@thatopen/components 2.2.10 → 2.2.11

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.
@@ -7,7 +7,7 @@ export declare class Components implements Disposable {
7
7
  /**
8
8
  * The version of the @thatopen/components library.
9
9
  */
10
- static readonly release = "2.2.10";
10
+ static readonly release = "2.2.11";
11
11
  /** {@link Disposable.onDisposed} */
12
12
  readonly onDisposed: Event<void>;
13
13
  /**
@@ -120,65 +120,6 @@ export declare class Disposer extends Component {
120
120
  private disposeChildren;
121
121
  private static disposeMaterial;
122
122
  }
123
- import { SimpleScene, SimpleSceneConfig } from "../Worlds";
124
- import { DistanceRenderer } from "./src";
125
- import { 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 {
140
- private _distanceRenderer?;
141
- /**
142
- * Whether the bias property should be set automatically depending on the shadow distance.
143
- */
144
- autoBias: boolean;
145
- /**
146
- * Configuration interface for the {@link ShadowedScene}.
147
- * Defines properties for directional and ambient lights, as well as shadows.
148
- */
149
- config: Required<ShadowedSceneConfig>;
150
- private _lightsWithShadow;
151
- private _isComputingShadows;
152
- private _shadowsEnabled;
153
- private _bias;
154
- /**
155
- * The getter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
156
- */
157
- get bias(): number;
158
- /**
159
- * The setter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
160
- */
161
- set bias(value: number);
162
- /**
163
- * Getter to see whether the shadows are enabled or not in this scene instance.
164
- */
165
- get shadowsEnabled(): boolean;
166
- /**
167
- * Setter to control whether the shadows are enabled or not in this scene instance.
168
- */
169
- set shadowsEnabled(value: boolean);
170
- /**
171
- * Getter to get the renderer used to determine the farthest distance from the camera.
172
- */
173
- get distanceRenderer(): DistanceRenderer;
174
- /** {@link Configurable.setup} */
175
- setup(config?: Partial<ShadowedSceneConfig>): void;
176
- /** {@link Disposable.dispose} */
177
- dispose(): void;
178
- /** Update all the shadows of the scene. */
179
- updateShadows(): Promise<void>;
180
- private recomputeShadows;
181
- }
182
123
  import { Component, Disposable, World, Event } from "../Types";
183
124
  import { SimpleRaycaster } from "./src";
184
125
  import { Components } from "../Components";
@@ -274,23 +215,64 @@ export declare class Worlds extends Component implements Updateable, Disposable
274
215
  /** {@link Updateable.update} */
275
216
  update(delta?: number): void | Promise<void>;
276
217
  }
277
- import * as THREE from "three";
278
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
279
- center: THREE.Vector3;
280
- halfSizes: THREE.Vector3;
281
- rotation: THREE.Matrix3;
282
- transformation: THREE.Matrix4;
283
- };
284
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
285
- import * as THREE from "three";
286
- export declare class MaterialsUtils {
287
- static isTransparent(material: THREE.Material): boolean;
218
+ import { SimpleScene, SimpleSceneConfig } from "../Worlds";
219
+ import { DistanceRenderer } from "./src";
220
+ import { Disposable } from "../Types";
221
+ /**
222
+ * Configuration interface for the {@link ShadowedScene}. Defines properties for directional and ambient lights,
223
+ * as well as shadows.
224
+ */
225
+ export interface ShadowedSceneConfig extends SimpleSceneConfig {
226
+ shadows: {
227
+ cascade: number;
228
+ resolution: number;
229
+ };
288
230
  }
289
- export declare class UUID {
290
- private static _pattern;
291
- private static _lut;
292
- static create(): string;
293
- static validate(uuid: string): void;
231
+ /**
232
+ * 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).
233
+ */
234
+ export declare class ShadowedScene extends SimpleScene implements Disposable {
235
+ private _distanceRenderer?;
236
+ /**
237
+ * Whether the bias property should be set automatically depending on the shadow distance.
238
+ */
239
+ autoBias: boolean;
240
+ /**
241
+ * Configuration interface for the {@link ShadowedScene}.
242
+ * Defines properties for directional and ambient lights, as well as shadows.
243
+ */
244
+ config: Required<ShadowedSceneConfig>;
245
+ private _lightsWithShadow;
246
+ private _isComputingShadows;
247
+ private _shadowsEnabled;
248
+ private _bias;
249
+ /**
250
+ * The getter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
251
+ */
252
+ get bias(): number;
253
+ /**
254
+ * The setter for the bias to prevent artifacts (stripes). It usually ranges between 0 and -0.005.
255
+ */
256
+ set bias(value: number);
257
+ /**
258
+ * Getter to see whether the shadows are enabled or not in this scene instance.
259
+ */
260
+ get shadowsEnabled(): boolean;
261
+ /**
262
+ * Setter to control whether the shadows are enabled or not in this scene instance.
263
+ */
264
+ set shadowsEnabled(value: boolean);
265
+ /**
266
+ * Getter to get the renderer used to determine the farthest distance from the camera.
267
+ */
268
+ get distanceRenderer(): DistanceRenderer;
269
+ /** {@link Configurable.setup} */
270
+ setup(config?: Partial<ShadowedSceneConfig>): void;
271
+ /** {@link Disposable.dispose} */
272
+ dispose(): void;
273
+ /** Update all the shadows of the scene. */
274
+ updateShadows(): Promise<void>;
275
+ private recomputeShadows;
294
276
  }
295
277
  import { Component, Disposable, World, Event } from "../Types";
296
278
  import { GridConfig, SimpleGrid } from "./src";
@@ -342,120 +324,135 @@ export declare class Grids extends Component implements Disposable {
342
324
  dispose(): void;
343
325
  }
344
326
  import * as THREE from "three";
345
- import { Component, Components, Disposable, Event, World } from "../core";
327
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
328
+ import { SimplePlane } from "./src";
329
+ import { Components } from "../Components";
346
330
  /**
347
- * Configuration interface for the VertexPicker component.
331
+ * 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).
332
+ *
333
+ * @param components - the instance of {@link Components} used.
334
+ * E.g. {@link SimplePlane}.
348
335
  */
349
- export interface VertexPickerConfig {
336
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
350
337
  /**
351
- * If true, only vertices will be picked, not the closest point on the face.
338
+ * A unique identifier for the component.
339
+ * This UUID is used to register the component within the Components system.
352
340
  */
353
- showOnlyVertex: boolean;
341
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
342
+ /** Event that fires when the user starts dragging a clipping plane. */
343
+ readonly onBeforeDrag: Event<void>;
344
+ /** Event that fires when the user stops dragging a clipping plane. */
345
+ readonly onAfterDrag: Event<void>;
354
346
  /**
355
- * The maximum distance for snapping to a vertex.
347
+ * Event that fires when the user starts creating a clipping plane.
356
348
  */
357
- snapDistance: number;
349
+ readonly onBeforeCreate: Event<unknown>;
358
350
  /**
359
- * The HTML element to use for previewing the picked vertex.
351
+ * Event that fires when the user cancels the creation of a clipping plane.
360
352
  */
361
- previewElement: HTMLElement;
362
- }
363
- /**
364
- * A class that provides functionality for picking vertices in a 3D scene.
365
- */
366
- export declare class VertexPicker extends Component implements Disposable {
367
- /** {@link Disposable.onDisposed} */
368
- readonly onDisposed: Event<unknown>;
353
+ readonly onBeforeCancel: Event<unknown>;
369
354
  /**
370
- * An event that is triggered when a vertex is found.
371
- * The event passes a THREE.Vector3 representing the position of the found vertex.
355
+ * Event that fires after the user cancels the creation of a clipping plane.
372
356
  */
373
- readonly onVertexFound: Event<THREE.Vector3>;
357
+ readonly onAfterCancel: Event<unknown>;
374
358
  /**
375
- * An event that is triggered when a vertex is lost.
376
- * The event passes a THREE.Vector3 representing the position of the lost vertex.
359
+ * Event that fires when the user starts deleting a clipping plane.
377
360
  */
378
- readonly onVertexLost: Event<THREE.Vector3>;
361
+ readonly onBeforeDelete: Event<unknown>;
379
362
  /**
380
- * An event that is triggered when the picker is enabled or disabled
363
+ * Event that fires after a clipping plane has been created.
364
+ * @param plane - The newly created clipping plane.
381
365
  */
382
- readonly onEnabled: Event<boolean>;
366
+ readonly onAfterCreate: Event<SimplePlane>;
383
367
  /**
384
- * A reference to the Components instance associated with this VertexPicker.
368
+ * Event that fires after a clipping plane has been deleted.
369
+ * @param plane - The deleted clipping plane.
385
370
  */
386
- components: Components;
371
+ readonly onAfterDelete: Event<SimplePlane>;
372
+ /** {@link Disposable.onDisposed} */
373
+ readonly onDisposed: Event<string>;
387
374
  /**
388
- * A reference to the working plane used for vertex picking.
389
- * This plane is used to determine which vertices are considered valid for picking.
390
- * If this value is null, all vertices are considered valid.
375
+ * Whether to force the clipping plane to be orthogonal in the Y direction
376
+ * (up). This is desirable when clipping a building horizontally and a
377
+ * clipping plane is created in its roof, which might have a slight
378
+ * slope for draining purposes.
391
379
  */
392
- workingPlane: THREE.Plane | null;
393
- private _pickedPoint;
394
- private _config;
395
- private _enabled;
380
+ orthogonalY: boolean;
396
381
  /**
397
- * Sets the enabled state of the VertexPicker.
398
- * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
399
- * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
400
- *
401
- * @param value - The new enabled state.
382
+ * The tolerance that determines whether an almost-horizontal clipping plane
383
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
384
+ * has to be 'true' for this to apply.
402
385
  */
403
- set enabled(value: boolean);
386
+ toleranceOrthogonalY: number;
404
387
  /**
405
- * Gets the current enabled state of the VertexPicker.
406
- *
407
- * @returns The current enabled state.
388
+ * The type of clipping plane to be created.
389
+ * Default is {@link SimplePlane}.
408
390
  */
391
+ Type: new (...args: any) => SimplePlane;
392
+ /**
393
+ * A list of all the clipping planes created by this component.
394
+ */
395
+ list: SimplePlane[];
396
+ /** The material used in all the clipping planes. */
397
+ private _material;
398
+ private _size;
399
+ private _enabled;
400
+ private _visible;
401
+ /** {@link Component.enabled} */
409
402
  get enabled(): boolean;
403
+ /** {@link Component.enabled} */
404
+ set enabled(state: boolean);
405
+ /** {@link Hideable.visible } */
406
+ get visible(): boolean;
407
+ /** {@link Hideable.visible } */
408
+ set visible(state: boolean);
409
+ /** The material of the clipping plane representation. */
410
+ get material(): THREE.MeshBasicMaterial;
411
+ /** The material of the clipping plane representation. */
412
+ set material(material: THREE.MeshBasicMaterial);
413
+ /** The size of the geometric representation of the clippings planes. */
414
+ get size(): number;
415
+ /** The size of the geometric representation of the clippings planes. */
416
+ set size(size: number);
417
+ constructor(components: Components);
418
+ /** {@link Disposable.dispose} */
419
+ dispose(): void;
420
+ /** {@link Createable.create} */
421
+ create(world: World): SimplePlane | null;
410
422
  /**
411
- * Sets the configuration for the VertexPicker component.
412
- *
413
- * @param value - A Partial object containing the configuration properties to update.
414
- * The properties not provided in the value object will retain their current values.
423
+ * Creates a plane in a certain place and with a certain orientation,
424
+ * without the need of the mouse.
415
425
  *
416
- * @example
417
- * '''typescript
418
- * vertexPicker.config = {
419
- * snapDistance: 0.5,
420
- * showOnlyVertex: true,
421
- * };
422
- * '''
426
+ * @param world - the world where this plane should be created.
427
+ * @param normal - the orientation of the clipping plane.
428
+ * @param point - the position of the clipping plane.
429
+ * navigation.
423
430
  */
424
- set config(value: Partial<VertexPickerConfig>);
431
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
425
432
  /**
426
- * Gets the current configuration for the VertexPicker component.
427
- *
428
- * @returns A copy of the current VertexPickerConfig object.
433
+ * {@link Createable.delete}
429
434
  *
430
- * @example
431
- * '''typescript
432
- * const currentConfig = vertexPicker.config;
433
- * console.log(currentConfig.snapDistance); // Output: 0.25
434
- * '''
435
+ * @param world - the world where the plane to delete is.
436
+ * @param plane - the plane to delete. If undefined, the first plane
437
+ * found under the cursor will be deleted.
435
438
  */
436
- get config(): Partial<VertexPickerConfig>;
437
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
438
- /** {@link Disposable.dispose} */
439
- dispose(): void;
439
+ delete(world: World, plane?: SimplePlane): void;
440
440
  /**
441
- * Performs the vertex picking operation based on the current state of the VertexPicker.
442
- *
443
- * @param world - The World instance to use for raycasting.
444
- *
445
- * @returns The current picked point, or null if no point is picked.
441
+ * Deletes all the existing clipping planes.
446
442
  *
447
- * @remarks
448
- * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
449
- * If enabled, it performs raycasting to find the closest intersecting object.
450
- * It then determines the closest vertex or point on the face, based on the configuration settings.
451
- * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
452
- * If the picked point is not on the working plane, it resets the 'pickedPoint'.
453
- * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
443
+ * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
454
444
  */
455
- get(world: World): THREE.Vector3 | null;
456
- private getClosestVertex;
457
- private getVertices;
458
- private getVertex;
445
+ deleteAll(types?: Set<string>): void;
446
+ private deletePlane;
447
+ private pickPlane;
448
+ private getAllPlaneMeshes;
449
+ private createPlaneFromIntersection;
450
+ private getWorldNormal;
451
+ private normalizePlaneDirectionY;
452
+ private newPlane;
453
+ private updateMaterialsAndPlanes;
454
+ private _onStartDragging;
455
+ private _onEndDragging;
459
456
  }
460
457
  import * as THREE from "three";
461
458
  import { Components } from "../Components";
@@ -514,136 +511,52 @@ export declare class Cullers extends Component implements Disposable {
514
511
  */
515
512
  updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
516
513
  }
517
- import * as THREE from "three";
518
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
519
- import { SimplePlane } from "./src";
514
+ import { MiniMap } from "./src";
515
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
520
516
  import { Components } from "../Components";
521
517
  /**
522
- * 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).
523
- *
524
- * @param components - the instance of {@link Components} used.
525
- * E.g. {@link SimplePlane}.
518
+ * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
526
519
  */
527
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
520
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
528
521
  /**
529
522
  * A unique identifier for the component.
530
523
  * This UUID is used to register the component within the Components system.
531
524
  */
532
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
533
- /** Event that fires when the user starts dragging a clipping plane. */
534
- readonly onBeforeDrag: Event<void>;
535
- /** Event that fires when the user stops dragging a clipping plane. */
536
- readonly onAfterDrag: Event<void>;
537
- /**
538
- * Event that fires when the user starts creating a clipping plane.
539
- */
540
- readonly onBeforeCreate: Event<unknown>;
541
- /**
542
- * Event that fires when the user cancels the creation of a clipping plane.
543
- */
544
- readonly onBeforeCancel: Event<unknown>;
545
- /**
546
- * Event that fires after the user cancels the creation of a clipping plane.
547
- */
548
- readonly onAfterCancel: Event<unknown>;
549
- /**
550
- * Event that fires when the user starts deleting a clipping plane.
551
- */
552
- readonly onBeforeDelete: Event<unknown>;
553
- /**
554
- * Event that fires after a clipping plane has been created.
555
- * @param plane - The newly created clipping plane.
556
- */
557
- readonly onAfterCreate: Event<SimplePlane>;
558
- /**
559
- * Event that fires after a clipping plane has been deleted.
560
- * @param plane - The deleted clipping plane.
561
- */
562
- readonly onAfterDelete: Event<SimplePlane>;
525
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
526
+ /** {@link Updateable.onAfterUpdate} */
527
+ readonly onAfterUpdate: Event<unknown>;
528
+ /** {@link Updateable.onBeforeUpdate} */
529
+ readonly onBeforeUpdate: Event<unknown>;
563
530
  /** {@link Disposable.onDisposed} */
564
- readonly onDisposed: Event<string>;
565
- /**
566
- * Whether to force the clipping plane to be orthogonal in the Y direction
567
- * (up). This is desirable when clipping a building horizontally and a
568
- * clipping plane is created in its roof, which might have a slight
569
- * slope for draining purposes.
570
- */
571
- orthogonalY: boolean;
572
- /**
573
- * The tolerance that determines whether an almost-horizontal clipping plane
574
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
575
- * has to be 'true' for this to apply.
576
- */
577
- toleranceOrthogonalY: number;
578
- /**
579
- * The type of clipping plane to be created.
580
- * Default is {@link SimplePlane}.
581
- */
582
- Type: new (...args: any) => SimplePlane;
583
- /**
584
- * A list of all the clipping planes created by this component.
585
- */
586
- list: SimplePlane[];
587
- /** The material used in all the clipping planes. */
588
- private _material;
589
- private _size;
590
- private _enabled;
591
- private _visible;
592
- /** {@link Component.enabled} */
593
- get enabled(): boolean;
531
+ readonly onDisposed: Event<unknown>;
594
532
  /** {@link Component.enabled} */
595
- set enabled(state: boolean);
596
- /** {@link Hideable.visible } */
597
- get visible(): boolean;
598
- /** {@link Hideable.visible } */
599
- set visible(state: boolean);
600
- /** The material of the clipping plane representation. */
601
- get material(): THREE.MeshBasicMaterial;
602
- /** The material of the clipping plane representation. */
603
- set material(material: THREE.MeshBasicMaterial);
604
- /** The size of the geometric representation of the clippings planes. */
605
- get size(): number;
606
- /** The size of the geometric representation of the clippings planes. */
607
- set size(size: number);
608
- constructor(components: Components);
609
- /** {@link Disposable.dispose} */
610
- dispose(): void;
611
- /** {@link Createable.create} */
612
- create(world: World): SimplePlane | null;
533
+ enabled: boolean;
613
534
  /**
614
- * Creates a plane in a certain place and with a certain orientation,
615
- * without the need of the mouse.
616
- *
617
- * @param world - the world where this plane should be created.
618
- * @param normal - the orientation of the clipping plane.
619
- * @param point - the position of the clipping plane.
620
- * navigation.
535
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
621
536
  */
622
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
537
+ list: Map<string, MiniMap>;
538
+ constructor(components: Components);
623
539
  /**
624
- * {@link Createable.delete}
540
+ * Creates a new {@link MiniMap} instance associated with the given world.
541
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
625
542
  *
626
- * @param world - the world where the plane to delete is.
627
- * @param plane - the plane to delete. If undefined, the first plane
628
- * found under the cursor will be deleted.
543
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
544
+ * @returns The newly created {@link MiniMap} instance.
545
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
629
546
  */
630
- delete(world: World, plane?: SimplePlane): void;
547
+ create(world: World): MiniMap;
631
548
  /**
632
- * Deletes all the existing clipping planes.
549
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
550
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
633
551
  *
634
- * @param types - the types of planes to be deleted. If not provided, all planes will be deleted.
552
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
553
+ * @returns {void}
635
554
  */
636
- deleteAll(types?: Set<string>): void;
637
- private deletePlane;
638
- private pickPlane;
639
- private getAllPlaneMeshes;
640
- private createPlaneFromIntersection;
641
- private getWorldNormal;
642
- private normalizePlaneDirectionY;
643
- private newPlane;
644
- private updateMaterialsAndPlanes;
645
- private _onStartDragging;
646
- private _onEndDragging;
555
+ delete(id: string): void;
556
+ /** {@link Disposable.dispose} */
557
+ dispose(): void;
558
+ /** {@link Updateable.update} */
559
+ update(): void;
647
560
  }
648
561
  import { World, Component, Disposable, Event, DataMap, Configurable } from "../Types";
649
562
  import { Components } from "../Components";
@@ -692,53 +605,6 @@ export declare class Viewpoints extends Component implements Disposable, Configu
692
605
  */
693
606
  dispose(): void;
694
607
  }
695
- import { MiniMap } from "./src";
696
- import { Component, Updateable, World, Event, Disposable } from "../Types";
697
- import { Components } from "../Components";
698
- /**
699
- * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
700
- */
701
- export declare class MiniMaps extends Component implements Updateable, Disposable {
702
- /**
703
- * A unique identifier for the component.
704
- * This UUID is used to register the component within the Components system.
705
- */
706
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
707
- /** {@link Updateable.onAfterUpdate} */
708
- readonly onAfterUpdate: Event<unknown>;
709
- /** {@link Updateable.onBeforeUpdate} */
710
- readonly onBeforeUpdate: Event<unknown>;
711
- /** {@link Disposable.onDisposed} */
712
- readonly onDisposed: Event<unknown>;
713
- /** {@link Component.enabled} */
714
- enabled: boolean;
715
- /**
716
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
717
- */
718
- list: Map<string, MiniMap>;
719
- constructor(components: Components);
720
- /**
721
- * Creates a new {@link MiniMap} instance associated with the given world.
722
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
723
- *
724
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
725
- * @returns The newly created {@link MiniMap} instance.
726
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
727
- */
728
- create(world: World): MiniMap;
729
- /**
730
- * Deletes a {@link MiniMap} instance associated with the given world ID.
731
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
732
- *
733
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
734
- * @returns {void}
735
- */
736
- delete(id: string): void;
737
- /** {@link Disposable.dispose} */
738
- dispose(): void;
739
- /** {@link Updateable.update} */
740
- update(): void;
741
- }
742
608
  import * as THREE from "three";
743
609
  import { Components } from "../Components";
744
610
  import { SimpleCamera } from "..";
@@ -1116,16 +982,66 @@ export declare class BoundingBoxer extends Component implements Disposable {
1116
982
  addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
1117
983
  private static getFragmentBounds;
1118
984
  }
1119
- import * as THREE from "three";
1120
- import * as FRAGS from "@thatopen/fragments";
1121
- import { Disposable, Component, Event, Components } from "../../core";
985
+ import { Component, Disposable, Event, Components } from "../../core";
1122
986
  /**
1123
- * 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.
987
+ * 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).
1124
988
  */
1125
- export interface Classification {
989
+ export declare class Exploder extends Component implements Disposable {
1126
990
  /**
1127
- * A system within the classification.
1128
- * The key is the system name, and the value is an object representing the classes within the system.
991
+ * A unique identifier for the component.
992
+ * This UUID is used to register the component within the Components system.
993
+ */
994
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
995
+ /** {@link Disposable.onDisposed} */
996
+ readonly onDisposed: Event<unknown>;
997
+ /** {@link Component.enabled} */
998
+ enabled: boolean;
999
+ /**
1000
+ * The height of the explosion animation.
1001
+ * This property determines the vertical distance by which fragments are moved during the explosion.
1002
+ * Default value is 10.
1003
+ */
1004
+ height: number;
1005
+ /**
1006
+ * The group name used for the explosion animation.
1007
+ * This property specifies the group of fragments that will be affected by the explosion.
1008
+ * Default value is "storeys".
1009
+ */
1010
+ groupName: string;
1011
+ /**
1012
+ * A set of strings representing the exploded items.
1013
+ * This set is used to keep track of which items have been exploded.
1014
+ */
1015
+ list: Set<string>;
1016
+ constructor(components: Components);
1017
+ /** {@link Disposable.dispose} */
1018
+ dispose(): void;
1019
+ /**
1020
+ * Sets the explosion state of the fragments.
1021
+ *
1022
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
1023
+ *
1024
+ * @remarks
1025
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1026
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1027
+ * If 'active' is false, the fragments are moved back to their original position.
1028
+ *
1029
+ * The method also keeps track of the exploded items using the 'list' set.
1030
+ *
1031
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1032
+ */
1033
+ set(active: boolean): void;
1034
+ }
1035
+ import * as THREE from "three";
1036
+ import * as FRAGS from "@thatopen/fragments";
1037
+ import { Disposable, Component, Event, Components } from "../../core";
1038
+ /**
1039
+ * 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.
1040
+ */
1041
+ export interface Classification {
1042
+ /**
1043
+ * A system within the classification.
1044
+ * The key is the system name, and the value is an object representing the classes within the system.
1129
1045
  */
1130
1046
  [system: string]: {
1131
1047
  /**
@@ -1290,56 +1206,6 @@ export declare class Classifier extends Component implements Disposable {
1290
1206
  resetColor(items: FRAGS.FragmentIdMap): void;
1291
1207
  protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
1292
1208
  }
1293
- import { Component, Disposable, Event, Components } from "../../core";
1294
- /**
1295
- * 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).
1296
- */
1297
- export declare class Exploder extends Component implements Disposable {
1298
- /**
1299
- * A unique identifier for the component.
1300
- * This UUID is used to register the component within the Components system.
1301
- */
1302
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
1303
- /** {@link Disposable.onDisposed} */
1304
- readonly onDisposed: Event<unknown>;
1305
- /** {@link Component.enabled} */
1306
- enabled: boolean;
1307
- /**
1308
- * The height of the explosion animation.
1309
- * This property determines the vertical distance by which fragments are moved during the explosion.
1310
- * Default value is 10.
1311
- */
1312
- height: number;
1313
- /**
1314
- * The group name used for the explosion animation.
1315
- * This property specifies the group of fragments that will be affected by the explosion.
1316
- * Default value is "storeys".
1317
- */
1318
- groupName: string;
1319
- /**
1320
- * A set of strings representing the exploded items.
1321
- * This set is used to keep track of which items have been exploded.
1322
- */
1323
- list: Set<string>;
1324
- constructor(components: Components);
1325
- /** {@link Disposable.dispose} */
1326
- dispose(): void;
1327
- /**
1328
- * Sets the explosion state of the fragments.
1329
- *
1330
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
1331
- *
1332
- * @remarks
1333
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
1334
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
1335
- * If 'active' is false, the fragments are moved back to their original position.
1336
- *
1337
- * The method also keeps track of the exploded items using the 'list' set.
1338
- *
1339
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
1340
- */
1341
- set(active: boolean): void;
1342
- }
1343
1209
  import * as FRAGS from "@thatopen/fragments";
1344
1210
  import { Components, Component } from "../../core";
1345
1211
  /**
@@ -1378,6 +1244,24 @@ export declare class Hider extends Component {
1378
1244
  isolate(items: FRAGS.FragmentIdMap): void;
1379
1245
  private updateCulledVisibility;
1380
1246
  }
1247
+ import * as THREE from "three";
1248
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
1249
+ center: THREE.Vector3;
1250
+ halfSizes: THREE.Vector3;
1251
+ rotation: THREE.Matrix3;
1252
+ transformation: THREE.Matrix4;
1253
+ };
1254
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
1255
+ import * as THREE from "three";
1256
+ export declare class MaterialsUtils {
1257
+ static isTransparent(material: THREE.Material): boolean;
1258
+ }
1259
+ export declare class UUID {
1260
+ private static _pattern;
1261
+ private static _lut;
1262
+ static create(): string;
1263
+ static validate(uuid: string): void;
1264
+ }
1381
1265
  import * as WEBIFC from "web-ifc";
1382
1266
  import * as FRAGS from "@thatopen/fragments";
1383
1267
  import { IfcFragmentSettings } from "./src";
@@ -1455,7 +1339,7 @@ export declare class IfcLoader extends Component implements Disposable {
1455
1339
  * const group = await ifcLoader.load(ifcData);
1456
1340
  * '''
1457
1341
  */
1458
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1342
+ load(data: Uint8Array, coordinate?: boolean, name?: string): Promise<FRAGS.FragmentsGroup>;
1459
1343
  /**
1460
1344
  * Reads an IFC file and initializes the Web-IFC library.
1461
1345
  *
@@ -1493,6 +1377,122 @@ export declare class IfcLoader extends Component implements Disposable {
1493
1377
  private getGeometry;
1494
1378
  private autoSetWasm;
1495
1379
  }
1380
+ import * as THREE from "three";
1381
+ import { Component, Components, Disposable, Event, World } from "../core";
1382
+ /**
1383
+ * Configuration interface for the VertexPicker component.
1384
+ */
1385
+ export interface VertexPickerConfig {
1386
+ /**
1387
+ * If true, only vertices will be picked, not the closest point on the face.
1388
+ */
1389
+ showOnlyVertex: boolean;
1390
+ /**
1391
+ * The maximum distance for snapping to a vertex.
1392
+ */
1393
+ snapDistance: number;
1394
+ /**
1395
+ * The HTML element to use for previewing the picked vertex.
1396
+ */
1397
+ previewElement: HTMLElement;
1398
+ }
1399
+ /**
1400
+ * A class that provides functionality for picking vertices in a 3D scene.
1401
+ */
1402
+ export declare class VertexPicker extends Component implements Disposable {
1403
+ /** {@link Disposable.onDisposed} */
1404
+ readonly onDisposed: Event<unknown>;
1405
+ /**
1406
+ * An event that is triggered when a vertex is found.
1407
+ * The event passes a THREE.Vector3 representing the position of the found vertex.
1408
+ */
1409
+ readonly onVertexFound: Event<THREE.Vector3>;
1410
+ /**
1411
+ * An event that is triggered when a vertex is lost.
1412
+ * The event passes a THREE.Vector3 representing the position of the lost vertex.
1413
+ */
1414
+ readonly onVertexLost: Event<THREE.Vector3>;
1415
+ /**
1416
+ * An event that is triggered when the picker is enabled or disabled
1417
+ */
1418
+ readonly onEnabled: Event<boolean>;
1419
+ /**
1420
+ * A reference to the Components instance associated with this VertexPicker.
1421
+ */
1422
+ components: Components;
1423
+ /**
1424
+ * A reference to the working plane used for vertex picking.
1425
+ * This plane is used to determine which vertices are considered valid for picking.
1426
+ * If this value is null, all vertices are considered valid.
1427
+ */
1428
+ workingPlane: THREE.Plane | null;
1429
+ private _pickedPoint;
1430
+ private _config;
1431
+ private _enabled;
1432
+ /**
1433
+ * Sets the enabled state of the VertexPicker.
1434
+ * When enabled, the VertexPicker will actively search for vertices in the 3D scene.
1435
+ * When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
1436
+ *
1437
+ * @param value - The new enabled state.
1438
+ */
1439
+ set enabled(value: boolean);
1440
+ /**
1441
+ * Gets the current enabled state of the VertexPicker.
1442
+ *
1443
+ * @returns The current enabled state.
1444
+ */
1445
+ get enabled(): boolean;
1446
+ /**
1447
+ * Sets the configuration for the VertexPicker component.
1448
+ *
1449
+ * @param value - A Partial object containing the configuration properties to update.
1450
+ * The properties not provided in the value object will retain their current values.
1451
+ *
1452
+ * @example
1453
+ * '''typescript
1454
+ * vertexPicker.config = {
1455
+ * snapDistance: 0.5,
1456
+ * showOnlyVertex: true,
1457
+ * };
1458
+ * '''
1459
+ */
1460
+ set config(value: Partial<VertexPickerConfig>);
1461
+ /**
1462
+ * Gets the current configuration for the VertexPicker component.
1463
+ *
1464
+ * @returns A copy of the current VertexPickerConfig object.
1465
+ *
1466
+ * @example
1467
+ * '''typescript
1468
+ * const currentConfig = vertexPicker.config;
1469
+ * console.log(currentConfig.snapDistance); // Output: 0.25
1470
+ * '''
1471
+ */
1472
+ get config(): Partial<VertexPickerConfig>;
1473
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
1474
+ /** {@link Disposable.dispose} */
1475
+ dispose(): void;
1476
+ /**
1477
+ * Performs the vertex picking operation based on the current state of the VertexPicker.
1478
+ *
1479
+ * @param world - The World instance to use for raycasting.
1480
+ *
1481
+ * @returns The current picked point, or null if no point is picked.
1482
+ *
1483
+ * @remarks
1484
+ * This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
1485
+ * If enabled, it performs raycasting to find the closest intersecting object.
1486
+ * It then determines the closest vertex or point on the face, based on the configuration settings.
1487
+ * If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
1488
+ * If the picked point is not on the working plane, it resets the 'pickedPoint'.
1489
+ * If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
1490
+ */
1491
+ get(world: World): THREE.Vector3 | null;
1492
+ private getClosestVertex;
1493
+ private getVertices;
1494
+ private getVertex;
1495
+ }
1496
1496
  import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1497
1497
  import * as THREE from "three";
1498
1498
  import * as FRAGS from "@thatopen/fragments";
@@ -1808,22 +1808,160 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
1808
1808
  private streamAllProperties;
1809
1809
  private cleanUp;
1810
1810
  }
1811
- import * as WEBIFC from "web-ifc";
1812
- import { FragmentsGroup } from "@thatopen/fragments";
1813
- import { Disposable, Event, Component, Components } from "../../core";
1814
- import { RelationsMap, ModelsRelationMap, InverseAttribute, IfcRelation } from "./src";
1811
+ import { XMLParser } from "fast-xml-parser";
1812
+ import { Component, Configurable, Disposable, Event, World, DataMap } from "../../core/Types";
1813
+ import { BCFTopic, BCFTopicsConfig, Topic } from "./src";
1814
+ import { Viewpoint } from "../../core/Viewpoints";
1815
1815
  /**
1816
- * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
1816
+ * BCFTopics manages Building Collaboration Format (BCF) data the engine.
1817
+ * It provides functionality for importing, exporting, and manipulating BCF data.
1817
1818
  */
1818
- export declare class IfcRelationsIndexer extends Component implements Disposable {
1819
- /**
1820
- * A unique identifier for the component.
1821
- * This UUID is used to register the component within the Components system.
1822
- */
1823
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1824
- /** {@link Disposable.onDisposed} */
1825
- readonly onDisposed: Event<string>;
1826
- /**
1819
+ export declare class BCFTopics extends Component implements Disposable, Configurable<BCFTopicsConfig> {
1820
+ static uuid: "de977976-e4f6-4e4f-a01a-204727839802";
1821
+ enabled: boolean;
1822
+ static xmlParser: XMLParser;
1823
+ config: Required<BCFTopicsConfig>;
1824
+ readonly list: DataMap<string, Topic>;
1825
+ readonly onSetup: Event<unknown>;
1826
+ isSetup: boolean;
1827
+ setup(config?: Partial<BCFTopicsConfig>): void;
1828
+ readonly onBCFImported: Event<Topic[]>;
1829
+ /**
1830
+ * Creates a new BCFTopic instance and adds it to the list.
1831
+ *
1832
+ * @param data - Optional partial BCFTopic object to initialize the new topic with.
1833
+ * If not provided, default values will be used.
1834
+ * @returns The newly created BCFTopic instance.
1835
+ */
1836
+ create(data?: Partial<BCFTopic>): Topic;
1837
+ readonly onDisposed: Event<unknown>;
1838
+ /**
1839
+ * Disposes of the BCFTopics component and triggers the onDisposed event.
1840
+ *
1841
+ * @remarks
1842
+ * This method clears the list of topics and triggers the onDisposed event.
1843
+ * It also resets the onDisposed event listener.
1844
+ */
1845
+ dispose(): void;
1846
+ /**
1847
+ * Retrieves the unique set of topic types used across all topics.
1848
+ *
1849
+ * @returns A Set containing the unique topic types.
1850
+ */
1851
+ get usedTypes(): Set<string>;
1852
+ /**
1853
+ * Retrieves the unique set of topic statuses used across all topics.
1854
+ *
1855
+ * @returns A Set containing the unique topic statuses.
1856
+ */
1857
+ get usedStatuses(): Set<string>;
1858
+ /**
1859
+ * Retrieves the unique set of topic priorities used across all topics.
1860
+ *
1861
+ * @returns A Set containing the unique topic priorities.
1862
+ * Note: This method filters out any null or undefined priorities.
1863
+ */
1864
+ get usedPriorities(): Set<string | undefined>;
1865
+ /**
1866
+ * Retrieves the unique set of topic stages used across all topics.
1867
+ *
1868
+ * @returns A Set containing the unique topic stages.
1869
+ * Note: This method filters out any null or undefined stages.
1870
+ */
1871
+ get usedStages(): Set<string | undefined>;
1872
+ /**
1873
+ * Retrieves the unique set of users associated with topics.
1874
+ *
1875
+ * @returns A Set containing the unique users.
1876
+ * Note: This method collects users from the creation author, assigned to, modified author, and comment authors.
1877
+ */
1878
+ get usedUsers(): Set<string>;
1879
+ /**
1880
+ * Retrieves the unique set of labels used across all topics.
1881
+ *
1882
+ * @returns A Set containing the unique labels.
1883
+ */
1884
+ get usedLabels(): Set<string>;
1885
+ /**
1886
+ * Updates the set of extensions (types, statuses, priorities, labels, stages, users) based on the current topics.
1887
+ * This method iterates through each topic in the list and adds its properties to the corresponding sets in the config.
1888
+ */
1889
+ updateExtensions(): void;
1890
+ /**
1891
+ * Updates the references to viewpoints in the topics.
1892
+ * This function iterates through each topic and checks if the viewpoints exist in the viewpoints list.
1893
+ * If a viewpoint does not exist, it is removed from the topic's viewpoints.
1894
+ */
1895
+ updateViewpointReferences(): void;
1896
+ /**
1897
+ * Exports the given topics to a BCF (Building Collaboration Format) zip file.
1898
+ *
1899
+ * @param topics - The topics to export. Defaults to all topics in the list.
1900
+ * @returns A promise that resolves to a Blob containing the exported BCF zip file.
1901
+ */
1902
+ export(topics?: Iterable<Topic>): Promise<Blob>;
1903
+ private serializeExtensions;
1904
+ private processMarkupComment;
1905
+ private getMarkupComments;
1906
+ private getMarkupLabels;
1907
+ private getMarkupViewpoints;
1908
+ private getMarkupRelatedTopics;
1909
+ /**
1910
+ * Loads BCF (Building Collaboration Format) data into the engine.
1911
+ *
1912
+ * @param world - The default world where the viewpoints are going to be created.
1913
+ * @param data - The BCF data to load.
1914
+ *
1915
+ * @returns A promise that resolves to an object containing the created viewpoints and topics.
1916
+ *
1917
+ * @throws An error if the BCF version is not supported.
1918
+ */
1919
+ load(data: Uint8Array, world: World): Promise<{
1920
+ viewpoints: Viewpoint[];
1921
+ topics: Topic[];
1922
+ }>;
1923
+ }
1924
+ import * as WEBIFC from "web-ifc";
1925
+ import * as FRAG from "@thatopen/fragments";
1926
+ import { Component, Components } from "../../core";
1927
+ /**
1928
+ * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
1929
+ */
1930
+ export declare class IfcJsonExporter extends Component {
1931
+ /**
1932
+ * A unique identifier for the component.
1933
+ * This UUID is used to register the component within the Components system.
1934
+ */
1935
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
1936
+ /** {@link Component.enabled} */
1937
+ enabled: boolean;
1938
+ constructor(components: Components);
1939
+ /**
1940
+ * Exports all the properties of an IFC into an array of JS objects.
1941
+ * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
1942
+ * @param modelID ID of the IFC model whose properties to extract.
1943
+ * @param indirect whether to get the indirect relationships as well.
1944
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
1945
+ * to make the location data available (e.g. absolute position of building).
1946
+ */
1947
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
1948
+ }
1949
+ import * as WEBIFC from "web-ifc";
1950
+ import { FragmentsGroup } from "@thatopen/fragments";
1951
+ import { Disposable, Event, Component, Components } from "../../core";
1952
+ import { RelationsMap, ModelsRelationMap, InverseAttribute, IfcRelation } from "./src";
1953
+ /**
1954
+ * Indexer component for IFC entities, facilitating the indexing and retrieval of IFC entity relationships. It is designed to process models properties by indexing their IFC entities' relations based on predefined inverse attributes, and provides methods to query these relations. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcRelationsIndexer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcRelationsIndexer).
1955
+ */
1956
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
1957
+ /**
1958
+ * A unique identifier for the component.
1959
+ * This UUID is used to register the component within the Components system.
1960
+ */
1961
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
1962
+ /** {@link Disposable.onDisposed} */
1963
+ readonly onDisposed: Event<string>;
1964
+ /**
1827
1965
  * Event triggered when relations for a model have been indexed.
1828
1966
  * This event provides the model's UUID and the relations map generated for that model.
1829
1967
  *
@@ -2013,30 +2151,54 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
2013
2151
  getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
2014
2152
  }
2015
2153
  import * as WEBIFC from "web-ifc";
2016
- import * as FRAG from "@thatopen/fragments";
2017
- import { Component, Components } from "../../core";
2154
+ export interface IfcItemsCategories {
2155
+ [itemID: number]: number;
2156
+ }
2157
+ export declare class IfcCategories {
2158
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2159
+ }
2018
2160
  /**
2019
- * Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
2161
+ * 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.
2162
+ *
2163
+ * @remarks
2164
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2165
+ * It is useful for identifying and processing different types of IFC elements in a project.
2166
+ *
2020
2167
  */
2021
- export declare class IfcJsonExporter extends Component {
2022
- /**
2023
- * A unique identifier for the component.
2024
- * This UUID is used to register the component within the Components system.
2025
- */
2026
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
2027
- /** {@link Component.enabled} */
2028
- enabled: boolean;
2029
- constructor(components: Components);
2030
- /**
2031
- * Exports all the properties of an IFC into an array of JS objects.
2032
- * @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
2033
- * @param modelID ID of the IFC model whose properties to extract.
2034
- * @param indirect whether to get the indirect relationships as well.
2035
- * @param recursiveSpatial whether to get the properties of spatial items recursively
2036
- * to make the location data available (e.g. absolute position of building).
2037
- */
2038
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
2168
+ export declare const IfcElements: {
2169
+ [key: number]: string;
2170
+ };
2171
+ import * as FRAGS from "@thatopen/fragments";
2172
+ export declare class IfcPropertiesUtils {
2173
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2174
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2175
+ [attribute: string]: any;
2176
+ } | null>;
2177
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2178
+ [relatingID: number]: number[];
2179
+ }>;
2180
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2181
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2182
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2183
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2184
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2185
+ key: string | null;
2186
+ name: string | null;
2187
+ }>;
2188
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2189
+ key: string | null;
2190
+ value: number | null;
2191
+ }>;
2192
+ static isRel(expressID: number): boolean;
2193
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2194
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2039
2195
  }
2196
+ /**
2197
+ * 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.
2198
+ */
2199
+ export declare const IfcCategoryMap: {
2200
+ [key: number]: string;
2201
+ };
2040
2202
  import * as WEBIFC from "web-ifc";
2041
2203
  import { FragmentsGroup } from "@thatopen/fragments";
2042
2204
  import { Component, Disposable, Event, Components } from "../../core";
@@ -2321,1099 +2483,1089 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
2321
2483
  private registerChange;
2322
2484
  private newSingleProperty;
2323
2485
  }
2324
- import { XMLParser } from "fast-xml-parser";
2325
- import { Component, Configurable, Disposable, Event, World, DataMap } from "../../core/Types";
2326
- import { BCFTopic, BCFTopicsConfig, Topic } from "./src";
2327
- import { Viewpoint } from "../../core/Viewpoints";
2328
2486
  /**
2329
- * BCFTopics manages Building Collaboration Format (BCF) data the engine.
2330
- * It provides functionality for importing, exporting, and manipulating BCF data.
2487
+ * A Set of unique numbers representing different types of IFC geometries.
2331
2488
  */
2332
- export declare class BCFTopics extends Component implements Disposable, Configurable<BCFTopicsConfig> {
2333
- static uuid: "de977976-e4f6-4e4f-a01a-204727839802";
2334
- enabled: boolean;
2335
- static xmlParser: XMLParser;
2336
- config: Required<BCFTopicsConfig>;
2337
- readonly list: DataMap<string, Topic>;
2338
- readonly onSetup: Event<unknown>;
2339
- isSetup: boolean;
2340
- setup(config?: Partial<BCFTopicsConfig>): void;
2341
- readonly onBCFImported: Event<Topic[]>;
2489
+ export declare const GeometryTypes: Set<number>;
2490
+ /**
2491
+ * 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.
2492
+ */
2493
+ export declare class Event<T> {
2342
2494
  /**
2343
- * Creates a new BCFTopic instance and adds it to the list.
2344
- *
2345
- * @param data - Optional partial BCFTopic object to initialize the new topic with.
2346
- * If not provided, default values will be used.
2347
- * @returns The newly created BCFTopic instance.
2495
+ * Add a callback to this event instance.
2496
+ * @param handler - the callback to be added to this event.
2348
2497
  */
2349
- create(data?: Partial<BCFTopic>): Topic;
2350
- readonly onDisposed: Event<unknown>;
2498
+ add(handler: T extends void ? {
2499
+ (): void;
2500
+ } : {
2501
+ (data: T): void;
2502
+ }): void;
2351
2503
  /**
2352
- * Disposes of the BCFTopics component and triggers the onDisposed event.
2353
- *
2354
- * @remarks
2355
- * This method clears the list of topics and triggers the onDisposed event.
2356
- * It also resets the onDisposed event listener.
2504
+ * Removes a callback from this event instance.
2505
+ * @param handler - the callback to be removed from this event.
2357
2506
  */
2358
- dispose(): void;
2507
+ remove(handler: T extends void ? {
2508
+ (): void;
2509
+ } : {
2510
+ (data: T): void;
2511
+ }): void;
2512
+ /** Triggers all the callbacks assigned to this event. */
2513
+ trigger: (data?: T) => void;
2514
+ /** Gets rid of all the suscribed events. */
2515
+ reset(): void;
2516
+ private handlers;
2517
+ }
2518
+ /**
2519
+ * 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.
2520
+ */
2521
+ export declare class AsyncEvent<T> {
2359
2522
  /**
2360
- * Retrieves the unique set of topic types used across all topics.
2361
- *
2362
- * @returns A Set containing the unique topic types.
2523
+ * Add a callback to this event instance.
2524
+ * @param handler - the callback to be added to this event.
2363
2525
  */
2364
- get usedTypes(): Set<string>;
2526
+ add(handler: T extends void ? {
2527
+ (): Promise<void>;
2528
+ } : {
2529
+ (data: T): Promise<void>;
2530
+ }): void;
2365
2531
  /**
2366
- * Retrieves the unique set of topic statuses used across all topics.
2367
- *
2368
- * @returns A Set containing the unique topic statuses.
2532
+ * Removes a callback from this event instance.
2533
+ * @param handler - the callback to be removed from this event.
2369
2534
  */
2370
- get usedStatuses(): Set<string>;
2535
+ remove(handler: T extends void ? {
2536
+ (): Promise<void>;
2537
+ } : {
2538
+ (data: T): Promise<void>;
2539
+ }): void;
2540
+ /** Triggers all the callbacks assigned to this event. */
2541
+ trigger: (data?: T) => Promise<void>;
2542
+ /** Gets rid of all the suscribed events. */
2543
+ reset(): void;
2544
+ private handlers;
2545
+ }
2546
+ import { Base } from "./base";
2547
+ /**
2548
+ * 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.
2549
+ */
2550
+ export declare abstract class Component extends Base {
2371
2551
  /**
2372
- * Retrieves the unique set of topic priorities used across all topics.
2373
- *
2374
- * @returns A Set containing the unique topic priorities.
2375
- * Note: This method filters out any null or undefined priorities.
2552
+ * Whether this component is active or not. The behaviour can vary depending
2553
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2554
+ * dimensions, while a disabled camera will stop moving. A disabled component
2555
+ * will not be updated automatically each frame.
2376
2556
  */
2377
- get usedPriorities(): Set<string | undefined>;
2557
+ abstract enabled: boolean;
2558
+ }
2559
+ import * as THREE from "three";
2560
+ import CameraControls from "camera-controls";
2561
+ import { Event } from "./event";
2562
+ /**
2563
+ * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
2564
+ */
2565
+ export interface Disposable {
2378
2566
  /**
2379
- * Retrieves the unique set of topic stages used across all topics.
2380
- *
2381
- * @returns A Set containing the unique topic stages.
2382
- * Note: This method filters out any null or undefined stages.
2567
+ * Destroys the object from memory to prevent a
2568
+ * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
2383
2569
  */
2384
- get usedStages(): Set<string | undefined>;
2570
+ dispose: () => void | Promise<void>;
2571
+ /** Fired after the tool has been disposed. */
2572
+ readonly onDisposed: Event<any>;
2573
+ }
2574
+ /**
2575
+ * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2576
+ */
2577
+ export interface Hideable {
2385
2578
  /**
2386
- * Retrieves the unique set of users associated with topics.
2387
- *
2388
- * @returns A Set containing the unique users.
2389
- * Note: This method collects users from the creation author, assigned to, modified author, and comment authors.
2579
+ * Whether the geometric representation of this component is
2580
+ * currently visible or not in the
2581
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
2390
2582
  */
2391
- get usedUsers(): Set<string>;
2583
+ visible: boolean;
2584
+ }
2585
+ /**
2586
+ * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
2587
+ */
2588
+ export interface Resizeable {
2392
2589
  /**
2393
- * Retrieves the unique set of labels used across all topics.
2394
- *
2395
- * @returns A Set containing the unique labels.
2590
+ * Sets size of this component (e.g. the resolution of a
2591
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2592
+ * component.
2396
2593
  */
2397
- get usedLabels(): Set<string>;
2594
+ resize: (size?: THREE.Vector2) => void;
2595
+ /** Event that fires when the component has been resized. */
2596
+ onResize: Event<THREE.Vector2>;
2398
2597
  /**
2399
- * Updates the set of extensions (types, statuses, priorities, labels, stages, users) based on the current topics.
2400
- * This method iterates through each topic in the list and adds its properties to the corresponding sets in the config.
2598
+ * Gets the current size of this component (e.g. the resolution of a
2599
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
2600
+ * component.
2401
2601
  */
2402
- updateExtensions(): void;
2602
+ getSize: () => THREE.Vector2;
2603
+ }
2604
+ /** Whether this component should be updated each frame. */
2605
+ export interface Updateable {
2606
+ /** Actions that should be executed after updating the component. */
2607
+ onAfterUpdate: Event<any>;
2608
+ /** Actions that should be executed before updating the component. */
2609
+ onBeforeUpdate: Event<any>;
2403
2610
  /**
2404
- * Updates the references to viewpoints in the topics.
2405
- * This function iterates through each topic and checks if the viewpoints exist in the viewpoints list.
2406
- * If a viewpoint does not exist, it is removed from the topic's viewpoints.
2611
+ * Function used to update the state of this component each frame. For
2612
+ * instance, a renderer component will make a render each frame.
2407
2613
  */
2408
- updateViewpointReferences(): void;
2614
+ update(delta?: number): void;
2615
+ }
2616
+ /** Basic type to describe the progress of any kind of process. */
2617
+ export interface Progress {
2618
+ /** The amount of things that have been done already. */
2619
+ current: number;
2620
+ /** The total amount of things to be done by the process. */
2621
+ total: number;
2622
+ }
2623
+ /**
2624
+ * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
2625
+ */
2626
+ export interface Createable {
2627
+ /** Creates a new instance of an element (e.g. a new Dimension). */
2628
+ create: (data: any) => void;
2409
2629
  /**
2410
- * Exports the given topics to a BCF (Building Collaboration Format) zip file.
2411
- *
2412
- * @param topics - The topics to export. Defaults to all topics in the list.
2413
- * @returns A promise that resolves to a Blob containing the exported BCF zip file.
2630
+ * Finish the creation process of the component, successfully creating an
2631
+ * instance of whatever the component creates.
2414
2632
  */
2415
- export(topics?: Iterable<Topic>): Promise<Blob>;
2416
- private serializeExtensions;
2417
- private processMarkupComment;
2418
- private getMarkupComments;
2419
- private getMarkupLabels;
2420
- private getMarkupViewpoints;
2421
- private getMarkupRelatedTopics;
2633
+ endCreation?: (data: any) => void;
2422
2634
  /**
2423
- * Loads BCF (Building Collaboration Format) data into the engine.
2424
- *
2425
- * @param world - The default world where the viewpoints are going to be created.
2426
- * @param data - The BCF data to load.
2427
- *
2428
- * @returns A promise that resolves to an object containing the created viewpoints and topics.
2429
- *
2430
- * @throws An error if the BCF version is not supported.
2635
+ * Cancels the creation process of the component, going back to the state
2636
+ * before starting to create.
2431
2637
  */
2432
- load(data: Uint8Array, world: World): Promise<{
2433
- viewpoints: Viewpoint[];
2434
- topics: Topic[];
2435
- }>;
2638
+ cancelCreation?: (data: any) => void;
2639
+ /** Deletes an existing instance of an element (e.g. a Dimension). */
2640
+ delete: (data: any) => void;
2436
2641
  }
2437
- import * as THREE from "three";
2438
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2439
2642
  /**
2440
- * A class representing a 2D minimap of a 3D world.
2643
+ * Whether this component supports to be configured.
2441
2644
  */
2442
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
2443
- /** {@link Disposable.onDisposed} */
2444
- readonly onDisposed: Event<unknown>;
2445
- /** {@link Updateable.onAfterUpdate} */
2446
- readonly onAfterUpdate: Event<unknown>;
2447
- /** {@link Updateable.onBeforeUpdate} */
2448
- readonly onBeforeUpdate: Event<unknown>;
2449
- /** {@link Resizeable.onResize} */
2450
- readonly onResize: Event<THREE.Vector2>;
2451
- /**
2452
- * The front offset of the minimap.
2453
- * It determines how much the minimap's view is offset from the camera's view.
2454
- * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
2455
- */
2456
- frontOffset: number;
2457
- /**
2458
- * The override material for the minimap.
2459
- * It is used to render the depth information of the world onto the minimap.
2645
+ export interface Configurable<T extends Record<string, any>> {
2646
+ /** Wether this components has been already configured. */
2647
+ isSetup: boolean;
2648
+ /** Use the provided configuration to setup the tool. */
2649
+ setup: (config?: Partial<T>) => void | Promise<void>;
2650
+ /** Fired after successfully calling {@link Configurable.setup()} */
2651
+ readonly onSetup: Event<any>;
2652
+ /** Object holding the tool configuration. Is not meant to be edited directly, if you need
2653
+ * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
2460
2654
  */
2461
- overrideMaterial: THREE.MeshDepthMaterial;
2655
+ config: Required<T>;
2656
+ }
2657
+ /**
2658
+ * Whether a camera uses the Camera Controls library.
2659
+ */
2660
+ export interface CameraControllable {
2462
2661
  /**
2463
- * The background color of the minimap.
2464
- * It is used to set the background color of the minimap's renderer.
2662
+ * An instance of CameraControls that provides camera control functionalities.
2663
+ * This instance is used to manipulate the camera.
2465
2664
  */
2466
- backgroundColor: THREE.Color;
2665
+ controls: CameraControls;
2666
+ }
2667
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2668
+ import { Components } from "../../Components";
2669
+ /**
2670
+ * Base class of the library. Useful for finding out the interfaces something implements.
2671
+ */
2672
+ export declare abstract class Base {
2673
+ components: Components;
2674
+ constructor(components: Components);
2675
+ /** Whether is component is {@link Disposable}. */
2676
+ isDisposeable: () => this is Disposable;
2677
+ /** Whether is component is {@link Resizeable}. */
2678
+ isResizeable: () => this is Resizeable;
2679
+ /** Whether is component is {@link Updateable}. */
2680
+ isUpdateable: () => this is Updateable;
2681
+ /** Whether is component is {@link Hideable}. */
2682
+ isHideable: () => this is Hideable;
2683
+ /** Whether is component is {@link Configurable}. */
2684
+ isConfigurable: () => this is Configurable<any>;
2685
+ }
2686
+ import { Base } from "./base";
2687
+ import { World } from "./world";
2688
+ import { Event } from "./event";
2689
+ import { Components } from "../../Components";
2690
+ /**
2691
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2692
+ */
2693
+ export declare abstract class BaseWorldItem extends Base {
2694
+ readonly worlds: Map<string, World>;
2467
2695
  /**
2468
- * The WebGL renderer for the minimap.
2469
- * It is used to render the minimap onto the screen.
2696
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2697
+ * The event payload contains the world instance and the action ("added" or "removed").
2470
2698
  */
2471
- renderer: THREE.WebGLRenderer;
2699
+ readonly onWorldChanged: Event<{
2700
+ world: World;
2701
+ action: "added" | "removed";
2702
+ }>;
2472
2703
  /**
2473
- * A flag indicating whether the minimap is enabled.
2474
- * If disabled, the minimap will not update or render.
2704
+ * The current world this item is associated with. It can be null if no world is currently active.
2475
2705
  */
2476
- enabled: boolean;
2477
- /**
2478
- * The world in which the minimap is displayed.
2479
- * It provides access to the 3D scene, camera, and other relevant world elements.
2480
- */
2481
- world: World;
2482
- private _lockRotation;
2483
- private _camera;
2484
- private _plane;
2485
- private _size;
2486
- private _tempVector1;
2487
- private _tempVector2;
2488
- private _tempTarget;
2489
- private readonly down;
2706
+ currentWorld: World | null;
2707
+ protected constructor(components: Components);
2708
+ }
2709
+ import * as THREE from "three";
2710
+ import CameraControls from "camera-controls";
2711
+ import { BaseWorldItem } from "./base-world-item";
2712
+ import { CameraControllable } from "./interfaces";
2713
+ /**
2714
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2715
+ */
2716
+ export declare abstract class BaseCamera extends BaseWorldItem {
2490
2717
  /**
2491
- * Gets or sets whether the minimap rotation is locked.
2492
- * When rotation is locked, the minimap will always face the same direction as the camera.
2718
+ * Whether the camera is enabled or not.
2493
2719
  */
2494
- get lockRotation(): boolean;
2720
+ abstract enabled: boolean;
2495
2721
  /**
2496
- * Sets whether the minimap rotation is locked.
2497
- * When rotation is locked, the minimap will always face the same direction as the camera.
2498
- * @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
2722
+ * The Three.js camera instance.
2499
2723
  */
2500
- set lockRotation(active: boolean);
2724
+ abstract three: THREE.Camera;
2501
2725
  /**
2502
- * Gets the current zoom level of the minimap.
2503
- * The zoom level determines how much of the world is visible on the minimap.
2504
- * @returns The current zoom level of the minimap.
2726
+ * Optional CameraControls instance for controlling the camera.
2727
+ * This property is only available if the camera is controllable.
2505
2728
  */
2506
- get zoom(): number;
2729
+ abstract controls?: CameraControls;
2507
2730
  /**
2508
- * Sets the zoom level of the minimap.
2509
- * The zoom level determines how much of the world is visible on the minimap.
2510
- * @param value - The new zoom level of the minimap.
2731
+ * Checks whether the instance is {@link CameraControllable}.
2732
+ *
2733
+ * @returns True if the instance is controllable, false otherwise.
2511
2734
  */
2512
- set zoom(value: number);
2513
- constructor(world: World);
2514
- /** {@link Disposable.dispose} */
2515
- dispose(): void;
2516
- /** Returns the camera used by the MiniMap */
2517
- get(): THREE.OrthographicCamera;
2518
- /** {@link Updateable.update} */
2519
- update(): void;
2520
- /** {@link Resizeable.getSize} */
2521
- getSize(): THREE.Vector2;
2522
- /** {@link Resizeable.resize} */
2523
- resize(size?: THREE.Vector2): void;
2524
- private updatePlanes;
2525
- }
2526
- import * as WEBIFC from "web-ifc";
2527
- export interface IfcItemsCategories {
2528
- [itemID: number]: number;
2529
- }
2530
- export declare class IfcCategories {
2531
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2532
- }
2533
- /**
2534
- * 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.
2535
- *
2536
- * @remarks
2537
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2538
- * It is useful for identifying and processing different types of IFC elements in a project.
2539
- *
2540
- */
2541
- export declare const IfcElements: {
2542
- [key: number]: string;
2543
- };
2544
- import * as FRAGS from "@thatopen/fragments";
2545
- export declare class IfcPropertiesUtils {
2546
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2547
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2548
- [attribute: string]: any;
2549
- } | null>;
2550
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2551
- [relatingID: number]: number[];
2552
- }>;
2553
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2554
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2555
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2556
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2557
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2558
- key: string | null;
2559
- name: string | null;
2560
- }>;
2561
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2562
- key: string | null;
2563
- value: number | null;
2564
- }>;
2565
- static isRel(expressID: number): boolean;
2566
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2567
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2568
- }
2569
- /**
2570
- * 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.
2571
- */
2572
- export declare const IfcCategoryMap: {
2573
- [key: number]: string;
2574
- };
2575
- import * as WEBIFC from "web-ifc";
2576
- import { IfcItemsCategories } from "../../../ifc";
2577
- export declare class SpatialStructure {
2578
- itemsByFloor: IfcItemsCategories;
2579
- private _units;
2580
- setUp(webIfc: WEBIFC.IfcAPI): void;
2581
- cleanUp(): void;
2582
- }
2583
- import * as FRAGS from "@thatopen/fragments";
2584
- import * as WEBIFC from "web-ifc";
2585
- export declare class SpatialIdsFinder {
2586
- static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
2735
+ hasCameraControls: () => this is CameraControllable;
2587
2736
  }
2737
+ import * as THREE from "three";
2738
+ import { Vector2 } from "three";
2739
+ import { Event } from "./event";
2740
+ import { BaseWorldItem } from "./base-world-item";
2741
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
2588
2742
  /**
2589
- * A Set of unique numbers representing different types of IFC geometries.
2743
+ * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
2590
2744
  */
2591
- export declare const GeometryTypes: Set<number>;
2592
- import * as WEBIFC from "web-ifc";
2593
- /** Configuration of the IFC-fragment conversion. */
2594
- export declare class IfcFragmentSettings {
2595
- /** Whether to extract the IFC properties into a JSON. */
2596
- includeProperties: boolean;
2597
- /**
2598
- * Generate the geometry for categories that are not included by default,
2599
- * like IFCSPACE.
2600
- */
2601
- optionalCategories: number[];
2602
- /** Whether to use the coordination data coming from the IFC files. */
2603
- coordinate: boolean;
2604
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2605
- wasm: {
2606
- path: string;
2607
- absolute: boolean;
2608
- logLevel?: WEBIFC.LogLevel;
2609
- };
2610
- /** List of categories that won't be converted to fragments. */
2611
- excludedCategories: Set<number>;
2612
- /** Exclusive list of categories that will be converted to fragments. If this contains any category, any other categories will be ignored. */
2613
- includedCategories: Set<number>;
2614
- /** Whether to save the absolute location of all IFC items. */
2615
- saveLocations: boolean;
2616
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2617
- webIfc: WEBIFC.LoaderSettings;
2618
- /**
2619
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2620
- * If set to true, the path will be set to the default path of the WASM file.
2621
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2622
- * Default value is true.
2623
- */
2624
- autoSetWasm: boolean;
2745
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
2625
2746
  /**
2626
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2627
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2628
- * If set to null, the default file location handler will be used.
2747
+ * The three.js WebGLRenderer instance associated with this renderer.
2629
2748
  *
2630
- * @param url - The URL of the file to locate.
2631
- * @returns The absolute path of the file.
2749
+ * @abstract
2750
+ * @type {THREE.WebGLRenderer}
2632
2751
  */
2633
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2634
- }
2635
- import { Topic } from "..";
2636
- import { Viewpoint } from "../../../core/Viewpoints";
2637
- import { Components } from "../../../core/Components";
2638
- /**
2639
- * Represents a comment in a BCF Topic.
2640
- */
2641
- export declare class Comment {
2642
- date: Date;
2643
- author: string;
2644
- guid: string;
2645
- viewpoint?: Viewpoint;
2646
- modifiedAuthor?: string;
2647
- modifiedDate?: Date;
2648
- topic?: Topic;
2649
- private _components;
2650
- private _comment;
2752
+ abstract three: THREE.WebGLRenderer;
2753
+ /** {@link Updateable.onBeforeUpdate} */
2754
+ onAfterUpdate: Event<unknown>;
2755
+ /** {@link Updateable.onAfterUpdate} */
2756
+ onBeforeUpdate: Event<unknown>;
2757
+ /** {@link Disposable.onDisposed} */
2758
+ readonly onDisposed: Event<undefined>;
2759
+ /** {@link Resizeable.onResize} */
2760
+ readonly onResize: Event<THREE.Vector2>;
2651
2761
  /**
2652
- * Sets the comment text and updates the modified date and author.
2653
- * The author will be the one defined in BCFTopics.config.author
2654
- * @param value - The new comment text.
2762
+ * Event that fires when there has been a change to the list of clipping
2763
+ * planes used by the active renderer.
2655
2764
  */
2656
- set comment(value: string);
2765
+ readonly onClippingPlanesUpdated: Event<unknown>;
2766
+ /** {@link Updateable.update} */
2767
+ abstract update(delta?: number): void | Promise<void>;
2768
+ /** {@link Disposable.dispose} */
2769
+ abstract dispose(): void;
2770
+ /** {@link Resizeable.getSize} */
2771
+ abstract getSize(): Vector2;
2772
+ /** {@link Resizeable.resize} */
2773
+ abstract resize(size: Vector2 | undefined): void;
2657
2774
  /**
2658
- * Gets the comment text.
2659
- * @returns The comment text.
2775
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
2660
2776
  */
2661
- get comment(): string;
2777
+ clippingPlanes: THREE.Plane[];
2662
2778
  /**
2663
- * Constructs a new BCF Topic Comment instance.
2664
- * @param components - The Components instance.
2665
- * @param text - The initial comment text.
2779
+ * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
2780
+ *
2781
+ * @remarks
2782
+ * This method is typically called when there is a change to the list of clipping planes
2783
+ * used by the active renderer.
2666
2784
  */
2667
- constructor(components: Components, text: string);
2785
+ updateClippingPlanes(): void;
2668
2786
  /**
2669
- * Serializes the Comment instance into a BCF compliant XML string.
2787
+ * Sets or removes a clipping plane from the renderer.
2670
2788
  *
2671
- * @returns A string representing the Comment in BCFv2 XML format.
2789
+ * @param active - A boolean indicating whether the clipping plane should be active or not.
2790
+ * @param plane - The clipping plane to be added or removed.
2791
+ * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
2792
+ *
2793
+ * @remarks
2794
+ * This method adds or removes a clipping plane from the 'clippingPlanes' array.
2795
+ * If 'active' is 'true' and the plane is not already in the array, it is added.
2796
+ * If 'active' is 'false' and the plane is in the array, it is removed.
2797
+ * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
2798
+ * excluding any planes marked as local.
2672
2799
  */
2673
- serialize(): string;
2800
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2674
2801
  }
2675
- import { InverseAttribute } from "./types";
2676
- export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585 | 982818633, {
2677
- forRelating: InverseAttribute;
2678
- forRelated: InverseAttribute;
2679
- }>;
2680
2802
  import * as THREE from "three";
2803
+ import { Disposable } from "./interfaces";
2804
+ import { Event } from "./event";
2681
2805
  import { Components } from "../../Components";
2682
- import { AsyncEvent, Event, World } from "../../Types";
2806
+ import { BaseWorldItem } from "./base-world-item";
2683
2807
  /**
2684
- * Settings to configure the CullerRenderer.
2808
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2685
2809
  */
2686
- export interface CullerRendererSettings {
2810
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2811
+ /** {@link Disposable.onDisposed} */
2812
+ readonly onDisposed: Event<unknown>;
2687
2813
  /**
2688
- * Interval in milliseconds at which the visibility check should be performed.
2689
- * Default value is 1000.
2814
+ * Abstract property representing the three.js object associated with this scene.
2815
+ * It should be implemented by subclasses.
2690
2816
  */
2691
- updateInterval?: number;
2817
+ abstract three: THREE.Object3D;
2818
+ /** The set of directional lights managed by this scene component. */
2819
+ directionalLights: Map<string, THREE.DirectionalLight>;
2820
+ /** The set of ambient lights managed by this scene component. */
2821
+ ambientLights: Map<string, THREE.AmbientLight>;
2822
+ protected constructor(components: Components);
2823
+ /** {@link Disposable.dispose} */
2824
+ dispose(): void;
2825
+ }
2826
+ import * as THREE from "three";
2827
+ import { BaseScene } from "./base-scene";
2828
+ import { BaseCamera } from "./base-camera";
2829
+ import { BaseRenderer } from "./base-renderer";
2830
+ import { Updateable, Disposable } from "./interfaces";
2831
+ /**
2832
+ * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
2833
+ */
2834
+ export interface World extends Disposable, Updateable {
2692
2835
  /**
2693
- * Width of the render target used for visibility checks.
2694
- * Default value is 512.
2836
+ * A set of meshes present in the world. This is taken into account for operations like raycasting.
2695
2837
  */
2696
- width?: number;
2838
+ meshes: Set<THREE.Mesh>;
2697
2839
  /**
2698
- * Height of the render target used for visibility checks.
2699
- * Default value is 512.
2840
+ * The base scene of the world.
2700
2841
  */
2701
- height?: number;
2842
+ scene: BaseScene;
2702
2843
  /**
2703
- * Whether the visibility check should be performed automatically.
2704
- * Default value is true.
2844
+ * The base camera of the world.
2705
2845
  */
2706
- autoUpdate?: boolean;
2846
+ camera: BaseCamera;
2847
+ /**
2848
+ * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
2849
+ */
2850
+ renderer: BaseRenderer | null;
2851
+ /**
2852
+ * A unique identifier for the world.
2853
+ */
2854
+ uuid: string;
2855
+ /**
2856
+ * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
2857
+ */
2858
+ isDisposing: boolean;
2707
2859
  }
2860
+ import { Event } from "./event";
2708
2861
  /**
2709
- * A base renderer to determine visibility on screen.
2862
+ * A class that extends the built-in Set class and provides additional functionality.
2863
+ * It triggers events when items are added, deleted, or the set is cleared.
2864
+ *
2865
+ * @template T - The type of elements in the set.
2710
2866
  */
2711
- export declare class CullerRenderer {
2712
- /** {@link Disposable.onDisposed} */
2713
- readonly onDisposed: Event<string>;
2867
+ export declare class DataSet<T> extends Set<T> {
2714
2868
  /**
2715
- * Fires after making the visibility check to the meshes. It lists the
2716
- * meshes that are currently visible, and the ones that were visible
2717
- * just before but not anymore.
2869
+ * An event that is triggered when a new item is added to the set.
2718
2870
  */
2719
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2871
+ readonly onItemAdded: Event<T>;
2720
2872
  /**
2721
- * Whether this renderer is active or not. If not, it won't render anything.
2873
+ * An event that is triggered when an item is deleted from the set.
2722
2874
  */
2723
- enabled: boolean;
2875
+ readonly onItemDeleted: Event<unknown>;
2724
2876
  /**
2725
- * Needs to check whether there are objects that need to be hidden or shown.
2726
- * You can bind this to the camera movement, to a certain interval, etc.
2877
+ * An event that is triggered when the set is cleared.
2727
2878
  */
2728
- needsUpdate: boolean;
2879
+ readonly onCleared: Event<unknown>;
2729
2880
  /**
2730
- * Render the internal scene used to determine the object visibility. Used
2731
- * for debugging purposes.
2881
+ * Constructs a new instance of the DataSet class.
2882
+ *
2883
+ * @param iterable - An optional iterable object to initialize the set with.
2732
2884
  */
2733
- renderDebugFrame: boolean;
2734
- /** The components instance to which this renderer belongs. */
2735
- components: Components;
2736
- /** The world instance to which this renderer belongs. */
2737
- readonly world: World;
2738
- /** The THREE.js renderer used to make the visibility test. */
2739
- readonly renderer: THREE.WebGLRenderer;
2740
- protected autoUpdate: boolean;
2741
- protected updateInterval: number;
2742
- protected readonly worker: Worker;
2743
- protected readonly scene: THREE.Scene;
2744
- private _width;
2745
- private _height;
2746
- private _availableColor;
2747
- private readonly renderTarget;
2748
- private readonly bufferSize;
2749
- private readonly _buffer;
2750
- protected _isWorkerBusy: boolean;
2751
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2752
- /** {@link Disposable.dispose} */
2753
- dispose(): void;
2885
+ constructor(iterable?: Iterable<T> | null);
2754
2886
  /**
2755
- * The function that the culler uses to reprocess the scene. Generally it's
2756
- * better to call needsUpdate, but you can also call this to force it.
2757
- * @param force if true, it will refresh the scene even if needsUpdate is
2758
- * not true.
2887
+ * Clears the set and triggers the onCleared event.
2759
2888
  */
2760
- updateVisibility: (force?: boolean) => Promise<void>;
2761
- protected getAvailableColor(): {
2762
- r: number;
2763
- g: number;
2764
- b: number;
2765
- code: string;
2766
- };
2767
- protected increaseColor(): void;
2768
- protected decreaseColor(): void;
2769
- private applySettings;
2889
+ clear(): void;
2890
+ /**
2891
+ * Adds one or multiple values to the set and triggers the onItemAdded event per each.
2892
+ *
2893
+ * @param value - The value to add to the set.
2894
+ * @returns - The set instance.
2895
+ */
2896
+ add(...value: T[]): this;
2897
+ /**
2898
+ * A function that acts as a guard for adding items to the set.
2899
+ * It determines whether a given value should be allowed to be added to the set.
2900
+ *
2901
+ * @param value - The value to be checked against the guard.
2902
+ * @returns A boolean indicating whether the value should be allowed to be added to the set.
2903
+ * By default, this function always returns true, allowing all values to be added.
2904
+ * You can override this behavior by providing a custom implementation.
2905
+ */
2906
+ guard: (value: T) => boolean;
2907
+ /**
2908
+ * Deletes a value from the set and triggers the onItemDeleted event.
2909
+ *
2910
+ * @param value - The value to delete from the set.
2911
+ * @returns - True if the value was successfully deleted, false otherwise.
2912
+ */
2913
+ delete(value: T): boolean;
2914
+ /**
2915
+ * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
2916
+ */
2917
+ dispose(): void;
2770
2918
  }
2771
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2772
- import * as THREE from "three";
2773
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2774
- import { Components } from "../../Components";
2775
- import { Event, World, Disposable } from "../../Types";
2919
+ import { Event } from "./event";
2776
2920
  /**
2777
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2921
+ * A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
2922
+ *
2923
+ * @template K - The type of keys in the map.
2924
+ * @template V - The type of values in the map.
2778
2925
  */
2779
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2926
+ export declare class DataMap<K, V> extends Map<K, V> {
2780
2927
  /**
2781
- * Event triggered when the visibility of meshes is updated.
2782
- * Contains two sets: seen and unseen.
2928
+ * An event triggered when a new item is set in the map.
2783
2929
  */
2784
- readonly onViewUpdated: Event<{
2785
- seen: Set<THREE.Mesh>;
2786
- unseen: Set<THREE.Mesh>;
2930
+ readonly onItemSet: Event<{
2931
+ key: K;
2932
+ value: V;
2787
2933
  }>;
2788
2934
  /**
2789
- * Pixels in screen a geometry must occupy to be considered "seen".
2790
- * Default value is 100.
2935
+ * An event triggered when an existing item in the map is updated.
2791
2936
  */
2792
- threshold: number;
2937
+ readonly onItemUpdated: Event<{
2938
+ key: K;
2939
+ value: V;
2940
+ }>;
2793
2941
  /**
2794
- * Map of color code to THREE.InstancedMesh.
2795
- * Used to keep track of color-coded meshes.
2942
+ * An event triggered when an item is deleted from the map.
2796
2943
  */
2797
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2944
+ readonly onItemDeleted: Event<K>;
2798
2945
  /**
2799
- * Flag to indicate if the renderer is currently processing.
2800
- * Used to prevent concurrent processing.
2946
+ * An event triggered when the map is cleared.
2801
2947
  */
2802
- isProcessing: boolean;
2803
- private _interval;
2804
- private _colorCodeMeshMap;
2805
- private _meshIDColorCodeMap;
2806
- private _currentVisibleMeshes;
2807
- private _recentlyHiddenMeshes;
2808
- private _intervalID;
2809
- private readonly _transparentMat;
2810
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2811
- /** {@link Disposable.dispose} */
2812
- dispose(): void;
2948
+ readonly onCleared: Event<unknown>;
2813
2949
  /**
2814
- * 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.
2815
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2816
- * @returns {void}
2950
+ * Constructs a new DataMap instance.
2951
+ *
2952
+ * @param iterable - An iterable object containing key-value pairs to populate the map.
2817
2953
  */
2818
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2954
+ constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
2819
2955
  /**
2820
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2821
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2822
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2823
- * @returns {void}
2956
+ * Clears the map and triggers the onCleared event.
2824
2957
  */
2825
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2958
+ clear(): void;
2826
2959
  /**
2827
- * 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.
2960
+ * Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
2828
2961
  *
2829
- * @param meshes - The meshes to update.
2962
+ * @param key - The key of the item to set.
2963
+ * @param value - The value of the item to set.
2964
+ * @returns The DataMap instance.
2965
+ */
2966
+ set(key: K, value: V): this;
2967
+ /**
2968
+ * A function that acts as a guard for adding items to the set.
2969
+ * It determines whether a given value should be allowed to be added to the set.
2830
2970
  *
2831
- * @returns {void}
2971
+ * @param key - The key of the entry to be checked against the guard.
2972
+ * @param value - The value of the entry to be checked against the guard.
2973
+ * @returns A boolean indicating whether the value should be allowed to be added to the set.
2974
+ * By default, this function always returns true, allowing all values to be added.
2975
+ * You can override this behavior by providing a custom implementation.
2832
2976
  */
2833
- updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
2834
- private handleWorkerMessage;
2835
- private getAvailableMaterial;
2977
+ guard: (key: K, value: V) => boolean;
2978
+ /**
2979
+ * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
2980
+ *
2981
+ * @param key - The key of the item to delete.
2982
+ * @returns True if the key was found and deleted; otherwise, false.
2983
+ */
2984
+ delete(key: K): boolean;
2985
+ /**
2986
+ * Clears the map and resets the events.
2987
+ */
2988
+ dispose(): void;
2836
2989
  }
2837
- import { SimplePlane } from "../../Clipper";
2838
- import { DataSet } from "../../Types";
2839
- export interface ViewpointCamera {
2840
- direction: {
2841
- x: number;
2842
- y: number;
2843
- z: number;
2844
- };
2845
- position: {
2846
- x: number;
2847
- y: number;
2848
- z: number;
2849
- };
2850
- aspectRatio: number;
2851
- }
2852
- export interface ViewpointPerspectiveCamera extends ViewpointCamera {
2853
- fov: number;
2854
- }
2855
- export interface ViewpointOrthographicCamera extends ViewpointCamera {
2856
- viewToWorldScale: number;
2857
- }
2858
- /**
2859
- * Represents a viewpoint in a BCF file.
2860
- */
2861
- export interface BCFViewpoint {
2862
- title?: string;
2863
- guid: string;
2864
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
2865
- selectionComponents: Iterable<string>;
2866
- exceptionComponents: Iterable<string>;
2867
- clippingPlanes: DataSet<SimplePlane>;
2868
- spacesVisible: boolean;
2869
- spaceBoundariesVisible: boolean;
2870
- openingsVisible: boolean;
2871
- defaultVisibility: boolean;
2990
+ import * as WEBIFC from "web-ifc";
2991
+ import { IfcItemsCategories } from "../../../ifc";
2992
+ export declare class SpatialStructure {
2993
+ itemsByFloor: IfcItemsCategories;
2994
+ private _units;
2995
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2996
+ cleanUp(): void;
2872
2997
  }
2873
2998
  import * as THREE from "three";
2874
- import * as FRAGS from "@thatopen/fragments";
2875
- import { BCFViewpoint, ViewpointOrthographicCamera, ViewpointPerspectiveCamera } from "./types";
2876
- import { CameraProjection } from "../../OrthoPerspectiveCamera";
2877
- import { Components } from "../../Components";
2878
- import { DataMap, DataSet, World } from "../../Types";
2879
- import { SimplePlane } from "../../Clipper";
2999
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
2880
3000
  /**
2881
- * Represents a BCF compliant viewpoint from BuildingSMART.
2882
- *
2883
- * The Viewpoint class provides methods for managing and interacting with viewpoints.
2884
- * It includes functionality for setting viewpoint properties, updating the camera,
2885
- * applying color to components, and serializing the viewpoint for export.
3001
+ * A class representing a 2D minimap of a 3D world.
2886
3002
  */
2887
- export declare class Viewpoint implements BCFViewpoint {
2888
- title?: string;
2889
- readonly guid: string;
3003
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
3004
+ /** {@link Disposable.onDisposed} */
3005
+ readonly onDisposed: Event<unknown>;
3006
+ /** {@link Updateable.onAfterUpdate} */
3007
+ readonly onAfterUpdate: Event<unknown>;
3008
+ /** {@link Updateable.onBeforeUpdate} */
3009
+ readonly onBeforeUpdate: Event<unknown>;
3010
+ /** {@link Resizeable.onResize} */
3011
+ readonly onResize: Event<THREE.Vector2>;
2890
3012
  /**
2891
- * ClippingPlanes can be used to define a subsection of a building model that is related to the topic.
2892
- * Each clipping plane is defined by Location and Direction.
2893
- * The Direction vector points in the invisible direction meaning the half-space that is clipped.
2894
- * @experimental
3013
+ * The front offset of the minimap.
3014
+ * It determines how much the minimap's view is offset from the camera's view.
3015
+ * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
2895
3016
  */
2896
- clippingPlanes: DataSet<SimplePlane>;
2897
- camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3017
+ frontOffset: number;
2898
3018
  /**
2899
- * A list of components GUIDs to hide when defaultVisibility = true or to show when defaultVisibility = false
3019
+ * The override material for the minimap.
3020
+ * It is used to render the depth information of the world onto the minimap.
2900
3021
  */
2901
- readonly exceptionComponents: DataSet<string>;
3022
+ overrideMaterial: THREE.MeshDepthMaterial;
2902
3023
  /**
2903
- * A list of components GUIDs that should be selected (highlighted) when displaying a viewpoint.
3024
+ * The background color of the minimap.
3025
+ * It is used to set the background color of the minimap's renderer.
2904
3026
  */
2905
- readonly selectionComponents: DataSet<string>;
3027
+ backgroundColor: THREE.Color;
2906
3028
  /**
2907
- * A map of colors and components GUIDs that should be colorized when displaying a viewpoint.
2908
- * For this to work, call viewpoint.colorize()
3029
+ * The WebGL renderer for the minimap.
3030
+ * It is used to render the minimap onto the screen.
2909
3031
  */
2910
- readonly componentColors: DataMap<string, string[]>;
3032
+ renderer: THREE.WebGLRenderer;
2911
3033
  /**
2912
- * Boolean flags to allow fine control over the visibility of spaces.
2913
- * A typical use of these flags is when DefaultVisibility=true but spaces should remain hidden.
2914
- * @default false
3034
+ * A flag indicating whether the minimap is enabled.
3035
+ * If disabled, the minimap will not update or render.
2915
3036
  */
2916
- spacesVisible: boolean;
3037
+ enabled: boolean;
2917
3038
  /**
2918
- * Boolean flags to allow fine control over the visibility of space boundaries.
2919
- * A typical use of these flags is when DefaultVisibility=true but space boundaries should remain hidden.
2920
- * @default false
3039
+ * The world in which the minimap is displayed.
3040
+ * It provides access to the 3D scene, camera, and other relevant world elements.
2921
3041
  */
2922
- spaceBoundariesVisible: boolean;
3042
+ world: World;
3043
+ private _lockRotation;
3044
+ private _camera;
3045
+ private _plane;
3046
+ private _size;
3047
+ private _tempVector1;
3048
+ private _tempVector2;
3049
+ private _tempTarget;
3050
+ private readonly down;
2923
3051
  /**
2924
- * Boolean flags to allow fine control over the visibility of openings.
2925
- * A typical use of these flags is when DefaultVisibility=true but openings should remain hidden.
2926
- * @default false
3052
+ * Gets or sets whether the minimap rotation is locked.
3053
+ * When rotation is locked, the minimap will always face the same direction as the camera.
2927
3054
  */
2928
- openingsVisible: boolean;
3055
+ get lockRotation(): boolean;
2929
3056
  /**
2930
- * When true, all components should be visible unless listed in the exceptions
2931
- * When false all components should be invisible unless listed in the exceptions
3057
+ * Sets whether the minimap rotation is locked.
3058
+ * When rotation is locked, the minimap will always face the same direction as the camera.
3059
+ * @param active - If 'true', rotation is locked. If 'false', rotation is not locked.
2932
3060
  */
2933
- defaultVisibility: boolean;
2934
- private get _selectionModelIdMap();
2935
- private get _exceptionModelIdMap();
3061
+ set lockRotation(active: boolean);
2936
3062
  /**
2937
- * A list of components that should be selected (highlighted) when displaying a viewpoint.
2938
- * @returns The fragmentIdMap for components marked as selections.
3063
+ * Gets the current zoom level of the minimap.
3064
+ * The zoom level determines how much of the world is visible on the minimap.
3065
+ * @returns The current zoom level of the minimap.
2939
3066
  */
2940
- get selection(): FRAGS.FragmentIdMap;
3067
+ get zoom(): number;
2941
3068
  /**
2942
- * A list of components to hide when defaultVisibility = true or to show when defaultVisibility = false
2943
- * @returns The fragmentIdMap for components marked as exceptions.
3069
+ * Sets the zoom level of the minimap.
3070
+ * The zoom level determines how much of the world is visible on the minimap.
3071
+ * @param value - The new zoom level of the minimap.
2944
3072
  */
2945
- get exception(): FRAGS.FragmentIdMap;
3073
+ set zoom(value: number);
3074
+ constructor(world: World);
3075
+ /** {@link Disposable.dispose} */
3076
+ dispose(): void;
3077
+ /** Returns the camera used by the MiniMap */
3078
+ get(): THREE.OrthographicCamera;
3079
+ /** {@link Updateable.update} */
3080
+ update(): void;
3081
+ /** {@link Resizeable.getSize} */
3082
+ getSize(): THREE.Vector2;
3083
+ /** {@link Resizeable.resize} */
3084
+ resize(size?: THREE.Vector2): void;
3085
+ private updatePlanes;
3086
+ }
3087
+ import * as FRAGS from "@thatopen/fragments";
3088
+ import * as WEBIFC from "web-ifc";
3089
+ export declare class SpatialIdsFinder {
3090
+ static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
3091
+ }
3092
+ import * as WEBIFC from "web-ifc";
3093
+ /** Configuration of the IFC-fragment conversion. */
3094
+ export declare class IfcFragmentSettings {
3095
+ /** Whether to extract the IFC properties into a JSON. */
3096
+ includeProperties: boolean;
2946
3097
  /**
2947
- * Retrieves the projection type of the viewpoint's camera.
2948
- *
2949
- * @returns A string representing the projection type of the viewpoint's camera.
2950
- * It can be either 'Perspective' or 'Orthographic'.
3098
+ * Generate the geometry for categories that are not included by default,
3099
+ * like IFCSPACE.
2951
3100
  */
2952
- get projection(): CameraProjection;
3101
+ optionalCategories: number[];
3102
+ /** Whether to use the coordination data coming from the IFC files. */
3103
+ coordinate: boolean;
3104
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
3105
+ wasm: {
3106
+ path: string;
3107
+ absolute: boolean;
3108
+ logLevel?: WEBIFC.LogLevel;
3109
+ };
3110
+ /** List of categories that won't be converted to fragments. */
3111
+ excludedCategories: Set<number>;
3112
+ /** Exclusive list of categories that will be converted to fragments. If this contains any category, any other categories will be ignored. */
3113
+ includedCategories: Set<number>;
3114
+ /** Whether to save the absolute location of all IFC items. */
3115
+ saveLocations: boolean;
3116
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
3117
+ webIfc: WEBIFC.LoaderSettings;
2953
3118
  /**
2954
- * Retrieves the position vector of the viewpoint's camera.
2955
- *
2956
- * @remarks
2957
- * The position vector represents the camera's position in the world coordinate system.
2958
- * The function applies the base coordinate system transformation to the position vector.
2959
- *
2960
- * @returns A THREE.Vector3 representing the position of the viewpoint's camera.
3119
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
3120
+ * If set to true, the path will be set to the default path of the WASM file.
3121
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
3122
+ * Default value is true.
2961
3123
  */
2962
- get position(): THREE.Vector3;
3124
+ autoSetWasm: boolean;
2963
3125
  /**
2964
- * Retrieves the direction vector of the viewpoint's camera.
2965
- *
2966
- * @remarks
2967
- * The direction vector represents the direction in which the camera is pointing.
2968
- * It is calculated by extracting the x, y, and z components from the camera's direction property.
3126
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
3127
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
3128
+ * If set to null, the default file location handler will be used.
2969
3129
  *
2970
- * @returns A THREE.Vector3 representing the direction of the viewpoint's camera.
3130
+ * @param url - The URL of the file to locate.
3131
+ * @returns The absolute path of the file.
2971
3132
  */
2972
- get direction(): THREE.Vector3;
3133
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
3134
+ }
3135
+ import { InverseAttribute } from "./types";
3136
+ export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585 | 982818633, {
3137
+ forRelating: InverseAttribute;
3138
+ forRelated: InverseAttribute;
3139
+ }>;
3140
+ import { Topic } from "..";
3141
+ import { Viewpoint } from "../../../core/Viewpoints";
3142
+ import { Components } from "../../../core/Components";
3143
+ /**
3144
+ * Represents a comment in a BCF Topic.
3145
+ */
3146
+ export declare class Comment {
3147
+ date: Date;
3148
+ author: string;
3149
+ guid: string;
3150
+ viewpoint?: Viewpoint;
3151
+ modifiedAuthor?: string;
3152
+ modifiedDate?: Date;
3153
+ topic?: Topic;
2973
3154
  private _components;
3155
+ private _comment;
2974
3156
  /**
2975
- * Represents the world in which the viewpoints are created and managed.
3157
+ * Sets the comment text and updates the modified date and author.
3158
+ * The author will be the one defined in BCFTopics.config.author
3159
+ * @param value - The new comment text.
2976
3160
  */
2977
- readonly world: World;
2978
- private get _managerVersion();
3161
+ set comment(value: string);
2979
3162
  /**
2980
- * Retrieves the list of BCF topics associated with the current viewpoint.
2981
- *
2982
- * @remarks
2983
- * This function retrieves the BCFTopics manager from the components,
2984
- * then filters the list of topics to find those associated with the current viewpoint.
2985
- *
2986
- * @returns An array of BCF topics associated with the current viewpoint.
3163
+ * Gets the comment text.
3164
+ * @returns The comment text.
2987
3165
  */
2988
- get topics(): import("../../../openbim/BCFTopics").Topic[];
2989
- constructor(components: Components, world: World, _config?: {
2990
- data?: Partial<BCFViewpoint>;
2991
- setCamera?: boolean;
2992
- });
3166
+ get comment(): string;
2993
3167
  /**
2994
- * Adds components to the viewpoint based on the provided fragment ID map.
2995
- *
2996
- * @param fragmentIdMap - A map containing fragment IDs as keys and arrays of express IDs as values.
2997
- */
2998
- addComponentsFromMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
2999
- /**
3000
- * Replace the properties of the viewpoint with the provided data.
3001
- *
3002
- * @remarks The guid will be ommited as it shouldn't change after it has been initially set.
3003
- * @remarks The existing selection and exception components will be fully replaced in case new ones are provided.
3004
- *
3005
- * @param data - An object containing the properties to be set.
3006
- * The properties not included in the object will remain unchanged.
3007
- *
3008
- * @returns The viewpoint instance with the updated properties.
3168
+ * Constructs a new BCF Topic Comment instance.
3169
+ * @param components - The Components instance.
3170
+ * @param text - The initial comment text.
3009
3171
  */
3010
- set(data: Partial<BCFViewpoint>): this;
3172
+ constructor(components: Components, text: string);
3011
3173
  /**
3012
- * Sets the viewpoint of the camera in the world.
3013
- *
3014
- * @remarks
3015
- * This function calculates the target position based on the viewpoint information.
3016
- * It sets the visibility of the viewpoint components and then applies the viewpoint using the camera's controls.
3017
- *
3018
- * @param transition - Indicates whether the camera movement should have a transition effect.
3019
- * Default value is 'true'.
3020
- *
3021
- * @throws An error if the world's camera does not have camera controls.
3174
+ * Serializes the Comment instance into a BCF compliant XML string.
3022
3175
  *
3023
- * @returns A Promise that resolves when the camera has been set.
3176
+ * @returns A string representing the Comment in BCFv2 XML format.
3024
3177
  */
3025
- go(transition?: boolean): Promise<void>;
3178
+ serialize(): string;
3179
+ }
3180
+ import * as THREE from "three";
3181
+ import { Components } from "../../Components";
3182
+ import { AsyncEvent, Event, World } from "../../Types";
3183
+ /**
3184
+ * Settings to configure the CullerRenderer.
3185
+ */
3186
+ export interface CullerRendererSettings {
3026
3187
  /**
3027
- * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
3028
- *
3029
- * @remarks
3030
- * This function retrieves the camera's position, direction, and aspect ratio from the world's camera and renderer.
3031
- * It then calculates the camera's perspective or orthographic settings based on the camera type.
3032
- * Finally, it updates the viewpoint's camera settings and updates the viewpoint to the Viewpoints manager.
3033
- *
3034
- * @throws An error if the world's camera does not have camera controls.
3035
- * @throws An error if the world's renderer is not available.
3188
+ * Interval in milliseconds at which the visibility check should be performed.
3189
+ * Default value is 1000.
3036
3190
  */
3037
- updateCamera(): void;
3191
+ updateInterval?: number;
3038
3192
  /**
3039
- * Applies color to the components in the viewpoint based on their GUIDs.
3040
- *
3041
- * This function iterates through the 'componentColors' map, retrieves the fragment IDs
3042
- * corresponding to each color, and then uses the 'Classifier' to apply the color to those fragments.
3043
- *
3044
- * @remarks
3045
- * The color is applied using the 'Classifier.setColor' method, which sets the color of the specified fragments.
3046
- * The color is provided as a hexadecimal string, prefixed with a '#'.
3193
+ * Width of the render target used for visibility checks.
3194
+ * Default value is 512.
3047
3195
  */
3048
- colorize(): void;
3196
+ width?: number;
3049
3197
  /**
3050
- * Resets the colors of all components in the viewpoint to their original color.
3051
- * This method iterates through the 'componentColors' map, retrieves the fragment IDs
3052
- * corresponding to each color, and then uses the 'Classifier' to reset the color of those fragments.
3198
+ * Height of the render target used for visibility checks.
3199
+ * Default value is 512.
3053
3200
  */
3054
- resetColors(): void;
3055
- private createComponentTags;
3201
+ height?: number;
3056
3202
  /**
3057
- * Serializes the viewpoint into a buildingSMART compliant XML string for export.
3058
- *
3059
- * @param version - The version of the BCF Manager to use for serialization.
3060
- * If not provided, the current version of the manager will be used.
3061
- *
3062
- * @returns A Promise that resolves to an XML string representing the viewpoint.
3063
- * The XML string follows the BCF VisualizationInfo schema.
3064
- *
3065
- * @throws An error if the world's camera does not have camera controls.
3066
- * @throws An error if the world's renderer is not available.
3203
+ * Whether the visibility check should be performed automatically.
3204
+ * Default value is true.
3067
3205
  */
3068
- serialize(version?: import("../../../openbim/BCFTopics").BCFVersion): Promise<string>;
3069
- }
3070
- import { NavigationMode } from "./types";
3071
- import { OrthoPerspectiveCamera } from "../index";
3072
- /**
3073
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3074
- */
3075
- export declare class FirstPersonMode implements NavigationMode {
3076
- private camera;
3077
- /** {@link NavigationMode.enabled} */
3078
- enabled: boolean;
3079
- /** {@link NavigationMode.id} */
3080
- readonly id = "FirstPerson";
3081
- constructor(camera: OrthoPerspectiveCamera);
3082
- /** {@link NavigationMode.set} */
3083
- set(active: boolean): void;
3084
- private setupFirstPersonCamera;
3085
- }
3086
- import { NavigationMode } from "./types";
3087
- import { OrthoPerspectiveCamera } from "../index";
3088
- /**
3089
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3090
- */
3091
- export declare class OrbitMode implements NavigationMode {
3092
- camera: OrthoPerspectiveCamera;
3093
- /** {@link NavigationMode.enabled} */
3094
- enabled: boolean;
3095
- /** {@link NavigationMode.id} */
3096
- readonly id = "Orbit";
3097
- constructor(camera: OrthoPerspectiveCamera);
3098
- /** {@link NavigationMode.set} */
3099
- set(active: boolean): void;
3100
- private activateOrbitControls;
3101
- }
3102
- import { NavigationMode } from "./types";
3103
- import { OrthoPerspectiveCamera } from "../index";
3104
- /**
3105
- * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
3106
- */
3107
- export declare class PlanMode implements NavigationMode {
3108
- private camera;
3109
- /** {@link NavigationMode.enabled} */
3110
- enabled: boolean;
3111
- /** {@link NavigationMode.id} */
3112
- readonly id = "Plan";
3113
- private mouseAction1?;
3114
- private mouseAction2?;
3115
- private mouseInitialized;
3116
- private readonly defaultAzimuthSpeed;
3117
- private readonly defaultPolarSpeed;
3118
- constructor(camera: OrthoPerspectiveCamera);
3119
- /** {@link NavigationMode.set} */
3120
- set(active: boolean): void;
3206
+ autoUpdate?: boolean;
3121
3207
  }
3122
- import * as THREE from "three";
3123
- import { CameraProjection } from "./types";
3124
- import { Event } from "../../Types";
3125
- import { OrthoPerspectiveCamera } from "../index";
3126
3208
  /**
3127
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3209
+ * A base renderer to determine visibility on screen.
3128
3210
  */
3129
- export declare class ProjectionManager {
3211
+ export declare class CullerRenderer {
3212
+ /** {@link Disposable.onDisposed} */
3213
+ readonly onDisposed: Event<string>;
3130
3214
  /**
3131
- * Event that fires when the {@link CameraProjection} changes.
3215
+ * Fires after making the visibility check to the meshes. It lists the
3216
+ * meshes that are currently visible, and the ones that were visible
3217
+ * just before but not anymore.
3132
3218
  */
3133
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
3219
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
3134
3220
  /**
3135
- * Current projection mode of the camera.
3136
- * Default is "Perspective".
3221
+ * Whether this renderer is active or not. If not, it won't render anything.
3137
3222
  */
3138
- current: CameraProjection;
3223
+ enabled: boolean;
3139
3224
  /**
3140
- * The camera controlled by this ProjectionManager.
3141
- * It can be either a PerspectiveCamera or an OrthographicCamera.
3225
+ * Needs to check whether there are objects that need to be hidden or shown.
3226
+ * You can bind this to the camera movement, to a certain interval, etc.
3142
3227
  */
3143
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3144
- /** Match Ortho zoom with Perspective distance when changing projection mode */
3145
- matchOrthoDistanceEnabled: boolean;
3146
- private _component;
3147
- private _previousDistance;
3148
- constructor(camera: OrthoPerspectiveCamera);
3228
+ needsUpdate: boolean;
3149
3229
  /**
3150
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
3151
- *
3152
- * @param projection - the new projection to set. If it is the current projection,
3153
- * it will have no effect.
3230
+ * Render the internal scene used to determine the object visibility. Used
3231
+ * for debugging purposes.
3154
3232
  */
3155
- set(projection: CameraProjection): Promise<void>;
3233
+ renderDebugFrame: boolean;
3234
+ /** The components instance to which this renderer belongs. */
3235
+ components: Components;
3236
+ /** The world instance to which this renderer belongs. */
3237
+ readonly world: World;
3238
+ /** The THREE.js renderer used to make the visibility test. */
3239
+ readonly renderer: THREE.WebGLRenderer;
3240
+ protected autoUpdate: boolean;
3241
+ protected updateInterval: number;
3242
+ protected readonly worker: Worker;
3243
+ protected readonly scene: THREE.Scene;
3244
+ private _width;
3245
+ private _height;
3246
+ private _availableColor;
3247
+ private readonly renderTarget;
3248
+ private readonly bufferSize;
3249
+ private readonly _buffer;
3250
+ protected _isWorkerBusy: boolean;
3251
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
3252
+ /** {@link Disposable.dispose} */
3253
+ dispose(): void;
3156
3254
  /**
3157
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
3158
- * and vice versa.
3255
+ * The function that the culler uses to reprocess the scene. Generally it's
3256
+ * better to call needsUpdate, but you can also call this to force it.
3257
+ * @param force if true, it will refresh the scene even if needsUpdate is
3258
+ * not true.
3159
3259
  */
3160
- toggle(): Promise<void>;
3161
- private setOrthoCamera;
3162
- private getPerspectiveDims;
3163
- private setupOrthoCamera;
3164
- private getDistance;
3165
- private setPerspectiveCamera;
3166
- }
3167
- /**
3168
- * The projection system of the camera.
3169
- */
3170
- export type CameraProjection = "Perspective" | "Orthographic";
3171
- /**
3172
- * The extensible list of supported navigation modes.
3173
- */
3174
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
3175
- /**
3176
- * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
3177
- */
3178
- export interface NavigationMode {
3179
- /** The unique ID of this navigation mode. */
3180
- id: NavModeID;
3181
- /**
3182
- * Enable or disable this navigation mode.
3183
- * When a new navigation mode is enabled, the previous navigation mode
3184
- * must be disabled.
3185
- *
3186
- * @param active - whether to enable or disable this mode.
3187
- * @param options - any additional data required to enable or disable it.
3188
- * */
3189
- set: (active: boolean, options?: any) => void;
3190
- /** Whether this navigation mode is active or not. */
3191
- enabled: boolean;
3260
+ updateVisibility: (force?: boolean) => Promise<void>;
3261
+ protected getAvailableColor(): {
3262
+ r: number;
3263
+ g: number;
3264
+ b: number;
3265
+ code: string;
3266
+ };
3267
+ protected increaseColor(): void;
3268
+ protected decreaseColor(): void;
3269
+ private applySettings;
3192
3270
  }
3271
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
3193
3272
  import * as THREE from "three";
3194
- import { Hideable, Event, World, Disposable } from "../../Types";
3273
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
3195
3274
  import { Components } from "../../Components";
3275
+ import { Event, World, Disposable } from "../../Types";
3196
3276
  /**
3197
- * Configuration interface for the {@link SimpleGrid} class.
3277
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
3198
3278
  */
3199
- export interface GridConfig {
3279
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
3200
3280
  /**
3201
- * The color of the grid lines.
3281
+ * Event triggered when the visibility of meshes is updated.
3282
+ * Contains two sets: seen and unseen.
3202
3283
  */
3203
- color: THREE.Color;
3284
+ readonly onViewUpdated: Event<{
3285
+ seen: Set<THREE.Mesh>;
3286
+ unseen: Set<THREE.Mesh>;
3287
+ }>;
3204
3288
  /**
3205
- * The size of the primary grid lines.
3289
+ * Pixels in screen a geometry must occupy to be considered "seen".
3290
+ * Default value is 100.
3206
3291
  */
3207
- size1: number;
3292
+ threshold: number;
3208
3293
  /**
3209
- * The size of the secondary grid lines.
3294
+ * Map of color code to THREE.InstancedMesh.
3295
+ * Used to keep track of color-coded meshes.
3210
3296
  */
3211
- size2: number;
3297
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
3212
3298
  /**
3213
- * The distance at which the grid lines start to fade away.
3299
+ * Flag to indicate if the renderer is currently processing.
3300
+ * Used to prevent concurrent processing.
3214
3301
  */
3215
- distance: number;
3216
- }
3217
- /**
3218
- * 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).
3219
- */
3220
- export declare class SimpleGrid implements Hideable, Disposable {
3221
- /** {@link Disposable.onDisposed} */
3222
- readonly onDisposed: Event<unknown>;
3223
- /** The world instance to which this Raycaster belongs. */
3224
- world: World;
3225
- /** The components instance to which this grid belongs. */
3226
- components: Components;
3227
- /** {@link Hideable.visible} */
3228
- get visible(): boolean;
3229
- /** {@link Hideable.visible} */
3230
- set visible(visible: boolean);
3231
- /** The material of the grid. */
3232
- get material(): THREE.ShaderMaterial;
3302
+ isProcessing: boolean;
3303
+ private _interval;
3304
+ private _colorCodeMeshMap;
3305
+ private _meshIDColorCodeMap;
3306
+ private _currentVisibleMeshes;
3307
+ private _recentlyHiddenMeshes;
3308
+ private _intervalID;
3309
+ private readonly _transparentMat;
3310
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
3311
+ /** {@link Disposable.dispose} */
3312
+ dispose(): void;
3233
3313
  /**
3234
- * Whether the grid should fade away with distance. Recommended to be true for
3235
- * perspective cameras and false for orthographic cameras.
3314
+ * 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.
3315
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3316
+ * @returns {void}
3236
3317
  */
3237
- get fade(): boolean;
3318
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3238
3319
  /**
3239
- * Whether the grid should fade away with distance. Recommended to be true for
3240
- * perspective cameras and false for orthographic cameras.
3320
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
3321
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
3322
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
3323
+ * @returns {void}
3241
3324
  */
3242
- set fade(active: boolean);
3243
- /** The Three.js mesh that contains the infinite grid. */
3244
- readonly three: THREE.Mesh;
3245
- private _fade;
3246
- constructor(components: Components, world: World, config: GridConfig);
3247
- /** {@link Disposable.dispose} */
3248
- dispose(): void;
3249
- private setupEvents;
3250
- private updateZoom;
3325
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
3326
+ /**
3327
+ * 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.
3328
+ *
3329
+ * @param meshes - The meshes to update.
3330
+ *
3331
+ * @returns {void}
3332
+ */
3333
+ updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
3334
+ private handleWorkerMessage;
3335
+ private getAvailableMaterial;
3251
3336
  }
3252
3337
  import * as THREE from "three";
3253
- import { Event, World } from "../../Types";
3338
+ import * as FRAGS from "@thatopen/fragments";
3339
+ import { BCFViewpoint, ViewpointOrthographicCamera, ViewpointPerspectiveCamera } from "./types";
3340
+ import { CameraProjection } from "../../OrthoPerspectiveCamera";
3254
3341
  import { Components } from "../../Components";
3342
+ import { DataMap, DataSet, World } from "../../Types";
3343
+ import { SimplePlane } from "../../Clipper";
3255
3344
  /**
3256
- * A base renderer to determine visibility on screen.
3345
+ * Represents a BCF compliant viewpoint from BuildingSMART.
3346
+ *
3347
+ * The Viewpoint class provides methods for managing and interacting with viewpoints.
3348
+ * It includes functionality for setting viewpoint properties, updating the camera,
3349
+ * applying color to components, and serializing the viewpoint for export.
3257
3350
  */
3258
- export declare class DistanceRenderer {
3259
- /** {@link Disposable.onDisposed} */
3260
- readonly onDisposed: Event<string>;
3351
+ export declare class Viewpoint implements BCFViewpoint {
3352
+ title?: string;
3353
+ readonly guid: string;
3261
3354
  /**
3262
- * Fires after making the visibility check to the meshes. It lists the
3263
- * meshes that are currently visible, and the ones that were visible
3264
- * just before but not anymore.
3355
+ * ClippingPlanes can be used to define a subsection of a building model that is related to the topic.
3356
+ * Each clipping plane is defined by Location and Direction.
3357
+ * The Direction vector points in the invisible direction meaning the half-space that is clipped.
3358
+ * @experimental
3265
3359
  */
3266
- readonly onDistanceComputed: Event<number>;
3360
+ clippingPlanes: DataSet<SimplePlane>;
3361
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3267
3362
  /**
3268
- * Objects that won't be taken into account in the distance check.
3363
+ * A list of components GUIDs to hide when defaultVisibility = true or to show when defaultVisibility = false
3269
3364
  */
3270
- excludedObjects: Set<THREE.Object3D<THREE.Object3DEventMap>>;
3365
+ readonly exceptionComponents: DataSet<string>;
3271
3366
  /**
3272
- * Whether this renderer is active or not. If not, it won't render anything.
3367
+ * A list of components GUIDs that should be selected (highlighted) when displaying a viewpoint.
3273
3368
  */
3274
- enabled: boolean;
3369
+ readonly selectionComponents: DataSet<string>;
3275
3370
  /**
3276
- * Render the internal scene used to determine the object visibility. Used
3277
- * for debugging purposes.
3371
+ * A map of colors and components GUIDs that should be colorized when displaying a viewpoint.
3372
+ * For this to work, call viewpoint.colorize()
3278
3373
  */
3279
- renderDebugFrame: boolean;
3280
- /** The components instance to which this renderer belongs. */
3281
- components: Components;
3374
+ readonly componentColors: DataMap<string, string[]>;
3282
3375
  /**
3283
- * The scene where the distance is computed.
3376
+ * Boolean flags to allow fine control over the visibility of spaces.
3377
+ * A typical use of these flags is when DefaultVisibility=true but spaces should remain hidden.
3378
+ * @default false
3284
3379
  */
3285
- scene: THREE.Scene;
3380
+ spacesVisible: boolean;
3286
3381
  /**
3287
- * The camera used to compute the distance.
3382
+ * Boolean flags to allow fine control over the visibility of space boundaries.
3383
+ * A typical use of these flags is when DefaultVisibility=true but space boundaries should remain hidden.
3384
+ * @default false
3288
3385
  */
3289
- camera: THREE.OrthographicCamera;
3386
+ spaceBoundariesVisible: boolean;
3290
3387
  /**
3291
- * The material used to compute the distance.
3388
+ * Boolean flags to allow fine control over the visibility of openings.
3389
+ * A typical use of these flags is when DefaultVisibility=true but openings should remain hidden.
3390
+ * @default false
3292
3391
  */
3293
- depthMaterial: THREE.ShaderMaterial;
3294
- /** The world instance to which this renderer belongs. */
3295
- readonly world: World;
3296
- /** The THREE.js renderer used to make the visibility test. */
3297
- readonly renderer: THREE.WebGLRenderer;
3298
- protected readonly worker: Worker;
3299
- private _width;
3300
- private _height;
3301
- private readonly _postQuad;
3302
- private readonly tempRT;
3303
- private readonly resultRT;
3304
- private readonly bufferSize;
3305
- private readonly _buffer;
3306
- protected _isWorkerBusy: boolean;
3307
- constructor(components: Components, world: World);
3308
- /** {@link Disposable.dispose} */
3309
- dispose(): void;
3392
+ openingsVisible: boolean;
3310
3393
  /**
3311
- * The function that the culler uses to reprocess the scene. Generally it's
3312
- * better to call needsUpdate, but you can also call this to force it.
3313
- * @param force if true, it will refresh the scene even if needsUpdate is
3314
- * not true.
3394
+ * When true, all components should be visible unless listed in the exceptions
3395
+ * When false all components should be invisible unless listed in the exceptions
3315
3396
  */
3316
- compute: () => Promise<void>;
3317
- private handleWorkerMessage;
3318
- }
3319
- import * as THREE from "three";
3320
- import { Hideable, Disposable, Event, World } from "../../Types";
3321
- import { Components } from "../../Components";
3322
- /**
3323
- * Each of the clipping planes created by the clipper.
3324
- */
3325
- export declare class SimplePlane implements Disposable, Hideable {
3326
- /** Event that fires when the user starts dragging a clipping plane. */
3327
- readonly onDraggingStarted: Event<unknown>;
3328
- /** Event that fires when the user stops dragging a clipping plane. */
3329
- readonly onDraggingEnded: Event<unknown>;
3330
- /** {@link Disposable.onDisposed} */
3331
- readonly onDisposed: Event<unknown>;
3397
+ defaultVisibility: boolean;
3398
+ private get _selectionModelIdMap();
3399
+ private get _exceptionModelIdMap();
3332
3400
  /**
3333
- * The normal vector of the clipping plane.
3401
+ * A list of components that should be selected (highlighted) when displaying a viewpoint.
3402
+ * @returns The fragmentIdMap for components marked as selections.
3334
3403
  */
3335
- readonly normal: THREE.Vector3;
3404
+ get selection(): FRAGS.FragmentIdMap;
3336
3405
  /**
3337
- * The origin point of the clipping plane.
3406
+ * A list of components to hide when defaultVisibility = true or to show when defaultVisibility = false
3407
+ * @returns The fragmentIdMap for components marked as exceptions.
3338
3408
  */
3339
- readonly origin: THREE.Vector3;
3409
+ get exception(): FRAGS.FragmentIdMap;
3340
3410
  /**
3341
- * The THREE.js Plane object representing the clipping plane.
3411
+ * Retrieves the projection type of the viewpoint's camera.
3412
+ *
3413
+ * @returns A string representing the projection type of the viewpoint's camera.
3414
+ * It can be either 'Perspective' or 'Orthographic'.
3342
3415
  */
3343
- readonly three: THREE.Plane;
3344
- /** The components instance to which this plane belongs. */
3345
- components: Components;
3346
- /** The world instance to which this plane belongs. */
3347
- world: World;
3348
- /** A custom string to identify what this plane is used for. */
3349
- type: string;
3350
- protected readonly _helper: THREE.Object3D;
3351
- protected _visible: boolean;
3352
- protected _enabled: boolean;
3353
- private _controlsActive;
3354
- private readonly _arrowBoundBox;
3355
- private readonly _planeMesh;
3356
- private readonly _controls;
3357
- private readonly _hiddenMaterial;
3416
+ get projection(): CameraProjection;
3358
3417
  /**
3359
- * Getter for the enabled state of the clipping plane.
3360
- * @returns {boolean} The current enabled state.
3418
+ * Retrieves the position vector of the viewpoint's camera.
3419
+ *
3420
+ * @remarks
3421
+ * The position vector represents the camera's position in the world coordinate system.
3422
+ * The function applies the base coordinate system transformation to the position vector.
3423
+ *
3424
+ * @returns A THREE.Vector3 representing the position of the viewpoint's camera.
3361
3425
  */
3362
- get enabled(): boolean;
3426
+ get position(): THREE.Vector3;
3363
3427
  /**
3364
- * Setter for the enabled state of the clipping plane.
3365
- * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3366
- * @param {boolean} state - The new enabled state.
3428
+ * Retrieves the direction vector of the viewpoint's camera.
3429
+ *
3430
+ * @remarks
3431
+ * The direction vector represents the direction in which the camera is pointing.
3432
+ * It is calculated by extracting the x, y, and z components from the camera's direction property.
3433
+ *
3434
+ * @returns A THREE.Vector3 representing the direction of the viewpoint's camera.
3367
3435
  */
3368
- set enabled(state: boolean);
3369
- /** {@link Hideable.visible } */
3370
- get visible(): boolean;
3371
- /** {@link Hideable.visible } */
3372
- set visible(state: boolean);
3373
- /** The meshes used for raycasting */
3374
- get meshes(): THREE.Mesh[];
3375
- /** The material of the clipping plane representation. */
3376
- get planeMaterial(): THREE.Material | THREE.Material[];
3377
- /** The material of the clipping plane representation. */
3378
- set planeMaterial(material: THREE.Material | THREE.Material[]);
3379
- /** The size of the clipping plane representation. */
3380
- get size(): number;
3381
- /** Sets the size of the clipping plane representation. */
3382
- set size(size: number);
3436
+ get direction(): THREE.Vector3;
3437
+ private _components;
3383
3438
  /**
3384
- * Getter for the helper object of the clipping plane.
3385
- * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3386
- * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3439
+ * Represents the world in which the viewpoints are created and managed.
3440
+ */
3441
+ readonly world: World;
3442
+ private get _managerVersion();
3443
+ /**
3444
+ * Retrieves the list of BCF topics associated with the current viewpoint.
3387
3445
  *
3388
- * @returns {THREE.Object3D} The helper object of the clipping plane.
3446
+ * @remarks
3447
+ * This function retrieves the BCFTopics manager from the components,
3448
+ * then filters the list of topics to find those associated with the current viewpoint.
3449
+ *
3450
+ * @returns An array of BCF topics associated with the current viewpoint.
3389
3451
  */
3390
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3391
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3452
+ get topics(): import("../../../openbim/BCFTopics").Topic[];
3453
+ constructor(components: Components, world: World, _config?: {
3454
+ data?: Partial<BCFViewpoint>;
3455
+ setCamera?: boolean;
3456
+ });
3392
3457
  /**
3393
- * Sets the clipping plane's normal and origin from the given normal and point.
3394
- * This method resets the clipping plane's state, updates the normal and origin,
3395
- * and positions the helper object accordingly.
3458
+ * Adds components to the viewpoint based on the provided fragment ID map.
3396
3459
  *
3397
- * @param normal - The new normal vector for the clipping plane.
3398
- * @param point - The new origin point for the clipping plane.
3460
+ * @param fragmentIdMap - A map containing fragment IDs as keys and arrays of express IDs as values.
3461
+ */
3462
+ addComponentsFromMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
3463
+ /**
3464
+ * Replace the properties of the viewpoint with the provided data.
3399
3465
  *
3400
- * @returns {void}
3466
+ * @remarks The guid will be ommited as it shouldn't change after it has been initially set.
3467
+ * @remarks The existing selection and exception components will be fully replaced in case new ones are provided.
3468
+ *
3469
+ * @param data - An object containing the properties to be set.
3470
+ * The properties not included in the object will remain unchanged.
3471
+ *
3472
+ * @returns The viewpoint instance with the updated properties.
3401
3473
  */
3402
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3403
- /** {@link Updateable.update} */
3404
- update: () => void;
3405
- /** {@link Disposable.dispose} */
3406
- dispose(): void;
3407
- private reset;
3408
- protected toggleControls(state: boolean): void;
3409
- private newTransformControls;
3410
- private initializeControls;
3411
- private createArrowBoundingBox;
3412
- private changeDrag;
3413
- private notifyDraggingChanged;
3414
- private preventCameraMovement;
3415
- private newHelper;
3416
- private static newPlaneMesh;
3474
+ set(data: Partial<BCFViewpoint>): this;
3475
+ /**
3476
+ * Sets the viewpoint of the camera in the world.
3477
+ *
3478
+ * @remarks
3479
+ * This function calculates the target position based on the viewpoint information.
3480
+ * It sets the visibility of the viewpoint components and then applies the viewpoint using the camera's controls.
3481
+ *
3482
+ * @param transition - Indicates whether the camera movement should have a transition effect.
3483
+ * Default value is 'true'.
3484
+ *
3485
+ * @throws An error if the world's camera does not have camera controls.
3486
+ *
3487
+ * @returns A Promise that resolves when the camera has been set.
3488
+ */
3489
+ go(transition?: boolean): Promise<void>;
3490
+ /**
3491
+ * Updates the camera settings of the viewpoint based on the current world's camera and renderer.
3492
+ *
3493
+ * @remarks
3494
+ * This function retrieves the camera's position, direction, and aspect ratio from the world's camera and renderer.
3495
+ * It then calculates the camera's perspective or orthographic settings based on the camera type.
3496
+ * Finally, it updates the viewpoint's camera settings and updates the viewpoint to the Viewpoints manager.
3497
+ *
3498
+ * @throws An error if the world's camera does not have camera controls.
3499
+ * @throws An error if the world's renderer is not available.
3500
+ */
3501
+ updateCamera(): void;
3502
+ /**
3503
+ * Applies color to the components in the viewpoint based on their GUIDs.
3504
+ *
3505
+ * This function iterates through the 'componentColors' map, retrieves the fragment IDs
3506
+ * corresponding to each color, and then uses the 'Classifier' to apply the color to those fragments.
3507
+ *
3508
+ * @remarks
3509
+ * The color is applied using the 'Classifier.setColor' method, which sets the color of the specified fragments.
3510
+ * The color is provided as a hexadecimal string, prefixed with a '#'.
3511
+ */
3512
+ colorize(): void;
3513
+ /**
3514
+ * Resets the colors of all components in the viewpoint to their original color.
3515
+ * This method iterates through the 'componentColors' map, retrieves the fragment IDs
3516
+ * corresponding to each color, and then uses the 'Classifier' to reset the color of those fragments.
3517
+ */
3518
+ resetColors(): void;
3519
+ private createComponentTags;
3520
+ /**
3521
+ * Serializes the viewpoint into a buildingSMART compliant XML string for export.
3522
+ *
3523
+ * @param version - The version of the BCF Manager to use for serialization.
3524
+ * If not provided, the current version of the manager will be used.
3525
+ *
3526
+ * @returns A Promise that resolves to an XML string representing the viewpoint.
3527
+ * The XML string follows the BCF VisualizationInfo schema.
3528
+ *
3529
+ * @throws An error if the world's camera does not have camera controls.
3530
+ * @throws An error if the world's renderer is not available.
3531
+ */
3532
+ serialize(version?: import("../../../openbim/BCFTopics").BCFVersion): Promise<string>;
3533
+ }
3534
+ import { SimplePlane } from "../../Clipper";
3535
+ import { DataSet } from "../../Types";
3536
+ export interface ViewpointCamera {
3537
+ direction: {
3538
+ x: number;
3539
+ y: number;
3540
+ z: number;
3541
+ };
3542
+ position: {
3543
+ x: number;
3544
+ y: number;
3545
+ z: number;
3546
+ };
3547
+ aspectRatio: number;
3548
+ }
3549
+ export interface ViewpointPerspectiveCamera extends ViewpointCamera {
3550
+ fov: number;
3551
+ }
3552
+ export interface ViewpointOrthographicCamera extends ViewpointCamera {
3553
+ viewToWorldScale: number;
3554
+ }
3555
+ /**
3556
+ * Represents a viewpoint in a BCF file.
3557
+ */
3558
+ export interface BCFViewpoint {
3559
+ title?: string;
3560
+ guid: string;
3561
+ camera: ViewpointPerspectiveCamera | ViewpointOrthographicCamera;
3562
+ selectionComponents: Iterable<string>;
3563
+ exceptionComponents: Iterable<string>;
3564
+ clippingPlanes: DataSet<SimplePlane>;
3565
+ spacesVisible: boolean;
3566
+ spaceBoundariesVisible: boolean;
3567
+ openingsVisible: boolean;
3568
+ defaultVisibility: boolean;
3417
3569
  }
3418
3570
  import * as THREE from "three";
3419
3571
  import { Disposable, Event } from "../../Types";
@@ -3490,816 +3642,759 @@ export declare class SimpleRaycaster implements Disposable {
3490
3642
  private intersect;
3491
3643
  private filterClippingPlanes;
3492
3644
  }
3645
+ import * as THREE from "three";
3646
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3493
3647
  /**
3494
- * 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.
3648
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3649
+ *
3650
+ * @template T - The type of the scene. Default is BaseScene.
3651
+ * @template U - The type of the camera. Default is BaseCamera.
3652
+ * @template S - The type of the renderer. Default is BaseRenderer.
3495
3653
  */
3496
- export declare class Event<T> {
3654
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
3497
3655
  /**
3498
- * Add a callback to this event instance.
3499
- * @param handler - the callback to be added to this event.
3656
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
3500
3657
  */
3501
- add(handler: T extends void ? {
3502
- (): void;
3503
- } : {
3504
- (data: T): void;
3505
- }): void;
3658
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
3659
+ /** {@link Updateable.onAfterUpdate} */
3660
+ readonly onAfterUpdate: Event<unknown>;
3661
+ /** {@link Updateable.onBeforeUpdate} */
3662
+ readonly onBeforeUpdate: Event<unknown>;
3663
+ /** {@link Disposable.onDisposed} */
3664
+ readonly onDisposed: Event<unknown>;
3506
3665
  /**
3507
- * Removes a callback from this event instance.
3508
- * @param handler - the callback to be removed from this event.
3666
+ * 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.
3509
3667
  */
3510
- remove(handler: T extends void ? {
3511
- (): void;
3512
- } : {
3513
- (data: T): void;
3514
- }): void;
3515
- /** Triggers all the callbacks assigned to this event. */
3516
- trigger: (data?: T) => void;
3517
- /** Gets rid of all the suscribed events. */
3518
- reset(): void;
3519
- private handlers;
3520
- }
3521
- /**
3522
- * 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.
3523
- */
3524
- export declare class AsyncEvent<T> {
3668
+ isDisposing: boolean;
3525
3669
  /**
3526
- * Add a callback to this event instance.
3527
- * @param handler - the callback to be added to this event.
3670
+ * Indicates whether the world is currently enabled.
3671
+ * When disabled, the world will not be updated.
3528
3672
  */
3529
- add(handler: T extends void ? {
3530
- (): Promise<void>;
3531
- } : {
3532
- (data: T): Promise<void>;
3533
- }): void;
3673
+ enabled: boolean;
3534
3674
  /**
3535
- * Removes a callback from this event instance.
3536
- * @param handler - the callback to be removed from this event.
3675
+ * A unique identifier for the world. Is not meant to be changed at any moment.
3537
3676
  */
3538
- remove(handler: T extends void ? {
3539
- (): Promise<void>;
3540
- } : {
3541
- (data: T): Promise<void>;
3542
- }): void;
3543
- /** Triggers all the callbacks assigned to this event. */
3544
- trigger: (data?: T) => Promise<void>;
3545
- /** Gets rid of all the suscribed events. */
3546
- reset(): void;
3547
- private handlers;
3548
- }
3549
- import * as THREE from "three";
3550
- import CameraControls from "camera-controls";
3551
- import { Event } from "./event";
3552
- /**
3553
- * Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
3554
- */
3555
- export interface Disposable {
3677
+ readonly uuid: string;
3556
3678
  /**
3557
- * Destroys the object from memory to prevent a
3558
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
3679
+ * An optional name for the world.
3559
3680
  */
3560
- dispose: () => void | Promise<void>;
3561
- /** Fired after the tool has been disposed. */
3562
- readonly onDisposed: Event<any>;
3563
- }
3564
- /**
3565
- * Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
3566
- */
3567
- export interface Hideable {
3681
+ name?: string;
3682
+ private _scene?;
3683
+ private _camera?;
3684
+ private _renderer;
3568
3685
  /**
3569
- * Whether the geometric representation of this component is
3570
- * currently visible or not in the
3571
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
3686
+ * Getter for the scene. If no scene is initialized, it throws an error.
3687
+ * @returns The current scene.
3572
3688
  */
3573
- visible: boolean;
3574
- }
3575
- /**
3576
- * Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
3577
- */
3578
- export interface Resizeable {
3689
+ get scene(): T;
3579
3690
  /**
3580
- * Sets size of this component (e.g. the resolution of a
3581
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
3582
- * component.
3691
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
3692
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
3693
+ * @param scene - The new scene to be set.
3583
3694
  */
3584
- resize: (size?: THREE.Vector2) => void;
3585
- /** Event that fires when the component has been resized. */
3586
- onResize: Event<THREE.Vector2>;
3695
+ set scene(scene: T);
3587
3696
  /**
3588
- * Gets the current size of this component (e.g. the resolution of a
3589
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
3590
- * component.
3697
+ * Getter for the camera. If no camera is initialized, it throws an error.
3698
+ * @returns The current camera.
3591
3699
  */
3592
- getSize: () => THREE.Vector2;
3593
- }
3594
- /** Whether this component should be updated each frame. */
3595
- export interface Updateable {
3596
- /** Actions that should be executed after updating the component. */
3597
- onAfterUpdate: Event<any>;
3598
- /** Actions that should be executed before updating the component. */
3599
- onBeforeUpdate: Event<any>;
3700
+ get camera(): U;
3600
3701
  /**
3601
- * Function used to update the state of this component each frame. For
3602
- * instance, a renderer component will make a render each frame.
3702
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
3703
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
3704
+ * @param camera - The new camera to be set.
3705
+ */
3706
+ set camera(camera: U);
3707
+ /**
3708
+ * Getter for the renderer.
3709
+ * @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).
3710
+ */
3711
+ get renderer(): S | null;
3712
+ /**
3713
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
3714
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
3715
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
3716
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
3603
3717
  */
3718
+ set renderer(renderer: S | null);
3719
+ /** {@link Updateable.update} */
3604
3720
  update(delta?: number): void;
3721
+ /** {@link Disposable.dispose} */
3722
+ dispose(disposeResources?: boolean): void;
3605
3723
  }
3606
- /** Basic type to describe the progress of any kind of process. */
3607
- export interface Progress {
3608
- /** The amount of things that have been done already. */
3609
- current: number;
3610
- /** The total amount of things to be done by the process. */
3611
- total: number;
3612
- }
3724
+ import * as THREE from "three";
3725
+ import { BaseRenderer, Event } from "../../Types";
3726
+ import { Components } from "../../Components";
3613
3727
  /**
3614
- * Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
3728
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
3615
3729
  */
3616
- export interface Createable {
3617
- /** Creates a new instance of an element (e.g. a new Dimension). */
3618
- create: (data: any) => void;
3730
+ export declare class SimpleRenderer extends BaseRenderer {
3619
3731
  /**
3620
- * Finish the creation process of the component, successfully creating an
3621
- * instance of whatever the component creates.
3732
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
3733
+ * Default is 'true'.
3622
3734
  */
3623
- endCreation?: (data: any) => void;
3735
+ enabled: boolean;
3624
3736
  /**
3625
- * Cancels the creation process of the component, going back to the state
3626
- * before starting to create.
3737
+ * The HTML container of the THREE.js canvas where the scene is rendered.
3627
3738
  */
3628
- cancelCreation?: (data: any) => void;
3629
- /** Deletes an existing instance of an element (e.g. a Dimension). */
3630
- delete: (data: any) => void;
3631
- }
3632
- /**
3633
- * Whether this component supports to be configured.
3634
- */
3635
- export interface Configurable<T extends Record<string, any>> {
3636
- /** Wether this components has been already configured. */
3637
- isSetup: boolean;
3638
- /** Use the provided configuration to setup the tool. */
3639
- setup: (config?: Partial<T>) => void | Promise<void>;
3640
- /** Fired after successfully calling {@link Configurable.setup()} */
3641
- readonly onSetup: Event<any>;
3642
- /** Object holding the tool configuration. Is not meant to be edited directly, if you need
3643
- * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
3739
+ container: HTMLElement;
3740
+ /**
3741
+ * The THREE.js WebGLRenderer instance.
3644
3742
  */
3645
- config: Required<T>;
3646
- }
3647
- /**
3648
- * Whether a camera uses the Camera Controls library.
3649
- */
3650
- export interface CameraControllable {
3743
+ three: THREE.WebGLRenderer;
3744
+ protected _canvas: HTMLCanvasElement;
3745
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
3746
+ protected _resizeObserver: ResizeObserver | null;
3747
+ protected onContainerUpdated: Event<unknown>;
3748
+ private _resizing;
3651
3749
  /**
3652
- * An instance of CameraControls that provides camera control functionalities.
3653
- * This instance is used to manipulate the camera.
3750
+ * Constructor for the SimpleRenderer class.
3751
+ *
3752
+ * @param components - The components instance.
3753
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
3754
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
3654
3755
  */
3655
- controls: CameraControls;
3656
- }
3657
- import { Base } from "./base";
3658
- /**
3659
- * 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.
3660
- */
3661
- export declare abstract class Component extends Base {
3756
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
3757
+ /** {@link Updateable.update} */
3758
+ update(): void;
3759
+ /** {@link Disposable.dispose} */
3760
+ dispose(): void;
3761
+ /** {@link Resizeable.getSize}. */
3762
+ getSize(): THREE.Vector2;
3763
+ /** {@link Resizeable.resize} */
3764
+ resize: (size?: THREE.Vector2) => void;
3662
3765
  /**
3663
- * Whether this component is active or not. The behaviour can vary depending
3664
- * on the type of component. E.g. a disabled dimension tool will stop creating
3665
- * dimensions, while a disabled camera will stop moving. A disabled component
3666
- * will not be updated automatically each frame.
3766
+ * Sets up and manages the event listeners for the renderer.
3767
+ *
3768
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
3769
+ *
3770
+ * @throws Will throw an error if the renderer does not have an HTML container.
3667
3771
  */
3668
- abstract enabled: boolean;
3772
+ setupEvents(active: boolean): void;
3773
+ private resizeEvent;
3774
+ private setupRenderer;
3775
+ private onContextLost;
3776
+ private onContextBack;
3669
3777
  }
3670
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
3778
+ import * as THREE from "three";
3779
+ import { BaseScene, Configurable, Event } from "../../Types";
3671
3780
  import { Components } from "../../Components";
3672
3781
  /**
3673
- * Base class of the library. Useful for finding out the interfaces something implements.
3782
+ * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
3674
3783
  */
3675
- export declare abstract class Base {
3676
- components: Components;
3677
- constructor(components: Components);
3678
- /** Whether is component is {@link Disposable}. */
3679
- isDisposeable: () => this is Disposable;
3680
- /** Whether is component is {@link Resizeable}. */
3681
- isResizeable: () => this is Resizeable;
3682
- /** Whether is component is {@link Updateable}. */
3683
- isUpdateable: () => this is Updateable;
3684
- /** Whether is component is {@link Hideable}. */
3685
- isHideable: () => this is Hideable;
3686
- /** Whether is component is {@link Configurable}. */
3687
- isConfigurable: () => this is Configurable<any>;
3784
+ export interface SimpleSceneConfig {
3785
+ directionalLight: {
3786
+ color: THREE.Color;
3787
+ intensity: number;
3788
+ position: THREE.Vector3;
3789
+ };
3790
+ ambientLight: {
3791
+ color: THREE.Color;
3792
+ intensity: number;
3793
+ };
3688
3794
  }
3689
- import { Base } from "./base";
3690
- import { World } from "./world";
3691
- import { Event } from "./event";
3692
- import { Components } from "../../Components";
3693
3795
  /**
3694
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
3796
+ * 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.
3695
3797
  */
3696
- export declare abstract class BaseWorldItem extends Base {
3697
- readonly worlds: Map<string, World>;
3798
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
3799
+ /** {@link Configurable.isSetup} */
3800
+ isSetup: boolean;
3698
3801
  /**
3699
- * Event that is triggered when a world is added or removed from the 'worlds' map.
3700
- * The event payload contains the world instance and the action ("added" or "removed").
3802
+ * The underlying Three.js scene object.
3803
+ * It is used to define the 3D space containing objects, lights, and cameras.
3701
3804
  */
3702
- readonly onWorldChanged: Event<{
3703
- world: World;
3704
- action: "added" | "removed";
3705
- }>;
3805
+ three: THREE.Scene;
3806
+ /** {@link Configurable.onSetup} */
3807
+ readonly onSetup: Event<SimpleScene>;
3706
3808
  /**
3707
- * The current world this item is associated with. It can be null if no world is currently active.
3809
+ * Configuration interface for the {@link SimpleScene}.
3810
+ * Defines properties for directional and ambient lights.
3708
3811
  */
3709
- currentWorld: World | null;
3710
- protected constructor(components: Components);
3812
+ config: Required<SimpleSceneConfig>;
3813
+ constructor(components: Components);
3814
+ /** {@link Configurable.setup} */
3815
+ setup(config?: Partial<SimpleSceneConfig>): void;
3711
3816
  }
3712
3817
  import * as THREE from "three";
3713
3818
  import CameraControls from "camera-controls";
3714
- import { BaseWorldItem } from "./base-world-item";
3715
- import { CameraControllable } from "./interfaces";
3819
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
3820
+ import { Components } from "../../Components";
3716
3821
  /**
3717
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
3822
+ * 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.
3718
3823
  */
3719
- export declare abstract class BaseCamera extends BaseWorldItem {
3824
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
3825
+ /** {@link Updateable.onBeforeUpdate} */
3826
+ readonly onBeforeUpdate: Event<SimpleCamera>;
3827
+ /** {@link Updateable.onAfterUpdate} */
3828
+ readonly onAfterUpdate: Event<SimpleCamera>;
3720
3829
  /**
3721
- * Whether the camera is enabled or not.
3830
+ * Event that is triggered when the aspect of the camera has been updated.
3831
+ * This event is useful when you need to perform actions after the aspect of the camera has been changed.
3722
3832
  */
3723
- abstract enabled: boolean;
3833
+ readonly onAspectUpdated: Event<unknown>;
3834
+ /** {@link Disposable.onDisposed} */
3835
+ readonly onDisposed: Event<string>;
3724
3836
  /**
3725
- * The Three.js camera instance.
3837
+ * A three.js PerspectiveCamera or OrthographicCamera instance.
3838
+ * This camera is used for rendering the scene.
3726
3839
  */
3727
- abstract three: THREE.Camera;
3840
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
3841
+ private _allControls;
3728
3842
  /**
3729
- * Optional CameraControls instance for controlling the camera.
3730
- * This property is only available if the camera is controllable.
3843
+ * The object that controls the camera. An instance of
3844
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
3845
+ * Transforming the camera directly will have no effect: you need to use this
3846
+ * object to move, rotate, look at objects, etc.
3731
3847
  */
3732
- abstract controls?: CameraControls;
3848
+ get controls(): CameraControls;
3733
3849
  /**
3734
- * Checks whether the instance is {@link CameraControllable}.
3850
+ * Getter for the enabled state of the camera controls.
3851
+ * If the current world is null, it returns false.
3852
+ * Otherwise, it returns the enabled state of the camera controls.
3735
3853
  *
3736
- * @returns True if the instance is controllable, false otherwise.
3854
+ * @returns {boolean} The enabled state of the camera controls.
3737
3855
  */
3738
- hasCameraControls: () => this is CameraControllable;
3739
- }
3740
- import * as THREE from "three";
3741
- import { Vector2 } from "three";
3742
- import { Event } from "./event";
3743
- import { BaseWorldItem } from "./base-world-item";
3744
- import { Disposable, Resizeable, Updateable } from "./interfaces";
3745
- /**
3746
- * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
3747
- */
3748
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
3856
+ get enabled(): boolean;
3749
3857
  /**
3750
- * The three.js WebGLRenderer instance associated with this renderer.
3858
+ * Setter for the enabled state of the camera controls.
3859
+ * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
3751
3860
  *
3752
- * @abstract
3753
- * @type {THREE.WebGLRenderer}
3861
+ * @param {boolean} enabled - The new enabled state of the camera controls.
3754
3862
  */
3755
- abstract three: THREE.WebGLRenderer;
3756
- /** {@link Updateable.onBeforeUpdate} */
3757
- onAfterUpdate: Event<unknown>;
3758
- /** {@link Updateable.onAfterUpdate} */
3759
- onBeforeUpdate: Event<unknown>;
3760
- /** {@link Disposable.onDisposed} */
3761
- readonly onDisposed: Event<undefined>;
3762
- /** {@link Resizeable.onResize} */
3763
- readonly onResize: Event<THREE.Vector2>;
3764
- /**
3765
- * Event that fires when there has been a change to the list of clipping
3766
- * planes used by the active renderer.
3767
- */
3768
- readonly onClippingPlanesUpdated: Event<unknown>;
3769
- /** {@link Updateable.update} */
3770
- abstract update(delta?: number): void | Promise<void>;
3863
+ set enabled(enabled: boolean);
3864
+ constructor(components: Components);
3771
3865
  /** {@link Disposable.dispose} */
3772
- abstract dispose(): void;
3773
- /** {@link Resizeable.getSize} */
3774
- abstract getSize(): Vector2;
3775
- /** {@link Resizeable.resize} */
3776
- abstract resize(size: Vector2 | undefined): void;
3777
- /**
3778
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
3779
- */
3780
- clippingPlanes: THREE.Plane[];
3781
- /**
3782
- * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
3783
- *
3784
- * @remarks
3785
- * This method is typically called when there is a change to the list of clipping planes
3786
- * used by the active renderer.
3787
- */
3788
- updateClippingPlanes(): void;
3866
+ dispose(): void;
3867
+ /** {@link Updateable.update} */
3868
+ update(_delta: number): void;
3789
3869
  /**
3790
- * Sets or removes a clipping plane from the renderer.
3791
- *
3792
- * @param active - A boolean indicating whether the clipping plane should be active or not.
3793
- * @param plane - The clipping plane to be added or removed.
3794
- * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
3795
- *
3796
- * @remarks
3797
- * This method adds or removes a clipping plane from the 'clippingPlanes' array.
3798
- * If 'active' is 'true' and the plane is not already in the array, it is added.
3799
- * If 'active' is 'false' and the plane is in the array, it is removed.
3800
- * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
3801
- * excluding any planes marked as local.
3870
+ * Updates the aspect of the camera to match the size of the
3871
+ * {@link Components.renderer}.
3802
3872
  */
3803
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
3873
+ updateAspect: () => void;
3874
+ private setupCamera;
3875
+ private newCameraControls;
3876
+ private setupEvents;
3877
+ private static getSubsetOfThree;
3804
3878
  }
3805
3879
  import * as THREE from "three";
3806
- import { Disposable } from "./interfaces";
3807
- import { Event } from "./event";
3880
+ import { Hideable, Event, World, Disposable } from "../../Types";
3808
3881
  import { Components } from "../../Components";
3809
- import { BaseWorldItem } from "./base-world-item";
3810
3882
  /**
3811
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
3812
- */
3813
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
3814
- /** {@link Disposable.onDisposed} */
3815
- readonly onDisposed: Event<unknown>;
3816
- /**
3817
- * Abstract property representing the three.js object associated with this scene.
3818
- * It should be implemented by subclasses.
3819
- */
3820
- abstract three: THREE.Object3D;
3821
- /** The set of directional lights managed by this scene component. */
3822
- directionalLights: Map<string, THREE.DirectionalLight>;
3823
- /** The set of ambient lights managed by this scene component. */
3824
- ambientLights: Map<string, THREE.AmbientLight>;
3825
- protected constructor(components: Components);
3826
- /** {@link Disposable.dispose} */
3827
- dispose(): void;
3828
- }
3829
- import * as THREE from "three";
3830
- import { BaseScene } from "./base-scene";
3831
- import { BaseCamera } from "./base-camera";
3832
- import { BaseRenderer } from "./base-renderer";
3833
- import { Updateable, Disposable } from "./interfaces";
3834
- /**
3835
- * Represents a 3D world with meshes, scene, camera, renderer, and other properties.
3883
+ * Configuration interface for the {@link SimpleGrid} class.
3836
3884
  */
3837
- export interface World extends Disposable, Updateable {
3838
- /**
3839
- * A set of meshes present in the world. This is taken into account for operations like raycasting.
3840
- */
3841
- meshes: Set<THREE.Mesh>;
3842
- /**
3843
- * The base scene of the world.
3844
- */
3845
- scene: BaseScene;
3885
+ export interface GridConfig {
3846
3886
  /**
3847
- * The base camera of the world.
3887
+ * The color of the grid lines.
3848
3888
  */
3849
- camera: BaseCamera;
3889
+ color: THREE.Color;
3850
3890
  /**
3851
- * The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
3891
+ * The size of the primary grid lines.
3852
3892
  */
3853
- renderer: BaseRenderer | null;
3893
+ size1: number;
3854
3894
  /**
3855
- * A unique identifier for the world.
3895
+ * The size of the secondary grid lines.
3856
3896
  */
3857
- uuid: string;
3897
+ size2: number;
3858
3898
  /**
3859
- * Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
3899
+ * The distance at which the grid lines start to fade away.
3860
3900
  */
3861
- isDisposing: boolean;
3901
+ distance: number;
3862
3902
  }
3863
- import { Event } from "./event";
3864
3903
  /**
3865
- * A class that extends the built-in Set class and provides additional functionality.
3866
- * It triggers events when items are added, deleted, or the set is cleared.
3867
- *
3868
- * @template T - The type of elements in the set.
3904
+ * 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).
3869
3905
  */
3870
- export declare class DataSet<T> extends Set<T> {
3871
- /**
3872
- * An event that is triggered when a new item is added to the set.
3873
- */
3874
- readonly onItemAdded: Event<T>;
3875
- /**
3876
- * An event that is triggered when an item is deleted from the set.
3877
- */
3878
- readonly onItemDeleted: Event<unknown>;
3879
- /**
3880
- * An event that is triggered when the set is cleared.
3881
- */
3882
- readonly onCleared: Event<unknown>;
3883
- /**
3884
- * Constructs a new instance of the DataSet class.
3885
- *
3886
- * @param iterable - An optional iterable object to initialize the set with.
3887
- */
3888
- constructor(iterable?: Iterable<T> | null);
3889
- /**
3890
- * Clears the set and triggers the onCleared event.
3891
- */
3892
- clear(): void;
3893
- /**
3894
- * Adds one or multiple values to the set and triggers the onItemAdded event per each.
3895
- *
3896
- * @param value - The value to add to the set.
3897
- * @returns - The set instance.
3898
- */
3899
- add(...value: T[]): this;
3900
- /**
3901
- * A function that acts as a guard for adding items to the set.
3902
- * It determines whether a given value should be allowed to be added to the set.
3903
- *
3904
- * @param value - The value to be checked against the guard.
3905
- * @returns A boolean indicating whether the value should be allowed to be added to the set.
3906
- * By default, this function always returns true, allowing all values to be added.
3907
- * You can override this behavior by providing a custom implementation.
3908
- */
3909
- guard: (value: T) => boolean;
3906
+ export declare class SimpleGrid implements Hideable, Disposable {
3907
+ /** {@link Disposable.onDisposed} */
3908
+ readonly onDisposed: Event<unknown>;
3909
+ /** The world instance to which this Raycaster belongs. */
3910
+ world: World;
3911
+ /** The components instance to which this grid belongs. */
3912
+ components: Components;
3913
+ /** {@link Hideable.visible} */
3914
+ get visible(): boolean;
3915
+ /** {@link Hideable.visible} */
3916
+ set visible(visible: boolean);
3917
+ /** The material of the grid. */
3918
+ get material(): THREE.ShaderMaterial;
3910
3919
  /**
3911
- * Deletes a value from the set and triggers the onItemDeleted event.
3912
- *
3913
- * @param value - The value to delete from the set.
3914
- * @returns - True if the value was successfully deleted, false otherwise.
3920
+ * Whether the grid should fade away with distance. Recommended to be true for
3921
+ * perspective cameras and false for orthographic cameras.
3915
3922
  */
3916
- delete(value: T): boolean;
3923
+ get fade(): boolean;
3917
3924
  /**
3918
- * Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
3925
+ * Whether the grid should fade away with distance. Recommended to be true for
3926
+ * perspective cameras and false for orthographic cameras.
3919
3927
  */
3928
+ set fade(active: boolean);
3929
+ /** The Three.js mesh that contains the infinite grid. */
3930
+ readonly three: THREE.Mesh;
3931
+ private _fade;
3932
+ constructor(components: Components, world: World, config: GridConfig);
3933
+ /** {@link Disposable.dispose} */
3920
3934
  dispose(): void;
3935
+ private setupEvents;
3936
+ private updateZoom;
3921
3937
  }
3922
- import { Event } from "./event";
3938
+ import { IfcRelName } from "./types";
3939
+ type IfcRelAttributePosition = {
3940
+ related: number;
3941
+ relating: number;
3942
+ };
3943
+ export declare const ifcRelAttrsPosition: Record<IfcRelName, IfcRelAttributePosition>;
3944
+ export {};
3945
+ import { IfcRelName } from "./types";
3946
+ import { IfcRelation } from "../../IfcRelationsIndexer";
3947
+ export declare const ifcRelClassNames: Record<IfcRelation, IfcRelName>;
3948
+ export type IfcRelationNames = [
3949
+ "IfcRelAssignsToControl",
3950
+ "IfcRelAssignsToGroup",
3951
+ "IfcRelAssignsToProduct",
3952
+ "IfcRelAssociatesClassification",
3953
+ "IfcRelAssociatesMaterial",
3954
+ "IfcRelAssociatesDocument",
3955
+ "IfcRelContainedInSpatialStructure",
3956
+ "IfcRelFlowControlElements",
3957
+ "IfcRelConnectsElements",
3958
+ "IfcRelDeclares",
3959
+ "IfcRelAggregates",
3960
+ "IfcRelNests",
3961
+ "IfcRelDefinesByProperties",
3962
+ "IfcRelDefinesByType",
3963
+ "IfcRelDefinesByTemplate"
3964
+ ];
3965
+ export type IfcRelName = IfcRelationNames[number];
3966
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3923
3967
  /**
3924
- * A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
3925
- *
3926
- * @template K - The type of keys in the map.
3927
- * @template V - The type of values in the map.
3968
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3928
3969
  */
3929
- export declare class DataMap<K, V> extends Map<K, V> {
3930
- /**
3931
- * An event triggered when a new item is set in the map.
3932
- */
3933
- readonly onItemSet: Event<{
3934
- key: K;
3935
- value: V;
3936
- }>;
3937
- /**
3938
- * An event triggered when an existing item in the map is updated.
3939
- */
3940
- readonly onItemUpdated: Event<{
3941
- key: K;
3942
- value: V;
3943
- }>;
3944
- /**
3945
- * An event triggered when an item is deleted from the map.
3946
- */
3947
- readonly onItemDeleted: Event<K>;
3948
- /**
3949
- * An event triggered when the map is cleared.
3950
- */
3951
- readonly onCleared: Event<unknown>;
3952
- /**
3953
- * Constructs a new DataMap instance.
3954
- *
3955
- * @param iterable - An iterable object containing key-value pairs to populate the map.
3956
- */
3957
- constructor(iterable?: Iterable<readonly [K, V]> | null | undefined);
3958
- /**
3959
- * Clears the map and triggers the onCleared event.
3960
- */
3961
- clear(): void;
3962
- /**
3963
- * Sets the value for the specified key in the map and triggers the appropriate event (onItemSet or onItemUpdated).
3964
- *
3965
- * @param key - The key of the item to set.
3966
- * @param value - The value of the item to set.
3967
- * @returns The DataMap instance.
3968
- */
3969
- set(key: K, value: V): this;
3970
- /**
3971
- * A function that acts as a guard for adding items to the set.
3972
- * It determines whether a given value should be allowed to be added to the set.
3973
- *
3974
- * @param key - The key of the entry to be checked against the guard.
3975
- * @param value - The value of the entry to be checked against the guard.
3976
- * @returns A boolean indicating whether the value should be allowed to be added to the set.
3977
- * By default, this function always returns true, allowing all values to be added.
3978
- * You can override this behavior by providing a custom implementation.
3979
- */
3980
- guard: (key: K, value: V) => boolean;
3981
- /**
3982
- * Deletes the specified key from the map and triggers the onItemDeleted event if the key was found.
3983
- *
3984
- * @param key - The key of the item to delete.
3985
- * @returns True if the key was found and deleted; otherwise, false.
3986
- */
3987
- delete(key: K): boolean;
3970
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3988
3971
  /**
3989
- * Clears the map and resets the events.
3972
+ * Amount of properties to be streamed.
3973
+ * Defaults to 100 properties.
3990
3974
  */
3991
- dispose(): void;
3975
+ propertiesSize: number;
3992
3976
  }
3993
- import * as THREE from "three";
3994
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3977
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
3995
3978
  /**
3996
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
3997
- *
3998
- * @template T - The type of the scene. Default is BaseScene.
3999
- * @template U - The type of the camera. Default is BaseCamera.
4000
- * @template S - The type of the renderer. Default is BaseRenderer.
3979
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
4001
3980
  */
4002
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
4003
- /**
4004
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
4005
- */
4006
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
4007
- /** {@link Updateable.onAfterUpdate} */
4008
- readonly onAfterUpdate: Event<unknown>;
4009
- /** {@link Updateable.onBeforeUpdate} */
4010
- readonly onBeforeUpdate: Event<unknown>;
4011
- /** {@link Disposable.onDisposed} */
4012
- readonly onDisposed: Event<unknown>;
3981
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
4013
3982
  /**
4014
- * 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.
3983
+ * Minimum number of geometries to be streamed.
3984
+ * Defaults to 10 geometries.
4015
3985
  */
4016
- isDisposing: boolean;
3986
+ minGeometrySize: number;
4017
3987
  /**
4018
- * Indicates whether the world is currently enabled.
4019
- * When disabled, the world will not be updated.
3988
+ * Minimum amount of assets to be streamed.
3989
+ * Defaults to 1000 assets.
4020
3990
  */
3991
+ minAssetsSize: number;
3992
+ }
3993
+ /**
3994
+ * 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.
3995
+ */
3996
+ export interface StreamedGeometries {
3997
+ [id: number]: {
3998
+ /** The bounding box of the geometry as a Float32Array. */
3999
+ boundingBox: Float32Array;
4000
+ /** A boolean indicating whether the geometry has holes. */
4001
+ hasHoles: boolean;
4002
+ /** An optional file path for the geometry data. */
4003
+ geometryFile?: string;
4004
+ };
4005
+ }
4006
+ /**
4007
+ * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
4008
+ */
4009
+ export interface StreamedAsset {
4010
+ /** The unique identifier of the asset. */
4011
+ id: number;
4012
+ /** An array of geometries associated with the asset. */
4013
+ geometries: {
4014
+ /** The unique identifier of the geometry. */
4015
+ geometryID: number;
4016
+ /** The transformation matrix of the geometry as a number array. */
4017
+ transformation: number[];
4018
+ /** The color of the geometry as a number array. */
4019
+ color: number[];
4020
+ }[];
4021
+ }
4022
+ import * as WEBIFC from "web-ifc";
4023
+ export type RelationsMap = Map<number, Map<number, number[]>>;
4024
+ export interface ModelsRelationMap {
4025
+ [modelID: string]: RelationsMap;
4026
+ }
4027
+ /**
4028
+ * Type alias for an array of inverse attribute names.
4029
+ */
4030
+ export type InverseAttributes = [
4031
+ "IsDecomposedBy",
4032
+ "Decomposes",
4033
+ "AssociatedTo",
4034
+ "HasAssociations",
4035
+ "ClassificationForObjects",
4036
+ "IsGroupedBy",
4037
+ "HasAssignments",
4038
+ "IsDefinedBy",
4039
+ "DefinesOcurrence",
4040
+ "IsTypedBy",
4041
+ "Types",
4042
+ "Defines",
4043
+ "ContainedInStructure",
4044
+ "ContainsElements",
4045
+ "HasControlElements",
4046
+ "AssignedToFlowElement",
4047
+ "ConnectedTo",
4048
+ "ConnectedFrom",
4049
+ "ReferencedBy",
4050
+ "Declares",
4051
+ "HasContext",
4052
+ "Controls",
4053
+ "IsNestedBy",
4054
+ "Nests",
4055
+ "DocumentRefForObjects"
4056
+ ];
4057
+ export type InverseAttribute = InverseAttributes[number];
4058
+ /**
4059
+ * Type alias for an array of IfcRelation types from WebIfc.
4060
+ */
4061
+ export type IfcRelations = [
4062
+ typeof WEBIFC.IFCRELAGGREGATES,
4063
+ typeof WEBIFC.IFCRELASSOCIATESMATERIAL,
4064
+ typeof WEBIFC.IFCRELASSOCIATESCLASSIFICATION,
4065
+ typeof WEBIFC.IFCRELASSIGNSTOGROUP,
4066
+ typeof WEBIFC.IFCRELDEFINESBYPROPERTIES,
4067
+ typeof WEBIFC.IFCRELDEFINESBYTYPE,
4068
+ typeof WEBIFC.IFCRELDEFINESBYTEMPLATE,
4069
+ typeof WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,
4070
+ typeof WEBIFC.IFCRELFLOWCONTROLELEMENTS,
4071
+ typeof WEBIFC.IFCRELCONNECTSELEMENTS,
4072
+ typeof WEBIFC.IFCRELASSIGNSTOPRODUCT,
4073
+ typeof WEBIFC.IFCRELDECLARES,
4074
+ typeof WEBIFC.IFCRELASSIGNSTOCONTROL,
4075
+ typeof WEBIFC.IFCRELNESTS,
4076
+ typeof WEBIFC.IFCRELASSOCIATESDOCUMENT
4077
+ ];
4078
+ export type IfcRelation = IfcRelations[number];
4079
+ import { NavigationMode } from "./types";
4080
+ import { OrthoPerspectiveCamera } from "../index";
4081
+ /**
4082
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
4083
+ */
4084
+ export declare class PlanMode implements NavigationMode {
4085
+ private camera;
4086
+ /** {@link NavigationMode.enabled} */
4021
4087
  enabled: boolean;
4088
+ /** {@link NavigationMode.id} */
4089
+ readonly id = "Plan";
4090
+ private mouseAction1?;
4091
+ private mouseAction2?;
4092
+ private mouseInitialized;
4093
+ private readonly defaultAzimuthSpeed;
4094
+ private readonly defaultPolarSpeed;
4095
+ constructor(camera: OrthoPerspectiveCamera);
4096
+ /** {@link NavigationMode.set} */
4097
+ set(active: boolean): void;
4098
+ }
4099
+ import { NavigationMode } from "./types";
4100
+ import { OrthoPerspectiveCamera } from "../index";
4101
+ /**
4102
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
4103
+ */
4104
+ export declare class OrbitMode implements NavigationMode {
4105
+ camera: OrthoPerspectiveCamera;
4106
+ /** {@link NavigationMode.enabled} */
4107
+ enabled: boolean;
4108
+ /** {@link NavigationMode.id} */
4109
+ readonly id = "Orbit";
4110
+ constructor(camera: OrthoPerspectiveCamera);
4111
+ /** {@link NavigationMode.set} */
4112
+ set(active: boolean): void;
4113
+ private activateOrbitControls;
4114
+ }
4115
+ import { NavigationMode } from "./types";
4116
+ import { OrthoPerspectiveCamera } from "../index";
4117
+ /**
4118
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
4119
+ */
4120
+ export declare class FirstPersonMode implements NavigationMode {
4121
+ private camera;
4122
+ /** {@link NavigationMode.enabled} */
4123
+ enabled: boolean;
4124
+ /** {@link NavigationMode.id} */
4125
+ readonly id = "FirstPerson";
4126
+ constructor(camera: OrthoPerspectiveCamera);
4127
+ /** {@link NavigationMode.set} */
4128
+ set(active: boolean): void;
4129
+ private setupFirstPersonCamera;
4130
+ }
4131
+ import * as THREE from "three";
4132
+ import { CameraProjection } from "./types";
4133
+ import { Event } from "../../Types";
4134
+ import { OrthoPerspectiveCamera } from "../index";
4135
+ /**
4136
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
4137
+ */
4138
+ export declare class ProjectionManager {
4022
4139
  /**
4023
- * A unique identifier for the world. Is not meant to be changed at any moment.
4024
- */
4025
- readonly uuid: string;
4026
- /**
4027
- * An optional name for the world.
4028
- */
4029
- name?: string;
4030
- private _scene?;
4031
- private _camera?;
4032
- private _renderer;
4033
- /**
4034
- * Getter for the scene. If no scene is initialized, it throws an error.
4035
- * @returns The current scene.
4036
- */
4037
- get scene(): T;
4038
- /**
4039
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
4040
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
4041
- * @param scene - The new scene to be set.
4140
+ * Event that fires when the {@link CameraProjection} changes.
4042
4141
  */
4043
- set scene(scene: T);
4142
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
4044
4143
  /**
4045
- * Getter for the camera. If no camera is initialized, it throws an error.
4046
- * @returns The current camera.
4144
+ * Current projection mode of the camera.
4145
+ * Default is "Perspective".
4047
4146
  */
4048
- get camera(): U;
4147
+ current: CameraProjection;
4049
4148
  /**
4050
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
4051
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
4052
- * @param camera - The new camera to be set.
4149
+ * The camera controlled by this ProjectionManager.
4150
+ * It can be either a PerspectiveCamera or an OrthographicCamera.
4053
4151
  */
4054
- set camera(camera: U);
4152
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
4153
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
4154
+ matchOrthoDistanceEnabled: boolean;
4155
+ private _component;
4156
+ private _previousDistance;
4157
+ constructor(camera: OrthoPerspectiveCamera);
4055
4158
  /**
4056
- * Getter for the renderer.
4057
- * @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).
4159
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
4160
+ *
4161
+ * @param projection - the new projection to set. If it is the current projection,
4162
+ * it will have no effect.
4058
4163
  */
4059
- get renderer(): S | null;
4164
+ set(projection: CameraProjection): Promise<void>;
4060
4165
  /**
4061
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
4062
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
4063
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
4064
- * @param renderer - The new renderer to be set or null to remove the current renderer.
4166
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
4167
+ * and vice versa.
4065
4168
  */
4066
- set renderer(renderer: S | null);
4067
- /** {@link Updateable.update} */
4068
- update(delta?: number): void;
4069
- /** {@link Disposable.dispose} */
4070
- dispose(disposeResources?: boolean): void;
4169
+ toggle(): Promise<void>;
4170
+ private setOrthoCamera;
4171
+ private getPerspectiveDims;
4172
+ private setupOrthoCamera;
4173
+ private getDistance;
4174
+ private setPerspectiveCamera;
4071
4175
  }
4072
- import * as THREE from "three";
4073
- import { BaseScene, Configurable, Event } from "../../Types";
4074
- import { Components } from "../../Components";
4075
4176
  /**
4076
- * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
4177
+ * The projection system of the camera.
4077
4178
  */
4078
- export interface SimpleSceneConfig {
4079
- directionalLight: {
4080
- color: THREE.Color;
4081
- intensity: number;
4082
- position: THREE.Vector3;
4083
- };
4084
- ambientLight: {
4085
- color: THREE.Color;
4086
- intensity: number;
4087
- };
4088
- }
4179
+ export type CameraProjection = "Perspective" | "Orthographic";
4089
4180
  /**
4090
- * 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.
4181
+ * The extensible list of supported navigation modes.
4091
4182
  */
4092
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
4093
- /** {@link Configurable.isSetup} */
4094
- isSetup: boolean;
4095
- /**
4096
- * The underlying Three.js scene object.
4097
- * It is used to define the 3D space containing objects, lights, and cameras.
4098
- */
4099
- three: THREE.Scene;
4100
- /** {@link Configurable.onSetup} */
4101
- readonly onSetup: Event<SimpleScene>;
4183
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
4184
+ /**
4185
+ * An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
4186
+ */
4187
+ export interface NavigationMode {
4188
+ /** The unique ID of this navigation mode. */
4189
+ id: NavModeID;
4102
4190
  /**
4103
- * Configuration interface for the {@link SimpleScene}.
4104
- * Defines properties for directional and ambient lights.
4105
- */
4106
- config: Required<SimpleSceneConfig>;
4107
- constructor(components: Components);
4108
- /** {@link Configurable.setup} */
4109
- setup(config?: Partial<SimpleSceneConfig>): void;
4191
+ * Enable or disable this navigation mode.
4192
+ * When a new navigation mode is enabled, the previous navigation mode
4193
+ * must be disabled.
4194
+ *
4195
+ * @param active - whether to enable or disable this mode.
4196
+ * @param options - any additional data required to enable or disable it.
4197
+ * */
4198
+ set: (active: boolean, options?: any) => void;
4199
+ /** Whether this navigation mode is active or not. */
4200
+ enabled: boolean;
4110
4201
  }
4111
4202
  import * as THREE from "three";
4112
- import { BaseRenderer, Event } from "../../Types";
4203
+ import * as WEBIFC from "web-ifc";
4204
+ import * as FRAGS from "@thatopen/fragments";
4205
+ export declare class CivilReader {
4206
+ defLineMat: THREE.LineBasicMaterial;
4207
+ read(webIfc: WEBIFC.IfcAPI): {
4208
+ alignments: Map<number, FRAGS.Alignment>;
4209
+ coordinationMatrix: THREE.Matrix4;
4210
+ } | undefined;
4211
+ get(civilItems: any): {
4212
+ alignments: Map<number, FRAGS.Alignment>;
4213
+ coordinationMatrix: THREE.Matrix4;
4214
+ } | undefined;
4215
+ private getCurves;
4216
+ }
4217
+ import * as THREE from "three";
4218
+ import { Hideable, Disposable, Event, World } from "../../Types";
4113
4219
  import { Components } from "../../Components";
4114
4220
  /**
4115
- * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
4221
+ * Each of the clipping planes created by the clipper.
4116
4222
  */
4117
- export declare class SimpleRenderer extends BaseRenderer {
4223
+ export declare class SimplePlane implements Disposable, Hideable {
4224
+ /** Event that fires when the user starts dragging a clipping plane. */
4225
+ readonly onDraggingStarted: Event<unknown>;
4226
+ /** Event that fires when the user stops dragging a clipping plane. */
4227
+ readonly onDraggingEnded: Event<unknown>;
4228
+ /** {@link Disposable.onDisposed} */
4229
+ readonly onDisposed: Event<unknown>;
4118
4230
  /**
4119
- * Indicates whether the renderer is enabled. If it's not, it won't be updated.
4120
- * Default is 'true'.
4231
+ * The normal vector of the clipping plane.
4121
4232
  */
4122
- enabled: boolean;
4233
+ readonly normal: THREE.Vector3;
4123
4234
  /**
4124
- * The HTML container of the THREE.js canvas where the scene is rendered.
4235
+ * The origin point of the clipping plane.
4125
4236
  */
4126
- container: HTMLElement;
4237
+ readonly origin: THREE.Vector3;
4127
4238
  /**
4128
- * The THREE.js WebGLRenderer instance.
4239
+ * The THREE.js Plane object representing the clipping plane.
4129
4240
  */
4130
- three: THREE.WebGLRenderer;
4131
- protected _canvas: HTMLCanvasElement;
4132
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
4133
- protected _resizeObserver: ResizeObserver | null;
4134
- protected onContainerUpdated: Event<unknown>;
4135
- private _resizing;
4241
+ readonly three: THREE.Plane;
4242
+ /** The components instance to which this plane belongs. */
4243
+ components: Components;
4244
+ /** The world instance to which this plane belongs. */
4245
+ world: World;
4246
+ /** A custom string to identify what this plane is used for. */
4247
+ type: string;
4248
+ protected readonly _helper: THREE.Object3D;
4249
+ protected _visible: boolean;
4250
+ protected _enabled: boolean;
4251
+ private _controlsActive;
4252
+ private readonly _arrowBoundBox;
4253
+ private readonly _planeMesh;
4254
+ private readonly _controls;
4255
+ private readonly _hiddenMaterial;
4136
4256
  /**
4137
- * Constructor for the SimpleRenderer class.
4257
+ * Getter for the enabled state of the clipping plane.
4258
+ * @returns {boolean} The current enabled state.
4259
+ */
4260
+ get enabled(): boolean;
4261
+ /**
4262
+ * Setter for the enabled state of the clipping plane.
4263
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
4264
+ * @param {boolean} state - The new enabled state.
4265
+ */
4266
+ set enabled(state: boolean);
4267
+ /** {@link Hideable.visible } */
4268
+ get visible(): boolean;
4269
+ /** {@link Hideable.visible } */
4270
+ set visible(state: boolean);
4271
+ /** The meshes used for raycasting */
4272
+ get meshes(): THREE.Mesh[];
4273
+ /** The material of the clipping plane representation. */
4274
+ get planeMaterial(): THREE.Material | THREE.Material[];
4275
+ /** The material of the clipping plane representation. */
4276
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
4277
+ /** The size of the clipping plane representation. */
4278
+ get size(): number;
4279
+ /** Sets the size of the clipping plane representation. */
4280
+ set size(size: number);
4281
+ /**
4282
+ * Getter for the helper object of the clipping plane.
4283
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
4284
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
4138
4285
  *
4139
- * @param components - The components instance.
4140
- * @param container - The HTML container where the THREE.js canvas will be rendered.
4141
- * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
4286
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
4142
4287
  */
4143
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
4144
- /** {@link Updateable.update} */
4145
- update(): void;
4146
- /** {@link Disposable.dispose} */
4147
- dispose(): void;
4148
- /** {@link Resizeable.getSize}. */
4149
- getSize(): THREE.Vector2;
4150
- /** {@link Resizeable.resize} */
4151
- resize: (size?: THREE.Vector2) => void;
4288
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
4289
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
4152
4290
  /**
4153
- * Sets up and manages the event listeners for the renderer.
4291
+ * Sets the clipping plane's normal and origin from the given normal and point.
4292
+ * This method resets the clipping plane's state, updates the normal and origin,
4293
+ * and positions the helper object accordingly.
4154
4294
  *
4155
- * @param active - A boolean indicating whether to activate or deactivate the event listeners.
4295
+ * @param normal - The new normal vector for the clipping plane.
4296
+ * @param point - The new origin point for the clipping plane.
4156
4297
  *
4157
- * @throws Will throw an error if the renderer does not have an HTML container.
4298
+ * @returns {void}
4158
4299
  */
4159
- setupEvents(active: boolean): void;
4160
- private resizeEvent;
4161
- private setupRenderer;
4162
- private onContextLost;
4163
- private onContextBack;
4300
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
4301
+ /** {@link Updateable.update} */
4302
+ update: () => void;
4303
+ /** {@link Disposable.dispose} */
4304
+ dispose(): void;
4305
+ private reset;
4306
+ protected toggleControls(state: boolean): void;
4307
+ private newTransformControls;
4308
+ private initializeControls;
4309
+ private createArrowBoundingBox;
4310
+ private changeDrag;
4311
+ private notifyDraggingChanged;
4312
+ private preventCameraMovement;
4313
+ private newHelper;
4314
+ private static newPlaneMesh;
4164
4315
  }
4165
4316
  import * as THREE from "three";
4166
- import CameraControls from "camera-controls";
4167
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
4317
+ import { Event, World } from "../../Types";
4168
4318
  import { Components } from "../../Components";
4169
4319
  /**
4170
- * 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.
4320
+ * A base renderer to determine visibility on screen.
4171
4321
  */
4172
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
4173
- /** {@link Updateable.onBeforeUpdate} */
4174
- readonly onBeforeUpdate: Event<SimpleCamera>;
4175
- /** {@link Updateable.onAfterUpdate} */
4176
- readonly onAfterUpdate: Event<SimpleCamera>;
4177
- /**
4178
- * Event that is triggered when the aspect of the camera has been updated.
4179
- * This event is useful when you need to perform actions after the aspect of the camera has been changed.
4180
- */
4181
- readonly onAspectUpdated: Event<unknown>;
4322
+ export declare class DistanceRenderer {
4182
4323
  /** {@link Disposable.onDisposed} */
4183
4324
  readonly onDisposed: Event<string>;
4184
4325
  /**
4185
- * A three.js PerspectiveCamera or OrthographicCamera instance.
4186
- * This camera is used for rendering the scene.
4326
+ * Fires after making the visibility check to the meshes. It lists the
4327
+ * meshes that are currently visible, and the ones that were visible
4328
+ * just before but not anymore.
4187
4329
  */
4188
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
4189
- private _allControls;
4330
+ readonly onDistanceComputed: Event<number>;
4190
4331
  /**
4191
- * The object that controls the camera. An instance of
4192
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
4193
- * Transforming the camera directly will have no effect: you need to use this
4194
- * object to move, rotate, look at objects, etc.
4332
+ * Objects that won't be taken into account in the distance check.
4195
4333
  */
4196
- get controls(): CameraControls;
4334
+ excludedObjects: Set<THREE.Object3D<THREE.Object3DEventMap>>;
4197
4335
  /**
4198
- * Getter for the enabled state of the camera controls.
4199
- * If the current world is null, it returns false.
4200
- * Otherwise, it returns the enabled state of the camera controls.
4201
- *
4202
- * @returns {boolean} The enabled state of the camera controls.
4336
+ * Whether this renderer is active or not. If not, it won't render anything.
4203
4337
  */
4204
- get enabled(): boolean;
4338
+ enabled: boolean;
4205
4339
  /**
4206
- * Setter for the enabled state of the camera controls.
4207
- * If the current world is not null, it sets the enabled state of the camera controls to the provided value.
4208
- *
4209
- * @param {boolean} enabled - The new enabled state of the camera controls.
4340
+ * Render the internal scene used to determine the object visibility. Used
4341
+ * for debugging purposes.
4210
4342
  */
4211
- set enabled(enabled: boolean);
4212
- constructor(components: Components);
4213
- /** {@link Disposable.dispose} */
4214
- dispose(): void;
4215
- /** {@link Updateable.update} */
4216
- update(_delta: number): void;
4343
+ renderDebugFrame: boolean;
4344
+ /** The components instance to which this renderer belongs. */
4345
+ components: Components;
4217
4346
  /**
4218
- * Updates the aspect of the camera to match the size of the
4219
- * {@link Components.renderer}.
4347
+ * The scene where the distance is computed.
4220
4348
  */
4221
- updateAspect: () => void;
4222
- private setupCamera;
4223
- private newCameraControls;
4224
- private setupEvents;
4225
- private static getSubsetOfThree;
4226
- }
4227
- import { IfcFragmentSettings } from "../../IfcLoader/src";
4228
- /**
4229
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
4230
- */
4231
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
4349
+ scene: THREE.Scene;
4232
4350
  /**
4233
- * Minimum number of geometries to be streamed.
4234
- * Defaults to 10 geometries.
4351
+ * The camera used to compute the distance.
4235
4352
  */
4236
- minGeometrySize: number;
4353
+ camera: THREE.OrthographicCamera;
4237
4354
  /**
4238
- * Minimum amount of assets to be streamed.
4239
- * Defaults to 1000 assets.
4355
+ * The material used to compute the distance.
4240
4356
  */
4241
- minAssetsSize: number;
4242
- }
4243
- import { IfcFragmentSettings } from "../../IfcLoader/src";
4244
- /**
4245
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
4246
- */
4247
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
4357
+ depthMaterial: THREE.ShaderMaterial;
4358
+ /** The world instance to which this renderer belongs. */
4359
+ readonly world: World;
4360
+ /** The THREE.js renderer used to make the visibility test. */
4361
+ readonly renderer: THREE.WebGLRenderer;
4362
+ protected readonly worker: Worker;
4363
+ private _width;
4364
+ private _height;
4365
+ private readonly _postQuad;
4366
+ private readonly tempRT;
4367
+ private readonly resultRT;
4368
+ private readonly bufferSize;
4369
+ private readonly _buffer;
4370
+ protected _isWorkerBusy: boolean;
4371
+ constructor(components: Components, world: World);
4372
+ /** {@link Disposable.dispose} */
4373
+ dispose(): void;
4248
4374
  /**
4249
- * Amount of properties to be streamed.
4250
- * Defaults to 100 properties.
4375
+ * The function that the culler uses to reprocess the scene. Generally it's
4376
+ * better to call needsUpdate, but you can also call this to force it.
4377
+ * @param force if true, it will refresh the scene even if needsUpdate is
4378
+ * not true.
4251
4379
  */
4252
- propertiesSize: number;
4253
- }
4254
- /**
4255
- * 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.
4256
- */
4257
- export interface StreamedGeometries {
4258
- [id: number]: {
4259
- /** The bounding box of the geometry as a Float32Array. */
4260
- boundingBox: Float32Array;
4261
- /** A boolean indicating whether the geometry has holes. */
4262
- hasHoles: boolean;
4263
- /** An optional file path for the geometry data. */
4264
- geometryFile?: string;
4265
- };
4266
- }
4267
- /**
4268
- * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
4269
- */
4270
- export interface StreamedAsset {
4271
- /** The unique identifier of the asset. */
4272
- id: number;
4273
- /** An array of geometries associated with the asset. */
4274
- geometries: {
4275
- /** The unique identifier of the geometry. */
4276
- geometryID: number;
4277
- /** The transformation matrix of the geometry as a number array. */
4278
- transformation: number[];
4279
- /** The color of the geometry as a number array. */
4280
- color: number[];
4281
- }[];
4282
- }
4283
- import * as THREE from "three";
4284
- import * as WEBIFC from "web-ifc";
4285
- import * as FRAGS from "@thatopen/fragments";
4286
- export declare class CivilReader {
4287
- defLineMat: THREE.LineBasicMaterial;
4288
- read(webIfc: WEBIFC.IfcAPI): {
4289
- alignments: Map<number, FRAGS.Alignment>;
4290
- coordinationMatrix: THREE.Matrix4;
4291
- } | undefined;
4292
- get(civilItems: any): {
4293
- alignments: Map<number, FRAGS.Alignment>;
4294
- coordinationMatrix: THREE.Matrix4;
4295
- } | undefined;
4296
- private getCurves;
4380
+ compute: () => Promise<void>;
4381
+ private handleWorkerMessage;
4297
4382
  }
4298
4383
  import * as WEBIFC from "web-ifc";
4299
4384
  export declare class IfcMetadataReader {
4300
4385
  getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4301
4386
  getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
4302
4387
  }
4388
+ import * as WEBIFC from "web-ifc";
4389
+ import * as THREE from "three";
4390
+ export declare class Units {
4391
+ factor: number;
4392
+ complement: number;
4393
+ apply(matrix: THREE.Matrix4): void;
4394
+ setUp(webIfc: WEBIFC.IfcAPI): void;
4395
+ private getLengthUnits;
4396
+ private getScaleMatrix;
4397
+ }
4303
4398
  import { Components } from "../../../core/Components";
4304
4399
  import { Viewpoint } from "../../../core/Viewpoints";
4305
4400
  import { Comment } from "./Comment";
@@ -4514,103 +4609,8 @@ export interface BCFTopicsConfig {
4514
4609
  */
4515
4610
  ignoreIncompleteTopicsOnImport: boolean;
4516
4611
  }
4517
- import { IfcRelName } from "./types";
4518
- type IfcRelAttributePosition = {
4519
- related: number;
4520
- relating: number;
4521
- };
4522
- export declare const ifcRelAttrsPosition: Record<IfcRelName, IfcRelAttributePosition>;
4523
- export {};
4524
- import { IfcRelName } from "./types";
4525
- import { IfcRelation } from "../../IfcRelationsIndexer";
4526
- export declare const ifcRelClassNames: Record<IfcRelation, IfcRelName>;
4527
- export type IfcRelationNames = [
4528
- "IfcRelAssignsToControl",
4529
- "IfcRelAssignsToGroup",
4530
- "IfcRelAssignsToProduct",
4531
- "IfcRelAssociatesClassification",
4532
- "IfcRelAssociatesMaterial",
4533
- "IfcRelAssociatesDocument",
4534
- "IfcRelContainedInSpatialStructure",
4535
- "IfcRelFlowControlElements",
4536
- "IfcRelConnectsElements",
4537
- "IfcRelDeclares",
4538
- "IfcRelAggregates",
4539
- "IfcRelNests",
4540
- "IfcRelDefinesByProperties",
4541
- "IfcRelDefinesByType",
4542
- "IfcRelDefinesByTemplate"
4543
- ];
4544
- export type IfcRelName = IfcRelationNames[number];
4545
- import * as WEBIFC from "web-ifc";
4546
- import * as THREE from "three";
4547
- export declare class Units {
4548
- factor: number;
4549
- complement: number;
4550
- apply(matrix: THREE.Matrix4): void;
4551
- setUp(webIfc: WEBIFC.IfcAPI): void;
4552
- private getLengthUnits;
4553
- private getScaleMatrix;
4554
- }
4555
4612
  import { BCFTopics } from "../..";
4556
4613
  export declare const extensionsImporter: (manager: BCFTopics, extensionsXML: string) => void;
4557
- import * as WEBIFC from "web-ifc";
4558
- export type RelationsMap = Map<number, Map<number, number[]>>;
4559
- export interface ModelsRelationMap {
4560
- [modelID: string]: RelationsMap;
4561
- }
4562
- /**
4563
- * Type alias for an array of inverse attribute names.
4564
- */
4565
- export type InverseAttributes = [
4566
- "IsDecomposedBy",
4567
- "Decomposes",
4568
- "AssociatedTo",
4569
- "HasAssociations",
4570
- "ClassificationForObjects",
4571
- "IsGroupedBy",
4572
- "HasAssignments",
4573
- "IsDefinedBy",
4574
- "DefinesOcurrence",
4575
- "IsTypedBy",
4576
- "Types",
4577
- "Defines",
4578
- "ContainedInStructure",
4579
- "ContainsElements",
4580
- "HasControlElements",
4581
- "AssignedToFlowElement",
4582
- "ConnectedTo",
4583
- "ConnectedFrom",
4584
- "ReferencedBy",
4585
- "Declares",
4586
- "HasContext",
4587
- "Controls",
4588
- "IsNestedBy",
4589
- "Nests",
4590
- "DocumentRefForObjects"
4591
- ];
4592
- export type InverseAttribute = InverseAttributes[number];
4593
- /**
4594
- * Type alias for an array of IfcRelation types from WebIfc.
4595
- */
4596
- export type IfcRelations = [
4597
- typeof WEBIFC.IFCRELAGGREGATES,
4598
- typeof WEBIFC.IFCRELASSOCIATESMATERIAL,
4599
- typeof WEBIFC.IFCRELASSOCIATESCLASSIFICATION,
4600
- typeof WEBIFC.IFCRELASSIGNSTOGROUP,
4601
- typeof WEBIFC.IFCRELDEFINESBYPROPERTIES,
4602
- typeof WEBIFC.IFCRELDEFINESBYTYPE,
4603
- typeof WEBIFC.IFCRELDEFINESBYTEMPLATE,
4604
- typeof WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,
4605
- typeof WEBIFC.IFCRELFLOWCONTROLELEMENTS,
4606
- typeof WEBIFC.IFCRELCONNECTSELEMENTS,
4607
- typeof WEBIFC.IFCRELASSIGNSTOPRODUCT,
4608
- typeof WEBIFC.IFCRELDECLARES,
4609
- typeof WEBIFC.IFCRELASSIGNSTOCONTROL,
4610
- typeof WEBIFC.IFCRELNESTS,
4611
- typeof WEBIFC.IFCRELASSOCIATESDOCUMENT
4612
- ];
4613
- export type IfcRelation = IfcRelations[number];
4614
4614
  import { BufferGeometry } from "three";
4615
4615
  import * as THREE from "three";
4616
4616
  export declare class TransformHelper {