Browse Source

InstancedMesh: use renderable instanceMatrix default (#24749)

* InstancedMesh: use renderable instanceMatrix default

* InstancedMesh: lint
Cody Bennett 2 years ago
parent
commit
2f5a5e131f
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/objects/InstancedMesh.js

+ 7 - 0
src/objects/InstancedMesh.js

@@ -7,6 +7,7 @@ const _instanceWorldMatrix = /*@__PURE__*/ new Matrix4();
 
 
 const _instanceIntersects = [];
 const _instanceIntersects = [];
 
 
+const _identity = /*@__PURE__*/ new Matrix4();
 const _mesh = /*@__PURE__*/ new Mesh();
 const _mesh = /*@__PURE__*/ new Mesh();
 
 
 class InstancedMesh extends Mesh {
 class InstancedMesh extends Mesh {
@@ -24,6 +25,12 @@ class InstancedMesh extends Mesh {
 
 
 		this.frustumCulled = false;
 		this.frustumCulled = false;
 
 
+		for ( let i = 0; i < count; i ++ ) {
+
+			this.setMatrixAt( i, _identity );
+
+		}
+
 	}
 	}
 
 
 	copy( source, recursive ) {
 	copy( source, recursive ) {