@thatopen/components 2.0.25 → 2.0.26

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,4 +1,122 @@
1
1
  declare namespace OBC {
2
+ import { Component, Disposable, World, Event } from "../Types";
3
+ import { SimpleRaycaster } from "./src";
4
+ import { Components } from "../Components";
5
+ /**
6
+ * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
7
+ */
8
+ export declare class Raycasters extends Component implements Disposable {
9
+ /**
10
+ * A unique identifier for the component.
11
+ * This UUID is used to register the component within the Components system.
12
+ */
13
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
14
+ /** {@link Component.enabled} */
15
+ enabled: boolean;
16
+ /**
17
+ * A Map that stores raycasters for each world.
18
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
19
+ */
20
+ list: Map<string, SimpleRaycaster>;
21
+ /** {@link Disposable.onDisposed} */
22
+ onDisposed: Event<unknown>;
23
+ constructor(components: Components);
24
+ /**
25
+ * Retrieves a SimpleRaycaster instance for the given world.
26
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
27
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
28
+ *
29
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
30
+ * @returns The SimpleRaycaster instance for the given world.
31
+ */
32
+ get(world: World): SimpleRaycaster;
33
+ /**
34
+ * Deletes the SimpleRaycaster instance associated with the given world.
35
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
36
+ *
37
+ * @param world - The world for which to delete the SimpleRaycaster instance.
38
+ * @returns {void}
39
+ */
40
+ delete(world: World): void;
41
+ /** {@link Disposable.dispose} */
42
+ dispose(): void;
43
+ }
44
+ import { Component, Disposable, Event } from "../Types";
45
+ /**
46
+ * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
47
+ */
48
+ export declare class Components implements Disposable {
49
+ /**
50
+ * The version of the @thatopen/components library.
51
+ */
52
+ static readonly release = "2.0.26";
53
+ /** {@link Disposable.onDisposed} */
54
+ readonly onDisposed: Event<void>;
55
+ /**
56
+ * The list of components created in this app.
57
+ * The keys are UUIDs and the values are instances of the components.
58
+ */
59
+ readonly list: Map<string, Component>;
60
+ /**
61
+ * If disabled, the animation loop will be stopped.
62
+ * Default value is false.
63
+ */
64
+ enabled: boolean;
65
+ private _clock;
66
+ /**
67
+ * Adds a component to the list of components.
68
+ * Throws an error if a component with the same UUID already exists.
69
+ *
70
+ * @param uuid - The unique identifier of the component.
71
+ * @param instance - The instance of the component to be added.
72
+ *
73
+ * @throws Will throw an error if a component with the same UUID already exists.
74
+ *
75
+ * @internal
76
+ */
77
+ add(uuid: string, instance: Component): void;
78
+ /**
79
+ * Retrieves a component instance by its constructor function.
80
+ * If the component does not exist in the list, it will be created and added.
81
+ *
82
+ * @template U - The type of the component to retrieve.
83
+ * @param Component - The constructor function of the component to retrieve.
84
+ *
85
+ * @returns The instance of the requested component.
86
+ *
87
+ * @throws Will throw an error if a component with the same UUID already exists.
88
+ *
89
+ * @internal
90
+ */
91
+ get<U extends Component>(Component: new (components: Components) => U): U;
92
+ constructor();
93
+ /**
94
+ * Initializes the Components instance.
95
+ * This method starts the animation loop, sets the enabled flag to true,
96
+ * and calls the update method.
97
+ *
98
+ * @returns {void}
99
+ */
100
+ init(): void;
101
+ /**
102
+ * Disposes the memory of all the components and tools of this instance of
103
+ * the library. A memory leak will be created if:
104
+ *
105
+ * - An instance of the library ends up out of scope and this function isn't
106
+ * called. This is especially relevant in Single Page Applications (React,
107
+ * Angular, Vue, etc).
108
+ *
109
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
110
+ * referenced by a reference type (object or array).
111
+ *
112
+ * You can learn more about how Three.js handles memory leaks
113
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
114
+ *
115
+ */
116
+ dispose(): void;
117
+ private update;
118
+ private static setupBVH;
119
+ }
2
120
  import * as THREE from "three";
3
121
  import { Components } from "../Components";
4
122
  import { Component } from "../Types";
@@ -44,6 +162,122 @@ export declare class Disposer extends Component {
44
162
  private disposeChildren;
45
163
  private static disposeMaterial;
46
164
  }
165
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
166
+ import { Components } from "../Components";
167
+ import { SimpleWorld } from "./src";
168
+ /**
169
+ * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
170
+ */
171
+ export declare class Worlds extends Component implements Updateable, Disposable {
172
+ /**
173
+ * A unique identifier for the component.
174
+ * This UUID is used to register the component within the Components system.
175
+ */
176
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
177
+ /** {@link Updateable.onAfterUpdate} */
178
+ readonly onAfterUpdate: Event<unknown>;
179
+ /** {@link Updateable.onBeforeUpdate} */
180
+ readonly onBeforeUpdate: Event<unknown>;
181
+ /** {@link Disposable.onDisposed} */
182
+ readonly onDisposed: Event<unknown>;
183
+ /**
184
+ * An event that is triggered when a new world is created.
185
+ * The event passes the newly created world as a parameter.
186
+ */
187
+ readonly onWorldCreated: Event<World>;
188
+ /**
189
+ * An event that is triggered when a world is deleted.
190
+ * The event passes the UUID of the deleted world as a parameter.
191
+ */
192
+ readonly onWorldDeleted: Event<string>;
193
+ /**
194
+ * A collection of worlds managed by this component.
195
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
196
+ */
197
+ list: Map<string, World>;
198
+ /** {@link Component.enabled} */
199
+ enabled: boolean;
200
+ constructor(components: Components);
201
+ /**
202
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
203
+ *
204
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
205
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
206
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
207
+ *
208
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
209
+ */
210
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
211
+ /**
212
+ * Deletes a world from the list of worlds.
213
+ *
214
+ * @param {World} world - The world to be deleted.
215
+ *
216
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
217
+ *
218
+ * @returns {void}
219
+ */
220
+ delete(world: World): void;
221
+ /**
222
+ * Disposes of the Worlds component and all its managed worlds.
223
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
224
+ * and triggers the onDisposed event.
225
+ *
226
+ * @returns {void}
227
+ */
228
+ dispose(): void;
229
+ /** {@link Updateable.update} */
230
+ update(delta?: number): void | Promise<void>;
231
+ }
232
+ import { Component, Disposable, World, Event } from "../Types";
233
+ import { GridConfig, SimpleGrid } from "./src";
234
+ import { Components } from "../Components";
235
+ /**
236
+ * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
237
+ */
238
+ export declare class Grids extends Component implements Disposable {
239
+ /**
240
+ * A unique identifier for the component.
241
+ * This UUID is used to register the component within the Components system.
242
+ */
243
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
244
+ /**
245
+ * A map of world UUIDs to their corresponding grid instances.
246
+ */
247
+ list: Map<string, SimpleGrid>;
248
+ /**
249
+ * The default configuration for grid creation.
250
+ */
251
+ config: Required<GridConfig>;
252
+ /** {@link Disposable.onDisposed} */
253
+ readonly onDisposed: Event<unknown>;
254
+ /** {@link Component.enabled} */
255
+ enabled: boolean;
256
+ constructor(components: Components);
257
+ /**
258
+ * Creates a new grid for the given world.
259
+ * Throws an error if a grid already exists for the world.
260
+ *
261
+ * @param world - The world to create the grid for.
262
+ * @returns The newly created grid.
263
+ *
264
+ * @throws Will throw an error if a grid already exists for the given world.
265
+ */
266
+ create(world: World): SimpleGrid;
267
+ /**
268
+ * Deletes the grid associated with the given world.
269
+ * If a grid does not exist for the given world, this method does nothing.
270
+ *
271
+ * @param world - The world for which to delete the grid.
272
+ *
273
+ * @remarks
274
+ * This method will dispose of the grid and remove it from the internal list.
275
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
276
+ */
277
+ delete(world: World): void;
278
+ /** {@link Disposable.dispose} */
279
+ dispose(): void;
280
+ }
47
281
  import * as THREE from "three";
48
282
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
49
283
  import { SimplePlane } from "./src";
@@ -218,123 +452,53 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
218
452
  /** {@link Updateable.update} */
219
453
  update(): void;
220
454
  }
221
- import { Component, Disposable, World, Event } from "../Types";
222
- import { SimpleRaycaster } from "./src";
223
455
  import { Components } from "../Components";
456
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
457
+ import { Component, Event, Disposable, World } from "../Types";
224
458
  /**
225
- * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
459
+ * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
226
460
  */
227
- export declare class Raycasters extends Component implements Disposable {
461
+ export declare class Cullers extends Component implements Disposable {
228
462
  /**
229
463
  * A unique identifier for the component.
230
464
  * This UUID is used to register the component within the Components system.
231
465
  */
232
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
233
- /** {@link Component.enabled} */
234
- enabled: boolean;
466
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
235
467
  /**
236
- * A Map that stores raycasters for each world.
237
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
468
+ * An event that is triggered when the Cullers component is disposed.
238
469
  */
239
- list: Map<string, SimpleRaycaster>;
240
- /** {@link Disposable.onDisposed} */
241
- onDisposed: Event<unknown>;
242
- constructor(components: Components);
470
+ readonly onDisposed: Event<unknown>;
471
+ private _enabled;
243
472
  /**
244
- * Retrieves a SimpleRaycaster instance for the given world.
245
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
246
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
247
- *
248
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
249
- * @returns The SimpleRaycaster instance for the given world.
250
- */
251
- get(world: World): SimpleRaycaster;
252
- /**
253
- * Deletes the SimpleRaycaster instance associated with the given world.
254
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
255
- *
256
- * @param world - The world for which to delete the SimpleRaycaster instance.
257
- * @returns {void}
258
- */
259
- delete(world: World): void;
260
- /** {@link Disposable.dispose} */
261
- dispose(): void;
262
- }
263
- import { Component, Disposable, Event } from "../Types";
264
- /**
265
- * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
266
- */
267
- export declare class Components implements Disposable {
268
- /**
269
- * The version of the @thatopen/components library.
270
- */
271
- static readonly release = "2.0.25";
272
- /** {@link Disposable.onDisposed} */
273
- readonly onDisposed: Event<void>;
274
- /**
275
- * The list of components created in this app.
276
- * The keys are UUIDs and the values are instances of the components.
277
- */
278
- readonly list: Map<string, Component>;
279
- /**
280
- * If disabled, the animation loop will be stopped.
281
- * Default value is false.
473
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
282
474
  */
283
- enabled: boolean;
284
- private _clock;
475
+ list: Map<string, MeshCullerRenderer>;
476
+ /** {@link Component.enabled} */
477
+ get enabled(): boolean;
478
+ /** {@link Component.enabled} */
479
+ set enabled(value: boolean);
480
+ constructor(components: Components);
285
481
  /**
286
- * Adds a component to the list of components.
287
- * Throws an error if a component with the same UUID already exists.
288
- *
289
- * @param uuid - The unique identifier of the component.
290
- * @param instance - The instance of the component to be added.
482
+ * Creates a new MeshCullerRenderer for the given world.
483
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
291
484
  *
292
- * @throws Will throw an error if a component with the same UUID already exists.
485
+ * @param world - The world for which to create the MeshCullerRenderer.
486
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
293
487
  *
294
- * @internal
488
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
295
489
  */
296
- add(uuid: string, instance: Component): void;
490
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
297
491
  /**
298
- * Retrieves a component instance by its constructor function.
299
- * If the component does not exist in the list, it will be created and added.
300
- *
301
- * @template U - The type of the component to retrieve.
302
- * @param Component - The constructor function of the component to retrieve.
303
- *
304
- * @returns The instance of the requested component.
305
- *
306
- * @throws Will throw an error if a component with the same UUID already exists.
492
+ * Deletes the MeshCullerRenderer associated with the given world.
493
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
307
494
  *
308
- * @internal
309
- */
310
- get<U extends Component>(Component: new (components: Components) => U): U;
311
- constructor();
312
- /**
313
- * Initializes the Components instance.
314
- * This method starts the animation loop, sets the enabled flag to true,
315
- * and calls the update method.
495
+ * @param world - The world for which to delete the MeshCullerRenderer.
316
496
  *
317
497
  * @returns {void}
318
498
  */
319
- init(): void;
320
- /**
321
- * Disposes the memory of all the components and tools of this instance of
322
- * the library. A memory leak will be created if:
323
- *
324
- * - An instance of the library ends up out of scope and this function isn't
325
- * called. This is especially relevant in Single Page Applications (React,
326
- * Angular, Vue, etc).
327
- *
328
- * - Any of the objects of this instance (meshes, geometries,materials, etc) is
329
- * referenced by a reference type (object or array).
330
- *
331
- * You can learn more about how Three.js handles memory leaks
332
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
333
- *
334
- */
499
+ delete(world: World): void;
500
+ /** {@link Disposable.dispose} */
335
501
  dispose(): void;
336
- private update;
337
- private static setupBVH;
338
502
  }
339
503
  import * as THREE from "three";
340
504
  import { Components } from "../Components";
@@ -400,170 +564,6 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
400
564
  private newOrthoCamera;
401
565
  private setOrthoPerspCameraAspect;
402
566
  }
403
- import { Components } from "../Components";
404
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
405
- import { Component, Event, Disposable, World } from "../Types";
406
- /**
407
- * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
408
- */
409
- export declare class Cullers extends Component implements Disposable {
410
- /**
411
- * A unique identifier for the component.
412
- * This UUID is used to register the component within the Components system.
413
- */
414
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
415
- /**
416
- * An event that is triggered when the Cullers component is disposed.
417
- */
418
- readonly onDisposed: Event<unknown>;
419
- private _enabled;
420
- /**
421
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
422
- */
423
- list: Map<string, MeshCullerRenderer>;
424
- /** {@link Component.enabled} */
425
- get enabled(): boolean;
426
- /** {@link Component.enabled} */
427
- set enabled(value: boolean);
428
- constructor(components: Components);
429
- /**
430
- * Creates a new MeshCullerRenderer for the given world.
431
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
432
- *
433
- * @param world - The world for which to create the MeshCullerRenderer.
434
- * @param config - Optional configuration settings for the MeshCullerRenderer.
435
- *
436
- * @returns The newly created or existing MeshCullerRenderer for the given world.
437
- */
438
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
439
- /**
440
- * Deletes the MeshCullerRenderer associated with the given world.
441
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
442
- *
443
- * @param world - The world for which to delete the MeshCullerRenderer.
444
- *
445
- * @returns {void}
446
- */
447
- delete(world: World): void;
448
- /** {@link Disposable.dispose} */
449
- dispose(): void;
450
- }
451
- import { Component, Disposable, World, Event } from "../Types";
452
- import { GridConfig, SimpleGrid } from "./src";
453
- import { Components } from "../Components";
454
- /**
455
- * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
456
- */
457
- export declare class Grids extends Component implements Disposable {
458
- /**
459
- * A unique identifier for the component.
460
- * This UUID is used to register the component within the Components system.
461
- */
462
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
463
- /**
464
- * A map of world UUIDs to their corresponding grid instances.
465
- */
466
- list: Map<string, SimpleGrid>;
467
- /**
468
- * The default configuration for grid creation.
469
- */
470
- config: Required<GridConfig>;
471
- /** {@link Disposable.onDisposed} */
472
- readonly onDisposed: Event<unknown>;
473
- /** {@link Component.enabled} */
474
- enabled: boolean;
475
- constructor(components: Components);
476
- /**
477
- * Creates a new grid for the given world.
478
- * Throws an error if a grid already exists for the world.
479
- *
480
- * @param world - The world to create the grid for.
481
- * @returns The newly created grid.
482
- *
483
- * @throws Will throw an error if a grid already exists for the given world.
484
- */
485
- create(world: World): SimpleGrid;
486
- /**
487
- * Deletes the grid associated with the given world.
488
- * If a grid does not exist for the given world, this method does nothing.
489
- *
490
- * @param world - The world for which to delete the grid.
491
- *
492
- * @remarks
493
- * This method will dispose of the grid and remove it from the internal list.
494
- * If the world is disposed before calling this method, the grid will be automatically deleted.
495
- */
496
- delete(world: World): void;
497
- /** {@link Disposable.dispose} */
498
- dispose(): void;
499
- }
500
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
501
- import { Components } from "../Components";
502
- import { SimpleWorld } from "./src";
503
- /**
504
- * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
505
- */
506
- export declare class Worlds extends Component implements Updateable, Disposable {
507
- /**
508
- * A unique identifier for the component.
509
- * This UUID is used to register the component within the Components system.
510
- */
511
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
512
- /** {@link Updateable.onAfterUpdate} */
513
- readonly onAfterUpdate: Event<unknown>;
514
- /** {@link Updateable.onBeforeUpdate} */
515
- readonly onBeforeUpdate: Event<unknown>;
516
- /** {@link Disposable.onDisposed} */
517
- readonly onDisposed: Event<unknown>;
518
- /**
519
- * An event that is triggered when a new world is created.
520
- * The event passes the newly created world as a parameter.
521
- */
522
- readonly onWorldCreated: Event<World>;
523
- /**
524
- * An event that is triggered when a world is deleted.
525
- * The event passes the UUID of the deleted world as a parameter.
526
- */
527
- readonly onWorldDeleted: Event<string>;
528
- /**
529
- * A collection of worlds managed by this component.
530
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
531
- */
532
- list: Map<string, World>;
533
- /** {@link Component.enabled} */
534
- enabled: boolean;
535
- constructor(components: Components);
536
- /**
537
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
538
- *
539
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
540
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
541
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
542
- *
543
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
544
- */
545
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
546
- /**
547
- * Deletes a world from the list of worlds.
548
- *
549
- * @param {World} world - The world to be deleted.
550
- *
551
- * @throws {Error} - Throws an error if the provided world is not found in the list.
552
- *
553
- * @returns {void}
554
- */
555
- delete(world: World): void;
556
- /**
557
- * Disposes of the Worlds component and all its managed worlds.
558
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
559
- * and triggers the onDisposed event.
560
- *
561
- * @returns {void}
562
- */
563
- dispose(): void;
564
- /** {@link Updateable.update} */
565
- update(delta?: number): void | Promise<void>;
566
- }
567
567
  import * as THREE from "three";
568
568
  import * as FRAGS from "@thatopen/fragments";
569
569
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -747,127 +747,30 @@ export declare class BoundingBoxer extends Component implements Disposable {
747
747
  * '''
748
748
  */
749
749
  addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
750
- private static getFragmentBounds;
751
- }
752
- import * as THREE from "three";
753
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
754
- center: THREE.Vector3;
755
- halfSizes: THREE.Vector3;
756
- rotation: THREE.Matrix3;
757
- transformation: THREE.Matrix4;
758
- };
759
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
760
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
761
- import * as THREE from "three";
762
- import * as FRAGS from "@thatopen/fragments";
763
- import { Component, Components, Event, Disposable } from "../../core";
764
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
765
- /**
766
- * Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
767
- */
768
- export declare class FragmentsManager extends Component implements Disposable {
769
- /**
770
- * A unique identifier for the component.
771
- * This UUID is used to register the component within the Components system.
772
- */
773
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
774
- /** {@link Disposable.onDisposed} */
775
- readonly onDisposed: Event<unknown>;
776
- /**
777
- * Event triggered when fragments are loaded.
778
- */
779
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
780
- /**
781
- * Event triggered when fragments are disposed.
782
- */
783
- readonly onFragmentsDisposed: Event<{
784
- groupID: string;
785
- fragmentIDs: string[];
786
- }>;
787
- /**
788
- * Map containing all loaded fragments.
789
- * The key is the fragment's unique identifier, and the value is the fragment itself.
790
- */
791
- readonly list: Map<string, Fragment>;
792
- /**
793
- * Map containing all loaded fragment groups.
794
- * The key is the group's unique identifier, and the value is the group itself.
795
- */
796
- readonly groups: Map<string, FragmentsGroup>;
797
- baseCoordinationModel: string;
798
- /** {@link Component.enabled} */
799
- enabled: boolean;
800
- private _loader;
801
750
  /**
802
- * Getter for the meshes of all fragments in the FragmentsManager.
803
- * It iterates over the fragments in the list and pushes their meshes into an array.
804
- * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
805
- */
806
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
807
- constructor(components: Components);
808
- /** {@link Disposable.dispose} */
809
- dispose(): void;
810
- /**
811
- * Dispose of a specific fragment group.
812
- * This method removes the group from the groups map, deletes all fragments within the group from the list,
813
- * disposes of the group, and triggers the onFragmentsDisposed event.
751
+ * Uses a FragmentIdMap to add its meshes to the bb calculation.
814
752
  *
815
- * @param group - The fragment group to be disposed.
816
- */
817
- disposeGroup(group: FragmentsGroup): void;
818
- /**
819
- * Loads a binary file that contain fragment geometry.
820
- * @param data - The binary data to load.
821
- * @param config - Optional configuration for loading.
822
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
823
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
824
- * @returns The loaded FragmentsGroup.
825
- */
826
- load(data: Uint8Array, config?: Partial<{
827
- coordinate: boolean;
828
- name: string;
829
- properties: FRAGS.IfcProperties;
830
- relationsMap: RelationsMap;
831
- }>): FragmentsGroup;
832
- /**
833
- * Export the specified fragmentsgroup to binary data.
834
- * @param group - the fragments group to be exported.
835
- * @returns the exported data as binary buffer.
836
- */
837
- export(group: FragmentsGroup): Uint8Array;
838
- /**
839
- * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
840
- * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
841
- * @returns A map of model IDs to sets of express IDs.
842
- */
843
- getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
844
- [modelID: string]: Set<number>;
845
- };
846
- /**
847
- * Converts a map of model IDs to sets of express IDs to a fragment ID map.
848
- * @param modelIdMap - A map of model IDs to their corresponding express IDs.
849
- * @returns A fragment ID map.
850
- * @remarks
851
- * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
852
- * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
853
- * The fragment ID maps are then merged into a single map and returned.
854
- * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
855
- */
856
- modelIdToFragmentIdMap(modelIdMap: {
857
- [modelID: string]: Set<number>;
858
- }): FRAGS.FragmentIdMap;
859
- /**
860
- * Applies coordinate transformation to the provided models.
861
- * If no models are provided, all groups are used.
862
- * The first model in the list becomes the base model for coordinate transformation.
863
- * All other models are then transformed to match the base model's coordinate system.
753
+ * This method iterates through the provided 'fragmentIdMap', retrieves the corresponding fragment from the 'FragmentsManager',
754
+ * and then calls the 'addMesh' method for each fragment's mesh, passing the expression IDs as the second parameter.
864
755
  *
865
- * @param models - The models to apply coordinate transformation to.
866
- * If not provided, all groups are used.
756
+ * @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
867
757
  *
868
- * @returns {void}
758
+ * @remarks
759
+ * This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
760
+ * It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
761
+ *
762
+ * @example
763
+ * '''typescript
764
+ * const boundingBoxer = components.get(BoundingBoxer);
765
+ * const fragmentIdMap: FRAGS.FragmentIdMap = {
766
+ * '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
767
+ * '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
768
+ * };
769
+ * boundingBoxer.addFragmentIdMap(fragmentIdMap);
770
+ * '''
869
771
  */
870
- coordinate(models?: FragmentsGroup[]): void;
772
+ addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
773
+ private static getFragmentBounds;
871
774
  }
872
775
  import { Component, Disposable, Event, Components } from "../../core";
873
776
  /**
@@ -920,10 +823,6 @@ export declare class Exploder extends Component implements Disposable {
920
823
  set(active: boolean): void;
921
824
  }
922
825
  import * as THREE from "three";
923
- export declare class MaterialsUtils {
924
- static isTransparent(material: THREE.Material): boolean;
925
- }
926
- import * as THREE from "three";
927
826
  import * as FRAGS from "@thatopen/fragments";
928
827
  import { Disposable, Component, Event, Components } from "../../core";
929
828
  /**
@@ -1087,103 +986,155 @@ export declare class Classifier extends Component implements Disposable {
1087
986
  resetColor(items: FRAGS.FragmentIdMap): void;
1088
987
  protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
1089
988
  }
1090
- import * as WEBIFC from "web-ifc";
1091
- import { Components, Disposable, Event, Component } from "../../core";
1092
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
989
+ import * as FRAGS from "@thatopen/fragments";
990
+ import { Components, Component } from "../../core";
1093
991
  /**
1094
- * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
992
+ * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
1095
993
  */
1096
- export declare class IfcGeometryTiler extends Component implements Disposable {
994
+ export declare class Hider extends Component {
1097
995
  /**
1098
996
  * A unique identifier for the component.
1099
997
  * This UUID is used to register the component within the Components system.
1100
998
  */
1101
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1102
- /**
1103
- * Event triggered when geometry is streamed.
1104
- * Contains the streamed geometry data and its buffer.
1105
- */
1106
- readonly onGeometryStreamed: Event<{
1107
- buffer: Uint8Array;
1108
- data: StreamedGeometries;
1109
- }>;
999
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1000
+ /** {@link Component.enabled} */
1001
+ enabled: boolean;
1002
+ constructor(components: Components);
1110
1003
  /**
1111
- * Event triggered when assets are streamed.
1112
- * Contains the streamed assets.
1004
+ * Sets the visibility of fragments within the 3D scene.
1005
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1006
+ * If 'items' is provided, only the specified fragments will be affected.
1007
+ *
1008
+ * @param visible - The visibility state to set for the fragments.
1009
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1010
+ * If not provided, all fragments will be affected.
1011
+ *
1012
+ * @returns {void}
1113
1013
  */
1114
- readonly onAssetStreamed: Event<StreamedAsset[]>;
1014
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1115
1015
  /**
1116
- * Event triggered to indicate the progress of the streaming process.
1117
- * Contains the progress percentage.
1016
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1017
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1018
+ *
1019
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1020
+ * If not provided, all fragments will be isolated.
1021
+ *
1022
+ * @returns {void}
1118
1023
  */
1119
- readonly onProgress: Event<number>;
1024
+ isolate(items: FRAGS.FragmentIdMap): void;
1025
+ private updateCulledVisibility;
1026
+ }
1027
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1028
+ import * as THREE from "three";
1029
+ import * as FRAGS from "@thatopen/fragments";
1030
+ import { Component, Components, Event, Disposable } from "../../core";
1031
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
1032
+ /**
1033
+ * Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
1034
+ */
1035
+ export declare class FragmentsManager extends Component implements Disposable {
1120
1036
  /**
1121
- * Event triggered when the IFC file is loaded.
1122
- * Contains the loaded IFC file data.
1037
+ * A unique identifier for the component.
1038
+ * This UUID is used to register the component within the Components system.
1123
1039
  */
1124
- readonly onIfcLoaded: Event<Uint8Array>;
1040
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
1125
1041
  /** {@link Disposable.onDisposed} */
1126
1042
  readonly onDisposed: Event<unknown>;
1127
1043
  /**
1128
- * Settings for the IfcGeometryTiler.
1044
+ * Event triggered when fragments are loaded.
1045
+ */
1046
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
1047
+ /**
1048
+ * Event triggered when fragments are disposed.
1049
+ */
1050
+ readonly onFragmentsDisposed: Event<{
1051
+ groupID: string;
1052
+ fragmentIDs: string[];
1053
+ }>;
1054
+ /**
1055
+ * Map containing all loaded fragments.
1056
+ * The key is the fragment's unique identifier, and the value is the fragment itself.
1057
+ */
1058
+ readonly list: Map<string, Fragment>;
1059
+ /**
1060
+ * Map containing all loaded fragment groups.
1061
+ * The key is the group's unique identifier, and the value is the group itself.
1129
1062
  */
1130
- settings: IfcStreamingSettings;
1063
+ readonly groups: Map<string, FragmentsGroup>;
1064
+ baseCoordinationModel: string;
1131
1065
  /** {@link Component.enabled} */
1132
1066
  enabled: boolean;
1067
+ private _loader;
1133
1068
  /**
1134
- * The WebIFC API instance used for IFC file processing.
1069
+ * Getter for the meshes of all fragments in the FragmentsManager.
1070
+ * It iterates over the fragments in the list and pushes their meshes into an array.
1071
+ * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1135
1072
  */
1136
- webIfc: WEBIFC.IfcAPI;
1137
- private _spatialTree;
1138
- private _metaData;
1139
- private _visitedGeometries;
1140
- private _streamSerializer;
1141
- private _geometries;
1142
- private _geometryCount;
1143
- private _civil;
1144
- private _groupSerializer;
1145
- private _assets;
1146
- private _meshesWithHoles;
1073
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1147
1074
  constructor(components: Components);
1148
1075
  /** {@link Disposable.dispose} */
1149
1076
  dispose(): void;
1150
1077
  /**
1151
- * This method streams the IFC file from a given buffer.
1152
- *
1153
- * @param data - The Uint8Array containing the IFC file data.
1154
- * @returns A Promise that resolves when the streaming process is complete.
1078
+ * Dispose of a specific fragment group.
1079
+ * This method removes the group from the groups map, deletes all fragments within the group from the list,
1080
+ * disposes of the group, and triggers the onFragmentsDisposed event.
1155
1081
  *
1082
+ * @param group - The fragment group to be disposed.
1083
+ */
1084
+ disposeGroup(group: FragmentsGroup): void;
1085
+ /**
1086
+ * Loads a binary file that contain fragment geometry.
1087
+ * @param data - The binary data to load.
1088
+ * @param config - Optional configuration for loading.
1089
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1090
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1091
+ * @returns The loaded FragmentsGroup.
1092
+ */
1093
+ load(data: Uint8Array, config?: Partial<{
1094
+ coordinate: boolean;
1095
+ name: string;
1096
+ properties: FRAGS.IfcProperties;
1097
+ relationsMap: RelationsMap;
1098
+ }>): FragmentsGroup;
1099
+ /**
1100
+ * Export the specified fragmentsgroup to binary data.
1101
+ * @param group - the fragments group to be exported.
1102
+ * @returns the exported data as binary buffer.
1103
+ */
1104
+ export(group: FragmentsGroup): Uint8Array;
1105
+ /**
1106
+ * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1107
+ * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1108
+ * @returns A map of model IDs to sets of express IDs.
1109
+ */
1110
+ getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1111
+ [modelID: string]: Set<number>;
1112
+ };
1113
+ /**
1114
+ * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1115
+ * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1116
+ * @returns A fragment ID map.
1156
1117
  * @remarks
1157
- * This method cleans up any resources after the streaming process is complete.
1158
- *
1159
- * @example
1160
- * '''typescript
1161
- * const ifcData = await fetch('path/to/ifc/file.ifc');
1162
- * const rawBuffer = await response.arrayBuffer();
1163
- * const ifcBuffer = new Uint8Array(rawBuffer);
1164
- * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1165
- * '''
1118
+ * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1119
+ * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1120
+ * The fragment ID maps are then merged into a single map and returned.
1121
+ * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
1166
1122
  */
1167
- streamFromBuffer(data: Uint8Array): Promise<void>;
1123
+ modelIdToFragmentIdMap(modelIdMap: {
1124
+ [modelID: string]: Set<number>;
1125
+ }): FRAGS.FragmentIdMap;
1168
1126
  /**
1169
- * This method streams the IFC file from a given callback.
1170
- *
1171
- * @param loadCallback - The callback function that will be used to load the IFC file.
1172
- * @returns A Promise that resolves when the streaming process is complete.
1127
+ * Applies coordinate transformation to the provided models.
1128
+ * If no models are provided, all groups are used.
1129
+ * The first model in the list becomes the base model for coordinate transformation.
1130
+ * All other models are then transformed to match the base model's coordinate system.
1173
1131
  *
1174
- * @remarks
1175
- * This method cleans up any resources after the streaming process is complete.
1132
+ * @param models - The models to apply coordinate transformation to.
1133
+ * If not provided, all groups are used.
1176
1134
  *
1135
+ * @returns {void}
1177
1136
  */
1178
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1179
- private readIfcFile;
1180
- private streamIfcFile;
1181
- private streamAllGeometries;
1182
- private cleanUp;
1183
- private getMesh;
1184
- private getGeometry;
1185
- private streamAssets;
1186
- private streamGeometries;
1137
+ coordinate(models?: FragmentsGroup[]): void;
1187
1138
  }
1188
1139
  import * as WEBIFC from "web-ifc";
1189
1140
  import * as FRAGS from "@thatopen/fragments";
@@ -1301,181 +1252,176 @@ export declare class IfcLoader extends Component implements Disposable {
1301
1252
  private autoSetWasm;
1302
1253
  }
1303
1254
  import * as WEBIFC from "web-ifc";
1304
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
1305
- import { PropertiesStreamingSettings } from "./src";
1255
+ import { Components, Disposable, Event, Component } from "../../core";
1256
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1306
1257
  /**
1307
- * A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
1258
+ * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
1308
1259
  */
1309
- export declare class IfcPropertiesTiler extends Component implements Disposable {
1260
+ export declare class IfcGeometryTiler extends Component implements Disposable {
1310
1261
  /**
1311
1262
  * A unique identifier for the component.
1312
1263
  * This UUID is used to register the component within the Components system.
1313
1264
  */
1314
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1265
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1315
1266
  /**
1316
- * An event that is triggered when properties are streamed from the IFC file.
1317
- * The event provides the type of the IFC entity and the corresponding data.
1267
+ * Event triggered when geometry is streamed.
1268
+ * Contains the streamed geometry data and its buffer.
1318
1269
  */
1319
- readonly onPropertiesStreamed: AsyncEvent<{
1320
- type: number;
1321
- data: {
1322
- [id: number]: any;
1323
- };
1270
+ readonly onGeometryStreamed: Event<{
1271
+ buffer: Uint8Array;
1272
+ data: StreamedGeometries;
1324
1273
  }>;
1325
1274
  /**
1326
- * An event that is triggered to indicate the progress of the streaming process.
1327
- * The event provides a number between 0 and 1 representing the progress percentage.
1275
+ * Event triggered when assets are streamed.
1276
+ * Contains the streamed assets.
1328
1277
  */
1329
- readonly onProgress: AsyncEvent<number>;
1278
+ readonly onAssetStreamed: Event<StreamedAsset[]>;
1330
1279
  /**
1331
- * An event that is triggered when indices are streamed from the IFC file.
1332
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1280
+ * Event triggered to indicate the progress of the streaming process.
1281
+ * Contains the progress percentage.
1333
1282
  */
1334
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1283
+ readonly onProgress: Event<number>;
1284
+ /**
1285
+ * Event triggered when the IFC file is loaded.
1286
+ * Contains the loaded IFC file data.
1287
+ */
1288
+ readonly onIfcLoaded: Event<Uint8Array>;
1335
1289
  /** {@link Disposable.onDisposed} */
1336
- readonly onDisposed: Event<string>;
1337
- /** {@link Component.enabled} */
1338
- enabled: boolean;
1290
+ readonly onDisposed: Event<unknown>;
1339
1291
  /**
1340
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1292
+ * Settings for the IfcGeometryTiler.
1341
1293
  */
1342
- settings: PropertiesStreamingSettings;
1294
+ settings: IfcStreamingSettings;
1295
+ /** {@link Component.enabled} */
1296
+ enabled: boolean;
1343
1297
  /**
1344
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1298
+ * The WebIFC API instance used for IFC file processing.
1345
1299
  */
1346
1300
  webIfc: WEBIFC.IfcAPI;
1301
+ private _spatialTree;
1302
+ private _metaData;
1303
+ private _visitedGeometries;
1304
+ private _streamSerializer;
1305
+ private _geometries;
1306
+ private _geometryCount;
1307
+ private _civil;
1308
+ private _groupSerializer;
1309
+ private _assets;
1310
+ private _meshesWithHoles;
1311
+ constructor(components: Components);
1347
1312
  /** {@link Disposable.dispose} */
1348
- dispose(): Promise<void>;
1313
+ dispose(): void;
1349
1314
  /**
1350
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1315
+ * This method streams the IFC file from a given buffer.
1351
1316
  *
1352
1317
  * @param data - The Uint8Array containing the IFC file data.
1353
1318
  * @returns A Promise that resolves when the streaming process is complete.
1319
+ *
1320
+ * @remarks
1321
+ * This method cleans up any resources after the streaming process is complete.
1322
+ *
1323
+ * @example
1324
+ * '''typescript
1325
+ * const ifcData = await fetch('path/to/ifc/file.ifc');
1326
+ * const rawBuffer = await response.arrayBuffer();
1327
+ * const ifcBuffer = new Uint8Array(rawBuffer);
1328
+ * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1329
+ * '''
1354
1330
  */
1355
1331
  streamFromBuffer(data: Uint8Array): Promise<void>;
1356
1332
  /**
1357
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1333
+ * This method streams the IFC file from a given callback.
1358
1334
  *
1359
- * @param loadCallback - A callback function that loads the IFC file data.
1335
+ * @param loadCallback - The callback function that will be used to load the IFC file.
1360
1336
  * @returns A Promise that resolves when the streaming process is complete.
1337
+ *
1338
+ * @remarks
1339
+ * This method cleans up any resources after the streaming process is complete.
1340
+ *
1361
1341
  */
1362
1342
  streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1363
1343
  private readIfcFile;
1364
1344
  private streamIfcFile;
1365
- private streamAllProperties;
1345
+ private streamAllGeometries;
1366
1346
  private cleanUp;
1347
+ private getMesh;
1348
+ private getGeometry;
1349
+ private streamAssets;
1350
+ private streamGeometries;
1367
1351
  }
1368
- import * as THREE from "three";
1369
- import * as FRAGS from "@thatopen/fragments";
1370
- import { Component, Components } from "../../core";
1371
- /**
1372
- * Represents an edge measurement result.
1373
- */
1374
- export interface MeasureEdge {
1375
- /**
1376
- * The distance between the two points of the edge.
1377
- */
1378
- distance: number;
1379
- /**
1380
- * The two points that define the edge.
1381
- */
1382
- points: THREE.Vector3[];
1383
- }
1352
+ import * as WEBIFC from "web-ifc";
1353
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
1354
+ import { PropertiesStreamingSettings } from "./src";
1384
1355
  /**
1385
- * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
1356
+ * A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
1386
1357
  */
1387
- export declare class MeasurementUtils extends Component {
1358
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
1388
1359
  /**
1389
1360
  * A unique identifier for the component.
1390
1361
  * This UUID is used to register the component within the Components system.
1391
1362
  */
1392
- static uuid: string;
1393
- /** {@link Component.enabled} */
1394
- enabled: boolean;
1395
- constructor(components: Components);
1363
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1396
1364
  /**
1397
- * Utility method to calculate the distance from a point to a line segment.
1398
- *
1399
- * @param point - The point from which to calculate the distance.
1400
- * @param lineStart - The start point of the line segment.
1401
- * @param lineEnd - The end point of the line segment.
1402
- * @param clamp - If true, the distance will be clamped to the line segment's length.
1403
- * @returns The distance from the point to the line segment.
1365
+ * An event that is triggered when properties are streamed from the IFC file.
1366
+ * The event provides the type of the IFC entity and the corresponding data.
1404
1367
  */
1405
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1368
+ readonly onPropertiesStreamed: AsyncEvent<{
1369
+ type: number;
1370
+ data: {
1371
+ [id: number]: any;
1372
+ };
1373
+ }>;
1406
1374
  /**
1407
- * Method to get the face of a mesh that contains a given triangle index.
1408
- * It also returns the edges of the found face and their indices.
1409
- *
1410
- * @param mesh - The mesh to get the face from. It must be indexed.
1411
- * @param triangleIndex - The index of the triangle within the mesh.
1412
- * @param instance - The instance of the mesh (optional).
1413
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1375
+ * An event that is triggered to indicate the progress of the streaming process.
1376
+ * The event provides a number between 0 and 1 representing the progress percentage.
1414
1377
  */
1415
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1416
- edges: MeasureEdge[];
1417
- indices: Set<number>;
1418
- } | null;
1378
+ readonly onProgress: AsyncEvent<number>;
1379
+ /**
1380
+ * An event that is triggered when indices are streamed from the IFC file.
1381
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1382
+ */
1383
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1384
+ /** {@link Disposable.onDisposed} */
1385
+ readonly onDisposed: Event<string>;
1386
+ /** {@link Component.enabled} */
1387
+ enabled: boolean;
1419
1388
  /**
1420
- * Method to get the vertices and normal of a mesh face at a given index.
1421
- * It also applies instance transformation if provided.
1422
- *
1423
- * @param mesh - The mesh to get the face from. It must be indexed.
1424
- * @param faceIndex - The index of the face within the mesh.
1425
- * @param instance - The instance of the mesh (optional).
1426
- * @returns An object containing the vertices and normal of the face.
1427
- * @throws Will throw an error if the geometry is not indexed.
1389
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1428
1390
  */
1429
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1430
- p1: THREE.Vector3;
1431
- p2: THREE.Vector3;
1432
- p3: THREE.Vector3;
1433
- faceNormal: THREE.Vector3;
1434
- };
1391
+ settings: PropertiesStreamingSettings;
1435
1392
  /**
1436
- * Method to round the vector's components to a specified number of decimal places.
1437
- * This is used to ensure numerical precision in edge detection.
1438
- *
1439
- * @param vector - The vector to round.
1440
- * @returns The vector with rounded components.
1393
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1441
1394
  */
1442
- round(vector: THREE.Vector3): void;
1395
+ webIfc: WEBIFC.IfcAPI;
1396
+ /** {@link Disposable.dispose} */
1397
+ dispose(): Promise<void>;
1443
1398
  /**
1444
- * Calculates the volume of a set of fragments.
1445
- *
1446
- * @param frags - A map of fragment IDs to their corresponding item IDs.
1447
- * @returns The total volume of the fragments and the bounding sphere.
1448
- *
1449
- * @remarks
1450
- * This method creates a set of instanced meshes from the given fragments and item IDs.
1451
- * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
1399
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1452
1400
  *
1453
- * @throws Will throw an error if the geometry of the meshes is not indexed.
1454
- * @throws Will throw an error if the fragment manager is not available.
1401
+ * @param data - The Uint8Array containing the IFC file data.
1402
+ * @returns A Promise that resolves when the streaming process is complete.
1455
1403
  */
1456
- getVolumeFromFragments(frags: FRAGS.FragmentIdMap): {
1457
- volume: number;
1458
- sphere: THREE.Sphere;
1459
- };
1404
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1460
1405
  /**
1461
- * Calculates the total volume of a set of meshes.
1462
- *
1463
- * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
1464
- * @returns The total volume of the meshes and the bounding sphere.
1465
- *
1466
- * @remarks
1467
- * This method calculates the volume of each mesh in the provided array and returns the total volume
1468
- * and its bounding sphere.
1406
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1469
1407
  *
1408
+ * @param loadCallback - A callback function that loads the IFC file data.
1409
+ * @returns A Promise that resolves when the streaming process is complete.
1470
1410
  */
1471
- getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): {
1472
- volume: number;
1473
- sphere: THREE.Sphere;
1474
- };
1475
- private getFaceData;
1476
- private getVolumeOfMesh;
1477
- private getSignedVolumeOfTriangle;
1411
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1412
+ private readIfcFile;
1413
+ private streamIfcFile;
1414
+ private streamAllProperties;
1415
+ private cleanUp;
1478
1416
  }
1417
+ import * as THREE from "three";
1418
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
1419
+ center: THREE.Vector3;
1420
+ halfSizes: THREE.Vector3;
1421
+ rotation: THREE.Matrix3;
1422
+ transformation: THREE.Matrix4;
1423
+ };
1424
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1479
1425
  import * as WEBIFC from "web-ifc";
1480
1426
  import * as FRAG from "@thatopen/fragments";
1481
1427
  import { Component, Components } from "../../core";
@@ -1501,43 +1447,127 @@ export declare class IfcJsonExporter extends Component {
1501
1447
  */
1502
1448
  export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1503
1449
  }
1504
- import * as FRAGS from "@thatopen/fragments";
1505
- import { Components, Component } from "../../core";
1450
+ import * as THREE from "three";
1451
+ export declare class MaterialsUtils {
1452
+ static isTransparent(material: THREE.Material): boolean;
1453
+ }
1454
+ export declare class UUID {
1455
+ private static _pattern;
1456
+ private static _lut;
1457
+ static create(): string;
1458
+ static validate(uuid: string): void;
1459
+ }
1460
+ import * as THREE from "three";
1461
+ import { Component, Components, Disposable, Event, World } from "../core";
1506
1462
  /**
1507
- * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
1463
+ * Configuration interface for the VertexPicker component.
1508
1464
  */
1509
- export declare class Hider extends Component {
1465
+ export interface VertexPickerConfig {
1510
1466
  /**
1511
- * A unique identifier for the component.
1512
- * This UUID is used to register the component within the Components system.
1467
+ * If true, only vertices will be picked, not the closest point on the face.
1513
1468
  */
1514
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1515
- /** {@link Component.enabled} */
1516
- enabled: boolean;
1517
- constructor(components: Components);
1469
+ showOnlyVertex: boolean;
1518
1470
  /**
1519
- * Sets the visibility of fragments within the 3D scene.
1520
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1521
- * If 'items' is provided, only the specified fragments will be affected.
1471
+ * The maximum distance for snapping to a vertex.
1472
+ */
1473
+ snapDistance: number;
1474
+ /**
1475
+ * The HTML element to use for previewing the picked vertex.
1476
+ */
1477
+ previewElement: HTMLElement;
1478
+ }
1479
+ /**
1480
+ * A class that provides functionality for picking vertices in a 3D scene.
1481
+ */
1482
+ export declare class VertexPicker extends Component implements Disposable {
1483
+ /** {@link Disposable.onDisposed} */
1484
+ readonly onDisposed: Event<unknown>;
1485
+ /**
1486
+ * An event that is triggered when a vertex is found.
1487
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
1488
+ */
1489
+ readonly onVertexFound: Event<THREE.Vector3>;
1490
+ /**
1491
+ * An event that is triggered when a vertex is lost.
1492
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
1493
+ */
1494
+ readonly onVertexLost: Event<THREE.Vector3>;
1495
+ /**
1496
+ * A reference to the Components instance associated with this VertexPicker.
1497
+ */
1498
+ components: Components;
1499
+ /**
1500
+ * A reference to the working plane used for vertex picking.
1501
+ * This plane is used to determine which vertices are considered valid for picking.
1502
+ * If this value is null, all vertices are considered valid.
1503
+ */
1504
+ workingPlane: THREE.Plane | null;
1505
+ private _pickedPoint;
1506
+ private _config;
1507
+ private _enabled;
1508
+ /**
1509
+ * Sets the enabled state of the VertexPicker.
1510
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1511
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1522
1512
  *
1523
- * @param visible - The visibility state to set for the fragments.
1524
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1525
- * If not provided, all fragments will be affected.
1513
+ * @param value - The new enabled state.
1514
+ */
1515
+ set enabled(value: boolean);
1516
+ /**
1517
+ * Gets the current enabled state of the VertexPicker.
1526
1518
  *
1527
- * @returns {void}
1519
+ * @returns The current enabled state.
1528
1520
  */
1529
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1521
+ get enabled(): boolean;
1530
1522
  /**
1531
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1532
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1523
+ * Sets the configuration for the VertexPicker component.
1533
1524
  *
1534
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1535
- * If not provided, all fragments will be isolated.
1525
+ * @param value - A Partial object containing the configuration properties to update.
1526
+ * The properties not provided in the value object will retain their current values.
1536
1527
  *
1537
- * @returns {void}
1528
+ * @example
1529
+ * '''typescript
1530
+ * vertexPicker.config = {
1531
+ * snapDistance: 0.5,
1532
+ * showOnlyVertex: true,
1533
+ * };
1534
+ * '''
1538
1535
  */
1539
- isolate(items: FRAGS.FragmentIdMap): void;
1540
- private updateCulledVisibility;
1536
+ set config(value: Partial<VertexPickerConfig>);
1537
+ /**
1538
+ * Gets the current configuration for the VertexPicker component.
1539
+ *
1540
+ * @returns A copy of the current VertexPickerConfig object.
1541
+ *
1542
+ * @example
1543
+ * '''typescript
1544
+ * const currentConfig = vertexPicker.config;
1545
+ * console.log(currentConfig.snapDistance); // Output: 0.25
1546
+ * '''
1547
+ */
1548
+ get config(): Partial<VertexPickerConfig>;
1549
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
1550
+ /** {@link Disposable.dispose} */
1551
+ dispose(): void;
1552
+ /**
1553
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
1554
+ *
1555
+ * @param world - The World instance to use for raycasting.
1556
+ *
1557
+ * @returns The current picked point, or null if no point is picked.
1558
+ *
1559
+ * @remarks
1560
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1561
+ * If enabled, it performs raycasting to find the closest intersecting object.
1562
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
1563
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1564
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1565
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1566
+ */
1567
+ get(world: World): THREE.Vector3 | null;
1568
+ private getClosestVertex;
1569
+ private getVertices;
1570
+ private getVertex;
1541
1571
  }
1542
1572
  import * as WEBIFC from "web-ifc";
1543
1573
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -1936,169 +1966,115 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1936
1966
  private registerChange;
1937
1967
  private newSingleProperty;
1938
1968
  }
1939
- export declare class UUID {
1940
- private static _pattern;
1941
- private static _lut;
1942
- static create(): string;
1943
- static validate(uuid: string): void;
1944
- }
1945
1969
  import * as THREE from "three";
1946
- import { Component, Components, Disposable, Event, World } from "../core";
1970
+ import * as FRAGS from "@thatopen/fragments";
1971
+ import { Component, Components } from "../../core";
1947
1972
  /**
1948
- * Configuration interface for the VertexPicker component.
1973
+ * Represents an edge measurement result.
1949
1974
  */
1950
- export interface VertexPickerConfig {
1951
- /**
1952
- * If true, only vertices will be picked, not the closest point on the face.
1953
- */
1954
- showOnlyVertex: boolean;
1975
+ export interface MeasureEdge {
1955
1976
  /**
1956
- * The maximum distance for snapping to a vertex.
1977
+ * The distance between the two points of the edge.
1957
1978
  */
1958
- snapDistance: number;
1979
+ distance: number;
1959
1980
  /**
1960
- * The HTML element to use for previewing the picked vertex.
1981
+ * The two points that define the edge.
1961
1982
  */
1962
- previewElement: HTMLElement;
1983
+ points: THREE.Vector3[];
1963
1984
  }
1964
1985
  /**
1965
- * A class that provides functionality for picking vertices in a 3D scene.
1986
+ * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
1966
1987
  */
1967
- export declare class VertexPicker extends Component implements Disposable {
1968
- /** {@link Disposable.onDisposed} */
1969
- readonly onDisposed: Event<unknown>;
1970
- /**
1971
- * An event that is triggered when a vertex is found.
1972
- * The event passes a THREE.Vector3 representing the position of the found vertex.
1973
- */
1974
- readonly onVertexFound: Event<THREE.Vector3>;
1975
- /**
1976
- * An event that is triggered when a vertex is lost.
1977
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
1978
- */
1979
- readonly onVertexLost: Event<THREE.Vector3>;
1980
- /**
1981
- * A reference to the Components instance associated with this VertexPicker.
1982
- */
1983
- components: Components;
1984
- /**
1985
- * A reference to the working plane used for vertex picking.
1986
- * This plane is used to determine which vertices are considered valid for picking.
1987
- * If this value is null, all vertices are considered valid.
1988
+ export declare class MeasurementUtils extends Component {
1989
+ /**
1990
+ * A unique identifier for the component.
1991
+ * This UUID is used to register the component within the Components system.
1988
1992
  */
1989
- workingPlane: THREE.Plane | null;
1990
- private _pickedPoint;
1991
- private _config;
1992
- private _enabled;
1993
+ static uuid: string;
1994
+ /** {@link Component.enabled} */
1995
+ enabled: boolean;
1996
+ constructor(components: Components);
1993
1997
  /**
1994
- * Sets the enabled state of the VertexPicker.
1995
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1996
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1998
+ * Utility method to calculate the distance from a point to a line segment.
1997
1999
  *
1998
- * @param value - The new enabled state.
2000
+ * @param point - The point from which to calculate the distance.
2001
+ * @param lineStart - The start point of the line segment.
2002
+ * @param lineEnd - The end point of the line segment.
2003
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
2004
+ * @returns The distance from the point to the line segment.
1999
2005
  */
2000
- set enabled(value: boolean);
2006
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
2001
2007
  /**
2002
- * Gets the current enabled state of the VertexPicker.
2008
+ * Method to get the face of a mesh that contains a given triangle index.
2009
+ * It also returns the edges of the found face and their indices.
2003
2010
  *
2004
- * @returns The current enabled state.
2011
+ * @param mesh - The mesh to get the face from. It must be indexed.
2012
+ * @param triangleIndex - The index of the triangle within the mesh.
2013
+ * @param instance - The instance of the mesh (optional).
2014
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
2005
2015
  */
2006
- get enabled(): boolean;
2016
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
2017
+ edges: MeasureEdge[];
2018
+ indices: Set<number>;
2019
+ } | null;
2007
2020
  /**
2008
- * Sets the configuration for the VertexPicker component.
2021
+ * Method to get the vertices and normal of a mesh face at a given index.
2022
+ * It also applies instance transformation if provided.
2009
2023
  *
2010
- * @param value - A Partial object containing the configuration properties to update.
2011
- * The properties not provided in the value object will retain their current values.
2024
+ * @param mesh - The mesh to get the face from. It must be indexed.
2025
+ * @param faceIndex - The index of the face within the mesh.
2026
+ * @param instance - The instance of the mesh (optional).
2027
+ * @returns An object containing the vertices and normal of the face.
2028
+ * @throws Will throw an error if the geometry is not indexed.
2029
+ */
2030
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
2031
+ p1: THREE.Vector3;
2032
+ p2: THREE.Vector3;
2033
+ p3: THREE.Vector3;
2034
+ faceNormal: THREE.Vector3;
2035
+ };
2036
+ /**
2037
+ * Method to round the vector's components to a specified number of decimal places.
2038
+ * This is used to ensure numerical precision in edge detection.
2012
2039
  *
2013
- * @example
2014
- * '''typescript
2015
- * vertexPicker.config = {
2016
- * snapDistance: 0.5,
2017
- * showOnlyVertex: true,
2018
- * };
2019
- * '''
2040
+ * @param vector - The vector to round.
2041
+ * @returns The vector with rounded components.
2020
2042
  */
2021
- set config(value: Partial<VertexPickerConfig>);
2043
+ round(vector: THREE.Vector3): void;
2022
2044
  /**
2023
- * Gets the current configuration for the VertexPicker component.
2045
+ * Calculates the volume of a set of fragments.
2024
2046
  *
2025
- * @returns A copy of the current VertexPickerConfig object.
2047
+ * @param frags - A map of fragment IDs to their corresponding item IDs.
2048
+ * @returns The total volume of the fragments and the bounding sphere.
2026
2049
  *
2027
- * @example
2028
- * '''typescript
2029
- * const currentConfig = vertexPicker.config;
2030
- * console.log(currentConfig.snapDistance); // Output: 0.25
2031
- * '''
2050
+ * @remarks
2051
+ * This method creates a set of instanced meshes from the given fragments and item IDs.
2052
+ * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
2053
+ *
2054
+ * @throws Will throw an error if the geometry of the meshes is not indexed.
2055
+ * @throws Will throw an error if the fragment manager is not available.
2032
2056
  */
2033
- get config(): Partial<VertexPickerConfig>;
2034
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
2035
- /** {@link Disposable.dispose} */
2036
- dispose(): void;
2057
+ getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
2037
2058
  /**
2038
- * Performs the vertex picking operation based on the current state of the VertexPicker.
2039
- *
2040
- * @param world - The World instance to use for raycasting.
2059
+ * Calculates the total volume of a set of meshes.
2041
2060
  *
2042
- * @returns The current picked point, or null if no point is picked.
2061
+ * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
2062
+ * @returns The total volume of the meshes and the bounding sphere.
2043
2063
  *
2044
2064
  * @remarks
2045
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
2046
- * If enabled, it performs raycasting to find the closest intersecting object.
2047
- * It then determines the closest vertex or point on the face, based on the configuration settings.
2048
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
2049
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
2050
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
2065
+ * This method calculates the volume of each mesh in the provided array and returns the total volume
2066
+ * and its bounding sphere.
2067
+ *
2051
2068
  */
2052
- get(world: World): THREE.Vector3 | null;
2053
- private getClosestVertex;
2054
- private getVertices;
2055
- private getVertex;
2069
+ getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
2070
+ private getFaceData;
2071
+ private getVolumeOfMesh;
2072
+ private getSignedVolumeOfTriangle;
2056
2073
  }
2057
2074
  /**
2058
2075
  * A Set of unique numbers representing different types of IFC geometries.
2059
2076
  */
2060
2077
  export declare const GeometryTypes: Set<number>;
2061
- import * as WEBIFC from "web-ifc";
2062
- /** Configuration of the IFC-fragment conversion. */
2063
- export declare class IfcFragmentSettings {
2064
- /** Whether to extract the IFC properties into a JSON. */
2065
- includeProperties: boolean;
2066
- /**
2067
- * Generate the geometry for categories that are not included by default,
2068
- * like IFCSPACE.
2069
- */
2070
- optionalCategories: number[];
2071
- /** Whether to use the coordination data coming from the IFC files. */
2072
- coordinate: boolean;
2073
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2074
- wasm: {
2075
- path: string;
2076
- absolute: boolean;
2077
- logLevel?: WEBIFC.LogLevel;
2078
- };
2079
- /** List of categories that won't be converted to fragments. */
2080
- excludedCategories: Set<number>;
2081
- /** Whether to save the absolute location of all IFC items. */
2082
- saveLocations: boolean;
2083
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2084
- webIfc: WEBIFC.LoaderSettings;
2085
- /**
2086
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2087
- * If set to true, the path will be set to the default path of the WASM file.
2088
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2089
- * Default value is true.
2090
- */
2091
- autoSetWasm: boolean;
2092
- /**
2093
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2094
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2095
- * If set to null, the default file location handler will be used.
2096
- *
2097
- * @param url - The URL of the file to locate.
2098
- * @returns The absolute path of the file.
2099
- */
2100
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2101
- }
2102
2078
  import * as THREE from "three";
2103
2079
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2104
2080
  /**
@@ -2189,6 +2165,52 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2189
2165
  private updatePlanes;
2190
2166
  }
2191
2167
  import * as WEBIFC from "web-ifc";
2168
+ /** Configuration of the IFC-fragment conversion. */
2169
+ export declare class IfcFragmentSettings {
2170
+ /** Whether to extract the IFC properties into a JSON. */
2171
+ includeProperties: boolean;
2172
+ /**
2173
+ * Generate the geometry for categories that are not included by default,
2174
+ * like IFCSPACE.
2175
+ */
2176
+ optionalCategories: number[];
2177
+ /** Whether to use the coordination data coming from the IFC files. */
2178
+ coordinate: boolean;
2179
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2180
+ wasm: {
2181
+ path: string;
2182
+ absolute: boolean;
2183
+ logLevel?: WEBIFC.LogLevel;
2184
+ };
2185
+ /** List of categories that won't be converted to fragments. */
2186
+ excludedCategories: Set<number>;
2187
+ /** Whether to save the absolute location of all IFC items. */
2188
+ saveLocations: boolean;
2189
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2190
+ webIfc: WEBIFC.LoaderSettings;
2191
+ /**
2192
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2193
+ * If set to true, the path will be set to the default path of the WASM file.
2194
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
2195
+ * Default value is true.
2196
+ */
2197
+ autoSetWasm: boolean;
2198
+ /**
2199
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2200
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2201
+ * If set to null, the default file location handler will be used.
2202
+ *
2203
+ * @param url - The URL of the file to locate.
2204
+ * @returns The absolute path of the file.
2205
+ */
2206
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2207
+ }
2208
+ import { InverseAttribute } from "./types";
2209
+ export declare const relToAttributesMap: Map<number, {
2210
+ forRelating: InverseAttribute;
2211
+ forRelated: InverseAttribute;
2212
+ }>;
2213
+ import * as WEBIFC from "web-ifc";
2192
2214
  import { IfcItemsCategories } from "../../../ifc";
2193
2215
  export declare class SpatialStructure {
2194
2216
  itemsByFloor: IfcItemsCategories;
@@ -2196,6 +2218,13 @@ export declare class SpatialStructure {
2196
2218
  setUp(webIfc: WEBIFC.IfcAPI): void;
2197
2219
  cleanUp(): void;
2198
2220
  }
2221
+ import * as WEBIFC from "web-ifc";
2222
+ export interface IfcItemsCategories {
2223
+ [itemID: number]: number;
2224
+ }
2225
+ export declare class IfcCategories {
2226
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2227
+ }
2199
2228
  /**
2200
2229
  * A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
2201
2230
  *
@@ -2213,38 +2242,6 @@ export declare const IfcElements: {
2213
2242
  export declare const IfcCategoryMap: {
2214
2243
  [key: number]: string;
2215
2244
  };
2216
- import * as WEBIFC from "web-ifc";
2217
- export interface IfcItemsCategories {
2218
- [itemID: number]: number;
2219
- }
2220
- export declare class IfcCategories {
2221
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2222
- }
2223
- import * as FRAGS from "@thatopen/fragments";
2224
- export declare class IfcPropertiesUtils {
2225
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2226
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2227
- [attribute: string]: any;
2228
- } | null>;
2229
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2230
- [relatingID: number]: number[];
2231
- }>;
2232
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2233
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2234
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2235
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2236
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2237
- key: string | null;
2238
- name: string | null;
2239
- }>;
2240
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2241
- key: string | null;
2242
- value: number | null;
2243
- }>;
2244
- static isRel(expressID: number): boolean;
2245
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2246
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2247
- }
2248
2245
  /**
2249
2246
  * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
2250
2247
  */
@@ -2273,6 +2270,31 @@ export declare class Event<T> {
2273
2270
  reset(): void;
2274
2271
  private handlers;
2275
2272
  }
2273
+ import * as FRAGS from "@thatopen/fragments";
2274
+ export declare class IfcPropertiesUtils {
2275
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2276
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2277
+ [attribute: string]: any;
2278
+ } | null>;
2279
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2280
+ [relatingID: number]: number[];
2281
+ }>;
2282
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2283
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2284
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2285
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2286
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2287
+ key: string | null;
2288
+ name: string | null;
2289
+ }>;
2290
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2291
+ key: string | null;
2292
+ value: number | null;
2293
+ }>;
2294
+ static isRel(expressID: number): boolean;
2295
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2296
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2297
+ }
2276
2298
  import * as THREE from "three";
2277
2299
  import CameraControls from "camera-controls";
2278
2300
  import { Event } from "./event";
@@ -2381,19 +2403,6 @@ export interface CameraControllable {
2381
2403
  */
2382
2404
  controls: CameraControls;
2383
2405
  }
2384
- import { Base } from "./base";
2385
- /**
2386
- * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
2387
- */
2388
- export declare abstract class Component extends Base {
2389
- /**
2390
- * Whether this component is active or not. The behaviour can vary depending
2391
- * on the type of component. E.g. a disabled dimension tool will stop creating
2392
- * dimensions, while a disabled camera will stop moving. A disabled component
2393
- * will not be updated automatically each frame.
2394
- */
2395
- abstract enabled: boolean;
2396
- }
2397
2406
  /**
2398
2407
  * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
2399
2408
  */
@@ -2422,33 +2431,18 @@ export declare class AsyncEvent<T> {
2422
2431
  reset(): void;
2423
2432
  private handlers;
2424
2433
  }
2425
- import * as THREE from "three";
2426
- import CameraControls from "camera-controls";
2427
- import { BaseWorldItem } from "./base-world-item";
2428
- import { CameraControllable } from "./interfaces";
2434
+ import { Base } from "./base";
2429
2435
  /**
2430
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2436
+ * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
2431
2437
  */
2432
- export declare abstract class BaseCamera extends BaseWorldItem {
2438
+ export declare abstract class Component extends Base {
2433
2439
  /**
2434
- * Whether the camera is enabled or not.
2440
+ * Whether this component is active or not. The behaviour can vary depending
2441
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2442
+ * dimensions, while a disabled camera will stop moving. A disabled component
2443
+ * will not be updated automatically each frame.
2435
2444
  */
2436
2445
  abstract enabled: boolean;
2437
- /**
2438
- * The Three.js camera instance.
2439
- */
2440
- abstract three: THREE.Camera;
2441
- /**
2442
- * Optional CameraControls instance for controlling the camera.
2443
- * This property is only available if the camera is controllable.
2444
- */
2445
- abstract controls?: CameraControls;
2446
- /**
2447
- * Checks whether the instance is {@link CameraControllable}.
2448
- *
2449
- * @returns True if the instance is controllable, false otherwise.
2450
- */
2451
- hasCameraControls: () => this is CameraControllable;
2452
2446
  }
2453
2447
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2454
2448
  import { Components } from "../../Components";
@@ -2493,6 +2487,34 @@ export declare abstract class BaseWorldItem extends Base {
2493
2487
  protected constructor(components: Components);
2494
2488
  }
2495
2489
  import * as THREE from "three";
2490
+ import CameraControls from "camera-controls";
2491
+ import { BaseWorldItem } from "./base-world-item";
2492
+ import { CameraControllable } from "./interfaces";
2493
+ /**
2494
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2495
+ */
2496
+ export declare abstract class BaseCamera extends BaseWorldItem {
2497
+ /**
2498
+ * Whether the camera is enabled or not.
2499
+ */
2500
+ abstract enabled: boolean;
2501
+ /**
2502
+ * The Three.js camera instance.
2503
+ */
2504
+ abstract three: THREE.Camera;
2505
+ /**
2506
+ * Optional CameraControls instance for controlling the camera.
2507
+ * This property is only available if the camera is controllable.
2508
+ */
2509
+ abstract controls?: CameraControls;
2510
+ /**
2511
+ * Checks whether the instance is {@link CameraControllable}.
2512
+ *
2513
+ * @returns True if the instance is controllable, false otherwise.
2514
+ */
2515
+ hasCameraControls: () => this is CameraControllable;
2516
+ }
2517
+ import * as THREE from "three";
2496
2518
  import { Vector2 } from "three";
2497
2519
  import { Event } from "./event";
2498
2520
  import { BaseWorldItem } from "./base-world-item";
@@ -2558,64 +2580,268 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2558
2580
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2559
2581
  }
2560
2582
  import * as THREE from "three";
2561
- import { Disposable } from "./interfaces";
2562
- import { Event } from "./event";
2563
- import { Components } from "../../Components";
2564
- import { BaseWorldItem } from "./base-world-item";
2583
+ import { Disposable } from "./interfaces";
2584
+ import { Event } from "./event";
2585
+ import { Components } from "../../Components";
2586
+ import { BaseWorldItem } from "./base-world-item";
2587
+ /**
2588
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2589
+ */
2590
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2591
+ /** {@link Disposable.onDisposed} */
2592
+ readonly onDisposed: Event<unknown>;
2593
+ /**
2594
+ * Abstract property representing the three.js object associated with this scene.
2595
+ * It should be implemented by subclasses.
2596
+ */
2597
+ abstract three: THREE.Object3D;
2598
+ protected constructor(components: Components);
2599
+ /** {@link Disposable.dispose} */
2600
+ dispose(): void;
2601
+ }
2602
+ import * as THREE from "three";
2603
+ import { BaseScene } from "./base-scene";
2604
+ import { BaseCamera } from "./base-camera";
2605
+ import { BaseRenderer } from "./base-renderer";
2606
+ import { Updateable, Disposable } from "./interfaces";
2607
+ /**
2608
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2609
+ */
2610
+ export interface World extends Disposable, Updateable {
2611
+ /**
2612
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
2613
+ */
2614
+ meshes: Set<THREE.Mesh>;
2615
+ /**
2616
+ * The base scene of the world.
2617
+ */
2618
+ scene: BaseScene;
2619
+ /**
2620
+ * The base camera of the world.
2621
+ */
2622
+ camera: BaseCamera;
2623
+ /**
2624
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2625
+ */
2626
+ renderer: BaseRenderer | null;
2627
+ /**
2628
+ * A unique identifier for the world.
2629
+ */
2630
+ uuid: string;
2631
+ /**
2632
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2633
+ */
2634
+ isDisposing: boolean;
2635
+ }
2636
+ import * as THREE from "three";
2637
+ import { Disposable, Event } from "../../Types";
2638
+ /**
2639
+ * A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
2640
+ */
2641
+ export declare class Mouse implements Disposable {
2642
+ dom: HTMLCanvasElement;
2643
+ private _event?;
2644
+ private _position;
2645
+ /** {@link Disposable.onDisposed} */
2646
+ readonly onDisposed: Event<unknown>;
2647
+ constructor(dom: HTMLCanvasElement);
2648
+ /**
2649
+ * The real position of the mouse of the Three.js canvas.
2650
+ */
2651
+ get position(): THREE.Vector2;
2652
+ /** {@link Disposable.dispose} */
2653
+ dispose(): void;
2654
+ private getPositionY;
2655
+ private getPositionX;
2656
+ private updateMouseInfo;
2657
+ private setupEvents;
2658
+ }
2659
+ import * as THREE from "three";
2660
+ import { Components } from "../../Components";
2661
+ import { Event, World, Disposable } from "../../Types";
2662
+ import { Mouse } from "./mouse";
2663
+ /**
2664
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
2665
+ */
2666
+ export declare class SimpleRaycaster implements Disposable {
2667
+ /** {@link Component.enabled} */
2668
+ enabled: boolean;
2669
+ /** The components instance to which this Raycaster belongs. */
2670
+ components: Components;
2671
+ /** {@link Disposable.onDisposed} */
2672
+ readonly onDisposed: Event<unknown>;
2673
+ /** The position of the mouse in the screen. */
2674
+ readonly mouse: Mouse;
2675
+ /**
2676
+ * A reference to the Three.js Raycaster instance.
2677
+ * This is used for raycasting operations.
2678
+ */
2679
+ readonly three: THREE.Raycaster;
2680
+ /**
2681
+ * A reference to the world instance to which this Raycaster belongs.
2682
+ * This is used to access the camera and meshes.
2683
+ */
2684
+ world: World;
2685
+ constructor(components: Components, world: World);
2686
+ /** {@link Disposable.dispose} */
2687
+ dispose(): void;
2688
+ /**
2689
+ * Throws a ray from the camera to the mouse or touch event point and returns
2690
+ * the first item found. This also takes into account the clipping planes
2691
+ * used by the renderer.
2692
+ *
2693
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2694
+ * to query. If not provided, it will query all the meshes stored in
2695
+ * {@link Components.meshes}.
2696
+ */
2697
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2698
+ /**
2699
+ * Casts a ray from a given origin in a given direction and returns the first item found.
2700
+ * This method also takes into account the clipping planes used by the renderer.
2701
+ *
2702
+ * @param origin - The origin of the ray.
2703
+ * @param direction - The direction of the ray.
2704
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2705
+ * @returns The first intersection found or 'null' if no intersection was found.
2706
+ */
2707
+ 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;
2708
+ private intersect;
2709
+ private filterClippingPlanes;
2710
+ }
2711
+ import { NavigationMode } from "./types";
2712
+ import { OrthoPerspectiveCamera } from "../index";
2713
+ /**
2714
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
2715
+ */
2716
+ export declare class FirstPersonMode implements NavigationMode {
2717
+ private camera;
2718
+ /** {@link NavigationMode.enabled} */
2719
+ enabled: boolean;
2720
+ /** {@link NavigationMode.id} */
2721
+ readonly id = "FirstPerson";
2722
+ constructor(camera: OrthoPerspectiveCamera);
2723
+ /** {@link NavigationMode.set} */
2724
+ set(active: boolean): void;
2725
+ private setupFirstPersonCamera;
2726
+ }
2727
+ import { NavigationMode } from "./types";
2728
+ import { OrthoPerspectiveCamera } from "../index";
2729
+ /**
2730
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
2731
+ */
2732
+ export declare class OrbitMode implements NavigationMode {
2733
+ camera: OrthoPerspectiveCamera;
2734
+ /** {@link NavigationMode.enabled} */
2735
+ enabled: boolean;
2736
+ /** {@link NavigationMode.id} */
2737
+ readonly id = "Orbit";
2738
+ constructor(camera: OrthoPerspectiveCamera);
2739
+ /** {@link NavigationMode.set} */
2740
+ set(active: boolean): void;
2741
+ private activateOrbitControls;
2742
+ }
2743
+ import { NavigationMode } from "./types";
2744
+ import { OrthoPerspectiveCamera } from "../index";
2745
+ /**
2746
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
2747
+ */
2748
+ export declare class PlanMode implements NavigationMode {
2749
+ private camera;
2750
+ /** {@link NavigationMode.enabled} */
2751
+ enabled: boolean;
2752
+ /** {@link NavigationMode.id} */
2753
+ readonly id = "Plan";
2754
+ private mouseAction1?;
2755
+ private mouseAction2?;
2756
+ private mouseInitialized;
2757
+ private readonly defaultAzimuthSpeed;
2758
+ private readonly defaultPolarSpeed;
2759
+ constructor(camera: OrthoPerspectiveCamera);
2760
+ /** {@link NavigationMode.set} */
2761
+ set(active: boolean): void;
2762
+ }
2763
+ import * as THREE from "three";
2764
+ import { CameraProjection } from "./types";
2765
+ import { Event } from "../../Types";
2766
+ import { OrthoPerspectiveCamera } from "../index";
2565
2767
  /**
2566
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2768
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
2567
2769
  */
2568
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2569
- /** {@link Disposable.onDisposed} */
2570
- readonly onDisposed: Event<unknown>;
2770
+ export declare class ProjectionManager {
2571
2771
  /**
2572
- * Abstract property representing the three.js object associated with this scene.
2573
- * It should be implemented by subclasses.
2772
+ * Event that fires when the {@link CameraProjection} changes.
2574
2773
  */
2575
- abstract three: THREE.Object3D;
2576
- protected constructor(components: Components);
2577
- /** {@link Disposable.dispose} */
2578
- dispose(): void;
2579
- }
2580
- import * as THREE from "three";
2581
- import { BaseScene } from "./base-scene";
2582
- import { BaseCamera } from "./base-camera";
2583
- import { BaseRenderer } from "./base-renderer";
2584
- import { Updateable, Disposable } from "./interfaces";
2585
- /**
2586
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2587
- */
2588
- export interface World extends Disposable, Updateable {
2774
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
2589
2775
  /**
2590
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
2776
+ * Current projection mode of the camera.
2777
+ * Default is "Perspective".
2591
2778
  */
2592
- meshes: Set<THREE.Mesh>;
2779
+ current: CameraProjection;
2593
2780
  /**
2594
- * The base scene of the world.
2781
+ * The camera controlled by this ProjectionManager.
2782
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
2595
2783
  */
2596
- scene: BaseScene;
2784
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2785
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
2786
+ matchOrthoDistanceEnabled: boolean;
2787
+ private _component;
2788
+ private _previousDistance;
2789
+ constructor(camera: OrthoPerspectiveCamera);
2597
2790
  /**
2598
- * The base camera of the world.
2791
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
2792
+ *
2793
+ * @param projection - the new projection to set. If it is the current projection,
2794
+ * it will have no effect.
2599
2795
  */
2600
- camera: BaseCamera;
2796
+ set(projection: CameraProjection): Promise<void>;
2601
2797
  /**
2602
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2798
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
2799
+ * and vice versa.
2603
2800
  */
2604
- renderer: BaseRenderer | null;
2801
+ toggle(): Promise<void>;
2802
+ private setOrthoCamera;
2803
+ private getPerspectiveDims;
2804
+ private setupOrthoCamera;
2805
+ private getDistance;
2806
+ private setPerspectiveCamera;
2807
+ }
2808
+ /**
2809
+ * The projection system of the camera.
2810
+ */
2811
+ export type CameraProjection = "Perspective" | "Orthographic";
2812
+ /**
2813
+ * The extensible list of supported navigation modes.
2814
+ */
2815
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
2816
+ /**
2817
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
2818
+ */
2819
+ export interface NavigationMode {
2820
+ /** The unique ID of this navigation mode. */
2821
+ id: NavModeID;
2605
2822
  /**
2606
- * A unique identifier for the world.
2607
- */
2608
- uuid: string;
2823
+ * Enable or disable this navigation mode.
2824
+ * When a new navigation mode is enabled, the previous navigation mode
2825
+ * must be disabled.
2826
+ *
2827
+ * @param active - whether to enable or disable this mode.
2828
+ * @param options - any additional data required to enable or disable it.
2829
+ * */
2830
+ set: (active: boolean, options?: any) => void;
2831
+ /** Whether this navigation mode is active or not. */
2832
+ enabled: boolean;
2833
+ }
2834
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
2835
+ /**
2836
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
2837
+ */
2838
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2609
2839
  /**
2610
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2840
+ * Amount of properties to be streamed.
2841
+ * Defaults to 100 properties.
2611
2842
  */
2612
- isDisposing: boolean;
2843
+ propertiesSize: number;
2613
2844
  }
2614
- import { InverseAttribute } from "./types";
2615
- export declare const relToAttributesMap: Map<number, {
2616
- forRelating: InverseAttribute;
2617
- forRelated: InverseAttribute;
2618
- }>;
2619
2845
  import * as THREE from "three";
2620
2846
  import { Components } from "../../Components";
2621
2847
  import { AsyncEvent, Event, World } from "../../Types";
@@ -2765,284 +2991,122 @@ export declare class MeshCullerRenderer extends CullerRenderer implements Dispos
2765
2991
  private getAvailableMaterial;
2766
2992
  }
2767
2993
  import * as THREE from "three";
2768
- import { Disposable, Event } from "../../Types";
2769
- /**
2770
- * A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
2771
- */
2772
- export declare class Mouse implements Disposable {
2773
- dom: HTMLCanvasElement;
2774
- private _event?;
2775
- private _position;
2776
- /** {@link Disposable.onDisposed} */
2777
- readonly onDisposed: Event<unknown>;
2778
- constructor(dom: HTMLCanvasElement);
2779
- /**
2780
- * The real position of the mouse of the Three.js canvas.
2781
- */
2782
- get position(): THREE.Vector2;
2783
- /** {@link Disposable.dispose} */
2784
- dispose(): void;
2785
- private getPositionY;
2786
- private getPositionX;
2787
- private updateMouseInfo;
2788
- private setupEvents;
2789
- }
2790
- /**
2791
- * A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
2792
- */
2793
- export interface StreamedGeometries {
2794
- [id: number]: {
2795
- /** The bounding box of the geometry as a Float32Array. */
2796
- boundingBox: Float32Array;
2797
- /** A boolean indicating whether the geometry has holes. */
2798
- hasHoles: boolean;
2799
- /** An optional file path for the geometry data. */
2800
- geometryFile?: string;
2801
- };
2802
- }
2803
- /**
2804
- * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
2805
- */
2806
- export interface StreamedAsset {
2807
- /** The unique identifier of the asset. */
2808
- id: number;
2809
- /** An array of geometries associated with the asset. */
2810
- geometries: {
2811
- /** The unique identifier of the geometry. */
2812
- geometryID: number;
2813
- /** The transformation matrix of the geometry as a number array. */
2814
- transformation: number[];
2815
- /** The color of the geometry as a number array. */
2816
- color: number[];
2817
- }[];
2818
- }
2819
- import * as THREE from "three";
2820
- import { BaseScene, Configurable, Event } from "../../Types";
2821
- import { Components } from "../../Components";
2822
- /**
2823
- * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
2824
- */
2825
- export interface SimpleSceneConfig {
2826
- directionalLight: {
2827
- color: THREE.Color;
2828
- intensity: number;
2829
- position: THREE.Vector3;
2830
- };
2831
- ambientLight: {
2832
- color: THREE.Color;
2833
- intensity: number;
2834
- };
2835
- }
2836
- /**
2837
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2838
- */
2839
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2840
- /** {@link Configurable.isSetup} */
2841
- isSetup: boolean;
2842
- /**
2843
- * The underlying Three.js scene object.
2844
- * It is used to define the 3D space containing objects, lights, and cameras.
2845
- */
2846
- three: THREE.Scene;
2847
- /** {@link Configurable.onSetup} */
2848
- readonly onSetup: Event<SimpleScene>;
2849
- /**
2850
- * Configuration interface for the {@link SimpleScene}.
2851
- * Defines properties for directional and ambient lights.
2852
- */
2853
- config: Required<SimpleSceneConfig>;
2854
- constructor(components: Components);
2855
- /** {@link Configurable.setup} */
2856
- setup(config?: Partial<SimpleSceneConfig>): void;
2857
- }
2858
- import * as THREE from "three";
2859
- import { Components } from "../../Components";
2860
- import { Event, World, Disposable } from "../../Types";
2861
- import { Mouse } from "./mouse";
2862
- /**
2863
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
2864
- */
2865
- export declare class SimpleRaycaster implements Disposable {
2866
- /** {@link Component.enabled} */
2867
- enabled: boolean;
2868
- /** The components instance to which this Raycaster belongs. */
2869
- components: Components;
2870
- /** {@link Disposable.onDisposed} */
2871
- readonly onDisposed: Event<unknown>;
2872
- /** The position of the mouse in the screen. */
2873
- readonly mouse: Mouse;
2874
- /**
2875
- * A reference to the Three.js Raycaster instance.
2876
- * This is used for raycasting operations.
2877
- */
2878
- readonly three: THREE.Raycaster;
2879
- /**
2880
- * A reference to the world instance to which this Raycaster belongs.
2881
- * This is used to access the camera and meshes.
2882
- */
2883
- world: World;
2884
- constructor(components: Components, world: World);
2885
- /** {@link Disposable.dispose} */
2886
- dispose(): void;
2887
- /**
2888
- * Throws a ray from the camera to the mouse or touch event point and returns
2889
- * the first item found. This also takes into account the clipping planes
2890
- * used by the renderer.
2891
- *
2892
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2893
- * to query. If not provided, it will query all the meshes stored in
2894
- * {@link Components.meshes}.
2895
- */
2896
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2897
- /**
2898
- * Casts a ray from a given origin in a given direction and returns the first item found.
2899
- * This method also takes into account the clipping planes used by the renderer.
2900
- *
2901
- * @param origin - The origin of the ray.
2902
- * @param direction - The direction of the ray.
2903
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2904
- * @returns The first intersection found or 'null' if no intersection was found.
2905
- */
2906
- 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;
2907
- private intersect;
2908
- private filterClippingPlanes;
2909
- }
2910
- import * as THREE from "three";
2911
- import CameraControls from "camera-controls";
2912
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
2913
- import { Components } from "../../Components";
2994
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2914
2995
  /**
2915
- * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
2996
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2997
+ *
2998
+ * @template T - The type of the scene. Default is BaseScene.
2999
+ * @template U - The type of the camera. Default is BaseCamera.
3000
+ * @template S - The type of the renderer. Default is BaseRenderer.
2916
3001
  */
2917
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
2918
- /** {@link Updateable.onBeforeUpdate} */
2919
- readonly onBeforeUpdate: Event<SimpleCamera>;
2920
- /** {@link Updateable.onAfterUpdate} */
2921
- readonly onAfterUpdate: Event<SimpleCamera>;
3002
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2922
3003
  /**
2923
- * Event that is triggered when the aspect of the camera has been updated.
2924
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
3004
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2925
3005
  */
2926
- readonly onAspectUpdated: Event<unknown>;
3006
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3007
+ /** {@link Updateable.onAfterUpdate} */
3008
+ readonly onAfterUpdate: Event<unknown>;
3009
+ /** {@link Updateable.onBeforeUpdate} */
3010
+ readonly onBeforeUpdate: Event<unknown>;
2927
3011
  /** {@link Disposable.onDisposed} */
2928
- readonly onDisposed: Event<string>;
2929
- /**
2930
- * A three.js PerspectiveCamera or OrthographicCamera instance.
2931
- * This camera is used for rendering the scene.
2932
- */
2933
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
2934
- private _allControls;
3012
+ readonly onDisposed: Event<unknown>;
2935
3013
  /**
2936
- * The object that controls the camera. An instance of
2937
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
2938
- * Transforming the camera directly will have no effect: you need to use this
2939
- * object to move, rotate, look at objects, etc.
3014
+ * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
2940
3015
  */
2941
- get controls(): CameraControls;
3016
+ isDisposing: boolean;
2942
3017
  /**
2943
- * Getter for the enabled state of the camera controls.
2944
- * If the current world is null, it returns false.
2945
- * Otherwise, it returns the enabled state of the camera controls.
2946
- *
2947
- * @returns {boolean} The enabled state of the camera controls.
3018
+ * Indicates whether the world is currently enabled.
3019
+ * When disabled, the world will not be updated.
2948
3020
  */
2949
- get enabled(): boolean;
3021
+ enabled: boolean;
2950
3022
  /**
2951
- * Setter for the enabled state of the camera controls.
2952
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
2953
- *
2954
- * @param {boolean} enabled - The new enabled state of the camera controls.
3023
+ * A unique identifier for the world.
2955
3024
  */
2956
- set enabled(enabled: boolean);
2957
- constructor(components: Components);
2958
- /** {@link Disposable.dispose} */
2959
- dispose(): void;
2960
- /** {@link Updateable.update} */
2961
- update(_delta: number): void;
3025
+ uuid: string;
2962
3026
  /**
2963
- * Updates the aspect of the camera to match the size of the
2964
- * {@link Components.renderer}.
3027
+ * An optional name for the world.
2965
3028
  */
2966
- updateAspect: () => void;
2967
- private setupCamera;
2968
- private newCameraControls;
2969
- private setupEvents;
2970
- private static getSubsetOfThree;
2971
- }
2972
- import { IfcFragmentSettings } from "../../IfcLoader/src";
2973
- /**
2974
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
2975
- */
2976
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
3029
+ name?: string;
3030
+ private _scene?;
3031
+ private _camera?;
3032
+ private _renderer;
2977
3033
  /**
2978
- * Minimum number of geometries to be streamed.
2979
- * Defaults to 10 geometries.
3034
+ * Getter for the scene. If no scene is initialized, it throws an error.
3035
+ * @returns The current scene.
2980
3036
  */
2981
- minGeometrySize: number;
3037
+ get scene(): T;
2982
3038
  /**
2983
- * Minimum amount of assets to be streamed.
2984
- * Defaults to 1000 assets.
3039
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3040
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3041
+ * @param scene - The new scene to be set.
2985
3042
  */
2986
- minAssetsSize: number;
2987
- }
2988
- import * as THREE from "three";
2989
- import { Hideable, Event, World, Disposable } from "../../Types";
2990
- import { Components } from "../../Components";
2991
- /**
2992
- * Configuration interface for the {@link SimpleGrid} class.
2993
- */
2994
- export interface GridConfig {
3043
+ set scene(scene: T);
2995
3044
  /**
2996
- * The color of the grid lines.
3045
+ * Getter for the camera. If no camera is initialized, it throws an error.
3046
+ * @returns The current camera.
2997
3047
  */
2998
- color: THREE.Color;
3048
+ get camera(): U;
2999
3049
  /**
3000
- * The size of the primary grid lines.
3050
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3051
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3052
+ * @param camera - The new camera to be set.
3001
3053
  */
3002
- size1: number;
3054
+ set camera(camera: U);
3003
3055
  /**
3004
- * The size of the secondary grid lines.
3056
+ * Getter for the renderer.
3057
+ * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3005
3058
  */
3006
- size2: number;
3059
+ get renderer(): S | null;
3007
3060
  /**
3008
- * The distance at which the grid lines start to fade away.
3061
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3062
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3063
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3064
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
3009
3065
  */
3010
- distance: number;
3066
+ set renderer(renderer: S | null);
3067
+ /** {@link Updateable.update} */
3068
+ update(delta?: number): void;
3069
+ /** {@link Disposable.dispose} */
3070
+ dispose(disposeResources?: boolean): void;
3011
3071
  }
3072
+ import * as THREE from "three";
3073
+ import { BaseScene, Configurable, Event } from "../../Types";
3074
+ import { Components } from "../../Components";
3012
3075
  /**
3013
- * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
3076
+ * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
3014
3077
  */
3015
- export declare class SimpleGrid implements Hideable, Disposable {
3016
- /** {@link Disposable.onDisposed} */
3017
- readonly onDisposed: Event<unknown>;
3018
- /** The world instance to which this Raycaster belongs. */
3019
- world: World;
3020
- /** The components instance to which this grid belongs. */
3021
- components: Components;
3022
- /** {@link Hideable.visible} */
3023
- get visible(): boolean;
3024
- /** {@link Hideable.visible} */
3025
- set visible(visible: boolean);
3026
- /** The material of the grid. */
3027
- get material(): THREE.ShaderMaterial;
3078
+ export interface SimpleSceneConfig {
3079
+ directionalLight: {
3080
+ color: THREE.Color;
3081
+ intensity: number;
3082
+ position: THREE.Vector3;
3083
+ };
3084
+ ambientLight: {
3085
+ color: THREE.Color;
3086
+ intensity: number;
3087
+ };
3088
+ }
3089
+ /**
3090
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
3091
+ */
3092
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
3093
+ /** {@link Configurable.isSetup} */
3094
+ isSetup: boolean;
3028
3095
  /**
3029
- * Whether the grid should fade away with distance. Recommended to be true for
3030
- * perspective cameras and false for orthographic cameras.
3096
+ * The underlying Three.js scene object.
3097
+ * It is used to define the 3D space containing objects, lights, and cameras.
3031
3098
  */
3032
- get fade(): boolean;
3099
+ three: THREE.Scene;
3100
+ /** {@link Configurable.onSetup} */
3101
+ readonly onSetup: Event<SimpleScene>;
3033
3102
  /**
3034
- * Whether the grid should fade away with distance. Recommended to be true for
3035
- * perspective cameras and false for orthographic cameras.
3103
+ * Configuration interface for the {@link SimpleScene}.
3104
+ * Defines properties for directional and ambient lights.
3036
3105
  */
3037
- set fade(active: boolean);
3038
- /** The Three.js mesh that contains the infinite grid. */
3039
- readonly three: THREE.Mesh;
3040
- private _fade;
3041
- constructor(components: Components, world: World, config: GridConfig);
3042
- /** {@link Disposable.dispose} */
3043
- dispose(): void;
3044
- private setupEvents;
3045
- private updateZoom;
3106
+ config: Required<SimpleSceneConfig>;
3107
+ constructor(components: Components);
3108
+ /** {@link Configurable.setup} */
3109
+ setup(config?: Partial<SimpleSceneConfig>): void;
3046
3110
  }
3047
3111
  import * as THREE from "three";
3048
3112
  import { BaseRenderer, Event } from "../../Types";
@@ -3099,94 +3163,125 @@ export declare class SimpleRenderer extends BaseRenderer {
3099
3163
  private onContextBack;
3100
3164
  }
3101
3165
  import * as THREE from "three";
3102
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3166
+ import CameraControls from "camera-controls";
3167
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
3168
+ import { Components } from "../../Components";
3103
3169
  /**
3104
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3105
- *
3106
- * @template T - The type of the scene. Default is BaseScene.
3107
- * @template U - The type of the camera. Default is BaseCamera.
3108
- * @template S - The type of the renderer. Default is BaseRenderer.
3170
+ * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
3109
3171
  */
3110
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3111
- /**
3112
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3113
- */
3114
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3115
- /** {@link Updateable.onAfterUpdate} */
3116
- readonly onAfterUpdate: Event<unknown>;
3172
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3117
3173
  /** {@link Updateable.onBeforeUpdate} */
3118
- readonly onBeforeUpdate: Event<unknown>;
3119
- /** {@link Disposable.onDisposed} */
3120
- readonly onDisposed: Event<unknown>;
3174
+ readonly onBeforeUpdate: Event<SimpleCamera>;
3175
+ /** {@link Updateable.onAfterUpdate} */
3176
+ readonly onAfterUpdate: Event<SimpleCamera>;
3121
3177
  /**
3122
- * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
3178
+ * Event that is triggered when the aspect of the camera has been updated.
3179
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
3123
3180
  */
3124
- isDisposing: boolean;
3181
+ readonly onAspectUpdated: Event<unknown>;
3182
+ /** {@link Disposable.onDisposed} */
3183
+ readonly onDisposed: Event<string>;
3125
3184
  /**
3126
- * Indicates whether the world is currently enabled.
3127
- * When disabled, the world will not be updated.
3185
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
3186
+ * This camera is used for rendering the scene.
3128
3187
  */
3129
- enabled: boolean;
3188
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3189
+ private _allControls;
3130
3190
  /**
3131
- * A unique identifier for the world.
3191
+ * The object that controls the camera. An instance of
3192
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3193
+ * Transforming the camera directly will have no effect: you need to use this
3194
+ * object to move, rotate, look at objects, etc.
3132
3195
  */
3133
- uuid: string;
3196
+ get controls(): CameraControls;
3134
3197
  /**
3135
- * An optional name for the world.
3198
+ * Getter for the enabled state of the camera controls.
3199
+ * If the current world is null, it returns false.
3200
+ * Otherwise, it returns the enabled state of the camera controls.
3201
+ *
3202
+ * @returns {boolean} The enabled state of the camera controls.
3136
3203
  */
3137
- name?: string;
3138
- private _scene?;
3139
- private _camera?;
3140
- private _renderer;
3204
+ get enabled(): boolean;
3141
3205
  /**
3142
- * Getter for the scene. If no scene is initialized, it throws an error.
3143
- * @returns The current scene.
3206
+ * Setter for the enabled state of the camera controls.
3207
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3208
+ *
3209
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3144
3210
  */
3145
- get scene(): T;
3211
+ set enabled(enabled: boolean);
3212
+ constructor(components: Components);
3213
+ /** {@link Disposable.dispose} */
3214
+ dispose(): void;
3215
+ /** {@link Updateable.update} */
3216
+ update(_delta: number): void;
3146
3217
  /**
3147
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3148
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3149
- * @param scene - The new scene to be set.
3218
+ * Updates the aspect of the camera to match the size of the
3219
+ * {@link Components.renderer}.
3150
3220
  */
3151
- set scene(scene: T);
3221
+ updateAspect: () => void;
3222
+ private setupCamera;
3223
+ private newCameraControls;
3224
+ private setupEvents;
3225
+ private static getSubsetOfThree;
3226
+ }
3227
+ import * as THREE from "three";
3228
+ import { Hideable, Event, World, Disposable } from "../../Types";
3229
+ import { Components } from "../../Components";
3230
+ /**
3231
+ * Configuration interface for the {@link SimpleGrid} class.
3232
+ */
3233
+ export interface GridConfig {
3152
3234
  /**
3153
- * Getter for the camera. If no camera is initialized, it throws an error.
3154
- * @returns The current camera.
3235
+ * The color of the grid lines.
3155
3236
  */
3156
- get camera(): U;
3237
+ color: THREE.Color;
3157
3238
  /**
3158
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3159
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3160
- * @param camera - The new camera to be set.
3239
+ * The size of the primary grid lines.
3161
3240
  */
3162
- set camera(camera: U);
3241
+ size1: number;
3163
3242
  /**
3164
- * Getter for the renderer.
3165
- * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3243
+ * The size of the secondary grid lines.
3166
3244
  */
3167
- get renderer(): S | null;
3245
+ size2: number;
3168
3246
  /**
3169
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3170
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3171
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3172
- * @param renderer - The new renderer to be set or null to remove the current renderer.
3247
+ * The distance at which the grid lines start to fade away.
3173
3248
  */
3174
- set renderer(renderer: S | null);
3175
- /** {@link Updateable.update} */
3176
- update(delta?: number): void;
3177
- /** {@link Disposable.dispose} */
3178
- dispose(disposeResources?: boolean): void;
3249
+ distance: number;
3179
3250
  }
3180
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3181
3251
  /**
3182
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3252
+ * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
3183
3253
  */
3184
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3254
+ export declare class SimpleGrid implements Hideable, Disposable {
3255
+ /** {@link Disposable.onDisposed} */
3256
+ readonly onDisposed: Event<unknown>;
3257
+ /** The world instance to which this Raycaster belongs. */
3258
+ world: World;
3259
+ /** The components instance to which this grid belongs. */
3260
+ components: Components;
3261
+ /** {@link Hideable.visible} */
3262
+ get visible(): boolean;
3263
+ /** {@link Hideable.visible} */
3264
+ set visible(visible: boolean);
3265
+ /** The material of the grid. */
3266
+ get material(): THREE.ShaderMaterial;
3185
3267
  /**
3186
- * Amount of properties to be streamed.
3187
- * Defaults to 100 properties.
3268
+ * Whether the grid should fade away with distance. Recommended to be true for
3269
+ * perspective cameras and false for orthographic cameras.
3188
3270
  */
3189
- propertiesSize: number;
3271
+ get fade(): boolean;
3272
+ /**
3273
+ * Whether the grid should fade away with distance. Recommended to be true for
3274
+ * perspective cameras and false for orthographic cameras.
3275
+ */
3276
+ set fade(active: boolean);
3277
+ /** The Three.js mesh that contains the infinite grid. */
3278
+ readonly three: THREE.Mesh;
3279
+ private _fade;
3280
+ constructor(components: Components, world: World, config: GridConfig);
3281
+ /** {@link Disposable.dispose} */
3282
+ dispose(): void;
3283
+ private setupEvents;
3284
+ private updateZoom;
3190
3285
  }
3191
3286
  import * as THREE from "three";
3192
3287
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -3285,11 +3380,6 @@ export declare class SimplePlane implements Disposable, Hideable {
3285
3380
  private newHelper;
3286
3381
  private static newPlaneMesh;
3287
3382
  }
3288
- import * as WEBIFC from "web-ifc";
3289
- export declare class IfcMetadataReader {
3290
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3291
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3292
- }
3293
3383
  import * as THREE from "three";
3294
3384
  import * as WEBIFC from "web-ifc";
3295
3385
  import * as FRAGS from "@thatopen/fragments";
@@ -3305,143 +3395,55 @@ export declare class CivilReader {
3305
3395
  } | undefined;
3306
3396
  private getCurves;
3307
3397
  }
3308
- import { NavigationMode } from "./types";
3309
- import { OrthoPerspectiveCamera } from "../index";
3310
- /**
3311
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3312
- */
3313
- export declare class FirstPersonMode implements NavigationMode {
3314
- private camera;
3315
- /** {@link NavigationMode.enabled} */
3316
- enabled: boolean;
3317
- /** {@link NavigationMode.id} */
3318
- readonly id = "FirstPerson";
3319
- constructor(camera: OrthoPerspectiveCamera);
3320
- /** {@link NavigationMode.set} */
3321
- set(active: boolean): void;
3322
- private setupFirstPersonCamera;
3323
- }
3324
- import { NavigationMode } from "./types";
3325
- import { OrthoPerspectiveCamera } from "../index";
3326
- /**
3327
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3328
- */
3329
- export declare class OrbitMode implements NavigationMode {
3330
- camera: OrthoPerspectiveCamera;
3331
- /** {@link NavigationMode.enabled} */
3332
- enabled: boolean;
3333
- /** {@link NavigationMode.id} */
3334
- readonly id = "Orbit";
3335
- constructor(camera: OrthoPerspectiveCamera);
3336
- /** {@link NavigationMode.set} */
3337
- set(active: boolean): void;
3338
- private activateOrbitControls;
3398
+ import * as WEBIFC from "web-ifc";
3399
+ export declare class IfcMetadataReader {
3400
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3401
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3339
3402
  }
3340
- import * as THREE from "three";
3341
- import { CameraProjection } from "./types";
3342
- import { Event } from "../../Types";
3343
- import { OrthoPerspectiveCamera } from "../index";
3403
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3344
3404
  /**
3345
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3405
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3346
3406
  */
3347
- export declare class ProjectionManager {
3348
- /**
3349
- * Event that fires when the {@link CameraProjection} changes.
3350
- */
3351
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3352
- /**
3353
- * Current projection mode of the camera.
3354
- * Default is "Perspective".
3355
- */
3356
- current: CameraProjection;
3357
- /**
3358
- * The camera controlled by this ProjectionManager.
3359
- * It can be either a PerspectiveCamera or an OrthographicCamera.
3360
- */
3361
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3362
- /** Match Ortho zoom with Perspective distance when changing projection mode */
3363
- matchOrthoDistanceEnabled: boolean;
3364
- private _component;
3365
- private _previousDistance;
3366
- constructor(camera: OrthoPerspectiveCamera);
3407
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3367
3408
  /**
3368
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3369
- *
3370
- * @param projection - the new projection to set. If it is the current projection,
3371
- * it will have no effect.
3409
+ * Minimum number of geometries to be streamed.
3410
+ * Defaults to 10 geometries.
3372
3411
  */
3373
- set(projection: CameraProjection): Promise<void>;
3412
+ minGeometrySize: number;
3374
3413
  /**
3375
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
3376
- * and vice versa.
3414
+ * Minimum amount of assets to be streamed.
3415
+ * Defaults to 1000 assets.
3377
3416
  */
3378
- toggle(): Promise<void>;
3379
- private setOrthoCamera;
3380
- private getPerspectiveDims;
3381
- private setupOrthoCamera;
3382
- private getDistance;
3383
- private setPerspectiveCamera;
3417
+ minAssetsSize: number;
3384
3418
  }
3385
3419
  /**
3386
- * The projection system of the camera.
3387
- */
3388
- export type CameraProjection = "Perspective" | "Orthographic";
3389
- /**
3390
- * The extensible list of supported navigation modes.
3391
- */
3392
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3393
- /**
3394
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3420
+ * A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
3395
3421
  */
3396
- export interface NavigationMode {
3397
- /** The unique ID of this navigation mode. */
3398
- id: NavModeID;
3399
- /**
3400
- * Enable or disable this navigation mode.
3401
- * When a new navigation mode is enabled, the previous navigation mode
3402
- * must be disabled.
3403
- *
3404
- * @param active - whether to enable or disable this mode.
3405
- * @param options - any additional data required to enable or disable it.
3406
- * */
3407
- set: (active: boolean, options?: any) => void;
3408
- /** Whether this navigation mode is active or not. */
3409
- enabled: boolean;
3422
+ export interface StreamedGeometries {
3423
+ [id: number]: {
3424
+ /** The bounding box of the geometry as a Float32Array. */
3425
+ boundingBox: Float32Array;
3426
+ /** A boolean indicating whether the geometry has holes. */
3427
+ hasHoles: boolean;
3428
+ /** An optional file path for the geometry data. */
3429
+ geometryFile?: string;
3430
+ };
3410
3431
  }
3411
- import { NavigationMode } from "./types";
3412
- import { OrthoPerspectiveCamera } from "../index";
3413
3432
  /**
3414
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3433
+ * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
3415
3434
  */
3416
- export declare class PlanMode implements NavigationMode {
3417
- private camera;
3418
- /** {@link NavigationMode.enabled} */
3419
- enabled: boolean;
3420
- /** {@link NavigationMode.id} */
3421
- readonly id = "Plan";
3422
- private mouseAction1?;
3423
- private mouseAction2?;
3424
- private mouseInitialized;
3425
- private readonly defaultAzimuthSpeed;
3426
- private readonly defaultPolarSpeed;
3427
- constructor(camera: OrthoPerspectiveCamera);
3428
- /** {@link NavigationMode.set} */
3429
- set(active: boolean): void;
3430
- }
3431
- import * as WEBIFC from "web-ifc";
3432
- import * as THREE from "three";
3433
- export declare class Units {
3434
- factor: number;
3435
- complement: number;
3436
- apply(matrix: THREE.Matrix4): void;
3437
- setUp(webIfc: WEBIFC.IfcAPI): void;
3438
- private getLengthUnits;
3439
- private getScaleMatrix;
3440
- }
3441
- import { BufferGeometry } from "three";
3442
- import * as THREE from "three";
3443
- export declare class TransformHelper {
3444
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3435
+ export interface StreamedAsset {
3436
+ /** The unique identifier of the asset. */
3437
+ id: number;
3438
+ /** An array of geometries associated with the asset. */
3439
+ geometries: {
3440
+ /** The unique identifier of the geometry. */
3441
+ geometryID: number;
3442
+ /** The transformation matrix of the geometry as a number array. */
3443
+ transformation: number[];
3444
+ /** The color of the geometry as a number array. */
3445
+ color: number[];
3446
+ }[];
3445
3447
  }
3446
3448
  export type RelationsMap = Map<number, Map<number, number[]>>;
3447
3449
  export interface ModelsRelationMap {
@@ -3467,5 +3469,20 @@ export type InverseAttributes = [
3467
3469
  "ContainsElements"
3468
3470
  ];
3469
3471
  export type InverseAttribute = InverseAttributes[number];
3472
+ import * as WEBIFC from "web-ifc";
3473
+ import * as THREE from "three";
3474
+ export declare class Units {
3475
+ factor: number;
3476
+ complement: number;
3477
+ apply(matrix: THREE.Matrix4): void;
3478
+ setUp(webIfc: WEBIFC.IfcAPI): void;
3479
+ private getLengthUnits;
3480
+ private getScaleMatrix;
3481
+ }
3482
+ import { BufferGeometry } from "three";
3483
+ import * as THREE from "three";
3484
+ export declare class TransformHelper {
3485
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3486
+ }
3470
3487
 
3471
3488
  }