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

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