()
| 9 | import SceneInit from './lib/SceneInit'; |
| 10 | |
| 11 | function App() { |
| 12 | useEffect(() => { |
| 13 | const test = new SceneInit('myThreeJsCanvas'); |
| 14 | test.initialize(); |
| 15 | test.animate(); |
| 16 | |
| 17 | // const boxGeometry = new THREE.BoxGeometry(8, 8, 8); |
| 18 | // const boxMaterial = new THREE.MeshNormalMaterial(); |
| 19 | // const boxMesh = new THREE.Mesh(boxGeometry, boxMaterial); |
| 20 | // test.scene.add(boxMesh); |
| 21 | |
| 22 | let loadedModel; |
| 23 | const glftLoader = new GLTFLoader(); |
| 24 | glftLoader.load('./assets/shiba/scene.gltf', (gltfScene) => { |
| 25 | loadedModel = gltfScene; |
| 26 | // console.log(loadedModel); |
| 27 | |
| 28 | gltfScene.scene.rotation.y = Math.PI / 8; |
| 29 | gltfScene.scene.position.y = 3; |
| 30 | gltfScene.scene.scale.set(10, 10, 10); |
| 31 | test.scene.add(gltfScene.scene); |
| 32 | }); |
| 33 | |
| 34 | const animate = () => { |
| 35 | if (loadedModel) { |
| 36 | loadedModel.scene.rotation.x += 0.01; |
| 37 | loadedModel.scene.rotation.y += 0.01; |
| 38 | loadedModel.scene.rotation.z += 0.01; |
| 39 | } |
| 40 | requestAnimationFrame(animate); |
| 41 | }; |
| 42 | animate(); |
| 43 | }, []); |
| 44 | |
| 45 | return ( |
| 46 | <div> |
| 47 | <canvas id="myThreeJsCanvas" /> |
| 48 | </div> |
| 49 | ); |
| 50 | } |
| 51 | |
| 52 | export default App; |
nothing calls this directly
no test coverage detected