@thatopen/components 2.1.23 → 2.1.24

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,49 +1,4 @@
1
1
  declare namespace OBC {
2
- import * as THREE from "three";
3
- import { Components } from "../Components";
4
- import { Component } from "../Types";
5
- /**
6
- * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
7
- */
8
- export declare class Disposer extends Component {
9
- private _disposedComponents;
10
- /** {@link Component.enabled} */
11
- enabled: boolean;
12
- /**
13
- * A unique identifier for the component.
14
- * This UUID is used to register the component within the Components system.
15
- */
16
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
17
- constructor(components: Components);
18
- /**
19
- * Return the UUIDs of all disposed components.
20
- */
21
- get(): Set<string>;
22
- /**
23
- * Removes a mesh, its geometry and its materials from memory. If you are
24
- * using any of these in other parts of the application, make sure that you
25
- * remove them from the mesh before disposing it.
26
- *
27
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
28
- * to remove.
29
- *
30
- * @param materials - whether to dispose the materials of the mesh.
31
- *
32
- * @param recursive - whether to recursively dispose the children of the mesh.
33
- */
34
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
35
- /**
36
- * Disposes a geometry from memory.
37
- *
38
- * @param geometry - the
39
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
40
- * to remove.
41
- */
42
- disposeGeometry(geometry: THREE.BufferGeometry): void;
43
- private disposeGeometryAndMaterials;
44
- private disposeChildren;
45
- private static disposeMaterial;
46
- }
47
2
  import { SimpleScene, SimpleSceneConfig } from "../Worlds";
48
3
  import { DistanceRenderer } from "./src";
49
4
  import { Disposable } from "../Types";
@@ -103,124 +58,6 @@ export declare class ShadowedScene extends SimpleScene implements Disposable {
103
58
  updateShadows(): Promise<void>;
104
59
  private recomputeShadows;
105
60
  }
106
- import { Component, Disposable, Event } from "../Types";
107
- /**
108
- * 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.
109
- */
110
- export declare class Components implements Disposable {
111
- /**
112
- * The version of the @thatopen/components library.
113
- */
114
- static readonly release = "2.1.23";
115
- /** {@link Disposable.onDisposed} */
116
- readonly onDisposed: Event<void>;
117
- /**
118
- * The list of components created in this app.
119
- * The keys are UUIDs and the values are instances of the components.
120
- */
121
- readonly list: Map<string, Component>;
122
- /**
123
- * If disabled, the animation loop will be stopped.
124
- * Default value is false.
125
- */
126
- enabled: boolean;
127
- private _clock;
128
- /**
129
- * Adds a component to the list of components.
130
- * Throws an error if a component with the same UUID already exists.
131
- *
132
- * @param uuid - The unique identifier of the component.
133
- * @param instance - The instance of the component to be added.
134
- *
135
- * @throws Will throw an error if a component with the same UUID already exists.
136
- *
137
- * @internal
138
- */
139
- add(uuid: string, instance: Component): void;
140
- /**
141
- * Retrieves a component instance by its constructor function.
142
- * If the component does not exist in the list, it will be created and added.
143
- *
144
- * @template U - The type of the component to retrieve.
145
- * @param Component - The constructor function of the component to retrieve.
146
- *
147
- * @returns The instance of the requested component.
148
- *
149
- * @throws Will throw an error if a component with the same UUID already exists.
150
- *
151
- * @internal
152
- */
153
- get<U extends Component>(Component: new (components: Components) => U): U;
154
- constructor();
155
- /**
156
- * Initializes the Components instance.
157
- * This method starts the animation loop, sets the enabled flag to true,
158
- * and calls the update method.
159
- *
160
- * @returns {void}
161
- */
162
- init(): void;
163
- /**
164
- * Disposes the memory of all the components and tools of this instance of
165
- * the library. A memory leak will be created if:
166
- *
167
- * - An instance of the library ends up out of scope and this function isn't
168
- * called. This is especially relevant in Single Page Applications (React,
169
- * Angular, Vue, etc).
170
- *
171
- * - Any of the objects of this instance (meshes, geometries,materials, etc) is
172
- * referenced by a reference type (object or array).
173
- *
174
- * You can learn more about how Three.js handles memory leaks
175
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
176
- *
177
- */
178
- dispose(): void;
179
- private update;
180
- private static setupBVH;
181
- }
182
- import { Component, Disposable, World, Event } from "../Types";
183
- import { SimpleRaycaster } from "./src";
184
- import { Components } from "../Components";
185
- /**
186
- * 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).
187
- */
188
- export declare class Raycasters extends Component implements Disposable {
189
- /**
190
- * A unique identifier for the component.
191
- * This UUID is used to register the component within the Components system.
192
- */
193
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
194
- /** {@link Component.enabled} */
195
- enabled: boolean;
196
- /**
197
- * A Map that stores raycasters for each world.
198
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
199
- */
200
- list: Map<string, SimpleRaycaster>;
201
- /** {@link Disposable.onDisposed} */
202
- onDisposed: Event<unknown>;
203
- constructor(components: Components);
204
- /**
205
- * Retrieves a SimpleRaycaster instance for the given world.
206
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
207
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
208
- *
209
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
210
- * @returns The SimpleRaycaster instance for the given world.
211
- */
212
- get(world: World): SimpleRaycaster;
213
- /**
214
- * Deletes the SimpleRaycaster instance associated with the given world.
215
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
216
- *
217
- * @param world - The world for which to delete the SimpleRaycaster instance.
218
- * @returns {void}
219
- */
220
- delete(world: World): void;
221
- /** {@link Disposable.dispose} */
222
- dispose(): void;
223
- }
224
61
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
225
62
  import { Components } from "../Components";
226
63
  import { SimpleWorld } from "./src";
@@ -288,54 +125,81 @@ export declare class Worlds extends Component implements Updateable, Disposable
288
125
  /** {@link Updateable.update} */
289
126
  update(delta?: number): void | Promise<void>;
290
127
  }
291
- import { Component, Disposable, World, Event } from "../Types";
292
- import { GridConfig, SimpleGrid } from "./src";
293
- import { Components } from "../Components";
128
+ import { Component, Disposable, Event } from "../Types";
294
129
  /**
295
- * 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).
130
+ * 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.
296
131
  */
297
- export declare class Grids extends Component implements Disposable {
132
+ export declare class Components implements Disposable {
298
133
  /**
299
- * A unique identifier for the component.
300
- * This UUID is used to register the component within the Components system.
134
+ * The version of the @thatopen/components library.
301
135
  */
302
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
136
+ static readonly release = "2.1.24";
137
+ /** {@link Disposable.onDisposed} */
138
+ readonly onDisposed: Event<void>;
303
139
  /**
304
- * A map of world UUIDs to their corresponding grid instances.
140
+ * The list of components created in this app.
141
+ * The keys are UUIDs and the values are instances of the components.
305
142
  */
306
- list: Map<string, SimpleGrid>;
143
+ readonly list: Map<string, Component>;
307
144
  /**
308
- * The default configuration for grid creation.
145
+ * If disabled, the animation loop will be stopped.
146
+ * Default value is false.
309
147
  */
310
- config: Required<GridConfig>;
311
- /** {@link Disposable.onDisposed} */
312
- readonly onDisposed: Event<unknown>;
313
- /** {@link Component.enabled} */
314
148
  enabled: boolean;
315
- constructor(components: Components);
149
+ private _clock;
316
150
  /**
317
- * Creates a new grid for the given world.
318
- * Throws an error if a grid already exists for the world.
151
+ * Adds a component to the list of components.
152
+ * Throws an error if a component with the same UUID already exists.
319
153
  *
320
- * @param world - The world to create the grid for.
321
- * @returns The newly created grid.
154
+ * @param uuid - The unique identifier of the component.
155
+ * @param instance - The instance of the component to be added.
322
156
  *
323
- * @throws Will throw an error if a grid already exists for the given world.
157
+ * @throws Will throw an error if a component with the same UUID already exists.
158
+ *
159
+ * @internal
324
160
  */
325
- create(world: World): SimpleGrid;
161
+ add(uuid: string, instance: Component): void;
326
162
  /**
327
- * Deletes the grid associated with the given world.
328
- * If a grid does not exist for the given world, this method does nothing.
163
+ * Retrieves a component instance by its constructor function.
164
+ * If the component does not exist in the list, it will be created and added.
329
165
  *
330
- * @param world - The world for which to delete the grid.
166
+ * @template U - The type of the component to retrieve.
167
+ * @param Component - The constructor function of the component to retrieve.
168
+ *
169
+ * @returns The instance of the requested component.
170
+ *
171
+ * @throws Will throw an error if a component with the same UUID already exists.
172
+ *
173
+ * @internal
174
+ */
175
+ get<U extends Component>(Component: new (components: Components) => U): U;
176
+ constructor();
177
+ /**
178
+ * Initializes the Components instance.
179
+ * This method starts the animation loop, sets the enabled flag to true,
180
+ * and calls the update method.
181
+ *
182
+ * @returns {void}
183
+ */
184
+ init(): void;
185
+ /**
186
+ * Disposes the memory of all the components and tools of this instance of
187
+ * the library. A memory leak will be created if:
188
+ *
189
+ * - An instance of the library ends up out of scope and this function isn't
190
+ * called. This is especially relevant in Single Page Applications (React,
191
+ * Angular, Vue, etc).
192
+ *
193
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
194
+ * referenced by a reference type (object or array).
195
+ *
196
+ * You can learn more about how Three.js handles memory leaks
197
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
331
198
  *
332
- * @remarks
333
- * This method will dispose of the grid and remove it from the internal list.
334
- * If the world is disposed before calling this method, the grid will be automatically deleted.
335
199
  */
336
- delete(world: World): void;
337
- /** {@link Disposable.dispose} */
338
200
  dispose(): void;
201
+ private update;
202
+ private static setupBVH;
339
203
  }
340
204
  import * as THREE from "three";
341
205
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
@@ -525,14 +389,197 @@ export declare class Cullers extends Component implements Disposable {
525
389
  */
526
390
  updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
527
391
  }
528
- import * as THREE from "three";
392
+ import { MiniMap } from "./src";
393
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
529
394
  import { Components } from "../Components";
530
- import { SimpleCamera } from "..";
531
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
532
395
  /**
533
- * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
396
+ * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
534
397
  */
535
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
398
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
399
+ /**
400
+ * A unique identifier for the component.
401
+ * This UUID is used to register the component within the Components system.
402
+ */
403
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
404
+ /** {@link Updateable.onAfterUpdate} */
405
+ readonly onAfterUpdate: Event<unknown>;
406
+ /** {@link Updateable.onBeforeUpdate} */
407
+ readonly onBeforeUpdate: Event<unknown>;
408
+ /** {@link Disposable.onDisposed} */
409
+ readonly onDisposed: Event<unknown>;
410
+ /** {@link Component.enabled} */
411
+ enabled: boolean;
412
+ /**
413
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
414
+ */
415
+ list: Map<string, MiniMap>;
416
+ constructor(components: Components);
417
+ /**
418
+ * Creates a new {@link MiniMap} instance associated with the given world.
419
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
420
+ *
421
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
422
+ * @returns The newly created {@link MiniMap} instance.
423
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
424
+ */
425
+ create(world: World): MiniMap;
426
+ /**
427
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
428
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
429
+ *
430
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
431
+ * @returns {void}
432
+ */
433
+ delete(id: string): void;
434
+ /** {@link Disposable.dispose} */
435
+ dispose(): void;
436
+ /** {@link Updateable.update} */
437
+ update(): void;
438
+ }
439
+ import { Component, Disposable, World, Event } from "../Types";
440
+ import { SimpleRaycaster } from "./src";
441
+ import { Components } from "../Components";
442
+ /**
443
+ * 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).
444
+ */
445
+ export declare class Raycasters extends Component implements Disposable {
446
+ /**
447
+ * A unique identifier for the component.
448
+ * This UUID is used to register the component within the Components system.
449
+ */
450
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
451
+ /** {@link Component.enabled} */
452
+ enabled: boolean;
453
+ /**
454
+ * A Map that stores raycasters for each world.
455
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
456
+ */
457
+ list: Map<string, SimpleRaycaster>;
458
+ /** {@link Disposable.onDisposed} */
459
+ onDisposed: Event<unknown>;
460
+ constructor(components: Components);
461
+ /**
462
+ * Retrieves a SimpleRaycaster instance for the given world.
463
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
464
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
465
+ *
466
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
467
+ * @returns The SimpleRaycaster instance for the given world.
468
+ */
469
+ get(world: World): SimpleRaycaster;
470
+ /**
471
+ * Deletes the SimpleRaycaster instance associated with the given world.
472
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
473
+ *
474
+ * @param world - The world for which to delete the SimpleRaycaster instance.
475
+ * @returns {void}
476
+ */
477
+ delete(world: World): void;
478
+ /** {@link Disposable.dispose} */
479
+ dispose(): void;
480
+ }
481
+ import { Component, Disposable, World, Event } from "../Types";
482
+ import { GridConfig, SimpleGrid } from "./src";
483
+ import { Components } from "../Components";
484
+ /**
485
+ * 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).
486
+ */
487
+ export declare class Grids extends Component implements Disposable {
488
+ /**
489
+ * A unique identifier for the component.
490
+ * This UUID is used to register the component within the Components system.
491
+ */
492
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
493
+ /**
494
+ * A map of world UUIDs to their corresponding grid instances.
495
+ */
496
+ list: Map<string, SimpleGrid>;
497
+ /**
498
+ * The default configuration for grid creation.
499
+ */
500
+ config: Required<GridConfig>;
501
+ /** {@link Disposable.onDisposed} */
502
+ readonly onDisposed: Event<unknown>;
503
+ /** {@link Component.enabled} */
504
+ enabled: boolean;
505
+ constructor(components: Components);
506
+ /**
507
+ * Creates a new grid for the given world.
508
+ * Throws an error if a grid already exists for the world.
509
+ *
510
+ * @param world - The world to create the grid for.
511
+ * @returns The newly created grid.
512
+ *
513
+ * @throws Will throw an error if a grid already exists for the given world.
514
+ */
515
+ create(world: World): SimpleGrid;
516
+ /**
517
+ * Deletes the grid associated with the given world.
518
+ * If a grid does not exist for the given world, this method does nothing.
519
+ *
520
+ * @param world - The world for which to delete the grid.
521
+ *
522
+ * @remarks
523
+ * This method will dispose of the grid and remove it from the internal list.
524
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
525
+ */
526
+ delete(world: World): void;
527
+ /** {@link Disposable.dispose} */
528
+ dispose(): void;
529
+ }
530
+ import * as THREE from "three";
531
+ import { Components } from "../Components";
532
+ import { Component } from "../Types";
533
+ /**
534
+ * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
535
+ */
536
+ export declare class Disposer extends Component {
537
+ private _disposedComponents;
538
+ /** {@link Component.enabled} */
539
+ enabled: boolean;
540
+ /**
541
+ * A unique identifier for the component.
542
+ * This UUID is used to register the component within the Components system.
543
+ */
544
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
545
+ constructor(components: Components);
546
+ /**
547
+ * Return the UUIDs of all disposed components.
548
+ */
549
+ get(): Set<string>;
550
+ /**
551
+ * Removes a mesh, its geometry and its materials from memory. If you are
552
+ * using any of these in other parts of the application, make sure that you
553
+ * remove them from the mesh before disposing it.
554
+ *
555
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
556
+ * to remove.
557
+ *
558
+ * @param materials - whether to dispose the materials of the mesh.
559
+ *
560
+ * @param recursive - whether to recursively dispose the children of the mesh.
561
+ */
562
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
563
+ /**
564
+ * Disposes a geometry from memory.
565
+ *
566
+ * @param geometry - the
567
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
568
+ * to remove.
569
+ */
570
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
571
+ private disposeGeometryAndMaterials;
572
+ private disposeChildren;
573
+ private static disposeMaterial;
574
+ }
575
+ import * as THREE from "three";
576
+ import { Components } from "../Components";
577
+ import { SimpleCamera } from "..";
578
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
579
+ /**
580
+ * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
581
+ */
582
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
536
583
  /**
537
584
  * A ProjectionManager instance that manages the projection modes of the camera.
538
585
  */
@@ -589,52 +636,17 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
589
636
  private newOrthoCamera;
590
637
  private setOrthoPerspCameraAspect;
591
638
  }
592
- import { MiniMap } from "./src";
593
- import { Component, Updateable, World, Event, Disposable } from "../Types";
594
- import { Components } from "../Components";
595
- /**
596
- * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
597
- */
598
- export declare class MiniMaps extends Component implements Updateable, Disposable {
599
- /**
600
- * A unique identifier for the component.
601
- * This UUID is used to register the component within the Components system.
602
- */
603
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
604
- /** {@link Updateable.onAfterUpdate} */
605
- readonly onAfterUpdate: Event<unknown>;
606
- /** {@link Updateable.onBeforeUpdate} */
607
- readonly onBeforeUpdate: Event<unknown>;
608
- /** {@link Disposable.onDisposed} */
609
- readonly onDisposed: Event<unknown>;
610
- /** {@link Component.enabled} */
611
- enabled: boolean;
612
- /**
613
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
614
- */
615
- list: Map<string, MiniMap>;
616
- constructor(components: Components);
617
- /**
618
- * Creates a new {@link MiniMap} instance associated with the given world.
619
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
620
- *
621
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
622
- * @returns The newly created {@link MiniMap} instance.
623
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
624
- */
625
- create(world: World): MiniMap;
626
- /**
627
- * Deletes a {@link MiniMap} instance associated with the given world ID.
628
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
629
- *
630
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
631
- * @returns {void}
632
- */
633
- delete(id: string): void;
634
- /** {@link Disposable.dispose} */
635
- dispose(): void;
636
- /** {@link Updateable.update} */
637
- update(): void;
639
+ import * as THREE from "three";
640
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
641
+ center: THREE.Vector3;
642
+ halfSizes: THREE.Vector3;
643
+ rotation: THREE.Matrix3;
644
+ transformation: THREE.Matrix4;
645
+ };
646
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
647
+ import * as THREE from "three";
648
+ export declare class MaterialsUtils {
649
+ static isTransparent(material: THREE.Material): boolean;
638
650
  }
639
651
  import * as THREE from "three";
640
652
  import * as FRAGS from "@thatopen/fragments";
@@ -905,35 +917,10 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
905
917
  getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
906
918
  }
907
919
  import * as WEBIFC from "web-ifc";
908
- import * as FRAG from "@thatopen/fragments";
909
- import { Component, Components } from "../../core";
920
+ import { FragmentsGroup } from "@thatopen/fragments";
921
+ import { Component, Disposable, Event, Components } from "../../core";
910
922
  /**
911
- * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
912
- */
913
- export declare class IfcJsonExporter extends Component {
914
- /**
915
- * A unique identifier for the component.
916
- * This UUID is used to register the component within the Components system.
917
- */
918
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
919
- /** {@link Component.enabled} */
920
- enabled: boolean;
921
- constructor(components: Components);
922
- /**
923
- * Exports all the properties of an IFC into an array of JS objects.
924
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
925
- * @param modelID ID of the IFC model whose properties to extract.
926
- * @param indirect whether to get the indirect relationships as well.
927
- * @param recursiveSpatial whether to get the properties of spatial items recursively
928
- * to make the location data available (e.g. absolute position of building).
929
- */
930
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
931
- }
932
- import * as WEBIFC from "web-ifc";
933
- import { FragmentsGroup } from "@thatopen/fragments";
934
- import { Component, Disposable, Event, Components } from "../../core";
935
- /**
936
- * Types for boolean properties in IFC schema.
923
+ * Types for boolean properties in IFC schema.
937
924
  */
938
925
  export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
939
926
  /**
@@ -1185,6 +1172,235 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1185
1172
  private registerChange;
1186
1173
  private newSingleProperty;
1187
1174
  }
1175
+ import * as WEBIFC from "web-ifc";
1176
+ import * as FRAG from "@thatopen/fragments";
1177
+ import { Component, Components } from "../../core";
1178
+ /**
1179
+ * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
1180
+ */
1181
+ export declare class IfcJsonExporter extends Component {
1182
+ /**
1183
+ * A unique identifier for the component.
1184
+ * This UUID is used to register the component within the Components system.
1185
+ */
1186
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1187
+ /** {@link Component.enabled} */
1188
+ enabled: boolean;
1189
+ constructor(components: Components);
1190
+ /**
1191
+ * Exports all the properties of an IFC into an array of JS objects.
1192
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1193
+ * @param modelID ID of the IFC model whose properties to extract.
1194
+ * @param indirect whether to get the indirect relationships as well.
1195
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
1196
+ * to make the location data available (e.g. absolute position of building).
1197
+ */
1198
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1199
+ }
1200
+ import * as THREE from "three";
1201
+ import { Component, Components, Disposable, Event, World } from "../core";
1202
+ /**
1203
+ * Configuration interface for the VertexPicker component.
1204
+ */
1205
+ export interface VertexPickerConfig {
1206
+ /**
1207
+ * If true, only vertices will be picked, not the closest point on the face.
1208
+ */
1209
+ showOnlyVertex: boolean;
1210
+ /**
1211
+ * The maximum distance for snapping to a vertex.
1212
+ */
1213
+ snapDistance: number;
1214
+ /**
1215
+ * The HTML element to use for previewing the picked vertex.
1216
+ */
1217
+ previewElement: HTMLElement;
1218
+ }
1219
+ /**
1220
+ * A class that provides functionality for picking vertices in a 3D scene.
1221
+ */
1222
+ export declare class VertexPicker extends Component implements Disposable {
1223
+ /** {@link Disposable.onDisposed} */
1224
+ readonly onDisposed: Event<unknown>;
1225
+ /**
1226
+ * An event that is triggered when a vertex is found.
1227
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
1228
+ */
1229
+ readonly onVertexFound: Event<THREE.Vector3>;
1230
+ /**
1231
+ * An event that is triggered when a vertex is lost.
1232
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
1233
+ */
1234
+ readonly onVertexLost: Event<THREE.Vector3>;
1235
+ /**
1236
+ * An event that is triggered when the picker is enabled or disabled
1237
+ */
1238
+ readonly onEnabled: Event<boolean>;
1239
+ /**
1240
+ * A reference to the Components instance associated with this VertexPicker.
1241
+ */
1242
+ components: Components;
1243
+ /**
1244
+ * A reference to the working plane used for vertex picking.
1245
+ * This plane is used to determine which vertices are considered valid for picking.
1246
+ * If this value is null, all vertices are considered valid.
1247
+ */
1248
+ workingPlane: THREE.Plane | null;
1249
+ private _pickedPoint;
1250
+ private _config;
1251
+ private _enabled;
1252
+ /**
1253
+ * Sets the enabled state of the VertexPicker.
1254
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1255
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1256
+ *
1257
+ * @param value - The new enabled state.
1258
+ */
1259
+ set enabled(value: boolean);
1260
+ /**
1261
+ * Gets the current enabled state of the VertexPicker.
1262
+ *
1263
+ * @returns The current enabled state.
1264
+ */
1265
+ get enabled(): boolean;
1266
+ /**
1267
+ * Sets the configuration for the VertexPicker component.
1268
+ *
1269
+ * @param value - A Partial object containing the configuration properties to update.
1270
+ * The properties not provided in the value object will retain their current values.
1271
+ *
1272
+ * @example
1273
+ * '''typescript
1274
+ * vertexPicker.config = {
1275
+ * snapDistance: 0.5,
1276
+ * showOnlyVertex: true,
1277
+ * };
1278
+ * '''
1279
+ */
1280
+ set config(value: Partial<VertexPickerConfig>);
1281
+ /**
1282
+ * Gets the current configuration for the VertexPicker component.
1283
+ *
1284
+ * @returns A copy of the current VertexPickerConfig object.
1285
+ *
1286
+ * @example
1287
+ * '''typescript
1288
+ * const currentConfig = vertexPicker.config;
1289
+ * console.log(currentConfig.snapDistance); // Output: 0.25
1290
+ * '''
1291
+ */
1292
+ get config(): Partial<VertexPickerConfig>;
1293
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
1294
+ /** {@link Disposable.dispose} */
1295
+ dispose(): void;
1296
+ /**
1297
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
1298
+ *
1299
+ * @param world - The World instance to use for raycasting.
1300
+ *
1301
+ * @returns The current picked point, or null if no point is picked.
1302
+ *
1303
+ * @remarks
1304
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1305
+ * If enabled, it performs raycasting to find the closest intersecting object.
1306
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
1307
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1308
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1309
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1310
+ */
1311
+ get(world: World): THREE.Vector3 | null;
1312
+ private getClosestVertex;
1313
+ private getVertices;
1314
+ private getVertex;
1315
+ }
1316
+ import { Component, Disposable, Event, Components } from "../../core";
1317
+ /**
1318
+ * The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
1319
+ */
1320
+ export declare class Exploder extends Component implements Disposable {
1321
+ /**
1322
+ * A unique identifier for the component.
1323
+ * This UUID is used to register the component within the Components system.
1324
+ */
1325
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1326
+ /** {@link Disposable.onDisposed} */
1327
+ readonly onDisposed: Event<unknown>;
1328
+ /** {@link Component.enabled} */
1329
+ enabled: boolean;
1330
+ /**
1331
+ * The height of the explosion animation.
1332
+ * This property determines the vertical distance by which fragments are moved during the explosion.
1333
+ * Default value is 10.
1334
+ */
1335
+ height: number;
1336
+ /**
1337
+ * The group name used for the explosion animation.
1338
+ * This property specifies the group of fragments that will be affected by the explosion.
1339
+ * Default value is "storeys".
1340
+ */
1341
+ groupName: string;
1342
+ /**
1343
+ * A set of strings representing the exploded items.
1344
+ * This set is used to keep track of which items have been exploded.
1345
+ */
1346
+ list: Set<string>;
1347
+ constructor(components: Components);
1348
+ /** {@link Disposable.dispose} */
1349
+ dispose(): void;
1350
+ /**
1351
+ * Sets the explosion state of the fragments.
1352
+ *
1353
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
1354
+ *
1355
+ * @remarks
1356
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1357
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1358
+ * If 'active' is false, the fragments are moved back to their original position.
1359
+ *
1360
+ * The method also keeps track of the exploded items using the 'list' set.
1361
+ *
1362
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1363
+ */
1364
+ set(active: boolean): void;
1365
+ }
1366
+ import * as FRAGS from "@thatopen/fragments";
1367
+ import { Components, Component } from "../../core";
1368
+ /**
1369
+ * 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).
1370
+ */
1371
+ export declare class Hider extends Component {
1372
+ /**
1373
+ * A unique identifier for the component.
1374
+ * This UUID is used to register the component within the Components system.
1375
+ */
1376
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1377
+ /** {@link Component.enabled} */
1378
+ enabled: boolean;
1379
+ constructor(components: Components);
1380
+ /**
1381
+ * Sets the visibility of fragments within the 3D scene.
1382
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1383
+ * If 'items' is provided, only the specified fragments will be affected.
1384
+ *
1385
+ * @param visible - The visibility state to set for the fragments.
1386
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1387
+ * If not provided, all fragments will be affected.
1388
+ *
1389
+ * @returns {void}
1390
+ */
1391
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1392
+ /**
1393
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1394
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1395
+ *
1396
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1397
+ * If not provided, all fragments will be isolated.
1398
+ *
1399
+ * @returns {void}
1400
+ */
1401
+ isolate(items: FRAGS.FragmentIdMap): void;
1402
+ private updateCulledVisibility;
1403
+ }
1188
1404
  import * as THREE from "three";
1189
1405
  import * as FRAGS from "@thatopen/fragments";
1190
1406
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -1393,410 +1609,14 @@ export declare class BoundingBoxer extends Component implements Disposable {
1393
1609
  addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
1394
1610
  private static getFragmentBounds;
1395
1611
  }
1396
- import * as THREE from "three";
1612
+ import * as WEBIFC from "web-ifc";
1397
1613
  import * as FRAGS from "@thatopen/fragments";
1398
- import { Disposable, Component, Event, Components } from "../../core";
1614
+ import { IfcFragmentSettings } from "./src";
1615
+ import { Component, Components, Event, Disposable } from "../../core";
1399
1616
  /**
1400
- * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
1617
+ * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1401
1618
  */
1402
- export interface Classification {
1403
- /**
1404
- * A system within the classification.
1405
- * The key is the system name, and the value is an object representing the classes within the system.
1406
- */
1407
- [system: string]: {
1408
- /**
1409
- * A class within the system.
1410
- * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
1411
- */
1412
- [className: string]: {
1413
- map: FRAGS.FragmentIdMap;
1414
- name: string;
1415
- id: number | null;
1416
- };
1417
- };
1418
- }
1419
- /**
1420
- * The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
1421
- */
1422
- export declare class Classifier extends Component implements Disposable {
1423
- /**
1424
- * A unique identifier for the component.
1425
- * This UUID is used to register the component within the Components system.
1426
- */
1427
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1428
- /** {@link Component.enabled} */
1429
- enabled: boolean;
1430
- /**
1431
- * A map representing the classification systems.
1432
- * The key is the system name, and the value is an object representing the classes within the system.
1433
- */
1434
- list: Classification;
1435
- /** {@link Disposable.onDisposed} */
1436
- readonly onDisposed: Event<unknown>;
1437
- constructor(components: Components);
1438
- private onFragmentsDisposed;
1439
- /** {@link Disposable.dispose} */
1440
- dispose(): void;
1441
- /**
1442
- * Removes a fragment from the classification based on its unique identifier (guid).
1443
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1444
- *
1445
- * @param guid - The unique identifier of the fragment to be removed.
1446
- */
1447
- remove(guid: string): void;
1448
- /**
1449
- * Finds and returns fragments based on the provided filter criteria.
1450
- * If no filter is provided, it returns all fragments.
1451
- *
1452
- * @param filter - An optional object containing filter criteria.
1453
- * The keys of the object represent the classification system names,
1454
- * and the values are arrays of class names to match.
1455
- *
1456
- * @returns A map of fragment GUIDs to their respective express IDs,
1457
- * where the express IDs are filtered based on the provided filter criteria.
1458
- *
1459
- * @throws Will throw an error if the fragments map is malformed.
1460
- */
1461
- find(filter?: {
1462
- [name: string]: string[];
1463
- }): FRAGS.FragmentIdMap;
1464
- /**
1465
- * Classifies fragments based on their modelID.
1466
- *
1467
- * @param modelID - The unique identifier of the model to classify fragments by.
1468
- * @param group - The FragmentsGroup containing the fragments to be classified.
1469
- *
1470
- * @remarks
1471
- * This method iterates through the fragments in the provided group,
1472
- * and classifies them based on their modelID.
1473
- * The classification is stored in the 'list.models' property,
1474
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1475
- *
1476
- */
1477
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1478
- /**
1479
- * Classifies fragments based on their PredefinedType property.
1480
- *
1481
- * @param group - The FragmentsGroup containing the fragments to be classified.
1482
- *
1483
- * @remarks
1484
- * This method iterates through the properties of the fragments in the provided group,
1485
- * and classifies them based on their PredefinedType property.
1486
- * The classification is stored in the 'list.predefinedTypes' property,
1487
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1488
- *
1489
- * @throws Will throw an error if the fragment ID is not found.
1490
- */
1491
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1492
- /**
1493
- * Classifies fragments based on their entity type.
1494
- *
1495
- * @param group - The FragmentsGroup containing the fragments to be classified.
1496
- *
1497
- * @remarks
1498
- * This method iterates through the relations of the fragments in the provided group,
1499
- * and classifies them based on their entity type.
1500
- * The classification is stored in the 'list.entities' property,
1501
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1502
- *
1503
- * @throws Will throw an error if the fragment ID is not found.
1504
- */
1505
- byEntity(group: FRAGS.FragmentsGroup): void;
1506
- /**
1507
- * Classifies fragments based on a specific IFC relationship.
1508
- *
1509
- * @param group - The FragmentsGroup containing the fragments to be classified.
1510
- * @param ifcRel - The IFC relationship number to classify fragments by.
1511
- * @param systemName - The name of the classification system to store the classification.
1512
- *
1513
- * @remarks
1514
- * This method iterates through the relations of the fragments in the provided group,
1515
- * and classifies them based on the specified IFC relationship.
1516
- * The classification is stored in the 'list' property under the specified system name,
1517
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1518
- *
1519
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1520
- */
1521
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1522
- /**
1523
- * Classifies fragments based on their spatial structure in the IFC model.
1524
- *
1525
- * @param model - The FragmentsGroup containing the fragments to be classified.
1526
- * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
1527
- * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
1528
- * the classifier just pick the WEBIFC categories provided.
1529
- *
1530
- * @remarks
1531
- * This method iterates through the relations of the fragments in the provided group,
1532
- * and classifies them based on their spatial structure in the IFC model.
1533
- * The classification is stored in the 'list' property under the system name "spatialStructures",
1534
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1535
- *
1536
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1537
- */
1538
- bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
1539
- useProperties?: boolean;
1540
- isolate?: Set<number>;
1541
- }): Promise<void>;
1542
- /**
1543
- * Sets the color of the specified fragments.
1544
- *
1545
- * @param items - A map of fragment IDs to their respective express IDs.
1546
- * @param color - The color to set for the fragments.
1547
- * @param override - A boolean indicating whether to override the existing color of the fragments.
1548
- *
1549
- * @remarks
1550
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1551
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
1552
- *
1553
- * @throws Will throw an error if the fragment with the specified ID is not found.
1554
- */
1555
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1556
- /**
1557
- * Resets the color of the specified fragments to their original color.
1558
- *
1559
- * @param items - A map of fragment IDs to their respective express IDs.
1560
- *
1561
- * @remarks
1562
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1563
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1564
- *
1565
- * @throws Will throw an error if the fragment with the specified ID is not found.
1566
- */
1567
- resetColor(items: FRAGS.FragmentIdMap): void;
1568
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1569
- }
1570
- import { Component, Disposable, Event, Components } from "../../core";
1571
- /**
1572
- * The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
1573
- */
1574
- export declare class Exploder extends Component implements Disposable {
1575
- /**
1576
- * A unique identifier for the component.
1577
- * This UUID is used to register the component within the Components system.
1578
- */
1579
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1580
- /** {@link Disposable.onDisposed} */
1581
- readonly onDisposed: Event<unknown>;
1582
- /** {@link Component.enabled} */
1583
- enabled: boolean;
1584
- /**
1585
- * The height of the explosion animation.
1586
- * This property determines the vertical distance by which fragments are moved during the explosion.
1587
- * Default value is 10.
1588
- */
1589
- height: number;
1590
- /**
1591
- * The group name used for the explosion animation.
1592
- * This property specifies the group of fragments that will be affected by the explosion.
1593
- * Default value is "storeys".
1594
- */
1595
- groupName: string;
1596
- /**
1597
- * A set of strings representing the exploded items.
1598
- * This set is used to keep track of which items have been exploded.
1599
- */
1600
- list: Set<string>;
1601
- constructor(components: Components);
1602
- /** {@link Disposable.dispose} */
1603
- dispose(): void;
1604
- /**
1605
- * Sets the explosion state of the fragments.
1606
- *
1607
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
1608
- *
1609
- * @remarks
1610
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1611
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1612
- * If 'active' is false, the fragments are moved back to their original position.
1613
- *
1614
- * The method also keeps track of the exploded items using the 'list' set.
1615
- *
1616
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1617
- */
1618
- set(active: boolean): void;
1619
- }
1620
- import * as THREE from "three";
1621
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
1622
- center: THREE.Vector3;
1623
- halfSizes: THREE.Vector3;
1624
- rotation: THREE.Matrix3;
1625
- transformation: THREE.Matrix4;
1626
- };
1627
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1628
- import * as THREE from "three";
1629
- export declare class MaterialsUtils {
1630
- static isTransparent(material: THREE.Material): boolean;
1631
- }
1632
- export declare class UUID {
1633
- private static _pattern;
1634
- private static _lut;
1635
- static create(): string;
1636
- static validate(uuid: string): void;
1637
- }
1638
- import * as THREE from "three";
1639
- import { Component, Components, Disposable, Event, World } from "../core";
1640
- /**
1641
- * Configuration interface for the VertexPicker component.
1642
- */
1643
- export interface VertexPickerConfig {
1644
- /**
1645
- * If true, only vertices will be picked, not the closest point on the face.
1646
- */
1647
- showOnlyVertex: boolean;
1648
- /**
1649
- * The maximum distance for snapping to a vertex.
1650
- */
1651
- snapDistance: number;
1652
- /**
1653
- * The HTML element to use for previewing the picked vertex.
1654
- */
1655
- previewElement: HTMLElement;
1656
- }
1657
- /**
1658
- * A class that provides functionality for picking vertices in a 3D scene.
1659
- */
1660
- export declare class VertexPicker extends Component implements Disposable {
1661
- /** {@link Disposable.onDisposed} */
1662
- readonly onDisposed: Event<unknown>;
1663
- /**
1664
- * An event that is triggered when a vertex is found.
1665
- * The event passes a THREE.Vector3 representing the position of the found vertex.
1666
- */
1667
- readonly onVertexFound: Event<THREE.Vector3>;
1668
- /**
1669
- * An event that is triggered when a vertex is lost.
1670
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
1671
- */
1672
- readonly onVertexLost: Event<THREE.Vector3>;
1673
- /**
1674
- * An event that is triggered when the picker is enabled or disabled
1675
- */
1676
- readonly onEnabled: Event<boolean>;
1677
- /**
1678
- * A reference to the Components instance associated with this VertexPicker.
1679
- */
1680
- components: Components;
1681
- /**
1682
- * A reference to the working plane used for vertex picking.
1683
- * This plane is used to determine which vertices are considered valid for picking.
1684
- * If this value is null, all vertices are considered valid.
1685
- */
1686
- workingPlane: THREE.Plane | null;
1687
- private _pickedPoint;
1688
- private _config;
1689
- private _enabled;
1690
- /**
1691
- * Sets the enabled state of the VertexPicker.
1692
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1693
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1694
- *
1695
- * @param value - The new enabled state.
1696
- */
1697
- set enabled(value: boolean);
1698
- /**
1699
- * Gets the current enabled state of the VertexPicker.
1700
- *
1701
- * @returns The current enabled state.
1702
- */
1703
- get enabled(): boolean;
1704
- /**
1705
- * Sets the configuration for the VertexPicker component.
1706
- *
1707
- * @param value - A Partial object containing the configuration properties to update.
1708
- * The properties not provided in the value object will retain their current values.
1709
- *
1710
- * @example
1711
- * '''typescript
1712
- * vertexPicker.config = {
1713
- * snapDistance: 0.5,
1714
- * showOnlyVertex: true,
1715
- * };
1716
- * '''
1717
- */
1718
- set config(value: Partial<VertexPickerConfig>);
1719
- /**
1720
- * Gets the current configuration for the VertexPicker component.
1721
- *
1722
- * @returns A copy of the current VertexPickerConfig object.
1723
- *
1724
- * @example
1725
- * '''typescript
1726
- * const currentConfig = vertexPicker.config;
1727
- * console.log(currentConfig.snapDistance); // Output: 0.25
1728
- * '''
1729
- */
1730
- get config(): Partial<VertexPickerConfig>;
1731
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
1732
- /** {@link Disposable.dispose} */
1733
- dispose(): void;
1734
- /**
1735
- * Performs the vertex picking operation based on the current state of the VertexPicker.
1736
- *
1737
- * @param world - The World instance to use for raycasting.
1738
- *
1739
- * @returns The current picked point, or null if no point is picked.
1740
- *
1741
- * @remarks
1742
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1743
- * If enabled, it performs raycasting to find the closest intersecting object.
1744
- * It then determines the closest vertex or point on the face, based on the configuration settings.
1745
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1746
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1747
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1748
- */
1749
- get(world: World): THREE.Vector3 | null;
1750
- private getClosestVertex;
1751
- private getVertices;
1752
- private getVertex;
1753
- }
1754
- import * as FRAGS from "@thatopen/fragments";
1755
- import { Components, Component } from "../../core";
1756
- /**
1757
- * 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).
1758
- */
1759
- export declare class Hider extends Component {
1760
- /**
1761
- * A unique identifier for the component.
1762
- * This UUID is used to register the component within the Components system.
1763
- */
1764
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1765
- /** {@link Component.enabled} */
1766
- enabled: boolean;
1767
- constructor(components: Components);
1768
- /**
1769
- * Sets the visibility of fragments within the 3D scene.
1770
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1771
- * If 'items' is provided, only the specified fragments will be affected.
1772
- *
1773
- * @param visible - The visibility state to set for the fragments.
1774
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1775
- * If not provided, all fragments will be affected.
1776
- *
1777
- * @returns {void}
1778
- */
1779
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1780
- /**
1781
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1782
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1783
- *
1784
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1785
- * If not provided, all fragments will be isolated.
1786
- *
1787
- * @returns {void}
1788
- */
1789
- isolate(items: FRAGS.FragmentIdMap): void;
1790
- private updateCulledVisibility;
1791
- }
1792
- import * as WEBIFC from "web-ifc";
1793
- import * as FRAGS from "@thatopen/fragments";
1794
- import { IfcFragmentSettings } from "./src";
1795
- import { Component, Components, Event, Disposable } from "../../core";
1796
- /**
1797
- * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1798
- */
1799
- export declare class IfcLoader extends Component implements Disposable {
1619
+ export declare class IfcLoader extends Component implements Disposable {
1800
1620
  /**
1801
1621
  * A unique identifier for the component.
1802
1622
  * This UUID is used to register the component within the Components system.
@@ -2177,50 +1997,223 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
2177
1997
  /**
2178
1998
  * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
2179
1999
  */
2180
- settings: PropertiesStreamingSettings;
2000
+ settings: PropertiesStreamingSettings;
2001
+ /**
2002
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
2003
+ */
2004
+ webIfc: WEBIFC.IfcAPI;
2005
+ /** {@link Disposable.dispose} */
2006
+ dispose(): Promise<void>;
2007
+ /**
2008
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
2009
+ *
2010
+ * @param data - The Uint8Array containing the IFC file data.
2011
+ * @returns A Promise that resolves when the streaming process is complete.
2012
+ */
2013
+ streamFromBuffer(data: Uint8Array): Promise<void>;
2014
+ /**
2015
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
2016
+ *
2017
+ * @param loadCallback - A callback function that loads the IFC file data.
2018
+ * @returns A Promise that resolves when the streaming process is complete.
2019
+ */
2020
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
2021
+ private readIfcFile;
2022
+ private streamIfcFile;
2023
+ private streamAllProperties;
2024
+ private cleanUp;
2025
+ }
2026
+ /**
2027
+ * 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.
2028
+ *
2029
+ * @remarks
2030
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2031
+ * It is useful for identifying and processing different types of IFC elements in a project.
2032
+ *
2033
+ */
2034
+ export declare const IfcElements: {
2035
+ [key: number]: string;
2036
+ };
2037
+ export declare class UUID {
2038
+ private static _pattern;
2039
+ private static _lut;
2040
+ static create(): string;
2041
+ static validate(uuid: string): void;
2042
+ }
2043
+ import * as THREE from "three";
2044
+ import * as FRAGS from "@thatopen/fragments";
2045
+ import { Disposable, Component, Event, Components } from "../../core";
2046
+ /**
2047
+ * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
2048
+ */
2049
+ export interface Classification {
2050
+ /**
2051
+ * A system within the classification.
2052
+ * The key is the system name, and the value is an object representing the classes within the system.
2053
+ */
2054
+ [system: string]: {
2055
+ /**
2056
+ * A class within the system.
2057
+ * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
2058
+ */
2059
+ [className: string]: {
2060
+ map: FRAGS.FragmentIdMap;
2061
+ name: string;
2062
+ id: number | null;
2063
+ };
2064
+ };
2065
+ }
2066
+ /**
2067
+ * The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
2068
+ */
2069
+ export declare class Classifier extends Component implements Disposable {
2070
+ /**
2071
+ * A unique identifier for the component.
2072
+ * This UUID is used to register the component within the Components system.
2073
+ */
2074
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
2075
+ /** {@link Component.enabled} */
2076
+ enabled: boolean;
2077
+ /**
2078
+ * A map representing the classification systems.
2079
+ * The key is the system name, and the value is an object representing the classes within the system.
2080
+ */
2081
+ list: Classification;
2082
+ /** {@link Disposable.onDisposed} */
2083
+ readonly onDisposed: Event<unknown>;
2084
+ constructor(components: Components);
2085
+ private onFragmentsDisposed;
2086
+ /** {@link Disposable.dispose} */
2087
+ dispose(): void;
2088
+ /**
2089
+ * Removes a fragment from the classification based on its unique identifier (guid).
2090
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
2091
+ *
2092
+ * @param guid - The unique identifier of the fragment to be removed.
2093
+ */
2094
+ remove(guid: string): void;
2095
+ /**
2096
+ * Finds and returns fragments based on the provided filter criteria.
2097
+ * If no filter is provided, it returns all fragments.
2098
+ *
2099
+ * @param filter - An optional object containing filter criteria.
2100
+ * The keys of the object represent the classification system names,
2101
+ * and the values are arrays of class names to match.
2102
+ *
2103
+ * @returns A map of fragment GUIDs to their respective express IDs,
2104
+ * where the express IDs are filtered based on the provided filter criteria.
2105
+ *
2106
+ * @throws Will throw an error if the fragments map is malformed.
2107
+ */
2108
+ find(filter?: {
2109
+ [name: string]: string[];
2110
+ }): FRAGS.FragmentIdMap;
2111
+ /**
2112
+ * Classifies fragments based on their modelID.
2113
+ *
2114
+ * @param modelID - The unique identifier of the model to classify fragments by.
2115
+ * @param group - The FragmentsGroup containing the fragments to be classified.
2116
+ *
2117
+ * @remarks
2118
+ * This method iterates through the fragments in the provided group,
2119
+ * and classifies them based on their modelID.
2120
+ * The classification is stored in the 'list.models' property,
2121
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
2122
+ *
2123
+ */
2124
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
2125
+ /**
2126
+ * Classifies fragments based on their PredefinedType property.
2127
+ *
2128
+ * @param group - The FragmentsGroup containing the fragments to be classified.
2129
+ *
2130
+ * @remarks
2131
+ * This method iterates through the properties of the fragments in the provided group,
2132
+ * and classifies them based on their PredefinedType property.
2133
+ * The classification is stored in the 'list.predefinedTypes' property,
2134
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
2135
+ *
2136
+ * @throws Will throw an error if the fragment ID is not found.
2137
+ */
2138
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
2139
+ /**
2140
+ * Classifies fragments based on their entity type.
2141
+ *
2142
+ * @param group - The FragmentsGroup containing the fragments to be classified.
2143
+ *
2144
+ * @remarks
2145
+ * This method iterates through the relations of the fragments in the provided group,
2146
+ * and classifies them based on their entity type.
2147
+ * The classification is stored in the 'list.entities' property,
2148
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
2149
+ *
2150
+ * @throws Will throw an error if the fragment ID is not found.
2151
+ */
2152
+ byEntity(group: FRAGS.FragmentsGroup): void;
2153
+ /**
2154
+ * Classifies fragments based on a specific IFC relationship.
2155
+ *
2156
+ * @param group - The FragmentsGroup containing the fragments to be classified.
2157
+ * @param ifcRel - The IFC relationship number to classify fragments by.
2158
+ * @param systemName - The name of the classification system to store the classification.
2159
+ *
2160
+ * @remarks
2161
+ * This method iterates through the relations of the fragments in the provided group,
2162
+ * and classifies them based on the specified IFC relationship.
2163
+ * The classification is stored in the 'list' property under the specified system name,
2164
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
2165
+ *
2166
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
2167
+ */
2168
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
2181
2169
  /**
2182
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
2170
+ * Classifies fragments based on their spatial structure in the IFC model.
2171
+ *
2172
+ * @param model - The FragmentsGroup containing the fragments to be classified.
2173
+ * @param config - The configuration for the classifier. It includes "useProperties", which is true by default
2174
+ * (if false, the classification will use the expressIDs instead of the names), and "isolate", which will make
2175
+ * the classifier just pick the WEBIFC categories provided.
2176
+ *
2177
+ * @remarks
2178
+ * This method iterates through the relations of the fragments in the provided group,
2179
+ * and classifies them based on their spatial structure in the IFC model.
2180
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
2181
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
2182
+ *
2183
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
2183
2184
  */
2184
- webIfc: WEBIFC.IfcAPI;
2185
- /** {@link Disposable.dispose} */
2186
- dispose(): Promise<void>;
2185
+ bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
2186
+ useProperties?: boolean;
2187
+ isolate?: Set<number>;
2188
+ }): Promise<void>;
2187
2189
  /**
2188
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
2190
+ * Sets the color of the specified fragments.
2189
2191
  *
2190
- * @param data - The Uint8Array containing the IFC file data.
2191
- * @returns A Promise that resolves when the streaming process is complete.
2192
+ * @param items - A map of fragment IDs to their respective express IDs.
2193
+ * @param color - The color to set for the fragments.
2194
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
2195
+ *
2196
+ * @remarks
2197
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
2198
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
2199
+ *
2200
+ * @throws Will throw an error if the fragment with the specified ID is not found.
2192
2201
  */
2193
- streamFromBuffer(data: Uint8Array): Promise<void>;
2202
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
2194
2203
  /**
2195
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
2204
+ * Resets the color of the specified fragments to their original color.
2196
2205
  *
2197
- * @param loadCallback - A callback function that loads the IFC file data.
2198
- * @returns A Promise that resolves when the streaming process is complete.
2206
+ * @param items - A map of fragment IDs to their respective express IDs.
2207
+ *
2208
+ * @remarks
2209
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
2210
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
2211
+ *
2212
+ * @throws Will throw an error if the fragment with the specified ID is not found.
2199
2213
  */
2200
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
2201
- private readIfcFile;
2202
- private streamIfcFile;
2203
- private streamAllProperties;
2204
- private cleanUp;
2205
- }
2206
- import * as WEBIFC from "web-ifc";
2207
- export interface IfcItemsCategories {
2208
- [itemID: number]: number;
2209
- }
2210
- export declare class IfcCategories {
2211
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2214
+ resetColor(items: FRAGS.FragmentIdMap): void;
2215
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
2212
2216
  }
2213
- /**
2214
- * 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.
2215
- *
2216
- * @remarks
2217
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2218
- * It is useful for identifying and processing different types of IFC elements in a project.
2219
- *
2220
- */
2221
- export declare const IfcElements: {
2222
- [key: number]: string;
2223
- };
2224
2217
  /**
2225
2218
  * A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
2226
2219
  */
@@ -2252,10 +2245,13 @@ export declare class IfcPropertiesUtils {
2252
2245
  static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2253
2246
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2254
2247
  }
2255
- /**
2256
- * A Set of unique numbers representing different types of IFC geometries.
2257
- */
2258
- export declare const GeometryTypes: Set<number>;
2248
+ import * as WEBIFC from "web-ifc";
2249
+ export interface IfcItemsCategories {
2250
+ [itemID: number]: number;
2251
+ }
2252
+ export declare class IfcCategories {
2253
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2254
+ }
2259
2255
  import * as THREE from "three";
2260
2256
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2261
2257
  /**
@@ -2462,8 +2458,175 @@ export declare class DistanceRenderer {
2462
2458
  * @param force if true, it will refresh the scene even if needsUpdate is
2463
2459
  * not true.
2464
2460
  */
2465
- compute: () => Promise<void>;
2461
+ compute: () => Promise<void>;
2462
+ private handleWorkerMessage;
2463
+ }
2464
+ import * as WEBIFC from "web-ifc";
2465
+ import { IfcItemsCategories } from "../../../ifc";
2466
+ export declare class SpatialStructure {
2467
+ itemsByFloor: IfcItemsCategories;
2468
+ private _units;
2469
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2470
+ cleanUp(): void;
2471
+ }
2472
+ /**
2473
+ * A Set of unique numbers representing different types of IFC geometries.
2474
+ */
2475
+ export declare const GeometryTypes: Set<number>;
2476
+ import * as THREE from "three";
2477
+ import { Components } from "../../Components";
2478
+ import { AsyncEvent, Event, World } from "../../Types";
2479
+ /**
2480
+ * Settings to configure the CullerRenderer.
2481
+ */
2482
+ export interface CullerRendererSettings {
2483
+ /**
2484
+ * Interval in milliseconds at which the visibility check should be performed.
2485
+ * Default value is 1000.
2486
+ */
2487
+ updateInterval?: number;
2488
+ /**
2489
+ * Width of the render target used for visibility checks.
2490
+ * Default value is 512.
2491
+ */
2492
+ width?: number;
2493
+ /**
2494
+ * Height of the render target used for visibility checks.
2495
+ * Default value is 512.
2496
+ */
2497
+ height?: number;
2498
+ /**
2499
+ * Whether the visibility check should be performed automatically.
2500
+ * Default value is true.
2501
+ */
2502
+ autoUpdate?: boolean;
2503
+ }
2504
+ /**
2505
+ * A base renderer to determine visibility on screen.
2506
+ */
2507
+ export declare class CullerRenderer {
2508
+ /** {@link Disposable.onDisposed} */
2509
+ readonly onDisposed: Event<string>;
2510
+ /**
2511
+ * Fires after making the visibility check to the meshes. It lists the
2512
+ * meshes that are currently visible, and the ones that were visible
2513
+ * just before but not anymore.
2514
+ */
2515
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2516
+ /**
2517
+ * Whether this renderer is active or not. If not, it won't render anything.
2518
+ */
2519
+ enabled: boolean;
2520
+ /**
2521
+ * Needs to check whether there are objects that need to be hidden or shown.
2522
+ * You can bind this to the camera movement, to a certain interval, etc.
2523
+ */
2524
+ needsUpdate: boolean;
2525
+ /**
2526
+ * Render the internal scene used to determine the object visibility. Used
2527
+ * for debugging purposes.
2528
+ */
2529
+ renderDebugFrame: boolean;
2530
+ /** The components instance to which this renderer belongs. */
2531
+ components: Components;
2532
+ /** The world instance to which this renderer belongs. */
2533
+ readonly world: World;
2534
+ /** The THREE.js renderer used to make the visibility test. */
2535
+ readonly renderer: THREE.WebGLRenderer;
2536
+ protected autoUpdate: boolean;
2537
+ protected updateInterval: number;
2538
+ protected readonly worker: Worker;
2539
+ protected readonly scene: THREE.Scene;
2540
+ private _width;
2541
+ private _height;
2542
+ private _availableColor;
2543
+ private readonly renderTarget;
2544
+ private readonly bufferSize;
2545
+ private readonly _buffer;
2546
+ protected _isWorkerBusy: boolean;
2547
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2548
+ /** {@link Disposable.dispose} */
2549
+ dispose(): void;
2550
+ /**
2551
+ * The function that the culler uses to reprocess the scene. Generally it's
2552
+ * better to call needsUpdate, but you can also call this to force it.
2553
+ * @param force if true, it will refresh the scene even if needsUpdate is
2554
+ * not true.
2555
+ */
2556
+ updateVisibility: (force?: boolean) => Promise<void>;
2557
+ protected getAvailableColor(): {
2558
+ r: number;
2559
+ g: number;
2560
+ b: number;
2561
+ code: string;
2562
+ };
2563
+ protected increaseColor(): void;
2564
+ protected decreaseColor(): void;
2565
+ private applySettings;
2566
+ }
2567
+ import * as THREE from "three";
2568
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2569
+ import { Components } from "../../Components";
2570
+ import { Event, World, Disposable } from "../../Types";
2571
+ /**
2572
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2573
+ */
2574
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2575
+ /**
2576
+ * Event triggered when the visibility of meshes is updated.
2577
+ * Contains two sets: seen and unseen.
2578
+ */
2579
+ readonly onViewUpdated: Event<{
2580
+ seen: Set<THREE.Mesh>;
2581
+ unseen: Set<THREE.Mesh>;
2582
+ }>;
2583
+ /**
2584
+ * Pixels in screen a geometry must occupy to be considered "seen".
2585
+ * Default value is 100.
2586
+ */
2587
+ threshold: number;
2588
+ /**
2589
+ * Map of color code to THREE.InstancedMesh.
2590
+ * Used to keep track of color-coded meshes.
2591
+ */
2592
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2593
+ /**
2594
+ * Flag to indicate if the renderer is currently processing.
2595
+ * Used to prevent concurrent processing.
2596
+ */
2597
+ isProcessing: boolean;
2598
+ private _colorCodeMeshMap;
2599
+ private _meshIDColorCodeMap;
2600
+ private _currentVisibleMeshes;
2601
+ private _recentlyHiddenMeshes;
2602
+ private _intervalID;
2603
+ private readonly _transparentMat;
2604
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2605
+ /** {@link Disposable.dispose} */
2606
+ dispose(): void;
2607
+ /**
2608
+ * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
2609
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2610
+ * @returns {void}
2611
+ */
2612
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2613
+ /**
2614
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2615
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2616
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2617
+ * @returns {void}
2618
+ */
2619
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2620
+ /**
2621
+ * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
2622
+ *
2623
+ * @param meshes - The meshes to update.
2624
+ *
2625
+ * @returns {void}
2626
+ */
2627
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
2466
2628
  private handleWorkerMessage;
2629
+ private getAvailableMaterial;
2467
2630
  }
2468
2631
  /**
2469
2632
  * 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.
@@ -2493,13 +2656,19 @@ export declare class Event<T> {
2493
2656
  reset(): void;
2494
2657
  private handlers;
2495
2658
  }
2496
- import * as WEBIFC from "web-ifc";
2497
- import { IfcItemsCategories } from "../../../ifc";
2498
- export declare class SpatialStructure {
2499
- itemsByFloor: IfcItemsCategories;
2500
- private _units;
2501
- setUp(webIfc: WEBIFC.IfcAPI): void;
2502
- cleanUp(): void;
2659
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2660
+ import { Base } from "./base";
2661
+ /**
2662
+ * 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.
2663
+ */
2664
+ export declare abstract class Component extends Base {
2665
+ /**
2666
+ * Whether this component is active or not. The behaviour can vary depending
2667
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2668
+ * dimensions, while a disabled camera will stop moving. A disabled component
2669
+ * will not be updated automatically each frame.
2670
+ */
2671
+ abstract enabled: boolean;
2503
2672
  }
2504
2673
  /**
2505
2674
  * 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.
@@ -2637,19 +2806,6 @@ export interface CameraControllable {
2637
2806
  */
2638
2807
  controls: CameraControls;
2639
2808
  }
2640
- import { Base } from "./base";
2641
- /**
2642
- * 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.
2643
- */
2644
- export declare abstract class Component extends Base {
2645
- /**
2646
- * Whether this component is active or not. The behaviour can vary depending
2647
- * on the type of component. E.g. a disabled dimension tool will stop creating
2648
- * dimensions, while a disabled camera will stop moving. A disabled component
2649
- * will not be updated automatically each frame.
2650
- */
2651
- abstract enabled: boolean;
2652
- }
2653
2809
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2654
2810
  import { Components } from "../../Components";
2655
2811
  /**
@@ -2669,29 +2825,6 @@ export declare abstract class Base {
2669
2825
  /** Whether is component is {@link Configurable}. */
2670
2826
  isConfigurable: () => this is Configurable<any>;
2671
2827
  }
2672
- import { Base } from "./base";
2673
- import { World } from "./world";
2674
- import { Event } from "./event";
2675
- import { Components } from "../../Components";
2676
- /**
2677
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2678
- */
2679
- export declare abstract class BaseWorldItem extends Base {
2680
- readonly worlds: Map<string, World>;
2681
- /**
2682
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2683
- * The event payload contains the world instance and the action ("added" or "removed").
2684
- */
2685
- readonly onWorldChanged: Event<{
2686
- world: World;
2687
- action: "added" | "removed";
2688
- }>;
2689
- /**
2690
- * The current world this item is associated with. It can be null if no world is currently active.
2691
- */
2692
- currentWorld: World | null;
2693
- protected constructor(components: Components);
2694
- }
2695
2828
  import * as THREE from "three";
2696
2829
  import CameraControls from "camera-controls";
2697
2830
  import { BaseWorldItem } from "./base-world-item";
@@ -2786,30 +2919,6 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2786
2919
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2787
2920
  }
2788
2921
  import * as THREE from "three";
2789
- import { Disposable } from "./interfaces";
2790
- import { Event } from "./event";
2791
- import { Components } from "../../Components";
2792
- import { BaseWorldItem } from "./base-world-item";
2793
- /**
2794
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2795
- */
2796
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2797
- /** {@link Disposable.onDisposed} */
2798
- readonly onDisposed: Event<unknown>;
2799
- /**
2800
- * Abstract property representing the three.js object associated with this scene.
2801
- * It should be implemented by subclasses.
2802
- */
2803
- abstract three: THREE.Object3D;
2804
- /** The set of directional lights managed by this scene component. */
2805
- directionalLights: Map<string, THREE.DirectionalLight>;
2806
- /** The set of ambient lights managed by this scene component. */
2807
- ambientLights: Map<string, THREE.AmbientLight>;
2808
- protected constructor(components: Components);
2809
- /** {@link Disposable.dispose} */
2810
- dispose(): void;
2811
- }
2812
- import * as THREE from "three";
2813
2922
  import { BaseScene } from "./base-scene";
2814
2923
  import { BaseCamera } from "./base-camera";
2815
2924
  import { BaseRenderer } from "./base-renderer";
@@ -2843,6 +2952,53 @@ export interface World extends Disposable, Updateable {
2843
2952
  */
2844
2953
  isDisposing: boolean;
2845
2954
  }
2955
+ import * as THREE from "three";
2956
+ import { Disposable } from "./interfaces";
2957
+ import { Event } from "./event";
2958
+ import { Components } from "../../Components";
2959
+ import { BaseWorldItem } from "./base-world-item";
2960
+ /**
2961
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2962
+ */
2963
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2964
+ /** {@link Disposable.onDisposed} */
2965
+ readonly onDisposed: Event<unknown>;
2966
+ /**
2967
+ * Abstract property representing the three.js object associated with this scene.
2968
+ * It should be implemented by subclasses.
2969
+ */
2970
+ abstract three: THREE.Object3D;
2971
+ /** The set of directional lights managed by this scene component. */
2972
+ directionalLights: Map<string, THREE.DirectionalLight>;
2973
+ /** The set of ambient lights managed by this scene component. */
2974
+ ambientLights: Map<string, THREE.AmbientLight>;
2975
+ protected constructor(components: Components);
2976
+ /** {@link Disposable.dispose} */
2977
+ dispose(): void;
2978
+ }
2979
+ import { Base } from "./base";
2980
+ import { World } from "./world";
2981
+ import { Event } from "./event";
2982
+ import { Components } from "../../Components";
2983
+ /**
2984
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2985
+ */
2986
+ export declare abstract class BaseWorldItem extends Base {
2987
+ readonly worlds: Map<string, World>;
2988
+ /**
2989
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2990
+ * The event payload contains the world instance and the action ("added" or "removed").
2991
+ */
2992
+ readonly onWorldChanged: Event<{
2993
+ world: World;
2994
+ action: "added" | "removed";
2995
+ }>;
2996
+ /**
2997
+ * The current world this item is associated with. It can be null if no world is currently active.
2998
+ */
2999
+ currentWorld: World | null;
3000
+ protected constructor(components: Components);
3001
+ }
2846
3002
  import { Event } from "./event";
2847
3003
  /**
2848
3004
  * A class that extends the built-in Set class and provides additional functionality.
@@ -2892,66 +3048,6 @@ export declare class DataSet<T> extends Set<T> {
2892
3048
  */
2893
3049
  dispose(): void;
2894
3050
  }
2895
- import { Event } from "./event";
2896
- /**
2897
- * A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
2898
- *
2899
- * @template K - The type of keys in the map.
2900
- * @template V - The type of values in the map.
2901
- */
2902
- export declare class DataMap<K, V> extends Map<K, V> {
2903
- /**
2904
- * An event triggered when a new item is set in the map.
2905
- */
2906
- readonly onItemSet: Event<{
2907
- key: K;
2908
- value: V;
2909
- }>;
2910
- /**
2911
- * An event triggered when an existing item in the map is updated.
2912
- */
2913
- readonly onItemUpdated: Event<{
2914
- key: K;
2915
- value: V;
2916
- }>;
2917
- /**
2918
- * An event triggered when an item is deleted from the map.
2919
- */
2920
- readonly onItemDeleted: Event<unknown>;
2921
- /**
2922
- * An event triggered when the map is cleared.
2923
- */
2924
- readonly onCleared: Event<unknown>;
2925
- /**
2926
- * Constructs a new DataMap instance.
2927
- *
2928
- * @param iterable - An iterable object containing key-value pairs to populate the map.
2929
- */
2930
- constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
2931
- /**
2932
- * Clears the map and triggers the onCleared event.
2933
- */
2934
- clear(): void;
2935
- /**
2936
- * Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
2937
- *
2938
- * @param key - The key of the item to set.
2939
- * @param value - The value of the item to set.
2940
- * @returns The DataMap instance.
2941
- */
2942
- set(key: K, value: V): this;
2943
- /**
2944
- * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
2945
- *
2946
- * @param key - The key of the item to delete.
2947
- * @returns True if the key was found and deleted; otherwise, false.
2948
- */
2949
- delete(key: K): boolean;
2950
- /**
2951
- * Clears the map and resets the events.
2952
- */
2953
- dispose(): void;
2954
- }
2955
3051
  import * as THREE from "three";
2956
3052
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2957
3053
  /**
@@ -3058,17 +3154,77 @@ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
3058
3154
  * The underlying Three.js scene object.
3059
3155
  * It is used to define the 3D space containing objects, lights, and cameras.
3060
3156
  */
3061
- three: THREE.Scene;
3062
- /** {@link Configurable.onSetup} */
3063
- readonly onSetup: Event<SimpleScene>;
3157
+ three: THREE.Scene;
3158
+ /** {@link Configurable.onSetup} */
3159
+ readonly onSetup: Event<SimpleScene>;
3160
+ /**
3161
+ * Configuration interface for the {@link SimpleScene}.
3162
+ * Defines properties for directional and ambient lights.
3163
+ */
3164
+ config: Required<SimpleSceneConfig>;
3165
+ constructor(components: Components);
3166
+ /** {@link Configurable.setup} */
3167
+ setup(config?: Partial<SimpleSceneConfig>): void;
3168
+ }
3169
+ import { Event } from "./event";
3170
+ /**
3171
+ * A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
3172
+ *
3173
+ * @template K - The type of keys in the map.
3174
+ * @template V - The type of values in the map.
3175
+ */
3176
+ export declare class DataMap<K, V> extends Map<K, V> {
3177
+ /**
3178
+ * An event triggered when a new item is set in the map.
3179
+ */
3180
+ readonly onItemSet: Event<{
3181
+ key: K;
3182
+ value: V;
3183
+ }>;
3184
+ /**
3185
+ * An event triggered when an existing item in the map is updated.
3186
+ */
3187
+ readonly onItemUpdated: Event<{
3188
+ key: K;
3189
+ value: V;
3190
+ }>;
3191
+ /**
3192
+ * An event triggered when an item is deleted from the map.
3193
+ */
3194
+ readonly onItemDeleted: Event<unknown>;
3195
+ /**
3196
+ * An event triggered when the map is cleared.
3197
+ */
3198
+ readonly onCleared: Event<unknown>;
3199
+ /**
3200
+ * Constructs a new DataMap instance.
3201
+ *
3202
+ * @param iterable - An iterable object containing key-value pairs to populate the map.
3203
+ */
3204
+ constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
3205
+ /**
3206
+ * Clears the map and triggers the onCleared event.
3207
+ */
3208
+ clear(): void;
3209
+ /**
3210
+ * Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
3211
+ *
3212
+ * @param key - The key of the item to set.
3213
+ * @param value - The value of the item to set.
3214
+ * @returns The DataMap instance.
3215
+ */
3216
+ set(key: K, value: V): this;
3217
+ /**
3218
+ * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
3219
+ *
3220
+ * @param key - The key of the item to delete.
3221
+ * @returns True if the key was found and deleted; otherwise, false.
3222
+ */
3223
+ delete(key: K): boolean;
3064
3224
  /**
3065
- * Configuration interface for the {@link SimpleScene}.
3066
- * Defines properties for directional and ambient lights.
3225
+ * Clears the map and resets the events.
3067
3226
  */
3068
- config: Required<SimpleSceneConfig>;
3069
- constructor(components: Components);
3070
- /** {@link Configurable.setup} */
3071
- setup(config?: Partial<SimpleSceneConfig>): void;
3227
+ dispose(): void;
3072
3228
  }
3073
3229
  import * as THREE from "three";
3074
3230
  import { BaseRenderer, Event } from "../../Types";
@@ -3165,257 +3321,26 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
3165
3321
  */
3166
3322
  get enabled(): boolean;
3167
3323
  /**
3168
- * Setter for the enabled state of the camera controls.
3169
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3170
- *
3171
- * @param {boolean} enabled - The new enabled state of the camera controls.
3172
- */
3173
- set enabled(enabled: boolean);
3174
- constructor(components: Components);
3175
- /** {@link Disposable.dispose} */
3176
- dispose(): void;
3177
- /** {@link Updateable.update} */
3178
- update(_delta: number): void;
3179
- /**
3180
- * Updates the aspect of the camera to match the size of the
3181
- * {@link Components.renderer}.
3182
- */
3183
- updateAspect: () => void;
3184
- private setupCamera;
3185
- private newCameraControls;
3186
- private setupEvents;
3187
- private static getSubsetOfThree;
3188
- }
3189
- import * as THREE from "three";
3190
- import { Disposable, Event } from "../../Types";
3191
- /**
3192
- * 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.
3193
- */
3194
- export declare class Mouse implements Disposable {
3195
- dom: HTMLCanvasElement;
3196
- private _event?;
3197
- private _position;
3198
- /** {@link Disposable.onDisposed} */
3199
- readonly onDisposed: Event<unknown>;
3200
- constructor(dom: HTMLCanvasElement);
3201
- /**
3202
- * The real position of the mouse of the Three.js canvas.
3203
- */
3204
- get position(): THREE.Vector2;
3205
- /** {@link Disposable.dispose} */
3206
- dispose(): void;
3207
- private getPositionY;
3208
- private getPositionX;
3209
- private updateMouseInfo;
3210
- private setupEvents;
3211
- }
3212
- import * as THREE from "three";
3213
- import { Components } from "../../Components";
3214
- import { Event, World, Disposable } from "../../Types";
3215
- import { Mouse } from "./mouse";
3216
- /**
3217
- * 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.
3218
- */
3219
- export declare class SimpleRaycaster implements Disposable {
3220
- /** {@link Component.enabled} */
3221
- enabled: boolean;
3222
- /** The components instance to which this Raycaster belongs. */
3223
- components: Components;
3224
- /** {@link Disposable.onDisposed} */
3225
- readonly onDisposed: Event<unknown>;
3226
- /** The position of the mouse in the screen. */
3227
- readonly mouse: Mouse;
3228
- /**
3229
- * A reference to the Three.js Raycaster instance.
3230
- * This is used for raycasting operations.
3231
- */
3232
- readonly three: THREE.Raycaster;
3233
- /**
3234
- * A reference to the world instance to which this Raycaster belongs.
3235
- * This is used to access the camera and meshes.
3236
- */
3237
- world: World;
3238
- constructor(components: Components, world: World);
3239
- /** {@link Disposable.dispose} */
3240
- dispose(): void;
3241
- /**
3242
- * Throws a ray from the camera to the mouse or touch event point and returns
3243
- * the first item found. This also takes into account the clipping planes
3244
- * used by the renderer.
3245
- *
3246
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3247
- * to query. If not provided, it will query all the meshes stored in
3248
- * {@link Components.meshes}.
3249
- */
3250
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3251
- /**
3252
- * Casts a ray from a given origin in a given direction and returns the first item found.
3253
- * This method also takes into account the clipping planes used by the renderer.
3254
- *
3255
- * @param origin - The origin of the ray.
3256
- * @param direction - The direction of the ray.
3257
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3258
- * @returns The first intersection found or 'null' if no intersection was found.
3259
- */
3260
- 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;
3261
- private intersect;
3262
- private filterClippingPlanes;
3263
- }
3264
- import * as THREE from "three";
3265
- import { Components } from "../../Components";
3266
- import { AsyncEvent, Event, World } from "../../Types";
3267
- /**
3268
- * Settings to configure the CullerRenderer.
3269
- */
3270
- export interface CullerRendererSettings {
3271
- /**
3272
- * Interval in milliseconds at which the visibility check should be performed.
3273
- * Default value is 1000.
3274
- */
3275
- updateInterval?: number;
3276
- /**
3277
- * Width of the render target used for visibility checks.
3278
- * Default value is 512.
3279
- */
3280
- width?: number;
3281
- /**
3282
- * Height of the render target used for visibility checks.
3283
- * Default value is 512.
3284
- */
3285
- height?: number;
3286
- /**
3287
- * Whether the visibility check should be performed automatically.
3288
- * Default value is true.
3289
- */
3290
- autoUpdate?: boolean;
3291
- }
3292
- /**
3293
- * A base renderer to determine visibility on screen.
3294
- */
3295
- export declare class CullerRenderer {
3296
- /** {@link Disposable.onDisposed} */
3297
- readonly onDisposed: Event<string>;
3298
- /**
3299
- * Fires after making the visibility check to the meshes. It lists the
3300
- * meshes that are currently visible, and the ones that were visible
3301
- * just before but not anymore.
3302
- */
3303
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3304
- /**
3305
- * Whether this renderer is active or not. If not, it won't render anything.
3306
- */
3307
- enabled: boolean;
3308
- /**
3309
- * Needs to check whether there are objects that need to be hidden or shown.
3310
- * You can bind this to the camera movement, to a certain interval, etc.
3311
- */
3312
- needsUpdate: boolean;
3313
- /**
3314
- * Render the internal scene used to determine the object visibility. Used
3315
- * for debugging purposes.
3316
- */
3317
- renderDebugFrame: boolean;
3318
- /** The components instance to which this renderer belongs. */
3319
- components: Components;
3320
- /** The world instance to which this renderer belongs. */
3321
- readonly world: World;
3322
- /** The THREE.js renderer used to make the visibility test. */
3323
- readonly renderer: THREE.WebGLRenderer;
3324
- protected autoUpdate: boolean;
3325
- protected updateInterval: number;
3326
- protected readonly worker: Worker;
3327
- protected readonly scene: THREE.Scene;
3328
- private _width;
3329
- private _height;
3330
- private _availableColor;
3331
- private readonly renderTarget;
3332
- private readonly bufferSize;
3333
- private readonly _buffer;
3334
- protected _isWorkerBusy: boolean;
3335
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3336
- /** {@link Disposable.dispose} */
3337
- dispose(): void;
3338
- /**
3339
- * The function that the culler uses to reprocess the scene. Generally it's
3340
- * better to call needsUpdate, but you can also call this to force it.
3341
- * @param force if true, it will refresh the scene even if needsUpdate is
3342
- * not true.
3343
- */
3344
- updateVisibility: (force?: boolean) => Promise<void>;
3345
- protected getAvailableColor(): {
3346
- r: number;
3347
- g: number;
3348
- b: number;
3349
- code: string;
3350
- };
3351
- protected increaseColor(): void;
3352
- protected decreaseColor(): void;
3353
- private applySettings;
3354
- }
3355
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3356
- import * as THREE from "three";
3357
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
3358
- import { Components } from "../../Components";
3359
- import { Event, World, Disposable } from "../../Types";
3360
- /**
3361
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3362
- */
3363
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3364
- /**
3365
- * Event triggered when the visibility of meshes is updated.
3366
- * Contains two sets: seen and unseen.
3367
- */
3368
- readonly onViewUpdated: Event<{
3369
- seen: Set<THREE.Mesh>;
3370
- unseen: Set<THREE.Mesh>;
3371
- }>;
3372
- /**
3373
- * Pixels in screen a geometry must occupy to be considered "seen".
3374
- * Default value is 100.
3375
- */
3376
- threshold: number;
3377
- /**
3378
- * Map of color code to THREE.InstancedMesh.
3379
- * Used to keep track of color-coded meshes.
3380
- */
3381
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3382
- /**
3383
- * Flag to indicate if the renderer is currently processing.
3384
- * Used to prevent concurrent processing.
3385
- */
3386
- isProcessing: boolean;
3387
- private _colorCodeMeshMap;
3388
- private _meshIDColorCodeMap;
3389
- private _currentVisibleMeshes;
3390
- private _recentlyHiddenMeshes;
3391
- private _intervalID;
3392
- private readonly _transparentMat;
3393
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
3394
- /** {@link Disposable.dispose} */
3395
- dispose(): void;
3396
- /**
3397
- * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
3398
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3399
- * @returns {void}
3400
- */
3401
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3402
- /**
3403
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3404
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3405
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3406
- * @returns {void}
3407
- */
3408
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3409
- /**
3410
- * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
3411
- *
3412
- * @param meshes - The meshes to update.
3324
+ * Setter for the enabled state of the camera controls.
3325
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3413
3326
  *
3414
- * @returns {void}
3327
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3415
3328
  */
3416
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
3417
- private handleWorkerMessage;
3418
- private getAvailableMaterial;
3329
+ set enabled(enabled: boolean);
3330
+ constructor(components: Components);
3331
+ /** {@link Disposable.dispose} */
3332
+ dispose(): void;
3333
+ /** {@link Updateable.update} */
3334
+ update(_delta: number): void;
3335
+ /**
3336
+ * Updates the aspect of the camera to match the size of the
3337
+ * {@link Components.renderer}.
3338
+ */
3339
+ updateAspect: () => void;
3340
+ private setupCamera;
3341
+ private newCameraControls;
3342
+ private setupEvents;
3343
+ private static getSubsetOfThree;
3419
3344
  }
3420
3345
  import { NavigationMode } from "./types";
3421
3346
  import { OrthoPerspectiveCamera } from "../index";
@@ -3433,51 +3358,6 @@ export declare class FirstPersonMode implements NavigationMode {
3433
3358
  set(active: boolean): void;
3434
3359
  private setupFirstPersonCamera;
3435
3360
  }
3436
- import * as THREE from "three";
3437
- import { CameraProjection } from "./types";
3438
- import { Event } from "../../Types";
3439
- import { OrthoPerspectiveCamera } from "../index";
3440
- /**
3441
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3442
- */
3443
- export declare class ProjectionManager {
3444
- /**
3445
- * Event that fires when the {@link CameraProjection} changes.
3446
- */
3447
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3448
- /**
3449
- * Current projection mode of the camera.
3450
- * Default is "Perspective".
3451
- */
3452
- current: CameraProjection;
3453
- /**
3454
- * The camera controlled by this ProjectionManager.
3455
- * It can be either a PerspectiveCamera or an OrthographicCamera.
3456
- */
3457
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3458
- /** Match Ortho zoom with Perspective distance when changing projection mode */
3459
- matchOrthoDistanceEnabled: boolean;
3460
- private _component;
3461
- private _previousDistance;
3462
- constructor(camera: OrthoPerspectiveCamera);
3463
- /**
3464
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3465
- *
3466
- * @param projection - the new projection to set. If it is the current projection,
3467
- * it will have no effect.
3468
- */
3469
- set(projection: CameraProjection): Promise<void>;
3470
- /**
3471
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
3472
- * and vice versa.
3473
- */
3474
- toggle(): Promise<void>;
3475
- private setOrthoCamera;
3476
- private getPerspectiveDims;
3477
- private setupOrthoCamera;
3478
- private getDistance;
3479
- private setPerspectiveCamera;
3480
- }
3481
3361
  import { NavigationMode } from "./types";
3482
3362
  import { OrthoPerspectiveCamera } from "../index";
3483
3363
  /**
@@ -3494,6 +3374,29 @@ export declare class OrbitMode implements NavigationMode {
3494
3374
  set(active: boolean): void;
3495
3375
  private activateOrbitControls;
3496
3376
  }
3377
+ import * as THREE from "three";
3378
+ import { Disposable, Event } from "../../Types";
3379
+ /**
3380
+ * 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.
3381
+ */
3382
+ export declare class Mouse implements Disposable {
3383
+ dom: HTMLCanvasElement;
3384
+ private _event?;
3385
+ private _position;
3386
+ /** {@link Disposable.onDisposed} */
3387
+ readonly onDisposed: Event<unknown>;
3388
+ constructor(dom: HTMLCanvasElement);
3389
+ /**
3390
+ * The real position of the mouse of the Three.js canvas.
3391
+ */
3392
+ get position(): THREE.Vector2;
3393
+ /** {@link Disposable.dispose} */
3394
+ dispose(): void;
3395
+ private getPositionY;
3396
+ private getPositionX;
3397
+ private updateMouseInfo;
3398
+ private setupEvents;
3399
+ }
3497
3400
  import { NavigationMode } from "./types";
3498
3401
  import { OrthoPerspectiveCamera } from "../index";
3499
3402
  /**
@@ -3600,6 +3503,103 @@ export declare class SimpleGrid implements Hideable, Disposable {
3600
3503
  private updateZoom;
3601
3504
  }
3602
3505
  import * as THREE from "three";
3506
+ import { Components } from "../../Components";
3507
+ import { Event, World, Disposable } from "../../Types";
3508
+ import { Mouse } from "./mouse";
3509
+ /**
3510
+ * 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.
3511
+ */
3512
+ export declare class SimpleRaycaster implements Disposable {
3513
+ /** {@link Component.enabled} */
3514
+ enabled: boolean;
3515
+ /** The components instance to which this Raycaster belongs. */
3516
+ components: Components;
3517
+ /** {@link Disposable.onDisposed} */
3518
+ readonly onDisposed: Event<unknown>;
3519
+ /** The position of the mouse in the screen. */
3520
+ readonly mouse: Mouse;
3521
+ /**
3522
+ * A reference to the Three.js Raycaster instance.
3523
+ * This is used for raycasting operations.
3524
+ */
3525
+ readonly three: THREE.Raycaster;
3526
+ /**
3527
+ * A reference to the world instance to which this Raycaster belongs.
3528
+ * This is used to access the camera and meshes.
3529
+ */
3530
+ world: World;
3531
+ constructor(components: Components, world: World);
3532
+ /** {@link Disposable.dispose} */
3533
+ dispose(): void;
3534
+ /**
3535
+ * Throws a ray from the camera to the mouse or touch event point and returns
3536
+ * the first item found. This also takes into account the clipping planes
3537
+ * used by the renderer.
3538
+ *
3539
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3540
+ * to query. If not provided, it will query all the meshes stored in
3541
+ * {@link Components.meshes}.
3542
+ */
3543
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3544
+ /**
3545
+ * Casts a ray from a given origin in a given direction and returns the first item found.
3546
+ * This method also takes into account the clipping planes used by the renderer.
3547
+ *
3548
+ * @param origin - The origin of the ray.
3549
+ * @param direction - The direction of the ray.
3550
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3551
+ * @returns The first intersection found or 'null' if no intersection was found.
3552
+ */
3553
+ 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;
3554
+ private intersect;
3555
+ private filterClippingPlanes;
3556
+ }
3557
+ import * as THREE from "three";
3558
+ import { CameraProjection } from "./types";
3559
+ import { Event } from "../../Types";
3560
+ import { OrthoPerspectiveCamera } from "../index";
3561
+ /**
3562
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3563
+ */
3564
+ export declare class ProjectionManager {
3565
+ /**
3566
+ * Event that fires when the {@link CameraProjection} changes.
3567
+ */
3568
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3569
+ /**
3570
+ * Current projection mode of the camera.
3571
+ * Default is "Perspective".
3572
+ */
3573
+ current: CameraProjection;
3574
+ /**
3575
+ * The camera controlled by this ProjectionManager.
3576
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
3577
+ */
3578
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3579
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
3580
+ matchOrthoDistanceEnabled: boolean;
3581
+ private _component;
3582
+ private _previousDistance;
3583
+ constructor(camera: OrthoPerspectiveCamera);
3584
+ /**
3585
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3586
+ *
3587
+ * @param projection - the new projection to set. If it is the current projection,
3588
+ * it will have no effect.
3589
+ */
3590
+ set(projection: CameraProjection): Promise<void>;
3591
+ /**
3592
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3593
+ * and vice versa.
3594
+ */
3595
+ toggle(): Promise<void>;
3596
+ private setOrthoCamera;
3597
+ private getPerspectiveDims;
3598
+ private setupOrthoCamera;
3599
+ private getDistance;
3600
+ private setPerspectiveCamera;
3601
+ }
3602
+ import * as THREE from "three";
3603
3603
  import { Hideable, Disposable, Event, World } from "../../Types";
3604
3604
  import { Components } from "../../Components";
3605
3605
  /**
@@ -3698,16 +3698,36 @@ export declare class SimplePlane implements Disposable, Hideable {
3698
3698
  private newHelper;
3699
3699
  private static newPlaneMesh;
3700
3700
  }
3701
+ import * as WEBIFC from "web-ifc";
3702
+ import * as THREE from "three";
3703
+ export declare class Units {
3704
+ factor: number;
3705
+ complement: number;
3706
+ apply(matrix: THREE.Matrix4): void;
3707
+ setUp(webIfc: WEBIFC.IfcAPI): void;
3708
+ private getLengthUnits;
3709
+ private getScaleMatrix;
3710
+ }
3711
+ import * as WEBIFC from "web-ifc";
3712
+ export declare class IfcMetadataReader {
3713
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3714
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3715
+ }
3701
3716
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3702
3717
  /**
3703
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3718
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3704
3719
  */
3705
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3720
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3706
3721
  /**
3707
- * Amount of properties to be streamed.
3708
- * Defaults to 100 properties.
3722
+ * Minimum number of geometries to be streamed.
3723
+ * Defaults to 10 geometries.
3709
3724
  */
3710
- propertiesSize: number;
3725
+ minGeometrySize: number;
3726
+ /**
3727
+ * Minimum amount of assets to be streamed.
3728
+ * Defaults to 1000 assets.
3729
+ */
3730
+ minAssetsSize: number;
3711
3731
  }
3712
3732
  import * as THREE from "three";
3713
3733
  import * as WEBIFC from "web-ifc";
@@ -3724,26 +3744,16 @@ export declare class CivilReader {
3724
3744
  } | undefined;
3725
3745
  private getCurves;
3726
3746
  }
3727
- import * as WEBIFC from "web-ifc";
3728
- export declare class IfcMetadataReader {
3729
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3730
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3731
- }
3732
3747
  import { IfcFragmentSettings } from "../../IfcLoader/src";
3733
3748
  /**
3734
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3749
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3735
3750
  */
3736
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
3737
- /**
3738
- * Minimum number of geometries to be streamed.
3739
- * Defaults to 10 geometries.
3740
- */
3741
- minGeometrySize: number;
3751
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3742
3752
  /**
3743
- * Minimum amount of assets to be streamed.
3744
- * Defaults to 1000 assets.
3753
+ * Amount of properties to be streamed.
3754
+ * Defaults to 100 properties.
3745
3755
  */
3746
- minAssetsSize: number;
3756
+ propertiesSize: number;
3747
3757
  }
3748
3758
  /**
3749
3759
  * 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.
@@ -3774,15 +3784,10 @@ export interface StreamedAsset {
3774
3784
  color: number[];
3775
3785
  }[];
3776
3786
  }
3777
- import * as WEBIFC from "web-ifc";
3787
+ import { BufferGeometry } from "three";
3778
3788
  import * as THREE from "three";
3779
- export declare class Units {
3780
- factor: number;
3781
- complement: number;
3782
- apply(matrix: THREE.Matrix4): void;
3783
- setUp(webIfc: WEBIFC.IfcAPI): void;
3784
- private getLengthUnits;
3785
- private getScaleMatrix;
3789
+ export declare class TransformHelper {
3790
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3786
3791
  }
3787
3792
  import * as WEBIFC from "web-ifc";
3788
3793
  export type RelationsMap = Map<number, Map<number, number[]>>;
@@ -3839,10 +3844,5 @@ export type IfcRelations = [
3839
3844
  typeof WEBIFC.IFCRELNESTS
3840
3845
  ];
3841
3846
  export type IfcRelation = IfcRelations[number];
3842
- import { BufferGeometry } from "three";
3843
- import * as THREE from "three";
3844
- export declare class TransformHelper {
3845
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3846
- }
3847
3847
 
3848
3848
  }