@xeokit/xeokit-sdk 2.4.2-beta-8 → 2.4.2-beta-9

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.
@@ -0,0 +1,418 @@
1
+ import {Entity} from "../Entity";
2
+ import {SceneModelMesh} from "./SceneModelMesh";
3
+ import {SceneModel} from "./SceneModel";
4
+
5
+ /**
6
+ * An abstract 3D scene element that can be individually shown, hidden, selected,
7
+ * highlighted, xrayed, culled, picked, clipped and bounded.
8
+ *
9
+ * @abstract
10
+ */
11
+ export declare abstract class SceneModelEntity implements Entity {
12
+
13
+ /**
14
+ * Component ID, unique within the {@link Scene}.
15
+ *
16
+ * @type {number|string}
17
+ * @abstract
18
+ */
19
+ get id(): string;
20
+
21
+ /**
22
+ * ID of the corresponding object within the originating system, if any.
23
+ *
24
+ * By default, this has the same value as {@link SceneModelEntity.id}. When we load a model using {@link XKTLoaderPlugin.load},
25
+ * with {@link XKTLoaderPlugin.globalizeObjectIds} set ````true````, then that plugin will prefix {@link SceneModelEntity.id}
26
+ * with the model ID, while leaving this property holding the original value of {@link SceneModelEntity.id}. When loading an
27
+ * IFC model, this property will hold the IFC product ID of the corresponding IFC element.
28
+ *
29
+ * @type {string}
30
+ */
31
+ get originalSystemId(): string;
32
+
33
+ /**
34
+ * Returns true to indicate that this is an SceneModelEntity.
35
+ *
36
+ * @returns {Boolean}
37
+ */
38
+ get isEntity(): boolean;
39
+
40
+ /**
41
+ * Returns ````true```` if this SceneModelEntity represents a model.
42
+ *
43
+ * When this is ````true````, the SceneModelEntity will be registered by {@link SceneModelEntity.id} in {@link Scene.models} and
44
+ * may also have a corresponding {@link MetaModel}.
45
+ *
46
+ * @type {Boolean}
47
+ * @abstract
48
+ */
49
+ get isModel(): boolean;
50
+
51
+ /**
52
+ * Returns ````true```` if this SceneModelEntity represents an object.
53
+ *
54
+ * When this is ````true````, the SceneModelEntity will be registered by {@link SceneModelEntity.id} in {@link Scene.objects} and
55
+ * may also have a corresponding {@link MetaObject}.
56
+ *
57
+ * @type {Boolean}
58
+ * @abstract
59
+ */
60
+ get isObject(): boolean;
61
+
62
+ /** Returns the parent SceneModelEntity, if any. */
63
+ get parent(): void;
64
+
65
+ /**
66
+ * Sets the 3D World-space origin for this SceneModelEntity.
67
+ *
68
+ * @type {Float64Array}
69
+ * @abstract
70
+ */
71
+ set origin(arg: Float64Array);
72
+
73
+ /**
74
+ * Gets the 3D World-space origin for this SceneModelEntity.
75
+ *
76
+ * @type {Float64Array}
77
+ * @abstract
78
+ */
79
+ get origin(): Float64Array;
80
+
81
+ /**
82
+ * World-space 3D axis-aligned bounding box (AABB) of this SceneModelEntity.
83
+ *
84
+ * Represented by a six-element Float64Array containing the min/max extents of the
85
+ * axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.
86
+ *
87
+ * @type {Float64Array}
88
+ * @abstract
89
+ */
90
+ get aabb(): number[];
91
+
92
+ /**
93
+ * The approximate number of triangles in this SceneModelEntity.
94
+ *
95
+ * @type {number}
96
+ * @abstract
97
+ */
98
+ get numTriangles(): number;
99
+
100
+ /**
101
+ * Sets if this SceneModelEntity is visible.
102
+ *
103
+ * Only rendered when {@link SceneModelEntity.visible} is ````true```` and {@link SceneModelEntity.culled} is ````false````.
104
+ *
105
+ * When {@link SceneModelEntity.isObject} and {@link SceneModelEntity.visible} are both ````true```` the SceneModelEntity will be
106
+ * registered by {@link SceneModelEntity.id} in {@link Scene.visibleObjects}.
107
+ *
108
+ * @type {Boolean}
109
+ * @abstract
110
+ */
111
+ set visible(arg: boolean);
112
+
113
+ /**
114
+ * Gets if this SceneModelEntity is visible.
115
+ *
116
+ * Only rendered when {@link SceneModelEntity.visible} is ````true```` and {@link SceneModelEntity.culled} is ````false````.
117
+ *
118
+ * When {@link SceneModelEntity.isObject} and {@link SceneModelEntity.visible} are both ````true```` the SceneModelEntity will be
119
+ * registered by {@link SceneModelEntity.id} in {@link Scene.visibleObjects}.
120
+ *
121
+ * @type {Boolean}
122
+ * @abstract
123
+ */
124
+ get visible(): boolean;
125
+
126
+ /**
127
+ * Sets if this SceneModelEntity is xrayed.
128
+ *
129
+ * When {@link SceneModelEntity.isObject} and {@link SceneModelEntity.xrayed} are both ````true``` the SceneModelEntity will be
130
+ * registered by {@link SceneModelEntity.id} in {@link Scene.xrayedObjects}.
131
+ *
132
+ * @type {Boolean}
133
+ * @abstract
134
+ */
135
+ set xrayed(arg: boolean);
136
+
137
+ /**
138
+ * Gets if this SceneModelEntity is xrayed.
139
+ *
140
+ * When {@link SceneModelEntity.isObject} and {@link SceneModelEntity.xrayed} are both ````true``` the SceneModelEntity will be
141
+ * registered by {@link SceneModelEntity.id} in {@link Scene.xrayedObjects}.
142
+ *
143
+ * @type {Boolean}
144
+ * @abstract
145
+ */
146
+ get xrayed(): boolean;
147
+
148
+ /**
149
+ * Sets if this SceneModelEntity is highlighted.
150
+ *
151
+ * When {@link SceneModelEntity.isObject} and {@link SceneModelEntity.highlighted} are both ````true```` the SceneModelEntity will be
152
+ * registered by {@link SceneModelEntity.id} in {@link Scene.highlightedObjects}.
153
+ *
154
+ * @type {Boolean}
155
+ * @abstract
156
+ */
157
+ set highlighted(arg: boolean);
158
+
159
+ /**
160
+ * Gets if this SceneModelEntity is highlighted.
161
+ *
162
+ * When {@link SceneModelEntity.isObject} and {@link SceneModelEntity.highlighted} are both ````true```` the SceneModelEntity will be
163
+ * registered by {@link SceneModelEntity.id} in {@link Scene.highlightedObjects}.
164
+ *
165
+ * @type {Boolean}
166
+ * @abstract
167
+ */
168
+ get highlighted(): boolean;
169
+
170
+ /**
171
+ * Sets if this SceneModelEntity is selected.
172
+ *
173
+ * When {@link SceneModelEntity.isObject} and {@link SceneModelEntity.selected} are both ````true``` the SceneModelEntity will be
174
+ * registered by {@link SceneModelEntity.id} in {@link Scene.selectedObjects}.
175
+ *
176
+ * @type {Boolean}
177
+ * @abstract
178
+ */
179
+ set selected(arg: boolean);
180
+
181
+ /**
182
+ * Gets if this SceneModelEntity is selected.
183
+ *
184
+ * When {@link SceneModelEntity.isObject} and {@link SceneModelEntity.selected} are both ````true``` the SceneModelEntity will be
185
+ * registered by {@link SceneModelEntity.id} in {@link Scene.selectedObjects}.
186
+ *
187
+ * @type {Boolean}
188
+ * @abstract
189
+ */
190
+ get selected(): boolean;
191
+
192
+ /**
193
+ * Sets if this SceneModelEntity's edges are enhanced.
194
+ *
195
+ * @type {Boolean}
196
+ * @abstract
197
+ */
198
+ set edges(arg: boolean);
199
+
200
+ /**
201
+ * Gets if this SceneModelEntity's edges are enhanced.
202
+ *
203
+ * @type {Boolean}
204
+ * @abstract
205
+ */
206
+ get edges(): boolean;
207
+
208
+ /**
209
+ * Sets if this SceneModelEntity is culled.
210
+ *
211
+ * Only rendered when {@link SceneModelEntity.visible} is ````true```` and {@link SceneModelEntity.culled} is ````false````.
212
+ *
213
+ * @type {Boolean}
214
+ * @abstract
215
+ */
216
+ set culled(arg: boolean);
217
+
218
+ /**
219
+ * Gets if this SceneModelEntity is culled.
220
+ *
221
+ * Only rendered when {@link SceneModelEntity.visible} is ````true```` and {@link SceneModelEntity.culled} is ````false````.
222
+ *
223
+ * @type {Boolean}
224
+ * @abstract
225
+ */
226
+ get culled(): boolean;
227
+
228
+ /**
229
+ * Sets if this SceneModelEntity is clippable.
230
+ *
231
+ * Clipping is done by the {@link SectionPlane}s in {@link Scene.sectionPlanes}.
232
+ *
233
+ * @type {Boolean}
234
+ * @abstract
235
+ */
236
+ set clippable(arg: boolean);
237
+
238
+ /**
239
+ * Gets if this SceneModelEntity is clippable.
240
+ *
241
+ * Clipping is done by the {@link SectionPlane}s in {@link Scene.sectionPlanes}.
242
+ *
243
+ * @type {Boolean}
244
+ * @abstract
245
+ */
246
+ get clippable(): boolean;
247
+
248
+ /**
249
+ * Sets if this SceneModelEntity is included in boundary calculations.
250
+ *
251
+ * @type {Boolean}
252
+ * @abstract
253
+ */
254
+ set collidable(arg: boolean);
255
+
256
+ /**
257
+ * Gets if this SceneModelEntity is included in boundary calculations.
258
+ *
259
+ * @type {Boolean}
260
+ * @abstract
261
+ */
262
+ get collidable(): boolean;
263
+
264
+ /**
265
+ * Sets if this SceneModelEntity is pickable.
266
+ *
267
+ * Picking is done via calls to {@link Scene.pick}.
268
+ *
269
+ * @type {Boolean}
270
+ * @abstract
271
+ */
272
+ set pickable(arg: boolean);
273
+
274
+ /**
275
+ * Gets if this SceneModelEntity is pickable.
276
+ *
277
+ * Picking is done via calls to {@link Scene.pick}.
278
+ *
279
+ * @type {Boolean}
280
+ * @abstract
281
+ */
282
+ get pickable(): boolean;
283
+
284
+ /**
285
+ * Sets the SceneModelEntity's RGB colorize color, multiplies by the SceneModelEntity's rendered fragment colors.
286
+ *
287
+ * Each element of the color is in range ````[0..1]````.
288
+ *
289
+ * @type {number[]}
290
+ * @abstract
291
+ */
292
+ set colorize(arg: number[]);
293
+
294
+ /**
295
+ * Gets the SceneModelEntity's RGB colorize color, multiplies by the SceneModelEntity's rendered fragment colors.
296
+ *
297
+ * Each element of the color is in range ````[0..1]````.
298
+ *
299
+ * @type {number[]}
300
+ * @abstract
301
+ */
302
+ get colorize(): number[];
303
+
304
+ /**
305
+ * Sets the SceneModelEntity's opacity factor, multiplies by the SceneModelEntity's rendered fragment alphas.
306
+ *
307
+ * This is a factor in range ````[0..1]````.
308
+ *
309
+ * @type {number}
310
+ * @abstract
311
+ */
312
+ set opacity(arg: number);
313
+
314
+ /**
315
+ * Gets the SceneModelEntity's opacity factor.
316
+ *
317
+ * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
318
+ *
319
+ * @type {number}
320
+ * @abstract
321
+ */
322
+ get opacity(): number;
323
+
324
+ /**
325
+ * Sets if this SceneModelEntity casts shadows.
326
+ *
327
+ * @type {Boolean}
328
+ * @abstract
329
+ */
330
+ set castsShadow(arg: boolean);
331
+
332
+ /**
333
+ * Gets if this SceneModelEntity casts shadows.
334
+ *
335
+ * @type {Boolean}
336
+ * @abstract
337
+ */
338
+ get castsShadow(): boolean;
339
+
340
+ /**
341
+ * Sets if to this SceneModelEntity can have shadows cast upon it
342
+ *
343
+ * @type {Boolean}
344
+ * @abstract
345
+ */
346
+ set receivesShadow(arg: boolean);
347
+
348
+ /**
349
+ * Gets if this SceneModelEntity can have shadows cast upon it
350
+ *
351
+ * @type {Boolean}
352
+ * @abstract
353
+ */
354
+ get receivesShadow(): boolean;
355
+
356
+ /**
357
+ * Gets if this SceneModelEntity can have Scalable Ambient Obscurance (SAO) applied to it.
358
+ *
359
+ * SAO is configured by {@link SAO}.
360
+ *
361
+ * @type {Boolean}
362
+ * @abstract
363
+ */
364
+ get saoEnabled(): boolean;
365
+
366
+ /**
367
+ * Sets the SceneModelEntity's 3D World-space offset.
368
+ *
369
+ * Since offsetting Entities comes with memory and rendering overhead on some systems, this feature
370
+ * only works when {@link Viewer} is configured with ````entityOffsetsEnabled: true````.
371
+ *
372
+ * The offset dynamically translates the SceneModelEntity in World-space, which is useful for creating
373
+ * effects like exploding parts assemblies etc.
374
+ *
375
+ * Default value is ````[0,0,0]````.
376
+ *
377
+ * Provide a null or undefined value to reset to the default value.
378
+ *
379
+ * @abstract
380
+ * @type {number[]}
381
+ */
382
+ set offset(arg: number[]);
383
+
384
+ /**
385
+ * Gets the SceneModelEntity's 3D World-space offset.
386
+ *
387
+ * Default value is ````[0,0,0]````.
388
+ *
389
+ * @abstract
390
+ * @type {number[]}
391
+ */
392
+ get offset(): number[];
393
+
394
+ /**
395
+ * Gets the World, View and Canvas-space positions of each vertex in a callback.
396
+ *
397
+ * @param callback
398
+ */
399
+ getEachVertex(callback: any): void;
400
+
401
+ /**
402
+ * The {@link SceneModel} to which this SceneModelEntity belongs.
403
+ */
404
+ model :SceneModel;
405
+
406
+ /**
407
+ * The {@link SceneModelMesh}es belonging to this SceneModelEntity.
408
+ *
409
+ * * These are created with {@link SceneModel#createMesh} and registered in {@ilnk SceneModel#meshes}
410
+ * * Each SceneModelMesh belongs to one SceneModelEntity
411
+ */
412
+ meshes : SceneModelMesh[];
413
+
414
+ /**
415
+ * Destroys this SceneModelEntity.
416
+ */
417
+ destroy(): void;
418
+ }
@@ -0,0 +1,68 @@
1
+ import {SceneModelEntity} from "./SceneModelEntity";
2
+ import {SceneModelTransform} from "./SceneModelTransform";
3
+ import {SceneModelTextureSet} from "./SceneModelTextureSet";
4
+ import {SceneModel} from "./SceneModel";
5
+
6
+ /**
7
+ * A mesh within a {@link SceneModel}.
8
+ *
9
+ * * Created with {@link SceneModel#createMesh}
10
+ * * Belongs to exactly one {@link SceneModelEntity}
11
+ * * Stored by ID in {@link SceneModel#meshes}
12
+ * * Referenced by {@link SceneModelEntity#meshes}
13
+ * * Can have a {@link SceneModelTransform} to dynamically scale, rotate and translate it.
14
+ */
15
+ export declare class SceneModelMesh {
16
+
17
+ /**
18
+ * The {@link SceneModel} that owns this SceneModelMesh.
19
+ *
20
+ * @type {SceneModel}
21
+ */
22
+ model: SceneModel;
23
+
24
+ /**
25
+ * The {@link SceneModelEntity} that owns this SceneModelMesh.
26
+ *
27
+ * @type {SceneModelEntity}
28
+ */
29
+ object: SceneModelEntity;
30
+
31
+ /**
32
+ * The {@link SceneModelTransform} that transforms this SceneModelMesh.
33
+ *
34
+ * * This only exists when the SceneModelMesh is instancing its geometry.
35
+ * * These are created with {@link SceneModel#createTransform}
36
+ * * Each of these is also registered in {@link SceneModel#transforms}.
37
+ *
38
+ * @type {SceneModelTransform}
39
+ */
40
+ transform: SceneModelTransform | null;
41
+
42
+
43
+ /**
44
+ * The {@link SceneModelTextureSet} that optionally textures this SceneModelMesh.
45
+ *
46
+ * * This only exists when the SceneModelMesh has texture.
47
+ * * These are created with {@link SceneModel#createTextureSet}
48
+ * * Each of these is also registered in {@link SceneModel#textureSets}.
49
+ *
50
+ * @type {SceneModelTextureSet}
51
+ */
52
+ textureSet: SceneModelTextureSet | null;
53
+
54
+ /**
55
+ * Unique ID of this SceneModelMesh.
56
+ *
57
+ * The SceneModelMesh is registered against this ID in {@link SceneModel#meshes}.
58
+ */
59
+ id: string | number;
60
+
61
+ /**
62
+ * The {@link SceneModelEntity} that owns this SceneModelMesh.
63
+ *
64
+ * @type {SceneModelEntity}
65
+ */
66
+ entity: SceneModelEntity;
67
+
68
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * A texture within a {@link SceneModelTextureSet}.
3
+ *
4
+ * * Created with {@link SceneModel#createTexture}
5
+ * * Belongs to many {@link SceneModelTextureSet}s
6
+ * * Stored by ID in {@link SceneModel#textures}}
7
+ */
8
+ export declare class SceneModelTexture {
9
+
10
+ /**
11
+ * Unique ID of this SceneModelTexture.
12
+ *
13
+ * The SceneModelTexture is registered against this ID in {@link SceneModel#textures}.
14
+ */
15
+ id: string | number;
16
+ }
@@ -0,0 +1,51 @@
1
+ import {SceneModelTexture} from "./SceneModelTexture";
2
+
3
+
4
+ /**
5
+ * A texture set within a {@link SceneModel}.
6
+ *
7
+ * * Created with {@link SceneModel#createTextureSet}
8
+ * * Belongs to many {@link SceneModelMesh}es
9
+ * * Stored by ID in {@link SceneModel#textureSets}
10
+ * * Referenced by {@link SceneModelMesh#textureSet}
11
+ */
12
+
13
+ export declare class SceneModelTextureSet {
14
+
15
+ /**
16
+ * Unique ID of this SceneModelTextureSet.
17
+ *
18
+ * The SceneModelTextureSet is registered against this ID in {@link SceneModel#textureSets}.
19
+ */
20
+ id: string | number;
21
+
22
+ /**
23
+ * The color texture.
24
+ * @type {SceneModelTexture|*}
25
+ */
26
+ colorTexture: SceneModelTexture | null;
27
+
28
+ /**
29
+ * The metallic-roughness texture.
30
+ * @type {SceneModelTexture|*}
31
+ */
32
+ metallicRoughnessTexture: SceneModelTexture | null;
33
+
34
+ /**
35
+ * The normal map texture.
36
+ * @type {SceneModelTexture|*}
37
+ */
38
+ normalsTexture: SceneModelTexture | null;
39
+
40
+ /**
41
+ * The emissive color texture.
42
+ * @type {SceneModelTexture|*}
43
+ */
44
+ emissiveTexture: SceneModelTexture | null;
45
+
46
+ /**
47
+ * The ambient occlusion texture.
48
+ * @type {SceneModelTexture|*}
49
+ */
50
+ occlusionTexture: SceneModelTexture | null;
51
+ }