I know there is the grouping method:
...
//after loading cube models
const group = new THREE.Group();
group.add( cube1 );
group.add( cube2 );
group.add( cube3 );
scene.add( group ); //This gives me 3 calls when rendering
but this doesn’t affect performance, it’s just to make things synthetically more clear.
I would like to merge cube1
, cube2
, & cube3
into a single object to reduce the number of calls in the scene
import { BufferGeometryUtils } from '../jsm/BufferGeometryUtils.js'; //gives error: BufferGeometryUtils.js doesn't export BufferGeometryUtils
var geometries = [];
geometries.push( cube1 );
geometries.push( cube2 );
geometries.push( cube3 );
const cubes = BufferGeometryUtils.mergeBufferGeometries( geometries );//doesn't work (outdated?)
scene.add( cubes );
I’ve followed some tutorials on BufferGeometryUtils
, but they seem outdated since BufferGeometryUtils.js
doesn’t export a BufferGeometryUtils
constructor