@thatopen/components 2.0.26 → 2.1.1
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.
- package/dist/core/Components/index.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +6 -2
- package/dist/namespace.d.ts +1522 -1518
- package/dist/utils/vertex-picker.d.ts +4 -0
- package/package.json +5 -5
package/dist/namespace.d.ts
CHANGED
|
@@ -1,45 +1,48 @@
|
|
|
1
1
|
declare namespace OBC {
|
|
2
|
-
import
|
|
3
|
-
import { SimpleRaycaster } from "./src";
|
|
2
|
+
import * as THREE from "three";
|
|
4
3
|
import { Components } from "../Components";
|
|
4
|
+
import { Component } from "../Types";
|
|
5
5
|
/**
|
|
6
|
-
* A
|
|
6
|
+
* A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
7
7
|
*/
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class Disposer extends Component {
|
|
9
|
+
private _disposedComponents;
|
|
10
|
+
/** {@link Component.enabled} */
|
|
11
|
+
enabled: boolean;
|
|
9
12
|
/**
|
|
10
13
|
* A unique identifier for the component.
|
|
11
14
|
* This UUID is used to register the component within the Components system.
|
|
12
15
|
*/
|
|
13
|
-
static readonly uuid: "
|
|
14
|
-
|
|
15
|
-
enabled: boolean;
|
|
16
|
+
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
17
|
+
constructor(components: Components);
|
|
16
18
|
/**
|
|
17
|
-
*
|
|
18
|
-
* The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
|
|
19
|
+
* Return the UUIDs of all disposed components.
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
-
/** {@link Disposable.onDisposed} */
|
|
22
|
-
onDisposed: Event<unknown>;
|
|
23
|
-
constructor(components: Components);
|
|
21
|
+
get(): Set<string>;
|
|
24
22
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
24
|
+
* using any of these in other parts of the application, make sure that you
|
|
25
|
+
* remove them from the mesh before disposing it.
|
|
28
26
|
*
|
|
29
|
-
* @param
|
|
30
|
-
*
|
|
27
|
+
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
28
|
+
* to remove.
|
|
29
|
+
*
|
|
30
|
+
* @param materials - whether to dispose the materials of the mesh.
|
|
31
|
+
*
|
|
32
|
+
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
31
33
|
*/
|
|
32
|
-
|
|
34
|
+
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
33
35
|
/**
|
|
34
|
-
*
|
|
35
|
-
* If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
|
|
36
|
+
* Disposes a geometry from memory.
|
|
36
37
|
*
|
|
37
|
-
* @param
|
|
38
|
-
*
|
|
38
|
+
* @param geometry - the
|
|
39
|
+
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
40
|
+
* to remove.
|
|
39
41
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
43
|
+
private disposeGeometryAndMaterials;
|
|
44
|
+
private disposeChildren;
|
|
45
|
+
private static disposeMaterial;
|
|
43
46
|
}
|
|
44
47
|
import { Component, Disposable, Event } from "../Types";
|
|
45
48
|
/**
|
|
@@ -49,7 +52,7 @@ export declare class Components implements Disposable {
|
|
|
49
52
|
/**
|
|
50
53
|
* The version of the @thatopen/components library.
|
|
51
54
|
*/
|
|
52
|
-
static readonly release = "2.
|
|
55
|
+
static readonly release = "2.1.1";
|
|
53
56
|
/** {@link Disposable.onDisposed} */
|
|
54
57
|
readonly onDisposed: Event<void>;
|
|
55
58
|
/**
|
|
@@ -117,51 +120,6 @@ export declare class Components implements Disposable {
|
|
|
117
120
|
private update;
|
|
118
121
|
private static setupBVH;
|
|
119
122
|
}
|
|
120
|
-
import * as THREE from "three";
|
|
121
|
-
import { Components } from "../Components";
|
|
122
|
-
import { Component } from "../Types";
|
|
123
|
-
/**
|
|
124
|
-
* A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
125
|
-
*/
|
|
126
|
-
export declare class Disposer extends Component {
|
|
127
|
-
private _disposedComponents;
|
|
128
|
-
/** {@link Component.enabled} */
|
|
129
|
-
enabled: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* A unique identifier for the component.
|
|
132
|
-
* This UUID is used to register the component within the Components system.
|
|
133
|
-
*/
|
|
134
|
-
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
135
|
-
constructor(components: Components);
|
|
136
|
-
/**
|
|
137
|
-
* Return the UUIDs of all disposed components.
|
|
138
|
-
*/
|
|
139
|
-
get(): Set<string>;
|
|
140
|
-
/**
|
|
141
|
-
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
142
|
-
* using any of these in other parts of the application, make sure that you
|
|
143
|
-
* remove them from the mesh before disposing it.
|
|
144
|
-
*
|
|
145
|
-
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
146
|
-
* to remove.
|
|
147
|
-
*
|
|
148
|
-
* @param materials - whether to dispose the materials of the mesh.
|
|
149
|
-
*
|
|
150
|
-
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
151
|
-
*/
|
|
152
|
-
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
153
|
-
/**
|
|
154
|
-
* Disposes a geometry from memory.
|
|
155
|
-
*
|
|
156
|
-
* @param geometry - the
|
|
157
|
-
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
158
|
-
* to remove.
|
|
159
|
-
*/
|
|
160
|
-
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
161
|
-
private disposeGeometryAndMaterials;
|
|
162
|
-
private disposeChildren;
|
|
163
|
-
private static disposeMaterial;
|
|
164
|
-
}
|
|
165
123
|
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
166
124
|
import { Components } from "../Components";
|
|
167
125
|
import { SimpleWorld } from "./src";
|
|
@@ -230,54 +188,142 @@ export declare class Worlds extends Component implements Updateable, Disposable
|
|
|
230
188
|
update(delta?: number): void | Promise<void>;
|
|
231
189
|
}
|
|
232
190
|
import { Component, Disposable, World, Event } from "../Types";
|
|
233
|
-
import {
|
|
191
|
+
import { SimpleRaycaster } from "./src";
|
|
234
192
|
import { Components } from "../Components";
|
|
235
193
|
/**
|
|
236
|
-
* A component that manages
|
|
194
|
+
* A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
|
|
237
195
|
*/
|
|
238
|
-
export declare class
|
|
196
|
+
export declare class Raycasters extends Component implements Disposable {
|
|
239
197
|
/**
|
|
240
198
|
* A unique identifier for the component.
|
|
241
199
|
* This UUID is used to register the component within the Components system.
|
|
242
200
|
*/
|
|
243
|
-
static readonly uuid: "
|
|
201
|
+
static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
|
|
202
|
+
/** {@link Component.enabled} */
|
|
203
|
+
enabled: boolean;
|
|
244
204
|
/**
|
|
245
|
-
* A
|
|
205
|
+
* A Map that stores raycasters for each world.
|
|
206
|
+
* The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
|
|
246
207
|
*/
|
|
247
|
-
list: Map<string,
|
|
208
|
+
list: Map<string, SimpleRaycaster>;
|
|
209
|
+
/** {@link Disposable.onDisposed} */
|
|
210
|
+
onDisposed: Event<unknown>;
|
|
211
|
+
constructor(components: Components);
|
|
248
212
|
/**
|
|
249
|
-
*
|
|
213
|
+
* Retrieves a SimpleRaycaster instance for the given world.
|
|
214
|
+
* If a SimpleRaycaster instance already exists for the world, it will be returned.
|
|
215
|
+
* Otherwise, a new SimpleRaycaster instance will be created and added to the list.
|
|
216
|
+
*
|
|
217
|
+
* @param world - The world for which to retrieve or create a SimpleRaycaster instance.
|
|
218
|
+
* @returns The SimpleRaycaster instance for the given world.
|
|
219
|
+
*/
|
|
220
|
+
get(world: World): SimpleRaycaster;
|
|
221
|
+
/**
|
|
222
|
+
* Deletes the SimpleRaycaster instance associated with the given world.
|
|
223
|
+
* If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
|
|
224
|
+
*
|
|
225
|
+
* @param world - The world for which to delete the SimpleRaycaster instance.
|
|
226
|
+
* @returns {void}
|
|
227
|
+
*/
|
|
228
|
+
delete(world: World): void;
|
|
229
|
+
/** {@link Disposable.dispose} */
|
|
230
|
+
dispose(): void;
|
|
231
|
+
}
|
|
232
|
+
import { Components } from "../Components";
|
|
233
|
+
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
234
|
+
import { Component, Event, Disposable, World } from "../Types";
|
|
235
|
+
/**
|
|
236
|
+
* A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
|
|
237
|
+
*/
|
|
238
|
+
export declare class Cullers extends Component implements Disposable {
|
|
239
|
+
/**
|
|
240
|
+
* A unique identifier for the component.
|
|
241
|
+
* This UUID is used to register the component within the Components system.
|
|
242
|
+
*/
|
|
243
|
+
static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
|
|
244
|
+
/**
|
|
245
|
+
* An event that is triggered when the Cullers component is disposed.
|
|
250
246
|
*/
|
|
251
|
-
config: Required<GridConfig>;
|
|
252
|
-
/** {@link Disposable.onDisposed} */
|
|
253
247
|
readonly onDisposed: Event<unknown>;
|
|
248
|
+
private _enabled;
|
|
249
|
+
/**
|
|
250
|
+
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
251
|
+
*/
|
|
252
|
+
list: Map<string, MeshCullerRenderer>;
|
|
254
253
|
/** {@link Component.enabled} */
|
|
255
|
-
enabled: boolean;
|
|
254
|
+
get enabled(): boolean;
|
|
255
|
+
/** {@link Component.enabled} */
|
|
256
|
+
set enabled(value: boolean);
|
|
256
257
|
constructor(components: Components);
|
|
257
258
|
/**
|
|
258
|
-
* Creates a new
|
|
259
|
-
*
|
|
259
|
+
* Creates a new MeshCullerRenderer for the given world.
|
|
260
|
+
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
260
261
|
*
|
|
261
|
-
* @param world - The world to create the
|
|
262
|
-
* @
|
|
262
|
+
* @param world - The world for which to create the MeshCullerRenderer.
|
|
263
|
+
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
263
264
|
*
|
|
264
|
-
* @
|
|
265
|
+
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
265
266
|
*/
|
|
266
|
-
create(world: World):
|
|
267
|
+
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
267
268
|
/**
|
|
268
|
-
* Deletes the
|
|
269
|
-
* If a
|
|
269
|
+
* Deletes the MeshCullerRenderer associated with the given world.
|
|
270
|
+
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
270
271
|
*
|
|
271
|
-
* @param world - The world for which to delete the
|
|
272
|
+
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
272
273
|
*
|
|
273
|
-
* @
|
|
274
|
-
* This method will dispose of the grid and remove it from the internal list.
|
|
275
|
-
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
274
|
+
* @returns {void}
|
|
276
275
|
*/
|
|
277
276
|
delete(world: World): void;
|
|
278
277
|
/** {@link Disposable.dispose} */
|
|
279
278
|
dispose(): void;
|
|
280
279
|
}
|
|
280
|
+
import { MiniMap } from "./src";
|
|
281
|
+
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
282
|
+
import { Components } from "../Components";
|
|
283
|
+
/**
|
|
284
|
+
* A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
|
|
285
|
+
*/
|
|
286
|
+
export declare class MiniMaps extends Component implements Updateable, Disposable {
|
|
287
|
+
/**
|
|
288
|
+
* A unique identifier for the component.
|
|
289
|
+
* This UUID is used to register the component within the Components system.
|
|
290
|
+
*/
|
|
291
|
+
static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
|
|
292
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
293
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
294
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
295
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
296
|
+
/** {@link Disposable.onDisposed} */
|
|
297
|
+
readonly onDisposed: Event<unknown>;
|
|
298
|
+
/** {@link Component.enabled} */
|
|
299
|
+
enabled: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* A collection of {@link MiniMap} instances, each associated with a unique world ID.
|
|
302
|
+
*/
|
|
303
|
+
list: Map<string, MiniMap>;
|
|
304
|
+
constructor(components: Components);
|
|
305
|
+
/**
|
|
306
|
+
* Creates a new {@link MiniMap} instance associated with the given world.
|
|
307
|
+
* If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
|
|
308
|
+
*
|
|
309
|
+
* @param world - The {@link World} for which to create a {@link MiniMap} instance.
|
|
310
|
+
* @returns The newly created {@link MiniMap} instance.
|
|
311
|
+
* @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
|
|
312
|
+
*/
|
|
313
|
+
create(world: World): MiniMap;
|
|
314
|
+
/**
|
|
315
|
+
* Deletes a {@link MiniMap} instance associated with the given world ID.
|
|
316
|
+
* If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
|
|
317
|
+
*
|
|
318
|
+
* @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
|
|
319
|
+
* @returns {void}
|
|
320
|
+
*/
|
|
321
|
+
delete(id: string): void;
|
|
322
|
+
/** {@link Disposable.dispose} */
|
|
323
|
+
dispose(): void;
|
|
324
|
+
/** {@link Updateable.update} */
|
|
325
|
+
update(): void;
|
|
326
|
+
}
|
|
281
327
|
import * as THREE from "three";
|
|
282
328
|
import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
|
|
283
329
|
import { SimplePlane } from "./src";
|
|
@@ -405,113 +451,18 @@ export declare class Clipper extends Component implements Createable, Disposable
|
|
|
405
451
|
private _onStartDragging;
|
|
406
452
|
private _onEndDragging;
|
|
407
453
|
}
|
|
408
|
-
import
|
|
409
|
-
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
454
|
+
import * as THREE from "three";
|
|
410
455
|
import { Components } from "../Components";
|
|
456
|
+
import { SimpleCamera } from "..";
|
|
457
|
+
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
411
458
|
/**
|
|
412
|
-
* A
|
|
459
|
+
* A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
|
|
413
460
|
*/
|
|
414
|
-
export declare class
|
|
461
|
+
export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
415
462
|
/**
|
|
416
|
-
* A
|
|
417
|
-
* This UUID is used to register the component within the Components system.
|
|
463
|
+
* A ProjectionManager instance that manages the projection modes of the camera.
|
|
418
464
|
*/
|
|
419
|
-
|
|
420
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
421
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
422
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
423
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
424
|
-
/** {@link Disposable.onDisposed} */
|
|
425
|
-
readonly onDisposed: Event<unknown>;
|
|
426
|
-
/** {@link Component.enabled} */
|
|
427
|
-
enabled: boolean;
|
|
428
|
-
/**
|
|
429
|
-
* A collection of {@link MiniMap} instances, each associated with a unique world ID.
|
|
430
|
-
*/
|
|
431
|
-
list: Map<string, MiniMap>;
|
|
432
|
-
constructor(components: Components);
|
|
433
|
-
/**
|
|
434
|
-
* Creates a new {@link MiniMap} instance associated with the given world.
|
|
435
|
-
* If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
|
|
436
|
-
*
|
|
437
|
-
* @param world - The {@link World} for which to create a {@link MiniMap} instance.
|
|
438
|
-
* @returns The newly created {@link MiniMap} instance.
|
|
439
|
-
* @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
|
|
440
|
-
*/
|
|
441
|
-
create(world: World): MiniMap;
|
|
442
|
-
/**
|
|
443
|
-
* Deletes a {@link MiniMap} instance associated with the given world ID.
|
|
444
|
-
* If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
|
|
445
|
-
*
|
|
446
|
-
* @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
|
|
447
|
-
* @returns {void}
|
|
448
|
-
*/
|
|
449
|
-
delete(id: string): void;
|
|
450
|
-
/** {@link Disposable.dispose} */
|
|
451
|
-
dispose(): void;
|
|
452
|
-
/** {@link Updateable.update} */
|
|
453
|
-
update(): void;
|
|
454
|
-
}
|
|
455
|
-
import { Components } from "../Components";
|
|
456
|
-
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
457
|
-
import { Component, Event, Disposable, World } from "../Types";
|
|
458
|
-
/**
|
|
459
|
-
* A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
|
|
460
|
-
*/
|
|
461
|
-
export declare class Cullers extends Component implements Disposable {
|
|
462
|
-
/**
|
|
463
|
-
* A unique identifier for the component.
|
|
464
|
-
* This UUID is used to register the component within the Components system.
|
|
465
|
-
*/
|
|
466
|
-
static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
|
|
467
|
-
/**
|
|
468
|
-
* An event that is triggered when the Cullers component is disposed.
|
|
469
|
-
*/
|
|
470
|
-
readonly onDisposed: Event<unknown>;
|
|
471
|
-
private _enabled;
|
|
472
|
-
/**
|
|
473
|
-
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
474
|
-
*/
|
|
475
|
-
list: Map<string, MeshCullerRenderer>;
|
|
476
|
-
/** {@link Component.enabled} */
|
|
477
|
-
get enabled(): boolean;
|
|
478
|
-
/** {@link Component.enabled} */
|
|
479
|
-
set enabled(value: boolean);
|
|
480
|
-
constructor(components: Components);
|
|
481
|
-
/**
|
|
482
|
-
* Creates a new MeshCullerRenderer for the given world.
|
|
483
|
-
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
484
|
-
*
|
|
485
|
-
* @param world - The world for which to create the MeshCullerRenderer.
|
|
486
|
-
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
487
|
-
*
|
|
488
|
-
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
489
|
-
*/
|
|
490
|
-
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
491
|
-
/**
|
|
492
|
-
* Deletes the MeshCullerRenderer associated with the given world.
|
|
493
|
-
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
494
|
-
*
|
|
495
|
-
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
496
|
-
*
|
|
497
|
-
* @returns {void}
|
|
498
|
-
*/
|
|
499
|
-
delete(world: World): void;
|
|
500
|
-
/** {@link Disposable.dispose} */
|
|
501
|
-
dispose(): void;
|
|
502
|
-
}
|
|
503
|
-
import * as THREE from "three";
|
|
504
|
-
import { Components } from "../Components";
|
|
505
|
-
import { SimpleCamera } from "..";
|
|
506
|
-
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
507
|
-
/**
|
|
508
|
-
* A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
|
|
509
|
-
*/
|
|
510
|
-
export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
511
|
-
/**
|
|
512
|
-
* A ProjectionManager instance that manages the projection modes of the camera.
|
|
513
|
-
*/
|
|
514
|
-
readonly projection: ProjectionManager;
|
|
465
|
+
readonly projection: ProjectionManager;
|
|
515
466
|
/**
|
|
516
467
|
* A THREE.OrthographicCamera instance that represents the orthographic camera.
|
|
517
468
|
* This camera is used when the projection mode is set to orthographic.
|
|
@@ -564,6 +515,55 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
|
564
515
|
private newOrthoCamera;
|
|
565
516
|
private setOrthoPerspCameraAspect;
|
|
566
517
|
}
|
|
518
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
519
|
+
import { GridConfig, SimpleGrid } from "./src";
|
|
520
|
+
import { Components } from "../Components";
|
|
521
|
+
/**
|
|
522
|
+
* A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
|
|
523
|
+
*/
|
|
524
|
+
export declare class Grids extends Component implements Disposable {
|
|
525
|
+
/**
|
|
526
|
+
* A unique identifier for the component.
|
|
527
|
+
* This UUID is used to register the component within the Components system.
|
|
528
|
+
*/
|
|
529
|
+
static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
|
|
530
|
+
/**
|
|
531
|
+
* A map of world UUIDs to their corresponding grid instances.
|
|
532
|
+
*/
|
|
533
|
+
list: Map<string, SimpleGrid>;
|
|
534
|
+
/**
|
|
535
|
+
* The default configuration for grid creation.
|
|
536
|
+
*/
|
|
537
|
+
config: Required<GridConfig>;
|
|
538
|
+
/** {@link Disposable.onDisposed} */
|
|
539
|
+
readonly onDisposed: Event<unknown>;
|
|
540
|
+
/** {@link Component.enabled} */
|
|
541
|
+
enabled: boolean;
|
|
542
|
+
constructor(components: Components);
|
|
543
|
+
/**
|
|
544
|
+
* Creates a new grid for the given world.
|
|
545
|
+
* Throws an error if a grid already exists for the world.
|
|
546
|
+
*
|
|
547
|
+
* @param world - The world to create the grid for.
|
|
548
|
+
* @returns The newly created grid.
|
|
549
|
+
*
|
|
550
|
+
* @throws Will throw an error if a grid already exists for the given world.
|
|
551
|
+
*/
|
|
552
|
+
create(world: World): SimpleGrid;
|
|
553
|
+
/**
|
|
554
|
+
* Deletes the grid associated with the given world.
|
|
555
|
+
* If a grid does not exist for the given world, this method does nothing.
|
|
556
|
+
*
|
|
557
|
+
* @param world - The world for which to delete the grid.
|
|
558
|
+
*
|
|
559
|
+
* @remarks
|
|
560
|
+
* This method will dispose of the grid and remove it from the internal list.
|
|
561
|
+
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
562
|
+
*/
|
|
563
|
+
delete(world: World): void;
|
|
564
|
+
/** {@link Disposable.dispose} */
|
|
565
|
+
dispose(): void;
|
|
566
|
+
}
|
|
567
567
|
import * as THREE from "three";
|
|
568
568
|
import * as FRAGS from "@thatopen/fragments";
|
|
569
569
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
@@ -772,6 +772,14 @@ export declare class BoundingBoxer extends Component implements Disposable {
|
|
|
772
772
|
addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
|
|
773
773
|
private static getFragmentBounds;
|
|
774
774
|
}
|
|
775
|
+
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
776
|
+
import * as THREE from "three";
|
|
777
|
+
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
778
|
+
center: THREE.Vector3;
|
|
779
|
+
halfSizes: THREE.Vector3;
|
|
780
|
+
rotation: THREE.Matrix3;
|
|
781
|
+
transformation: THREE.Matrix4;
|
|
782
|
+
};
|
|
775
783
|
import { Component, Disposable, Event, Components } from "../../core";
|
|
776
784
|
/**
|
|
777
785
|
* The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
|
|
@@ -822,339 +830,67 @@ export declare class Exploder extends Component implements Disposable {
|
|
|
822
830
|
*/
|
|
823
831
|
set(active: boolean): void;
|
|
824
832
|
}
|
|
825
|
-
import * as THREE from "three";
|
|
826
833
|
import * as FRAGS from "@thatopen/fragments";
|
|
827
|
-
import {
|
|
828
|
-
/**
|
|
829
|
-
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
|
|
830
|
-
*/
|
|
831
|
-
export interface Classification {
|
|
832
|
-
/**
|
|
833
|
-
* A system within the classification.
|
|
834
|
-
* The key is the system name, and the value is an object representing the classes within the system.
|
|
835
|
-
*/
|
|
836
|
-
[system: string]: {
|
|
837
|
-
/**
|
|
838
|
-
* A class within the system.
|
|
839
|
-
* The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
|
|
840
|
-
*/
|
|
841
|
-
[className: string]: FRAGS.FragmentIdMap;
|
|
842
|
-
};
|
|
843
|
-
}
|
|
834
|
+
import { Components, Component } from "../../core";
|
|
844
835
|
/**
|
|
845
|
-
*
|
|
836
|
+
* A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
|
|
846
837
|
*/
|
|
847
|
-
export declare class
|
|
838
|
+
export declare class Hider extends Component {
|
|
848
839
|
/**
|
|
849
840
|
* A unique identifier for the component.
|
|
850
841
|
* This UUID is used to register the component within the Components system.
|
|
851
842
|
*/
|
|
852
|
-
static readonly uuid: "
|
|
843
|
+
static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
|
|
853
844
|
/** {@link Component.enabled} */
|
|
854
845
|
enabled: boolean;
|
|
855
|
-
/**
|
|
856
|
-
* A map representing the classification systems.
|
|
857
|
-
* The key is the system name, and the value is an object representing the classes within the system.
|
|
858
|
-
*/
|
|
859
|
-
list: Classification;
|
|
860
|
-
/** {@link Disposable.onDisposed} */
|
|
861
|
-
readonly onDisposed: Event<unknown>;
|
|
862
846
|
constructor(components: Components);
|
|
863
|
-
private onFragmentsDisposed;
|
|
864
|
-
/** {@link Disposable.dispose} */
|
|
865
|
-
dispose(): void;
|
|
866
847
|
/**
|
|
867
|
-
*
|
|
868
|
-
*
|
|
848
|
+
* Sets the visibility of fragments within the 3D scene.
|
|
849
|
+
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
850
|
+
* If 'items' is provided, only the specified fragments will be affected.
|
|
869
851
|
*
|
|
870
|
-
* @param
|
|
852
|
+
* @param visible - The visibility state to set for the fragments.
|
|
853
|
+
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
854
|
+
* If not provided, all fragments will be affected.
|
|
855
|
+
*
|
|
856
|
+
* @returns {void}
|
|
871
857
|
*/
|
|
872
|
-
|
|
858
|
+
set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
|
|
873
859
|
/**
|
|
874
|
-
*
|
|
875
|
-
*
|
|
876
|
-
*
|
|
877
|
-
* @param filter - An optional object containing filter criteria.
|
|
878
|
-
* The keys of the object represent the classification system names,
|
|
879
|
-
* and the values are arrays of class names to match.
|
|
860
|
+
* Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
|
|
861
|
+
* It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
|
|
880
862
|
*
|
|
881
|
-
* @
|
|
882
|
-
*
|
|
863
|
+
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
864
|
+
* If not provided, all fragments will be isolated.
|
|
883
865
|
*
|
|
884
|
-
* @
|
|
866
|
+
* @returns {void}
|
|
885
867
|
*/
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
868
|
+
isolate(items: FRAGS.FragmentIdMap): void;
|
|
869
|
+
private updateCulledVisibility;
|
|
870
|
+
}
|
|
871
|
+
import * as THREE from "three";
|
|
872
|
+
export declare class MaterialsUtils {
|
|
873
|
+
static isTransparent(material: THREE.Material): boolean;
|
|
874
|
+
}
|
|
875
|
+
import * as WEBIFC from "web-ifc";
|
|
876
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
877
|
+
import { IfcFragmentSettings } from "./src";
|
|
878
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
879
|
+
/**
|
|
880
|
+
* The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
|
|
881
|
+
*/
|
|
882
|
+
export declare class IfcLoader extends Component implements Disposable {
|
|
889
883
|
/**
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
893
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
894
|
-
*
|
|
895
|
-
* @remarks
|
|
896
|
-
* This method iterates through the fragments in the provided group,
|
|
897
|
-
* and classifies them based on their modelID.
|
|
898
|
-
* The classification is stored in the 'list.models' property,
|
|
899
|
-
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
900
|
-
*
|
|
884
|
+
* A unique identifier for the component.
|
|
885
|
+
* This UUID is used to register the component within the Components system.
|
|
901
886
|
*/
|
|
902
|
-
|
|
887
|
+
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
888
|
+
/** {@link Disposable.onDisposed} */
|
|
889
|
+
readonly onDisposed: Event<string>;
|
|
903
890
|
/**
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
907
|
-
*
|
|
908
|
-
* @remarks
|
|
909
|
-
* This method iterates through the properties of the fragments in the provided group,
|
|
910
|
-
* and classifies them based on their PredefinedType property.
|
|
911
|
-
* The classification is stored in the 'list.predefinedTypes' property,
|
|
912
|
-
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
913
|
-
*
|
|
914
|
-
* @throws Will throw an error if the fragment ID is not found.
|
|
891
|
+
* An event triggered when the IFC file starts loading.
|
|
915
892
|
*/
|
|
916
|
-
|
|
917
|
-
/**
|
|
918
|
-
* Classifies fragments based on their entity type.
|
|
919
|
-
*
|
|
920
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
921
|
-
*
|
|
922
|
-
* @remarks
|
|
923
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
924
|
-
* and classifies them based on their entity type.
|
|
925
|
-
* The classification is stored in the 'list.entities' property,
|
|
926
|
-
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
927
|
-
*
|
|
928
|
-
* @throws Will throw an error if the fragment ID is not found.
|
|
929
|
-
*/
|
|
930
|
-
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
931
|
-
/**
|
|
932
|
-
* Classifies fragments based on a specific IFC relationship.
|
|
933
|
-
*
|
|
934
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
935
|
-
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
936
|
-
* @param systemName - The name of the classification system to store the classification.
|
|
937
|
-
*
|
|
938
|
-
* @remarks
|
|
939
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
940
|
-
* and classifies them based on the specified IFC relationship.
|
|
941
|
-
* The classification is stored in the 'list' property under the specified system name,
|
|
942
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
943
|
-
*
|
|
944
|
-
* @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
|
|
945
|
-
*/
|
|
946
|
-
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
947
|
-
/**
|
|
948
|
-
* Classifies fragments based on their spatial structure in the IFC model.
|
|
949
|
-
*
|
|
950
|
-
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
951
|
-
*
|
|
952
|
-
* @remarks
|
|
953
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
954
|
-
* and classifies them based on their spatial structure in the IFC model.
|
|
955
|
-
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
956
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
957
|
-
*
|
|
958
|
-
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
959
|
-
*/
|
|
960
|
-
bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
|
|
961
|
-
/**
|
|
962
|
-
* Sets the color of the specified fragments.
|
|
963
|
-
*
|
|
964
|
-
* @param items - A map of fragment IDs to their respective express IDs.
|
|
965
|
-
* @param color - The color to set for the fragments.
|
|
966
|
-
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
967
|
-
*
|
|
968
|
-
* @remarks
|
|
969
|
-
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
970
|
-
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
971
|
-
*
|
|
972
|
-
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
973
|
-
*/
|
|
974
|
-
setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
|
|
975
|
-
/**
|
|
976
|
-
* Resets the color of the specified fragments to their original color.
|
|
977
|
-
*
|
|
978
|
-
* @param items - A map of fragment IDs to their respective express IDs.
|
|
979
|
-
*
|
|
980
|
-
* @remarks
|
|
981
|
-
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
982
|
-
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
983
|
-
*
|
|
984
|
-
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
985
|
-
*/
|
|
986
|
-
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
987
|
-
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
|
|
988
|
-
}
|
|
989
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
990
|
-
import { Components, Component } from "../../core";
|
|
991
|
-
/**
|
|
992
|
-
* A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
|
|
993
|
-
*/
|
|
994
|
-
export declare class Hider extends Component {
|
|
995
|
-
/**
|
|
996
|
-
* A unique identifier for the component.
|
|
997
|
-
* This UUID is used to register the component within the Components system.
|
|
998
|
-
*/
|
|
999
|
-
static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
|
|
1000
|
-
/** {@link Component.enabled} */
|
|
1001
|
-
enabled: boolean;
|
|
1002
|
-
constructor(components: Components);
|
|
1003
|
-
/**
|
|
1004
|
-
* Sets the visibility of fragments within the 3D scene.
|
|
1005
|
-
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
1006
|
-
* If 'items' is provided, only the specified fragments will be affected.
|
|
1007
|
-
*
|
|
1008
|
-
* @param visible - The visibility state to set for the fragments.
|
|
1009
|
-
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
1010
|
-
* If not provided, all fragments will be affected.
|
|
1011
|
-
*
|
|
1012
|
-
* @returns {void}
|
|
1013
|
-
*/
|
|
1014
|
-
set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
|
|
1015
|
-
/**
|
|
1016
|
-
* Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
|
|
1017
|
-
* It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
|
|
1018
|
-
*
|
|
1019
|
-
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
1020
|
-
* If not provided, all fragments will be isolated.
|
|
1021
|
-
*
|
|
1022
|
-
* @returns {void}
|
|
1023
|
-
*/
|
|
1024
|
-
isolate(items: FRAGS.FragmentIdMap): void;
|
|
1025
|
-
private updateCulledVisibility;
|
|
1026
|
-
}
|
|
1027
|
-
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1028
|
-
import * as THREE from "three";
|
|
1029
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1030
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
1031
|
-
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
1032
|
-
/**
|
|
1033
|
-
* Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
|
|
1034
|
-
*/
|
|
1035
|
-
export declare class FragmentsManager extends Component implements Disposable {
|
|
1036
|
-
/**
|
|
1037
|
-
* A unique identifier for the component.
|
|
1038
|
-
* This UUID is used to register the component within the Components system.
|
|
1039
|
-
*/
|
|
1040
|
-
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1041
|
-
/** {@link Disposable.onDisposed} */
|
|
1042
|
-
readonly onDisposed: Event<unknown>;
|
|
1043
|
-
/**
|
|
1044
|
-
* Event triggered when fragments are loaded.
|
|
1045
|
-
*/
|
|
1046
|
-
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1047
|
-
/**
|
|
1048
|
-
* Event triggered when fragments are disposed.
|
|
1049
|
-
*/
|
|
1050
|
-
readonly onFragmentsDisposed: Event<{
|
|
1051
|
-
groupID: string;
|
|
1052
|
-
fragmentIDs: string[];
|
|
1053
|
-
}>;
|
|
1054
|
-
/**
|
|
1055
|
-
* Map containing all loaded fragments.
|
|
1056
|
-
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
1057
|
-
*/
|
|
1058
|
-
readonly list: Map<string, Fragment>;
|
|
1059
|
-
/**
|
|
1060
|
-
* Map containing all loaded fragment groups.
|
|
1061
|
-
* The key is the group's unique identifier, and the value is the group itself.
|
|
1062
|
-
*/
|
|
1063
|
-
readonly groups: Map<string, FragmentsGroup>;
|
|
1064
|
-
baseCoordinationModel: string;
|
|
1065
|
-
/** {@link Component.enabled} */
|
|
1066
|
-
enabled: boolean;
|
|
1067
|
-
private _loader;
|
|
1068
|
-
/**
|
|
1069
|
-
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
1070
|
-
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1071
|
-
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1072
|
-
*/
|
|
1073
|
-
get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
|
|
1074
|
-
constructor(components: Components);
|
|
1075
|
-
/** {@link Disposable.dispose} */
|
|
1076
|
-
dispose(): void;
|
|
1077
|
-
/**
|
|
1078
|
-
* Dispose of a specific fragment group.
|
|
1079
|
-
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1080
|
-
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1081
|
-
*
|
|
1082
|
-
* @param group - The fragment group to be disposed.
|
|
1083
|
-
*/
|
|
1084
|
-
disposeGroup(group: FragmentsGroup): void;
|
|
1085
|
-
/**
|
|
1086
|
-
* Loads a binary file that contain fragment geometry.
|
|
1087
|
-
* @param data - The binary data to load.
|
|
1088
|
-
* @param config - Optional configuration for loading.
|
|
1089
|
-
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
1090
|
-
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1091
|
-
* @returns The loaded FragmentsGroup.
|
|
1092
|
-
*/
|
|
1093
|
-
load(data: Uint8Array, config?: Partial<{
|
|
1094
|
-
coordinate: boolean;
|
|
1095
|
-
name: string;
|
|
1096
|
-
properties: FRAGS.IfcProperties;
|
|
1097
|
-
relationsMap: RelationsMap;
|
|
1098
|
-
}>): FragmentsGroup;
|
|
1099
|
-
/**
|
|
1100
|
-
* Export the specified fragmentsgroup to binary data.
|
|
1101
|
-
* @param group - the fragments group to be exported.
|
|
1102
|
-
* @returns the exported data as binary buffer.
|
|
1103
|
-
*/
|
|
1104
|
-
export(group: FragmentsGroup): Uint8Array;
|
|
1105
|
-
/**
|
|
1106
|
-
* Gets a map of model IDs to sets of express IDs for the given fragment ID map.
|
|
1107
|
-
* @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
|
|
1108
|
-
* @returns A map of model IDs to sets of express IDs.
|
|
1109
|
-
*/
|
|
1110
|
-
getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
|
|
1111
|
-
[modelID: string]: Set<number>;
|
|
1112
|
-
};
|
|
1113
|
-
/**
|
|
1114
|
-
* Converts a map of model IDs to sets of express IDs to a fragment ID map.
|
|
1115
|
-
* @param modelIdMap - A map of model IDs to their corresponding express IDs.
|
|
1116
|
-
* @returns A fragment ID map.
|
|
1117
|
-
* @remarks
|
|
1118
|
-
* This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
|
|
1119
|
-
* and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
|
|
1120
|
-
* The fragment ID maps are then merged into a single map and returned.
|
|
1121
|
-
* If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
|
|
1122
|
-
*/
|
|
1123
|
-
modelIdToFragmentIdMap(modelIdMap: {
|
|
1124
|
-
[modelID: string]: Set<number>;
|
|
1125
|
-
}): FRAGS.FragmentIdMap;
|
|
1126
|
-
/**
|
|
1127
|
-
* Applies coordinate transformation to the provided models.
|
|
1128
|
-
* If no models are provided, all groups are used.
|
|
1129
|
-
* The first model in the list becomes the base model for coordinate transformation.
|
|
1130
|
-
* All other models are then transformed to match the base model's coordinate system.
|
|
1131
|
-
*
|
|
1132
|
-
* @param models - The models to apply coordinate transformation to.
|
|
1133
|
-
* If not provided, all groups are used.
|
|
1134
|
-
*
|
|
1135
|
-
* @returns {void}
|
|
1136
|
-
*/
|
|
1137
|
-
coordinate(models?: FragmentsGroup[]): void;
|
|
1138
|
-
}
|
|
1139
|
-
import * as WEBIFC from "web-ifc";
|
|
1140
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1141
|
-
import { IfcFragmentSettings } from "./src";
|
|
1142
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
1143
|
-
/**
|
|
1144
|
-
* The IfcLoader component is responsible for loading and processing IFC files. It utilizes the Web-IFC library to handle the IFC data and the Three.js library for 3D rendering. The class provides methods for setting up, loading, and cleaning up IFC files. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcLoader). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcLoader).
|
|
1145
|
-
*/
|
|
1146
|
-
export declare class IfcLoader extends Component implements Disposable {
|
|
1147
|
-
/**
|
|
1148
|
-
* A unique identifier for the component.
|
|
1149
|
-
* This UUID is used to register the component within the Components system.
|
|
1150
|
-
*/
|
|
1151
|
-
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
1152
|
-
/** {@link Disposable.onDisposed} */
|
|
1153
|
-
readonly onDisposed: Event<string>;
|
|
1154
|
-
/**
|
|
1155
|
-
* An event triggered when the IFC file starts loading.
|
|
1156
|
-
*/
|
|
1157
|
-
readonly onIfcStartedLoading: Event<void>;
|
|
893
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
1158
894
|
/**
|
|
1159
895
|
* An event triggered when the setup process is completed.
|
|
1160
896
|
*/
|
|
@@ -1349,21 +1085,126 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
|
|
|
1349
1085
|
private streamAssets;
|
|
1350
1086
|
private streamGeometries;
|
|
1351
1087
|
}
|
|
1352
|
-
import * as
|
|
1353
|
-
import
|
|
1354
|
-
import {
|
|
1088
|
+
import * as THREE from "three";
|
|
1089
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1090
|
+
import { Component, Components } from "../../core";
|
|
1355
1091
|
/**
|
|
1356
|
-
*
|
|
1092
|
+
* Represents an edge measurement result.
|
|
1357
1093
|
*/
|
|
1358
|
-
export
|
|
1094
|
+
export interface MeasureEdge {
|
|
1359
1095
|
/**
|
|
1360
|
-
*
|
|
1361
|
-
* This UUID is used to register the component within the Components system.
|
|
1096
|
+
* The distance between the two points of the edge.
|
|
1362
1097
|
*/
|
|
1363
|
-
|
|
1098
|
+
distance: number;
|
|
1364
1099
|
/**
|
|
1365
|
-
*
|
|
1366
|
-
|
|
1100
|
+
* The two points that define the edge.
|
|
1101
|
+
*/
|
|
1102
|
+
points: THREE.Vector3[];
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
|
|
1106
|
+
*/
|
|
1107
|
+
export declare class MeasurementUtils extends Component {
|
|
1108
|
+
/**
|
|
1109
|
+
* A unique identifier for the component.
|
|
1110
|
+
* This UUID is used to register the component within the Components system.
|
|
1111
|
+
*/
|
|
1112
|
+
static uuid: string;
|
|
1113
|
+
/** {@link Component.enabled} */
|
|
1114
|
+
enabled: boolean;
|
|
1115
|
+
constructor(components: Components);
|
|
1116
|
+
/**
|
|
1117
|
+
* Utility method to calculate the distance from a point to a line segment.
|
|
1118
|
+
*
|
|
1119
|
+
* @param point - The point from which to calculate the distance.
|
|
1120
|
+
* @param lineStart - The start point of the line segment.
|
|
1121
|
+
* @param lineEnd - The end point of the line segment.
|
|
1122
|
+
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
1123
|
+
* @returns The distance from the point to the line segment.
|
|
1124
|
+
*/
|
|
1125
|
+
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
1126
|
+
/**
|
|
1127
|
+
* Method to get the face of a mesh that contains a given triangle index.
|
|
1128
|
+
* It also returns the edges of the found face and their indices.
|
|
1129
|
+
*
|
|
1130
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1131
|
+
* @param triangleIndex - The index of the triangle within the mesh.
|
|
1132
|
+
* @param instance - The instance of the mesh (optional).
|
|
1133
|
+
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
1134
|
+
*/
|
|
1135
|
+
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
1136
|
+
edges: MeasureEdge[];
|
|
1137
|
+
indices: Set<number>;
|
|
1138
|
+
} | null;
|
|
1139
|
+
/**
|
|
1140
|
+
* Method to get the vertices and normal of a mesh face at a given index.
|
|
1141
|
+
* It also applies instance transformation if provided.
|
|
1142
|
+
*
|
|
1143
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1144
|
+
* @param faceIndex - The index of the face within the mesh.
|
|
1145
|
+
* @param instance - The instance of the mesh (optional).
|
|
1146
|
+
* @returns An object containing the vertices and normal of the face.
|
|
1147
|
+
* @throws Will throw an error if the geometry is not indexed.
|
|
1148
|
+
*/
|
|
1149
|
+
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
1150
|
+
p1: THREE.Vector3;
|
|
1151
|
+
p2: THREE.Vector3;
|
|
1152
|
+
p3: THREE.Vector3;
|
|
1153
|
+
faceNormal: THREE.Vector3;
|
|
1154
|
+
};
|
|
1155
|
+
/**
|
|
1156
|
+
* Method to round the vector's components to a specified number of decimal places.
|
|
1157
|
+
* This is used to ensure numerical precision in edge detection.
|
|
1158
|
+
*
|
|
1159
|
+
* @param vector - The vector to round.
|
|
1160
|
+
* @returns The vector with rounded components.
|
|
1161
|
+
*/
|
|
1162
|
+
round(vector: THREE.Vector3): void;
|
|
1163
|
+
/**
|
|
1164
|
+
* Calculates the volume of a set of fragments.
|
|
1165
|
+
*
|
|
1166
|
+
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
1167
|
+
* @returns The total volume of the fragments and the bounding sphere.
|
|
1168
|
+
*
|
|
1169
|
+
* @remarks
|
|
1170
|
+
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
1171
|
+
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
1172
|
+
*
|
|
1173
|
+
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
1174
|
+
* @throws Will throw an error if the fragment manager is not available.
|
|
1175
|
+
*/
|
|
1176
|
+
getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
|
|
1177
|
+
/**
|
|
1178
|
+
* Calculates the total volume of a set of meshes.
|
|
1179
|
+
*
|
|
1180
|
+
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
1181
|
+
* @returns The total volume of the meshes and the bounding sphere.
|
|
1182
|
+
*
|
|
1183
|
+
* @remarks
|
|
1184
|
+
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
1185
|
+
* and its bounding sphere.
|
|
1186
|
+
*
|
|
1187
|
+
*/
|
|
1188
|
+
getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
|
|
1189
|
+
private getFaceData;
|
|
1190
|
+
private getVolumeOfMesh;
|
|
1191
|
+
private getSignedVolumeOfTriangle;
|
|
1192
|
+
}
|
|
1193
|
+
import * as WEBIFC from "web-ifc";
|
|
1194
|
+
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
1195
|
+
import { PropertiesStreamingSettings } from "./src";
|
|
1196
|
+
/**
|
|
1197
|
+
* A component that converts the properties of an IFC file to tiles. It uses the Web-IFC library to read and process the IFC data. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcPropertiesTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcPropertiesTiler).
|
|
1198
|
+
*/
|
|
1199
|
+
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
1200
|
+
/**
|
|
1201
|
+
* A unique identifier for the component.
|
|
1202
|
+
* This UUID is used to register the component within the Components system.
|
|
1203
|
+
*/
|
|
1204
|
+
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
1205
|
+
/**
|
|
1206
|
+
* An event that is triggered when properties are streamed from the IFC file.
|
|
1207
|
+
* The event provides the type of the IFC entity and the corresponding data.
|
|
1367
1208
|
*/
|
|
1368
1209
|
readonly onPropertiesStreamed: AsyncEvent<{
|
|
1369
1210
|
type: number;
|
|
@@ -1414,160 +1255,306 @@ export declare class IfcPropertiesTiler extends Component implements Disposable
|
|
|
1414
1255
|
private streamAllProperties;
|
|
1415
1256
|
private cleanUp;
|
|
1416
1257
|
}
|
|
1258
|
+
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1417
1259
|
import * as THREE from "three";
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
rotation: THREE.Matrix3;
|
|
1422
|
-
transformation: THREE.Matrix4;
|
|
1423
|
-
};
|
|
1424
|
-
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
1425
|
-
import * as WEBIFC from "web-ifc";
|
|
1426
|
-
import * as FRAG from "@thatopen/fragments";
|
|
1427
|
-
import { Component, Components } from "../../core";
|
|
1260
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1261
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1262
|
+
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
1428
1263
|
/**
|
|
1429
|
-
* Component to
|
|
1264
|
+
* Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
|
|
1430
1265
|
*/
|
|
1431
|
-
export declare class
|
|
1266
|
+
export declare class FragmentsManager extends Component implements Disposable {
|
|
1432
1267
|
/**
|
|
1433
1268
|
* A unique identifier for the component.
|
|
1434
1269
|
* This UUID is used to register the component within the Components system.
|
|
1435
1270
|
*/
|
|
1436
|
-
static readonly uuid: "
|
|
1437
|
-
/** {@link
|
|
1438
|
-
|
|
1439
|
-
constructor(components: Components);
|
|
1271
|
+
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1272
|
+
/** {@link Disposable.onDisposed} */
|
|
1273
|
+
readonly onDisposed: Event<unknown>;
|
|
1440
1274
|
/**
|
|
1441
|
-
*
|
|
1442
|
-
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
1443
|
-
* @param modelID ID of the IFC model whose properties to extract.
|
|
1444
|
-
* @param indirect whether to get the indirect relationships as well.
|
|
1445
|
-
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
1446
|
-
* to make the location data available (e.g. absolute position of building).
|
|
1275
|
+
* Event triggered when fragments are loaded.
|
|
1447
1276
|
*/
|
|
1448
|
-
|
|
1449
|
-
}
|
|
1450
|
-
import * as THREE from "three";
|
|
1451
|
-
export declare class MaterialsUtils {
|
|
1452
|
-
static isTransparent(material: THREE.Material): boolean;
|
|
1453
|
-
}
|
|
1454
|
-
export declare class UUID {
|
|
1455
|
-
private static _pattern;
|
|
1456
|
-
private static _lut;
|
|
1457
|
-
static create(): string;
|
|
1458
|
-
static validate(uuid: string): void;
|
|
1459
|
-
}
|
|
1460
|
-
import * as THREE from "three";
|
|
1461
|
-
import { Component, Components, Disposable, Event, World } from "../core";
|
|
1462
|
-
/**
|
|
1463
|
-
* Configuration interface for the VertexPicker component.
|
|
1464
|
-
*/
|
|
1465
|
-
export interface VertexPickerConfig {
|
|
1277
|
+
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1466
1278
|
/**
|
|
1467
|
-
*
|
|
1279
|
+
* Event triggered when fragments are disposed.
|
|
1468
1280
|
*/
|
|
1469
|
-
|
|
1281
|
+
readonly onFragmentsDisposed: Event<{
|
|
1282
|
+
groupID: string;
|
|
1283
|
+
fragmentIDs: string[];
|
|
1284
|
+
}>;
|
|
1470
1285
|
/**
|
|
1471
|
-
*
|
|
1286
|
+
* Map containing all loaded fragments.
|
|
1287
|
+
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
1472
1288
|
*/
|
|
1473
|
-
|
|
1289
|
+
readonly list: Map<string, Fragment>;
|
|
1474
1290
|
/**
|
|
1475
|
-
*
|
|
1291
|
+
* Map containing all loaded fragment groups.
|
|
1292
|
+
* The key is the group's unique identifier, and the value is the group itself.
|
|
1476
1293
|
*/
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
/**
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
export declare class VertexPicker extends Component implements Disposable {
|
|
1483
|
-
/** {@link Disposable.onDisposed} */
|
|
1484
|
-
readonly onDisposed: Event<unknown>;
|
|
1294
|
+
readonly groups: Map<string, FragmentsGroup>;
|
|
1295
|
+
baseCoordinationModel: string;
|
|
1296
|
+
/** {@link Component.enabled} */
|
|
1297
|
+
enabled: boolean;
|
|
1298
|
+
private _loader;
|
|
1485
1299
|
/**
|
|
1486
|
-
*
|
|
1487
|
-
*
|
|
1300
|
+
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
1301
|
+
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1302
|
+
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1488
1303
|
*/
|
|
1489
|
-
|
|
1304
|
+
get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
|
|
1305
|
+
constructor(components: Components);
|
|
1306
|
+
/** {@link Disposable.dispose} */
|
|
1307
|
+
dispose(): void;
|
|
1490
1308
|
/**
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1309
|
+
* Dispose of a specific fragment group.
|
|
1310
|
+
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1311
|
+
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1312
|
+
*
|
|
1313
|
+
* @param group - The fragment group to be disposed.
|
|
1493
1314
|
*/
|
|
1494
|
-
|
|
1315
|
+
disposeGroup(group: FragmentsGroup): void;
|
|
1495
1316
|
/**
|
|
1496
|
-
*
|
|
1317
|
+
* Loads a binary file that contain fragment geometry.
|
|
1318
|
+
* @param data - The binary data to load.
|
|
1319
|
+
* @param config - Optional configuration for loading.
|
|
1320
|
+
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
1321
|
+
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1322
|
+
* @returns The loaded FragmentsGroup.
|
|
1497
1323
|
*/
|
|
1498
|
-
|
|
1324
|
+
load(data: Uint8Array, config?: Partial<{
|
|
1325
|
+
coordinate: boolean;
|
|
1326
|
+
name: string;
|
|
1327
|
+
properties: FRAGS.IfcProperties;
|
|
1328
|
+
relationsMap: RelationsMap;
|
|
1329
|
+
}>): FragmentsGroup;
|
|
1499
1330
|
/**
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
1502
|
-
*
|
|
1331
|
+
* Export the specified fragmentsgroup to binary data.
|
|
1332
|
+
* @param group - the fragments group to be exported.
|
|
1333
|
+
* @returns the exported data as binary buffer.
|
|
1503
1334
|
*/
|
|
1504
|
-
|
|
1505
|
-
private _pickedPoint;
|
|
1506
|
-
private _config;
|
|
1507
|
-
private _enabled;
|
|
1335
|
+
export(group: FragmentsGroup): Uint8Array;
|
|
1508
1336
|
/**
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1511
|
-
*
|
|
1512
|
-
*
|
|
1513
|
-
* @param value - The new enabled state.
|
|
1337
|
+
* Gets a map of model IDs to sets of express IDs for the given fragment ID map.
|
|
1338
|
+
* @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
|
|
1339
|
+
* @returns A map of model IDs to sets of express IDs.
|
|
1514
1340
|
*/
|
|
1515
|
-
|
|
1341
|
+
getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
|
|
1342
|
+
[modelID: string]: Set<number>;
|
|
1343
|
+
};
|
|
1516
1344
|
/**
|
|
1517
|
-
*
|
|
1518
|
-
*
|
|
1519
|
-
* @returns
|
|
1345
|
+
* Converts a map of model IDs to sets of express IDs to a fragment ID map.
|
|
1346
|
+
* @param modelIdMap - A map of model IDs to their corresponding express IDs.
|
|
1347
|
+
* @returns A fragment ID map.
|
|
1348
|
+
* @remarks
|
|
1349
|
+
* This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
|
|
1350
|
+
* and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
|
|
1351
|
+
* The fragment ID maps are then merged into a single map and returned.
|
|
1352
|
+
* If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
|
|
1520
1353
|
*/
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1354
|
+
modelIdToFragmentIdMap(modelIdMap: {
|
|
1355
|
+
[modelID: string]: Set<number>;
|
|
1356
|
+
}): FRAGS.FragmentIdMap;
|
|
1357
|
+
/**
|
|
1358
|
+
* Applies coordinate transformation to the provided models.
|
|
1359
|
+
* If no models are provided, all groups are used.
|
|
1360
|
+
* The first model in the list becomes the base model for coordinate transformation.
|
|
1361
|
+
* All other models are then transformed to match the base model's coordinate system.
|
|
1524
1362
|
*
|
|
1525
|
-
* @param
|
|
1526
|
-
*
|
|
1363
|
+
* @param models - The models to apply coordinate transformation to.
|
|
1364
|
+
* If not provided, all groups are used.
|
|
1527
1365
|
*
|
|
1528
|
-
* @
|
|
1529
|
-
* '''typescript
|
|
1530
|
-
* vertexPicker.config = {
|
|
1531
|
-
* snapDistance: 0.5,
|
|
1532
|
-
* showOnlyVertex: true,
|
|
1533
|
-
* };
|
|
1534
|
-
* '''
|
|
1366
|
+
* @returns {void}
|
|
1535
1367
|
*/
|
|
1536
|
-
|
|
1368
|
+
coordinate(models?: FragmentsGroup[]): void;
|
|
1369
|
+
}
|
|
1370
|
+
import * as THREE from "three";
|
|
1371
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1372
|
+
import { Disposable, Component, Event, Components } from "../../core";
|
|
1373
|
+
/**
|
|
1374
|
+
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs to their respective express IDs.
|
|
1375
|
+
*/
|
|
1376
|
+
export interface Classification {
|
|
1537
1377
|
/**
|
|
1538
|
-
*
|
|
1539
|
-
*
|
|
1540
|
-
* @returns A copy of the current VertexPickerConfig object.
|
|
1541
|
-
*
|
|
1542
|
-
* @example
|
|
1543
|
-
* '''typescript
|
|
1544
|
-
* const currentConfig = vertexPicker.config;
|
|
1545
|
-
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
1546
|
-
* '''
|
|
1378
|
+
* A system within the classification.
|
|
1379
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1547
1380
|
*/
|
|
1548
|
-
|
|
1549
|
-
|
|
1381
|
+
[system: string]: {
|
|
1382
|
+
/**
|
|
1383
|
+
* A class within the system.
|
|
1384
|
+
* The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
|
|
1385
|
+
*/
|
|
1386
|
+
[className: string]: FRAGS.FragmentIdMap;
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
|
|
1391
|
+
*/
|
|
1392
|
+
export declare class Classifier extends Component implements Disposable {
|
|
1393
|
+
/**
|
|
1394
|
+
* A unique identifier for the component.
|
|
1395
|
+
* This UUID is used to register the component within the Components system.
|
|
1396
|
+
*/
|
|
1397
|
+
static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
|
|
1398
|
+
/** {@link Component.enabled} */
|
|
1399
|
+
enabled: boolean;
|
|
1400
|
+
/**
|
|
1401
|
+
* A map representing the classification systems.
|
|
1402
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1403
|
+
*/
|
|
1404
|
+
list: Classification;
|
|
1405
|
+
/** {@link Disposable.onDisposed} */
|
|
1406
|
+
readonly onDisposed: Event<unknown>;
|
|
1407
|
+
constructor(components: Components);
|
|
1408
|
+
private onFragmentsDisposed;
|
|
1550
1409
|
/** {@link Disposable.dispose} */
|
|
1551
1410
|
dispose(): void;
|
|
1552
1411
|
/**
|
|
1553
|
-
*
|
|
1412
|
+
* Removes a fragment from the classification based on its unique identifier (guid).
|
|
1413
|
+
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
1554
1414
|
*
|
|
1555
|
-
* @param
|
|
1415
|
+
* @param guid - The unique identifier of the fragment to be removed.
|
|
1416
|
+
*/
|
|
1417
|
+
remove(guid: string): void;
|
|
1418
|
+
/**
|
|
1419
|
+
* Finds and returns fragments based on the provided filter criteria.
|
|
1420
|
+
* If no filter is provided, it returns all fragments.
|
|
1556
1421
|
*
|
|
1557
|
-
* @
|
|
1422
|
+
* @param filter - An optional object containing filter criteria.
|
|
1423
|
+
* The keys of the object represent the classification system names,
|
|
1424
|
+
* and the values are arrays of class names to match.
|
|
1425
|
+
*
|
|
1426
|
+
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
1427
|
+
* where the express IDs are filtered based on the provided filter criteria.
|
|
1428
|
+
*
|
|
1429
|
+
* @throws Will throw an error if the fragments map is malformed.
|
|
1430
|
+
*/
|
|
1431
|
+
find(filter?: {
|
|
1432
|
+
[name: string]: string[];
|
|
1433
|
+
}): FRAGS.FragmentIdMap;
|
|
1434
|
+
/**
|
|
1435
|
+
* Classifies fragments based on their modelID.
|
|
1436
|
+
*
|
|
1437
|
+
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
1438
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1558
1439
|
*
|
|
1559
1440
|
* @remarks
|
|
1560
|
-
* This method
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1563
|
-
*
|
|
1564
|
-
*
|
|
1565
|
-
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
1441
|
+
* This method iterates through the fragments in the provided group,
|
|
1442
|
+
* and classifies them based on their modelID.
|
|
1443
|
+
* The classification is stored in the 'list.models' property,
|
|
1444
|
+
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1445
|
+
*
|
|
1566
1446
|
*/
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1447
|
+
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
1448
|
+
/**
|
|
1449
|
+
* Classifies fragments based on their PredefinedType property.
|
|
1450
|
+
*
|
|
1451
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1452
|
+
*
|
|
1453
|
+
* @remarks
|
|
1454
|
+
* This method iterates through the properties of the fragments in the provided group,
|
|
1455
|
+
* and classifies them based on their PredefinedType property.
|
|
1456
|
+
* The classification is stored in the 'list.predefinedTypes' property,
|
|
1457
|
+
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1458
|
+
*
|
|
1459
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
1460
|
+
*/
|
|
1461
|
+
byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
|
|
1462
|
+
/**
|
|
1463
|
+
* Classifies fragments based on their entity type.
|
|
1464
|
+
*
|
|
1465
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1466
|
+
*
|
|
1467
|
+
* @remarks
|
|
1468
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
1469
|
+
* and classifies them based on their entity type.
|
|
1470
|
+
* The classification is stored in the 'list.entities' property,
|
|
1471
|
+
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1472
|
+
*
|
|
1473
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
1474
|
+
*/
|
|
1475
|
+
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
1476
|
+
/**
|
|
1477
|
+
* Classifies fragments based on a specific IFC relationship.
|
|
1478
|
+
*
|
|
1479
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1480
|
+
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
1481
|
+
* @param systemName - The name of the classification system to store the classification.
|
|
1482
|
+
*
|
|
1483
|
+
* @remarks
|
|
1484
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
1485
|
+
* and classifies them based on the specified IFC relationship.
|
|
1486
|
+
* The classification is stored in the 'list' property under the specified system name,
|
|
1487
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1488
|
+
*
|
|
1489
|
+
* @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
|
|
1490
|
+
*/
|
|
1491
|
+
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
1492
|
+
/**
|
|
1493
|
+
* Classifies fragments based on their spatial structure in the IFC model.
|
|
1494
|
+
*
|
|
1495
|
+
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
1496
|
+
*
|
|
1497
|
+
* @remarks
|
|
1498
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
1499
|
+
* and classifies them based on their spatial structure in the IFC model.
|
|
1500
|
+
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
1501
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1502
|
+
*
|
|
1503
|
+
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
1504
|
+
*/
|
|
1505
|
+
bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
|
|
1506
|
+
/**
|
|
1507
|
+
* Sets the color of the specified fragments.
|
|
1508
|
+
*
|
|
1509
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
1510
|
+
* @param color - The color to set for the fragments.
|
|
1511
|
+
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
1512
|
+
*
|
|
1513
|
+
* @remarks
|
|
1514
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
1515
|
+
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
1516
|
+
*
|
|
1517
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
1518
|
+
*/
|
|
1519
|
+
setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
|
|
1520
|
+
/**
|
|
1521
|
+
* Resets the color of the specified fragments to their original color.
|
|
1522
|
+
*
|
|
1523
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
1524
|
+
*
|
|
1525
|
+
* @remarks
|
|
1526
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
1527
|
+
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
1528
|
+
*
|
|
1529
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
1530
|
+
*/
|
|
1531
|
+
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
1532
|
+
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
|
|
1533
|
+
}
|
|
1534
|
+
import * as WEBIFC from "web-ifc";
|
|
1535
|
+
import * as FRAG from "@thatopen/fragments";
|
|
1536
|
+
import { Component, Components } from "../../core";
|
|
1537
|
+
/**
|
|
1538
|
+
* Component to export all the properties from an IFC to a JS object. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcJsonExporter). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcJsonExporter).
|
|
1539
|
+
*/
|
|
1540
|
+
export declare class IfcJsonExporter extends Component {
|
|
1541
|
+
/**
|
|
1542
|
+
* A unique identifier for the component.
|
|
1543
|
+
* This UUID is used to register the component within the Components system.
|
|
1544
|
+
*/
|
|
1545
|
+
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
1546
|
+
/** {@link Component.enabled} */
|
|
1547
|
+
enabled: boolean;
|
|
1548
|
+
constructor(components: Components);
|
|
1549
|
+
/**
|
|
1550
|
+
* Exports all the properties of an IFC into an array of JS objects.
|
|
1551
|
+
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
1552
|
+
* @param modelID ID of the IFC model whose properties to extract.
|
|
1553
|
+
* @param indirect whether to get the indirect relationships as well.
|
|
1554
|
+
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
1555
|
+
* to make the location data available (e.g. absolute position of building).
|
|
1556
|
+
*/
|
|
1557
|
+
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
1571
1558
|
}
|
|
1572
1559
|
import * as WEBIFC from "web-ifc";
|
|
1573
1560
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
@@ -1966,115 +1953,169 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
|
|
|
1966
1953
|
private registerChange;
|
|
1967
1954
|
private newSingleProperty;
|
|
1968
1955
|
}
|
|
1956
|
+
export declare class UUID {
|
|
1957
|
+
private static _pattern;
|
|
1958
|
+
private static _lut;
|
|
1959
|
+
static create(): string;
|
|
1960
|
+
static validate(uuid: string): void;
|
|
1961
|
+
}
|
|
1969
1962
|
import * as THREE from "three";
|
|
1970
|
-
import
|
|
1971
|
-
import { Component, Components } from "../../core";
|
|
1963
|
+
import { Component, Components, Disposable, Event, World } from "../core";
|
|
1972
1964
|
/**
|
|
1973
|
-
*
|
|
1965
|
+
* Configuration interface for the VertexPicker component.
|
|
1974
1966
|
*/
|
|
1975
|
-
export interface
|
|
1967
|
+
export interface VertexPickerConfig {
|
|
1976
1968
|
/**
|
|
1977
|
-
*
|
|
1969
|
+
* If true, only vertices will be picked, not the closest point on the face.
|
|
1978
1970
|
*/
|
|
1979
|
-
|
|
1971
|
+
showOnlyVertex: boolean;
|
|
1980
1972
|
/**
|
|
1981
|
-
* The
|
|
1973
|
+
* The maximum distance for snapping to a vertex.
|
|
1982
1974
|
*/
|
|
1983
|
-
|
|
1975
|
+
snapDistance: number;
|
|
1976
|
+
/**
|
|
1977
|
+
* The HTML element to use for previewing the picked vertex.
|
|
1978
|
+
*/
|
|
1979
|
+
previewElement: HTMLElement;
|
|
1984
1980
|
}
|
|
1985
1981
|
/**
|
|
1986
|
-
*
|
|
1982
|
+
* A class that provides functionality for picking vertices in a 3D scene.
|
|
1987
1983
|
*/
|
|
1988
|
-
export declare class
|
|
1984
|
+
export declare class VertexPicker extends Component implements Disposable {
|
|
1985
|
+
/** {@link Disposable.onDisposed} */
|
|
1986
|
+
readonly onDisposed: Event<unknown>;
|
|
1989
1987
|
/**
|
|
1990
|
-
*
|
|
1991
|
-
*
|
|
1988
|
+
* An event that is triggered when a vertex is found.
|
|
1989
|
+
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
1992
1990
|
*/
|
|
1993
|
-
|
|
1994
|
-
/** {@link Component.enabled} */
|
|
1995
|
-
enabled: boolean;
|
|
1996
|
-
constructor(components: Components);
|
|
1991
|
+
readonly onVertexFound: Event<THREE.Vector3>;
|
|
1997
1992
|
/**
|
|
1998
|
-
*
|
|
1999
|
-
*
|
|
2000
|
-
* @param point - The point from which to calculate the distance.
|
|
2001
|
-
* @param lineStart - The start point of the line segment.
|
|
2002
|
-
* @param lineEnd - The end point of the line segment.
|
|
2003
|
-
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
2004
|
-
* @returns The distance from the point to the line segment.
|
|
1993
|
+
* An event that is triggered when a vertex is lost.
|
|
1994
|
+
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
2005
1995
|
*/
|
|
2006
|
-
|
|
1996
|
+
readonly onVertexLost: Event<THREE.Vector3>;
|
|
2007
1997
|
/**
|
|
2008
|
-
*
|
|
2009
|
-
* It also returns the edges of the found face and their indices.
|
|
2010
|
-
*
|
|
2011
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
2012
|
-
* @param triangleIndex - The index of the triangle within the mesh.
|
|
2013
|
-
* @param instance - The instance of the mesh (optional).
|
|
2014
|
-
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
1998
|
+
* An event that is triggered when the picker is enabled or disabled
|
|
2015
1999
|
*/
|
|
2016
|
-
|
|
2017
|
-
edges: MeasureEdge[];
|
|
2018
|
-
indices: Set<number>;
|
|
2019
|
-
} | null;
|
|
2000
|
+
readonly onEnabled: Event<boolean>;
|
|
2020
2001
|
/**
|
|
2021
|
-
*
|
|
2022
|
-
|
|
2002
|
+
* A reference to the Components instance associated with this VertexPicker.
|
|
2003
|
+
*/
|
|
2004
|
+
components: Components;
|
|
2005
|
+
/**
|
|
2006
|
+
* A reference to the working plane used for vertex picking.
|
|
2007
|
+
* This plane is used to determine which vertices are considered valid for picking.
|
|
2008
|
+
* If this value is null, all vertices are considered valid.
|
|
2009
|
+
*/
|
|
2010
|
+
workingPlane: THREE.Plane | null;
|
|
2011
|
+
private _pickedPoint;
|
|
2012
|
+
private _config;
|
|
2013
|
+
private _enabled;
|
|
2014
|
+
/**
|
|
2015
|
+
* Sets the enabled state of the VertexPicker.
|
|
2016
|
+
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
2017
|
+
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
2023
2018
|
*
|
|
2024
|
-
* @param
|
|
2025
|
-
* @param faceIndex - The index of the face within the mesh.
|
|
2026
|
-
* @param instance - The instance of the mesh (optional).
|
|
2027
|
-
* @returns An object containing the vertices and normal of the face.
|
|
2028
|
-
* @throws Will throw an error if the geometry is not indexed.
|
|
2019
|
+
* @param value - The new enabled state.
|
|
2029
2020
|
*/
|
|
2030
|
-
|
|
2031
|
-
p1: THREE.Vector3;
|
|
2032
|
-
p2: THREE.Vector3;
|
|
2033
|
-
p3: THREE.Vector3;
|
|
2034
|
-
faceNormal: THREE.Vector3;
|
|
2035
|
-
};
|
|
2021
|
+
set enabled(value: boolean);
|
|
2036
2022
|
/**
|
|
2037
|
-
*
|
|
2038
|
-
* This is used to ensure numerical precision in edge detection.
|
|
2023
|
+
* Gets the current enabled state of the VertexPicker.
|
|
2039
2024
|
*
|
|
2040
|
-
* @
|
|
2041
|
-
* @returns The vector with rounded components.
|
|
2025
|
+
* @returns The current enabled state.
|
|
2042
2026
|
*/
|
|
2043
|
-
|
|
2027
|
+
get enabled(): boolean;
|
|
2044
2028
|
/**
|
|
2045
|
-
*
|
|
2029
|
+
* Sets the configuration for the VertexPicker component.
|
|
2046
2030
|
*
|
|
2047
|
-
* @param
|
|
2048
|
-
*
|
|
2031
|
+
* @param value - A Partial object containing the configuration properties to update.
|
|
2032
|
+
* The properties not provided in the value object will retain their current values.
|
|
2049
2033
|
*
|
|
2050
|
-
* @
|
|
2051
|
-
*
|
|
2052
|
-
*
|
|
2034
|
+
* @example
|
|
2035
|
+
* '''typescript
|
|
2036
|
+
* vertexPicker.config = {
|
|
2037
|
+
* snapDistance: 0.5,
|
|
2038
|
+
* showOnlyVertex: true,
|
|
2039
|
+
* };
|
|
2040
|
+
* '''
|
|
2041
|
+
*/
|
|
2042
|
+
set config(value: Partial<VertexPickerConfig>);
|
|
2043
|
+
/**
|
|
2044
|
+
* Gets the current configuration for the VertexPicker component.
|
|
2053
2045
|
*
|
|
2054
|
-
* @
|
|
2055
|
-
*
|
|
2046
|
+
* @returns A copy of the current VertexPickerConfig object.
|
|
2047
|
+
*
|
|
2048
|
+
* @example
|
|
2049
|
+
* '''typescript
|
|
2050
|
+
* const currentConfig = vertexPicker.config;
|
|
2051
|
+
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
2052
|
+
* '''
|
|
2056
2053
|
*/
|
|
2057
|
-
|
|
2054
|
+
get config(): Partial<VertexPickerConfig>;
|
|
2055
|
+
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
2056
|
+
/** {@link Disposable.dispose} */
|
|
2057
|
+
dispose(): void;
|
|
2058
2058
|
/**
|
|
2059
|
-
*
|
|
2059
|
+
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
2060
2060
|
*
|
|
2061
|
-
* @param
|
|
2062
|
-
*
|
|
2061
|
+
* @param world - The World instance to use for raycasting.
|
|
2062
|
+
*
|
|
2063
|
+
* @returns The current picked point, or null if no point is picked.
|
|
2063
2064
|
*
|
|
2064
2065
|
* @remarks
|
|
2065
|
-
* This method
|
|
2066
|
-
*
|
|
2066
|
+
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
2067
|
+
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
2068
|
+
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
2069
|
+
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
2070
|
+
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
2071
|
+
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
2072
|
+
*/
|
|
2073
|
+
get(world: World): THREE.Vector3 | null;
|
|
2074
|
+
private getClosestVertex;
|
|
2075
|
+
private getVertices;
|
|
2076
|
+
private getVertex;
|
|
2077
|
+
}
|
|
2078
|
+
import * as WEBIFC from "web-ifc";
|
|
2079
|
+
/** Configuration of the IFC-fragment conversion. */
|
|
2080
|
+
export declare class IfcFragmentSettings {
|
|
2081
|
+
/** Whether to extract the IFC properties into a JSON. */
|
|
2082
|
+
includeProperties: boolean;
|
|
2083
|
+
/**
|
|
2084
|
+
* Generate the geometry for categories that are not included by default,
|
|
2085
|
+
* like IFCSPACE.
|
|
2086
|
+
*/
|
|
2087
|
+
optionalCategories: number[];
|
|
2088
|
+
/** Whether to use the coordination data coming from the IFC files. */
|
|
2089
|
+
coordinate: boolean;
|
|
2090
|
+
/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2091
|
+
wasm: {
|
|
2092
|
+
path: string;
|
|
2093
|
+
absolute: boolean;
|
|
2094
|
+
logLevel?: WEBIFC.LogLevel;
|
|
2095
|
+
};
|
|
2096
|
+
/** List of categories that won't be converted to fragments. */
|
|
2097
|
+
excludedCategories: Set<number>;
|
|
2098
|
+
/** Whether to save the absolute location of all IFC items. */
|
|
2099
|
+
saveLocations: boolean;
|
|
2100
|
+
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2101
|
+
webIfc: WEBIFC.LoaderSettings;
|
|
2102
|
+
/**
|
|
2103
|
+
* Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2104
|
+
* If set to true, the path will be set to the default path of the WASM file.
|
|
2105
|
+
* If set to false, the path must be provided manually in the 'wasm.path' property.
|
|
2106
|
+
* Default value is true.
|
|
2107
|
+
*/
|
|
2108
|
+
autoSetWasm: boolean;
|
|
2109
|
+
/**
|
|
2110
|
+
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2111
|
+
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
2112
|
+
* If set to null, the default file location handler will be used.
|
|
2067
2113
|
*
|
|
2114
|
+
* @param url - The URL of the file to locate.
|
|
2115
|
+
* @returns The absolute path of the file.
|
|
2068
2116
|
*/
|
|
2069
|
-
|
|
2070
|
-
private getFaceData;
|
|
2071
|
-
private getVolumeOfMesh;
|
|
2072
|
-
private getSignedVolumeOfTriangle;
|
|
2117
|
+
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2073
2118
|
}
|
|
2074
|
-
/**
|
|
2075
|
-
* A Set of unique numbers representing different types of IFC geometries.
|
|
2076
|
-
*/
|
|
2077
|
-
export declare const GeometryTypes: Set<number>;
|
|
2078
2119
|
import * as THREE from "three";
|
|
2079
2120
|
import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
|
|
2080
2121
|
/**
|
|
@@ -2164,52 +2205,10 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
|
|
|
2164
2205
|
resize(size?: THREE.Vector2): void;
|
|
2165
2206
|
private updatePlanes;
|
|
2166
2207
|
}
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
includeProperties: boolean;
|
|
2172
|
-
/**
|
|
2173
|
-
* Generate the geometry for categories that are not included by default,
|
|
2174
|
-
* like IFCSPACE.
|
|
2175
|
-
*/
|
|
2176
|
-
optionalCategories: number[];
|
|
2177
|
-
/** Whether to use the coordination data coming from the IFC files. */
|
|
2178
|
-
coordinate: boolean;
|
|
2179
|
-
/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2180
|
-
wasm: {
|
|
2181
|
-
path: string;
|
|
2182
|
-
absolute: boolean;
|
|
2183
|
-
logLevel?: WEBIFC.LogLevel;
|
|
2184
|
-
};
|
|
2185
|
-
/** List of categories that won't be converted to fragments. */
|
|
2186
|
-
excludedCategories: Set<number>;
|
|
2187
|
-
/** Whether to save the absolute location of all IFC items. */
|
|
2188
|
-
saveLocations: boolean;
|
|
2189
|
-
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2190
|
-
webIfc: WEBIFC.LoaderSettings;
|
|
2191
|
-
/**
|
|
2192
|
-
* Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2193
|
-
* If set to true, the path will be set to the default path of the WASM file.
|
|
2194
|
-
* If set to false, the path must be provided manually in the 'wasm.path' property.
|
|
2195
|
-
* Default value is true.
|
|
2196
|
-
*/
|
|
2197
|
-
autoSetWasm: boolean;
|
|
2198
|
-
/**
|
|
2199
|
-
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2200
|
-
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
2201
|
-
* If set to null, the default file location handler will be used.
|
|
2202
|
-
*
|
|
2203
|
-
* @param url - The URL of the file to locate.
|
|
2204
|
-
* @returns The absolute path of the file.
|
|
2205
|
-
*/
|
|
2206
|
-
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2207
|
-
}
|
|
2208
|
-
import { InverseAttribute } from "./types";
|
|
2209
|
-
export declare const relToAttributesMap: Map<number, {
|
|
2210
|
-
forRelating: InverseAttribute;
|
|
2211
|
-
forRelated: InverseAttribute;
|
|
2212
|
-
}>;
|
|
2208
|
+
/**
|
|
2209
|
+
* A Set of unique numbers representing different types of IFC geometries.
|
|
2210
|
+
*/
|
|
2211
|
+
export declare const GeometryTypes: Set<number>;
|
|
2213
2212
|
import * as WEBIFC from "web-ifc";
|
|
2214
2213
|
import { IfcItemsCategories } from "../../../ifc";
|
|
2215
2214
|
export declare class SpatialStructure {
|
|
@@ -2225,6 +2224,12 @@ export interface IfcItemsCategories {
|
|
|
2225
2224
|
export declare class IfcCategories {
|
|
2226
2225
|
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
2227
2226
|
}
|
|
2227
|
+
/**
|
|
2228
|
+
* A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
|
|
2229
|
+
*/
|
|
2230
|
+
export declare const IfcCategoryMap: {
|
|
2231
|
+
[key: number]: string;
|
|
2232
|
+
};
|
|
2228
2233
|
/**
|
|
2229
2234
|
* A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
|
|
2230
2235
|
*
|
|
@@ -2236,40 +2241,6 @@ export declare class IfcCategories {
|
|
|
2236
2241
|
export declare const IfcElements: {
|
|
2237
2242
|
[key: number]: string;
|
|
2238
2243
|
};
|
|
2239
|
-
/**
|
|
2240
|
-
* A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
|
|
2241
|
-
*/
|
|
2242
|
-
export declare const IfcCategoryMap: {
|
|
2243
|
-
[key: number]: string;
|
|
2244
|
-
};
|
|
2245
|
-
/**
|
|
2246
|
-
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
|
|
2247
|
-
*/
|
|
2248
|
-
export declare class Event<T> {
|
|
2249
|
-
/**
|
|
2250
|
-
* Add a callback to this event instance.
|
|
2251
|
-
* @param handler - the callback to be added to this event.
|
|
2252
|
-
*/
|
|
2253
|
-
add(handler: T extends void ? {
|
|
2254
|
-
(): void;
|
|
2255
|
-
} : {
|
|
2256
|
-
(data: T): void;
|
|
2257
|
-
}): void;
|
|
2258
|
-
/**
|
|
2259
|
-
* Removes a callback from this event instance.
|
|
2260
|
-
* @param handler - the callback to be removed from this event.
|
|
2261
|
-
*/
|
|
2262
|
-
remove(handler: T extends void ? {
|
|
2263
|
-
(): void;
|
|
2264
|
-
} : {
|
|
2265
|
-
(data: T): void;
|
|
2266
|
-
}): void;
|
|
2267
|
-
/** Triggers all the callbacks assigned to this event. */
|
|
2268
|
-
trigger: (data?: T) => void;
|
|
2269
|
-
/** Gets rid of all the suscribed events. */
|
|
2270
|
-
reset(): void;
|
|
2271
|
-
private handlers;
|
|
2272
|
-
}
|
|
2273
2244
|
import * as FRAGS from "@thatopen/fragments";
|
|
2274
2245
|
export declare class IfcPropertiesUtils {
|
|
2275
2246
|
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
@@ -2295,343 +2266,335 @@ export declare class IfcPropertiesUtils {
|
|
|
2295
2266
|
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2296
2267
|
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2297
2268
|
}
|
|
2269
|
+
import { InverseAttribute } from "./types";
|
|
2270
|
+
export declare const relToAttributesMap: Map<number, {
|
|
2271
|
+
forRelating: InverseAttribute;
|
|
2272
|
+
forRelated: InverseAttribute;
|
|
2273
|
+
}>;
|
|
2298
2274
|
import * as THREE from "three";
|
|
2299
|
-
import
|
|
2300
|
-
import {
|
|
2275
|
+
import { BaseScene, Configurable, Event } from "../../Types";
|
|
2276
|
+
import { Components } from "../../Components";
|
|
2301
2277
|
/**
|
|
2302
|
-
*
|
|
2278
|
+
* Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
|
|
2303
2279
|
*/
|
|
2304
|
-
export interface
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2280
|
+
export interface SimpleSceneConfig {
|
|
2281
|
+
directionalLight: {
|
|
2282
|
+
color: THREE.Color;
|
|
2283
|
+
intensity: number;
|
|
2284
|
+
position: THREE.Vector3;
|
|
2285
|
+
};
|
|
2286
|
+
ambientLight: {
|
|
2287
|
+
color: THREE.Color;
|
|
2288
|
+
intensity: number;
|
|
2289
|
+
};
|
|
2312
2290
|
}
|
|
2313
2291
|
/**
|
|
2314
|
-
*
|
|
2292
|
+
* A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
|
|
2315
2293
|
*/
|
|
2316
|
-
export
|
|
2294
|
+
export declare class SimpleScene extends BaseScene implements Configurable<{}> {
|
|
2295
|
+
/** {@link Configurable.isSetup} */
|
|
2296
|
+
isSetup: boolean;
|
|
2317
2297
|
/**
|
|
2318
|
-
*
|
|
2319
|
-
*
|
|
2320
|
-
* [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
2298
|
+
* The underlying Three.js scene object.
|
|
2299
|
+
* It is used to define the 3D space containing objects, lights, and cameras.
|
|
2321
2300
|
*/
|
|
2322
|
-
|
|
2301
|
+
three: THREE.Scene;
|
|
2302
|
+
/** {@link Configurable.onSetup} */
|
|
2303
|
+
readonly onSetup: Event<SimpleScene>;
|
|
2304
|
+
/**
|
|
2305
|
+
* Configuration interface for the {@link SimpleScene}.
|
|
2306
|
+
* Defines properties for directional and ambient lights.
|
|
2307
|
+
*/
|
|
2308
|
+
config: Required<SimpleSceneConfig>;
|
|
2309
|
+
constructor(components: Components);
|
|
2310
|
+
/** {@link Configurable.setup} */
|
|
2311
|
+
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
2323
2312
|
}
|
|
2313
|
+
import * as THREE from "three";
|
|
2314
|
+
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
2324
2315
|
/**
|
|
2325
|
-
*
|
|
2316
|
+
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
2317
|
+
*
|
|
2318
|
+
* @template T - The type of the scene. Default is BaseScene.
|
|
2319
|
+
* @template U - The type of the camera. Default is BaseCamera.
|
|
2320
|
+
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
2326
2321
|
*/
|
|
2327
|
-
export
|
|
2322
|
+
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
|
|
2328
2323
|
/**
|
|
2329
|
-
*
|
|
2330
|
-
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2331
|
-
* component.
|
|
2324
|
+
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
2332
2325
|
*/
|
|
2333
|
-
|
|
2334
|
-
/**
|
|
2335
|
-
|
|
2326
|
+
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
2327
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2328
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
2329
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2330
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
2331
|
+
/** {@link Disposable.onDisposed} */
|
|
2332
|
+
readonly onDisposed: Event<unknown>;
|
|
2336
2333
|
/**
|
|
2337
|
-
*
|
|
2338
|
-
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2339
|
-
* component.
|
|
2334
|
+
* Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
|
|
2340
2335
|
*/
|
|
2341
|
-
|
|
2342
|
-
}
|
|
2343
|
-
/** Whether this component should be updated each frame. */
|
|
2344
|
-
export interface Updateable {
|
|
2345
|
-
/** Actions that should be executed after updating the component. */
|
|
2346
|
-
onAfterUpdate: Event<any>;
|
|
2347
|
-
/** Actions that should be executed before updating the component. */
|
|
2348
|
-
onBeforeUpdate: Event<any>;
|
|
2336
|
+
isDisposing: boolean;
|
|
2349
2337
|
/**
|
|
2350
|
-
*
|
|
2351
|
-
*
|
|
2338
|
+
* Indicates whether the world is currently enabled.
|
|
2339
|
+
* When disabled, the world will not be updated.
|
|
2352
2340
|
*/
|
|
2353
|
-
|
|
2354
|
-
}
|
|
2355
|
-
/** Basic type to describe the progress of any kind of process. */
|
|
2356
|
-
export interface Progress {
|
|
2357
|
-
/** The amount of things that have been done already. */
|
|
2358
|
-
current: number;
|
|
2359
|
-
/** The total amount of things to be done by the process. */
|
|
2360
|
-
total: number;
|
|
2361
|
-
}
|
|
2362
|
-
/**
|
|
2363
|
-
* Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
|
|
2364
|
-
*/
|
|
2365
|
-
export interface Createable {
|
|
2366
|
-
/** Creates a new instance of an element (e.g. a new Dimension). */
|
|
2367
|
-
create: (data: any) => void;
|
|
2341
|
+
enabled: boolean;
|
|
2368
2342
|
/**
|
|
2369
|
-
*
|
|
2370
|
-
* instance of whatever the component creates.
|
|
2343
|
+
* A unique identifier for the world.
|
|
2371
2344
|
*/
|
|
2372
|
-
|
|
2345
|
+
uuid: string;
|
|
2373
2346
|
/**
|
|
2374
|
-
*
|
|
2375
|
-
* before starting to create.
|
|
2347
|
+
* An optional name for the world.
|
|
2376
2348
|
*/
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
/**
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
export interface Configurable<T extends Record<string, any>> {
|
|
2385
|
-
/** Wether this components has been already configured. */
|
|
2386
|
-
isSetup: boolean;
|
|
2387
|
-
/** Use the provided configuration to setup the tool. */
|
|
2388
|
-
setup: (config?: Partial<T>) => void | Promise<void>;
|
|
2389
|
-
/** Fired after successfully calling {@link Configurable.setup()} */
|
|
2390
|
-
readonly onSetup: Event<any>;
|
|
2391
|
-
/** Object holding the tool configuration. Is not meant to be edited directly, if you need
|
|
2392
|
-
* to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
|
|
2349
|
+
name?: string;
|
|
2350
|
+
private _scene?;
|
|
2351
|
+
private _camera?;
|
|
2352
|
+
private _renderer;
|
|
2353
|
+
/**
|
|
2354
|
+
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
2355
|
+
* @returns The current scene.
|
|
2393
2356
|
*/
|
|
2394
|
-
|
|
2395
|
-
}
|
|
2396
|
-
/**
|
|
2397
|
-
* Whether a camera uses the Camera Controls library.
|
|
2398
|
-
*/
|
|
2399
|
-
export interface CameraControllable {
|
|
2357
|
+
get scene(): T;
|
|
2400
2358
|
/**
|
|
2401
|
-
*
|
|
2402
|
-
*
|
|
2359
|
+
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
2360
|
+
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
2361
|
+
* @param scene - The new scene to be set.
|
|
2403
2362
|
*/
|
|
2404
|
-
|
|
2405
|
-
}
|
|
2406
|
-
/**
|
|
2407
|
-
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
|
|
2408
|
-
*/
|
|
2409
|
-
export declare class AsyncEvent<T> {
|
|
2363
|
+
set scene(scene: T);
|
|
2410
2364
|
/**
|
|
2411
|
-
*
|
|
2412
|
-
* @
|
|
2365
|
+
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
2366
|
+
* @returns The current camera.
|
|
2413
2367
|
*/
|
|
2414
|
-
|
|
2415
|
-
(): Promise<void>;
|
|
2416
|
-
} : {
|
|
2417
|
-
(data: T): Promise<void>;
|
|
2418
|
-
}): void;
|
|
2368
|
+
get camera(): U;
|
|
2419
2369
|
/**
|
|
2420
|
-
*
|
|
2421
|
-
*
|
|
2370
|
+
* Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
|
|
2371
|
+
* sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
|
|
2372
|
+
* @param camera - The new camera to be set.
|
|
2422
2373
|
*/
|
|
2423
|
-
|
|
2424
|
-
(): Promise<void>;
|
|
2425
|
-
} : {
|
|
2426
|
-
(data: T): Promise<void>;
|
|
2427
|
-
}): void;
|
|
2428
|
-
/** Triggers all the callbacks assigned to this event. */
|
|
2429
|
-
trigger: (data?: T) => Promise<void>;
|
|
2430
|
-
/** Gets rid of all the suscribed events. */
|
|
2431
|
-
reset(): void;
|
|
2432
|
-
private handlers;
|
|
2433
|
-
}
|
|
2434
|
-
import { Base } from "./base";
|
|
2435
|
-
/**
|
|
2436
|
-
* Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
|
|
2437
|
-
*/
|
|
2438
|
-
export declare abstract class Component extends Base {
|
|
2374
|
+
set camera(camera: U);
|
|
2439
2375
|
/**
|
|
2440
|
-
*
|
|
2441
|
-
*
|
|
2442
|
-
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
2443
|
-
* will not be updated automatically each frame.
|
|
2376
|
+
* Getter for the renderer.
|
|
2377
|
+
* @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
|
|
2444
2378
|
*/
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
/**
|
|
2456
|
-
|
|
2457
|
-
/** Whether is component is {@link Resizeable}. */
|
|
2458
|
-
isResizeable: () => this is Resizeable;
|
|
2459
|
-
/** Whether is component is {@link Updateable}. */
|
|
2460
|
-
isUpdateable: () => this is Updateable;
|
|
2461
|
-
/** Whether is component is {@link Hideable}. */
|
|
2462
|
-
isHideable: () => this is Hideable;
|
|
2463
|
-
/** Whether is component is {@link Configurable}. */
|
|
2464
|
-
isConfigurable: () => this is Configurable<any>;
|
|
2379
|
+
get renderer(): S | null;
|
|
2380
|
+
/**
|
|
2381
|
+
* Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
|
|
2382
|
+
* sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
|
|
2383
|
+
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
2384
|
+
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
2385
|
+
*/
|
|
2386
|
+
set renderer(renderer: S | null);
|
|
2387
|
+
/** {@link Updateable.update} */
|
|
2388
|
+
update(delta?: number): void;
|
|
2389
|
+
/** {@link Disposable.dispose} */
|
|
2390
|
+
dispose(disposeResources?: boolean): void;
|
|
2465
2391
|
}
|
|
2466
|
-
import
|
|
2467
|
-
import {
|
|
2468
|
-
import { Event } from "./event";
|
|
2392
|
+
import * as THREE from "three";
|
|
2393
|
+
import { BaseRenderer, Event } from "../../Types";
|
|
2469
2394
|
import { Components } from "../../Components";
|
|
2470
2395
|
/**
|
|
2471
|
-
*
|
|
2396
|
+
* A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
|
|
2472
2397
|
*/
|
|
2473
|
-
export declare
|
|
2474
|
-
readonly worlds: Map<string, World>;
|
|
2398
|
+
export declare class SimpleRenderer extends BaseRenderer {
|
|
2475
2399
|
/**
|
|
2476
|
-
*
|
|
2477
|
-
*
|
|
2400
|
+
* Indicates whether the renderer is enabled. If it's not, it won't be updated.
|
|
2401
|
+
* Default is 'true'.
|
|
2478
2402
|
*/
|
|
2479
|
-
|
|
2480
|
-
world: World;
|
|
2481
|
-
action: "added" | "removed";
|
|
2482
|
-
}>;
|
|
2403
|
+
enabled: boolean;
|
|
2483
2404
|
/**
|
|
2484
|
-
* The
|
|
2405
|
+
* The HTML container of the THREE.js canvas where the scene is rendered.
|
|
2485
2406
|
*/
|
|
2486
|
-
|
|
2487
|
-
protected constructor(components: Components);
|
|
2488
|
-
}
|
|
2489
|
-
import * as THREE from "three";
|
|
2490
|
-
import CameraControls from "camera-controls";
|
|
2491
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
2492
|
-
import { CameraControllable } from "./interfaces";
|
|
2493
|
-
/**
|
|
2494
|
-
* Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
|
|
2495
|
-
*/
|
|
2496
|
-
export declare abstract class BaseCamera extends BaseWorldItem {
|
|
2497
|
-
/**
|
|
2498
|
-
* Whether the camera is enabled or not.
|
|
2499
|
-
*/
|
|
2500
|
-
abstract enabled: boolean;
|
|
2407
|
+
container: HTMLElement;
|
|
2501
2408
|
/**
|
|
2502
|
-
* The
|
|
2409
|
+
* The THREE.js WebGLRenderer instance.
|
|
2503
2410
|
*/
|
|
2504
|
-
|
|
2411
|
+
three: THREE.WebGLRenderer;
|
|
2412
|
+
protected _canvas: HTMLCanvasElement;
|
|
2413
|
+
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
2414
|
+
protected _resizeObserver: ResizeObserver | null;
|
|
2415
|
+
protected onContainerUpdated: Event<unknown>;
|
|
2416
|
+
private _resizing;
|
|
2505
2417
|
/**
|
|
2506
|
-
*
|
|
2507
|
-
*
|
|
2418
|
+
* Constructor for the SimpleRenderer class.
|
|
2419
|
+
*
|
|
2420
|
+
* @param components - The components instance.
|
|
2421
|
+
* @param container - The HTML container where the THREE.js canvas will be rendered.
|
|
2422
|
+
* @param parameters - Optional parameters for the THREE.js WebGLRenderer.
|
|
2508
2423
|
*/
|
|
2509
|
-
|
|
2424
|
+
constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
|
|
2425
|
+
/** {@link Updateable.update} */
|
|
2426
|
+
update(): void;
|
|
2427
|
+
/** {@link Disposable.dispose} */
|
|
2428
|
+
dispose(): void;
|
|
2429
|
+
/** {@link Resizeable.getSize}. */
|
|
2430
|
+
getSize(): THREE.Vector2;
|
|
2431
|
+
/** {@link Resizeable.resize} */
|
|
2432
|
+
resize: (size?: THREE.Vector2) => void;
|
|
2510
2433
|
/**
|
|
2511
|
-
*
|
|
2434
|
+
* Sets up and manages the event listeners for the renderer.
|
|
2512
2435
|
*
|
|
2513
|
-
* @
|
|
2436
|
+
* @param active - A boolean indicating whether to activate or deactivate the event listeners.
|
|
2437
|
+
*
|
|
2438
|
+
* @throws Will throw an error if the renderer does not have an HTML container.
|
|
2514
2439
|
*/
|
|
2515
|
-
|
|
2440
|
+
setupEvents(active: boolean): void;
|
|
2441
|
+
private resizeEvent;
|
|
2442
|
+
private setupRenderer;
|
|
2443
|
+
private onContextLost;
|
|
2444
|
+
private onContextBack;
|
|
2516
2445
|
}
|
|
2517
2446
|
import * as THREE from "three";
|
|
2518
|
-
import
|
|
2519
|
-
import { Event } from "
|
|
2520
|
-
import {
|
|
2521
|
-
import { Disposable, Resizeable, Updateable } from "./interfaces";
|
|
2447
|
+
import CameraControls from "camera-controls";
|
|
2448
|
+
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
2449
|
+
import { Components } from "../../Components";
|
|
2522
2450
|
/**
|
|
2523
|
-
*
|
|
2451
|
+
* A basic camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
|
|
2524
2452
|
*/
|
|
2525
|
-
export declare
|
|
2526
|
-
/**
|
|
2527
|
-
* The three.js WebGLRenderer instance associated with this renderer.
|
|
2528
|
-
*
|
|
2529
|
-
* @abstract
|
|
2530
|
-
* @type {THREE.WebGLRenderer}
|
|
2531
|
-
*/
|
|
2532
|
-
abstract three: THREE.WebGLRenderer;
|
|
2453
|
+
export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
|
|
2533
2454
|
/** {@link Updateable.onBeforeUpdate} */
|
|
2534
|
-
|
|
2455
|
+
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
2535
2456
|
/** {@link Updateable.onAfterUpdate} */
|
|
2536
|
-
|
|
2457
|
+
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
2458
|
+
/**
|
|
2459
|
+
* Event that is triggered when the aspect of the camera has been updated.
|
|
2460
|
+
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
2461
|
+
*/
|
|
2462
|
+
readonly onAspectUpdated: Event<unknown>;
|
|
2537
2463
|
/** {@link Disposable.onDisposed} */
|
|
2538
|
-
readonly onDisposed: Event<
|
|
2539
|
-
/** {@link Resizeable.onResize} */
|
|
2540
|
-
readonly onResize: Event<THREE.Vector2>;
|
|
2464
|
+
readonly onDisposed: Event<string>;
|
|
2541
2465
|
/**
|
|
2542
|
-
*
|
|
2543
|
-
*
|
|
2466
|
+
* A three.js PerspectiveCamera or OrthographicCamera instance.
|
|
2467
|
+
* This camera is used for rendering the scene.
|
|
2544
2468
|
*/
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
abstract update(delta?: number): void | Promise<void>;
|
|
2548
|
-
/** {@link Disposable.dispose} */
|
|
2549
|
-
abstract dispose(): void;
|
|
2550
|
-
/** {@link Resizeable.getSize} */
|
|
2551
|
-
abstract getSize(): Vector2;
|
|
2552
|
-
/** {@link Resizeable.resize} */
|
|
2553
|
-
abstract resize(size: Vector2 | undefined): void;
|
|
2469
|
+
three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
2470
|
+
private _allControls;
|
|
2554
2471
|
/**
|
|
2555
|
-
* The
|
|
2472
|
+
* The object that controls the camera. An instance of
|
|
2473
|
+
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
2474
|
+
* Transforming the camera directly will have no effect: you need to use this
|
|
2475
|
+
* object to move, rotate, look at objects, etc.
|
|
2556
2476
|
*/
|
|
2557
|
-
|
|
2477
|
+
get controls(): CameraControls;
|
|
2558
2478
|
/**
|
|
2559
|
-
*
|
|
2479
|
+
* Getter for the enabled state of the camera controls.
|
|
2480
|
+
* If the current world is null, it returns false.
|
|
2481
|
+
* Otherwise, it returns the enabled state of the camera controls.
|
|
2560
2482
|
*
|
|
2561
|
-
* @
|
|
2562
|
-
* This method is typically called when there is a change to the list of clipping planes
|
|
2563
|
-
* used by the active renderer.
|
|
2483
|
+
* @returns {boolean} The enabled state of the camera controls.
|
|
2564
2484
|
*/
|
|
2565
|
-
|
|
2485
|
+
get enabled(): boolean;
|
|
2566
2486
|
/**
|
|
2567
|
-
*
|
|
2568
|
-
*
|
|
2569
|
-
* @param active - A boolean indicating whether the clipping plane should be active or not.
|
|
2570
|
-
* @param plane - The clipping plane to be added or removed.
|
|
2571
|
-
* @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
|
|
2487
|
+
* Setter for the enabled state of the camera controls.
|
|
2488
|
+
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
2572
2489
|
*
|
|
2573
|
-
* @
|
|
2574
|
-
* This method adds or removes a clipping plane from the 'clippingPlanes' array.
|
|
2575
|
-
* If 'active' is 'true' and the plane is not already in the array, it is added.
|
|
2576
|
-
* If 'active' is 'false' and the plane is in the array, it is removed.
|
|
2577
|
-
* The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
|
|
2578
|
-
* excluding any planes marked as local.
|
|
2490
|
+
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
2579
2491
|
*/
|
|
2580
|
-
|
|
2492
|
+
set enabled(enabled: boolean);
|
|
2493
|
+
constructor(components: Components);
|
|
2494
|
+
/** {@link Disposable.dispose} */
|
|
2495
|
+
dispose(): void;
|
|
2496
|
+
/** {@link Updateable.update} */
|
|
2497
|
+
update(_delta: number): void;
|
|
2498
|
+
/**
|
|
2499
|
+
* Updates the aspect of the camera to match the size of the
|
|
2500
|
+
* {@link Components.renderer}.
|
|
2501
|
+
*/
|
|
2502
|
+
updateAspect: () => void;
|
|
2503
|
+
private setupCamera;
|
|
2504
|
+
private newCameraControls;
|
|
2505
|
+
private setupEvents;
|
|
2506
|
+
private static getSubsetOfThree;
|
|
2581
2507
|
}
|
|
2582
2508
|
import * as THREE from "three";
|
|
2583
|
-
import { Disposable } from "./interfaces";
|
|
2584
|
-
import { Event } from "./event";
|
|
2585
2509
|
import { Components } from "../../Components";
|
|
2586
|
-
import {
|
|
2510
|
+
import { AsyncEvent, Event, World } from "../../Types";
|
|
2587
2511
|
/**
|
|
2588
|
-
*
|
|
2512
|
+
* Settings to configure the CullerRenderer.
|
|
2589
2513
|
*/
|
|
2590
|
-
export
|
|
2591
|
-
/** {@link Disposable.onDisposed} */
|
|
2592
|
-
readonly onDisposed: Event<unknown>;
|
|
2514
|
+
export interface CullerRendererSettings {
|
|
2593
2515
|
/**
|
|
2594
|
-
*
|
|
2595
|
-
*
|
|
2516
|
+
* Interval in milliseconds at which the visibility check should be performed.
|
|
2517
|
+
* Default value is 1000.
|
|
2596
2518
|
*/
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2519
|
+
updateInterval?: number;
|
|
2520
|
+
/**
|
|
2521
|
+
* Width of the render target used for visibility checks.
|
|
2522
|
+
* Default value is 512.
|
|
2523
|
+
*/
|
|
2524
|
+
width?: number;
|
|
2525
|
+
/**
|
|
2526
|
+
* Height of the render target used for visibility checks.
|
|
2527
|
+
* Default value is 512.
|
|
2528
|
+
*/
|
|
2529
|
+
height?: number;
|
|
2530
|
+
/**
|
|
2531
|
+
* Whether the visibility check should be performed automatically.
|
|
2532
|
+
* Default value is true.
|
|
2533
|
+
*/
|
|
2534
|
+
autoUpdate?: boolean;
|
|
2601
2535
|
}
|
|
2602
|
-
import * as THREE from "three";
|
|
2603
|
-
import { BaseScene } from "./base-scene";
|
|
2604
|
-
import { BaseCamera } from "./base-camera";
|
|
2605
|
-
import { BaseRenderer } from "./base-renderer";
|
|
2606
|
-
import { Updateable, Disposable } from "./interfaces";
|
|
2607
2536
|
/**
|
|
2608
|
-
*
|
|
2537
|
+
* A base renderer to determine visibility on screen.
|
|
2609
2538
|
*/
|
|
2610
|
-
export
|
|
2611
|
-
/**
|
|
2612
|
-
|
|
2613
|
-
*/
|
|
2614
|
-
meshes: Set<THREE.Mesh>;
|
|
2539
|
+
export declare class CullerRenderer {
|
|
2540
|
+
/** {@link Disposable.onDisposed} */
|
|
2541
|
+
readonly onDisposed: Event<string>;
|
|
2615
2542
|
/**
|
|
2616
|
-
*
|
|
2543
|
+
* Fires after making the visibility check to the meshes. It lists the
|
|
2544
|
+
* meshes that are currently visible, and the ones that were visible
|
|
2545
|
+
* just before but not anymore.
|
|
2617
2546
|
*/
|
|
2618
|
-
|
|
2547
|
+
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
2619
2548
|
/**
|
|
2620
|
-
*
|
|
2549
|
+
* Whether this renderer is active or not. If not, it won't render anything.
|
|
2621
2550
|
*/
|
|
2622
|
-
|
|
2551
|
+
enabled: boolean;
|
|
2623
2552
|
/**
|
|
2624
|
-
*
|
|
2553
|
+
* Needs to check whether there are objects that need to be hidden or shown.
|
|
2554
|
+
* You can bind this to the camera movement, to a certain interval, etc.
|
|
2625
2555
|
*/
|
|
2626
|
-
|
|
2556
|
+
needsUpdate: boolean;
|
|
2627
2557
|
/**
|
|
2628
|
-
*
|
|
2558
|
+
* Render the internal scene used to determine the object visibility. Used
|
|
2559
|
+
* for debugging purposes.
|
|
2629
2560
|
*/
|
|
2630
|
-
|
|
2561
|
+
renderDebugFrame: boolean;
|
|
2562
|
+
/** The components instance to which this renderer belongs. */
|
|
2563
|
+
components: Components;
|
|
2564
|
+
/** The world instance to which this renderer belongs. */
|
|
2565
|
+
readonly world: World;
|
|
2566
|
+
/** The THREE.js renderer used to make the visibility test. */
|
|
2567
|
+
readonly renderer: THREE.WebGLRenderer;
|
|
2568
|
+
protected autoUpdate: boolean;
|
|
2569
|
+
protected updateInterval: number;
|
|
2570
|
+
protected readonly worker: Worker;
|
|
2571
|
+
protected readonly scene: THREE.Scene;
|
|
2572
|
+
private _width;
|
|
2573
|
+
private _height;
|
|
2574
|
+
private _availableColor;
|
|
2575
|
+
private readonly renderTarget;
|
|
2576
|
+
private readonly bufferSize;
|
|
2577
|
+
private readonly _buffer;
|
|
2578
|
+
protected _isWorkerBusy: boolean;
|
|
2579
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2580
|
+
/** {@link Disposable.dispose} */
|
|
2581
|
+
dispose(): void;
|
|
2631
2582
|
/**
|
|
2632
|
-
*
|
|
2583
|
+
* The function that the culler uses to reprocess the scene. Generally it's
|
|
2584
|
+
* better to call needsUpdate, but you can also call this to force it.
|
|
2585
|
+
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
2586
|
+
* not true.
|
|
2633
2587
|
*/
|
|
2634
|
-
|
|
2588
|
+
updateVisibility: (force?: boolean) => Promise<void>;
|
|
2589
|
+
protected getAvailableColor(): {
|
|
2590
|
+
r: number;
|
|
2591
|
+
g: number;
|
|
2592
|
+
b: number;
|
|
2593
|
+
code: string;
|
|
2594
|
+
};
|
|
2595
|
+
protected increaseColor(): void;
|
|
2596
|
+
protected decreaseColor(): void;
|
|
2597
|
+
private applySettings;
|
|
2635
2598
|
}
|
|
2636
2599
|
import * as THREE from "three";
|
|
2637
2600
|
import { Disposable, Event } from "../../Types";
|
|
@@ -2657,13 +2620,70 @@ export declare class Mouse implements Disposable {
|
|
|
2657
2620
|
private setupEvents;
|
|
2658
2621
|
}
|
|
2659
2622
|
import * as THREE from "three";
|
|
2623
|
+
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
2660
2624
|
import { Components } from "../../Components";
|
|
2661
2625
|
import { Event, World, Disposable } from "../../Types";
|
|
2662
|
-
import { Mouse } from "./mouse";
|
|
2663
2626
|
/**
|
|
2664
|
-
* A
|
|
2627
|
+
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
2665
2628
|
*/
|
|
2666
|
-
export declare class
|
|
2629
|
+
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
2630
|
+
/**
|
|
2631
|
+
* Event triggered when the visibility of meshes is updated.
|
|
2632
|
+
* Contains two sets: seen and unseen.
|
|
2633
|
+
*/
|
|
2634
|
+
readonly onViewUpdated: Event<{
|
|
2635
|
+
seen: Set<THREE.Mesh>;
|
|
2636
|
+
unseen: Set<THREE.Mesh>;
|
|
2637
|
+
}>;
|
|
2638
|
+
/**
|
|
2639
|
+
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
2640
|
+
* Default value is 100.
|
|
2641
|
+
*/
|
|
2642
|
+
threshold: number;
|
|
2643
|
+
/**
|
|
2644
|
+
* Map of color code to THREE.InstancedMesh.
|
|
2645
|
+
* Used to keep track of color-coded meshes.
|
|
2646
|
+
*/
|
|
2647
|
+
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
2648
|
+
/**
|
|
2649
|
+
* Flag to indicate if the renderer is currently processing.
|
|
2650
|
+
* Used to prevent concurrent processing.
|
|
2651
|
+
*/
|
|
2652
|
+
isProcessing: boolean;
|
|
2653
|
+
private _colorCodeMeshMap;
|
|
2654
|
+
private _meshIDColorCodeMap;
|
|
2655
|
+
private _currentVisibleMeshes;
|
|
2656
|
+
private _recentlyHiddenMeshes;
|
|
2657
|
+
private _intervalID;
|
|
2658
|
+
private readonly _transparentMat;
|
|
2659
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2660
|
+
/** {@link Disposable.dispose} */
|
|
2661
|
+
dispose(): void;
|
|
2662
|
+
/**
|
|
2663
|
+
* Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
|
|
2664
|
+
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2665
|
+
* @returns {void}
|
|
2666
|
+
*/
|
|
2667
|
+
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2668
|
+
/**
|
|
2669
|
+
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2670
|
+
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2671
|
+
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2672
|
+
* @returns {void}
|
|
2673
|
+
*/
|
|
2674
|
+
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2675
|
+
private handleWorkerMessage;
|
|
2676
|
+
private getAvailableMaterial;
|
|
2677
|
+
}
|
|
2678
|
+
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2679
|
+
import * as THREE from "three";
|
|
2680
|
+
import { Components } from "../../Components";
|
|
2681
|
+
import { Event, World, Disposable } from "../../Types";
|
|
2682
|
+
import { Mouse } from "./mouse";
|
|
2683
|
+
/**
|
|
2684
|
+
* A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
|
|
2685
|
+
*/
|
|
2686
|
+
export declare class SimpleRaycaster implements Disposable {
|
|
2667
2687
|
/** {@link Component.enabled} */
|
|
2668
2688
|
enabled: boolean;
|
|
2669
2689
|
/** The components instance to which this Raycaster belongs. */
|
|
@@ -2708,580 +2728,430 @@ export declare class SimpleRaycaster implements Disposable {
|
|
|
2708
2728
|
private intersect;
|
|
2709
2729
|
private filterClippingPlanes;
|
|
2710
2730
|
}
|
|
2711
|
-
import { NavigationMode } from "./types";
|
|
2712
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
2713
|
-
/**
|
|
2714
|
-
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
2715
|
-
*/
|
|
2716
|
-
export declare class FirstPersonMode implements NavigationMode {
|
|
2717
|
-
private camera;
|
|
2718
|
-
/** {@link NavigationMode.enabled} */
|
|
2719
|
-
enabled: boolean;
|
|
2720
|
-
/** {@link NavigationMode.id} */
|
|
2721
|
-
readonly id = "FirstPerson";
|
|
2722
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
2723
|
-
/** {@link NavigationMode.set} */
|
|
2724
|
-
set(active: boolean): void;
|
|
2725
|
-
private setupFirstPersonCamera;
|
|
2726
|
-
}
|
|
2727
|
-
import { NavigationMode } from "./types";
|
|
2728
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
2729
|
-
/**
|
|
2730
|
-
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
2731
|
-
*/
|
|
2732
|
-
export declare class OrbitMode implements NavigationMode {
|
|
2733
|
-
camera: OrthoPerspectiveCamera;
|
|
2734
|
-
/** {@link NavigationMode.enabled} */
|
|
2735
|
-
enabled: boolean;
|
|
2736
|
-
/** {@link NavigationMode.id} */
|
|
2737
|
-
readonly id = "Orbit";
|
|
2738
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
2739
|
-
/** {@link NavigationMode.set} */
|
|
2740
|
-
set(active: boolean): void;
|
|
2741
|
-
private activateOrbitControls;
|
|
2742
|
-
}
|
|
2743
|
-
import { NavigationMode } from "./types";
|
|
2744
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
2745
|
-
/**
|
|
2746
|
-
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
2747
|
-
*/
|
|
2748
|
-
export declare class PlanMode implements NavigationMode {
|
|
2749
|
-
private camera;
|
|
2750
|
-
/** {@link NavigationMode.enabled} */
|
|
2751
|
-
enabled: boolean;
|
|
2752
|
-
/** {@link NavigationMode.id} */
|
|
2753
|
-
readonly id = "Plan";
|
|
2754
|
-
private mouseAction1?;
|
|
2755
|
-
private mouseAction2?;
|
|
2756
|
-
private mouseInitialized;
|
|
2757
|
-
private readonly defaultAzimuthSpeed;
|
|
2758
|
-
private readonly defaultPolarSpeed;
|
|
2759
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
2760
|
-
/** {@link NavigationMode.set} */
|
|
2761
|
-
set(active: boolean): void;
|
|
2762
|
-
}
|
|
2763
2731
|
import * as THREE from "three";
|
|
2764
|
-
import {
|
|
2765
|
-
import {
|
|
2766
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
2732
|
+
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
2733
|
+
import { Components } from "../../Components";
|
|
2767
2734
|
/**
|
|
2768
|
-
*
|
|
2735
|
+
* Configuration interface for the {@link SimpleGrid} class.
|
|
2769
2736
|
*/
|
|
2770
|
-
export
|
|
2771
|
-
/**
|
|
2772
|
-
* Event that fires when the {@link CameraProjection} changes.
|
|
2773
|
-
*/
|
|
2774
|
-
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
2737
|
+
export interface GridConfig {
|
|
2775
2738
|
/**
|
|
2776
|
-
*
|
|
2777
|
-
* Default is "Perspective".
|
|
2739
|
+
* The color of the grid lines.
|
|
2778
2740
|
*/
|
|
2779
|
-
|
|
2741
|
+
color: THREE.Color;
|
|
2780
2742
|
/**
|
|
2781
|
-
* The
|
|
2782
|
-
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
2743
|
+
* The size of the primary grid lines.
|
|
2783
2744
|
*/
|
|
2784
|
-
|
|
2785
|
-
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
2786
|
-
matchOrthoDistanceEnabled: boolean;
|
|
2787
|
-
private _component;
|
|
2788
|
-
private _previousDistance;
|
|
2789
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
2745
|
+
size1: number;
|
|
2790
2746
|
/**
|
|
2791
|
-
*
|
|
2792
|
-
*
|
|
2793
|
-
* @param projection - the new projection to set. If it is the current projection,
|
|
2794
|
-
* it will have no effect.
|
|
2747
|
+
* The size of the secondary grid lines.
|
|
2795
2748
|
*/
|
|
2796
|
-
|
|
2749
|
+
size2: number;
|
|
2797
2750
|
/**
|
|
2798
|
-
*
|
|
2799
|
-
* and vice versa.
|
|
2751
|
+
* The distance at which the grid lines start to fade away.
|
|
2800
2752
|
*/
|
|
2801
|
-
|
|
2802
|
-
private setOrthoCamera;
|
|
2803
|
-
private getPerspectiveDims;
|
|
2804
|
-
private setupOrthoCamera;
|
|
2805
|
-
private getDistance;
|
|
2806
|
-
private setPerspectiveCamera;
|
|
2753
|
+
distance: number;
|
|
2807
2754
|
}
|
|
2808
2755
|
/**
|
|
2809
|
-
*
|
|
2810
|
-
*/
|
|
2811
|
-
export type CameraProjection = "Perspective" | "Orthographic";
|
|
2812
|
-
/**
|
|
2813
|
-
* The extensible list of supported navigation modes.
|
|
2814
|
-
*/
|
|
2815
|
-
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
2816
|
-
/**
|
|
2817
|
-
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
2756
|
+
* An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
|
|
2818
2757
|
*/
|
|
2819
|
-
export
|
|
2820
|
-
/**
|
|
2821
|
-
|
|
2758
|
+
export declare class SimpleGrid implements Hideable, Disposable {
|
|
2759
|
+
/** {@link Disposable.onDisposed} */
|
|
2760
|
+
readonly onDisposed: Event<unknown>;
|
|
2761
|
+
/** The world instance to which this Raycaster belongs. */
|
|
2762
|
+
world: World;
|
|
2763
|
+
/** The components instance to which this grid belongs. */
|
|
2764
|
+
components: Components;
|
|
2765
|
+
/** {@link Hideable.visible} */
|
|
2766
|
+
get visible(): boolean;
|
|
2767
|
+
/** {@link Hideable.visible} */
|
|
2768
|
+
set visible(visible: boolean);
|
|
2769
|
+
/** The material of the grid. */
|
|
2770
|
+
get material(): THREE.ShaderMaterial;
|
|
2822
2771
|
/**
|
|
2823
|
-
*
|
|
2824
|
-
*
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
* @param active - whether to enable or disable this mode.
|
|
2828
|
-
* @param options - any additional data required to enable or disable it.
|
|
2829
|
-
* */
|
|
2830
|
-
set: (active: boolean, options?: any) => void;
|
|
2831
|
-
/** Whether this navigation mode is active or not. */
|
|
2832
|
-
enabled: boolean;
|
|
2833
|
-
}
|
|
2834
|
-
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
2835
|
-
/**
|
|
2836
|
-
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
2837
|
-
*/
|
|
2838
|
-
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
2772
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2773
|
+
* perspective cameras and false for orthographic cameras.
|
|
2774
|
+
*/
|
|
2775
|
+
get fade(): boolean;
|
|
2839
2776
|
/**
|
|
2840
|
-
*
|
|
2841
|
-
*
|
|
2777
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2778
|
+
* perspective cameras and false for orthographic cameras.
|
|
2842
2779
|
*/
|
|
2843
|
-
|
|
2780
|
+
set fade(active: boolean);
|
|
2781
|
+
/** The Three.js mesh that contains the infinite grid. */
|
|
2782
|
+
readonly three: THREE.Mesh;
|
|
2783
|
+
private _fade;
|
|
2784
|
+
constructor(components: Components, world: World, config: GridConfig);
|
|
2785
|
+
/** {@link Disposable.dispose} */
|
|
2786
|
+
dispose(): void;
|
|
2787
|
+
private setupEvents;
|
|
2788
|
+
private updateZoom;
|
|
2844
2789
|
}
|
|
2845
|
-
import * as THREE from "three";
|
|
2846
|
-
import { Components } from "../../Components";
|
|
2847
|
-
import { AsyncEvent, Event, World } from "../../Types";
|
|
2848
2790
|
/**
|
|
2849
|
-
*
|
|
2791
|
+
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
|
|
2850
2792
|
*/
|
|
2851
|
-
export
|
|
2793
|
+
export declare class Event<T> {
|
|
2852
2794
|
/**
|
|
2853
|
-
*
|
|
2854
|
-
*
|
|
2795
|
+
* Add a callback to this event instance.
|
|
2796
|
+
* @param handler - the callback to be added to this event.
|
|
2855
2797
|
*/
|
|
2856
|
-
|
|
2798
|
+
add(handler: T extends void ? {
|
|
2799
|
+
(): void;
|
|
2800
|
+
} : {
|
|
2801
|
+
(data: T): void;
|
|
2802
|
+
}): void;
|
|
2857
2803
|
/**
|
|
2858
|
-
*
|
|
2859
|
-
*
|
|
2804
|
+
* Removes a callback from this event instance.
|
|
2805
|
+
* @param handler - the callback to be removed from this event.
|
|
2860
2806
|
*/
|
|
2861
|
-
|
|
2807
|
+
remove(handler: T extends void ? {
|
|
2808
|
+
(): void;
|
|
2809
|
+
} : {
|
|
2810
|
+
(data: T): void;
|
|
2811
|
+
}): void;
|
|
2812
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2813
|
+
trigger: (data?: T) => void;
|
|
2814
|
+
/** Gets rid of all the suscribed events. */
|
|
2815
|
+
reset(): void;
|
|
2816
|
+
private handlers;
|
|
2817
|
+
}
|
|
2818
|
+
/**
|
|
2819
|
+
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
|
|
2820
|
+
*/
|
|
2821
|
+
export declare class AsyncEvent<T> {
|
|
2862
2822
|
/**
|
|
2863
|
-
*
|
|
2864
|
-
*
|
|
2823
|
+
* Add a callback to this event instance.
|
|
2824
|
+
* @param handler - the callback to be added to this event.
|
|
2865
2825
|
*/
|
|
2866
|
-
|
|
2826
|
+
add(handler: T extends void ? {
|
|
2827
|
+
(): Promise<void>;
|
|
2828
|
+
} : {
|
|
2829
|
+
(data: T): Promise<void>;
|
|
2830
|
+
}): void;
|
|
2867
2831
|
/**
|
|
2868
|
-
*
|
|
2869
|
-
*
|
|
2832
|
+
* Removes a callback from this event instance.
|
|
2833
|
+
* @param handler - the callback to be removed from this event.
|
|
2870
2834
|
*/
|
|
2871
|
-
|
|
2835
|
+
remove(handler: T extends void ? {
|
|
2836
|
+
(): Promise<void>;
|
|
2837
|
+
} : {
|
|
2838
|
+
(data: T): Promise<void>;
|
|
2839
|
+
}): void;
|
|
2840
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2841
|
+
trigger: (data?: T) => Promise<void>;
|
|
2842
|
+
/** Gets rid of all the suscribed events. */
|
|
2843
|
+
reset(): void;
|
|
2844
|
+
private handlers;
|
|
2872
2845
|
}
|
|
2846
|
+
import * as THREE from "three";
|
|
2847
|
+
import CameraControls from "camera-controls";
|
|
2848
|
+
import { Event } from "./event";
|
|
2873
2849
|
/**
|
|
2874
|
-
*
|
|
2850
|
+
* Whether this component has to be manually destroyed once you are done with it to prevent [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). This also ensures that the DOM events created by that component will be cleaned up.
|
|
2875
2851
|
*/
|
|
2876
|
-
export
|
|
2877
|
-
/** {@link Disposable.onDisposed} */
|
|
2878
|
-
readonly onDisposed: Event<string>;
|
|
2879
|
-
/**
|
|
2880
|
-
* Fires after making the visibility check to the meshes. It lists the
|
|
2881
|
-
* meshes that are currently visible, and the ones that were visible
|
|
2882
|
-
* just before but not anymore.
|
|
2883
|
-
*/
|
|
2884
|
-
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
2885
|
-
/**
|
|
2886
|
-
* Whether this renderer is active or not. If not, it won't render anything.
|
|
2887
|
-
*/
|
|
2888
|
-
enabled: boolean;
|
|
2889
|
-
/**
|
|
2890
|
-
* Needs to check whether there are objects that need to be hidden or shown.
|
|
2891
|
-
* You can bind this to the camera movement, to a certain interval, etc.
|
|
2892
|
-
*/
|
|
2893
|
-
needsUpdate: boolean;
|
|
2894
|
-
/**
|
|
2895
|
-
* Render the internal scene used to determine the object visibility. Used
|
|
2896
|
-
* for debugging purposes.
|
|
2897
|
-
*/
|
|
2898
|
-
renderDebugFrame: boolean;
|
|
2899
|
-
/** The components instance to which this renderer belongs. */
|
|
2900
|
-
components: Components;
|
|
2901
|
-
/** The world instance to which this renderer belongs. */
|
|
2902
|
-
readonly world: World;
|
|
2903
|
-
/** The THREE.js renderer used to make the visibility test. */
|
|
2904
|
-
readonly renderer: THREE.WebGLRenderer;
|
|
2905
|
-
protected autoUpdate: boolean;
|
|
2906
|
-
protected updateInterval: number;
|
|
2907
|
-
protected readonly worker: Worker;
|
|
2908
|
-
protected readonly scene: THREE.Scene;
|
|
2909
|
-
private _width;
|
|
2910
|
-
private _height;
|
|
2911
|
-
private _availableColor;
|
|
2912
|
-
private readonly renderTarget;
|
|
2913
|
-
private readonly bufferSize;
|
|
2914
|
-
private readonly _buffer;
|
|
2915
|
-
protected _isWorkerBusy: boolean;
|
|
2916
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2917
|
-
/** {@link Disposable.dispose} */
|
|
2918
|
-
dispose(): void;
|
|
2852
|
+
export interface Disposable {
|
|
2919
2853
|
/**
|
|
2920
|
-
*
|
|
2921
|
-
*
|
|
2922
|
-
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
2923
|
-
* not true.
|
|
2854
|
+
* Destroys the object from memory to prevent a
|
|
2855
|
+
* [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
2924
2856
|
*/
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
g: number;
|
|
2929
|
-
b: number;
|
|
2930
|
-
code: string;
|
|
2931
|
-
};
|
|
2932
|
-
protected increaseColor(): void;
|
|
2933
|
-
protected decreaseColor(): void;
|
|
2934
|
-
private applySettings;
|
|
2857
|
+
dispose: () => void | Promise<void>;
|
|
2858
|
+
/** Fired after the tool has been disposed. */
|
|
2859
|
+
readonly onDisposed: Event<any>;
|
|
2935
2860
|
}
|
|
2936
|
-
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2937
|
-
import * as THREE from "three";
|
|
2938
|
-
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
2939
|
-
import { Components } from "../../Components";
|
|
2940
|
-
import { Event, World, Disposable } from "../../Types";
|
|
2941
2861
|
/**
|
|
2942
|
-
*
|
|
2862
|
+
* Whether the geometric representation of this component can be hidden or shown in the [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
2943
2863
|
*/
|
|
2944
|
-
export
|
|
2945
|
-
/**
|
|
2946
|
-
* Event triggered when the visibility of meshes is updated.
|
|
2947
|
-
* Contains two sets: seen and unseen.
|
|
2948
|
-
*/
|
|
2949
|
-
readonly onViewUpdated: Event<{
|
|
2950
|
-
seen: Set<THREE.Mesh>;
|
|
2951
|
-
unseen: Set<THREE.Mesh>;
|
|
2952
|
-
}>;
|
|
2953
|
-
/**
|
|
2954
|
-
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
2955
|
-
* Default value is 100.
|
|
2956
|
-
*/
|
|
2957
|
-
threshold: number;
|
|
2958
|
-
/**
|
|
2959
|
-
* Map of color code to THREE.InstancedMesh.
|
|
2960
|
-
* Used to keep track of color-coded meshes.
|
|
2961
|
-
*/
|
|
2962
|
-
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
2963
|
-
/**
|
|
2964
|
-
* Flag to indicate if the renderer is currently processing.
|
|
2965
|
-
* Used to prevent concurrent processing.
|
|
2966
|
-
*/
|
|
2967
|
-
isProcessing: boolean;
|
|
2968
|
-
private _colorCodeMeshMap;
|
|
2969
|
-
private _meshIDColorCodeMap;
|
|
2970
|
-
private _currentVisibleMeshes;
|
|
2971
|
-
private _recentlyHiddenMeshes;
|
|
2972
|
-
private _intervalID;
|
|
2973
|
-
private readonly _transparentMat;
|
|
2974
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2975
|
-
/** {@link Disposable.dispose} */
|
|
2976
|
-
dispose(): void;
|
|
2977
|
-
/**
|
|
2978
|
-
* Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
|
|
2979
|
-
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2980
|
-
* @returns {void}
|
|
2981
|
-
*/
|
|
2982
|
-
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2864
|
+
export interface Hideable {
|
|
2983
2865
|
/**
|
|
2984
|
-
*
|
|
2985
|
-
*
|
|
2986
|
-
*
|
|
2987
|
-
* @returns {void}
|
|
2866
|
+
* Whether the geometric representation of this component is
|
|
2867
|
+
* currently visible or not in the
|
|
2868
|
+
* [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
2988
2869
|
*/
|
|
2989
|
-
|
|
2990
|
-
private handleWorkerMessage;
|
|
2991
|
-
private getAvailableMaterial;
|
|
2870
|
+
visible: boolean;
|
|
2992
2871
|
}
|
|
2993
|
-
import * as THREE from "three";
|
|
2994
|
-
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
2995
2872
|
/**
|
|
2996
|
-
*
|
|
2997
|
-
*
|
|
2998
|
-
* @template T - The type of the scene. Default is BaseScene.
|
|
2999
|
-
* @template U - The type of the camera. Default is BaseCamera.
|
|
3000
|
-
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
2873
|
+
* Whether this component can be resized. The meaning of this can vary depending on the component: resizing a [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) component could mean changing its resolution, whereas resizing a [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
|
|
3001
2874
|
*/
|
|
3002
|
-
export
|
|
3003
|
-
/**
|
|
3004
|
-
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
3005
|
-
*/
|
|
3006
|
-
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
3007
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
3008
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
3009
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
3010
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
3011
|
-
/** {@link Disposable.onDisposed} */
|
|
3012
|
-
readonly onDisposed: Event<unknown>;
|
|
3013
|
-
/**
|
|
3014
|
-
* Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
|
|
3015
|
-
*/
|
|
3016
|
-
isDisposing: boolean;
|
|
2875
|
+
export interface Resizeable {
|
|
3017
2876
|
/**
|
|
3018
|
-
*
|
|
3019
|
-
*
|
|
2877
|
+
* Sets size of this component (e.g. the resolution of a
|
|
2878
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2879
|
+
* component.
|
|
3020
2880
|
*/
|
|
3021
|
-
|
|
2881
|
+
resize: (size?: THREE.Vector2) => void;
|
|
2882
|
+
/** Event that fires when the component has been resized. */
|
|
2883
|
+
onResize: Event<THREE.Vector2>;
|
|
3022
2884
|
/**
|
|
3023
|
-
*
|
|
2885
|
+
* Gets the current size of this component (e.g. the resolution of a
|
|
2886
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2887
|
+
* component.
|
|
3024
2888
|
*/
|
|
3025
|
-
|
|
2889
|
+
getSize: () => THREE.Vector2;
|
|
2890
|
+
}
|
|
2891
|
+
/** Whether this component should be updated each frame. */
|
|
2892
|
+
export interface Updateable {
|
|
2893
|
+
/** Actions that should be executed after updating the component. */
|
|
2894
|
+
onAfterUpdate: Event<any>;
|
|
2895
|
+
/** Actions that should be executed before updating the component. */
|
|
2896
|
+
onBeforeUpdate: Event<any>;
|
|
3026
2897
|
/**
|
|
3027
|
-
*
|
|
2898
|
+
* Function used to update the state of this component each frame. For
|
|
2899
|
+
* instance, a renderer component will make a render each frame.
|
|
3028
2900
|
*/
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
2901
|
+
update(delta?: number): void;
|
|
2902
|
+
}
|
|
2903
|
+
/** Basic type to describe the progress of any kind of process. */
|
|
2904
|
+
export interface Progress {
|
|
2905
|
+
/** The amount of things that have been done already. */
|
|
2906
|
+
current: number;
|
|
2907
|
+
/** The total amount of things to be done by the process. */
|
|
2908
|
+
total: number;
|
|
2909
|
+
}
|
|
2910
|
+
/**
|
|
2911
|
+
* Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
|
|
2912
|
+
*/
|
|
2913
|
+
export interface Createable {
|
|
2914
|
+
/** Creates a new instance of an element (e.g. a new Dimension). */
|
|
2915
|
+
create: (data: any) => void;
|
|
3033
2916
|
/**
|
|
3034
|
-
*
|
|
3035
|
-
*
|
|
2917
|
+
* Finish the creation process of the component, successfully creating an
|
|
2918
|
+
* instance of whatever the component creates.
|
|
3036
2919
|
*/
|
|
3037
|
-
|
|
2920
|
+
endCreation?: (data: any) => void;
|
|
3038
2921
|
/**
|
|
3039
|
-
*
|
|
3040
|
-
*
|
|
3041
|
-
* @param scene - The new scene to be set.
|
|
2922
|
+
* Cancels the creation process of the component, going back to the state
|
|
2923
|
+
* before starting to create.
|
|
3042
2924
|
*/
|
|
3043
|
-
|
|
3044
|
-
/**
|
|
3045
|
-
|
|
3046
|
-
|
|
2925
|
+
cancelCreation?: (data: any) => void;
|
|
2926
|
+
/** Deletes an existing instance of an element (e.g. a Dimension). */
|
|
2927
|
+
delete: (data: any) => void;
|
|
2928
|
+
}
|
|
2929
|
+
/**
|
|
2930
|
+
* Whether this component supports to be configured.
|
|
2931
|
+
*/
|
|
2932
|
+
export interface Configurable<T extends Record<string, any>> {
|
|
2933
|
+
/** Wether this components has been already configured. */
|
|
2934
|
+
isSetup: boolean;
|
|
2935
|
+
/** Use the provided configuration to setup the tool. */
|
|
2936
|
+
setup: (config?: Partial<T>) => void | Promise<void>;
|
|
2937
|
+
/** Fired after successfully calling {@link Configurable.setup()} */
|
|
2938
|
+
readonly onSetup: Event<any>;
|
|
2939
|
+
/** Object holding the tool configuration. Is not meant to be edited directly, if you need
|
|
2940
|
+
* to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
|
|
3047
2941
|
*/
|
|
3048
|
-
|
|
2942
|
+
config: Required<T>;
|
|
2943
|
+
}
|
|
2944
|
+
/**
|
|
2945
|
+
* Whether a camera uses the Camera Controls library.
|
|
2946
|
+
*/
|
|
2947
|
+
export interface CameraControllable {
|
|
3049
2948
|
/**
|
|
3050
|
-
*
|
|
3051
|
-
*
|
|
3052
|
-
* @param camera - The new camera to be set.
|
|
2949
|
+
* An instance of CameraControls that provides camera control functionalities.
|
|
2950
|
+
* This instance is used to manipulate the camera.
|
|
3053
2951
|
*/
|
|
3054
|
-
|
|
2952
|
+
controls: CameraControls;
|
|
2953
|
+
}
|
|
2954
|
+
import { Base } from "./base";
|
|
2955
|
+
import { World } from "./world";
|
|
2956
|
+
import { Event } from "./event";
|
|
2957
|
+
import { Components } from "../../Components";
|
|
2958
|
+
/**
|
|
2959
|
+
* One of the elements that make a world. It can be either a scene, a camera or a renderer.
|
|
2960
|
+
*/
|
|
2961
|
+
export declare abstract class BaseWorldItem extends Base {
|
|
2962
|
+
readonly worlds: Map<string, World>;
|
|
3055
2963
|
/**
|
|
3056
|
-
*
|
|
3057
|
-
*
|
|
2964
|
+
* Event that is triggered when a world is added or removed from the 'worlds' map.
|
|
2965
|
+
* The event payload contains the world instance and the action ("added" or "removed").
|
|
3058
2966
|
*/
|
|
3059
|
-
|
|
2967
|
+
readonly onWorldChanged: Event<{
|
|
2968
|
+
world: World;
|
|
2969
|
+
action: "added" | "removed";
|
|
2970
|
+
}>;
|
|
3060
2971
|
/**
|
|
3061
|
-
*
|
|
3062
|
-
* sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
|
|
3063
|
-
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
3064
|
-
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
2972
|
+
* The current world this item is associated with. It can be null if no world is currently active.
|
|
3065
2973
|
*/
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
update(delta?: number): void;
|
|
3069
|
-
/** {@link Disposable.dispose} */
|
|
3070
|
-
dispose(disposeResources?: boolean): void;
|
|
2974
|
+
currentWorld: World | null;
|
|
2975
|
+
protected constructor(components: Components);
|
|
3071
2976
|
}
|
|
3072
|
-
import
|
|
3073
|
-
import { BaseScene, Configurable, Event } from "../../Types";
|
|
3074
|
-
import { Components } from "../../Components";
|
|
2977
|
+
import { Base } from "./base";
|
|
3075
2978
|
/**
|
|
3076
|
-
*
|
|
2979
|
+
* Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
|
|
3077
2980
|
*/
|
|
3078
|
-
export
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
intensity: number;
|
|
3087
|
-
};
|
|
2981
|
+
export declare abstract class Component extends Base {
|
|
2982
|
+
/**
|
|
2983
|
+
* Whether this component is active or not. The behaviour can vary depending
|
|
2984
|
+
* on the type of component. E.g. a disabled dimension tool will stop creating
|
|
2985
|
+
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
2986
|
+
* will not be updated automatically each frame.
|
|
2987
|
+
*/
|
|
2988
|
+
abstract enabled: boolean;
|
|
3088
2989
|
}
|
|
2990
|
+
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
2991
|
+
import { Components } from "../../Components";
|
|
3089
2992
|
/**
|
|
3090
|
-
*
|
|
2993
|
+
* Base class of the library. Useful for finding out the interfaces something implements.
|
|
3091
2994
|
*/
|
|
3092
|
-
export declare class
|
|
3093
|
-
|
|
3094
|
-
isSetup: boolean;
|
|
3095
|
-
/**
|
|
3096
|
-
* The underlying Three.js scene object.
|
|
3097
|
-
* It is used to define the 3D space containing objects, lights, and cameras.
|
|
3098
|
-
*/
|
|
3099
|
-
three: THREE.Scene;
|
|
3100
|
-
/** {@link Configurable.onSetup} */
|
|
3101
|
-
readonly onSetup: Event<SimpleScene>;
|
|
3102
|
-
/**
|
|
3103
|
-
* Configuration interface for the {@link SimpleScene}.
|
|
3104
|
-
* Defines properties for directional and ambient lights.
|
|
3105
|
-
*/
|
|
3106
|
-
config: Required<SimpleSceneConfig>;
|
|
2995
|
+
export declare abstract class Base {
|
|
2996
|
+
components: Components;
|
|
3107
2997
|
constructor(components: Components);
|
|
3108
|
-
/** {@link
|
|
3109
|
-
|
|
2998
|
+
/** Whether is component is {@link Disposable}. */
|
|
2999
|
+
isDisposeable: () => this is Disposable;
|
|
3000
|
+
/** Whether is component is {@link Resizeable}. */
|
|
3001
|
+
isResizeable: () => this is Resizeable;
|
|
3002
|
+
/** Whether is component is {@link Updateable}. */
|
|
3003
|
+
isUpdateable: () => this is Updateable;
|
|
3004
|
+
/** Whether is component is {@link Hideable}. */
|
|
3005
|
+
isHideable: () => this is Hideable;
|
|
3006
|
+
/** Whether is component is {@link Configurable}. */
|
|
3007
|
+
isConfigurable: () => this is Configurable<any>;
|
|
3110
3008
|
}
|
|
3111
3009
|
import * as THREE from "three";
|
|
3112
|
-
import {
|
|
3113
|
-
import {
|
|
3010
|
+
import { Vector2 } from "three";
|
|
3011
|
+
import { Event } from "./event";
|
|
3012
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
3013
|
+
import { Disposable, Resizeable, Updateable } from "./interfaces";
|
|
3114
3014
|
/**
|
|
3115
|
-
*
|
|
3015
|
+
* Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
|
|
3116
3016
|
*/
|
|
3117
|
-
export declare class
|
|
3017
|
+
export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
|
|
3118
3018
|
/**
|
|
3119
|
-
*
|
|
3120
|
-
*
|
|
3019
|
+
* The three.js WebGLRenderer instance associated with this renderer.
|
|
3020
|
+
*
|
|
3021
|
+
* @abstract
|
|
3022
|
+
* @type {THREE.WebGLRenderer}
|
|
3121
3023
|
*/
|
|
3122
|
-
|
|
3024
|
+
abstract three: THREE.WebGLRenderer;
|
|
3025
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
3026
|
+
onAfterUpdate: Event<unknown>;
|
|
3027
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
3028
|
+
onBeforeUpdate: Event<unknown>;
|
|
3029
|
+
/** {@link Disposable.onDisposed} */
|
|
3030
|
+
readonly onDisposed: Event<undefined>;
|
|
3031
|
+
/** {@link Resizeable.onResize} */
|
|
3032
|
+
readonly onResize: Event<THREE.Vector2>;
|
|
3123
3033
|
/**
|
|
3124
|
-
*
|
|
3034
|
+
* Event that fires when there has been a change to the list of clipping
|
|
3035
|
+
* planes used by the active renderer.
|
|
3125
3036
|
*/
|
|
3126
|
-
|
|
3037
|
+
readonly onClippingPlanesUpdated: Event<unknown>;
|
|
3038
|
+
/** {@link Updateable.update} */
|
|
3039
|
+
abstract update(delta?: number): void | Promise<void>;
|
|
3040
|
+
/** {@link Disposable.dispose} */
|
|
3041
|
+
abstract dispose(): void;
|
|
3042
|
+
/** {@link Resizeable.getSize} */
|
|
3043
|
+
abstract getSize(): Vector2;
|
|
3044
|
+
/** {@link Resizeable.resize} */
|
|
3045
|
+
abstract resize(size: Vector2 | undefined): void;
|
|
3127
3046
|
/**
|
|
3128
|
-
* The
|
|
3047
|
+
* The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
|
|
3129
3048
|
*/
|
|
3130
|
-
|
|
3131
|
-
protected _canvas: HTMLCanvasElement;
|
|
3132
|
-
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
3133
|
-
protected _resizeObserver: ResizeObserver | null;
|
|
3134
|
-
protected onContainerUpdated: Event<unknown>;
|
|
3135
|
-
private _resizing;
|
|
3049
|
+
clippingPlanes: THREE.Plane[];
|
|
3136
3050
|
/**
|
|
3137
|
-
*
|
|
3051
|
+
* Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
|
|
3138
3052
|
*
|
|
3139
|
-
* @
|
|
3140
|
-
*
|
|
3141
|
-
*
|
|
3053
|
+
* @remarks
|
|
3054
|
+
* This method is typically called when there is a change to the list of clipping planes
|
|
3055
|
+
* used by the active renderer.
|
|
3142
3056
|
*/
|
|
3143
|
-
|
|
3144
|
-
/** {@link Updateable.update} */
|
|
3145
|
-
update(): void;
|
|
3146
|
-
/** {@link Disposable.dispose} */
|
|
3147
|
-
dispose(): void;
|
|
3148
|
-
/** {@link Resizeable.getSize}. */
|
|
3149
|
-
getSize(): THREE.Vector2;
|
|
3150
|
-
/** {@link Resizeable.resize} */
|
|
3151
|
-
resize: (size?: THREE.Vector2) => void;
|
|
3057
|
+
updateClippingPlanes(): void;
|
|
3152
3058
|
/**
|
|
3153
|
-
* Sets
|
|
3059
|
+
* Sets or removes a clipping plane from the renderer.
|
|
3154
3060
|
*
|
|
3155
|
-
* @param active - A boolean indicating whether
|
|
3061
|
+
* @param active - A boolean indicating whether the clipping plane should be active or not.
|
|
3062
|
+
* @param plane - The clipping plane to be added or removed.
|
|
3063
|
+
* @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
|
|
3156
3064
|
*
|
|
3157
|
-
* @
|
|
3065
|
+
* @remarks
|
|
3066
|
+
* This method adds or removes a clipping plane from the 'clippingPlanes' array.
|
|
3067
|
+
* If 'active' is 'true' and the plane is not already in the array, it is added.
|
|
3068
|
+
* If 'active' is 'false' and the plane is in the array, it is removed.
|
|
3069
|
+
* The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
|
|
3070
|
+
* excluding any planes marked as local.
|
|
3158
3071
|
*/
|
|
3159
|
-
|
|
3160
|
-
private resizeEvent;
|
|
3161
|
-
private setupRenderer;
|
|
3162
|
-
private onContextLost;
|
|
3163
|
-
private onContextBack;
|
|
3072
|
+
setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
|
|
3164
3073
|
}
|
|
3165
3074
|
import * as THREE from "three";
|
|
3166
3075
|
import CameraControls from "camera-controls";
|
|
3167
|
-
import {
|
|
3168
|
-
import {
|
|
3076
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
3077
|
+
import { CameraControllable } from "./interfaces";
|
|
3169
3078
|
/**
|
|
3170
|
-
*
|
|
3079
|
+
* Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
|
|
3171
3080
|
*/
|
|
3172
|
-
export declare class
|
|
3173
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
3174
|
-
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
3175
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
3176
|
-
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
3081
|
+
export declare abstract class BaseCamera extends BaseWorldItem {
|
|
3177
3082
|
/**
|
|
3178
|
-
*
|
|
3179
|
-
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
3083
|
+
* Whether the camera is enabled or not.
|
|
3180
3084
|
*/
|
|
3181
|
-
|
|
3182
|
-
/** {@link Disposable.onDisposed} */
|
|
3183
|
-
readonly onDisposed: Event<string>;
|
|
3085
|
+
abstract enabled: boolean;
|
|
3184
3086
|
/**
|
|
3185
|
-
*
|
|
3186
|
-
* This camera is used for rendering the scene.
|
|
3087
|
+
* The Three.js camera instance.
|
|
3187
3088
|
*/
|
|
3188
|
-
three: THREE.
|
|
3189
|
-
private _allControls;
|
|
3089
|
+
abstract three: THREE.Camera;
|
|
3190
3090
|
/**
|
|
3191
|
-
*
|
|
3192
|
-
*
|
|
3193
|
-
* Transforming the camera directly will have no effect: you need to use this
|
|
3194
|
-
* object to move, rotate, look at objects, etc.
|
|
3091
|
+
* Optional CameraControls instance for controlling the camera.
|
|
3092
|
+
* This property is only available if the camera is controllable.
|
|
3195
3093
|
*/
|
|
3196
|
-
|
|
3094
|
+
abstract controls?: CameraControls;
|
|
3197
3095
|
/**
|
|
3198
|
-
*
|
|
3199
|
-
* If the current world is null, it returns false.
|
|
3200
|
-
* Otherwise, it returns the enabled state of the camera controls.
|
|
3096
|
+
* Checks whether the instance is {@link CameraControllable}.
|
|
3201
3097
|
*
|
|
3202
|
-
* @returns
|
|
3098
|
+
* @returns True if the instance is controllable, false otherwise.
|
|
3203
3099
|
*/
|
|
3204
|
-
|
|
3100
|
+
hasCameraControls: () => this is CameraControllable;
|
|
3101
|
+
}
|
|
3102
|
+
import * as THREE from "three";
|
|
3103
|
+
import { Disposable } from "./interfaces";
|
|
3104
|
+
import { Event } from "./event";
|
|
3105
|
+
import { Components } from "../../Components";
|
|
3106
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
3107
|
+
/**
|
|
3108
|
+
* Abstract class representing a base scene in the application. All scenes should use this class as a base.
|
|
3109
|
+
*/
|
|
3110
|
+
export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
|
|
3111
|
+
/** {@link Disposable.onDisposed} */
|
|
3112
|
+
readonly onDisposed: Event<unknown>;
|
|
3205
3113
|
/**
|
|
3206
|
-
*
|
|
3207
|
-
*
|
|
3208
|
-
*
|
|
3209
|
-
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
3114
|
+
* Abstract property representing the three.js object associated with this scene.
|
|
3115
|
+
* It should be implemented by subclasses.
|
|
3210
3116
|
*/
|
|
3211
|
-
|
|
3212
|
-
constructor(components: Components);
|
|
3117
|
+
abstract three: THREE.Object3D;
|
|
3118
|
+
protected constructor(components: Components);
|
|
3213
3119
|
/** {@link Disposable.dispose} */
|
|
3214
3120
|
dispose(): void;
|
|
3215
|
-
/** {@link Updateable.update} */
|
|
3216
|
-
update(_delta: number): void;
|
|
3217
|
-
/**
|
|
3218
|
-
* Updates the aspect of the camera to match the size of the
|
|
3219
|
-
* {@link Components.renderer}.
|
|
3220
|
-
*/
|
|
3221
|
-
updateAspect: () => void;
|
|
3222
|
-
private setupCamera;
|
|
3223
|
-
private newCameraControls;
|
|
3224
|
-
private setupEvents;
|
|
3225
|
-
private static getSubsetOfThree;
|
|
3226
3121
|
}
|
|
3227
3122
|
import * as THREE from "three";
|
|
3228
|
-
import {
|
|
3229
|
-
import {
|
|
3123
|
+
import { BaseScene } from "./base-scene";
|
|
3124
|
+
import { BaseCamera } from "./base-camera";
|
|
3125
|
+
import { BaseRenderer } from "./base-renderer";
|
|
3126
|
+
import { Updateable, Disposable } from "./interfaces";
|
|
3230
3127
|
/**
|
|
3231
|
-
*
|
|
3128
|
+
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
3232
3129
|
*/
|
|
3233
|
-
export interface
|
|
3130
|
+
export interface World extends Disposable, Updateable {
|
|
3234
3131
|
/**
|
|
3235
|
-
*
|
|
3132
|
+
* A set of meshes present in the world. This is taken into account for operations like raycasting.
|
|
3236
3133
|
*/
|
|
3237
|
-
|
|
3134
|
+
meshes: Set<THREE.Mesh>;
|
|
3238
3135
|
/**
|
|
3239
|
-
* The
|
|
3136
|
+
* The base scene of the world.
|
|
3240
3137
|
*/
|
|
3241
|
-
|
|
3138
|
+
scene: BaseScene;
|
|
3242
3139
|
/**
|
|
3243
|
-
* The
|
|
3140
|
+
* The base camera of the world.
|
|
3244
3141
|
*/
|
|
3245
|
-
|
|
3142
|
+
camera: BaseCamera;
|
|
3246
3143
|
/**
|
|
3247
|
-
* The
|
|
3144
|
+
* The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
|
|
3248
3145
|
*/
|
|
3249
|
-
|
|
3250
|
-
}
|
|
3251
|
-
/**
|
|
3252
|
-
* An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
|
|
3253
|
-
*/
|
|
3254
|
-
export declare class SimpleGrid implements Hideable, Disposable {
|
|
3255
|
-
/** {@link Disposable.onDisposed} */
|
|
3256
|
-
readonly onDisposed: Event<unknown>;
|
|
3257
|
-
/** The world instance to which this Raycaster belongs. */
|
|
3258
|
-
world: World;
|
|
3259
|
-
/** The components instance to which this grid belongs. */
|
|
3260
|
-
components: Components;
|
|
3261
|
-
/** {@link Hideable.visible} */
|
|
3262
|
-
get visible(): boolean;
|
|
3263
|
-
/** {@link Hideable.visible} */
|
|
3264
|
-
set visible(visible: boolean);
|
|
3265
|
-
/** The material of the grid. */
|
|
3266
|
-
get material(): THREE.ShaderMaterial;
|
|
3146
|
+
renderer: BaseRenderer | null;
|
|
3267
3147
|
/**
|
|
3268
|
-
*
|
|
3269
|
-
* perspective cameras and false for orthographic cameras.
|
|
3148
|
+
* A unique identifier for the world.
|
|
3270
3149
|
*/
|
|
3271
|
-
|
|
3150
|
+
uuid: string;
|
|
3272
3151
|
/**
|
|
3273
|
-
*
|
|
3274
|
-
* perspective cameras and false for orthographic cameras.
|
|
3152
|
+
* Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
|
|
3275
3153
|
*/
|
|
3276
|
-
|
|
3277
|
-
/** The Three.js mesh that contains the infinite grid. */
|
|
3278
|
-
readonly three: THREE.Mesh;
|
|
3279
|
-
private _fade;
|
|
3280
|
-
constructor(components: Components, world: World, config: GridConfig);
|
|
3281
|
-
/** {@link Disposable.dispose} */
|
|
3282
|
-
dispose(): void;
|
|
3283
|
-
private setupEvents;
|
|
3284
|
-
private updateZoom;
|
|
3154
|
+
isDisposing: boolean;
|
|
3285
3155
|
}
|
|
3286
3156
|
import * as THREE from "three";
|
|
3287
3157
|
import { Hideable, Disposable, Event, World } from "../../Types";
|
|
@@ -3380,6 +3250,145 @@ export declare class SimplePlane implements Disposable, Hideable {
|
|
|
3380
3250
|
private newHelper;
|
|
3381
3251
|
private static newPlaneMesh;
|
|
3382
3252
|
}
|
|
3253
|
+
import { NavigationMode } from "./types";
|
|
3254
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3255
|
+
/**
|
|
3256
|
+
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
3257
|
+
*/
|
|
3258
|
+
export declare class FirstPersonMode implements NavigationMode {
|
|
3259
|
+
private camera;
|
|
3260
|
+
/** {@link NavigationMode.enabled} */
|
|
3261
|
+
enabled: boolean;
|
|
3262
|
+
/** {@link NavigationMode.id} */
|
|
3263
|
+
readonly id = "FirstPerson";
|
|
3264
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3265
|
+
/** {@link NavigationMode.set} */
|
|
3266
|
+
set(active: boolean): void;
|
|
3267
|
+
private setupFirstPersonCamera;
|
|
3268
|
+
}
|
|
3269
|
+
import { NavigationMode } from "./types";
|
|
3270
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3271
|
+
/**
|
|
3272
|
+
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
3273
|
+
*/
|
|
3274
|
+
export declare class OrbitMode implements NavigationMode {
|
|
3275
|
+
camera: OrthoPerspectiveCamera;
|
|
3276
|
+
/** {@link NavigationMode.enabled} */
|
|
3277
|
+
enabled: boolean;
|
|
3278
|
+
/** {@link NavigationMode.id} */
|
|
3279
|
+
readonly id = "Orbit";
|
|
3280
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3281
|
+
/** {@link NavigationMode.set} */
|
|
3282
|
+
set(active: boolean): void;
|
|
3283
|
+
private activateOrbitControls;
|
|
3284
|
+
}
|
|
3285
|
+
import { NavigationMode } from "./types";
|
|
3286
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3287
|
+
/**
|
|
3288
|
+
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3289
|
+
*/
|
|
3290
|
+
export declare class PlanMode implements NavigationMode {
|
|
3291
|
+
private camera;
|
|
3292
|
+
/** {@link NavigationMode.enabled} */
|
|
3293
|
+
enabled: boolean;
|
|
3294
|
+
/** {@link NavigationMode.id} */
|
|
3295
|
+
readonly id = "Plan";
|
|
3296
|
+
private mouseAction1?;
|
|
3297
|
+
private mouseAction2?;
|
|
3298
|
+
private mouseInitialized;
|
|
3299
|
+
private readonly defaultAzimuthSpeed;
|
|
3300
|
+
private readonly defaultPolarSpeed;
|
|
3301
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3302
|
+
/** {@link NavigationMode.set} */
|
|
3303
|
+
set(active: boolean): void;
|
|
3304
|
+
}
|
|
3305
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3306
|
+
/**
|
|
3307
|
+
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3308
|
+
*/
|
|
3309
|
+
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
3310
|
+
/**
|
|
3311
|
+
* Amount of properties to be streamed.
|
|
3312
|
+
* Defaults to 100 properties.
|
|
3313
|
+
*/
|
|
3314
|
+
propertiesSize: number;
|
|
3315
|
+
}
|
|
3316
|
+
import * as THREE from "three";
|
|
3317
|
+
import { CameraProjection } from "./types";
|
|
3318
|
+
import { Event } from "../../Types";
|
|
3319
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3320
|
+
/**
|
|
3321
|
+
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3322
|
+
*/
|
|
3323
|
+
export declare class ProjectionManager {
|
|
3324
|
+
/**
|
|
3325
|
+
* Event that fires when the {@link CameraProjection} changes.
|
|
3326
|
+
*/
|
|
3327
|
+
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3328
|
+
/**
|
|
3329
|
+
* Current projection mode of the camera.
|
|
3330
|
+
* Default is "Perspective".
|
|
3331
|
+
*/
|
|
3332
|
+
current: CameraProjection;
|
|
3333
|
+
/**
|
|
3334
|
+
* The camera controlled by this ProjectionManager.
|
|
3335
|
+
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3336
|
+
*/
|
|
3337
|
+
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3338
|
+
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3339
|
+
matchOrthoDistanceEnabled: boolean;
|
|
3340
|
+
private _component;
|
|
3341
|
+
private _previousDistance;
|
|
3342
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3343
|
+
/**
|
|
3344
|
+
* Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3345
|
+
*
|
|
3346
|
+
* @param projection - the new projection to set. If it is the current projection,
|
|
3347
|
+
* it will have no effect.
|
|
3348
|
+
*/
|
|
3349
|
+
set(projection: CameraProjection): Promise<void>;
|
|
3350
|
+
/**
|
|
3351
|
+
* Changes the current {@link CameraProjection} from Ortographic to Perspective
|
|
3352
|
+
* and vice versa.
|
|
3353
|
+
*/
|
|
3354
|
+
toggle(): Promise<void>;
|
|
3355
|
+
private setOrthoCamera;
|
|
3356
|
+
private getPerspectiveDims;
|
|
3357
|
+
private setupOrthoCamera;
|
|
3358
|
+
private getDistance;
|
|
3359
|
+
private setPerspectiveCamera;
|
|
3360
|
+
}
|
|
3361
|
+
/**
|
|
3362
|
+
* The projection system of the camera.
|
|
3363
|
+
*/
|
|
3364
|
+
export type CameraProjection = "Perspective" | "Orthographic";
|
|
3365
|
+
/**
|
|
3366
|
+
* The extensible list of supported navigation modes.
|
|
3367
|
+
*/
|
|
3368
|
+
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
3369
|
+
/**
|
|
3370
|
+
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3371
|
+
*/
|
|
3372
|
+
export interface NavigationMode {
|
|
3373
|
+
/** The unique ID of this navigation mode. */
|
|
3374
|
+
id: NavModeID;
|
|
3375
|
+
/**
|
|
3376
|
+
* Enable or disable this navigation mode.
|
|
3377
|
+
* When a new navigation mode is enabled, the previous navigation mode
|
|
3378
|
+
* must be disabled.
|
|
3379
|
+
*
|
|
3380
|
+
* @param active - whether to enable or disable this mode.
|
|
3381
|
+
* @param options - any additional data required to enable or disable it.
|
|
3382
|
+
* */
|
|
3383
|
+
set: (active: boolean, options?: any) => void;
|
|
3384
|
+
/** Whether this navigation mode is active or not. */
|
|
3385
|
+
enabled: boolean;
|
|
3386
|
+
}
|
|
3387
|
+
import * as WEBIFC from "web-ifc";
|
|
3388
|
+
export declare class IfcMetadataReader {
|
|
3389
|
+
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3390
|
+
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3391
|
+
}
|
|
3383
3392
|
import * as THREE from "three";
|
|
3384
3393
|
import * as WEBIFC from "web-ifc";
|
|
3385
3394
|
import * as FRAGS from "@thatopen/fragments";
|
|
@@ -3395,11 +3404,6 @@ export declare class CivilReader {
|
|
|
3395
3404
|
} | undefined;
|
|
3396
3405
|
private getCurves;
|
|
3397
3406
|
}
|
|
3398
|
-
import * as WEBIFC from "web-ifc";
|
|
3399
|
-
export declare class IfcMetadataReader {
|
|
3400
|
-
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3401
|
-
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3402
|
-
}
|
|
3403
3407
|
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3404
3408
|
/**
|
|
3405
3409
|
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
@@ -3416,6 +3420,16 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
|
3416
3420
|
*/
|
|
3417
3421
|
minAssetsSize: number;
|
|
3418
3422
|
}
|
|
3423
|
+
import * as WEBIFC from "web-ifc";
|
|
3424
|
+
import * as THREE from "three";
|
|
3425
|
+
export declare class Units {
|
|
3426
|
+
factor: number;
|
|
3427
|
+
complement: number;
|
|
3428
|
+
apply(matrix: THREE.Matrix4): void;
|
|
3429
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3430
|
+
private getLengthUnits;
|
|
3431
|
+
private getScaleMatrix;
|
|
3432
|
+
}
|
|
3419
3433
|
/**
|
|
3420
3434
|
* A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
|
|
3421
3435
|
*/
|
|
@@ -3469,16 +3483,6 @@ export type InverseAttributes = [
|
|
|
3469
3483
|
"ContainsElements"
|
|
3470
3484
|
];
|
|
3471
3485
|
export type InverseAttribute = InverseAttributes[number];
|
|
3472
|
-
import * as WEBIFC from "web-ifc";
|
|
3473
|
-
import * as THREE from "three";
|
|
3474
|
-
export declare class Units {
|
|
3475
|
-
factor: number;
|
|
3476
|
-
complement: number;
|
|
3477
|
-
apply(matrix: THREE.Matrix4): void;
|
|
3478
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3479
|
-
private getLengthUnits;
|
|
3480
|
-
private getScaleMatrix;
|
|
3481
|
-
}
|
|
3482
3486
|
import { BufferGeometry } from "three";
|
|
3483
3487
|
import * as THREE from "three";
|
|
3484
3488
|
export declare class TransformHelper {
|