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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/core/Clipper/index.d.ts +8 -12
  2. package/dist/core/Clipper/src/simple-plane.d.ts +2 -2
  3. package/dist/core/Grids/index.d.ts +1 -1
  4. package/dist/core/Grids/src/simple-grid.d.ts +1 -3
  5. package/dist/core/MiniMap/index.d.ts +3 -2
  6. package/dist/core/MiniMap/src/index.d.ts +1 -1
  7. package/dist/core/OrthoPerspectiveCamera/index.d.ts +5 -4
  8. package/dist/core/OrthoPerspectiveCamera/src/first-person-mode.d.ts +2 -1
  9. package/dist/core/OrthoPerspectiveCamera/src/orbit-mode.d.ts +3 -2
  10. package/dist/core/OrthoPerspectiveCamera/src/plan-mode.d.ts +2 -1
  11. package/dist/core/OrthoPerspectiveCamera/src/projections.d.ts +3 -3
  12. package/dist/core/Raycasters/src/simple-raycaster.d.ts +1 -1
  13. package/dist/core/Worlds/src/simple-camera.d.ts +1 -1
  14. package/dist/core/Worlds/src/simple-renderer.d.ts +1 -1
  15. package/dist/core/index.d.ts +0 -1
  16. package/dist/fragments/{BoundingBoxes → BoundingBoxer}/index.d.ts +1 -1
  17. package/dist/fragments/{FragmentClassifier → Classifier}/index.d.ts +1 -1
  18. package/dist/fragments/{FragmentExploder → Exploder}/index.d.ts +3 -5
  19. package/dist/fragments/{FragmentManager → FragmentsManager}/index.d.ts +1 -1
  20. package/dist/fragments/IfcGeometryTiler/src/streaming-settings.d.ts +1 -1
  21. package/dist/fragments/{FragmentIfcLoader → IfcLoader}/index.d.ts +1 -2
  22. package/dist/fragments/index.d.ts +6 -6
  23. package/dist/ifc/IfcJsonExporter/index.d.ts +6 -1
  24. package/dist/ifc/IfcPropertiesManager/index.d.ts +1 -2
  25. package/dist/ifc/index.d.ts +0 -1
  26. package/dist/index.cjs +5 -5
  27. package/dist/index.mjs +1791 -2051
  28. package/dist/measurement/Utils/index.d.ts +9 -5
  29. package/dist/namespace.d.ts +1222 -1330
  30. package/dist/utils/vertex-picker.d.ts +2 -5
  31. package/package.json +2 -3
  32. package/dist/core/Materials/index.d.ts +0 -49
  33. package/dist/ifc/IfcPropertiesFinder/index.d.ts +0 -37
  34. package/dist/ifc/IfcPropertiesFinder/src/types.d.ts +0 -23
  35. /package/dist/fragments/{FragmentHider → Hider}/index.d.ts +0 -0
  36. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/civil-reader.d.ts +0 -0
  37. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/ifc-fragment-settings.d.ts +0 -0
  38. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/ifc-metadata-reader.d.ts +0 -0
  39. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/index.d.ts +0 -0
  40. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/spatial-structure.d.ts +0 -0
  41. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/transform-helper.d.ts +0 -0
  42. /package/dist/fragments/{FragmentIfcLoader → IfcLoader}/src/units.d.ts +0 -0
@@ -1,16 +1,46 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, World, Event } from "../Types";
3
- import { SimpleRaycaster } from "./src";
2
+ import * as THREE from "three";
4
3
  import { Components } from "../Components";
5
- export declare class Raycasters extends Component implements Disposable {
6
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
4
+ import { Component } from "../Types";
5
+ /**
6
+ * A tool to safely remove meshes and geometries from memory to
7
+ * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
8
+ */
9
+ export declare class Disposer extends Component {
10
+ private _disposedComponents;
11
+ /** {@link Component.enabled} */
7
12
  enabled: boolean;
8
- list: Map<string, SimpleRaycaster>;
9
- onDisposed: Event<unknown>;
13
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
10
14
  constructor(components: Components);
11
- get(world: World): SimpleRaycaster;
12
- delete(world: World): void;
13
- dispose(): void;
15
+ /**
16
+ * {@link Component.uuid}.
17
+ * @return the list of UUIDs of deleted components.
18
+ */
19
+ get(): Set<string>;
20
+ /**
21
+ * Removes a mesh, its geometry and its materials from memory. If you are
22
+ * using any of these in other parts of the application, make sure that you
23
+ * remove them from the mesh before disposing it.
24
+ *
25
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
26
+ * to remove.
27
+ *
28
+ * @param materials - whether to dispose the materials of the mesh.
29
+ *
30
+ * @param recursive - whether to recursively dispose the children of the mesh.
31
+ */
32
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
33
+ /**
34
+ * Disposes a geometry from memory.
35
+ *
36
+ * @param geometry - the
37
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
38
+ * to remove.
39
+ */
40
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
41
+ private disposeGeometryAndMaterials;
42
+ private disposeChildren;
43
+ private static disposeMaterial;
14
44
  }
15
45
  import { Component, Disposable, Event } from "../Types";
16
46
  /**
@@ -65,60 +95,17 @@ export declare class Components implements Disposable {
65
95
  private static setupBVH;
66
96
  }
67
97
  import { Component, Disposable, World, Event } from "../Types";
68
- import { GridConfig, SimpleGrid } from "./src";
69
- export declare class Grids extends Component implements Disposable {
70
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
71
- list: Map<string, SimpleGrid>;
72
- onDisposed: Event<unknown>;
73
- config: Required<GridConfig>;
74
- /** {@link Component.enabled} */
75
- enabled: boolean;
76
- create(world: World): void;
77
- delete(world: World): void;
78
- dispose(): void;
79
- }
80
- import * as THREE from "three";
98
+ import { SimpleRaycaster } from "./src";
81
99
  import { Components } from "../Components";
82
- import { Component } from "../Types";
83
- /**
84
- * A tool to safely remove meshes and geometries from memory to
85
- * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
86
- */
87
- export declare class Disposer extends Component {
88
- private _disposedComponents;
89
- /** {@link Component.enabled} */
100
+ export declare class Raycasters extends Component implements Disposable {
101
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
90
102
  enabled: boolean;
91
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
103
+ list: Map<string, SimpleRaycaster>;
104
+ onDisposed: Event<unknown>;
92
105
  constructor(components: Components);
93
- /**
94
- * {@link Component.uuid}.
95
- * @return the list of UUIDs of deleted components.
96
- */
97
- get(): Set<string>;
98
- /**
99
- * Removes a mesh, its geometry and its materials from memory. If you are
100
- * using any of these in other parts of the application, make sure that you
101
- * remove them from the mesh before disposing it.
102
- *
103
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
104
- * to remove.
105
- *
106
- * @param materials - whether to dispose the materials of the mesh.
107
- *
108
- * @param recursive - whether to recursively dispose the children of the mesh.
109
- */
110
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
111
- /**
112
- * Disposes a geometry from memory.
113
- *
114
- * @param geometry - the
115
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
116
- * to remove.
117
- */
118
- disposeGeometry(geometry: THREE.BufferGeometry): void;
119
- private disposeGeometryAndMaterials;
120
- private disposeChildren;
121
- private static disposeMaterial;
106
+ get(world: World): SimpleRaycaster;
107
+ delete(world: World): void;
108
+ dispose(): void;
122
109
  }
123
110
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
124
111
  import { Components } from "../Components";
@@ -145,15 +132,14 @@ import { Components } from "../Components";
145
132
  * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
146
133
  *
147
134
  * @param components - the instance of {@link Components} used.
148
- * @param planeType - the type of plane to be used by the clipper.
149
135
  * E.g. {@link SimplePlane}.
150
136
  */
151
- export declare class Clipper<T extends SimplePlane> extends Component implements Createable, Disposable, Hideable {
137
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
152
138
  static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
153
139
  /** {@link Createable.onAfterCreate} */
154
- readonly onAfterCreate: Event<T>;
140
+ readonly onAfterCreate: Event<SimplePlane>;
155
141
  /** {@link Createable.onAfterDelete} */
156
- readonly onAfterDelete: Event<T>;
142
+ readonly onAfterDelete: Event<SimplePlane>;
157
143
  /** Event that fires when the user starts dragging a clipping plane. */
158
144
  readonly onBeforeDrag: Event<void>;
159
145
  /** Event that fires when the user stops dragging a clipping plane. */
@@ -177,10 +163,10 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
177
163
  * has to be 'true' for this to apply.
178
164
  */
179
165
  toleranceOrthogonalY: number;
180
- list: T[];
181
- protected PlaneType: new (...args: any) => SimplePlane | T;
166
+ Type: new (...args: any) => SimplePlane;
167
+ list: SimplePlane[];
182
168
  /** The material used in all the clipping planes. */
183
- protected _material: THREE.MeshBasicMaterial;
169
+ private _material;
184
170
  private _size;
185
171
  private _enabled;
186
172
  private _visible;
@@ -201,8 +187,6 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
201
187
  /** The size of the geometric representation of the clippings planes. */
202
188
  set size(size: number);
203
189
  constructor(components: Components);
204
- endCreation(): void;
205
- cancelCreation(): void;
206
190
  /** {@link Disposable.dispose} */
207
191
  dispose(): void;
208
192
  /** {@link Createable.create} */
@@ -216,7 +200,7 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
216
200
  * @param point - the position of the clipping plane.
217
201
  * navigation.
218
202
  */
219
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): T;
203
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
220
204
  /**
221
205
  * {@link Createable.delete}
222
206
  *
@@ -224,7 +208,7 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
224
208
  * @param plane - the plane to delete. If undefined, the first plane
225
209
  * found under the cursor will be deleted.
226
210
  */
227
- delete(world: World, plane?: T): void;
211
+ delete(world: World, plane?: SimplePlane): void;
228
212
  /** Deletes all the existing clipping planes. */
229
213
  deleteAll(): void;
230
214
  private deletePlane;
@@ -234,62 +218,13 @@ export declare class Clipper<T extends SimplePlane> extends Component implements
234
218
  private getWorldNormal;
235
219
  private normalizePlaneDirectionY;
236
220
  private newPlane;
237
- protected newPlaneInstance(world: World, point: THREE.Vector3, normal: THREE.Vector3): T;
238
221
  private updateMaterialsAndPlanes;
239
222
  private _onStartDragging;
240
223
  private _onEndDragging;
241
224
  }
242
- import * as THREE from "three";
243
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
244
- center: THREE.Vector3;
245
- halfSizes: THREE.Vector3;
246
- rotation: THREE.Matrix3;
247
- transformation: THREE.Matrix4;
248
- };
249
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
250
- import * as THREE from "three";
251
- export declare class MaterialsUtils {
252
- static isTransparent(material: THREE.Material): boolean;
253
- }
254
- import * as THREE from "three";
255
- import { Component, Components, Event, World, Disposable } from "../core";
256
- export interface VertexPickerConfig {
257
- showOnlyVertex: boolean;
258
- snapDistance: number;
259
- previewElement: HTMLElement;
260
- }
261
- export declare class VertexPicker extends Component implements Disposable {
262
- onVertexFound: Event<THREE.Vector3>;
263
- onVertexLost: Event<THREE.Vector3>;
264
- components: Components;
265
- private _pickedPoint;
266
- private _config;
267
- private _enabled;
268
- private _workingPlane;
269
- /** {@link Disposable.onDisposed} */
270
- readonly onDisposed: Event<unknown>;
271
- set enabled(value: boolean);
272
- get enabled(): boolean;
273
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
274
- [Symbol.dispose](): void;
275
- set workingPlane(plane: THREE.Plane | null);
276
- get workingPlane(): THREE.Plane | null;
277
- set config(value: Partial<VertexPickerConfig>);
278
- get config(): Partial<VertexPickerConfig>;
279
- dispose(): void;
280
- get(world: World): THREE.Vector3 | null;
281
- private getClosestVertex;
282
- private getVertices;
283
- private getVertex;
284
- }
285
- export declare class UUID {
286
- private static _pattern;
287
- private static _lut;
288
- static create(): string;
289
- static validate(uuid: string): void;
290
- }
291
- import { Component, Components, Disposable, Updateable, World, Event } from "../../core";
292
225
  import { MiniMap } from "./src";
226
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
227
+ import { Components } from "../Components";
293
228
  export declare class MiniMaps extends Component implements Updateable, Disposable {
294
229
  static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
295
230
  readonly onAfterUpdate: Event<unknown>;
@@ -300,34 +235,12 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
300
235
  constructor(components: Components);
301
236
  create(world: World): MiniMap;
302
237
  delete(id: string): void;
303
- dispose(): void | Promise<void>;
304
- update(): void;
305
- }
306
- import { Components } from "../Components";
307
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
308
- import { Component, Event, Disposable, World } from "../Types";
309
- /**
310
- * A tool to handle big scenes efficiently by automatically hiding the objects
311
- * that are not visible to the camera.
312
- */
313
- export declare class Cullers extends Component implements Disposable {
314
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
315
- private _enabled;
316
- list: Map<string, MeshCullerRenderer>;
317
- /** {@link Disposable.onDisposed} */
318
- readonly onDisposed: Event<unknown>;
319
- /** {@link Component.enabled} */
320
- get enabled(): boolean;
321
- set enabled(value: boolean);
322
- constructor(components: Components);
323
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
324
- delete(world: World): void;
325
- /** {@link Disposable.dispose} */
326
238
  dispose(): void;
239
+ update(): void;
327
240
  }
328
241
  import * as THREE from "three";
329
- import { Components } from "../../core/Components";
330
- import { SimpleCamera } from "../../core";
242
+ import { Components } from "../Components";
243
+ import { SimpleCamera } from "..";
331
244
  import { NavigationMode, NavModeID, ProjectionManager } from "./src";
332
245
  /**
333
246
  * A flexible camera that uses
@@ -339,13 +252,14 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
339
252
  /**
340
253
  * The current {@link NavigationMode}.
341
254
  */
342
- mode: NavigationMode;
255
+ _mode: NavigationMode | null;
343
256
  readonly projection: ProjectionManager;
344
257
  readonly threeOrtho: THREE.OrthographicCamera;
258
+ readonly threePersp: THREE.PerspectiveCamera;
345
259
  protected readonly _userInputButtons: any;
346
260
  protected readonly _frustumSize = 50;
347
261
  protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
348
- get current(): THREE.PerspectiveCamera | THREE.OrthographicCamera;
262
+ get mode(): NavigationMode;
349
263
  constructor(components: Components);
350
264
  /** {@link Disposable.dispose} */
351
265
  dispose(): void;
@@ -374,369 +288,213 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
374
288
  private newOrthoCamera;
375
289
  private setOrthoCameraAspect;
376
290
  }
377
- import * as THREE from "three";
378
- import { Component, Disposable, Event } from "../Types";
379
291
  import { Components } from "../Components";
292
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
293
+ import { Component, Event, Disposable, World } from "../Types";
380
294
  /**
381
- * A tool to easily handle the materials of massive amounts of
382
- * objects and scene background easily.
295
+ * A tool to handle big scenes efficiently by automatically hiding the objects
296
+ * that are not visible to the camera.
383
297
  */
384
- export declare class Materials extends Component implements Disposable {
385
- static readonly uuid: "24989d27-fa2f-4797-8b08-35918f74e502";
386
- /** {@link Component.enabled} */
387
- enabled: boolean;
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>;
388
302
  /** {@link Disposable.onDisposed} */
389
- readonly onDisposed: Event<string>;
390
- list: {
391
- [id: string]: {
392
- material: THREE.Material;
393
- meshes: Set<THREE.Mesh | THREE.InstancedMesh>;
394
- };
395
- };
396
- private _originals;
303
+ readonly onDisposed: Event<unknown>;
304
+ /** {@link Component.enabled} */
305
+ get enabled(): boolean;
306
+ set enabled(value: boolean);
397
307
  constructor(components: Components);
308
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
309
+ delete(world: World): void;
398
310
  /** {@link Disposable.dispose} */
399
311
  dispose(): void;
400
- /**
401
- * Turns the specified material styles on or off.
402
- *
403
- * @param active whether to turn it on or off.
404
- * @param ids the ids of the style to turn on or off.
405
- */
406
- set(active: boolean, ids?: string[]): void;
407
- /**
408
- * Creates a new material style.
409
- * @param id the identifier of the style to create.
410
- * @param material the material of the style.
411
- */
412
- addMaterial(id: string, material: THREE.Material): void;
413
- /**
414
- * Assign meshes to a certain style.
415
- * @param id the identifier of the style.
416
- * @param meshes the meshes to assign to the style.
417
- */
418
- addMeshes(id: string, meshes: THREE.Mesh[]): void;
419
- /**
420
- * Remove meshes from a certain style.
421
- * @param id the identifier of the style.
422
- * @param meshes the meshes to assign to the style.
423
- */
424
- removeMeshes(id: string, meshes: THREE.Mesh[]): void;
425
- }
426
- import * as THREE from "three";
427
- export interface MeasureEdge {
428
- distance: number;
429
- points: THREE.Vector3[];
430
- }
431
- export declare class MeasurementUtils {
432
- static getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
433
- edges: MeasureEdge[];
434
- indices: Set<number>;
435
- } | null;
436
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
437
- private static getFaceData;
438
- static getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
439
- p1: THREE.Vector3;
440
- p2: THREE.Vector3;
441
- p3: THREE.Vector3;
442
- faceNormal: THREE.Vector3;
443
- };
444
- private static round;
445
312
  }
446
- import * as THREE from "three";
447
- import * as FRAGS from "@thatopen/fragments";
448
- import { FragmentsGroup } from "@thatopen/fragments";
449
- import { Component, Components, Disposable, Event } from "../../core";
313
+ import * as WEBIFC from "web-ifc";
314
+ import * as FRAG from "@thatopen/fragments";
315
+ import { Component, Components } from "../../core";
450
316
  /**
451
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
452
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
317
+ * Object to export all the properties from an IFC to a JS object.
453
318
  */
454
- export declare class BoundingBoxes extends Component implements Disposable {
455
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
319
+ export declare class IfcJsonExporter extends Component {
320
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
456
321
  /** {@link Component.enabled} */
457
322
  enabled: boolean;
458
- /** {@link Disposable.onDisposed} */
459
- readonly onDisposed: Event<unknown>;
460
- private _absoluteMin;
461
- private _absoluteMax;
462
- private _meshes;
463
323
  constructor(components: Components);
464
- static getDimensions(bbox: THREE.Box3): {
465
- width: number;
466
- height: number;
467
- depth: number;
468
- center: THREE.Vector3;
469
- };
470
- static newBound(positive: boolean): THREE.Vector3;
471
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
472
- /** {@link Disposable.dispose} */
473
- dispose(): void;
474
- get(): THREE.Box3;
475
- getSphere(): THREE.Sphere;
476
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
477
- reset(): void;
478
- add(group: FragmentsGroup): void;
479
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
480
- private static getFragmentBounds;
481
- }
482
- import * as THREE from "three";
483
- import * as FRAGS from "@thatopen/fragments";
484
- import { Disposable, Component, Event, Components } from "../../core";
485
- export interface Classification {
486
- [system: string]: {
487
- [className: string]: FRAGS.FragmentIdMap;
488
- };
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>;
489
333
  }
490
- export declare class FragmentClassifier extends Component implements Disposable {
491
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
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>;
492
341
  /** {@link Component.enabled} */
493
342
  enabled: boolean;
494
- list: Classification;
495
- /** {@link Disposable.onDisposed} */
496
- readonly onDisposed: Event<unknown>;
497
- constructor(components: Components);
498
- private onFragmentsDisposed;
343
+ create(world: World): SimpleGrid;
344
+ delete(world: World): void;
499
345
  dispose(): void;
500
- remove(guid: string): void;
501
- find(filter?: {
502
- [name: string]: string[];
503
- }): FRAGS.FragmentIdMap;
504
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
505
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
506
- byEntity(group: FRAGS.FragmentsGroup): void;
507
- byStorey(group: FRAGS.FragmentsGroup): void;
508
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
509
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
510
- resetColor(items: FRAGS.FragmentIdMap): void;
511
- private saveItem;
512
346
  }
347
+ import * as WEBIFC from "web-ifc";
348
+ import { FragmentsGroup } from "@thatopen/fragments";
513
349
  import { Component, Disposable, Event, Components } from "../../core";
514
- export declare class FragmentExploder extends Component implements Disposable {
515
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
516
- enabled: boolean;
517
- height: number;
518
- groupName: string;
350
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
351
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
352
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
353
+ interface ChangeMap {
354
+ [modelID: string]: Set<number>;
355
+ }
356
+ interface AttributeListener {
357
+ [modelID: string]: {
358
+ [expressID: number]: {
359
+ [attributeName: string]: Event<String | Boolean | Number>;
360
+ };
361
+ };
362
+ }
363
+ export declare class IfcPropertiesManager extends Component implements Disposable {
364
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
519
365
  /** {@link Disposable.onDisposed} */
520
366
  readonly onDisposed: Event<string>;
521
- list: Set<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
+ };
391
+ enabled: boolean;
392
+ attributeListeners: AttributeListener;
393
+ selectedModel?: FragmentsGroup;
394
+ changeMap: ChangeMap;
522
395
  constructor(components: Components);
523
396
  dispose(): void;
524
- explode(): void;
525
- reset(): void;
526
- update(): 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>>;
527
417
  }
528
- import * as FRAGS from "@thatopen/fragments";
529
- import { Components, Component } from "../../core";
530
- export declare class FragmentHider extends Component {
531
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
418
+ export {};
419
+ 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 {
532
426
  enabled: boolean;
427
+ static uuid: string;
533
428
  constructor(components: Components);
534
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
535
- isolate(items: FRAGS.FragmentIdMap): void;
536
- private updateCulledVisibility;
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;
537
442
  }
538
- import * as WEBIFC from "web-ifc";
539
- import * as FRAGS from "@thatopen/fragments";
540
- import { IfcFragmentSettings } from "./src";
541
- import { Component, Components, Event, Disposable } from "../../core";
542
- export declare class FragmentIfcLoader extends Component implements Disposable {
543
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
544
- readonly onIfcStartedLoading: Event<void>;
545
- readonly onSetup: Event<void>;
546
- /** {@link Disposable.onDisposed} */
547
- readonly onDisposed: Event<string>;
548
- settings: IfcFragmentSettings;
443
+ import { Component, Disposable, Event, Components } from "../../core";
444
+ export declare class Exploder extends Component implements Disposable {
445
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
549
446
  enabled: boolean;
550
- webIfc: WEBIFC.IfcAPI;
551
- private _material;
552
- private _spatialTree;
553
- private _metaData;
554
- private _fragmentInstances;
555
- private _civil;
556
- private _propertyExporter;
557
- private _visitedFragments;
558
- private _materialT;
447
+ height: number;
448
+ groupName: string;
449
+ /** {@link Disposable.onDisposed} */
450
+ readonly onDisposed: Event<unknown>;
451
+ list: Set<string>;
559
452
  constructor(components: Components);
560
453
  dispose(): void;
561
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
562
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
563
- readIfcFile(data: Uint8Array): Promise<number>;
564
- private getAllGeometries;
565
- cleanUp(): void;
566
- private getMesh;
567
- private getGeometry;
568
- private autoSetWasm;
454
+ set(active: boolean): void;
569
455
  }
570
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
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
+ };
571
463
  import * as THREE from "three";
572
464
  import * as FRAGS from "@thatopen/fragments";
573
- import { Component, Components, Event, Disposable } from "../../core";
574
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
465
+ import { FragmentsGroup } from "@thatopen/fragments";
466
+ import { Component, Components, Disposable, Event } from "../../core";
575
467
  /**
576
- * Object that can efficiently load binary files that contain
577
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
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.
578
470
  */
579
- export declare class FragmentManager extends Component implements Disposable {
580
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
581
- /** {@link Disposable.onDisposed} */
582
- readonly onDisposed: Event<unknown>;
583
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
584
- readonly onFragmentsDisposed: Event<{
585
- groupID: string;
586
- fragmentIDs: string[];
587
- }>;
588
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
589
- readonly list: Map<string, Fragment>;
590
- readonly groups: Map<string, FragmentsGroup>;
471
+ export declare class BoundingBoxer extends Component implements Disposable {
472
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
591
473
  /** {@link Component.enabled} */
592
474
  enabled: boolean;
593
- baseCoordinationModel: string;
594
- private _loader;
595
- /** The list of meshes of the created fragments. */
596
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
475
+ /** {@link Disposable.onDisposed} */
476
+ readonly onDisposed: Event<unknown>;
477
+ private _absoluteMin;
478
+ private _absoluteMax;
479
+ private _meshes;
597
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;
598
489
  /** {@link Disposable.dispose} */
599
490
  dispose(): void;
600
- disposeGroup(group: FragmentsGroup): void;
601
- /**
602
- * Loads a binar file that contain fragment geometry.
603
- * @param data - The binary data to load.
604
- * @param config - Optional configuration for loading.
605
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
606
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
607
- * @returns The loaded FragmentsGroup.
608
- */
609
- load(data: Uint8Array, config?: Partial<{
610
- coordinate: boolean;
611
- properties: FRAGS.IfcProperties;
612
- relationsMap: RelationsMap;
613
- }>): FragmentsGroup;
614
- /**
615
- * Export the specified fragments.
616
- * @param group - the fragments group to be exported.
617
- * @returns the exported data as binary buffer.
618
- */
619
- export(group: FragmentsGroup): Uint8Array;
620
- coordinate(models?: FragmentsGroup[]): void;
621
- }
622
- import * as WEBIFC from "web-ifc";
623
- import { Components, Disposable, Event, Component } from "../../core";
624
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
625
- export declare class IfcGeometryTiler extends Component implements Disposable {
626
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
627
- onGeometryStreamed: Event<{
628
- buffer: Uint8Array;
629
- data: StreamedGeometries;
630
- }>;
631
- onAssetStreamed: Event<StreamedAsset[]>;
632
- onProgress: Event<number>;
633
- onIfcLoaded: Event<Uint8Array>;
634
- /** {@link Disposable.onDisposed} */
635
- readonly onDisposed: Event<unknown>;
636
- settings: IfcStreamingSettings;
637
- enabled: boolean;
638
- webIfc: WEBIFC.IfcAPI;
639
- private _spatialTree;
640
- private _metaData;
641
- private _visitedGeometries;
642
- private _streamSerializer;
643
- private _geometries;
644
- private _geometryCount;
645
- private _civil;
646
- private _groupSerializer;
647
- private _assets;
648
- private _meshesWithHoles;
649
- constructor(components: Components);
650
- dispose(): void;
651
- streamFromBuffer(data: Uint8Array): Promise<void>;
652
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
653
- private readIfcFile;
654
- private streamIfcFile;
655
- private streamAllGeometries;
656
- private cleanUp;
657
- private getMesh;
658
- private getGeometry;
659
- private streamAssets;
660
- private streamGeometries;
661
- }
662
- import * as WEBIFC from "web-ifc";
663
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
664
- import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
665
- export declare class IfcPropertiesTiler extends Component implements Disposable {
666
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
667
- onPropertiesStreamed: AsyncEvent<{
668
- type: number;
669
- data: {
670
- [id: number]: any;
671
- };
672
- }>;
673
- onProgress: AsyncEvent<number>;
674
- onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
675
- /** {@link Disposable.onDisposed} */
676
- readonly onDisposed: Event<string>;
677
- enabled: boolean;
678
- settings: PropertiesStreamingSettings;
679
- webIfc: WEBIFC.IfcAPI;
680
- dispose(): Promise<void>;
681
- streamFromBuffer(data: Uint8Array): Promise<void>;
682
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
683
- private readIfcFile;
684
- private streamIfcFile;
685
- private streamAllProperties;
686
- private cleanUp;
687
- }
688
- import * as WEBIFC from "web-ifc";
689
- import * as FRAG from "@thatopen/fragments";
690
- /**
691
- * Object to export all the properties from an IFC to a JS object.
692
- */
693
- export declare class IfcJsonExporter {
694
- /**
695
- * Exports all the properties of an IFC into an array of JS objects.
696
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
697
- * @param modelID ID of the IFC model whose properties to extract.
698
- * @param indirect whether to get the indirect relationships as well.
699
- * @param recursiveSpatial whether to get the properties of spatial items recursively
700
- * to make the location data available (e.g. absolute position of building).
701
- */
702
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
703
- }
704
- import * as FRAGS from "@thatopen/fragments";
705
- import { FragmentsGroup } from "@thatopen/fragments";
706
- import { Disposable, Event, Component, Components } from "../../core";
707
- import { QueryGroup } from "./src/types";
708
- export interface QueryResult {
709
- [modelID: string]: {
710
- modelEntities: Set<number>;
711
- otherEntities: Set<number>;
712
- };
713
- }
714
- export interface IndexedModels {
715
- [modelID: string]: {
716
- [expressID: number]: Set<number>;
717
- };
718
- }
719
- export declare class IfcPropertiesFinder extends Component implements Disposable {
720
- readonly onFound: Event<FRAGS.FragmentIdMap>;
721
- /** {@link Disposable.onDisposed} */
722
- readonly onDisposed: Event<unknown>;
723
- enabled: boolean;
724
- indexedModels: IndexedModels;
725
- private readonly _conditionFunctions;
726
- private _noHandleAttributes;
727
- constructor(components: Components);
728
- private onFragmentsDisposed;
729
- dispose(): void;
730
- private indexEntityRelations;
731
- find(groups: QueryGroup[], queryModels?: FragmentsGroup[]): Promise<FRAGS.FragmentIdMap>;
732
- private toFragmentMap;
733
- private simpleQuery;
734
- private getMatchingEntities;
735
- private combineArrays;
736
- private getCommonElements;
737
- private arrayIntersection;
738
- private arrayUnion;
739
- private getConditionFunctions;
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;
740
498
  }
741
499
  import * as WEBIFC from "web-ifc";
742
500
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -870,142 +628,264 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
870
628
  dispose(): void;
871
629
  }
872
630
  export type { InverseAttribute } from "./src/types";
873
- import * as WEBIFC from "web-ifc";
874
- import { FragmentsGroup } from "@thatopen/fragments";
875
- import { Component, Disposable, Event, Components } from "../../core";
876
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
877
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
878
- type NumericPropTypes = "IfcInteger" | "IfcReal";
879
- interface ChangeMap {
880
- [modelID: string]: Set<number>;
881
- }
882
- interface AttributeListener {
883
- [modelID: string]: {
884
- [expressID: number]: {
885
- [attributeName: string]: Event<String | Boolean | Number>;
886
- };
631
+ 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;
887
637
  };
888
638
  }
889
- export declare class IfcPropertiesManager extends Component implements Disposable {
890
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
891
- /** {@link Disposable.onDisposed} */
892
- readonly onDisposed: Event<string>;
893
- readonly onRequestFile: Event<unknown>;
894
- ifcToExport: ArrayBuffer | null;
895
- readonly onElementToPset: Event<{
896
- model: FragmentsGroup;
897
- psetID: number;
898
- elementID: number;
899
- }>;
900
- readonly onPropToPset: Event<{
901
- model: FragmentsGroup;
902
- psetID: number;
903
- propID: number;
904
- }>;
905
- readonly onPsetRemoved: Event<{
906
- model: FragmentsGroup;
907
- psetID: number;
908
- }>;
909
- readonly onDataChanged: Event<{
910
- model: FragmentsGroup;
911
- expressID: number;
912
- }>;
913
- wasm: {
914
- path: string;
915
- absolute: boolean;
916
- };
639
+ export declare class Classifier extends Component implements Disposable {
640
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
641
+ /** {@link Component.enabled} */
917
642
  enabled: boolean;
918
- attributeListeners: AttributeListener;
919
- selectedModel?: FragmentsGroup;
920
- private _changeMap;
643
+ list: Classification;
644
+ /** {@link Disposable.onDisposed} */
645
+ readonly onDisposed: Event<unknown>;
921
646
  constructor(components: Components);
922
- get(): ChangeMap;
647
+ private onFragmentsDisposed;
923
648
  dispose(): void;
924
- private increaseMaxID;
925
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
926
- private newGUID;
927
- private getOwnerHistory;
928
- private registerChange;
929
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
930
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
931
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
932
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
933
- }>;
934
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
935
- private newSingleProperty;
936
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
937
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
938
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
939
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
940
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
941
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
942
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
943
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
944
- }
945
- export {};
946
- import * as WEBIFC from "web-ifc";
947
- export interface IfcItemsCategories {
948
- [itemID: number]: number;
949
- }
950
- export declare class IfcCategories {
951
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
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;
952
661
  }
953
- export declare const IfcCategoryMap: {
954
- [key: number]: string;
955
- };
956
- export declare const IfcElements: {
957
- [key: number]: string;
958
- };
662
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
663
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
959
664
  import * as THREE from "three";
960
- import { Event, Resizeable, Updateable, Disposable, World } from "../../../core";
961
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
665
+ import * as FRAGS from "@thatopen/fragments";
666
+ import { Component, Components, Event, Disposable } from "../../core";
667
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
668
+ /**
669
+ * Object that can efficiently load binary files that contain
670
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
671
+ */
672
+ export declare class FragmentsManager extends Component implements Disposable {
673
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
962
674
  /** {@link Disposable.onDisposed} */
963
675
  readonly onDisposed: Event<unknown>;
964
- readonly onAfterUpdate: Event<unknown>;
965
- readonly onBeforeUpdate: Event<unknown>;
966
- readonly onResize: Event<THREE.Vector2>;
967
- frontOffset: number;
968
- overrideMaterial: THREE.MeshDepthMaterial;
969
- backgroundColor: THREE.Color;
970
- renderer: THREE.WebGLRenderer;
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>;
684
+ /** {@link Component.enabled} */
971
685
  enabled: boolean;
972
- world: World;
973
- private _lockRotation;
974
- private _camera;
975
- private _plane;
976
- private _size;
977
- private _tempVector1;
978
- private _tempVector2;
979
- private _tempTarget;
980
- private readonly down;
981
- get lockRotation(): boolean;
982
- set lockRotation(active: boolean);
983
- get zoom(): number;
984
- set zoom(value: number);
985
- constructor(world: World);
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
+ constructor(components: Components);
691
+ /** {@link Disposable.dispose} */
986
692
  dispose(): void;
987
- get(): THREE.OrthographicCamera;
988
- update(): void;
989
- getSize(): THREE.Vector2;
990
- resize(size?: THREE.Vector2): void;
991
- private updatePlanes;
992
- }
993
- import * as FRAGS from "@thatopen/fragments";
994
- export declare class IfcPropertiesUtils {
995
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
996
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
997
- [attribute: string]: any;
998
- } | null>;
999
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
1000
- [relatingID: number]: number[];
1001
- }>;
1002
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
1003
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
1004
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
1005
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
1006
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
1007
- key: string | null;
1008
- name: string | null;
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
+ /**
708
+ * Export the specified fragments.
709
+ * @param group - the fragments group to be exported.
710
+ * @returns the exported data as binary buffer.
711
+ */
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;
728
+ }
729
+ 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;
738
+ };
739
+ }>;
740
+ onProgress: AsyncEvent<number>;
741
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
742
+ /** {@link Disposable.onDisposed} */
743
+ 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;
754
+ }
755
+ export declare class UUID {
756
+ private static _pattern;
757
+ private static _lut;
758
+ static create(): string;
759
+ static validate(uuid: string): void;
760
+ }
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
+ import * as THREE from "three";
833
+ import { Component, Components, Event, World } from "../core";
834
+ export interface VertexPickerConfig {
835
+ showOnlyVertex: boolean;
836
+ snapDistance: number;
837
+ previewElement: HTMLElement;
838
+ }
839
+ export declare class VertexPicker extends Component {
840
+ onVertexFound: Event<THREE.Vector3>;
841
+ onVertexLost: Event<THREE.Vector3>;
842
+ components: Components;
843
+ private _pickedPoint;
844
+ private _config;
845
+ private _enabled;
846
+ private _workingPlane;
847
+ set enabled(value: boolean);
848
+ get enabled(): boolean;
849
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
850
+ set workingPlane(plane: THREE.Plane | null);
851
+ get workingPlane(): THREE.Plane | null;
852
+ set config(value: Partial<VertexPickerConfig>);
853
+ get config(): Partial<VertexPickerConfig>;
854
+ dispose(): void;
855
+ get(world: World): THREE.Vector3 | null;
856
+ private getClosestVertex;
857
+ private getVertices;
858
+ private getVertex;
859
+ }
860
+ export declare const IfcElements: {
861
+ [key: number]: string;
862
+ };
863
+ import * as WEBIFC from "web-ifc";
864
+ export interface IfcItemsCategories {
865
+ [itemID: number]: number;
866
+ }
867
+ export declare class IfcCategories {
868
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
869
+ }
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;
1009
889
  }>;
1010
890
  static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
1011
891
  key: string | null;
@@ -1015,631 +895,830 @@ export declare class IfcPropertiesUtils {
1015
895
  static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1016
896
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1017
897
  }
898
+ export declare const GeometryTypes: Set<number>;
899
+ import * as THREE from "three";
900
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
901
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
902
+ /** {@link Disposable.onDisposed} */
903
+ readonly onDisposed: Event<unknown>;
904
+ readonly onAfterUpdate: Event<unknown>;
905
+ readonly onBeforeUpdate: Event<unknown>;
906
+ readonly onResize: Event<THREE.Vector2>;
907
+ frontOffset: number;
908
+ overrideMaterial: THREE.MeshDepthMaterial;
909
+ backgroundColor: THREE.Color;
910
+ renderer: THREE.WebGLRenderer;
911
+ enabled: boolean;
912
+ world: World;
913
+ private _lockRotation;
914
+ private _camera;
915
+ private _plane;
916
+ private _size;
917
+ private _tempVector1;
918
+ private _tempVector2;
919
+ private _tempTarget;
920
+ private readonly down;
921
+ get lockRotation(): boolean;
922
+ set lockRotation(active: boolean);
923
+ get zoom(): number;
924
+ set zoom(value: number);
925
+ constructor(world: World);
926
+ dispose(): void;
927
+ get(): THREE.OrthographicCamera;
928
+ update(): void;
929
+ getSize(): THREE.Vector2;
930
+ resize(size?: THREE.Vector2): void;
931
+ private updatePlanes;
932
+ }
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;
942
+ }
943
+ /**
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).
948
+ */
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;
960
+ /**
961
+ * Whether the grid should fade away with distance. Recommended to be true for
962
+ * perspective cameras and false for orthographic cameras.
963
+ */
964
+ get fade(): boolean;
965
+ /**
966
+ * Whether the grid should fade away with distance. Recommended to be true for
967
+ * perspective cameras and false for orthographic cameras.
968
+ */
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";
1018
1051
  /**
1019
- * Simple event handler by
1020
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1021
- * Keep in mind that:
1022
- * - If you want to remove it later, you might want to declare the callback as
1023
- * an object.
1024
- * - If you want to maintain the reference to 'this', you will need to declare
1025
- * the callback as an arrow function.
1052
+ * A basic renderer capable of rendering
1053
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1026
1054
  */
1027
- export declare class Event<T> {
1028
- /**
1029
- * Add a callback to this event instance.
1030
- * @param handler - the callback to be added to this event.
1031
- */
1032
- add(handler: T extends void ? {
1033
- (): void;
1034
- } : {
1035
- (data: T): void;
1036
- }): void;
1037
- /**
1038
- * Removes a callback from this event instance.
1039
- * @param handler - the callback to be removed from this event.
1040
- */
1041
- remove(handler: T extends void ? {
1042
- (): void;
1043
- } : {
1044
- (data: T): void;
1045
- }): void;
1046
- /** Triggers all the callbacks assigned to this event. */
1047
- trigger: (data?: T) => void;
1048
- /** Gets rid of all the suscribed events. */
1049
- reset(): void;
1050
- private handlers;
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;
1051
1078
  }
1052
1079
  import * as THREE from "three";
1053
- import CameraControls from "camera-controls";
1054
- import { Event } from "./event";
1080
+ import { Disposable, Event } from "../../Types";
1055
1081
  /**
1056
- * Whether this component has to be manually destroyed once you are done with
1057
- * it to prevent
1058
- * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1059
- * This also ensures that the DOM events created by that component will be
1060
- * cleaned up.
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.
1061
1086
  */
1062
- export interface Disposable {
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);
1063
1094
  /**
1064
- * Destroys the object from memory to prevent a
1065
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1095
+ * The real position of the mouse of the Three.js canvas.
1066
1096
  */
1067
- dispose: () => void | Promise<void>;
1068
- /** Fired after the tool has been {@link Disposable.dispose()} */
1069
- readonly onDisposed: Event<any>;
1097
+ get position(): THREE.Vector2;
1098
+ /** {@link Disposable.dispose} */
1099
+ dispose(): void;
1100
+ private getPositionY;
1101
+ private getPositionX;
1102
+ private updateMouseInfo;
1103
+ private setupEvents;
1070
1104
  }
1105
+ import * as THREE from "three";
1106
+ import { Components } from "../../Components";
1107
+ import { Event, World, Disposable } from "../../Types";
1108
+ import { Mouse } from "./mouse";
1071
1109
  /**
1072
- * Whether the geometric representation of this component can be
1073
- * hidden or shown in the
1074
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
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.
1075
1113
  */
1076
- export interface Hideable {
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;
1077
1127
  /**
1078
- * Whether the geometric representation of this component is
1079
- * currently visible or not in the
1080
- * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
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}.
1081
1135
  */
1082
- visible: boolean;
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;
1083
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";
1084
1145
  /**
1085
- * Whether this component can be resized. The meaning of this can vary depending
1086
- * on the component: resizing a
1087
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1088
- * component could mean changing its resolution, whereas resizing a
1089
- * [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
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.
1090
1150
  */
1091
- export interface Resizeable {
1092
- /**
1093
- * Sets size of this component (e.g. the resolution of a
1094
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1095
- * component.
1096
- */
1097
- resize: (size?: THREE.Vector2) => void;
1098
- /** Event that fires when the component has been resized. */
1099
- onResize: Event<THREE.Vector2>;
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;
1100
1161
  /**
1101
- * Gets the current size of this component (e.g. the resolution of a
1102
- * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1103
- * component.
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.
1104
1166
  */
1105
- getSize: () => THREE.Vector2;
1106
- }
1107
- /** Whether this component should be updated each frame. */
1108
- export interface Updateable {
1109
- /** Actions that should be executed after updating the component. */
1110
- onAfterUpdate: Event<any>;
1111
- /** Actions that should be executed before updating the component. */
1112
- onBeforeUpdate: Event<any>;
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;
1113
1177
  /**
1114
- * Function used to update the state of this component each frame. For
1115
- * instance, a renderer component will make a render each frame.
1178
+ * Updates the aspect of the camera to match the size of the
1179
+ * {@link Components.renderer}.
1116
1180
  */
1117
- update(delta?: number): void;
1181
+ updateAspect: () => void;
1182
+ private setupCamera;
1183
+ private newCameraControls;
1184
+ private setupEvents;
1185
+ private static getSubsetOfThree;
1118
1186
  }
1119
- /** Basic type to describe the progress of any kind of process. */
1120
- export interface Progress {
1121
- /** The amount of things that have been done already. */
1122
- current: number;
1123
- /** The total amount of things to be done by the process. */
1124
- total: number;
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;
1125
1195
  }
1126
1196
  /**
1127
- * Whether this component supports create and destroy operations. This generally
1128
- * applies for components that work with instances, such as clipping planes or
1129
- * dimensions.
1197
+ * A base renderer to determine visibility on screen
1130
1198
  */
1131
- export interface Createable {
1132
- /** Creates a new instance of an element (e.g. a new Dimension). */
1133
- create: (data: any) => void;
1199
+ export declare class CullerRenderer {
1200
+ /** {@link Disposable.onDisposed} */
1201
+ readonly onDisposed: Event<string>;
1134
1202
  /**
1135
- * Finish the creation process of the component, successfully creating an
1136
- * instance of whatever the component creates.
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.
1137
1206
  */
1138
- endCreation?: (data: any) => void;
1207
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1208
+ /** {@link Component.enabled} */
1209
+ enabled: boolean;
1139
1210
  /**
1140
- * Cancels the creation process of the component, going back to the state
1141
- * before starting to create.
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.
1142
1242
  */
1143
- cancelCreation?: (data: any) => void;
1144
- /** Deletes an existing instance of an element (e.g. a Dimension). */
1145
- delete: (data: any) => void;
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;
1146
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";
1147
1258
  /**
1148
- * Whether this component supports to be configured.
1259
+ * A renderer to determine a mesh visibility on screen
1149
1260
  */
1150
- export interface Configurable<T extends Record<string, any>> {
1151
- /** Wether this components has been already configured. */
1152
- isSetup: boolean;
1153
- /** Use the provided configuration to setup the tool. */
1154
- setup: (config?: Partial<T>) => void | Promise<void>;
1155
- /** Fired after successfully calling {@link Configurable.setup()} */
1156
- readonly onSetup: Event<any>;
1157
- /** Object holding the tool configuration. Is not meant to be edited directly, if you need
1158
- * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
1159
- */
1160
- config: Required<T>;
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;
1161
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";
1162
1285
  /**
1163
- * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
1286
+ * A {@link NavigationMode} that allows 3D navigation and panning
1287
+ * like in many 3D and CAD softwares.
1164
1288
  */
1165
- export interface BVHGeometry extends THREE.BufferGeometry {
1166
- boundsTree: Object | undefined;
1167
- disposeBoundsTree: () => void;
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;
1168
1299
  }
1300
+ import { NavigationMode } from "./types";
1301
+ import { OrthoPerspectiveCamera } from "../index";
1169
1302
  /**
1170
- * Whether a camera uses the Camera Controls library.
1303
+ * A {@link NavigationMode} that allows first person navigation,
1304
+ * simulating FPS video games.
1171
1305
  */
1172
- export interface CameraControllable {
1173
- controls: CameraControls;
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;
1174
1316
  }
1317
+ import * as THREE from "three";
1318
+ import { CameraProjection } from "./types";
1319
+ import { Event } from "../../Types";
1320
+ import { OrthoPerspectiveCamera } from "../index";
1175
1321
  /**
1176
- * Simple event handler by
1177
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1178
- * Keep in mind that:
1179
- * - If you want to remove it later, you might want to declare the callback as
1180
- * an object.
1181
- * - If you want to maintain the reference to 'this', you will need to declare
1182
- * the callback as an arrow function.
1322
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1183
1323
  */
1184
- export declare class AsyncEvent<T> {
1324
+ export declare class ProjectionManager {
1185
1325
  /**
1186
- * Add a callback to this event instance.
1187
- * @param handler - the callback to be added to this event.
1326
+ * Event that fires when the {@link CameraProjection} changes.
1188
1327
  */
1189
- add(handler: T extends void ? {
1190
- (): Promise<void>;
1191
- } : {
1192
- (data: T): Promise<void>;
1193
- }): void;
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);
1194
1336
  /**
1195
- * Removes a callback from this event instance.
1196
- * @param handler - the callback to be removed from this event.
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.
1197
1341
  */
1198
- remove(handler: T extends void ? {
1199
- (): Promise<void>;
1200
- } : {
1201
- (data: T): Promise<void>;
1202
- }): void;
1203
- /** Triggers all the callbacks assigned to this event. */
1204
- trigger: (data?: T) => Promise<void>;
1205
- /** Gets rid of all the suscribed events. */
1206
- reset(): void;
1207
- private handlers;
1208
- }
1209
- import { Base } from "./base";
1210
- /**
1211
- * Components are the building blocks of this library. Components are singleton
1212
- * elements that contain specific functionality. For instance, the SimpleClipper
1213
- * Component can create, delete and handle 3D clipping planes. Components must be
1214
- * unique (they can't be instanced more than once), and have a static UUID that
1215
- * identifies them uniquely. The can be accessed globally using the {@link Components}
1216
- * instance.
1217
- */
1218
- export declare abstract class Component extends Base {
1342
+ set(projection: CameraProjection): Promise<void>;
1219
1343
  /**
1220
- * Whether this component is active or not. The behaviour can vary depending
1221
- * on the type of component. E.g. a disabled dimension tool will stop creating
1222
- * dimensions, while a disabled camera will stop moving. A disabled component
1223
- * will not be updated automatically each frame.
1344
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1345
+ * and vice versa.
1224
1346
  */
1225
- abstract enabled: boolean;
1347
+ toggle(): Promise<void>;
1348
+ private setOrthoCamera;
1349
+ private getPerspectiveDims;
1350
+ private setupOrthoCamera;
1351
+ private getDistance;
1352
+ private setPerspectiveCamera;
1226
1353
  }
1227
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1228
- import { Components } from "../../Components";
1354
+ import { NavigationMode } from "./types";
1355
+ import { OrthoPerspectiveCamera } from "../index";
1229
1356
  /**
1230
- * Base class of the library. Useful for finding out the interfaces it implements.
1357
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1358
+ * like many BIM tools.
1231
1359
  */
1232
- export declare abstract class Base {
1233
- components: Components;
1234
- constructor(components: Components);
1235
- /** Whether is component is {@link Disposable}. */
1236
- isDisposeable: () => this is Disposable;
1237
- /** Whether is component is {@link Resizeable}. */
1238
- isResizeable: () => this is Resizeable;
1239
- /** Whether is component is {@link Updateable}. */
1240
- isUpdateable: () => this is Updateable;
1241
- /** Whether is component is {@link Hideable}. */
1242
- isHideable: () => this is Hideable;
1243
- /** Whether is component is {@link Configurable}. */
1244
- isConfigurable: () => this is Configurable<any>;
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;
1245
1374
  }
1246
- export declare const GeometryTypes: Set<number>;
1247
- import { Base } from "./base";
1248
- import { World } from "./world";
1249
- import { Event } from "./event";
1250
- import { Components } from "../../Components";
1251
1375
  /**
1252
- * One of the elements that make a world. It can be either a scene, a camera
1253
- * or a renderer.
1376
+ * The projection system of the camera.
1254
1377
  */
1255
- export declare abstract class BaseWorldItem extends Base {
1256
- readonly worlds: Map<string, World>;
1257
- readonly onWorldChanged: Event<{
1258
- world: World;
1259
- action: "added" | "removed";
1260
- }>;
1261
- currentWorld: World | null;
1262
- protected constructor(components: Components);
1263
- }
1264
- import * as WEBIFC from "web-ifc";
1265
- import { IfcItemsCategories } from "../../../ifc";
1266
- export declare class SpatialStructure {
1267
- itemsByFloor: IfcItemsCategories;
1268
- private _units;
1269
- setUp(webIfc: WEBIFC.IfcAPI): void;
1270
- cleanUp(): void;
1271
- }
1272
- import { InverseAttribute } from "./types";
1273
- export declare const relToAttributesMap: Map<number, {
1274
- forRelating: InverseAttribute;
1275
- forRelated: InverseAttribute;
1276
- }>;
1277
- import * as THREE from "three";
1278
- import { Vector2 } from "three";
1279
- import { Event } from "./event";
1280
- import { BaseWorldItem } from "./base-world-item";
1281
- import { Disposable, Resizeable, Updateable } from "./interfaces";
1282
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1283
- abstract three: THREE.WebGLRenderer;
1284
- /** {@link Updateable.onBeforeUpdate} */
1285
- onAfterUpdate: Event<unknown>;
1286
- /** {@link Updateable.onAfterUpdate} */
1287
- onBeforeUpdate: Event<unknown>;
1288
- /** {@link Disposable.onDisposed} */
1289
- readonly onDisposed: Event<undefined>;
1290
- readonly onResize: Event<THREE.Vector2>;
1291
- /**
1292
- * Event that fires when there has been a change to the list of clipping
1293
- * planes used by the active renderer.
1294
- */
1295
- readonly onClippingPlanesUpdated: Event<unknown>;
1296
- abstract update(delta?: number): void | Promise<void>;
1297
- abstract dispose(): void;
1298
- abstract getSize(): Vector2;
1299
- abstract resize(size: Vector2 | undefined): void;
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;
1300
1390
  /**
1301
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1302
- * instance of the renderer.
1303
- */
1304
- clippingPlanes: THREE.Plane[];
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;
1401
+ }
1402
+ /**
1403
+ * Simple event handler by
1404
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1405
+ * Keep in mind that:
1406
+ * - If you want to remove it later, you might want to declare the callback as
1407
+ * an object.
1408
+ * - If you want to maintain the reference to 'this', you will need to declare
1409
+ * the callback as an arrow function.
1410
+ */
1411
+ export declare class Event<T> {
1305
1412
  /**
1306
- * Forces the update of the clipping planes and all components that depend
1307
- * on them that are subscribed to 'onClippingPlanesUpdated'.
1413
+ * Add a callback to this event instance.
1414
+ * @param handler - the callback to be added to this event.
1308
1415
  */
1309
- updateClippingPlanes(): void;
1416
+ add(handler: T extends void ? {
1417
+ (): void;
1418
+ } : {
1419
+ (data: T): void;
1420
+ }): void;
1310
1421
  /**
1311
- * Adds or removes a
1312
- * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1313
- * to the renderer.
1422
+ * Removes a callback from this event instance.
1423
+ * @param handler - the callback to be removed from this event.
1314
1424
  */
1315
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1425
+ remove(handler: T extends void ? {
1426
+ (): void;
1427
+ } : {
1428
+ (data: T): void;
1429
+ }): void;
1430
+ /** Triggers all the callbacks assigned to this event. */
1431
+ trigger: (data?: T) => void;
1432
+ /** Gets rid of all the suscribed events. */
1433
+ reset(): void;
1434
+ private handlers;
1316
1435
  }
1317
1436
  import * as THREE from "three";
1318
1437
  import CameraControls from "camera-controls";
1319
- import { BaseWorldItem } from "./base-world-item";
1320
- import { CameraControllable } from "./interfaces";
1321
- export declare abstract class BaseCamera extends BaseWorldItem {
1322
- abstract enabled: boolean;
1323
- abstract three: THREE.Camera;
1324
- abstract controls?: CameraControls;
1325
- /** Whether is instance is {@link CameraControllable}. */
1326
- hasCameraControls: () => this is CameraControllable;
1327
- }
1328
- import * as THREE from "three";
1329
- import { Disposable } from "./interfaces";
1330
1438
  import { Event } from "./event";
1331
- import { Components } from "../../Components";
1332
- import { BaseWorldItem } from "./base-world-item";
1333
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1334
- /** {@link Disposable.onDisposed} */
1335
- readonly onDisposed: Event<unknown>;
1336
- abstract three: THREE.Object3D;
1337
- protected constructor(components: Components);
1338
- /** {@link Disposable.dispose} */
1339
- dispose(): void;
1439
+ /**
1440
+ * Whether this component has to be manually destroyed once you are done with
1441
+ * it to prevent
1442
+ * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1443
+ * This also ensures that the DOM events created by that component will be
1444
+ * cleaned up.
1445
+ */
1446
+ export interface Disposable {
1447
+ /**
1448
+ * Destroys the object from memory to prevent a
1449
+ * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1450
+ */
1451
+ dispose: () => void | Promise<void>;
1452
+ /** Fired after the tool has been {@link Disposable.dispose()} */
1453
+ readonly onDisposed: Event<any>;
1340
1454
  }
1341
- import * as THREE from "three";
1342
- import { BaseScene } from "./base-scene";
1343
- import { BaseCamera } from "./base-camera";
1344
- import { BaseRenderer } from "./base-renderer";
1345
- import { Updateable, Disposable } from "./interfaces";
1346
- export interface World extends Disposable, Updateable {
1347
- meshes: Set<THREE.Mesh>;
1348
- scene: BaseScene;
1349
- camera: BaseCamera;
1350
- renderer: BaseRenderer | null;
1351
- uuid: string;
1455
+ /**
1456
+ * Whether the geometric representation of this component can be
1457
+ * hidden or shown in the
1458
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1459
+ */
1460
+ export interface Hideable {
1461
+ /**
1462
+ * Whether the geometric representation of this component is
1463
+ * currently visible or not in the
1464
+ * [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
1465
+ */
1466
+ visible: boolean;
1352
1467
  }
1353
- import * as THREE from "three";
1354
- import { Components } from "../../Components";
1355
- import { Event, World, Disposable } from "../../Types";
1356
- import { Mouse } from "./mouse";
1357
1468
  /**
1358
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1359
- * that allows to easily get items from the scene using the mouse and touch
1360
- * events.
1469
+ * Whether this component can be resized. The meaning of this can vary depending
1470
+ * on the component: resizing a
1471
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1472
+ * component could mean changing its resolution, whereas resizing a
1473
+ * [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
1361
1474
  */
1362
- export declare class SimpleRaycaster implements Disposable {
1363
- /** {@link Component.enabled} */
1364
- enabled: boolean;
1365
- components: Components;
1366
- /** {@link Disposable.onDisposed} */
1367
- readonly onDisposed: Event<unknown>;
1368
- /** The position of the mouse in the screen. */
1369
- readonly mouse: Mouse;
1370
- readonly three: THREE.Raycaster;
1371
- world: World;
1372
- constructor(components: Components, world: World);
1373
- /** {@link Disposable.dispose} */
1374
- dispose(): void;
1475
+ export interface Resizeable {
1375
1476
  /**
1376
- * Throws a ray from the camera to the mouse or touch event point and returns
1377
- * the first item found. This also takes into account the clipping planes
1378
- * used by the renderer.
1379
- *
1380
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1381
- * to query. If not provided, it will query all the meshes stored in
1382
- * {@link Components.meshes}.
1477
+ * Sets size of this component (e.g. the resolution of a
1478
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1479
+ * component.
1383
1480
  */
1384
- castRay(items?: THREE.Mesh[]): THREE.Intersection | null;
1385
- 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;
1386
- private intersect;
1387
- private filterClippingPlanes;
1481
+ resize: (size?: THREE.Vector2) => void;
1482
+ /** Event that fires when the component has been resized. */
1483
+ onResize: Event<THREE.Vector2>;
1484
+ /**
1485
+ * Gets the current size of this component (e.g. the resolution of a
1486
+ * [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
1487
+ * component.
1488
+ */
1489
+ getSize: () => THREE.Vector2;
1388
1490
  }
1389
- import * as THREE from "three";
1390
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1391
- import { Components } from "../../Components";
1392
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1491
+ /** Whether this component should be updated each frame. */
1492
+ export interface Updateable {
1493
+ /** Actions that should be executed after updating the component. */
1494
+ onAfterUpdate: Event<any>;
1495
+ /** Actions that should be executed before updating the component. */
1496
+ onBeforeUpdate: Event<any>;
1393
1497
  /**
1394
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1498
+ * Function used to update the state of this component each frame. For
1499
+ * instance, a renderer component will make a render each frame.
1395
1500
  */
1396
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1397
- readonly onAfterUpdate: Event<unknown>;
1398
- readonly onBeforeUpdate: Event<unknown>;
1399
- enabled: boolean;
1400
- uuid: string;
1401
- readonly onDisposed: Event<unknown>;
1402
- private _scene?;
1403
- private _camera?;
1404
- private _renderer;
1405
- get scene(): T;
1406
- set scene(scene: T);
1407
- get camera(): U;
1408
- set camera(camera: U);
1409
- get renderer(): S | null;
1410
- set renderer(renderer: S | null);
1411
- constructor(components: Components);
1412
1501
  update(delta?: number): void;
1413
- dispose(disposeResources?: boolean): void;
1414
1502
  }
1415
- import * as THREE from "three";
1416
- import { Disposable, Event } from "../../Types";
1503
+ /** Basic type to describe the progress of any kind of process. */
1504
+ export interface Progress {
1505
+ /** The amount of things that have been done already. */
1506
+ current: number;
1507
+ /** The total amount of things to be done by the process. */
1508
+ total: number;
1509
+ }
1417
1510
  /**
1418
- * A helper to easily get the real position of the mouse in the Three.js canvas
1419
- * to work with tools like the
1420
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1421
- * been transformed through CSS or doesn't occupy the whole screen.
1511
+ * Whether this component supports create and destroy operations. This generally
1512
+ * applies for components that work with instances, such as clipping planes or
1513
+ * dimensions.
1422
1514
  */
1423
- export declare class Mouse implements Disposable {
1424
- dom: HTMLCanvasElement;
1425
- private _event?;
1426
- private _position;
1427
- /** {@link Disposable.onDisposed} */
1428
- readonly onDisposed: Event<unknown>;
1429
- constructor(dom: HTMLCanvasElement);
1515
+ export interface Createable {
1516
+ /** Creates a new instance of an element (e.g. a new Dimension). */
1517
+ create: (data: any) => void;
1430
1518
  /**
1431
- * The real position of the mouse of the Three.js canvas.
1519
+ * Finish the creation process of the component, successfully creating an
1520
+ * instance of whatever the component creates.
1432
1521
  */
1433
- get position(): THREE.Vector2;
1434
- /** {@link Disposable.dispose} */
1435
- dispose(): void;
1436
- private getPositionY;
1437
- private getPositionX;
1438
- private updateMouseInfo;
1439
- private setupEvents;
1522
+ endCreation?: (data: any) => void;
1523
+ /**
1524
+ * Cancels the creation process of the component, going back to the state
1525
+ * before starting to create.
1526
+ */
1527
+ cancelCreation?: (data: any) => void;
1528
+ /** Deletes an existing instance of an element (e.g. a Dimension). */
1529
+ delete: (data: any) => void;
1530
+ }
1531
+ /**
1532
+ * Whether this component supports to be configured.
1533
+ */
1534
+ export interface Configurable<T extends Record<string, any>> {
1535
+ /** Wether this components has been already configured. */
1536
+ isSetup: boolean;
1537
+ /** Use the provided configuration to setup the tool. */
1538
+ setup: (config?: Partial<T>) => void | Promise<void>;
1539
+ /** Fired after successfully calling {@link Configurable.setup()} */
1540
+ readonly onSetup: Event<any>;
1541
+ /** Object holding the tool configuration. Is not meant to be edited directly, if you need
1542
+ * to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
1543
+ */
1544
+ config: Required<T>;
1545
+ }
1546
+ /**
1547
+ * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
1548
+ */
1549
+ export interface BVHGeometry extends THREE.BufferGeometry {
1550
+ boundsTree: Object | undefined;
1551
+ disposeBoundsTree: () => void;
1552
+ }
1553
+ /**
1554
+ * Whether a camera uses the Camera Controls library.
1555
+ */
1556
+ export interface CameraControllable {
1557
+ controls: CameraControls;
1440
1558
  }
1441
- import * as THREE from "three";
1442
- import { BaseRenderer, Event } from "../../Types";
1443
- import { Components } from "../../Components";
1559
+ import { Base } from "./base";
1444
1560
  /**
1445
- * A basic renderer capable of rendering
1446
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1561
+ * Components are the building blocks of this library. Components are singleton
1562
+ * elements that contain specific functionality. For instance, the SimpleClipper
1563
+ * Component can create, delete and handle 3D clipping planes. Components must be
1564
+ * unique (they can't be instanced more than once), and have a static UUID that
1565
+ * identifies them uniquely. The can be accessed globally using the {@link Components}
1566
+ * instance.
1447
1567
  */
1448
- export declare class SimpleRenderer extends BaseRenderer {
1449
- enabled: boolean;
1450
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1451
- container: HTMLElement;
1452
- three: THREE.WebGLRenderer;
1453
- protected _canvas: HTMLCanvasElement;
1454
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1455
- protected _resizeObserver: ResizeObserver | null;
1456
- protected onContainerUpdated: Event<HTMLElement>;
1457
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1458
- /** {@link Updateable.update} */
1459
- update(): void;
1460
- /** {@link Disposable.dispose} */
1461
- dispose(): void;
1462
- /** {@link Resizeable.getSize}. */
1463
- getSize(): THREE.Vector2;
1464
- /** {@link Resizeable.resize} */
1465
- resize: (size?: THREE.Vector2) => void;
1466
- setupEvents(active: boolean): void;
1467
- private resizeEvent;
1468
- private setupRenderer;
1469
- private onContextLost;
1470
- private onContextBack;
1568
+ export declare abstract class Component extends Base {
1569
+ /**
1570
+ * Whether this component is active or not. The behaviour can vary depending
1571
+ * on the type of component. E.g. a disabled dimension tool will stop creating
1572
+ * dimensions, while a disabled camera will stop moving. A disabled component
1573
+ * will not be updated automatically each frame.
1574
+ */
1575
+ abstract enabled: boolean;
1471
1576
  }
1472
- import * as THREE from "three";
1473
- import { BaseScene, Configurable, Event } from "../../Types";
1577
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1474
1578
  import { Components } from "../../Components";
1475
- export interface SimpleSceneConfig {
1476
- directionalLight: {
1477
- color: THREE.Color;
1478
- intensity: number;
1479
- position: THREE.Vector3;
1480
- };
1481
- ambientLight: {
1482
- color: THREE.Color;
1483
- intensity: number;
1484
- };
1485
- }
1486
1579
  /**
1487
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1488
- * objects hierarchically, and easily dispose them when you are finished with it.
1489
- * @noInheritDoc
1580
+ * Base class of the library. Useful for finding out the interfaces it implements.
1490
1581
  */
1491
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1492
- /** {@link Configurable.isSetup} */
1493
- isSetup: boolean;
1494
- three: THREE.Scene;
1495
- /** {@link Configurable.onSetup} */
1496
- readonly onSetup: Event<SimpleScene>;
1497
- config: Required<SimpleSceneConfig>;
1582
+ export declare abstract class Base {
1583
+ components: Components;
1498
1584
  constructor(components: Components);
1499
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1500
- setup(config?: Partial<SimpleSceneConfig>): void;
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>;
1501
1595
  }
1502
- import * as THREE from "three";
1503
- import CameraControls from "camera-controls";
1504
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1505
- import { Components } from "../../Components";
1506
1596
  /**
1507
- * A basic camera that uses
1508
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1509
- * easily control the camera in 2D and 3D. Check out it's API to find out
1510
- * what features it offers.
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.
1511
1604
  */
1512
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1513
- /** {@link Updateable.onBeforeUpdate} */
1514
- readonly onBeforeUpdate: Event<SimpleCamera>;
1515
- /** {@link Updateable.onAfterUpdate} */
1516
- readonly onAfterUpdate: Event<SimpleCamera>;
1517
- readonly onAspectUpdated: Event<unknown>;
1518
- /** {@link Disposable.onDisposed} */
1519
- readonly onDisposed: Event<string>;
1520
- readonly three: THREE.PerspectiveCamera;
1521
- private _allControls;
1605
+ export declare class AsyncEvent<T> {
1522
1606
  /**
1523
- * The object that controls the camera. An instance of
1524
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1525
- * Transforming the camera directly will have no effect: you need to use this
1526
- * object to move, rotate, look at objects, etc.
1607
+ * Add a callback to this event instance.
1608
+ * @param handler - the callback to be added to this event.
1527
1609
  */
1528
- get controls(): CameraControls;
1529
- /** {@link Component.enabled} */
1530
- get enabled(): boolean;
1531
- /** {@link Component.enabled} */
1532
- set enabled(enabled: boolean);
1533
- constructor(components: Components);
1534
- /** {@link Disposable.dispose} */
1535
- dispose(): void;
1536
- /** {@link Updateable.update} */
1537
- update(_delta: number): void;
1610
+ add(handler: T extends void ? {
1611
+ (): Promise<void>;
1612
+ } : {
1613
+ (data: T): Promise<void>;
1614
+ }): void;
1538
1615
  /**
1539
- * Updates the aspect of the camera to match the size of the
1540
- * {@link Components.renderer}.
1616
+ * Removes a callback from this event instance.
1617
+ * @param handler - the callback to be removed from this event.
1541
1618
  */
1542
- updateAspect: () => void;
1543
- private setupCamera;
1544
- private newCameraControls;
1545
- private setupEvents;
1546
- private static getSubsetOfThree;
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;
1547
1629
  }
1548
- import * as THREE from "three";
1630
+ import { Base } from "./base";
1631
+ import { World } from "./world";
1632
+ import { Event } from "./event";
1549
1633
  import { Components } from "../../Components";
1550
- import { AsyncEvent, Event, World } from "../../Types";
1551
- export interface CullerRendererSettings {
1552
- updateInterval?: number;
1553
- width?: number;
1554
- height?: number;
1555
- autoUpdate?: boolean;
1556
- }
1557
1634
  /**
1558
- * A base renderer to determine visibility on screen
1635
+ * One of the elements that make a world. It can be either a scene, a camera
1636
+ * or a renderer.
1559
1637
  */
1560
- export declare class CullerRenderer {
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);
1646
+ }
1647
+ 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;
1657
+ }
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>;
1561
1669
  /** {@link Disposable.onDisposed} */
1562
- readonly onDisposed: Event<string>;
1563
- /**
1564
- * Fires after making the visibility check to the meshes. It lists the
1565
- * meshes that are currently visible, and the ones that were visible
1566
- * just before but not anymore.
1567
- */
1568
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1569
- /** {@link Component.enabled} */
1570
- enabled: boolean;
1670
+ readonly onDisposed: Event<undefined>;
1671
+ readonly onResize: Event<THREE.Vector2>;
1571
1672
  /**
1572
- * Needs to check whether there are objects that need to be hidden or shown.
1573
- * You can bind this to the camera movement, to a certain interval, etc.
1673
+ * Event that fires when there has been a change to the list of clipping
1674
+ * planes used by the active renderer.
1574
1675
  */
1575
- needsUpdate: boolean;
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;
1576
1681
  /**
1577
- * Render the internal scene used to determine the object visibility. Used
1578
- * for debugging purposes.
1682
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1683
+ * instance of the renderer.
1579
1684
  */
1580
- renderDebugFrame: boolean;
1581
- components: Components;
1582
- readonly world: World;
1583
- readonly renderer: THREE.WebGLRenderer;
1584
- protected autoUpdate: boolean;
1585
- protected updateInterval: number;
1586
- protected readonly worker: Worker;
1587
- protected readonly scene: THREE.Scene;
1588
- private _width;
1589
- private _height;
1590
- private _availableColor;
1591
- private readonly renderTarget;
1592
- private readonly bufferSize;
1593
- private readonly _buffer;
1594
- protected _isWorkerBusy: boolean;
1595
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1596
- /** {@link Disposable.dispose} */
1597
- dispose(): void;
1685
+ clippingPlanes: THREE.Plane[];
1598
1686
  /**
1599
- * The function that the culler uses to reprocess the scene. Generally it's
1600
- * better to call needsUpdate, but you can also call this to force it.
1601
- * @param force if true, it will refresh the scene even if needsUpdate is
1602
- * not true.
1603
- */
1604
- updateVisibility: (force?: boolean) => Promise<void>;
1605
- protected getAvailableColor(): {
1606
- r: number;
1607
- g: number;
1608
- b: number;
1609
- code: string;
1610
- };
1611
- protected increaseColor(): void;
1612
- protected decreaseColor(): void;
1613
- private applySettings;
1687
+ * Forces the update of the clipping planes and all components that depend
1688
+ * on them that are subscribed to 'onClippingPlanesUpdated'.
1689
+ */
1690
+ updateClippingPlanes(): void;
1691
+ /**
1692
+ * Adds or removes a
1693
+ * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1694
+ * to the renderer.
1695
+ */
1696
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1614
1697
  }
1615
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1616
1698
  import * as THREE from "three";
1617
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1699
+ import { Disposable } from "./interfaces";
1700
+ import { Event } from "./event";
1618
1701
  import { Components } from "../../Components";
1619
- import { Event, World } from "../../Types";
1620
- /**
1621
- * A renderer to determine a mesh visibility on screen
1622
- */
1623
- export declare class MeshCullerRenderer extends CullerRenderer {
1624
- threshold: number;
1625
- readonly onViewUpdated: Event<{
1626
- seen: Set<THREE.Mesh>;
1627
- unseen: Set<THREE.Mesh>;
1628
- }>;
1629
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1630
- isProcessing: boolean;
1631
- private _colorCodeMeshMap;
1632
- private _meshIDColorCodeMap;
1633
- private _currentVisibleMeshes;
1634
- private _recentlyHiddenMeshes;
1635
- private _intervalID;
1636
- private readonly _transparentMat;
1637
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1702
+ import { BaseWorldItem } from "./base-world-item";
1703
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1704
+ /** {@link Disposable.onDisposed} */
1705
+ readonly onDisposed: Event<unknown>;
1706
+ abstract three: THREE.Object3D;
1707
+ protected constructor(components: Components);
1708
+ /** {@link Disposable.dispose} */
1638
1709
  dispose(): void;
1639
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1640
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1641
- private handleWorkerMessage;
1642
- private getAvailableMaterial;
1710
+ }
1711
+ 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;
1643
1722
  }
1644
1723
  import * as THREE from "three";
1645
1724
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -1686,9 +1765,9 @@ export declare class SimplePlane implements Disposable, Hideable {
1686
1765
  set size(size: number);
1687
1766
  get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1688
1767
  constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1689
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): Promise<void>;
1768
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
1690
1769
  /** {@link Updateable.update} */
1691
- update: () => Promise<void>;
1770
+ update: () => void;
1692
1771
  /** {@link Disposable.dispose} */
1693
1772
  dispose(): void;
1694
1773
  private reset;
@@ -1702,169 +1781,15 @@ export declare class SimplePlane implements Disposable, Hideable {
1702
1781
  private newHelper;
1703
1782
  private static newPlaneMesh;
1704
1783
  }
1705
- /// <reference types="node" />
1706
- import * as THREE from "three";
1707
- import { Hideable, Event, World } from "../../Types";
1708
- import { Components } from "../../Components";
1709
- export interface GridConfig {
1710
- color: THREE.Color;
1711
- size1: number;
1712
- size2: number;
1713
- distance: number;
1714
- }
1715
- /**
1716
- * An infinite grid. Created by
1717
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1718
- * and translated to typescript by
1719
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1720
- */
1721
- export declare class SimpleGrid implements Hideable, Disposable {
1722
- /** {@link Disposable.onDisposed} */
1723
- readonly onDisposed: Event<unknown>;
1724
- world: World;
1725
- components: Components;
1726
- /** {@link Hideable.visible} */
1727
- get visible(): boolean;
1728
- /** {@link Hideable.visible} */
1729
- set visible(visible: boolean);
1730
- /** The material of the grid. */
1731
- get material(): THREE.ShaderMaterial;
1732
- /**
1733
- * Whether the grid should fade away with distance. Recommended to be true for
1734
- * perspective cameras and false for orthographic cameras.
1735
- */
1736
- get fade(): boolean;
1737
- /**
1738
- * Whether the grid should fade away with distance. Recommended to be true for
1739
- * perspective cameras and false for orthographic cameras.
1740
- */
1741
- set fade(active: boolean);
1742
- private readonly _grid;
1743
- private _fade;
1744
- constructor(components: Components, world: World, config: GridConfig);
1745
- [Symbol.dispose](): void;
1746
- /** {@link Component.get} */
1747
- get(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1748
- /** {@link Disposable.dispose} */
1749
- dispose(): void;
1750
- private setupEvents;
1751
- private updateZoom;
1752
- }
1753
- import { NavigationMode } from "./types";
1754
- /**
1755
- * A {@link NavigationMode} that allows first person navigation,
1756
- * simulating FPS video games.
1757
- */
1758
- export declare class FirstPersonMode implements NavigationMode {
1759
- private camera;
1760
- /** {@link NavigationMode.enabled} */
1761
- enabled: boolean;
1762
- /** {@link NavigationMode.id} */
1763
- readonly id = "FirstPerson";
1764
- constructor(camera: any);
1765
- /** {@link NavigationMode.set} */
1766
- set(active: boolean): void;
1767
- private setupFirstPersonCamera;
1768
- }
1769
- import { NavigationMode } from "./types";
1770
- /**
1771
- * A {@link NavigationMode} that allows 3D navigation and panning
1772
- * like in many 3D and CAD softwares.
1773
- */
1774
- export declare class OrbitMode implements NavigationMode {
1775
- camera: any;
1776
- /** {@link NavigationMode.enabled} */
1777
- enabled: boolean;
1778
- /** {@link NavigationMode.id} */
1779
- readonly id = "Orbit";
1780
- constructor(camera: any);
1781
- /** {@link NavigationMode.set} */
1782
- set(active: boolean): void;
1783
- private activateOrbitControls;
1784
- }
1785
- import { NavigationMode } from "./types";
1786
- /**
1787
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1788
- * like many BIM tools.
1789
- */
1790
- export declare class PlanMode implements NavigationMode {
1791
- private camera;
1792
- /** {@link NavigationMode.enabled} */
1793
- enabled: boolean;
1794
- /** {@link NavigationMode.id} */
1795
- readonly id = "Plan";
1796
- private mouseAction1?;
1797
- private mouseAction2?;
1798
- private mouseInitialized;
1799
- private readonly defaultAzimuthSpeed;
1800
- private readonly defaultPolarSpeed;
1801
- constructor(camera: any);
1802
- /** {@link NavigationMode.set} */
1803
- set(active: boolean): void;
1804
- }
1784
+ import * as WEBIFC from "web-ifc";
1805
1785
  import * as THREE from "three";
1806
- import { CameraProjection } from "./types";
1807
- import { Event } from "../../../core";
1808
- import { OrthoPerspectiveCamera } from "../index";
1809
- /**
1810
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1811
- */
1812
- export declare class ProjectionManager {
1813
- /**
1814
- * Event that fires when the {@link CameraProjection} changes.
1815
- */
1816
- readonly onChanged: Event<THREE.Camera>;
1817
- current: CameraProjection;
1818
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1819
- private _component;
1820
- private _previousDistance;
1821
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1822
- matchOrthoDistanceEnabled: boolean;
1823
- constructor(camera: OrthoPerspectiveCamera);
1824
- /**
1825
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1826
- *
1827
- * @param projection - the new projection to set. If it is the current projection,
1828
- * it will have no effect.
1829
- */
1830
- set(projection: CameraProjection): Promise<void>;
1831
- /**
1832
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1833
- * and vice versa.
1834
- */
1835
- toggle(): Promise<void>;
1836
- private setOrthoCamera;
1837
- private getDims;
1838
- private setupOrthoCamera;
1839
- private getDistance;
1840
- private setPerspectiveCamera;
1841
- }
1842
- /**
1843
- * The projection system of the camera.
1844
- */
1845
- export type CameraProjection = "Perspective" | "Orthographic";
1846
- /**
1847
- * The extensible list of supported navigation modes.
1848
- */
1849
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1850
- /**
1851
- * An object that determines the behavior of the camera controls
1852
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1853
- */
1854
- export interface NavigationMode {
1855
- /** The unique ID of this navigation mode. */
1856
- id: NavModeID;
1857
- /**
1858
- * Enable or disable this navigation mode.
1859
- * When a new navigation mode is enabled, the previous navigation mode
1860
- * must be disabled.
1861
- *
1862
- * @param active - whether to enable or disable this mode.
1863
- * @param options - any additional data required to enable or disable it.
1864
- * */
1865
- set: (active: boolean, options?: any) => void;
1866
- /** Whether this navigation mode is active or not. */
1867
- enabled: boolean;
1786
+ export declare class Units {
1787
+ factor: number;
1788
+ complement: number;
1789
+ apply(matrix: THREE.Matrix4): void;
1790
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1791
+ private getLengthUnits;
1792
+ private getScaleMatrix;
1868
1793
  }
1869
1794
  import * as WEBIFC from "web-ifc";
1870
1795
  /** Configuration of the IFC-fragment conversion. */
@@ -1912,17 +1837,7 @@ import * as WEBIFC from "web-ifc";
1912
1837
  export declare class IfcMetadataReader {
1913
1838
  get(webIfc: WEBIFC.IfcAPI, type: number): string;
1914
1839
  }
1915
- import * as WEBIFC from "web-ifc";
1916
- import * as THREE from "three";
1917
- export declare class Units {
1918
- factor: number;
1919
- complement: number;
1920
- apply(matrix: THREE.Matrix4): void;
1921
- setUp(webIfc: WEBIFC.IfcAPI): void;
1922
- private getLengthUnits;
1923
- private getScaleMatrix;
1924
- }
1925
- import { IfcFragmentSettings } from "../../FragmentIfcLoader/src";
1840
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
1926
1841
  /** Configuration of the IFC-fragment streaming. */
1927
1842
  export declare class IfcStreamingSettings extends IfcFragmentSettings {
1928
1843
  minGeometrySize: number;
@@ -1932,21 +1847,6 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1932
1847
  export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1933
1848
  propertiesSize: number;
1934
1849
  }
1935
- export interface StreamedGeometries {
1936
- [id: number]: {
1937
- boundingBox: Float32Array;
1938
- hasHoles: boolean;
1939
- geometryFile?: string;
1940
- };
1941
- }
1942
- export interface StreamedAsset {
1943
- id: number;
1944
- geometries: {
1945
- geometryID: number;
1946
- transformation: number[];
1947
- color: number[];
1948
- }[];
1949
- }
1950
1850
  import * as WEBIFC from "web-ifc";
1951
1851
  import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1952
1852
  import { PropertiesStreamingSettings } from "./streaming-settings";
@@ -1974,6 +1874,21 @@ export declare class FragmentPropsStreamConverter extends Component implements D
1974
1874
  private getIndices;
1975
1875
  private cleanUp;
1976
1876
  }
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
+ }
1977
1892
  export type RelationsMap = Map<number, Map<number, number[]>>;
1978
1893
  export interface ModelsRelationMap {
1979
1894
  [modelID: string]: RelationsMap;
@@ -2003,28 +1918,5 @@ import * as THREE from "three";
2003
1918
  export declare class TransformHelper {
2004
1919
  getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
2005
1920
  }
2006
- export type QueryConditions = "is" | "includes" | "startsWith" | "endsWith" | "matches";
2007
- export type ConditionFunctions = {
2008
- [queryCondition in QueryConditions]: (leftValue: string | boolean | number, rightValue: string | boolean | number) => boolean;
2009
- };
2010
- export type QueryOperators = "AND" | "OR";
2011
- export interface AttributeQuery {
2012
- operator?: QueryOperators;
2013
- attribute: string;
2014
- condition: QueryConditions;
2015
- value: string | number | boolean;
2016
- negateResult?: boolean;
2017
- caseSensitive?: boolean;
2018
- }
2019
- export interface QueryGroup {
2020
- operator?: QueryOperators;
2021
- description?: string;
2022
- queries: (AttributeQuery | QueryGroup)[];
2023
- }
2024
- export interface Query {
2025
- name: string;
2026
- description?: string;
2027
- groups: QueryGroup;
2028
- }
2029
1921
 
2030
1922
  }