|
|
@ -47,7 +47,7 @@ import { randFloat } from 'three/src/math/MathUtils.js'; |
|
|
|
const cubeMaterial = new THREE.MeshPhongMaterial({ map: texture }); |
|
|
|
|
|
|
|
// Create an InstancedMesh
|
|
|
|
count = 100; |
|
|
|
count = 80; |
|
|
|
instancedMesh = new THREE.InstancedMesh(cubeGeometry, cubeMaterial, count); |
|
|
|
scene.add(instancedMesh) |
|
|
|
dummy = new THREE.Object3D(); |
|
|
@ -55,7 +55,7 @@ import { randFloat } from 'three/src/math/MathUtils.js'; |
|
|
|
for (let i = 0; i < count; i++) { |
|
|
|
let size = randFloat(5, 8); |
|
|
|
dummy.scale.set(size, size, size); |
|
|
|
dummy.position.set(randFloat(-10, 10), randFloat(-6, 3), 0); |
|
|
|
dummy.position.set(randFloat(-10, 10), randFloat(-8, 8), 0); |
|
|
|
dummy.updateMatrix(); |
|
|
|
instancedMesh.setMatrixAt(i, dummy.matrix); |
|
|
|
} |
|
|
|