@thatopen/components 2.0.21 → 2.0.22

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,124 +1,45 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, Event } from "../Types";
3
- /**
4
- * 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.
5
- */
6
- export declare class Components implements Disposable {
7
- /**
8
- * The version of the @thatopen/components library.
9
- */
10
- static readonly release = "2.0.21";
11
- /** {@link Disposable.onDisposed} */
12
- readonly onDisposed: Event<void>;
13
- /**
14
- * The list of components created in this app.
15
- * The keys are UUIDs and the values are instances of the components.
16
- */
17
- readonly list: Map<string, Component>;
18
- /**
19
- * If disabled, the animation loop will be stopped.
20
- * Default value is false.
21
- */
22
- enabled: boolean;
23
- private _clock;
24
- /**
25
- * Adds a component to the list of components.
26
- * Throws an error if a component with the same UUID already exists.
27
- *
28
- * @param uuid - The unique identifier of the component.
29
- * @param instance - The instance of the component to be added.
30
- *
31
- * @throws Will throw an error if a component with the same UUID already exists.
32
- *
33
- * @internal
34
- */
35
- add(uuid: string, instance: Component): void;
36
- /**
37
- * Retrieves a component instance by its constructor function.
38
- * If the component does not exist in the list, it will be created and added.
39
- *
40
- * @template U - The type of the component to retrieve.
41
- * @param Component - The constructor function of the component to retrieve.
42
- *
43
- * @returns The instance of the requested component.
44
- *
45
- * @throws Will throw an error if a component with the same UUID already exists.
46
- *
47
- * @internal
48
- */
49
- get<U extends Component>(Component: new (components: Components) => U): U;
50
- constructor();
51
- /**
52
- * Initializes the Components instance.
53
- * This method starts the animation loop, sets the enabled flag to true,
54
- * and calls the update method.
55
- *
56
- * @returns {void}
57
- */
58
- init(): void;
59
- /**
60
- * Disposes the memory of all the components and tools of this instance of
61
- * the library. A memory leak will be created if:
62
- *
63
- * - An instance of the library ends up out of scope and this function isn't
64
- * called. This is especially relevant in Single Page Applications (React,
65
- * Angular, Vue, etc).
66
- *
67
- * - Any of the objects of this instance (meshes, geometries,materials, etc) is
68
- * referenced by a reference type (object or array).
69
- *
70
- * You can learn more about how Three.js handles memory leaks
71
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
72
- *
73
- */
74
- dispose(): void;
75
- private update;
76
- private static setupBVH;
77
- }
78
- import * as THREE from "three";
2
+ import { Component, Disposable, World, Event } from "../Types";
3
+ import { SimpleRaycaster } from "./src";
79
4
  import { Components } from "../Components";
80
- import { Component } from "../Types";
81
5
  /**
82
- * 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).
6
+ * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
83
7
  */
84
- export declare class Disposer extends Component {
85
- private _disposedComponents;
86
- /** {@link Component.enabled} */
87
- enabled: boolean;
8
+ export declare class Raycasters extends Component implements Disposable {
88
9
  /**
89
10
  * A unique identifier for the component.
90
11
  * This UUID is used to register the component within the Components system.
91
12
  */
92
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
93
- constructor(components: Components);
13
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
14
+ /** {@link Component.enabled} */
15
+ enabled: boolean;
94
16
  /**
95
- * Return the UUIDs of all disposed components.
17
+ * A Map that stores raycasters for each world.
18
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
96
19
  */
97
- get(): Set<string>;
20
+ list: Map<string, SimpleRaycaster>;
21
+ /** {@link Disposable.onDisposed} */
22
+ onDisposed: Event<unknown>;
23
+ constructor(components: Components);
98
24
  /**
99
- * Removes a mesh, its geometry and its materials from memory. If you are
100
- * using any of these in other parts of the application, make sure that you
101
- * remove them from the mesh before disposing it.
102
- *
103
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
104
- * to remove.
105
- *
106
- * @param materials - whether to dispose the materials of the mesh.
25
+ * Retrieves a SimpleRaycaster instance for the given world.
26
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
27
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
107
28
  *
108
- * @param recursive - whether to recursively dispose the children of the mesh.
29
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
30
+ * @returns The SimpleRaycaster instance for the given world.
109
31
  */
110
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
32
+ get(world: World): SimpleRaycaster;
111
33
  /**
112
- * Disposes a geometry from memory.
34
+ * Deletes the SimpleRaycaster instance associated with the given world.
35
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
113
36
  *
114
- * @param geometry - the
115
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
116
- * to remove.
37
+ * @param world - The world for which to delete the SimpleRaycaster instance.
38
+ * @returns {void}
117
39
  */
118
- disposeGeometry(geometry: THREE.BufferGeometry): void;
119
- private disposeGeometryAndMaterials;
120
- private disposeChildren;
121
- private static disposeMaterial;
40
+ delete(world: World): void;
41
+ /** {@link Disposable.dispose} */
42
+ dispose(): void;
122
43
  }
123
44
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
124
45
  import { Components } from "../Components";
@@ -187,54 +108,6 @@ export declare class Worlds extends Component implements Updateable, Disposable
187
108
  /** {@link Updateable.update} */
188
109
  update(delta?: number): void | Promise<void>;
189
110
  }
190
- import { Components } from "../Components";
191
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
192
- import { Component, Event, Disposable, World } from "../Types";
193
- /**
194
- * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
195
- */
196
- export declare class Cullers extends Component implements Disposable {
197
- /**
198
- * A unique identifier for the component.
199
- * This UUID is used to register the component within the Components system.
200
- */
201
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
202
- /**
203
- * An event that is triggered when the Cullers component is disposed.
204
- */
205
- readonly onDisposed: Event<unknown>;
206
- private _enabled;
207
- /**
208
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
209
- */
210
- list: Map<string, MeshCullerRenderer>;
211
- /** {@link Component.enabled} */
212
- get enabled(): boolean;
213
- /** {@link Component.enabled} */
214
- set enabled(value: boolean);
215
- constructor(components: Components);
216
- /**
217
- * Creates a new MeshCullerRenderer for the given world.
218
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
219
- *
220
- * @param world - The world for which to create the MeshCullerRenderer.
221
- * @param config - Optional configuration settings for the MeshCullerRenderer.
222
- *
223
- * @returns The newly created or existing MeshCullerRenderer for the given world.
224
- */
225
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
226
- /**
227
- * Deletes the MeshCullerRenderer associated with the given world.
228
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
229
- *
230
- * @param world - The world for which to delete the MeshCullerRenderer.
231
- *
232
- * @returns {void}
233
- */
234
- delete(world: World): void;
235
- /** {@link Disposable.dispose} */
236
- dispose(): void;
237
- }
238
111
  import * as THREE from "three";
239
112
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
240
113
  import { SimplePlane } from "./src";
@@ -362,59 +235,88 @@ export declare class Clipper extends Component implements Createable, Disposable
362
235
  private _onStartDragging;
363
236
  private _onEndDragging;
364
237
  }
365
- import { MiniMap } from "./src";
366
- import { Component, Updateable, World, Event, Disposable } from "../Types";
367
- import { Components } from "../Components";
238
+ import { Component, Disposable, Event } from "../Types";
368
239
  /**
369
- * 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).
240
+ * 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.
370
241
  */
371
- export declare class MiniMaps extends Component implements Updateable, Disposable {
242
+ export declare class Components implements Disposable {
372
243
  /**
373
- * A unique identifier for the component.
374
- * This UUID is used to register the component within the Components system.
244
+ * The version of the @thatopen/components library.
375
245
  */
376
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
377
- /** {@link Updateable.onAfterUpdate} */
378
- readonly onAfterUpdate: Event<unknown>;
379
- /** {@link Updateable.onBeforeUpdate} */
380
- readonly onBeforeUpdate: Event<unknown>;
246
+ static readonly release = "2.0.22";
381
247
  /** {@link Disposable.onDisposed} */
382
- readonly onDisposed: Event<unknown>;
383
- /** {@link Component.enabled} */
248
+ readonly onDisposed: Event<void>;
249
+ /**
250
+ * The list of components created in this app.
251
+ * The keys are UUIDs and the values are instances of the components.
252
+ */
253
+ readonly list: Map<string, Component>;
254
+ /**
255
+ * If disabled, the animation loop will be stopped.
256
+ * Default value is false.
257
+ */
384
258
  enabled: boolean;
259
+ private _clock;
385
260
  /**
386
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
261
+ * Adds a component to the list of components.
262
+ * Throws an error if a component with the same UUID already exists.
263
+ *
264
+ * @param uuid - The unique identifier of the component.
265
+ * @param instance - The instance of the component to be added.
266
+ *
267
+ * @throws Will throw an error if a component with the same UUID already exists.
268
+ *
269
+ * @internal
387
270
  */
388
- list: Map<string, MiniMap>;
389
- constructor(components: Components);
271
+ add(uuid: string, instance: Component): void;
390
272
  /**
391
- * Creates a new {@link MiniMap} instance associated with the given world.
392
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
273
+ * Retrieves a component instance by its constructor function.
274
+ * If the component does not exist in the list, it will be created and added.
393
275
  *
394
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
395
- * @returns The newly created {@link MiniMap} instance.
396
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
276
+ * @template U - The type of the component to retrieve.
277
+ * @param Component - The constructor function of the component to retrieve.
278
+ *
279
+ * @returns The instance of the requested component.
280
+ *
281
+ * @throws Will throw an error if a component with the same UUID already exists.
282
+ *
283
+ * @internal
397
284
  */
398
- create(world: World): MiniMap;
285
+ get<U extends Component>(Component: new (components: Components) => U): U;
286
+ constructor();
399
287
  /**
400
- * Deletes a {@link MiniMap} instance associated with the given world ID.
401
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
288
+ * Initializes the Components instance.
289
+ * This method starts the animation loop, sets the enabled flag to true,
290
+ * and calls the update method.
402
291
  *
403
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
404
292
  * @returns {void}
405
293
  */
406
- delete(id: string): void;
407
- /** {@link Disposable.dispose} */
408
- dispose(): void;
409
- /** {@link Updateable.update} */
410
- update(): void;
411
- }
412
- import { Component, Disposable, World, Event } from "../Types";
413
- import { GridConfig, SimpleGrid } from "./src";
414
- import { Components } from "../Components";
415
- /**
416
- * 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).
417
- */
294
+ init(): void;
295
+ /**
296
+ * Disposes the memory of all the components and tools of this instance of
297
+ * the library. A memory leak will be created if:
298
+ *
299
+ * - An instance of the library ends up out of scope and this function isn't
300
+ * called. This is especially relevant in Single Page Applications (React,
301
+ * Angular, Vue, etc).
302
+ *
303
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
304
+ * referenced by a reference type (object or array).
305
+ *
306
+ * You can learn more about how Three.js handles memory leaks
307
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
308
+ *
309
+ */
310
+ dispose(): void;
311
+ private update;
312
+ private static setupBVH;
313
+ }
314
+ import { Component, Disposable, World, Event } from "../Types";
315
+ import { GridConfig, SimpleGrid } from "./src";
316
+ import { Components } from "../Components";
317
+ /**
318
+ * 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).
319
+ */
418
320
  export declare class Grids extends Component implements Disposable {
419
321
  /**
420
322
  * A unique identifier for the component.
@@ -458,6 +360,99 @@ export declare class Grids extends Component implements Disposable {
458
360
  /** {@link Disposable.dispose} */
459
361
  dispose(): void;
460
362
  }
363
+ import { Components } from "../Components";
364
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
365
+ import { Component, Event, Disposable, World } from "../Types";
366
+ /**
367
+ * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
368
+ */
369
+ export declare class Cullers extends Component implements Disposable {
370
+ /**
371
+ * A unique identifier for the component.
372
+ * This UUID is used to register the component within the Components system.
373
+ */
374
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
375
+ /**
376
+ * An event that is triggered when the Cullers component is disposed.
377
+ */
378
+ readonly onDisposed: Event<unknown>;
379
+ private _enabled;
380
+ /**
381
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
382
+ */
383
+ list: Map<string, MeshCullerRenderer>;
384
+ /** {@link Component.enabled} */
385
+ get enabled(): boolean;
386
+ /** {@link Component.enabled} */
387
+ set enabled(value: boolean);
388
+ constructor(components: Components);
389
+ /**
390
+ * Creates a new MeshCullerRenderer for the given world.
391
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
392
+ *
393
+ * @param world - The world for which to create the MeshCullerRenderer.
394
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
395
+ *
396
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
397
+ */
398
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
399
+ /**
400
+ * Deletes the MeshCullerRenderer associated with the given world.
401
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
402
+ *
403
+ * @param world - The world for which to delete the MeshCullerRenderer.
404
+ *
405
+ * @returns {void}
406
+ */
407
+ delete(world: World): void;
408
+ /** {@link Disposable.dispose} */
409
+ dispose(): void;
410
+ }
411
+ import * as THREE from "three";
412
+ import { Components } from "../Components";
413
+ import { Component } from "../Types";
414
+ /**
415
+ * 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).
416
+ */
417
+ export declare class Disposer extends Component {
418
+ private _disposedComponents;
419
+ /** {@link Component.enabled} */
420
+ enabled: boolean;
421
+ /**
422
+ * A unique identifier for the component.
423
+ * This UUID is used to register the component within the Components system.
424
+ */
425
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
426
+ constructor(components: Components);
427
+ /**
428
+ * Return the UUIDs of all disposed components.
429
+ */
430
+ get(): Set<string>;
431
+ /**
432
+ * Removes a mesh, its geometry and its materials from memory. If you are
433
+ * using any of these in other parts of the application, make sure that you
434
+ * remove them from the mesh before disposing it.
435
+ *
436
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
437
+ * to remove.
438
+ *
439
+ * @param materials - whether to dispose the materials of the mesh.
440
+ *
441
+ * @param recursive - whether to recursively dispose the children of the mesh.
442
+ */
443
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
444
+ /**
445
+ * Disposes a geometry from memory.
446
+ *
447
+ * @param geometry - the
448
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
449
+ * to remove.
450
+ */
451
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
452
+ private disposeGeometryAndMaterials;
453
+ private disposeChildren;
454
+ private static disposeMaterial;
455
+ }
461
456
  import * as THREE from "three";
462
457
  import { Components } from "../Components";
463
458
  import { SimpleCamera } from "..";
@@ -522,106 +517,241 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
522
517
  private newOrthoCamera;
523
518
  private setOrthoPerspCameraAspect;
524
519
  }
525
- import { Component, Disposable, World, Event } from "../Types";
526
- import { SimpleRaycaster } from "./src";
520
+ import * as THREE from "three";
521
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
522
+ center: THREE.Vector3;
523
+ halfSizes: THREE.Vector3;
524
+ rotation: THREE.Matrix3;
525
+ transformation: THREE.Matrix4;
526
+ };
527
+ import { MiniMap } from "./src";
528
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
527
529
  import { Components } from "../Components";
528
530
  /**
529
- * 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).
531
+ * 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).
530
532
  */
531
- export declare class Raycasters extends Component implements Disposable {
533
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
532
534
  /**
533
535
  * A unique identifier for the component.
534
536
  * This UUID is used to register the component within the Components system.
535
537
  */
536
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
538
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
539
+ /** {@link Updateable.onAfterUpdate} */
540
+ readonly onAfterUpdate: Event<unknown>;
541
+ /** {@link Updateable.onBeforeUpdate} */
542
+ readonly onBeforeUpdate: Event<unknown>;
543
+ /** {@link Disposable.onDisposed} */
544
+ readonly onDisposed: Event<unknown>;
537
545
  /** {@link Component.enabled} */
538
546
  enabled: boolean;
539
547
  /**
540
- * A Map that stores raycasters for each world.
541
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
548
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
542
549
  */
543
- list: Map<string, SimpleRaycaster>;
544
- /** {@link Disposable.onDisposed} */
545
- onDisposed: Event<unknown>;
550
+ list: Map<string, MiniMap>;
546
551
  constructor(components: Components);
547
552
  /**
548
- * Retrieves a SimpleRaycaster instance for the given world.
549
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
550
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
553
+ * Creates a new {@link MiniMap} instance associated with the given world.
554
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
551
555
  *
552
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
553
- * @returns The SimpleRaycaster instance for the given world.
556
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
557
+ * @returns The newly created {@link MiniMap} instance.
558
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
554
559
  */
555
- get(world: World): SimpleRaycaster;
560
+ create(world: World): MiniMap;
556
561
  /**
557
- * Deletes the SimpleRaycaster instance associated with the given world.
558
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
562
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
563
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
559
564
  *
560
- * @param world - The world for which to delete the SimpleRaycaster instance.
565
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
561
566
  * @returns {void}
562
567
  */
563
- delete(world: World): void;
568
+ delete(id: string): void;
564
569
  /** {@link Disposable.dispose} */
565
570
  dispose(): void;
571
+ /** {@link Updateable.update} */
572
+ update(): void;
573
+ }
574
+ export declare class UUID {
575
+ private static _pattern;
576
+ private static _lut;
577
+ static create(): string;
578
+ static validate(uuid: string): void;
566
579
  }
580
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
567
581
  import * as THREE from "three";
568
- import * as FRAGS from "@thatopen/fragments";
569
- import { FragmentsGroup } from "@thatopen/fragments";
570
- import { Component, Components, Disposable, Event } from "../../core";
582
+ export declare class MaterialsUtils {
583
+ static isTransparent(material: THREE.Material): boolean;
584
+ }
585
+ import * as THREE from "three";
586
+ import { Component, Components, Disposable, Event, World } from "../core";
571
587
  /**
572
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
588
+ * Configuration interface for the VertexPicker component.
573
589
  */
574
- export declare class BoundingBoxer extends Component implements Disposable {
575
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
576
- /** {@link Component.enabled} */
577
- enabled: boolean;
590
+ export interface VertexPickerConfig {
591
+ /**
592
+ * If true, only vertices will be picked, not the closest point on the face.
593
+ */
594
+ showOnlyVertex: boolean;
595
+ /**
596
+ * The maximum distance for snapping to a vertex.
597
+ */
598
+ snapDistance: number;
599
+ /**
600
+ * The HTML element to use for previewing the picked vertex.
601
+ */
602
+ previewElement: HTMLElement;
603
+ }
604
+ /**
605
+ * A class that provides functionality for picking vertices in a 3D scene.
606
+ */
607
+ export declare class VertexPicker extends Component implements Disposable {
578
608
  /** {@link Disposable.onDisposed} */
579
609
  readonly onDisposed: Event<unknown>;
580
- private _absoluteMin;
581
- private _absoluteMax;
582
- private _meshes;
583
- constructor(components: Components);
584
610
  /**
585
- * A static method to calculate the dimensions of a given bounding box.
586
- *
587
- * @param bbox - The bounding box to calculate the dimensions for.
588
- * @returns An object containing the width, height, depth, and center of the bounding box.
611
+ * An event that is triggered when a vertex is found.
612
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
589
613
  */
590
- static getDimensions(bbox: THREE.Box3): {
591
- width: number;
592
- height: number;
593
- depth: number;
594
- center: THREE.Vector3;
595
- };
614
+ readonly onVertexFound: Event<THREE.Vector3>;
596
615
  /**
597
- * A static method to create a new bounding box boundary.
598
- *
599
- * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
600
- * @returns A new THREE.Vector3 representing the boundary.
601
- *
602
- * @remarks
603
- * This method is used to create a new boundary for calculating bounding boxes.
604
- * It sets the x, y, and z components of the returned vector to positive or negative infinity,
605
- * depending on the value of the 'positive' parameter.
606
- *
607
- * @example
608
- * '''typescript
609
- * const positiveBound = BoundingBoxer.newBound(true);
610
- * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
611
- *
612
- * const negativeBound = BoundingBoxer.newBound(false);
613
- * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
614
- * '''
616
+ * An event that is triggered when a vertex is lost.
617
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
615
618
  */
616
- static newBound(positive: boolean): THREE.Vector3;
619
+ readonly onVertexLost: Event<THREE.Vector3>;
617
620
  /**
618
- * A static method to calculate the bounding box of a set of points.
619
- *
620
- * @param points - An array of THREE.Vector3 representing the points.
621
- * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
622
- * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
623
- * @returns A THREE.Box3 representing the bounding box of the given points.
624
- *
621
+ * A reference to the Components instance associated with this VertexPicker.
622
+ */
623
+ components: Components;
624
+ /**
625
+ * A reference to the working plane used for vertex picking.
626
+ * This plane is used to determine which vertices are considered valid for picking.
627
+ * If this value is null, all vertices are considered valid.
628
+ */
629
+ workingPlane: THREE.Plane | null;
630
+ private _pickedPoint;
631
+ private _config;
632
+ private _enabled;
633
+ /**
634
+ * Sets the enabled state of the VertexPicker.
635
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
636
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
637
+ *
638
+ * @param value - The new enabled state.
639
+ */
640
+ set enabled(value: boolean);
641
+ /**
642
+ * Gets the current enabled state of the VertexPicker.
643
+ *
644
+ * @returns The current enabled state.
645
+ */
646
+ get enabled(): boolean;
647
+ /**
648
+ * Sets the configuration for the VertexPicker component.
649
+ *
650
+ * @param value - A Partial object containing the configuration properties to update.
651
+ * The properties not provided in the value object will retain their current values.
652
+ *
653
+ * @example
654
+ * '''typescript
655
+ * vertexPicker.config = {
656
+ * snapDistance: 0.5,
657
+ * showOnlyVertex: true,
658
+ * };
659
+ * '''
660
+ */
661
+ set config(value: Partial<VertexPickerConfig>);
662
+ /**
663
+ * Gets the current configuration for the VertexPicker component.
664
+ *
665
+ * @returns A copy of the current VertexPickerConfig object.
666
+ *
667
+ * @example
668
+ * '''typescript
669
+ * const currentConfig = vertexPicker.config;
670
+ * console.log(currentConfig.snapDistance); // Output: 0.25
671
+ * '''
672
+ */
673
+ get config(): Partial<VertexPickerConfig>;
674
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
675
+ /** {@link Disposable.dispose} */
676
+ dispose(): void;
677
+ /**
678
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
679
+ *
680
+ * @param world - The World instance to use for raycasting.
681
+ *
682
+ * @returns The current picked point, or null if no point is picked.
683
+ *
684
+ * @remarks
685
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
686
+ * If enabled, it performs raycasting to find the closest intersecting object.
687
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
688
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
689
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
690
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
691
+ */
692
+ get(world: World): THREE.Vector3 | null;
693
+ private getClosestVertex;
694
+ private getVertices;
695
+ private getVertex;
696
+ }
697
+ import * as THREE from "three";
698
+ import * as FRAGS from "@thatopen/fragments";
699
+ import { FragmentsGroup } from "@thatopen/fragments";
700
+ import { Component, Components, Disposable, Event } from "../../core";
701
+ /**
702
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
703
+ */
704
+ export declare class BoundingBoxer extends Component implements Disposable {
705
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
706
+ /** {@link Component.enabled} */
707
+ enabled: boolean;
708
+ /** {@link Disposable.onDisposed} */
709
+ readonly onDisposed: Event<unknown>;
710
+ private _absoluteMin;
711
+ private _absoluteMax;
712
+ private _meshes;
713
+ constructor(components: Components);
714
+ /**
715
+ * A static method to calculate the dimensions of a given bounding box.
716
+ *
717
+ * @param bbox - The bounding box to calculate the dimensions for.
718
+ * @returns An object containing the width, height, depth, and center of the bounding box.
719
+ */
720
+ static getDimensions(bbox: THREE.Box3): {
721
+ width: number;
722
+ height: number;
723
+ depth: number;
724
+ center: THREE.Vector3;
725
+ };
726
+ /**
727
+ * A static method to create a new bounding box boundary.
728
+ *
729
+ * @param positive - A boolean indicating whether to create a boundary for positive or negative values.
730
+ * @returns A new THREE.Vector3 representing the boundary.
731
+ *
732
+ * @remarks
733
+ * This method is used to create a new boundary for calculating bounding boxes.
734
+ * It sets the x, y, and z components of the returned vector to positive or negative infinity,
735
+ * depending on the value of the 'positive' parameter.
736
+ *
737
+ * @example
738
+ * '''typescript
739
+ * const positiveBound = BoundingBoxer.newBound(true);
740
+ * console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
741
+ *
742
+ * const negativeBound = BoundingBoxer.newBound(false);
743
+ * console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
744
+ * '''
745
+ */
746
+ static newBound(positive: boolean): THREE.Vector3;
747
+ /**
748
+ * A static method to calculate the bounding box of a set of points.
749
+ *
750
+ * @param points - An array of THREE.Vector3 representing the points.
751
+ * @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
752
+ * @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
753
+ * @returns A THREE.Box3 representing the bounding box of the given points.
754
+ *
625
755
  * @remarks
626
756
  * This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
627
757
  * If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
@@ -750,13 +880,119 @@ export declare class BoundingBoxer extends Component implements Disposable {
750
880
  private static getFragmentBounds;
751
881
  }
752
882
  import * as THREE from "three";
753
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
754
- center: THREE.Vector3;
755
- halfSizes: THREE.Vector3;
756
- rotation: THREE.Matrix3;
757
- transformation: THREE.Matrix4;
758
- };
759
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
883
+ import { Component, Components } from "../../core";
884
+ /**
885
+ * Represents an edge measurement result.
886
+ */
887
+ export interface MeasureEdge {
888
+ /**
889
+ * The distance between the two points of the edge.
890
+ */
891
+ distance: number;
892
+ /**
893
+ * The two points that define the edge.
894
+ */
895
+ points: THREE.Vector3[];
896
+ }
897
+ /**
898
+ * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
899
+ */
900
+ export declare class MeasurementUtils extends Component {
901
+ /**
902
+ * A unique identifier for the component.
903
+ * This UUID is used to register the component within the Components system.
904
+ */
905
+ static uuid: string;
906
+ /** {@link Component.enabled} */
907
+ enabled: boolean;
908
+ constructor(components: Components);
909
+ /**
910
+ * Utility method to calculate the distance from a point to a line segment.
911
+ *
912
+ * @param point - The point from which to calculate the distance.
913
+ * @param lineStart - The start point of the line segment.
914
+ * @param lineEnd - The end point of the line segment.
915
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
916
+ * @returns The distance from the point to the line segment.
917
+ */
918
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
919
+ /**
920
+ * Method to get the face of a mesh that contains a given triangle index.
921
+ * It also returns the edges of the found face and their indices.
922
+ *
923
+ * @param mesh - The mesh to get the face from. It must be indexed.
924
+ * @param triangleIndex - The index of the triangle within the mesh.
925
+ * @param instance - The instance of the mesh (optional).
926
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
927
+ */
928
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
929
+ edges: MeasureEdge[];
930
+ indices: Set<number>;
931
+ } | null;
932
+ /**
933
+ * Method to get the vertices and normal of a mesh face at a given index.
934
+ * It also applies instance transformation if provided.
935
+ *
936
+ * @param mesh - The mesh to get the face from. It must be indexed.
937
+ * @param faceIndex - The index of the face within the mesh.
938
+ * @param instance - The instance of the mesh (optional).
939
+ * @returns An object containing the vertices and normal of the face.
940
+ * @throws Will throw an error if the geometry is not indexed.
941
+ */
942
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
943
+ p1: THREE.Vector3;
944
+ p2: THREE.Vector3;
945
+ p3: THREE.Vector3;
946
+ faceNormal: THREE.Vector3;
947
+ };
948
+ /**
949
+ * Method to round the vector's components to a specified number of decimal places.
950
+ * This is used to ensure numerical precision in edge detection.
951
+ *
952
+ * @param vector - The vector to round.
953
+ * @returns The vector with rounded components.
954
+ */
955
+ round(vector: THREE.Vector3): void;
956
+ private getFaceData;
957
+ }
958
+ import * as FRAGS from "@thatopen/fragments";
959
+ import { Components, Component } from "../../core";
960
+ /**
961
+ * 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).
962
+ */
963
+ export declare class Hider extends Component {
964
+ /**
965
+ * A unique identifier for the component.
966
+ * This UUID is used to register the component within the Components system.
967
+ */
968
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
969
+ /** {@link Component.enabled} */
970
+ enabled: boolean;
971
+ constructor(components: Components);
972
+ /**
973
+ * Sets the visibility of fragments within the 3D scene.
974
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
975
+ * If 'items' is provided, only the specified fragments will be affected.
976
+ *
977
+ * @param visible - The visibility state to set for the fragments.
978
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
979
+ * If not provided, all fragments will be affected.
980
+ *
981
+ * @returns {void}
982
+ */
983
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
984
+ /**
985
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
986
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
987
+ *
988
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
989
+ * If not provided, all fragments will be isolated.
990
+ *
991
+ * @returns {void}
992
+ */
993
+ isolate(items: FRAGS.FragmentIdMap): void;
994
+ private updateCulledVisibility;
995
+ }
760
996
  import { Component, Disposable, Event, Components } from "../../core";
761
997
  /**
762
998
  * 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).
@@ -807,213 +1043,7 @@ export declare class Exploder extends Component implements Disposable {
807
1043
  */
808
1044
  set(active: boolean): void;
809
1045
  }
810
- import * as THREE from "three";
811
- import * as FRAGS from "@thatopen/fragments";
812
- import { Disposable, Component, Event, Components } from "../../core";
813
- /**
814
- * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
815
- */
816
- export interface Classification {
817
- /**
818
- * A system within the classification.
819
- * The key is the system name, and the value is an object representing the classes within the system.
820
- */
821
- [system: string]: {
822
- /**
823
- * A class within the system.
824
- * The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
825
- */
826
- [className: string]: FRAGS.FragmentIdMap;
827
- };
828
- }
829
- /**
830
- * 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).
831
- */
832
- export declare class Classifier extends Component implements Disposable {
833
- /**
834
- * A unique identifier for the component.
835
- * This UUID is used to register the component within the Components system.
836
- */
837
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
838
- /** {@link Component.enabled} */
839
- enabled: boolean;
840
- /**
841
- * A map representing the classification systems.
842
- * The key is the system name, and the value is an object representing the classes within the system.
843
- */
844
- list: Classification;
845
- /** {@link Disposable.onDisposed} */
846
- readonly onDisposed: Event<unknown>;
847
- constructor(components: Components);
848
- private onFragmentsDisposed;
849
- /** {@link Disposable.dispose} */
850
- dispose(): void;
851
- /**
852
- * Removes a fragment from the classification based on its unique identifier (guid).
853
- * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
854
- *
855
- * @param guid - The unique identifier of the fragment to be removed.
856
- */
857
- remove(guid: string): void;
858
- /**
859
- * Finds and returns fragments based on the provided filter criteria.
860
- * If no filter is provided, it returns all fragments.
861
- *
862
- * @param filter - An optional object containing filter criteria.
863
- * The keys of the object represent the classification system names,
864
- * and the values are arrays of class names to match.
865
- *
866
- * @returns A map of fragment GUIDs to their respective express IDs,
867
- * where the express IDs are filtered based on the provided filter criteria.
868
- *
869
- * @throws Will throw an error if the fragments map is malformed.
870
- */
871
- find(filter?: {
872
- [name: string]: string[];
873
- }): FRAGS.FragmentIdMap;
874
- /**
875
- * Classifies fragments based on their modelID.
876
- *
877
- * @param modelID - The unique identifier of the model to classify fragments by.
878
- * @param group - The FragmentsGroup containing the fragments to be classified.
879
- *
880
- * @remarks
881
- * This method iterates through the fragments in the provided group,
882
- * and classifies them based on their modelID.
883
- * The classification is stored in the 'list.models' property,
884
- * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
885
- *
886
- */
887
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
888
- /**
889
- * Classifies fragments based on their PredefinedType property.
890
- *
891
- * @param group - The FragmentsGroup containing the fragments to be classified.
892
- *
893
- * @remarks
894
- * This method iterates through the properties of the fragments in the provided group,
895
- * and classifies them based on their PredefinedType property.
896
- * The classification is stored in the 'list.predefinedTypes' property,
897
- * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
898
- *
899
- * @throws Will throw an error if the fragment ID is not found.
900
- */
901
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
902
- /**
903
- * Classifies fragments based on their entity type.
904
- *
905
- * @param group - The FragmentsGroup containing the fragments to be classified.
906
- *
907
- * @remarks
908
- * This method iterates through the relations of the fragments in the provided group,
909
- * and classifies them based on their entity type.
910
- * The classification is stored in the 'list.entities' property,
911
- * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
912
- *
913
- * @throws Will throw an error if the fragment ID is not found.
914
- */
915
- byEntity(group: FRAGS.FragmentsGroup): void;
916
- /**
917
- * Classifies fragments based on a specific IFC relationship.
918
- *
919
- * @param group - The FragmentsGroup containing the fragments to be classified.
920
- * @param ifcRel - The IFC relationship number to classify fragments by.
921
- * @param systemName - The name of the classification system to store the classification.
922
- *
923
- * @remarks
924
- * This method iterates through the relations of the fragments in the provided group,
925
- * and classifies them based on the specified IFC relationship.
926
- * The classification is stored in the 'list' property under the specified system name,
927
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
928
- *
929
- * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
930
- */
931
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
932
- /**
933
- * Classifies fragments based on their spatial structure in the IFC model.
934
- *
935
- * @param model - The FragmentsGroup containing the fragments to be classified.
936
- *
937
- * @remarks
938
- * This method iterates through the relations of the fragments in the provided group,
939
- * and classifies them based on their spatial structure in the IFC model.
940
- * The classification is stored in the 'list' property under the system name "spatialStructures",
941
- * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
942
- *
943
- * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
944
- */
945
- bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
946
- /**
947
- * Sets the color of the specified fragments.
948
- *
949
- * @param items - A map of fragment IDs to their respective express IDs.
950
- * @param color - The color to set for the fragments.
951
- * @param override - A boolean indicating whether to override the existing color of the fragments.
952
- *
953
- * @remarks
954
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
955
- * and sets their color using the 'setColor' method of the FragmentsGroup class.
956
- *
957
- * @throws Will throw an error if the fragment with the specified ID is not found.
958
- */
959
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
960
- /**
961
- * Resets the color of the specified fragments to their original color.
962
- *
963
- * @param items - A map of fragment IDs to their respective express IDs.
964
- *
965
- * @remarks
966
- * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
967
- * and resets their color using the 'resetColor' method of the FragmentsGroup class.
968
- *
969
- * @throws Will throw an error if the fragment with the specified ID is not found.
970
- */
971
- resetColor(items: FRAGS.FragmentIdMap): void;
972
- protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
973
- }
974
- import * as THREE from "three";
975
- export declare class MaterialsUtils {
976
- static isTransparent(material: THREE.Material): boolean;
977
- }
978
- import * as FRAGS from "@thatopen/fragments";
979
- import { Components, Component } from "../../core";
980
- /**
981
- * 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).
982
- */
983
- export declare class Hider extends Component {
984
- /**
985
- * A unique identifier for the component.
986
- * This UUID is used to register the component within the Components system.
987
- */
988
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
989
- /** {@link Component.enabled} */
990
- enabled: boolean;
991
- constructor(components: Components);
992
- /**
993
- * Sets the visibility of fragments within the 3D scene.
994
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
995
- * If 'items' is provided, only the specified fragments will be affected.
996
- *
997
- * @param visible - The visibility state to set for the fragments.
998
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
999
- * If not provided, all fragments will be affected.
1000
- *
1001
- * @returns {void}
1002
- */
1003
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1004
- /**
1005
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1006
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1007
- *
1008
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1009
- * If not provided, all fragments will be isolated.
1010
- *
1011
- * @returns {void}
1012
- */
1013
- isolate(items: FRAGS.FragmentIdMap): void;
1014
- private updateCulledVisibility;
1015
- }
1016
- import * as WEBIFC from "web-ifc";
1046
+ import * as WEBIFC from "web-ifc";
1017
1047
  import * as FRAGS from "@thatopen/fragments";
1018
1048
  import { IfcFragmentSettings } from "./src";
1019
1049
  import { Component, Components, Event, Disposable } from "../../core";
@@ -1404,6 +1434,31 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
1404
1434
  private cleanUp;
1405
1435
  }
1406
1436
  import * as WEBIFC from "web-ifc";
1437
+ import * as FRAG from "@thatopen/fragments";
1438
+ import { Component, Components } from "../../core";
1439
+ /**
1440
+ * 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).
1441
+ */
1442
+ export declare class IfcJsonExporter extends Component {
1443
+ /**
1444
+ * A unique identifier for the component.
1445
+ * This UUID is used to register the component within the Components system.
1446
+ */
1447
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1448
+ /** {@link Component.enabled} */
1449
+ enabled: boolean;
1450
+ constructor(components: Components);
1451
+ /**
1452
+ * Exports all the properties of an IFC into an array of JS objects.
1453
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1454
+ * @param modelID ID of the IFC model whose properties to extract.
1455
+ * @param indirect whether to get the indirect relationships as well.
1456
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
1457
+ * to make the location data available (e.g. absolute position of building).
1458
+ */
1459
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1460
+ }
1461
+ import * as WEBIFC from "web-ifc";
1407
1462
  import { FragmentsGroup } from "@thatopen/fragments";
1408
1463
  import { Disposable, Event, Component, Components } from "../../core";
1409
1464
  import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
@@ -1544,30 +1599,169 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
1544
1599
  /** {@link Disposable.dispose} */
1545
1600
  dispose(): void;
1546
1601
  }
1547
- import * as WEBIFC from "web-ifc";
1548
- import * as FRAG from "@thatopen/fragments";
1549
- import { Component, Components } from "../../core";
1602
+ import * as THREE from "three";
1603
+ import * as FRAGS from "@thatopen/fragments";
1604
+ import { Disposable, Component, Event, Components } from "../../core";
1550
1605
  /**
1551
- * 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).
1606
+ * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
1552
1607
  */
1553
- export declare class IfcJsonExporter extends Component {
1608
+ export interface Classification {
1554
1609
  /**
1555
- * A unique identifier for the component.
1556
- * This UUID is used to register the component within the Components system.
1610
+ * A system within the classification.
1611
+ * The key is the system name, and the value is an object representing the classes within the system.
1557
1612
  */
1558
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1559
- /** {@link Component.enabled} */
1560
- enabled: boolean;
1561
- constructor(components: Components);
1562
- /**
1563
- * Exports all the properties of an IFC into an array of JS objects.
1564
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1565
- * @param modelID ID of the IFC model whose properties to extract.
1566
- * @param indirect whether to get the indirect relationships as well.
1567
- * @param recursiveSpatial whether to get the properties of spatial items recursively
1568
- * to make the location data available (e.g. absolute position of building).
1613
+ [system: string]: {
1614
+ /**
1615
+ * A class within the system.
1616
+ * The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
1617
+ */
1618
+ [className: string]: FRAGS.FragmentIdMap;
1619
+ };
1620
+ }
1621
+ /**
1622
+ * 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).
1623
+ */
1624
+ export declare class Classifier extends Component implements Disposable {
1625
+ /**
1626
+ * A unique identifier for the component.
1627
+ * This UUID is used to register the component within the Components system.
1569
1628
  */
1570
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1629
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1630
+ /** {@link Component.enabled} */
1631
+ enabled: boolean;
1632
+ /**
1633
+ * A map representing the classification systems.
1634
+ * The key is the system name, and the value is an object representing the classes within the system.
1635
+ */
1636
+ list: Classification;
1637
+ /** {@link Disposable.onDisposed} */
1638
+ readonly onDisposed: Event<unknown>;
1639
+ constructor(components: Components);
1640
+ private onFragmentsDisposed;
1641
+ /** {@link Disposable.dispose} */
1642
+ dispose(): void;
1643
+ /**
1644
+ * Removes a fragment from the classification based on its unique identifier (guid).
1645
+ * This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
1646
+ *
1647
+ * @param guid - The unique identifier of the fragment to be removed.
1648
+ */
1649
+ remove(guid: string): void;
1650
+ /**
1651
+ * Finds and returns fragments based on the provided filter criteria.
1652
+ * If no filter is provided, it returns all fragments.
1653
+ *
1654
+ * @param filter - An optional object containing filter criteria.
1655
+ * The keys of the object represent the classification system names,
1656
+ * and the values are arrays of class names to match.
1657
+ *
1658
+ * @returns A map of fragment GUIDs to their respective express IDs,
1659
+ * where the express IDs are filtered based on the provided filter criteria.
1660
+ *
1661
+ * @throws Will throw an error if the fragments map is malformed.
1662
+ */
1663
+ find(filter?: {
1664
+ [name: string]: string[];
1665
+ }): FRAGS.FragmentIdMap;
1666
+ /**
1667
+ * Classifies fragments based on their modelID.
1668
+ *
1669
+ * @param modelID - The unique identifier of the model to classify fragments by.
1670
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1671
+ *
1672
+ * @remarks
1673
+ * This method iterates through the fragments in the provided group,
1674
+ * and classifies them based on their modelID.
1675
+ * The classification is stored in the 'list.models' property,
1676
+ * with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
1677
+ *
1678
+ */
1679
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
1680
+ /**
1681
+ * Classifies fragments based on their PredefinedType property.
1682
+ *
1683
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1684
+ *
1685
+ * @remarks
1686
+ * This method iterates through the properties of the fragments in the provided group,
1687
+ * and classifies them based on their PredefinedType property.
1688
+ * The classification is stored in the 'list.predefinedTypes' property,
1689
+ * with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
1690
+ *
1691
+ * @throws Will throw an error if the fragment ID is not found.
1692
+ */
1693
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
1694
+ /**
1695
+ * Classifies fragments based on their entity type.
1696
+ *
1697
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1698
+ *
1699
+ * @remarks
1700
+ * This method iterates through the relations of the fragments in the provided group,
1701
+ * and classifies them based on their entity type.
1702
+ * The classification is stored in the 'list.entities' property,
1703
+ * with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
1704
+ *
1705
+ * @throws Will throw an error if the fragment ID is not found.
1706
+ */
1707
+ byEntity(group: FRAGS.FragmentsGroup): void;
1708
+ /**
1709
+ * Classifies fragments based on a specific IFC relationship.
1710
+ *
1711
+ * @param group - The FragmentsGroup containing the fragments to be classified.
1712
+ * @param ifcRel - The IFC relationship number to classify fragments by.
1713
+ * @param systemName - The name of the classification system to store the classification.
1714
+ *
1715
+ * @remarks
1716
+ * This method iterates through the relations of the fragments in the provided group,
1717
+ * and classifies them based on the specified IFC relationship.
1718
+ * The classification is stored in the 'list' property under the specified system name,
1719
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1720
+ *
1721
+ * @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
1722
+ */
1723
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
1724
+ /**
1725
+ * Classifies fragments based on their spatial structure in the IFC model.
1726
+ *
1727
+ * @param model - The FragmentsGroup containing the fragments to be classified.
1728
+ *
1729
+ * @remarks
1730
+ * This method iterates through the relations of the fragments in the provided group,
1731
+ * and classifies them based on their spatial structure in the IFC model.
1732
+ * The classification is stored in the 'list' property under the system name "spatialStructures",
1733
+ * with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
1734
+ *
1735
+ * @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
1736
+ */
1737
+ bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
1738
+ /**
1739
+ * Sets the color of the specified fragments.
1740
+ *
1741
+ * @param items - A map of fragment IDs to their respective express IDs.
1742
+ * @param color - The color to set for the fragments.
1743
+ * @param override - A boolean indicating whether to override the existing color of the fragments.
1744
+ *
1745
+ * @remarks
1746
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1747
+ * and sets their color using the 'setColor' method of the FragmentsGroup class.
1748
+ *
1749
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1750
+ */
1751
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
1752
+ /**
1753
+ * Resets the color of the specified fragments to their original color.
1754
+ *
1755
+ * @param items - A map of fragment IDs to their respective express IDs.
1756
+ *
1757
+ * @remarks
1758
+ * This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
1759
+ * and resets their color using the 'resetColor' method of the FragmentsGroup class.
1760
+ *
1761
+ * @throws Will throw an error if the fragment with the specified ID is not found.
1762
+ */
1763
+ resetColor(items: FRAGS.FragmentIdMap): void;
1764
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
1571
1765
  }
1572
1766
  import * as WEBIFC from "web-ifc";
1573
1767
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -1825,234 +2019,84 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1825
2019
  private registerChange;
1826
2020
  private newSingleProperty;
1827
2021
  }
1828
- import * as THREE from "three";
1829
- import { Component, Components } from "../../core";
1830
- /**
1831
- * Represents an edge measurement result.
1832
- */
1833
- export interface MeasureEdge {
2022
+ import * as WEBIFC from "web-ifc";
2023
+ /** Configuration of the IFC-fragment conversion. */
2024
+ export declare class IfcFragmentSettings {
2025
+ /** Whether to extract the IFC properties into a JSON. */
2026
+ includeProperties: boolean;
1834
2027
  /**
1835
- * The distance between the two points of the edge.
2028
+ * Generate the geometry for categories that are not included by default,
2029
+ * like IFCSPACE.
1836
2030
  */
1837
- distance: number;
2031
+ optionalCategories: number[];
2032
+ /** Whether to use the coordination data coming from the IFC files. */
2033
+ coordinate: boolean;
2034
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2035
+ wasm: {
2036
+ path: string;
2037
+ absolute: boolean;
2038
+ logLevel?: WEBIFC.LogLevel;
2039
+ };
2040
+ /** List of categories that won't be converted to fragments. */
2041
+ excludedCategories: Set<number>;
2042
+ /** Whether to save the absolute location of all IFC items. */
2043
+ saveLocations: boolean;
2044
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2045
+ webIfc: WEBIFC.LoaderSettings;
1838
2046
  /**
1839
- * The two points that define the edge.
2047
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2048
+ * If set to true, the path will be set to the default path of the WASM file.
2049
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
2050
+ * Default value is true.
1840
2051
  */
1841
- points: THREE.Vector3[];
2052
+ autoSetWasm: boolean;
2053
+ /**
2054
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2055
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2056
+ * If set to null, the default file location handler will be used.
2057
+ *
2058
+ * @param url - The URL of the file to locate.
2059
+ * @returns The absolute path of the file.
2060
+ */
2061
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2062
+ }
2063
+ import * as WEBIFC from "web-ifc";
2064
+ export interface IfcItemsCategories {
2065
+ [itemID: number]: number;
2066
+ }
2067
+ export declare class IfcCategories {
2068
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
1842
2069
  }
2070
+ import * as THREE from "three";
2071
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
1843
2072
  /**
1844
- * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
2073
+ * A class representing a 2D minimap of a 3D world.
1845
2074
  */
1846
- export declare class MeasurementUtils extends Component {
2075
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2076
+ /** {@link Disposable.onDisposed} */
2077
+ readonly onDisposed: Event<unknown>;
2078
+ /** {@link Updateable.onAfterUpdate} */
2079
+ readonly onAfterUpdate: Event<unknown>;
2080
+ /** {@link Updateable.onBeforeUpdate} */
2081
+ readonly onBeforeUpdate: Event<unknown>;
2082
+ /** {@link Resizeable.onResize} */
2083
+ readonly onResize: Event<THREE.Vector2>;
1847
2084
  /**
1848
- * A unique identifier for the component.
1849
- * This UUID is used to register the component within the Components system.
2085
+ * The front offset of the minimap.
2086
+ * It determines how much the minimap's view is offset from the camera's view.
2087
+ * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
1850
2088
  */
1851
- static uuid: string;
1852
- /** {@link Component.enabled} */
1853
- enabled: boolean;
1854
- constructor(components: Components);
2089
+ frontOffset: number;
1855
2090
  /**
1856
- * Utility method to calculate the distance from a point to a line segment.
1857
- *
1858
- * @param point - The point from which to calculate the distance.
1859
- * @param lineStart - The start point of the line segment.
1860
- * @param lineEnd - The end point of the line segment.
1861
- * @param clamp - If true, the distance will be clamped to the line segment's length.
1862
- * @returns The distance from the point to the line segment.
2091
+ * The override material for the minimap.
2092
+ * It is used to render the depth information of the world onto the minimap.
1863
2093
  */
1864
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
2094
+ overrideMaterial: THREE.MeshDepthMaterial;
1865
2095
  /**
1866
- * Method to get the face of a mesh that contains a given triangle index.
1867
- * It also returns the edges of the found face and their indices.
1868
- *
1869
- * @param mesh - The mesh to get the face from. It must be indexed.
1870
- * @param triangleIndex - The index of the triangle within the mesh.
1871
- * @param instance - The instance of the mesh (optional).
1872
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
2096
+ * The background color of the minimap.
2097
+ * It is used to set the background color of the minimap's renderer.
1873
2098
  */
1874
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1875
- edges: MeasureEdge[];
1876
- indices: Set<number>;
1877
- } | null;
1878
- /**
1879
- * Method to get the vertices and normal of a mesh face at a given index.
1880
- * It also applies instance transformation if provided.
1881
- *
1882
- * @param mesh - The mesh to get the face from. It must be indexed.
1883
- * @param faceIndex - The index of the face within the mesh.
1884
- * @param instance - The instance of the mesh (optional).
1885
- * @returns An object containing the vertices and normal of the face.
1886
- * @throws Will throw an error if the geometry is not indexed.
1887
- */
1888
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1889
- p1: THREE.Vector3;
1890
- p2: THREE.Vector3;
1891
- p3: THREE.Vector3;
1892
- faceNormal: THREE.Vector3;
1893
- };
1894
- /**
1895
- * Method to round the vector's components to a specified number of decimal places.
1896
- * This is used to ensure numerical precision in edge detection.
1897
- *
1898
- * @param vector - The vector to round.
1899
- * @returns The vector with rounded components.
1900
- */
1901
- round(vector: THREE.Vector3): void;
1902
- private getFaceData;
1903
- }
1904
- export declare class UUID {
1905
- private static _pattern;
1906
- private static _lut;
1907
- static create(): string;
1908
- static validate(uuid: string): void;
1909
- }
1910
- import * as THREE from "three";
1911
- import { Component, Components, Disposable, Event, World } from "../core";
1912
- /**
1913
- * Configuration interface for the VertexPicker component.
1914
- */
1915
- export interface VertexPickerConfig {
1916
- /**
1917
- * If true, only vertices will be picked, not the closest point on the face.
1918
- */
1919
- showOnlyVertex: boolean;
1920
- /**
1921
- * The maximum distance for snapping to a vertex.
1922
- */
1923
- snapDistance: number;
1924
- /**
1925
- * The HTML element to use for previewing the picked vertex.
1926
- */
1927
- previewElement: HTMLElement;
1928
- }
1929
- /**
1930
- * A class that provides functionality for picking vertices in a 3D scene.
1931
- */
1932
- export declare class VertexPicker extends Component implements Disposable {
1933
- /** {@link Disposable.onDisposed} */
1934
- readonly onDisposed: Event<unknown>;
1935
- /**
1936
- * An event that is triggered when a vertex is found.
1937
- * The event passes a THREE.Vector3 representing the position of the found vertex.
1938
- */
1939
- readonly onVertexFound: Event<THREE.Vector3>;
1940
- /**
1941
- * An event that is triggered when a vertex is lost.
1942
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
1943
- */
1944
- readonly onVertexLost: Event<THREE.Vector3>;
1945
- /**
1946
- * A reference to the Components instance associated with this VertexPicker.
1947
- */
1948
- components: Components;
1949
- /**
1950
- * A reference to the working plane used for vertex picking.
1951
- * This plane is used to determine which vertices are considered valid for picking.
1952
- * If this value is null, all vertices are considered valid.
1953
- */
1954
- workingPlane: THREE.Plane | null;
1955
- private _pickedPoint;
1956
- private _config;
1957
- private _enabled;
1958
- /**
1959
- * Sets the enabled state of the VertexPicker.
1960
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1961
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1962
- *
1963
- * @param value - The new enabled state.
1964
- */
1965
- set enabled(value: boolean);
1966
- /**
1967
- * Gets the current enabled state of the VertexPicker.
1968
- *
1969
- * @returns The current enabled state.
1970
- */
1971
- get enabled(): boolean;
1972
- /**
1973
- * Sets the configuration for the VertexPicker component.
1974
- *
1975
- * @param value - A Partial object containing the configuration properties to update.
1976
- * The properties not provided in the value object will retain their current values.
1977
- *
1978
- * @example
1979
- * '''typescript
1980
- * vertexPicker.config = {
1981
- * snapDistance: 0.5,
1982
- * showOnlyVertex: true,
1983
- * };
1984
- * '''
1985
- */
1986
- set config(value: Partial<VertexPickerConfig>);
1987
- /**
1988
- * Gets the current configuration for the VertexPicker component.
1989
- *
1990
- * @returns A copy of the current VertexPickerConfig object.
1991
- *
1992
- * @example
1993
- * '''typescript
1994
- * const currentConfig = vertexPicker.config;
1995
- * console.log(currentConfig.snapDistance); // Output: 0.25
1996
- * '''
1997
- */
1998
- get config(): Partial<VertexPickerConfig>;
1999
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
2000
- /** {@link Disposable.dispose} */
2001
- dispose(): void;
2002
- /**
2003
- * Performs the vertex picking operation based on the current state of the VertexPicker.
2004
- *
2005
- * @param world - The World instance to use for raycasting.
2006
- *
2007
- * @returns The current picked point, or null if no point is picked.
2008
- *
2009
- * @remarks
2010
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
2011
- * If enabled, it performs raycasting to find the closest intersecting object.
2012
- * It then determines the closest vertex or point on the face, based on the configuration settings.
2013
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
2014
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
2015
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
2016
- */
2017
- get(world: World): THREE.Vector3 | null;
2018
- private getClosestVertex;
2019
- private getVertices;
2020
- private getVertex;
2021
- }
2022
- /**
2023
- * A Set of unique numbers representing different types of IFC geometries.
2024
- */
2025
- export declare const GeometryTypes: Set<number>;
2026
- import * as THREE from "three";
2027
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2028
- /**
2029
- * A class representing a 2D minimap of a 3D world.
2030
- */
2031
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
2032
- /** {@link Disposable.onDisposed} */
2033
- readonly onDisposed: Event<unknown>;
2034
- /** {@link Updateable.onAfterUpdate} */
2035
- readonly onAfterUpdate: Event<unknown>;
2036
- /** {@link Updateable.onBeforeUpdate} */
2037
- readonly onBeforeUpdate: Event<unknown>;
2038
- /** {@link Resizeable.onResize} */
2039
- readonly onResize: Event<THREE.Vector2>;
2040
- /**
2041
- * The front offset of the minimap.
2042
- * It determines how much the minimap's view is offset from the camera's view.
2043
- * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
2044
- */
2045
- frontOffset: number;
2046
- /**
2047
- * The override material for the minimap.
2048
- * It is used to render the depth information of the world onto the minimap.
2049
- */
2050
- overrideMaterial: THREE.MeshDepthMaterial;
2051
- /**
2052
- * The background color of the minimap.
2053
- * It is used to set the background color of the minimap's renderer.
2054
- */
2055
- backgroundColor: THREE.Color;
2099
+ backgroundColor: THREE.Color;
2056
2100
  /**
2057
2101
  * The WebGL renderer for the minimap.
2058
2102
  * It is used to render the minimap onto the screen.
@@ -2112,67 +2156,12 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2112
2156
  resize(size?: THREE.Vector2): void;
2113
2157
  private updatePlanes;
2114
2158
  }
2115
- import { InverseAttribute } from "./types";
2116
- export declare const relToAttributesMap: Map<number, {
2117
- forRelating: InverseAttribute;
2118
- forRelated: InverseAttribute;
2119
- }>;
2120
- import * as WEBIFC from "web-ifc";
2121
- /** Configuration of the IFC-fragment conversion. */
2122
- export declare class IfcFragmentSettings {
2123
- /** Whether to extract the IFC properties into a JSON. */
2124
- includeProperties: boolean;
2125
- /**
2126
- * Generate the geometry for categories that are not included by default,
2127
- * like IFCSPACE.
2128
- */
2129
- optionalCategories: number[];
2130
- /** Whether to use the coordination data coming from the IFC files. */
2131
- coordinate: boolean;
2132
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2133
- wasm: {
2134
- path: string;
2135
- absolute: boolean;
2136
- logLevel?: WEBIFC.LogLevel;
2137
- };
2138
- /** List of categories that won't be converted to fragments. */
2139
- excludedCategories: Set<number>;
2140
- /** Whether to save the absolute location of all IFC items. */
2141
- saveLocations: boolean;
2142
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2143
- webIfc: WEBIFC.LoaderSettings;
2144
- /**
2145
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2146
- * If set to true, the path will be set to the default path of the WASM file.
2147
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2148
- * Default value is true.
2149
- */
2150
- autoSetWasm: boolean;
2151
- /**
2152
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2153
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2154
- * If set to null, the default file location handler will be used.
2155
- *
2156
- * @param url - The URL of the file to locate.
2157
- * @returns The absolute path of the file.
2158
- */
2159
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2160
- }
2161
- import * as WEBIFC from "web-ifc";
2162
- import { IfcItemsCategories } from "../../../ifc";
2163
- export declare class SpatialStructure {
2164
- itemsByFloor: IfcItemsCategories;
2165
- private _units;
2166
- setUp(webIfc: WEBIFC.IfcAPI): void;
2167
- cleanUp(): void;
2168
- }
2169
- import * as WEBIFC from "web-ifc";
2170
- export interface IfcItemsCategories {
2171
- [itemID: number]: number;
2172
- }
2173
- export declare class IfcCategories {
2174
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2175
- }
2159
+ /**
2160
+ * 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.
2161
+ */
2162
+ export declare const IfcCategoryMap: {
2163
+ [key: number]: string;
2164
+ };
2176
2165
  /**
2177
2166
  * 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.
2178
2167
  *
@@ -2184,19 +2173,21 @@ export declare class IfcCategories {
2184
2173
  export declare const IfcElements: {
2185
2174
  [key: number]: string;
2186
2175
  };
2187
- /**
2188
- * 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.
2189
- */
2190
- export declare const IfcCategoryMap: {
2191
- [key: number]: string;
2192
- };
2193
- import * as FRAGS from "@thatopen/fragments";
2194
- export declare class IfcPropertiesUtils {
2195
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2196
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2197
- [attribute: string]: any;
2198
- } | null>;
2199
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2176
+ import * as WEBIFC from "web-ifc";
2177
+ import { IfcItemsCategories } from "../../../ifc";
2178
+ export declare class SpatialStructure {
2179
+ itemsByFloor: IfcItemsCategories;
2180
+ private _units;
2181
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2182
+ cleanUp(): void;
2183
+ }
2184
+ import * as FRAGS from "@thatopen/fragments";
2185
+ export declare class IfcPropertiesUtils {
2186
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2187
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2188
+ [attribute: string]: any;
2189
+ } | null>;
2190
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2200
2191
  [relatingID: number]: number[];
2201
2192
  }>;
2202
2193
  static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
@@ -2216,60 +2207,26 @@ export declare class IfcPropertiesUtils {
2216
2207
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2217
2208
  }
2218
2209
  /**
2219
- * 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.
2210
+ * A Set of unique numbers representing different types of IFC geometries.
2220
2211
  */
2221
- export declare class AsyncEvent<T> {
2222
- /**
2223
- * Add a callback to this event instance.
2224
- * @param handler - the callback to be added to this event.
2225
- */
2226
- add(handler: T extends void ? {
2227
- (): Promise<void>;
2228
- } : {
2229
- (data: T): Promise<void>;
2230
- }): void;
2231
- /**
2232
- * Removes a callback from this event instance.
2233
- * @param handler - the callback to be removed from this event.
2234
- */
2235
- remove(handler: T extends void ? {
2236
- (): Promise<void>;
2237
- } : {
2238
- (data: T): Promise<void>;
2239
- }): void;
2240
- /** Triggers all the callbacks assigned to this event. */
2241
- trigger: (data?: T) => Promise<void>;
2242
- /** Gets rid of all the suscribed events. */
2243
- reset(): void;
2244
- private handlers;
2245
- }
2212
+ export declare const GeometryTypes: Set<number>;
2213
+ import { InverseAttribute } from "./types";
2214
+ export declare const relToAttributesMap: Map<number, {
2215
+ forRelating: InverseAttribute;
2216
+ forRelated: InverseAttribute;
2217
+ }>;
2218
+ import { Base } from "./base";
2246
2219
  /**
2247
- * 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.
2220
+ * 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.
2248
2221
  */
2249
- export declare class Event<T> {
2250
- /**
2251
- * Add a callback to this event instance.
2252
- * @param handler - the callback to be added to this event.
2253
- */
2254
- add(handler: T extends void ? {
2255
- (): void;
2256
- } : {
2257
- (data: T): void;
2258
- }): void;
2222
+ export declare abstract class Component extends Base {
2259
2223
  /**
2260
- * Removes a callback from this event instance.
2261
- * @param handler - the callback to be removed from this event.
2224
+ * Whether this component is active or not. The behaviour can vary depending
2225
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2226
+ * dimensions, while a disabled camera will stop moving. A disabled component
2227
+ * will not be updated automatically each frame.
2262
2228
  */
2263
- remove(handler: T extends void ? {
2264
- (): void;
2265
- } : {
2266
- (data: T): void;
2267
- }): void;
2268
- /** Triggers all the callbacks assigned to this event. */
2269
- trigger: (data?: T) => void;
2270
- /** Gets rid of all the suscribed events. */
2271
- reset(): void;
2272
- private handlers;
2229
+ abstract enabled: boolean;
2273
2230
  }
2274
2231
  import * as THREE from "three";
2275
2232
  import CameraControls from "camera-controls";
@@ -2379,6 +2336,62 @@ export interface CameraControllable {
2379
2336
  */
2380
2337
  controls: CameraControls;
2381
2338
  }
2339
+ /**
2340
+ * 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.
2341
+ */
2342
+ export declare class Event<T> {
2343
+ /**
2344
+ * Add a callback to this event instance.
2345
+ * @param handler - the callback to be added to this event.
2346
+ */
2347
+ add(handler: T extends void ? {
2348
+ (): void;
2349
+ } : {
2350
+ (data: T): void;
2351
+ }): void;
2352
+ /**
2353
+ * Removes a callback from this event instance.
2354
+ * @param handler - the callback to be removed from this event.
2355
+ */
2356
+ remove(handler: T extends void ? {
2357
+ (): void;
2358
+ } : {
2359
+ (data: T): void;
2360
+ }): void;
2361
+ /** Triggers all the callbacks assigned to this event. */
2362
+ trigger: (data?: T) => void;
2363
+ /** Gets rid of all the suscribed events. */
2364
+ reset(): void;
2365
+ private handlers;
2366
+ }
2367
+ /**
2368
+ * 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.
2369
+ */
2370
+ export declare class AsyncEvent<T> {
2371
+ /**
2372
+ * Add a callback to this event instance.
2373
+ * @param handler - the callback to be added to this event.
2374
+ */
2375
+ add(handler: T extends void ? {
2376
+ (): Promise<void>;
2377
+ } : {
2378
+ (data: T): Promise<void>;
2379
+ }): void;
2380
+ /**
2381
+ * Removes a callback from this event instance.
2382
+ * @param handler - the callback to be removed from this event.
2383
+ */
2384
+ remove(handler: T extends void ? {
2385
+ (): Promise<void>;
2386
+ } : {
2387
+ (data: T): Promise<void>;
2388
+ }): void;
2389
+ /** Triggers all the callbacks assigned to this event. */
2390
+ trigger: (data?: T) => Promise<void>;
2391
+ /** Gets rid of all the suscribed events. */
2392
+ reset(): void;
2393
+ private handlers;
2394
+ }
2382
2395
  import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2383
2396
  import { Components } from "../../Components";
2384
2397
  /**
@@ -2398,6 +2411,29 @@ export declare abstract class Base {
2398
2411
  /** Whether is component is {@link Configurable}. */
2399
2412
  isConfigurable: () => this is Configurable<any>;
2400
2413
  }
2414
+ import { Base } from "./base";
2415
+ import { World } from "./world";
2416
+ import { Event } from "./event";
2417
+ import { Components } from "../../Components";
2418
+ /**
2419
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2420
+ */
2421
+ export declare abstract class BaseWorldItem extends Base {
2422
+ readonly worlds: Map<string, World>;
2423
+ /**
2424
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2425
+ * The event payload contains the world instance and the action ("added" or "removed").
2426
+ */
2427
+ readonly onWorldChanged: Event<{
2428
+ world: World;
2429
+ action: "added" | "removed";
2430
+ }>;
2431
+ /**
2432
+ * The current world this item is associated with. It can be null if no world is currently active.
2433
+ */
2434
+ currentWorld: World | null;
2435
+ protected constructor(components: Components);
2436
+ }
2401
2437
  import * as THREE from "three";
2402
2438
  import CameraControls from "camera-controls";
2403
2439
  import { BaseWorldItem } from "./base-world-item";
@@ -2426,19 +2462,6 @@ export declare abstract class BaseCamera extends BaseWorldItem {
2426
2462
  */
2427
2463
  hasCameraControls: () => this is CameraControllable;
2428
2464
  }
2429
- import { Base } from "./base";
2430
- /**
2431
- * 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.
2432
- */
2433
- export declare abstract class Component extends Base {
2434
- /**
2435
- * Whether this component is active or not. The behaviour can vary depending
2436
- * on the type of component. E.g. a disabled dimension tool will stop creating
2437
- * dimensions, while a disabled camera will stop moving. A disabled component
2438
- * will not be updated automatically each frame.
2439
- */
2440
- abstract enabled: boolean;
2441
- }
2442
2465
  import * as THREE from "three";
2443
2466
  import { Vector2 } from "three";
2444
2467
  import { Event } from "./event";
@@ -2524,377 +2547,39 @@ export declare abstract class BaseScene extends BaseWorldItem implements Disposa
2524
2547
  /** {@link Disposable.dispose} */
2525
2548
  dispose(): void;
2526
2549
  }
2527
- import { Base } from "./base";
2528
- import { World } from "./world";
2529
- import { Event } from "./event";
2530
- import { Components } from "../../Components";
2531
- /**
2532
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2533
- */
2534
- export declare abstract class BaseWorldItem extends Base {
2535
- readonly worlds: Map<string, World>;
2536
- /**
2537
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2538
- * The event payload contains the world instance and the action ("added" or "removed").
2539
- */
2540
- readonly onWorldChanged: Event<{
2541
- world: World;
2542
- action: "added" | "removed";
2543
- }>;
2544
- /**
2545
- * The current world this item is associated with. It can be null if no world is currently active.
2546
- */
2547
- currentWorld: World | null;
2548
- protected constructor(components: Components);
2549
- }
2550
2550
  import * as THREE from "three";
2551
2551
  import { BaseScene } from "./base-scene";
2552
2552
  import { BaseCamera } from "./base-camera";
2553
- import { BaseRenderer } from "./base-renderer";
2554
- import { Updateable, Disposable } from "./interfaces";
2555
- /**
2556
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2557
- */
2558
- export interface World extends Disposable, Updateable {
2559
- /**
2560
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
2561
- */
2562
- meshes: Set<THREE.Mesh>;
2563
- /**
2564
- * The base scene of the world.
2565
- */
2566
- scene: BaseScene;
2567
- /**
2568
- * The base camera of the world.
2569
- */
2570
- camera: BaseCamera;
2571
- /**
2572
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2573
- */
2574
- renderer: BaseRenderer | null;
2575
- /**
2576
- * A unique identifier for the world.
2577
- */
2578
- uuid: string;
2579
- /**
2580
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2581
- */
2582
- isDisposing: boolean;
2583
- }
2584
- import * as THREE from "three";
2585
- import { Hideable, Event, World, Disposable } from "../../Types";
2586
- import { Components } from "../../Components";
2587
- /**
2588
- * Configuration interface for the {@link SimpleGrid} class.
2589
- */
2590
- export interface GridConfig {
2591
- /**
2592
- * The color of the grid lines.
2593
- */
2594
- color: THREE.Color;
2595
- /**
2596
- * The size of the primary grid lines.
2597
- */
2598
- size1: number;
2599
- /**
2600
- * The size of the secondary grid lines.
2601
- */
2602
- size2: number;
2603
- /**
2604
- * The distance at which the grid lines start to fade away.
2605
- */
2606
- distance: number;
2607
- }
2608
- /**
2609
- * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
2610
- */
2611
- export declare class SimpleGrid implements Hideable, Disposable {
2612
- /** {@link Disposable.onDisposed} */
2613
- readonly onDisposed: Event<unknown>;
2614
- /** The world instance to which this Raycaster belongs. */
2615
- world: World;
2616
- /** The components instance to which this grid belongs. */
2617
- components: Components;
2618
- /** {@link Hideable.visible} */
2619
- get visible(): boolean;
2620
- /** {@link Hideable.visible} */
2621
- set visible(visible: boolean);
2622
- /** The material of the grid. */
2623
- get material(): THREE.ShaderMaterial;
2624
- /**
2625
- * Whether the grid should fade away with distance. Recommended to be true for
2626
- * perspective cameras and false for orthographic cameras.
2627
- */
2628
- get fade(): boolean;
2629
- /**
2630
- * Whether the grid should fade away with distance. Recommended to be true for
2631
- * perspective cameras and false for orthographic cameras.
2632
- */
2633
- set fade(active: boolean);
2634
- /** The Three.js mesh that contains the infinite grid. */
2635
- readonly three: THREE.Mesh;
2636
- private _fade;
2637
- constructor(components: Components, world: World, config: GridConfig);
2638
- /** {@link Disposable.dispose} */
2639
- dispose(): void;
2640
- private setupEvents;
2641
- private updateZoom;
2642
- }
2643
- import * as THREE from "three";
2644
- import { Components } from "../../Components";
2645
- import { AsyncEvent, Event, World } from "../../Types";
2646
- /**
2647
- * Settings to configure the CullerRenderer.
2648
- */
2649
- export interface CullerRendererSettings {
2650
- /**
2651
- * Interval in milliseconds at which the visibility check should be performed.
2652
- * Default value is 1000.
2653
- */
2654
- updateInterval?: number;
2655
- /**
2656
- * Width of the render target used for visibility checks.
2657
- * Default value is 512.
2658
- */
2659
- width?: number;
2660
- /**
2661
- * Height of the render target used for visibility checks.
2662
- * Default value is 512.
2663
- */
2664
- height?: number;
2665
- /**
2666
- * Whether the visibility check should be performed automatically.
2667
- * Default value is true.
2668
- */
2669
- autoUpdate?: boolean;
2670
- }
2671
- /**
2672
- * A base renderer to determine visibility on screen.
2673
- */
2674
- export declare class CullerRenderer {
2675
- /** {@link Disposable.onDisposed} */
2676
- readonly onDisposed: Event<string>;
2677
- /**
2678
- * Fires after making the visibility check to the meshes. It lists the
2679
- * meshes that are currently visible, and the ones that were visible
2680
- * just before but not anymore.
2681
- */
2682
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2683
- /**
2684
- * Whether this renderer is active or not. If not, it won't render anything.
2685
- */
2686
- enabled: boolean;
2687
- /**
2688
- * Needs to check whether there are objects that need to be hidden or shown.
2689
- * You can bind this to the camera movement, to a certain interval, etc.
2690
- */
2691
- needsUpdate: boolean;
2692
- /**
2693
- * Render the internal scene used to determine the object visibility. Used
2694
- * for debugging purposes.
2695
- */
2696
- renderDebugFrame: boolean;
2697
- /** The components instance to which this renderer belongs. */
2698
- components: Components;
2699
- /** The world instance to which this renderer belongs. */
2700
- readonly world: World;
2701
- /** The THREE.js renderer used to make the visibility test. */
2702
- readonly renderer: THREE.WebGLRenderer;
2703
- protected autoUpdate: boolean;
2704
- protected updateInterval: number;
2705
- protected readonly worker: Worker;
2706
- protected readonly scene: THREE.Scene;
2707
- private _width;
2708
- private _height;
2709
- private _availableColor;
2710
- private readonly renderTarget;
2711
- private readonly bufferSize;
2712
- private readonly _buffer;
2713
- protected _isWorkerBusy: boolean;
2714
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2715
- /** {@link Disposable.dispose} */
2716
- dispose(): void;
2717
- /**
2718
- * The function that the culler uses to reprocess the scene. Generally it's
2719
- * better to call needsUpdate, but you can also call this to force it.
2720
- * @param force if true, it will refresh the scene even if needsUpdate is
2721
- * not true.
2722
- */
2723
- updateVisibility: (force?: boolean) => Promise<void>;
2724
- protected getAvailableColor(): {
2725
- r: number;
2726
- g: number;
2727
- b: number;
2728
- code: string;
2729
- };
2730
- protected increaseColor(): void;
2731
- protected decreaseColor(): void;
2732
- private applySettings;
2733
- }
2734
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2735
- import { IfcFragmentSettings } from "../../IfcLoader/src";
2736
- /**
2737
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
2738
- */
2739
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2740
- /**
2741
- * Amount of properties to be streamed.
2742
- * Defaults to 100 properties.
2743
- */
2744
- propertiesSize: number;
2745
- }
2746
- import * as THREE from "three";
2747
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2748
- import { Components } from "../../Components";
2749
- import { Event, World, Disposable } from "../../Types";
2750
- /**
2751
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2752
- */
2753
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2754
- /**
2755
- * Event triggered when the visibility of meshes is updated.
2756
- * Contains two sets: seen and unseen.
2757
- */
2758
- readonly onViewUpdated: Event<{
2759
- seen: Set<THREE.Mesh>;
2760
- unseen: Set<THREE.Mesh>;
2761
- }>;
2762
- /**
2763
- * Pixels in screen a geometry must occupy to be considered "seen".
2764
- * Default value is 100.
2765
- */
2766
- threshold: number;
2767
- /**
2768
- * Map of color code to THREE.InstancedMesh.
2769
- * Used to keep track of color-coded meshes.
2770
- */
2771
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2772
- /**
2773
- * Flag to indicate if the renderer is currently processing.
2774
- * Used to prevent concurrent processing.
2775
- */
2776
- isProcessing: boolean;
2777
- private _colorCodeMeshMap;
2778
- private _meshIDColorCodeMap;
2779
- private _currentVisibleMeshes;
2780
- private _recentlyHiddenMeshes;
2781
- private _intervalID;
2782
- private readonly _transparentMat;
2783
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2784
- /** {@link Disposable.dispose} */
2785
- dispose(): void;
2786
- /**
2787
- * 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.
2788
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2789
- * @returns {void}
2790
- */
2791
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2792
- /**
2793
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2794
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2795
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2796
- * @returns {void}
2797
- */
2798
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2799
- private handleWorkerMessage;
2800
- private getAvailableMaterial;
2801
- }
2802
- import * as THREE from "three";
2803
- import { Hideable, Disposable, Event, World } from "../../Types";
2804
- import { Components } from "../../Components";
2553
+ import { BaseRenderer } from "./base-renderer";
2554
+ import { Updateable, Disposable } from "./interfaces";
2805
2555
  /**
2806
- * Each of the clipping planes created by the clipper.
2556
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2807
2557
  */
2808
- export declare class SimplePlane implements Disposable, Hideable {
2809
- /** Event that fires when the user starts dragging a clipping plane. */
2810
- readonly onDraggingStarted: Event<unknown>;
2811
- /** Event that fires when the user stops dragging a clipping plane. */
2812
- readonly onDraggingEnded: Event<unknown>;
2813
- /** {@link Disposable.onDisposed} */
2814
- readonly onDisposed: Event<unknown>;
2815
- /**
2816
- * The normal vector of the clipping plane.
2817
- */
2818
- readonly normal: THREE.Vector3;
2558
+ export interface World extends Disposable, Updateable {
2819
2559
  /**
2820
- * The origin point of the clipping plane.
2560
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
2821
2561
  */
2822
- readonly origin: THREE.Vector3;
2562
+ meshes: Set<THREE.Mesh>;
2823
2563
  /**
2824
- * The THREE.js Plane object representing the clipping plane.
2564
+ * The base scene of the world.
2825
2565
  */
2826
- readonly three: THREE.Plane;
2827
- /** The components instance to which this plane belongs. */
2828
- components: Components;
2829
- /** The world instance to which this plane belongs. */
2830
- world: World;
2831
- protected readonly _helper: THREE.Object3D;
2832
- protected _visible: boolean;
2833
- protected _enabled: boolean;
2834
- private _controlsActive;
2835
- private readonly _arrowBoundBox;
2836
- private readonly _planeMesh;
2837
- private readonly _controls;
2838
- private readonly _hiddenMaterial;
2566
+ scene: BaseScene;
2839
2567
  /**
2840
- * Getter for the enabled state of the clipping plane.
2841
- * @returns {boolean} The current enabled state.
2568
+ * The base camera of the world.
2842
2569
  */
2843
- get enabled(): boolean;
2570
+ camera: BaseCamera;
2844
2571
  /**
2845
- * Setter for the enabled state of the clipping plane.
2846
- * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
2847
- * @param {boolean} state - The new enabled state.
2572
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2848
2573
  */
2849
- set enabled(state: boolean);
2850
- /** {@link Hideable.visible } */
2851
- get visible(): boolean;
2852
- /** {@link Hideable.visible } */
2853
- set visible(state: boolean);
2854
- /** The meshes used for raycasting */
2855
- get meshes(): THREE.Mesh[];
2856
- /** The material of the clipping plane representation. */
2857
- get planeMaterial(): THREE.Material | THREE.Material[];
2858
- /** The material of the clipping plane representation. */
2859
- set planeMaterial(material: THREE.Material | THREE.Material[]);
2860
- /** The size of the clipping plane representation. */
2861
- get size(): number;
2862
- /** Sets the size of the clipping plane representation. */
2863
- set size(size: number);
2574
+ renderer: BaseRenderer | null;
2864
2575
  /**
2865
- * Getter for the helper object of the clipping plane.
2866
- * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
2867
- * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
2868
- *
2869
- * @returns {THREE.Object3D} The helper object of the clipping plane.
2576
+ * A unique identifier for the world.
2870
2577
  */
2871
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
2872
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
2578
+ uuid: string;
2873
2579
  /**
2874
- * Sets the clipping plane's normal and origin from the given normal and point.
2875
- * This method resets the clipping plane's state, updates the normal and origin,
2876
- * and positions the helper object accordingly.
2877
- *
2878
- * @param normal - The new normal vector for the clipping plane.
2879
- * @param point - The new origin point for the clipping plane.
2880
- *
2881
- * @returns {void}
2580
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2882
2581
  */
2883
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
2884
- /** {@link Updateable.update} */
2885
- update: () => void;
2886
- /** {@link Disposable.dispose} */
2887
- dispose(): void;
2888
- private reset;
2889
- protected toggleControls(state: boolean): void;
2890
- private newTransformControls;
2891
- private initializeControls;
2892
- private createArrowBoundingBox;
2893
- private changeDrag;
2894
- private notifyDraggingChanged;
2895
- private preventCameraMovement;
2896
- private newHelper;
2897
- private static newPlaneMesh;
2582
+ isDisposing: boolean;
2898
2583
  }
2899
2584
  import * as THREE from "three";
2900
2585
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
@@ -2993,80 +2678,253 @@ export interface SimpleSceneConfig {
2993
2678
  };
2994
2679
  }
2995
2680
  /**
2996
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2681
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2682
+ */
2683
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2684
+ /** {@link Configurable.isSetup} */
2685
+ isSetup: boolean;
2686
+ /**
2687
+ * The underlying Three.js scene object.
2688
+ * It is used to define the 3D space containing objects, lights, and cameras.
2689
+ */
2690
+ three: THREE.Scene;
2691
+ /** {@link Configurable.onSetup} */
2692
+ readonly onSetup: Event<SimpleScene>;
2693
+ /**
2694
+ * Configuration interface for the {@link SimpleScene}.
2695
+ * Defines properties for directional and ambient lights.
2696
+ */
2697
+ config: Required<SimpleSceneConfig>;
2698
+ constructor(components: Components);
2699
+ /** {@link Configurable.setup} */
2700
+ setup(config?: Partial<SimpleSceneConfig>): void;
2701
+ }
2702
+ import * as THREE from "three";
2703
+ import { BaseRenderer, Event } from "../../Types";
2704
+ import { Components } from "../../Components";
2705
+ /**
2706
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2707
+ */
2708
+ export declare class SimpleRenderer extends BaseRenderer {
2709
+ /**
2710
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2711
+ * Default is 'true'.
2712
+ */
2713
+ enabled: boolean;
2714
+ /**
2715
+ * The HTML container of the THREE.js canvas where the scene is rendered.
2716
+ */
2717
+ container: HTMLElement;
2718
+ /**
2719
+ * The THREE.js WebGLRenderer instance.
2720
+ */
2721
+ three: THREE.WebGLRenderer;
2722
+ protected _canvas: HTMLCanvasElement;
2723
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2724
+ protected _resizeObserver: ResizeObserver | null;
2725
+ protected onContainerUpdated: Event<unknown>;
2726
+ private _resizing;
2727
+ /**
2728
+ * Constructor for the SimpleRenderer class.
2729
+ *
2730
+ * @param components - The components instance.
2731
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
2732
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2733
+ */
2734
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
2735
+ /** {@link Updateable.update} */
2736
+ update(): void;
2737
+ /** {@link Disposable.dispose} */
2738
+ dispose(): void;
2739
+ /** {@link Resizeable.getSize}. */
2740
+ getSize(): THREE.Vector2;
2741
+ /** {@link Resizeable.resize} */
2742
+ resize: (size?: THREE.Vector2) => void;
2743
+ /**
2744
+ * Sets up and manages the event listeners for the renderer.
2745
+ *
2746
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
2747
+ *
2748
+ * @throws Will throw an error if the renderer does not have an HTML container.
2749
+ */
2750
+ setupEvents(active: boolean): void;
2751
+ private resizeEvent;
2752
+ private setupRenderer;
2753
+ private onContextLost;
2754
+ private onContextBack;
2755
+ }
2756
+ import * as THREE from "three";
2757
+ import { Hideable, Event, World, Disposable } from "../../Types";
2758
+ import { Components } from "../../Components";
2759
+ /**
2760
+ * Configuration interface for the {@link SimpleGrid} class.
2761
+ */
2762
+ export interface GridConfig {
2763
+ /**
2764
+ * The color of the grid lines.
2765
+ */
2766
+ color: THREE.Color;
2767
+ /**
2768
+ * The size of the primary grid lines.
2769
+ */
2770
+ size1: number;
2771
+ /**
2772
+ * The size of the secondary grid lines.
2773
+ */
2774
+ size2: number;
2775
+ /**
2776
+ * The distance at which the grid lines start to fade away.
2777
+ */
2778
+ distance: number;
2779
+ }
2780
+ /**
2781
+ * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
2782
+ */
2783
+ export declare class SimpleGrid implements Hideable, Disposable {
2784
+ /** {@link Disposable.onDisposed} */
2785
+ readonly onDisposed: Event<unknown>;
2786
+ /** The world instance to which this Raycaster belongs. */
2787
+ world: World;
2788
+ /** The components instance to which this grid belongs. */
2789
+ components: Components;
2790
+ /** {@link Hideable.visible} */
2791
+ get visible(): boolean;
2792
+ /** {@link Hideable.visible} */
2793
+ set visible(visible: boolean);
2794
+ /** The material of the grid. */
2795
+ get material(): THREE.ShaderMaterial;
2796
+ /**
2797
+ * Whether the grid should fade away with distance. Recommended to be true for
2798
+ * perspective cameras and false for orthographic cameras.
2799
+ */
2800
+ get fade(): boolean;
2801
+ /**
2802
+ * Whether the grid should fade away with distance. Recommended to be true for
2803
+ * perspective cameras and false for orthographic cameras.
2804
+ */
2805
+ set fade(active: boolean);
2806
+ /** The Three.js mesh that contains the infinite grid. */
2807
+ readonly three: THREE.Mesh;
2808
+ private _fade;
2809
+ constructor(components: Components, world: World, config: GridConfig);
2810
+ /** {@link Disposable.dispose} */
2811
+ dispose(): void;
2812
+ private setupEvents;
2813
+ private updateZoom;
2814
+ }
2815
+ import * as THREE from "three";
2816
+ import { Disposable, Event } from "../../Types";
2817
+ /**
2818
+ * 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.
2819
+ */
2820
+ export declare class Mouse implements Disposable {
2821
+ dom: HTMLCanvasElement;
2822
+ private _event?;
2823
+ private _position;
2824
+ /** {@link Disposable.onDisposed} */
2825
+ readonly onDisposed: Event<unknown>;
2826
+ constructor(dom: HTMLCanvasElement);
2827
+ /**
2828
+ * The real position of the mouse of the Three.js canvas.
2829
+ */
2830
+ get position(): THREE.Vector2;
2831
+ /** {@link Disposable.dispose} */
2832
+ dispose(): void;
2833
+ private getPositionY;
2834
+ private getPositionX;
2835
+ private updateMouseInfo;
2836
+ private setupEvents;
2837
+ }
2838
+ import * as THREE from "three";
2839
+ import { Components } from "../../Components";
2840
+ import { AsyncEvent, Event, World } from "../../Types";
2841
+ /**
2842
+ * Settings to configure the CullerRenderer.
2997
2843
  */
2998
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2999
- /** {@link Configurable.isSetup} */
3000
- isSetup: boolean;
2844
+ export interface CullerRendererSettings {
3001
2845
  /**
3002
- * The underlying Three.js scene object.
3003
- * It is used to define the 3D space containing objects, lights, and cameras.
2846
+ * Interval in milliseconds at which the visibility check should be performed.
2847
+ * Default value is 1000.
3004
2848
  */
3005
- three: THREE.Scene;
3006
- /** {@link Configurable.onSetup} */
3007
- readonly onSetup: Event<SimpleScene>;
2849
+ updateInterval?: number;
3008
2850
  /**
3009
- * Configuration interface for the {@link SimpleScene}.
3010
- * Defines properties for directional and ambient lights.
2851
+ * Width of the render target used for visibility checks.
2852
+ * Default value is 512.
3011
2853
  */
3012
- config: Required<SimpleSceneConfig>;
3013
- constructor(components: Components);
3014
- /** {@link Configurable.setup} */
3015
- setup(config?: Partial<SimpleSceneConfig>): void;
2854
+ width?: number;
2855
+ /**
2856
+ * Height of the render target used for visibility checks.
2857
+ * Default value is 512.
2858
+ */
2859
+ height?: number;
2860
+ /**
2861
+ * Whether the visibility check should be performed automatically.
2862
+ * Default value is true.
2863
+ */
2864
+ autoUpdate?: boolean;
3016
2865
  }
3017
- import * as THREE from "three";
3018
- import { BaseRenderer, Event } from "../../Types";
3019
- import { Components } from "../../Components";
3020
2866
  /**
3021
- * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2867
+ * A base renderer to determine visibility on screen.
3022
2868
  */
3023
- export declare class SimpleRenderer extends BaseRenderer {
2869
+ export declare class CullerRenderer {
2870
+ /** {@link Disposable.onDisposed} */
2871
+ readonly onDisposed: Event<string>;
3024
2872
  /**
3025
- * Indicates whether the renderer is enabled. If it's not, it won't be updated.
3026
- * Default is 'true'.
2873
+ * Fires after making the visibility check to the meshes. It lists the
2874
+ * meshes that are currently visible, and the ones that were visible
2875
+ * just before but not anymore.
3027
2876
  */
3028
- enabled: boolean;
2877
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3029
2878
  /**
3030
- * The HTML container of the THREE.js canvas where the scene is rendered.
2879
+ * Whether this renderer is active or not. If not, it won't render anything.
3031
2880
  */
3032
- container: HTMLElement;
2881
+ enabled: boolean;
3033
2882
  /**
3034
- * The THREE.js WebGLRenderer instance.
2883
+ * Needs to check whether there are objects that need to be hidden or shown.
2884
+ * You can bind this to the camera movement, to a certain interval, etc.
3035
2885
  */
3036
- three: THREE.WebGLRenderer;
3037
- protected _canvas: HTMLCanvasElement;
3038
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
3039
- protected _resizeObserver: ResizeObserver | null;
3040
- protected onContainerUpdated: Event<unknown>;
3041
- private _resizing;
2886
+ needsUpdate: boolean;
3042
2887
  /**
3043
- * Constructor for the SimpleRenderer class.
3044
- *
3045
- * @param components - The components instance.
3046
- * @param container - The HTML container where the THREE.js canvas will be rendered.
3047
- * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
2888
+ * Render the internal scene used to determine the object visibility. Used
2889
+ * for debugging purposes.
3048
2890
  */
3049
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
3050
- /** {@link Updateable.update} */
3051
- update(): void;
2891
+ renderDebugFrame: boolean;
2892
+ /** The components instance to which this renderer belongs. */
2893
+ components: Components;
2894
+ /** The world instance to which this renderer belongs. */
2895
+ readonly world: World;
2896
+ /** The THREE.js renderer used to make the visibility test. */
2897
+ readonly renderer: THREE.WebGLRenderer;
2898
+ protected autoUpdate: boolean;
2899
+ protected updateInterval: number;
2900
+ protected readonly worker: Worker;
2901
+ protected readonly scene: THREE.Scene;
2902
+ private _width;
2903
+ private _height;
2904
+ private _availableColor;
2905
+ private readonly renderTarget;
2906
+ private readonly bufferSize;
2907
+ private readonly _buffer;
2908
+ protected _isWorkerBusy: boolean;
2909
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
3052
2910
  /** {@link Disposable.dispose} */
3053
2911
  dispose(): void;
3054
- /** {@link Resizeable.getSize}. */
3055
- getSize(): THREE.Vector2;
3056
- /** {@link Resizeable.resize} */
3057
- resize: (size?: THREE.Vector2) => void;
3058
2912
  /**
3059
- * Sets up and manages the event listeners for the renderer.
3060
- *
3061
- * @param active - A boolean indicating whether to activate or deactivate the event listeners.
3062
- *
3063
- * @throws Will throw an error if the renderer does not have an HTML container.
2913
+ * The function that the culler uses to reprocess the scene. Generally it's
2914
+ * better to call needsUpdate, but you can also call this to force it.
2915
+ * @param force if true, it will refresh the scene even if needsUpdate is
2916
+ * not true.
3064
2917
  */
3065
- setupEvents(active: boolean): void;
3066
- private resizeEvent;
3067
- private setupRenderer;
3068
- private onContextLost;
3069
- private onContextBack;
2918
+ updateVisibility: (force?: boolean) => Promise<void>;
2919
+ protected getAvailableColor(): {
2920
+ r: number;
2921
+ g: number;
2922
+ b: number;
2923
+ code: string;
2924
+ };
2925
+ protected increaseColor(): void;
2926
+ protected decreaseColor(): void;
2927
+ private applySettings;
3070
2928
  }
3071
2929
  import * as THREE from "three";
3072
2930
  import CameraControls from "camera-controls";
@@ -3130,6 +2988,63 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
3130
2988
  private setupEvents;
3131
2989
  private static getSubsetOfThree;
3132
2990
  }
2991
+ import * as THREE from "three";
2992
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2993
+ import { Components } from "../../Components";
2994
+ import { Event, World, Disposable } from "../../Types";
2995
+ /**
2996
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2997
+ */
2998
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2999
+ /**
3000
+ * Event triggered when the visibility of meshes is updated.
3001
+ * Contains two sets: seen and unseen.
3002
+ */
3003
+ readonly onViewUpdated: Event<{
3004
+ seen: Set<THREE.Mesh>;
3005
+ unseen: Set<THREE.Mesh>;
3006
+ }>;
3007
+ /**
3008
+ * Pixels in screen a geometry must occupy to be considered "seen".
3009
+ * Default value is 100.
3010
+ */
3011
+ threshold: number;
3012
+ /**
3013
+ * Map of color code to THREE.InstancedMesh.
3014
+ * Used to keep track of color-coded meshes.
3015
+ */
3016
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3017
+ /**
3018
+ * Flag to indicate if the renderer is currently processing.
3019
+ * Used to prevent concurrent processing.
3020
+ */
3021
+ isProcessing: boolean;
3022
+ private _colorCodeMeshMap;
3023
+ private _meshIDColorCodeMap;
3024
+ private _currentVisibleMeshes;
3025
+ private _recentlyHiddenMeshes;
3026
+ private _intervalID;
3027
+ private readonly _transparentMat;
3028
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
3029
+ /** {@link Disposable.dispose} */
3030
+ dispose(): void;
3031
+ /**
3032
+ * 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.
3033
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3034
+ * @returns {void}
3035
+ */
3036
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3037
+ /**
3038
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3039
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3040
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3041
+ * @returns {void}
3042
+ */
3043
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3044
+ private handleWorkerMessage;
3045
+ private getAvailableMaterial;
3046
+ }
3047
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3133
3048
  import { NavigationMode } from "./types";
3134
3049
  import { OrthoPerspectiveCamera } from "../index";
3135
3050
  /**
@@ -3148,22 +3063,6 @@ export declare class FirstPersonMode implements NavigationMode {
3148
3063
  }
3149
3064
  import { NavigationMode } from "./types";
3150
3065
  import { OrthoPerspectiveCamera } from "../index";
3151
- /**
3152
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3153
- */
3154
- export declare class OrbitMode implements NavigationMode {
3155
- camera: OrthoPerspectiveCamera;
3156
- /** {@link NavigationMode.enabled} */
3157
- enabled: boolean;
3158
- /** {@link NavigationMode.id} */
3159
- readonly id = "Orbit";
3160
- constructor(camera: OrthoPerspectiveCamera);
3161
- /** {@link NavigationMode.set} */
3162
- set(active: boolean): void;
3163
- private activateOrbitControls;
3164
- }
3165
- import { NavigationMode } from "./types";
3166
- import { OrthoPerspectiveCamera } from "../index";
3167
3066
  /**
3168
3067
  * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3169
3068
  */
@@ -3182,32 +3081,6 @@ export declare class PlanMode implements NavigationMode {
3182
3081
  /** {@link NavigationMode.set} */
3183
3082
  set(active: boolean): void;
3184
3083
  }
3185
- /**
3186
- * The projection system of the camera.
3187
- */
3188
- export type CameraProjection = "Perspective" | "Orthographic";
3189
- /**
3190
- * The extensible list of supported navigation modes.
3191
- */
3192
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3193
- /**
3194
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3195
- */
3196
- export interface NavigationMode {
3197
- /** The unique ID of this navigation mode. */
3198
- id: NavModeID;
3199
- /**
3200
- * Enable or disable this navigation mode.
3201
- * When a new navigation mode is enabled, the previous navigation mode
3202
- * must be disabled.
3203
- *
3204
- * @param active - whether to enable or disable this mode.
3205
- * @param options - any additional data required to enable or disable it.
3206
- * */
3207
- set: (active: boolean, options?: any) => void;
3208
- /** Whether this navigation mode is active or not. */
3209
- enabled: boolean;
3210
- }
3211
3084
  import * as THREE from "three";
3212
3085
  import { CameraProjection } from "./types";
3213
3086
  import { Event } from "../../Types";
@@ -3251,95 +3124,130 @@ export declare class ProjectionManager {
3251
3124
  private getPerspectiveDims;
3252
3125
  private setupOrthoCamera;
3253
3126
  private getDistance;
3254
- private setPerspectiveCamera;
3255
- }
3256
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3257
- /**
3258
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3259
- */
3260
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
3261
- /**
3262
- * Minimum number of geometries to be streamed.
3263
- * Defaults to 10 geometries.
3264
- */
3265
- minGeometrySize: number;
3266
- /**
3267
- * Minimum amount of assets to be streamed.
3268
- * Defaults to 1000 assets.
3269
- */
3270
- minAssetsSize: number;
3271
- }
3272
- import * as THREE from "three";
3273
- import * as WEBIFC from "web-ifc";
3274
- import * as FRAGS from "@thatopen/fragments";
3275
- export declare class CivilReader {
3276
- defLineMat: THREE.LineBasicMaterial;
3277
- read(webIfc: WEBIFC.IfcAPI): {
3278
- alignments: Map<number, FRAGS.Alignment>;
3279
- coordinationMatrix: THREE.Matrix4;
3280
- } | undefined;
3281
- get(civilItems: any): {
3282
- alignments: Map<number, FRAGS.Alignment>;
3283
- coordinationMatrix: THREE.Matrix4;
3284
- } | undefined;
3285
- private getCurves;
3286
- }
3287
- import * as WEBIFC from "web-ifc";
3288
- export declare class IfcMetadataReader {
3289
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3290
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3127
+ private setPerspectiveCamera;
3291
3128
  }
3292
3129
  /**
3293
- * 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.
3130
+ * The projection system of the camera.
3294
3131
  */
3295
- export interface StreamedGeometries {
3296
- [id: number]: {
3297
- /** The bounding box of the geometry as a Float32Array. */
3298
- boundingBox: Float32Array;
3299
- /** A boolean indicating whether the geometry has holes. */
3300
- hasHoles: boolean;
3301
- /** An optional file path for the geometry data. */
3302
- geometryFile?: string;
3303
- };
3304
- }
3132
+ export type CameraProjection = "Perspective" | "Orthographic";
3305
3133
  /**
3306
- * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
3134
+ * The extensible list of supported navigation modes.
3307
3135
  */
3308
- export interface StreamedAsset {
3309
- /** The unique identifier of the asset. */
3310
- id: number;
3311
- /** An array of geometries associated with the asset. */
3312
- geometries: {
3313
- /** The unique identifier of the geometry. */
3314
- geometryID: number;
3315
- /** The transformation matrix of the geometry as a number array. */
3316
- transformation: number[];
3317
- /** The color of the geometry as a number array. */
3318
- color: number[];
3319
- }[];
3136
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3137
+ /**
3138
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3139
+ */
3140
+ export interface NavigationMode {
3141
+ /** The unique ID of this navigation mode. */
3142
+ id: NavModeID;
3143
+ /**
3144
+ * Enable or disable this navigation mode.
3145
+ * When a new navigation mode is enabled, the previous navigation mode
3146
+ * must be disabled.
3147
+ *
3148
+ * @param active - whether to enable or disable this mode.
3149
+ * @param options - any additional data required to enable or disable it.
3150
+ * */
3151
+ set: (active: boolean, options?: any) => void;
3152
+ /** Whether this navigation mode is active or not. */
3153
+ enabled: boolean;
3320
3154
  }
3321
3155
  import * as THREE from "three";
3322
- import { Disposable, Event } from "../../Types";
3156
+ import { Hideable, Disposable, Event, World } from "../../Types";
3157
+ import { Components } from "../../Components";
3323
3158
  /**
3324
- * 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.
3159
+ * Each of the clipping planes created by the clipper.
3325
3160
  */
3326
- export declare class Mouse implements Disposable {
3327
- dom: HTMLCanvasElement;
3328
- private _event?;
3329
- private _position;
3161
+ export declare class SimplePlane implements Disposable, Hideable {
3162
+ /** Event that fires when the user starts dragging a clipping plane. */
3163
+ readonly onDraggingStarted: Event<unknown>;
3164
+ /** Event that fires when the user stops dragging a clipping plane. */
3165
+ readonly onDraggingEnded: Event<unknown>;
3330
3166
  /** {@link Disposable.onDisposed} */
3331
3167
  readonly onDisposed: Event<unknown>;
3332
- constructor(dom: HTMLCanvasElement);
3333
3168
  /**
3334
- * The real position of the mouse of the Three.js canvas.
3169
+ * The normal vector of the clipping plane.
3335
3170
  */
3336
- get position(): THREE.Vector2;
3171
+ readonly normal: THREE.Vector3;
3172
+ /**
3173
+ * The origin point of the clipping plane.
3174
+ */
3175
+ readonly origin: THREE.Vector3;
3176
+ /**
3177
+ * The THREE.js Plane object representing the clipping plane.
3178
+ */
3179
+ readonly three: THREE.Plane;
3180
+ /** The components instance to which this plane belongs. */
3181
+ components: Components;
3182
+ /** The world instance to which this plane belongs. */
3183
+ world: World;
3184
+ protected readonly _helper: THREE.Object3D;
3185
+ protected _visible: boolean;
3186
+ protected _enabled: boolean;
3187
+ private _controlsActive;
3188
+ private readonly _arrowBoundBox;
3189
+ private readonly _planeMesh;
3190
+ private readonly _controls;
3191
+ private readonly _hiddenMaterial;
3192
+ /**
3193
+ * Getter for the enabled state of the clipping plane.
3194
+ * @returns {boolean} The current enabled state.
3195
+ */
3196
+ get enabled(): boolean;
3197
+ /**
3198
+ * Setter for the enabled state of the clipping plane.
3199
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3200
+ * @param {boolean} state - The new enabled state.
3201
+ */
3202
+ set enabled(state: boolean);
3203
+ /** {@link Hideable.visible } */
3204
+ get visible(): boolean;
3205
+ /** {@link Hideable.visible } */
3206
+ set visible(state: boolean);
3207
+ /** The meshes used for raycasting */
3208
+ get meshes(): THREE.Mesh[];
3209
+ /** The material of the clipping plane representation. */
3210
+ get planeMaterial(): THREE.Material | THREE.Material[];
3211
+ /** The material of the clipping plane representation. */
3212
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
3213
+ /** The size of the clipping plane representation. */
3214
+ get size(): number;
3215
+ /** Sets the size of the clipping plane representation. */
3216
+ set size(size: number);
3217
+ /**
3218
+ * Getter for the helper object of the clipping plane.
3219
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3220
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3221
+ *
3222
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
3223
+ */
3224
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3225
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3226
+ /**
3227
+ * Sets the clipping plane's normal and origin from the given normal and point.
3228
+ * This method resets the clipping plane's state, updates the normal and origin,
3229
+ * and positions the helper object accordingly.
3230
+ *
3231
+ * @param normal - The new normal vector for the clipping plane.
3232
+ * @param point - The new origin point for the clipping plane.
3233
+ *
3234
+ * @returns {void}
3235
+ */
3236
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3237
+ /** {@link Updateable.update} */
3238
+ update: () => void;
3337
3239
  /** {@link Disposable.dispose} */
3338
3240
  dispose(): void;
3339
- private getPositionY;
3340
- private getPositionX;
3341
- private updateMouseInfo;
3342
- private setupEvents;
3241
+ private reset;
3242
+ protected toggleControls(state: boolean): void;
3243
+ private newTransformControls;
3244
+ private initializeControls;
3245
+ private createArrowBoundingBox;
3246
+ private changeDrag;
3247
+ private notifyDraggingChanged;
3248
+ private preventCameraMovement;
3249
+ private newHelper;
3250
+ private static newPlaneMesh;
3343
3251
  }
3344
3252
  import * as THREE from "three";
3345
3253
  import { Components } from "../../Components";
@@ -3393,6 +3301,63 @@ export declare class SimpleRaycaster implements Disposable {
3393
3301
  private intersect;
3394
3302
  private filterClippingPlanes;
3395
3303
  }
3304
+ import { NavigationMode } from "./types";
3305
+ import { OrthoPerspectiveCamera } from "../index";
3306
+ /**
3307
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3308
+ */
3309
+ export declare class OrbitMode implements NavigationMode {
3310
+ camera: OrthoPerspectiveCamera;
3311
+ /** {@link NavigationMode.enabled} */
3312
+ enabled: boolean;
3313
+ /** {@link NavigationMode.id} */
3314
+ readonly id = "Orbit";
3315
+ constructor(camera: OrthoPerspectiveCamera);
3316
+ /** {@link NavigationMode.set} */
3317
+ set(active: boolean): void;
3318
+ private activateOrbitControls;
3319
+ }
3320
+ import * as THREE from "three";
3321
+ import * as WEBIFC from "web-ifc";
3322
+ import * as FRAGS from "@thatopen/fragments";
3323
+ export declare class CivilReader {
3324
+ defLineMat: THREE.LineBasicMaterial;
3325
+ read(webIfc: WEBIFC.IfcAPI): {
3326
+ alignments: Map<number, FRAGS.Alignment>;
3327
+ coordinationMatrix: THREE.Matrix4;
3328
+ } | undefined;
3329
+ get(civilItems: any): {
3330
+ alignments: Map<number, FRAGS.Alignment>;
3331
+ coordinationMatrix: THREE.Matrix4;
3332
+ } | undefined;
3333
+ private getCurves;
3334
+ }
3335
+ import * as WEBIFC from "web-ifc";
3336
+ import * as THREE from "three";
3337
+ export declare class Units {
3338
+ factor: number;
3339
+ complement: number;
3340
+ apply(matrix: THREE.Matrix4): void;
3341
+ setUp(webIfc: WEBIFC.IfcAPI): void;
3342
+ private getLengthUnits;
3343
+ private getScaleMatrix;
3344
+ }
3345
+ import * as WEBIFC from "web-ifc";
3346
+ export declare class IfcMetadataReader {
3347
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3348
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
3349
+ }
3350
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3351
+ /**
3352
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3353
+ */
3354
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3355
+ /**
3356
+ * Amount of properties to be streamed.
3357
+ * Defaults to 100 properties.
3358
+ */
3359
+ propertiesSize: number;
3360
+ }
3396
3361
  export type RelationsMap = Map<number, Map<number, number[]>>;
3397
3362
  export interface ModelsRelationMap {
3398
3363
  [modelID: string]: RelationsMap;
@@ -3417,20 +3382,55 @@ export type InverseAttributes = [
3417
3382
  "ContainsElements"
3418
3383
  ];
3419
3384
  export type InverseAttribute = InverseAttributes[number];
3420
- import * as WEBIFC from "web-ifc";
3421
- import * as THREE from "three";
3422
- export declare class Units {
3423
- factor: number;
3424
- complement: number;
3425
- apply(matrix: THREE.Matrix4): void;
3426
- setUp(webIfc: WEBIFC.IfcAPI): void;
3427
- private getLengthUnits;
3428
- private getScaleMatrix;
3385
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3386
+ /**
3387
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3388
+ */
3389
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
3390
+ /**
3391
+ * Minimum number of geometries to be streamed.
3392
+ * Defaults to 10 geometries.
3393
+ */
3394
+ minGeometrySize: number;
3395
+ /**
3396
+ * Minimum amount of assets to be streamed.
3397
+ * Defaults to 1000 assets.
3398
+ */
3399
+ minAssetsSize: number;
3429
3400
  }
3430
3401
  import { BufferGeometry } from "three";
3431
3402
  import * as THREE from "three";
3432
3403
  export declare class TransformHelper {
3433
3404
  getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
3434
3405
  }
3406
+ /**
3407
+ * 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.
3408
+ */
3409
+ export interface StreamedGeometries {
3410
+ [id: number]: {
3411
+ /** The bounding box of the geometry as a Float32Array. */
3412
+ boundingBox: Float32Array;
3413
+ /** A boolean indicating whether the geometry has holes. */
3414
+ hasHoles: boolean;
3415
+ /** An optional file path for the geometry data. */
3416
+ geometryFile?: string;
3417
+ };
3418
+ }
3419
+ /**
3420
+ * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
3421
+ */
3422
+ export interface StreamedAsset {
3423
+ /** The unique identifier of the asset. */
3424
+ id: number;
3425
+ /** An array of geometries associated with the asset. */
3426
+ geometries: {
3427
+ /** The unique identifier of the geometry. */
3428
+ geometryID: number;
3429
+ /** The transformation matrix of the geometry as a number array. */
3430
+ transformation: number[];
3431
+ /** The color of the geometry as a number array. */
3432
+ color: number[];
3433
+ }[];
3434
+ }
3435
3435
 
3436
3436
  }