@thatopen/components 2.0.1 → 2.0.3

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.
@@ -1,55 +1,16 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, Event } from "../Types";
3
- /**
4
- * The entry point of the Components library.
5
- * It can:
6
- * - Create and access all the components of the library.
7
- * - Update all the updatable components automatically.
8
- * - Dispose all the components, preventing memory leaks.
9
- */
10
- export declare class Components implements Disposable {
11
- static readonly release = "1.4.21";
12
- /** {@link Disposable.onDisposed} */
13
- readonly onDisposed: Event<void>;
14
- /** The list of components created in this app. */
15
- readonly list: Map<string, Component>;
16
- /** If disabled, the animation loop will be stopped. */
2
+ import { Component, Disposable, World, Event } from "../Types";
3
+ import { SimpleRaycaster } from "./src";
4
+ import { Components } from "../Components";
5
+ export declare class Raycasters extends Component implements Disposable {
6
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
17
7
  enabled: boolean;
18
- private _clock;
19
- add(uuid: string, instance: Component): void;
20
- /**
21
- * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
22
- * doesn't exist, it will instance it automatically.
23
- *
24
- * @param Component - The component to get or create.
25
- */
26
- get<U extends Component>(Component: new (components: Components) => U): U;
27
- constructor();
28
- /**
29
- * Initializes the library. It should be called at the start of the app after
30
- * initializing the scene, the renderer and the
31
- * camera. Additionally, if any component that need a raycaster is
32
- * used, the {@link raycaster} will need to be initialized.
33
- */
34
- init(): void;
35
- /**
36
- * Disposes the memory of all the components and tools of this instance of
37
- * the library. A memory leak will be created if:
38
- *
39
- * - An instance of the library ends up out of scope and this function isn't
40
- * called. This is especially relevant in Single Page Applications (React,
41
- * Angular, Vue, etc).
42
- *
43
- * - Any of the objects of this instance (meshes, geometries, etc) is
44
- * referenced by a reference type (object or array).
45
- *
46
- * You can learn more about how Three.js handles memory leaks
47
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
48
- *
49
- */
8
+ list: Map<string, SimpleRaycaster>;
9
+ onDisposed: Event<unknown>;
10
+ constructor(components: Components);
11
+ get(world: World): SimpleRaycaster;
12
+ delete(world: World): void;
50
13
  dispose(): void;
51
- private update;
52
- private static setupBVH;
53
14
  }
54
15
  import * as THREE from "three";
55
16
  import { Components } from "../Components";
@@ -94,69 +55,57 @@ export declare class Disposer extends Component {
94
55
  private disposeChildren;
95
56
  private static disposeMaterial;
96
57
  }
97
- import { Component, Disposable, World, Event } from "../Types";
98
- import { SimpleRaycaster } from "./src";
99
- import { Components } from "../Components";
100
- export declare class Raycasters extends Component implements Disposable {
101
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
58
+ import { Component, Disposable, Event } from "../Types";
59
+ /**
60
+ * The entry point of the Components library.
61
+ * It can:
62
+ * - Create and access all the components of the library.
63
+ * - Update all the updatable components automatically.
64
+ * - Dispose all the components, preventing memory leaks.
65
+ */
66
+ export declare class Components implements Disposable {
67
+ static readonly release = "1.4.21";
68
+ /** {@link Disposable.onDisposed} */
69
+ readonly onDisposed: Event<void>;
70
+ /** The list of components created in this app. */
71
+ readonly list: Map<string, Component>;
72
+ /** If disabled, the animation loop will be stopped. */
102
73
  enabled: boolean;
103
- list: Map<string, SimpleRaycaster>;
104
- onDisposed: Event<unknown>;
105
- constructor(components: Components);
106
- get(world: World): SimpleRaycaster;
107
- delete(world: World): void;
108
- dispose(): void;
109
- }
110
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
111
- import { Components } from "../Components";
112
- import { SimpleWorld } from "./src";
113
- export declare class Worlds extends Component implements Updateable, Disposable {
114
- /**
115
- * A unique identifier for the component.
116
- * This UUID is used to register the component within the Components system.
117
- */
118
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
119
- /**
120
- * Event triggered after the update process of all worlds.
121
- * Subscribers can listen to this event to perform actions post-update.
122
- */
123
- readonly onAfterUpdate: Event<unknown>;
124
- /**
125
- * Event triggered before the update process of all worlds.
126
- * Subscribers can listen to this event to perform actions pre-update.
127
- */
128
- readonly onBeforeUpdate: Event<unknown>;
74
+ private _clock;
75
+ add(uuid: string, instance: Component): void;
129
76
  /**
130
- * Event triggered when the Worlds component is disposed.
131
- * Subscribers can listen to this event to perform cleanup actions.
77
+ * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
78
+ * doesn't exist, it will instance it automatically.
79
+ *
80
+ * @param Component - The component to get or create.
132
81
  */
133
- readonly onDisposed: Event<unknown>;
82
+ get<U extends Component>(Component: new (components: Components) => U): U;
83
+ constructor();
134
84
  /**
135
- * A collection of worlds managed by this component.
136
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
85
+ * Initializes the library. It should be called at the start of the app after
86
+ * initializing the scene, the renderer and the
87
+ * camera. Additionally, if any component that need a raycaster is
88
+ * used, the {@link raycaster} will need to be initialized.
137
89
  */
138
- list: Map<string, World>;
90
+ init(): void;
139
91
  /**
140
- * A flag indicating whether the Worlds component is enabled.
141
- * If false, the update process will be skipped.
92
+ * Disposes the memory of all the components and tools of this instance of
93
+ * the library. A memory leak will be created if:
94
+ *
95
+ * - An instance of the library ends up out of scope and this function isn't
96
+ * called. This is especially relevant in Single Page Applications (React,
97
+ * Angular, Vue, etc).
98
+ *
99
+ * - Any of the objects of this instance (meshes, geometries, etc) is
100
+ * referenced by a reference type (object or array).
101
+ *
102
+ * You can learn more about how Three.js handles memory leaks
103
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
104
+ *
142
105
  */
143
- enabled: boolean;
144
- constructor(components: Components);
145
- /**
146
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
147
- *
148
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
149
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
150
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
151
- *
152
- * @returns {SimpleWorld<T, U, S>} - The newly created SimpleWorld instance.
153
- *
154
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
155
- */
156
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
157
- delete(world: World): void;
158
106
  dispose(): void;
159
- update(delta?: number): void | Promise<void>;
107
+ private update;
108
+ private static setupBVH;
160
109
  }
161
110
  import { Component, Disposable, World, Event } from "../Types";
162
111
  import { GridConfig, SimpleGrid } from "./src";
@@ -171,6 +120,22 @@ export declare class Grids extends Component implements Disposable {
171
120
  delete(world: World): void;
172
121
  dispose(): void;
173
122
  }
123
+ import { MiniMap } from "./src";
124
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
125
+ import { Components } from "../Components";
126
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
127
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
128
+ readonly onAfterUpdate: Event<unknown>;
129
+ readonly onBeforeUpdate: Event<unknown>;
130
+ readonly onDisposed: Event<unknown>;
131
+ enabled: boolean;
132
+ list: Map<string, MiniMap>;
133
+ constructor(components: Components);
134
+ create(world: World): MiniMap;
135
+ delete(id: string): void;
136
+ dispose(): void;
137
+ update(): void;
138
+ }
174
139
  import { Components } from "../Components";
175
140
  import { MeshCullerRenderer, CullerRendererSettings } from "./src";
176
141
  import { Component, Event, Disposable, World } from "../Types";
@@ -223,120 +188,56 @@ export declare class Cullers extends Component implements Disposable {
223
188
  /** {@link Disposable.dispose} */
224
189
  dispose(): void;
225
190
  }
226
- import * as THREE from "three";
227
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
228
- import { SimplePlane } from "./src";
191
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
229
192
  import { Components } from "../Components";
230
- /**
231
- * A lightweight component to easily create and handle
232
- * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
233
- *
234
- * @param components - the instance of {@link Components} used.
235
- * E.g. {@link SimplePlane}.
236
- */
237
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
238
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
239
- /** {@link Createable.onAfterCreate} */
240
- readonly onAfterCreate: Event<SimplePlane>;
241
- /** {@link Createable.onAfterDelete} */
242
- readonly onAfterDelete: Event<SimplePlane>;
243
- /** Event that fires when the user starts dragging a clipping plane. */
244
- readonly onBeforeDrag: Event<void>;
245
- /** Event that fires when the user stops dragging a clipping plane. */
246
- readonly onAfterDrag: Event<void>;
247
- readonly onBeforeCreate: Event<unknown>;
248
- readonly onBeforeCancel: Event<unknown>;
249
- readonly onAfterCancel: Event<unknown>;
250
- readonly onBeforeDelete: Event<unknown>;
251
- /** {@link Disposable.onDisposed} */
252
- readonly onDisposed: Event<string>;
193
+ import { SimpleWorld } from "./src";
194
+ export declare class Worlds extends Component implements Updateable, Disposable {
253
195
  /**
254
- * Whether to force the clipping plane to be orthogonal in the Y direction
255
- * (up). This is desirable when clipping a building horizontally and a
256
- * clipping plane is created in its roof, which might have a slight
257
- * slope for draining purposes.
196
+ * A unique identifier for the component.
197
+ * This UUID is used to register the component within the Components system.
258
198
  */
259
- orthogonalY: boolean;
199
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
260
200
  /**
261
- * The tolerance that determines whether an almost-horizontal clipping plane
262
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
263
- * has to be 'true' for this to apply.
201
+ * Event triggered after the update process of all worlds.
202
+ * Subscribers can listen to this event to perform actions post-update.
264
203
  */
265
- toleranceOrthogonalY: number;
266
- Type: new (...args: any) => SimplePlane;
267
- list: SimplePlane[];
268
- /** The material used in all the clipping planes. */
269
- private _material;
270
- private _size;
271
- private _enabled;
272
- private _visible;
273
- /** {@link Component.enabled} */
274
- get enabled(): boolean;
275
- /** {@link Component.enabled} */
276
- set enabled(state: boolean);
277
- /** {@link Hideable.visible } */
278
- get visible(): boolean;
279
- /** {@link Hideable.visible } */
280
- set visible(state: boolean);
281
- /** The material of the clipping plane representation. */
282
- get material(): THREE.MeshBasicMaterial;
283
- /** The material of the clipping plane representation. */
284
- set material(material: THREE.MeshBasicMaterial);
285
- /** The size of the geometric representation of the clippings planes. */
286
- get size(): number;
287
- /** The size of the geometric representation of the clippings planes. */
288
- set size(size: number);
289
- constructor(components: Components);
290
- /** {@link Disposable.dispose} */
291
- dispose(): void;
292
- /** {@link Createable.create} */
293
- create(world: World): void;
204
+ readonly onAfterUpdate: Event<unknown>;
294
205
  /**
295
- * Creates a plane in a certain place and with a certain orientation,
296
- * without the need of the mouse.
297
- *
298
- * @param world - the world where this plane should be created.
299
- * @param normal - the orientation of the clipping plane.
300
- * @param point - the position of the clipping plane.
301
- * navigation.
206
+ * Event triggered before the update process of all worlds.
207
+ * Subscribers can listen to this event to perform actions pre-update.
302
208
  */
303
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
209
+ readonly onBeforeUpdate: Event<unknown>;
304
210
  /**
305
- * {@link Createable.delete}
306
- *
307
- * @param world - the world where the plane to delete is.
308
- * @param plane - the plane to delete. If undefined, the first plane
309
- * found under the cursor will be deleted.
310
- */
311
- delete(world: World, plane?: SimplePlane): void;
312
- /** Deletes all the existing clipping planes. */
313
- deleteAll(): void;
314
- private deletePlane;
315
- private pickPlane;
316
- private getAllPlaneMeshes;
317
- private createPlaneFromIntersection;
318
- private getWorldNormal;
319
- private normalizePlaneDirectionY;
320
- private newPlane;
321
- private updateMaterialsAndPlanes;
322
- private _onStartDragging;
323
- private _onEndDragging;
324
- }
325
- import { MiniMap } from "./src";
326
- import { Component, Updateable, World, Event, Disposable } from "../Types";
327
- import { Components } from "../Components";
328
- export declare class MiniMaps extends Component implements Updateable, Disposable {
329
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
330
- readonly onAfterUpdate: Event<unknown>;
331
- readonly onBeforeUpdate: Event<unknown>;
211
+ * Event triggered when the Worlds component is disposed.
212
+ * Subscribers can listen to this event to perform cleanup actions.
213
+ */
332
214
  readonly onDisposed: Event<unknown>;
215
+ readonly onWorldCreated: Event<World>;
216
+ readonly onWorldDeleted: Event<string>;
217
+ /**
218
+ * A collection of worlds managed by this component.
219
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
220
+ */
221
+ list: Map<string, World>;
222
+ /**
223
+ * A flag indicating whether the Worlds component is enabled.
224
+ * If false, the update process will be skipped.
225
+ */
333
226
  enabled: boolean;
334
- list: Map<string, MiniMap>;
335
227
  constructor(components: Components);
336
- create(world: World): MiniMap;
337
- delete(id: string): void;
228
+ /**
229
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
230
+ *
231
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
232
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
233
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
234
+ *
235
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
236
+ */
237
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
238
+ delete(world: World): void;
338
239
  dispose(): void;
339
- update(): void;
240
+ update(delta?: number): void | Promise<void>;
340
241
  }
341
242
  import * as THREE from "three";
342
243
  import { Components } from "../Components";
@@ -390,40 +291,103 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
390
291
  private setOrthoPerspCameraAspect;
391
292
  }
392
293
  import * as THREE from "three";
393
- import * as FRAGS from "@thatopen/fragments";
394
- import { FragmentsGroup } from "@thatopen/fragments";
395
- import { Component, Components, Disposable, Event } from "../../core";
294
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
295
+ import { SimplePlane } from "./src";
296
+ import { Components } from "../Components";
396
297
  /**
397
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
398
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
298
+ * A lightweight component to easily create and handle
299
+ * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
300
+ *
301
+ * @param components - the instance of {@link Components} used.
302
+ * E.g. {@link SimplePlane}.
399
303
  */
400
- export declare class BoundingBoxer extends Component implements Disposable {
401
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
402
- /** {@link Component.enabled} */
403
- enabled: boolean;
304
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
305
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
306
+ /** {@link Createable.onAfterCreate} */
307
+ readonly onAfterCreate: Event<SimplePlane>;
308
+ /** {@link Createable.onAfterDelete} */
309
+ readonly onAfterDelete: Event<SimplePlane>;
310
+ /** Event that fires when the user starts dragging a clipping plane. */
311
+ readonly onBeforeDrag: Event<void>;
312
+ /** Event that fires when the user stops dragging a clipping plane. */
313
+ readonly onAfterDrag: Event<void>;
314
+ readonly onBeforeCreate: Event<unknown>;
315
+ readonly onBeforeCancel: Event<unknown>;
316
+ readonly onAfterCancel: Event<unknown>;
317
+ readonly onBeforeDelete: Event<unknown>;
404
318
  /** {@link Disposable.onDisposed} */
405
- readonly onDisposed: Event<unknown>;
406
- private _absoluteMin;
407
- private _absoluteMax;
408
- private _meshes;
319
+ readonly onDisposed: Event<string>;
320
+ /**
321
+ * Whether to force the clipping plane to be orthogonal in the Y direction
322
+ * (up). This is desirable when clipping a building horizontally and a
323
+ * clipping plane is created in its roof, which might have a slight
324
+ * slope for draining purposes.
325
+ */
326
+ orthogonalY: boolean;
327
+ /**
328
+ * The tolerance that determines whether an almost-horizontal clipping plane
329
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
330
+ * has to be 'true' for this to apply.
331
+ */
332
+ toleranceOrthogonalY: number;
333
+ Type: new (...args: any) => SimplePlane;
334
+ list: SimplePlane[];
335
+ /** The material used in all the clipping planes. */
336
+ private _material;
337
+ private _size;
338
+ private _enabled;
339
+ private _visible;
340
+ /** {@link Component.enabled} */
341
+ get enabled(): boolean;
342
+ /** {@link Component.enabled} */
343
+ set enabled(state: boolean);
344
+ /** {@link Hideable.visible } */
345
+ get visible(): boolean;
346
+ /** {@link Hideable.visible } */
347
+ set visible(state: boolean);
348
+ /** The material of the clipping plane representation. */
349
+ get material(): THREE.MeshBasicMaterial;
350
+ /** The material of the clipping plane representation. */
351
+ set material(material: THREE.MeshBasicMaterial);
352
+ /** The size of the geometric representation of the clippings planes. */
353
+ get size(): number;
354
+ /** The size of the geometric representation of the clippings planes. */
355
+ set size(size: number);
409
356
  constructor(components: Components);
410
- static getDimensions(bbox: THREE.Box3): {
411
- width: number;
412
- height: number;
413
- depth: number;
414
- center: THREE.Vector3;
415
- };
416
- static newBound(positive: boolean): THREE.Vector3;
417
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
418
357
  /** {@link Disposable.dispose} */
419
358
  dispose(): void;
420
- get(): THREE.Box3;
421
- getSphere(): THREE.Sphere;
422
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
423
- reset(): void;
424
- add(group: FragmentsGroup): void;
425
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
426
- private static getFragmentBounds;
359
+ /** {@link Createable.create} */
360
+ create(world: World): void;
361
+ /**
362
+ * Creates a plane in a certain place and with a certain orientation,
363
+ * without the need of the mouse.
364
+ *
365
+ * @param world - the world where this plane should be created.
366
+ * @param normal - the orientation of the clipping plane.
367
+ * @param point - the position of the clipping plane.
368
+ * navigation.
369
+ */
370
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
371
+ /**
372
+ * {@link Createable.delete}
373
+ *
374
+ * @param world - the world where the plane to delete is.
375
+ * @param plane - the plane to delete. If undefined, the first plane
376
+ * found under the cursor will be deleted.
377
+ */
378
+ delete(world: World, plane?: SimplePlane): void;
379
+ /** Deletes all the existing clipping planes. */
380
+ deleteAll(): void;
381
+ private deletePlane;
382
+ private pickPlane;
383
+ private getAllPlaneMeshes;
384
+ private createPlaneFromIntersection;
385
+ private getWorldNormal;
386
+ private normalizePlaneDirectionY;
387
+ private newPlane;
388
+ private updateMaterialsAndPlanes;
389
+ private _onStartDragging;
390
+ private _onEndDragging;
427
391
  }
428
392
  import * as THREE from "three";
429
393
  import * as FRAGS from "@thatopen/fragments";
@@ -450,11 +414,65 @@ export declare class Classifier extends Component implements Disposable {
450
414
  byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
451
415
  byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
452
416
  byEntity(group: FRAGS.FragmentsGroup): void;
453
- byStorey(group: FRAGS.FragmentsGroup): void;
454
417
  byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
418
+ bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
455
419
  setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
456
420
  resetColor(items: FRAGS.FragmentIdMap): void;
457
- private saveItem;
421
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
422
+ }
423
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
424
+ import * as THREE from "three";
425
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
426
+ center: THREE.Vector3;
427
+ halfSizes: THREE.Vector3;
428
+ rotation: THREE.Matrix3;
429
+ transformation: THREE.Matrix4;
430
+ };
431
+ import * as THREE from "three";
432
+ export declare class MaterialsUtils {
433
+ static isTransparent(material: THREE.Material): boolean;
434
+ }
435
+ export declare class UUID {
436
+ private static _pattern;
437
+ private static _lut;
438
+ static create(): string;
439
+ static validate(uuid: string): void;
440
+ }
441
+ import * as THREE from "three";
442
+ import * as FRAGS from "@thatopen/fragments";
443
+ import { FragmentsGroup } from "@thatopen/fragments";
444
+ import { Component, Components, Disposable, Event } from "../../core";
445
+ /**
446
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
447
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
448
+ */
449
+ export declare class BoundingBoxer extends Component implements Disposable {
450
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
451
+ /** {@link Component.enabled} */
452
+ enabled: boolean;
453
+ /** {@link Disposable.onDisposed} */
454
+ readonly onDisposed: Event<unknown>;
455
+ private _absoluteMin;
456
+ private _absoluteMax;
457
+ private _meshes;
458
+ constructor(components: Components);
459
+ static getDimensions(bbox: THREE.Box3): {
460
+ width: number;
461
+ height: number;
462
+ depth: number;
463
+ center: THREE.Vector3;
464
+ };
465
+ static newBound(positive: boolean): THREE.Vector3;
466
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
467
+ /** {@link Disposable.dispose} */
468
+ dispose(): void;
469
+ get(): THREE.Box3;
470
+ getSphere(): THREE.Sphere;
471
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
472
+ reset(): void;
473
+ add(group: FragmentsGroup): void;
474
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
475
+ private static getFragmentBounds;
458
476
  }
459
477
  import { Component, Disposable, Event, Components } from "../../core";
460
478
  export declare class Exploder extends Component implements Disposable {
@@ -502,7 +520,7 @@ export declare class IfcLoader extends Component implements Disposable {
502
520
  }
503
521
  import * as FRAGS from "@thatopen/fragments";
504
522
  import { Components, Component } from "../../core";
505
- export declare class FragmentHider extends Component {
523
+ export declare class Hider extends Component {
506
524
  static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
507
525
  enabled: boolean;
508
526
  constructor(components: Components);
@@ -510,57 +528,45 @@ export declare class FragmentHider extends Component {
510
528
  isolate(items: FRAGS.FragmentIdMap): void;
511
529
  private updateCulledVisibility;
512
530
  }
513
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
514
- import * as THREE from "three";
515
- import * as FRAGS from "@thatopen/fragments";
516
- import { Component, Components, Event, Disposable } from "../../core";
517
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
518
- /**
519
- * Object that can efficiently load binary files that contain
520
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
521
- */
522
- export declare class FragmentsManager extends Component implements Disposable {
523
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
531
+ import * as WEBIFC from "web-ifc";
532
+ import { Components, Disposable, Event, Component } from "../../core";
533
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
534
+ export declare class IfcGeometryTiler extends Component implements Disposable {
535
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
536
+ onGeometryStreamed: Event<{
537
+ buffer: Uint8Array;
538
+ data: StreamedGeometries;
539
+ }>;
540
+ onAssetStreamed: Event<StreamedAsset[]>;
541
+ onProgress: Event<number>;
542
+ onIfcLoaded: Event<Uint8Array>;
524
543
  /** {@link Disposable.onDisposed} */
525
544
  readonly onDisposed: Event<unknown>;
526
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
527
- readonly onFragmentsDisposed: Event<{
528
- groupID: string;
529
- fragmentIDs: string[];
530
- }>;
531
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
532
- readonly list: Map<string, Fragment>;
533
- readonly groups: Map<string, FragmentsGroup>;
534
- /** {@link Component.enabled} */
545
+ settings: IfcStreamingSettings;
535
546
  enabled: boolean;
536
- baseCoordinationModel: string;
537
- private _loader;
538
- /** The list of meshes of the created fragments. */
539
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
540
- constructor(components: Components);
541
- /** {@link Disposable.dispose} */
547
+ webIfc: WEBIFC.IfcAPI;
548
+ private _spatialTree;
549
+ private _metaData;
550
+ private _visitedGeometries;
551
+ private _streamSerializer;
552
+ private _geometries;
553
+ private _geometryCount;
554
+ private _civil;
555
+ private _groupSerializer;
556
+ private _assets;
557
+ private _meshesWithHoles;
558
+ constructor(components: Components);
542
559
  dispose(): void;
543
- disposeGroup(group: FragmentsGroup): void;
544
- /**
545
- * Loads a binar file that contain fragment geometry.
546
- * @param data - The binary data to load.
547
- * @param config - Optional configuration for loading.
548
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
549
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
550
- * @returns The loaded FragmentsGroup.
551
- */
552
- load(data: Uint8Array, config?: Partial<{
553
- coordinate: boolean;
554
- properties: FRAGS.IfcProperties;
555
- relationsMap: RelationsMap;
556
- }>): FragmentsGroup;
557
- /**
558
- * Export the specified fragments.
559
- * @param group - the fragments group to be exported.
560
- * @returns the exported data as binary buffer.
561
- */
562
- export(group: FragmentsGroup): Uint8Array;
563
- coordinate(models?: FragmentsGroup[]): void;
560
+ streamFromBuffer(data: Uint8Array): Promise<void>;
561
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
562
+ private readIfcFile;
563
+ private streamIfcFile;
564
+ private streamAllGeometries;
565
+ private cleanUp;
566
+ private getMesh;
567
+ private getGeometry;
568
+ private streamAssets;
569
+ private streamGeometries;
564
570
  }
565
571
  import * as WEBIFC from "web-ifc";
566
572
  import { AsyncEvent, Component, Disposable, Event } from "../../core";
@@ -588,136 +594,57 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
588
594
  private streamAllProperties;
589
595
  private cleanUp;
590
596
  }
591
- import * as WEBIFC from "web-ifc";
592
- import { Components, Disposable, Event, Component } from "../../core";
593
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
594
- export declare class IfcGeometryTiler extends Component implements Disposable {
595
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
596
- onGeometryStreamed: Event<{
597
- buffer: Uint8Array;
598
- data: StreamedGeometries;
599
- }>;
600
- onAssetStreamed: Event<StreamedAsset[]>;
601
- onProgress: Event<number>;
602
- onIfcLoaded: Event<Uint8Array>;
603
- /** {@link Disposable.onDisposed} */
604
- readonly onDisposed: Event<unknown>;
605
- settings: IfcStreamingSettings;
606
- enabled: boolean;
607
- webIfc: WEBIFC.IfcAPI;
608
- private _spatialTree;
609
- private _metaData;
610
- private _visitedGeometries;
611
- private _streamSerializer;
612
- private _geometries;
613
- private _geometryCount;
614
- private _civil;
615
- private _groupSerializer;
616
- private _assets;
617
- private _meshesWithHoles;
618
- constructor(components: Components);
619
- dispose(): void;
620
- streamFromBuffer(data: Uint8Array): Promise<void>;
621
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
622
- private readIfcFile;
623
- private streamIfcFile;
624
- private streamAllGeometries;
625
- private cleanUp;
626
- private getMesh;
627
- private getGeometry;
628
- private streamAssets;
629
- private streamGeometries;
630
- }
631
- import * as THREE from "three";
632
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
633
- center: THREE.Vector3;
634
- halfSizes: THREE.Vector3;
635
- rotation: THREE.Matrix3;
636
- transformation: THREE.Matrix4;
637
- };
638
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
639
- import * as THREE from "three";
640
- export declare class MaterialsUtils {
641
- static isTransparent(material: THREE.Material): boolean;
642
- }
643
- import * as THREE from "three";
644
- import { Component, Components } from "../../core";
645
- export interface MeasureEdge {
646
- distance: number;
647
- points: THREE.Vector3[];
648
- }
649
- export declare class MeasurementUtils extends Component {
650
- enabled: boolean;
651
- static uuid: string;
652
- constructor(components: Components);
653
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
654
- edges: MeasureEdge[];
655
- indices: Set<number>;
656
- } | null;
657
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
658
- private getFaceData;
659
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
660
- p1: THREE.Vector3;
661
- p2: THREE.Vector3;
662
- p3: THREE.Vector3;
663
- faceNormal: THREE.Vector3;
664
- };
665
- private round;
666
- }
667
- export declare class UUID {
668
- private static _pattern;
669
- private static _lut;
670
- static create(): string;
671
- static validate(uuid: string): void;
672
- }
597
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
673
598
  import * as THREE from "three";
674
- import { Component, Components, Event, World } from "../core";
675
- export interface VertexPickerConfig {
676
- showOnlyVertex: boolean;
677
- snapDistance: number;
678
- previewElement: HTMLElement;
679
- }
680
- export declare class VertexPicker extends Component {
681
- onVertexFound: Event<THREE.Vector3>;
682
- onVertexLost: Event<THREE.Vector3>;
683
- components: Components;
684
- private _pickedPoint;
685
- private _config;
686
- private _enabled;
687
- private _workingPlane;
688
- set enabled(value: boolean);
689
- get enabled(): boolean;
690
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
691
- set workingPlane(plane: THREE.Plane | null);
692
- get workingPlane(): THREE.Plane | null;
693
- set config(value: Partial<VertexPickerConfig>);
694
- get config(): Partial<VertexPickerConfig>;
695
- dispose(): void;
696
- get(world: World): THREE.Vector3 | null;
697
- private getClosestVertex;
698
- private getVertices;
699
- private getVertex;
700
- }
701
- import * as WEBIFC from "web-ifc";
702
- import * as FRAG from "@thatopen/fragments";
703
- import { Component, Components } from "../../core";
599
+ import * as FRAGS from "@thatopen/fragments";
600
+ import { Component, Components, Event, Disposable } from "../../core";
601
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
704
602
  /**
705
- * Object to export all the properties from an IFC to a JS object.
603
+ * Object that can efficiently load binary files that contain
604
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
706
605
  */
707
- export declare class IfcJsonExporter extends Component {
708
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
606
+ export declare class FragmentsManager extends Component implements Disposable {
607
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
608
+ /** {@link Disposable.onDisposed} */
609
+ readonly onDisposed: Event<unknown>;
610
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
611
+ readonly onFragmentsDisposed: Event<{
612
+ groupID: string;
613
+ fragmentIDs: string[];
614
+ }>;
615
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
616
+ readonly list: Map<string, Fragment>;
617
+ readonly groups: Map<string, FragmentsGroup>;
709
618
  /** {@link Component.enabled} */
710
619
  enabled: boolean;
620
+ baseCoordinationModel: string;
621
+ private _loader;
622
+ /** The list of meshes of the created fragments. */
623
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
711
624
  constructor(components: Components);
625
+ /** {@link Disposable.dispose} */
626
+ dispose(): void;
627
+ disposeGroup(group: FragmentsGroup): void;
712
628
  /**
713
- * Exports all the properties of an IFC into an array of JS objects.
714
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
715
- * @param modelID ID of the IFC model whose properties to extract.
716
- * @param indirect whether to get the indirect relationships as well.
717
- * @param recursiveSpatial whether to get the properties of spatial items recursively
718
- * to make the location data available (e.g. absolute position of building).
629
+ * Loads a binar file that contain fragment geometry.
630
+ * @param data - The binary data to load.
631
+ * @param config - Optional configuration for loading.
632
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
633
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
634
+ * @returns The loaded FragmentsGroup.
719
635
  */
720
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
636
+ load(data: Uint8Array, config?: Partial<{
637
+ coordinate: boolean;
638
+ properties: FRAGS.IfcProperties;
639
+ relationsMap: RelationsMap;
640
+ }>): FragmentsGroup;
641
+ /**
642
+ * Export the specified fragments.
643
+ * @param group - the fragments group to be exported.
644
+ * @returns the exported data as binary buffer.
645
+ */
646
+ export(group: FragmentsGroup): Uint8Array;
647
+ coordinate(models?: FragmentsGroup[]): void;
721
648
  }
722
649
  import * as WEBIFC from "web-ifc";
723
650
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -924,37 +851,113 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
924
851
  }
925
852
  export {};
926
853
  import * as WEBIFC from "web-ifc";
927
- import { IfcItemsCategories } from "../../../ifc";
928
- export declare class SpatialStructure {
929
- itemsByFloor: IfcItemsCategories;
930
- private _units;
931
- setUp(webIfc: WEBIFC.IfcAPI): void;
932
- cleanUp(): void;
854
+ import * as FRAG from "@thatopen/fragments";
855
+ import { Component, Components } from "../../core";
856
+ /**
857
+ * Object to export all the properties from an IFC to a JS object.
858
+ */
859
+ export declare class IfcJsonExporter extends Component {
860
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
861
+ /** {@link Component.enabled} */
862
+ enabled: boolean;
863
+ constructor(components: Components);
864
+ /**
865
+ * Exports all the properties of an IFC into an array of JS objects.
866
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
867
+ * @param modelID ID of the IFC model whose properties to extract.
868
+ * @param indirect whether to get the indirect relationships as well.
869
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
870
+ * to make the location data available (e.g. absolute position of building).
871
+ */
872
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
933
873
  }
934
874
  import * as THREE from "three";
935
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
936
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
937
- /** {@link Disposable.onDisposed} */
938
- readonly onDisposed: Event<unknown>;
939
- readonly onAfterUpdate: Event<unknown>;
940
- readonly onBeforeUpdate: Event<unknown>;
941
- readonly onResize: Event<THREE.Vector2>;
942
- frontOffset: number;
943
- overrideMaterial: THREE.MeshDepthMaterial;
944
- backgroundColor: THREE.Color;
945
- renderer: THREE.WebGLRenderer;
946
- enabled: boolean;
947
- world: World;
948
- private _lockRotation;
949
- private _camera;
950
- private _plane;
951
- private _size;
952
- private _tempVector1;
953
- private _tempVector2;
954
- private _tempTarget;
955
- private readonly down;
956
- get lockRotation(): boolean;
957
- set lockRotation(active: boolean);
875
+ import { Component, Components, Event, World } from "../core";
876
+ export interface VertexPickerConfig {
877
+ showOnlyVertex: boolean;
878
+ snapDistance: number;
879
+ previewElement: HTMLElement;
880
+ }
881
+ export declare class VertexPicker extends Component {
882
+ onVertexFound: Event<THREE.Vector3>;
883
+ onVertexLost: Event<THREE.Vector3>;
884
+ components: Components;
885
+ private _pickedPoint;
886
+ private _config;
887
+ private _enabled;
888
+ private _workingPlane;
889
+ set enabled(value: boolean);
890
+ get enabled(): boolean;
891
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
892
+ set workingPlane(plane: THREE.Plane | null);
893
+ get workingPlane(): THREE.Plane | null;
894
+ set config(value: Partial<VertexPickerConfig>);
895
+ get config(): Partial<VertexPickerConfig>;
896
+ dispose(): void;
897
+ get(world: World): THREE.Vector3 | null;
898
+ private getClosestVertex;
899
+ private getVertices;
900
+ private getVertex;
901
+ }
902
+ import * as WEBIFC from "web-ifc";
903
+ import { IfcItemsCategories } from "../../../ifc";
904
+ export declare class SpatialStructure {
905
+ itemsByFloor: IfcItemsCategories;
906
+ private _units;
907
+ setUp(webIfc: WEBIFC.IfcAPI): void;
908
+ cleanUp(): void;
909
+ }
910
+ import * as THREE from "three";
911
+ import { Component, Components } from "../../core";
912
+ export interface MeasureEdge {
913
+ distance: number;
914
+ points: THREE.Vector3[];
915
+ }
916
+ export declare class MeasurementUtils extends Component {
917
+ enabled: boolean;
918
+ static uuid: string;
919
+ constructor(components: Components);
920
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
921
+ edges: MeasureEdge[];
922
+ indices: Set<number>;
923
+ } | null;
924
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
925
+ private getFaceData;
926
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
927
+ p1: THREE.Vector3;
928
+ p2: THREE.Vector3;
929
+ p3: THREE.Vector3;
930
+ faceNormal: THREE.Vector3;
931
+ };
932
+ private round;
933
+ }
934
+ export declare const IfcElements: {
935
+ [key: number]: string;
936
+ };
937
+ import * as THREE from "three";
938
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
939
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
940
+ /** {@link Disposable.onDisposed} */
941
+ readonly onDisposed: Event<unknown>;
942
+ readonly onAfterUpdate: Event<unknown>;
943
+ readonly onBeforeUpdate: Event<unknown>;
944
+ readonly onResize: Event<THREE.Vector2>;
945
+ frontOffset: number;
946
+ overrideMaterial: THREE.MeshDepthMaterial;
947
+ backgroundColor: THREE.Color;
948
+ renderer: THREE.WebGLRenderer;
949
+ enabled: boolean;
950
+ world: World;
951
+ private _lockRotation;
952
+ private _camera;
953
+ private _plane;
954
+ private _size;
955
+ private _tempVector1;
956
+ private _tempVector2;
957
+ private _tempTarget;
958
+ private readonly down;
959
+ get lockRotation(): boolean;
960
+ set lockRotation(active: boolean);
958
961
  get zoom(): number;
959
962
  set zoom(value: number);
960
963
  constructor(world: World);
@@ -966,16 +969,6 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
966
969
  private updatePlanes;
967
970
  }
968
971
  export declare const GeometryTypes: Set<number>;
969
- import * as WEBIFC from "web-ifc";
970
- export interface IfcItemsCategories {
971
- [itemID: number]: number;
972
- }
973
- export declare class IfcCategories {
974
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
975
- }
976
- export declare const IfcElements: {
977
- [key: number]: string;
978
- };
979
972
  import * as FRAGS from "@thatopen/fragments";
980
973
  export declare class IfcPropertiesUtils {
981
974
  static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
@@ -1001,396 +994,209 @@ export declare class IfcPropertiesUtils {
1001
994
  static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1002
995
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1003
996
  }
1004
- export declare const IfcCategoryMap: {
1005
- [key: number]: string;
1006
- };
1007
- /**
1008
- * Simple event handler by
1009
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1010
- * Keep in mind that:
1011
- * - If you want to remove it later, you might want to declare the callback as
1012
- * an object.
1013
- * - If you want to maintain the reference to 'this', you will need to declare
1014
- * the callback as an arrow function.
1015
- */
1016
- export declare class Event<T> {
1017
- /**
1018
- * Add a callback to this event instance.
1019
- * @param handler - the callback to be added to this event.
1020
- */
1021
- add(handler: T extends void ? {
1022
- (): void;
1023
- } : {
1024
- (data: T): void;
1025
- }): void;
1026
- /**
1027
- * Removes a callback from this event instance.
1028
- * @param handler - the callback to be removed from this event.
1029
- */
1030
- remove(handler: T extends void ? {
1031
- (): void;
1032
- } : {
1033
- (data: T): void;
1034
- }): void;
1035
- /** Triggers all the callbacks assigned to this event. */
1036
- trigger: (data?: T) => void;
1037
- /** Gets rid of all the suscribed events. */
1038
- reset(): void;
1039
- private handlers;
1040
- }
1041
- /**
1042
- * Simple event handler by
1043
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1044
- * Keep in mind that:
1045
- * - If you want to remove it later, you might want to declare the callback as
1046
- * an object.
1047
- * - If you want to maintain the reference to 'this', you will need to declare
1048
- * the callback as an arrow function.
1049
- */
1050
- export declare class AsyncEvent<T> {
1051
- /**
1052
- * Add a callback to this event instance.
1053
- * @param handler - the callback to be added to this event.
1054
- */
1055
- add(handler: T extends void ? {
1056
- (): Promise<void>;
1057
- } : {
1058
- (data: T): Promise<void>;
1059
- }): void;
1060
- /**
1061
- * Removes a callback from this event instance.
1062
- * @param handler - the callback to be removed from this event.
1063
- */
1064
- remove(handler: T extends void ? {
1065
- (): Promise<void>;
1066
- } : {
1067
- (data: T): Promise<void>;
1068
- }): void;
1069
- /** Triggers all the callbacks assigned to this event. */
1070
- trigger: (data?: T) => Promise<void>;
1071
- /** Gets rid of all the suscribed events. */
1072
- reset(): void;
1073
- private handlers;
1074
- }
1075
997
  import { InverseAttribute } from "./types";
1076
998
  export declare const relToAttributesMap: Map<number, {
1077
999
  forRelating: InverseAttribute;
1078
1000
  forRelated: InverseAttribute;
1079
1001
  }>;
1002
+ export declare const IfcCategoryMap: {
1003
+ [key: number]: string;
1004
+ };
1005
+ import * as WEBIFC from "web-ifc";
1006
+ export interface IfcItemsCategories {
1007
+ [itemID: number]: number;
1008
+ }
1009
+ export declare class IfcCategories {
1010
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
1011
+ }
1080
1012
  import * as THREE from "three";
1081
- import CameraControls from "camera-controls";
1082
- import { Event } from "./event";
1013
+ import { Disposable, Event } from "../../Types";
1083
1014
  /**
1084
- * Whether this component has to be manually destroyed once you are done with
1085
- * it to prevent
1086
- * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1087
- * This also ensures that the DOM events created by that component will be
1088
- * cleaned up.
1015
+ * A helper to easily get the real position of the mouse in the Three.js canvas
1016
+ * to work with tools like the
1017
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1018
+ * been transformed through CSS or doesn't occupy the whole screen.
1089
1019
  */
1090
- export interface Disposable {
1020
+ export declare class Mouse implements Disposable {
1021
+ dom: HTMLCanvasElement;
1022
+ private _event?;
1023
+ private _position;
1024
+ /** {@link Disposable.onDisposed} */
1025
+ readonly onDisposed: Event<unknown>;
1026
+ constructor(dom: HTMLCanvasElement);
1091
1027
  /**
1092
- * Destroys the object from memory to prevent a
1093
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1028
+ * The real position of the mouse of the Three.js canvas.
1094
1029
  */
1095
- dispose: () => void | Promise<void>;
1096
- /** Fired after the tool has been {@link Disposable.dispose()} */
1097
- readonly onDisposed: Event<any>;
1030
+ get position(): THREE.Vector2;
1031
+ /** {@link Disposable.dispose} */
1032
+ dispose(): void;
1033
+ private getPositionY;
1034
+ private getPositionX;
1035
+ private updateMouseInfo;
1036
+ private setupEvents;
1098
1037
  }
1038
+ import * as THREE from "three";
1039
+ import { Components } from "../../Components";
1040
+ import { Event, World, Disposable } from "../../Types";
1041
+ import { Mouse } from "./mouse";
1099
1042
  /**
1100
- * Whether the geometric representation of this component can be
1101
- * hidden or shown in the
1102
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1043
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1044
+ * that allows to easily get items from the scene using the mouse and touch
1045
+ * events.
1103
1046
  */
1104
- export interface Hideable {
1047
+ export declare class SimpleRaycaster implements Disposable {
1048
+ /** {@link Component.enabled} */
1049
+ enabled: boolean;
1050
+ components: Components;
1051
+ /** {@link Disposable.onDisposed} */
1052
+ readonly onDisposed: Event<unknown>;
1053
+ /** The position of the mouse in the screen. */
1054
+ readonly mouse: Mouse;
1055
+ readonly three: THREE.Raycaster;
1056
+ world: World;
1057
+ constructor(components: Components, world: World);
1058
+ /** {@link Disposable.dispose} */
1059
+ dispose(): void;
1105
1060
  /**
1106
- * Whether the geometric representation of this component is
1107
- * currently visible or not in the
1108
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1061
+ * Throws a ray from the camera to the mouse or touch event point and returns
1062
+ * the first item found. This also takes into account the clipping planes
1063
+ * used by the renderer.
1064
+ *
1065
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1066
+ * to query. If not provided, it will query all the meshes stored in
1067
+ * {@link Components.meshes}.
1109
1068
  */
1110
- visible: boolean;
1069
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1070
+ castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
1071
+ private intersect;
1072
+ private filterClippingPlanes;
1111
1073
  }
1074
+ import * as THREE from "three";
1075
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1076
+ import { Components } from "../../Components";
1077
+ import { Event, World } from "../../Types";
1112
1078
  /**
1113
- * Whether this component can be resized. The meaning of this can vary depending
1114
- * on the component: resizing a
1115
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1116
- * component could mean changing its resolution, whereas resizing a
1117
- * [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
1118
- */
1119
- export interface Resizeable {
1120
- /**
1121
- * Sets size of this component (e.g. the resolution of a
1122
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1123
- * component.
1124
- */
1125
- resize: (size?: THREE.Vector2) => void;
1126
- /** Event that fires when the component has been resized. */
1127
- onResize: Event<THREE.Vector2>;
1128
- /**
1129
- * Gets the current size of this component (e.g. the resolution of a
1130
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1131
- * component.
1132
- */
1133
- getSize: () => THREE.Vector2;
1134
- }
1135
- /** Whether this component should be updated each frame. */
1136
- export interface Updateable {
1137
- /** Actions that should be executed after updating the component. */
1138
- onAfterUpdate: Event<any>;
1139
- /** Actions that should be executed before updating the component. */
1140
- onBeforeUpdate: Event<any>;
1141
- /**
1142
- * Function used to update the state of this component each frame. For
1143
- * instance, a renderer component will make a render each frame.
1144
- */
1145
- update(delta?: number): void;
1146
- }
1147
- /** Basic type to describe the progress of any kind of process. */
1148
- export interface Progress {
1149
- /** The amount of things that have been done already. */
1150
- current: number;
1151
- /** The total amount of things to be done by the process. */
1152
- total: number;
1153
- }
1154
- /**
1155
- * Whether this component supports create and destroy operations. This generally
1156
- * applies for components that work with instances, such as clipping planes or
1157
- * dimensions.
1158
- */
1159
- export interface Createable {
1160
- /** Creates a new instance of an element (e.g. a new Dimension). */
1161
- create: (data: any) => void;
1162
- /**
1163
- * Finish the creation process of the component, successfully creating an
1164
- * instance of whatever the component creates.
1165
- */
1166
- endCreation?: (data: any) => void;
1167
- /**
1168
- * Cancels the creation process of the component, going back to the state
1169
- * before starting to create.
1170
- */
1171
- cancelCreation?: (data: any) => void;
1172
- /** Deletes an existing instance of an element (e.g. a Dimension). */
1173
- delete: (data: any) => void;
1174
- }
1175
- /**
1176
- * Whether this component supports to be configured.
1177
- */
1178
- export interface Configurable<T extends Record<string, any>> {
1179
- /** Wether this components has been already configured. */
1180
- isSetup: boolean;
1181
- /** Use the provided configuration to setup the tool. */
1182
- setup: (config?: Partial<T>) => void | Promise<void>;
1183
- /** Fired after successfully calling {@link Configurable.setup()} */
1184
- readonly onSetup: Event<any>;
1185
- /** Object holding the tool configuration. Is not meant to be edited directly, if you need
1186
- * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
1187
- */
1188
- config: Required<T>;
1189
- }
1190
- /**
1191
- * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
1192
- */
1193
- export interface BVHGeometry extends THREE.BufferGeometry {
1194
- boundsTree: Object | undefined;
1195
- disposeBoundsTree: () => void;
1196
- }
1197
- /**
1198
- * Whether a camera uses the Camera Controls library.
1199
- */
1200
- export interface CameraControllable {
1201
- controls: CameraControls;
1202
- }
1203
- import { Base } from "./base";
1204
- /**
1205
- * Components are the building blocks of this library. Components are singleton
1206
- * elements that contain specific functionality. For instance, the SimpleClipper
1207
- * Component can create, delete and handle 3D clipping planes. Components must be
1208
- * unique (they can't be instanced more than once), and have a static UUID that
1209
- * identifies them uniquely. The can be accessed globally using the {@link Components}
1210
- * instance.
1079
+ * A renderer to determine a mesh visibility on screen
1211
1080
  */
1212
- export declare abstract class Component extends Base {
1213
- /**
1214
- * Whether this component is active or not. The behaviour can vary depending
1215
- * on the type of component. E.g. a disabled dimension tool will stop creating
1216
- * dimensions, while a disabled camera will stop moving. A disabled component
1217
- * will not be updated automatically each frame.
1218
- */
1219
- abstract enabled: boolean;
1081
+ export declare class MeshCullerRenderer extends CullerRenderer {
1082
+ threshold: number;
1083
+ readonly onViewUpdated: Event<{
1084
+ seen: Set<THREE.Mesh>;
1085
+ unseen: Set<THREE.Mesh>;
1086
+ }>;
1087
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1088
+ isProcessing: boolean;
1089
+ private _colorCodeMeshMap;
1090
+ private _meshIDColorCodeMap;
1091
+ private _currentVisibleMeshes;
1092
+ private _recentlyHiddenMeshes;
1093
+ private _intervalID;
1094
+ private readonly _transparentMat;
1095
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1096
+ dispose(): void;
1097
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1098
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1099
+ private handleWorkerMessage;
1100
+ private getAvailableMaterial;
1220
1101
  }
1221
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1102
+ import * as THREE from "three";
1222
1103
  import { Components } from "../../Components";
1223
- /**
1224
- * Base class of the library. Useful for finding out the interfaces it implements.
1225
- */
1226
- export declare abstract class Base {
1227
- components: Components;
1228
- constructor(components: Components);
1229
- /** Whether is component is {@link Disposable}. */
1230
- isDisposeable: () => this is Disposable;
1231
- /** Whether is component is {@link Resizeable}. */
1232
- isResizeable: () => this is Resizeable;
1233
- /** Whether is component is {@link Updateable}. */
1234
- isUpdateable: () => this is Updateable;
1235
- /** Whether is component is {@link Hideable}. */
1236
- isHideable: () => this is Hideable;
1237
- /** Whether is component is {@link Configurable}. */
1238
- isConfigurable: () => this is Configurable<any>;
1104
+ import { AsyncEvent, Event, World } from "../../Types";
1105
+ export interface CullerRendererSettings {
1106
+ updateInterval?: number;
1107
+ width?: number;
1108
+ height?: number;
1109
+ autoUpdate?: boolean;
1239
1110
  }
1240
- import { Base } from "./base";
1241
- import { World } from "./world";
1242
- import { Event } from "./event";
1243
- import { Components } from "../../Components";
1244
1111
  /**
1245
- * One of the elements that make a world. It can be either a scene, a camera
1246
- * or a renderer.
1112
+ * A base renderer to determine visibility on screen
1247
1113
  */
1248
- export declare abstract class BaseWorldItem extends Base {
1249
- readonly worlds: Map<string, World>;
1250
- readonly onWorldChanged: Event<{
1251
- world: World;
1252
- action: "added" | "removed";
1253
- }>;
1254
- currentWorld: World | null;
1255
- protected constructor(components: Components);
1256
- }
1257
- import * as THREE from "three";
1258
- import CameraControls from "camera-controls";
1259
- import { BaseWorldItem } from "./base-world-item";
1260
- import { CameraControllable } from "./interfaces";
1261
- export declare abstract class BaseCamera extends BaseWorldItem {
1262
- abstract enabled: boolean;
1263
- abstract three: THREE.Camera;
1264
- abstract controls?: CameraControls;
1265
- /** Whether is instance is {@link CameraControllable}. */
1266
- hasCameraControls: () => this is CameraControllable;
1267
- }
1268
- import * as THREE from "three";
1269
- import { Vector2 } from "three";
1270
- import { Event } from "./event";
1271
- import { BaseWorldItem } from "./base-world-item";
1272
- import { Disposable, Resizeable, Updateable } from "./interfaces";
1273
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1274
- abstract three: THREE.WebGLRenderer;
1275
- /** {@link Updateable.onBeforeUpdate} */
1276
- onAfterUpdate: Event<unknown>;
1277
- /** {@link Updateable.onAfterUpdate} */
1278
- onBeforeUpdate: Event<unknown>;
1114
+ export declare class CullerRenderer {
1279
1115
  /** {@link Disposable.onDisposed} */
1280
- readonly onDisposed: Event<undefined>;
1281
- readonly onResize: Event<THREE.Vector2>;
1282
- /**
1283
- * Event that fires when there has been a change to the list of clipping
1284
- * planes used by the active renderer.
1285
- */
1286
- readonly onClippingPlanesUpdated: Event<unknown>;
1287
- abstract update(delta?: number): void | Promise<void>;
1288
- abstract dispose(): void;
1289
- abstract getSize(): Vector2;
1290
- abstract resize(size: Vector2 | undefined): void;
1116
+ readonly onDisposed: Event<string>;
1291
1117
  /**
1292
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1293
- * instance of the renderer.
1118
+ * Fires after making the visibility check to the meshes. It lists the
1119
+ * meshes that are currently visible, and the ones that were visible
1120
+ * just before but not anymore.
1294
1121
  */
1295
- clippingPlanes: THREE.Plane[];
1122
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1123
+ /** {@link Component.enabled} */
1124
+ enabled: boolean;
1296
1125
  /**
1297
- * Forces the update of the clipping planes and all components that depend
1298
- * on them that are subscribed to 'onClippingPlanesUpdated'.
1126
+ * Needs to check whether there are objects that need to be hidden or shown.
1127
+ * You can bind this to the camera movement, to a certain interval, etc.
1299
1128
  */
1300
- updateClippingPlanes(): void;
1129
+ needsUpdate: boolean;
1301
1130
  /**
1302
- * Adds or removes a
1303
- * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1304
- * to the renderer.
1131
+ * Render the internal scene used to determine the object visibility. Used
1132
+ * for debugging purposes.
1305
1133
  */
1306
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1307
- }
1308
- import * as THREE from "three";
1309
- import { Disposable } from "./interfaces";
1310
- import { Event } from "./event";
1311
- import { Components } from "../../Components";
1312
- import { BaseWorldItem } from "./base-world-item";
1313
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1314
- /** {@link Disposable.onDisposed} */
1315
- readonly onDisposed: Event<unknown>;
1316
- abstract three: THREE.Object3D;
1317
- protected constructor(components: Components);
1134
+ renderDebugFrame: boolean;
1135
+ components: Components;
1136
+ readonly world: World;
1137
+ readonly renderer: THREE.WebGLRenderer;
1138
+ protected autoUpdate: boolean;
1139
+ protected updateInterval: number;
1140
+ protected readonly worker: Worker;
1141
+ protected readonly scene: THREE.Scene;
1142
+ private _width;
1143
+ private _height;
1144
+ private _availableColor;
1145
+ private readonly renderTarget;
1146
+ private readonly bufferSize;
1147
+ private readonly _buffer;
1148
+ protected _isWorkerBusy: boolean;
1149
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1318
1150
  /** {@link Disposable.dispose} */
1319
1151
  dispose(): void;
1320
- }
1321
- import * as THREE from "three";
1322
- import { BaseScene } from "./base-scene";
1323
- import { BaseCamera } from "./base-camera";
1324
- import { BaseRenderer } from "./base-renderer";
1325
- import { Updateable, Disposable } from "./interfaces";
1326
- export interface World extends Disposable, Updateable {
1327
- meshes: Set<THREE.Mesh>;
1328
- scene: BaseScene;
1329
- camera: BaseCamera;
1330
- renderer: BaseRenderer | null;
1331
- uuid: string;
1332
- }
1333
- import * as THREE from "three";
1334
- import { Disposable, Event } from "../../Types";
1335
- /**
1336
- * A helper to easily get the real position of the mouse in the Three.js canvas
1337
- * to work with tools like the
1338
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1339
- * been transformed through CSS or doesn't occupy the whole screen.
1340
- */
1341
- export declare class Mouse implements Disposable {
1342
- dom: HTMLCanvasElement;
1343
- private _event?;
1344
- private _position;
1345
- /** {@link Disposable.onDisposed} */
1346
- readonly onDisposed: Event<unknown>;
1347
- constructor(dom: HTMLCanvasElement);
1348
1152
  /**
1349
- * The real position of the mouse of the Three.js canvas.
1153
+ * The function that the culler uses to reprocess the scene. Generally it's
1154
+ * better to call needsUpdate, but you can also call this to force it.
1155
+ * @param force if true, it will refresh the scene even if needsUpdate is
1156
+ * not true.
1350
1157
  */
1351
- get position(): THREE.Vector2;
1352
- /** {@link Disposable.dispose} */
1353
- dispose(): void;
1354
- private getPositionY;
1355
- private getPositionX;
1356
- private updateMouseInfo;
1357
- private setupEvents;
1158
+ updateVisibility: (force?: boolean) => Promise<void>;
1159
+ protected getAvailableColor(): {
1160
+ r: number;
1161
+ g: number;
1162
+ b: number;
1163
+ code: string;
1164
+ };
1165
+ protected increaseColor(): void;
1166
+ protected decreaseColor(): void;
1167
+ private applySettings;
1358
1168
  }
1359
1169
  import * as THREE from "three";
1170
+ import { BaseRenderer, Event } from "../../Types";
1360
1171
  import { Components } from "../../Components";
1361
- import { Event, World, Disposable } from "../../Types";
1362
- import { Mouse } from "./mouse";
1363
1172
  /**
1364
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1365
- * that allows to easily get items from the scene using the mouse and touch
1366
- * events.
1173
+ * A basic renderer capable of rendering
1174
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1367
1175
  */
1368
- export declare class SimpleRaycaster implements Disposable {
1369
- /** {@link Component.enabled} */
1176
+ export declare class SimpleRenderer extends BaseRenderer {
1370
1177
  enabled: boolean;
1371
- components: Components;
1372
- /** {@link Disposable.onDisposed} */
1373
- readonly onDisposed: Event<unknown>;
1374
- /** The position of the mouse in the screen. */
1375
- readonly mouse: Mouse;
1376
- readonly three: THREE.Raycaster;
1377
- world: World;
1378
- constructor(components: Components, world: World);
1178
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
1179
+ container: HTMLElement;
1180
+ three: THREE.WebGLRenderer;
1181
+ protected _canvas: HTMLCanvasElement;
1182
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1183
+ protected _resizeObserver: ResizeObserver | null;
1184
+ protected onContainerUpdated: Event<unknown>;
1185
+ private _resizing;
1186
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1187
+ /** {@link Updateable.update} */
1188
+ update(): void;
1379
1189
  /** {@link Disposable.dispose} */
1380
1190
  dispose(): void;
1381
- /**
1382
- * Throws a ray from the camera to the mouse or touch event point and returns
1383
- * the first item found. This also takes into account the clipping planes
1384
- * used by the renderer.
1385
- *
1386
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1387
- * to query. If not provided, it will query all the meshes stored in
1388
- * {@link Components.meshes}.
1389
- */
1390
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1391
- castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
1392
- private intersect;
1393
- private filterClippingPlanes;
1191
+ /** {@link Resizeable.getSize}. */
1192
+ getSize(): THREE.Vector2;
1193
+ /** {@link Resizeable.resize} */
1194
+ resize: (size?: THREE.Vector2) => void;
1195
+ setupEvents(active: boolean): void;
1196
+ private resizeEvent;
1197
+ private setupRenderer;
1198
+ private onContextLost;
1199
+ private onContextBack;
1394
1200
  }
1395
1201
  import * as THREE from "three";
1396
1202
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
@@ -1402,8 +1208,10 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
1402
1208
  readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1403
1209
  readonly onAfterUpdate: Event<unknown>;
1404
1210
  readonly onBeforeUpdate: Event<unknown>;
1211
+ isDisposing: boolean;
1405
1212
  enabled: boolean;
1406
1213
  uuid: string;
1214
+ name?: string;
1407
1215
  readonly onDisposed: Event<unknown>;
1408
1216
  private _scene?;
1409
1217
  private _camera?;
@@ -1418,6 +1226,40 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
1418
1226
  update(delta?: number): void;
1419
1227
  dispose(disposeResources?: boolean): void;
1420
1228
  }
1229
+ /**
1230
+ * Simple event handler by
1231
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1232
+ * Keep in mind that:
1233
+ * - If you want to remove it later, you might want to declare the callback as
1234
+ * an object.
1235
+ * - If you want to maintain the reference to 'this', you will need to declare
1236
+ * the callback as an arrow function.
1237
+ */
1238
+ export declare class Event<T> {
1239
+ /**
1240
+ * Add a callback to this event instance.
1241
+ * @param handler - the callback to be added to this event.
1242
+ */
1243
+ add(handler: T extends void ? {
1244
+ (): void;
1245
+ } : {
1246
+ (data: T): void;
1247
+ }): void;
1248
+ /**
1249
+ * Removes a callback from this event instance.
1250
+ * @param handler - the callback to be removed from this event.
1251
+ */
1252
+ remove(handler: T extends void ? {
1253
+ (): void;
1254
+ } : {
1255
+ (data: T): void;
1256
+ }): void;
1257
+ /** Triggers all the callbacks assigned to this event. */
1258
+ trigger: (data?: T) => void;
1259
+ /** Gets rid of all the suscribed events. */
1260
+ reset(): void;
1261
+ private handlers;
1262
+ }
1421
1263
  import * as THREE from "three";
1422
1264
  import { BaseScene, Configurable, Event } from "../../Types";
1423
1265
  import { Components } from "../../Components";
@@ -1448,37 +1290,147 @@ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1448
1290
  /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1449
1291
  setup(config?: Partial<SimpleSceneConfig>): void;
1450
1292
  }
1293
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1294
+ /// <reference types="node" />
1451
1295
  import * as THREE from "three";
1452
- import { BaseRenderer, Event } from "../../Types";
1296
+ import { Hideable, Event, World } from "../../Types";
1453
1297
  import { Components } from "../../Components";
1298
+ export interface GridConfig {
1299
+ color: THREE.Color;
1300
+ size1: number;
1301
+ size2: number;
1302
+ distance: number;
1303
+ }
1454
1304
  /**
1455
- * A basic renderer capable of rendering
1456
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1305
+ * An infinite grid. Created by
1306
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1307
+ * and translated to typescript by
1308
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1457
1309
  */
1458
- export declare class SimpleRenderer extends BaseRenderer {
1459
- enabled: boolean;
1460
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1461
- container: HTMLElement;
1462
- three: THREE.WebGLRenderer;
1463
- protected _canvas: HTMLCanvasElement;
1464
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1465
- protected _resizeObserver: ResizeObserver | null;
1466
- protected onContainerUpdated: Event<unknown>;
1467
- private _resizing;
1468
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1310
+ export declare class SimpleGrid implements Hideable, Disposable {
1311
+ /** {@link Disposable.onDisposed} */
1312
+ readonly onDisposed: Event<unknown>;
1313
+ world: World;
1314
+ components: Components;
1315
+ /** {@link Hideable.visible} */
1316
+ get visible(): boolean;
1317
+ /** {@link Hideable.visible} */
1318
+ set visible(visible: boolean);
1319
+ /** The material of the grid. */
1320
+ get material(): THREE.ShaderMaterial;
1321
+ /**
1322
+ * Whether the grid should fade away with distance. Recommended to be true for
1323
+ * perspective cameras and false for orthographic cameras.
1324
+ */
1325
+ get fade(): boolean;
1326
+ /**
1327
+ * Whether the grid should fade away with distance. Recommended to be true for
1328
+ * perspective cameras and false for orthographic cameras.
1329
+ */
1330
+ set fade(active: boolean);
1331
+ readonly three: THREE.Mesh;
1332
+ private _fade;
1333
+ constructor(components: Components, world: World, config: GridConfig);
1334
+ [Symbol.dispose](): void;
1335
+ /** {@link Disposable.dispose} */
1336
+ dispose(): void;
1337
+ private setupEvents;
1338
+ private updateZoom;
1339
+ }
1340
+ /**
1341
+ * Simple event handler by
1342
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1343
+ * Keep in mind that:
1344
+ * - If you want to remove it later, you might want to declare the callback as
1345
+ * an object.
1346
+ * - If you want to maintain the reference to 'this', you will need to declare
1347
+ * the callback as an arrow function.
1348
+ */
1349
+ export declare class AsyncEvent<T> {
1350
+ /**
1351
+ * Add a callback to this event instance.
1352
+ * @param handler - the callback to be added to this event.
1353
+ */
1354
+ add(handler: T extends void ? {
1355
+ (): Promise<void>;
1356
+ } : {
1357
+ (data: T): Promise<void>;
1358
+ }): void;
1359
+ /**
1360
+ * Removes a callback from this event instance.
1361
+ * @param handler - the callback to be removed from this event.
1362
+ */
1363
+ remove(handler: T extends void ? {
1364
+ (): Promise<void>;
1365
+ } : {
1366
+ (data: T): Promise<void>;
1367
+ }): void;
1368
+ /** Triggers all the callbacks assigned to this event. */
1369
+ trigger: (data?: T) => Promise<void>;
1370
+ /** Gets rid of all the suscribed events. */
1371
+ reset(): void;
1372
+ private handlers;
1373
+ }
1374
+ import * as THREE from "three";
1375
+ import { Hideable, Disposable, Event, World } from "../../Types";
1376
+ import { Components } from "../../Components";
1377
+ /**
1378
+ * Each of the planes created by {@link SimpleClipper}.
1379
+ */
1380
+ export declare class SimplePlane implements Disposable, Hideable {
1381
+ /** Event that fires when the user starts dragging a clipping plane. */
1382
+ readonly onDraggingStarted: Event<unknown>;
1383
+ /** Event that fires when the user stops dragging a clipping plane. */
1384
+ readonly onDraggingEnded: Event<unknown>;
1385
+ /** {@link Disposable.onDisposed} */
1386
+ readonly onDisposed: Event<unknown>;
1387
+ readonly normal: THREE.Vector3;
1388
+ readonly origin: THREE.Vector3;
1389
+ readonly three: THREE.Plane;
1390
+ protected readonly _helper: THREE.Object3D;
1391
+ protected _visible: boolean;
1392
+ protected _enabled: boolean;
1393
+ components: Components;
1394
+ world: World;
1395
+ private _controlsActive;
1396
+ private readonly _arrowBoundBox;
1397
+ private readonly _planeMesh;
1398
+ private readonly _controls;
1399
+ private readonly _hiddenMaterial;
1400
+ get enabled(): boolean;
1401
+ /** {@link Component.enabled} */
1402
+ set enabled(state: boolean);
1403
+ /** {@link Hideable.visible } */
1404
+ get visible(): boolean;
1405
+ /** {@link Hideable.visible } */
1406
+ set visible(state: boolean);
1407
+ /** The meshes used for raycasting */
1408
+ get meshes(): THREE.Mesh[];
1409
+ /** The material of the clipping plane representation. */
1410
+ get planeMaterial(): THREE.Material | THREE.Material[];
1411
+ /** The material of the clipping plane representation. */
1412
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
1413
+ /** The size of the clipping plane representation. */
1414
+ get size(): number;
1415
+ /** Sets the size of the clipping plane representation. */
1416
+ set size(size: number);
1417
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1418
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1419
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
1469
1420
  /** {@link Updateable.update} */
1470
- update(): void;
1421
+ update: () => void;
1471
1422
  /** {@link Disposable.dispose} */
1472
1423
  dispose(): void;
1473
- /** {@link Resizeable.getSize}. */
1474
- getSize(): THREE.Vector2;
1475
- /** {@link Resizeable.resize} */
1476
- resize: (size?: THREE.Vector2) => void;
1477
- setupEvents(active: boolean): void;
1478
- private resizeEvent;
1479
- private setupRenderer;
1480
- private onContextLost;
1481
- private onContextBack;
1424
+ private reset;
1425
+ protected toggleControls(state: boolean): void;
1426
+ private newTransformControls;
1427
+ private initializeControls;
1428
+ private createArrowBoundingBox;
1429
+ private changeDrag;
1430
+ private notifyDraggingChanged;
1431
+ private preventCameraMovement;
1432
+ private newHelper;
1433
+ private static newPlaneMesh;
1482
1434
  }
1483
1435
  import * as THREE from "three";
1484
1436
  import CameraControls from "camera-controls";
@@ -1526,210 +1478,246 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
1526
1478
  private setupEvents;
1527
1479
  private static getSubsetOfThree;
1528
1480
  }
1529
- /// <reference types="node" />
1530
- import * as THREE from "three";
1531
- import { Hideable, Event, World } from "../../Types";
1481
+ import { Base } from "./base";
1482
+ /**
1483
+ * Components are the building blocks of this library. Components are singleton
1484
+ * elements that contain specific functionality. For instance, the SimpleClipper
1485
+ * Component can create, delete and handle 3D clipping planes. Components must be
1486
+ * unique (they can't be instanced more than once), and have a static UUID that
1487
+ * identifies them uniquely. The can be accessed globally using the {@link Components}
1488
+ * instance.
1489
+ */
1490
+ export declare abstract class Component extends Base {
1491
+ /**
1492
+ * Whether this component is active or not. The behaviour can vary depending
1493
+ * on the type of component. E.g. a disabled dimension tool will stop creating
1494
+ * dimensions, while a disabled camera will stop moving. A disabled component
1495
+ * will not be updated automatically each frame.
1496
+ */
1497
+ abstract enabled: boolean;
1498
+ }
1499
+ import { Base } from "./base";
1500
+ import { World } from "./world";
1501
+ import { Event } from "./event";
1532
1502
  import { Components } from "../../Components";
1533
- export interface GridConfig {
1534
- color: THREE.Color;
1535
- size1: number;
1536
- size2: number;
1537
- distance: number;
1503
+ /**
1504
+ * One of the elements that make a world. It can be either a scene, a camera
1505
+ * or a renderer.
1506
+ */
1507
+ export declare abstract class BaseWorldItem extends Base {
1508
+ readonly worlds: Map<string, World>;
1509
+ readonly onWorldChanged: Event<{
1510
+ world: World;
1511
+ action: "added" | "removed";
1512
+ }>;
1513
+ currentWorld: World | null;
1514
+ protected constructor(components: Components);
1515
+ }
1516
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1517
+ import { Components } from "../../Components";
1518
+ /**
1519
+ * Base class of the library. Useful for finding out the interfaces it implements.
1520
+ */
1521
+ export declare abstract class Base {
1522
+ components: Components;
1523
+ constructor(components: Components);
1524
+ /** Whether is component is {@link Disposable}. */
1525
+ isDisposeable: () => this is Disposable;
1526
+ /** Whether is component is {@link Resizeable}. */
1527
+ isResizeable: () => this is Resizeable;
1528
+ /** Whether is component is {@link Updateable}. */
1529
+ isUpdateable: () => this is Updateable;
1530
+ /** Whether is component is {@link Hideable}. */
1531
+ isHideable: () => this is Hideable;
1532
+ /** Whether is component is {@link Configurable}. */
1533
+ isConfigurable: () => this is Configurable<any>;
1534
+ }
1535
+ import * as THREE from "three";
1536
+ import CameraControls from "camera-controls";
1537
+ import { Event } from "./event";
1538
+ /**
1539
+ * Whether this component has to be manually destroyed once you are done with
1540
+ * it to prevent
1541
+ * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1542
+ * This also ensures that the DOM events created by that component will be
1543
+ * cleaned up.
1544
+ */
1545
+ export interface Disposable {
1546
+ /**
1547
+ * Destroys the object from memory to prevent a
1548
+ * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1549
+ */
1550
+ dispose: () => void | Promise<void>;
1551
+ /** Fired after the tool has been {@link Disposable.dispose()} */
1552
+ readonly onDisposed: Event<any>;
1538
1553
  }
1539
1554
  /**
1540
- * An infinite grid. Created by
1541
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1542
- * and translated to typescript by
1543
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1555
+ * Whether the geometric representation of this component can be
1556
+ * hidden or shown in the
1557
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1544
1558
  */
1545
- export declare class SimpleGrid implements Hideable, Disposable {
1546
- /** {@link Disposable.onDisposed} */
1547
- readonly onDisposed: Event<unknown>;
1548
- world: World;
1549
- components: Components;
1550
- /** {@link Hideable.visible} */
1551
- get visible(): boolean;
1552
- /** {@link Hideable.visible} */
1553
- set visible(visible: boolean);
1554
- /** The material of the grid. */
1555
- get material(): THREE.ShaderMaterial;
1556
- /**
1557
- * Whether the grid should fade away with distance. Recommended to be true for
1558
- * perspective cameras and false for orthographic cameras.
1559
- */
1560
- get fade(): boolean;
1559
+ export interface Hideable {
1561
1560
  /**
1562
- * Whether the grid should fade away with distance. Recommended to be true for
1563
- * perspective cameras and false for orthographic cameras.
1561
+ * Whether the geometric representation of this component is
1562
+ * currently visible or not in the
1563
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1564
1564
  */
1565
- set fade(active: boolean);
1566
- readonly three: THREE.Mesh;
1567
- private _fade;
1568
- constructor(components: Components, world: World, config: GridConfig);
1569
- [Symbol.dispose](): void;
1570
- /** {@link Disposable.dispose} */
1571
- dispose(): void;
1572
- private setupEvents;
1573
- private updateZoom;
1574
- }
1575
- import * as THREE from "three";
1576
- import { Components } from "../../Components";
1577
- import { AsyncEvent, Event, World } from "../../Types";
1578
- export interface CullerRendererSettings {
1579
- updateInterval?: number;
1580
- width?: number;
1581
- height?: number;
1582
- autoUpdate?: boolean;
1565
+ visible: boolean;
1583
1566
  }
1584
1567
  /**
1585
- * A base renderer to determine visibility on screen
1568
+ * Whether this component can be resized. The meaning of this can vary depending
1569
+ * on the component: resizing a
1570
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1571
+ * component could mean changing its resolution, whereas resizing a
1572
+ * [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
1586
1573
  */
1587
- export declare class CullerRenderer {
1588
- /** {@link Disposable.onDisposed} */
1589
- readonly onDisposed: Event<string>;
1574
+ export interface Resizeable {
1590
1575
  /**
1591
- * Fires after making the visibility check to the meshes. It lists the
1592
- * meshes that are currently visible, and the ones that were visible
1593
- * just before but not anymore.
1576
+ * Sets size of this component (e.g. the resolution of a
1577
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1578
+ * component.
1594
1579
  */
1595
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1596
- /** {@link Component.enabled} */
1597
- enabled: boolean;
1580
+ resize: (size?: THREE.Vector2) => void;
1581
+ /** Event that fires when the component has been resized. */
1582
+ onResize: Event<THREE.Vector2>;
1598
1583
  /**
1599
- * Needs to check whether there are objects that need to be hidden or shown.
1600
- * You can bind this to the camera movement, to a certain interval, etc.
1584
+ * Gets the current size of this component (e.g. the resolution of a
1585
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1586
+ * component.
1601
1587
  */
1602
- needsUpdate: boolean;
1588
+ getSize: () => THREE.Vector2;
1589
+ }
1590
+ /** Whether this component should be updated each frame. */
1591
+ export interface Updateable {
1592
+ /** Actions that should be executed after updating the component. */
1593
+ onAfterUpdate: Event<any>;
1594
+ /** Actions that should be executed before updating the component. */
1595
+ onBeforeUpdate: Event<any>;
1603
1596
  /**
1604
- * Render the internal scene used to determine the object visibility. Used
1605
- * for debugging purposes.
1597
+ * Function used to update the state of this component each frame. For
1598
+ * instance, a renderer component will make a render each frame.
1606
1599
  */
1607
- renderDebugFrame: boolean;
1608
- components: Components;
1609
- readonly world: World;
1610
- readonly renderer: THREE.WebGLRenderer;
1611
- protected autoUpdate: boolean;
1612
- protected updateInterval: number;
1613
- protected readonly worker: Worker;
1614
- protected readonly scene: THREE.Scene;
1615
- private _width;
1616
- private _height;
1617
- private _availableColor;
1618
- private readonly renderTarget;
1619
- private readonly bufferSize;
1620
- private readonly _buffer;
1621
- protected _isWorkerBusy: boolean;
1622
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1623
- /** {@link Disposable.dispose} */
1624
- dispose(): void;
1600
+ update(delta?: number): void;
1601
+ }
1602
+ /** Basic type to describe the progress of any kind of process. */
1603
+ export interface Progress {
1604
+ /** The amount of things that have been done already. */
1605
+ current: number;
1606
+ /** The total amount of things to be done by the process. */
1607
+ total: number;
1608
+ }
1609
+ /**
1610
+ * Whether this component supports create and destroy operations. This generally
1611
+ * applies for components that work with instances, such as clipping planes or
1612
+ * dimensions.
1613
+ */
1614
+ export interface Createable {
1615
+ /** Creates a new instance of an element (e.g. a new Dimension). */
1616
+ create: (data: any) => void;
1625
1617
  /**
1626
- * The function that the culler uses to reprocess the scene. Generally it's
1627
- * better to call needsUpdate, but you can also call this to force it.
1628
- * @param force if true, it will refresh the scene even if needsUpdate is
1629
- * not true.
1618
+ * Finish the creation process of the component, successfully creating an
1619
+ * instance of whatever the component creates.
1630
1620
  */
1631
- updateVisibility: (force?: boolean) => Promise<void>;
1632
- protected getAvailableColor(): {
1633
- r: number;
1634
- g: number;
1635
- b: number;
1636
- code: string;
1637
- };
1638
- protected increaseColor(): void;
1639
- protected decreaseColor(): void;
1640
- private applySettings;
1621
+ endCreation?: (data: any) => void;
1622
+ /**
1623
+ * Cancels the creation process of the component, going back to the state
1624
+ * before starting to create.
1625
+ */
1626
+ cancelCreation?: (data: any) => void;
1627
+ /** Deletes an existing instance of an element (e.g. a Dimension). */
1628
+ delete: (data: any) => void;
1641
1629
  }
1642
- import * as THREE from "three";
1643
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1644
- import { Components } from "../../Components";
1645
- import { Event, World } from "../../Types";
1646
1630
  /**
1647
- * A renderer to determine a mesh visibility on screen
1631
+ * Whether this component supports to be configured.
1648
1632
  */
1649
- export declare class MeshCullerRenderer extends CullerRenderer {
1650
- threshold: number;
1651
- readonly onViewUpdated: Event<{
1652
- seen: Set<THREE.Mesh>;
1653
- unseen: Set<THREE.Mesh>;
1654
- }>;
1655
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1656
- isProcessing: boolean;
1657
- private _colorCodeMeshMap;
1658
- private _meshIDColorCodeMap;
1659
- private _currentVisibleMeshes;
1660
- private _recentlyHiddenMeshes;
1661
- private _intervalID;
1662
- private readonly _transparentMat;
1663
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1664
- dispose(): void;
1665
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1666
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1667
- private handleWorkerMessage;
1668
- private getAvailableMaterial;
1633
+ export interface Configurable<T extends Record<string, any>> {
1634
+ /** Wether this components has been already configured. */
1635
+ isSetup: boolean;
1636
+ /** Use the provided configuration to setup the tool. */
1637
+ setup: (config?: Partial<T>) => void | Promise<void>;
1638
+ /** Fired after successfully calling {@link Configurable.setup()} */
1639
+ readonly onSetup: Event<any>;
1640
+ /** Object holding the tool configuration. Is not meant to be edited directly, if you need
1641
+ * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
1642
+ */
1643
+ config: Required<T>;
1669
1644
  }
1670
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1671
- import * as WEBIFC from "web-ifc";
1672
- /** Configuration of the IFC-fragment conversion. */
1673
- export declare class IfcFragmentSettings {
1674
- /** Whether to extract the IFC properties into a JSON. */
1675
- includeProperties: boolean;
1645
+ /**
1646
+ * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
1647
+ */
1648
+ export interface BVHGeometry extends THREE.BufferGeometry {
1649
+ boundsTree: Object | undefined;
1650
+ disposeBoundsTree: () => void;
1651
+ }
1652
+ /**
1653
+ * Whether a camera uses the Camera Controls library.
1654
+ */
1655
+ export interface CameraControllable {
1656
+ controls: CameraControls;
1657
+ }
1658
+ import * as THREE from "three";
1659
+ import CameraControls from "camera-controls";
1660
+ import { BaseWorldItem } from "./base-world-item";
1661
+ import { CameraControllable } from "./interfaces";
1662
+ export declare abstract class BaseCamera extends BaseWorldItem {
1663
+ abstract enabled: boolean;
1664
+ abstract three: THREE.Camera;
1665
+ abstract controls?: CameraControls;
1666
+ /** Whether is instance is {@link CameraControllable}. */
1667
+ hasCameraControls: () => this is CameraControllable;
1668
+ }
1669
+ import * as THREE from "three";
1670
+ import { Vector2 } from "three";
1671
+ import { Event } from "./event";
1672
+ import { BaseWorldItem } from "./base-world-item";
1673
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
1674
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1675
+ abstract three: THREE.WebGLRenderer;
1676
+ /** {@link Updateable.onBeforeUpdate} */
1677
+ onAfterUpdate: Event<unknown>;
1678
+ /** {@link Updateable.onAfterUpdate} */
1679
+ onBeforeUpdate: Event<unknown>;
1680
+ /** {@link Disposable.onDisposed} */
1681
+ readonly onDisposed: Event<undefined>;
1682
+ readonly onResize: Event<THREE.Vector2>;
1676
1683
  /**
1677
- * Generate the geometry for categories that are not included by default,
1678
- * like IFCSPACE.
1684
+ * Event that fires when there has been a change to the list of clipping
1685
+ * planes used by the active renderer.
1679
1686
  */
1680
- optionalCategories: number[];
1681
- /** Whether to use the coordination data coming from the IFC files. */
1682
- coordinate: boolean;
1683
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1684
- wasm: {
1685
- path: string;
1686
- absolute: boolean;
1687
- logLevel?: WEBIFC.LogLevel;
1688
- };
1689
- /** List of categories that won't be converted to fragments. */
1690
- excludedCategories: Set<number>;
1691
- /** Whether to save the absolute location of all IFC items. */
1692
- saveLocations: boolean;
1693
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1694
- webIfc: WEBIFC.LoaderSettings;
1695
- autoSetWasm: boolean;
1696
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1687
+ readonly onClippingPlanesUpdated: Event<unknown>;
1688
+ abstract update(delta?: number): void | Promise<void>;
1689
+ abstract dispose(): void;
1690
+ abstract getSize(): Vector2;
1691
+ abstract resize(size: Vector2 | undefined): void;
1692
+ /**
1693
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1694
+ * instance of the renderer.
1695
+ */
1696
+ clippingPlanes: THREE.Plane[];
1697
+ /**
1698
+ * Forces the update of the clipping planes and all components that depend
1699
+ * on them that are subscribed to 'onClippingPlanesUpdated'.
1700
+ */
1701
+ updateClippingPlanes(): void;
1702
+ /**
1703
+ * Adds or removes a
1704
+ * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1705
+ * to the renderer.
1706
+ */
1707
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1697
1708
  }
1698
1709
  import * as THREE from "three";
1699
- import * as WEBIFC from "web-ifc";
1700
- import * as FRAGS from "@thatopen/fragments";
1701
- export declare class CivilReader {
1702
- defLineMat: THREE.LineBasicMaterial;
1703
- read(webIfc: WEBIFC.IfcAPI): {
1704
- alignments: Map<number, FRAGS.Alignment>;
1705
- coordinationMatrix: THREE.Matrix4;
1706
- } | undefined;
1707
- get(civilItems: any): {
1708
- alignments: Map<number, FRAGS.Alignment>;
1709
- coordinationMatrix: THREE.Matrix4;
1710
- } | undefined;
1711
- private getCurves;
1712
- }
1713
- import * as WEBIFC from "web-ifc";
1714
- export declare class IfcMetadataReader {
1715
- get(webIfc: WEBIFC.IfcAPI, type: number): string;
1716
- }
1717
- import { NavigationMode } from "./types";
1718
- import { OrthoPerspectiveCamera } from "../index";
1719
- /**
1720
- * A {@link NavigationMode} that allows first person navigation,
1721
- * simulating FPS video games.
1722
- */
1723
- export declare class FirstPersonMode implements NavigationMode {
1724
- private camera;
1725
- /** {@link NavigationMode.enabled} */
1726
- enabled: boolean;
1727
- /** {@link NavigationMode.id} */
1728
- readonly id = "FirstPerson";
1729
- constructor(camera: OrthoPerspectiveCamera);
1730
- /** {@link NavigationMode.set} */
1731
- set(active: boolean): void;
1732
- private setupFirstPersonCamera;
1710
+ import { BaseScene } from "./base-scene";
1711
+ import { BaseCamera } from "./base-camera";
1712
+ import { BaseRenderer } from "./base-renderer";
1713
+ import { Updateable, Disposable } from "./interfaces";
1714
+ export interface World extends Disposable, Updateable {
1715
+ meshes: Set<THREE.Mesh>;
1716
+ scene: BaseScene;
1717
+ camera: BaseCamera;
1718
+ renderer: BaseRenderer | null;
1719
+ uuid: string;
1720
+ isDisposing: boolean;
1733
1721
  }
1734
1722
  import { NavigationMode } from "./types";
1735
1723
  import { OrthoPerspectiveCamera } from "../index";
@@ -1751,23 +1739,32 @@ export declare class OrbitMode implements NavigationMode {
1751
1739
  import { NavigationMode } from "./types";
1752
1740
  import { OrthoPerspectiveCamera } from "../index";
1753
1741
  /**
1754
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1755
- * like many BIM tools.
1742
+ * A {@link NavigationMode} that allows first person navigation,
1743
+ * simulating FPS video games.
1756
1744
  */
1757
- export declare class PlanMode implements NavigationMode {
1745
+ export declare class FirstPersonMode implements NavigationMode {
1758
1746
  private camera;
1759
1747
  /** {@link NavigationMode.enabled} */
1760
1748
  enabled: boolean;
1761
1749
  /** {@link NavigationMode.id} */
1762
- readonly id = "Plan";
1763
- private mouseAction1?;
1764
- private mouseAction2?;
1765
- private mouseInitialized;
1766
- private readonly defaultAzimuthSpeed;
1767
- private readonly defaultPolarSpeed;
1750
+ readonly id = "FirstPerson";
1768
1751
  constructor(camera: OrthoPerspectiveCamera);
1769
1752
  /** {@link NavigationMode.set} */
1770
1753
  set(active: boolean): void;
1754
+ private setupFirstPersonCamera;
1755
+ }
1756
+ import * as THREE from "three";
1757
+ import { Disposable } from "./interfaces";
1758
+ import { Event } from "./event";
1759
+ import { Components } from "../../Components";
1760
+ import { BaseWorldItem } from "./base-world-item";
1761
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1762
+ /** {@link Disposable.onDisposed} */
1763
+ readonly onDisposed: Event<unknown>;
1764
+ abstract three: THREE.Object3D;
1765
+ protected constructor(components: Components);
1766
+ /** {@link Disposable.dispose} */
1767
+ dispose(): void;
1771
1768
  }
1772
1769
  import * as THREE from "three";
1773
1770
  import { CameraProjection } from "./types";
@@ -1833,6 +1830,27 @@ export interface NavigationMode {
1833
1830
  /** Whether this navigation mode is active or not. */
1834
1831
  enabled: boolean;
1835
1832
  }
1833
+ import { NavigationMode } from "./types";
1834
+ import { OrthoPerspectiveCamera } from "../index";
1835
+ /**
1836
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1837
+ * like many BIM tools.
1838
+ */
1839
+ export declare class PlanMode implements NavigationMode {
1840
+ private camera;
1841
+ /** {@link NavigationMode.enabled} */
1842
+ enabled: boolean;
1843
+ /** {@link NavigationMode.id} */
1844
+ readonly id = "Plan";
1845
+ private mouseAction1?;
1846
+ private mouseAction2?;
1847
+ private mouseInitialized;
1848
+ private readonly defaultAzimuthSpeed;
1849
+ private readonly defaultPolarSpeed;
1850
+ constructor(camera: OrthoPerspectiveCamera);
1851
+ /** {@link NavigationMode.set} */
1852
+ set(active: boolean): void;
1853
+ }
1836
1854
  import { IfcFragmentSettings } from "../../IfcLoader/src";
1837
1855
  /** Configuration of the IFC-fragment streaming. */
1838
1856
  export declare class IfcStreamingSettings extends IfcFragmentSettings {
@@ -1844,6 +1862,48 @@ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1844
1862
  propertiesSize: number;
1845
1863
  }
1846
1864
  import * as WEBIFC from "web-ifc";
1865
+ /** Configuration of the IFC-fragment conversion. */
1866
+ export declare class IfcFragmentSettings {
1867
+ /** Whether to extract the IFC properties into a JSON. */
1868
+ includeProperties: boolean;
1869
+ /**
1870
+ * Generate the geometry for categories that are not included by default,
1871
+ * like IFCSPACE.
1872
+ */
1873
+ optionalCategories: number[];
1874
+ /** Whether to use the coordination data coming from the IFC files. */
1875
+ coordinate: boolean;
1876
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1877
+ wasm: {
1878
+ path: string;
1879
+ absolute: boolean;
1880
+ logLevel?: WEBIFC.LogLevel;
1881
+ };
1882
+ /** List of categories that won't be converted to fragments. */
1883
+ excludedCategories: Set<number>;
1884
+ /** Whether to save the absolute location of all IFC items. */
1885
+ saveLocations: boolean;
1886
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1887
+ webIfc: WEBIFC.LoaderSettings;
1888
+ autoSetWasm: boolean;
1889
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1890
+ }
1891
+ export interface StreamedGeometries {
1892
+ [id: number]: {
1893
+ boundingBox: Float32Array;
1894
+ hasHoles: boolean;
1895
+ geometryFile?: string;
1896
+ };
1897
+ }
1898
+ export interface StreamedAsset {
1899
+ id: number;
1900
+ geometries: {
1901
+ geometryID: number;
1902
+ transformation: number[];
1903
+ color: number[];
1904
+ }[];
1905
+ }
1906
+ import * as WEBIFC from "web-ifc";
1847
1907
  import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1848
1908
  import { PropertiesStreamingSettings } from "./streaming-settings";
1849
1909
  export declare class FragmentPropsStreamConverter extends Component implements Disposable {
@@ -1870,91 +1930,24 @@ export declare class FragmentPropsStreamConverter extends Component implements D
1870
1930
  private getIndices;
1871
1931
  private cleanUp;
1872
1932
  }
1873
- export interface StreamedGeometries {
1874
- [id: number]: {
1875
- boundingBox: Float32Array;
1876
- hasHoles: boolean;
1877
- geometryFile?: string;
1878
- };
1879
- }
1880
- export interface StreamedAsset {
1881
- id: number;
1882
- geometries: {
1883
- geometryID: number;
1884
- transformation: number[];
1885
- color: number[];
1886
- }[];
1933
+ import * as WEBIFC from "web-ifc";
1934
+ export declare class IfcMetadataReader {
1935
+ get(webIfc: WEBIFC.IfcAPI, type: number): string;
1887
1936
  }
1888
1937
  import * as THREE from "three";
1889
- import { Hideable, Disposable, Event, World } from "../../Types";
1890
- import { Components } from "../../Components";
1891
- /**
1892
- * Each of the planes created by {@link SimpleClipper}.
1893
- */
1894
- export declare class SimplePlane implements Disposable, Hideable {
1895
- /** Event that fires when the user starts dragging a clipping plane. */
1896
- readonly onDraggingStarted: Event<unknown>;
1897
- /** Event that fires when the user stops dragging a clipping plane. */
1898
- readonly onDraggingEnded: Event<unknown>;
1899
- /** {@link Disposable.onDisposed} */
1900
- readonly onDisposed: Event<unknown>;
1901
- readonly normal: THREE.Vector3;
1902
- readonly origin: THREE.Vector3;
1903
- readonly three: THREE.Plane;
1904
- protected readonly _helper: THREE.Object3D;
1905
- protected _visible: boolean;
1906
- protected _enabled: boolean;
1907
- components: Components;
1908
- world: World;
1909
- private _controlsActive;
1910
- private readonly _arrowBoundBox;
1911
- private readonly _planeMesh;
1912
- private readonly _controls;
1913
- private readonly _hiddenMaterial;
1914
- get enabled(): boolean;
1915
- /** {@link Component.enabled} */
1916
- set enabled(state: boolean);
1917
- /** {@link Hideable.visible } */
1918
- get visible(): boolean;
1919
- /** {@link Hideable.visible } */
1920
- set visible(state: boolean);
1921
- /** The meshes used for raycasting */
1922
- get meshes(): THREE.Mesh[];
1923
- /** The material of the clipping plane representation. */
1924
- get planeMaterial(): THREE.Material | THREE.Material[];
1925
- /** The material of the clipping plane representation. */
1926
- set planeMaterial(material: THREE.Material | THREE.Material[]);
1927
- /** The size of the clipping plane representation. */
1928
- get size(): number;
1929
- /** Sets the size of the clipping plane representation. */
1930
- set size(size: number);
1931
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1932
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1933
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
1934
- /** {@link Updateable.update} */
1935
- update: () => void;
1936
- /** {@link Disposable.dispose} */
1937
- dispose(): void;
1938
- private reset;
1939
- protected toggleControls(state: boolean): void;
1940
- private newTransformControls;
1941
- private initializeControls;
1942
- private createArrowBoundingBox;
1943
- private changeDrag;
1944
- private notifyDraggingChanged;
1945
- private preventCameraMovement;
1946
- private newHelper;
1947
- private static newPlaneMesh;
1948
- }
1949
1938
  import * as WEBIFC from "web-ifc";
1950
- import * as THREE from "three";
1951
- export declare class Units {
1952
- factor: number;
1953
- complement: number;
1954
- apply(matrix: THREE.Matrix4): void;
1955
- setUp(webIfc: WEBIFC.IfcAPI): void;
1956
- private getLengthUnits;
1957
- private getScaleMatrix;
1939
+ import * as FRAGS from "@thatopen/fragments";
1940
+ export declare class CivilReader {
1941
+ defLineMat: THREE.LineBasicMaterial;
1942
+ read(webIfc: WEBIFC.IfcAPI): {
1943
+ alignments: Map<number, FRAGS.Alignment>;
1944
+ coordinationMatrix: THREE.Matrix4;
1945
+ } | undefined;
1946
+ get(civilItems: any): {
1947
+ alignments: Map<number, FRAGS.Alignment>;
1948
+ coordinationMatrix: THREE.Matrix4;
1949
+ } | undefined;
1950
+ private getCurves;
1958
1951
  }
1959
1952
  export type RelationsMap = Map<number, Map<number, number[]>>;
1960
1953
  export interface ModelsRelationMap {
@@ -1980,6 +1973,16 @@ export type InverseAttributes = [
1980
1973
  "ContainsElements"
1981
1974
  ];
1982
1975
  export type InverseAttribute = InverseAttributes[number];
1976
+ import * as WEBIFC from "web-ifc";
1977
+ import * as THREE from "three";
1978
+ export declare class Units {
1979
+ factor: number;
1980
+ complement: number;
1981
+ apply(matrix: THREE.Matrix4): void;
1982
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1983
+ private getLengthUnits;
1984
+ private getScaleMatrix;
1985
+ }
1983
1986
  import { BufferGeometry } from "three";
1984
1987
  import * as THREE from "three";
1985
1988
  export declare class TransformHelper {