BatchedMesh doesn't render wireframe mode correctly
Description
BatchedMesh doesn't render wireframe mode correctly.
Reproduction steps
- Create a
BatchedMeshwith anyMaterialwithwireframeset to true. - Look at the results.
Code
const box = new THREE.BoxGeometry();
const sphere = new THREE.SphereGeometry();
const material = new THREE.MeshBasicMaterial( { wireframe: true } );
const batchedMesh = new THREE.BatchedMesh( 10, 5000, 10000, material );
const boxGeometryId = batchedMesh.addGeometry( box );
const boxInstancedId1 = batchedMesh.addInstance( boxGeometryId );
batchedMesh.setMatrixAt( boxInstancedId1, new THREE.Matrix4());
scene.add( batchedMesh );
Live example
https://jsfiddle.net/hamuyrodrigo/w9vhs7rp/62/
Screenshots
Example: 2 spheres and 2 boxes.
With wireframe turned on.
With wireframe turned off.
Version
r167
Device
Desktop, Mobile
Browser
Chrome
OS
MacOS, Android
When using the wireframe: true flag, the engine internally creates special line geometry data and alters the render mode from triangles to lines.
This approach works for normal meshes but is incompatible with BatchedMesh right now.
Since a new index buffer is created for the sake of drawing edges rather than triangles - the batched mesh "multi draw starts" and "multi draw counts" buffers (see here) need to be adjusted for the new primitive stride and buffer before upload.