Hey there! does anyone knows what algorithm use three.js to merge objects?
It’s not really a specific algorithm, so much as just adding one group of triangles to another. Three.js does not do Constructive Solid Geometry (CSG) or boolean operations, for example.
Here is the code:
mergeBufferGeometries: function ( geometries, useGroups ) {
var isIndexed = geometries[ 0 ].index !== null;
var attributesUsed = new Set( Object.keys( geometries[ 0 ].attributes ) );
var morphAttributesUsed = new Set( Object.keys( geometries[ 0 ].morphAttributes ) );
var attributes = {};
var morphAttributes = {};
var mergedGeometry = new THREE.BufferGeometry();
var offset = 0;
for ( var i = 0; i < geometries.length; ++ i ) {
var geometry = geometries[ i ];
// ensure that all geometries are indexed, or none
This file has been truncated. show original
2 Likes