Update occt-import-js.

This commit is contained in:
kovacsv 2023-04-15 07:54:59 +02:00
parent 029fb13324
commit 142d71efb6
5 changed files with 19 additions and 17 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

14
package-lock.json generated
View File

@ -13,7 +13,7 @@
"@types/node": "^18.11.18",
"draco3d": "1.5.6",
"fflate": "0.7.4",
"occt-import-js": "0.0.17",
"occt-import-js": "0.0.18",
"rhino3dm": "8.0.0",
"three": "0.150.1",
"web-ifc": "0.0.35"
@ -4161,9 +4161,9 @@
}
},
"node_modules/occt-import-js": {
"version": "0.0.17",
"resolved": "https://registry.npmjs.org/occt-import-js/-/occt-import-js-0.0.17.tgz",
"integrity": "sha512-XUeE5+mopS8LP69MxlwBuB3Pc/4Se03N7b+eZlHX3ubzIy9gE/pbSDgV6U8HbcY9YSRLmjtbCPrDnkiCXAT+vA=="
"version": "0.0.18",
"resolved": "https://registry.npmjs.org/occt-import-js/-/occt-import-js-0.0.18.tgz",
"integrity": "sha512-6ddYLyiY6aOVLhJB3DB1Cpp9W339qJ5fSB3zGs4N+wA9V4wBxxP1xtBFh+hfxWi7x5DzH0ls4dOtbM1aRQuh9Q=="
},
"node_modules/omggif": {
"version": "1.0.10",
@ -8730,9 +8730,9 @@
"dev": true
},
"occt-import-js": {
"version": "0.0.17",
"resolved": "https://registry.npmjs.org/occt-import-js/-/occt-import-js-0.0.17.tgz",
"integrity": "sha512-XUeE5+mopS8LP69MxlwBuB3Pc/4Se03N7b+eZlHX3ubzIy9gE/pbSDgV6U8HbcY9YSRLmjtbCPrDnkiCXAT+vA=="
"version": "0.0.18",
"resolved": "https://registry.npmjs.org/occt-import-js/-/occt-import-js-0.0.18.tgz",
"integrity": "sha512-6ddYLyiY6aOVLhJB3DB1Cpp9W339qJ5fSB3zGs4N+wA9V4wBxxP1xtBFh+hfxWi7x5DzH0ls4dOtbM1aRQuh9Q=="
},
"omggif": {
"version": "1.0.10",

View File

@ -78,7 +78,7 @@
"@types/node": "^18.11.18",
"draco3d": "1.5.6",
"fflate": "0.7.4",
"occt-import-js": "0.0.17",
"occt-import-js": "0.0.18",
"rhino3dm": "8.0.0",
"three": "0.150.1",
"web-ifc": "0.0.35"

View File

@ -108,16 +108,18 @@ export class ImporterOcct extends ImporterBase
if (occtMesh.name) {
mesh.SetName (occtMesh.name);
}
if (occtMesh.face_colors) {
for (let faceColorGroup of occtMesh.face_colors) {
let faceColor = RGBColorFromFloatComponents (faceColorGroup.color[0], faceColorGroup.color[1], faceColorGroup.color[2]);
let faceMaterialIndex = colorToMaterial.GetMaterialIndex (faceColor.r, faceColor.g, faceColor.b, null);
for (let i = faceColorGroup.first; i <= faceColorGroup.last; i++) {
let triangle = mesh.GetTriangle (i);
triangle.SetMaterial (faceMaterialIndex);
}
for (let brepFace of occtMesh.brep_faces) {
if (brepFace.color === null) {
continue;
}
let faceColor = RGBColorFromFloatComponents (brepFace.color[0], brepFace.color[1], brepFace.color[2]);
let faceMaterialIndex = colorToMaterial.GetMaterialIndex (faceColor.r, faceColor.g, faceColor.b, null);
for (let i = brepFace.first; i <= brepFace.last; i++) {
let triangle = mesh.GetTriangle (i);
triangle.SetMaterial (faceMaterialIndex);
}
}
return mesh;
}
}