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

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