Skip to content

Commit

Permalink
Neptunium website
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-tanner committed Feb 15, 2024
0 parents commit 93197e6
Show file tree
Hide file tree
Showing 11 changed files with 108,556 additions and 0 deletions.
37 changes: 37 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Neptunium</title>
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap"
rel="stylesheet"
/>
<link rel="icon" href="neptunium.svg" sizes="any" type="image/svg+xml">
</head>
<body>
<img id="logo" src="neptunium-inverted.svg" alt="Logo" />
<button id="resetButton">📷</button>
<div id="links" >
<a href="https://github.com/peter-tanner">GitHub</a> |
<a href="https://uwaaero.space">UWA Aerospace</a> | 2024
</div>
<div id="loadingOverlay">
<div id="loadingSpinner"></div>
</div>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/[email protected]/build/three.module.js",
"three/addons/": "https://unpkg.com/[email protected]/examples/jsm/"
}
}
</script>
<script type="module" src="main.js" ></script>
</script>
</body>
</html>
92 changes: 92 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import * as THREE from "three";
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
import { DRACOLoader } from "three/addons/loaders/DRACOLoader.js";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";

var scene, camera, renderer, controls;
var model;

init();
animate();

function init() {
showLoadingOverlay();
scene = new THREE.Scene();

camera = new THREE.PerspectiveCamera(
60,
window.innerWidth / window.innerHeight,
0.1,
1000
);
camera.position.z = -10.5 * Math.SQRT1_2;
camera.position.x = 10.5 * Math.SQRT1_2;

renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

var loader = new GLTFLoader();
var dracoLoader = new DRACOLoader();
dracoLoader.setDecoderConfig({ type: "js" });
dracoLoader.setDecoderPath("https://www.gstatic.com/draco/v1/decoders/");
loader.setDRACOLoader(dracoLoader);

loader.load("neptunium_web.draco.gltf", function (gltf) {
model = gltf.scene;
model.position.set(0, 0.25, 0);
// model.rotateY(Math.PI);
// model.rotateX(Math.PI);
model.rotateZ(-Math.PI / 2);
model.scale.set(100, 100, 100);
scene.add(model);
hideLoadingOverlay();
});

var global_illumination = new THREE.AmbientLight(0xffffff, 1);
scene.add(global_illumination);

controls = new OrbitControls(camera, renderer.domElement);
controls.autoRotate = true;
controls.autoRotateSpeed = 2;

renderer.setClearColor(0x000000, 1);
window.addEventListener("resize", onWindowResize, false);
document.addEventListener(
"mousedown",
() => (controls.autoRotate = false),
false
);
document.addEventListener(
"mouseup",
() => (controls.autoRotate = true),
false
);
document
.getElementById("resetButton")
.addEventListener("click", () => controls.reset());
}

function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
}

function animate() {
requestAnimationFrame(animate);
controls.update();
renderer.render(scene, camera);
}

function showLoadingOverlay() {
document.getElementById("loadingOverlay").style.display = "flex";
}

function hideLoadingOverlay() {
document.getElementById("loadingOverlay").classList.add("fade-out");

setTimeout(() => {
document.getElementById("loadingOverlay").style.display = "none";
}, 1000);
}
284 changes: 284 additions & 0 deletions neptunium-inverted.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
272 changes: 272 additions & 0 deletions neptunium.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 93197e6

Please sign in to comment.