diff --git a/src/instanced-mesh.js b/src/instanced-mesh.js index 5ba6b96..a894793 100644 --- a/src/instanced-mesh.js +++ b/src/instanced-mesh.js @@ -184,13 +184,16 @@ AFRAME.registerComponent('instanced-mesh', { this.componentOriginalColors = []; this.meshNodes.forEach((node, index) => { - var instancedMesh = new THREE.InstancedMesh(node.geometry, - node.material, - this.data.capacity); + const instancedMesh = new THREE.InstancedMesh(node.geometry, + node.material, + this.data.capacity); + // mesh doesn't have any members yet + instancedMesh.count = 0 // For each instanced mesh required, we store off both the instanced mesh // itself. and the transform matrix for the component of the model that // it represents. + this.instancedMeshes.push(instancedMesh) this.componentMatrices.push(node.matrixWorld) this.componentMaterialIndices.push(node.materialIndex) diff --git a/tests/empty-instanced-mesh.html b/tests/empty-instanced-mesh.html new file mode 100644 index 0000000..5f13ace --- /dev/null +++ b/tests/empty-instanced-mesh.html @@ -0,0 +1,30 @@ + +
+ + + + + + + + + + view code + +