@bldrs-ai/conway 0.18.886 → 0.18.902
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/examples/browser-bundled.js +4 -4
- package/compiled/examples/validator-bundled.js +4 -4
- package/compiled/src/core/entity_description.d.ts +1 -1
- package/compiled/src/core/i_local_id_set.d.ts +27 -0
- package/compiled/src/core/i_local_id_set.d.ts.map +1 -0
- package/compiled/src/core/i_local_id_set.js +1 -0
- package/compiled/src/ifc/ifc_command_line_main.js +17 -3
- package/compiled/src/ifc/ifc_geometry_extraction.d.ts +15 -5
- package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
- package/compiled/src/ifc/ifc_geometry_extraction.js +240 -228
- package/compiled/src/indexing/dynamic_single_index_set.d.ts +2 -1
- package/compiled/src/indexing/dynamic_single_index_set.d.ts.map +1 -1
- package/compiled/src/indexing/multi_index_set.d.ts +2 -2
- package/compiled/src/indexing/multi_index_set.d.ts.map +1 -1
- package/compiled/src/indexing/multi_index_set.js +3 -3
- package/compiled/src/indexing/multi_index_set_cursor_or.d.ts.map +1 -1
- package/compiled/src/indexing/search_operations.d.ts.map +1 -1
- package/compiled/src/indexing/single_index_set.d.ts +10 -3
- package/compiled/src/indexing/single_index_set.d.ts.map +1 -1
- package/compiled/src/indexing/single_index_set.js +19 -4
- package/compiled/src/indexing/single_index_set.test.js +12 -0
- package/compiled/src/loaders/conway_model_loader.d.ts +3 -1
- package/compiled/src/loaders/conway_model_loader.d.ts.map +1 -1
- package/compiled/src/loaders/conway_model_loader.js +4 -2
- package/compiled/src/rendering/threejs/scene_object.d.ts +19 -0
- package/compiled/src/rendering/threejs/scene_object.d.ts.map +1 -1
- package/compiled/src/rendering/threejs/scene_object.js +64 -10
- package/compiled/src/rendering/threejs/simple_viewer_scene.d.ts +34 -0
- package/compiled/src/rendering/threejs/simple_viewer_scene.d.ts.map +1 -1
- package/compiled/src/rendering/threejs/simple_viewer_scene.js +38 -6
- package/compiled/src/version/version.js +1 -1
- package/compiled/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single_index_set.d.ts","sourceRoot":"","sources":["../../../src/indexing/single_index_set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"single_index_set.d.ts","sourceRoot":"","sources":["../../../src/indexing/single_index_set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5D,OAAO,EAAe,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAYlE;;GAEG;AACH,qBAAa,cAAe,YAAW,qBAAqB;IAcxD,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAd5B;;;;;;;;;;OAUG;gBAEgB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,WAAW;IAGzC;;;;OAIG;IACH,IAAW,IAAI,IAAI,MAAM,CAcxB;IAED;;;;OAIG;IACH,IAAW,MAAM,IAAI,mBAAmB,CAEvC;IAED;;;;;OAKG;IACI,GAAG,CAAE,OAAO,EAAE,MAAM,GAAI,OAAO;IAItC;;;;OAIG;IACI,MAAM,IAAI,eAAe;IAMhC;;;;;OAKG;WACW,uBAAuB,CAAE,OAAO,EAAE,MAAM,GAAI,cAAc;IAgBxE;;;;;OAKG;WACW,kBAAkB,CAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,mBAAmB,GAAI,cAAc;CA0B7F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addCompactedElement32State, addCompactedElementCount32State, initCountCompactedElements32State } from "./bit_operations.js";
|
|
1
|
+
import { addCompactedElement32State, addCompactedElementCount32State, initCountCompactedElements32State, pop32 } from "./bit_operations.js";
|
|
2
2
|
import { indexSetPointQuery32 } from "./search_operations.js";
|
|
3
3
|
import { SingleIndexSetCursor } from "./single_index_set_cursor.js";
|
|
4
4
|
const localState = new Int32Array(2);
|
|
@@ -22,6 +22,21 @@ export class SingleIndexSet {
|
|
|
22
22
|
this.end_ = end_;
|
|
23
23
|
this.elements_ = elements_;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* The size of the set.
|
|
27
|
+
*
|
|
28
|
+
* @return {number} The size of the set.
|
|
29
|
+
*/
|
|
30
|
+
get size() {
|
|
31
|
+
const end = this.end_ << 1;
|
|
32
|
+
const start = this.start_;
|
|
33
|
+
const buffer = this.buffer;
|
|
34
|
+
let result = 0;
|
|
35
|
+
for (let where = start + 1; where < end; where += 2) {
|
|
36
|
+
result += pop32(buffer[where]);
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
25
40
|
/**
|
|
26
41
|
* Get the buffer elements from this (treat as immutable)
|
|
27
42
|
*
|
|
@@ -33,11 +48,11 @@ export class SingleIndexSet {
|
|
|
33
48
|
/**
|
|
34
49
|
* Does the set have a particular index for a particular type.
|
|
35
50
|
*
|
|
36
|
-
* @param
|
|
51
|
+
* @param localID The dense index in the set to check.
|
|
37
52
|
* @return {boolean} True if it has the type.
|
|
38
53
|
*/
|
|
39
|
-
has(
|
|
40
|
-
return indexSetPointQuery32(
|
|
54
|
+
has(localID) {
|
|
55
|
+
return indexSetPointQuery32(localID, this.elements_, this.start_, this.end_ << 1);
|
|
41
56
|
}
|
|
42
57
|
/**
|
|
43
58
|
* Get a cursor that lets you iterate over the items in this set.
|
|
@@ -42,8 +42,20 @@ function buildAndTestSingleSet() {
|
|
|
42
42
|
}
|
|
43
43
|
return true;
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Test the size property of a SingleIndexSet initialized with ID_SET.
|
|
47
|
+
*
|
|
48
|
+
* @return {boolean} True if the test passes.
|
|
49
|
+
*/
|
|
50
|
+
function testSizeProperty() {
|
|
51
|
+
const singleIndexSet = SingleIndexSet.createFromLocalIds(ID_SET);
|
|
52
|
+
return singleIndexSet.size === ID_SET.length;
|
|
53
|
+
}
|
|
45
54
|
describe("Single Index Set Test", () => {
|
|
46
55
|
test("buildAndTestSingleSet()", () => {
|
|
47
56
|
expect(buildAndTestSingleSet()).toBe(true);
|
|
48
57
|
});
|
|
58
|
+
test("testSizeProperty()", () => {
|
|
59
|
+
expect(testSizeProperty()).toBe(true);
|
|
60
|
+
});
|
|
49
61
|
});
|
|
@@ -10,10 +10,12 @@ export declare class ConwayModelLoader {
|
|
|
10
10
|
* Load a model using the format detector
|
|
11
11
|
*
|
|
12
12
|
* @param data The buffer to load from.
|
|
13
|
+
* @param limitCSGDepth Whether to limit CSG depth during geometry extraction.
|
|
14
|
+
* @param maximumCSGDepth The maximum CSG depth allowed during geometry extraction.
|
|
13
15
|
* @param modelID The model id to use for statistics (or 0 if none is provided)
|
|
14
16
|
* @return {Promise<[Model, Scene]>} A promise to return the loaded model and scene.
|
|
15
17
|
*/
|
|
16
|
-
static loadModelWithScene(data: Uint8Array, modelID?: number): Promise<[
|
|
18
|
+
static loadModelWithScene(data: Uint8Array, limitCSGDepth?: boolean, maximumCSGDepth?: number, modelID?: number): Promise<[
|
|
17
19
|
Model,
|
|
18
20
|
Scene
|
|
19
21
|
]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conway_model_loader.d.ts","sourceRoot":"","sources":["../../../src/loaders/conway_model_loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAcrC;;;;GAIG;AACH,qBAAa,iBAAiB;IAE5B
|
|
1
|
+
{"version":3,"file":"conway_model_loader.d.ts","sourceRoot":"","sources":["../../../src/loaders/conway_model_loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAcrC;;;;GAIG;AACH,qBAAa,iBAAiB;IAE5B;;;;;;;;OAQG;WACiB,kBAAkB,CAClC,IAAI,EAAE,UAAU,EAChB,aAAa,GAAE,OAAc,EAC7B,eAAe,GAAE,MAAW,EAC5B,OAAO,GAAE,MAAU,GAAI,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;CAsXnD"}
|
|
@@ -22,10 +22,12 @@ export class ConwayModelLoader {
|
|
|
22
22
|
* Load a model using the format detector
|
|
23
23
|
*
|
|
24
24
|
* @param data The buffer to load from.
|
|
25
|
+
* @param limitCSGDepth Whether to limit CSG depth during geometry extraction.
|
|
26
|
+
* @param maximumCSGDepth The maximum CSG depth allowed during geometry extraction.
|
|
25
27
|
* @param modelID The model id to use for statistics (or 0 if none is provided)
|
|
26
28
|
* @return {Promise<[Model, Scene]>} A promise to return the loaded model and scene.
|
|
27
29
|
*/
|
|
28
|
-
static async loadModelWithScene(data, modelID = 0) {
|
|
30
|
+
static async loadModelWithScene(data, limitCSGDepth = true, maximumCSGDepth = 20, modelID = 0) {
|
|
29
31
|
const allTimeStart = Date.now();
|
|
30
32
|
const modelFormat = ModelFormatDetector.detect(new ParsingBuffer(data));
|
|
31
33
|
switch (modelFormat) {
|
|
@@ -190,7 +192,7 @@ export class ConwayModelLoader {
|
|
|
190
192
|
if (model === void 0) {
|
|
191
193
|
throw Error("Unable to parse model");
|
|
192
194
|
}
|
|
193
|
-
const conwayModel = new IfcGeometryExtraction(conwayWasm, model);
|
|
195
|
+
const conwayModel = new IfcGeometryExtraction(conwayWasm, model, limitCSGDepth, maximumCSGDepth);
|
|
194
196
|
// parse + extract data model + geometry data
|
|
195
197
|
const startTime = Date.now();
|
|
196
198
|
const [extractionResult, scene] = conwayModel.extractIFCGeometryData();
|
|
@@ -1,13 +1,32 @@
|
|
|
1
1
|
import { Group, Vector3 } from "three";
|
|
2
2
|
import { Scene as ConwayScene } from "../../core/scene.js";
|
|
3
|
+
import { ILocalIdSet } from "../../core/i_local_id_set.js";
|
|
3
4
|
/**
|
|
4
5
|
* A three proxy for a conway scene of a model.
|
|
5
6
|
*/
|
|
6
7
|
export default class SceneObject extends Group {
|
|
7
8
|
readonly target: ConwayScene;
|
|
8
9
|
private readonly sink_;
|
|
10
|
+
/**
|
|
11
|
+
* Set the visibility set for the elements in this scene object.
|
|
12
|
+
* Note it is a set of of the local IDs of the related elements
|
|
13
|
+
* (i.e. IfcProducts) that are used to control visibility.
|
|
14
|
+
*
|
|
15
|
+
* @return {ILocalIdSet | Set< number > | null} The visibility set to use, or null for all items.
|
|
16
|
+
*/
|
|
17
|
+
get visibilitySet(): ILocalIdSet | Set<number> | null;
|
|
18
|
+
/**
|
|
19
|
+
* Set the visibility set for the elements in this scene object.
|
|
20
|
+
* Note it is a set of of the local IDs of the related elements
|
|
21
|
+
* (i.e. IfcProducts) that are used to control visibility.
|
|
22
|
+
*
|
|
23
|
+
* @param value The visibility set to use, or null for all items.
|
|
24
|
+
*/
|
|
25
|
+
set visibilitySet(value: ILocalIdSet | Set<number> | null);
|
|
9
26
|
/**
|
|
10
27
|
* Does this have instances that aren't spaces?
|
|
28
|
+
*
|
|
29
|
+
* @return {boolean} Does this have non spzces?
|
|
11
30
|
*/
|
|
12
31
|
get hasNonSpaces(): boolean;
|
|
13
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene_object.d.ts","sourceRoot":"","sources":["../../../../src/rendering/threejs/scene_object.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EAaL,OAAO,EACR,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,KAAK,IAAI,WAAW,EAAuC,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"scene_object.d.ts","sourceRoot":"","sources":["../../../../src/rendering/threejs/scene_object.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,EAaL,OAAO,EACR,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,KAAK,IAAI,WAAW,EAAuC,MAAM,kBAAkB,CAAA;AAM5F,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAUvD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK;aAiGf,MAAM,EAAG,WAAW;IA/FjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IAEtC;;;;;;OAMG;IACH,IAAW,aAAa,IAAI,WAAW,GAAG,GAAG,CAAE,MAAM,CAAE,GAAG,IAAI,CAE7D;IAED;;;;;;OAMG;IACH,IAAW,aAAa,CAAE,KAAK,EAAE,WAAW,GAAG,GAAG,CAAE,MAAM,CAAE,GAAG,IAAI,EAElE;IAED;;;;OAIG;IACH,IAAW,YAAY,IAAI,OAAO,CAGjC;IAED;;;;OAIG;IACH,IAAW,UAAU,IAAI,OAAO,CAG/B;IAED;;;;OAIG;IACH,IAAW,UAAU,CAAE,KAAK,EAAE,OAAO,EAGpC;IAED;;;;OAIG;IACH,IAAW,aAAa,IAAI,OAAO,CAGlC;IAED;;;;OAIG;IACH,IAAW,aAAa,CAAE,KAAK,EAAE,OAAO,EAGvC;IAED;;;;;;;;OAQG;IACH,IAAW,cAAc,IAAI,OAAO,CAGnC;IAED;;;;;;OAMG;gBAC0B,MAAM,EAAG,WAAW,EAAE,IAAI,GAAE,OAAc;IASvE;;OAEG;IACI,MAAM,IAAI,IAAI;IAKrB;;OAEG;IACI,OAAO,IAAI,IAAI;CAIvB"}
|
|
@@ -10,8 +10,30 @@ const eventListenerOptions = new SceneListenerOptions(true, false, true);
|
|
|
10
10
|
* A three proxy for a conway scene of a model.
|
|
11
11
|
*/
|
|
12
12
|
export default class SceneObject extends Group {
|
|
13
|
+
/**
|
|
14
|
+
* Set the visibility set for the elements in this scene object.
|
|
15
|
+
* Note it is a set of of the local IDs of the related elements
|
|
16
|
+
* (i.e. IfcProducts) that are used to control visibility.
|
|
17
|
+
*
|
|
18
|
+
* @return {ILocalIdSet | Set< number > | null} The visibility set to use, or null for all items.
|
|
19
|
+
*/
|
|
20
|
+
get visibilitySet() {
|
|
21
|
+
return this.sink_.visibilitySet;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Set the visibility set for the elements in this scene object.
|
|
25
|
+
* Note it is a set of of the local IDs of the related elements
|
|
26
|
+
* (i.e. IfcProducts) that are used to control visibility.
|
|
27
|
+
*
|
|
28
|
+
* @param value The visibility set to use, or null for all items.
|
|
29
|
+
*/
|
|
30
|
+
set visibilitySet(value) {
|
|
31
|
+
this.sink_.visibilitySet = value;
|
|
32
|
+
}
|
|
13
33
|
/**
|
|
14
34
|
* Does this have instances that aren't spaces?
|
|
35
|
+
*
|
|
36
|
+
* @return {boolean} Does this have non spzces?
|
|
15
37
|
*/
|
|
16
38
|
get hasNonSpaces() {
|
|
17
39
|
return this.sink_.hasNonSpaces;
|
|
@@ -95,11 +117,32 @@ const invertNormalizeMat = normalizeMat.clone().transpose();
|
|
|
95
117
|
* Sink for receiving events from a target scene
|
|
96
118
|
*/
|
|
97
119
|
class SceneEventSink {
|
|
120
|
+
/**
|
|
121
|
+
* Set the visibility set for this object.
|
|
122
|
+
*
|
|
123
|
+
* @param value The visibility set to use, or null for all items
|
|
124
|
+
* to be default visibile (exception spaces).
|
|
125
|
+
*/
|
|
126
|
+
set visibilitySet(value) {
|
|
127
|
+
if (this.visibilitySet_ !== value) {
|
|
128
|
+
this.visibilitySet_ = value;
|
|
129
|
+
this.reconcileVisibility();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Get the visibility set for this object.
|
|
134
|
+
*
|
|
135
|
+
* @return {ILocalIdSet | Set< number > | null} The visibility set.
|
|
136
|
+
*/
|
|
137
|
+
get visibilitySet() {
|
|
138
|
+
return this.visibilitySet_;
|
|
139
|
+
}
|
|
98
140
|
/**
|
|
99
141
|
* Reconcile space visibility.
|
|
100
142
|
*/
|
|
101
|
-
|
|
143
|
+
reconcileVisibility() {
|
|
102
144
|
const onlySpaces = this.nonSpaceCount_ === 0;
|
|
145
|
+
const visibilitySet = this.visibilitySet_;
|
|
103
146
|
for (const [node, instance] of this.instances_.entries()) {
|
|
104
147
|
const batch = instance.batch;
|
|
105
148
|
const batched = instance.batched;
|
|
@@ -110,13 +153,17 @@ class SceneEventSink {
|
|
|
110
153
|
continue;
|
|
111
154
|
}
|
|
112
155
|
const batchMesh = batch.mesh;
|
|
113
|
-
const isVisible = (!node.isSpace && !this.hideNonSpaces_) ||
|
|
114
|
-
(node.isSpace && (onlySpaces || this.showSpaces_))
|
|
156
|
+
const isVisible = ((!node.isSpace && !this.hideNonSpaces_) ||
|
|
157
|
+
(node.isSpace && (onlySpaces || this.showSpaces_))) &&
|
|
158
|
+
(visibilitySet === null || (instance.node.relatedElementLocalId !== void 0 &&
|
|
159
|
+
visibilitySet.has(instance.node.relatedElementLocalId)));
|
|
115
160
|
batchMesh.setVisibleAt(instance.instanceID, isVisible);
|
|
116
161
|
}
|
|
117
162
|
}
|
|
118
163
|
/**
|
|
119
164
|
* Does this have instances that aren't spaces?
|
|
165
|
+
*
|
|
166
|
+
* @return {boolean}
|
|
120
167
|
*/
|
|
121
168
|
get hasNonSpaces() {
|
|
122
169
|
return this.nonSpaceCount_ > 0;
|
|
@@ -137,7 +184,7 @@ class SceneEventSink {
|
|
|
137
184
|
set showSpaces(value) {
|
|
138
185
|
if (this.showSpaces_ !== value) {
|
|
139
186
|
this.showSpaces_ = value;
|
|
140
|
-
this.
|
|
187
|
+
this.reconcileVisibility();
|
|
141
188
|
}
|
|
142
189
|
}
|
|
143
190
|
/**
|
|
@@ -156,7 +203,7 @@ class SceneEventSink {
|
|
|
156
203
|
set hideNonSpaces(value) {
|
|
157
204
|
if (this.hideNonSpaces_ !== value) {
|
|
158
205
|
this.hideNonSpaces_ = value;
|
|
159
|
-
this.
|
|
206
|
+
this.reconcileVisibility();
|
|
160
207
|
}
|
|
161
208
|
}
|
|
162
209
|
/**
|
|
@@ -194,6 +241,7 @@ class SceneEventSink {
|
|
|
194
241
|
this.nonSpaceCount_ = 0;
|
|
195
242
|
this.showSpaces_ = false;
|
|
196
243
|
this.hideNonSpaces_ = false;
|
|
244
|
+
this.visibilitySet_ = null;
|
|
197
245
|
}
|
|
198
246
|
/**
|
|
199
247
|
* Uncork this event handler, processing all geometry into batches at once.
|
|
@@ -229,6 +277,7 @@ class SceneEventSink {
|
|
|
229
277
|
}
|
|
230
278
|
}
|
|
231
279
|
}
|
|
280
|
+
const visibilitySet = this.visibilitySet_;
|
|
232
281
|
for (const [node, instance] of this.instances_.entries()) {
|
|
233
282
|
const batch = instance.batch;
|
|
234
283
|
const batched = instance.batched;
|
|
@@ -237,8 +286,10 @@ class SceneEventSink {
|
|
|
237
286
|
}
|
|
238
287
|
const batchMesh = batch.mesh;
|
|
239
288
|
instance.instanceID = batchMesh.addInstance(batched.geometryID);
|
|
240
|
-
const isVisible = (!node.isSpace && !this.hideNonSpaces_) ||
|
|
241
|
-
(node.isSpace && (onlySpaces || this.showSpaces_))
|
|
289
|
+
const isVisible = ((!node.isSpace && !this.hideNonSpaces_) ||
|
|
290
|
+
(node.isSpace && (onlySpaces || this.showSpaces_))) &&
|
|
291
|
+
(visibilitySet === null || (instance.node.relatedElementLocalId !== void 0 &&
|
|
292
|
+
visibilitySet.has(instance.node.relatedElementLocalId)));
|
|
242
293
|
batchMesh.setVisibleAt(instance.instanceID, isVisible);
|
|
243
294
|
batchMesh.setMatrixAt(instance.instanceID, instance.transform);
|
|
244
295
|
}
|
|
@@ -322,7 +373,7 @@ class SceneEventSink {
|
|
|
322
373
|
onGeometryUpdated(node, transform, isAdded = false) {
|
|
323
374
|
if (isAdded && !node.isSpace) {
|
|
324
375
|
if ((this.nonSpaceCount_++) === 0 && !this.cork_) {
|
|
325
|
-
this.
|
|
376
|
+
this.reconcileVisibility();
|
|
326
377
|
}
|
|
327
378
|
}
|
|
328
379
|
const model = node.model;
|
|
@@ -536,9 +587,12 @@ class SceneEventSink {
|
|
|
536
587
|
++batch.instanceCount;
|
|
537
588
|
// Geometry id must exist if the batch is uncorked.
|
|
538
589
|
const instanceID = batchMesh.addInstance(batchGeometry.geometryID);
|
|
590
|
+
const visibilitySet = this.visibilitySet_;
|
|
539
591
|
const onlySpaces = this.nonSpaceCount_ === 0;
|
|
540
|
-
const isVisible = (!node.isSpace && !this.hideNonSpaces_) ||
|
|
541
|
-
(node.isSpace && (onlySpaces || this.showSpaces_))
|
|
592
|
+
const isVisible = ((!node.isSpace && !this.hideNonSpaces_) ||
|
|
593
|
+
(node.isSpace && (onlySpaces || this.showSpaces_))) &&
|
|
594
|
+
(visibilitySet === null || (instance.node.relatedElementLocalId !== void 0 &&
|
|
595
|
+
visibilitySet.has(instance.node.relatedElementLocalId)));
|
|
542
596
|
batchMesh.setVisibleAt(instanceID, isVisible);
|
|
543
597
|
instance.instanceID = instanceID;
|
|
544
598
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
import SceneObject from "./scene_object.js";
|
|
3
3
|
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
4
|
+
import { Model } from "../../core/model.js";
|
|
4
5
|
/**
|
|
5
6
|
* Shadow quality, lower values use lower resolution/faster settings,
|
|
6
7
|
* higher values use high resolution/slower but more aesthetic settings.
|
|
@@ -65,6 +66,17 @@ export interface SimpleViewerSceneOptions {
|
|
|
65
66
|
* Is ambient occlusion enabled? (default true)
|
|
66
67
|
*/
|
|
67
68
|
ao?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Should we limit the CSG depth? (default false)
|
|
71
|
+
*
|
|
72
|
+
* This is used to limit the depth of the CSG operations
|
|
73
|
+
* to avoid very deep recursions.
|
|
74
|
+
*/
|
|
75
|
+
limitCSGDepth?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* The maximum CSG depth to use. (default 20)
|
|
78
|
+
*/
|
|
79
|
+
maxCSGDepth?: number;
|
|
68
80
|
}
|
|
69
81
|
/**
|
|
70
82
|
* A default scene setup for three with a conway model that can be loaded.
|
|
@@ -78,6 +90,7 @@ export declare class SimpleViewerScene {
|
|
|
78
90
|
number
|
|
79
91
|
];
|
|
80
92
|
private readonly options;
|
|
93
|
+
private currentModelSceneObject_?;
|
|
81
94
|
private currentModel_?;
|
|
82
95
|
private currentRadius_;
|
|
83
96
|
orbitControls: OrbitControls;
|
|
@@ -88,7 +101,28 @@ export declare class SimpleViewerScene {
|
|
|
88
101
|
private premGenerator_?;
|
|
89
102
|
private composer_?;
|
|
90
103
|
private ambientOclussion_;
|
|
104
|
+
/**
|
|
105
|
+
* Should we limit the CSG depth? Othwerwise we will only limit the depth
|
|
106
|
+
* of memoization.
|
|
107
|
+
*/
|
|
108
|
+
limitCSGDepth: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* The limit for CSG recursion depth (or memoization depth).
|
|
111
|
+
*/
|
|
112
|
+
maxCSGDepth: number;
|
|
91
113
|
onload?: (scene: SimpleViewerScene, object: SceneObject) => void;
|
|
114
|
+
/**
|
|
115
|
+
* Get the current model scene object.
|
|
116
|
+
*
|
|
117
|
+
* @return {SceneObject | undefined} The current model scene object.
|
|
118
|
+
*/
|
|
119
|
+
get currentModelSceneObject(): SceneObject | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Get the current model.
|
|
122
|
+
*
|
|
123
|
+
* @return {Model | undefined} The current model.
|
|
124
|
+
*/
|
|
125
|
+
get currentModel(): Model | undefined;
|
|
92
126
|
/**
|
|
93
127
|
* Is ambient occlusion enabled?
|
|
94
128
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple_viewer_scene.d.ts","sourceRoot":"","sources":["../../../../src/rendering/threejs/simple_viewer_scene.ts"],"names":[],"mappings":"AACA,OAAO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 20,
|
|
34
36
|
};
|
|
35
37
|
let modelID = 0;
|
|
36
38
|
/**
|
|
37
39
|
* A default scene setup for three with a conway model that can be loaded.
|
|
38
40
|
*/
|
|
39
41
|
export class SimpleViewerScene {
|
|
42
|
+
/**
|
|
43
|
+
* Get the current model scene object.
|
|
44
|
+
*
|
|
45
|
+
* @return {SceneObject | undefined} The current model scene object.
|
|
46
|
+
*/
|
|
47
|
+
get currentModelSceneObject() {
|
|
48
|
+
return this.currentModelSceneObject_;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get the current model.
|
|
52
|
+
*
|
|
53
|
+
* @return {Model | undefined} The current model.
|
|
54
|
+
*/
|
|
55
|
+
get currentModel() {
|
|
56
|
+
return this.currentModel_;
|
|
57
|
+
}
|
|
40
58
|
/**
|
|
41
59
|
* Is ambient occlusion enabled?
|
|
42
60
|
*
|
|
@@ -253,6 +271,17 @@ export class SimpleViewerScene {
|
|
|
253
271
|
// Slightly blue cast ambient sky light
|
|
254
272
|
this.ambient = new THREE.HemisphereLight(11184813, 1118481, 0.5 * Math.PI);
|
|
255
273
|
this.lightDir_ = new THREE.Vector3(1, 1, 1);
|
|
274
|
+
/**
|
|
275
|
+
* Should we limit the CSG depth? Othwerwise we will only limit the depth
|
|
276
|
+
* of memoization.
|
|
277
|
+
*/
|
|
278
|
+
this.limitCSGDepth = true;
|
|
279
|
+
/**
|
|
280
|
+
* The limit for CSG recursion depth (or memoization depth).
|
|
281
|
+
*/
|
|
282
|
+
this.maxCSGDepth = 20;
|
|
283
|
+
this.limitCSGDepth = options.limitCSGDepth ?? !!defaultOptions.limitCSGDepth;
|
|
284
|
+
this.maxCSGDepth = options.maxCSGDepth ?? defaultOptions.maxCSGDepth ?? this.maxCSGDepth;
|
|
256
285
|
this.ambientOclussion_ = options.ao ?? !!defaultOptions.ao;
|
|
257
286
|
if (options.ambientLight ?? defaultOptions.ambientLight) {
|
|
258
287
|
scene.add(this.ambient);
|
|
@@ -315,19 +344,22 @@ export class SimpleViewerScene {
|
|
|
315
344
|
*/
|
|
316
345
|
async load(buffer) {
|
|
317
346
|
try {
|
|
318
|
-
const loadResult = await ConwayModelLoader.loadModelWithScene(new Uint8Array(buffer), modelID++);
|
|
347
|
+
const loadResult = await ConwayModelLoader.loadModelWithScene(new Uint8Array(buffer), this.limitCSGDepth, this.maxCSGDepth, modelID++);
|
|
348
|
+
const model = loadResult[0];
|
|
319
349
|
const modelScene = loadResult[1];
|
|
320
350
|
const scene = this.scene;
|
|
321
|
-
const
|
|
322
|
-
if (
|
|
323
|
-
scene.remove(
|
|
351
|
+
const currentModelSceneObject = this.currentModelSceneObject_;
|
|
352
|
+
if (currentModelSceneObject !== void 0) {
|
|
353
|
+
scene.remove(currentModelSceneObject);
|
|
354
|
+
this.currentModelSceneObject_ = void 0;
|
|
324
355
|
this.currentModel_ = void 0;
|
|
325
356
|
}
|
|
326
357
|
const conwaySceneObject = new SceneObject(modelScene);
|
|
327
358
|
conwaySceneObject.uncork();
|
|
328
359
|
conwaySceneObject.castShadow = true;
|
|
329
360
|
conwaySceneObject.receiveShadow = true;
|
|
330
|
-
this.
|
|
361
|
+
this.currentModelSceneObject_ = conwaySceneObject;
|
|
362
|
+
this.currentModel_ = model;
|
|
331
363
|
const currentBoundingBox = new THREE.Box3().setFromObject(conwaySceneObject);
|
|
332
364
|
const currentBoundingSphere = currentBoundingBox
|
|
333
365
|
.getBoundingSphere(new THREE.Sphere());
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const versionString = 'Conway Web-Ifc Shim v0.18.
|
|
1
|
+
const versionString = 'Conway Web-Ifc Shim v0.18.902';
|
|
2
2
|
export { versionString };
|