-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 93197e6
Showing
11 changed files
with
108,556 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.