I have 2 geometries and 2 meshes. Main goal is sometimes exclude part of first geometry (so I need 2 groups for that) and show in this time part of 2nd geometry (always 1 g
BufferGeometry.groups
is now used to support MultiMaterial
( formerly MeshFaceMaterial ).
geometry.clearGroups();
geometry.addGroup( start1, count1, 0 ); // materialIndex 0
geometry.addGroup( start2, count2, 1 ); // materialIndex 1
var material = new THREE.MultiMaterial( materialsArray );
var mesh = new THREE.Mesh( geometry, material );
If you have a single material and want to render sub-groups of faces, you can use a pattern like so:
geometry.clearGroups();
geometry.addGroup( start1, count1, 0 ); // zero
geometry.addGroup( start2, count2, 0 ); // zero
var materialsArray = [ material ];
var material = new THREE.MultiMaterial( materialsArray );
var mesh = new THREE.Mesh( geometry, material );
geometry.drawRange
is ignored when the material is MultiMaterial
.
three.js r.72