()
| 6 | import SceneInit from './lib/SceneInit'; |
| 7 | |
| 8 | function App() { |
| 9 | useEffect(() => { |
| 10 | const test = new SceneInit('myThreeJsCanvas'); |
| 11 | test.initialize(); |
| 12 | test.animate(); |
| 13 | |
| 14 | // inital scene |
| 15 | // const boxGeometry = new THREE.BoxGeometry(2, 2, 2); |
| 16 | // const boxMaterial = new THREE.MeshNormalMaterial(); |
| 17 | // const boxMesh = new THREE.Mesh(boxGeometry, boxMaterial); |
| 18 | // test.scene.add(boxMesh); |
| 19 | |
| 20 | const addNewBoxMesh = (x, y, z) => { |
| 21 | const boxGeometry = new THREE.BoxGeometry(1, 1, 1); |
| 22 | const boxMaterial = new THREE.MeshPhongMaterial({ |
| 23 | color: 0xfafafa, |
| 24 | }); |
| 25 | const boxMesh = new THREE.Mesh(boxGeometry, boxMaterial); |
| 26 | boxMesh.position.set(x, y, z); |
| 27 | test.scene.add(boxMesh); |
| 28 | }; |
| 29 | |
| 30 | // top rows |
| 31 | addNewBoxMesh(0, 2, 0); |
| 32 | addNewBoxMesh(2, 2, 0); |
| 33 | addNewBoxMesh(-2, 2, 0); |
| 34 | addNewBoxMesh(0, 2, -2); |
| 35 | addNewBoxMesh(2, 2, -2); |
| 36 | addNewBoxMesh(-2, 2, -2); |
| 37 | addNewBoxMesh(0, 2, 2); |
| 38 | addNewBoxMesh(2, 2, 2); |
| 39 | addNewBoxMesh(-2, 2, 2); |
| 40 | |
| 41 | // middle rows |
| 42 | addNewBoxMesh(0, 0, 0); |
| 43 | addNewBoxMesh(2, 0, 0); |
| 44 | addNewBoxMesh(-2, 0, 0); |
| 45 | addNewBoxMesh(0, 0, -2); |
| 46 | addNewBoxMesh(2, 0, -2); |
| 47 | addNewBoxMesh(-2, 0, -2); |
| 48 | addNewBoxMesh(0, 0, 2); |
| 49 | addNewBoxMesh(2, 0, 2); |
| 50 | addNewBoxMesh(-2, 0, 2); |
| 51 | |
| 52 | // bottom rows |
| 53 | addNewBoxMesh(0, -2, 0); |
| 54 | addNewBoxMesh(2, -2, 0); |
| 55 | addNewBoxMesh(-2, -2, 0); |
| 56 | addNewBoxMesh(0, -2, -2); |
| 57 | addNewBoxMesh(2, -2, -2); |
| 58 | addNewBoxMesh(-2, -2, -2); |
| 59 | addNewBoxMesh(0, -2, 2); |
| 60 | addNewBoxMesh(2, -2, 2); |
| 61 | addNewBoxMesh(-2, -2, 2); |
| 62 | |
| 63 | // add shiba model |
| 64 | const glftLoader = new GLTFLoader(); |
| 65 | glftLoader.load('./assets/shiba/scene.gltf', (gltfScene) => { |
nothing calls this directly
no test coverage detected