feat: load 3d nds model

This commit is contained in:
2025-12-13 15:55:38 +01:00
parent a5dba4b652
commit 69abfd8aca
17 changed files with 1736 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
Model Information:
* title: Nintendo DS
* source: https://sketchfab.com/3d-models/nintendo-ds-934fdde060874d5c99b40cdf1dbb37f2
* author: solal.sblt (https://sketchfab.com/Solal.Sebillotte)
Model License:
* license type: CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)
* requirements: Author must be credited. Commercial use is allowed.
If you use this 3D model in your project be sure to copy paste this credit wherever you share it:
This work is based on "Nintendo DS" (https://sketchfab.com/3d-models/nintendo-ds-934fdde060874d5c99b40cdf1dbb37f2) by solal.sblt (https://sketchfab.com/Solal.Sebillotte) licensed under CC-BY-4.0 (http://creativecommons.org/licenses/by/4.0/)

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

@@ -1,11 +1,13 @@
import "./style.css"; import "./style.css";
import * as THREE from "three"; import * as THREE from "three";
import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
import { OrbitControls } from "three/addons/controls/OrbitControls.js"; import { OrbitControls } from "three/addons/controls/OrbitControls.js";
const scene = new THREE.Scene(); const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, 0, 0.001, 1000); const camera = new THREE.PerspectiveCamera(75, 0, 0.001, 1000);
const renderer = new THREE.WebGLRenderer(); const renderer = new THREE.WebGLRenderer();
renderer.setClearColor(0xffffff);
const controls = new OrbitControls(camera, renderer.domElement); const controls = new OrbitControls(camera, renderer.domElement);
@@ -14,15 +16,30 @@ const handleResize = () => {
camera.updateProjectionMatrix(); camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight); renderer.setSize(window.innerWidth, window.innerHeight);
} };
window.addEventListener("resize", handleResize, false); window.addEventListener("resize", handleResize, false);
handleResize(); handleResize();
// load nds model
const loader = new GLTFLoader();
const nds = await loader.loadAsync("/nintendo-ds/scene.gltf");
nds.scene.scale.set(50, 50, 50);
scene.add(nds.scene);
// create light
const color = 0xffffff;
const intensity = 3;
const ambient = new THREE.AmbientLight(color, intensity);
scene.add(ambient);
const directional = new THREE.DirectionalLight(color, intensity);
directional.target = nds.scene;
directional.position.set(0, 100, 0);
scene.add(directional);
renderer.setAnimationLoop(() => { renderer.setAnimationLoop(() => {
controls.update(); controls.update();
renderer.render(scene, camera); renderer.render(scene, camera);
}); });