@thatopen/components 2.0.0-alpha.17 → 2.0.0-alpha.18

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