-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Description
Description
When i try to add a mesh generated from ExtrudeGeometry this will cause an error
Uncaught TypeError: reference.getIndex is not a function (in jsfiddle)
using the code -> TypeError: t.getIndex is not a function
Reproduction steps
Create a mesh from a ExtrudeGeometry and add it to a BatchedMesh
Code
function addBatchedMesh() {
const material = new THREE.MeshBasicMaterial( );
// initialize and add geometries into the batched mesh
const batchedMesh = new THREE.BatchedMesh( 10, 5000, 10000, material );
const length = 12, width = 8;
const shape = new THREE.Shape();
shape.moveTo( 0,0 );
shape.lineTo( 0, width );
shape.lineTo( length, width );
shape.lineTo( length, 0 );
shape.lineTo( 0, 0 );
const extrudeSettings = {
steps: 2,
depth: 16,
bevelEnabled: true,
bevelThickness: 1,
bevelSize: 1,
bevelOffset: 0,
bevelSegments: 1
};
const extrudeGeometry = new THREE.ExtrudeGeometry( shape, extrudeSettings );
const extrudeMesh = new THREE.Mesh( extrudeGeometry, material ) ;
const extrudeGeometryId = batchedMesh.addGeometry( extrudeMesh );
// create instances of those geometries
const extrudeInstancedId = batchedMesh.addInstance( extrudeGeometryId );
// position the geometries
batchedMesh.setMatrixAt( extrudeGeometryId, new THREE.Matrix4().setPosition(2,0,0) );
scene.add( batchedMesh );
}
Live example
https://jsfiddle.net/Maddog_Eddy/z2c0p1b7/17
Screenshots
No response
Version
r170
Device
Desktop
Browser
Chrome
OS
Windows