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

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,546 +1,314 @@
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";
6
- enabled: boolean;
7
- height: number;
8
- groupName: string;
9
- /** {@link Disposable.onDisposed} */
10
- readonly onDisposed: Event<string>;
11
- list: Set<string>;
12
- constructor(components: Components);
13
- dispose(): void;
14
- explode(): void;
15
- reset(): void;
16
- update(): void;
17
- }
18
2
  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";
3
+ import { Components } from "../Components";
4
+ import { Component } from "../Types";
22
5
  /**
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.
6
+ * A tool to safely remove meshes and geometries from memory to
7
+ * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
25
8
  */
26
- export declare class BoundingBoxes extends Component implements Disposable {
27
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
9
+ export declare class Disposer extends Component {
10
+ private _disposedComponents;
28
11
  /** {@link Component.enabled} */
29
12
  enabled: boolean;
30
- /** {@link Disposable.onDisposed} */
31
- readonly onDisposed: Event<unknown>;
32
- private _absoluteMin;
33
- private _absoluteMax;
34
- private _meshes;
13
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
35
14
  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;
15
+ /**
16
+ * {@link Component.uuid}.
17
+ * @return the list of UUIDs of deleted components.
18
+ */
19
+ get(): Set<string>;
20
+ /**
21
+ * Removes a mesh, its geometry and its materials from memory. If you are
22
+ * using any of these in other parts of the application, make sure that you
23
+ * remove them from the mesh before disposing it.
24
+ *
25
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
26
+ * to remove.
27
+ *
28
+ * @param materials - whether to dispose the materials of the mesh.
29
+ *
30
+ * @param recursive - whether to recursively dispose the children of the mesh.
31
+ */
32
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
33
+ /**
34
+ * Disposes a geometry from memory.
35
+ *
36
+ * @param geometry - the
37
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
38
+ * to remove.
39
+ */
40
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
41
+ private disposeGeometryAndMaterials;
42
+ private disposeChildren;
43
+ private static disposeMaterial;
53
44
  }
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";
45
+ import { Component, Disposable, World, Event } from "../Types";
46
+ import { SimpleRaycaster } from "./src";
47
+ import { Components } from "../Components";
48
+ export declare class Raycasters extends Component implements Disposable {
49
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
58
50
  enabled: boolean;
51
+ list: Map<string, SimpleRaycaster>;
52
+ onDisposed: Event<unknown>;
59
53
  constructor(components: Components);
60
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
61
- isolate(items: FRAGS.FragmentIdMap): void;
62
- private updateCulledVisibility;
54
+ get(world: World): SimpleRaycaster;
55
+ delete(world: World): void;
56
+ dispose(): void;
63
57
  }
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>;
58
+ import { Component, Disposable, Event } from "../Types";
59
+ /**
60
+ * The entry point of the Components library.
61
+ * It can:
62
+ * - Create and access all the components of the library.
63
+ * - Update all the updatable components automatically.
64
+ * - Dispose all the components, preventing memory leaks.
65
+ */
66
+ export declare class Components implements Disposable {
67
+ static readonly release = "1.4.21";
72
68
  /** {@link Disposable.onDisposed} */
73
- readonly onDisposed: Event<string>;
74
- settings: IfcFragmentSettings;
69
+ readonly onDisposed: Event<void>;
70
+ /** The list of components created in this app. */
71
+ readonly list: Map<string, Component>;
72
+ /** If disabled, the animation loop will be stopped. */
75
73
  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);
74
+ private _clock;
75
+ add(uuid: string, instance: Component): void;
76
+ /**
77
+ * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
78
+ * doesn't exist, it will instance it automatically.
79
+ *
80
+ * @param Component - The component to get or create.
81
+ */
82
+ get<U extends Component>(Component: new (components: Components) => U): U;
83
+ constructor();
84
+ /**
85
+ * Initializes the library. It should be called at the start of the app after
86
+ * initializing the scene, the renderer and the
87
+ * camera. Additionally, if any component that need a raycaster is
88
+ * used, the {@link raycaster} will need to be initialized.
89
+ */
90
+ init(): void;
91
+ /**
92
+ * Disposes the memory of all the components and tools of this instance of
93
+ * the library. A memory leak will be created if:
94
+ *
95
+ * - An instance of the library ends up out of scope and this function isn't
96
+ * called. This is especially relevant in Single Page Applications (React,
97
+ * Angular, Vue, etc).
98
+ *
99
+ * - Any of the objects of this instance (meshes, geometries, etc) is
100
+ * referenced by a reference type (object or array).
101
+ *
102
+ * You can learn more about how Three.js handles memory leaks
103
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
104
+ *
105
+ */
86
106
  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
- }
116
- 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
- };
107
+ private update;
108
+ private static setupBVH;
123
109
  }
124
- export declare class FragmentClassifier extends Component implements Disposable {
125
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
110
+ import { Component, Disposable, World, Event } from "../Types";
111
+ import { GridConfig, SimpleGrid } from "./src";
112
+ export declare class Grids extends Component implements Disposable {
113
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
114
+ list: Map<string, SimpleGrid>;
115
+ onDisposed: Event<unknown>;
116
+ config: Required<GridConfig>;
126
117
  /** {@link Component.enabled} */
127
118
  enabled: boolean;
128
- list: Classification;
129
- /** {@link Disposable.onDisposed} */
119
+ create(world: World): void;
120
+ delete(world: World): void;
121
+ dispose(): void;
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;
256
- }
257
- import * as THREE from "three";
258
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
259
- center: THREE.Vector3;
260
- halfSizes: THREE.Vector3;
261
- rotation: THREE.Matrix3;
262
- transformation: THREE.Matrix4;
263
- };
264
- export declare class UUID {
265
- private static _pattern;
266
- private static _lut;
267
- static create(): string;
268
- static validate(uuid: string): void;
269
- }
270
- import * as THREE from "three";
271
- import { Component, Components, Event, World, Disposable } from "../core";
272
- export interface VertexPickerConfig {
273
- showOnlyVertex: boolean;
274
- snapDistance: number;
275
- previewElement: HTMLElement;
276
- }
277
- export declare class VertexPicker extends Component implements Disposable {
278
- onVertexFound: Event<THREE.Vector3>;
279
- onVertexLost: Event<THREE.Vector3>;
280
- components: Components;
281
- private _pickedPoint;
282
- private _config;
283
- private _enabled;
284
- private _workingPlane;
285
- /** {@link Disposable.onDisposed} */
286
- readonly onDisposed: Event<unknown>;
287
- set enabled(value: boolean);
288
- get enabled(): boolean;
289
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
290
- [Symbol.dispose](): void;
291
- set workingPlane(plane: THREE.Plane | null);
292
- get workingPlane(): THREE.Plane | null;
293
- set config(value: Partial<VertexPickerConfig>);
294
- get config(): Partial<VertexPickerConfig>;
295
- dispose(): void;
296
- get(world: World): THREE.Vector3 | null;
297
- private getClosestVertex;
298
- private getVertices;
299
- private getVertex;
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;
300
241
  }
301
242
  import * as THREE from "three";
302
- export declare class MaterialsUtils {
303
- static isTransparent(material: THREE.Material): boolean;
304
- }
305
243
  import { Component, Disposable, Event } from "../Types";
244
+ import { Components } from "../Components";
306
245
  /**
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.
246
+ * A tool to easily handle the materials of massive amounts of
247
+ * objects and scene background easily.
312
248
  */
313
- export declare class Components implements Disposable {
314
- static readonly release = "1.4.21";
315
- /** {@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. */
249
+ export declare class Materials extends Component implements Disposable {
250
+ static readonly uuid: "24989d27-fa2f-4797-8b08-35918f74e502";
251
+ /** {@link Component.enabled} */
320
252
  enabled: boolean;
321
- private _clock;
322
- add(uuid: string, instance: Component): void;
253
+ /** {@link Disposable.onDisposed} */
254
+ readonly onDisposed: Event<string>;
255
+ list: {
256
+ [id: string]: {
257
+ material: THREE.Material;
258
+ meshes: Set<THREE.Mesh | THREE.InstancedMesh>;
259
+ };
260
+ };
261
+ private _originals;
262
+ constructor(components: Components);
263
+ /** {@link Disposable.dispose} */
264
+ dispose(): void;
323
265
  /**
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.
266
+ * Turns the specified material styles on or off.
326
267
  *
327
- * @param Component - The component to get or create.
268
+ * @param active whether to turn it on or off.
269
+ * @param ids the ids of the style to turn on or off.
328
270
  */
329
- get<U extends Component>(Component: new (components: Components) => U): U;
330
- constructor();
271
+ set(active: boolean, ids?: string[]): void;
331
272
  /**
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;
380
- 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;
383
- 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.
273
+ * Creates a new material style.
274
+ * @param id the identifier of the style to create.
275
+ * @param material the material of the style.
402
276
  */
403
- get(): Set<string>;
277
+ addMaterial(id: string, material: THREE.Material): void;
404
278
  /**
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.
279
+ * Assign meshes to a certain style.
280
+ * @param id the identifier of the style.
281
+ * @param meshes the meshes to assign to the style.
415
282
  */
416
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
283
+ addMeshes(id: string, meshes: THREE.Mesh[]): void;
417
284
  /**
418
- * Disposes a geometry from memory.
419
- *
420
- * @param geometry - the
421
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
422
- * to remove.
285
+ * Remove meshes from a certain style.
286
+ * @param id the identifier of the style.
287
+ * @param meshes the meshes to assign to the style.
423
288
  */
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;
289
+ removeMeshes(id: string, meshes: THREE.Mesh[]): void;
441
290
  }
442
- import * as THREE from "three";
443
- import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
444
- import { SimplePlane } from "./src";
445
291
  import { Components } from "../Components";
292
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
293
+ import { Component, Event, Disposable, World } from "../Types";
446
294
  /**
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}.
295
+ * A tool to handle big scenes efficiently by automatically hiding the objects
296
+ * that are not visible to the camera.
453
297
  */
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.
481
- */
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;
298
+ export declare class Cullers extends Component implements Disposable {
299
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
488
300
  private _enabled;
489
- private _visible;
301
+ list: Map<string, MeshCullerRenderer>;
302
+ /** {@link Disposable.onDisposed} */
303
+ readonly onDisposed: Event<unknown>;
490
304
  /** {@link Component.enabled} */
491
305
  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);
306
+ set enabled(value: boolean);
506
307
  constructor(components: Components);
507
- endCreation(): void;
508
- cancelCreation(): void;
308
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
309
+ delete(world: World): void;
509
310
  /** {@link Disposable.dispose} */
510
311
  dispose(): void;
511
- /** {@link Createable.create} */
512
- create(world: World): void;
513
- /**
514
- * Creates a plane in a certain place and with a certain orientation,
515
- * without the need of the mouse.
516
- *
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.
521
- */
522
- createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): T;
523
- /**
524
- * {@link Createable.delete}
525
- *
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.
529
- */
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
312
  }
545
313
  import { Component, Components, Disposable, Updateable, World, Event } from "../../core";
546
314
  import { MiniMap } from "./src";
@@ -558,75 +326,26 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
558
326
  update(): void;
559
327
  }
560
328
  import * as THREE from "three";
561
- import { Component, Disposable, Event } from "../Types";
562
- import { Components } from "../Components";
329
+ import { Components } from "../../core/Components";
330
+ import { SimpleCamera } from "../../core";
331
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
563
332
  /**
564
- * A tool to easily handle the materials of massive amounts of
565
- * objects and scene background easily.
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.
566
337
  */
567
- export declare class Materials extends Component implements Disposable {
568
- static readonly uuid: "24989d27-fa2f-4797-8b08-35918f74e502";
569
- /** {@link Component.enabled} */
570
- enabled: boolean;
571
- /** {@link Disposable.onDisposed} */
572
- readonly onDisposed: Event<string>;
573
- list: {
574
- [id: string]: {
575
- material: THREE.Material;
576
- meshes: Set<THREE.Mesh | THREE.InstancedMesh>;
577
- };
578
- };
579
- private _originals;
580
- constructor(components: Components);
581
- /** {@link Disposable.dispose} */
582
- dispose(): void;
583
- /**
584
- * Turns the specified material styles on or off.
585
- *
586
- * @param active whether to turn it on or off.
587
- * @param ids the ids of the style to turn on or off.
588
- */
589
- set(active: boolean, ids?: string[]): void;
590
- /**
591
- * Creates a new material style.
592
- * @param id the identifier of the style to create.
593
- * @param material the material of the style.
594
- */
595
- addMaterial(id: string, material: THREE.Material): void;
596
- /**
597
- * Assign meshes to a certain style.
598
- * @param id the identifier of the style.
599
- * @param meshes the meshes to assign to the style.
600
- */
601
- addMeshes(id: string, meshes: THREE.Mesh[]): void;
602
- /**
603
- * Remove meshes from a certain style.
604
- * @param id the identifier of the style.
605
- * @param meshes the meshes to assign to the style.
606
- */
607
- removeMeshes(id: string, meshes: THREE.Mesh[]): void;
608
- }
609
- 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;
338
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
339
+ /**
340
+ * The current {@link NavigationMode}.
341
+ */
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;
630
349
  constructor(components: Components);
631
350
  /** {@link Disposable.dispose} */
632
351
  dispose(): void;
@@ -655,28 +374,6 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
655
374
  private newOrthoCamera;
656
375
  private setOrthoCameraAspect;
657
376
  }
658
- import { Components } from "../Components";
659
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
660
- import { Component, Event, Disposable, World } from "../Types";
661
- /**
662
- * A tool to handle big scenes efficiently by automatically hiding the objects
663
- * that are not visible to the camera.
664
- */
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>;
669
- /** {@link Disposable.onDisposed} */
670
- readonly onDisposed: Event<unknown>;
671
- /** {@link Component.enabled} */
672
- get enabled(): boolean;
673
- set enabled(value: boolean);
674
- constructor(components: Components);
675
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
676
- delete(world: World): void;
677
- /** {@link Disposable.dispose} */
678
- dispose(): void;
679
- }
680
377
  import * as WEBIFC from "web-ifc";
681
378
  import * as FRAG from "@thatopen/fragments";
682
379
  /**
@@ -733,7 +430,7 @@ export declare class IfcPropertiesFinder extends Component implements Disposable
733
430
  import * as WEBIFC from "web-ifc";
734
431
  import { FragmentsGroup } from "@thatopen/fragments";
735
432
  import { Disposable, Event, Component, Components } from "../../core";
736
- import { RelationsMap, ModelsRelationMap, InverseAttributes, InverseAttribute } from "./src/types";
433
+ import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
737
434
  /**
738
435
  * Indexer for IFC entities, facilitating the indexing and retrieval of IFC entity relationships.
739
436
  * 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,11 +445,8 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
748
445
  relationsMap: RelationsMap;
749
446
  }>;
750
447
  private _relToAttributesMap;
751
- /**
752
- * Array of inverse attribute names.
753
- * This array is used to define the inverse attributes that the indexer will process and index.
754
- */
755
- readonly inverseAttributes: InverseAttributes;
448
+ private _inverseAttributes;
449
+ private _ifcRels;
756
450
  /**
757
451
  * Holds the relationship mappings for each model processed by the indexer.
758
452
  * The structure is a map where each key is a model's UUID, and the value is another map.
@@ -764,7 +458,6 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
764
458
  readonly relationMaps: ModelsRelationMap;
765
459
  constructor(components: Components);
766
460
  private onFragmentsDisposed;
767
- private getAttributeRels;
768
461
  /**
769
462
  * Adds a relation map to the model's relations map.
770
463
  *
@@ -792,7 +485,7 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
792
485
  */
793
486
  process(model: FragmentsGroup): Promise<RelationsMap>;
794
487
  /**
795
- * Processes a given model from a WebIfc API to index its IFC entities relations based on predefined inverse attributes.
488
+ * Processes a given model from a WebIfc API to index its IFC entities relations.
796
489
  *
797
490
  * @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
798
491
  * @param modelID - The unique identifier of the model within the WebIfc API.
@@ -865,6 +558,7 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
865
558
  */
866
559
  dispose(): void;
867
560
  }
561
+ export type { InverseAttribute } from "./src/types";
868
562
  import * as WEBIFC from "web-ifc";
869
563
  import { FragmentsGroup } from "@thatopen/fragments";
870
564
  import { Component, Disposable, Event, Components } from "../../core";
@@ -937,49 +631,317 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
937
631
  saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
938
632
  setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
939
633
  }
940
- export {};
634
+ export {};
635
+ import * as THREE from "three";
636
+ export interface MeasureEdge {
637
+ distance: number;
638
+ points: THREE.Vector3[];
639
+ }
640
+ export declare class MeasurementUtils {
641
+ static getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
642
+ edges: MeasureEdge[];
643
+ indices: Set<number>;
644
+ } | null;
645
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
646
+ private static getFaceData;
647
+ static getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
648
+ p1: THREE.Vector3;
649
+ p2: THREE.Vector3;
650
+ p3: THREE.Vector3;
651
+ faceNormal: THREE.Vector3;
652
+ };
653
+ private static round;
654
+ }
655
+ import * as THREE from "three";
656
+ import * as FRAGS from "@thatopen/fragments";
657
+ import { FragmentsGroup } from "@thatopen/fragments";
658
+ import { Component, Components, Disposable, Event } from "../../core";
659
+ /**
660
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
661
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
662
+ */
663
+ export declare class BoundingBoxes extends Component implements Disposable {
664
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
665
+ /** {@link Component.enabled} */
666
+ enabled: boolean;
667
+ /** {@link Disposable.onDisposed} */
668
+ readonly onDisposed: Event<unknown>;
669
+ private _absoluteMin;
670
+ private _absoluteMax;
671
+ private _meshes;
672
+ constructor(components: Components);
673
+ static getDimensions(bbox: THREE.Box3): {
674
+ width: number;
675
+ height: number;
676
+ depth: number;
677
+ center: THREE.Vector3;
678
+ };
679
+ static newBound(positive: boolean): THREE.Vector3;
680
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
681
+ /** {@link Disposable.dispose} */
682
+ dispose(): void;
683
+ get(): THREE.Box3;
684
+ getSphere(): THREE.Sphere;
685
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
686
+ reset(): void;
687
+ add(group: FragmentsGroup): void;
688
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
689
+ private static getFragmentBounds;
690
+ }
691
+ import { Component, Disposable, Event, Components } from "../../core";
692
+ export declare class FragmentExploder extends Component implements Disposable {
693
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
694
+ enabled: boolean;
695
+ height: number;
696
+ groupName: string;
697
+ /** {@link Disposable.onDisposed} */
698
+ readonly onDisposed: Event<string>;
699
+ list: Set<string>;
700
+ constructor(components: Components);
701
+ dispose(): void;
702
+ explode(): void;
703
+ reset(): void;
704
+ update(): void;
705
+ }
706
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
707
+ import * as THREE from "three";
708
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
709
+ center: THREE.Vector3;
710
+ halfSizes: THREE.Vector3;
711
+ rotation: THREE.Matrix3;
712
+ transformation: THREE.Matrix4;
713
+ };
714
+ import * as THREE from "three";
715
+ export declare class MaterialsUtils {
716
+ static isTransparent(material: THREE.Material): boolean;
717
+ }
718
+ import * as THREE from "three";
719
+ import { Component, Components, Event, World, Disposable } from "../core";
720
+ export interface VertexPickerConfig {
721
+ showOnlyVertex: boolean;
722
+ snapDistance: number;
723
+ previewElement: HTMLElement;
724
+ }
725
+ export declare class VertexPicker extends Component implements Disposable {
726
+ onVertexFound: Event<THREE.Vector3>;
727
+ onVertexLost: Event<THREE.Vector3>;
728
+ components: Components;
729
+ private _pickedPoint;
730
+ private _config;
731
+ private _enabled;
732
+ private _workingPlane;
733
+ /** {@link Disposable.onDisposed} */
734
+ readonly onDisposed: Event<unknown>;
735
+ set enabled(value: boolean);
736
+ get enabled(): boolean;
737
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
738
+ [Symbol.dispose](): void;
739
+ set workingPlane(plane: THREE.Plane | null);
740
+ get workingPlane(): THREE.Plane | null;
741
+ set config(value: Partial<VertexPickerConfig>);
742
+ get config(): Partial<VertexPickerConfig>;
743
+ dispose(): void;
744
+ get(world: World): THREE.Vector3 | null;
745
+ private getClosestVertex;
746
+ private getVertices;
747
+ private getVertex;
748
+ }
749
+ export declare class UUID {
750
+ private static _pattern;
751
+ private static _lut;
752
+ static create(): string;
753
+ static validate(uuid: string): void;
754
+ }
755
+ import * as THREE from "three";
756
+ import * as FRAGS from "@thatopen/fragments";
757
+ import { Disposable, Component, Event, Components } from "../../core";
758
+ export interface Classification {
759
+ [system: string]: {
760
+ [className: string]: FRAGS.FragmentIdMap;
761
+ };
762
+ }
763
+ export declare class FragmentClassifier extends Component implements Disposable {
764
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
765
+ /** {@link Component.enabled} */
766
+ enabled: boolean;
767
+ list: Classification;
768
+ /** {@link Disposable.onDisposed} */
769
+ readonly onDisposed: Event<unknown>;
770
+ constructor(components: Components);
771
+ private onFragmentsDisposed;
772
+ dispose(): void;
773
+ remove(guid: string): void;
774
+ find(filter?: {
775
+ [name: string]: string[];
776
+ }): FRAGS.FragmentIdMap;
777
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
778
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
779
+ byEntity(group: FRAGS.FragmentsGroup): void;
780
+ byStorey(group: FRAGS.FragmentsGroup): void;
781
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
782
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
783
+ resetColor(items: FRAGS.FragmentIdMap): void;
784
+ private saveItem;
785
+ }
786
+ import * as FRAGS from "@thatopen/fragments";
787
+ import { Components, Component } from "../../core";
788
+ export declare class FragmentHider extends Component {
789
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
790
+ enabled: boolean;
791
+ constructor(components: Components);
792
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
793
+ isolate(items: FRAGS.FragmentIdMap): void;
794
+ private updateCulledVisibility;
795
+ }
796
+ import * as WEBIFC from "web-ifc";
797
+ import * as FRAGS from "@thatopen/fragments";
798
+ import { IfcFragmentSettings } from "./src";
799
+ import { Component, Components, Event, Disposable } from "../../core";
800
+ export declare class FragmentIfcLoader extends Component implements Disposable {
801
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
802
+ readonly onIfcStartedLoading: Event<void>;
803
+ readonly onSetup: Event<void>;
804
+ /** {@link Disposable.onDisposed} */
805
+ readonly onDisposed: Event<string>;
806
+ settings: IfcFragmentSettings;
807
+ enabled: boolean;
808
+ webIfc: WEBIFC.IfcAPI;
809
+ private _material;
810
+ private _spatialTree;
811
+ private _metaData;
812
+ private _fragmentInstances;
813
+ private _civil;
814
+ private _propertyExporter;
815
+ private _visitedFragments;
816
+ private _materialT;
817
+ constructor(components: Components);
818
+ dispose(): void;
819
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
820
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
821
+ readIfcFile(data: Uint8Array): Promise<number>;
822
+ private getAllGeometries;
823
+ cleanUp(): void;
824
+ private getMesh;
825
+ private getGeometry;
826
+ private autoSetWasm;
827
+ }
828
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
829
+ import * as THREE from "three";
830
+ import * as FRAGS from "@thatopen/fragments";
831
+ import { Component, Components, Event, Disposable } from "../../core";
832
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
833
+ /**
834
+ * Object that can efficiently load binary files that contain
835
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
836
+ */
837
+ export declare class FragmentManager extends Component implements Disposable {
838
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
839
+ /** {@link Disposable.onDisposed} */
840
+ readonly onDisposed: Event<unknown>;
841
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
842
+ readonly onFragmentsDisposed: Event<{
843
+ groupID: string;
844
+ fragmentIDs: string[];
845
+ }>;
846
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
847
+ readonly list: Map<string, Fragment>;
848
+ readonly groups: Map<string, FragmentsGroup>;
849
+ /** {@link Component.enabled} */
850
+ enabled: boolean;
851
+ baseCoordinationModel: string;
852
+ private _loader;
853
+ /** The list of meshes of the created fragments. */
854
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
855
+ constructor(components: Components);
856
+ /** {@link Disposable.dispose} */
857
+ dispose(): void;
858
+ disposeGroup(group: FragmentsGroup): void;
859
+ /**
860
+ * Loads a binar file that contain fragment geometry.
861
+ * @param data - The binary data to load.
862
+ * @param config - Optional configuration for loading.
863
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
864
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
865
+ * @returns The loaded FragmentsGroup.
866
+ */
867
+ load(data: Uint8Array, config?: Partial<{
868
+ coordinate: boolean;
869
+ properties: FRAGS.IfcProperties;
870
+ relationsMap: RelationsMap;
871
+ }>): FragmentsGroup;
872
+ /**
873
+ * Export the specified fragments.
874
+ * @param group - the fragments group to be exported.
875
+ * @returns the exported data as binary buffer.
876
+ */
877
+ export(group: FragmentsGroup): Uint8Array;
878
+ coordinate(models?: FragmentsGroup[]): void;
879
+ }
880
+ import * as WEBIFC from "web-ifc";
881
+ import { Components, Disposable, Event, Component } from "../../core";
882
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
883
+ export declare class IfcGeometryTiler extends Component implements Disposable {
884
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
885
+ onGeometryStreamed: Event<{
886
+ buffer: Uint8Array;
887
+ data: StreamedGeometries;
888
+ }>;
889
+ onAssetStreamed: Event<StreamedAsset[]>;
890
+ onProgress: Event<number>;
891
+ onIfcLoaded: Event<Uint8Array>;
892
+ /** {@link Disposable.onDisposed} */
893
+ readonly onDisposed: Event<unknown>;
894
+ settings: IfcStreamingSettings;
895
+ enabled: boolean;
896
+ webIfc: WEBIFC.IfcAPI;
897
+ private _spatialTree;
898
+ private _metaData;
899
+ private _visitedGeometries;
900
+ private _streamSerializer;
901
+ private _geometries;
902
+ private _geometryCount;
903
+ private _civil;
904
+ private _groupSerializer;
905
+ private _assets;
906
+ private _meshesWithHoles;
907
+ constructor(components: Components);
908
+ dispose(): void;
909
+ streamFromBuffer(data: Uint8Array): Promise<void>;
910
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
911
+ private readIfcFile;
912
+ private streamIfcFile;
913
+ private streamAllGeometries;
914
+ private cleanUp;
915
+ private getMesh;
916
+ private getGeometry;
917
+ private streamAssets;
918
+ private streamGeometries;
919
+ }
941
920
  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;
948
- }
949
- export declare const GeometryTypes: Set<number>;
950
- import * as THREE from "three";
951
- import { Event, Resizeable, Updateable, Disposable, World } from "../../../core";
952
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
921
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
922
+ import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
923
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
924
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
925
+ onPropertiesStreamed: AsyncEvent<{
926
+ type: number;
927
+ data: {
928
+ [id: number]: any;
929
+ };
930
+ }>;
931
+ onProgress: AsyncEvent<number>;
932
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
953
933
  /** {@link Disposable.onDisposed} */
954
- readonly onDisposed: Event<unknown>;
955
- readonly onAfterUpdate: Event<unknown>;
956
- readonly onBeforeUpdate: Event<unknown>;
957
- readonly onResize: Event<THREE.Vector2>;
958
- frontOffset: number;
959
- overrideMaterial: THREE.MeshDepthMaterial;
960
- backgroundColor: THREE.Color;
961
- renderer: THREE.WebGLRenderer;
934
+ readonly onDisposed: Event<string>;
962
935
  enabled: boolean;
963
- world: World;
964
- private _lockRotation;
965
- private _camera;
966
- private _plane;
967
- private _size;
968
- private _tempVector1;
969
- private _tempVector2;
970
- private _tempTarget;
971
- private readonly down;
972
- get lockRotation(): boolean;
973
- 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;
936
+ settings: PropertiesStreamingSettings;
937
+ webIfc: WEBIFC.IfcAPI;
938
+ dispose(): Promise<void>;
939
+ streamFromBuffer(data: Uint8Array): Promise<void>;
940
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
941
+ private readIfcFile;
942
+ private streamIfcFile;
943
+ private streamAllProperties;
944
+ private cleanUp;
983
945
  }
984
946
  import * as WEBIFC from "web-ifc";
985
947
  export interface IfcItemsCategories {
@@ -988,12 +950,8 @@ export interface IfcItemsCategories {
988
950
  export declare class IfcCategories {
989
951
  getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
990
952
  }
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[];
953
+ export declare const IfcElements: {
954
+ [key: number]: string;
997
955
  };
998
956
  import * as FRAGS from "@thatopen/fragments";
999
957
  export declare class IfcPropertiesUtils {
@@ -1020,182 +978,44 @@ export declare class IfcPropertiesUtils {
1020
978
  static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
1021
979
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
1022
980
  }
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
981
  export declare const IfcCategoryMap: {
1053
982
  [key: number]: string;
1054
983
  };
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
984
  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;
985
+ import { Event, Resizeable, Updateable, Disposable, World } from "../../../core";
986
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
1124
987
  /** {@link Disposable.onDisposed} */
1125
988
  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>;
989
+ readonly onAfterUpdate: Event<unknown>;
990
+ readonly onBeforeUpdate: Event<unknown>;
991
+ readonly onResize: Event<THREE.Vector2>;
992
+ frontOffset: number;
993
+ overrideMaterial: THREE.MeshDepthMaterial;
994
+ backgroundColor: THREE.Color;
995
+ renderer: THREE.WebGLRenderer;
1187
996
  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;
997
+ world: World;
998
+ private _lockRotation;
999
+ private _camera;
1000
+ private _plane;
1001
+ private _size;
1002
+ private _tempVector1;
1003
+ private _tempVector2;
1004
+ private _tempTarget;
1005
+ private readonly down;
1006
+ get lockRotation(): boolean;
1007
+ set lockRotation(active: boolean);
1008
+ get zoom(): number;
1009
+ set zoom(value: number);
1010
+ constructor(world: World);
1011
+ dispose(): void;
1012
+ get(): THREE.OrthographicCamera;
1013
+ update(): void;
1014
+ getSize(): THREE.Vector2;
1015
+ resize(size?: THREE.Vector2): void;
1016
+ private updatePlanes;
1198
1017
  }
1018
+ export declare const GeometryTypes: Set<number>;
1199
1019
  import * as THREE from "three";
1200
1020
  import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1201
1021
  import { Components } from "../../Components";
@@ -1222,6 +1042,49 @@ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends Base
1222
1042
  update(delta?: number): void;
1223
1043
  dispose(disposeResources?: boolean): void;
1224
1044
  }
1045
+ import { InverseAttribute } from "./types";
1046
+ export declare const relToAttributesMap: Map<number, {
1047
+ forRelating: InverseAttribute;
1048
+ forRelated: InverseAttribute;
1049
+ }>;
1050
+ import * as WEBIFC from "web-ifc";
1051
+ import { IfcItemsCategories } from "../../../ifc";
1052
+ export declare class SpatialStructure {
1053
+ itemsByFloor: IfcItemsCategories;
1054
+ private _units;
1055
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1056
+ cleanUp(): void;
1057
+ }
1058
+ import * as THREE from "three";
1059
+ import { BaseScene, Configurable, Event } from "../../Types";
1060
+ import { Components } from "../../Components";
1061
+ export interface SimpleSceneConfig {
1062
+ directionalLight: {
1063
+ color: THREE.Color;
1064
+ intensity: number;
1065
+ position: THREE.Vector3;
1066
+ };
1067
+ ambientLight: {
1068
+ color: THREE.Color;
1069
+ intensity: number;
1070
+ };
1071
+ }
1072
+ /**
1073
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1074
+ * objects hierarchically, and easily dispose them when you are finished with it.
1075
+ * @noInheritDoc
1076
+ */
1077
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1078
+ /** {@link Configurable.isSetup} */
1079
+ isSetup: boolean;
1080
+ three: THREE.Scene;
1081
+ /** {@link Configurable.onSetup} */
1082
+ readonly onSetup: Event<SimpleScene>;
1083
+ config: Required<SimpleSceneConfig>;
1084
+ constructor(components: Components);
1085
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1086
+ setup(config?: Partial<SimpleSceneConfig>): void;
1087
+ }
1225
1088
  import * as THREE from "three";
1226
1089
  import { BaseRenderer, Event } from "../../Types";
1227
1090
  import { Components } from "../../Components";
@@ -1299,145 +1162,6 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
1299
1162
  private setupEvents;
1300
1163
  private static getSubsetOfThree;
1301
1164
  }
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} */
1437
- dispose(): void;
1438
- private setupEvents;
1439
- private updateZoom;
1440
- }
1441
1165
  /**
1442
1166
  * Simple event handler by
1443
1167
  * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
@@ -1472,40 +1196,6 @@ export declare class Event<T> {
1472
1196
  reset(): void;
1473
1197
  private handlers;
1474
1198
  }
1475
- /**
1476
- * Simple event handler by
1477
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1478
- * Keep in mind that:
1479
- * - If you want to remove it later, you might want to declare the callback as
1480
- * an object.
1481
- * - If you want to maintain the reference to 'this', you will need to declare
1482
- * the callback as an arrow function.
1483
- */
1484
- export declare class AsyncEvent<T> {
1485
- /**
1486
- * Add a callback to this event instance.
1487
- * @param handler - the callback to be added to this event.
1488
- */
1489
- add(handler: T extends void ? {
1490
- (): Promise<void>;
1491
- } : {
1492
- (data: T): Promise<void>;
1493
- }): void;
1494
- /**
1495
- * Removes a callback from this event instance.
1496
- * @param handler - the callback to be removed from this event.
1497
- */
1498
- remove(handler: T extends void ? {
1499
- (): Promise<void>;
1500
- } : {
1501
- (data: T): Promise<void>;
1502
- }): void;
1503
- /** Triggers all the callbacks assigned to this event. */
1504
- trigger: (data?: T) => Promise<void>;
1505
- /** Gets rid of all the suscribed events. */
1506
- reset(): void;
1507
- private handlers;
1508
- }
1509
1199
  import * as THREE from "three";
1510
1200
  import CameraControls from "camera-controls";
1511
1201
  import { Event } from "./event";
@@ -1629,6 +1319,40 @@ export interface BVHGeometry extends THREE.BufferGeometry {
1629
1319
  export interface CameraControllable {
1630
1320
  controls: CameraControls;
1631
1321
  }
1322
+ /**
1323
+ * Simple event handler by
1324
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1325
+ * Keep in mind that:
1326
+ * - If you want to remove it later, you might want to declare the callback as
1327
+ * an object.
1328
+ * - If you want to maintain the reference to 'this', you will need to declare
1329
+ * the callback as an arrow function.
1330
+ */
1331
+ export declare class AsyncEvent<T> {
1332
+ /**
1333
+ * Add a callback to this event instance.
1334
+ * @param handler - the callback to be added to this event.
1335
+ */
1336
+ add(handler: T extends void ? {
1337
+ (): Promise<void>;
1338
+ } : {
1339
+ (data: T): Promise<void>;
1340
+ }): void;
1341
+ /**
1342
+ * Removes a callback from this event instance.
1343
+ * @param handler - the callback to be removed from this event.
1344
+ */
1345
+ remove(handler: T extends void ? {
1346
+ (): Promise<void>;
1347
+ } : {
1348
+ (data: T): Promise<void>;
1349
+ }): void;
1350
+ /** Triggers all the callbacks assigned to this event. */
1351
+ trigger: (data?: T) => Promise<void>;
1352
+ /** Gets rid of all the suscribed events. */
1353
+ reset(): void;
1354
+ private handlers;
1355
+ }
1632
1356
  import { Base } from "./base";
1633
1357
  /**
1634
1358
  * Components are the building blocks of this library. Components are singleton
@@ -1724,6 +1448,17 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
1724
1448
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1725
1449
  }
1726
1450
  import * as THREE from "three";
1451
+ import CameraControls from "camera-controls";
1452
+ import { BaseWorldItem } from "./base-world-item";
1453
+ import { CameraControllable } from "./interfaces";
1454
+ export declare abstract class BaseCamera extends BaseWorldItem {
1455
+ abstract enabled: boolean;
1456
+ abstract three: THREE.Camera;
1457
+ abstract controls?: CameraControls;
1458
+ /** Whether is instance is {@link CameraControllable}. */
1459
+ hasCameraControls: () => this is CameraControllable;
1460
+ }
1461
+ import * as THREE from "three";
1727
1462
  import { Disposable } from "./interfaces";
1728
1463
  import { Event } from "./event";
1729
1464
  import { Components } from "../../Components";
@@ -1737,17 +1472,6 @@ export declare abstract class BaseScene extends BaseWorldItem implements Disposa
1737
1472
  dispose(): void;
1738
1473
  }
1739
1474
  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;
1749
- }
1750
- import * as THREE from "three";
1751
1475
  import { BaseScene } from "./base-scene";
1752
1476
  import { BaseCamera } from "./base-camera";
1753
1477
  import { BaseRenderer } from "./base-renderer";
@@ -1759,6 +1483,170 @@ export interface World extends Disposable, Updateable {
1759
1483
  renderer: BaseRenderer | null;
1760
1484
  uuid: string;
1761
1485
  }
1486
+ import { NavigationMode } from "./types";
1487
+ /**
1488
+ * A {@link NavigationMode} that allows first person navigation,
1489
+ * simulating FPS video games.
1490
+ */
1491
+ export declare class FirstPersonMode implements NavigationMode {
1492
+ private camera;
1493
+ /** {@link NavigationMode.enabled} */
1494
+ enabled: boolean;
1495
+ /** {@link NavigationMode.id} */
1496
+ readonly id = "FirstPerson";
1497
+ constructor(camera: any);
1498
+ /** {@link NavigationMode.set} */
1499
+ set(active: boolean): void;
1500
+ private setupFirstPersonCamera;
1501
+ }
1502
+ import { NavigationMode } from "./types";
1503
+ /**
1504
+ * A {@link NavigationMode} that allows 3D navigation and panning
1505
+ * like in many 3D and CAD softwares.
1506
+ */
1507
+ export declare class OrbitMode implements NavigationMode {
1508
+ camera: any;
1509
+ /** {@link NavigationMode.enabled} */
1510
+ enabled: boolean;
1511
+ /** {@link NavigationMode.id} */
1512
+ readonly id = "Orbit";
1513
+ constructor(camera: any);
1514
+ /** {@link NavigationMode.set} */
1515
+ set(active: boolean): void;
1516
+ private activateOrbitControls;
1517
+ }
1518
+ import { NavigationMode } from "./types";
1519
+ /**
1520
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1521
+ * like many BIM tools.
1522
+ */
1523
+ export declare class PlanMode implements NavigationMode {
1524
+ private camera;
1525
+ /** {@link NavigationMode.enabled} */
1526
+ enabled: boolean;
1527
+ /** {@link NavigationMode.id} */
1528
+ readonly id = "Plan";
1529
+ private mouseAction1?;
1530
+ private mouseAction2?;
1531
+ private mouseInitialized;
1532
+ private readonly defaultAzimuthSpeed;
1533
+ private readonly defaultPolarSpeed;
1534
+ constructor(camera: any);
1535
+ /** {@link NavigationMode.set} */
1536
+ set(active: boolean): void;
1537
+ }
1538
+ import * as THREE from "three";
1539
+ import { CameraProjection } from "./types";
1540
+ import { Event } from "../../../core";
1541
+ import { OrthoPerspectiveCamera } from "../index";
1542
+ /**
1543
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1544
+ */
1545
+ export declare class ProjectionManager {
1546
+ /**
1547
+ * Event that fires when the {@link CameraProjection} changes.
1548
+ */
1549
+ readonly onChanged: Event<THREE.Camera>;
1550
+ current: CameraProjection;
1551
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1552
+ private _component;
1553
+ private _previousDistance;
1554
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1555
+ matchOrthoDistanceEnabled: boolean;
1556
+ constructor(camera: OrthoPerspectiveCamera);
1557
+ /**
1558
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1559
+ *
1560
+ * @param projection - the new projection to set. If it is the current projection,
1561
+ * it will have no effect.
1562
+ */
1563
+ set(projection: CameraProjection): Promise<void>;
1564
+ /**
1565
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1566
+ * and vice versa.
1567
+ */
1568
+ toggle(): Promise<void>;
1569
+ private setOrthoCamera;
1570
+ private getDims;
1571
+ private setupOrthoCamera;
1572
+ private getDistance;
1573
+ private setPerspectiveCamera;
1574
+ }
1575
+ /**
1576
+ * The projection system of the camera.
1577
+ */
1578
+ export type CameraProjection = "Perspective" | "Orthographic";
1579
+ /**
1580
+ * The extensible list of supported navigation modes.
1581
+ */
1582
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1583
+ /**
1584
+ * An object that determines the behavior of the camera controls
1585
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1586
+ */
1587
+ export interface NavigationMode {
1588
+ /** The unique ID of this navigation mode. */
1589
+ id: NavModeID;
1590
+ /**
1591
+ * Enable or disable this navigation mode.
1592
+ * When a new navigation mode is enabled, the previous navigation mode
1593
+ * must be disabled.
1594
+ *
1595
+ * @param active - whether to enable or disable this mode.
1596
+ * @param options - any additional data required to enable or disable it.
1597
+ * */
1598
+ set: (active: boolean, options?: any) => void;
1599
+ /** Whether this navigation mode is active or not. */
1600
+ enabled: boolean;
1601
+ }
1602
+ /// <reference types="node" />
1603
+ import * as THREE from "three";
1604
+ import { Hideable, Event, World } from "../../Types";
1605
+ import { Components } from "../../Components";
1606
+ export interface GridConfig {
1607
+ color: THREE.Color;
1608
+ size1: number;
1609
+ size2: number;
1610
+ distance: number;
1611
+ }
1612
+ /**
1613
+ * An infinite grid. Created by
1614
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1615
+ * and translated to typescript by
1616
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1617
+ */
1618
+ export declare class SimpleGrid implements Hideable, Disposable {
1619
+ /** {@link Disposable.onDisposed} */
1620
+ readonly onDisposed: Event<unknown>;
1621
+ world: World;
1622
+ components: Components;
1623
+ /** {@link Hideable.visible} */
1624
+ get visible(): boolean;
1625
+ /** {@link Hideable.visible} */
1626
+ set visible(visible: boolean);
1627
+ /** The material of the grid. */
1628
+ get material(): THREE.ShaderMaterial;
1629
+ /**
1630
+ * Whether the grid should fade away with distance. Recommended to be true for
1631
+ * perspective cameras and false for orthographic cameras.
1632
+ */
1633
+ get fade(): boolean;
1634
+ /**
1635
+ * Whether the grid should fade away with distance. Recommended to be true for
1636
+ * perspective cameras and false for orthographic cameras.
1637
+ */
1638
+ set fade(active: boolean);
1639
+ private readonly _grid;
1640
+ private _fade;
1641
+ constructor(components: Components, world: World, config: GridConfig);
1642
+ [Symbol.dispose](): void;
1643
+ /** {@link Component.get} */
1644
+ get(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
1645
+ /** {@link Disposable.dispose} */
1646
+ dispose(): void;
1647
+ private setupEvents;
1648
+ private updateZoom;
1649
+ }
1762
1650
  import * as THREE from "three";
1763
1651
  import { Components } from "../../Components";
1764
1652
  import { AsyncEvent, Event, World } from "../../Types";
@@ -1826,22 +1714,7 @@ export declare class CullerRenderer {
1826
1714
  protected decreaseColor(): void;
1827
1715
  private applySettings;
1828
1716
  }
1829
- import { NavigationMode } from "./types";
1830
- /**
1831
- * A {@link NavigationMode} that allows first person navigation,
1832
- * simulating FPS video games.
1833
- */
1834
- export declare class FirstPersonMode implements NavigationMode {
1835
- private camera;
1836
- /** {@link NavigationMode.enabled} */
1837
- enabled: boolean;
1838
- /** {@link NavigationMode.id} */
1839
- readonly id = "FirstPerson";
1840
- constructor(camera: any);
1841
- /** {@link NavigationMode.set} */
1842
- set(active: boolean): void;
1843
- private setupFirstPersonCamera;
1844
- }
1717
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1845
1718
  import * as THREE from "three";
1846
1719
  import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1847
1720
  import { Components } from "../../Components";
@@ -1870,111 +1743,236 @@ export declare class MeshCullerRenderer extends CullerRenderer {
1870
1743
  private handleWorkerMessage;
1871
1744
  private getAvailableMaterial;
1872
1745
  }
1873
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1874
- import { NavigationMode } from "./types";
1875
- /**
1876
- * A {@link NavigationMode} that allows 3D navigation and panning
1877
- * like in many 3D and CAD softwares.
1878
- */
1879
- export declare class OrbitMode implements NavigationMode {
1880
- camera: any;
1881
- /** {@link NavigationMode.enabled} */
1882
- enabled: boolean;
1883
- /** {@link NavigationMode.id} */
1884
- readonly id = "Orbit";
1885
- constructor(camera: any);
1886
- /** {@link NavigationMode.set} */
1887
- set(active: boolean): void;
1888
- private activateOrbitControls;
1889
- }
1890
- import { NavigationMode } from "./types";
1746
+ import * as THREE from "three";
1747
+ import { Disposable, Event } from "../../Types";
1891
1748
  /**
1892
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1893
- * like many BIM tools.
1749
+ * A helper to easily get the real position of the mouse in the Three.js canvas
1750
+ * to work with tools like the
1751
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1752
+ * been transformed through CSS or doesn't occupy the whole screen.
1894
1753
  */
1895
- export declare class PlanMode implements NavigationMode {
1896
- private camera;
1897
- /** {@link NavigationMode.enabled} */
1898
- enabled: boolean;
1899
- /** {@link NavigationMode.id} */
1900
- readonly id = "Plan";
1901
- private mouseAction1?;
1902
- private mouseAction2?;
1903
- private mouseInitialized;
1904
- private readonly defaultAzimuthSpeed;
1905
- private readonly defaultPolarSpeed;
1906
- constructor(camera: any);
1907
- /** {@link NavigationMode.set} */
1908
- set(active: boolean): void;
1754
+ export declare class Mouse implements Disposable {
1755
+ dom: HTMLCanvasElement;
1756
+ private _event?;
1757
+ private _position;
1758
+ /** {@link Disposable.onDisposed} */
1759
+ readonly onDisposed: Event<unknown>;
1760
+ constructor(dom: HTMLCanvasElement);
1761
+ /**
1762
+ * The real position of the mouse of the Three.js canvas.
1763
+ */
1764
+ get position(): THREE.Vector2;
1765
+ /** {@link Disposable.dispose} */
1766
+ dispose(): void;
1767
+ private getPositionY;
1768
+ private getPositionX;
1769
+ private updateMouseInfo;
1770
+ private setupEvents;
1909
1771
  }
1910
1772
  import * as THREE from "three";
1911
- import { CameraProjection } from "./types";
1912
- import { Event } from "../../../core";
1913
- import { OrthoPerspectiveCamera } from "../index";
1773
+ import { Components } from "../../Components";
1774
+ import { Event, World, Disposable } from "../../Types";
1775
+ import { Mouse } from "./mouse";
1914
1776
  /**
1915
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1777
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1778
+ * that allows to easily get items from the scene using the mouse and touch
1779
+ * events.
1916
1780
  */
1917
- export declare class ProjectionManager {
1918
- /**
1919
- * Event that fires when the {@link CameraProjection} changes.
1920
- */
1921
- readonly onChanged: Event<THREE.Camera>;
1922
- current: CameraProjection;
1923
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1924
- private _component;
1925
- private _previousDistance;
1926
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1927
- matchOrthoDistanceEnabled: boolean;
1928
- constructor(camera: OrthoPerspectiveCamera);
1781
+ export declare class SimpleRaycaster implements Disposable {
1782
+ /** {@link Component.enabled} */
1783
+ enabled: boolean;
1784
+ components: Components;
1785
+ /** {@link Disposable.onDisposed} */
1786
+ readonly onDisposed: Event<unknown>;
1787
+ /** The position of the mouse in the screen. */
1788
+ readonly mouse: Mouse;
1789
+ readonly three: THREE.Raycaster;
1790
+ world: World;
1791
+ constructor(components: Components, world: World);
1792
+ /** {@link Disposable.dispose} */
1793
+ dispose(): void;
1929
1794
  /**
1930
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1795
+ * Throws a ray from the camera to the mouse or touch event point and returns
1796
+ * the first item found. This also takes into account the clipping planes
1797
+ * used by the renderer.
1931
1798
  *
1932
- * @param projection - the new projection to set. If it is the current projection,
1933
- * it will have no effect.
1934
- */
1935
- set(projection: CameraProjection): Promise<void>;
1936
- /**
1937
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1938
- * and vice versa.
1799
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1800
+ * to query. If not provided, it will query all the meshes stored in
1801
+ * {@link Components.meshes}.
1939
1802
  */
1940
- toggle(): Promise<void>;
1941
- private setOrthoCamera;
1942
- private getDims;
1943
- private setupOrthoCamera;
1944
- private getDistance;
1945
- private setPerspectiveCamera;
1803
+ castRay(items?: THREE.Mesh[]): THREE.Intersection | null;
1804
+ 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;
1805
+ private intersect;
1806
+ private filterClippingPlanes;
1946
1807
  }
1808
+ import * as THREE from "three";
1809
+ import { Hideable, Disposable, Event, World } from "../../Types";
1810
+ import { Components } from "../../Components";
1947
1811
  /**
1948
- * The projection system of the camera.
1949
- */
1950
- export type CameraProjection = "Perspective" | "Orthographic";
1951
- /**
1952
- * The extensible list of supported navigation modes.
1953
- */
1954
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1955
- /**
1956
- * An object that determines the behavior of the camera controls
1957
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1812
+ * Each of the planes created by {@link SimpleClipper}.
1958
1813
  */
1959
- export interface NavigationMode {
1960
- /** The unique ID of this navigation mode. */
1961
- id: NavModeID;
1814
+ export declare class SimplePlane implements Disposable, Hideable {
1815
+ /** Event that fires when the user starts dragging a clipping plane. */
1816
+ readonly onDraggingStarted: Event<unknown>;
1817
+ /** Event that fires when the user stops dragging a clipping plane. */
1818
+ readonly onDraggingEnded: Event<unknown>;
1819
+ /** {@link Disposable.onDisposed} */
1820
+ readonly onDisposed: Event<unknown>;
1821
+ readonly normal: THREE.Vector3;
1822
+ readonly origin: THREE.Vector3;
1823
+ readonly three: THREE.Plane;
1824
+ protected readonly _helper: THREE.Object3D;
1825
+ protected _visible: boolean;
1826
+ protected _enabled: boolean;
1827
+ components: Components;
1828
+ world: World;
1829
+ private _controlsActive;
1830
+ private readonly _arrowBoundBox;
1831
+ private readonly _planeMesh;
1832
+ private readonly _controls;
1833
+ private readonly _hiddenMaterial;
1834
+ get enabled(): boolean;
1835
+ /** {@link Component.enabled} */
1836
+ set enabled(state: boolean);
1837
+ /** {@link Hideable.visible } */
1838
+ get visible(): boolean;
1839
+ /** {@link Hideable.visible } */
1840
+ set visible(state: boolean);
1841
+ /** The meshes used for raycasting */
1842
+ get meshes(): THREE.Mesh[];
1843
+ /** The material of the clipping plane representation. */
1844
+ get planeMaterial(): THREE.Material | THREE.Material[];
1845
+ /** The material of the clipping plane representation. */
1846
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
1847
+ /** The size of the clipping plane representation. */
1848
+ get size(): number;
1849
+ /** Sets the size of the clipping plane representation. */
1850
+ set size(size: number);
1851
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1852
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1853
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): Promise<void>;
1854
+ /** {@link Updateable.update} */
1855
+ update: () => Promise<void>;
1856
+ /** {@link Disposable.dispose} */
1857
+ dispose(): void;
1858
+ private reset;
1859
+ protected toggleControls(state: boolean): void;
1860
+ private newTransformControls;
1861
+ private initializeControls;
1862
+ private createArrowBoundingBox;
1863
+ private changeDrag;
1864
+ private notifyDraggingChanged;
1865
+ private preventCameraMovement;
1866
+ private newHelper;
1867
+ private static newPlaneMesh;
1868
+ }
1869
+ import * as THREE from "three";
1870
+ import * as WEBIFC from "web-ifc";
1871
+ import * as FRAGS from "@thatopen/fragments";
1872
+ export declare class CivilReader {
1873
+ defLineMat: THREE.LineBasicMaterial;
1874
+ read(webIfc: WEBIFC.IfcAPI): {
1875
+ alignments: Map<number, FRAGS.Alignment>;
1876
+ coordinationMatrix: THREE.Matrix4;
1877
+ } | undefined;
1878
+ get(civilItems: any): {
1879
+ alignments: Map<number, FRAGS.Alignment>;
1880
+ coordinationMatrix: THREE.Matrix4;
1881
+ } | undefined;
1882
+ private getCurves;
1883
+ }
1884
+ import * as WEBIFC from "web-ifc";
1885
+ /** Configuration of the IFC-fragment conversion. */
1886
+ export declare class IfcFragmentSettings {
1887
+ /** Whether to extract the IFC properties into a JSON. */
1888
+ includeProperties: boolean;
1962
1889
  /**
1963
- * Enable or disable this navigation mode.
1964
- * When a new navigation mode is enabled, the previous navigation mode
1965
- * must be disabled.
1966
- *
1967
- * @param active - whether to enable or disable this mode.
1968
- * @param options - any additional data required to enable or disable it.
1969
- * */
1970
- set: (active: boolean, options?: any) => void;
1971
- /** Whether this navigation mode is active or not. */
1890
+ * Generate the geometry for categories that are not included by default,
1891
+ * like IFCSPACE.
1892
+ */
1893
+ optionalCategories: number[];
1894
+ /** Whether to use the coordination data coming from the IFC files. */
1895
+ coordinate: boolean;
1896
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1897
+ wasm: {
1898
+ path: string;
1899
+ absolute: boolean;
1900
+ logLevel?: WEBIFC.LogLevel;
1901
+ };
1902
+ /** List of categories that won't be converted to fragments. */
1903
+ excludedCategories: Set<number>;
1904
+ /** Whether to save the absolute location of all IFC items. */
1905
+ saveLocations: boolean;
1906
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1907
+ webIfc: WEBIFC.LoaderSettings;
1908
+ autoSetWasm: boolean;
1909
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1910
+ }
1911
+ import * as WEBIFC from "web-ifc";
1912
+ export declare class IfcMetadataReader {
1913
+ get(webIfc: WEBIFC.IfcAPI, type: number): string;
1914
+ }
1915
+ import { IfcFragmentSettings } from "../../FragmentIfcLoader/src";
1916
+ /** Configuration of the IFC-fragment streaming. */
1917
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1918
+ minGeometrySize: number;
1919
+ minAssetsSize: number;
1920
+ }
1921
+ /** Configuration of the IFC-fragment streaming. */
1922
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1923
+ propertiesSize: number;
1924
+ }
1925
+ import * as WEBIFC from "web-ifc";
1926
+ import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1927
+ import { PropertiesStreamingSettings } from "./streaming-settings";
1928
+ export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1929
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1930
+ onPropertiesStreamed: AsyncEvent<{
1931
+ type: number;
1932
+ data: {
1933
+ [id: number]: any;
1934
+ };
1935
+ }>;
1936
+ onProgress: AsyncEvent<number>;
1937
+ onIndicesStreamed: AsyncEvent<number[][]>;
1938
+ /** {@link Disposable.onDisposed} */
1939
+ readonly onDisposed: Event<string>;
1972
1940
  enabled: boolean;
1941
+ settings: PropertiesStreamingSettings;
1942
+ webIfc: WEBIFC.IfcAPI;
1943
+ dispose(): Promise<void>;
1944
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1945
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1946
+ private readIfcFile;
1947
+ private streamIfcFile;
1948
+ private streamAllProperties;
1949
+ private getIndices;
1950
+ private cleanUp;
1973
1951
  }
1974
- import { BufferGeometry } from "three";
1952
+ export interface StreamedGeometries {
1953
+ [id: number]: {
1954
+ boundingBox: Float32Array;
1955
+ hasHoles: boolean;
1956
+ geometryFile?: string;
1957
+ };
1958
+ }
1959
+ export interface StreamedAsset {
1960
+ id: number;
1961
+ geometries: {
1962
+ geometryID: number;
1963
+ transformation: number[];
1964
+ color: number[];
1965
+ }[];
1966
+ }
1967
+ import * as WEBIFC from "web-ifc";
1975
1968
  import * as THREE from "three";
1976
- export declare class TransformHelper {
1977
- getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
1969
+ export declare class Units {
1970
+ factor: number;
1971
+ complement: number;
1972
+ apply(matrix: THREE.Matrix4): void;
1973
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1974
+ private getLengthUnits;
1975
+ private getScaleMatrix;
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;