Skip to content

Commit 2bdd447

Browse files
committed
feat: force ifc spaces to be transparent by default
1 parent 3773c22 commit 2bdd447

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

packages/fragments/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thatopen/fragments",
33
"description": "Simple geometric system built on top of Three.js to display 3D BIM data efficiently.",
4-
"version": "3.2.5",
4+
"version": "3.2.6",
55
"author": "That Open Company",
66
"contributors": [
77
"Antonio Gonzalez Viegas (https://github.com/agviegas)",

packages/fragments/src/Importers/IfcImporter/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ export class IfcImporter {
5959
* Precision of the plane constants for coplanarity when computing breps.
6060
*/
6161
planePrecision: 1000,
62+
/*
63+
* Whether to force ifc spaces to be transparent.
64+
*/
65+
forceTransparentSpaces: true,
6266
};
6367

6468
/**

packages/fragments/src/Importers/IfcImporter/src/geometry/ifc-file-reader.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ export class IfcFileReader {
156156

157157
const tempPosition = new THREE.Vector3();
158158

159+
let currentCategory: number | null = null;
160+
159161
const callback = (mesh: WEBIFC.FlatMesh) => {
160162
if (this._ifcAPI === null) {
161163
throw new Error("Fragments: IfcAPI not initialized");
@@ -218,6 +220,7 @@ export class IfcFileReader {
218220
mesh,
219221
i,
220222
transformWithoutScale.elements,
223+
currentCategory,
221224
);
222225
}
223226
}
@@ -266,6 +269,9 @@ export class IfcFileReader {
266269
if (index + 1 === toProcess.length) return "finish";
267270
return "inProgress";
268271
})();
272+
273+
currentCategory = category;
274+
269275
const idsVector = this._ifcAPI.GetLineIDsWithType(modelID, category);
270276
const ids: number[] = [];
271277
for (let i = 0; i < idsVector.size(); i++) {
@@ -530,6 +536,7 @@ export class IfcFileReader {
530536
mesh: WEBIFC.FlatMesh,
531537
geometryIndex: number,
532538
elementTransform: number[],
539+
category: number | null,
533540
) {
534541
if (this._ifcAPI === null) {
535542
throw new Error("Fragments: IfcAPI not initialized");
@@ -550,7 +557,16 @@ export class IfcFileReader {
550557
return;
551558
}
552559

553-
const { x, y, z, w } = geometryRef.color;
560+
const { x, y, z } = geometryRef.color;
561+
let w = geometryRef.color.w;
562+
563+
if (
564+
this._serializer.geometryProcessSettings.forceTransparentSpaces &&
565+
category === WEBIFC.IFCSPACE &&
566+
w === 1
567+
) {
568+
w = 0.5;
569+
}
554570

555571
const geometryData: IfcGeometryInstance = {
556572
id: geometryRef.geometryExpressID,

resources/worker.mjs

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)