We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 142144a commit 2cb9218Copy full SHA for 2cb9218
examples/webgl_clipping_advanced.html
@@ -208,18 +208,20 @@
208
clipShadows: true
209
} );
210
211
- object = new THREE.Group();
212
-
+ const count = 5 * 5 * 5;
213
const geometry = new THREE.BoxGeometry( 0.18, 0.18, 0.18 );
+ object = new THREE.InstancedMesh( geometry, clipMaterial, count );
214
+ object.castShadow = true;
215
+
216
+ let i = 0;
217
+ const matrix = new THREE.Matrix4();
218
219
for ( let z = - 2; z <= 2; ++ z )
220
for ( let y = - 2; y <= 2; ++ y )
221
for ( let x = - 2; x <= 2; ++ x ) {
222
- const mesh = new THREE.Mesh( geometry, clipMaterial );
- mesh.position.set( x / 5, y / 5, z / 5 );
- mesh.castShadow = true;
- object.add( mesh );
223
+ matrix.setPosition( x / 5, y / 5, z / 5 );
224
+ object.setMatrixAt( i ++, matrix );
225
226
}
227
0 commit comments