mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-11-15 02:27:56 +01:00
update export material
export material now has side property so we can differentiate between open and closed shapes
This commit is contained in:
parent
162016bbc9
commit
c31115aa0b
@ -101,11 +101,16 @@ export function generateExportMesh(state, options = {}) {
|
|||||||
objectGeometry.mergeVertices();
|
objectGeometry.mergeVertices();
|
||||||
objectGeometry.applyMatrix(new THREE.Matrix4().multiplyMatrices(objectMatrix, matrix));
|
objectGeometry.applyMatrix(new THREE.Matrix4().multiplyMatrices(objectMatrix, matrix));
|
||||||
|
|
||||||
const colorHex = material.color.getHex();
|
const color = material.color.getHex();
|
||||||
let materialIndex = materials.findIndex(exportMaterial => exportMaterial.color.getHex() === colorHex);
|
const side = shapeData.fill ? THREE.FrontSide : THREE.DoubleSide;
|
||||||
|
let materialIndex = materials.findIndex(exportMaterial => {
|
||||||
|
return exportMaterial.color.getHex() === color && exportMaterial.side === side;
|
||||||
|
});
|
||||||
if (materialIndex === -1) {
|
if (materialIndex === -1) {
|
||||||
materialIndex = materials.length;
|
materialIndex = materials.length;
|
||||||
materials.push(material);
|
const exportMaterial = new THREE.MeshBasicMaterial({ color });
|
||||||
|
exportMaterial.side = side;
|
||||||
|
materials.push(exportMaterial);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unionGeometry) {
|
if (unionGeometry) {
|
||||||
|
Loading…
Reference in New Issue
Block a user