Skip to content

Commit bd7d3fb

Browse files
committed
Added GeometryUtils.removeMaterials
This allows to work around removed CubeGeometry sides functionality.
1 parent b11e457 commit bd7d3fb

File tree

3 files changed

+65
-18
lines changed

3 files changed

+65
-18
lines changed

build/three.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23003,6 +23003,29 @@ THREE.GeometryUtils = {
2300323003

2300423004
},
2300523005

23006+
removeMaterials: function ( geometry, materialIndexArray ) {
23007+
23008+
var materialIndexMap = {};
23009+
23010+
for ( var i = 0, il = materialIndexArray.length; i < il; i ++ ) {
23011+
23012+
materialIndexMap[ materialIndexArray[i] ] = true;
23013+
23014+
}
23015+
23016+
var face, newFaces = [];
23017+
23018+
for ( var i = 0, il = geometry.faces.length; i < il; i ++ ) {
23019+
23020+
face = geometry.faces[ i ];
23021+
if ( ! ( face.materialIndex in materialIndexMap ) ) newFaces.push( face );
23022+
23023+
}
23024+
23025+
geometry.faces = newFaces;
23026+
23027+
},
23028+
2300623029
// Get random point in triangle (via barycentric coordinates)
2300723030
// (uniform distribution)
2300823031
// http://www.cgafaq.info/wiki/Random_Point_In_Triangle

0 commit comments

Comments
 (0)