mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-11-16 02:57:56 +01:00
each part has it's own material
This commit is contained in:
parent
65592d6f48
commit
01f4b4c1f8
@ -98,18 +98,11 @@ export function generateExportMesh(state, options = {}) {
|
||||
objectGeometry.mergeVertices();
|
||||
objectGeometry.applyMatrix(new THREE.Matrix4().multiplyMatrices(objectMatrix, matrix));
|
||||
|
||||
const color = material.color.getHex();
|
||||
const side = shapeData.fill ? THREE.FrontSide : THREE.DoubleSide;
|
||||
let materialIndex = materials.findIndex(exportMaterial => {
|
||||
return exportMaterial.color.getHex() === color && exportMaterial.side === side;
|
||||
});
|
||||
if (materialIndex === -1) {
|
||||
materialIndex = materials.length;
|
||||
const exportMaterial = new THREE.MeshBasicMaterial({ color });
|
||||
exportMaterial.side = side;
|
||||
const exportMaterial = new THREE.MeshBasicMaterial({ color: material.color.getHex() });
|
||||
exportMaterial.side = shapeData.fill ? THREE.FrontSide : THREE.DoubleSide;
|
||||
materials.push(exportMaterial);
|
||||
}
|
||||
|
||||
const materialIndex = materials.length;
|
||||
if (unionGeometry) {
|
||||
objectGeometry = new THREE_BSP(objectGeometry, materialIndex);
|
||||
if (exportGeometry) {
|
||||
|
Loading…
Reference in New Issue
Block a user