@thatopen/components 2.0.13 → 2.0.14

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,568 +1,602 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, Event } from "../Types";
2
+ import { Component, Disposable, Event, Components } from "../../core";
3
3
  /**
4
- * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
4
+ * The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
5
5
  */
6
- export declare class Components implements Disposable {
6
+ export declare class Exploder extends Component implements Disposable {
7
7
  /**
8
- * The version of the @thatopen/components library.
8
+ * A unique identifier for the component.
9
+ * This UUID is used to register the component within the Components system.
9
10
  */
10
- static readonly release = "2.0.12";
11
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
11
12
  /** {@link Disposable.onDisposed} */
12
- readonly onDisposed: Event<void>;
13
- /**
14
- * The list of components created in this app.
15
- * The keys are UUIDs and the values are instances of the components.
16
- */
17
- readonly list: Map<string, Component>;
18
- /**
19
- * If disabled, the animation loop will be stopped.
20
- * Default value is false.
21
- */
13
+ readonly onDisposed: Event<unknown>;
14
+ /** {@link Component.enabled} */
22
15
  enabled: boolean;
23
- private _clock;
24
16
  /**
25
- * Adds a component to the list of components.
26
- * Throws an error if a component with the same UUID already exists.
27
- *
28
- * @param uuid - The unique identifier of the component.
29
- * @param instance - The instance of the component to be added.
30
- *
31
- * @throws Will throw an error if a component with the same UUID already exists.
32
- *
33
- * @internal
17
+ * The height of the explosion animation.
18
+ * This property determines the vertical distance by which fragments are moved during the explosion.
19
+ * Default value is 10.
34
20
  */
35
- add(uuid: string, instance: Component): void;
21
+ height: number;
36
22
  /**
37
- * Retrieves a component instance by its constructor function.
38
- * If the component does not exist in the list, it will be created and added.
39
- *
40
- * @template U - The type of the component to retrieve.
41
- * @param Component - The constructor function of the component to retrieve.
42
- *
43
- * @returns The instance of the requested component.
44
- *
45
- * @throws Will throw an error if a component with the same UUID already exists.
46
- *
47
- * @internal
23
+ * The group name used for the explosion animation.
24
+ * This property specifies the group of fragments that will be affected by the explosion.
25
+ * Default value is "storeys".
48
26
  */
49
- get<U extends Component>(Component: new (components: Components) => U): U;
50
- constructor();
27
+ groupName: string;
51
28
  /**
52
- * Initializes the Components instance.
53
- * This method starts the animation loop, sets the enabled flag to true,
54
- * and calls the update method.
55
- *
56
- * @returns {void}
29
+ * A set of strings representing the exploded items.
30
+ * This set is used to keep track of which items have been exploded.
57
31
  */
58
- init(): void;
32
+ list: Set<string>;
33
+ constructor(components: Components);
34
+ /** {@link Disposable.dispose} */
35
+ dispose(): void;
59
36
  /**
60
- * Disposes the memory of all the components and tools of this instance of
61
- * the library. A memory leak will be created if:
37
+ * Sets the explosion state of the fragments.
62
38
  *
63
- * - An instance of the library ends up out of scope and this function isn't
64
- * called. This is especially relevant in Single Page Applications (React,
65
- * Angular, Vue, etc).
39
+ * @param active - A boolean indicating whether to activate or deactivate the explosion.
66
40
  *
67
- * - Any of the objects of this instance (meshes, geometries,materials, etc) is
68
- * referenced by a reference type (object or array).
41
+ * @remarks
42
+ * This method applies a vertical transformation to the fragments based on the 'active' parameter.
43
+ * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
44
+ * If 'active' is false, the fragments are moved back to their original position.
69
45
  *
70
- * You can learn more about how Three.js handles memory leaks
71
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
46
+ * The method also keeps track of the exploded items using the 'list' set.
72
47
  *
48
+ * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
73
49
  */
74
- dispose(): void;
75
- private update;
76
- private static setupBVH;
50
+ set(active: boolean): void;
77
51
  }
52
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
78
53
  import * as THREE from "three";
79
- import { Components } from "../Components";
80
- import { Component } from "../Types";
54
+ import * as FRAGS from "@thatopen/fragments";
55
+ import { Component, Components, Event, Disposable } from "../../core";
56
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
81
57
  /**
82
- * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
58
+ * Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
83
59
  */
84
- export declare class Disposer extends Component {
85
- private _disposedComponents;
86
- /** {@link Component.enabled} */
87
- enabled: boolean;
60
+ export declare class FragmentsManager extends Component implements Disposable {
88
61
  /**
89
62
  * A unique identifier for the component.
90
63
  * This UUID is used to register the component within the Components system.
91
64
  */
92
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
93
- constructor(components: Components);
65
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
66
+ /** {@link Disposable.onDisposed} */
67
+ readonly onDisposed: Event<unknown>;
94
68
  /**
95
- * Return the UUIDs of all disposed components.
69
+ * Event triggered when fragments are loaded.
96
70
  */
97
- get(): Set<string>;
71
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
98
72
  /**
99
- * Removes a mesh, its geometry and its materials from memory. If you are
100
- * using any of these in other parts of the application, make sure that you
101
- * remove them from the mesh before disposing it.
102
- *
103
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
104
- * to remove.
105
- *
106
- * @param materials - whether to dispose the materials of the mesh.
107
- *
108
- * @param recursive - whether to recursively dispose the children of the mesh.
73
+ * Event triggered when fragments are disposed.
109
74
  */
110
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
75
+ readonly onFragmentsDisposed: Event<{
76
+ groupID: string;
77
+ fragmentIDs: string[];
78
+ }>;
111
79
  /**
112
- * Disposes a geometry from memory.
113
- *
114
- * @param geometry - the
115
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
116
- * to remove.
80
+ * Map containing all loaded fragments.
81
+ * The key is the fragment's unique identifier, and the value is the fragment itself.
117
82
  */
118
- disposeGeometry(geometry: THREE.BufferGeometry): void;
119
- private disposeGeometryAndMaterials;
120
- private disposeChildren;
121
- private static disposeMaterial;
122
- }
123
- import { Component, Disposable, World, Event } from "../Types";
124
- import { SimpleRaycaster } from "./src";
125
- import { Components } from "../Components";
126
- /**
127
- * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
128
- */
129
- export declare class Raycasters extends Component implements Disposable {
83
+ readonly list: Map<string, Fragment>;
130
84
  /**
131
- * A unique identifier for the component.
132
- * This UUID is used to register the component within the Components system.
85
+ * Map containing all loaded fragment groups.
86
+ * The key is the group's unique identifier, and the value is the group itself.
133
87
  */
134
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
88
+ readonly groups: Map<string, FragmentsGroup>;
89
+ baseCoordinationModel: string;
135
90
  /** {@link Component.enabled} */
136
91
  enabled: boolean;
92
+ private _loader;
137
93
  /**
138
- * A Map that stores raycasters for each world.
139
- * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
94
+ * Getter for the meshes of all fragments in the FragmentsManager.
95
+ * It iterates over the fragments in the list and pushes their meshes into an array.
96
+ * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
140
97
  */
141
- list: Map<string, SimpleRaycaster>;
142
- /** {@link Disposable.onDisposed} */
143
- onDisposed: Event<unknown>;
98
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
144
99
  constructor(components: Components);
100
+ /** {@link Disposable.dispose} */
101
+ dispose(): void;
145
102
  /**
146
- * Retrieves a SimpleRaycaster instance for the given world.
147
- * If a SimpleRaycaster instance already exists for the world, it will be returned.
148
- * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
103
+ * Dispose of a specific fragment group.
104
+ * This method removes the group from the groups map, deletes all fragments within the group from the list,
105
+ * disposes of the group, and triggers the onFragmentsDisposed event.
149
106
  *
150
- * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
151
- * @returns The SimpleRaycaster instance for the given world.
107
+ * @param group - The fragment group to be disposed.
152
108
  */
153
- get(world: World): SimpleRaycaster;
109
+ disposeGroup(group: FragmentsGroup): void;
154
110
  /**
155
- * Deletes the SimpleRaycaster instance associated with the given world.
156
- * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
111
+ * Loads a binary file that contain fragment geometry.
112
+ * @param data - The binary data to load.
113
+ * @param config - Optional configuration for loading.
114
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
115
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
116
+ * @returns The loaded FragmentsGroup.
117
+ */
118
+ load(data: Uint8Array, config?: Partial<{
119
+ coordinate: boolean;
120
+ name: string;
121
+ properties: FRAGS.IfcProperties;
122
+ relationsMap: RelationsMap;
123
+ }>): FragmentsGroup;
124
+ /**
125
+ * Export the specified fragmentsgroup to binary data.
126
+ * @param group - the fragments group to be exported.
127
+ * @returns the exported data as binary buffer.
128
+ */
129
+ export(group: FragmentsGroup): Uint8Array;
130
+ /**
131
+ * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
132
+ * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
133
+ * @returns A map of model IDs to sets of express IDs.
134
+ */
135
+ getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
136
+ [modelID: string]: Set<number>;
137
+ };
138
+ /**
139
+ * Converts a map of model IDs to sets of express IDs to a fragment ID map.
140
+ * @param modelIdMap - A map of model IDs to their corresponding express IDs.
141
+ * @returns A fragment ID map.
142
+ * @remarks
143
+ * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
144
+ * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
145
+ * The fragment ID maps are then merged into a single map and returned.
146
+ * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
147
+ */
148
+ modelIdToFragmentIdMap(modelIdMap: {
149
+ [modelID: string]: Set<number>;
150
+ }): FRAGS.FragmentIdMap;
151
+ /**
152
+ * Applies coordinate transformation to the provided models.
153
+ * If no models are provided, all groups are used.
154
+ * The first model in the list becomes the base model for coordinate transformation.
155
+ * All other models are then transformed to match the base model's coordinate system.
156
+ *
157
+ * @param models - The models to apply coordinate transformation to.
158
+ * If not provided, all groups are used.
157
159
  *
158
- * @param world - The world for which to delete the SimpleRaycaster instance.
159
160
  * @returns {void}
160
161
  */
161
- delete(world: World): void;
162
- /** {@link Disposable.dispose} */
163
- dispose(): void;
162
+ coordinate(models?: FragmentsGroup[]): void;
164
163
  }
165
- import { Component, Disposable, World, Event } from "../Types";
166
- import { GridConfig, SimpleGrid } from "./src";
167
- import { Components } from "../Components";
164
+ import * as WEBIFC from "web-ifc";
165
+ import * as FRAGS from "@thatopen/fragments";
166
+ import { IfcFragmentSettings } from "./src";
167
+ import { Component, Components, Event, Disposable } from "../../core";
168
168
  /**
169
- * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
169
+ * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
170
170
  */
171
- export declare class Grids extends Component implements Disposable {
171
+ export declare class IfcLoader extends Component implements Disposable {
172
172
  /**
173
173
  * A unique identifier for the component.
174
174
  * This UUID is used to register the component within the Components system.
175
175
  */
176
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
176
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
177
+ /** {@link Disposable.onDisposed} */
178
+ readonly onDisposed: Event<string>;
177
179
  /**
178
- * A map of world UUIDs to their corresponding grid instances.
180
+ * An event triggered when the IFC file starts loading.
179
181
  */
180
- list: Map<string, SimpleGrid>;
182
+ readonly onIfcStartedLoading: Event<void>;
181
183
  /**
182
- * The default configuration for grid creation.
184
+ * An event triggered when the setup process is completed.
183
185
  */
184
- config: Required<GridConfig>;
185
- /** {@link Disposable.onDisposed} */
186
- readonly onDisposed: Event<unknown>;
187
- /** {@link Component.enabled} */
188
- enabled: boolean;
186
+ readonly onSetup: Event<void>;
187
+ /**
188
+ * The settings for the IfcLoader.
189
+ * It includes options for excluding categories, setting WASM paths, and more.
190
+ */
191
+ settings: IfcFragmentSettings;
192
+ /**
193
+ * The instance of the Web-IFC library used for handling IFC data.
194
+ */
195
+ webIfc: WEBIFC.IfcAPI;
196
+ /** {@link Component.enabled} */
197
+ enabled: boolean;
198
+ private _material;
199
+ private _spatialTree;
200
+ private _metaData;
201
+ private _fragmentInstances;
202
+ private _civil;
203
+ private _visitedFragments;
204
+ private _materialT;
189
205
  constructor(components: Components);
206
+ /** {@link Disposable.dispose} */
207
+ dispose(): void;
190
208
  /**
191
- * Creates a new grid for the given world.
192
- * Throws an error if a grid already exists for the world.
209
+ * Sets up the IfcLoader component with the provided configuration.
193
210
  *
194
- * @param world - The world to create the grid for.
195
- * @returns The newly created grid.
211
+ * @param config - Optional configuration settings for the IfcLoader.
212
+ * If not provided, the existing settings will be used.
196
213
  *
197
- * @throws Will throw an error if a grid already exists for the given world.
214
+ * @returns A Promise that resolves when the setup process is completed.
215
+ *
216
+ * @remarks
217
+ * If the 'autoSetWasm' option is enabled in the configuration,
218
+ * the method will automatically set the WASM paths for the Web-IFC library.
219
+ *
220
+ * @example
221
+ * '''typescript
222
+ * const ifcLoader = new IfcLoader(components);
223
+ * await ifcLoader.setup({ autoSetWasm: true });
224
+ * '''
198
225
  */
199
- create(world: World): SimpleGrid;
226
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
200
227
  /**
201
- * Deletes the grid associated with the given world.
202
- * If a grid does not exist for the given world, this method does nothing.
228
+ * Loads an IFC file and processes it for 3D visualization.
203
229
  *
204
- * @param world - The world for which to delete the grid.
230
+ * @param data - The Uint8Array containing the IFC file data.
231
+ * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
232
+ *
233
+ * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
234
+ *
235
+ * @example
236
+ * '''typescript
237
+ * const ifcLoader = components.get(IfcLoader);
238
+ * const group = await ifcLoader.load(ifcData);
239
+ * '''
240
+ */
241
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
242
+ /**
243
+ * Reads an IFC file and initializes the Web-IFC library.
244
+ *
245
+ * @param data - The Uint8Array containing the IFC file data.
246
+ *
247
+ * @returns A Promise that resolves when the IFC file is opened and initialized.
205
248
  *
206
249
  * @remarks
207
- * This method will dispose of the grid and remove it from the internal list.
208
- * If the world is disposed before calling this method, the grid will be automatically deleted.
250
+ * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
251
+ * It also opens the IFC model using the provided data and settings.
252
+ *
253
+ * @example
254
+ * '''typescript
255
+ * const ifcLoader = components.get(IfcLoader);
256
+ * await ifcLoader.readIfcFile(ifcData);
257
+ * '''
209
258
  */
210
- delete(world: World): void;
211
- /** {@link Disposable.dispose} */
212
- dispose(): void;
259
+ readIfcFile(data: Uint8Array): Promise<number>;
260
+ /**
261
+ * Cleans up the IfcLoader component by resetting the Web-IFC library,
262
+ * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
263
+ *
264
+ * @remarks
265
+ * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
266
+ *
267
+ * @example
268
+ * '''typescript
269
+ * const ifcLoader = components.get(IfcLoader);
270
+ * ifcLoader.cleanUp();
271
+ * '''
272
+ */
273
+ cleanUp(): void;
274
+ private getAllGeometries;
275
+ private getMesh;
276
+ private getGeometry;
277
+ private autoSetWasm;
213
278
  }
214
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
215
- import { Components } from "../Components";
216
- import { SimpleWorld } from "./src";
279
+ import * as WEBIFC from "web-ifc";
280
+ import { Components, Disposable, Event, Component } from "../../core";
281
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
217
282
  /**
218
- * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
283
+ * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
219
284
  */
220
- export declare class Worlds extends Component implements Updateable, Disposable {
285
+ export declare class IfcGeometryTiler extends Component implements Disposable {
221
286
  /**
222
287
  * A unique identifier for the component.
223
288
  * This UUID is used to register the component within the Components system.
224
289
  */
225
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
226
- /** {@link Updateable.onAfterUpdate} */
227
- readonly onAfterUpdate: Event<unknown>;
228
- /** {@link Updateable.onBeforeUpdate} */
229
- readonly onBeforeUpdate: Event<unknown>;
230
- /** {@link Disposable.onDisposed} */
231
- readonly onDisposed: Event<unknown>;
290
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
232
291
  /**
233
- * An event that is triggered when a new world is created.
234
- * The event passes the newly created world as a parameter.
292
+ * Event triggered when geometry is streamed.
293
+ * Contains the streamed geometry data and its buffer.
235
294
  */
236
- readonly onWorldCreated: Event<World>;
295
+ readonly onGeometryStreamed: Event<{
296
+ buffer: Uint8Array;
297
+ data: StreamedGeometries;
298
+ }>;
237
299
  /**
238
- * An event that is triggered when a world is deleted.
239
- * The event passes the UUID of the deleted world as a parameter.
300
+ * Event triggered when assets are streamed.
301
+ * Contains the streamed assets.
240
302
  */
241
- readonly onWorldDeleted: Event<string>;
303
+ readonly onAssetStreamed: Event<StreamedAsset[]>;
242
304
  /**
243
- * A collection of worlds managed by this component.
244
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
305
+ * Event triggered to indicate the progress of the streaming process.
306
+ * Contains the progress percentage.
245
307
  */
246
- list: Map<string, World>;
308
+ readonly onProgress: Event<number>;
309
+ /**
310
+ * Event triggered when the IFC file is loaded.
311
+ * Contains the loaded IFC file data.
312
+ */
313
+ readonly onIfcLoaded: Event<Uint8Array>;
314
+ /** {@link Disposable.onDisposed} */
315
+ readonly onDisposed: Event<unknown>;
316
+ /**
317
+ * Settings for the IfcGeometryTiler.
318
+ */
319
+ settings: IfcStreamingSettings;
247
320
  /** {@link Component.enabled} */
248
321
  enabled: boolean;
249
- constructor(components: Components);
250
322
  /**
251
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
252
- *
253
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
254
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
255
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
256
- *
257
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
323
+ * The WebIFC API instance used for IFC file processing.
258
324
  */
259
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
325
+ webIfc: WEBIFC.IfcAPI;
326
+ private _spatialTree;
327
+ private _metaData;
328
+ private _visitedGeometries;
329
+ private _streamSerializer;
330
+ private _geometries;
331
+ private _geometryCount;
332
+ private _civil;
333
+ private _groupSerializer;
334
+ private _assets;
335
+ private _meshesWithHoles;
336
+ constructor(components: Components);
337
+ /** {@link Disposable.dispose} */
338
+ dispose(): void;
260
339
  /**
261
- * Deletes a world from the list of worlds.
340
+ * This method streams the IFC file from a given buffer.
262
341
  *
263
- * @param {World} world - The world to be deleted.
342
+ * @param data - The Uint8Array containing the IFC file data.
343
+ * @returns A Promise that resolves when the streaming process is complete.
264
344
  *
265
- * @throws {Error} - Throws an error if the provided world is not found in the list.
345
+ * @remarks
346
+ * This method cleans up any resources after the streaming process is complete.
266
347
  *
267
- * @returns {void}
348
+ * @example
349
+ * '''typescript
350
+ * const ifcData = await fetch('path/to/ifc/file.ifc');
351
+ * const rawBuffer = await response.arrayBuffer();
352
+ * const ifcBuffer = new Uint8Array(rawBuffer);
353
+ * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
354
+ * '''
268
355
  */
269
- delete(world: World): void;
356
+ streamFromBuffer(data: Uint8Array): Promise<void>;
270
357
  /**
271
- * Disposes of the Worlds component and all its managed worlds.
272
- * This method sets the enabled flag to false, disposes of all worlds, clears the list,
273
- * and triggers the onDisposed event.
358
+ * This method streams the IFC file from a given callback.
359
+ *
360
+ * @param loadCallback - The callback function that will be used to load the IFC file.
361
+ * @returns A Promise that resolves when the streaming process is complete.
362
+ *
363
+ * @remarks
364
+ * This method cleans up any resources after the streaming process is complete.
274
365
  *
275
- * @returns {void}
276
366
  */
277
- dispose(): void;
278
- /** {@link Updateable.update} */
279
- update(delta?: number): void | Promise<void>;
367
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
368
+ private readIfcFile;
369
+ private streamIfcFile;
370
+ private streamAllGeometries;
371
+ private cleanUp;
372
+ private getMesh;
373
+ private getGeometry;
374
+ private streamAssets;
375
+ private streamGeometries;
280
376
  }
281
- import { Components } from "../Components";
282
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
283
- import { Component, Event, Disposable, World } from "../Types";
377
+ import * as WEBIFC from "web-ifc";
378
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
379
+ import { PropertiesStreamingSettings } from "./src";
284
380
  /**
285
- * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
381
+ * A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
286
382
  */
287
- export declare class Cullers extends Component implements Disposable {
383
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
288
384
  /**
289
385
  * A unique identifier for the component.
290
386
  * This UUID is used to register the component within the Components system.
291
387
  */
292
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
388
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
293
389
  /**
294
- * An event that is triggered when the Cullers component is disposed.
390
+ * An event that is triggered when properties are streamed from the IFC file.
391
+ * The event provides the type of the IFC entity and the corresponding data.
295
392
  */
296
- readonly onDisposed: Event<unknown>;
297
- private _enabled;
393
+ readonly onPropertiesStreamed: AsyncEvent<{
394
+ type: number;
395
+ data: {
396
+ [id: number]: any;
397
+ };
398
+ }>;
298
399
  /**
299
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
400
+ * An event that is triggered to indicate the progress of the streaming process.
401
+ * The event provides a number between 0 and 1 representing the progress percentage.
300
402
  */
301
- list: Map<string, MeshCullerRenderer>;
302
- /** {@link Component.enabled} */
303
- get enabled(): boolean;
304
- /** {@link Component.enabled} */
305
- set enabled(value: boolean);
306
- constructor(components: Components);
403
+ readonly onProgress: AsyncEvent<number>;
307
404
  /**
308
- * Creates a new MeshCullerRenderer for the given world.
309
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
310
- *
311
- * @param world - The world for which to create the MeshCullerRenderer.
312
- * @param config - Optional configuration settings for the MeshCullerRenderer.
313
- *
314
- * @returns The newly created or existing MeshCullerRenderer for the given world.
405
+ * An event that is triggered when indices are streamed from the IFC file.
406
+ * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
315
407
  */
316
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
317
- /**
318
- * Deletes the MeshCullerRenderer associated with the given world.
319
- * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
408
+ readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
409
+ /** {@link Disposable.onDisposed} */
410
+ readonly onDisposed: Event<string>;
411
+ /** {@link Component.enabled} */
412
+ enabled: boolean;
413
+ /**
414
+ * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
415
+ */
416
+ settings: PropertiesStreamingSettings;
417
+ /**
418
+ * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
419
+ */
420
+ webIfc: WEBIFC.IfcAPI;
421
+ /** {@link Disposable.dispose} */
422
+ dispose(): Promise<void>;
423
+ /**
424
+ * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
320
425
  *
321
- * @param world - The world for which to delete the MeshCullerRenderer.
426
+ * @param data - The Uint8Array containing the IFC file data.
427
+ * @returns A Promise that resolves when the streaming process is complete.
428
+ */
429
+ streamFromBuffer(data: Uint8Array): Promise<void>;
430
+ /**
431
+ * This method converts properties from an IFC file to tiles using a given callback function to read the file.
322
432
  *
323
- * @returns {void}
433
+ * @param loadCallback - A callback function that loads the IFC file data.
434
+ * @returns A Promise that resolves when the streaming process is complete.
324
435
  */
325
- delete(world: World): void;
326
- /** {@link Disposable.dispose} */
327
- dispose(): void;
436
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
437
+ private readIfcFile;
438
+ private streamIfcFile;
439
+ private streamAllProperties;
440
+ private cleanUp;
328
441
  }
329
442
  import * as THREE from "three";
330
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
331
- import { SimplePlane } from "./src";
332
- import { Components } from "../Components";
443
+ import { Component, Components } from "../../core";
333
444
  /**
334
- * A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper).
335
- *
336
- * @param components - the instance of {@link Components} used.
337
- * E.g. {@link SimplePlane}.
445
+ * Represents an edge measurement result.
338
446
  */
339
- export declare class Clipper extends Component implements Createable, Disposable, Hideable {
340
- /**
341
- * A unique identifier for the component.
342
- * This UUID is used to register the component within the Components system.
343
- */
344
- static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
345
- /** Event that fires when the user starts dragging a clipping plane. */
346
- readonly onBeforeDrag: Event<void>;
347
- /** Event that fires when the user stops dragging a clipping plane. */
348
- readonly onAfterDrag: Event<void>;
349
- /**
350
- * Event that fires when the user starts creating a clipping plane.
351
- */
352
- readonly onBeforeCreate: Event<unknown>;
447
+ export interface MeasureEdge {
353
448
  /**
354
- * Event that fires when the user cancels the creation of a clipping plane.
449
+ * The distance between the two points of the edge.
355
450
  */
356
- readonly onBeforeCancel: Event<unknown>;
451
+ distance: number;
357
452
  /**
358
- * Event that fires after the user cancels the creation of a clipping plane.
453
+ * The two points that define the edge.
359
454
  */
360
- readonly onAfterCancel: Event<unknown>;
455
+ points: THREE.Vector3[];
456
+ }
457
+ /**
458
+ * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
459
+ */
460
+ export declare class MeasurementUtils extends Component {
361
461
  /**
362
- * Event that fires when the user starts deleting a clipping plane.
462
+ * A unique identifier for the component.
463
+ * This UUID is used to register the component within the Components system.
363
464
  */
364
- readonly onBeforeDelete: Event<unknown>;
465
+ static uuid: string;
466
+ /** {@link Component.enabled} */
467
+ enabled: boolean;
468
+ constructor(components: Components);
365
469
  /**
366
- * Event that fires after a clipping plane has been created.
367
- * @param plane - The newly created clipping plane.
470
+ * Utility method to calculate the distance from a point to a line segment.
471
+ *
472
+ * @param point - The point from which to calculate the distance.
473
+ * @param lineStart - The start point of the line segment.
474
+ * @param lineEnd - The end point of the line segment.
475
+ * @param clamp - If true, the distance will be clamped to the line segment's length.
476
+ * @returns The distance from the point to the line segment.
368
477
  */
369
- readonly onAfterCreate: Event<SimplePlane>;
478
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
370
479
  /**
371
- * Event that fires after a clipping plane has been deleted.
372
- * @param plane - The deleted clipping plane.
480
+ * Method to get the face of a mesh that contains a given triangle index.
481
+ * It also returns the edges of the found face and their indices.
482
+ *
483
+ * @param mesh - The mesh to get the face from. It must be indexed.
484
+ * @param triangleIndex - The index of the triangle within the mesh.
485
+ * @param instance - The instance of the mesh (optional).
486
+ * @returns An object containing the edges of the found face and their indices, or null if no face was found.
373
487
  */
374
- readonly onAfterDelete: Event<SimplePlane>;
375
- /** {@link Disposable.onDisposed} */
376
- readonly onDisposed: Event<string>;
488
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
489
+ edges: MeasureEdge[];
490
+ indices: Set<number>;
491
+ } | null;
377
492
  /**
378
- * Whether to force the clipping plane to be orthogonal in the Y direction
379
- * (up). This is desirable when clipping a building horizontally and a
380
- * clipping plane is created in its roof, which might have a slight
381
- * slope for draining purposes.
493
+ * Method to get the vertices and normal of a mesh face at a given index.
494
+ * It also applies instance transformation if provided.
495
+ *
496
+ * @param mesh - The mesh to get the face from. It must be indexed.
497
+ * @param faceIndex - The index of the face within the mesh.
498
+ * @param instance - The instance of the mesh (optional).
499
+ * @returns An object containing the vertices and normal of the face.
500
+ * @throws Will throw an error if the geometry is not indexed.
382
501
  */
383
- orthogonalY: boolean;
502
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
503
+ p1: THREE.Vector3;
504
+ p2: THREE.Vector3;
505
+ p3: THREE.Vector3;
506
+ faceNormal: THREE.Vector3;
507
+ };
384
508
  /**
385
- * The tolerance that determines whether an almost-horizontal clipping plane
386
- * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
387
- * has to be 'true' for this to apply.
509
+ * Method to round the vector's components to a specified number of decimal places.
510
+ * This is used to ensure numerical precision in edge detection.
511
+ *
512
+ * @param vector - The vector to round.
513
+ * @returns The vector with rounded components.
388
514
  */
389
- toleranceOrthogonalY: number;
515
+ round(vector: THREE.Vector3): void;
516
+ private getFaceData;
517
+ }
518
+ import * as THREE from "three";
519
+ import { Components } from "../Components";
520
+ import { Component } from "../Types";
521
+ /**
522
+ * A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
523
+ */
524
+ export declare class Disposer extends Component {
525
+ private _disposedComponents;
526
+ /** {@link Component.enabled} */
527
+ enabled: boolean;
390
528
  /**
391
- * The type of clipping plane to be created.
392
- * Default is {@link SimplePlane}.
529
+ * A unique identifier for the component.
530
+ * This UUID is used to register the component within the Components system.
393
531
  */
394
- Type: new (...args: any) => SimplePlane;
532
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
533
+ constructor(components: Components);
395
534
  /**
396
- * A list of all the clipping planes created by this component.
535
+ * Return the UUIDs of all disposed components.
397
536
  */
398
- list: SimplePlane[];
399
- /** The material used in all the clipping planes. */
400
- private _material;
401
- private _size;
402
- private _enabled;
403
- private _visible;
404
- /** {@link Component.enabled} */
405
- get enabled(): boolean;
406
- /** {@link Component.enabled} */
407
- set enabled(state: boolean);
408
- /** {@link Hideable.visible } */
409
- get visible(): boolean;
410
- /** {@link Hideable.visible } */
411
- set visible(state: boolean);
412
- /** The material of the clipping plane representation. */
413
- get material(): THREE.MeshBasicMaterial;
414
- /** The material of the clipping plane representation. */
415
- set material(material: THREE.MeshBasicMaterial);
416
- /** The size of the geometric representation of the clippings planes. */
417
- get size(): number;
418
- /** The size of the geometric representation of the clippings planes. */
419
- set size(size: number);
420
- constructor(components: Components);
421
- /** {@link Disposable.dispose} */
422
- dispose(): void;
423
- /** {@link Createable.create} */
424
- create(world: World): void;
537
+ get(): Set<string>;
425
538
  /**
426
- * Creates a plane in a certain place and with a certain orientation,
427
- * without the need of the mouse.
539
+ * Removes a mesh, its geometry and its materials from memory. If you are
540
+ * using any of these in other parts of the application, make sure that you
541
+ * remove them from the mesh before disposing it.
428
542
  *
429
- * @param world - the world where this plane should be created.
430
- * @param normal - the orientation of the clipping plane.
431
- * @param point - the position of the clipping plane.
432
- * navigation.
543
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
544
+ * to remove.
545
+ *
546
+ * @param materials - whether to dispose the materials of the mesh.
547
+ *
548
+ * @param recursive - whether to recursively dispose the children of the mesh.
433
549
  */
434
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
550
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
435
551
  /**
436
- * {@link Createable.delete}
552
+ * Disposes a geometry from memory.
437
553
  *
438
- * @param world - the world where the plane to delete is.
439
- * @param plane - the plane to delete. If undefined, the first plane
440
- * found under the cursor will be deleted.
554
+ * @param geometry - the
555
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
556
+ * to remove.
441
557
  */
442
- delete(world: World, plane?: SimplePlane): void;
443
- /** Deletes all the existing clipping planes. */
444
- deleteAll(): void;
445
- private deletePlane;
446
- private pickPlane;
447
- private getAllPlaneMeshes;
448
- private createPlaneFromIntersection;
449
- private getWorldNormal;
450
- private normalizePlaneDirectionY;
451
- private newPlane;
452
- private updateMaterialsAndPlanes;
453
- private _onStartDragging;
454
- private _onEndDragging;
558
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
559
+ private disposeGeometryAndMaterials;
560
+ private disposeChildren;
561
+ private static disposeMaterial;
455
562
  }
456
- import { MiniMap } from "./src";
457
- import { Component, Updateable, World, Event, Disposable } from "../Types";
458
- import { Components } from "../Components";
563
+ import * as FRAGS from "@thatopen/fragments";
564
+ import { Components, Component } from "../../core";
459
565
  /**
460
- * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
566
+ * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
461
567
  */
462
- export declare class MiniMaps extends Component implements Updateable, Disposable {
568
+ export declare class Hider extends Component {
463
569
  /**
464
570
  * A unique identifier for the component.
465
571
  * This UUID is used to register the component within the Components system.
466
572
  */
467
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
468
- /** {@link Updateable.onAfterUpdate} */
469
- readonly onAfterUpdate: Event<unknown>;
470
- /** {@link Updateable.onBeforeUpdate} */
471
- readonly onBeforeUpdate: Event<unknown>;
472
- /** {@link Disposable.onDisposed} */
473
- readonly onDisposed: Event<unknown>;
573
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
474
574
  /** {@link Component.enabled} */
475
575
  enabled: boolean;
476
- /**
477
- * A collection of {@link MiniMap} instances, each associated with a unique world ID.
478
- */
479
- list: Map<string, MiniMap>;
480
576
  constructor(components: Components);
481
577
  /**
482
- * Creates a new {@link MiniMap} instance associated with the given world.
483
- * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
578
+ * Sets the visibility of fragments within the 3D scene.
579
+ * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
580
+ * If 'items' is provided, only the specified fragments will be affected.
484
581
  *
485
- * @param world - The {@link World} for which to create a {@link MiniMap} instance.
486
- * @returns The newly created {@link MiniMap} instance.
487
- * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
488
- */
489
- create(world: World): MiniMap;
490
- /**
491
- * Deletes a {@link MiniMap} instance associated with the given world ID.
492
- * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
582
+ * @param visible - The visibility state to set for the fragments.
583
+ * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
584
+ * If not provided, all fragments will be affected.
493
585
  *
494
- * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
495
586
  * @returns {void}
496
587
  */
497
- delete(id: string): void;
498
- /** {@link Disposable.dispose} */
499
- dispose(): void;
500
- /** {@link Updateable.update} */
501
- update(): void;
502
- }
503
- import * as THREE from "three";
504
- import { Components } from "../Components";
505
- import { SimpleCamera } from "..";
506
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
507
- /**
508
- * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
509
- */
510
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
511
- /**
512
- * A ProjectionManager instance that manages the projection modes of the camera.
513
- */
514
- readonly projection: ProjectionManager;
515
- /**
516
- * A THREE.OrthographicCamera instance that represents the orthographic camera.
517
- * This camera is used when the projection mode is set to orthographic.
518
- */
519
- readonly threeOrtho: THREE.OrthographicCamera;
520
- /**
521
- * A THREE.PerspectiveCamera instance that represents the perspective camera.
522
- * This camera is used when the projection mode is set to perspective.
523
- */
524
- readonly threePersp: THREE.PerspectiveCamera;
525
- protected readonly _userInputButtons: any;
526
- protected readonly _frustumSize = 50;
527
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
528
- protected _mode: NavigationMode | null;
529
- private previousSize;
530
- /**
531
- * Getter for the current navigation mode.
532
- * Throws an error if the mode is not found or the camera is not initialized.
533
- *
534
- * @returns {NavigationMode} The current navigation mode.
535
- *
536
- * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
537
- */
538
- get mode(): NavigationMode;
539
- constructor(components: Components);
540
- /** {@link Disposable.dispose} */
541
- dispose(): void;
542
- /**
543
- * Sets a new {@link NavigationMode} and disables the previous one.
544
- *
545
- * @param mode - The {@link NavigationMode} to set.
546
- */
547
- set(mode: NavModeID): void;
588
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
548
589
  /**
549
- * Make the camera view fit all the specified meshes.
590
+ * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
591
+ * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
550
592
  *
551
- * @param meshes the meshes to fit. If it is not defined, it will
552
- * evaluate {@link Components.meshes}.
553
- * @param offset the distance to the fit object
554
- */
555
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
556
- /**
557
- * Allows or prevents all user input.
593
+ * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
594
+ * If not provided, all fragments will be isolated.
558
595
  *
559
- * @param active - whether to enable or disable user inputs.
596
+ * @returns {void}
560
597
  */
561
- setUserInput(active: boolean): void;
562
- private disableUserInput;
563
- private enableUserInput;
564
- private newOrthoCamera;
565
- private setOrthoPerspCameraAspect;
598
+ isolate(items: FRAGS.FragmentIdMap): void;
599
+ private updateCulledVisibility;
566
600
  }
567
601
  import * as THREE from "three";
568
602
  import * as FRAGS from "@thatopen/fragments";
@@ -749,6 +783,7 @@ export declare class BoundingBoxer extends Component implements Disposable {
749
783
  addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
750
784
  private static getFragmentBounds;
751
785
  }
786
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
752
787
  import * as THREE from "three";
753
788
  export declare function obbFromPoints(vertices: ArrayLike<number>): {
754
789
  center: THREE.Vector3;
@@ -757,133 +792,6 @@ export declare function obbFromPoints(vertices: ArrayLike<number>): {
757
792
  transformation: THREE.Matrix4;
758
793
  };
759
794
  import * as THREE from "three";
760
- export declare class MaterialsUtils {
761
- static isTransparent(material: THREE.Material): boolean;
762
- }
763
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
764
- export declare class UUID {
765
- private static _pattern;
766
- private static _lut;
767
- static create(): string;
768
- static validate(uuid: string): void;
769
- }
770
- import * as THREE from "three";
771
- import { Component, Components, Event, World } from "../core";
772
- export interface VertexPickerConfig {
773
- showOnlyVertex: boolean;
774
- snapDistance: number;
775
- previewElement: HTMLElement;
776
- }
777
- export declare class VertexPicker extends Component {
778
- onVertexFound: Event<THREE.Vector3>;
779
- onVertexLost: Event<THREE.Vector3>;
780
- components: Components;
781
- private _pickedPoint;
782
- private _config;
783
- private _enabled;
784
- private _workingPlane;
785
- set enabled(value: boolean);
786
- get enabled(): boolean;
787
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
788
- set workingPlane(plane: THREE.Plane | null);
789
- get workingPlane(): THREE.Plane | null;
790
- set config(value: Partial<VertexPickerConfig>);
791
- get config(): Partial<VertexPickerConfig>;
792
- dispose(): void;
793
- get(world: World): THREE.Vector3 | null;
794
- private getClosestVertex;
795
- private getVertices;
796
- private getVertex;
797
- }
798
- import * as FRAGS from "@thatopen/fragments";
799
- import { Components, Component } from "../../core";
800
- /**
801
- * A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
802
- */
803
- export declare class Hider extends Component {
804
- /**
805
- * A unique identifier for the component.
806
- * This UUID is used to register the component within the Components system.
807
- */
808
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
809
- /** {@link Component.enabled} */
810
- enabled: boolean;
811
- constructor(components: Components);
812
- /**
813
- * Sets the visibility of fragments within the 3D scene.
814
- * If no 'items' parameter is provided, all fragments will be set to the specified visibility.
815
- * If 'items' is provided, only the specified fragments will be affected.
816
- *
817
- * @param visible - The visibility state to set for the fragments.
818
- * @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
819
- * If not provided, all fragments will be affected.
820
- *
821
- * @returns {void}
822
- */
823
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
824
- /**
825
- * Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
826
- * It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
827
- *
828
- * @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
829
- * If not provided, all fragments will be isolated.
830
- *
831
- * @returns {void}
832
- */
833
- isolate(items: FRAGS.FragmentIdMap): void;
834
- private updateCulledVisibility;
835
- }
836
- import { Component, Disposable, Event, Components } from "../../core";
837
- /**
838
- * The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
839
- */
840
- export declare class Exploder extends Component implements Disposable {
841
- /**
842
- * A unique identifier for the component.
843
- * This UUID is used to register the component within the Components system.
844
- */
845
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
846
- /** {@link Disposable.onDisposed} */
847
- readonly onDisposed: Event<unknown>;
848
- /** {@link Component.enabled} */
849
- enabled: boolean;
850
- /**
851
- * The height of the explosion animation.
852
- * This property determines the vertical distance by which fragments are moved during the explosion.
853
- * Default value is 10.
854
- */
855
- height: number;
856
- /**
857
- * The group name used for the explosion animation.
858
- * This property specifies the group of fragments that will be affected by the explosion.
859
- * Default value is "storeys".
860
- */
861
- groupName: string;
862
- /**
863
- * A set of strings representing the exploded items.
864
- * This set is used to keep track of which items have been exploded.
865
- */
866
- list: Set<string>;
867
- constructor(components: Components);
868
- /** {@link Disposable.dispose} */
869
- dispose(): void;
870
- /**
871
- * Sets the explosion state of the fragments.
872
- *
873
- * @param active - A boolean indicating whether to activate or deactivate the explosion.
874
- *
875
- * @remarks
876
- * This method applies a vertical transformation to the fragments based on the 'active' parameter.
877
- * If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
878
- * If 'active' is false, the fragments are moved back to their original position.
879
- *
880
- * The method also keeps track of the exploded items using the 'list' set.
881
- *
882
- * @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
883
- */
884
- set(active: boolean): void;
885
- }
886
- import * as THREE from "three";
887
795
  import * as FRAGS from "@thatopen/fragments";
888
796
  import { Disposable, Component, Event, Components } from "../../core";
889
797
  /**
@@ -1047,471 +955,563 @@ export declare class Classifier extends Component implements Disposable {
1047
955
  resetColor(items: FRAGS.FragmentIdMap): void;
1048
956
  protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
1049
957
  }
1050
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
1051
958
  import * as THREE from "three";
1052
- import * as FRAGS from "@thatopen/fragments";
1053
- import { Component, Components, Event, Disposable } from "../../core";
1054
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
959
+ import { Component, Components, Event, World } from "../core";
960
+ export interface VertexPickerConfig {
961
+ showOnlyVertex: boolean;
962
+ snapDistance: number;
963
+ previewElement: HTMLElement;
964
+ }
965
+ export declare class VertexPicker extends Component {
966
+ onVertexFound: Event<THREE.Vector3>;
967
+ onVertexLost: Event<THREE.Vector3>;
968
+ components: Components;
969
+ private _pickedPoint;
970
+ private _config;
971
+ private _enabled;
972
+ private _workingPlane;
973
+ set enabled(value: boolean);
974
+ get enabled(): boolean;
975
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
976
+ set workingPlane(plane: THREE.Plane | null);
977
+ get workingPlane(): THREE.Plane | null;
978
+ set config(value: Partial<VertexPickerConfig>);
979
+ get config(): Partial<VertexPickerConfig>;
980
+ dispose(): void;
981
+ get(world: World): THREE.Vector3 | null;
982
+ private getClosestVertex;
983
+ private getVertices;
984
+ private getVertex;
985
+ }
986
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
987
+ import { Components } from "../Components";
988
+ import { SimpleWorld } from "./src";
1055
989
  /**
1056
- * Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
990
+ * A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
1057
991
  */
1058
- export declare class FragmentsManager extends Component implements Disposable {
992
+ export declare class Worlds extends Component implements Updateable, Disposable {
1059
993
  /**
1060
994
  * A unique identifier for the component.
1061
995
  * This UUID is used to register the component within the Components system.
1062
996
  */
1063
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
997
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
998
+ /** {@link Updateable.onAfterUpdate} */
999
+ readonly onAfterUpdate: Event<unknown>;
1000
+ /** {@link Updateable.onBeforeUpdate} */
1001
+ readonly onBeforeUpdate: Event<unknown>;
1064
1002
  /** {@link Disposable.onDisposed} */
1065
1003
  readonly onDisposed: Event<unknown>;
1066
1004
  /**
1067
- * Event triggered when fragments are loaded.
1068
- */
1069
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
1070
- /**
1071
- * Event triggered when fragments are disposed.
1005
+ * An event that is triggered when a new world is created.
1006
+ * The event passes the newly created world as a parameter.
1072
1007
  */
1073
- readonly onFragmentsDisposed: Event<{
1074
- groupID: string;
1075
- fragmentIDs: string[];
1076
- }>;
1008
+ readonly onWorldCreated: Event<World>;
1077
1009
  /**
1078
- * Map containing all loaded fragments.
1079
- * The key is the fragment's unique identifier, and the value is the fragment itself.
1010
+ * An event that is triggered when a world is deleted.
1011
+ * The event passes the UUID of the deleted world as a parameter.
1080
1012
  */
1081
- readonly list: Map<string, Fragment>;
1013
+ readonly onWorldDeleted: Event<string>;
1082
1014
  /**
1083
- * Map containing all loaded fragment groups.
1084
- * The key is the group's unique identifier, and the value is the group itself.
1015
+ * A collection of worlds managed by this component.
1016
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
1085
1017
  */
1086
- readonly groups: Map<string, FragmentsGroup>;
1087
- baseCoordinationModel: string;
1018
+ list: Map<string, World>;
1088
1019
  /** {@link Component.enabled} */
1089
1020
  enabled: boolean;
1090
- private _loader;
1091
- /**
1092
- * Getter for the meshes of all fragments in the FragmentsManager.
1093
- * It iterates over the fragments in the list and pushes their meshes into an array.
1094
- * @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
1095
- */
1096
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
1097
1021
  constructor(components: Components);
1098
- /** {@link Disposable.dispose} */
1099
- dispose(): void;
1100
1022
  /**
1101
- * Dispose of a specific fragment group.
1102
- * This method removes the group from the groups map, deletes all fragments within the group from the list,
1103
- * disposes of the group, and triggers the onFragmentsDisposed event.
1023
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
1104
1024
  *
1105
- * @param group - The fragment group to be disposed.
1025
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
1026
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
1027
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
1028
+ *
1029
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
1106
1030
  */
1107
- disposeGroup(group: FragmentsGroup): void;
1031
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
1108
1032
  /**
1109
- * Loads a binary file that contain fragment geometry.
1110
- * @param data - The binary data to load.
1111
- * @param config - Optional configuration for loading.
1112
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
1113
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
1114
- * @returns The loaded FragmentsGroup.
1033
+ * Deletes a world from the list of worlds.
1034
+ *
1035
+ * @param {World} world - The world to be deleted.
1036
+ *
1037
+ * @throws {Error} - Throws an error if the provided world is not found in the list.
1038
+ *
1039
+ * @returns {void}
1115
1040
  */
1116
- load(data: Uint8Array, config?: Partial<{
1117
- coordinate: boolean;
1118
- name: string;
1119
- properties: FRAGS.IfcProperties;
1120
- relationsMap: RelationsMap;
1121
- }>): FragmentsGroup;
1041
+ delete(world: World): void;
1122
1042
  /**
1123
- * Export the specified fragmentsgroup to binary data.
1124
- * @param group - the fragments group to be exported.
1125
- * @returns the exported data as binary buffer.
1043
+ * Disposes of the Worlds component and all its managed worlds.
1044
+ * This method sets the enabled flag to false, disposes of all worlds, clears the list,
1045
+ * and triggers the onDisposed event.
1046
+ *
1047
+ * @returns {void}
1126
1048
  */
1127
- export(group: FragmentsGroup): Uint8Array;
1049
+ dispose(): void;
1050
+ /** {@link Updateable.update} */
1051
+ update(delta?: number): void | Promise<void>;
1052
+ }
1053
+ import * as THREE from "three";
1054
+ export declare class MaterialsUtils {
1055
+ static isTransparent(material: THREE.Material): boolean;
1056
+ }
1057
+ import { Component, Disposable, World, Event } from "../Types";
1058
+ import { SimpleRaycaster } from "./src";
1059
+ import { Components } from "../Components";
1060
+ /**
1061
+ * A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
1062
+ */
1063
+ export declare class Raycasters extends Component implements Disposable {
1128
1064
  /**
1129
- * Gets a map of model IDs to sets of express IDs for the given fragment ID map.
1130
- * @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
1131
- * @returns A map of model IDs to sets of express IDs.
1065
+ * A unique identifier for the component.
1066
+ * This UUID is used to register the component within the Components system.
1132
1067
  */
1133
- getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
1134
- [modelID: string]: Set<number>;
1135
- };
1068
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
1069
+ /** {@link Component.enabled} */
1070
+ enabled: boolean;
1136
1071
  /**
1137
- * Converts a map of model IDs to sets of express IDs to a fragment ID map.
1138
- * @param modelIdMap - A map of model IDs to their corresponding express IDs.
1139
- * @returns A fragment ID map.
1140
- * @remarks
1141
- * This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
1142
- * and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
1143
- * The fragment ID maps are then merged into a single map and returned.
1144
- * If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
1072
+ * A Map that stores raycasters for each world.
1073
+ * The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
1145
1074
  */
1146
- modelIdToFragmentIdMap(modelIdMap: {
1147
- [modelID: string]: Set<number>;
1148
- }): FRAGS.FragmentIdMap;
1075
+ list: Map<string, SimpleRaycaster>;
1076
+ /** {@link Disposable.onDisposed} */
1077
+ onDisposed: Event<unknown>;
1078
+ constructor(components: Components);
1149
1079
  /**
1150
- * Applies coordinate transformation to the provided models.
1151
- * If no models are provided, all groups are used.
1152
- * The first model in the list becomes the base model for coordinate transformation.
1153
- * All other models are then transformed to match the base model's coordinate system.
1080
+ * Retrieves a SimpleRaycaster instance for the given world.
1081
+ * If a SimpleRaycaster instance already exists for the world, it will be returned.
1082
+ * Otherwise, a new SimpleRaycaster instance will be created and added to the list.
1154
1083
  *
1155
- * @param models - The models to apply coordinate transformation to.
1156
- * If not provided, all groups are used.
1084
+ * @param world - The world for which to retrieve or create a SimpleRaycaster instance.
1085
+ * @returns The SimpleRaycaster instance for the given world.
1086
+ */
1087
+ get(world: World): SimpleRaycaster;
1088
+ /**
1089
+ * Deletes the SimpleRaycaster instance associated with the given world.
1090
+ * If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
1157
1091
  *
1092
+ * @param world - The world for which to delete the SimpleRaycaster instance.
1158
1093
  * @returns {void}
1159
1094
  */
1160
- coordinate(models?: FragmentsGroup[]): void;
1095
+ delete(world: World): void;
1096
+ /** {@link Disposable.dispose} */
1097
+ dispose(): void;
1161
1098
  }
1162
- import * as WEBIFC from "web-ifc";
1163
- import * as FRAGS from "@thatopen/fragments";
1164
- import { IfcFragmentSettings } from "./src";
1165
- import { Component, Components, Event, Disposable } from "../../core";
1099
+ import * as THREE from "three";
1100
+ import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
1101
+ import { SimplePlane } from "./src";
1102
+ import { Components } from "../Components";
1166
1103
  /**
1167
- * The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
1104
+ * A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper).
1105
+ *
1106
+ * @param components - the instance of {@link Components} used.
1107
+ * E.g. {@link SimplePlane}.
1168
1108
  */
1169
- export declare class IfcLoader extends Component implements Disposable {
1109
+ export declare class Clipper extends Component implements Createable, Disposable, Hideable {
1170
1110
  /**
1171
1111
  * A unique identifier for the component.
1172
1112
  * This UUID is used to register the component within the Components system.
1173
1113
  */
1174
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
1114
+ static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
1115
+ /** Event that fires when the user starts dragging a clipping plane. */
1116
+ readonly onBeforeDrag: Event<void>;
1117
+ /** Event that fires when the user stops dragging a clipping plane. */
1118
+ readonly onAfterDrag: Event<void>;
1119
+ /**
1120
+ * Event that fires when the user starts creating a clipping plane.
1121
+ */
1122
+ readonly onBeforeCreate: Event<unknown>;
1123
+ /**
1124
+ * Event that fires when the user cancels the creation of a clipping plane.
1125
+ */
1126
+ readonly onBeforeCancel: Event<unknown>;
1127
+ /**
1128
+ * Event that fires after the user cancels the creation of a clipping plane.
1129
+ */
1130
+ readonly onAfterCancel: Event<unknown>;
1131
+ /**
1132
+ * Event that fires when the user starts deleting a clipping plane.
1133
+ */
1134
+ readonly onBeforeDelete: Event<unknown>;
1135
+ /**
1136
+ * Event that fires after a clipping plane has been created.
1137
+ * @param plane - The newly created clipping plane.
1138
+ */
1139
+ readonly onAfterCreate: Event<SimplePlane>;
1140
+ /**
1141
+ * Event that fires after a clipping plane has been deleted.
1142
+ * @param plane - The deleted clipping plane.
1143
+ */
1144
+ readonly onAfterDelete: Event<SimplePlane>;
1175
1145
  /** {@link Disposable.onDisposed} */
1176
1146
  readonly onDisposed: Event<string>;
1177
1147
  /**
1178
- * An event triggered when the IFC file starts loading.
1148
+ * Whether to force the clipping plane to be orthogonal in the Y direction
1149
+ * (up). This is desirable when clipping a building horizontally and a
1150
+ * clipping plane is created in its roof, which might have a slight
1151
+ * slope for draining purposes.
1179
1152
  */
1180
- readonly onIfcStartedLoading: Event<void>;
1153
+ orthogonalY: boolean;
1181
1154
  /**
1182
- * An event triggered when the setup process is completed.
1155
+ * The tolerance that determines whether an almost-horizontal clipping plane
1156
+ * will be forced to be orthogonal to the Y direction. {@link orthogonalY}
1157
+ * has to be 'true' for this to apply.
1183
1158
  */
1184
- readonly onSetup: Event<void>;
1159
+ toleranceOrthogonalY: number;
1185
1160
  /**
1186
- * The settings for the IfcLoader.
1187
- * It includes options for excluding categories, setting WASM paths, and more.
1161
+ * The type of clipping plane to be created.
1162
+ * Default is {@link SimplePlane}.
1188
1163
  */
1189
- settings: IfcFragmentSettings;
1164
+ Type: new (...args: any) => SimplePlane;
1190
1165
  /**
1191
- * The instance of the Web-IFC library used for handling IFC data.
1166
+ * A list of all the clipping planes created by this component.
1192
1167
  */
1193
- webIfc: WEBIFC.IfcAPI;
1194
- /** {@link Component.enabled} */
1195
- enabled: boolean;
1168
+ list: SimplePlane[];
1169
+ /** The material used in all the clipping planes. */
1196
1170
  private _material;
1197
- private _spatialTree;
1198
- private _metaData;
1199
- private _fragmentInstances;
1200
- private _civil;
1201
- private _visitedFragments;
1202
- private _materialT;
1171
+ private _size;
1172
+ private _enabled;
1173
+ private _visible;
1174
+ /** {@link Component.enabled} */
1175
+ get enabled(): boolean;
1176
+ /** {@link Component.enabled} */
1177
+ set enabled(state: boolean);
1178
+ /** {@link Hideable.visible } */
1179
+ get visible(): boolean;
1180
+ /** {@link Hideable.visible } */
1181
+ set visible(state: boolean);
1182
+ /** The material of the clipping plane representation. */
1183
+ get material(): THREE.MeshBasicMaterial;
1184
+ /** The material of the clipping plane representation. */
1185
+ set material(material: THREE.MeshBasicMaterial);
1186
+ /** The size of the geometric representation of the clippings planes. */
1187
+ get size(): number;
1188
+ /** The size of the geometric representation of the clippings planes. */
1189
+ set size(size: number);
1203
1190
  constructor(components: Components);
1204
1191
  /** {@link Disposable.dispose} */
1205
1192
  dispose(): void;
1193
+ /** {@link Createable.create} */
1194
+ create(world: World): void;
1206
1195
  /**
1207
- * Sets up the IfcLoader component with the provided configuration.
1208
- *
1209
- * @param config - Optional configuration settings for the IfcLoader.
1210
- * If not provided, the existing settings will be used.
1196
+ * Creates a plane in a certain place and with a certain orientation,
1197
+ * without the need of the mouse.
1211
1198
  *
1212
- * @returns A Promise that resolves when the setup process is completed.
1199
+ * @param world - the world where this plane should be created.
1200
+ * @param normal - the orientation of the clipping plane.
1201
+ * @param point - the position of the clipping plane.
1202
+ * navigation.
1203
+ */
1204
+ createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
1205
+ /**
1206
+ * {@link Createable.delete}
1213
1207
  *
1214
- * @remarks
1215
- * If the 'autoSetWasm' option is enabled in the configuration,
1216
- * the method will automatically set the WASM paths for the Web-IFC library.
1217
- *
1218
- * @example
1219
- * '''typescript
1220
- * const ifcLoader = new IfcLoader(components);
1221
- * await ifcLoader.setup({ autoSetWasm: true });
1222
- * '''
1208
+ * @param world - the world where the plane to delete is.
1209
+ * @param plane - the plane to delete. If undefined, the first plane
1210
+ * found under the cursor will be deleted.
1223
1211
  */
1224
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
1212
+ delete(world: World, plane?: SimplePlane): void;
1213
+ /** Deletes all the existing clipping planes. */
1214
+ deleteAll(): void;
1215
+ private deletePlane;
1216
+ private pickPlane;
1217
+ private getAllPlaneMeshes;
1218
+ private createPlaneFromIntersection;
1219
+ private getWorldNormal;
1220
+ private normalizePlaneDirectionY;
1221
+ private newPlane;
1222
+ private updateMaterialsAndPlanes;
1223
+ private _onStartDragging;
1224
+ private _onEndDragging;
1225
+ }
1226
+ export declare class UUID {
1227
+ private static _pattern;
1228
+ private static _lut;
1229
+ static create(): string;
1230
+ static validate(uuid: string): void;
1231
+ }
1232
+ import * as THREE from "three";
1233
+ import { Components } from "../Components";
1234
+ import { SimpleCamera } from "..";
1235
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
1236
+ /**
1237
+ * A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
1238
+ */
1239
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
1225
1240
  /**
1226
- * Loads an IFC file and processes it for 3D visualization.
1227
- *
1228
- * @param data - The Uint8Array containing the IFC file data.
1229
- * @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
1230
- *
1231
- * @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
1232
- *
1233
- * @example
1234
- * '''typescript
1235
- * const ifcLoader = components.get(IfcLoader);
1236
- * const group = await ifcLoader.load(ifcData);
1237
- * '''
1241
+ * A ProjectionManager instance that manages the projection modes of the camera.
1238
1242
  */
1239
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
1243
+ readonly projection: ProjectionManager;
1240
1244
  /**
1241
- * Reads an IFC file and initializes the Web-IFC library.
1242
- *
1243
- * @param data - The Uint8Array containing the IFC file data.
1245
+ * A THREE.OrthographicCamera instance that represents the orthographic camera.
1246
+ * This camera is used when the projection mode is set to orthographic.
1247
+ */
1248
+ readonly threeOrtho: THREE.OrthographicCamera;
1249
+ /**
1250
+ * A THREE.PerspectiveCamera instance that represents the perspective camera.
1251
+ * This camera is used when the projection mode is set to perspective.
1252
+ */
1253
+ readonly threePersp: THREE.PerspectiveCamera;
1254
+ protected readonly _userInputButtons: any;
1255
+ protected readonly _frustumSize = 50;
1256
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
1257
+ protected _mode: NavigationMode | null;
1258
+ private previousSize;
1259
+ /**
1260
+ * Getter for the current navigation mode.
1261
+ * Throws an error if the mode is not found or the camera is not initialized.
1244
1262
  *
1245
- * @returns A Promise that resolves when the IFC file is opened and initialized.
1263
+ * @returns {NavigationMode} The current navigation mode.
1246
1264
  *
1247
- * @remarks
1248
- * This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
1249
- * It also opens the IFC model using the provided data and settings.
1265
+ * @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
1266
+ */
1267
+ get mode(): NavigationMode;
1268
+ constructor(components: Components);
1269
+ /** {@link Disposable.dispose} */
1270
+ dispose(): void;
1271
+ /**
1272
+ * Sets a new {@link NavigationMode} and disables the previous one.
1250
1273
  *
1251
- * @example
1252
- * '''typescript
1253
- * const ifcLoader = components.get(IfcLoader);
1254
- * await ifcLoader.readIfcFile(ifcData);
1255
- * '''
1274
+ * @param mode - The {@link NavigationMode} to set.
1256
1275
  */
1257
- readIfcFile(data: Uint8Array): Promise<number>;
1276
+ set(mode: NavModeID): void;
1258
1277
  /**
1259
- * Cleans up the IfcLoader component by resetting the Web-IFC library,
1260
- * clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
1278
+ * Make the camera view fit all the specified meshes.
1261
1279
  *
1262
- * @remarks
1263
- * This method is called automatically after using the .load() method, so usually you don't need to use it manually.
1280
+ * @param meshes the meshes to fit. If it is not defined, it will
1281
+ * evaluate {@link Components.meshes}.
1282
+ * @param offset the distance to the fit object
1283
+ */
1284
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
1285
+ /**
1286
+ * Allows or prevents all user input.
1264
1287
  *
1265
- * @example
1266
- * '''typescript
1267
- * const ifcLoader = components.get(IfcLoader);
1268
- * ifcLoader.cleanUp();
1269
- * '''
1288
+ * @param active - whether to enable or disable user inputs.
1270
1289
  */
1271
- cleanUp(): void;
1272
- private getAllGeometries;
1273
- private getMesh;
1274
- private getGeometry;
1275
- private autoSetWasm;
1290
+ setUserInput(active: boolean): void;
1291
+ private disableUserInput;
1292
+ private enableUserInput;
1293
+ private newOrthoCamera;
1294
+ private setOrthoPerspCameraAspect;
1276
1295
  }
1277
- import * as WEBIFC from "web-ifc";
1278
- import { Components, Disposable, Event, Component } from "../../core";
1279
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
1296
+ import { Components } from "../Components";
1297
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
1298
+ import { Component, Event, Disposable, World } from "../Types";
1280
1299
  /**
1281
- * A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
1300
+ * A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
1282
1301
  */
1283
- export declare class IfcGeometryTiler extends Component implements Disposable {
1302
+ export declare class Cullers extends Component implements Disposable {
1284
1303
  /**
1285
1304
  * A unique identifier for the component.
1286
1305
  * This UUID is used to register the component within the Components system.
1287
1306
  */
1288
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1289
- /**
1290
- * Event triggered when geometry is streamed.
1291
- * Contains the streamed geometry data and its buffer.
1292
- */
1293
- readonly onGeometryStreamed: Event<{
1294
- buffer: Uint8Array;
1295
- data: StreamedGeometries;
1296
- }>;
1297
- /**
1298
- * Event triggered when assets are streamed.
1299
- * Contains the streamed assets.
1300
- */
1301
- readonly onAssetStreamed: Event<StreamedAsset[]>;
1302
- /**
1303
- * Event triggered to indicate the progress of the streaming process.
1304
- * Contains the progress percentage.
1305
- */
1306
- readonly onProgress: Event<number>;
1307
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
1307
1308
  /**
1308
- * Event triggered when the IFC file is loaded.
1309
- * Contains the loaded IFC file data.
1309
+ * An event that is triggered when the Cullers component is disposed.
1310
1310
  */
1311
- readonly onIfcLoaded: Event<Uint8Array>;
1312
- /** {@link Disposable.onDisposed} */
1313
1311
  readonly onDisposed: Event<unknown>;
1312
+ private _enabled;
1314
1313
  /**
1315
- * Settings for the IfcGeometryTiler.
1314
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
1316
1315
  */
1317
- settings: IfcStreamingSettings;
1316
+ list: Map<string, MeshCullerRenderer>;
1318
1317
  /** {@link Component.enabled} */
1319
- enabled: boolean;
1320
- /**
1321
- * The WebIFC API instance used for IFC file processing.
1322
- */
1323
- webIfc: WEBIFC.IfcAPI;
1324
- private _spatialTree;
1325
- private _metaData;
1326
- private _visitedGeometries;
1327
- private _streamSerializer;
1328
- private _geometries;
1329
- private _geometryCount;
1330
- private _civil;
1331
- private _groupSerializer;
1332
- private _assets;
1333
- private _meshesWithHoles;
1318
+ get enabled(): boolean;
1319
+ /** {@link Component.enabled} */
1320
+ set enabled(value: boolean);
1334
1321
  constructor(components: Components);
1335
- /** {@link Disposable.dispose} */
1336
- dispose(): void;
1337
1322
  /**
1338
- * This method streams the IFC file from a given buffer.
1339
- *
1340
- * @param data - The Uint8Array containing the IFC file data.
1341
- * @returns A Promise that resolves when the streaming process is complete.
1323
+ * Creates a new MeshCullerRenderer for the given world.
1324
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
1342
1325
  *
1343
- * @remarks
1344
- * This method cleans up any resources after the streaming process is complete.
1326
+ * @param world - The world for which to create the MeshCullerRenderer.
1327
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
1345
1328
  *
1346
- * @example
1347
- * '''typescript
1348
- * const ifcData = await fetch('path/to/ifc/file.ifc');
1349
- * const rawBuffer = await response.arrayBuffer();
1350
- * const ifcBuffer = new Uint8Array(rawBuffer);
1351
- * await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
1352
- * '''
1329
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
1353
1330
  */
1354
- streamFromBuffer(data: Uint8Array): Promise<void>;
1331
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
1355
1332
  /**
1356
- * This method streams the IFC file from a given callback.
1357
- *
1358
- * @param loadCallback - The callback function that will be used to load the IFC file.
1359
- * @returns A Promise that resolves when the streaming process is complete.
1333
+ * Deletes the MeshCullerRenderer associated with the given world.
1334
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
1360
1335
  *
1361
- * @remarks
1362
- * This method cleans up any resources after the streaming process is complete.
1336
+ * @param world - The world for which to delete the MeshCullerRenderer.
1363
1337
  *
1338
+ * @returns {void}
1364
1339
  */
1365
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1366
- private readIfcFile;
1367
- private streamIfcFile;
1368
- private streamAllGeometries;
1369
- private cleanUp;
1370
- private getMesh;
1371
- private getGeometry;
1372
- private streamAssets;
1373
- private streamGeometries;
1340
+ delete(world: World): void;
1341
+ /** {@link Disposable.dispose} */
1342
+ dispose(): void;
1374
1343
  }
1375
- import * as WEBIFC from "web-ifc";
1376
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
1377
- import { PropertiesStreamingSettings } from "./src";
1344
+ import { MiniMap } from "./src";
1345
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
1346
+ import { Components } from "../Components";
1378
1347
  /**
1379
- * A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
1348
+ * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
1380
1349
  */
1381
- export declare class IfcPropertiesTiler extends Component implements Disposable {
1350
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
1382
1351
  /**
1383
1352
  * A unique identifier for the component.
1384
1353
  * This UUID is used to register the component within the Components system.
1385
1354
  */
1386
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1355
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
1356
+ /** {@link Updateable.onAfterUpdate} */
1357
+ readonly onAfterUpdate: Event<unknown>;
1358
+ /** {@link Updateable.onBeforeUpdate} */
1359
+ readonly onBeforeUpdate: Event<unknown>;
1360
+ /** {@link Disposable.onDisposed} */
1361
+ readonly onDisposed: Event<unknown>;
1362
+ /** {@link Component.enabled} */
1363
+ enabled: boolean;
1387
1364
  /**
1388
- * An event that is triggered when properties are streamed from the IFC file.
1389
- * The event provides the type of the IFC entity and the corresponding data.
1365
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
1390
1366
  */
1391
- readonly onPropertiesStreamed: AsyncEvent<{
1392
- type: number;
1393
- data: {
1394
- [id: number]: any;
1395
- };
1396
- }>;
1367
+ list: Map<string, MiniMap>;
1368
+ constructor(components: Components);
1397
1369
  /**
1398
- * An event that is triggered to indicate the progress of the streaming process.
1399
- * The event provides a number between 0 and 1 representing the progress percentage.
1370
+ * Creates a new {@link MiniMap} instance associated with the given world.
1371
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
1372
+ *
1373
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
1374
+ * @returns The newly created {@link MiniMap} instance.
1375
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
1400
1376
  */
1401
- readonly onProgress: AsyncEvent<number>;
1377
+ create(world: World): MiniMap;
1402
1378
  /**
1403
- * An event that is triggered when indices are streamed from the IFC file.
1404
- * The event provides a map of indices, where the key is the entity type and the value is another map of indices.
1379
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
1380
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
1381
+ *
1382
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
1383
+ * @returns {void}
1405
1384
  */
1406
- readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
1407
- /** {@link Disposable.onDisposed} */
1408
- readonly onDisposed: Event<string>;
1409
- /** {@link Component.enabled} */
1410
- enabled: boolean;
1385
+ delete(id: string): void;
1386
+ /** {@link Disposable.dispose} */
1387
+ dispose(): void;
1388
+ /** {@link Updateable.update} */
1389
+ update(): void;
1390
+ }
1391
+ import { Component, Disposable, World, Event } from "../Types";
1392
+ import { GridConfig, SimpleGrid } from "./src";
1393
+ import { Components } from "../Components";
1394
+ /**
1395
+ * A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
1396
+ */
1397
+ export declare class Grids extends Component implements Disposable {
1411
1398
  /**
1412
- * An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
1399
+ * A unique identifier for the component.
1400
+ * This UUID is used to register the component within the Components system.
1413
1401
  */
1414
- settings: PropertiesStreamingSettings;
1402
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
1415
1403
  /**
1416
- * An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
1404
+ * A map of world UUIDs to their corresponding grid instances.
1417
1405
  */
1418
- webIfc: WEBIFC.IfcAPI;
1419
- /** {@link Disposable.dispose} */
1420
- dispose(): Promise<void>;
1406
+ list: Map<string, SimpleGrid>;
1421
1407
  /**
1422
- * This method converts properties from an IFC file to tiles given its data as a Uint8Array.
1408
+ * The default configuration for grid creation.
1409
+ */
1410
+ config: Required<GridConfig>;
1411
+ /** {@link Disposable.onDisposed} */
1412
+ readonly onDisposed: Event<unknown>;
1413
+ /** {@link Component.enabled} */
1414
+ enabled: boolean;
1415
+ constructor(components: Components);
1416
+ /**
1417
+ * Creates a new grid for the given world.
1418
+ * Throws an error if a grid already exists for the world.
1423
1419
  *
1424
- * @param data - The Uint8Array containing the IFC file data.
1425
- * @returns A Promise that resolves when the streaming process is complete.
1420
+ * @param world - The world to create the grid for.
1421
+ * @returns The newly created grid.
1422
+ *
1423
+ * @throws Will throw an error if a grid already exists for the given world.
1426
1424
  */
1427
- streamFromBuffer(data: Uint8Array): Promise<void>;
1425
+ create(world: World): SimpleGrid;
1428
1426
  /**
1429
- * This method converts properties from an IFC file to tiles using a given callback function to read the file.
1427
+ * Deletes the grid associated with the given world.
1428
+ * If a grid does not exist for the given world, this method does nothing.
1430
1429
  *
1431
- * @param loadCallback - A callback function that loads the IFC file data.
1432
- * @returns A Promise that resolves when the streaming process is complete.
1430
+ * @param world - The world for which to delete the grid.
1431
+ *
1432
+ * @remarks
1433
+ * This method will dispose of the grid and remove it from the internal list.
1434
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
1433
1435
  */
1434
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1435
- private readIfcFile;
1436
- private streamIfcFile;
1437
- private streamAllProperties;
1438
- private cleanUp;
1436
+ delete(world: World): void;
1437
+ /** {@link Disposable.dispose} */
1438
+ dispose(): void;
1439
1439
  }
1440
- import * as THREE from "three";
1441
- import { Component, Components } from "../../core";
1440
+ import { Component, Disposable, Event } from "../Types";
1442
1441
  /**
1443
- * Represents an edge measurement result.
1442
+ * The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
1444
1443
  */
1445
- export interface MeasureEdge {
1444
+ export declare class Components implements Disposable {
1446
1445
  /**
1447
- * The distance between the two points of the edge.
1446
+ * The version of the @thatopen/components library.
1448
1447
  */
1449
- distance: number;
1448
+ static readonly release = "2.0.14";
1449
+ /** {@link Disposable.onDisposed} */
1450
+ readonly onDisposed: Event<void>;
1450
1451
  /**
1451
- * The two points that define the edge.
1452
+ * The list of components created in this app.
1453
+ * The keys are UUIDs and the values are instances of the components.
1452
1454
  */
1453
- points: THREE.Vector3[];
1454
- }
1455
- /**
1456
- * Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
1457
- */
1458
- export declare class MeasurementUtils extends Component {
1455
+ readonly list: Map<string, Component>;
1459
1456
  /**
1460
- * A unique identifier for the component.
1461
- * This UUID is used to register the component within the Components system.
1457
+ * If disabled, the animation loop will be stopped.
1458
+ * Default value is false.
1462
1459
  */
1463
- static uuid: string;
1464
- /** {@link Component.enabled} */
1465
1460
  enabled: boolean;
1466
- constructor(components: Components);
1461
+ private _clock;
1467
1462
  /**
1468
- * Utility method to calculate the distance from a point to a line segment.
1463
+ * Adds a component to the list of components.
1464
+ * Throws an error if a component with the same UUID already exists.
1469
1465
  *
1470
- * @param point - The point from which to calculate the distance.
1471
- * @param lineStart - The start point of the line segment.
1472
- * @param lineEnd - The end point of the line segment.
1473
- * @param clamp - If true, the distance will be clamped to the line segment's length.
1474
- * @returns The distance from the point to the line segment.
1466
+ * @param uuid - The unique identifier of the component.
1467
+ * @param instance - The instance of the component to be added.
1468
+ *
1469
+ * @throws Will throw an error if a component with the same UUID already exists.
1470
+ *
1471
+ * @internal
1475
1472
  */
1476
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
1473
+ add(uuid: string, instance: Component): void;
1477
1474
  /**
1478
- * Method to get the face of a mesh that contains a given triangle index.
1479
- * It also returns the edges of the found face and their indices.
1475
+ * Retrieves a component instance by its constructor function.
1476
+ * If the component does not exist in the list, it will be created and added.
1480
1477
  *
1481
- * @param mesh - The mesh to get the face from. It must be indexed.
1482
- * @param triangleIndex - The index of the triangle within the mesh.
1483
- * @param instance - The instance of the mesh (optional).
1484
- * @returns An object containing the edges of the found face and their indices, or null if no face was found.
1478
+ * @template U - The type of the component to retrieve.
1479
+ * @param Component - The constructor function of the component to retrieve.
1480
+ *
1481
+ * @returns The instance of the requested component.
1482
+ *
1483
+ * @throws Will throw an error if a component with the same UUID already exists.
1484
+ *
1485
+ * @internal
1485
1486
  */
1486
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
1487
- edges: MeasureEdge[];
1488
- indices: Set<number>;
1489
- } | null;
1487
+ get<U extends Component>(Component: new (components: Components) => U): U;
1488
+ constructor();
1490
1489
  /**
1491
- * Method to get the vertices and normal of a mesh face at a given index.
1492
- * It also applies instance transformation if provided.
1490
+ * Initializes the Components instance.
1491
+ * This method starts the animation loop, sets the enabled flag to true,
1492
+ * and calls the update method.
1493
1493
  *
1494
- * @param mesh - The mesh to get the face from. It must be indexed.
1495
- * @param faceIndex - The index of the face within the mesh.
1496
- * @param instance - The instance of the mesh (optional).
1497
- * @returns An object containing the vertices and normal of the face.
1498
- * @throws Will throw an error if the geometry is not indexed.
1494
+ * @returns {void}
1499
1495
  */
1500
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
1501
- p1: THREE.Vector3;
1502
- p2: THREE.Vector3;
1503
- p3: THREE.Vector3;
1504
- faceNormal: THREE.Vector3;
1505
- };
1496
+ init(): void;
1506
1497
  /**
1507
- * Method to round the vector's components to a specified number of decimal places.
1508
- * This is used to ensure numerical precision in edge detection.
1498
+ * Disposes the memory of all the components and tools of this instance of
1499
+ * the library. A memory leak will be created if:
1500
+ *
1501
+ * - An instance of the library ends up out of scope and this function isn't
1502
+ * called. This is especially relevant in Single Page Applications (React,
1503
+ * Angular, Vue, etc).
1504
+ *
1505
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
1506
+ * referenced by a reference type (object or array).
1507
+ *
1508
+ * You can learn more about how Three.js handles memory leaks
1509
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1509
1510
  *
1510
- * @param vector - The vector to round.
1511
- * @returns The vector with rounded components.
1512
1511
  */
1513
- round(vector: THREE.Vector3): void;
1514
- private getFaceData;
1512
+ dispose(): void;
1513
+ private update;
1514
+ private static setupBVH;
1515
1515
  }
1516
1516
  import * as WEBIFC from "web-ifc";
1517
1517
  import * as FRAG from "@thatopen/fragments";
@@ -1679,6 +1679,10 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
1679
1679
  /** {@link Disposable.dispose} */
1680
1680
  dispose(): void;
1681
1681
  }
1682
+ /**
1683
+ * A Set of unique numbers representing different types of IFC geometries.
1684
+ */
1685
+ export declare const GeometryTypes: Set<number>;
1682
1686
  import * as WEBIFC from "web-ifc";
1683
1687
  import { FragmentsGroup } from "@thatopen/fragments";
1684
1688
  import { Component, Disposable, Event, Components } from "../../core";
@@ -1936,6 +1940,47 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
1936
1940
  private newSingleProperty;
1937
1941
  }
1938
1942
  import * as WEBIFC from "web-ifc";
1943
+ /** Configuration of the IFC-fragment conversion. */
1944
+ export declare class IfcFragmentSettings {
1945
+ /** Whether to extract the IFC properties into a JSON. */
1946
+ includeProperties: boolean;
1947
+ /**
1948
+ * Generate the geometry for categories that are not included by default,
1949
+ * like IFCSPACE.
1950
+ */
1951
+ optionalCategories: number[];
1952
+ /** Whether to use the coordination data coming from the IFC files. */
1953
+ coordinate: boolean;
1954
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1955
+ wasm: {
1956
+ path: string;
1957
+ absolute: boolean;
1958
+ logLevel?: WEBIFC.LogLevel;
1959
+ };
1960
+ /** List of categories that won't be converted to fragments. */
1961
+ excludedCategories: Set<number>;
1962
+ /** Whether to save the absolute location of all IFC items. */
1963
+ saveLocations: boolean;
1964
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1965
+ webIfc: WEBIFC.LoaderSettings;
1966
+ /**
1967
+ * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
1968
+ * If set to true, the path will be set to the default path of the WASM file.
1969
+ * If set to false, the path must be provided manually in the 'wasm.path' property.
1970
+ * Default value is true.
1971
+ */
1972
+ autoSetWasm: boolean;
1973
+ /**
1974
+ * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
1975
+ * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
1976
+ * If set to null, the default file location handler will be used.
1977
+ *
1978
+ * @param url - The URL of the file to locate.
1979
+ * @returns The absolute path of the file.
1980
+ */
1981
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1982
+ }
1983
+ import * as WEBIFC from "web-ifc";
1939
1984
  import { IfcItemsCategories } from "../../../ifc";
1940
1985
  export declare class SpatialStructure {
1941
1986
  itemsByFloor: IfcItemsCategories;
@@ -2032,127 +2077,457 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
2032
2077
  resize(size?: THREE.Vector2): void;
2033
2078
  private updatePlanes;
2034
2079
  }
2035
- import * as WEBIFC from "web-ifc";
2036
- /** Configuration of the IFC-fragment conversion. */
2037
- export declare class IfcFragmentSettings {
2038
- /** Whether to extract the IFC properties into a JSON. */
2039
- includeProperties: boolean;
2040
- /**
2041
- * Generate the geometry for categories that are not included by default,
2042
- * like IFCSPACE.
2043
- */
2044
- optionalCategories: number[];
2045
- /** Whether to use the coordination data coming from the IFC files. */
2046
- coordinate: boolean;
2047
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2048
- wasm: {
2049
- path: string;
2050
- absolute: boolean;
2051
- logLevel?: WEBIFC.LogLevel;
2052
- };
2053
- /** List of categories that won't be converted to fragments. */
2054
- excludedCategories: Set<number>;
2055
- /** Whether to save the absolute location of all IFC items. */
2056
- saveLocations: boolean;
2057
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
2058
- webIfc: WEBIFC.LoaderSettings;
2080
+ import * as FRAGS from "@thatopen/fragments";
2081
+ export declare class IfcPropertiesUtils {
2082
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2083
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2084
+ [attribute: string]: any;
2085
+ } | null>;
2086
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2087
+ [relatingID: number]: number[];
2088
+ }>;
2089
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2090
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2091
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2092
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2093
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2094
+ key: string | null;
2095
+ name: string | null;
2096
+ }>;
2097
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2098
+ key: string | null;
2099
+ value: number | null;
2100
+ }>;
2101
+ static isRel(expressID: number): boolean;
2102
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2103
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2104
+ }
2105
+ /**
2106
+ * A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
2107
+ */
2108
+ export declare const IfcCategoryMap: {
2109
+ [key: number]: string;
2110
+ };
2111
+ import * as THREE from "three";
2112
+ import { Components } from "../../Components";
2113
+ import { AsyncEvent, Event, World } from "../../Types";
2114
+ /**
2115
+ * Settings to configure the CullerRenderer.
2116
+ */
2117
+ export interface CullerRendererSettings {
2059
2118
  /**
2060
- * Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2061
- * If set to true, the path will be set to the default path of the WASM file.
2062
- * If set to false, the path must be provided manually in the 'wasm.path' property.
2119
+ * Interval in milliseconds at which the visibility check should be performed.
2120
+ * Default value is 1000.
2121
+ */
2122
+ updateInterval?: number;
2123
+ /**
2124
+ * Width of the render target used for visibility checks.
2125
+ * Default value is 512.
2126
+ */
2127
+ width?: number;
2128
+ /**
2129
+ * Height of the render target used for visibility checks.
2130
+ * Default value is 512.
2131
+ */
2132
+ height?: number;
2133
+ /**
2134
+ * Whether the visibility check should be performed automatically.
2063
2135
  * Default value is true.
2064
2136
  */
2065
- autoSetWasm: boolean;
2137
+ autoUpdate?: boolean;
2138
+ }
2139
+ /**
2140
+ * A base renderer to determine visibility on screen.
2141
+ */
2142
+ export declare class CullerRenderer {
2143
+ /** {@link Disposable.onDisposed} */
2144
+ readonly onDisposed: Event<string>;
2145
+ /**
2146
+ * Fires after making the visibility check to the meshes. It lists the
2147
+ * meshes that are currently visible, and the ones that were visible
2148
+ * just before but not anymore.
2149
+ */
2150
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2151
+ /**
2152
+ * Whether this renderer is active or not. If not, it won't render anything.
2153
+ */
2154
+ enabled: boolean;
2155
+ /**
2156
+ * Needs to check whether there are objects that need to be hidden or shown.
2157
+ * You can bind this to the camera movement, to a certain interval, etc.
2158
+ */
2159
+ needsUpdate: boolean;
2160
+ /**
2161
+ * Render the internal scene used to determine the object visibility. Used
2162
+ * for debugging purposes.
2163
+ */
2164
+ renderDebugFrame: boolean;
2165
+ /** The components instance to which this renderer belongs. */
2166
+ components: Components;
2167
+ /** The world instance to which this renderer belongs. */
2168
+ readonly world: World;
2169
+ /** The THREE.js renderer used to make the visibility test. */
2170
+ readonly renderer: THREE.WebGLRenderer;
2171
+ protected autoUpdate: boolean;
2172
+ protected updateInterval: number;
2173
+ protected readonly worker: Worker;
2174
+ protected readonly scene: THREE.Scene;
2175
+ private _width;
2176
+ private _height;
2177
+ private _availableColor;
2178
+ private readonly renderTarget;
2179
+ private readonly bufferSize;
2180
+ private readonly _buffer;
2181
+ protected _isWorkerBusy: boolean;
2182
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2183
+ /** {@link Disposable.dispose} */
2184
+ dispose(): void;
2185
+ /**
2186
+ * The function that the culler uses to reprocess the scene. Generally it's
2187
+ * better to call needsUpdate, but you can also call this to force it.
2188
+ * @param force if true, it will refresh the scene even if needsUpdate is
2189
+ * not true.
2190
+ */
2191
+ updateVisibility: (force?: boolean) => Promise<void>;
2192
+ protected getAvailableColor(): {
2193
+ r: number;
2194
+ g: number;
2195
+ b: number;
2196
+ code: string;
2197
+ };
2198
+ protected increaseColor(): void;
2199
+ protected decreaseColor(): void;
2200
+ private applySettings;
2201
+ }
2202
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
2203
+ /**
2204
+ * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
2205
+ */
2206
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
2207
+ /**
2208
+ * Amount of properties to be streamed.
2209
+ * Defaults to 100 properties.
2210
+ */
2211
+ propertiesSize: number;
2212
+ }
2213
+ /**
2214
+ * A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
2215
+ *
2216
+ * @remarks
2217
+ * This map is used to provide a mapping between IFC entity type numbers and their names.
2218
+ * It is useful for identifying and processing different types of IFC elements in a project.
2219
+ *
2220
+ */
2221
+ export declare const IfcElements: {
2222
+ [key: number]: string;
2223
+ };
2224
+ import * as THREE from "three";
2225
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2226
+ import { Components } from "../../Components";
2227
+ import { Event, World, Disposable } from "../../Types";
2228
+ /**
2229
+ * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2230
+ */
2231
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2232
+ /**
2233
+ * Event triggered when the visibility of meshes is updated.
2234
+ * Contains two sets: seen and unseen.
2235
+ */
2236
+ readonly onViewUpdated: Event<{
2237
+ seen: Set<THREE.Mesh>;
2238
+ unseen: Set<THREE.Mesh>;
2239
+ }>;
2240
+ /**
2241
+ * Pixels in screen a geometry must occupy to be considered "seen".
2242
+ * Default value is 100.
2243
+ */
2244
+ threshold: number;
2245
+ /**
2246
+ * Map of color code to THREE.InstancedMesh.
2247
+ * Used to keep track of color-coded meshes.
2248
+ */
2249
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2250
+ /**
2251
+ * Flag to indicate if the renderer is currently processing.
2252
+ * Used to prevent concurrent processing.
2253
+ */
2254
+ isProcessing: boolean;
2255
+ private _colorCodeMeshMap;
2256
+ private _meshIDColorCodeMap;
2257
+ private _currentVisibleMeshes;
2258
+ private _recentlyHiddenMeshes;
2259
+ private _intervalID;
2260
+ private readonly _transparentMat;
2261
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
2262
+ /** {@link Disposable.dispose} */
2263
+ dispose(): void;
2264
+ /**
2265
+ * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
2266
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2267
+ * @returns {void}
2268
+ */
2269
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2270
+ /**
2271
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2272
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2273
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2274
+ * @returns {void}
2275
+ */
2276
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2277
+ private handleWorkerMessage;
2278
+ private getAvailableMaterial;
2279
+ }
2280
+ import * as WEBIFC from "web-ifc";
2281
+ export interface IfcItemsCategories {
2282
+ [itemID: number]: number;
2283
+ }
2284
+ export declare class IfcCategories {
2285
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2286
+ }
2287
+ import { InverseAttribute } from "./types";
2288
+ export declare const relToAttributesMap: Map<number, {
2289
+ forRelating: InverseAttribute;
2290
+ forRelated: InverseAttribute;
2291
+ }>;
2292
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2293
+ /**
2294
+ * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
2295
+ */
2296
+ export declare class Event<T> {
2297
+ /**
2298
+ * Add a callback to this event instance.
2299
+ * @param handler - the callback to be added to this event.
2300
+ */
2301
+ add(handler: T extends void ? {
2302
+ (): void;
2303
+ } : {
2304
+ (data: T): void;
2305
+ }): void;
2306
+ /**
2307
+ * Removes a callback from this event instance.
2308
+ * @param handler - the callback to be removed from this event.
2309
+ */
2310
+ remove(handler: T extends void ? {
2311
+ (): void;
2312
+ } : {
2313
+ (data: T): void;
2314
+ }): void;
2315
+ /** Triggers all the callbacks assigned to this event. */
2316
+ trigger: (data?: T) => void;
2317
+ /** Gets rid of all the suscribed events. */
2318
+ reset(): void;
2319
+ private handlers;
2320
+ }
2321
+ /**
2322
+ * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
2323
+ */
2324
+ export declare class AsyncEvent<T> {
2325
+ /**
2326
+ * Add a callback to this event instance.
2327
+ * @param handler - the callback to be added to this event.
2328
+ */
2329
+ add(handler: T extends void ? {
2330
+ (): Promise<void>;
2331
+ } : {
2332
+ (data: T): Promise<void>;
2333
+ }): void;
2334
+ /**
2335
+ * Removes a callback from this event instance.
2336
+ * @param handler - the callback to be removed from this event.
2337
+ */
2338
+ remove(handler: T extends void ? {
2339
+ (): Promise<void>;
2340
+ } : {
2341
+ (data: T): Promise<void>;
2342
+ }): void;
2343
+ /** Triggers all the callbacks assigned to this event. */
2344
+ trigger: (data?: T) => Promise<void>;
2345
+ /** Gets rid of all the suscribed events. */
2346
+ reset(): void;
2347
+ private handlers;
2348
+ }
2349
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2350
+ import { Components } from "../../Components";
2351
+ /**
2352
+ * Base class of the library. Useful for finding out the interfaces something implements.
2353
+ */
2354
+ export declare abstract class Base {
2355
+ components: Components;
2356
+ constructor(components: Components);
2357
+ /** Whether is component is {@link Disposable}. */
2358
+ isDisposeable: () => this is Disposable;
2359
+ /** Whether is component is {@link Resizeable}. */
2360
+ isResizeable: () => this is Resizeable;
2361
+ /** Whether is component is {@link Updateable}. */
2362
+ isUpdateable: () => this is Updateable;
2363
+ /** Whether is component is {@link Hideable}. */
2364
+ isHideable: () => this is Hideable;
2365
+ /** Whether is component is {@link Configurable}. */
2366
+ isConfigurable: () => this is Configurable<any>;
2367
+ }
2368
+ import { Base } from "./base";
2369
+ /**
2370
+ * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
2371
+ */
2372
+ export declare abstract class Component extends Base {
2373
+ /**
2374
+ * Whether this component is active or not. The behaviour can vary depending
2375
+ * on the type of component. E.g. a disabled dimension tool will stop creating
2376
+ * dimensions, while a disabled camera will stop moving. A disabled component
2377
+ * will not be updated automatically each frame.
2378
+ */
2379
+ abstract enabled: boolean;
2380
+ }
2381
+ import * as THREE from "three";
2382
+ import CameraControls from "camera-controls";
2383
+ import { BaseWorldItem } from "./base-world-item";
2384
+ import { CameraControllable } from "./interfaces";
2385
+ /**
2386
+ * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2387
+ */
2388
+ export declare abstract class BaseCamera extends BaseWorldItem {
2389
+ /**
2390
+ * Whether the camera is enabled or not.
2391
+ */
2392
+ abstract enabled: boolean;
2393
+ /**
2394
+ * The Three.js camera instance.
2395
+ */
2396
+ abstract three: THREE.Camera;
2397
+ /**
2398
+ * Optional CameraControls instance for controlling the camera.
2399
+ * This property is only available if the camera is controllable.
2400
+ */
2401
+ abstract controls?: CameraControls;
2402
+ /**
2403
+ * Checks whether the instance is {@link CameraControllable}.
2404
+ *
2405
+ * @returns True if the instance is controllable, false otherwise.
2406
+ */
2407
+ hasCameraControls: () => this is CameraControllable;
2408
+ }
2409
+ import * as THREE from "three";
2410
+ import { Disposable } from "./interfaces";
2411
+ import { Event } from "./event";
2412
+ import { Components } from "../../Components";
2413
+ import { BaseWorldItem } from "./base-world-item";
2414
+ /**
2415
+ * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2416
+ */
2417
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2418
+ /** {@link Disposable.onDisposed} */
2419
+ readonly onDisposed: Event<unknown>;
2420
+ /**
2421
+ * Abstract property representing the three.js object associated with this scene.
2422
+ * It should be implemented by subclasses.
2423
+ */
2424
+ abstract three: THREE.Object3D;
2425
+ protected constructor(components: Components);
2426
+ /** {@link Disposable.dispose} */
2427
+ dispose(): void;
2428
+ }
2429
+ import { Base } from "./base";
2430
+ import { World } from "./world";
2431
+ import { Event } from "./event";
2432
+ import { Components } from "../../Components";
2433
+ /**
2434
+ * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2435
+ */
2436
+ export declare abstract class BaseWorldItem extends Base {
2437
+ readonly worlds: Map<string, World>;
2438
+ /**
2439
+ * Event that is triggered when a world is added or removed from the 'worlds' map.
2440
+ * The event payload contains the world instance and the action ("added" or "removed").
2441
+ */
2442
+ readonly onWorldChanged: Event<{
2443
+ world: World;
2444
+ action: "added" | "removed";
2445
+ }>;
2066
2446
  /**
2067
- * Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
2068
- * This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
2069
- * If set to null, the default file location handler will be used.
2070
- *
2071
- * @param url - The URL of the file to locate.
2072
- * @returns The absolute path of the file.
2447
+ * The current world this item is associated with. It can be null if no world is currently active.
2073
2448
  */
2074
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
2449
+ currentWorld: World | null;
2450
+ protected constructor(components: Components);
2075
2451
  }
2076
- /**
2077
- * A Set of unique numbers representing different types of IFC geometries.
2078
- */
2079
- export declare const GeometryTypes: Set<number>;
2452
+ import * as THREE from "three";
2080
2453
  import * as WEBIFC from "web-ifc";
2081
- export interface IfcItemsCategories {
2082
- [itemID: number]: number;
2083
- }
2084
- export declare class IfcCategories {
2085
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
2086
- }
2087
- /**
2088
- * A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
2089
- *
2090
- * @remarks
2091
- * This map is used to provide a mapping between IFC entity type numbers and their names.
2092
- * It is useful for identifying and processing different types of IFC elements in a project.
2093
- *
2094
- */
2095
- export declare const IfcElements: {
2096
- [key: number]: string;
2097
- };
2098
- /**
2099
- * A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
2100
- */
2101
- export declare const IfcCategoryMap: {
2102
- [key: number]: string;
2103
- };
2104
2454
  import * as FRAGS from "@thatopen/fragments";
2105
- export declare class IfcPropertiesUtils {
2106
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
2107
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
2108
- [attribute: string]: any;
2109
- } | null>;
2110
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
2111
- [relatingID: number]: number[];
2112
- }>;
2113
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
2114
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
2115
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
2116
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
2117
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
2118
- key: string | null;
2119
- name: string | null;
2120
- }>;
2121
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
2122
- key: string | null;
2123
- value: number | null;
2124
- }>;
2125
- static isRel(expressID: number): boolean;
2126
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
2127
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
2455
+ export declare class CivilReader {
2456
+ defLineMat: THREE.LineBasicMaterial;
2457
+ read(webIfc: WEBIFC.IfcAPI): {
2458
+ alignments: Map<number, FRAGS.Alignment>;
2459
+ coordinationMatrix: THREE.Matrix4;
2460
+ } | undefined;
2461
+ get(civilItems: any): {
2462
+ alignments: Map<number, FRAGS.Alignment>;
2463
+ coordinationMatrix: THREE.Matrix4;
2464
+ } | undefined;
2465
+ private getCurves;
2128
2466
  }
2467
+ import * as THREE from "three";
2468
+ import { Vector2 } from "three";
2469
+ import { Event } from "./event";
2470
+ import { BaseWorldItem } from "./base-world-item";
2471
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
2129
2472
  /**
2130
- * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
2473
+ * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
2131
2474
  */
2132
- export declare class Event<T> {
2475
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
2133
2476
  /**
2134
- * Add a callback to this event instance.
2135
- * @param handler - the callback to be added to this event.
2477
+ * The three.js WebGLRenderer instance associated with this renderer.
2478
+ *
2479
+ * @abstract
2480
+ * @type {THREE.WebGLRenderer}
2136
2481
  */
2137
- add(handler: T extends void ? {
2138
- (): void;
2139
- } : {
2140
- (data: T): void;
2141
- }): void;
2482
+ abstract three: THREE.WebGLRenderer;
2483
+ /** {@link Updateable.onBeforeUpdate} */
2484
+ onAfterUpdate: Event<unknown>;
2485
+ /** {@link Updateable.onAfterUpdate} */
2486
+ onBeforeUpdate: Event<unknown>;
2487
+ /** {@link Disposable.onDisposed} */
2488
+ readonly onDisposed: Event<undefined>;
2489
+ /** {@link Resizeable.onResize} */
2490
+ readonly onResize: Event<THREE.Vector2>;
2142
2491
  /**
2143
- * Removes a callback from this event instance.
2144
- * @param handler - the callback to be removed from this event.
2492
+ * Event that fires when there has been a change to the list of clipping
2493
+ * planes used by the active renderer.
2145
2494
  */
2146
- remove(handler: T extends void ? {
2147
- (): void;
2148
- } : {
2149
- (data: T): void;
2150
- }): void;
2151
- /** Triggers all the callbacks assigned to this event. */
2152
- trigger: (data?: T) => void;
2153
- /** Gets rid of all the suscribed events. */
2154
- reset(): void;
2155
- private handlers;
2495
+ readonly onClippingPlanesUpdated: Event<unknown>;
2496
+ /** {@link Updateable.update} */
2497
+ abstract update(delta?: number): void | Promise<void>;
2498
+ /** {@link Disposable.dispose} */
2499
+ abstract dispose(): void;
2500
+ /** {@link Resizeable.getSize} */
2501
+ abstract getSize(): Vector2;
2502
+ /** {@link Resizeable.resize} */
2503
+ abstract resize(size: Vector2 | undefined): void;
2504
+ /**
2505
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
2506
+ */
2507
+ clippingPlanes: THREE.Plane[];
2508
+ /**
2509
+ * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
2510
+ *
2511
+ * @remarks
2512
+ * This method is typically called when there is a change to the list of clipping planes
2513
+ * used by the active renderer.
2514
+ */
2515
+ updateClippingPlanes(): void;
2516
+ /**
2517
+ * Sets or removes a clipping plane from the renderer.
2518
+ *
2519
+ * @param active - A boolean indicating whether the clipping plane should be active or not.
2520
+ * @param plane - The clipping plane to be added or removed.
2521
+ * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
2522
+ *
2523
+ * @remarks
2524
+ * This method adds or removes a clipping plane from the 'clippingPlanes' array.
2525
+ * If 'active' is 'true' and the plane is not already in the array, it is added.
2526
+ * If 'active' is 'false' and the plane is in the array, it is removed.
2527
+ * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
2528
+ * excluding any planes marked as local.
2529
+ */
2530
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2156
2531
  }
2157
2532
  import * as THREE from "three";
2158
2533
  import CameraControls from "camera-controls";
@@ -2262,206 +2637,162 @@ export interface CameraControllable {
2262
2637
  */
2263
2638
  controls: CameraControls;
2264
2639
  }
2265
- import { Base } from "./base";
2266
- /**
2267
- * Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
2268
- */
2269
- export declare abstract class Component extends Base {
2270
- /**
2271
- * Whether this component is active or not. The behaviour can vary depending
2272
- * on the type of component. E.g. a disabled dimension tool will stop creating
2273
- * dimensions, while a disabled camera will stop moving. A disabled component
2274
- * will not be updated automatically each frame.
2275
- */
2276
- abstract enabled: boolean;
2277
- }
2278
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
2279
- import { Components } from "../../Components";
2280
- /**
2281
- * Base class of the library. Useful for finding out the interfaces something implements.
2282
- */
2283
- export declare abstract class Base {
2284
- components: Components;
2285
- constructor(components: Components);
2286
- /** Whether is component is {@link Disposable}. */
2287
- isDisposeable: () => this is Disposable;
2288
- /** Whether is component is {@link Resizeable}. */
2289
- isResizeable: () => this is Resizeable;
2290
- /** Whether is component is {@link Updateable}. */
2291
- isUpdateable: () => this is Updateable;
2292
- /** Whether is component is {@link Hideable}. */
2293
- isHideable: () => this is Hideable;
2294
- /** Whether is component is {@link Configurable}. */
2295
- isConfigurable: () => this is Configurable<any>;
2296
- }
2640
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
2297
2641
  /**
2298
- * Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
2642
+ * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
2299
2643
  */
2300
- export declare class AsyncEvent<T> {
2644
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
2301
2645
  /**
2302
- * Add a callback to this event instance.
2303
- * @param handler - the callback to be added to this event.
2646
+ * Minimum number of geometries to be streamed.
2647
+ * Defaults to 10 geometries.
2304
2648
  */
2305
- add(handler: T extends void ? {
2306
- (): Promise<void>;
2307
- } : {
2308
- (data: T): Promise<void>;
2309
- }): void;
2649
+ minGeometrySize: number;
2310
2650
  /**
2311
- * Removes a callback from this event instance.
2312
- * @param handler - the callback to be removed from this event.
2651
+ * Minimum amount of assets to be streamed.
2652
+ * Defaults to 1000 assets.
2313
2653
  */
2314
- remove(handler: T extends void ? {
2315
- (): Promise<void>;
2316
- } : {
2317
- (data: T): Promise<void>;
2318
- }): void;
2319
- /** Triggers all the callbacks assigned to this event. */
2320
- trigger: (data?: T) => Promise<void>;
2321
- /** Gets rid of all the suscribed events. */
2322
- reset(): void;
2323
- private handlers;
2654
+ minAssetsSize: number;
2655
+ }
2656
+ import * as WEBIFC from "web-ifc";
2657
+ export declare class IfcMetadataReader {
2658
+ getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
2659
+ getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
2324
2660
  }
2325
- import * as THREE from "three";
2326
- import CameraControls from "camera-controls";
2327
- import { BaseWorldItem } from "./base-world-item";
2328
- import { CameraControllable } from "./interfaces";
2329
2661
  /**
2330
- * Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
2662
+ * A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
2331
2663
  */
2332
- export declare abstract class BaseCamera extends BaseWorldItem {
2333
- /**
2334
- * Whether the camera is enabled or not.
2335
- */
2336
- abstract enabled: boolean;
2337
- /**
2338
- * The Three.js camera instance.
2339
- */
2340
- abstract three: THREE.Camera;
2341
- /**
2342
- * Optional CameraControls instance for controlling the camera.
2343
- * This property is only available if the camera is controllable.
2344
- */
2345
- abstract controls?: CameraControls;
2346
- /**
2347
- * Checks whether the instance is {@link CameraControllable}.
2348
- *
2349
- * @returns True if the instance is controllable, false otherwise.
2350
- */
2351
- hasCameraControls: () => this is CameraControllable;
2664
+ export interface StreamedGeometries {
2665
+ [id: number]: {
2666
+ /** The bounding box of the geometry as a Float32Array. */
2667
+ boundingBox: Float32Array;
2668
+ /** A boolean indicating whether the geometry has holes. */
2669
+ hasHoles: boolean;
2670
+ /** An optional file path for the geometry data. */
2671
+ geometryFile?: string;
2672
+ };
2352
2673
  }
2353
- import { Base } from "./base";
2354
- import { World } from "./world";
2355
- import { Event } from "./event";
2356
- import { Components } from "../../Components";
2357
2674
  /**
2358
- * One of the elements that make a world. It can be either a scene, a camera or a renderer.
2675
+ * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
2359
2676
  */
2360
- export declare abstract class BaseWorldItem extends Base {
2361
- readonly worlds: Map<string, World>;
2362
- /**
2363
- * Event that is triggered when a world is added or removed from the 'worlds' map.
2364
- * The event payload contains the world instance and the action ("added" or "removed").
2365
- */
2366
- readonly onWorldChanged: Event<{
2367
- world: World;
2368
- action: "added" | "removed";
2369
- }>;
2370
- /**
2371
- * The current world this item is associated with. It can be null if no world is currently active.
2372
- */
2373
- currentWorld: World | null;
2374
- protected constructor(components: Components);
2677
+ export interface StreamedAsset {
2678
+ /** The unique identifier of the asset. */
2679
+ id: number;
2680
+ /** An array of geometries associated with the asset. */
2681
+ geometries: {
2682
+ /** The unique identifier of the geometry. */
2683
+ geometryID: number;
2684
+ /** The transformation matrix of the geometry as a number array. */
2685
+ transformation: number[];
2686
+ /** The color of the geometry as a number array. */
2687
+ color: number[];
2688
+ }[];
2375
2689
  }
2376
- import { InverseAttribute } from "./types";
2377
- export declare const relToAttributesMap: Map<number, {
2378
- forRelating: InverseAttribute;
2379
- forRelated: InverseAttribute;
2380
- }>;
2690
+ import * as WEBIFC from "web-ifc";
2381
2691
  import * as THREE from "three";
2382
- import { Disposable } from "./interfaces";
2383
- import { Event } from "./event";
2692
+ export declare class Units {
2693
+ factor: number;
2694
+ complement: number;
2695
+ apply(matrix: THREE.Matrix4): void;
2696
+ setUp(webIfc: WEBIFC.IfcAPI): void;
2697
+ private getLengthUnits;
2698
+ private getScaleMatrix;
2699
+ }
2700
+ import * as THREE from "three";
2701
+ import { Hideable, Disposable, Event, World } from "../../Types";
2384
2702
  import { Components } from "../../Components";
2385
- import { BaseWorldItem } from "./base-world-item";
2386
2703
  /**
2387
- * Abstract class representing a base scene in the application. All scenes should use this class as a base.
2704
+ * Each of the clipping planes created by the clipper.
2388
2705
  */
2389
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
2706
+ export declare class SimplePlane implements Disposable, Hideable {
2707
+ /** Event that fires when the user starts dragging a clipping plane. */
2708
+ readonly onDraggingStarted: Event<unknown>;
2709
+ /** Event that fires when the user stops dragging a clipping plane. */
2710
+ readonly onDraggingEnded: Event<unknown>;
2390
2711
  /** {@link Disposable.onDisposed} */
2391
2712
  readonly onDisposed: Event<unknown>;
2392
2713
  /**
2393
- * Abstract property representing the three.js object associated with this scene.
2394
- * It should be implemented by subclasses.
2714
+ * The normal vector of the clipping plane.
2395
2715
  */
2396
- abstract three: THREE.Object3D;
2397
- protected constructor(components: Components);
2398
- /** {@link Disposable.dispose} */
2399
- dispose(): void;
2400
- }
2401
- import * as THREE from "three";
2402
- import { Vector2 } from "three";
2403
- import { Event } from "./event";
2404
- import { BaseWorldItem } from "./base-world-item";
2405
- import { Disposable, Resizeable, Updateable } from "./interfaces";
2406
- /**
2407
- * Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
2408
- */
2409
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
2716
+ readonly normal: THREE.Vector3;
2410
2717
  /**
2411
- * The three.js WebGLRenderer instance associated with this renderer.
2412
- *
2413
- * @abstract
2414
- * @type {THREE.WebGLRenderer}
2718
+ * The origin point of the clipping plane.
2415
2719
  */
2416
- abstract three: THREE.WebGLRenderer;
2417
- /** {@link Updateable.onBeforeUpdate} */
2418
- onAfterUpdate: Event<unknown>;
2419
- /** {@link Updateable.onAfterUpdate} */
2420
- onBeforeUpdate: Event<unknown>;
2421
- /** {@link Disposable.onDisposed} */
2422
- readonly onDisposed: Event<undefined>;
2423
- /** {@link Resizeable.onResize} */
2424
- readonly onResize: Event<THREE.Vector2>;
2720
+ readonly origin: THREE.Vector3;
2425
2721
  /**
2426
- * Event that fires when there has been a change to the list of clipping
2427
- * planes used by the active renderer.
2722
+ * The THREE.js Plane object representing the clipping plane.
2428
2723
  */
2429
- readonly onClippingPlanesUpdated: Event<unknown>;
2430
- /** {@link Updateable.update} */
2431
- abstract update(delta?: number): void | Promise<void>;
2432
- /** {@link Disposable.dispose} */
2433
- abstract dispose(): void;
2434
- /** {@link Resizeable.getSize} */
2435
- abstract getSize(): Vector2;
2436
- /** {@link Resizeable.resize} */
2437
- abstract resize(size: Vector2 | undefined): void;
2724
+ readonly three: THREE.Plane;
2725
+ /** The components instance to which this plane belongs. */
2726
+ components: Components;
2727
+ /** The world instance to which this plane belongs. */
2728
+ world: World;
2729
+ protected readonly _helper: THREE.Object3D;
2730
+ protected _visible: boolean;
2731
+ protected _enabled: boolean;
2732
+ private _controlsActive;
2733
+ private readonly _arrowBoundBox;
2734
+ private readonly _planeMesh;
2735
+ private readonly _controls;
2736
+ private readonly _hiddenMaterial;
2438
2737
  /**
2439
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
2738
+ * Getter for the enabled state of the clipping plane.
2739
+ * @returns {boolean} The current enabled state.
2440
2740
  */
2441
- clippingPlanes: THREE.Plane[];
2741
+ get enabled(): boolean;
2442
2742
  /**
2443
- * Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
2743
+ * Setter for the enabled state of the clipping plane.
2744
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
2745
+ * @param {boolean} state - The new enabled state.
2746
+ */
2747
+ set enabled(state: boolean);
2748
+ /** {@link Hideable.visible } */
2749
+ get visible(): boolean;
2750
+ /** {@link Hideable.visible } */
2751
+ set visible(state: boolean);
2752
+ /** The meshes used for raycasting */
2753
+ get meshes(): THREE.Mesh[];
2754
+ /** The material of the clipping plane representation. */
2755
+ get planeMaterial(): THREE.Material | THREE.Material[];
2756
+ /** The material of the clipping plane representation. */
2757
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
2758
+ /** The size of the clipping plane representation. */
2759
+ get size(): number;
2760
+ /** Sets the size of the clipping plane representation. */
2761
+ set size(size: number);
2762
+ /**
2763
+ * Getter for the helper object of the clipping plane.
2764
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
2765
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
2444
2766
  *
2445
- * @remarks
2446
- * This method is typically called when there is a change to the list of clipping planes
2447
- * used by the active renderer.
2767
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
2448
2768
  */
2449
- updateClippingPlanes(): void;
2769
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
2770
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
2450
2771
  /**
2451
- * Sets or removes a clipping plane from the renderer.
2772
+ * Sets the clipping plane's normal and origin from the given normal and point.
2773
+ * This method resets the clipping plane's state, updates the normal and origin,
2774
+ * and positions the helper object accordingly.
2452
2775
  *
2453
- * @param active - A boolean indicating whether the clipping plane should be active or not.
2454
- * @param plane - The clipping plane to be added or removed.
2455
- * @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
2776
+ * @param normal - The new normal vector for the clipping plane.
2777
+ * @param point - The new origin point for the clipping plane.
2456
2778
  *
2457
- * @remarks
2458
- * This method adds or removes a clipping plane from the 'clippingPlanes' array.
2459
- * If 'active' is 'true' and the plane is not already in the array, it is added.
2460
- * If 'active' is 'false' and the plane is in the array, it is removed.
2461
- * The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
2462
- * excluding any planes marked as local.
2779
+ * @returns {void}
2463
2780
  */
2464
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
2781
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
2782
+ /** {@link Updateable.update} */
2783
+ update: () => void;
2784
+ /** {@link Disposable.dispose} */
2785
+ dispose(): void;
2786
+ private reset;
2787
+ protected toggleControls(state: boolean): void;
2788
+ private newTransformControls;
2789
+ private initializeControls;
2790
+ private createArrowBoundingBox;
2791
+ private changeDrag;
2792
+ private notifyDraggingChanged;
2793
+ private preventCameraMovement;
2794
+ private newHelper;
2795
+ private static newPlaneMesh;
2465
2796
  }
2466
2797
  import * as THREE from "three";
2467
2798
  import { BaseScene } from "./base-scene";
@@ -2497,96 +2828,123 @@ export interface World extends Disposable, Updateable {
2497
2828
  */
2498
2829
  isDisposing: boolean;
2499
2830
  }
2500
- import { NavigationMode } from "./types";
2501
- import { OrthoPerspectiveCamera } from "../index";
2502
- /**
2503
- * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
2504
- */
2505
- export declare class OrbitMode implements NavigationMode {
2506
- camera: OrthoPerspectiveCamera;
2507
- /** {@link NavigationMode.enabled} */
2508
- enabled: boolean;
2509
- /** {@link NavigationMode.id} */
2510
- readonly id = "Orbit";
2511
- constructor(camera: OrthoPerspectiveCamera);
2512
- /** {@link NavigationMode.set} */
2513
- set(active: boolean): void;
2514
- private activateOrbitControls;
2515
- }
2516
- import { NavigationMode } from "./types";
2517
- import { OrthoPerspectiveCamera } from "../index";
2518
- /**
2519
- * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
2520
- */
2521
- export declare class FirstPersonMode implements NavigationMode {
2522
- private camera;
2523
- /** {@link NavigationMode.enabled} */
2524
- enabled: boolean;
2525
- /** {@link NavigationMode.id} */
2526
- readonly id = "FirstPerson";
2527
- constructor(camera: OrthoPerspectiveCamera);
2528
- /** {@link NavigationMode.set} */
2529
- set(active: boolean): void;
2530
- private setupFirstPersonCamera;
2531
- }
2532
2831
  import * as THREE from "three";
2533
- import { Hideable, Event, World, Disposable } from "../../Types";
2534
- import { Components } from "../../Components";
2832
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
2535
2833
  /**
2536
- * Configuration interface for the {@link SimpleGrid} class.
2834
+ * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2835
+ *
2836
+ * @template T - The type of the scene. Default is BaseScene.
2837
+ * @template U - The type of the camera. Default is BaseCamera.
2838
+ * @template S - The type of the renderer. Default is BaseRenderer.
2537
2839
  */
2538
- export interface GridConfig {
2840
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2841
+ /**
2842
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2843
+ */
2844
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2845
+ /** {@link Updateable.onAfterUpdate} */
2846
+ readonly onAfterUpdate: Event<unknown>;
2847
+ /** {@link Updateable.onBeforeUpdate} */
2848
+ readonly onBeforeUpdate: Event<unknown>;
2849
+ /** {@link Disposable.onDisposed} */
2850
+ readonly onDisposed: Event<unknown>;
2851
+ /**
2852
+ * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
2853
+ */
2854
+ isDisposing: boolean;
2855
+ /**
2856
+ * Indicates whether the world is currently enabled.
2857
+ * When disabled, the world will not be updated.
2858
+ */
2859
+ enabled: boolean;
2860
+ /**
2861
+ * A unique identifier for the world.
2862
+ */
2863
+ uuid: string;
2864
+ /**
2865
+ * An optional name for the world.
2866
+ */
2867
+ name?: string;
2868
+ private _scene?;
2869
+ private _camera?;
2870
+ private _renderer;
2539
2871
  /**
2540
- * The color of the grid lines.
2872
+ * Getter for the scene. If no scene is initialized, it throws an error.
2873
+ * @returns The current scene.
2541
2874
  */
2542
- color: THREE.Color;
2875
+ get scene(): T;
2543
2876
  /**
2544
- * The size of the primary grid lines.
2877
+ * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
2878
+ * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
2879
+ * @param scene - The new scene to be set.
2545
2880
  */
2546
- size1: number;
2881
+ set scene(scene: T);
2547
2882
  /**
2548
- * The size of the secondary grid lines.
2883
+ * Getter for the camera. If no camera is initialized, it throws an error.
2884
+ * @returns The current camera.
2549
2885
  */
2550
- size2: number;
2886
+ get camera(): U;
2551
2887
  /**
2552
- * The distance at which the grid lines start to fade away.
2888
+ * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
2889
+ * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
2890
+ * @param camera - The new camera to be set.
2553
2891
  */
2554
- distance: number;
2892
+ set camera(camera: U);
2893
+ /**
2894
+ * Getter for the renderer.
2895
+ * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
2896
+ */
2897
+ get renderer(): S | null;
2898
+ /**
2899
+ * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
2900
+ * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
2901
+ * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2902
+ * @param renderer - The new renderer to be set or null to remove the current renderer.
2903
+ */
2904
+ set renderer(renderer: S | null);
2905
+ /** {@link Updateable.update} */
2906
+ update(delta?: number): void;
2907
+ /** {@link Disposable.dispose} */
2908
+ dispose(disposeResources?: boolean): void;
2555
2909
  }
2910
+ import * as THREE from "three";
2911
+ import { BaseScene, Configurable, Event } from "../../Types";
2912
+ import { Components } from "../../Components";
2556
2913
  /**
2557
- * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
2914
+ * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
2558
2915
  */
2559
- export declare class SimpleGrid implements Hideable, Disposable {
2560
- /** {@link Disposable.onDisposed} */
2561
- readonly onDisposed: Event<unknown>;
2562
- /** The world instance to which this Raycaster belongs. */
2563
- world: World;
2564
- /** The components instance to which this grid belongs. */
2565
- components: Components;
2566
- /** {@link Hideable.visible} */
2567
- get visible(): boolean;
2568
- /** {@link Hideable.visible} */
2569
- set visible(visible: boolean);
2570
- /** The material of the grid. */
2571
- get material(): THREE.ShaderMaterial;
2916
+ export interface SimpleSceneConfig {
2917
+ directionalLight: {
2918
+ color: THREE.Color;
2919
+ intensity: number;
2920
+ position: THREE.Vector3;
2921
+ };
2922
+ ambientLight: {
2923
+ color: THREE.Color;
2924
+ intensity: number;
2925
+ };
2926
+ }
2927
+ /**
2928
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
2929
+ */
2930
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
2931
+ /** {@link Configurable.isSetup} */
2932
+ isSetup: boolean;
2572
2933
  /**
2573
- * Whether the grid should fade away with distance. Recommended to be true for
2574
- * perspective cameras and false for orthographic cameras.
2934
+ * The underlying Three.js scene object.
2935
+ * It is used to define the 3D space containing objects, lights, and cameras.
2575
2936
  */
2576
- get fade(): boolean;
2937
+ three: THREE.Scene;
2938
+ /** {@link Configurable.onSetup} */
2939
+ readonly onSetup: Event<SimpleScene>;
2577
2940
  /**
2578
- * Whether the grid should fade away with distance. Recommended to be true for
2579
- * perspective cameras and false for orthographic cameras.
2941
+ * Configuration interface for the {@link SimpleScene}.
2942
+ * Defines properties for directional and ambient lights.
2580
2943
  */
2581
- set fade(active: boolean);
2582
- /** The Three.js mesh that contains the infinite grid. */
2583
- readonly three: THREE.Mesh;
2584
- private _fade;
2585
- constructor(components: Components, world: World, config: GridConfig);
2586
- /** {@link Disposable.dispose} */
2587
- dispose(): void;
2588
- private setupEvents;
2589
- private updateZoom;
2944
+ config: Required<SimpleSceneConfig>;
2945
+ constructor(components: Components);
2946
+ /** {@link Configurable.setup} */
2947
+ setup(config?: Partial<SimpleSceneConfig>): void;
2590
2948
  }
2591
2949
  import { NavigationMode } from "./types";
2592
2950
  import { OrthoPerspectiveCamera } from "../index";
@@ -2609,6 +2967,60 @@ export declare class PlanMode implements NavigationMode {
2609
2967
  set(active: boolean): void;
2610
2968
  }
2611
2969
  import * as THREE from "three";
2970
+ import { BaseRenderer, Event } from "../../Types";
2971
+ import { Components } from "../../Components";
2972
+ /**
2973
+ * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
2974
+ */
2975
+ export declare class SimpleRenderer extends BaseRenderer {
2976
+ /**
2977
+ * Indicates whether the renderer is enabled. If it's not, it won't be updated.
2978
+ * Default is 'true'.
2979
+ */
2980
+ enabled: boolean;
2981
+ /**
2982
+ * The HTML container of the THREE.js canvas where the scene is rendered.
2983
+ */
2984
+ container: HTMLElement;
2985
+ /**
2986
+ * The THREE.js WebGLRenderer instance.
2987
+ */
2988
+ three: THREE.WebGLRenderer;
2989
+ protected _canvas: HTMLCanvasElement;
2990
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
2991
+ protected _resizeObserver: ResizeObserver | null;
2992
+ protected onContainerUpdated: Event<unknown>;
2993
+ private _resizing;
2994
+ /**
2995
+ * Constructor for the SimpleRenderer class.
2996
+ *
2997
+ * @param components - The components instance.
2998
+ * @param container - The HTML container where the THREE.js canvas will be rendered.
2999
+ * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
3000
+ */
3001
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
3002
+ /** {@link Updateable.update} */
3003
+ update(): void;
3004
+ /** {@link Disposable.dispose} */
3005
+ dispose(): void;
3006
+ /** {@link Resizeable.getSize}. */
3007
+ getSize(): THREE.Vector2;
3008
+ /** {@link Resizeable.resize} */
3009
+ resize: (size?: THREE.Vector2) => void;
3010
+ /**
3011
+ * Sets up and manages the event listeners for the renderer.
3012
+ *
3013
+ * @param active - A boolean indicating whether to activate or deactivate the event listeners.
3014
+ *
3015
+ * @throws Will throw an error if the renderer does not have an HTML container.
3016
+ */
3017
+ setupEvents(active: boolean): void;
3018
+ private resizeEvent;
3019
+ private setupRenderer;
3020
+ private onContextLost;
3021
+ private onContextBack;
3022
+ }
3023
+ import * as THREE from "three";
2612
3024
  import { CameraProjection } from "./types";
2613
3025
  import { Event } from "../../Types";
2614
3026
  import { OrthoPerspectiveCamera } from "../index";
@@ -2643,106 +3055,15 @@ export declare class ProjectionManager {
2643
3055
  */
2644
3056
  set(projection: CameraProjection): Promise<void>;
2645
3057
  /**
2646
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
2647
- * and vice versa.
2648
- */
2649
- toggle(): Promise<void>;
2650
- private setOrthoCamera;
2651
- private getPerspectiveDims;
2652
- private setupOrthoCamera;
2653
- private getDistance;
2654
- private setPerspectiveCamera;
2655
- }
2656
- import * as THREE from "three";
2657
- import { Components } from "../../Components";
2658
- import { AsyncEvent, Event, World } from "../../Types";
2659
- /**
2660
- * Settings to configure the CullerRenderer.
2661
- */
2662
- export interface CullerRendererSettings {
2663
- /**
2664
- * Interval in milliseconds at which the visibility check should be performed.
2665
- * Default value is 1000.
2666
- */
2667
- updateInterval?: number;
2668
- /**
2669
- * Width of the render target used for visibility checks.
2670
- * Default value is 512.
2671
- */
2672
- width?: number;
2673
- /**
2674
- * Height of the render target used for visibility checks.
2675
- * Default value is 512.
2676
- */
2677
- height?: number;
2678
- /**
2679
- * Whether the visibility check should be performed automatically.
2680
- * Default value is true.
2681
- */
2682
- autoUpdate?: boolean;
2683
- }
2684
- /**
2685
- * A base renderer to determine visibility on screen.
2686
- */
2687
- export declare class CullerRenderer {
2688
- /** {@link Disposable.onDisposed} */
2689
- readonly onDisposed: Event<string>;
2690
- /**
2691
- * Fires after making the visibility check to the meshes. It lists the
2692
- * meshes that are currently visible, and the ones that were visible
2693
- * just before but not anymore.
2694
- */
2695
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
2696
- /**
2697
- * Whether this renderer is active or not. If not, it won't render anything.
2698
- */
2699
- enabled: boolean;
2700
- /**
2701
- * Needs to check whether there are objects that need to be hidden or shown.
2702
- * You can bind this to the camera movement, to a certain interval, etc.
2703
- */
2704
- needsUpdate: boolean;
2705
- /**
2706
- * Render the internal scene used to determine the object visibility. Used
2707
- * for debugging purposes.
2708
- */
2709
- renderDebugFrame: boolean;
2710
- /** The components instance to which this renderer belongs. */
2711
- components: Components;
2712
- /** The world instance to which this renderer belongs. */
2713
- readonly world: World;
2714
- /** The THREE.js renderer used to make the visibility test. */
2715
- readonly renderer: THREE.WebGLRenderer;
2716
- protected autoUpdate: boolean;
2717
- protected updateInterval: number;
2718
- protected readonly worker: Worker;
2719
- protected readonly scene: THREE.Scene;
2720
- private _width;
2721
- private _height;
2722
- private _availableColor;
2723
- private readonly renderTarget;
2724
- private readonly bufferSize;
2725
- private readonly _buffer;
2726
- protected _isWorkerBusy: boolean;
2727
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2728
- /** {@link Disposable.dispose} */
2729
- dispose(): void;
2730
- /**
2731
- * The function that the culler uses to reprocess the scene. Generally it's
2732
- * better to call needsUpdate, but you can also call this to force it.
2733
- * @param force if true, it will refresh the scene even if needsUpdate is
2734
- * not true.
2735
- */
2736
- updateVisibility: (force?: boolean) => Promise<void>;
2737
- protected getAvailableColor(): {
2738
- r: number;
2739
- g: number;
2740
- b: number;
2741
- code: string;
2742
- };
2743
- protected increaseColor(): void;
2744
- protected decreaseColor(): void;
2745
- private applySettings;
3058
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
3059
+ * and vice versa.
3060
+ */
3061
+ toggle(): Promise<void>;
3062
+ private setOrthoCamera;
3063
+ private getPerspectiveDims;
3064
+ private setupOrthoCamera;
3065
+ private getDistance;
3066
+ private setPerspectiveCamera;
2746
3067
  }
2747
3068
  /**
2748
3069
  * The projection system of the camera.
@@ -2771,86 +3092,6 @@ export interface NavigationMode {
2771
3092
  enabled: boolean;
2772
3093
  }
2773
3094
  import * as THREE from "three";
2774
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
2775
- import { Components } from "../../Components";
2776
- import { Event, World, Disposable } from "../../Types";
2777
- /**
2778
- * A renderer to hide/show meshes depending on their visibility from the user's point of view.
2779
- */
2780
- export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
2781
- /**
2782
- * Event triggered when the visibility of meshes is updated.
2783
- * Contains two sets: seen and unseen.
2784
- */
2785
- readonly onViewUpdated: Event<{
2786
- seen: Set<THREE.Mesh>;
2787
- unseen: Set<THREE.Mesh>;
2788
- }>;
2789
- /**
2790
- * Pixels in screen a geometry must occupy to be considered "seen".
2791
- * Default value is 100.
2792
- */
2793
- threshold: number;
2794
- /**
2795
- * Map of color code to THREE.InstancedMesh.
2796
- * Used to keep track of color-coded meshes.
2797
- */
2798
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
2799
- /**
2800
- * Flag to indicate if the renderer is currently processing.
2801
- * Used to prevent concurrent processing.
2802
- */
2803
- isProcessing: boolean;
2804
- private _colorCodeMeshMap;
2805
- private _meshIDColorCodeMap;
2806
- private _currentVisibleMeshes;
2807
- private _recentlyHiddenMeshes;
2808
- private _intervalID;
2809
- private readonly _transparentMat;
2810
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
2811
- /** {@link Disposable.dispose} */
2812
- dispose(): void;
2813
- /**
2814
- * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
2815
- * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2816
- * @returns {void}
2817
- */
2818
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2819
- /**
2820
- * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
2821
- * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
2822
- * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
2823
- * @returns {void}
2824
- */
2825
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
2826
- private handleWorkerMessage;
2827
- private getAvailableMaterial;
2828
- }
2829
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
2830
- import * as THREE from "three";
2831
- import { Disposable, Event } from "../../Types";
2832
- /**
2833
- * A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
2834
- */
2835
- export declare class Mouse implements Disposable {
2836
- dom: HTMLCanvasElement;
2837
- private _event?;
2838
- private _position;
2839
- /** {@link Disposable.onDisposed} */
2840
- readonly onDisposed: Event<unknown>;
2841
- constructor(dom: HTMLCanvasElement);
2842
- /**
2843
- * The real position of the mouse of the Three.js canvas.
2844
- */
2845
- get position(): THREE.Vector2;
2846
- /** {@link Disposable.dispose} */
2847
- dispose(): void;
2848
- private getPositionY;
2849
- private getPositionX;
2850
- private updateMouseInfo;
2851
- private setupEvents;
2852
- }
2853
- import * as THREE from "three";
2854
3095
  import { Components } from "../../Components";
2855
3096
  import { Event, World, Disposable } from "../../Types";
2856
3097
  import { Mouse } from "./mouse";
@@ -2903,142 +3144,118 @@ export declare class SimpleRaycaster implements Disposable {
2903
3144
  private filterClippingPlanes;
2904
3145
  }
2905
3146
  import * as THREE from "three";
2906
- import * as WEBIFC from "web-ifc";
2907
- import * as FRAGS from "@thatopen/fragments";
2908
- export declare class CivilReader {
2909
- defLineMat: THREE.LineBasicMaterial;
2910
- read(webIfc: WEBIFC.IfcAPI): {
2911
- alignments: Map<number, FRAGS.Alignment>;
2912
- coordinationMatrix: THREE.Matrix4;
2913
- } | undefined;
2914
- get(civilItems: any): {
2915
- alignments: Map<number, FRAGS.Alignment>;
2916
- coordinationMatrix: THREE.Matrix4;
2917
- } | undefined;
2918
- private getCurves;
2919
- }
2920
- import * as WEBIFC from "web-ifc";
2921
- export declare class IfcMetadataReader {
2922
- getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
2923
- getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
2924
- }
2925
- import * as THREE from "three";
2926
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
3147
+ import { Disposable, Event } from "../../Types";
2927
3148
  /**
2928
- * A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
2929
- *
2930
- * @template T - The type of the scene. Default is BaseScene.
2931
- * @template U - The type of the camera. Default is BaseCamera.
2932
- * @template S - The type of the renderer. Default is BaseRenderer.
3149
+ * A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
2933
3150
  */
2934
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
2935
- /**
2936
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
2937
- */
2938
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
2939
- /** {@link Updateable.onAfterUpdate} */
2940
- readonly onAfterUpdate: Event<unknown>;
2941
- /** {@link Updateable.onBeforeUpdate} */
2942
- readonly onBeforeUpdate: Event<unknown>;
3151
+ export declare class Mouse implements Disposable {
3152
+ dom: HTMLCanvasElement;
3153
+ private _event?;
3154
+ private _position;
2943
3155
  /** {@link Disposable.onDisposed} */
2944
3156
  readonly onDisposed: Event<unknown>;
3157
+ constructor(dom: HTMLCanvasElement);
2945
3158
  /**
2946
- * Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
2947
- */
2948
- isDisposing: boolean;
2949
- /**
2950
- * Indicates whether the world is currently enabled.
2951
- * When disabled, the world will not be updated.
3159
+ * The real position of the mouse of the Three.js canvas.
2952
3160
  */
3161
+ get position(): THREE.Vector2;
3162
+ /** {@link Disposable.dispose} */
3163
+ dispose(): void;
3164
+ private getPositionY;
3165
+ private getPositionX;
3166
+ private updateMouseInfo;
3167
+ private setupEvents;
3168
+ }
3169
+ import { NavigationMode } from "./types";
3170
+ import { OrthoPerspectiveCamera } from "../index";
3171
+ /**
3172
+ * A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
3173
+ */
3174
+ export declare class FirstPersonMode implements NavigationMode {
3175
+ private camera;
3176
+ /** {@link NavigationMode.enabled} */
2953
3177
  enabled: boolean;
3178
+ /** {@link NavigationMode.id} */
3179
+ readonly id = "FirstPerson";
3180
+ constructor(camera: OrthoPerspectiveCamera);
3181
+ /** {@link NavigationMode.set} */
3182
+ set(active: boolean): void;
3183
+ private setupFirstPersonCamera;
3184
+ }
3185
+ import { NavigationMode } from "./types";
3186
+ import { OrthoPerspectiveCamera } from "../index";
3187
+ /**
3188
+ * A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
3189
+ */
3190
+ export declare class OrbitMode implements NavigationMode {
3191
+ camera: OrthoPerspectiveCamera;
3192
+ /** {@link NavigationMode.enabled} */
3193
+ enabled: boolean;
3194
+ /** {@link NavigationMode.id} */
3195
+ readonly id = "Orbit";
3196
+ constructor(camera: OrthoPerspectiveCamera);
3197
+ /** {@link NavigationMode.set} */
3198
+ set(active: boolean): void;
3199
+ private activateOrbitControls;
3200
+ }
3201
+ import * as THREE from "three";
3202
+ import { Hideable, Event, World, Disposable } from "../../Types";
3203
+ import { Components } from "../../Components";
3204
+ /**
3205
+ * Configuration interface for the {@link SimpleGrid} class.
3206
+ */
3207
+ export interface GridConfig {
2954
3208
  /**
2955
- * A unique identifier for the world.
2956
- */
2957
- uuid: string;
2958
- /**
2959
- * An optional name for the world.
2960
- */
2961
- name?: string;
2962
- private _scene?;
2963
- private _camera?;
2964
- private _renderer;
2965
- /**
2966
- * Getter for the scene. If no scene is initialized, it throws an error.
2967
- * @returns The current scene.
2968
- */
2969
- get scene(): T;
2970
- /**
2971
- * Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
2972
- * sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
2973
- * @param scene - The new scene to be set.
2974
- */
2975
- set scene(scene: T);
2976
- /**
2977
- * Getter for the camera. If no camera is initialized, it throws an error.
2978
- * @returns The current camera.
3209
+ * The color of the grid lines.
2979
3210
  */
2980
- get camera(): U;
3211
+ color: THREE.Color;
2981
3212
  /**
2982
- * Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
2983
- * sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
2984
- * @param camera - The new camera to be set.
3213
+ * The size of the primary grid lines.
2985
3214
  */
2986
- set camera(camera: U);
3215
+ size1: number;
2987
3216
  /**
2988
- * Getter for the renderer.
2989
- * @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
3217
+ * The size of the secondary grid lines.
2990
3218
  */
2991
- get renderer(): S | null;
3219
+ size2: number;
2992
3220
  /**
2993
- * Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
2994
- * sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
2995
- * If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
2996
- * @param renderer - The new renderer to be set or null to remove the current renderer.
3221
+ * The distance at which the grid lines start to fade away.
2997
3222
  */
2998
- set renderer(renderer: S | null);
2999
- /** {@link Updateable.update} */
3000
- update(delta?: number): void;
3001
- /** {@link Disposable.dispose} */
3002
- dispose(disposeResources?: boolean): void;
3003
- }
3004
- import * as THREE from "three";
3005
- import { BaseScene, Configurable, Event } from "../../Types";
3006
- import { Components } from "../../Components";
3007
- /**
3008
- * Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
3009
- */
3010
- export interface SimpleSceneConfig {
3011
- directionalLight: {
3012
- color: THREE.Color;
3013
- intensity: number;
3014
- position: THREE.Vector3;
3015
- };
3016
- ambientLight: {
3017
- color: THREE.Color;
3018
- intensity: number;
3019
- };
3223
+ distance: number;
3020
3224
  }
3021
3225
  /**
3022
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
3023
- */
3024
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
3025
- /** {@link Configurable.isSetup} */
3026
- isSetup: boolean;
3226
+ * An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
3227
+ */
3228
+ export declare class SimpleGrid implements Hideable, Disposable {
3229
+ /** {@link Disposable.onDisposed} */
3230
+ readonly onDisposed: Event<unknown>;
3231
+ /** The world instance to which this Raycaster belongs. */
3232
+ world: World;
3233
+ /** The components instance to which this grid belongs. */
3234
+ components: Components;
3235
+ /** {@link Hideable.visible} */
3236
+ get visible(): boolean;
3237
+ /** {@link Hideable.visible} */
3238
+ set visible(visible: boolean);
3239
+ /** The material of the grid. */
3240
+ get material(): THREE.ShaderMaterial;
3027
3241
  /**
3028
- * The underlying Three.js scene object.
3029
- * It is used to define the 3D space containing objects, lights, and cameras.
3242
+ * Whether the grid should fade away with distance. Recommended to be true for
3243
+ * perspective cameras and false for orthographic cameras.
3030
3244
  */
3031
- three: THREE.Scene;
3032
- /** {@link Configurable.onSetup} */
3033
- readonly onSetup: Event<SimpleScene>;
3245
+ get fade(): boolean;
3034
3246
  /**
3035
- * Configuration interface for the {@link SimpleScene}.
3036
- * Defines properties for directional and ambient lights.
3247
+ * Whether the grid should fade away with distance. Recommended to be true for
3248
+ * perspective cameras and false for orthographic cameras.
3037
3249
  */
3038
- config: Required<SimpleSceneConfig>;
3039
- constructor(components: Components);
3040
- /** {@link Configurable.setup} */
3041
- setup(config?: Partial<SimpleSceneConfig>): void;
3250
+ set fade(active: boolean);
3251
+ /** The Three.js mesh that contains the infinite grid. */
3252
+ readonly three: THREE.Mesh;
3253
+ private _fade;
3254
+ constructor(components: Components, world: World, config: GridConfig);
3255
+ /** {@link Disposable.dispose} */
3256
+ dispose(): void;
3257
+ private setupEvents;
3258
+ private updateZoom;
3042
3259
  }
3043
3260
  import * as THREE from "three";
3044
3261
  import CameraControls from "camera-controls";
@@ -3102,183 +3319,6 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
3102
3319
  private setupEvents;
3103
3320
  private static getSubsetOfThree;
3104
3321
  }
3105
- import * as THREE from "three";
3106
- import { Hideable, Disposable, Event, World } from "../../Types";
3107
- import { Components } from "../../Components";
3108
- /**
3109
- * Each of the clipping planes created by the clipper.
3110
- */
3111
- export declare class SimplePlane implements Disposable, Hideable {
3112
- /** Event that fires when the user starts dragging a clipping plane. */
3113
- readonly onDraggingStarted: Event<unknown>;
3114
- /** Event that fires when the user stops dragging a clipping plane. */
3115
- readonly onDraggingEnded: Event<unknown>;
3116
- /** {@link Disposable.onDisposed} */
3117
- readonly onDisposed: Event<unknown>;
3118
- /**
3119
- * The normal vector of the clipping plane.
3120
- */
3121
- readonly normal: THREE.Vector3;
3122
- /**
3123
- * The origin point of the clipping plane.
3124
- */
3125
- readonly origin: THREE.Vector3;
3126
- /**
3127
- * The THREE.js Plane object representing the clipping plane.
3128
- */
3129
- readonly three: THREE.Plane;
3130
- /** The components instance to which this plane belongs. */
3131
- components: Components;
3132
- /** The world instance to which this plane belongs. */
3133
- world: World;
3134
- protected readonly _helper: THREE.Object3D;
3135
- protected _visible: boolean;
3136
- protected _enabled: boolean;
3137
- private _controlsActive;
3138
- private readonly _arrowBoundBox;
3139
- private readonly _planeMesh;
3140
- private readonly _controls;
3141
- private readonly _hiddenMaterial;
3142
- /**
3143
- * Getter for the enabled state of the clipping plane.
3144
- * @returns {boolean} The current enabled state.
3145
- */
3146
- get enabled(): boolean;
3147
- /**
3148
- * Setter for the enabled state of the clipping plane.
3149
- * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
3150
- * @param {boolean} state - The new enabled state.
3151
- */
3152
- set enabled(state: boolean);
3153
- /** {@link Hideable.visible } */
3154
- get visible(): boolean;
3155
- /** {@link Hideable.visible } */
3156
- set visible(state: boolean);
3157
- /** The meshes used for raycasting */
3158
- get meshes(): THREE.Mesh[];
3159
- /** The material of the clipping plane representation. */
3160
- get planeMaterial(): THREE.Material | THREE.Material[];
3161
- /** The material of the clipping plane representation. */
3162
- set planeMaterial(material: THREE.Material | THREE.Material[]);
3163
- /** The size of the clipping plane representation. */
3164
- get size(): number;
3165
- /** Sets the size of the clipping plane representation. */
3166
- set size(size: number);
3167
- /**
3168
- * Getter for the helper object of the clipping plane.
3169
- * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
3170
- * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
3171
- *
3172
- * @returns {THREE.Object3D} The helper object of the clipping plane.
3173
- */
3174
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
3175
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
3176
- /**
3177
- * Sets the clipping plane's normal and origin from the given normal and point.
3178
- * This method resets the clipping plane's state, updates the normal and origin,
3179
- * and positions the helper object accordingly.
3180
- *
3181
- * @param normal - The new normal vector for the clipping plane.
3182
- * @param point - The new origin point for the clipping plane.
3183
- *
3184
- * @returns {void}
3185
- */
3186
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
3187
- /** {@link Updateable.update} */
3188
- update: () => void;
3189
- /** {@link Disposable.dispose} */
3190
- dispose(): void;
3191
- private reset;
3192
- protected toggleControls(state: boolean): void;
3193
- private newTransformControls;
3194
- private initializeControls;
3195
- private createArrowBoundingBox;
3196
- private changeDrag;
3197
- private notifyDraggingChanged;
3198
- private preventCameraMovement;
3199
- private newHelper;
3200
- private static newPlaneMesh;
3201
- }
3202
- import * as THREE from "three";
3203
- import { BaseRenderer, Event } from "../../Types";
3204
- import { Components } from "../../Components";
3205
- /**
3206
- * A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
3207
- */
3208
- export declare class SimpleRenderer extends BaseRenderer {
3209
- /**
3210
- * Indicates whether the renderer is enabled. If it's not, it won't be updated.
3211
- * Default is 'true'.
3212
- */
3213
- enabled: boolean;
3214
- /**
3215
- * The HTML container of the THREE.js canvas where the scene is rendered.
3216
- */
3217
- container: HTMLElement;
3218
- /**
3219
- * The THREE.js WebGLRenderer instance.
3220
- */
3221
- three: THREE.WebGLRenderer;
3222
- protected _canvas: HTMLCanvasElement;
3223
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
3224
- protected _resizeObserver: ResizeObserver | null;
3225
- protected onContainerUpdated: Event<unknown>;
3226
- private _resizing;
3227
- /**
3228
- * Constructor for the SimpleRenderer class.
3229
- *
3230
- * @param components - The components instance.
3231
- * @param container - The HTML container where the THREE.js canvas will be rendered.
3232
- * @param parameters - Optional parameters for the THREE.js WebGLRenderer.
3233
- */
3234
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
3235
- /** {@link Updateable.update} */
3236
- update(): void;
3237
- /** {@link Disposable.dispose} */
3238
- dispose(): void;
3239
- /** {@link Resizeable.getSize}. */
3240
- getSize(): THREE.Vector2;
3241
- /** {@link Resizeable.resize} */
3242
- resize: (size?: THREE.Vector2) => void;
3243
- /**
3244
- * Sets up and manages the event listeners for the renderer.
3245
- *
3246
- * @param active - A boolean indicating whether to activate or deactivate the event listeners.
3247
- *
3248
- * @throws Will throw an error if the renderer does not have an HTML container.
3249
- */
3250
- setupEvents(active: boolean): void;
3251
- private resizeEvent;
3252
- private setupRenderer;
3253
- private onContextLost;
3254
- private onContextBack;
3255
- }
3256
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3257
- /**
3258
- * Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
3259
- */
3260
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
3261
- /**
3262
- * Minimum number of geometries to be streamed.
3263
- * Defaults to 10 geometries.
3264
- */
3265
- minGeometrySize: number;
3266
- /**
3267
- * Minimum amount of assets to be streamed.
3268
- * Defaults to 1000 assets.
3269
- */
3270
- minAssetsSize: number;
3271
- }
3272
- import * as WEBIFC from "web-ifc";
3273
- import * as THREE from "three";
3274
- export declare class Units {
3275
- factor: number;
3276
- complement: number;
3277
- apply(matrix: THREE.Matrix4): void;
3278
- setUp(webIfc: WEBIFC.IfcAPI): void;
3279
- private getLengthUnits;
3280
- private getScaleMatrix;
3281
- }
3282
3322
  export type RelationsMap = Map<number, Map<number, number[]>>;
3283
3323
  export interface ModelsRelationMap {
3284
3324
  [modelID: string]: RelationsMap;
@@ -3303,46 +3343,6 @@ export type InverseAttributes = [
3303
3343
  "ContainsElements"
3304
3344
  ];
3305
3345
  export type InverseAttribute = InverseAttributes[number];
3306
- import { IfcFragmentSettings } from "../../IfcLoader/src";
3307
- /**
3308
- * Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
3309
- */
3310
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
3311
- /**
3312
- * Amount of properties to be streamed.
3313
- * Defaults to 100 properties.
3314
- */
3315
- propertiesSize: number;
3316
- }
3317
- /**
3318
- * A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
3319
- */
3320
- export interface StreamedGeometries {
3321
- [id: number]: {
3322
- /** The bounding box of the geometry as a Float32Array. */
3323
- boundingBox: Float32Array;
3324
- /** A boolean indicating whether the geometry has holes. */
3325
- hasHoles: boolean;
3326
- /** An optional file path for the geometry data. */
3327
- geometryFile?: string;
3328
- };
3329
- }
3330
- /**
3331
- * A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
3332
- */
3333
- export interface StreamedAsset {
3334
- /** The unique identifier of the asset. */
3335
- id: number;
3336
- /** An array of geometries associated with the asset. */
3337
- geometries: {
3338
- /** The unique identifier of the geometry. */
3339
- geometryID: number;
3340
- /** The transformation matrix of the geometry as a number array. */
3341
- transformation: number[];
3342
- /** The color of the geometry as a number array. */
3343
- color: number[];
3344
- }[];
3345
- }
3346
3346
  import { BufferGeometry } from "three";
3347
3347
  import * as THREE from "three";
3348
3348
  export declare class TransformHelper {