@thatopen/components 2.0.0-alpha.15 → 2.0.0-alpha.16

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.
@@ -42,58 +42,6 @@ export declare class Disposer extends Component {
42
42
  private disposeChildren;
43
43
  private static disposeMaterial;
44
44
  }
45
- import { Component, Disposable, Event } from "../Types";
46
- /**
47
- * The entry point of the Components library.
48
- * It can:
49
- * - Create and access all the components of the library.
50
- * - Update all the updatable components automatically.
51
- * - Dispose all the components, preventing memory leaks.
52
- */
53
- export declare class Components implements Disposable {
54
- static readonly release = "1.4.21";
55
- /** {@link Disposable.onDisposed} */
56
- readonly onDisposed: Event<void>;
57
- /** The list of components created in this app. */
58
- readonly list: Map<string, Component>;
59
- /** If disabled, the animation loop will be stopped. */
60
- enabled: boolean;
61
- private _clock;
62
- add(uuid: string, instance: Component): void;
63
- /**
64
- * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
65
- * doesn't exist, it will instance it automatically.
66
- *
67
- * @param Component - The component to get or create.
68
- */
69
- get<U extends Component>(Component: new (components: Components) => U): U;
70
- constructor();
71
- /**
72
- * Initializes the library. It should be called at the start of the app after
73
- * initializing the scene, the renderer and the
74
- * camera. Additionally, if any component that need a raycaster is
75
- * used, the {@link raycaster} will need to be initialized.
76
- */
77
- init(): void;
78
- /**
79
- * Disposes the memory of all the components and tools of this instance of
80
- * the library. A memory leak will be created if:
81
- *
82
- * - An instance of the library ends up out of scope and this function isn't
83
- * called. This is especially relevant in Single Page Applications (React,
84
- * Angular, Vue, etc).
85
- *
86
- * - Any of the objects of this instance (meshes, geometries, etc) is
87
- * referenced by a reference type (object or array).
88
- *
89
- * You can learn more about how Three.js handles memory leaks
90
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
91
- *
92
- */
93
- dispose(): void;
94
- private update;
95
- private static setupBVH;
96
- }
97
45
  import { Component, Disposable, World, Event } from "../Types";
98
46
  import { SimpleRaycaster } from "./src";
99
47
  import { Components } from "../Components";
@@ -111,18 +59,82 @@ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera,
111
59
  import { Components } from "../Components";
112
60
  import { SimpleWorld } from "./src";
113
61
  export declare class Worlds extends Component implements Updateable, Disposable {
62
+ /**
63
+ * A unique identifier for the component.
64
+ * This UUID is used to register the component within the Components system.
65
+ */
114
66
  static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
67
+ /**
68
+ * Event triggered after the update process of all worlds.
69
+ * Subscribers can listen to this event to perform actions post-update.
70
+ */
115
71
  readonly onAfterUpdate: Event<unknown>;
72
+ /**
73
+ * Event triggered before the update process of all worlds.
74
+ * Subscribers can listen to this event to perform actions pre-update.
75
+ */
116
76
  readonly onBeforeUpdate: Event<unknown>;
77
+ /**
78
+ * Event triggered when the Worlds component is disposed.
79
+ * Subscribers can listen to this event to perform cleanup actions.
80
+ */
117
81
  readonly onDisposed: Event<unknown>;
82
+ /**
83
+ * A collection of worlds managed by this component.
84
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
85
+ */
118
86
  list: Map<string, World>;
87
+ /**
88
+ * A flag indicating whether the Worlds component is enabled.
89
+ * If false, the update process will be skipped.
90
+ */
119
91
  enabled: boolean;
120
92
  constructor(components: Components);
93
+ /**
94
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
95
+ *
96
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
97
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
98
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
99
+ *
100
+ * @returns {SimpleWorld<T, U, S>} - The newly created SimpleWorld instance.
101
+ *
102
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
103
+ */
121
104
  create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
122
105
  delete(world: World): void;
123
106
  dispose(): void;
124
107
  update(delta?: number): void | Promise<void>;
125
108
  }
109
+ import { MiniMap } from "./src";
110
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
111
+ import { Components } from "../Components";
112
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
113
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
114
+ readonly onAfterUpdate: Event<unknown>;
115
+ readonly onBeforeUpdate: Event<unknown>;
116
+ readonly onDisposed: Event<unknown>;
117
+ enabled: boolean;
118
+ list: Map<string, MiniMap>;
119
+ constructor(components: Components);
120
+ create(world: World): MiniMap;
121
+ delete(id: string): void;
122
+ dispose(): void;
123
+ update(): void;
124
+ }
125
+ import { Component, Disposable, World, Event } from "../Types";
126
+ import { GridConfig, SimpleGrid } from "./src";
127
+ export declare class Grids extends Component implements Disposable {
128
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
129
+ list: Map<string, SimpleGrid>;
130
+ onDisposed: Event<unknown>;
131
+ config: Required<GridConfig>;
132
+ /** {@link Component.enabled} */
133
+ enabled: boolean;
134
+ create(world: World): SimpleGrid;
135
+ delete(world: World): void;
136
+ dispose(): void;
137
+ }
126
138
  import * as THREE from "three";
127
139
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
128
140
  import { SimplePlane } from "./src";
@@ -222,21 +234,109 @@ export declare class Clipper extends Component implements Createable, Disposable
222
234
  private _onStartDragging;
223
235
  private _onEndDragging;
224
236
  }
225
- import { MiniMap } from "./src";
226
- import { Component, Updateable, World, Event, Disposable } from "../Types";
237
+ import { Component, Disposable, Event } from "../Types";
238
+ /**
239
+ * The entry point of the Components library.
240
+ * It can:
241
+ * - Create and access all the components of the library.
242
+ * - Update all the updatable components automatically.
243
+ * - Dispose all the components, preventing memory leaks.
244
+ */
245
+ export declare class Components implements Disposable {
246
+ static readonly release = "1.4.21";
247
+ /** {@link Disposable.onDisposed} */
248
+ readonly onDisposed: Event<void>;
249
+ /** The list of components created in this app. */
250
+ readonly list: Map<string, Component>;
251
+ /** If disabled, the animation loop will be stopped. */
252
+ enabled: boolean;
253
+ private _clock;
254
+ add(uuid: string, instance: Component): void;
255
+ /**
256
+ * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
257
+ * doesn't exist, it will instance it automatically.
258
+ *
259
+ * @param Component - The component to get or create.
260
+ */
261
+ get<U extends Component>(Component: new (components: Components) => U): U;
262
+ constructor();
263
+ /**
264
+ * Initializes the library. It should be called at the start of the app after
265
+ * initializing the scene, the renderer and the
266
+ * camera. Additionally, if any component that need a raycaster is
267
+ * used, the {@link raycaster} will need to be initialized.
268
+ */
269
+ init(): void;
270
+ /**
271
+ * Disposes the memory of all the components and tools of this instance of
272
+ * the library. A memory leak will be created if:
273
+ *
274
+ * - An instance of the library ends up out of scope and this function isn't
275
+ * called. This is especially relevant in Single Page Applications (React,
276
+ * Angular, Vue, etc).
277
+ *
278
+ * - Any of the objects of this instance (meshes, geometries, etc) is
279
+ * referenced by a reference type (object or array).
280
+ *
281
+ * You can learn more about how Three.js handles memory leaks
282
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
283
+ *
284
+ */
285
+ dispose(): void;
286
+ private update;
287
+ private static setupBVH;
288
+ }
227
289
  import { Components } from "../Components";
228
- export declare class MiniMaps extends Component implements Updateable, Disposable {
229
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
230
- readonly onAfterUpdate: Event<unknown>;
231
- readonly onBeforeUpdate: Event<unknown>;
290
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
291
+ import { Component, Event, Disposable, World } from "../Types";
292
+ /**
293
+ * A tool to handle big scenes efficiently by automatically hiding the objects
294
+ * that are not visible to the camera.
295
+ */
296
+ export declare class Cullers extends Component implements Disposable {
297
+ /**
298
+ * A unique identifier for the Cullers component.
299
+ */
300
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
301
+ /**
302
+ * Indicates whether the Cullers component is enabled.
303
+ */
304
+ private _enabled;
305
+ /**
306
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
307
+ */
308
+ list: Map<string, MeshCullerRenderer>;
309
+ /**
310
+ * An event that is triggered when the Cullers component is disposed.
311
+ */
232
312
  readonly onDisposed: Event<unknown>;
233
- enabled: boolean;
234
- list: Map<string, MiniMap>;
313
+ /**
314
+ * Gets the enabled state of the Cullers component.
315
+ *
316
+ * @returns The current enabled state.
317
+ */
318
+ get enabled(): boolean;
319
+ /**
320
+ * Sets the enabled state of the Cullers component.
321
+ * Also sets the enabled state of all MeshCullerRenderer instances.
322
+ *
323
+ * @param value - The new enabled state.
324
+ */
325
+ set enabled(value: boolean);
235
326
  constructor(components: Components);
236
- create(world: World): MiniMap;
237
- delete(id: string): void;
327
+ /**
328
+ * Creates a new MeshCullerRenderer for the given world.
329
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
330
+ *
331
+ * @param world - The world for which to create the MeshCullerRenderer.
332
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
333
+ *
334
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
335
+ */
336
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
337
+ delete(world: World): void;
338
+ /** {@link Disposable.dispose} */
238
339
  dispose(): void;
239
- update(): void;
240
340
  }
241
341
  import * as THREE from "three";
242
342
  import { Components } from "../Components";
@@ -288,157 +388,146 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
288
388
  private newOrthoCamera;
289
389
  private setOrthoCameraAspect;
290
390
  }
291
- import { Components } from "../Components";
292
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
293
- import { Component, Event, Disposable, World } from "../Types";
391
+ import * as THREE from "three";
392
+ import * as FRAGS from "@thatopen/fragments";
393
+ import { FragmentsGroup } from "@thatopen/fragments";
394
+ import { Component, Components, Disposable, Event } from "../../core";
294
395
  /**
295
- * A tool to handle big scenes efficiently by automatically hiding the objects
296
- * that are not visible to the camera.
396
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
397
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
297
398
  */
298
- export declare class Cullers extends Component implements Disposable {
299
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
300
- private _enabled;
301
- list: Map<string, MeshCullerRenderer>;
399
+ export declare class BoundingBoxer extends Component implements Disposable {
400
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
401
+ /** {@link Component.enabled} */
402
+ enabled: boolean;
302
403
  /** {@link Disposable.onDisposed} */
303
404
  readonly onDisposed: Event<unknown>;
304
- /** {@link Component.enabled} */
305
- get enabled(): boolean;
306
- set enabled(value: boolean);
405
+ private _absoluteMin;
406
+ private _absoluteMax;
407
+ private _meshes;
307
408
  constructor(components: Components);
308
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
309
- delete(world: World): void;
409
+ static getDimensions(bbox: THREE.Box3): {
410
+ width: number;
411
+ height: number;
412
+ depth: number;
413
+ center: THREE.Vector3;
414
+ };
415
+ static newBound(positive: boolean): THREE.Vector3;
416
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
310
417
  /** {@link Disposable.dispose} */
311
418
  dispose(): void;
419
+ get(): THREE.Box3;
420
+ getSphere(): THREE.Sphere;
421
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
422
+ reset(): void;
423
+ add(group: FragmentsGroup): void;
424
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
425
+ private static getFragmentBounds;
312
426
  }
313
- import * as WEBIFC from "web-ifc";
314
- import * as FRAG from "@thatopen/fragments";
315
- import { Component, Components } from "../../core";
316
- /**
317
- * Object to export all the properties from an IFC to a JS object.
318
- */
319
- export declare class IfcJsonExporter extends Component {
320
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
321
- /** {@link Component.enabled} */
427
+ import * as THREE from "three";
428
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
429
+ center: THREE.Vector3;
430
+ halfSizes: THREE.Vector3;
431
+ rotation: THREE.Matrix3;
432
+ transformation: THREE.Matrix4;
433
+ };
434
+ import * as FRAGS from "@thatopen/fragments";
435
+ import { Components, Component } from "../../core";
436
+ export declare class FragmentHider extends Component {
437
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
322
438
  enabled: boolean;
323
439
  constructor(components: Components);
324
- /**
325
- * Exports all the properties of an IFC into an array of JS objects.
326
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
327
- * @param modelID ID of the IFC model whose properties to extract.
328
- * @param indirect whether to get the indirect relationships as well.
329
- * @param recursiveSpatial whether to get the properties of spatial items recursively
330
- * to make the location data available (e.g. absolute position of building).
331
- */
332
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
333
- }
334
- import { Component, Disposable, World, Event } from "../Types";
335
- import { GridConfig, SimpleGrid } from "./src";
336
- export declare class Grids extends Component implements Disposable {
337
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
338
- list: Map<string, SimpleGrid>;
339
- onDisposed: Event<unknown>;
340
- config: Required<GridConfig>;
341
- /** {@link Component.enabled} */
342
- enabled: boolean;
343
- create(world: World): SimpleGrid;
344
- delete(world: World): void;
345
- dispose(): void;
440
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
441
+ isolate(items: FRAGS.FragmentIdMap): void;
442
+ private updateCulledVisibility;
346
443
  }
347
- import * as WEBIFC from "web-ifc";
348
- import { FragmentsGroup } from "@thatopen/fragments";
349
- import { Component, Disposable, Event, Components } from "../../core";
350
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
351
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
352
- type NumericPropTypes = "IfcInteger" | "IfcReal";
353
- interface ChangeMap {
354
- [modelID: string]: Set<number>;
444
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
445
+ import * as THREE from "three";
446
+ export declare class MaterialsUtils {
447
+ static isTransparent(material: THREE.Material): boolean;
355
448
  }
356
- interface AttributeListener {
357
- [modelID: string]: {
358
- [expressID: number]: {
359
- [attributeName: string]: Event<String | Boolean | Number>;
360
- };
449
+ import * as THREE from "three";
450
+ import * as FRAGS from "@thatopen/fragments";
451
+ import { Disposable, Component, Event, Components } from "../../core";
452
+ export interface Classification {
453
+ [system: string]: {
454
+ [className: string]: FRAGS.FragmentIdMap;
361
455
  };
362
456
  }
363
- export declare class IfcPropertiesManager extends Component implements Disposable {
364
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
365
- /** {@link Disposable.onDisposed} */
366
- readonly onDisposed: Event<string>;
367
- readonly onRequestFile: Event<unknown>;
368
- ifcToExport: ArrayBuffer | null;
369
- readonly onElementToPset: Event<{
370
- model: FragmentsGroup;
371
- psetID: number;
372
- elementID: number;
373
- }>;
374
- readonly onPropToPset: Event<{
375
- model: FragmentsGroup;
376
- psetID: number;
377
- propID: number;
378
- }>;
379
- readonly onPsetRemoved: Event<{
380
- model: FragmentsGroup;
381
- psetID: number;
382
- }>;
383
- readonly onDataChanged: Event<{
384
- model: FragmentsGroup;
385
- expressID: number;
386
- }>;
387
- wasm: {
388
- path: string;
389
- absolute: boolean;
390
- };
457
+ export declare class Classifier extends Component implements Disposable {
458
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
459
+ /** {@link Component.enabled} */
391
460
  enabled: boolean;
392
- attributeListeners: AttributeListener;
393
- selectedModel?: FragmentsGroup;
394
- changeMap: ChangeMap;
461
+ list: Classification;
462
+ /** {@link Disposable.onDisposed} */
463
+ readonly onDisposed: Event<unknown>;
395
464
  constructor(components: Components);
465
+ private onFragmentsDisposed;
396
466
  dispose(): void;
397
- private increaseMaxID;
398
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
399
- private newGUID;
400
- private getOwnerHistory;
401
- private registerChange;
402
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
403
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
404
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
405
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
406
- }>;
407
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
408
- private newSingleProperty;
409
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
410
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
411
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
412
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
413
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
414
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
415
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
416
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
467
+ remove(guid: string): void;
468
+ find(filter?: {
469
+ [name: string]: string[];
470
+ }): FRAGS.FragmentIdMap;
471
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
472
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
473
+ byEntity(group: FRAGS.FragmentsGroup): void;
474
+ byStorey(group: FRAGS.FragmentsGroup): void;
475
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
476
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
477
+ resetColor(items: FRAGS.FragmentIdMap): void;
478
+ private saveItem;
417
479
  }
418
- export {};
480
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
419
481
  import * as THREE from "three";
420
- import { Component, Components } from "../../core";
421
- export interface MeasureEdge {
422
- distance: number;
423
- points: THREE.Vector3[];
424
- }
425
- export declare class MeasurementUtils extends Component {
482
+ import * as FRAGS from "@thatopen/fragments";
483
+ import { Component, Components, Event, Disposable } from "../../core";
484
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
485
+ /**
486
+ * Object that can efficiently load binary files that contain
487
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
488
+ */
489
+ export declare class FragmentsManager extends Component implements Disposable {
490
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
491
+ /** {@link Disposable.onDisposed} */
492
+ readonly onDisposed: Event<unknown>;
493
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
494
+ readonly onFragmentsDisposed: Event<{
495
+ groupID: string;
496
+ fragmentIDs: string[];
497
+ }>;
498
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
499
+ readonly list: Map<string, Fragment>;
500
+ readonly groups: Map<string, FragmentsGroup>;
501
+ /** {@link Component.enabled} */
426
502
  enabled: boolean;
427
- static uuid: string;
503
+ baseCoordinationModel: string;
504
+ private _loader;
505
+ /** The list of meshes of the created fragments. */
506
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
428
507
  constructor(components: Components);
429
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
430
- edges: MeasureEdge[];
431
- indices: Set<number>;
432
- } | null;
433
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
434
- private getFaceData;
435
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
436
- p1: THREE.Vector3;
437
- p2: THREE.Vector3;
438
- p3: THREE.Vector3;
439
- faceNormal: THREE.Vector3;
440
- };
441
- private round;
508
+ /** {@link Disposable.dispose} */
509
+ dispose(): void;
510
+ disposeGroup(group: FragmentsGroup): void;
511
+ /**
512
+ * Loads a binar file that contain fragment geometry.
513
+ * @param data - The binary data to load.
514
+ * @param config - Optional configuration for loading.
515
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
516
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
517
+ * @returns The loaded FragmentsGroup.
518
+ */
519
+ load(data: Uint8Array, config?: Partial<{
520
+ coordinate: boolean;
521
+ properties: FRAGS.IfcProperties;
522
+ relationsMap: RelationsMap;
523
+ }>): FragmentsGroup;
524
+ /**
525
+ * Export the specified fragments.
526
+ * @param group - the fragments group to be exported.
527
+ * @returns the exported data as binary buffer.
528
+ */
529
+ export(group: FragmentsGroup): Uint8Array;
530
+ coordinate(models?: FragmentsGroup[]): void;
442
531
  }
443
532
  import { Component, Disposable, Event, Components } from "../../core";
444
533
  export declare class Exploder extends Component implements Disposable {
@@ -453,74 +542,128 @@ export declare class Exploder extends Component implements Disposable {
453
542
  dispose(): void;
454
543
  set(active: boolean): void;
455
544
  }
456
- import * as THREE from "three";
457
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
458
- center: THREE.Vector3;
459
- halfSizes: THREE.Vector3;
460
- rotation: THREE.Matrix3;
461
- transformation: THREE.Matrix4;
462
- };
463
- import * as THREE from "three";
464
- import * as FRAGS from "@thatopen/fragments";
465
- import { FragmentsGroup } from "@thatopen/fragments";
466
- import { Component, Components, Disposable, Event } from "../../core";
467
- /**
468
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
469
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
470
- */
471
- export declare class BoundingBoxer extends Component implements Disposable {
472
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
473
- /** {@link Component.enabled} */
474
- enabled: boolean;
475
- /** {@link Disposable.onDisposed} */
476
- readonly onDisposed: Event<unknown>;
477
- private _absoluteMin;
478
- private _absoluteMax;
479
- private _meshes;
480
- constructor(components: Components);
481
- static getDimensions(bbox: THREE.Box3): {
482
- width: number;
483
- height: number;
484
- depth: number;
485
- center: THREE.Vector3;
486
- };
487
- static newBound(positive: boolean): THREE.Vector3;
488
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
489
- /** {@link Disposable.dispose} */
490
- dispose(): void;
491
- get(): THREE.Box3;
492
- getSphere(): THREE.Sphere;
493
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
494
- reset(): void;
495
- add(group: FragmentsGroup): void;
496
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
497
- private static getFragmentBounds;
498
- }
499
545
  import * as WEBIFC from "web-ifc";
500
- import { FragmentsGroup } from "@thatopen/fragments";
501
- import { Disposable, Event, Component, Components } from "../../core";
502
- import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
503
- /**
504
- * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
505
- * 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.
506
- */
507
- export declare class IfcRelationsIndexer extends Component implements Disposable {
508
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
546
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
547
+ import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
548
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
549
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
550
+ onPropertiesStreamed: AsyncEvent<{
551
+ type: number;
552
+ data: {
553
+ [id: number]: any;
554
+ };
555
+ }>;
556
+ onProgress: AsyncEvent<number>;
557
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
509
558
  /** {@link Disposable.onDisposed} */
510
559
  readonly onDisposed: Event<string>;
511
560
  enabled: boolean;
512
- readonly onRelationsIndexed: Event<{
513
- modelID: string;
514
- relationsMap: RelationsMap;
515
- }>;
516
- private _relToAttributesMap;
517
- private _inverseAttributes;
518
- private _ifcRels;
519
- /**
520
- * Holds the relationship mappings for each model processed by the indexer.
521
- * The structure is a map where each key is a model's UUID, and the value is another map.
522
- * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
523
- * representing a specific relation type, and the value is an array of expressIDs of entities
561
+ settings: PropertiesStreamingSettings;
562
+ webIfc: WEBIFC.IfcAPI;
563
+ dispose(): Promise<void>;
564
+ streamFromBuffer(data: Uint8Array): Promise<void>;
565
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
566
+ private readIfcFile;
567
+ private streamIfcFile;
568
+ private streamAllProperties;
569
+ private cleanUp;
570
+ }
571
+ import * as WEBIFC from "web-ifc";
572
+ import * as FRAGS from "@thatopen/fragments";
573
+ import { IfcFragmentSettings } from "./src";
574
+ import { Component, Components, Event, Disposable } from "../../core";
575
+ export declare class IfcLoader extends Component implements Disposable {
576
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
577
+ readonly onIfcStartedLoading: Event<void>;
578
+ readonly onSetup: Event<void>;
579
+ /** {@link Disposable.onDisposed} */
580
+ readonly onDisposed: Event<string>;
581
+ settings: IfcFragmentSettings;
582
+ enabled: boolean;
583
+ webIfc: WEBIFC.IfcAPI;
584
+ private _material;
585
+ private _spatialTree;
586
+ private _metaData;
587
+ private _fragmentInstances;
588
+ private _civil;
589
+ private _visitedFragments;
590
+ private _materialT;
591
+ constructor(components: Components);
592
+ dispose(): void;
593
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
594
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
595
+ readIfcFile(data: Uint8Array): Promise<number>;
596
+ private getAllGeometries;
597
+ cleanUp(): void;
598
+ private getMesh;
599
+ private getGeometry;
600
+ private autoSetWasm;
601
+ }
602
+ import * as WEBIFC from "web-ifc";
603
+ import { Components, Disposable, Event, Component } from "../../core";
604
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
605
+ export declare class IfcGeometryTiler extends Component implements Disposable {
606
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
607
+ onGeometryStreamed: Event<{
608
+ buffer: Uint8Array;
609
+ data: StreamedGeometries;
610
+ }>;
611
+ onAssetStreamed: Event<StreamedAsset[]>;
612
+ onProgress: Event<number>;
613
+ onIfcLoaded: Event<Uint8Array>;
614
+ /** {@link Disposable.onDisposed} */
615
+ readonly onDisposed: Event<unknown>;
616
+ settings: IfcStreamingSettings;
617
+ enabled: boolean;
618
+ webIfc: WEBIFC.IfcAPI;
619
+ private _spatialTree;
620
+ private _metaData;
621
+ private _visitedGeometries;
622
+ private _streamSerializer;
623
+ private _geometries;
624
+ private _geometryCount;
625
+ private _civil;
626
+ private _groupSerializer;
627
+ private _assets;
628
+ private _meshesWithHoles;
629
+ constructor(components: Components);
630
+ dispose(): void;
631
+ streamFromBuffer(data: Uint8Array): Promise<void>;
632
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
633
+ private readIfcFile;
634
+ private streamIfcFile;
635
+ private streamAllGeometries;
636
+ private cleanUp;
637
+ private getMesh;
638
+ private getGeometry;
639
+ private streamAssets;
640
+ private streamGeometries;
641
+ }
642
+ import * as WEBIFC from "web-ifc";
643
+ import { FragmentsGroup } from "@thatopen/fragments";
644
+ import { Disposable, Event, Component, Components } from "../../core";
645
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
646
+ /**
647
+ * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
648
+ * 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.
649
+ */
650
+ export declare class IfcRelationsIndexer extends Component implements Disposable {
651
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
652
+ /** {@link Disposable.onDisposed} */
653
+ readonly onDisposed: Event<string>;
654
+ enabled: boolean;
655
+ readonly onRelationsIndexed: Event<{
656
+ modelID: string;
657
+ relationsMap: RelationsMap;
658
+ }>;
659
+ private _relToAttributesMap;
660
+ private _inverseAttributes;
661
+ private _ifcRels;
662
+ /**
663
+ * Holds the relationship mappings for each model processed by the indexer.
664
+ * The structure is a map where each key is a model's UUID, and the value is another map.
665
+ * This inner map's keys are entity expressIDs, and its values are maps where each key is an index
666
+ * representing a specific relation type, and the value is an array of expressIDs of entities
524
667
  * that are related through that relation type. This structure allows for efficient querying
525
668
  * of entity relationships within a model.
526
669
  */
@@ -629,206 +772,128 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
629
772
  }
630
773
  export type { InverseAttribute } from "./src/types";
631
774
  import * as THREE from "three";
632
- import * as FRAGS from "@thatopen/fragments";
633
- import { Disposable, Component, Event, Components } from "../../core";
634
- export interface Classification {
635
- [system: string]: {
636
- [className: string]: FRAGS.FragmentIdMap;
637
- };
775
+ import { Component, Components } from "../../core";
776
+ export interface MeasureEdge {
777
+ distance: number;
778
+ points: THREE.Vector3[];
638
779
  }
639
- export declare class Classifier extends Component implements Disposable {
640
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
641
- /** {@link Component.enabled} */
780
+ export declare class MeasurementUtils extends Component {
642
781
  enabled: boolean;
643
- list: Classification;
644
- /** {@link Disposable.onDisposed} */
645
- readonly onDisposed: Event<unknown>;
782
+ static uuid: string;
646
783
  constructor(components: Components);
647
- private onFragmentsDisposed;
648
- dispose(): void;
649
- remove(guid: string): void;
650
- find(filter?: {
651
- [name: string]: string[];
652
- }): FRAGS.FragmentIdMap;
653
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
654
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
655
- byEntity(group: FRAGS.FragmentsGroup): void;
656
- byStorey(group: FRAGS.FragmentsGroup): void;
657
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
658
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
659
- resetColor(items: FRAGS.FragmentIdMap): void;
660
- private saveItem;
784
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
785
+ edges: MeasureEdge[];
786
+ indices: Set<number>;
787
+ } | null;
788
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
789
+ private getFaceData;
790
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
791
+ p1: THREE.Vector3;
792
+ p2: THREE.Vector3;
793
+ p3: THREE.Vector3;
794
+ faceNormal: THREE.Vector3;
795
+ };
796
+ private round;
661
797
  }
662
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
663
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
664
- import * as THREE from "three";
665
- import * as FRAGS from "@thatopen/fragments";
666
- import { Component, Components, Event, Disposable } from "../../core";
667
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
798
+ import * as WEBIFC from "web-ifc";
799
+ import * as FRAG from "@thatopen/fragments";
800
+ import { Component, Components } from "../../core";
668
801
  /**
669
- * Object that can efficiently load binary files that contain
670
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
802
+ * Object to export all the properties from an IFC to a JS object.
671
803
  */
672
- export declare class FragmentsManager extends Component implements Disposable {
673
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
674
- /** {@link Disposable.onDisposed} */
675
- readonly onDisposed: Event<unknown>;
676
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
677
- readonly onFragmentsDisposed: Event<{
678
- groupID: string;
679
- fragmentIDs: string[];
680
- }>;
681
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
682
- readonly list: Map<string, Fragment>;
683
- readonly groups: Map<string, FragmentsGroup>;
804
+ export declare class IfcJsonExporter extends Component {
805
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
684
806
  /** {@link Component.enabled} */
685
807
  enabled: boolean;
686
- baseCoordinationModel: string;
687
- private _loader;
688
- /** The list of meshes of the created fragments. */
689
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
690
808
  constructor(components: Components);
691
- /** {@link Disposable.dispose} */
692
- dispose(): void;
693
- disposeGroup(group: FragmentsGroup): void;
694
- /**
695
- * Loads a binar file that contain fragment geometry.
696
- * @param data - The binary data to load.
697
- * @param config - Optional configuration for loading.
698
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
699
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
700
- * @returns The loaded FragmentsGroup.
701
- */
702
- load(data: Uint8Array, config?: Partial<{
703
- coordinate: boolean;
704
- properties: FRAGS.IfcProperties;
705
- relationsMap: RelationsMap;
706
- }>): FragmentsGroup;
707
809
  /**
708
- * Export the specified fragments.
709
- * @param group - the fragments group to be exported.
710
- * @returns the exported data as binary buffer.
810
+ * Exports all the properties of an IFC into an array of JS objects.
811
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
812
+ * @param modelID ID of the IFC model whose properties to extract.
813
+ * @param indirect whether to get the indirect relationships as well.
814
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
815
+ * to make the location data available (e.g. absolute position of building).
711
816
  */
712
- export(group: FragmentsGroup): Uint8Array;
713
- coordinate(models?: FragmentsGroup[]): void;
714
- }
715
- import * as FRAGS from "@thatopen/fragments";
716
- import { Components, Component } from "../../core";
717
- export declare class FragmentHider extends Component {
718
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
719
- enabled: boolean;
720
- constructor(components: Components);
721
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
722
- isolate(items: FRAGS.FragmentIdMap): void;
723
- private updateCulledVisibility;
724
- }
725
- import * as THREE from "three";
726
- export declare class MaterialsUtils {
727
- static isTransparent(material: THREE.Material): boolean;
817
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
728
818
  }
729
819
  import * as WEBIFC from "web-ifc";
730
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
731
- import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
732
- export declare class IfcPropertiesTiler extends Component implements Disposable {
733
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
734
- onPropertiesStreamed: AsyncEvent<{
735
- type: number;
736
- data: {
737
- [id: number]: any;
820
+ import { FragmentsGroup } from "@thatopen/fragments";
821
+ import { Component, Disposable, Event, Components } from "../../core";
822
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
823
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
824
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
825
+ interface ChangeMap {
826
+ [modelID: string]: Set<number>;
827
+ }
828
+ interface AttributeListener {
829
+ [modelID: string]: {
830
+ [expressID: number]: {
831
+ [attributeName: string]: Event<String | Boolean | Number>;
738
832
  };
739
- }>;
740
- onProgress: AsyncEvent<number>;
741
- onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
833
+ };
834
+ }
835
+ export declare class IfcPropertiesManager extends Component implements Disposable {
836
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
742
837
  /** {@link Disposable.onDisposed} */
743
838
  readonly onDisposed: Event<string>;
744
- enabled: boolean;
745
- settings: PropertiesStreamingSettings;
746
- webIfc: WEBIFC.IfcAPI;
747
- dispose(): Promise<void>;
748
- streamFromBuffer(data: Uint8Array): Promise<void>;
749
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
750
- private readIfcFile;
751
- private streamIfcFile;
752
- private streamAllProperties;
753
- private cleanUp;
839
+ readonly onRequestFile: Event<unknown>;
840
+ ifcToExport: ArrayBuffer | null;
841
+ readonly onElementToPset: Event<{
842
+ model: FragmentsGroup;
843
+ psetID: number;
844
+ elementID: number;
845
+ }>;
846
+ readonly onPropToPset: Event<{
847
+ model: FragmentsGroup;
848
+ psetID: number;
849
+ propID: number;
850
+ }>;
851
+ readonly onPsetRemoved: Event<{
852
+ model: FragmentsGroup;
853
+ psetID: number;
854
+ }>;
855
+ readonly onDataChanged: Event<{
856
+ model: FragmentsGroup;
857
+ expressID: number;
858
+ }>;
859
+ wasm: {
860
+ path: string;
861
+ absolute: boolean;
862
+ };
863
+ enabled: boolean;
864
+ attributeListeners: AttributeListener;
865
+ selectedModel?: FragmentsGroup;
866
+ changeMap: ChangeMap;
867
+ constructor(components: Components);
868
+ dispose(): void;
869
+ private increaseMaxID;
870
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
871
+ private newGUID;
872
+ private getOwnerHistory;
873
+ private registerChange;
874
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
875
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
876
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
877
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
878
+ }>;
879
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
880
+ private newSingleProperty;
881
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
882
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
883
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
884
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
885
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
886
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
887
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
888
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
754
889
  }
890
+ export {};
755
891
  export declare class UUID {
756
892
  private static _pattern;
757
893
  private static _lut;
758
894
  static create(): string;
759
895
  static validate(uuid: string): void;
760
896
  }
761
- import * as WEBIFC from "web-ifc";
762
- import { Components, Disposable, Event, Component } from "../../core";
763
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
764
- export declare class IfcGeometryTiler extends Component implements Disposable {
765
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
766
- onGeometryStreamed: Event<{
767
- buffer: Uint8Array;
768
- data: StreamedGeometries;
769
- }>;
770
- onAssetStreamed: Event<StreamedAsset[]>;
771
- onProgress: Event<number>;
772
- onIfcLoaded: Event<Uint8Array>;
773
- /** {@link Disposable.onDisposed} */
774
- readonly onDisposed: Event<unknown>;
775
- settings: IfcStreamingSettings;
776
- enabled: boolean;
777
- webIfc: WEBIFC.IfcAPI;
778
- private _spatialTree;
779
- private _metaData;
780
- private _visitedGeometries;
781
- private _streamSerializer;
782
- private _geometries;
783
- private _geometryCount;
784
- private _civil;
785
- private _groupSerializer;
786
- private _assets;
787
- private _meshesWithHoles;
788
- constructor(components: Components);
789
- dispose(): void;
790
- streamFromBuffer(data: Uint8Array): Promise<void>;
791
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
792
- private readIfcFile;
793
- private streamIfcFile;
794
- private streamAllGeometries;
795
- private cleanUp;
796
- private getMesh;
797
- private getGeometry;
798
- private streamAssets;
799
- private streamGeometries;
800
- }
801
- import * as WEBIFC from "web-ifc";
802
- import * as FRAGS from "@thatopen/fragments";
803
- import { IfcFragmentSettings } from "./src";
804
- import { Component, Components, Event, Disposable } from "../../core";
805
- export declare class IfcLoader extends Component implements Disposable {
806
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
807
- readonly onIfcStartedLoading: Event<void>;
808
- readonly onSetup: Event<void>;
809
- /** {@link Disposable.onDisposed} */
810
- readonly onDisposed: Event<string>;
811
- settings: IfcFragmentSettings;
812
- enabled: boolean;
813
- webIfc: WEBIFC.IfcAPI;
814
- private _material;
815
- private _spatialTree;
816
- private _metaData;
817
- private _fragmentInstances;
818
- private _civil;
819
- private _visitedFragments;
820
- private _materialT;
821
- constructor(components: Components);
822
- dispose(): void;
823
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
824
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
825
- readIfcFile(data: Uint8Array): Promise<number>;
826
- private getAllGeometries;
827
- cleanUp(): void;
828
- private getMesh;
829
- private getGeometry;
830
- private autoSetWasm;
831
- }
832
897
  import * as THREE from "three";
833
898
  import { Component, Components, Event, World } from "../core";
834
899
  export interface VertexPickerConfig {
@@ -867,35 +932,6 @@ export interface IfcItemsCategories {
867
932
  export declare class IfcCategories {
868
933
  getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
869
934
  }
870
- export declare const IfcCategoryMap: {
871
- [key: number]: string;
872
- };
873
- import * as FRAGS from "@thatopen/fragments";
874
- export declare class IfcPropertiesUtils {
875
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
876
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
877
- [attribute: string]: any;
878
- } | null>;
879
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
880
- [relatingID: number]: number[];
881
- }>;
882
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
883
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
884
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
885
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
886
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
887
- key: string | null;
888
- name: string | null;
889
- }>;
890
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
891
- key: string | null;
892
- value: number | null;
893
- }>;
894
- static isRel(expressID: number): boolean;
895
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
896
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
897
- }
898
- export declare const GeometryTypes: Set<number>;
899
935
  import * as THREE from "three";
900
936
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
901
937
  export declare class MiniMap implements Resizeable, Updateable, Disposable {
@@ -930,474 +966,76 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
930
966
  resize(size?: THREE.Vector2): void;
931
967
  private updatePlanes;
932
968
  }
933
- /// <reference types="node" />
934
- import * as THREE from "three";
935
- import { Hideable, Event, World } from "../../Types";
936
- import { Components } from "../../Components";
937
- export interface GridConfig {
938
- color: THREE.Color;
939
- size1: number;
940
- size2: number;
941
- distance: number;
969
+ export declare const GeometryTypes: Set<number>;
970
+ import * as WEBIFC from "web-ifc";
971
+ import { IfcItemsCategories } from "../../../ifc";
972
+ export declare class SpatialStructure {
973
+ itemsByFloor: IfcItemsCategories;
974
+ private _units;
975
+ setUp(webIfc: WEBIFC.IfcAPI): void;
976
+ cleanUp(): void;
977
+ }
978
+ export declare const IfcCategoryMap: {
979
+ [key: number]: string;
980
+ };
981
+ import * as FRAGS from "@thatopen/fragments";
982
+ export declare class IfcPropertiesUtils {
983
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
984
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
985
+ [attribute: string]: any;
986
+ } | null>;
987
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
988
+ [relatingID: number]: number[];
989
+ }>;
990
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
991
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
992
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
993
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
994
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
995
+ key: string | null;
996
+ name: string | null;
997
+ }>;
998
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
999
+ key: string | null;
1000
+ value: number | null;
1001
+ }>;
1002
+ static isRel(expressID: number): boolean;
1003
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1004
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
942
1005
  }
943
1006
  /**
944
- * An infinite grid. Created by
945
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
946
- * and translated to typescript by
947
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1007
+ * Simple event handler by
1008
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1009
+ * Keep in mind that:
1010
+ * - If you want to remove it later, you might want to declare the callback as
1011
+ * an object.
1012
+ * - If you want to maintain the reference to 'this', you will need to declare
1013
+ * the callback as an arrow function.
948
1014
  */
949
- export declare class SimpleGrid implements Hideable, Disposable {
950
- /** {@link Disposable.onDisposed} */
951
- readonly onDisposed: Event<unknown>;
952
- world: World;
953
- components: Components;
954
- /** {@link Hideable.visible} */
955
- get visible(): boolean;
956
- /** {@link Hideable.visible} */
957
- set visible(visible: boolean);
958
- /** The material of the grid. */
959
- get material(): THREE.ShaderMaterial;
1015
+ export declare class Event<T> {
960
1016
  /**
961
- * Whether the grid should fade away with distance. Recommended to be true for
962
- * perspective cameras and false for orthographic cameras.
1017
+ * Add a callback to this event instance.
1018
+ * @param handler - the callback to be added to this event.
963
1019
  */
964
- get fade(): boolean;
1020
+ add(handler: T extends void ? {
1021
+ (): void;
1022
+ } : {
1023
+ (data: T): void;
1024
+ }): void;
965
1025
  /**
966
- * Whether the grid should fade away with distance. Recommended to be true for
967
- * perspective cameras and false for orthographic cameras.
1026
+ * Removes a callback from this event instance.
1027
+ * @param handler - the callback to be removed from this event.
968
1028
  */
969
- set fade(active: boolean);
970
- readonly three: THREE.Mesh;
971
- private _fade;
972
- constructor(components: Components, world: World, config: GridConfig);
973
- [Symbol.dispose](): void;
974
- /** {@link Disposable.dispose} */
975
- dispose(): void;
976
- private setupEvents;
977
- private updateZoom;
978
- }
979
- import { InverseAttribute } from "./types";
980
- export declare const relToAttributesMap: Map<number, {
981
- forRelating: InverseAttribute;
982
- forRelated: InverseAttribute;
983
- }>;
984
- import * as THREE from "three";
985
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
986
- import { Components } from "../../Components";
987
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
988
- /**
989
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
990
- */
991
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
992
- readonly onAfterUpdate: Event<unknown>;
993
- readonly onBeforeUpdate: Event<unknown>;
994
- enabled: boolean;
995
- uuid: string;
996
- readonly onDisposed: Event<unknown>;
997
- private _scene?;
998
- private _camera?;
999
- private _renderer;
1000
- get scene(): T;
1001
- set scene(scene: T);
1002
- get camera(): U;
1003
- set camera(camera: U);
1004
- get renderer(): S | null;
1005
- set renderer(renderer: S | null);
1006
- constructor(components: Components);
1007
- update(delta?: number): void;
1008
- dispose(disposeResources?: boolean): void;
1009
- }
1010
- import * as THREE from "three";
1011
- import { BaseScene, Configurable, Event } from "../../Types";
1012
- import { Components } from "../../Components";
1013
- export interface SimpleSceneConfig {
1014
- directionalLight: {
1015
- color: THREE.Color;
1016
- intensity: number;
1017
- position: THREE.Vector3;
1018
- };
1019
- ambientLight: {
1020
- color: THREE.Color;
1021
- intensity: number;
1022
- };
1023
- }
1024
- /**
1025
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1026
- * objects hierarchically, and easily dispose them when you are finished with it.
1027
- * @noInheritDoc
1028
- */
1029
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1030
- /** {@link Configurable.isSetup} */
1031
- isSetup: boolean;
1032
- three: THREE.Scene;
1033
- /** {@link Configurable.onSetup} */
1034
- readonly onSetup: Event<SimpleScene>;
1035
- config: Required<SimpleSceneConfig>;
1036
- constructor(components: Components);
1037
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1038
- setup(config?: Partial<SimpleSceneConfig>): void;
1039
- }
1040
- import * as WEBIFC from "web-ifc";
1041
- import { IfcItemsCategories } from "../../../ifc";
1042
- export declare class SpatialStructure {
1043
- itemsByFloor: IfcItemsCategories;
1044
- private _units;
1045
- setUp(webIfc: WEBIFC.IfcAPI): void;
1046
- cleanUp(): void;
1047
- }
1048
- import * as THREE from "three";
1049
- import { BaseRenderer, Event } from "../../Types";
1050
- import { Components } from "../../Components";
1051
- /**
1052
- * A basic renderer capable of rendering
1053
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1054
- */
1055
- export declare class SimpleRenderer extends BaseRenderer {
1056
- enabled: boolean;
1057
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1058
- container: HTMLElement;
1059
- three: THREE.WebGLRenderer;
1060
- protected _canvas: HTMLCanvasElement;
1061
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1062
- protected _resizeObserver: ResizeObserver | null;
1063
- protected onContainerUpdated: Event<unknown>;
1064
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1065
- /** {@link Updateable.update} */
1066
- update(): void;
1067
- /** {@link Disposable.dispose} */
1068
- dispose(): void;
1069
- /** {@link Resizeable.getSize}. */
1070
- getSize(): THREE.Vector2;
1071
- /** {@link Resizeable.resize} */
1072
- resize: (size?: THREE.Vector2) => void;
1073
- setupEvents(active: boolean): void;
1074
- private resizeEvent;
1075
- private setupRenderer;
1076
- private onContextLost;
1077
- private onContextBack;
1078
- }
1079
- import * as THREE from "three";
1080
- import { Disposable, Event } from "../../Types";
1081
- /**
1082
- * A helper to easily get the real position of the mouse in the Three.js canvas
1083
- * to work with tools like the
1084
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1085
- * been transformed through CSS or doesn't occupy the whole screen.
1086
- */
1087
- export declare class Mouse implements Disposable {
1088
- dom: HTMLCanvasElement;
1089
- private _event?;
1090
- private _position;
1091
- /** {@link Disposable.onDisposed} */
1092
- readonly onDisposed: Event<unknown>;
1093
- constructor(dom: HTMLCanvasElement);
1094
- /**
1095
- * The real position of the mouse of the Three.js canvas.
1096
- */
1097
- get position(): THREE.Vector2;
1098
- /** {@link Disposable.dispose} */
1099
- dispose(): void;
1100
- private getPositionY;
1101
- private getPositionX;
1102
- private updateMouseInfo;
1103
- private setupEvents;
1104
- }
1105
- import * as THREE from "three";
1106
- import { Components } from "../../Components";
1107
- import { Event, World, Disposable } from "../../Types";
1108
- import { Mouse } from "./mouse";
1109
- /**
1110
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1111
- * that allows to easily get items from the scene using the mouse and touch
1112
- * events.
1113
- */
1114
- export declare class SimpleRaycaster implements Disposable {
1115
- /** {@link Component.enabled} */
1116
- enabled: boolean;
1117
- components: Components;
1118
- /** {@link Disposable.onDisposed} */
1119
- readonly onDisposed: Event<unknown>;
1120
- /** The position of the mouse in the screen. */
1121
- readonly mouse: Mouse;
1122
- readonly three: THREE.Raycaster;
1123
- world: World;
1124
- constructor(components: Components, world: World);
1125
- /** {@link Disposable.dispose} */
1126
- dispose(): void;
1127
- /**
1128
- * Throws a ray from the camera to the mouse or touch event point and returns
1129
- * the first item found. This also takes into account the clipping planes
1130
- * used by the renderer.
1131
- *
1132
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1133
- * to query. If not provided, it will query all the meshes stored in
1134
- * {@link Components.meshes}.
1135
- */
1136
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1137
- castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
1138
- private intersect;
1139
- private filterClippingPlanes;
1140
- }
1141
- import * as THREE from "three";
1142
- import CameraControls from "camera-controls";
1143
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1144
- import { Components } from "../../Components";
1145
- /**
1146
- * A basic camera that uses
1147
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1148
- * easily control the camera in 2D and 3D. Check out it's API to find out
1149
- * what features it offers.
1150
- */
1151
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1152
- /** {@link Updateable.onBeforeUpdate} */
1153
- readonly onBeforeUpdate: Event<SimpleCamera>;
1154
- /** {@link Updateable.onAfterUpdate} */
1155
- readonly onAfterUpdate: Event<SimpleCamera>;
1156
- readonly onAspectUpdated: Event<unknown>;
1157
- /** {@link Disposable.onDisposed} */
1158
- readonly onDisposed: Event<string>;
1159
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1160
- private _allControls;
1161
- /**
1162
- * The object that controls the camera. An instance of
1163
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1164
- * Transforming the camera directly will have no effect: you need to use this
1165
- * object to move, rotate, look at objects, etc.
1166
- */
1167
- get controls(): CameraControls;
1168
- /** {@link Component.enabled} */
1169
- get enabled(): boolean;
1170
- /** {@link Component.enabled} */
1171
- set enabled(enabled: boolean);
1172
- constructor(components: Components);
1173
- /** {@link Disposable.dispose} */
1174
- dispose(): void;
1175
- /** {@link Updateable.update} */
1176
- update(_delta: number): void;
1177
- /**
1178
- * Updates the aspect of the camera to match the size of the
1179
- * {@link Components.renderer}.
1180
- */
1181
- updateAspect: () => void;
1182
- private setupCamera;
1183
- private newCameraControls;
1184
- private setupEvents;
1185
- private static getSubsetOfThree;
1186
- }
1187
- import * as THREE from "three";
1188
- import { Components } from "../../Components";
1189
- import { AsyncEvent, Event, World } from "../../Types";
1190
- export interface CullerRendererSettings {
1191
- updateInterval?: number;
1192
- width?: number;
1193
- height?: number;
1194
- autoUpdate?: boolean;
1195
- }
1196
- /**
1197
- * A base renderer to determine visibility on screen
1198
- */
1199
- export declare class CullerRenderer {
1200
- /** {@link Disposable.onDisposed} */
1201
- readonly onDisposed: Event<string>;
1202
- /**
1203
- * Fires after making the visibility check to the meshes. It lists the
1204
- * meshes that are currently visible, and the ones that were visible
1205
- * just before but not anymore.
1206
- */
1207
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1208
- /** {@link Component.enabled} */
1209
- enabled: boolean;
1210
- /**
1211
- * Needs to check whether there are objects that need to be hidden or shown.
1212
- * You can bind this to the camera movement, to a certain interval, etc.
1213
- */
1214
- needsUpdate: boolean;
1215
- /**
1216
- * Render the internal scene used to determine the object visibility. Used
1217
- * for debugging purposes.
1218
- */
1219
- renderDebugFrame: boolean;
1220
- components: Components;
1221
- readonly world: World;
1222
- readonly renderer: THREE.WebGLRenderer;
1223
- protected autoUpdate: boolean;
1224
- protected updateInterval: number;
1225
- protected readonly worker: Worker;
1226
- protected readonly scene: THREE.Scene;
1227
- private _width;
1228
- private _height;
1229
- private _availableColor;
1230
- private readonly renderTarget;
1231
- private readonly bufferSize;
1232
- private readonly _buffer;
1233
- protected _isWorkerBusy: boolean;
1234
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1235
- /** {@link Disposable.dispose} */
1236
- dispose(): void;
1237
- /**
1238
- * The function that the culler uses to reprocess the scene. Generally it's
1239
- * better to call needsUpdate, but you can also call this to force it.
1240
- * @param force if true, it will refresh the scene even if needsUpdate is
1241
- * not true.
1242
- */
1243
- updateVisibility: (force?: boolean) => Promise<void>;
1244
- protected getAvailableColor(): {
1245
- r: number;
1246
- g: number;
1247
- b: number;
1248
- code: string;
1249
- };
1250
- protected increaseColor(): void;
1251
- protected decreaseColor(): void;
1252
- private applySettings;
1253
- }
1254
- import * as THREE from "three";
1255
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1256
- import { Components } from "../../Components";
1257
- import { Event, World } from "../../Types";
1258
- /**
1259
- * A renderer to determine a mesh visibility on screen
1260
- */
1261
- export declare class MeshCullerRenderer extends CullerRenderer {
1262
- threshold: number;
1263
- readonly onViewUpdated: Event<{
1264
- seen: Set<THREE.Mesh>;
1265
- unseen: Set<THREE.Mesh>;
1266
- }>;
1267
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1268
- isProcessing: boolean;
1269
- private _colorCodeMeshMap;
1270
- private _meshIDColorCodeMap;
1271
- private _currentVisibleMeshes;
1272
- private _recentlyHiddenMeshes;
1273
- private _intervalID;
1274
- private readonly _transparentMat;
1275
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1276
- dispose(): void;
1277
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1278
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1279
- private handleWorkerMessage;
1280
- private getAvailableMaterial;
1281
- }
1282
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1283
- import { NavigationMode } from "./types";
1284
- import { OrthoPerspectiveCamera } from "../index";
1285
- /**
1286
- * A {@link NavigationMode} that allows 3D navigation and panning
1287
- * like in many 3D and CAD softwares.
1288
- */
1289
- export declare class OrbitMode implements NavigationMode {
1290
- camera: OrthoPerspectiveCamera;
1291
- /** {@link NavigationMode.enabled} */
1292
- enabled: boolean;
1293
- /** {@link NavigationMode.id} */
1294
- readonly id = "Orbit";
1295
- constructor(camera: OrthoPerspectiveCamera);
1296
- /** {@link NavigationMode.set} */
1297
- set(active: boolean): void;
1298
- private activateOrbitControls;
1299
- }
1300
- import { NavigationMode } from "./types";
1301
- import { OrthoPerspectiveCamera } from "../index";
1302
- /**
1303
- * A {@link NavigationMode} that allows first person navigation,
1304
- * simulating FPS video games.
1305
- */
1306
- export declare class FirstPersonMode implements NavigationMode {
1307
- private camera;
1308
- /** {@link NavigationMode.enabled} */
1309
- enabled: boolean;
1310
- /** {@link NavigationMode.id} */
1311
- readonly id = "FirstPerson";
1312
- constructor(camera: OrthoPerspectiveCamera);
1313
- /** {@link NavigationMode.set} */
1314
- set(active: boolean): void;
1315
- private setupFirstPersonCamera;
1316
- }
1317
- import * as THREE from "three";
1318
- import { CameraProjection } from "./types";
1319
- import { Event } from "../../Types";
1320
- import { OrthoPerspectiveCamera } from "../index";
1321
- /**
1322
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1323
- */
1324
- export declare class ProjectionManager {
1325
- /**
1326
- * Event that fires when the {@link CameraProjection} changes.
1327
- */
1328
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1329
- current: CameraProjection;
1330
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1331
- private _component;
1332
- private _previousDistance;
1333
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1334
- matchOrthoDistanceEnabled: boolean;
1335
- constructor(camera: OrthoPerspectiveCamera);
1336
- /**
1337
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1338
- *
1339
- * @param projection - the new projection to set. If it is the current projection,
1340
- * it will have no effect.
1341
- */
1342
- set(projection: CameraProjection): Promise<void>;
1343
- /**
1344
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1345
- * and vice versa.
1346
- */
1347
- toggle(): Promise<void>;
1348
- private setOrthoCamera;
1349
- private getPerspectiveDims;
1350
- private setupOrthoCamera;
1351
- private getDistance;
1352
- private setPerspectiveCamera;
1353
- }
1354
- import { NavigationMode } from "./types";
1355
- import { OrthoPerspectiveCamera } from "../index";
1356
- /**
1357
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1358
- * like many BIM tools.
1359
- */
1360
- export declare class PlanMode implements NavigationMode {
1361
- private camera;
1362
- /** {@link NavigationMode.enabled} */
1363
- enabled: boolean;
1364
- /** {@link NavigationMode.id} */
1365
- readonly id = "Plan";
1366
- private mouseAction1?;
1367
- private mouseAction2?;
1368
- private mouseInitialized;
1369
- private readonly defaultAzimuthSpeed;
1370
- private readonly defaultPolarSpeed;
1371
- constructor(camera: OrthoPerspectiveCamera);
1372
- /** {@link NavigationMode.set} */
1373
- set(active: boolean): void;
1374
- }
1375
- /**
1376
- * The projection system of the camera.
1377
- */
1378
- export type CameraProjection = "Perspective" | "Orthographic";
1379
- /**
1380
- * The extensible list of supported navigation modes.
1381
- */
1382
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1383
- /**
1384
- * An object that determines the behavior of the camera controls
1385
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1386
- */
1387
- export interface NavigationMode {
1388
- /** The unique ID of this navigation mode. */
1389
- id: NavModeID;
1390
- /**
1391
- * Enable or disable this navigation mode.
1392
- * When a new navigation mode is enabled, the previous navigation mode
1393
- * must be disabled.
1394
- *
1395
- * @param active - whether to enable or disable this mode.
1396
- * @param options - any additional data required to enable or disable it.
1397
- * */
1398
- set: (active: boolean, options?: any) => void;
1399
- /** Whether this navigation mode is active or not. */
1400
- enabled: boolean;
1029
+ remove(handler: T extends void ? {
1030
+ (): void;
1031
+ } : {
1032
+ (data: T): void;
1033
+ }): void;
1034
+ /** Triggers all the callbacks assigned to this event. */
1035
+ trigger: (data?: T) => void;
1036
+ /** Gets rid of all the suscribed events. */
1037
+ reset(): void;
1038
+ private handlers;
1401
1039
  }
1402
1040
  /**
1403
1041
  * Simple event handler by
@@ -1408,27 +1046,27 @@ export interface NavigationMode {
1408
1046
  * - If you want to maintain the reference to 'this', you will need to declare
1409
1047
  * the callback as an arrow function.
1410
1048
  */
1411
- export declare class Event<T> {
1049
+ export declare class AsyncEvent<T> {
1412
1050
  /**
1413
1051
  * Add a callback to this event instance.
1414
1052
  * @param handler - the callback to be added to this event.
1415
1053
  */
1416
1054
  add(handler: T extends void ? {
1417
- (): void;
1055
+ (): Promise<void>;
1418
1056
  } : {
1419
- (data: T): void;
1057
+ (data: T): Promise<void>;
1420
1058
  }): void;
1421
1059
  /**
1422
1060
  * Removes a callback from this event instance.
1423
1061
  * @param handler - the callback to be removed from this event.
1424
1062
  */
1425
1063
  remove(handler: T extends void ? {
1426
- (): void;
1064
+ (): Promise<void>;
1427
1065
  } : {
1428
- (data: T): void;
1066
+ (data: T): Promise<void>;
1429
1067
  }): void;
1430
1068
  /** Triggers all the callbacks assigned to this event. */
1431
- trigger: (data?: T) => void;
1069
+ trigger: (data?: T) => Promise<void>;
1432
1070
  /** Gets rid of all the suscribed events. */
1433
1071
  reset(): void;
1434
1072
  private handlers;
@@ -1556,6 +1194,25 @@ export interface BVHGeometry extends THREE.BufferGeometry {
1556
1194
  export interface CameraControllable {
1557
1195
  controls: CameraControls;
1558
1196
  }
1197
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1198
+ import { Components } from "../../Components";
1199
+ /**
1200
+ * Base class of the library. Useful for finding out the interfaces it implements.
1201
+ */
1202
+ export declare abstract class Base {
1203
+ components: Components;
1204
+ constructor(components: Components);
1205
+ /** Whether is component is {@link Disposable}. */
1206
+ isDisposeable: () => this is Disposable;
1207
+ /** Whether is component is {@link Resizeable}. */
1208
+ isResizeable: () => this is Resizeable;
1209
+ /** Whether is component is {@link Updateable}. */
1210
+ isUpdateable: () => this is Updateable;
1211
+ /** Whether is component is {@link Hideable}. */
1212
+ isHideable: () => this is Hideable;
1213
+ /** Whether is component is {@link Configurable}. */
1214
+ isConfigurable: () => this is Configurable<any>;
1215
+ }
1559
1216
  import { Base } from "./base";
1560
1217
  /**
1561
1218
  * Components are the building blocks of this library. Components are singleton
@@ -1574,151 +1231,541 @@ export declare abstract class Component extends Base {
1574
1231
  */
1575
1232
  abstract enabled: boolean;
1576
1233
  }
1577
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1234
+ import { Base } from "./base";
1235
+ import { World } from "./world";
1236
+ import { Event } from "./event";
1578
1237
  import { Components } from "../../Components";
1579
1238
  /**
1580
- * Base class of the library. Useful for finding out the interfaces it implements.
1239
+ * One of the elements that make a world. It can be either a scene, a camera
1240
+ * or a renderer.
1581
1241
  */
1582
- export declare abstract class Base {
1583
- components: Components;
1242
+ export declare abstract class BaseWorldItem extends Base {
1243
+ readonly worlds: Map<string, World>;
1244
+ readonly onWorldChanged: Event<{
1245
+ world: World;
1246
+ action: "added" | "removed";
1247
+ }>;
1248
+ currentWorld: World | null;
1249
+ protected constructor(components: Components);
1250
+ }
1251
+ import * as THREE from "three";
1252
+ import { Disposable } from "./interfaces";
1253
+ import { Event } from "./event";
1254
+ import { Components } from "../../Components";
1255
+ import { BaseWorldItem } from "./base-world-item";
1256
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1257
+ /** {@link Disposable.onDisposed} */
1258
+ readonly onDisposed: Event<unknown>;
1259
+ abstract three: THREE.Object3D;
1260
+ protected constructor(components: Components);
1261
+ /** {@link Disposable.dispose} */
1262
+ dispose(): void;
1263
+ }
1264
+ import * as THREE from "three";
1265
+ import CameraControls from "camera-controls";
1266
+ import { BaseWorldItem } from "./base-world-item";
1267
+ import { CameraControllable } from "./interfaces";
1268
+ export declare abstract class BaseCamera extends BaseWorldItem {
1269
+ abstract enabled: boolean;
1270
+ abstract three: THREE.Camera;
1271
+ abstract controls?: CameraControls;
1272
+ /** Whether is instance is {@link CameraControllable}. */
1273
+ hasCameraControls: () => this is CameraControllable;
1274
+ }
1275
+ import * as THREE from "three";
1276
+ import { Vector2 } from "three";
1277
+ import { Event } from "./event";
1278
+ import { BaseWorldItem } from "./base-world-item";
1279
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
1280
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1281
+ abstract three: THREE.WebGLRenderer;
1282
+ /** {@link Updateable.onBeforeUpdate} */
1283
+ onAfterUpdate: Event<unknown>;
1284
+ /** {@link Updateable.onAfterUpdate} */
1285
+ onBeforeUpdate: Event<unknown>;
1286
+ /** {@link Disposable.onDisposed} */
1287
+ readonly onDisposed: Event<undefined>;
1288
+ readonly onResize: Event<THREE.Vector2>;
1289
+ /**
1290
+ * Event that fires when there has been a change to the list of clipping
1291
+ * planes used by the active renderer.
1292
+ */
1293
+ readonly onClippingPlanesUpdated: Event<unknown>;
1294
+ abstract update(delta?: number): void | Promise<void>;
1295
+ abstract dispose(): void;
1296
+ abstract getSize(): Vector2;
1297
+ abstract resize(size: Vector2 | undefined): void;
1298
+ /**
1299
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1300
+ * instance of the renderer.
1301
+ */
1302
+ clippingPlanes: THREE.Plane[];
1303
+ /**
1304
+ * Forces the update of the clipping planes and all components that depend
1305
+ * on them that are subscribed to 'onClippingPlanesUpdated'.
1306
+ */
1307
+ updateClippingPlanes(): void;
1308
+ /**
1309
+ * Adds or removes a
1310
+ * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1311
+ * to the renderer.
1312
+ */
1313
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1314
+ }
1315
+ import * as THREE from "three";
1316
+ import { BaseScene } from "./base-scene";
1317
+ import { BaseCamera } from "./base-camera";
1318
+ import { BaseRenderer } from "./base-renderer";
1319
+ import { Updateable, Disposable } from "./interfaces";
1320
+ export interface World extends Disposable, Updateable {
1321
+ meshes: Set<THREE.Mesh>;
1322
+ scene: BaseScene;
1323
+ camera: BaseCamera;
1324
+ renderer: BaseRenderer | null;
1325
+ uuid: string;
1326
+ }
1327
+ import * as THREE from "three";
1328
+ import { BaseScene, Configurable, Event } from "../../Types";
1329
+ import { Components } from "../../Components";
1330
+ export interface SimpleSceneConfig {
1331
+ directionalLight: {
1332
+ color: THREE.Color;
1333
+ intensity: number;
1334
+ position: THREE.Vector3;
1335
+ };
1336
+ ambientLight: {
1337
+ color: THREE.Color;
1338
+ intensity: number;
1339
+ };
1340
+ }
1341
+ /**
1342
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1343
+ * objects hierarchically, and easily dispose them when you are finished with it.
1344
+ * @noInheritDoc
1345
+ */
1346
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1347
+ /** {@link Configurable.isSetup} */
1348
+ isSetup: boolean;
1349
+ three: THREE.Scene;
1350
+ /** {@link Configurable.onSetup} */
1351
+ readonly onSetup: Event<SimpleScene>;
1352
+ config: Required<SimpleSceneConfig>;
1584
1353
  constructor(components: Components);
1585
- /** Whether is component is {@link Disposable}. */
1586
- isDisposeable: () => this is Disposable;
1587
- /** Whether is component is {@link Resizeable}. */
1588
- isResizeable: () => this is Resizeable;
1589
- /** Whether is component is {@link Updateable}. */
1590
- isUpdateable: () => this is Updateable;
1591
- /** Whether is component is {@link Hideable}. */
1592
- isHideable: () => this is Hideable;
1593
- /** Whether is component is {@link Configurable}. */
1594
- isConfigurable: () => this is Configurable<any>;
1354
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1355
+ setup(config?: Partial<SimpleSceneConfig>): void;
1356
+ }
1357
+ import * as THREE from "three";
1358
+ import { BaseRenderer, Event } from "../../Types";
1359
+ import { Components } from "../../Components";
1360
+ /**
1361
+ * A basic renderer capable of rendering
1362
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1363
+ */
1364
+ export declare class SimpleRenderer extends BaseRenderer {
1365
+ enabled: boolean;
1366
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
1367
+ container: HTMLElement;
1368
+ three: THREE.WebGLRenderer;
1369
+ protected _canvas: HTMLCanvasElement;
1370
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1371
+ protected _resizeObserver: ResizeObserver | null;
1372
+ protected onContainerUpdated: Event<unknown>;
1373
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1374
+ /** {@link Updateable.update} */
1375
+ update(): void;
1376
+ /** {@link Disposable.dispose} */
1377
+ dispose(): void;
1378
+ /** {@link Resizeable.getSize}. */
1379
+ getSize(): THREE.Vector2;
1380
+ /** {@link Resizeable.resize} */
1381
+ resize: (size?: THREE.Vector2) => void;
1382
+ setupEvents(active: boolean): void;
1383
+ private resizeEvent;
1384
+ private setupRenderer;
1385
+ private onContextLost;
1386
+ private onContextBack;
1387
+ }
1388
+ import { InverseAttribute } from "./types";
1389
+ export declare const relToAttributesMap: Map<number, {
1390
+ forRelating: InverseAttribute;
1391
+ forRelated: InverseAttribute;
1392
+ }>;
1393
+ /// <reference types="node" />
1394
+ import * as THREE from "three";
1395
+ import { Hideable, Event, World } from "../../Types";
1396
+ import { Components } from "../../Components";
1397
+ export interface GridConfig {
1398
+ color: THREE.Color;
1399
+ size1: number;
1400
+ size2: number;
1401
+ distance: number;
1402
+ }
1403
+ /**
1404
+ * An infinite grid. Created by
1405
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1406
+ * and translated to typescript by
1407
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1408
+ */
1409
+ export declare class SimpleGrid implements Hideable, Disposable {
1410
+ /** {@link Disposable.onDisposed} */
1411
+ readonly onDisposed: Event<unknown>;
1412
+ world: World;
1413
+ components: Components;
1414
+ /** {@link Hideable.visible} */
1415
+ get visible(): boolean;
1416
+ /** {@link Hideable.visible} */
1417
+ set visible(visible: boolean);
1418
+ /** The material of the grid. */
1419
+ get material(): THREE.ShaderMaterial;
1420
+ /**
1421
+ * Whether the grid should fade away with distance. Recommended to be true for
1422
+ * perspective cameras and false for orthographic cameras.
1423
+ */
1424
+ get fade(): boolean;
1425
+ /**
1426
+ * Whether the grid should fade away with distance. Recommended to be true for
1427
+ * perspective cameras and false for orthographic cameras.
1428
+ */
1429
+ set fade(active: boolean);
1430
+ readonly three: THREE.Mesh;
1431
+ private _fade;
1432
+ constructor(components: Components, world: World, config: GridConfig);
1433
+ [Symbol.dispose](): void;
1434
+ /** {@link Disposable.dispose} */
1435
+ dispose(): void;
1436
+ private setupEvents;
1437
+ private updateZoom;
1438
+ }
1439
+ import * as THREE from "three";
1440
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1441
+ import { Components } from "../../Components";
1442
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1443
+ /**
1444
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1445
+ */
1446
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1447
+ readonly onAfterUpdate: Event<unknown>;
1448
+ readonly onBeforeUpdate: Event<unknown>;
1449
+ enabled: boolean;
1450
+ uuid: string;
1451
+ readonly onDisposed: Event<unknown>;
1452
+ private _scene?;
1453
+ private _camera?;
1454
+ private _renderer;
1455
+ get scene(): T;
1456
+ set scene(scene: T);
1457
+ get camera(): U;
1458
+ set camera(camera: U);
1459
+ get renderer(): S | null;
1460
+ set renderer(renderer: S | null);
1461
+ constructor(components: Components);
1462
+ update(delta?: number): void;
1463
+ dispose(disposeResources?: boolean): void;
1595
1464
  }
1465
+ import * as THREE from "three";
1466
+ import CameraControls from "camera-controls";
1467
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1468
+ import { Components } from "../../Components";
1596
1469
  /**
1597
- * Simple event handler by
1598
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1599
- * Keep in mind that:
1600
- * - If you want to remove it later, you might want to declare the callback as
1601
- * an object.
1602
- * - If you want to maintain the reference to 'this', you will need to declare
1603
- * the callback as an arrow function.
1470
+ * A basic camera that uses
1471
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1472
+ * easily control the camera in 2D and 3D. Check out it's API to find out
1473
+ * what features it offers.
1604
1474
  */
1605
- export declare class AsyncEvent<T> {
1475
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1476
+ /** {@link Updateable.onBeforeUpdate} */
1477
+ readonly onBeforeUpdate: Event<SimpleCamera>;
1478
+ /** {@link Updateable.onAfterUpdate} */
1479
+ readonly onAfterUpdate: Event<SimpleCamera>;
1480
+ readonly onAspectUpdated: Event<unknown>;
1481
+ /** {@link Disposable.onDisposed} */
1482
+ readonly onDisposed: Event<string>;
1483
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1484
+ private _allControls;
1606
1485
  /**
1607
- * Add a callback to this event instance.
1608
- * @param handler - the callback to be added to this event.
1486
+ * The object that controls the camera. An instance of
1487
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1488
+ * Transforming the camera directly will have no effect: you need to use this
1489
+ * object to move, rotate, look at objects, etc.
1609
1490
  */
1610
- add(handler: T extends void ? {
1611
- (): Promise<void>;
1612
- } : {
1613
- (data: T): Promise<void>;
1614
- }): void;
1491
+ get controls(): CameraControls;
1492
+ /** {@link Component.enabled} */
1493
+ get enabled(): boolean;
1494
+ /** {@link Component.enabled} */
1495
+ set enabled(enabled: boolean);
1496
+ constructor(components: Components);
1497
+ /** {@link Disposable.dispose} */
1498
+ dispose(): void;
1499
+ /** {@link Updateable.update} */
1500
+ update(_delta: number): void;
1615
1501
  /**
1616
- * Removes a callback from this event instance.
1617
- * @param handler - the callback to be removed from this event.
1502
+ * Updates the aspect of the camera to match the size of the
1503
+ * {@link Components.renderer}.
1618
1504
  */
1619
- remove(handler: T extends void ? {
1620
- (): Promise<void>;
1621
- } : {
1622
- (data: T): Promise<void>;
1623
- }): void;
1624
- /** Triggers all the callbacks assigned to this event. */
1625
- trigger: (data?: T) => Promise<void>;
1626
- /** Gets rid of all the suscribed events. */
1627
- reset(): void;
1628
- private handlers;
1505
+ updateAspect: () => void;
1506
+ private setupCamera;
1507
+ private newCameraControls;
1508
+ private setupEvents;
1509
+ private static getSubsetOfThree;
1629
1510
  }
1630
- import { Base } from "./base";
1631
- import { World } from "./world";
1632
- import { Event } from "./event";
1511
+ import * as THREE from "three";
1633
1512
  import { Components } from "../../Components";
1513
+ import { Event, World, Disposable } from "../../Types";
1514
+ import { Mouse } from "./mouse";
1634
1515
  /**
1635
- * One of the elements that make a world. It can be either a scene, a camera
1636
- * or a renderer.
1516
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1517
+ * that allows to easily get items from the scene using the mouse and touch
1518
+ * events.
1637
1519
  */
1638
- export declare abstract class BaseWorldItem extends Base {
1639
- readonly worlds: Map<string, World>;
1640
- readonly onWorldChanged: Event<{
1641
- world: World;
1642
- action: "added" | "removed";
1643
- }>;
1644
- currentWorld: World | null;
1645
- protected constructor(components: Components);
1520
+ export declare class SimpleRaycaster implements Disposable {
1521
+ /** {@link Component.enabled} */
1522
+ enabled: boolean;
1523
+ components: Components;
1524
+ /** {@link Disposable.onDisposed} */
1525
+ readonly onDisposed: Event<unknown>;
1526
+ /** The position of the mouse in the screen. */
1527
+ readonly mouse: Mouse;
1528
+ readonly three: THREE.Raycaster;
1529
+ world: World;
1530
+ constructor(components: Components, world: World);
1531
+ /** {@link Disposable.dispose} */
1532
+ dispose(): void;
1533
+ /**
1534
+ * Throws a ray from the camera to the mouse or touch event point and returns
1535
+ * the first item found. This also takes into account the clipping planes
1536
+ * used by the renderer.
1537
+ *
1538
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1539
+ * to query. If not provided, it will query all the meshes stored in
1540
+ * {@link Components.meshes}.
1541
+ */
1542
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1543
+ castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
1544
+ private intersect;
1545
+ private filterClippingPlanes;
1646
1546
  }
1647
1547
  import * as THREE from "three";
1648
- import CameraControls from "camera-controls";
1649
- import { BaseWorldItem } from "./base-world-item";
1650
- import { CameraControllable } from "./interfaces";
1651
- export declare abstract class BaseCamera extends BaseWorldItem {
1652
- abstract enabled: boolean;
1653
- abstract three: THREE.Camera;
1654
- abstract controls?: CameraControls;
1655
- /** Whether is instance is {@link CameraControllable}. */
1656
- hasCameraControls: () => this is CameraControllable;
1548
+ import { Components } from "../../Components";
1549
+ import { AsyncEvent, Event, World } from "../../Types";
1550
+ export interface CullerRendererSettings {
1551
+ updateInterval?: number;
1552
+ width?: number;
1553
+ height?: number;
1554
+ autoUpdate?: boolean;
1657
1555
  }
1658
- import * as THREE from "three";
1659
- import { Vector2 } from "three";
1660
- import { Event } from "./event";
1661
- import { BaseWorldItem } from "./base-world-item";
1662
- import { Disposable, Resizeable, Updateable } from "./interfaces";
1663
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1664
- abstract three: THREE.WebGLRenderer;
1665
- /** {@link Updateable.onBeforeUpdate} */
1666
- onAfterUpdate: Event<unknown>;
1667
- /** {@link Updateable.onAfterUpdate} */
1668
- onBeforeUpdate: Event<unknown>;
1556
+ /**
1557
+ * A base renderer to determine visibility on screen
1558
+ */
1559
+ export declare class CullerRenderer {
1669
1560
  /** {@link Disposable.onDisposed} */
1670
- readonly onDisposed: Event<undefined>;
1671
- readonly onResize: Event<THREE.Vector2>;
1561
+ readonly onDisposed: Event<string>;
1672
1562
  /**
1673
- * Event that fires when there has been a change to the list of clipping
1674
- * planes used by the active renderer.
1563
+ * Fires after making the visibility check to the meshes. It lists the
1564
+ * meshes that are currently visible, and the ones that were visible
1565
+ * just before but not anymore.
1675
1566
  */
1676
- readonly onClippingPlanesUpdated: Event<unknown>;
1677
- abstract update(delta?: number): void | Promise<void>;
1678
- abstract dispose(): void;
1679
- abstract getSize(): Vector2;
1680
- abstract resize(size: Vector2 | undefined): void;
1567
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1568
+ /** {@link Component.enabled} */
1569
+ enabled: boolean;
1681
1570
  /**
1682
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1683
- * instance of the renderer.
1571
+ * Needs to check whether there are objects that need to be hidden or shown.
1572
+ * You can bind this to the camera movement, to a certain interval, etc.
1684
1573
  */
1685
- clippingPlanes: THREE.Plane[];
1574
+ needsUpdate: boolean;
1686
1575
  /**
1687
- * Forces the update of the clipping planes and all components that depend
1688
- * on them that are subscribed to 'onClippingPlanesUpdated'.
1576
+ * Render the internal scene used to determine the object visibility. Used
1577
+ * for debugging purposes.
1689
1578
  */
1690
- updateClippingPlanes(): void;
1579
+ renderDebugFrame: boolean;
1580
+ components: Components;
1581
+ readonly world: World;
1582
+ readonly renderer: THREE.WebGLRenderer;
1583
+ protected autoUpdate: boolean;
1584
+ protected updateInterval: number;
1585
+ protected readonly worker: Worker;
1586
+ protected readonly scene: THREE.Scene;
1587
+ private _width;
1588
+ private _height;
1589
+ private _availableColor;
1590
+ private readonly renderTarget;
1591
+ private readonly bufferSize;
1592
+ private readonly _buffer;
1593
+ protected _isWorkerBusy: boolean;
1594
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1595
+ /** {@link Disposable.dispose} */
1596
+ dispose(): void;
1691
1597
  /**
1692
- * Adds or removes a
1693
- * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1694
- * to the renderer.
1598
+ * The function that the culler uses to reprocess the scene. Generally it's
1599
+ * better to call needsUpdate, but you can also call this to force it.
1600
+ * @param force if true, it will refresh the scene even if needsUpdate is
1601
+ * not true.
1695
1602
  */
1696
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1603
+ updateVisibility: (force?: boolean) => Promise<void>;
1604
+ protected getAvailableColor(): {
1605
+ r: number;
1606
+ g: number;
1607
+ b: number;
1608
+ code: string;
1609
+ };
1610
+ protected increaseColor(): void;
1611
+ protected decreaseColor(): void;
1612
+ private applySettings;
1697
1613
  }
1698
1614
  import * as THREE from "three";
1699
- import { Disposable } from "./interfaces";
1700
- import { Event } from "./event";
1615
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1701
1616
  import { Components } from "../../Components";
1702
- import { BaseWorldItem } from "./base-world-item";
1703
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1617
+ import { Event, World } from "../../Types";
1618
+ /**
1619
+ * A renderer to determine a mesh visibility on screen
1620
+ */
1621
+ export declare class MeshCullerRenderer extends CullerRenderer {
1622
+ threshold: number;
1623
+ readonly onViewUpdated: Event<{
1624
+ seen: Set<THREE.Mesh>;
1625
+ unseen: Set<THREE.Mesh>;
1626
+ }>;
1627
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1628
+ isProcessing: boolean;
1629
+ private _colorCodeMeshMap;
1630
+ private _meshIDColorCodeMap;
1631
+ private _currentVisibleMeshes;
1632
+ private _recentlyHiddenMeshes;
1633
+ private _intervalID;
1634
+ private readonly _transparentMat;
1635
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1636
+ dispose(): void;
1637
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1638
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1639
+ private handleWorkerMessage;
1640
+ private getAvailableMaterial;
1641
+ }
1642
+ import * as THREE from "three";
1643
+ import { Disposable, Event } from "../../Types";
1644
+ /**
1645
+ * A helper to easily get the real position of the mouse in the Three.js canvas
1646
+ * to work with tools like the
1647
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1648
+ * been transformed through CSS or doesn't occupy the whole screen.
1649
+ */
1650
+ export declare class Mouse implements Disposable {
1651
+ dom: HTMLCanvasElement;
1652
+ private _event?;
1653
+ private _position;
1704
1654
  /** {@link Disposable.onDisposed} */
1705
1655
  readonly onDisposed: Event<unknown>;
1706
- abstract three: THREE.Object3D;
1707
- protected constructor(components: Components);
1656
+ constructor(dom: HTMLCanvasElement);
1657
+ /**
1658
+ * The real position of the mouse of the Three.js canvas.
1659
+ */
1660
+ get position(): THREE.Vector2;
1708
1661
  /** {@link Disposable.dispose} */
1709
1662
  dispose(): void;
1663
+ private getPositionY;
1664
+ private getPositionX;
1665
+ private updateMouseInfo;
1666
+ private setupEvents;
1667
+ }
1668
+ import * as WEBIFC from "web-ifc";
1669
+ export declare class IfcMetadataReader {
1670
+ get(webIfc: WEBIFC.IfcAPI, type: number): string;
1710
1671
  }
1672
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1711
1673
  import * as THREE from "three";
1712
- import { BaseScene } from "./base-scene";
1713
- import { BaseCamera } from "./base-camera";
1714
- import { BaseRenderer } from "./base-renderer";
1715
- import { Updateable, Disposable } from "./interfaces";
1716
- export interface World extends Disposable, Updateable {
1717
- meshes: Set<THREE.Mesh>;
1718
- scene: BaseScene;
1719
- camera: BaseCamera;
1720
- renderer: BaseRenderer | null;
1721
- uuid: string;
1674
+ import * as WEBIFC from "web-ifc";
1675
+ import * as FRAGS from "@thatopen/fragments";
1676
+ export declare class CivilReader {
1677
+ defLineMat: THREE.LineBasicMaterial;
1678
+ read(webIfc: WEBIFC.IfcAPI): {
1679
+ alignments: Map<number, FRAGS.Alignment>;
1680
+ coordinationMatrix: THREE.Matrix4;
1681
+ } | undefined;
1682
+ get(civilItems: any): {
1683
+ alignments: Map<number, FRAGS.Alignment>;
1684
+ coordinationMatrix: THREE.Matrix4;
1685
+ } | undefined;
1686
+ private getCurves;
1687
+ }
1688
+ import * as WEBIFC from "web-ifc";
1689
+ /** Configuration of the IFC-fragment conversion. */
1690
+ export declare class IfcFragmentSettings {
1691
+ /** Whether to extract the IFC properties into a JSON. */
1692
+ includeProperties: boolean;
1693
+ /**
1694
+ * Generate the geometry for categories that are not included by default,
1695
+ * like IFCSPACE.
1696
+ */
1697
+ optionalCategories: number[];
1698
+ /** Whether to use the coordination data coming from the IFC files. */
1699
+ coordinate: boolean;
1700
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1701
+ wasm: {
1702
+ path: string;
1703
+ absolute: boolean;
1704
+ logLevel?: WEBIFC.LogLevel;
1705
+ };
1706
+ /** List of categories that won't be converted to fragments. */
1707
+ excludedCategories: Set<number>;
1708
+ /** Whether to save the absolute location of all IFC items. */
1709
+ saveLocations: boolean;
1710
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1711
+ webIfc: WEBIFC.LoaderSettings;
1712
+ autoSetWasm: boolean;
1713
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1714
+ }
1715
+ import { NavigationMode } from "./types";
1716
+ import { OrthoPerspectiveCamera } from "../index";
1717
+ /**
1718
+ * A {@link NavigationMode} that allows first person navigation,
1719
+ * simulating FPS video games.
1720
+ */
1721
+ export declare class FirstPersonMode implements NavigationMode {
1722
+ private camera;
1723
+ /** {@link NavigationMode.enabled} */
1724
+ enabled: boolean;
1725
+ /** {@link NavigationMode.id} */
1726
+ readonly id = "FirstPerson";
1727
+ constructor(camera: OrthoPerspectiveCamera);
1728
+ /** {@link NavigationMode.set} */
1729
+ set(active: boolean): void;
1730
+ private setupFirstPersonCamera;
1731
+ }
1732
+ import { NavigationMode } from "./types";
1733
+ import { OrthoPerspectiveCamera } from "../index";
1734
+ /**
1735
+ * A {@link NavigationMode} that allows 3D navigation and panning
1736
+ * like in many 3D and CAD softwares.
1737
+ */
1738
+ export declare class OrbitMode implements NavigationMode {
1739
+ camera: OrthoPerspectiveCamera;
1740
+ /** {@link NavigationMode.enabled} */
1741
+ enabled: boolean;
1742
+ /** {@link NavigationMode.id} */
1743
+ readonly id = "Orbit";
1744
+ constructor(camera: OrthoPerspectiveCamera);
1745
+ /** {@link NavigationMode.set} */
1746
+ set(active: boolean): void;
1747
+ private activateOrbitControls;
1748
+ }
1749
+ import { NavigationMode } from "./types";
1750
+ import { OrthoPerspectiveCamera } from "../index";
1751
+ /**
1752
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1753
+ * like many BIM tools.
1754
+ */
1755
+ export declare class PlanMode implements NavigationMode {
1756
+ private camera;
1757
+ /** {@link NavigationMode.enabled} */
1758
+ enabled: boolean;
1759
+ /** {@link NavigationMode.id} */
1760
+ readonly id = "Plan";
1761
+ private mouseAction1?;
1762
+ private mouseAction2?;
1763
+ private mouseInitialized;
1764
+ private readonly defaultAzimuthSpeed;
1765
+ private readonly defaultPolarSpeed;
1766
+ constructor(camera: OrthoPerspectiveCamera);
1767
+ /** {@link NavigationMode.set} */
1768
+ set(active: boolean): void;
1722
1769
  }
1723
1770
  import * as THREE from "three";
1724
1771
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -1781,6 +1828,70 @@ export declare class SimplePlane implements Disposable, Hideable {
1781
1828
  private newHelper;
1782
1829
  private static newPlaneMesh;
1783
1830
  }
1831
+ import * as THREE from "three";
1832
+ import { CameraProjection } from "./types";
1833
+ import { Event } from "../../Types";
1834
+ import { OrthoPerspectiveCamera } from "../index";
1835
+ /**
1836
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1837
+ */
1838
+ export declare class ProjectionManager {
1839
+ /**
1840
+ * Event that fires when the {@link CameraProjection} changes.
1841
+ */
1842
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1843
+ current: CameraProjection;
1844
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1845
+ private _component;
1846
+ private _previousDistance;
1847
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1848
+ matchOrthoDistanceEnabled: boolean;
1849
+ constructor(camera: OrthoPerspectiveCamera);
1850
+ /**
1851
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1852
+ *
1853
+ * @param projection - the new projection to set. If it is the current projection,
1854
+ * it will have no effect.
1855
+ */
1856
+ set(projection: CameraProjection): Promise<void>;
1857
+ /**
1858
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1859
+ * and vice versa.
1860
+ */
1861
+ toggle(): Promise<void>;
1862
+ private setOrthoCamera;
1863
+ private getPerspectiveDims;
1864
+ private setupOrthoCamera;
1865
+ private getDistance;
1866
+ private setPerspectiveCamera;
1867
+ }
1868
+ /**
1869
+ * The projection system of the camera.
1870
+ */
1871
+ export type CameraProjection = "Perspective" | "Orthographic";
1872
+ /**
1873
+ * The extensible list of supported navigation modes.
1874
+ */
1875
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1876
+ /**
1877
+ * An object that determines the behavior of the camera controls
1878
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1879
+ */
1880
+ export interface NavigationMode {
1881
+ /** The unique ID of this navigation mode. */
1882
+ id: NavModeID;
1883
+ /**
1884
+ * Enable or disable this navigation mode.
1885
+ * When a new navigation mode is enabled, the previous navigation mode
1886
+ * must be disabled.
1887
+ *
1888
+ * @param active - whether to enable or disable this mode.
1889
+ * @param options - any additional data required to enable or disable it.
1890
+ * */
1891
+ set: (active: boolean, options?: any) => void;
1892
+ /** Whether this navigation mode is active or not. */
1893
+ enabled: boolean;
1894
+ }
1784
1895
  import * as WEBIFC from "web-ifc";
1785
1896
  import * as THREE from "three";
1786
1897
  export declare class Units {
@@ -1791,52 +1902,6 @@ export declare class Units {
1791
1902
  private getLengthUnits;
1792
1903
  private getScaleMatrix;
1793
1904
  }
1794
- import * as WEBIFC from "web-ifc";
1795
- /** Configuration of the IFC-fragment conversion. */
1796
- export declare class IfcFragmentSettings {
1797
- /** Whether to extract the IFC properties into a JSON. */
1798
- includeProperties: boolean;
1799
- /**
1800
- * Generate the geometry for categories that are not included by default,
1801
- * like IFCSPACE.
1802
- */
1803
- optionalCategories: number[];
1804
- /** Whether to use the coordination data coming from the IFC files. */
1805
- coordinate: boolean;
1806
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1807
- wasm: {
1808
- path: string;
1809
- absolute: boolean;
1810
- logLevel?: WEBIFC.LogLevel;
1811
- };
1812
- /** List of categories that won't be converted to fragments. */
1813
- excludedCategories: Set<number>;
1814
- /** Whether to save the absolute location of all IFC items. */
1815
- saveLocations: boolean;
1816
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1817
- webIfc: WEBIFC.LoaderSettings;
1818
- autoSetWasm: boolean;
1819
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1820
- }
1821
- import * as THREE from "three";
1822
- import * as WEBIFC from "web-ifc";
1823
- import * as FRAGS from "@thatopen/fragments";
1824
- export declare class CivilReader {
1825
- defLineMat: THREE.LineBasicMaterial;
1826
- read(webIfc: WEBIFC.IfcAPI): {
1827
- alignments: Map<number, FRAGS.Alignment>;
1828
- coordinationMatrix: THREE.Matrix4;
1829
- } | undefined;
1830
- get(civilItems: any): {
1831
- alignments: Map<number, FRAGS.Alignment>;
1832
- coordinationMatrix: THREE.Matrix4;
1833
- } | undefined;
1834
- private getCurves;
1835
- }
1836
- import * as WEBIFC from "web-ifc";
1837
- export declare class IfcMetadataReader {
1838
- get(webIfc: WEBIFC.IfcAPI, type: number): string;
1839
- }
1840
1905
  import { IfcFragmentSettings } from "../../IfcLoader/src";
1841
1906
  /** Configuration of the IFC-fragment streaming. */
1842
1907
  export declare class IfcStreamingSettings extends IfcFragmentSettings {
@@ -1847,6 +1912,21 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1847
1912
  export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1848
1913
  propertiesSize: number;
1849
1914
  }
1915
+ export interface StreamedGeometries {
1916
+ [id: number]: {
1917
+ boundingBox: Float32Array;
1918
+ hasHoles: boolean;
1919
+ geometryFile?: string;
1920
+ };
1921
+ }
1922
+ export interface StreamedAsset {
1923
+ id: number;
1924
+ geometries: {
1925
+ geometryID: number;
1926
+ transformation: number[];
1927
+ color: number[];
1928
+ }[];
1929
+ }
1850
1930
  import * as WEBIFC from "web-ifc";
1851
1931
  import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1852
1932
  import { PropertiesStreamingSettings } from "./streaming-settings";
@@ -1874,21 +1954,6 @@ export declare class FragmentPropsStreamConverter extends Component implements D
1874
1954
  private getIndices;
1875
1955
  private cleanUp;
1876
1956
  }
1877
- export interface StreamedGeometries {
1878
- [id: number]: {
1879
- boundingBox: Float32Array;
1880
- hasHoles: boolean;
1881
- geometryFile?: string;
1882
- };
1883
- }
1884
- export interface StreamedAsset {
1885
- id: number;
1886
- geometries: {
1887
- geometryID: number;
1888
- transformation: number[];
1889
- color: number[];
1890
- }[];
1891
- }
1892
1957
  export type RelationsMap = Map<number, Map<number, number[]>>;
1893
1958
  export interface ModelsRelationMap {
1894
1959
  [modelID: string]: RelationsMap;