diff --git a/examples/test.ts b/examples/test.ts index 1fb628b..f53f2cc 100644 --- a/examples/test.ts +++ b/examples/test.ts @@ -18,20 +18,20 @@ main.createView({ } }); -const instancedMesh = new InstancedMesh2(new BoxGeometry(), new MeshNormalMaterial(), { capacity: undefined }); +const instancedMesh = new InstancedMesh2(new BoxGeometry(), new MeshNormalMaterial()); // capacity is optional instancedMesh.on('click', (e) => instancedMesh.setVisibilityAt(e.intersection.instanceId, false)); scene.add(instancedMesh); scene.on('animate', () => { - if (instancedMesh.instancesCount >= 1000000) return; + if (instancedMesh.instancesCount >= 10000000) return; instancedMesh.addInstances(625, (obj, index) => { - obj.position.randomDirection().multiplyScalar(Math.random() * 100000 + 200); + obj.position.randomDirection().multiplyScalar(Math.random() * 1000000 + 200); obj.scale.random().multiplyScalar(Math.random() * 5 + 1); obj.quaternion.random(); }); - if (instancedMesh.instancesCount === 625) { // FIX + if (instancedMesh.instancesCount === 625) { instancedMesh.computeBVH({ getBBoxFromBSphere: true }); // fix if count is 0 } }); diff --git a/index.html b/index.html index a837ee9..b34436b 100644 --- a/index.html +++ b/index.html @@ -31,7 +31,7 @@
- +