Skip to content

Commit 01f4b4c

Browse files
committed
each part has it's own material
1 parent 65592d6 commit 01f4b4c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/utils/exportUtils.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,11 @@ export function generateExportMesh(state, options = {}) {
9898
objectGeometry.mergeVertices();
9999
objectGeometry.applyMatrix(new THREE.Matrix4().multiplyMatrices(objectMatrix, matrix));
100100

101-
const color = material.color.getHex();
102-
const side = shapeData.fill ? THREE.FrontSide : THREE.DoubleSide;
103-
let materialIndex = materials.findIndex(exportMaterial => {
104-
return exportMaterial.color.getHex() === color && exportMaterial.side === side;
105-
});
106-
if (materialIndex === -1) {
107-
materialIndex = materials.length;
108-
const exportMaterial = new THREE.MeshBasicMaterial({ color });
109-
exportMaterial.side = side;
110-
materials.push(exportMaterial);
111-
}
101+
const exportMaterial = new THREE.MeshBasicMaterial({ color: material.color.getHex() });
102+
exportMaterial.side = shapeData.fill ? THREE.FrontSide : THREE.DoubleSide;
103+
materials.push(exportMaterial);
112104

105+
const materialIndex = materials.length;
113106
if (unionGeometry) {
114107
objectGeometry = new THREE_BSP(objectGeometry, materialIndex);
115108
if (exportGeometry) {

0 commit comments

Comments
 (0)