@thatopen/components 2.3.0-alpha.7 → 2.3.0-alpha.8

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.
Files changed (2) hide show
  1. package/dist/namespace.d.ts +2019 -2019
  2. package/package.json +1 -1
@@ -44,6 +44,100 @@ export declare class Disposer extends Component {
44
44
  private disposeChildren;
45
45
  private static disposeMaterial;
46
46
  }
47
+ import { SimpleScene, SimpleSceneConfig, SimpleSceneConfigManager } from "../Worlds";
48
+ import { DistanceRenderer } from "./src";
49
+ import { Configurable, Disposable } from "../Types";
50
+ /**
51
+ * Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights,
52
+ * as well as shadows.
53
+ */
54
+ export interface ShadowedSceneConfig extends SimpleSceneConfig {
55
+ shadows: {
56
+ cascade: number;
57
+ resolution: number;
58
+ };
59
+ }
60
+ /**
61
+ * A scene that supports efficient cast shadows. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/ShadowedScene). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/ShadowedScene).
62
+ */
63
+ export declare class ShadowedScene extends SimpleScene implements Disposable, Configurable<SimpleSceneConfigManager, ShadowedSceneConfig> {
64
+ private _distanceRenderer?;
65
+ /**
66
+ * Whether the bias property should be set automatically depending on the shadow distance.
67
+ */
68
+ autoBias: boolean;
69
+ protected _defaultShadowConfig: {
70
+ cascade: number;
71
+ resolution: number;
72
+ };
73
+ private _lightsWithShadow;
74
+ private _isComputingShadows;
75
+ private _shadowsEnabled;
76
+ private _bias;
77
+ /**
78
+ * The getter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
79
+ */
80
+ get bias(): number;
81
+ /**
82
+ * The setter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
83
+ */
84
+ set bias(value: number);
85
+ /**
86
+ * Getter to see whether the shadows are enabled or not in this scene instance.
87
+ */
88
+ get shadowsEnabled(): boolean;
89
+ /**
90
+ * Setter to control whether the shadows are enabled or not in this scene instance.
91
+ */
92
+ set shadowsEnabled(value: boolean);
93
+ /**
94
+ * Getter to get the renderer used to determine the farthest distance from the camera.
95
+ */
96
+ get distanceRenderer(): DistanceRenderer;
97
+ /** {@link Configurable.setup} */
98
+ setup(config?: Partial<ShadowedSceneConfig>): void;
99
+ /** {@link Disposable.dispose} */
100
+ dispose(): void;
101
+ /** Update all the shadows of the scene. */
102
+ updateShadows(): Promise<void>;
103
+ private recomputeShadows;
104
+ }
105
+ import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
106
+ import { Components } from "../Components";
107
+ import { BCFViewpoint, Viewpoint } from "./src";
108
+ import { ViewpointsConfigManager, ViewpointsConfig } from "./src/viewpoints-config";
109
+ export declare class Viewpoints extends Component implements Disposable, Configurable<ViewpointsConfigManager, ViewpointsConfig> {
110
+ static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66";
111
+ enabled: boolean;
112
+ /**
113
+ * A DataMap that stores Viewpoint instances, indexed by their unique identifiers (guid).
114
+ * This map is used to manage and retrieve Viewpoint instances within the Viewpoints component.
115
+ */
116
+ readonly list: DataMap<string, Viewpoint>;
117
+ /**
118
+ * Creates a new Viewpoint instance and adds it to the list.
119
+ *
120
+ * @param world - The world in which the Viewpoint will be created.
121
+ * @param data - Optional partial data for the Viewpoint. If not provided, default data will be used.
122
+ *
123
+ * @returns The newly created Viewpoint instance.
124
+ */
125
+ create(world: World, data?: Partial<BCFViewpoint>): Viewpoint;
126
+ constructor(components: Components);
127
+ isSetup: boolean;
128
+ setup(): void;
129
+ onSetup: Event<unknown>;
130
+ config: ViewpointsConfigManager;
131
+ readonly onDisposed: Event<unknown>;
132
+ /**
133
+ * Disposes of the Viewpoints component and its associated resources.
134
+ *
135
+ * This method is responsible for cleaning up any resources held by the Viewpoints component,
136
+ * such as disposing of the DataMap of Viewpoint instances and triggering and resetting the
137
+ * onDisposed event.
138
+ */
139
+ dispose(): void;
140
+ }
47
141
  import { Component, Disposable, Event } from "../Types";
48
142
  /**
49
143
  * 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.
@@ -120,64 +214,6 @@ export declare class Components implements Disposable {
120
214
  private update;
121
215
  private static setupBVH;
122
216
  }
123
- import { SimpleScene, SimpleSceneConfig, SimpleSceneConfigManager } from "../Worlds";
124
- import { DistanceRenderer } from "./src";
125
- import { Configurable, Disposable } from "../Types";
126
- /**
127
- * Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights,
128
- * as well as shadows.
129
- */
130
- export interface ShadowedSceneConfig extends SimpleSceneConfig {
131
- shadows: {
132
- cascade: number;
133
- resolution: number;
134
- };
135
- }
136
- /**
137
- * A scene that supports efficient cast shadows. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/ShadowedScene). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/ShadowedScene).
138
- */
139
- export declare class ShadowedScene extends SimpleScene implements Disposable, Configurable<SimpleSceneConfigManager, ShadowedSceneConfig> {
140
- private _distanceRenderer?;
141
- /**
142
- * Whether the bias property should be set automatically depending on the shadow distance.
143
- */
144
- autoBias: boolean;
145
- protected _defaultShadowConfig: {
146
- cascade: number;
147
- resolution: number;
148
- };
149
- private _lightsWithShadow;
150
- private _isComputingShadows;
151
- private _shadowsEnabled;
152
- private _bias;
153
- /**
154
- * The getter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
155
- */
156
- get bias(): number;
157
- /**
158
- * The setter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
159
- */
160
- set bias(value: number);
161
- /**
162
- * Getter to see whether the shadows are enabled or not in this scene instance.
163
- */
164
- get shadowsEnabled(): boolean;
165
- /**
166
- * Setter to control whether the shadows are enabled or not in this scene instance.
167
- */
168
- set shadowsEnabled(value: boolean);
169
- /**
170
- * Getter to get the renderer used to determine the farthest distance from the camera.
171
- */
172
- get distanceRenderer(): DistanceRenderer;
173
- /** {@link Configurable.setup} */
174
- setup(config?: Partial<ShadowedSceneConfig>): void;
175
- /** {@link Disposable.dispose} */
176
- dispose(): void;
177
- /** Update all the shadows of the scene. */
178
- updateShadows(): Promise<void>;
179
- private recomputeShadows;
180
- }
181
217
  import { Component, Disposable, World, Event } from "../Types";
182
218
  import { SimpleRaycaster } from "./src";
183
219
  import { Components } from "../Components";
@@ -287,195 +323,59 @@ export declare class Worlds extends Component implements Updateable, Disposable
287
323
  /** {@link Updateable.update} */
288
324
  update(delta?: number): void | Promise<void>;
289
325
  }
290
- import { Component, Disposable, World, Event } from "../Types";
291
- import { SimpleGrid } from "./src";
326
+ import * as THREE from "three";
327
+ import { Component, Configurable, Createable, Disposable, Event, Hideable, World } from "../Types";
328
+ import { SimplePlane } from "./src";
292
329
  import { Components } from "../Components";
330
+ import { ClipperConfig, ClipperConfigManager } from "./src/clipper-config";
293
331
  /**
294
- * 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).
332
+ * A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper).
333
+ *
334
+ * @param components - the instance of {@link Components} used.
335
+ * E.g. {@link SimplePlane}.
295
336
  */
296
- export declare class Grids extends Component implements Disposable {
337
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable, Configurable<ClipperConfigManager, ClipperConfig> {
297
338
  /**
298
339
  * A unique identifier for the component.
299
340
  * This UUID is used to register the component within the Components system.
300
341
  */
301
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
342
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
343
+ /** {@link Configurable.onSetup} */
344
+ readonly onSetup: Event<unknown>;
345
+ /** Event that fires when the user starts dragging a clipping plane. */
346
+ readonly onBeforeDrag: Event<void>;
347
+ /** Event that fires when the user stops dragging a clipping plane. */
348
+ readonly onAfterDrag: Event<void>;
302
349
  /**
303
- * A map of world UUIDs to their corresponding grid instances.
350
+ * Event that fires when the user starts creating a clipping plane.
304
351
  */
305
- list: Map<string, SimpleGrid>;
306
- /** {@link Disposable.onDisposed} */
307
- readonly onDisposed: Event<unknown>;
308
- /** {@link Component.enabled} */
309
- enabled: boolean;
310
- constructor(components: Components);
352
+ readonly onBeforeCreate: Event<unknown>;
311
353
  /**
312
- * Creates a new grid for the given world.
313
- * Throws an error if a grid already exists for the world.
314
- *
315
- * @param world - The world to create the grid for.
316
- * @returns The newly created grid.
317
- *
318
- * @throws Will throw an error if a grid already exists for the given world.
354
+ * Event that fires when the user cancels the creation of a clipping plane.
319
355
  */
320
- create(world: World): SimpleGrid;
356
+ readonly onBeforeCancel: Event<unknown>;
321
357
  /**
322
- * Deletes the grid associated with the given world.
323
- * If a grid does not exist for the given world, this method does nothing.
324
- *
325
- * @param world - The world for which to delete the grid.
326
- *
327
- * @remarks
328
- * This method will dispose of the grid and remove it from the internal list.
329
- * If the world is disposed before calling this method, the grid will be automatically deleted.
358
+ * Event that fires after the user cancels the creation of a clipping plane.
330
359
  */
331
- delete(world: World): void;
332
- /** {@link Disposable.dispose} */
333
- dispose(): void;
334
- }
335
- import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
336
- import { Components } from "../Components";
337
- import { BCFViewpoint, Viewpoint } from "./src";
338
- import { ViewpointsConfigManager, ViewpointsConfig } from "./src/viewpoints-config";
339
- export declare class Viewpoints extends Component implements Disposable, Configurable<ViewpointsConfigManager, ViewpointsConfig> {
340
- static readonly uuid: "ee867824-a796-408d-8aa0-4e5962a83c66";
341
- enabled: boolean;
360
+ readonly onAfterCancel: Event<unknown>;
342
361
  /**
343
- * A DataMap that stores Viewpoint instances, indexed by their unique identifiers (guid).
344
- * This map is used to manage and retrieve Viewpoint instances within the Viewpoints component.
362
+ * Event that fires when the user starts deleting a clipping plane.
345
363
  */
346
- readonly list: DataMap<string, Viewpoint>;
364
+ readonly onBeforeDelete: Event<unknown>;
347
365
  /**
348
- * Creates a new Viewpoint instance and adds it to the list.
349
- *
350
- * @param world - The world in which the Viewpoint will be created.
351
- * @param data - Optional partial data for the Viewpoint. If not provided, default data will be used.
352
- *
353
- * @returns The newly created Viewpoint instance.
366
+ * Event that fires after a clipping plane has been created.
367
+ * @param plane - The newly created clipping plane.
354
368
  */
355
- create(world: World, data?: Partial<BCFViewpoint>): Viewpoint;
356
- constructor(components: Components);
357
- isSetup: boolean;
358
- setup(): void;
359
- onSetup: Event<unknown>;
360
- config: ViewpointsConfigManager;
361
- readonly onDisposed: Event<unknown>;
369
+ readonly onAfterCreate: Event<SimplePlane>;
362
370
  /**
363
- * Disposes of the Viewpoints component and its associated resources.
364
- *
365
- * This method is responsible for cleaning up any resources held by the Viewpoints component,
366
- * such as disposing of the DataMap of Viewpoint instances and triggering and resetting the
367
- * onDisposed event.
371
+ * Event that fires after a clipping plane has been deleted.
372
+ * @param plane - The deleted clipping plane.
368
373
  */
369
- dispose(): void;
370
- }
371
- import * as THREE from "three";
372
- import { Components } from "../Components";
373
- import { MeshCullerRenderer } from "./src";
374
- import { Component, Event, Disposable, World } from "../Types";
375
- /**
376
- * 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).
377
- */
378
- export declare class Cullers extends Component implements Disposable {
379
- /**
380
- * A unique identifier for the component.
381
- * This UUID is used to register the component within the Components system.
382
- */
383
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
384
- /**
385
- * An event that is triggered when the Cullers component is disposed.
386
- */
387
- readonly onDisposed: Event<unknown>;
388
- private _enabled;
389
- /**
390
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
391
- */
392
- list: Map<string, MeshCullerRenderer>;
393
- /** {@link Component.enabled} */
394
- get enabled(): boolean;
395
- /** {@link Component.enabled} */
396
- set enabled(value: boolean);
397
- constructor(components: Components);
398
- /**
399
- * Creates a new MeshCullerRenderer for the given world.
400
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
401
- *
402
- * @param world - The world for which to create the MeshCullerRenderer.
403
- *
404
- * @returns The newly created or existing MeshCullerRenderer for the given world.
405
- */
406
- create(world: World): MeshCullerRenderer;
407
- /**
408
- * Deletes the MeshCullerRenderer associated with the given world.
409
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
410
- *
411
- * @param world - The world for which to delete the MeshCullerRenderer.
412
- *
413
- * @returns {void}
414
- */
415
- delete(world: World): void;
416
- /** {@link Disposable.dispose} */
417
- dispose(): void;
418
- /**
419
- * Updates the given instanced meshes inside the all the cullers. You should use this if you change the count property, e.g. when changing the visibility of fragments.
420
- *
421
- * @param meshes - The meshes to update.
422
- *
423
- */
424
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
425
- }
426
- import * as THREE from "three";
427
- import { Component, Configurable, Createable, Disposable, Event, Hideable, World } from "../Types";
428
- import { SimplePlane } from "./src";
429
- import { Components } from "../Components";
430
- import { ClipperConfig, ClipperConfigManager } from "./src/clipper-config";
431
- /**
432
- * A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper).
433
- *
434
- * @param components - the instance of {@link Components} used.
435
- * E.g. {@link SimplePlane}.
436
- */
437
- export declare class Clipper extends Component implements Createable, Disposable, Hideable, Configurable<ClipperConfigManager, ClipperConfig> {
438
- /**
439
- * A unique identifier for the component.
440
- * This UUID is used to register the component within the Components system.
441
- */
442
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
443
- /** {@link Configurable.onSetup} */
444
- readonly onSetup: Event<unknown>;
445
- /** Event that fires when the user starts dragging a clipping plane. */
446
- readonly onBeforeDrag: Event<void>;
447
- /** Event that fires when the user stops dragging a clipping plane. */
448
- readonly onAfterDrag: Event<void>;
449
- /**
450
- * Event that fires when the user starts creating a clipping plane.
451
- */
452
- readonly onBeforeCreate: Event<unknown>;
453
- /**
454
- * Event that fires when the user cancels the creation of a clipping plane.
455
- */
456
- readonly onBeforeCancel: Event<unknown>;
457
- /**
458
- * Event that fires after the user cancels the creation of a clipping plane.
459
- */
460
- readonly onAfterCancel: Event<unknown>;
461
- /**
462
- * Event that fires when the user starts deleting a clipping plane.
463
- */
464
- readonly onBeforeDelete: Event<unknown>;
465
- /**
466
- * Event that fires after a clipping plane has been created.
467
- * @param plane - The newly created clipping plane.
468
- */
469
- readonly onAfterCreate: Event<SimplePlane>;
470
- /**
471
- * Event that fires after a clipping plane has been deleted.
472
- * @param plane - The deleted clipping plane.
473
- */
474
- readonly onAfterDelete: Event<SimplePlane>;
475
- /** {@link Disposable.onDisposed} */
476
- readonly onDisposed: Event<string>;
477
- /** {@link Configurable.isSetup} */
478
- isSetup: boolean;
374
+ readonly onAfterDelete: Event<SimplePlane>;
375
+ /** {@link Disposable.onDisposed} */
376
+ readonly onDisposed: Event<string>;
377
+ /** {@link Configurable.isSetup} */
378
+ isSetup: boolean;
479
379
  /**
480
380
  * Whether to force the clipping plane to be orthogonal in the Y direction
481
381
  * (up). This is desirable when clipping a building horizontally and a
@@ -564,18 +464,6 @@ export declare class Clipper extends Component implements Createable, Disposable
564
464
  private _onStartDragging;
565
465
  private _onEndDragging;
566
466
  }
567
- import * as THREE from "three";
568
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
569
- center: THREE.Vector3;
570
- halfSizes: THREE.Vector3;
571
- rotation: THREE.Matrix3;
572
- transformation: THREE.Matrix4;
573
- };
574
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
575
- import * as THREE from "three";
576
- export declare class MaterialsUtils {
577
- static isTransparent(material: THREE.Material): boolean;
578
- }
579
467
  import { MiniMap } from "./src";
580
468
  import { Component, Updateable, World, Event, Disposable } from "../Types";
581
469
  import { Components } from "../Components";
@@ -623,12 +511,6 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
623
511
  /** {@link Updateable.update} */
624
512
  update(): void;
625
513
  }
626
- export declare class UUID {
627
- private static _pattern;
628
- private static _lut;
629
- static create(): string;
630
- static validate(uuid: string): void;
631
- }
632
514
  import * as THREE from "three";
633
515
  import { Components } from "../Components";
634
516
  import { SimpleCamera } from "..";
@@ -693,27 +575,59 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
693
575
  private newOrthoCamera;
694
576
  private setOrthoPerspCameraAspect;
695
577
  }
696
- import { Component, DataSet } from "../Types";
578
+ import { Component, Disposable, World, Event } from "../Types";
579
+ import { SimpleGrid } from "./src";
697
580
  import { Components } from "../Components";
698
- import { Configurator } from "./src";
699
581
  /**
700
- * A tool to manage all the configuration from the app centrally.
582
+ * 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).
701
583
  */
702
- export declare class ConfigManager extends Component {
584
+ export declare class Grids extends Component implements Disposable {
703
585
  /**
704
- * The list of all configurations of this app.
586
+ * A unique identifier for the component.
587
+ * This UUID is used to register the component within the Components system.
705
588
  */
706
- list: DataSet<Configurator<any, any>>;
589
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
590
+ /**
591
+ * A map of world UUIDs to their corresponding grid instances.
592
+ */
593
+ list: Map<string, SimpleGrid>;
594
+ /** {@link Disposable.onDisposed} */
595
+ readonly onDisposed: Event<unknown>;
707
596
  /** {@link Component.enabled} */
708
597
  enabled: boolean;
598
+ constructor(components: Components);
709
599
  /**
710
- * A unique identifier for the component.
711
- * This UUID is used to register the component within the Components system.
600
+ * Creates a new grid for the given world.
601
+ * Throws an error if a grid already exists for the world.
602
+ *
603
+ * @param world - The world to create the grid for.
604
+ * @returns The newly created grid.
605
+ *
606
+ * @throws Will throw an error if a grid already exists for the given world.
712
607
  */
713
- static readonly uuid: "b8c764e0-6b24-4e77-9a32-35fa728ee5b4";
714
- constructor(components: Components);
608
+ create(world: World): SimpleGrid;
609
+ /**
610
+ * Deletes the grid associated with the given world.
611
+ * If a grid does not exist for the given world, this method does nothing.
612
+ *
613
+ * @param world - The world for which to delete the grid.
614
+ *
615
+ * @remarks
616
+ * This method will dispose of the grid and remove it from the internal list.
617
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
618
+ */
619
+ delete(world: World): void;
620
+ /** {@link Disposable.dispose} */
621
+ dispose(): void;
715
622
  }
716
623
  import * as THREE from "three";
624
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
625
+ center: THREE.Vector3;
626
+ halfSizes: THREE.Vector3;
627
+ rotation: THREE.Matrix3;
628
+ transformation: THREE.Matrix4;
629
+ };
630
+ import * as THREE from "three";
717
631
  import * as FRAGS from "@thatopen/fragments";
718
632
  import { FragmentsGroup } from "@thatopen/fragments";
719
633
  import { Component, Components, Disposable, Event } from "../../core";
@@ -921,90 +835,120 @@ export declare class BoundingBoxer extends Component implements Disposable {
921
835
  addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
922
836
  private static getFragmentBounds;
923
837
  }
924
- import { Component, Disposable, Event, Components } from "../../core";
838
+ import { Component, DataSet } from "../Types";
839
+ import { Components } from "../Components";
840
+ import { Configurator } from "./src";
925
841
  /**
926
- * 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).
842
+ * A tool to manage all the configuration from the app centrally.
927
843
  */
928
- export declare class Exploder extends Component implements Disposable {
844
+ export declare class ConfigManager extends Component {
929
845
  /**
930
- * A unique identifier for the component.
931
- * This UUID is used to register the component within the Components system.
846
+ * The list of all configurations of this app.
932
847
  */
933
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
934
- /** {@link Disposable.onDisposed} */
935
- readonly onDisposed: Event<unknown>;
848
+ list: DataSet<Configurator<any, any>>;
936
849
  /** {@link Component.enabled} */
937
850
  enabled: boolean;
938
851
  /**
939
- * The height of the explosion animation.
940
- * This property determines the vertical distance by which fragments are moved during the explosion.
941
- * Default value is 10.
942
- */
943
- height: number;
944
- /**
945
- * The group name used for the explosion animation.
946
- * This property specifies the group of fragments that will be affected by the explosion.
947
- * Default value is "storeys".
948
- */
949
- groupName: string;
950
- /**
951
- * A set of strings representing the exploded items.
952
- * This set is used to keep track of which items have been exploded.
852
+ * A unique identifier for the component.
853
+ * This UUID is used to register the component within the Components system.
953
854
  */
954
- list: Set<string>;
855
+ static readonly uuid: "b8c764e0-6b24-4e77-9a32-35fa728ee5b4";
955
856
  constructor(components: Components);
956
- /** {@link Disposable.dispose} */
957
- dispose(): void;
958
- /**
959
- * Sets the explosion state of the fragments.
960
- *
961
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
962
- *
963
- * @remarks
964
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
965
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
966
- * If 'active' is false, the fragments are moved back to their original position.
967
- *
968
- * The method also keeps track of the exploded items using the 'list' set.
969
- *
970
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
971
- */
972
- set(active: boolean): void;
973
857
  }
858
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
974
859
  import * as THREE from "three";
975
- import * as FRAGS from "@thatopen/fragments";
976
- import { Disposable, Component, Event, Components } from "../../core";
977
- /**
978
- * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
979
- */
980
- export interface Classification {
981
- /**
982
- * A system within the classification.
983
- * The key is the system name, and the value is an object representing the classes within the system.
984
- */
985
- [system: string]: {
986
- /**
987
- * A class within the system.
988
- * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
989
- */
990
- [className: string]: {
991
- map: FRAGS.FragmentIdMap;
992
- name: string;
993
- id: number | null;
994
- };
995
- };
860
+ export declare class MaterialsUtils {
861
+ static isTransparent(material: THREE.Material): boolean;
996
862
  }
863
+ import * as THREE from "three";
864
+ import { Components } from "../Components";
865
+ import { MeshCullerRenderer } from "./src";
866
+ import { Component, Event, Disposable, World } from "../Types";
997
867
  /**
998
- * 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).
868
+ * 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).
999
869
  */
1000
- export declare class Classifier extends Component implements Disposable {
870
+ export declare class Cullers extends Component implements Disposable {
1001
871
  /**
1002
872
  * A unique identifier for the component.
1003
873
  * This UUID is used to register the component within the Components system.
1004
874
  */
1005
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
1006
- /** {@link Component.enabled} */
1007
- enabled: boolean;
875
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
876
+ /**
877
+ * An event that is triggered when the Cullers component is disposed.
878
+ */
879
+ readonly onDisposed: Event<unknown>;
880
+ private _enabled;
881
+ /**
882
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
883
+ */
884
+ list: Map<string, MeshCullerRenderer>;
885
+ /** {@link Component.enabled} */
886
+ get enabled(): boolean;
887
+ /** {@link Component.enabled} */
888
+ set enabled(value: boolean);
889
+ constructor(components: Components);
890
+ /**
891
+ * Creates a new MeshCullerRenderer for the given world.
892
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
893
+ *
894
+ * @param world - The world for which to create the MeshCullerRenderer.
895
+ *
896
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
897
+ */
898
+ create(world: World): MeshCullerRenderer;
899
+ /**
900
+ * Deletes the MeshCullerRenderer associated with the given world.
901
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
902
+ *
903
+ * @param world - The world for which to delete the MeshCullerRenderer.
904
+ *
905
+ * @returns {void}
906
+ */
907
+ delete(world: World): void;
908
+ /** {@link Disposable.dispose} */
909
+ dispose(): void;
910
+ /**
911
+ * Updates the given instanced meshes inside the all the cullers. You should use this if you change the count property, e.g. when changing the visibility of fragments.
912
+ *
913
+ * @param meshes - The meshes to update.
914
+ *
915
+ */
916
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
917
+ }
918
+ import * as THREE from "three";
919
+ import * as FRAGS from "@thatopen/fragments";
920
+ import { Disposable, Component, Event, Components } from "../../core";
921
+ /**
922
+ * Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
923
+ */
924
+ export interface Classification {
925
+ /**
926
+ * A system within the classification.
927
+ * The key is the system name, and the value is an object representing the classes within the system.
928
+ */
929
+ [system: string]: {
930
+ /**
931
+ * A class within the system.
932
+ * The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
933
+ */
934
+ [className: string]: {
935
+ map: FRAGS.FragmentIdMap;
936
+ name: string;
937
+ id: number | null;
938
+ };
939
+ };
940
+ }
941
+ /**
942
+ * 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).
943
+ */
944
+ export declare class Classifier extends Component implements Disposable {
945
+ /**
946
+ * A unique identifier for the component.
947
+ * This UUID is used to register the component within the Components system.
948
+ */
949
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
950
+ /** {@link Component.enabled} */
951
+ enabled: boolean;
1008
952
  /**
1009
953
  * A map representing the classification systems.
1010
954
  * The key is the system name, and the value is an object representing the classes within the system.
@@ -1145,172 +1089,237 @@ export declare class Classifier extends Component implements Disposable {
1145
1089
  resetColor(items: FRAGS.FragmentIdMap): void;
1146
1090
  protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1147
1091
  }
1148
- import * as WEBIFC from "web-ifc";
1149
- import { Components, Disposable, Event, Component } from "../../core";
1150
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1092
+ import { Component, Disposable, Event, Components } from "../../core";
1151
1093
  /**
1152
- * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
1094
+ * 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).
1153
1095
  */
1154
- export declare class IfcGeometryTiler extends Component implements Disposable {
1096
+ export declare class Exploder extends Component implements Disposable {
1155
1097
  /**
1156
1098
  * A unique identifier for the component.
1157
1099
  * This UUID is used to register the component within the Components system.
1158
1100
  */
1159
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1160
- /**
1161
- * Event triggered when geometry is streamed.
1162
- * Contains the streamed geometry data and its buffer.
1163
- */
1164
- readonly onGeometryStreamed: Event<{
1165
- buffer: Uint8Array;
1166
- data: StreamedGeometries;
1167
- }>;
1168
- /**
1169
- * Event triggered when assets are streamed.
1170
- * Contains the streamed assets.
1171
- */
1172
- readonly onAssetStreamed: Event<StreamedAsset[]>;
1173
- /**
1174
- * Event triggered to indicate the progress of the streaming process.
1175
- * Contains the progress percentage.
1176
- */
1177
- readonly onProgress: Event<number>;
1178
- /**
1179
- * Event triggered when the IFC file is loaded.
1180
- * Contains the loaded IFC file data.
1181
- */
1182
- readonly onIfcLoaded: Event<Uint8Array>;
1101
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1183
1102
  /** {@link Disposable.onDisposed} */
1184
1103
  readonly onDisposed: Event<unknown>;
1185
- /**
1186
- * Settings for the IfcGeometryTiler.
1187
- */
1188
- settings: IfcStreamingSettings;
1189
1104
  /** {@link Component.enabled} */
1190
1105
  enabled: boolean;
1191
1106
  /**
1192
- * The WebIFC API instance used for IFC file processing.
1107
+ * The height of the explosion animation.
1108
+ * This property determines the vertical distance by which fragments are moved during the explosion.
1109
+ * Default value is 10.
1193
1110
  */
1194
- webIfc: WEBIFC.IfcAPI;
1195
- private _nextAvailableID;
1196
- private _splittedGeometries;
1197
- private _spatialTree;
1198
- private _metaData;
1199
- private _visitedGeometries;
1200
- private _streamSerializer;
1201
- private _geometries;
1202
- private _geometryCount;
1203
- private _civil;
1204
- private _groupSerializer;
1205
- private _assets;
1206
- private _meshesWithHoles;
1111
+ height: number;
1112
+ /**
1113
+ * The group name used for the explosion animation.
1114
+ * This property specifies the group of fragments that will be affected by the explosion.
1115
+ * Default value is "storeys".
1116
+ */
1117
+ groupName: string;
1118
+ /**
1119
+ * A set of strings representing the exploded items.
1120
+ * This set is used to keep track of which items have been exploded.
1121
+ */
1122
+ list: Set<string>;
1207
1123
  constructor(components: Components);
1208
1124
  /** {@link Disposable.dispose} */
1209
1125
  dispose(): void;
1210
1126
  /**
1211
- * This method streams the IFC file from a given buffer.
1127
+ * Sets the explosion state of the fragments.
1212
1128
  *
1213
- * @param data - The Uint8Array containing the IFC file data.
1214
- * @returns A Promise that resolves when the streaming process is complete.
1129
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
1215
1130
  *
1216
1131
  * @remarks
1217
- * This method cleans up any resources after the streaming process is complete.
1218
- *
1219
- * @example
1220
- * '''typescript
1221
- * const ifcData = await fetch('path/to/ifc/file.ifc');
1222
- * const rawBuffer = await response.arrayBuffer();
1223
- * const ifcBuffer = new Uint8Array(rawBuffer);
1224
- * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1225
- * '''
1226
- */
1227
- streamFromBuffer(data: Uint8Array): Promise<void>;
1228
- /**
1229
- * This method streams the IFC file from a given callback.
1230
- *
1231
- * @param loadCallback - The callback function that will be used to load the IFC file.
1232
- * @returns A Promise that resolves when the streaming process is complete.
1132
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1133
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1134
+ * If 'active' is false, the fragments are moved back to their original position.
1233
1135
  *
1234
- * @remarks
1235
- * This method cleans up any resources after the streaming process is complete.
1136
+ * The method also keeps track of the exploded items using the 'list' set.
1236
1137
  *
1138
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1237
1139
  */
1238
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1239
- private readIfcFile;
1240
- private streamIfcFile;
1241
- private streamAllGeometries;
1242
- private cleanUp;
1243
- private getMesh;
1244
- private getGeometry;
1245
- private streamAssets;
1246
- private streamGeometries;
1247
- private registerGeometryData;
1140
+ set(active: boolean): void;
1248
1141
  }
1249
- import * as WEBIFC from "web-ifc";
1250
- import * as FRAGS from "@thatopen/fragments";
1251
- import { IfcFragmentSettings } from "./src";
1252
- import { Component, Components, Event, Disposable } from "../../core";
1142
+ import * as THREE from "three";
1143
+ import { Component, Components, Disposable, Event, World } from "../core";
1253
1144
  /**
1254
- * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1145
+ * Configuration interface for the VertexPicker component.
1255
1146
  */
1256
- export declare class IfcLoader extends Component implements Disposable {
1147
+ export interface VertexPickerConfig {
1257
1148
  /**
1258
- * A unique identifier for the component.
1259
- * This UUID is used to register the component within the Components system.
1149
+ * If true, only vertices will be picked, not the closest point on the face.
1260
1150
  */
1261
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1262
- /** {@link Disposable.onDisposed} */
1263
- readonly onDisposed: Event<string>;
1151
+ showOnlyVertex: boolean;
1264
1152
  /**
1265
- * An event triggered when the IFC file starts loading.
1153
+ * The maximum distance for snapping to a vertex.
1266
1154
  */
1267
- readonly onIfcStartedLoading: Event<void>;
1155
+ snapDistance: number;
1268
1156
  /**
1269
- * An event triggered when the setup process is completed.
1157
+ * The HTML element to use for previewing the picked vertex.
1270
1158
  */
1271
- readonly onSetup: Event<void>;
1159
+ previewElement: HTMLElement;
1160
+ }
1161
+ /**
1162
+ * A class that provides functionality for picking vertices in a 3D scene.
1163
+ */
1164
+ export declare class VertexPicker extends Component implements Disposable {
1165
+ /** {@link Disposable.onDisposed} */
1166
+ readonly onDisposed: Event<unknown>;
1272
1167
  /**
1273
- * The settings for the IfcLoader.
1274
- * It includes options for excluding categories, setting WASM paths, and more.
1168
+ * An event that is triggered when a vertex is found.
1169
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
1275
1170
  */
1276
- settings: IfcFragmentSettings;
1171
+ readonly onVertexFound: Event<THREE.Vector3>;
1277
1172
  /**
1278
- * The instance of the Web-IFC library used for handling IFC data.
1173
+ * An event that is triggered when a vertex is lost.
1174
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
1279
1175
  */
1280
- webIfc: WEBIFC.IfcAPI;
1281
- /** {@link Component.enabled} */
1282
- enabled: boolean;
1283
- private _material;
1284
- private _spatialTree;
1285
- private _metaData;
1286
- private _fragmentInstances;
1287
- private _civil;
1288
- private _visitedFragments;
1289
- private _materialT;
1290
- constructor(components: Components);
1291
- /** {@link Disposable.dispose} */
1292
- dispose(): void;
1176
+ readonly onVertexLost: Event<THREE.Vector3>;
1293
1177
  /**
1294
- * Sets up the IfcLoader component with the provided configuration.
1295
- *
1296
- * @param config - Optional configuration settings for the IfcLoader.
1297
- * If not provided, the existing settings will be used.
1298
- *
1299
- * @returns A Promise that resolves when the setup process is completed.
1300
- *
1301
- * @remarks
1302
- * If the 'autoSetWasm' option is enabled in the configuration,
1303
- * the method will automatically set the WASM paths for the Web-IFC library.
1304
- *
1305
- * @example
1306
- * '''typescript
1307
- * const ifcLoader = new IfcLoader(components);
1308
- * await ifcLoader.setup({ autoSetWasm: true });
1309
- * '''
1178
+ * An event that is triggered when the picker is enabled or disabled
1310
1179
  */
1311
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1180
+ readonly onEnabled: Event<boolean>;
1312
1181
  /**
1313
- * Loads an IFC file and processes it for 3D visualization.
1182
+ * A reference to the Components instance associated with this VertexPicker.
1183
+ */
1184
+ components: Components;
1185
+ /**
1186
+ * A reference to the working plane used for vertex picking.
1187
+ * This plane is used to determine which vertices are considered valid for picking.
1188
+ * If this value is null, all vertices are considered valid.
1189
+ */
1190
+ workingPlane: THREE.Plane | null;
1191
+ private _pickedPoint;
1192
+ private _config;
1193
+ private _enabled;
1194
+ /**
1195
+ * Sets the enabled state of the VertexPicker.
1196
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1197
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1198
+ *
1199
+ * @param value - The new enabled state.
1200
+ */
1201
+ set enabled(value: boolean);
1202
+ /**
1203
+ * Gets the current enabled state of the VertexPicker.
1204
+ *
1205
+ * @returns The current enabled state.
1206
+ */
1207
+ get enabled(): boolean;
1208
+ /**
1209
+ * Sets the configuration for the VertexPicker component.
1210
+ *
1211
+ * @param value - A Partial object containing the configuration properties to update.
1212
+ * The properties not provided in the value object will retain their current values.
1213
+ *
1214
+ * @example
1215
+ * '''typescript
1216
+ * vertexPicker.config = {
1217
+ * snapDistance: 0.5,
1218
+ * showOnlyVertex: true,
1219
+ * };
1220
+ * '''
1221
+ */
1222
+ set config(value: Partial<VertexPickerConfig>);
1223
+ /**
1224
+ * Gets the current configuration for the VertexPicker component.
1225
+ *
1226
+ * @returns A copy of the current VertexPickerConfig object.
1227
+ *
1228
+ * @example
1229
+ * '''typescript
1230
+ * const currentConfig = vertexPicker.config;
1231
+ * console.log(currentConfig.snapDistance); // Output: 0.25
1232
+ * '''
1233
+ */
1234
+ get config(): Partial<VertexPickerConfig>;
1235
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
1236
+ /** {@link Disposable.dispose} */
1237
+ dispose(): void;
1238
+ /**
1239
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
1240
+ *
1241
+ * @param world - The World instance to use for raycasting.
1242
+ *
1243
+ * @returns The current picked point, or null if no point is picked.
1244
+ *
1245
+ * @remarks
1246
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1247
+ * If enabled, it performs raycasting to find the closest intersecting object.
1248
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
1249
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1250
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1251
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1252
+ */
1253
+ get(world: World): THREE.Vector3 | null;
1254
+ private getClosestVertex;
1255
+ private getVertices;
1256
+ private getVertex;
1257
+ }
1258
+ import * as WEBIFC from "web-ifc";
1259
+ import * as FRAGS from "@thatopen/fragments";
1260
+ import { IfcFragmentSettings } from "./src";
1261
+ import { Component, Components, Event, Disposable } from "../../core";
1262
+ /**
1263
+ * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1264
+ */
1265
+ export declare class IfcLoader extends Component implements Disposable {
1266
+ /**
1267
+ * A unique identifier for the component.
1268
+ * This UUID is used to register the component within the Components system.
1269
+ */
1270
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1271
+ /** {@link Disposable.onDisposed} */
1272
+ readonly onDisposed: Event<string>;
1273
+ /**
1274
+ * An event triggered when the IFC file starts loading.
1275
+ */
1276
+ readonly onIfcStartedLoading: Event<void>;
1277
+ /**
1278
+ * An event triggered when the setup process is completed.
1279
+ */
1280
+ readonly onSetup: Event<void>;
1281
+ /**
1282
+ * The settings for the IfcLoader.
1283
+ * It includes options for excluding categories, setting WASM paths, and more.
1284
+ */
1285
+ settings: IfcFragmentSettings;
1286
+ /**
1287
+ * The instance of the Web-IFC library used for handling IFC data.
1288
+ */
1289
+ webIfc: WEBIFC.IfcAPI;
1290
+ /** {@link Component.enabled} */
1291
+ enabled: boolean;
1292
+ private _material;
1293
+ private _spatialTree;
1294
+ private _metaData;
1295
+ private _fragmentInstances;
1296
+ private _civil;
1297
+ private _visitedFragments;
1298
+ private _materialT;
1299
+ constructor(components: Components);
1300
+ /** {@link Disposable.dispose} */
1301
+ dispose(): void;
1302
+ /**
1303
+ * Sets up the IfcLoader component with the provided configuration.
1304
+ *
1305
+ * @param config - Optional configuration settings for the IfcLoader.
1306
+ * If not provided, the existing settings will be used.
1307
+ *
1308
+ * @returns A Promise that resolves when the setup process is completed.
1309
+ *
1310
+ * @remarks
1311
+ * If the 'autoSetWasm' option is enabled in the configuration,
1312
+ * the method will automatically set the WASM paths for the Web-IFC library.
1313
+ *
1314
+ * @example
1315
+ * '''typescript
1316
+ * const ifcLoader = new IfcLoader(components);
1317
+ * await ifcLoader.setup({ autoSetWasm: true });
1318
+ * '''
1319
+ */
1320
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1321
+ /**
1322
+ * Loads an IFC file and processes it for 3D visualization.
1314
1323
  *
1315
1324
  * @param data - The Uint8Array containing the IFC file data.
1316
1325
  * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
@@ -1361,43 +1370,70 @@ export declare class IfcLoader extends Component implements Disposable {
1361
1370
  private getGeometry;
1362
1371
  private autoSetWasm;
1363
1372
  }
1364
- import * as FRAGS from "@thatopen/fragments";
1365
- import { Components, Component } from "../../core";
1373
+ import * as WEBIFC from "web-ifc";
1374
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
1375
+ import { PropertiesStreamingSettings } from "./src";
1366
1376
  /**
1367
- * 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).
1377
+ * A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
1368
1378
  */
1369
- export declare class Hider extends Component {
1379
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
1370
1380
  /**
1371
1381
  * A unique identifier for the component.
1372
1382
  * This UUID is used to register the component within the Components system.
1373
1383
  */
1374
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1384
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1385
+ /**
1386
+ * An event that is triggered when properties are streamed from the IFC file.
1387
+ * The event provides the type of the IFC entity and the corresponding data.
1388
+ */
1389
+ readonly onPropertiesStreamed: AsyncEvent<{
1390
+ type: number;
1391
+ data: {
1392
+ [id: number]: any;
1393
+ };
1394
+ }>;
1395
+ /**
1396
+ * An event that is triggered to indicate the progress of the streaming process.
1397
+ * The event provides a number between 0 and 1 representing the progress percentage.
1398
+ */
1399
+ readonly onProgress: AsyncEvent<number>;
1400
+ /**
1401
+ * An event that is triggered when indices are streamed from the IFC file.
1402
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1403
+ */
1404
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1405
+ /** {@link Disposable.onDisposed} */
1406
+ readonly onDisposed: Event<string>;
1375
1407
  /** {@link Component.enabled} */
1376
1408
  enabled: boolean;
1377
- constructor(components: Components);
1378
1409
  /**
1379
- * Sets the visibility of fragments within the 3D scene.
1380
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1381
- * If 'items' is provided, only the specified fragments will be affected.
1382
- *
1383
- * @param visible - The visibility state to set for the fragments.
1384
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1385
- * If not provided, all fragments will be affected.
1386
- *
1387
- * @returns {void}
1410
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1388
1411
  */
1389
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1412
+ settings: PropertiesStreamingSettings;
1390
1413
  /**
1391
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1392
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1414
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1415
+ */
1416
+ webIfc: WEBIFC.IfcAPI;
1417
+ /** {@link Disposable.dispose} */
1418
+ dispose(): Promise<void>;
1419
+ /**
1420
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1393
1421
  *
1394
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1395
- * If not provided, all fragments will be isolated.
1422
+ * @param data - The Uint8Array containing the IFC file data.
1423
+ * @returns A Promise that resolves when the streaming process is complete.
1424
+ */
1425
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1426
+ /**
1427
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1396
1428
  *
1397
- * @returns {void}
1429
+ * @param loadCallback - A callback function that loads the IFC file data.
1430
+ * @returns A Promise that resolves when the streaming process is complete.
1398
1431
  */
1399
- isolate(items: FRAGS.FragmentIdMap): void;
1400
- private updateCulledVisibility;
1432
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1433
+ private readIfcFile;
1434
+ private streamIfcFile;
1435
+ private streamAllProperties;
1436
+ private cleanUp;
1401
1437
  }
1402
1438
  import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1403
1439
  import * as THREE from "three";
@@ -1544,295 +1580,254 @@ export declare class FragmentsManager extends Component implements Disposable {
1544
1580
  clone(model: FRAGS.FragmentsGroup, items?: FRAGS.FragmentIdMap): FragmentsGroup;
1545
1581
  }
1546
1582
  import * as WEBIFC from "web-ifc";
1547
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
1548
- import { PropertiesStreamingSettings } from "./src";
1583
+ import { Components, Disposable, Event, Component } from "../../core";
1584
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1549
1585
  /**
1550
- * A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
1586
+ * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
1551
1587
  */
1552
- export declare class IfcPropertiesTiler extends Component implements Disposable {
1588
+ export declare class IfcGeometryTiler extends Component implements Disposable {
1553
1589
  /**
1554
1590
  * A unique identifier for the component.
1555
1591
  * This UUID is used to register the component within the Components system.
1556
1592
  */
1557
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1593
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1558
1594
  /**
1559
- * An event that is triggered when properties are streamed from the IFC file.
1560
- * The event provides the type of the IFC entity and the corresponding data.
1595
+ * Event triggered when geometry is streamed.
1596
+ * Contains the streamed geometry data and its buffer.
1561
1597
  */
1562
- readonly onPropertiesStreamed: AsyncEvent<{
1563
- type: number;
1564
- data: {
1565
- [id: number]: any;
1566
- };
1598
+ readonly onGeometryStreamed: Event<{
1599
+ buffer: Uint8Array;
1600
+ data: StreamedGeometries;
1567
1601
  }>;
1568
1602
  /**
1569
- * An event that is triggered to indicate the progress of the streaming process.
1570
- * The event provides a number between 0 and 1 representing the progress percentage.
1603
+ * Event triggered when assets are streamed.
1604
+ * Contains the streamed assets.
1571
1605
  */
1572
- readonly onProgress: AsyncEvent<number>;
1606
+ readonly onAssetStreamed: Event<StreamedAsset[]>;
1573
1607
  /**
1574
- * An event that is triggered when indices are streamed from the IFC file.
1575
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1608
+ * Event triggered to indicate the progress of the streaming process.
1609
+ * Contains the progress percentage.
1576
1610
  */
1577
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1578
- /** {@link Disposable.onDisposed} */
1579
- readonly onDisposed: Event<string>;
1580
- /** {@link Component.enabled} */
1581
- enabled: boolean;
1611
+ readonly onProgress: Event<number>;
1582
1612
  /**
1583
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1613
+ * Event triggered when the IFC file is loaded.
1614
+ * Contains the loaded IFC file data.
1584
1615
  */
1585
- settings: PropertiesStreamingSettings;
1616
+ readonly onIfcLoaded: Event<Uint8Array>;
1617
+ /** {@link Disposable.onDisposed} */
1618
+ readonly onDisposed: Event<unknown>;
1586
1619
  /**
1587
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1620
+ * Settings for the IfcGeometryTiler.
1621
+ */
1622
+ settings: IfcStreamingSettings;
1623
+ /** {@link Component.enabled} */
1624
+ enabled: boolean;
1625
+ /**
1626
+ * The WebIFC API instance used for IFC file processing.
1588
1627
  */
1589
1628
  webIfc: WEBIFC.IfcAPI;
1629
+ private _nextAvailableID;
1630
+ private _splittedGeometries;
1631
+ private _spatialTree;
1632
+ private _metaData;
1633
+ private _visitedGeometries;
1634
+ private _streamSerializer;
1635
+ private _geometries;
1636
+ private _geometryCount;
1637
+ private _civil;
1638
+ private _groupSerializer;
1639
+ private _assets;
1640
+ private _meshesWithHoles;
1641
+ constructor(components: Components);
1590
1642
  /** {@link Disposable.dispose} */
1591
- dispose(): Promise<void>;
1643
+ dispose(): void;
1592
1644
  /**
1593
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1645
+ * This method streams the IFC file from a given buffer.
1594
1646
  *
1595
1647
  * @param data - The Uint8Array containing the IFC file data.
1596
1648
  * @returns A Promise that resolves when the streaming process is complete.
1649
+ *
1650
+ * @remarks
1651
+ * This method cleans up any resources after the streaming process is complete.
1652
+ *
1653
+ * @example
1654
+ * '''typescript
1655
+ * const ifcData = await fetch('path/to/ifc/file.ifc');
1656
+ * const rawBuffer = await response.arrayBuffer();
1657
+ * const ifcBuffer = new Uint8Array(rawBuffer);
1658
+ * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1659
+ * '''
1597
1660
  */
1598
1661
  streamFromBuffer(data: Uint8Array): Promise<void>;
1599
1662
  /**
1600
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1663
+ * This method streams the IFC file from a given callback.
1601
1664
  *
1602
- * @param loadCallback - A callback function that loads the IFC file data.
1665
+ * @param loadCallback - The callback function that will be used to load the IFC file.
1603
1666
  * @returns A Promise that resolves when the streaming process is complete.
1667
+ *
1668
+ * @remarks
1669
+ * This method cleans up any resources after the streaming process is complete.
1670
+ *
1604
1671
  */
1605
1672
  streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1606
1673
  private readIfcFile;
1607
1674
  private streamIfcFile;
1608
- private streamAllProperties;
1675
+ private streamAllGeometries;
1609
1676
  private cleanUp;
1677
+ private getMesh;
1678
+ private getGeometry;
1679
+ private streamAssets;
1680
+ private streamGeometries;
1681
+ private registerGeometryData;
1610
1682
  }
1611
- import * as THREE from "three";
1612
- import { Component, Components, Disposable, Event, World } from "../core";
1683
+ import * as FRAGS from "@thatopen/fragments";
1684
+ import { Components, Component } from "../../core";
1613
1685
  /**
1614
- * Configuration interface for the VertexPicker component.
1686
+ * 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).
1615
1687
  */
1616
- export interface VertexPickerConfig {
1688
+ export declare class Hider extends Component {
1617
1689
  /**
1618
- * If true, only vertices will be picked, not the closest point on the face.
1690
+ * A unique identifier for the component.
1691
+ * This UUID is used to register the component within the Components system.
1619
1692
  */
1620
- showOnlyVertex: boolean;
1693
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
1694
+ /** {@link Component.enabled} */
1695
+ enabled: boolean;
1696
+ constructor(components: Components);
1621
1697
  /**
1622
- * The maximum distance for snapping to a vertex.
1698
+ * Sets the visibility of fragments within the 3D scene.
1699
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
1700
+ * If 'items' is provided, only the specified fragments will be affected.
1701
+ *
1702
+ * @param visible - The visibility state to set for the fragments.
1703
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
1704
+ * If not provided, all fragments will be affected.
1705
+ *
1706
+ * @returns {void}
1623
1707
  */
1624
- snapDistance: number;
1708
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
1625
1709
  /**
1626
- * The HTML element to use for previewing the picked vertex.
1710
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
1711
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
1712
+ *
1713
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
1714
+ * If not provided, all fragments will be isolated.
1715
+ *
1716
+ * @returns {void}
1627
1717
  */
1628
- previewElement: HTMLElement;
1718
+ isolate(items: FRAGS.FragmentIdMap): void;
1719
+ private updateCulledVisibility;
1720
+ }
1721
+ export declare class UUID {
1722
+ private static _pattern;
1723
+ private static _lut;
1724
+ static create(): string;
1725
+ static validate(uuid: string): void;
1629
1726
  }
1727
+ import * as THREE from "three";
1728
+ import * as FRAGS from "@thatopen/fragments";
1729
+ import { Component, Components } from "../../core";
1630
1730
  /**
1631
- * A class that provides functionality for picking vertices in a 3D scene.
1731
+ * Represents an edge measurement result.
1632
1732
  */
1633
- export declare class VertexPicker extends Component implements Disposable {
1634
- /** {@link Disposable.onDisposed} */
1635
- readonly onDisposed: Event<unknown>;
1636
- /**
1637
- * An event that is triggered when a vertex is found.
1638
- * The event passes a THREE.Vector3 representing the position of the found vertex.
1639
- */
1640
- readonly onVertexFound: Event<THREE.Vector3>;
1733
+ export interface MeasureEdge {
1641
1734
  /**
1642
- * An event that is triggered when a vertex is lost.
1643
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
1735
+ * The distance between the two points of the edge.
1644
1736
  */
1645
- readonly onVertexLost: Event<THREE.Vector3>;
1737
+ distance: number;
1646
1738
  /**
1647
- * An event that is triggered when the picker is enabled or disabled
1739
+ * The two points that define the edge.
1648
1740
  */
1649
- readonly onEnabled: Event<boolean>;
1741
+ points: THREE.Vector3[];
1742
+ }
1743
+ /**
1744
+ * 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).
1745
+ */
1746
+ export declare class MeasurementUtils extends Component {
1650
1747
  /**
1651
- * A reference to the Components instance associated with this VertexPicker.
1748
+ * A unique identifier for the component.
1749
+ * This UUID is used to register the component within the Components system.
1652
1750
  */
1653
- components: Components;
1751
+ static uuid: string;
1752
+ /** {@link Component.enabled} */
1753
+ enabled: boolean;
1754
+ constructor(components: Components);
1654
1755
  /**
1655
- * A reference to the working plane used for vertex picking.
1656
- * This plane is used to determine which vertices are considered valid for picking.
1657
- * If this value is null, all vertices are considered valid.
1756
+ * Utility method to calculate the distance from a point to a line segment.
1757
+ *
1758
+ * @param point - The point from which to calculate the distance.
1759
+ * @param lineStart - The start point of the line segment.
1760
+ * @param lineEnd - The end point of the line segment.
1761
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
1762
+ * @returns The distance from the point to the line segment.
1658
1763
  */
1659
- workingPlane: THREE.Plane | null;
1660
- private _pickedPoint;
1661
- private _config;
1662
- private _enabled;
1764
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1663
1765
  /**
1664
- * Sets the enabled state of the VertexPicker.
1665
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1666
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1766
+ * Method to get the face of a mesh that contains a given triangle index.
1767
+ * It also returns the edges of the found face and their indices.
1667
1768
  *
1668
- * @param value - The new enabled state.
1769
+ * @param mesh - The mesh to get the face from. It must be indexed.
1770
+ * @param triangleIndex - The index of the triangle within the mesh.
1771
+ * @param instance - The instance of the mesh (optional).
1772
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1669
1773
  */
1670
- set enabled(value: boolean);
1774
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1775
+ edges: MeasureEdge[];
1776
+ indices: Set<number>;
1777
+ } | null;
1671
1778
  /**
1672
- * Gets the current enabled state of the VertexPicker.
1779
+ * Method to get the vertices and normal of a mesh face at a given index.
1780
+ * It also applies instance transformation if provided.
1673
1781
  *
1674
- * @returns The current enabled state.
1782
+ * @param mesh - The mesh to get the face from. It must be indexed.
1783
+ * @param faceIndex - The index of the face within the mesh.
1784
+ * @param instance - The instance of the mesh (optional).
1785
+ * @returns An object containing the vertices and normal of the face.
1786
+ * @throws Will throw an error if the geometry is not indexed.
1675
1787
  */
1676
- get enabled(): boolean;
1788
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1789
+ p1: THREE.Vector3;
1790
+ p2: THREE.Vector3;
1791
+ p3: THREE.Vector3;
1792
+ faceNormal: THREE.Vector3;
1793
+ };
1677
1794
  /**
1678
- * Sets the configuration for the VertexPicker component.
1679
- *
1680
- * @param value - A Partial object containing the configuration properties to update.
1681
- * The properties not provided in the value object will retain their current values.
1795
+ * Method to round the vector's components to a specified number of decimal places.
1796
+ * This is used to ensure numerical precision in edge detection.
1682
1797
  *
1683
- * @example
1684
- * '''typescript
1685
- * vertexPicker.config = {
1686
- * snapDistance: 0.5,
1687
- * showOnlyVertex: true,
1688
- * };
1689
- * '''
1798
+ * @param vector - The vector to round.
1799
+ * @returns The vector with rounded components.
1690
1800
  */
1691
- set config(value: Partial<VertexPickerConfig>);
1801
+ round(vector: THREE.Vector3): void;
1692
1802
  /**
1693
- * Gets the current configuration for the VertexPicker component.
1803
+ * Calculates the volume of a set of fragments.
1694
1804
  *
1695
- * @returns A copy of the current VertexPickerConfig object.
1805
+ * @param frags - A map of fragment IDs to their corresponding item IDs.
1806
+ * @returns The total volume of the fragments and the bounding sphere.
1696
1807
  *
1697
- * @example
1698
- * '''typescript
1699
- * const currentConfig = vertexPicker.config;
1700
- * console.log(currentConfig.snapDistance); // Output: 0.25
1701
- * '''
1808
+ * @remarks
1809
+ * This method creates a set of instanced meshes from the given fragments and item IDs.
1810
+ * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
1811
+ *
1812
+ * @throws Will throw an error if the geometry of the meshes is not indexed.
1813
+ * @throws Will throw an error if the fragment manager is not available.
1702
1814
  */
1703
- get config(): Partial<VertexPickerConfig>;
1704
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
1705
- /** {@link Disposable.dispose} */
1706
- dispose(): void;
1815
+ getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
1707
1816
  /**
1708
- * Performs the vertex picking operation based on the current state of the VertexPicker.
1709
- *
1710
- * @param world - The World instance to use for raycasting.
1817
+ * Calculates the total volume of a set of meshes.
1711
1818
  *
1712
- * @returns The current picked point, or null if no point is picked.
1819
+ * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
1820
+ * @returns The total volume of the meshes and the bounding sphere.
1713
1821
  *
1714
1822
  * @remarks
1715
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1716
- * If enabled, it performs raycasting to find the closest intersecting object.
1717
- * It then determines the closest vertex or point on the face, based on the configuration settings.
1718
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1719
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1720
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1823
+ * This method calculates the volume of each mesh in the provided array and returns the total volume
1824
+ * and its bounding sphere.
1825
+ *
1721
1826
  */
1722
- get(world: World): THREE.Vector3 | null;
1723
- private getClosestVertex;
1724
- private getVertices;
1725
- private getVertex;
1726
- }
1727
- import { XMLParser } from "fast-xml-parser";
1728
- import { Component, Configurable, Disposable, Event, World, DataMap } from "../../core";
1729
- import { BCFTopic, Topic, BCFTopicsConfigManager, BCFTopicsConfig } from "./src";
1730
- import { Viewpoint } from "../../core/Viewpoints";
1731
- export declare class BCFTopics extends Component implements Disposable, Configurable<BCFTopicsConfigManager, BCFTopicsConfig> {
1732
- static uuid: "de977976-e4f6-4e4f-a01a-204727839802";
1733
- enabled: boolean;
1734
- static xmlParser: XMLParser;
1735
- protected _defaultConfig: Required<BCFTopicsConfig>;
1736
- config: BCFTopicsConfigManager;
1737
- readonly list: DataMap<string, Topic>;
1738
- readonly onSetup: Event<unknown>;
1739
- isSetup: boolean;
1740
- setup(config?: Partial<BCFTopicsConfig>): void;
1741
- readonly onBCFImported: Event<Topic[]>;
1742
- /**
1743
- * Creates a new BCFTopic instance and adds it to the list.
1744
- *
1745
- * @param data - Optional partial BCFTopic object to initialize the new topic with.
1746
- * If not provided, default values will be used.
1747
- * @returns The newly created BCFTopic instance.
1748
- */
1749
- create(data?: Partial<BCFTopic>): Topic;
1750
- readonly onDisposed: Event<unknown>;
1751
- /**
1752
- * Disposes of the BCFTopics component and triggers the onDisposed event.
1753
- *
1754
- * @remarks
1755
- * This method clears the list of topics and triggers the onDisposed event.
1756
- * It also resets the onDisposed event listener.
1757
- */
1758
- dispose(): void;
1759
- /**
1760
- * Retrieves the unique set of topic types used across all topics.
1761
- *
1762
- * @returns A Set containing the unique topic types.
1763
- */
1764
- get usedTypes(): Set<string>;
1765
- /**
1766
- * Retrieves the unique set of topic statuses used across all topics.
1767
- *
1768
- * @returns A Set containing the unique topic statuses.
1769
- */
1770
- get usedStatuses(): Set<string>;
1771
- /**
1772
- * Retrieves the unique set of topic priorities used across all topics.
1773
- *
1774
- * @returns A Set containing the unique topic priorities.
1775
- * Note: This method filters out any null or undefined priorities.
1776
- */
1777
- get usedPriorities(): Set<string | undefined>;
1778
- /**
1779
- * Retrieves the unique set of topic stages used across all topics.
1780
- *
1781
- * @returns A Set containing the unique topic stages.
1782
- * Note: This method filters out any null or undefined stages.
1783
- */
1784
- get usedStages(): Set<string | undefined>;
1785
- /**
1786
- * Retrieves the unique set of users associated with topics.
1787
- *
1788
- * @returns A Set containing the unique users.
1789
- * Note: This method collects users from the creation author, assigned to, modified author, and comment authors.
1790
- */
1791
- get usedUsers(): Set<string>;
1792
- /**
1793
- * Retrieves the unique set of labels used across all topics.
1794
- *
1795
- * @returns A Set containing the unique labels.
1796
- */
1797
- get usedLabels(): Set<string>;
1798
- /**
1799
- * Updates the set of extensions (types, statuses, priorities, labels, stages, users) based on the current topics.
1800
- * This method iterates through each topic in the list and adds its properties to the corresponding sets in the config.
1801
- */
1802
- updateExtensions(): void;
1803
- /**
1804
- * Updates the references to viewpoints in the topics.
1805
- * This function iterates through each topic and checks if the viewpoints exist in the viewpoints list.
1806
- * If a viewpoint does not exist, it is removed from the topic's viewpoints.
1807
- */
1808
- updateViewpointReferences(): void;
1809
- /**
1810
- * Exports the given topics to a BCF (Building Collaboration Format) zip file.
1811
- *
1812
- * @param topics - The topics to export. Defaults to all topics in the list.
1813
- * @returns A promise that resolves to a Blob containing the exported BCF zip file.
1814
- */
1815
- export(topics?: Iterable<Topic>): Promise<Blob>;
1816
- private serializeExtensions;
1817
- private processMarkupComment;
1818
- private getMarkupComments;
1819
- private getMarkupLabels;
1820
- private getMarkupViewpoints;
1821
- private getMarkupRelatedTopics;
1822
- /**
1823
- * Loads BCF (Building Collaboration Format) data into the engine.
1824
- *
1825
- * @param world - The default world where the viewpoints are going to be created.
1826
- * @param data - The BCF data to load.
1827
- *
1828
- * @returns A promise that resolves to an object containing the created viewpoints and topics.
1829
- *
1830
- * @throws An error if the BCF version is not supported.
1831
- */
1832
- load(data: Uint8Array, world: World): Promise<{
1833
- viewpoints: Viewpoint[];
1834
- topics: Topic[];
1835
- }>;
1827
+ getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
1828
+ private getFaceData;
1829
+ private getVolumeOfMesh;
1830
+ private getSignedVolumeOfTriangle;
1836
1831
  }
1837
1832
  import * as WEBIFC from "web-ifc";
1838
1833
  import * as FRAG from "@thatopen/fragments";
@@ -2034,134 +2029,116 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
2034
2029
  */
2035
2030
  getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
2036
2031
  }
2037
- import * as THREE from "three";
2038
- import * as FRAGS from "@thatopen/fragments";
2039
- import { Component, Components } from "../../core";
2040
- /**
2041
- * Represents an edge measurement result.
2042
- */
2043
- export interface MeasureEdge {
2032
+ import { XMLParser } from "fast-xml-parser";
2033
+ import { Component, Configurable, Disposable, Event, World, DataMap } from "../../core";
2034
+ import { BCFTopic, Topic, BCFTopicsConfigManager, BCFTopicsConfig } from "./src";
2035
+ import { Viewpoint } from "../../core/Viewpoints";
2036
+ export declare class BCFTopics extends Component implements Disposable, Configurable<BCFTopicsConfigManager, BCFTopicsConfig> {
2037
+ static uuid: "de977976-e4f6-4e4f-a01a-204727839802";
2038
+ enabled: boolean;
2039
+ static xmlParser: XMLParser;
2040
+ protected _defaultConfig: Required<BCFTopicsConfig>;
2041
+ config: BCFTopicsConfigManager;
2042
+ readonly list: DataMap<string, Topic>;
2043
+ readonly onSetup: Event<unknown>;
2044
+ isSetup: boolean;
2045
+ setup(config?: Partial<BCFTopicsConfig>): void;
2046
+ readonly onBCFImported: Event<Topic[]>;
2044
2047
  /**
2045
- * The distance between the two points of the edge.
2048
+ * Creates a new BCFTopic instance and adds it to the list.
2049
+ *
2050
+ * @param data - Optional partial BCFTopic object to initialize the new topic with.
2051
+ * If not provided, default values will be used.
2052
+ * @returns The newly created BCFTopic instance.
2046
2053
  */
2047
- distance: number;
2054
+ create(data?: Partial<BCFTopic>): Topic;
2055
+ readonly onDisposed: Event<unknown>;
2048
2056
  /**
2049
- * The two points that define the edge.
2057
+ * Disposes of the BCFTopics component and triggers the onDisposed event.
2058
+ *
2059
+ * @remarks
2060
+ * This method clears the list of topics and triggers the onDisposed event.
2061
+ * It also resets the onDisposed event listener.
2050
2062
  */
2051
- points: THREE.Vector3[];
2052
- }
2053
- /**
2054
- * 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).
2055
- */
2056
- export declare class MeasurementUtils extends Component {
2063
+ dispose(): void;
2057
2064
  /**
2058
- * A unique identifier for the component.
2059
- * This UUID is used to register the component within the Components system.
2065
+ * Retrieves the unique set of topic types used across all topics.
2066
+ *
2067
+ * @returns A Set containing the unique topic types.
2060
2068
  */
2061
- static uuid: string;
2062
- /** {@link Component.enabled} */
2063
- enabled: boolean;
2064
- constructor(components: Components);
2069
+ get usedTypes(): Set<string>;
2065
2070
  /**
2066
- * Utility method to calculate the distance from a point to a line segment.
2071
+ * Retrieves the unique set of topic statuses used across all topics.
2067
2072
  *
2068
- * @param point - The point from which to calculate the distance.
2069
- * @param lineStart - The start point of the line segment.
2070
- * @param lineEnd - The end point of the line segment.
2071
- * @param clamp - If true, the distance will be clamped to the line segment's length.
2072
- * @returns The distance from the point to the line segment.
2073
+ * @returns A Set containing the unique topic statuses.
2073
2074
  */
2074
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
2075
+ get usedStatuses(): Set<string>;
2075
2076
  /**
2076
- * Method to get the face of a mesh that contains a given triangle index.
2077
- * It also returns the edges of the found face and their indices.
2077
+ * Retrieves the unique set of topic priorities used across all topics.
2078
2078
  *
2079
- * @param mesh - The mesh to get the face from. It must be indexed.
2080
- * @param triangleIndex - The index of the triangle within the mesh.
2081
- * @param instance - The instance of the mesh (optional).
2082
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
2079
+ * @returns A Set containing the unique topic priorities.
2080
+ * Note: This method filters out any null or undefined priorities.
2083
2081
  */
2084
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
2085
- edges: MeasureEdge[];
2086
- indices: Set<number>;
2087
- } | null;
2082
+ get usedPriorities(): Set<string | undefined>;
2088
2083
  /**
2089
- * Method to get the vertices and normal of a mesh face at a given index.
2090
- * It also applies instance transformation if provided.
2084
+ * Retrieves the unique set of topic stages used across all topics.
2091
2085
  *
2092
- * @param mesh - The mesh to get the face from. It must be indexed.
2093
- * @param faceIndex - The index of the face within the mesh.
2094
- * @param instance - The instance of the mesh (optional).
2095
- * @returns An object containing the vertices and normal of the face.
2096
- * @throws Will throw an error if the geometry is not indexed.
2086
+ * @returns A Set containing the unique topic stages.
2087
+ * Note: This method filters out any null or undefined stages.
2097
2088
  */
2098
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
2099
- p1: THREE.Vector3;
2100
- p2: THREE.Vector3;
2101
- p3: THREE.Vector3;
2102
- faceNormal: THREE.Vector3;
2103
- };
2089
+ get usedStages(): Set<string | undefined>;
2104
2090
  /**
2105
- * Method to round the vector's components to a specified number of decimal places.
2106
- * This is used to ensure numerical precision in edge detection.
2091
+ * Retrieves the unique set of users associated with topics.
2107
2092
  *
2108
- * @param vector - The vector to round.
2109
- * @returns The vector with rounded components.
2093
+ * @returns A Set containing the unique users.
2094
+ * Note: This method collects users from the creation author, assigned to, modified author, and comment authors.
2110
2095
  */
2111
- round(vector: THREE.Vector3): void;
2096
+ get usedUsers(): Set<string>;
2112
2097
  /**
2113
- * Calculates the volume of a set of fragments.
2114
- *
2115
- * @param frags - A map of fragment IDs to their corresponding item IDs.
2116
- * @returns The total volume of the fragments and the bounding sphere.
2098
+ * Retrieves the unique set of labels used across all topics.
2117
2099
  *
2118
- * @remarks
2119
- * This method creates a set of instanced meshes from the given fragments and item IDs.
2120
- * It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
2100
+ * @returns A Set containing the unique labels.
2101
+ */
2102
+ get usedLabels(): Set<string>;
2103
+ /**
2104
+ * Updates the set of extensions (types, statuses, priorities, labels, stages, users) based on the current topics.
2105
+ * This method iterates through each topic in the list and adds its properties to the corresponding sets in the config.
2106
+ */
2107
+ updateExtensions(): void;
2108
+ /**
2109
+ * Updates the references to viewpoints in the topics.
2110
+ * This function iterates through each topic and checks if the viewpoints exist in the viewpoints list.
2111
+ * If a viewpoint does not exist, it is removed from the topic's viewpoints.
2112
+ */
2113
+ updateViewpointReferences(): void;
2114
+ /**
2115
+ * Exports the given topics to a BCF (Building Collaboration Format) zip file.
2121
2116
  *
2122
- * @throws Will throw an error if the geometry of the meshes is not indexed.
2123
- * @throws Will throw an error if the fragment manager is not available.
2117
+ * @param topics - The topics to export. Defaults to all topics in the list.
2118
+ * @returns A promise that resolves to a Blob containing the exported BCF zip file.
2124
2119
  */
2125
- getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
2120
+ export(topics?: Iterable<Topic>): Promise<Blob>;
2121
+ private serializeExtensions;
2122
+ private processMarkupComment;
2123
+ private getMarkupComments;
2124
+ private getMarkupLabels;
2125
+ private getMarkupViewpoints;
2126
+ private getMarkupRelatedTopics;
2126
2127
  /**
2127
- * Calculates the total volume of a set of meshes.
2128
+ * Loads BCF (Building Collaboration Format) data into the engine.
2128
2129
  *
2129
- * @param meshes - An array of meshes or instanced meshes to calculate the volume from.
2130
- * @returns The total volume of the meshes and the bounding sphere.
2130
+ * @param world - The default world where the viewpoints are going to be created.
2131
+ * @param data - The BCF data to load.
2131
2132
  *
2132
- * @remarks
2133
- * This method calculates the volume of each mesh in the provided array and returns the total volume
2134
- * and its bounding sphere.
2133
+ * @returns A promise that resolves to an object containing the created viewpoints and topics.
2135
2134
  *
2135
+ * @throws An error if the BCF version is not supported.
2136
2136
  */
2137
- getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
2138
- private getFaceData;
2139
- private getVolumeOfMesh;
2140
- private getSignedVolumeOfTriangle;
2137
+ load(data: Uint8Array, world: World): Promise<{
2138
+ viewpoints: Viewpoint[];
2139
+ topics: Topic[];
2140
+ }>;
2141
2141
  }
2142
- import { BooleanSettingsControl } from "../../Types";
2143
- import { Viewpoints } from "../index";
2144
- import { Configurator } from "../../ConfigManager";
2145
- /**
2146
- * Configuration interface for the Viewpoints general behavior.
2147
- */
2148
- export interface ViewpointsConfig {
2149
- /**
2150
- * Indicates whether to overwrite the fragments colors when applying viewpoints.
2151
- * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any.
2152
- * @default false
2153
- */
2154
- overwriteColors: boolean;
2155
- }
2156
- type ViewpointsConfigType = {
2157
- overwriteColors: BooleanSettingsControl;
2158
- };
2159
- export declare class ViewpointsConfigManager extends Configurator<Viewpoints, ViewpointsConfigType> {
2160
- protected _config: ViewpointsConfigType;
2161
- get overwriteColors(): boolean;
2162
- set overwriteColors(value: boolean);
2163
- }
2164
- export {};
2165
2142
  import * as WEBIFC from "web-ifc";
2166
2143
  import { FragmentsGroup } from "@thatopen/fragments";
2167
2144
  import { Component, Disposable, Event, Components } from "../../core";
@@ -2518,10 +2495,36 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2518
2495
  resize(size?: THREE.Vector2): void;
2519
2496
  private updatePlanes;
2520
2497
  }
2521
- import * as FRAGS from "@thatopen/fragments";
2498
+ import { BooleanSettingsControl } from "../../Types";
2499
+ import { Viewpoints } from "../index";
2500
+ import { Configurator } from "../../ConfigManager";
2501
+ /**
2502
+ * Configuration interface for the Viewpoints general behavior.
2503
+ */
2504
+ export interface ViewpointsConfig {
2505
+ /**
2506
+ * Indicates whether to overwrite the fragments colors when applying viewpoints.
2507
+ * @remarks BCF Viewpoints comes with information to indicate the colors to be applied to components, if any.
2508
+ * @default false
2509
+ */
2510
+ overwriteColors: boolean;
2511
+ }
2512
+ type ViewpointsConfigType = {
2513
+ overwriteColors: BooleanSettingsControl;
2514
+ };
2515
+ export declare class ViewpointsConfigManager extends Configurator<Viewpoints, ViewpointsConfigType> {
2516
+ protected _config: ViewpointsConfigType;
2517
+ get overwriteColors(): boolean;
2518
+ set overwriteColors(value: boolean);
2519
+ }
2520
+ export {};
2522
2521
  import * as WEBIFC from "web-ifc";
2523
- export declare class SpatialIdsFinder {
2524
- static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2522
+ import { IfcItemsCategories } from "../../../ifc";
2523
+ export declare class SpatialStructure {
2524
+ itemsByFloor: IfcItemsCategories;
2525
+ private _units;
2526
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2527
+ cleanUp(): void;
2525
2528
  }
2526
2529
  import * as WEBIFC from "web-ifc";
2527
2530
  /** Configuration of the IFC-fragment conversion. */
@@ -2566,6 +2569,11 @@ export declare class IfcFragmentSettings {
2566
2569
  */
2567
2570
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2568
2571
  }
2572
+ import * as FRAGS from "@thatopen/fragments";
2573
+ import * as WEBIFC from "web-ifc";
2574
+ export declare class SpatialIdsFinder {
2575
+ static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2576
+ }
2569
2577
  import * as WEBIFC from "web-ifc";
2570
2578
  export interface IfcItemsCategories {
2571
2579
  [itemID: number]: number;
@@ -2573,12 +2581,6 @@ export interface IfcItemsCategories {
2573
2581
  export declare class IfcCategories {
2574
2582
  getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2575
2583
  }
2576
- /**
2577
- * 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.
2578
- */
2579
- export declare const IfcCategoryMap: {
2580
- [key: number]: string;
2581
- };
2582
2584
  /**
2583
2585
  * 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.
2584
2586
  *
@@ -2590,6 +2592,12 @@ export declare const IfcCategoryMap: {
2590
2592
  export declare const IfcElements: {
2591
2593
  [key: number]: string;
2592
2594
  };
2595
+ /**
2596
+ * 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.
2597
+ */
2598
+ export declare const IfcCategoryMap: {
2599
+ [key: number]: string;
2600
+ };
2593
2601
  import * as FRAGS from "@thatopen/fragments";
2594
2602
  export declare class IfcPropertiesUtils {
2595
2603
  static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
@@ -2615,18 +2623,6 @@ export declare class IfcPropertiesUtils {
2615
2623
  static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2616
2624
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2617
2625
  }
2618
- import * as WEBIFC from "web-ifc";
2619
- import { IfcItemsCategories } from "../../../ifc";
2620
- export declare class SpatialStructure {
2621
- itemsByFloor: IfcItemsCategories;
2622
- private _units;
2623
- setUp(webIfc: WEBIFC.IfcAPI): void;
2624
- cleanUp(): void;
2625
- }
2626
- /**
2627
- * A Set of unique numbers representing different types of IFC geometries.
2628
- */
2629
- export declare const GeometryTypes: Set<number>;
2630
2626
  import * as THREE from "three";
2631
2627
  import { BooleanSettingsControl, ColorSettingsControl, NumberSettingControl } from "../../Types";
2632
2628
  import { Configurator } from "../../ConfigManager";
@@ -2661,66 +2657,122 @@ export declare class ClipperConfigManager extends Configurator<Clipper, ClipperC
2661
2657
  }
2662
2658
  export {};
2663
2659
  /**
2664
- * 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.
2660
+ * A Set of unique numbers representing different types of IFC geometries.
2665
2661
  */
2666
- export declare class Event<T> {
2662
+ export declare const GeometryTypes: Set<number>;
2663
+ import { ControlsSchema, ControlEntry } from "../../Types";
2664
+ import { Components } from "../../Components";
2665
+ export declare abstract class Configurator<T, U extends ControlsSchema> {
2666
+ protected abstract _config: U;
2667
+ protected _component: T;
2668
+ name: string;
2669
+ get controls(): U;
2670
+ constructor(component: T, components: Components, name: string);
2671
+ copyEntry(controlEntry: ControlEntry): ControlEntry;
2672
+ }
2673
+ import * as THREE from "three";
2674
+ import { Disposable, Event } from "../../Types";
2675
+ /**
2676
+ * 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.
2677
+ */
2678
+ export declare class Mouse implements Disposable {
2679
+ dom: HTMLCanvasElement;
2680
+ private _event?;
2681
+ private _position;
2682
+ /** {@link Disposable.onDisposed} */
2683
+ readonly onDisposed: Event<unknown>;
2684
+ constructor(dom: HTMLCanvasElement);
2667
2685
  /**
2668
- * Add a callback to this event instance.
2669
- * @param handler - the callback to be added to this event.
2686
+ * The real position of the mouse of the Three.js canvas.
2670
2687
  */
2671
- add(handler: T extends void ? {
2672
- (): void;
2673
- } : {
2674
- (data: T): void;
2675
- }): void;
2688
+ get position(): THREE.Vector2;
2689
+ /** {@link Disposable.dispose} */
2690
+ dispose(): void;
2691
+ private getPositionY;
2692
+ private getPositionX;
2693
+ private updateMouseInfo;
2694
+ private setupEvents;
2695
+ }
2696
+ import * as THREE from "three";
2697
+ import { Components } from "../../Components";
2698
+ import { Event, World, Disposable } from "../../Types";
2699
+ import { Mouse } from "./mouse";
2700
+ /**
2701
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
2702
+ */
2703
+ export declare class SimpleRaycaster implements Disposable {
2704
+ /** {@link Component.enabled} */
2705
+ enabled: boolean;
2706
+ /** The components instance to which this Raycaster belongs. */
2707
+ components: Components;
2708
+ /** {@link Disposable.onDisposed} */
2709
+ readonly onDisposed: Event<unknown>;
2710
+ /** The position of the mouse in the screen. */
2711
+ readonly mouse: Mouse;
2676
2712
  /**
2677
- * Removes a callback from this event instance.
2678
- * @param handler - the callback to be removed from this event.
2713
+ * A reference to the Three.js Raycaster instance.
2714
+ * This is used for raycasting operations.
2679
2715
  */
2680
- remove(handler: T extends void ? {
2681
- (): void;
2682
- } : {
2683
- (data: T): void;
2684
- }): void;
2685
- /** Triggers all the callbacks assigned to this event. */
2686
- trigger: (data?: T) => void;
2687
- /** Gets rid of all the suscribed events. */
2688
- reset(): void;
2689
- private handlers;
2716
+ readonly three: THREE.Raycaster;
2717
+ /**
2718
+ * A reference to the world instance to which this Raycaster belongs.
2719
+ * This is used to access the camera and meshes.
2720
+ */
2721
+ world: World;
2722
+ constructor(components: Components, world: World);
2723
+ /** {@link Disposable.dispose} */
2724
+ dispose(): void;
2725
+ /**
2726
+ * Throws a ray from the camera to the mouse or touch event point and returns
2727
+ * the first item found. This also takes into account the clipping planes
2728
+ * used by the renderer.
2729
+ *
2730
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
2731
+ * to query. If not provided, it will query all the meshes stored in
2732
+ * {@link Components.meshes}.
2733
+ */
2734
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
2735
+ /**
2736
+ * Casts a ray from a given origin in a given direction and returns the first item found.
2737
+ * This method also takes into account the clipping planes used by the renderer.
2738
+ *
2739
+ * @param origin - The origin of the ray.
2740
+ * @param direction - The direction of the ray.
2741
+ * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
2742
+ * @returns The first intersection found or 'null' if no intersection was found.
2743
+ */
2744
+ castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
2745
+ private intersect;
2746
+ private filterClippingPlanes;
2690
2747
  }
2691
2748
  /**
2692
2749
  * 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.
2693
2750
  */
2694
- export declare class AsyncEvent<T> {
2751
+ export declare class Event<T> {
2695
2752
  /**
2696
2753
  * Add a callback to this event instance.
2697
2754
  * @param handler - the callback to be added to this event.
2698
2755
  */
2699
2756
  add(handler: T extends void ? {
2700
- (): Promise<void>;
2757
+ (): void;
2701
2758
  } : {
2702
- (data: T): Promise<void>;
2759
+ (data: T): void;
2703
2760
  }): void;
2704
2761
  /**
2705
2762
  * Removes a callback from this event instance.
2706
2763
  * @param handler - the callback to be removed from this event.
2707
2764
  */
2708
2765
  remove(handler: T extends void ? {
2709
- (): Promise<void>;
2766
+ (): void;
2710
2767
  } : {
2711
- (data: T): Promise<void>;
2768
+ (data: T): void;
2712
2769
  }): void;
2713
2770
  /** Triggers all the callbacks assigned to this event. */
2714
- trigger: (data?: T) => Promise<void>;
2771
+ trigger: (data?: T) => void;
2715
2772
  /** Gets rid of all the suscribed events. */
2716
2773
  reset(): void;
2717
2774
  private handlers;
2718
2775
  }
2719
- import { InverseAttribute } from "./types";
2720
- export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585, {
2721
- forRelating: InverseAttribute;
2722
- forRelated: InverseAttribute;
2723
- }>;
2724
2776
  import * as THREE from "three";
2725
2777
  import CameraControls from "camera-controls";
2726
2778
  import { Event } from "./event";
@@ -2828,53 +2880,34 @@ export interface CameraControllable {
2828
2880
  */
2829
2881
  controls: CameraControls;
2830
2882
  }
2831
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2832
- import { Components } from "../../Components";
2833
- /**
2834
- * Base class of the library. Useful for finding out the interfaces something implements.
2835
- */
2836
- export declare abstract class Base {
2837
- components: Components;
2838
- constructor(components: Components);
2839
- /** Whether is component is {@link Disposable}. */
2840
- isDisposeable: () => this is Disposable;
2841
- /** Whether is component is {@link Resizeable}. */
2842
- isResizeable: () => this is Resizeable;
2843
- /** Whether is component is {@link Updateable}. */
2844
- isUpdateable: () => this is Updateable;
2845
- /** Whether is component is {@link Hideable}. */
2846
- isHideable: () => this is Hideable;
2847
- /** Whether is component is {@link Configurable}. */
2848
- isConfigurable: () => this is Configurable<any, any>;
2849
- }
2850
- import * as THREE from "three";
2851
- import CameraControls from "camera-controls";
2852
- import { BaseWorldItem } from "./base-world-item";
2853
- import { CameraControllable } from "./interfaces";
2854
2883
  /**
2855
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2884
+ * 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.
2856
2885
  */
2857
- export declare abstract class BaseCamera extends BaseWorldItem {
2858
- /**
2859
- * Whether the camera is enabled or not.
2860
- */
2861
- abstract enabled: boolean;
2862
- /**
2863
- * The Three.js camera instance.
2864
- */
2865
- abstract three: THREE.Camera;
2886
+ export declare class AsyncEvent<T> {
2866
2887
  /**
2867
- * Optional CameraControls instance for controlling the camera.
2868
- * This property is only available if the camera is controllable.
2888
+ * Add a callback to this event instance.
2889
+ * @param handler - the callback to be added to this event.
2869
2890
  */
2870
- abstract controls?: CameraControls;
2891
+ add(handler: T extends void ? {
2892
+ (): Promise<void>;
2893
+ } : {
2894
+ (data: T): Promise<void>;
2895
+ }): void;
2871
2896
  /**
2872
- * Checks whether the instance is {@link CameraControllable}.
2873
- *
2874
- * @returns True if the instance is controllable, false otherwise.
2897
+ * Removes a callback from this event instance.
2898
+ * @param handler - the callback to be removed from this event.
2875
2899
  */
2876
- hasCameraControls: () => this is CameraControllable;
2877
- }
2900
+ remove(handler: T extends void ? {
2901
+ (): Promise<void>;
2902
+ } : {
2903
+ (data: T): Promise<void>;
2904
+ }): void;
2905
+ /** Triggers all the callbacks assigned to this event. */
2906
+ trigger: (data?: T) => Promise<void>;
2907
+ /** Gets rid of all the suscribed events. */
2908
+ reset(): void;
2909
+ private handlers;
2910
+ }
2878
2911
  import { Base } from "./base";
2879
2912
  /**
2880
2913
  * 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.
@@ -2888,6 +2921,76 @@ export declare abstract class Component extends Base {
2888
2921
  */
2889
2922
  abstract enabled: boolean;
2890
2923
  }
2924
+ import { Base } from "./base";
2925
+ import { World } from "./world";
2926
+ import { Event } from "./event";
2927
+ import { Components } from "../../Components";
2928
+ /**
2929
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2930
+ */
2931
+ export declare abstract class BaseWorldItem extends Base {
2932
+ readonly worlds: Map<string, World>;
2933
+ /**
2934
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2935
+ * The event payload contains the world instance and the action ("added" or "removed").
2936
+ */
2937
+ readonly onWorldChanged: Event<{
2938
+ world: World;
2939
+ action: "added" | "removed";
2940
+ }>;
2941
+ /**
2942
+ * The current world this item is associated with. It can be null if no world is currently active.
2943
+ */
2944
+ currentWorld: World | null;
2945
+ protected constructor(components: Components);
2946
+ }
2947
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2948
+ import { Components } from "../../Components";
2949
+ /**
2950
+ * Base class of the library. Useful for finding out the interfaces something implements.
2951
+ */
2952
+ export declare abstract class Base {
2953
+ components: Components;
2954
+ constructor(components: Components);
2955
+ /** Whether is component is {@link Disposable}. */
2956
+ isDisposeable: () => this is Disposable;
2957
+ /** Whether is component is {@link Resizeable}. */
2958
+ isResizeable: () => this is Resizeable;
2959
+ /** Whether is component is {@link Updateable}. */
2960
+ isUpdateable: () => this is Updateable;
2961
+ /** Whether is component is {@link Hideable}. */
2962
+ isHideable: () => this is Hideable;
2963
+ /** Whether is component is {@link Configurable}. */
2964
+ isConfigurable: () => this is Configurable<any, any>;
2965
+ }
2966
+ import * as THREE from "three";
2967
+ import CameraControls from "camera-controls";
2968
+ import { BaseWorldItem } from "./base-world-item";
2969
+ import { CameraControllable } from "./interfaces";
2970
+ /**
2971
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2972
+ */
2973
+ export declare abstract class BaseCamera extends BaseWorldItem {
2974
+ /**
2975
+ * Whether the camera is enabled or not.
2976
+ */
2977
+ abstract enabled: boolean;
2978
+ /**
2979
+ * The Three.js camera instance.
2980
+ */
2981
+ abstract three: THREE.Camera;
2982
+ /**
2983
+ * Optional CameraControls instance for controlling the camera.
2984
+ * This property is only available if the camera is controllable.
2985
+ */
2986
+ abstract controls?: CameraControls;
2987
+ /**
2988
+ * Checks whether the instance is {@link CameraControllable}.
2989
+ *
2990
+ * @returns True if the instance is controllable, false otherwise.
2991
+ */
2992
+ hasCameraControls: () => this is CameraControllable;
2993
+ }
2891
2994
  import * as THREE from "three";
2892
2995
  import { Vector2 } from "three";
2893
2996
  import { Event } from "./event";
@@ -2953,54 +3056,11 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
2953
3056
  */
2954
3057
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2955
3058
  }
2956
- import { Base } from "./base";
2957
- import { World } from "./world";
2958
- import { Event } from "./event";
2959
- import { Components } from "../../Components";
2960
- /**
2961
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2962
- */
2963
- export declare abstract class BaseWorldItem extends Base {
2964
- readonly worlds: Map<string, World>;
2965
- /**
2966
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2967
- * The event payload contains the world instance and the action ("added" or "removed").
2968
- */
2969
- readonly onWorldChanged: Event<{
2970
- world: World;
2971
- action: "added" | "removed";
2972
- }>;
2973
- /**
2974
- * The current world this item is associated with. It can be null if no world is currently active.
2975
- */
2976
- currentWorld: World | null;
2977
- protected constructor(components: Components);
2978
- }
2979
- import * as THREE from "three";
2980
- import { Disposable } from "./interfaces";
2981
- import { Event } from "./event";
2982
- import { Components } from "../../Components";
2983
- import { BaseWorldItem } from "./base-world-item";
2984
- /**
2985
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2986
- */
2987
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2988
- /** {@link Disposable.onDisposed} */
2989
- readonly onDisposed: Event<unknown>;
2990
- /**
2991
- * Abstract property representing the three.js object associated with this scene.
2992
- * It should be implemented by subclasses.
2993
- */
2994
- abstract three: THREE.Object3D;
2995
- /** The set of directional lights managed by this scene component. */
2996
- directionalLights: Map<string, THREE.DirectionalLight>;
2997
- /** The set of ambient lights managed by this scene component. */
2998
- ambientLights: Map<string, THREE.AmbientLight>;
2999
- protected constructor(components: Components);
3000
- /** {@link Disposable.dispose} */
3001
- dispose(): void;
3002
- deleteAllLights(): void;
3003
- }
3059
+ import { InverseAttribute } from "./types";
3060
+ export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585, {
3061
+ forRelating: InverseAttribute;
3062
+ forRelated: InverseAttribute;
3063
+ }>;
3004
3064
  import * as THREE from "three";
3005
3065
  import { BaseScene } from "./base-scene";
3006
3066
  import { BaseCamera } from "./base-camera";
@@ -3035,77 +3095,30 @@ export interface World extends Disposable, Updateable {
3035
3095
  */
3036
3096
  isDisposing: boolean;
3037
3097
  }
3098
+ import * as THREE from "three";
3099
+ import { Disposable } from "./interfaces";
3038
3100
  import { Event } from "./event";
3101
+ import { Components } from "../../Components";
3102
+ import { BaseWorldItem } from "./base-world-item";
3039
3103
  /**
3040
- * A class that extends the built-in Set class and provides additional functionality.
3041
- * It triggers events when items are added, deleted, or the set is cleared.
3042
- *
3043
- * @template T - The type of elements in the set.
3104
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
3044
3105
  */
3045
- export declare class DataSet<T> extends Set<T> {
3046
- /**
3047
- * An event that is triggered when a new item is added to the set.
3048
- */
3049
- readonly onItemAdded: Event<T>;
3050
- /**
3051
- * An event that is triggered when an item is deleted from the set.
3052
- */
3053
- readonly onItemDeleted: Event<unknown>;
3054
- /**
3055
- * An event that is triggered when the set is cleared.
3056
- */
3057
- readonly onCleared: Event<unknown>;
3058
- /**
3059
- * Constructs a new instance of the DataSet class.
3060
- *
3061
- * @param iterable - An optional iterable object to initialize the set with.
3062
- */
3063
- constructor(iterable?: Iterable<T> | null);
3064
- /**
3065
- * Clears the set and triggers the onCleared event.
3066
- */
3067
- clear(): void;
3068
- /**
3069
- * Adds one or multiple values to the set and triggers the onItemAdded event per each.
3070
- *
3071
- * @param value - The value to add to the set.
3072
- * @returns - The set instance.
3073
- */
3074
- add(...value: T[]): this;
3075
- /**
3076
- * A function that acts as a guard for adding items to the set.
3077
- * It determines whether a given value should be allowed to be added to the set.
3078
- *
3079
- * @param value - The value to be checked against the guard.
3080
- * @returns A boolean indicating whether the value should be allowed to be added to the set.
3081
- * By default, this function always returns true, allowing all values to be added.
3082
- * You can override this behavior by providing a custom implementation.
3083
- */
3084
- guard: (value: T) => boolean;
3085
- /**
3086
- * Deletes a value from the set and triggers the onItemDeleted event.
3087
- *
3088
- * @param value - The value to delete from the set.
3089
- * @returns - True if the value was successfully deleted, false otherwise.
3090
- */
3091
- delete(value: T): boolean;
3106
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
3107
+ /** {@link Disposable.onDisposed} */
3108
+ readonly onDisposed: Event<unknown>;
3092
3109
  /**
3093
- * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
3110
+ * Abstract property representing the three.js object associated with this scene.
3111
+ * It should be implemented by subclasses.
3094
3112
  */
3113
+ abstract three: THREE.Object3D;
3114
+ /** The set of directional lights managed by this scene component. */
3115
+ directionalLights: Map<string, THREE.DirectionalLight>;
3116
+ /** The set of ambient lights managed by this scene component. */
3117
+ ambientLights: Map<string, THREE.AmbientLight>;
3118
+ protected constructor(components: Components);
3119
+ /** {@link Disposable.dispose} */
3095
3120
  dispose(): void;
3096
- }
3097
- import { Component } from "./component";
3098
- export type ComponentUIElement = {
3099
- name: string;
3100
- componentID: string;
3101
- attributes: {
3102
- [name: string]: string;
3103
- };
3104
- get: () => HTMLElement;
3105
- };
3106
- export declare abstract class ComponentWithUI extends Component {
3107
- abstract name: string;
3108
- abstract getUI(): ComponentUIElement[];
3121
+ deleteAllLights(): void;
3109
3122
  }
3110
3123
  import { Event } from "./event";
3111
3124
  /**
@@ -3178,119 +3191,77 @@ export declare class DataMap<K, V> extends Map<K, V> {
3178
3191
  */
3179
3192
  dispose(): void;
3180
3193
  }
3181
- import * as THREE from "three";
3182
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3194
+ import { Event } from "./event";
3183
3195
  /**
3184
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3196
+ * A class that extends the built-in Set class and provides additional functionality.
3197
+ * It triggers events when items are added, deleted, or the set is cleared.
3185
3198
  *
3186
- * @template T - The type of the scene. Default is BaseScene.
3187
- * @template U - The type of the camera. Default is BaseCamera.
3188
- * @template S - The type of the renderer. Default is BaseRenderer.
3199
+ * @template T - The type of elements in the set.
3189
3200
  */
3190
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3201
+ export declare class DataSet<T> extends Set<T> {
3191
3202
  /**
3192
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3203
+ * An event that is triggered when a new item is added to the set.
3193
3204
  */
3194
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3195
- /** {@link Updateable.onAfterUpdate} */
3196
- readonly onAfterUpdate: Event<unknown>;
3197
- /** {@link Updateable.onBeforeUpdate} */
3198
- readonly onBeforeUpdate: Event<unknown>;
3199
- /** {@link Disposable.onDisposed} */
3200
- readonly onDisposed: Event<unknown>;
3205
+ readonly onItemAdded: Event<T>;
3201
3206
  /**
3202
- * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
3207
+ * An event that is triggered when an item is deleted from the set.
3203
3208
  */
3204
- isDisposing: boolean;
3209
+ readonly onItemDeleted: Event<unknown>;
3205
3210
  /**
3206
- * Indicates whether the world is currently enabled.
3207
- * When disabled, the world will not be updated.
3211
+ * An event that is triggered when the set is cleared.
3208
3212
  */
3209
- enabled: boolean;
3213
+ readonly onCleared: Event<unknown>;
3210
3214
  /**
3211
- * A unique identifier for the world.
3215
+ * Constructs a new instance of the DataSet class.
3216
+ *
3217
+ * @param iterable - An optional iterable object to initialize the set with.
3212
3218
  */
3213
- uuid: string;
3219
+ constructor(iterable?: Iterable<T> | null);
3214
3220
  /**
3215
- * An optional name for the world.
3221
+ * Clears the set and triggers the onCleared event.
3216
3222
  */
3217
- name?: string;
3218
- private _scene?;
3219
- private _camera?;
3220
- private _renderer;
3221
- /**
3222
- * Getter for the scene. If no scene is initialized, it throws an error.
3223
- * @returns The current scene.
3224
- */
3225
- get scene(): T;
3226
- /**
3227
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3228
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3229
- * @param scene - The new scene to be set.
3230
- */
3231
- set scene(scene: T);
3223
+ clear(): void;
3232
3224
  /**
3233
- * Getter for the camera. If no camera is initialized, it throws an error.
3234
- * @returns The current camera.
3225
+ * Adds one or multiple values to the set and triggers the onItemAdded event per each.
3226
+ *
3227
+ * @param value - The value to add to the set.
3228
+ * @returns - The set instance.
3235
3229
  */
3236
- get camera(): U;
3230
+ add(...value: T[]): this;
3237
3231
  /**
3238
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3239
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3240
- * @param camera - The new camera to be set.
3232
+ * A function that acts as a guard for adding items to the set.
3233
+ * It determines whether a given value should be allowed to be added to the set.
3234
+ *
3235
+ * @param value - The value to be checked against the guard.
3236
+ * @returns A boolean indicating whether the value should be allowed to be added to the set.
3237
+ * By default, this function always returns true, allowing all values to be added.
3238
+ * You can override this behavior by providing a custom implementation.
3241
3239
  */
3242
- set camera(camera: U);
3240
+ guard: (value: T) => boolean;
3243
3241
  /**
3244
- * Getter for the renderer.
3245
- * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3242
+ * Deletes a value from the set and triggers the onItemDeleted event.
3243
+ *
3244
+ * @param value - The value to delete from the set.
3245
+ * @returns - True if the value was successfully deleted, false otherwise.
3246
3246
  */
3247
- get renderer(): S | null;
3247
+ delete(value: T): boolean;
3248
3248
  /**
3249
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3250
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3251
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3252
- * @param renderer - The new renderer to be set or null to remove the current renderer.
3249
+ * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
3253
3250
  */
3254
- set renderer(renderer: S | null);
3255
- /** {@link Updateable.update} */
3256
- update(delta?: number): void;
3257
- /** {@link Disposable.dispose} */
3258
- dispose(disposeResources?: boolean): void;
3251
+ dispose(): void;
3259
3252
  }
3260
- import { ControlsSchema, ControlEntry } from "../../Types";
3261
- import { Components } from "../../Components";
3262
- export declare abstract class Configurator<T, U extends ControlsSchema> {
3263
- protected abstract _config: U;
3264
- protected _component: T;
3253
+ import { Component } from "./component";
3254
+ export type ComponentUIElement = {
3265
3255
  name: string;
3266
- get controls(): U;
3267
- constructor(component: T, components: Components, name: string);
3268
- copyEntry(controlEntry: ControlEntry): ControlEntry;
3269
- }
3270
- import * as THREE from "three";
3271
- import { BaseScene, Configurable, Event } from "../../Types";
3272
- import { Components } from "../../Components";
3273
- import { SimpleSceneConfig, SimpleSceneConfigManager } from "./simple-scene-config";
3274
- /**
3275
- * 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.
3276
- */
3277
- export declare class SimpleScene extends BaseScene implements Configurable<SimpleSceneConfigManager, SimpleSceneConfig> {
3278
- /** {@link Configurable.onSetup} */
3279
- readonly onSetup: Event<unknown>;
3280
- /** {@link Configurable.isSetup} */
3281
- isSetup: boolean;
3282
- /**
3283
- * The underlying Three.js scene object.
3284
- * It is used to define the 3D space containing objects, lights, and cameras.
3285
- */
3286
- three: THREE.Scene;
3287
- /** {@link Configurable.config} */
3288
- config: SimpleSceneConfigManager;
3289
- protected _defaultConfig: SimpleSceneConfig;
3290
- constructor(components: Components);
3291
- /** {@link Configurable.setup} */
3292
- setup(config?: Partial<SimpleSceneConfig>): void;
3293
- dispose(): void;
3256
+ componentID: string;
3257
+ attributes: {
3258
+ [name: string]: string;
3259
+ };
3260
+ get: () => HTMLElement;
3261
+ };
3262
+ export declare abstract class ComponentWithUI extends Component {
3263
+ abstract name: string;
3264
+ abstract getUI(): ComponentUIElement[];
3294
3265
  }
3295
3266
  import * as THREE from "three";
3296
3267
  export interface BooleanSettingsControl {
@@ -3334,110 +3305,654 @@ export type ControlEntry = BooleanSettingsControl | ColorSettingsControl | TextS
3334
3305
  export interface ControlsSchema {
3335
3306
  [name: string]: ControlEntry | ControlsSchema;
3336
3307
  }
3308
+ import { SimplePlane } from "../../Clipper";
3309
+ import { DataSet } from "../../Types";
3310
+ export interface ViewpointCamera {
3311
+ direction: {
3312
+ x: number;
3313
+ y: number;
3314
+ z: number;
3315
+ };
3316
+ position: {
3317
+ x: number;
3318
+ y: number;
3319
+ z: number;
3320
+ };
3321
+ aspectRatio: number;
3322
+ }
3323
+ export interface ViewpointPerspectiveCamera extends ViewpointCamera {
3324
+ fov: number;
3325
+ }
3326
+ export interface ViewpointOrthographicCamera extends ViewpointCamera {
3327
+ viewToWorldScale: number;
3328
+ }
3329
+ export interface BCFViewpoint {
3330
+ title?: string;
3331
+ guid: string;
3332
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3333
+ selectionComponents: Iterable<string>;
3334
+ exceptionComponents: Iterable<string>;
3335
+ clippingPlanes: DataSet<SimplePlane>;
3336
+ spacesVisible: boolean;
3337
+ spaceBoundariesVisible: boolean;
3338
+ openingsVisible: boolean;
3339
+ defaultVisibility: boolean;
3340
+ }
3337
3341
  import * as THREE from "three";
3338
- import { BaseRenderer, Event } from "../../Types";
3342
+ import * as FRAGS from "@thatopen/fragments";
3343
+ import { BCFViewpoint, ViewpointOrthographicCamera, ViewpointPerspectiveCamera } from "./types";
3344
+ import { CameraProjection } from "../../OrthoPerspectiveCamera";
3339
3345
  import { Components } from "../../Components";
3340
- /**
3341
- * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
3342
- */
3343
- export declare class SimpleRenderer extends BaseRenderer {
3346
+ import { DataMap, DataSet, World } from "../../Types";
3347
+ import { SimplePlane } from "../../Clipper";
3348
+ export declare class Viewpoint implements BCFViewpoint {
3349
+ title?: string;
3350
+ guid: string;
3344
3351
  /**
3345
- * Indicates whether the renderer is enabled. If it's not, it won't be updated.
3346
- * Default is 'true'.
3352
+ * ClippingPlanes can be used to define a subsection of a building model that is related to the topic.
3353
+ * Each clipping plane is defined by Location and Direction.
3354
+ * The Direction vector points in the invisible direction meaning the half-space that is clipped.
3347
3355
  */
3348
- enabled: boolean;
3356
+ clippingPlanes: DataSet<SimplePlane>;
3357
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3349
3358
  /**
3350
- * The HTML container of the THREE.js canvas where the scene is rendered.
3359
+ * A list of components GUIDs to hide when defaultVisibility = true or to show when defaultVisibility = false
3351
3360
  */
3352
- container: HTMLElement;
3361
+ readonly exceptionComponents: DataSet<string>;
3353
3362
  /**
3354
- * The THREE.js WebGLRenderer instance.
3363
+ * A list of components GUIDs that should be selected (highlighted) when displaying a viewpoint.
3355
3364
  */
3356
- three: THREE.WebGLRenderer;
3357
- protected _canvas: HTMLCanvasElement;
3358
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
3359
- protected _resizeObserver: ResizeObserver | null;
3360
- protected onContainerUpdated: Event<unknown>;
3361
- private _resizing;
3365
+ readonly selectionComponents: DataSet<string>;
3362
3366
  /**
3363
- * Constructor for the SimpleRenderer class.
3364
- *
3365
- * @param components - The components instance.
3366
- * @param container - The HTML container where the THREE.js canvas will be rendered.
3367
- * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
3367
+ * A map of colors and components GUIDs that should be colorized when displaying a viewpoint.
3368
+ * For this to work, call viewpoint.colorize()
3368
3369
  */
3369
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
3370
- /** {@link Updateable.update} */
3371
- update(): void;
3372
- /** {@link Disposable.dispose} */
3373
- dispose(): void;
3374
- /** {@link Resizeable.getSize}. */
3375
- getSize(): THREE.Vector2;
3376
- /** {@link Resizeable.resize} */
3377
- resize: (size?: THREE.Vector2) => void;
3370
+ readonly componentColors: DataMap<string, string[]>;
3378
3371
  /**
3379
- * Sets up and manages the event listeners for the renderer.
3380
- *
3381
- * @param active - A boolean indicating whether to activate or deactivate the event listeners.
3382
- *
3383
- * @throws Will throw an error if the renderer does not have an HTML container.
3372
+ * Boolean flags to allow fine control over the visibility of spaces.
3373
+ * A typical use of these flags is when DefaultVisibility=true but spaces should remain hidden.
3374
+ * @default false
3384
3375
  */
3385
- setupEvents(active: boolean): void;
3386
- private resizeEvent;
3387
- private setupRenderer;
3388
- private onContextLost;
3389
- private onContextBack;
3390
- }
3391
- import * as THREE from "three";
3392
- import CameraControls from "camera-controls";
3393
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
3394
- import { Components } from "../../Components";
3395
- /**
3396
- * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
3397
- */
3398
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3399
- /** {@link Updateable.onBeforeUpdate} */
3400
- readonly onBeforeUpdate: Event<SimpleCamera>;
3401
- /** {@link Updateable.onAfterUpdate} */
3402
- readonly onAfterUpdate: Event<SimpleCamera>;
3376
+ spacesVisible: boolean;
3403
3377
  /**
3404
- * Event that is triggered when the aspect of the camera has been updated.
3405
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
3378
+ * Boolean flags to allow fine control over the visibility of space boundaries.
3379
+ * A typical use of these flags is when DefaultVisibility=true but space boundaries should remain hidden.
3380
+ * @default false
3406
3381
  */
3407
- readonly onAspectUpdated: Event<unknown>;
3408
- /** {@link Disposable.onDisposed} */
3409
- readonly onDisposed: Event<string>;
3382
+ spaceBoundariesVisible: boolean;
3410
3383
  /**
3411
- * A three.js PerspectiveCamera or OrthographicCamera instance.
3412
- * This camera is used for rendering the scene.
3384
+ * Boolean flags to allow fine control over the visibility of openings.
3385
+ * A typical use of these flags is when DefaultVisibility=true but openings should remain hidden.
3386
+ * @default false
3413
3387
  */
3414
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3415
- private _allControls;
3388
+ openingsVisible: boolean;
3416
3389
  /**
3417
- * The object that controls the camera. An instance of
3418
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3419
- * Transforming the camera directly will have no effect: you need to use this
3420
- * object to move, rotate, look at objects, etc.
3390
+ * When true, all components should be visible unless listed in the exceptions
3391
+ * When false all components should be invisible unless listed in the exceptions
3421
3392
  */
3422
- get controls(): CameraControls;
3393
+ defaultVisibility: boolean;
3394
+ private get _selectionModelIdMap();
3395
+ private get _exceptionModelIdMap();
3423
3396
  /**
3424
- * Getter for the enabled state of the camera controls.
3425
- * If the current world is null, it returns false.
3426
- * Otherwise, it returns the enabled state of the camera controls.
3427
- *
3428
- * @returns {boolean} The enabled state of the camera controls.
3397
+ * A list of components that should be selected (highlighted) when displaying a viewpoint.
3398
+ * @returns The fragmentIdMap for components marked as selections.
3429
3399
  */
3430
- get enabled(): boolean;
3400
+ get selection(): FRAGS.FragmentIdMap;
3431
3401
  /**
3432
- * Setter for the enabled state of the camera controls.
3433
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3434
- *
3435
- * @param {boolean} enabled - The new enabled state of the camera controls.
3402
+ * A list of components to hide when defaultVisibility = true or to show when defaultVisibility = false
3403
+ * @returns The fragmentIdMap for components marked as exceptions.
3436
3404
  */
3437
- set enabled(enabled: boolean);
3438
- constructor(components: Components);
3439
- /** {@link Disposable.dispose} */
3440
- dispose(): void;
3405
+ get exception(): FRAGS.FragmentIdMap;
3406
+ /**
3407
+ * Retrieves the projection type of the viewpoint's camera.
3408
+ *
3409
+ * @returns A string representing the projection type of the viewpoint's camera.
3410
+ * It can be either 'Perspective' or 'Orthographic'.
3411
+ */
3412
+ get projection(): CameraProjection;
3413
+ /**
3414
+ * Retrieves the position vector of the viewpoint's camera.
3415
+ *
3416
+ * @remarks
3417
+ * The position vector represents the camera's position in the world coordinate system.
3418
+ * The function applies the base coordinate system transformation to the position vector.
3419
+ *
3420
+ * @returns A THREE.Vector3 representing the position of the viewpoint's camera.
3421
+ */
3422
+ get position(): THREE.Vector3;
3423
+ /**
3424
+ * Retrieves the direction vector of the viewpoint's camera.
3425
+ *
3426
+ * @remarks
3427
+ * The direction vector represents the direction in which the camera is pointing.
3428
+ * It is calculated by extracting the x, y, and z components from the camera's direction property.
3429
+ *
3430
+ * @returns A THREE.Vector3 representing the direction of the viewpoint's camera.
3431
+ */
3432
+ get direction(): THREE.Vector3;
3433
+ private _components;
3434
+ /**
3435
+ * Represents the world in which the viewpoints are created and managed.
3436
+ */
3437
+ readonly world: World;
3438
+ private get _managerVersion();
3439
+ /**
3440
+ * Retrieves the list of BCF topics associated with the current viewpoint.
3441
+ *
3442
+ * @remarks
3443
+ * This function retrieves the BCFTopics manager from the components,
3444
+ * then filters the list of topics to find those associated with the current viewpoint.
3445
+ *
3446
+ * @returns An array of BCF topics associated with the current viewpoint.
3447
+ */
3448
+ get topics(): import("../../../openbim/BCFTopics").Topic[];
3449
+ constructor(components: Components, world: World, _config?: {
3450
+ data?: Partial<BCFViewpoint>;
3451
+ setCamera?: boolean;
3452
+ });
3453
+ /**
3454
+ * Adds components to the viewpoint based on the provided fragment ID map.
3455
+ *
3456
+ * @param fragmentIdMap - A map containing fragment IDs as keys and arrays of express IDs as values.
3457
+ *
3458
+ * @returns A Promise that resolves when the components have been added to the viewpoint.
3459
+ */
3460
+ addComponentsFromMap(fragmentIdMap: FRAGS.FragmentIdMap): Promise<void>;
3461
+ /**
3462
+ * Sets the properties of the viewpoint with the provided data.
3463
+ *
3464
+ * @remarks The guid will be ommited as it shouldn't change after it has been initially set.
3465
+ *
3466
+ * @param data - An object containing the properties to be set.
3467
+ * The properties not included in the object will remain unchanged.
3468
+ *
3469
+ * @returns The viewpoint instance with the updated properties.
3470
+ */
3471
+ set(data: Partial<BCFViewpoint>): this;
3472
+ /**
3473
+ * Sets the viewpoint of the camera in the world.
3474
+ *
3475
+ * @remarks
3476
+ * This function calculates the target position based on the viewpoint information.
3477
+ * It sets the visibility of the viewpoint components and then applies the viewpoint using the camera's controls.
3478
+ *
3479
+ * @param transition - Indicates whether the camera movement should have a transition effect.
3480
+ * Default value is 'true'.
3481
+ *
3482
+ * @throws An error if the world's camera does not have camera controls.
3483
+ *
3484
+ * @returns A Promise that resolves when the camera has been set.
3485
+ */
3486
+ go(transition?: boolean): Promise<void>;
3487
+ /**
3488
+ * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
3489
+ *
3490
+ * @remarks
3491
+ * This function retrieves the camera's position, direction, and aspect ratio from the world's camera and renderer.
3492
+ * It then calculates the camera's perspective or orthographic settings based on the camera type.
3493
+ * Finally, it updates the viewpoint's camera settings and updates the viewpoint to the Viewpoints manager.
3494
+ *
3495
+ * @throws An error if the world's camera does not have camera controls.
3496
+ * @throws An error if the world's renderer is not available.
3497
+ */
3498
+ updateCamera(): void;
3499
+ /**
3500
+ * Applies color to the components in the viewpoint based on their GUIDs.
3501
+ *
3502
+ * This function iterates through the 'componentColors' map, retrieves the fragment IDs
3503
+ * corresponding to each color, and then uses the 'Classifier' to apply the color to those fragments.
3504
+ *
3505
+ * @remarks
3506
+ * The color is applied using the 'Classifier.setColor' method, which sets the color of the specified fragments.
3507
+ * The color is provided as a hexadecimal string, prefixed with a '#'.
3508
+ */
3509
+ colorize(): void;
3510
+ /**
3511
+ * Resets the colors of all components in the viewpoint to their original color.
3512
+ * This method iterates through the 'componentColors' map, retrieves the fragment IDs
3513
+ * corresponding to each color, and then uses the 'Classifier' to reset the color of those fragments.
3514
+ */
3515
+ resetColors(): void;
3516
+ private createComponentTags;
3517
+ /**
3518
+ * Serializes the viewpoint into a buildingSMART compliant XML string for export.
3519
+ *
3520
+ * @param version - The version of the BCF Manager to use for serialization.
3521
+ * If not provided, the current version of the manager will be used.
3522
+ *
3523
+ * @returns A Promise that resolves to an XML string representing the viewpoint.
3524
+ * The XML string follows the BCF VisualizationInfo schema.
3525
+ *
3526
+ * @throws An error if the world's camera does not have camera controls.
3527
+ * @throws An error if the world's renderer is not available.
3528
+ */
3529
+ serialize(version?: string): Promise<string>;
3530
+ }
3531
+ import { NavigationMode } from "./types";
3532
+ import { OrthoPerspectiveCamera } from "../index";
3533
+ /**
3534
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3535
+ */
3536
+ export declare class FirstPersonMode implements NavigationMode {
3537
+ private camera;
3538
+ /** {@link NavigationMode.enabled} */
3539
+ enabled: boolean;
3540
+ /** {@link NavigationMode.id} */
3541
+ readonly id = "FirstPerson";
3542
+ constructor(camera: OrthoPerspectiveCamera);
3543
+ /** {@link NavigationMode.set} */
3544
+ set(active: boolean): void;
3545
+ private setupFirstPersonCamera;
3546
+ }
3547
+ import { NavigationMode } from "./types";
3548
+ import { OrthoPerspectiveCamera } from "../index";
3549
+ /**
3550
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3551
+ */
3552
+ export declare class OrbitMode implements NavigationMode {
3553
+ camera: OrthoPerspectiveCamera;
3554
+ /** {@link NavigationMode.enabled} */
3555
+ enabled: boolean;
3556
+ /** {@link NavigationMode.id} */
3557
+ readonly id = "Orbit";
3558
+ constructor(camera: OrthoPerspectiveCamera);
3559
+ /** {@link NavigationMode.set} */
3560
+ set(active: boolean): void;
3561
+ private activateOrbitControls;
3562
+ }
3563
+ import { NavigationMode } from "./types";
3564
+ import { OrthoPerspectiveCamera } from "../index";
3565
+ /**
3566
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3567
+ */
3568
+ export declare class PlanMode implements NavigationMode {
3569
+ private camera;
3570
+ /** {@link NavigationMode.enabled} */
3571
+ enabled: boolean;
3572
+ /** {@link NavigationMode.id} */
3573
+ readonly id = "Plan";
3574
+ private mouseAction1?;
3575
+ private mouseAction2?;
3576
+ private mouseInitialized;
3577
+ private readonly defaultAzimuthSpeed;
3578
+ private readonly defaultPolarSpeed;
3579
+ constructor(camera: OrthoPerspectiveCamera);
3580
+ /** {@link NavigationMode.set} */
3581
+ set(active: boolean): void;
3582
+ }
3583
+ import * as THREE from "three";
3584
+ import { Hideable, Event, World, Disposable, Configurable } from "../../Types";
3585
+ import { Components } from "../../Components";
3586
+ import { SimpleGridConfig, SimpleGridConfigManager } from "./simple-grid-config";
3587
+ /**
3588
+ * 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).
3589
+ */
3590
+ export declare class SimpleGrid implements Hideable, Disposable, Configurable<SimpleGridConfigManager, SimpleGridConfig> {
3591
+ /** {@link Disposable.onDisposed} */
3592
+ readonly onDisposed: Event<unknown>;
3593
+ /** {@link Configurable.onSetup} */
3594
+ readonly onSetup: Event<unknown>;
3595
+ /** {@link Configurable.isSetup} */
3596
+ isSetup: boolean;
3597
+ /** The world instance to which this Raycaster belongs. */
3598
+ world: World;
3599
+ /** The components instance to which this grid belongs. */
3600
+ components: Components;
3601
+ /** {@link Configurable.config} */
3602
+ config: SimpleGridConfigManager;
3603
+ protected _defaultConfig: SimpleGridConfig;
3604
+ /** {@link Hideable.visible} */
3605
+ get visible(): boolean;
3606
+ /** {@link Hideable.visible} */
3607
+ set visible(visible: boolean);
3608
+ /** The material of the grid. */
3609
+ get material(): THREE.ShaderMaterial;
3610
+ /**
3611
+ * Whether the grid should fade away with distance. Recommended to be true for
3612
+ * perspective cameras and false for orthographic cameras.
3613
+ */
3614
+ get fade(): boolean;
3615
+ /**
3616
+ * Whether the grid should fade away with distance. Recommended to be true for
3617
+ * perspective cameras and false for orthographic cameras.
3618
+ */
3619
+ set fade(active: boolean);
3620
+ /** The Three.js mesh that contains the infinite grid. */
3621
+ readonly three: THREE.Mesh;
3622
+ private _fade;
3623
+ constructor(components: Components, world: World);
3624
+ /** {@link Configurable.setup} */
3625
+ setup(config?: Partial<SimpleGridConfig>): void;
3626
+ /** {@link Disposable.dispose} */
3627
+ dispose(): void;
3628
+ private setupEvents;
3629
+ private updateZoom;
3630
+ }
3631
+ /**
3632
+ * The projection system of the camera.
3633
+ */
3634
+ export type CameraProjection = "Perspective" | "Orthographic";
3635
+ /**
3636
+ * The extensible list of supported navigation modes.
3637
+ */
3638
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3639
+ /**
3640
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3641
+ */
3642
+ export interface NavigationMode {
3643
+ /** The unique ID of this navigation mode. */
3644
+ id: NavModeID;
3645
+ /**
3646
+ * Enable or disable this navigation mode.
3647
+ * When a new navigation mode is enabled, the previous navigation mode
3648
+ * must be disabled.
3649
+ *
3650
+ * @param active - whether to enable or disable this mode.
3651
+ * @param options - any additional data required to enable or disable it.
3652
+ * */
3653
+ set: (active: boolean, options?: any) => void;
3654
+ /** Whether this navigation mode is active or not. */
3655
+ enabled: boolean;
3656
+ }
3657
+ import * as THREE from "three";
3658
+ import { BooleanSettingsControl, ColorSettingsControl, NumberSettingControl } from "../../Types";
3659
+ import { Configurator } from "../../ConfigManager";
3660
+ import { SimpleGrid } from "./simple-grid";
3661
+ type SimpleGridConfigType = {
3662
+ visible: BooleanSettingsControl;
3663
+ color: ColorSettingsControl;
3664
+ primarySize: NumberSettingControl;
3665
+ secondarySize: NumberSettingControl;
3666
+ distance: NumberSettingControl;
3667
+ };
3668
+ /**
3669
+ * Configuration interface for the {@link SimpleGrid}.
3670
+ */
3671
+ export interface SimpleGridConfig {
3672
+ /**
3673
+ * The color of the grid lines.
3674
+ */
3675
+ color: THREE.Color;
3676
+ /**
3677
+ * The size of the primary grid lines.
3678
+ */
3679
+ primarySize: number;
3680
+ /**
3681
+ * The size of the secondary grid lines.
3682
+ */
3683
+ secondarySize: number;
3684
+ /**
3685
+ * The distance at which the grid lines start to fade away.
3686
+ */
3687
+ distance: number;
3688
+ }
3689
+ export declare class SimpleGridConfigManager extends Configurator<SimpleGrid, SimpleGridConfigType> {
3690
+ protected _config: SimpleGridConfigType;
3691
+ get visible(): boolean;
3692
+ set visible(value: boolean);
3693
+ get color(): THREE.Color;
3694
+ set color(value: THREE.Color);
3695
+ get primarySize(): number;
3696
+ set primarySize(value: number);
3697
+ get secondarySize(): number;
3698
+ set secondarySize(value: number);
3699
+ get distance(): number;
3700
+ set distance(value: number);
3701
+ }
3702
+ export {};
3703
+ import * as THREE from "three";
3704
+ import { CameraProjection } from "./types";
3705
+ import { Event } from "../../Types";
3706
+ import { OrthoPerspectiveCamera } from "../index";
3707
+ /**
3708
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3709
+ */
3710
+ export declare class ProjectionManager {
3711
+ /**
3712
+ * Event that fires when the {@link CameraProjection} changes.
3713
+ */
3714
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3715
+ /**
3716
+ * Current projection mode of the camera.
3717
+ * Default is "Perspective".
3718
+ */
3719
+ current: CameraProjection;
3720
+ /**
3721
+ * The camera controlled by this ProjectionManager.
3722
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
3723
+ */
3724
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3725
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
3726
+ matchOrthoDistanceEnabled: boolean;
3727
+ private _component;
3728
+ private _previousDistance;
3729
+ constructor(camera: OrthoPerspectiveCamera);
3730
+ /**
3731
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3732
+ *
3733
+ * @param projection - the new projection to set. If it is the current projection,
3734
+ * it will have no effect.
3735
+ */
3736
+ set(projection: CameraProjection): Promise<void>;
3737
+ /**
3738
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3739
+ * and vice versa.
3740
+ */
3741
+ toggle(): Promise<void>;
3742
+ private setOrthoCamera;
3743
+ private getPerspectiveDims;
3744
+ private setupOrthoCamera;
3745
+ private getDistance;
3746
+ private setPerspectiveCamera;
3747
+ }
3748
+ import * as THREE from "three";
3749
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3750
+ /**
3751
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3752
+ *
3753
+ * @template T - The type of the scene. Default is BaseScene.
3754
+ * @template U - The type of the camera. Default is BaseCamera.
3755
+ * @template S - The type of the renderer. Default is BaseRenderer.
3756
+ */
3757
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3758
+ /**
3759
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3760
+ */
3761
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3762
+ /** {@link Updateable.onAfterUpdate} */
3763
+ readonly onAfterUpdate: Event<unknown>;
3764
+ /** {@link Updateable.onBeforeUpdate} */
3765
+ readonly onBeforeUpdate: Event<unknown>;
3766
+ /** {@link Disposable.onDisposed} */
3767
+ readonly onDisposed: Event<unknown>;
3768
+ /**
3769
+ * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
3770
+ */
3771
+ isDisposing: boolean;
3772
+ /**
3773
+ * Indicates whether the world is currently enabled.
3774
+ * When disabled, the world will not be updated.
3775
+ */
3776
+ enabled: boolean;
3777
+ /**
3778
+ * A unique identifier for the world.
3779
+ */
3780
+ uuid: string;
3781
+ /**
3782
+ * An optional name for the world.
3783
+ */
3784
+ name?: string;
3785
+ private _scene?;
3786
+ private _camera?;
3787
+ private _renderer;
3788
+ /**
3789
+ * Getter for the scene. If no scene is initialized, it throws an error.
3790
+ * @returns The current scene.
3791
+ */
3792
+ get scene(): T;
3793
+ /**
3794
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3795
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3796
+ * @param scene - The new scene to be set.
3797
+ */
3798
+ set scene(scene: T);
3799
+ /**
3800
+ * Getter for the camera. If no camera is initialized, it throws an error.
3801
+ * @returns The current camera.
3802
+ */
3803
+ get camera(): U;
3804
+ /**
3805
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3806
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3807
+ * @param camera - The new camera to be set.
3808
+ */
3809
+ set camera(camera: U);
3810
+ /**
3811
+ * Getter for the renderer.
3812
+ * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3813
+ */
3814
+ get renderer(): S | null;
3815
+ /**
3816
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3817
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3818
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3819
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
3820
+ */
3821
+ set renderer(renderer: S | null);
3822
+ /** {@link Updateable.update} */
3823
+ update(delta?: number): void;
3824
+ /** {@link Disposable.dispose} */
3825
+ dispose(disposeResources?: boolean): void;
3826
+ }
3827
+ import * as THREE from "three";
3828
+ import { BaseScene, Configurable, Event } from "../../Types";
3829
+ import { Components } from "../../Components";
3830
+ import { SimpleSceneConfig, SimpleSceneConfigManager } from "./simple-scene-config";
3831
+ /**
3832
+ * 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.
3833
+ */
3834
+ export declare class SimpleScene extends BaseScene implements Configurable<SimpleSceneConfigManager, SimpleSceneConfig> {
3835
+ /** {@link Configurable.onSetup} */
3836
+ readonly onSetup: Event<unknown>;
3837
+ /** {@link Configurable.isSetup} */
3838
+ isSetup: boolean;
3839
+ /**
3840
+ * The underlying Three.js scene object.
3841
+ * It is used to define the 3D space containing objects, lights, and cameras.
3842
+ */
3843
+ three: THREE.Scene;
3844
+ /** {@link Configurable.config} */
3845
+ config: SimpleSceneConfigManager;
3846
+ protected _defaultConfig: SimpleSceneConfig;
3847
+ constructor(components: Components);
3848
+ /** {@link Configurable.setup} */
3849
+ setup(config?: Partial<SimpleSceneConfig>): void;
3850
+ dispose(): void;
3851
+ }
3852
+ import * as THREE from "three";
3853
+ import { BaseRenderer, Event } from "../../Types";
3854
+ import { Components } from "../../Components";
3855
+ /**
3856
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
3857
+ */
3858
+ export declare class SimpleRenderer extends BaseRenderer {
3859
+ /**
3860
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
3861
+ * Default is 'true'.
3862
+ */
3863
+ enabled: boolean;
3864
+ /**
3865
+ * The HTML container of the THREE.js canvas where the scene is rendered.
3866
+ */
3867
+ container: HTMLElement;
3868
+ /**
3869
+ * The THREE.js WebGLRenderer instance.
3870
+ */
3871
+ three: THREE.WebGLRenderer;
3872
+ protected _canvas: HTMLCanvasElement;
3873
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
3874
+ protected _resizeObserver: ResizeObserver | null;
3875
+ protected onContainerUpdated: Event<unknown>;
3876
+ private _resizing;
3877
+ /**
3878
+ * Constructor for the SimpleRenderer class.
3879
+ *
3880
+ * @param components - The components instance.
3881
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
3882
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
3883
+ */
3884
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
3885
+ /** {@link Updateable.update} */
3886
+ update(): void;
3887
+ /** {@link Disposable.dispose} */
3888
+ dispose(): void;
3889
+ /** {@link Resizeable.getSize}. */
3890
+ getSize(): THREE.Vector2;
3891
+ /** {@link Resizeable.resize} */
3892
+ resize: (size?: THREE.Vector2) => void;
3893
+ /**
3894
+ * Sets up and manages the event listeners for the renderer.
3895
+ *
3896
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
3897
+ *
3898
+ * @throws Will throw an error if the renderer does not have an HTML container.
3899
+ */
3900
+ setupEvents(active: boolean): void;
3901
+ private resizeEvent;
3902
+ private setupRenderer;
3903
+ private onContextLost;
3904
+ private onContextBack;
3905
+ }
3906
+ import * as THREE from "three";
3907
+ import CameraControls from "camera-controls";
3908
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
3909
+ import { Components } from "../../Components";
3910
+ /**
3911
+ * A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
3912
+ */
3913
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3914
+ /** {@link Updateable.onBeforeUpdate} */
3915
+ readonly onBeforeUpdate: Event<SimpleCamera>;
3916
+ /** {@link Updateable.onAfterUpdate} */
3917
+ readonly onAfterUpdate: Event<SimpleCamera>;
3918
+ /**
3919
+ * Event that is triggered when the aspect of the camera has been updated.
3920
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
3921
+ */
3922
+ readonly onAspectUpdated: Event<unknown>;
3923
+ /** {@link Disposable.onDisposed} */
3924
+ readonly onDisposed: Event<string>;
3925
+ /**
3926
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
3927
+ * This camera is used for rendering the scene.
3928
+ */
3929
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3930
+ private _allControls;
3931
+ /**
3932
+ * The object that controls the camera. An instance of
3933
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3934
+ * Transforming the camera directly will have no effect: you need to use this
3935
+ * object to move, rotate, look at objects, etc.
3936
+ */
3937
+ get controls(): CameraControls;
3938
+ /**
3939
+ * Getter for the enabled state of the camera controls.
3940
+ * If the current world is null, it returns false.
3941
+ * Otherwise, it returns the enabled state of the camera controls.
3942
+ *
3943
+ * @returns {boolean} The enabled state of the camera controls.
3944
+ */
3945
+ get enabled(): boolean;
3946
+ /**
3947
+ * Setter for the enabled state of the camera controls.
3948
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3949
+ *
3950
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3951
+ */
3952
+ set enabled(enabled: boolean);
3953
+ constructor(components: Components);
3954
+ /** {@link Disposable.dispose} */
3955
+ dispose(): void;
3441
3956
  /** {@link Updateable.update} */
3442
3957
  update(_delta: number): void;
3443
3958
  /**
@@ -3570,169 +4085,11 @@ export declare class DistanceRenderer {
3570
4085
  /**
3571
4086
  * The function that the culler uses to reprocess the scene. Generally it's
3572
4087
  * better to call needsUpdate, but you can also call this to force it.
3573
- * @param force if true, it will refresh the scene even if needsUpdate is
3574
- * not true.
3575
- */
3576
- compute: () => Promise<void>;
3577
- private handleWorkerMessage;
3578
- }
3579
- import * as THREE from "three";
3580
- import { Components } from "../../Components";
3581
- import { AsyncEvent, Configurable, Event, World } from "../../Types";
3582
- import { CullerRendererConfig, CullerRendererConfigManager } from "./culler-renderer-config";
3583
- /**
3584
- * A base renderer to determine visibility on screen.
3585
- */
3586
- export declare class CullerRenderer implements Configurable<CullerRendererConfigManager, CullerRendererConfig> {
3587
- /** {@link Configurable.onSetup} */
3588
- readonly onSetup: Event<unknown>;
3589
- /** {@link Disposable.onDisposed} */
3590
- readonly onDisposed: Event<string>;
3591
- /**
3592
- * Fires after making the visibility check to the meshes. It lists the
3593
- * meshes that are currently visible, and the ones that were visible
3594
- * just before but not anymore.
3595
- */
3596
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3597
- /**
3598
- * Whether this renderer is active or not. If not, it won't render anything.
3599
- */
3600
- enabled: boolean;
3601
- /**
3602
- * Needs to check whether there are objects that need to be hidden or shown.
3603
- * You can bind this to the camera movement, to a certain interval, etc.
3604
- */
3605
- needsUpdate: boolean;
3606
- /** The components instance to which this renderer belongs. */
3607
- components: Components;
3608
- /** The render target used to render the visibility scene. */
3609
- renderTarget: THREE.WebGLRenderTarget<THREE.Texture>;
3610
- /**
3611
- * The size of the buffer where the result of the visibility check is stored.
3612
- */
3613
- bufferSize: number;
3614
- /**
3615
- * The buffer when the result of the visibility check is stored.
3616
- */
3617
- buffer: Uint8Array;
3618
- /**
3619
- * Flag to indicate if the renderer shouldn't update the visibility.
3620
- */
3621
- preventUpdate: boolean;
3622
- /** {@link Configurable.config} */
3623
- config: CullerRendererConfigManager;
3624
- /** {@link Configurable.isSetup} */
3625
- isSetup: boolean;
3626
- /** The world instance to which this renderer belongs. */
3627
- readonly world: World;
3628
- /** The THREE.js renderer used to make the visibility test. */
3629
- readonly renderer: THREE.WebGLRenderer;
3630
- protected _defaultConfig: CullerRendererConfig;
3631
- protected readonly worker: Worker;
3632
- protected readonly scene: THREE.Scene;
3633
- private _availableColor;
3634
- protected _isWorkerBusy: boolean;
3635
- constructor(components: Components, world: World);
3636
- /** {@link Disposable.dispose} */
3637
- dispose(): void;
3638
- /**
3639
- * The function that the culler uses to reprocess the scene. Generally it's
3640
- * better to call needsUpdate, but you can also call this to force it.
3641
- * @param force if true, it will refresh the scene even if needsUpdate is
3642
- * not true.
3643
- */
3644
- updateVisibility: (force?: boolean) => Promise<void>;
3645
- setup(config?: Partial<CullerRendererConfig>): void;
3646
- protected getAvailableColor(): {
3647
- r: number;
3648
- g: number;
3649
- b: number;
3650
- code: string;
3651
- };
3652
- protected increaseColor(): void;
3653
- protected decreaseColor(): void;
3654
- }
3655
- import * as THREE from "three";
3656
- import { Disposable, Event } from "../../Types";
3657
- /**
3658
- * 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.
3659
- */
3660
- export declare class Mouse implements Disposable {
3661
- dom: HTMLCanvasElement;
3662
- private _event?;
3663
- private _position;
3664
- /** {@link Disposable.onDisposed} */
3665
- readonly onDisposed: Event<unknown>;
3666
- constructor(dom: HTMLCanvasElement);
3667
- /**
3668
- * The real position of the mouse of the Three.js canvas.
3669
- */
3670
- get position(): THREE.Vector2;
3671
- /** {@link Disposable.dispose} */
3672
- dispose(): void;
3673
- private getPositionY;
3674
- private getPositionX;
3675
- private updateMouseInfo;
3676
- private setupEvents;
3677
- }
3678
- import * as THREE from "three";
3679
- import { CullerRenderer } from "./culler-renderer";
3680
- import { Components } from "../../Components";
3681
- import { Event, World, Disposable } from "../../Types";
3682
- /**
3683
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3684
- */
3685
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3686
- /**
3687
- * Event triggered when the visibility of meshes is updated.
3688
- * Contains two sets: seen and unseen.
3689
- */
3690
- readonly onViewUpdated: Event<{
3691
- seen: Set<THREE.Mesh>;
3692
- unseen: Set<THREE.Mesh>;
3693
- }>;
3694
- /**
3695
- * Map of color code to THREE.InstancedMesh.
3696
- * Used to keep track of color-coded meshes.
3697
- */
3698
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3699
- /**
3700
- * @deprecated use config.threshold instead.
3701
- */
3702
- get threshold(): number;
3703
- /**
3704
- * @deprecated use config.threshold instead.
3705
- */
3706
- set threshold(value: number);
3707
- private _colorCodeMeshMap;
3708
- private _meshIDColorCodeMap;
3709
- private _currentVisibleMeshes;
3710
- private _recentlyHiddenMeshes;
3711
- private readonly _transparentMat;
3712
- constructor(components: Components, world: World);
3713
- /** {@link Disposable.dispose} */
3714
- dispose(): void;
3715
- /**
3716
- * 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.
3717
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3718
- */
3719
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3720
- /**
3721
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3722
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3723
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3724
- */
3725
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3726
- /**
3727
- * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
3728
- *
3729
- * @param meshes - The meshes to update.
3730
- *
3731
- * @returns {void}
4088
+ * @param force if true, it will refresh the scene even if needsUpdate is
4089
+ * not true.
3732
4090
  */
3733
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
4091
+ compute: () => Promise<void>;
3734
4092
  private handleWorkerMessage;
3735
- private getAvailableMaterial;
3736
4093
  }
3737
4094
  import * as THREE from "three";
3738
4095
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -3777,579 +4134,217 @@ export declare class SimplePlane implements Disposable, Hideable {
3777
4134
  * Getter for the enabled state of the clipping plane.
3778
4135
  * @returns {boolean} The current enabled state.
3779
4136
  */
3780
- get enabled(): boolean;
3781
- /**
3782
- * Setter for the enabled state of the clipping plane.
3783
- * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3784
- * @param {boolean} state - The new enabled state.
3785
- */
3786
- set enabled(state: boolean);
3787
- /** {@link Hideable.visible } */
3788
- get visible(): boolean;
3789
- /** {@link Hideable.visible } */
3790
- set visible(state: boolean);
3791
- /** The meshes used for raycasting */
3792
- get meshes(): THREE.Mesh[];
3793
- /** The material of the clipping plane representation. */
3794
- get planeMaterial(): THREE.Material | THREE.Material[];
3795
- /** The material of the clipping plane representation. */
3796
- set planeMaterial(material: THREE.Material | THREE.Material[]);
3797
- /** The size of the clipping plane representation. */
3798
- get size(): number;
3799
- /** Sets the size of the clipping plane representation. */
3800
- set size(size: number);
3801
- /**
3802
- * Getter for the helper object of the clipping plane.
3803
- * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3804
- * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3805
- *
3806
- * @returns {THREE.Object3D} The helper object of the clipping plane.
3807
- */
3808
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3809
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3810
- /**
3811
- * Sets the clipping plane's normal and origin from the given normal and point.
3812
- * This method resets the clipping plane's state, updates the normal and origin,
3813
- * and positions the helper object accordingly.
3814
- *
3815
- * @param normal - The new normal vector for the clipping plane.
3816
- * @param point - The new origin point for the clipping plane.
3817
- *
3818
- * @returns {void}
3819
- */
3820
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3821
- /** {@link Updateable.update} */
3822
- update: () => void;
3823
- /** {@link Disposable.dispose} */
3824
- dispose(): void;
3825
- private reset;
3826
- protected toggleControls(state: boolean): void;
3827
- private newTransformControls;
3828
- private initializeControls;
3829
- private createArrowBoundingBox;
3830
- private changeDrag;
3831
- private notifyDraggingChanged;
3832
- private preventCameraMovement;
3833
- private newHelper;
3834
- private static newPlaneMesh;
3835
- }
3836
- import * as THREE from "three";
3837
- import { Components } from "../../Components";
3838
- import { Event, World, Disposable } from "../../Types";
3839
- import { Mouse } from "./mouse";
3840
- /**
3841
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
3842
- */
3843
- export declare class SimpleRaycaster implements Disposable {
3844
- /** {@link Component.enabled} */
3845
- enabled: boolean;
3846
- /** The components instance to which this Raycaster belongs. */
3847
- components: Components;
3848
- /** {@link Disposable.onDisposed} */
3849
- readonly onDisposed: Event<unknown>;
3850
- /** The position of the mouse in the screen. */
3851
- readonly mouse: Mouse;
3852
- /**
3853
- * A reference to the Three.js Raycaster instance.
3854
- * This is used for raycasting operations.
3855
- */
3856
- readonly three: THREE.Raycaster;
3857
- /**
3858
- * A reference to the world instance to which this Raycaster belongs.
3859
- * This is used to access the camera and meshes.
3860
- */
3861
- world: World;
3862
- constructor(components: Components, world: World);
3863
- /** {@link Disposable.dispose} */
3864
- dispose(): void;
3865
- /**
3866
- * Throws a ray from the camera to the mouse or touch event point and returns
3867
- * the first item found. This also takes into account the clipping planes
3868
- * used by the renderer.
3869
- *
3870
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
3871
- * to query. If not provided, it will query all the meshes stored in
3872
- * {@link Components.meshes}.
3873
- */
3874
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
3875
- /**
3876
- * Casts a ray from a given origin in a given direction and returns the first item found.
3877
- * This method also takes into account the clipping planes used by the renderer.
3878
- *
3879
- * @param origin - The origin of the ray.
3880
- * @param direction - The direction of the ray.
3881
- * @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
3882
- * @returns The first intersection found or 'null' if no intersection was found.
3883
- */
3884
- castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
3885
- private intersect;
3886
- private filterClippingPlanes;
3887
- }
3888
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3889
- import { SimplePlane } from "../../Clipper";
3890
- import { DataSet } from "../../Types";
3891
- export interface ViewpointCamera {
3892
- direction: {
3893
- x: number;
3894
- y: number;
3895
- z: number;
3896
- };
3897
- position: {
3898
- x: number;
3899
- y: number;
3900
- z: number;
3901
- };
3902
- aspectRatio: number;
3903
- }
3904
- export interface ViewpointPerspectiveCamera extends ViewpointCamera {
3905
- fov: number;
3906
- }
3907
- export interface ViewpointOrthographicCamera extends ViewpointCamera {
3908
- viewToWorldScale: number;
3909
- }
3910
- export interface BCFViewpoint {
3911
- title?: string;
3912
- guid: string;
3913
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3914
- selectionComponents: Iterable<string>;
3915
- exceptionComponents: Iterable<string>;
3916
- clippingPlanes: DataSet<SimplePlane>;
3917
- spacesVisible: boolean;
3918
- spaceBoundariesVisible: boolean;
3919
- openingsVisible: boolean;
3920
- defaultVisibility: boolean;
3921
- }
3922
- import { NavigationMode } from "./types";
3923
- import { OrthoPerspectiveCamera } from "../index";
3924
- /**
3925
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3926
- */
3927
- export declare class FirstPersonMode implements NavigationMode {
3928
- private camera;
3929
- /** {@link NavigationMode.enabled} */
3930
- enabled: boolean;
3931
- /** {@link NavigationMode.id} */
3932
- readonly id = "FirstPerson";
3933
- constructor(camera: OrthoPerspectiveCamera);
3934
- /** {@link NavigationMode.set} */
3935
- set(active: boolean): void;
3936
- private setupFirstPersonCamera;
3937
- }
3938
- import * as THREE from "three";
3939
- import * as FRAGS from "@thatopen/fragments";
3940
- import { BCFViewpoint, ViewpointOrthographicCamera, ViewpointPerspectiveCamera } from "./types";
3941
- import { CameraProjection } from "../../OrthoPerspectiveCamera";
3942
- import { Components } from "../../Components";
3943
- import { DataMap, DataSet, World } from "../../Types";
3944
- import { SimplePlane } from "../../Clipper";
3945
- export declare class Viewpoint implements BCFViewpoint {
3946
- title?: string;
3947
- guid: string;
3948
- /**
3949
- * ClippingPlanes can be used to define a subsection of a building model that is related to the topic.
3950
- * Each clipping plane is defined by Location and Direction.
3951
- * The Direction vector points in the invisible direction meaning the half-space that is clipped.
3952
- */
3953
- clippingPlanes: DataSet<SimplePlane>;
3954
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3955
- /**
3956
- * A list of components GUIDs to hide when defaultVisibility = true or to show when defaultVisibility = false
3957
- */
3958
- readonly exceptionComponents: DataSet<string>;
3959
- /**
3960
- * A list of components GUIDs that should be selected (highlighted) when displaying a viewpoint.
3961
- */
3962
- readonly selectionComponents: DataSet<string>;
3963
- /**
3964
- * A map of colors and components GUIDs that should be colorized when displaying a viewpoint.
3965
- * For this to work, call viewpoint.colorize()
3966
- */
3967
- readonly componentColors: DataMap<string, string[]>;
3968
- /**
3969
- * Boolean flags to allow fine control over the visibility of spaces.
3970
- * A typical use of these flags is when DefaultVisibility=true but spaces should remain hidden.
3971
- * @default false
3972
- */
3973
- spacesVisible: boolean;
3974
- /**
3975
- * Boolean flags to allow fine control over the visibility of space boundaries.
3976
- * A typical use of these flags is when DefaultVisibility=true but space boundaries should remain hidden.
3977
- * @default false
3978
- */
3979
- spaceBoundariesVisible: boolean;
3980
- /**
3981
- * Boolean flags to allow fine control over the visibility of openings.
3982
- * A typical use of these flags is when DefaultVisibility=true but openings should remain hidden.
3983
- * @default false
3984
- */
3985
- openingsVisible: boolean;
3986
- /**
3987
- * When true, all components should be visible unless listed in the exceptions
3988
- * When false all components should be invisible unless listed in the exceptions
3989
- */
3990
- defaultVisibility: boolean;
3991
- private get _selectionModelIdMap();
3992
- private get _exceptionModelIdMap();
3993
- /**
3994
- * A list of components that should be selected (highlighted) when displaying a viewpoint.
3995
- * @returns The fragmentIdMap for components marked as selections.
3996
- */
3997
- get selection(): FRAGS.FragmentIdMap;
3998
- /**
3999
- * A list of components to hide when defaultVisibility = true or to show when defaultVisibility = false
4000
- * @returns The fragmentIdMap for components marked as exceptions.
4001
- */
4002
- get exception(): FRAGS.FragmentIdMap;
4003
- /**
4004
- * Retrieves the projection type of the viewpoint's camera.
4005
- *
4006
- * @returns A string representing the projection type of the viewpoint's camera.
4007
- * It can be either 'Perspective' or 'Orthographic'.
4008
- */
4009
- get projection(): CameraProjection;
4010
- /**
4011
- * Retrieves the position vector of the viewpoint's camera.
4012
- *
4013
- * @remarks
4014
- * The position vector represents the camera's position in the world coordinate system.
4015
- * The function applies the base coordinate system transformation to the position vector.
4016
- *
4017
- * @returns A THREE.Vector3 representing the position of the viewpoint's camera.
4018
- */
4019
- get position(): THREE.Vector3;
4020
- /**
4021
- * Retrieves the direction vector of the viewpoint's camera.
4022
- *
4023
- * @remarks
4024
- * The direction vector represents the direction in which the camera is pointing.
4025
- * It is calculated by extracting the x, y, and z components from the camera's direction property.
4026
- *
4027
- * @returns A THREE.Vector3 representing the direction of the viewpoint's camera.
4028
- */
4029
- get direction(): THREE.Vector3;
4030
- private _components;
4137
+ get enabled(): boolean;
4031
4138
  /**
4032
- * Represents the world in which the viewpoints are created and managed.
4139
+ * Setter for the enabled state of the clipping plane.
4140
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
4141
+ * @param {boolean} state - The new enabled state.
4033
4142
  */
4034
- readonly world: World;
4035
- private get _managerVersion();
4143
+ set enabled(state: boolean);
4144
+ /** {@link Hideable.visible } */
4145
+ get visible(): boolean;
4146
+ /** {@link Hideable.visible } */
4147
+ set visible(state: boolean);
4148
+ /** The meshes used for raycasting */
4149
+ get meshes(): THREE.Mesh[];
4150
+ /** The material of the clipping plane representation. */
4151
+ get planeMaterial(): THREE.Material | THREE.Material[];
4152
+ /** The material of the clipping plane representation. */
4153
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
4154
+ /** The size of the clipping plane representation. */
4155
+ get size(): number;
4156
+ /** Sets the size of the clipping plane representation. */
4157
+ set size(size: number);
4036
4158
  /**
4037
- * Retrieves the list of BCF topics associated with the current viewpoint.
4038
- *
4039
- * @remarks
4040
- * This function retrieves the BCFTopics manager from the components,
4041
- * then filters the list of topics to find those associated with the current viewpoint.
4159
+ * Getter for the helper object of the clipping plane.
4160
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
4161
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
4042
4162
  *
4043
- * @returns An array of BCF topics associated with the current viewpoint.
4163
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
4044
4164
  */
4045
- get topics(): import("../../../openbim/BCFTopics").Topic[];
4046
- constructor(components: Components, world: World, _config?: {
4047
- data?: Partial<BCFViewpoint>;
4048
- setCamera?: boolean;
4049
- });
4165
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
4166
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
4050
4167
  /**
4051
- * Adds components to the viewpoint based on the provided fragment ID map.
4168
+ * Sets the clipping plane's normal and origin from the given normal and point.
4169
+ * This method resets the clipping plane's state, updates the normal and origin,
4170
+ * and positions the helper object accordingly.
4052
4171
  *
4053
- * @param fragmentIdMap - A map containing fragment IDs as keys and arrays of express IDs as values.
4172
+ * @param normal - The new normal vector for the clipping plane.
4173
+ * @param point - The new origin point for the clipping plane.
4054
4174
  *
4055
- * @returns A Promise that resolves when the components have been added to the viewpoint.
4175
+ * @returns {void}
4056
4176
  */
4057
- addComponentsFromMap(fragmentIdMap: FRAGS.FragmentIdMap): Promise<void>;
4177
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
4178
+ /** {@link Updateable.update} */
4179
+ update: () => void;
4180
+ /** {@link Disposable.dispose} */
4181
+ dispose(): void;
4182
+ private reset;
4183
+ protected toggleControls(state: boolean): void;
4184
+ private newTransformControls;
4185
+ private initializeControls;
4186
+ private createArrowBoundingBox;
4187
+ private changeDrag;
4188
+ private notifyDraggingChanged;
4189
+ private preventCameraMovement;
4190
+ private newHelper;
4191
+ private static newPlaneMesh;
4192
+ }
4193
+ import * as THREE from "three";
4194
+ import { Components } from "../../Components";
4195
+ import { AsyncEvent, Configurable, Event, World } from "../../Types";
4196
+ import { CullerRendererConfig, CullerRendererConfigManager } from "./culler-renderer-config";
4197
+ /**
4198
+ * A base renderer to determine visibility on screen.
4199
+ */
4200
+ export declare class CullerRenderer implements Configurable<CullerRendererConfigManager, CullerRendererConfig> {
4201
+ /** {@link Configurable.onSetup} */
4202
+ readonly onSetup: Event<unknown>;
4203
+ /** {@link Disposable.onDisposed} */
4204
+ readonly onDisposed: Event<string>;
4058
4205
  /**
4059
- * Sets the properties of the viewpoint with the provided data.
4060
- *
4061
- * @remarks The guid will be ommited as it shouldn't change after it has been initially set.
4062
- *
4063
- * @param data - An object containing the properties to be set.
4064
- * The properties not included in the object will remain unchanged.
4065
- *
4066
- * @returns The viewpoint instance with the updated properties.
4206
+ * Fires after making the visibility check to the meshes. It lists the
4207
+ * meshes that are currently visible, and the ones that were visible
4208
+ * just before but not anymore.
4067
4209
  */
4068
- set(data: Partial<BCFViewpoint>): this;
4210
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
4069
4211
  /**
4070
- * Sets the viewpoint of the camera in the world.
4071
- *
4072
- * @remarks
4073
- * This function calculates the target position based on the viewpoint information.
4074
- * It sets the visibility of the viewpoint components and then applies the viewpoint using the camera's controls.
4075
- *
4076
- * @param transition - Indicates whether the camera movement should have a transition effect.
4077
- * Default value is 'true'.
4078
- *
4079
- * @throws An error if the world's camera does not have camera controls.
4080
- *
4081
- * @returns A Promise that resolves when the camera has been set.
4212
+ * Whether this renderer is active or not. If not, it won't render anything.
4082
4213
  */
4083
- go(transition?: boolean): Promise<void>;
4214
+ enabled: boolean;
4084
4215
  /**
4085
- * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
4086
- *
4087
- * @remarks
4088
- * This function retrieves the camera's position, direction, and aspect ratio from the world's camera and renderer.
4089
- * It then calculates the camera's perspective or orthographic settings based on the camera type.
4090
- * Finally, it updates the viewpoint's camera settings and updates the viewpoint to the Viewpoints manager.
4091
- *
4092
- * @throws An error if the world's camera does not have camera controls.
4093
- * @throws An error if the world's renderer is not available.
4216
+ * Needs to check whether there are objects that need to be hidden or shown.
4217
+ * You can bind this to the camera movement, to a certain interval, etc.
4094
4218
  */
4095
- updateCamera(): void;
4219
+ needsUpdate: boolean;
4220
+ /** The components instance to which this renderer belongs. */
4221
+ components: Components;
4222
+ /** The render target used to render the visibility scene. */
4223
+ renderTarget: THREE.WebGLRenderTarget<THREE.Texture>;
4096
4224
  /**
4097
- * Applies color to the components in the viewpoint based on their GUIDs.
4098
- *
4099
- * This function iterates through the 'componentColors' map, retrieves the fragment IDs
4100
- * corresponding to each color, and then uses the 'Classifier' to apply the color to those fragments.
4101
- *
4102
- * @remarks
4103
- * The color is applied using the 'Classifier.setColor' method, which sets the color of the specified fragments.
4104
- * The color is provided as a hexadecimal string, prefixed with a '#'.
4225
+ * The size of the buffer where the result of the visibility check is stored.
4105
4226
  */
4106
- colorize(): void;
4227
+ bufferSize: number;
4107
4228
  /**
4108
- * Resets the colors of all components in the viewpoint to their original color.
4109
- * This method iterates through the 'componentColors' map, retrieves the fragment IDs
4110
- * corresponding to each color, and then uses the 'Classifier' to reset the color of those fragments.
4229
+ * The buffer when the result of the visibility check is stored.
4111
4230
  */
4112
- resetColors(): void;
4113
- private createComponentTags;
4231
+ buffer: Uint8Array;
4114
4232
  /**
4115
- * Serializes the viewpoint into a buildingSMART compliant XML string for export.
4116
- *
4117
- * @param version - The version of the BCF Manager to use for serialization.
4118
- * If not provided, the current version of the manager will be used.
4119
- *
4120
- * @returns A Promise that resolves to an XML string representing the viewpoint.
4121
- * The XML string follows the BCF VisualizationInfo schema.
4122
- *
4123
- * @throws An error if the world's camera does not have camera controls.
4124
- * @throws An error if the world's renderer is not available.
4233
+ * Flag to indicate if the renderer shouldn't update the visibility.
4125
4234
  */
4126
- serialize(version?: string): Promise<string>;
4127
- }
4128
- import { NavigationMode } from "./types";
4129
- import { OrthoPerspectiveCamera } from "../index";
4130
- /**
4131
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
4132
- */
4133
- export declare class OrbitMode implements NavigationMode {
4134
- camera: OrthoPerspectiveCamera;
4135
- /** {@link NavigationMode.enabled} */
4136
- enabled: boolean;
4137
- /** {@link NavigationMode.id} */
4138
- readonly id = "Orbit";
4139
- constructor(camera: OrthoPerspectiveCamera);
4140
- /** {@link NavigationMode.set} */
4141
- set(active: boolean): void;
4142
- private activateOrbitControls;
4143
- }
4144
- /**
4145
- * The projection system of the camera.
4146
- */
4147
- export type CameraProjection = "Perspective" | "Orthographic";
4148
- /**
4149
- * The extensible list of supported navigation modes.
4150
- */
4151
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
4152
- /**
4153
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
4154
- */
4155
- export interface NavigationMode {
4156
- /** The unique ID of this navigation mode. */
4157
- id: NavModeID;
4235
+ preventUpdate: boolean;
4236
+ /** {@link Configurable.config} */
4237
+ config: CullerRendererConfigManager;
4238
+ /** {@link Configurable.isSetup} */
4239
+ isSetup: boolean;
4240
+ /** The world instance to which this renderer belongs. */
4241
+ readonly world: World;
4242
+ /** The THREE.js renderer used to make the visibility test. */
4243
+ readonly renderer: THREE.WebGLRenderer;
4244
+ protected _defaultConfig: CullerRendererConfig;
4245
+ protected readonly worker: Worker;
4246
+ protected readonly scene: THREE.Scene;
4247
+ private _availableColor;
4248
+ protected _isWorkerBusy: boolean;
4249
+ constructor(components: Components, world: World);
4250
+ /** {@link Disposable.dispose} */
4251
+ dispose(): void;
4158
4252
  /**
4159
- * Enable or disable this navigation mode.
4160
- * When a new navigation mode is enabled, the previous navigation mode
4161
- * must be disabled.
4162
- *
4163
- * @param active - whether to enable or disable this mode.
4164
- * @param options - any additional data required to enable or disable it.
4165
- * */
4166
- set: (active: boolean, options?: any) => void;
4167
- /** Whether this navigation mode is active or not. */
4168
- enabled: boolean;
4169
- }
4170
- import { NavigationMode } from "./types";
4171
- import { OrthoPerspectiveCamera } from "../index";
4172
- /**
4173
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
4174
- */
4175
- export declare class PlanMode implements NavigationMode {
4176
- private camera;
4177
- /** {@link NavigationMode.enabled} */
4178
- enabled: boolean;
4179
- /** {@link NavigationMode.id} */
4180
- readonly id = "Plan";
4181
- private mouseAction1?;
4182
- private mouseAction2?;
4183
- private mouseInitialized;
4184
- private readonly defaultAzimuthSpeed;
4185
- private readonly defaultPolarSpeed;
4186
- constructor(camera: OrthoPerspectiveCamera);
4187
- /** {@link NavigationMode.set} */
4188
- set(active: boolean): void;
4253
+ * The function that the culler uses to reprocess the scene. Generally it's
4254
+ * better to call needsUpdate, but you can also call this to force it.
4255
+ * @param force if true, it will refresh the scene even if needsUpdate is
4256
+ * not true.
4257
+ */
4258
+ updateVisibility: (force?: boolean) => Promise<void>;
4259
+ setup(config?: Partial<CullerRendererConfig>): void;
4260
+ protected getAvailableColor(): {
4261
+ r: number;
4262
+ g: number;
4263
+ b: number;
4264
+ code: string;
4265
+ };
4266
+ protected increaseColor(): void;
4267
+ protected decreaseColor(): void;
4189
4268
  }
4269
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
4190
4270
  import * as THREE from "three";
4191
- import { BooleanSettingsControl, ColorSettingsControl, NumberSettingControl } from "../../Types";
4192
- import { Configurator } from "../../ConfigManager";
4193
- import { SimpleGrid } from "./simple-grid";
4194
- type SimpleGridConfigType = {
4195
- visible: BooleanSettingsControl;
4196
- color: ColorSettingsControl;
4197
- primarySize: NumberSettingControl;
4198
- secondarySize: NumberSettingControl;
4199
- distance: NumberSettingControl;
4200
- };
4271
+ import { CullerRenderer } from "./culler-renderer";
4272
+ import { Components } from "../../Components";
4273
+ import { Event, World, Disposable } from "../../Types";
4201
4274
  /**
4202
- * Configuration interface for the {@link SimpleGrid}.
4275
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
4203
4276
  */
4204
- export interface SimpleGridConfig {
4205
- /**
4206
- * The color of the grid lines.
4207
- */
4208
- color: THREE.Color;
4277
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
4209
4278
  /**
4210
- * The size of the primary grid lines.
4279
+ * Event triggered when the visibility of meshes is updated.
4280
+ * Contains two sets: seen and unseen.
4211
4281
  */
4212
- primarySize: number;
4282
+ readonly onViewUpdated: Event<{
4283
+ seen: Set<THREE.Mesh>;
4284
+ unseen: Set<THREE.Mesh>;
4285
+ }>;
4213
4286
  /**
4214
- * The size of the secondary grid lines.
4287
+ * Map of color code to THREE.InstancedMesh.
4288
+ * Used to keep track of color-coded meshes.
4215
4289
  */
4216
- secondarySize: number;
4290
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
4217
4291
  /**
4218
- * The distance at which the grid lines start to fade away.
4292
+ * @deprecated use config.threshold instead.
4219
4293
  */
4220
- distance: number;
4221
- }
4222
- export declare class SimpleGridConfigManager extends Configurator<SimpleGrid, SimpleGridConfigType> {
4223
- protected _config: SimpleGridConfigType;
4224
- get visible(): boolean;
4225
- set visible(value: boolean);
4226
- get color(): THREE.Color;
4227
- set color(value: THREE.Color);
4228
- get primarySize(): number;
4229
- set primarySize(value: number);
4230
- get secondarySize(): number;
4231
- set secondarySize(value: number);
4232
- get distance(): number;
4233
- set distance(value: number);
4234
- }
4235
- export {};
4236
- import * as THREE from "three";
4237
- import { CameraProjection } from "./types";
4238
- import { Event } from "../../Types";
4239
- import { OrthoPerspectiveCamera } from "../index";
4240
- /**
4241
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
4242
- */
4243
- export declare class ProjectionManager {
4294
+ get threshold(): number;
4244
4295
  /**
4245
- * Event that fires when the {@link CameraProjection} changes.
4296
+ * @deprecated use config.threshold instead.
4246
4297
  */
4247
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
4298
+ set threshold(value: number);
4299
+ private _colorCodeMeshMap;
4300
+ private _meshIDColorCodeMap;
4301
+ private _currentVisibleMeshes;
4302
+ private _recentlyHiddenMeshes;
4303
+ private readonly _transparentMat;
4304
+ constructor(components: Components, world: World);
4305
+ /** {@link Disposable.dispose} */
4306
+ dispose(): void;
4248
4307
  /**
4249
- * Current projection mode of the camera.
4250
- * Default is "Perspective".
4308
+ * 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.
4309
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
4251
4310
  */
4252
- current: CameraProjection;
4311
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
4253
4312
  /**
4254
- * The camera controlled by this ProjectionManager.
4255
- * It can be either a PerspectiveCamera or an OrthographicCamera.
4313
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
4314
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
4315
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
4256
4316
  */
4257
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
4258
- /** Match Ortho zoom with Perspective distance when changing projection mode */
4259
- matchOrthoDistanceEnabled: boolean;
4260
- private _component;
4261
- private _previousDistance;
4262
- constructor(camera: OrthoPerspectiveCamera);
4317
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
4263
4318
  /**
4264
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
4319
+ * Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
4265
4320
  *
4266
- * @param projection - the new projection to set. If it is the current projection,
4267
- * it will have no effect.
4268
- */
4269
- set(projection: CameraProjection): Promise<void>;
4270
- /**
4271
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
4272
- * and vice versa.
4321
+ * @param meshes - The meshes to update.
4322
+ *
4323
+ * @returns {void}
4273
4324
  */
4274
- toggle(): Promise<void>;
4275
- private setOrthoCamera;
4276
- private getPerspectiveDims;
4277
- private setupOrthoCamera;
4278
- private getDistance;
4279
- private setPerspectiveCamera;
4325
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
4326
+ private handleWorkerMessage;
4327
+ private getAvailableMaterial;
4280
4328
  }
4281
- import * as THREE from "three";
4282
- import { Hideable, Event, World, Disposable, Configurable } from "../../Types";
4283
- import { Components } from "../../Components";
4284
- import { SimpleGridConfig, SimpleGridConfigManager } from "./simple-grid-config";
4329
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
4285
4330
  /**
4286
- * 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).
4331
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
4287
4332
  */
4288
- export declare class SimpleGrid implements Hideable, Disposable, Configurable<SimpleGridConfigManager, SimpleGridConfig> {
4289
- /** {@link Disposable.onDisposed} */
4290
- readonly onDisposed: Event<unknown>;
4291
- /** {@link Configurable.onSetup} */
4292
- readonly onSetup: Event<unknown>;
4293
- /** {@link Configurable.isSetup} */
4294
- isSetup: boolean;
4295
- /** The world instance to which this Raycaster belongs. */
4296
- world: World;
4297
- /** The components instance to which this grid belongs. */
4298
- components: Components;
4299
- /** {@link Configurable.config} */
4300
- config: SimpleGridConfigManager;
4301
- protected _defaultConfig: SimpleGridConfig;
4302
- /** {@link Hideable.visible} */
4303
- get visible(): boolean;
4304
- /** {@link Hideable.visible} */
4305
- set visible(visible: boolean);
4306
- /** The material of the grid. */
4307
- get material(): THREE.ShaderMaterial;
4333
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
4308
4334
  /**
4309
- * Whether the grid should fade away with distance. Recommended to be true for
4310
- * perspective cameras and false for orthographic cameras.
4335
+ * Minimum number of geometries to be streamed.
4336
+ * Defaults to 10 geometries.
4311
4337
  */
4312
- get fade(): boolean;
4338
+ minGeometrySize: number;
4313
4339
  /**
4314
- * Whether the grid should fade away with distance. Recommended to be true for
4315
- * perspective cameras and false for orthographic cameras.
4340
+ * Minimum amount of assets to be streamed.
4341
+ * Defaults to 1000 assets.
4316
4342
  */
4317
- set fade(active: boolean);
4318
- /** The Three.js mesh that contains the infinite grid. */
4319
- readonly three: THREE.Mesh;
4320
- private _fade;
4321
- constructor(components: Components, world: World);
4322
- /** {@link Configurable.setup} */
4323
- setup(config?: Partial<SimpleGridConfig>): void;
4324
- /** {@link Disposable.dispose} */
4325
- dispose(): void;
4326
- private setupEvents;
4327
- private updateZoom;
4328
- }
4329
- import * as WEBIFC from "web-ifc";
4330
- import * as THREE from "three";
4331
- export declare class Units {
4332
- factor: number;
4333
- complement: number;
4334
- apply(matrix: THREE.Matrix4): void;
4335
- setUp(webIfc: WEBIFC.IfcAPI): void;
4336
- private getLengthUnits;
4337
- private getScaleMatrix;
4338
- }
4339
- import * as THREE from "three";
4340
- import * as WEBIFC from "web-ifc";
4341
- import * as FRAGS from "@thatopen/fragments";
4342
- export declare class CivilReader {
4343
- defLineMat: THREE.LineBasicMaterial;
4344
- read(webIfc: WEBIFC.IfcAPI): {
4345
- alignments: Map<number, FRAGS.Alignment>;
4346
- coordinationMatrix: THREE.Matrix4;
4347
- } | undefined;
4348
- get(civilItems: any): {
4349
- alignments: Map<number, FRAGS.Alignment>;
4350
- coordinationMatrix: THREE.Matrix4;
4351
- } | undefined;
4352
- private getCurves;
4343
+ minAssetsSize: number;
4344
+ /**
4345
+ * Maximum amount of triangles per fragment. Useful for controlling the maximum size of fragment files.
4346
+ */
4347
+ maxTriangles: number | null;
4353
4348
  }
4354
4349
  /**
4355
4350
  * 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.
@@ -4380,100 +4375,46 @@ export interface StreamedAsset {
4380
4375
  color: number[];
4381
4376
  }[];
4382
4377
  }
4378
+ import * as THREE from "three";
4379
+ import * as WEBIFC from "web-ifc";
4380
+ import * as FRAGS from "@thatopen/fragments";
4381
+ export declare class CivilReader {
4382
+ defLineMat: THREE.LineBasicMaterial;
4383
+ read(webIfc: WEBIFC.IfcAPI): {
4384
+ alignments: Map<number, FRAGS.Alignment>;
4385
+ coordinationMatrix: THREE.Matrix4;
4386
+ } | undefined;
4387
+ get(civilItems: any): {
4388
+ alignments: Map<number, FRAGS.Alignment>;
4389
+ coordinationMatrix: THREE.Matrix4;
4390
+ } | undefined;
4391
+ private getCurves;
4392
+ }
4383
4393
  import * as WEBIFC from "web-ifc";
4384
4394
  export declare class IfcMetadataReader {
4385
4395
  getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4386
4396
  getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4387
4397
  }
4388
- import { IfcFragmentSettings } from "../../IfcLoader/src";
4389
- /**
4390
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
4391
- */
4392
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
4393
- /**
4394
- * Minimum number of geometries to be streamed.
4395
- * Defaults to 10 geometries.
4396
- */
4397
- minGeometrySize: number;
4398
- /**
4399
- * Minimum amount of assets to be streamed.
4400
- * Defaults to 1000 assets.
4401
- */
4402
- minAssetsSize: number;
4403
- /**
4404
- * Maximum amount of triangles per fragment. Useful for controlling the maximum size of fragment files.
4405
- */
4406
- maxTriangles: number | null;
4398
+ import * as WEBIFC from "web-ifc";
4399
+ import * as THREE from "three";
4400
+ export declare class Units {
4401
+ factor: number;
4402
+ complement: number;
4403
+ apply(matrix: THREE.Matrix4): void;
4404
+ setUp(webIfc: WEBIFC.IfcAPI): void;
4405
+ private getLengthUnits;
4406
+ private getScaleMatrix;
4407
4407
  }
4408
4408
  import { IfcFragmentSettings } from "../../IfcLoader/src";
4409
4409
  /**
4410
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
4411
- */
4412
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
4413
- /**
4414
- * Amount of properties to be streamed.
4415
- * Defaults to 100 properties.
4416
- */
4417
- propertiesSize: number;
4418
- }
4419
- export type BCFVersion = "2.1" | "3";
4420
- export interface BCFTopic {
4421
- guid: string;
4422
- serverAssignedId?: string;
4423
- type: string;
4424
- status: string;
4425
- title: string;
4426
- priority?: string;
4427
- index?: number;
4428
- labels: Set<string>;
4429
- creationDate: Date;
4430
- creationAuthor: string;
4431
- modifiedDate?: Date;
4432
- modifiedAuthor?: string;
4433
- dueDate?: Date;
4434
- assignedTo?: string;
4435
- description?: string;
4436
- stage?: string;
4437
- }
4438
- import { Topic } from "..";
4439
- import { Viewpoint } from "../../../core/Viewpoints";
4440
- import { Components } from "../../../core/Components";
4441
- /**
4442
- * Represents a comment in a BCF Topic.
4410
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
4443
4411
  */
4444
- export declare class Comment {
4445
- date: Date;
4446
- author: string;
4447
- guid: string;
4448
- viewpoint?: Viewpoint;
4449
- modifiedAuthor?: string;
4450
- modifiedDate?: Date;
4451
- topic?: Topic;
4452
- private _components;
4453
- private _comment;
4454
- /**
4455
- * Sets the comment text and updates the modified date and author.
4456
- * The author will be the one defined in BCFTopics.config.author
4457
- * @param value - The new comment text.
4458
- */
4459
- set comment(value: string);
4460
- /**
4461
- * Gets the comment text.
4462
- * @returns The comment text.
4463
- */
4464
- get comment(): string;
4465
- /**
4466
- * Constructs a new BCF Topic Comment instance.
4467
- * @param components - The Components instance.
4468
- * @param text - The initial comment text.
4469
- */
4470
- constructor(components: Components, text: string);
4412
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
4471
4413
  /**
4472
- * Serializes the Comment instance into a BCF compliant XML string.
4473
- *
4474
- * @returns A string representing the Comment in BCFv2 XML format.
4414
+ * Amount of properties to be streamed.
4415
+ * Defaults to 100 properties.
4475
4416
  */
4476
- serialize(): string;
4417
+ propertiesSize: number;
4477
4418
  }
4478
4419
  import { Components } from "../../../core/Components";
4479
4420
  import { Viewpoint } from "../../../core/Viewpoints";
@@ -4598,86 +4539,24 @@ export declare class Topic implements BCFTopic {
4598
4539
  */
4599
4540
  serialize(): string;
4600
4541
  }
4601
- import { BooleanSettingsControl, NumberSettingControl } from "../../Types";
4602
- import { Configurator } from "../../ConfigManager";
4603
- import { CullerRenderer } from "../index";
4604
- type CullerRendererConfigType = {
4605
- enabled: BooleanSettingsControl;
4606
- width: NumberSettingControl;
4607
- height: NumberSettingControl;
4608
- updateInterval: NumberSettingControl;
4609
- autoUpdate: BooleanSettingsControl;
4610
- renderDebugFrame: BooleanSettingsControl;
4611
- threshold: NumberSettingControl;
4612
- };
4613
- /**
4614
- * Configuration interface for the {@link CullerRenderer}.
4615
- */
4616
- export interface CullerRendererConfig {
4617
- /**
4618
- * Whether the culler renderer should make renders or not.
4619
- */
4620
- enabled: boolean;
4621
- /**
4622
- * Width of the render target used for visibility checks.
4623
- */
4624
- width: number;
4625
- /**
4626
- * Height of the render target used for visibility checks.
4627
- * Default value is 512.
4628
- */
4629
- height: number;
4630
- /**
4631
- * Whether the visibility check should be performed automatically.
4632
- * Default value is true.
4633
- */
4634
- autoUpdate: boolean;
4635
- /**
4636
- * Interval in milliseconds at which the visibility check should be performed.
4637
- */
4638
- updateInterval: number;
4639
- /**
4640
- * Whether to render the frame use to debug the culler behavior.
4641
- */
4642
- renderDebugFrame: boolean;
4643
- /**
4644
- * Pixels in screen a geometry must occupy to be considered "seen".
4645
- * Default value is 100.
4646
- */
4647
- threshold: number;
4648
- }
4649
- /**
4650
- * Settings to configure the CullerRenderer.
4651
- */
4652
- export declare class CullerRendererConfigManager extends Configurator<CullerRenderer, CullerRendererConfigType> {
4653
- protected _config: CullerRendererConfigType;
4654
- private _interval;
4655
- get enabled(): boolean;
4656
- set enabled(value: boolean);
4657
- get width(): number;
4658
- set width(value: number);
4659
- get height(): number;
4660
- set height(value: number);
4661
- get autoUpdate(): boolean;
4662
- set autoUpdate(value: boolean);
4663
- get updateInterval(): number;
4664
- set updateInterval(value: number);
4665
- get renderDebugFrame(): boolean;
4666
- set renderDebugFrame(value: boolean);
4667
- get threshold(): number;
4668
- set threshold(value: number);
4669
- setWidthHeight(width: number, height: number): void;
4670
- setAutoAndInterval(auto: boolean, interval: number): void;
4671
- private resetRenderTarget;
4672
- private resetInterval;
4673
- }
4674
- export {};
4675
- import { BCFTopics } from "../..";
4676
- export declare const extensionsImporter: (manager: BCFTopics, extensionsXML: string) => void;
4677
- import { BufferGeometry } from "three";
4678
- import * as THREE from "three";
4679
- export declare class TransformHelper {
4680
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
4542
+ export type BCFVersion = "2.1" | "3";
4543
+ export interface BCFTopic {
4544
+ guid: string;
4545
+ serverAssignedId?: string;
4546
+ type: string;
4547
+ status: string;
4548
+ title: string;
4549
+ priority?: string;
4550
+ index?: number;
4551
+ labels: Set<string>;
4552
+ creationDate: Date;
4553
+ creationAuthor: string;
4554
+ modifiedDate?: Date;
4555
+ modifiedAuthor?: string;
4556
+ dueDate?: Date;
4557
+ assignedTo?: string;
4558
+ description?: string;
4559
+ stage?: string;
4681
4560
  }
4682
4561
  import { BCFTopics, BCFVersion } from "../index";
4683
4562
  import { BooleanSettingsControl, Configurator, SelectSettingControl, TextSetSettingControl, TextSettingsControl } from "../../../core";
@@ -4801,6 +4680,127 @@ export declare class BCFTopicsConfigManager extends Configurator<BCFTopics, BCFT
4801
4680
  set ignoreIncompleteTopicsOnImport(value: boolean);
4802
4681
  }
4803
4682
  export {};
4683
+ import { BooleanSettingsControl, NumberSettingControl } from "../../Types";
4684
+ import { Configurator } from "../../ConfigManager";
4685
+ import { CullerRenderer } from "../index";
4686
+ type CullerRendererConfigType = {
4687
+ enabled: BooleanSettingsControl;
4688
+ width: NumberSettingControl;
4689
+ height: NumberSettingControl;
4690
+ updateInterval: NumberSettingControl;
4691
+ autoUpdate: BooleanSettingsControl;
4692
+ renderDebugFrame: BooleanSettingsControl;
4693
+ threshold: NumberSettingControl;
4694
+ };
4695
+ /**
4696
+ * Configuration interface for the {@link CullerRenderer}.
4697
+ */
4698
+ export interface CullerRendererConfig {
4699
+ /**
4700
+ * Whether the culler renderer should make renders or not.
4701
+ */
4702
+ enabled: boolean;
4703
+ /**
4704
+ * Width of the render target used for visibility checks.
4705
+ */
4706
+ width: number;
4707
+ /**
4708
+ * Height of the render target used for visibility checks.
4709
+ * Default value is 512.
4710
+ */
4711
+ height: number;
4712
+ /**
4713
+ * Whether the visibility check should be performed automatically.
4714
+ * Default value is true.
4715
+ */
4716
+ autoUpdate: boolean;
4717
+ /**
4718
+ * Interval in milliseconds at which the visibility check should be performed.
4719
+ */
4720
+ updateInterval: number;
4721
+ /**
4722
+ * Whether to render the frame use to debug the culler behavior.
4723
+ */
4724
+ renderDebugFrame: boolean;
4725
+ /**
4726
+ * Pixels in screen a geometry must occupy to be considered "seen".
4727
+ * Default value is 100.
4728
+ */
4729
+ threshold: number;
4730
+ }
4731
+ /**
4732
+ * Settings to configure the CullerRenderer.
4733
+ */
4734
+ export declare class CullerRendererConfigManager extends Configurator<CullerRenderer, CullerRendererConfigType> {
4735
+ protected _config: CullerRendererConfigType;
4736
+ private _interval;
4737
+ get enabled(): boolean;
4738
+ set enabled(value: boolean);
4739
+ get width(): number;
4740
+ set width(value: number);
4741
+ get height(): number;
4742
+ set height(value: number);
4743
+ get autoUpdate(): boolean;
4744
+ set autoUpdate(value: boolean);
4745
+ get updateInterval(): number;
4746
+ set updateInterval(value: number);
4747
+ get renderDebugFrame(): boolean;
4748
+ set renderDebugFrame(value: boolean);
4749
+ get threshold(): number;
4750
+ set threshold(value: number);
4751
+ setWidthHeight(width: number, height: number): void;
4752
+ setAutoAndInterval(auto: boolean, interval: number): void;
4753
+ private resetRenderTarget;
4754
+ private resetInterval;
4755
+ }
4756
+ export {};
4757
+ import { Topic } from "..";
4758
+ import { Viewpoint } from "../../../core/Viewpoints";
4759
+ import { Components } from "../../../core/Components";
4760
+ /**
4761
+ * Represents a comment in a BCF Topic.
4762
+ */
4763
+ export declare class Comment {
4764
+ date: Date;
4765
+ author: string;
4766
+ guid: string;
4767
+ viewpoint?: Viewpoint;
4768
+ modifiedAuthor?: string;
4769
+ modifiedDate?: Date;
4770
+ topic?: Topic;
4771
+ private _components;
4772
+ private _comment;
4773
+ /**
4774
+ * Sets the comment text and updates the modified date and author.
4775
+ * The author will be the one defined in BCFTopics.config.author
4776
+ * @param value - The new comment text.
4777
+ */
4778
+ set comment(value: string);
4779
+ /**
4780
+ * Gets the comment text.
4781
+ * @returns The comment text.
4782
+ */
4783
+ get comment(): string;
4784
+ /**
4785
+ * Constructs a new BCF Topic Comment instance.
4786
+ * @param components - The Components instance.
4787
+ * @param text - The initial comment text.
4788
+ */
4789
+ constructor(components: Components, text: string);
4790
+ /**
4791
+ * Serializes the Comment instance into a BCF compliant XML string.
4792
+ *
4793
+ * @returns A string representing the Comment in BCFv2 XML format.
4794
+ */
4795
+ serialize(): string;
4796
+ }
4797
+ import { BCFTopics } from "../..";
4798
+ export declare const extensionsImporter: (manager: BCFTopics, extensionsXML: string) => void;
4799
+ import { BufferGeometry } from "three";
4800
+ import * as THREE from "three";
4801
+ export declare class TransformHelper {
4802
+ getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
4803
+ }
4804
4804
  import * as WEBIFC from "web-ifc";
4805
4805
  export type RelationsMap = Map<number, Map<number, number[]>>;
4806
4806
  export interface ModelsRelationMap {