@thatopen/components 2.0.21 → 2.0.23
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 +5 -5
- package/dist/index.mjs +166 -165
- package/dist/namespace.d.ts +2031 -2031
- package/package.json +1 -1
package/dist/namespace.d.ts
CHANGED
|
@@ -1,240 +1,4 @@
|
|
|
1
1
|
declare namespace OBC {
|
|
2
|
-
import { Component, Disposable, Event } from "../Types";
|
|
3
|
-
/**
|
|
4
|
-
* The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
|
|
5
|
-
*/
|
|
6
|
-
export declare class Components implements Disposable {
|
|
7
|
-
/**
|
|
8
|
-
* The version of the @thatopen/components library.
|
|
9
|
-
*/
|
|
10
|
-
static readonly release = "2.0.21";
|
|
11
|
-
/** {@link Disposable.onDisposed} */
|
|
12
|
-
readonly onDisposed: Event<void>;
|
|
13
|
-
/**
|
|
14
|
-
* The list of components created in this app.
|
|
15
|
-
* The keys are UUIDs and the values are instances of the components.
|
|
16
|
-
*/
|
|
17
|
-
readonly list: Map<string, Component>;
|
|
18
|
-
/**
|
|
19
|
-
* If disabled, the animation loop will be stopped.
|
|
20
|
-
* Default value is false.
|
|
21
|
-
*/
|
|
22
|
-
enabled: boolean;
|
|
23
|
-
private _clock;
|
|
24
|
-
/**
|
|
25
|
-
* Adds a component to the list of components.
|
|
26
|
-
* Throws an error if a component with the same UUID already exists.
|
|
27
|
-
*
|
|
28
|
-
* @param uuid - The unique identifier of the component.
|
|
29
|
-
* @param instance - The instance of the component to be added.
|
|
30
|
-
*
|
|
31
|
-
* @throws Will throw an error if a component with the same UUID already exists.
|
|
32
|
-
*
|
|
33
|
-
* @internal
|
|
34
|
-
*/
|
|
35
|
-
add(uuid: string, instance: Component): void;
|
|
36
|
-
/**
|
|
37
|
-
* Retrieves a component instance by its constructor function.
|
|
38
|
-
* If the component does not exist in the list, it will be created and added.
|
|
39
|
-
*
|
|
40
|
-
* @template U - The type of the component to retrieve.
|
|
41
|
-
* @param Component - The constructor function of the component to retrieve.
|
|
42
|
-
*
|
|
43
|
-
* @returns The instance of the requested component.
|
|
44
|
-
*
|
|
45
|
-
* @throws Will throw an error if a component with the same UUID already exists.
|
|
46
|
-
*
|
|
47
|
-
* @internal
|
|
48
|
-
*/
|
|
49
|
-
get<U extends Component>(Component: new (components: Components) => U): U;
|
|
50
|
-
constructor();
|
|
51
|
-
/**
|
|
52
|
-
* Initializes the Components instance.
|
|
53
|
-
* This method starts the animation loop, sets the enabled flag to true,
|
|
54
|
-
* and calls the update method.
|
|
55
|
-
*
|
|
56
|
-
* @returns {void}
|
|
57
|
-
*/
|
|
58
|
-
init(): void;
|
|
59
|
-
/**
|
|
60
|
-
* Disposes the memory of all the components and tools of this instance of
|
|
61
|
-
* the library. A memory leak will be created if:
|
|
62
|
-
*
|
|
63
|
-
* - An instance of the library ends up out of scope and this function isn't
|
|
64
|
-
* called. This is especially relevant in Single Page Applications (React,
|
|
65
|
-
* Angular, Vue, etc).
|
|
66
|
-
*
|
|
67
|
-
* - Any of the objects of this instance (meshes, geometries,materials, etc) is
|
|
68
|
-
* referenced by a reference type (object or array).
|
|
69
|
-
*
|
|
70
|
-
* You can learn more about how Three.js handles memory leaks
|
|
71
|
-
* [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
72
|
-
*
|
|
73
|
-
*/
|
|
74
|
-
dispose(): void;
|
|
75
|
-
private update;
|
|
76
|
-
private static setupBVH;
|
|
77
|
-
}
|
|
78
|
-
import * as THREE from "three";
|
|
79
|
-
import { Components } from "../Components";
|
|
80
|
-
import { Component } from "../Types";
|
|
81
|
-
/**
|
|
82
|
-
* A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
83
|
-
*/
|
|
84
|
-
export declare class Disposer extends Component {
|
|
85
|
-
private _disposedComponents;
|
|
86
|
-
/** {@link Component.enabled} */
|
|
87
|
-
enabled: boolean;
|
|
88
|
-
/**
|
|
89
|
-
* A unique identifier for the component.
|
|
90
|
-
* This UUID is used to register the component within the Components system.
|
|
91
|
-
*/
|
|
92
|
-
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
93
|
-
constructor(components: Components);
|
|
94
|
-
/**
|
|
95
|
-
* Return the UUIDs of all disposed components.
|
|
96
|
-
*/
|
|
97
|
-
get(): Set<string>;
|
|
98
|
-
/**
|
|
99
|
-
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
100
|
-
* using any of these in other parts of the application, make sure that you
|
|
101
|
-
* remove them from the mesh before disposing it.
|
|
102
|
-
*
|
|
103
|
-
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
104
|
-
* to remove.
|
|
105
|
-
*
|
|
106
|
-
* @param materials - whether to dispose the materials of the mesh.
|
|
107
|
-
*
|
|
108
|
-
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
109
|
-
*/
|
|
110
|
-
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
111
|
-
/**
|
|
112
|
-
* Disposes a geometry from memory.
|
|
113
|
-
*
|
|
114
|
-
* @param geometry - the
|
|
115
|
-
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
116
|
-
* to remove.
|
|
117
|
-
*/
|
|
118
|
-
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
119
|
-
private disposeGeometryAndMaterials;
|
|
120
|
-
private disposeChildren;
|
|
121
|
-
private static disposeMaterial;
|
|
122
|
-
}
|
|
123
|
-
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
124
|
-
import { Components } from "../Components";
|
|
125
|
-
import { SimpleWorld } from "./src";
|
|
126
|
-
/**
|
|
127
|
-
* A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
|
|
128
|
-
*/
|
|
129
|
-
export declare class Worlds extends Component implements Updateable, Disposable {
|
|
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: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
|
|
135
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
136
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
137
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
138
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
139
|
-
/** {@link Disposable.onDisposed} */
|
|
140
|
-
readonly onDisposed: Event<unknown>;
|
|
141
|
-
/**
|
|
142
|
-
* An event that is triggered when a new world is created.
|
|
143
|
-
* The event passes the newly created world as a parameter.
|
|
144
|
-
*/
|
|
145
|
-
readonly onWorldCreated: Event<World>;
|
|
146
|
-
/**
|
|
147
|
-
* An event that is triggered when a world is deleted.
|
|
148
|
-
* The event passes the UUID of the deleted world as a parameter.
|
|
149
|
-
*/
|
|
150
|
-
readonly onWorldDeleted: Event<string>;
|
|
151
|
-
/**
|
|
152
|
-
* A collection of worlds managed by this component.
|
|
153
|
-
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
154
|
-
*/
|
|
155
|
-
list: Map<string, World>;
|
|
156
|
-
/** {@link Component.enabled} */
|
|
157
|
-
enabled: boolean;
|
|
158
|
-
constructor(components: Components);
|
|
159
|
-
/**
|
|
160
|
-
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
161
|
-
*
|
|
162
|
-
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
163
|
-
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
164
|
-
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
165
|
-
*
|
|
166
|
-
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
167
|
-
*/
|
|
168
|
-
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
169
|
-
/**
|
|
170
|
-
* Deletes a world from the list of worlds.
|
|
171
|
-
*
|
|
172
|
-
* @param {World} world - The world to be deleted.
|
|
173
|
-
*
|
|
174
|
-
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
175
|
-
*
|
|
176
|
-
* @returns {void}
|
|
177
|
-
*/
|
|
178
|
-
delete(world: World): void;
|
|
179
|
-
/**
|
|
180
|
-
* Disposes of the Worlds component and all its managed worlds.
|
|
181
|
-
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
182
|
-
* and triggers the onDisposed event.
|
|
183
|
-
*
|
|
184
|
-
* @returns {void}
|
|
185
|
-
*/
|
|
186
|
-
dispose(): void;
|
|
187
|
-
/** {@link Updateable.update} */
|
|
188
|
-
update(delta?: number): void | Promise<void>;
|
|
189
|
-
}
|
|
190
|
-
import { Components } from "../Components";
|
|
191
|
-
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
192
|
-
import { Component, Event, Disposable, World } from "../Types";
|
|
193
|
-
/**
|
|
194
|
-
* 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).
|
|
195
|
-
*/
|
|
196
|
-
export declare class Cullers extends Component implements Disposable {
|
|
197
|
-
/**
|
|
198
|
-
* A unique identifier for the component.
|
|
199
|
-
* This UUID is used to register the component within the Components system.
|
|
200
|
-
*/
|
|
201
|
-
static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
|
|
202
|
-
/**
|
|
203
|
-
* An event that is triggered when the Cullers component is disposed.
|
|
204
|
-
*/
|
|
205
|
-
readonly onDisposed: Event<unknown>;
|
|
206
|
-
private _enabled;
|
|
207
|
-
/**
|
|
208
|
-
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
209
|
-
*/
|
|
210
|
-
list: Map<string, MeshCullerRenderer>;
|
|
211
|
-
/** {@link Component.enabled} */
|
|
212
|
-
get enabled(): boolean;
|
|
213
|
-
/** {@link Component.enabled} */
|
|
214
|
-
set enabled(value: boolean);
|
|
215
|
-
constructor(components: Components);
|
|
216
|
-
/**
|
|
217
|
-
* Creates a new MeshCullerRenderer for the given world.
|
|
218
|
-
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
219
|
-
*
|
|
220
|
-
* @param world - The world for which to create the MeshCullerRenderer.
|
|
221
|
-
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
222
|
-
*
|
|
223
|
-
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
224
|
-
*/
|
|
225
|
-
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
226
|
-
/**
|
|
227
|
-
* Deletes the MeshCullerRenderer associated with the given world.
|
|
228
|
-
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
229
|
-
*
|
|
230
|
-
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
231
|
-
*
|
|
232
|
-
* @returns {void}
|
|
233
|
-
*/
|
|
234
|
-
delete(world: World): void;
|
|
235
|
-
/** {@link Disposable.dispose} */
|
|
236
|
-
dispose(): void;
|
|
237
|
-
}
|
|
238
2
|
import * as THREE from "three";
|
|
239
3
|
import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
|
|
240
4
|
import { SimplePlane } from "./src";
|
|
@@ -362,165 +126,126 @@ export declare class Clipper extends Component implements Createable, Disposable
|
|
|
362
126
|
private _onStartDragging;
|
|
363
127
|
private _onEndDragging;
|
|
364
128
|
}
|
|
365
|
-
import
|
|
366
|
-
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
129
|
+
import * as THREE from "three";
|
|
367
130
|
import { Components } from "../Components";
|
|
131
|
+
import { Component } from "../Types";
|
|
368
132
|
/**
|
|
369
|
-
* A
|
|
133
|
+
* 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).
|
|
370
134
|
*/
|
|
371
|
-
export declare class
|
|
135
|
+
export declare class Disposer extends Component {
|
|
136
|
+
private _disposedComponents;
|
|
137
|
+
/** {@link Component.enabled} */
|
|
138
|
+
enabled: boolean;
|
|
372
139
|
/**
|
|
373
140
|
* A unique identifier for the component.
|
|
374
141
|
* This UUID is used to register the component within the Components system.
|
|
375
142
|
*/
|
|
376
|
-
static readonly uuid: "
|
|
377
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
378
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
379
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
380
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
381
|
-
/** {@link Disposable.onDisposed} */
|
|
382
|
-
readonly onDisposed: Event<unknown>;
|
|
383
|
-
/** {@link Component.enabled} */
|
|
384
|
-
enabled: boolean;
|
|
385
|
-
/**
|
|
386
|
-
* A collection of {@link MiniMap} instances, each associated with a unique world ID.
|
|
387
|
-
*/
|
|
388
|
-
list: Map<string, MiniMap>;
|
|
143
|
+
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
389
144
|
constructor(components: Components);
|
|
390
145
|
/**
|
|
391
|
-
*
|
|
392
|
-
|
|
146
|
+
* Return the UUIDs of all disposed components.
|
|
147
|
+
*/
|
|
148
|
+
get(): Set<string>;
|
|
149
|
+
/**
|
|
150
|
+
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
151
|
+
* using any of these in other parts of the application, make sure that you
|
|
152
|
+
* remove them from the mesh before disposing it.
|
|
393
153
|
*
|
|
394
|
-
* @param
|
|
395
|
-
*
|
|
396
|
-
*
|
|
154
|
+
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
155
|
+
* to remove.
|
|
156
|
+
*
|
|
157
|
+
* @param materials - whether to dispose the materials of the mesh.
|
|
158
|
+
*
|
|
159
|
+
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
397
160
|
*/
|
|
398
|
-
|
|
161
|
+
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
399
162
|
/**
|
|
400
|
-
*
|
|
401
|
-
* If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
|
|
163
|
+
* Disposes a geometry from memory.
|
|
402
164
|
*
|
|
403
|
-
* @param
|
|
404
|
-
*
|
|
165
|
+
* @param geometry - the
|
|
166
|
+
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
167
|
+
* to remove.
|
|
405
168
|
*/
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
update(): void;
|
|
169
|
+
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
170
|
+
private disposeGeometryAndMaterials;
|
|
171
|
+
private disposeChildren;
|
|
172
|
+
private static disposeMaterial;
|
|
411
173
|
}
|
|
412
|
-
import { Component, Disposable,
|
|
413
|
-
import { GridConfig, SimpleGrid } from "./src";
|
|
414
|
-
import { Components } from "../Components";
|
|
174
|
+
import { Component, Disposable, Event } from "../Types";
|
|
415
175
|
/**
|
|
416
|
-
*
|
|
176
|
+
* The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
|
|
417
177
|
*/
|
|
418
|
-
export declare class
|
|
178
|
+
export declare class Components implements Disposable {
|
|
419
179
|
/**
|
|
420
|
-
*
|
|
421
|
-
* This UUID is used to register the component within the Components system.
|
|
180
|
+
* The version of the @thatopen/components library.
|
|
422
181
|
*/
|
|
423
|
-
static readonly
|
|
182
|
+
static readonly release = "2.0.23";
|
|
183
|
+
/** {@link Disposable.onDisposed} */
|
|
184
|
+
readonly onDisposed: Event<void>;
|
|
424
185
|
/**
|
|
425
|
-
*
|
|
186
|
+
* The list of components created in this app.
|
|
187
|
+
* The keys are UUIDs and the values are instances of the components.
|
|
426
188
|
*/
|
|
427
|
-
list: Map<string,
|
|
189
|
+
readonly list: Map<string, Component>;
|
|
428
190
|
/**
|
|
429
|
-
*
|
|
191
|
+
* If disabled, the animation loop will be stopped.
|
|
192
|
+
* Default value is false.
|
|
430
193
|
*/
|
|
431
|
-
config: Required<GridConfig>;
|
|
432
|
-
/** {@link Disposable.onDisposed} */
|
|
433
|
-
readonly onDisposed: Event<unknown>;
|
|
434
|
-
/** {@link Component.enabled} */
|
|
435
194
|
enabled: boolean;
|
|
436
|
-
|
|
195
|
+
private _clock;
|
|
437
196
|
/**
|
|
438
|
-
*
|
|
439
|
-
* Throws an error if a
|
|
197
|
+
* Adds a component to the list of components.
|
|
198
|
+
* Throws an error if a component with the same UUID already exists.
|
|
440
199
|
*
|
|
441
|
-
* @param
|
|
442
|
-
* @
|
|
200
|
+
* @param uuid - The unique identifier of the component.
|
|
201
|
+
* @param instance - The instance of the component to be added.
|
|
443
202
|
*
|
|
444
|
-
* @throws Will throw an error if a
|
|
203
|
+
* @throws Will throw an error if a component with the same UUID already exists.
|
|
204
|
+
*
|
|
205
|
+
* @internal
|
|
445
206
|
*/
|
|
446
|
-
|
|
207
|
+
add(uuid: string, instance: Component): void;
|
|
447
208
|
/**
|
|
448
|
-
*
|
|
449
|
-
* If
|
|
209
|
+
* Retrieves a component instance by its constructor function.
|
|
210
|
+
* If the component does not exist in the list, it will be created and added.
|
|
450
211
|
*
|
|
451
|
-
* @
|
|
212
|
+
* @template U - The type of the component to retrieve.
|
|
213
|
+
* @param Component - The constructor function of the component to retrieve.
|
|
452
214
|
*
|
|
453
|
-
* @
|
|
454
|
-
* This method will dispose of the grid and remove it from the internal list.
|
|
455
|
-
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
456
|
-
*/
|
|
457
|
-
delete(world: World): void;
|
|
458
|
-
/** {@link Disposable.dispose} */
|
|
459
|
-
dispose(): void;
|
|
460
|
-
}
|
|
461
|
-
import * as THREE from "three";
|
|
462
|
-
import { Components } from "../Components";
|
|
463
|
-
import { SimpleCamera } from "..";
|
|
464
|
-
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
465
|
-
/**
|
|
466
|
-
* 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).
|
|
467
|
-
*/
|
|
468
|
-
export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
469
|
-
/**
|
|
470
|
-
* A ProjectionManager instance that manages the projection modes of the camera.
|
|
471
|
-
*/
|
|
472
|
-
readonly projection: ProjectionManager;
|
|
473
|
-
/**
|
|
474
|
-
* A THREE.OrthographicCamera instance that represents the orthographic camera.
|
|
475
|
-
* This camera is used when the projection mode is set to orthographic.
|
|
476
|
-
*/
|
|
477
|
-
readonly threeOrtho: THREE.OrthographicCamera;
|
|
478
|
-
/**
|
|
479
|
-
* A THREE.PerspectiveCamera instance that represents the perspective camera.
|
|
480
|
-
* This camera is used when the projection mode is set to perspective.
|
|
481
|
-
*/
|
|
482
|
-
readonly threePersp: THREE.PerspectiveCamera;
|
|
483
|
-
protected readonly _userInputButtons: any;
|
|
484
|
-
protected readonly _frustumSize = 50;
|
|
485
|
-
protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
|
|
486
|
-
protected _mode: NavigationMode | null;
|
|
487
|
-
private previousSize;
|
|
488
|
-
/**
|
|
489
|
-
* Getter for the current navigation mode.
|
|
490
|
-
* Throws an error if the mode is not found or the camera is not initialized.
|
|
215
|
+
* @returns The instance of the requested component.
|
|
491
216
|
*
|
|
492
|
-
* @
|
|
217
|
+
* @throws Will throw an error if a component with the same UUID already exists.
|
|
493
218
|
*
|
|
494
|
-
* @
|
|
219
|
+
* @internal
|
|
495
220
|
*/
|
|
496
|
-
get
|
|
497
|
-
constructor(
|
|
498
|
-
/** {@link Disposable.dispose} */
|
|
499
|
-
dispose(): void;
|
|
221
|
+
get<U extends Component>(Component: new (components: Components) => U): U;
|
|
222
|
+
constructor();
|
|
500
223
|
/**
|
|
501
|
-
*
|
|
224
|
+
* Initializes the Components instance.
|
|
225
|
+
* This method starts the animation loop, sets the enabled flag to true,
|
|
226
|
+
* and calls the update method.
|
|
502
227
|
*
|
|
503
|
-
* @
|
|
228
|
+
* @returns {void}
|
|
504
229
|
*/
|
|
505
|
-
|
|
230
|
+
init(): void;
|
|
506
231
|
/**
|
|
507
|
-
*
|
|
232
|
+
* Disposes the memory of all the components and tools of this instance of
|
|
233
|
+
* the library. A memory leak will be created if:
|
|
508
234
|
*
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
*
|
|
235
|
+
* - An instance of the library ends up out of scope and this function isn't
|
|
236
|
+
* called. This is especially relevant in Single Page Applications (React,
|
|
237
|
+
* Angular, Vue, etc).
|
|
238
|
+
*
|
|
239
|
+
* - Any of the objects of this instance (meshes, geometries,materials, etc) is
|
|
240
|
+
* referenced by a reference type (object or array).
|
|
241
|
+
*
|
|
242
|
+
* You can learn more about how Three.js handles memory leaks
|
|
243
|
+
* [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
516
244
|
*
|
|
517
|
-
* @param active - whether to enable or disable user inputs.
|
|
518
245
|
*/
|
|
519
|
-
|
|
520
|
-
private
|
|
521
|
-
private
|
|
522
|
-
private newOrthoCamera;
|
|
523
|
-
private setOrthoPerspCameraAspect;
|
|
246
|
+
dispose(): void;
|
|
247
|
+
private update;
|
|
248
|
+
private static setupBVH;
|
|
524
249
|
}
|
|
525
250
|
import { Component, Disposable, World, Event } from "../Types";
|
|
526
251
|
import { SimpleRaycaster } from "./src";
|
|
@@ -564,642 +289,1176 @@ export declare class Raycasters extends Component implements Disposable {
|
|
|
564
289
|
/** {@link Disposable.dispose} */
|
|
565
290
|
dispose(): void;
|
|
566
291
|
}
|
|
567
|
-
import
|
|
568
|
-
import
|
|
569
|
-
import {
|
|
570
|
-
import { Component, Components, Disposable, Event } from "../../core";
|
|
292
|
+
import { Components } from "../Components";
|
|
293
|
+
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
294
|
+
import { Component, Event, Disposable, World } from "../Types";
|
|
571
295
|
/**
|
|
572
|
-
* A
|
|
296
|
+
* 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).
|
|
573
297
|
*/
|
|
574
|
-
export declare class
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
298
|
+
export declare class Cullers extends Component implements Disposable {
|
|
299
|
+
/**
|
|
300
|
+
* A unique identifier for the component.
|
|
301
|
+
* This UUID is used to register the component within the Components system.
|
|
302
|
+
*/
|
|
303
|
+
static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
|
|
304
|
+
/**
|
|
305
|
+
* An event that is triggered when the Cullers component is disposed.
|
|
306
|
+
*/
|
|
579
307
|
readonly onDisposed: Event<unknown>;
|
|
580
|
-
private
|
|
581
|
-
private _absoluteMax;
|
|
582
|
-
private _meshes;
|
|
583
|
-
constructor(components: Components);
|
|
308
|
+
private _enabled;
|
|
584
309
|
/**
|
|
585
|
-
* A
|
|
586
|
-
*
|
|
587
|
-
* @param bbox - The bounding box to calculate the dimensions for.
|
|
588
|
-
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
310
|
+
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
589
311
|
*/
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
312
|
+
list: Map<string, MeshCullerRenderer>;
|
|
313
|
+
/** {@link Component.enabled} */
|
|
314
|
+
get enabled(): boolean;
|
|
315
|
+
/** {@link Component.enabled} */
|
|
316
|
+
set enabled(value: boolean);
|
|
317
|
+
constructor(components: Components);
|
|
596
318
|
/**
|
|
597
|
-
*
|
|
598
|
-
*
|
|
599
|
-
* @param positive - A boolean indicating whether to create a boundary for positive or negative values.
|
|
600
|
-
* @returns A new THREE.Vector3 representing the boundary.
|
|
601
|
-
*
|
|
602
|
-
* @remarks
|
|
603
|
-
* This method is used to create a new boundary for calculating bounding boxes.
|
|
604
|
-
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
605
|
-
* depending on the value of the 'positive' parameter.
|
|
319
|
+
* Creates a new MeshCullerRenderer for the given world.
|
|
320
|
+
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
606
321
|
*
|
|
607
|
-
* @
|
|
608
|
-
*
|
|
609
|
-
* const positiveBound = BoundingBoxer.newBound(true);
|
|
610
|
-
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
322
|
+
* @param world - The world for which to create the MeshCullerRenderer.
|
|
323
|
+
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
611
324
|
*
|
|
612
|
-
*
|
|
613
|
-
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
614
|
-
* '''
|
|
325
|
+
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
615
326
|
*/
|
|
616
|
-
|
|
327
|
+
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
617
328
|
/**
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
* @param points - An array of THREE.Vector3 representing the points.
|
|
621
|
-
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
622
|
-
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
623
|
-
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
329
|
+
* Deletes the MeshCullerRenderer associated with the given world.
|
|
330
|
+
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
624
331
|
*
|
|
625
|
-
* @
|
|
626
|
-
* This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
|
|
627
|
-
* If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
|
|
332
|
+
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
628
333
|
*
|
|
629
|
-
* @
|
|
630
|
-
* '''typescript
|
|
631
|
-
* const points = [
|
|
632
|
-
* new THREE.Vector3(1, 2, 3),
|
|
633
|
-
* new THREE.Vector3(4, 5, 6),
|
|
634
|
-
* new THREE.Vector3(7, 8, 9),
|
|
635
|
-
* ];
|
|
636
|
-
*
|
|
637
|
-
* const bbox = BoundingBoxer.getBounds(points);
|
|
638
|
-
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
639
|
-
* '''
|
|
334
|
+
* @returns {void}
|
|
640
335
|
*/
|
|
641
|
-
|
|
336
|
+
delete(world: World): void;
|
|
642
337
|
/** {@link Disposable.dispose} */
|
|
643
338
|
dispose(): void;
|
|
339
|
+
}
|
|
340
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
341
|
+
import { GridConfig, SimpleGrid } from "./src";
|
|
342
|
+
import { Components } from "../Components";
|
|
343
|
+
/**
|
|
344
|
+
* 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).
|
|
345
|
+
*/
|
|
346
|
+
export declare class Grids extends Component implements Disposable {
|
|
644
347
|
/**
|
|
645
|
-
*
|
|
646
|
-
*
|
|
647
|
-
* @returns A new THREE.Box3 instance representing the bounding box.
|
|
648
|
-
*
|
|
649
|
-
* @remarks
|
|
650
|
-
* This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
|
|
651
|
-
* The returned box represents the bounding box of the calculated fragments.
|
|
652
|
-
*
|
|
653
|
-
* @example
|
|
654
|
-
* '''typescript
|
|
655
|
-
* const boundingBox = boundingBoxer.get();
|
|
656
|
-
* console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
|
|
657
|
-
* '''
|
|
658
|
-
*/
|
|
659
|
-
get(): THREE.Box3;
|
|
660
|
-
/**
|
|
661
|
-
* Calculates and returns a sphere that encompasses the entire bounding box.
|
|
662
|
-
*
|
|
663
|
-
* @returns A new THREE.Sphere instance representing the calculated sphere.
|
|
664
|
-
*
|
|
665
|
-
* @remarks
|
|
666
|
-
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
667
|
-
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
668
|
-
* The radius is calculated as the distance from the center to the minimum bound.
|
|
669
|
-
*
|
|
670
|
-
* @example
|
|
671
|
-
* '''typescript
|
|
672
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
673
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
674
|
-
* const boundingSphere = boundingBoxer.getSphere();
|
|
675
|
-
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
676
|
-
* '''
|
|
348
|
+
* A unique identifier for the component.
|
|
349
|
+
* This UUID is used to register the component within the Components system.
|
|
677
350
|
*/
|
|
678
|
-
|
|
351
|
+
static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
|
|
679
352
|
/**
|
|
680
|
-
*
|
|
681
|
-
*
|
|
682
|
-
* @returns A new THREE.Mesh instance representing the bounding box.
|
|
683
|
-
*
|
|
684
|
-
* @remarks
|
|
685
|
-
* This method calculates the dimensions of the bounding box using the 'getDimensions' method.
|
|
686
|
-
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
687
|
-
* A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
|
|
688
|
-
* The position of the mesh is set to the center of the bounding box.
|
|
689
|
-
*
|
|
690
|
-
* @example
|
|
691
|
-
* '''typescript
|
|
692
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
693
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
694
|
-
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
695
|
-
* scene.add(boundingBoxMesh);
|
|
696
|
-
* '''
|
|
353
|
+
* A map of world UUIDs to their corresponding grid instances.
|
|
697
354
|
*/
|
|
698
|
-
|
|
355
|
+
list: Map<string, SimpleGrid>;
|
|
699
356
|
/**
|
|
700
|
-
*
|
|
701
|
-
* This method is used to prepare the BoundingBoxer for a new set of fragments.
|
|
702
|
-
*
|
|
703
|
-
* @remarks
|
|
704
|
-
* This method is called when a new set of fragments is added to the BoundingBoxer.
|
|
705
|
-
* It ensures that the bounding box calculations are accurate and up-to-date.
|
|
706
|
-
*
|
|
707
|
-
* @example
|
|
708
|
-
* '''typescript
|
|
709
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
710
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
711
|
-
* // ...
|
|
712
|
-
* boundingBoxer.reset();
|
|
713
|
-
* '''
|
|
357
|
+
* The default configuration for grid creation.
|
|
714
358
|
*/
|
|
715
|
-
|
|
359
|
+
config: Required<GridConfig>;
|
|
360
|
+
/** {@link Disposable.onDisposed} */
|
|
361
|
+
readonly onDisposed: Event<unknown>;
|
|
362
|
+
/** {@link Component.enabled} */
|
|
363
|
+
enabled: boolean;
|
|
364
|
+
constructor(components: Components);
|
|
716
365
|
/**
|
|
717
|
-
*
|
|
718
|
-
*
|
|
719
|
-
* @param group - The FragmentsGroup to add.
|
|
366
|
+
* Creates a new grid for the given world.
|
|
367
|
+
* Throws an error if a grid already exists for the world.
|
|
720
368
|
*
|
|
721
|
-
* @
|
|
722
|
-
*
|
|
723
|
-
* and calls the 'addMesh' method for each fragment's mesh.
|
|
369
|
+
* @param world - The world to create the grid for.
|
|
370
|
+
* @returns The newly created grid.
|
|
724
371
|
*
|
|
725
|
-
* @
|
|
726
|
-
* '''typescript
|
|
727
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
728
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
729
|
-
* '''
|
|
372
|
+
* @throws Will throw an error if a grid already exists for the given world.
|
|
730
373
|
*/
|
|
731
|
-
|
|
374
|
+
create(world: World): SimpleGrid;
|
|
732
375
|
/**
|
|
733
|
-
*
|
|
376
|
+
* Deletes the grid associated with the given world.
|
|
377
|
+
* If a grid does not exist for the given world, this method does nothing.
|
|
734
378
|
*
|
|
735
|
-
* @param
|
|
736
|
-
* @param itemIDs - An optional iterable of numbers representing the item IDs.
|
|
379
|
+
* @param world - The world for which to delete the grid.
|
|
737
380
|
*
|
|
738
381
|
* @remarks
|
|
739
|
-
* This method
|
|
740
|
-
* If the
|
|
741
|
-
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
742
|
-
*
|
|
743
|
-
* @example
|
|
744
|
-
* '''typescript
|
|
745
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
746
|
-
* boundingBoxer.addMesh(mesh);
|
|
747
|
-
* '''
|
|
382
|
+
* This method will dispose of the grid and remove it from the internal list.
|
|
383
|
+
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
748
384
|
*/
|
|
749
|
-
|
|
750
|
-
|
|
385
|
+
delete(world: World): void;
|
|
386
|
+
/** {@link Disposable.dispose} */
|
|
387
|
+
dispose(): void;
|
|
751
388
|
}
|
|
752
|
-
import
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
halfSizes: THREE.Vector3;
|
|
756
|
-
rotation: THREE.Matrix3;
|
|
757
|
-
transformation: THREE.Matrix4;
|
|
758
|
-
};
|
|
759
|
-
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
760
|
-
import { Component, Disposable, Event, Components } from "../../core";
|
|
389
|
+
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
390
|
+
import { Components } from "../Components";
|
|
391
|
+
import { SimpleWorld } from "./src";
|
|
761
392
|
/**
|
|
762
|
-
*
|
|
393
|
+
* A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
|
|
763
394
|
*/
|
|
764
|
-
export declare class
|
|
395
|
+
export declare class Worlds extends Component implements Updateable, Disposable {
|
|
765
396
|
/**
|
|
766
397
|
* A unique identifier for the component.
|
|
767
398
|
* This UUID is used to register the component within the Components system.
|
|
768
399
|
*/
|
|
769
|
-
static readonly uuid: "
|
|
400
|
+
static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
|
|
401
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
402
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
403
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
404
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
770
405
|
/** {@link Disposable.onDisposed} */
|
|
771
406
|
readonly onDisposed: Event<unknown>;
|
|
772
|
-
/** {@link Component.enabled} */
|
|
773
|
-
enabled: boolean;
|
|
774
407
|
/**
|
|
775
|
-
*
|
|
776
|
-
*
|
|
777
|
-
* Default value is 10.
|
|
408
|
+
* An event that is triggered when a new world is created.
|
|
409
|
+
* The event passes the newly created world as a parameter.
|
|
778
410
|
*/
|
|
779
|
-
|
|
411
|
+
readonly onWorldCreated: Event<World>;
|
|
780
412
|
/**
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
* Default value is "storeys".
|
|
413
|
+
* An event that is triggered when a world is deleted.
|
|
414
|
+
* The event passes the UUID of the deleted world as a parameter.
|
|
784
415
|
*/
|
|
785
|
-
|
|
416
|
+
readonly onWorldDeleted: Event<string>;
|
|
786
417
|
/**
|
|
787
|
-
* A
|
|
788
|
-
*
|
|
418
|
+
* A collection of worlds managed by this component.
|
|
419
|
+
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
789
420
|
*/
|
|
790
|
-
list:
|
|
421
|
+
list: Map<string, World>;
|
|
422
|
+
/** {@link Component.enabled} */
|
|
423
|
+
enabled: boolean;
|
|
791
424
|
constructor(components: Components);
|
|
792
|
-
/** {@link Disposable.dispose} */
|
|
793
|
-
dispose(): void;
|
|
794
425
|
/**
|
|
795
|
-
*
|
|
426
|
+
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
796
427
|
*
|
|
797
|
-
* @
|
|
428
|
+
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
429
|
+
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
430
|
+
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
798
431
|
*
|
|
799
|
-
* @
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
432
|
+
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
433
|
+
*/
|
|
434
|
+
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
435
|
+
/**
|
|
436
|
+
* Deletes a world from the list of worlds.
|
|
803
437
|
*
|
|
804
|
-
*
|
|
438
|
+
* @param {World} world - The world to be deleted.
|
|
805
439
|
*
|
|
806
|
-
* @throws
|
|
440
|
+
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
441
|
+
*
|
|
442
|
+
* @returns {void}
|
|
807
443
|
*/
|
|
808
|
-
|
|
809
|
-
}
|
|
810
|
-
import * as THREE from "three";
|
|
811
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
812
|
-
import { Disposable, Component, Event, Components } from "../../core";
|
|
813
|
-
/**
|
|
814
|
-
* 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.
|
|
815
|
-
*/
|
|
816
|
-
export interface Classification {
|
|
444
|
+
delete(world: World): void;
|
|
817
445
|
/**
|
|
818
|
-
*
|
|
819
|
-
*
|
|
446
|
+
* Disposes of the Worlds component and all its managed worlds.
|
|
447
|
+
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
448
|
+
* and triggers the onDisposed event.
|
|
449
|
+
*
|
|
450
|
+
* @returns {void}
|
|
820
451
|
*/
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
* The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
|
|
825
|
-
*/
|
|
826
|
-
[className: string]: FRAGS.FragmentIdMap;
|
|
827
|
-
};
|
|
452
|
+
dispose(): void;
|
|
453
|
+
/** {@link Updateable.update} */
|
|
454
|
+
update(delta?: number): void | Promise<void>;
|
|
828
455
|
}
|
|
456
|
+
import { MiniMap } from "./src";
|
|
457
|
+
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
458
|
+
import { Components } from "../Components";
|
|
829
459
|
/**
|
|
830
|
-
*
|
|
460
|
+
* A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
|
|
831
461
|
*/
|
|
832
|
-
export declare class
|
|
462
|
+
export declare class MiniMaps extends Component implements Updateable, Disposable {
|
|
833
463
|
/**
|
|
834
464
|
* A unique identifier for the component.
|
|
835
465
|
* This UUID is used to register the component within the Components system.
|
|
836
466
|
*/
|
|
837
|
-
static readonly uuid: "
|
|
467
|
+
static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
|
|
468
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
469
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
470
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
471
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
472
|
+
/** {@link Disposable.onDisposed} */
|
|
473
|
+
readonly onDisposed: Event<unknown>;
|
|
838
474
|
/** {@link Component.enabled} */
|
|
839
475
|
enabled: boolean;
|
|
840
476
|
/**
|
|
841
|
-
* A
|
|
842
|
-
* The key is the system name, and the value is an object representing the classes within the system.
|
|
477
|
+
* A collection of {@link MiniMap} instances, each associated with a unique world ID.
|
|
843
478
|
*/
|
|
844
|
-
list:
|
|
845
|
-
/** {@link Disposable.onDisposed} */
|
|
846
|
-
readonly onDisposed: Event<unknown>;
|
|
479
|
+
list: Map<string, MiniMap>;
|
|
847
480
|
constructor(components: Components);
|
|
848
|
-
private onFragmentsDisposed;
|
|
849
|
-
/** {@link Disposable.dispose} */
|
|
850
|
-
dispose(): void;
|
|
851
481
|
/**
|
|
852
|
-
*
|
|
853
|
-
*
|
|
482
|
+
* Creates a new {@link MiniMap} instance associated with the given world.
|
|
483
|
+
* If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
|
|
854
484
|
*
|
|
855
|
-
* @param
|
|
485
|
+
* @param world - The {@link World} for which to create a {@link MiniMap} instance.
|
|
486
|
+
* @returns The newly created {@link MiniMap} instance.
|
|
487
|
+
* @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
|
|
856
488
|
*/
|
|
857
|
-
|
|
489
|
+
create(world: World): MiniMap;
|
|
858
490
|
/**
|
|
859
|
-
*
|
|
860
|
-
* If
|
|
861
|
-
*
|
|
862
|
-
* @param filter - An optional object containing filter criteria.
|
|
863
|
-
* The keys of the object represent the classification system names,
|
|
864
|
-
* and the values are arrays of class names to match.
|
|
865
|
-
*
|
|
866
|
-
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
867
|
-
* where the express IDs are filtered based on the provided filter criteria.
|
|
491
|
+
* Deletes a {@link MiniMap} instance associated with the given world ID.
|
|
492
|
+
* If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
|
|
868
493
|
*
|
|
869
|
-
* @
|
|
494
|
+
* @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
|
|
495
|
+
* @returns {void}
|
|
870
496
|
*/
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
497
|
+
delete(id: string): void;
|
|
498
|
+
/** {@link Disposable.dispose} */
|
|
499
|
+
dispose(): void;
|
|
500
|
+
/** {@link Updateable.update} */
|
|
501
|
+
update(): void;
|
|
502
|
+
}
|
|
503
|
+
import * as THREE from "three";
|
|
504
|
+
import { Components } from "../Components";
|
|
505
|
+
import { SimpleCamera } from "..";
|
|
506
|
+
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
507
|
+
/**
|
|
508
|
+
* A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
|
|
509
|
+
*/
|
|
510
|
+
export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
874
511
|
/**
|
|
875
|
-
*
|
|
876
|
-
*
|
|
877
|
-
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
878
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
879
|
-
*
|
|
880
|
-
* @remarks
|
|
881
|
-
* This method iterates through the fragments in the provided group,
|
|
882
|
-
* and classifies them based on their modelID.
|
|
883
|
-
* The classification is stored in the 'list.models' property,
|
|
884
|
-
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
885
|
-
*
|
|
512
|
+
* A ProjectionManager instance that manages the projection modes of the camera.
|
|
886
513
|
*/
|
|
887
|
-
|
|
514
|
+
readonly projection: ProjectionManager;
|
|
888
515
|
/**
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
892
|
-
*
|
|
893
|
-
* @remarks
|
|
894
|
-
* This method iterates through the properties of the fragments in the provided group,
|
|
895
|
-
* and classifies them based on their PredefinedType property.
|
|
896
|
-
* The classification is stored in the 'list.predefinedTypes' property,
|
|
897
|
-
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
898
|
-
*
|
|
899
|
-
* @throws Will throw an error if the fragment ID is not found.
|
|
516
|
+
* A THREE.OrthographicCamera instance that represents the orthographic camera.
|
|
517
|
+
* This camera is used when the projection mode is set to orthographic.
|
|
900
518
|
*/
|
|
901
|
-
|
|
519
|
+
readonly threeOrtho: THREE.OrthographicCamera;
|
|
902
520
|
/**
|
|
903
|
-
*
|
|
904
|
-
*
|
|
905
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
906
|
-
*
|
|
907
|
-
* @remarks
|
|
908
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
909
|
-
* and classifies them based on their entity type.
|
|
910
|
-
* The classification is stored in the 'list.entities' property,
|
|
911
|
-
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
912
|
-
*
|
|
913
|
-
* @throws Will throw an error if the fragment ID is not found.
|
|
521
|
+
* A THREE.PerspectiveCamera instance that represents the perspective camera.
|
|
522
|
+
* This camera is used when the projection mode is set to perspective.
|
|
914
523
|
*/
|
|
915
|
-
|
|
524
|
+
readonly threePersp: THREE.PerspectiveCamera;
|
|
525
|
+
protected readonly _userInputButtons: any;
|
|
526
|
+
protected readonly _frustumSize = 50;
|
|
527
|
+
protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
|
|
528
|
+
protected _mode: NavigationMode | null;
|
|
529
|
+
private previousSize;
|
|
916
530
|
/**
|
|
917
|
-
*
|
|
918
|
-
*
|
|
919
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
920
|
-
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
921
|
-
* @param systemName - The name of the classification system to store the classification.
|
|
531
|
+
* Getter for the current navigation mode.
|
|
532
|
+
* Throws an error if the mode is not found or the camera is not initialized.
|
|
922
533
|
*
|
|
923
|
-
* @
|
|
924
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
925
|
-
* and classifies them based on the specified IFC relationship.
|
|
926
|
-
* The classification is stored in the 'list' property under the specified system name,
|
|
927
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
534
|
+
* @returns {NavigationMode} The current navigation mode.
|
|
928
535
|
*
|
|
929
|
-
* @throws
|
|
536
|
+
* @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
|
|
930
537
|
*/
|
|
931
|
-
|
|
538
|
+
get mode(): NavigationMode;
|
|
539
|
+
constructor(components: Components);
|
|
540
|
+
/** {@link Disposable.dispose} */
|
|
541
|
+
dispose(): void;
|
|
932
542
|
/**
|
|
933
|
-
*
|
|
934
|
-
*
|
|
935
|
-
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
936
|
-
*
|
|
937
|
-
* @remarks
|
|
938
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
939
|
-
* and classifies them based on their spatial structure in the IFC model.
|
|
940
|
-
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
941
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
543
|
+
* Sets a new {@link NavigationMode} and disables the previous one.
|
|
942
544
|
*
|
|
943
|
-
* @
|
|
545
|
+
* @param mode - The {@link NavigationMode} to set.
|
|
944
546
|
*/
|
|
945
|
-
|
|
547
|
+
set(mode: NavModeID): void;
|
|
946
548
|
/**
|
|
947
|
-
*
|
|
948
|
-
*
|
|
949
|
-
* @param items - A map of fragment IDs to their respective express IDs.
|
|
950
|
-
* @param color - The color to set for the fragments.
|
|
951
|
-
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
952
|
-
*
|
|
953
|
-
* @remarks
|
|
954
|
-
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
955
|
-
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
549
|
+
* Make the camera view fit all the specified meshes.
|
|
956
550
|
*
|
|
957
|
-
* @
|
|
551
|
+
* @param meshes the meshes to fit. If it is not defined, it will
|
|
552
|
+
* evaluate {@link Components.meshes}.
|
|
553
|
+
* @param offset the distance to the fit object
|
|
958
554
|
*/
|
|
959
|
-
|
|
555
|
+
fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
|
|
960
556
|
/**
|
|
961
|
-
*
|
|
962
|
-
*
|
|
963
|
-
* @param items - A map of fragment IDs to their respective express IDs.
|
|
964
|
-
*
|
|
965
|
-
* @remarks
|
|
966
|
-
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
967
|
-
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
557
|
+
* Allows or prevents all user input.
|
|
968
558
|
*
|
|
969
|
-
* @
|
|
559
|
+
* @param active - whether to enable or disable user inputs.
|
|
970
560
|
*/
|
|
971
|
-
|
|
972
|
-
|
|
561
|
+
setUserInput(active: boolean): void;
|
|
562
|
+
private disableUserInput;
|
|
563
|
+
private enableUserInput;
|
|
564
|
+
private newOrthoCamera;
|
|
565
|
+
private setOrthoPerspCameraAspect;
|
|
973
566
|
}
|
|
974
567
|
import * as THREE from "three";
|
|
975
|
-
|
|
976
|
-
|
|
568
|
+
import { Component, Components } from "../../core";
|
|
569
|
+
/**
|
|
570
|
+
* Represents an edge measurement result.
|
|
571
|
+
*/
|
|
572
|
+
export interface MeasureEdge {
|
|
573
|
+
/**
|
|
574
|
+
* The distance between the two points of the edge.
|
|
575
|
+
*/
|
|
576
|
+
distance: number;
|
|
577
|
+
/**
|
|
578
|
+
* The two points that define the edge.
|
|
579
|
+
*/
|
|
580
|
+
points: THREE.Vector3[];
|
|
977
581
|
}
|
|
978
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
979
|
-
import { Components, Component } from "../../core";
|
|
980
582
|
/**
|
|
981
|
-
*
|
|
583
|
+
* 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).
|
|
982
584
|
*/
|
|
983
|
-
export declare class
|
|
585
|
+
export declare class MeasurementUtils extends Component {
|
|
984
586
|
/**
|
|
985
587
|
* A unique identifier for the component.
|
|
986
588
|
* This UUID is used to register the component within the Components system.
|
|
987
589
|
*/
|
|
988
|
-
static
|
|
590
|
+
static uuid: string;
|
|
989
591
|
/** {@link Component.enabled} */
|
|
990
592
|
enabled: boolean;
|
|
991
593
|
constructor(components: Components);
|
|
992
594
|
/**
|
|
993
|
-
*
|
|
994
|
-
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
995
|
-
* If 'items' is provided, only the specified fragments will be affected.
|
|
996
|
-
*
|
|
997
|
-
* @param visible - The visibility state to set for the fragments.
|
|
998
|
-
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
999
|
-
* If not provided, all fragments will be affected.
|
|
595
|
+
* Utility method to calculate the distance from a point to a line segment.
|
|
1000
596
|
*
|
|
1001
|
-
* @
|
|
597
|
+
* @param point - The point from which to calculate the distance.
|
|
598
|
+
* @param lineStart - The start point of the line segment.
|
|
599
|
+
* @param lineEnd - The end point of the line segment.
|
|
600
|
+
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
601
|
+
* @returns The distance from the point to the line segment.
|
|
1002
602
|
*/
|
|
1003
|
-
|
|
603
|
+
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
1004
604
|
/**
|
|
1005
|
-
*
|
|
1006
|
-
* It
|
|
1007
|
-
*
|
|
1008
|
-
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
1009
|
-
* If not provided, all fragments will be isolated.
|
|
605
|
+
* Method to get the face of a mesh that contains a given triangle index.
|
|
606
|
+
* It also returns the edges of the found face and their indices.
|
|
1010
607
|
*
|
|
1011
|
-
* @
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
}
|
|
1016
|
-
import * as WEBIFC from "web-ifc";
|
|
1017
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1018
|
-
import { IfcFragmentSettings } from "./src";
|
|
1019
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
1020
|
-
/**
|
|
1021
|
-
* 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).
|
|
1022
|
-
*/
|
|
1023
|
-
export declare class IfcLoader extends Component implements Disposable {
|
|
1024
|
-
/**
|
|
1025
|
-
* A unique identifier for the component.
|
|
1026
|
-
* This UUID is used to register the component within the Components system.
|
|
608
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
609
|
+
* @param triangleIndex - The index of the triangle within the mesh.
|
|
610
|
+
* @param instance - The instance of the mesh (optional).
|
|
611
|
+
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
1027
612
|
*/
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
613
|
+
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
614
|
+
edges: MeasureEdge[];
|
|
615
|
+
indices: Set<number>;
|
|
616
|
+
} | null;
|
|
1031
617
|
/**
|
|
1032
|
-
*
|
|
618
|
+
* Method to get the vertices and normal of a mesh face at a given index.
|
|
619
|
+
* It also applies instance transformation if provided.
|
|
620
|
+
*
|
|
621
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
622
|
+
* @param faceIndex - The index of the face within the mesh.
|
|
623
|
+
* @param instance - The instance of the mesh (optional).
|
|
624
|
+
* @returns An object containing the vertices and normal of the face.
|
|
625
|
+
* @throws Will throw an error if the geometry is not indexed.
|
|
1033
626
|
*/
|
|
1034
|
-
|
|
627
|
+
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
628
|
+
p1: THREE.Vector3;
|
|
629
|
+
p2: THREE.Vector3;
|
|
630
|
+
p3: THREE.Vector3;
|
|
631
|
+
faceNormal: THREE.Vector3;
|
|
632
|
+
};
|
|
1035
633
|
/**
|
|
1036
|
-
*
|
|
634
|
+
* Method to round the vector's components to a specified number of decimal places.
|
|
635
|
+
* This is used to ensure numerical precision in edge detection.
|
|
636
|
+
*
|
|
637
|
+
* @param vector - The vector to round.
|
|
638
|
+
* @returns The vector with rounded components.
|
|
1037
639
|
*/
|
|
1038
|
-
|
|
640
|
+
round(vector: THREE.Vector3): void;
|
|
641
|
+
private getFaceData;
|
|
642
|
+
}
|
|
643
|
+
import * as THREE from "three";
|
|
644
|
+
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
645
|
+
center: THREE.Vector3;
|
|
646
|
+
halfSizes: THREE.Vector3;
|
|
647
|
+
rotation: THREE.Matrix3;
|
|
648
|
+
transformation: THREE.Matrix4;
|
|
649
|
+
};
|
|
650
|
+
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
651
|
+
import * as THREE from "three";
|
|
652
|
+
export declare class MaterialsUtils {
|
|
653
|
+
static isTransparent(material: THREE.Material): boolean;
|
|
654
|
+
}
|
|
655
|
+
export declare class UUID {
|
|
656
|
+
private static _pattern;
|
|
657
|
+
private static _lut;
|
|
658
|
+
static create(): string;
|
|
659
|
+
static validate(uuid: string): void;
|
|
660
|
+
}
|
|
661
|
+
import * as THREE from "three";
|
|
662
|
+
import { Component, Components, Disposable, Event, World } from "../core";
|
|
663
|
+
/**
|
|
664
|
+
* Configuration interface for the VertexPicker component.
|
|
665
|
+
*/
|
|
666
|
+
export interface VertexPickerConfig {
|
|
1039
667
|
/**
|
|
1040
|
-
*
|
|
1041
|
-
* It includes options for excluding categories, setting WASM paths, and more.
|
|
668
|
+
* If true, only vertices will be picked, not the closest point on the face.
|
|
1042
669
|
*/
|
|
1043
|
-
|
|
670
|
+
showOnlyVertex: boolean;
|
|
1044
671
|
/**
|
|
1045
|
-
* The
|
|
672
|
+
* The maximum distance for snapping to a vertex.
|
|
1046
673
|
*/
|
|
1047
|
-
|
|
1048
|
-
/** {@link Component.enabled} */
|
|
1049
|
-
enabled: boolean;
|
|
1050
|
-
private _material;
|
|
1051
|
-
private _spatialTree;
|
|
1052
|
-
private _metaData;
|
|
1053
|
-
private _fragmentInstances;
|
|
1054
|
-
private _civil;
|
|
1055
|
-
private _visitedFragments;
|
|
1056
|
-
private _materialT;
|
|
1057
|
-
constructor(components: Components);
|
|
1058
|
-
/** {@link Disposable.dispose} */
|
|
1059
|
-
dispose(): void;
|
|
674
|
+
snapDistance: number;
|
|
1060
675
|
/**
|
|
1061
|
-
*
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
676
|
+
* The HTML element to use for previewing the picked vertex.
|
|
677
|
+
*/
|
|
678
|
+
previewElement: HTMLElement;
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* A class that provides functionality for picking vertices in a 3D scene.
|
|
682
|
+
*/
|
|
683
|
+
export declare class VertexPicker extends Component implements Disposable {
|
|
684
|
+
/** {@link Disposable.onDisposed} */
|
|
685
|
+
readonly onDisposed: Event<unknown>;
|
|
686
|
+
/**
|
|
687
|
+
* An event that is triggered when a vertex is found.
|
|
688
|
+
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
689
|
+
*/
|
|
690
|
+
readonly onVertexFound: Event<THREE.Vector3>;
|
|
691
|
+
/**
|
|
692
|
+
* An event that is triggered when a vertex is lost.
|
|
693
|
+
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
694
|
+
*/
|
|
695
|
+
readonly onVertexLost: Event<THREE.Vector3>;
|
|
696
|
+
/**
|
|
697
|
+
* A reference to the Components instance associated with this VertexPicker.
|
|
698
|
+
*/
|
|
699
|
+
components: Components;
|
|
700
|
+
/**
|
|
701
|
+
* A reference to the working plane used for vertex picking.
|
|
702
|
+
* This plane is used to determine which vertices are considered valid for picking.
|
|
703
|
+
* If this value is null, all vertices are considered valid.
|
|
704
|
+
*/
|
|
705
|
+
workingPlane: THREE.Plane | null;
|
|
706
|
+
private _pickedPoint;
|
|
707
|
+
private _config;
|
|
708
|
+
private _enabled;
|
|
709
|
+
/**
|
|
710
|
+
* Sets the enabled state of the VertexPicker.
|
|
711
|
+
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
712
|
+
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
1071
713
|
*
|
|
1072
|
-
* @
|
|
1073
|
-
* '''typescript
|
|
1074
|
-
* const ifcLoader = new IfcLoader(components);
|
|
1075
|
-
* await ifcLoader.setup({ autoSetWasm: true });
|
|
1076
|
-
* '''
|
|
714
|
+
* @param value - The new enabled state.
|
|
1077
715
|
*/
|
|
1078
|
-
|
|
716
|
+
set enabled(value: boolean);
|
|
1079
717
|
/**
|
|
1080
|
-
*
|
|
718
|
+
* Gets the current enabled state of the VertexPicker.
|
|
1081
719
|
*
|
|
1082
|
-
* @
|
|
1083
|
-
|
|
720
|
+
* @returns The current enabled state.
|
|
721
|
+
*/
|
|
722
|
+
get enabled(): boolean;
|
|
723
|
+
/**
|
|
724
|
+
* Sets the configuration for the VertexPicker component.
|
|
1084
725
|
*
|
|
1085
|
-
* @
|
|
726
|
+
* @param value - A Partial object containing the configuration properties to update.
|
|
727
|
+
* The properties not provided in the value object will retain their current values.
|
|
1086
728
|
*
|
|
1087
729
|
* @example
|
|
1088
730
|
* '''typescript
|
|
1089
|
-
*
|
|
1090
|
-
*
|
|
731
|
+
* vertexPicker.config = {
|
|
732
|
+
* snapDistance: 0.5,
|
|
733
|
+
* showOnlyVertex: true,
|
|
734
|
+
* };
|
|
1091
735
|
* '''
|
|
1092
736
|
*/
|
|
1093
|
-
|
|
737
|
+
set config(value: Partial<VertexPickerConfig>);
|
|
1094
738
|
/**
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1097
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1098
|
-
*
|
|
1099
|
-
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
739
|
+
* Gets the current configuration for the VertexPicker component.
|
|
1100
740
|
*
|
|
1101
|
-
* @
|
|
1102
|
-
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
1103
|
-
* It also opens the IFC model using the provided data and settings.
|
|
741
|
+
* @returns A copy of the current VertexPickerConfig object.
|
|
1104
742
|
*
|
|
1105
743
|
* @example
|
|
1106
744
|
* '''typescript
|
|
1107
|
-
* const
|
|
1108
|
-
*
|
|
745
|
+
* const currentConfig = vertexPicker.config;
|
|
746
|
+
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
1109
747
|
* '''
|
|
1110
748
|
*/
|
|
1111
|
-
|
|
749
|
+
get config(): Partial<VertexPickerConfig>;
|
|
750
|
+
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
751
|
+
/** {@link Disposable.dispose} */
|
|
752
|
+
dispose(): void;
|
|
1112
753
|
/**
|
|
1113
|
-
*
|
|
1114
|
-
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
754
|
+
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
1115
755
|
*
|
|
1116
|
-
* @
|
|
1117
|
-
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
756
|
+
* @param world - The World instance to use for raycasting.
|
|
1118
757
|
*
|
|
1119
|
-
* @
|
|
1120
|
-
*
|
|
1121
|
-
*
|
|
1122
|
-
*
|
|
1123
|
-
*
|
|
758
|
+
* @returns The current picked point, or null if no point is picked.
|
|
759
|
+
*
|
|
760
|
+
* @remarks
|
|
761
|
+
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
762
|
+
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
763
|
+
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
764
|
+
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
765
|
+
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
766
|
+
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
1124
767
|
*/
|
|
1125
|
-
|
|
1126
|
-
private
|
|
1127
|
-
private
|
|
1128
|
-
private
|
|
1129
|
-
private autoSetWasm;
|
|
768
|
+
get(world: World): THREE.Vector3 | null;
|
|
769
|
+
private getClosestVertex;
|
|
770
|
+
private getVertices;
|
|
771
|
+
private getVertex;
|
|
1130
772
|
}
|
|
1131
|
-
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1132
773
|
import * as THREE from "three";
|
|
1133
774
|
import * as FRAGS from "@thatopen/fragments";
|
|
1134
|
-
import {
|
|
1135
|
-
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
775
|
+
import { Disposable, Component, Event, Components } from "../../core";
|
|
1136
776
|
/**
|
|
1137
|
-
*
|
|
777
|
+
* 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.
|
|
1138
778
|
*/
|
|
1139
|
-
export
|
|
1140
|
-
/**
|
|
1141
|
-
* A unique identifier for the component.
|
|
1142
|
-
* This UUID is used to register the component within the Components system.
|
|
1143
|
-
*/
|
|
1144
|
-
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1145
|
-
/** {@link Disposable.onDisposed} */
|
|
1146
|
-
readonly onDisposed: Event<unknown>;
|
|
1147
|
-
/**
|
|
1148
|
-
* Event triggered when fragments are loaded.
|
|
1149
|
-
*/
|
|
1150
|
-
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1151
|
-
/**
|
|
1152
|
-
* Event triggered when fragments are disposed.
|
|
1153
|
-
*/
|
|
1154
|
-
readonly onFragmentsDisposed: Event<{
|
|
1155
|
-
groupID: string;
|
|
1156
|
-
fragmentIDs: string[];
|
|
1157
|
-
}>;
|
|
779
|
+
export interface Classification {
|
|
1158
780
|
/**
|
|
1159
|
-
*
|
|
1160
|
-
* The key is the
|
|
781
|
+
* A system within the classification.
|
|
782
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1161
783
|
*/
|
|
1162
|
-
|
|
784
|
+
[system: string]: {
|
|
785
|
+
/**
|
|
786
|
+
* A class within the system.
|
|
787
|
+
* The key is the class name, and the value is a map of fragment IDs to their respective express IDs.
|
|
788
|
+
*/
|
|
789
|
+
[className: string]: FRAGS.FragmentIdMap;
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* 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).
|
|
794
|
+
*/
|
|
795
|
+
export declare class Classifier extends Component implements Disposable {
|
|
1163
796
|
/**
|
|
1164
|
-
*
|
|
1165
|
-
*
|
|
797
|
+
* A unique identifier for the component.
|
|
798
|
+
* This UUID is used to register the component within the Components system.
|
|
1166
799
|
*/
|
|
1167
|
-
readonly
|
|
1168
|
-
baseCoordinationModel: string;
|
|
800
|
+
static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
|
|
1169
801
|
/** {@link Component.enabled} */
|
|
1170
802
|
enabled: boolean;
|
|
1171
|
-
private _loader;
|
|
1172
803
|
/**
|
|
1173
|
-
*
|
|
1174
|
-
*
|
|
1175
|
-
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
804
|
+
* A map representing the classification systems.
|
|
805
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1176
806
|
*/
|
|
1177
|
-
|
|
807
|
+
list: Classification;
|
|
808
|
+
/** {@link Disposable.onDisposed} */
|
|
809
|
+
readonly onDisposed: Event<unknown>;
|
|
1178
810
|
constructor(components: Components);
|
|
811
|
+
private onFragmentsDisposed;
|
|
1179
812
|
/** {@link Disposable.dispose} */
|
|
1180
813
|
dispose(): void;
|
|
1181
814
|
/**
|
|
1182
|
-
*
|
|
1183
|
-
* This method
|
|
1184
|
-
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
815
|
+
* Removes a fragment from the classification based on its unique identifier (guid).
|
|
816
|
+
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
1185
817
|
*
|
|
1186
|
-
* @param
|
|
1187
|
-
*/
|
|
1188
|
-
disposeGroup(group: FragmentsGroup): void;
|
|
1189
|
-
/**
|
|
1190
|
-
* Loads a binary file that contain fragment geometry.
|
|
1191
|
-
* @param data - The binary data to load.
|
|
1192
|
-
* @param config - Optional configuration for loading.
|
|
1193
|
-
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
1194
|
-
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1195
|
-
* @returns The loaded FragmentsGroup.
|
|
818
|
+
* @param guid - The unique identifier of the fragment to be removed.
|
|
1196
819
|
*/
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
820
|
+
remove(guid: string): void;
|
|
821
|
+
/**
|
|
822
|
+
* Finds and returns fragments based on the provided filter criteria.
|
|
823
|
+
* If no filter is provided, it returns all fragments.
|
|
824
|
+
*
|
|
825
|
+
* @param filter - An optional object containing filter criteria.
|
|
826
|
+
* The keys of the object represent the classification system names,
|
|
827
|
+
* and the values are arrays of class names to match.
|
|
828
|
+
*
|
|
829
|
+
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
830
|
+
* where the express IDs are filtered based on the provided filter criteria.
|
|
831
|
+
*
|
|
832
|
+
* @throws Will throw an error if the fragments map is malformed.
|
|
833
|
+
*/
|
|
834
|
+
find(filter?: {
|
|
835
|
+
[name: string]: string[];
|
|
836
|
+
}): FRAGS.FragmentIdMap;
|
|
837
|
+
/**
|
|
838
|
+
* Classifies fragments based on their modelID.
|
|
839
|
+
*
|
|
840
|
+
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
841
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
842
|
+
*
|
|
843
|
+
* @remarks
|
|
844
|
+
* This method iterates through the fragments in the provided group,
|
|
845
|
+
* and classifies them based on their modelID.
|
|
846
|
+
* The classification is stored in the 'list.models' property,
|
|
847
|
+
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
848
|
+
*
|
|
849
|
+
*/
|
|
850
|
+
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
851
|
+
/**
|
|
852
|
+
* Classifies fragments based on their PredefinedType property.
|
|
853
|
+
*
|
|
854
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
855
|
+
*
|
|
856
|
+
* @remarks
|
|
857
|
+
* This method iterates through the properties of the fragments in the provided group,
|
|
858
|
+
* and classifies them based on their PredefinedType property.
|
|
859
|
+
* The classification is stored in the 'list.predefinedTypes' property,
|
|
860
|
+
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
861
|
+
*
|
|
862
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
863
|
+
*/
|
|
864
|
+
byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
|
|
865
|
+
/**
|
|
866
|
+
* Classifies fragments based on their entity type.
|
|
867
|
+
*
|
|
868
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
869
|
+
*
|
|
870
|
+
* @remarks
|
|
871
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
872
|
+
* and classifies them based on their entity type.
|
|
873
|
+
* The classification is stored in the 'list.entities' property,
|
|
874
|
+
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
875
|
+
*
|
|
876
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
877
|
+
*/
|
|
878
|
+
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
879
|
+
/**
|
|
880
|
+
* Classifies fragments based on a specific IFC relationship.
|
|
881
|
+
*
|
|
882
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
883
|
+
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
884
|
+
* @param systemName - The name of the classification system to store the classification.
|
|
885
|
+
*
|
|
886
|
+
* @remarks
|
|
887
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
888
|
+
* and classifies them based on the specified IFC relationship.
|
|
889
|
+
* The classification is stored in the 'list' property under the specified system name,
|
|
890
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
891
|
+
*
|
|
892
|
+
* @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
|
|
893
|
+
*/
|
|
894
|
+
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
895
|
+
/**
|
|
896
|
+
* Classifies fragments based on their spatial structure in the IFC model.
|
|
897
|
+
*
|
|
898
|
+
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
899
|
+
*
|
|
900
|
+
* @remarks
|
|
901
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
902
|
+
* and classifies them based on their spatial structure in the IFC model.
|
|
903
|
+
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
904
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
905
|
+
*
|
|
906
|
+
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
907
|
+
*/
|
|
908
|
+
bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
|
|
909
|
+
/**
|
|
910
|
+
* Sets the color of the specified fragments.
|
|
911
|
+
*
|
|
912
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
913
|
+
* @param color - The color to set for the fragments.
|
|
914
|
+
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
915
|
+
*
|
|
916
|
+
* @remarks
|
|
917
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
918
|
+
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
919
|
+
*
|
|
920
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
921
|
+
*/
|
|
922
|
+
setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
|
|
923
|
+
/**
|
|
924
|
+
* Resets the color of the specified fragments to their original color.
|
|
925
|
+
*
|
|
926
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
927
|
+
*
|
|
928
|
+
* @remarks
|
|
929
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
930
|
+
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
931
|
+
*
|
|
932
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
933
|
+
*/
|
|
934
|
+
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
935
|
+
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
|
|
936
|
+
}
|
|
937
|
+
import * as THREE from "three";
|
|
938
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
939
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
940
|
+
import { Component, Components, Disposable, Event } from "../../core";
|
|
941
|
+
/**
|
|
942
|
+
* A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
|
|
943
|
+
*/
|
|
944
|
+
export declare class BoundingBoxer extends Component implements Disposable {
|
|
945
|
+
static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
|
|
946
|
+
/** {@link Component.enabled} */
|
|
947
|
+
enabled: boolean;
|
|
948
|
+
/** {@link Disposable.onDisposed} */
|
|
949
|
+
readonly onDisposed: Event<unknown>;
|
|
950
|
+
private _absoluteMin;
|
|
951
|
+
private _absoluteMax;
|
|
952
|
+
private _meshes;
|
|
953
|
+
constructor(components: Components);
|
|
954
|
+
/**
|
|
955
|
+
* A static method to calculate the dimensions of a given bounding box.
|
|
956
|
+
*
|
|
957
|
+
* @param bbox - The bounding box to calculate the dimensions for.
|
|
958
|
+
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
959
|
+
*/
|
|
960
|
+
static getDimensions(bbox: THREE.Box3): {
|
|
961
|
+
width: number;
|
|
962
|
+
height: number;
|
|
963
|
+
depth: number;
|
|
964
|
+
center: THREE.Vector3;
|
|
965
|
+
};
|
|
966
|
+
/**
|
|
967
|
+
* A static method to create a new bounding box boundary.
|
|
968
|
+
*
|
|
969
|
+
* @param positive - A boolean indicating whether to create a boundary for positive or negative values.
|
|
970
|
+
* @returns A new THREE.Vector3 representing the boundary.
|
|
971
|
+
*
|
|
972
|
+
* @remarks
|
|
973
|
+
* This method is used to create a new boundary for calculating bounding boxes.
|
|
974
|
+
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
975
|
+
* depending on the value of the 'positive' parameter.
|
|
976
|
+
*
|
|
977
|
+
* @example
|
|
978
|
+
* '''typescript
|
|
979
|
+
* const positiveBound = BoundingBoxer.newBound(true);
|
|
980
|
+
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
981
|
+
*
|
|
982
|
+
* const negativeBound = BoundingBoxer.newBound(false);
|
|
983
|
+
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
984
|
+
* '''
|
|
985
|
+
*/
|
|
986
|
+
static newBound(positive: boolean): THREE.Vector3;
|
|
987
|
+
/**
|
|
988
|
+
* A static method to calculate the bounding box of a set of points.
|
|
989
|
+
*
|
|
990
|
+
* @param points - An array of THREE.Vector3 representing the points.
|
|
991
|
+
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
992
|
+
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
993
|
+
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
994
|
+
*
|
|
995
|
+
* @remarks
|
|
996
|
+
* This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
|
|
997
|
+
* If the 'min' or 'max' parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
|
|
998
|
+
*
|
|
999
|
+
* @example
|
|
1000
|
+
* '''typescript
|
|
1001
|
+
* const points = [
|
|
1002
|
+
* new THREE.Vector3(1, 2, 3),
|
|
1003
|
+
* new THREE.Vector3(4, 5, 6),
|
|
1004
|
+
* new THREE.Vector3(7, 8, 9),
|
|
1005
|
+
* ];
|
|
1006
|
+
*
|
|
1007
|
+
* const bbox = BoundingBoxer.getBounds(points);
|
|
1008
|
+
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
1009
|
+
* '''
|
|
1010
|
+
*/
|
|
1011
|
+
static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
|
|
1012
|
+
/** {@link Disposable.dispose} */
|
|
1013
|
+
dispose(): void;
|
|
1014
|
+
/**
|
|
1015
|
+
* Returns the bounding box of the calculated fragments.
|
|
1016
|
+
*
|
|
1017
|
+
* @returns A new THREE.Box3 instance representing the bounding box.
|
|
1018
|
+
*
|
|
1019
|
+
* @remarks
|
|
1020
|
+
* This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
|
|
1021
|
+
* The returned box represents the bounding box of the calculated fragments.
|
|
1022
|
+
*
|
|
1023
|
+
* @example
|
|
1024
|
+
* '''typescript
|
|
1025
|
+
* const boundingBox = boundingBoxer.get();
|
|
1026
|
+
* console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
|
|
1027
|
+
* '''
|
|
1028
|
+
*/
|
|
1029
|
+
get(): THREE.Box3;
|
|
1030
|
+
/**
|
|
1031
|
+
* Calculates and returns a sphere that encompasses the entire bounding box.
|
|
1032
|
+
*
|
|
1033
|
+
* @returns A new THREE.Sphere instance representing the calculated sphere.
|
|
1034
|
+
*
|
|
1035
|
+
* @remarks
|
|
1036
|
+
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
1037
|
+
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
1038
|
+
* The radius is calculated as the distance from the center to the minimum bound.
|
|
1039
|
+
*
|
|
1040
|
+
* @example
|
|
1041
|
+
* '''typescript
|
|
1042
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
1043
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
1044
|
+
* const boundingSphere = boundingBoxer.getSphere();
|
|
1045
|
+
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
1046
|
+
* '''
|
|
1047
|
+
*/
|
|
1048
|
+
getSphere(): THREE.Sphere;
|
|
1049
|
+
/**
|
|
1050
|
+
* Returns a THREE.Mesh instance representing the bounding box.
|
|
1051
|
+
*
|
|
1052
|
+
* @returns A new THREE.Mesh instance representing the bounding box.
|
|
1053
|
+
*
|
|
1054
|
+
* @remarks
|
|
1055
|
+
* This method calculates the dimensions of the bounding box using the 'getDimensions' method.
|
|
1056
|
+
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
1057
|
+
* A new THREE.Mesh is created using the box geometry, and it is added to the '_meshes' array.
|
|
1058
|
+
* The position of the mesh is set to the center of the bounding box.
|
|
1059
|
+
*
|
|
1060
|
+
* @example
|
|
1061
|
+
* '''typescript
|
|
1062
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
1063
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
1064
|
+
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
1065
|
+
* scene.add(boundingBoxMesh);
|
|
1066
|
+
* '''
|
|
1067
|
+
*/
|
|
1068
|
+
getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
|
|
1071
|
+
* This method is used to prepare the BoundingBoxer for a new set of fragments.
|
|
1072
|
+
*
|
|
1073
|
+
* @remarks
|
|
1074
|
+
* This method is called when a new set of fragments is added to the BoundingBoxer.
|
|
1075
|
+
* It ensures that the bounding box calculations are accurate and up-to-date.
|
|
1076
|
+
*
|
|
1077
|
+
* @example
|
|
1078
|
+
* '''typescript
|
|
1079
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
1080
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
1081
|
+
* // ...
|
|
1082
|
+
* boundingBoxer.reset();
|
|
1083
|
+
* '''
|
|
1084
|
+
*/
|
|
1085
|
+
reset(): void;
|
|
1086
|
+
/**
|
|
1087
|
+
* Adds a FragmentsGroup to the BoundingBoxer.
|
|
1088
|
+
*
|
|
1089
|
+
* @param group - The FragmentsGroup to add.
|
|
1090
|
+
*
|
|
1091
|
+
* @remarks
|
|
1092
|
+
* This method iterates through each fragment in the provided FragmentsGroup,
|
|
1093
|
+
* and calls the 'addMesh' method for each fragment's mesh.
|
|
1094
|
+
*
|
|
1095
|
+
* @example
|
|
1096
|
+
* '''typescript
|
|
1097
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
1098
|
+
* boundingBoxer.add(fragmentsGroup);
|
|
1099
|
+
* '''
|
|
1100
|
+
*/
|
|
1101
|
+
add(group: FragmentsGroup): void;
|
|
1102
|
+
/**
|
|
1103
|
+
* Adds a mesh to the BoundingBoxer and calculates the bounding box.
|
|
1104
|
+
*
|
|
1105
|
+
* @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
|
|
1106
|
+
* @param itemIDs - An optional iterable of numbers representing the item IDs.
|
|
1107
|
+
*
|
|
1108
|
+
* @remarks
|
|
1109
|
+
* This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
|
|
1110
|
+
* If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
|
|
1111
|
+
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* '''typescript
|
|
1115
|
+
* const boundingBoxer = components.get(BoundingBoxer);
|
|
1116
|
+
* boundingBoxer.addMesh(mesh);
|
|
1117
|
+
* '''
|
|
1118
|
+
*/
|
|
1119
|
+
addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
|
|
1120
|
+
private static getFragmentBounds;
|
|
1121
|
+
}
|
|
1122
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1123
|
+
import { Components, Component } from "../../core";
|
|
1124
|
+
/**
|
|
1125
|
+
* 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).
|
|
1126
|
+
*/
|
|
1127
|
+
export declare class Hider extends Component {
|
|
1128
|
+
/**
|
|
1129
|
+
* A unique identifier for the component.
|
|
1130
|
+
* This UUID is used to register the component within the Components system.
|
|
1131
|
+
*/
|
|
1132
|
+
static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
|
|
1133
|
+
/** {@link Component.enabled} */
|
|
1134
|
+
enabled: boolean;
|
|
1135
|
+
constructor(components: Components);
|
|
1136
|
+
/**
|
|
1137
|
+
* Sets the visibility of fragments within the 3D scene.
|
|
1138
|
+
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
1139
|
+
* If 'items' is provided, only the specified fragments will be affected.
|
|
1140
|
+
*
|
|
1141
|
+
* @param visible - The visibility state to set for the fragments.
|
|
1142
|
+
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
1143
|
+
* If not provided, all fragments will be affected.
|
|
1144
|
+
*
|
|
1145
|
+
* @returns {void}
|
|
1146
|
+
*/
|
|
1147
|
+
set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
|
|
1148
|
+
/**
|
|
1149
|
+
* Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
|
|
1150
|
+
* It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
|
|
1151
|
+
*
|
|
1152
|
+
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
1153
|
+
* If not provided, all fragments will be isolated.
|
|
1154
|
+
*
|
|
1155
|
+
* @returns {void}
|
|
1156
|
+
*/
|
|
1157
|
+
isolate(items: FRAGS.FragmentIdMap): void;
|
|
1158
|
+
private updateCulledVisibility;
|
|
1159
|
+
}
|
|
1160
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
1161
|
+
/**
|
|
1162
|
+
* 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).
|
|
1163
|
+
*/
|
|
1164
|
+
export declare class Exploder extends Component implements Disposable {
|
|
1165
|
+
/**
|
|
1166
|
+
* A unique identifier for the component.
|
|
1167
|
+
* This UUID is used to register the component within the Components system.
|
|
1168
|
+
*/
|
|
1169
|
+
static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
|
|
1170
|
+
/** {@link Disposable.onDisposed} */
|
|
1171
|
+
readonly onDisposed: Event<unknown>;
|
|
1172
|
+
/** {@link Component.enabled} */
|
|
1173
|
+
enabled: boolean;
|
|
1174
|
+
/**
|
|
1175
|
+
* The height of the explosion animation.
|
|
1176
|
+
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
1177
|
+
* Default value is 10.
|
|
1178
|
+
*/
|
|
1179
|
+
height: number;
|
|
1180
|
+
/**
|
|
1181
|
+
* The group name used for the explosion animation.
|
|
1182
|
+
* This property specifies the group of fragments that will be affected by the explosion.
|
|
1183
|
+
* Default value is "storeys".
|
|
1184
|
+
*/
|
|
1185
|
+
groupName: string;
|
|
1186
|
+
/**
|
|
1187
|
+
* A set of strings representing the exploded items.
|
|
1188
|
+
* This set is used to keep track of which items have been exploded.
|
|
1189
|
+
*/
|
|
1190
|
+
list: Set<string>;
|
|
1191
|
+
constructor(components: Components);
|
|
1192
|
+
/** {@link Disposable.dispose} */
|
|
1193
|
+
dispose(): void;
|
|
1194
|
+
/**
|
|
1195
|
+
* Sets the explosion state of the fragments.
|
|
1196
|
+
*
|
|
1197
|
+
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
1198
|
+
*
|
|
1199
|
+
* @remarks
|
|
1200
|
+
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
1201
|
+
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
1202
|
+
* If 'active' is false, the fragments are moved back to their original position.
|
|
1203
|
+
*
|
|
1204
|
+
* The method also keeps track of the exploded items using the 'list' set.
|
|
1205
|
+
*
|
|
1206
|
+
* @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
|
|
1207
|
+
*/
|
|
1208
|
+
set(active: boolean): void;
|
|
1209
|
+
}
|
|
1210
|
+
import * as WEBIFC from "web-ifc";
|
|
1211
|
+
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
1212
|
+
import { PropertiesStreamingSettings } from "./src";
|
|
1213
|
+
/**
|
|
1214
|
+
* 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).
|
|
1215
|
+
*/
|
|
1216
|
+
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
1217
|
+
/**
|
|
1218
|
+
* A unique identifier for the component.
|
|
1219
|
+
* This UUID is used to register the component within the Components system.
|
|
1220
|
+
*/
|
|
1221
|
+
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
1222
|
+
/**
|
|
1223
|
+
* An event that is triggered when properties are streamed from the IFC file.
|
|
1224
|
+
* The event provides the type of the IFC entity and the corresponding data.
|
|
1225
|
+
*/
|
|
1226
|
+
readonly onPropertiesStreamed: AsyncEvent<{
|
|
1227
|
+
type: number;
|
|
1228
|
+
data: {
|
|
1229
|
+
[id: number]: any;
|
|
1230
|
+
};
|
|
1231
|
+
}>;
|
|
1232
|
+
/**
|
|
1233
|
+
* An event that is triggered to indicate the progress of the streaming process.
|
|
1234
|
+
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
1235
|
+
*/
|
|
1236
|
+
readonly onProgress: AsyncEvent<number>;
|
|
1237
|
+
/**
|
|
1238
|
+
* An event that is triggered when indices are streamed from the IFC file.
|
|
1239
|
+
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
1240
|
+
*/
|
|
1241
|
+
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
1242
|
+
/** {@link Disposable.onDisposed} */
|
|
1243
|
+
readonly onDisposed: Event<string>;
|
|
1244
|
+
/** {@link Component.enabled} */
|
|
1245
|
+
enabled: boolean;
|
|
1246
|
+
/**
|
|
1247
|
+
* An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
|
|
1248
|
+
*/
|
|
1249
|
+
settings: PropertiesStreamingSettings;
|
|
1250
|
+
/**
|
|
1251
|
+
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
1252
|
+
*/
|
|
1253
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1254
|
+
/** {@link Disposable.dispose} */
|
|
1255
|
+
dispose(): Promise<void>;
|
|
1256
|
+
/**
|
|
1257
|
+
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
1258
|
+
*
|
|
1259
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1260
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1261
|
+
*/
|
|
1262
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1263
|
+
/**
|
|
1264
|
+
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
1265
|
+
*
|
|
1266
|
+
* @param loadCallback - A callback function that loads the IFC file data.
|
|
1267
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
1268
|
+
*/
|
|
1269
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1270
|
+
private readIfcFile;
|
|
1271
|
+
private streamIfcFile;
|
|
1272
|
+
private streamAllProperties;
|
|
1273
|
+
private cleanUp;
|
|
1274
|
+
}
|
|
1275
|
+
import * as WEBIFC from "web-ifc";
|
|
1276
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1277
|
+
import { IfcFragmentSettings } from "./src";
|
|
1278
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1279
|
+
/**
|
|
1280
|
+
* 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).
|
|
1281
|
+
*/
|
|
1282
|
+
export declare class IfcLoader extends Component implements Disposable {
|
|
1283
|
+
/**
|
|
1284
|
+
* A unique identifier for the component.
|
|
1285
|
+
* This UUID is used to register the component within the Components system.
|
|
1286
|
+
*/
|
|
1287
|
+
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
1288
|
+
/** {@link Disposable.onDisposed} */
|
|
1289
|
+
readonly onDisposed: Event<string>;
|
|
1290
|
+
/**
|
|
1291
|
+
* An event triggered when the IFC file starts loading.
|
|
1292
|
+
*/
|
|
1293
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
1294
|
+
/**
|
|
1295
|
+
* An event triggered when the setup process is completed.
|
|
1296
|
+
*/
|
|
1297
|
+
readonly onSetup: Event<void>;
|
|
1298
|
+
/**
|
|
1299
|
+
* The settings for the IfcLoader.
|
|
1300
|
+
* It includes options for excluding categories, setting WASM paths, and more.
|
|
1301
|
+
*/
|
|
1302
|
+
settings: IfcFragmentSettings;
|
|
1303
|
+
/**
|
|
1304
|
+
* The instance of the Web-IFC library used for handling IFC data.
|
|
1305
|
+
*/
|
|
1306
|
+
webIfc: WEBIFC.IfcAPI;
|
|
1307
|
+
/** {@link Component.enabled} */
|
|
1308
|
+
enabled: boolean;
|
|
1309
|
+
private _material;
|
|
1310
|
+
private _spatialTree;
|
|
1311
|
+
private _metaData;
|
|
1312
|
+
private _fragmentInstances;
|
|
1313
|
+
private _civil;
|
|
1314
|
+
private _visitedFragments;
|
|
1315
|
+
private _materialT;
|
|
1316
|
+
constructor(components: Components);
|
|
1317
|
+
/** {@link Disposable.dispose} */
|
|
1318
|
+
dispose(): void;
|
|
1319
|
+
/**
|
|
1320
|
+
* Sets up the IfcLoader component with the provided configuration.
|
|
1321
|
+
*
|
|
1322
|
+
* @param config - Optional configuration settings for the IfcLoader.
|
|
1323
|
+
* If not provided, the existing settings will be used.
|
|
1324
|
+
*
|
|
1325
|
+
* @returns A Promise that resolves when the setup process is completed.
|
|
1326
|
+
*
|
|
1327
|
+
* @remarks
|
|
1328
|
+
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
1329
|
+
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
1330
|
+
*
|
|
1331
|
+
* @example
|
|
1332
|
+
* '''typescript
|
|
1333
|
+
* const ifcLoader = new IfcLoader(components);
|
|
1334
|
+
* await ifcLoader.setup({ autoSetWasm: true });
|
|
1335
|
+
* '''
|
|
1336
|
+
*/
|
|
1337
|
+
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
1338
|
+
/**
|
|
1339
|
+
* Loads an IFC file and processes it for 3D visualization.
|
|
1340
|
+
*
|
|
1341
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1342
|
+
* @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
1343
|
+
*
|
|
1344
|
+
* @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
|
|
1345
|
+
*
|
|
1346
|
+
* @example
|
|
1347
|
+
* '''typescript
|
|
1348
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1349
|
+
* const group = await ifcLoader.load(ifcData);
|
|
1350
|
+
* '''
|
|
1351
|
+
*/
|
|
1352
|
+
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
1353
|
+
/**
|
|
1354
|
+
* Reads an IFC file and initializes the Web-IFC library.
|
|
1355
|
+
*
|
|
1356
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
1357
|
+
*
|
|
1358
|
+
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
1359
|
+
*
|
|
1360
|
+
* @remarks
|
|
1361
|
+
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
1362
|
+
* It also opens the IFC model using the provided data and settings.
|
|
1363
|
+
*
|
|
1364
|
+
* @example
|
|
1365
|
+
* '''typescript
|
|
1366
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1367
|
+
* await ifcLoader.readIfcFile(ifcData);
|
|
1368
|
+
* '''
|
|
1369
|
+
*/
|
|
1370
|
+
readIfcFile(data: Uint8Array): Promise<number>;
|
|
1371
|
+
/**
|
|
1372
|
+
* Cleans up the IfcLoader component by resetting the Web-IFC library,
|
|
1373
|
+
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
1374
|
+
*
|
|
1375
|
+
* @remarks
|
|
1376
|
+
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
1377
|
+
*
|
|
1378
|
+
* @example
|
|
1379
|
+
* '''typescript
|
|
1380
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
1381
|
+
* ifcLoader.cleanUp();
|
|
1382
|
+
* '''
|
|
1383
|
+
*/
|
|
1384
|
+
cleanUp(): void;
|
|
1385
|
+
private getAllGeometries;
|
|
1386
|
+
private getMesh;
|
|
1387
|
+
private getGeometry;
|
|
1388
|
+
private autoSetWasm;
|
|
1389
|
+
}
|
|
1390
|
+
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1391
|
+
import * as THREE from "three";
|
|
1392
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
1393
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
1394
|
+
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
1395
|
+
/**
|
|
1396
|
+
* 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).
|
|
1397
|
+
*/
|
|
1398
|
+
export declare class FragmentsManager extends Component implements Disposable {
|
|
1399
|
+
/**
|
|
1400
|
+
* A unique identifier for the component.
|
|
1401
|
+
* This UUID is used to register the component within the Components system.
|
|
1402
|
+
*/
|
|
1403
|
+
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1404
|
+
/** {@link Disposable.onDisposed} */
|
|
1405
|
+
readonly onDisposed: Event<unknown>;
|
|
1406
|
+
/**
|
|
1407
|
+
* Event triggered when fragments are loaded.
|
|
1408
|
+
*/
|
|
1409
|
+
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
1410
|
+
/**
|
|
1411
|
+
* Event triggered when fragments are disposed.
|
|
1412
|
+
*/
|
|
1413
|
+
readonly onFragmentsDisposed: Event<{
|
|
1414
|
+
groupID: string;
|
|
1415
|
+
fragmentIDs: string[];
|
|
1416
|
+
}>;
|
|
1417
|
+
/**
|
|
1418
|
+
* Map containing all loaded fragments.
|
|
1419
|
+
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
1420
|
+
*/
|
|
1421
|
+
readonly list: Map<string, Fragment>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Map containing all loaded fragment groups.
|
|
1424
|
+
* The key is the group's unique identifier, and the value is the group itself.
|
|
1425
|
+
*/
|
|
1426
|
+
readonly groups: Map<string, FragmentsGroup>;
|
|
1427
|
+
baseCoordinationModel: string;
|
|
1428
|
+
/** {@link Component.enabled} */
|
|
1429
|
+
enabled: boolean;
|
|
1430
|
+
private _loader;
|
|
1431
|
+
/**
|
|
1432
|
+
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
1433
|
+
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
1434
|
+
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
1435
|
+
*/
|
|
1436
|
+
get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
|
|
1437
|
+
constructor(components: Components);
|
|
1438
|
+
/** {@link Disposable.dispose} */
|
|
1439
|
+
dispose(): void;
|
|
1440
|
+
/**
|
|
1441
|
+
* Dispose of a specific fragment group.
|
|
1442
|
+
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1443
|
+
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1444
|
+
*
|
|
1445
|
+
* @param group - The fragment group to be disposed.
|
|
1446
|
+
*/
|
|
1447
|
+
disposeGroup(group: FragmentsGroup): void;
|
|
1448
|
+
/**
|
|
1449
|
+
* Loads a binary file that contain fragment geometry.
|
|
1450
|
+
* @param data - The binary data to load.
|
|
1451
|
+
* @param config - Optional configuration for loading.
|
|
1452
|
+
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
1453
|
+
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1454
|
+
* @returns The loaded FragmentsGroup.
|
|
1455
|
+
*/
|
|
1456
|
+
load(data: Uint8Array, config?: Partial<{
|
|
1457
|
+
coordinate: boolean;
|
|
1458
|
+
name: string;
|
|
1459
|
+
properties: FRAGS.IfcProperties;
|
|
1460
|
+
relationsMap: RelationsMap;
|
|
1461
|
+
}>): FragmentsGroup;
|
|
1203
1462
|
/**
|
|
1204
1463
|
* Export the specified fragmentsgroup to binary data.
|
|
1205
1464
|
* @param group - the fragments group to be exported.
|
|
@@ -1291,117 +1550,52 @@ export declare class IfcGeometryTiler extends Component implements Disposable {
|
|
|
1291
1550
|
private _metaData;
|
|
1292
1551
|
private _visitedGeometries;
|
|
1293
1552
|
private _streamSerializer;
|
|
1294
|
-
private _geometries;
|
|
1295
|
-
private _geometryCount;
|
|
1296
|
-
private _civil;
|
|
1297
|
-
private _groupSerializer;
|
|
1298
|
-
private _assets;
|
|
1299
|
-
private _meshesWithHoles;
|
|
1300
|
-
constructor(components: Components);
|
|
1301
|
-
/** {@link Disposable.dispose} */
|
|
1302
|
-
dispose(): void;
|
|
1303
|
-
/**
|
|
1304
|
-
* This method streams the IFC file from a given buffer.
|
|
1305
|
-
*
|
|
1306
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
1307
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1308
|
-
*
|
|
1309
|
-
* @remarks
|
|
1310
|
-
* This method cleans up any resources after the streaming process is complete.
|
|
1311
|
-
*
|
|
1312
|
-
* @example
|
|
1313
|
-
* '''typescript
|
|
1314
|
-
* const ifcData = await fetch('path/to/ifc/file.ifc');
|
|
1315
|
-
* const rawBuffer = await response.arrayBuffer();
|
|
1316
|
-
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
1317
|
-
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
1318
|
-
* '''
|
|
1319
|
-
*/
|
|
1320
|
-
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1321
|
-
/**
|
|
1322
|
-
* This method streams the IFC file from a given callback.
|
|
1323
|
-
*
|
|
1324
|
-
* @param loadCallback - The callback function that will be used to load the IFC file.
|
|
1325
|
-
* @returns A Promise that resolves when the streaming process is complete.
|
|
1326
|
-
*
|
|
1327
|
-
* @remarks
|
|
1328
|
-
* This method cleans up any resources after the streaming process is complete.
|
|
1329
|
-
*
|
|
1330
|
-
*/
|
|
1331
|
-
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1332
|
-
private readIfcFile;
|
|
1333
|
-
private streamIfcFile;
|
|
1334
|
-
private streamAllGeometries;
|
|
1335
|
-
private cleanUp;
|
|
1336
|
-
private getMesh;
|
|
1337
|
-
private getGeometry;
|
|
1338
|
-
private streamAssets;
|
|
1339
|
-
private streamGeometries;
|
|
1340
|
-
}
|
|
1341
|
-
import * as WEBIFC from "web-ifc";
|
|
1342
|
-
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
1343
|
-
import { PropertiesStreamingSettings } from "./src";
|
|
1344
|
-
/**
|
|
1345
|
-
* 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).
|
|
1346
|
-
*/
|
|
1347
|
-
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
1348
|
-
/**
|
|
1349
|
-
* A unique identifier for the component.
|
|
1350
|
-
* This UUID is used to register the component within the Components system.
|
|
1351
|
-
*/
|
|
1352
|
-
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
1353
|
-
/**
|
|
1354
|
-
* An event that is triggered when properties are streamed from the IFC file.
|
|
1355
|
-
* The event provides the type of the IFC entity and the corresponding data.
|
|
1356
|
-
*/
|
|
1357
|
-
readonly onPropertiesStreamed: AsyncEvent<{
|
|
1358
|
-
type: number;
|
|
1359
|
-
data: {
|
|
1360
|
-
[id: number]: any;
|
|
1361
|
-
};
|
|
1362
|
-
}>;
|
|
1363
|
-
/**
|
|
1364
|
-
* An event that is triggered to indicate the progress of the streaming process.
|
|
1365
|
-
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
1366
|
-
*/
|
|
1367
|
-
readonly onProgress: AsyncEvent<number>;
|
|
1368
|
-
/**
|
|
1369
|
-
* An event that is triggered when indices are streamed from the IFC file.
|
|
1370
|
-
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
1371
|
-
*/
|
|
1372
|
-
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
1373
|
-
/** {@link Disposable.onDisposed} */
|
|
1374
|
-
readonly onDisposed: Event<string>;
|
|
1375
|
-
/** {@link Component.enabled} */
|
|
1376
|
-
enabled: boolean;
|
|
1377
|
-
/**
|
|
1378
|
-
* An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
|
|
1379
|
-
*/
|
|
1380
|
-
settings: PropertiesStreamingSettings;
|
|
1381
|
-
/**
|
|
1382
|
-
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
1383
|
-
*/
|
|
1384
|
-
webIfc: WEBIFC.IfcAPI;
|
|
1553
|
+
private _geometries;
|
|
1554
|
+
private _geometryCount;
|
|
1555
|
+
private _civil;
|
|
1556
|
+
private _groupSerializer;
|
|
1557
|
+
private _assets;
|
|
1558
|
+
private _meshesWithHoles;
|
|
1559
|
+
constructor(components: Components);
|
|
1385
1560
|
/** {@link Disposable.dispose} */
|
|
1386
|
-
dispose():
|
|
1561
|
+
dispose(): void;
|
|
1387
1562
|
/**
|
|
1388
|
-
* This method
|
|
1563
|
+
* This method streams the IFC file from a given buffer.
|
|
1389
1564
|
*
|
|
1390
1565
|
* @param data - The Uint8Array containing the IFC file data.
|
|
1391
1566
|
* @returns A Promise that resolves when the streaming process is complete.
|
|
1567
|
+
*
|
|
1568
|
+
* @remarks
|
|
1569
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
1570
|
+
*
|
|
1571
|
+
* @example
|
|
1572
|
+
* '''typescript
|
|
1573
|
+
* const ifcData = await fetch('path/to/ifc/file.ifc');
|
|
1574
|
+
* const rawBuffer = await response.arrayBuffer();
|
|
1575
|
+
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
1576
|
+
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
1577
|
+
* '''
|
|
1392
1578
|
*/
|
|
1393
1579
|
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
1394
1580
|
/**
|
|
1395
|
-
* This method
|
|
1581
|
+
* This method streams the IFC file from a given callback.
|
|
1396
1582
|
*
|
|
1397
|
-
* @param loadCallback -
|
|
1583
|
+
* @param loadCallback - The callback function that will be used to load the IFC file.
|
|
1398
1584
|
* @returns A Promise that resolves when the streaming process is complete.
|
|
1585
|
+
*
|
|
1586
|
+
* @remarks
|
|
1587
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
1588
|
+
*
|
|
1399
1589
|
*/
|
|
1400
1590
|
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
1401
1591
|
private readIfcFile;
|
|
1402
1592
|
private streamIfcFile;
|
|
1403
|
-
private
|
|
1593
|
+
private streamAllGeometries;
|
|
1404
1594
|
private cleanUp;
|
|
1595
|
+
private getMesh;
|
|
1596
|
+
private getGeometry;
|
|
1597
|
+
private streamAssets;
|
|
1598
|
+
private streamGeometries;
|
|
1405
1599
|
}
|
|
1406
1600
|
import * as WEBIFC from "web-ifc";
|
|
1407
1601
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
@@ -1545,31 +1739,6 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
|
|
|
1545
1739
|
dispose(): void;
|
|
1546
1740
|
}
|
|
1547
1741
|
import * as WEBIFC from "web-ifc";
|
|
1548
|
-
import * as FRAG from "@thatopen/fragments";
|
|
1549
|
-
import { Component, Components } from "../../core";
|
|
1550
|
-
/**
|
|
1551
|
-
* 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).
|
|
1552
|
-
*/
|
|
1553
|
-
export declare class IfcJsonExporter extends Component {
|
|
1554
|
-
/**
|
|
1555
|
-
* A unique identifier for the component.
|
|
1556
|
-
* This UUID is used to register the component within the Components system.
|
|
1557
|
-
*/
|
|
1558
|
-
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
1559
|
-
/** {@link Component.enabled} */
|
|
1560
|
-
enabled: boolean;
|
|
1561
|
-
constructor(components: Components);
|
|
1562
|
-
/**
|
|
1563
|
-
* Exports all the properties of an IFC into an array of JS objects.
|
|
1564
|
-
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
1565
|
-
* @param modelID ID of the IFC model whose properties to extract.
|
|
1566
|
-
* @param indirect whether to get the indirect relationships as well.
|
|
1567
|
-
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
1568
|
-
* to make the location data available (e.g. absolute position of building).
|
|
1569
|
-
*/
|
|
1570
|
-
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
1571
|
-
}
|
|
1572
|
-
import * as WEBIFC from "web-ifc";
|
|
1573
1742
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1574
1743
|
import { Component, Disposable, Event, Components } from "../../core";
|
|
1575
1744
|
/**
|
|
@@ -1825,204 +1994,31 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
|
|
|
1825
1994
|
private registerChange;
|
|
1826
1995
|
private newSingleProperty;
|
|
1827
1996
|
}
|
|
1828
|
-
import * as
|
|
1829
|
-
import
|
|
1830
|
-
|
|
1831
|
-
* Represents an edge measurement result.
|
|
1832
|
-
*/
|
|
1833
|
-
export interface MeasureEdge {
|
|
1834
|
-
/**
|
|
1835
|
-
* The distance between the two points of the edge.
|
|
1836
|
-
*/
|
|
1837
|
-
distance: number;
|
|
1838
|
-
/**
|
|
1839
|
-
* The two points that define the edge.
|
|
1840
|
-
*/
|
|
1841
|
-
points: THREE.Vector3[];
|
|
1842
|
-
}
|
|
1843
|
-
/**
|
|
1844
|
-
* 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).
|
|
1845
|
-
*/
|
|
1846
|
-
export declare class MeasurementUtils extends Component {
|
|
1847
|
-
/**
|
|
1848
|
-
* A unique identifier for the component.
|
|
1849
|
-
* This UUID is used to register the component within the Components system.
|
|
1850
|
-
*/
|
|
1851
|
-
static uuid: string;
|
|
1852
|
-
/** {@link Component.enabled} */
|
|
1853
|
-
enabled: boolean;
|
|
1854
|
-
constructor(components: Components);
|
|
1855
|
-
/**
|
|
1856
|
-
* Utility method to calculate the distance from a point to a line segment.
|
|
1857
|
-
*
|
|
1858
|
-
* @param point - The point from which to calculate the distance.
|
|
1859
|
-
* @param lineStart - The start point of the line segment.
|
|
1860
|
-
* @param lineEnd - The end point of the line segment.
|
|
1861
|
-
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
1862
|
-
* @returns The distance from the point to the line segment.
|
|
1863
|
-
*/
|
|
1864
|
-
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
1865
|
-
/**
|
|
1866
|
-
* Method to get the face of a mesh that contains a given triangle index.
|
|
1867
|
-
* It also returns the edges of the found face and their indices.
|
|
1868
|
-
*
|
|
1869
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1870
|
-
* @param triangleIndex - The index of the triangle within the mesh.
|
|
1871
|
-
* @param instance - The instance of the mesh (optional).
|
|
1872
|
-
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
1873
|
-
*/
|
|
1874
|
-
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
1875
|
-
edges: MeasureEdge[];
|
|
1876
|
-
indices: Set<number>;
|
|
1877
|
-
} | null;
|
|
1878
|
-
/**
|
|
1879
|
-
* Method to get the vertices and normal of a mesh face at a given index.
|
|
1880
|
-
* It also applies instance transformation if provided.
|
|
1881
|
-
*
|
|
1882
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1883
|
-
* @param faceIndex - The index of the face within the mesh.
|
|
1884
|
-
* @param instance - The instance of the mesh (optional).
|
|
1885
|
-
* @returns An object containing the vertices and normal of the face.
|
|
1886
|
-
* @throws Will throw an error if the geometry is not indexed.
|
|
1887
|
-
*/
|
|
1888
|
-
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
1889
|
-
p1: THREE.Vector3;
|
|
1890
|
-
p2: THREE.Vector3;
|
|
1891
|
-
p3: THREE.Vector3;
|
|
1892
|
-
faceNormal: THREE.Vector3;
|
|
1893
|
-
};
|
|
1894
|
-
/**
|
|
1895
|
-
* Method to round the vector's components to a specified number of decimal places.
|
|
1896
|
-
* This is used to ensure numerical precision in edge detection.
|
|
1897
|
-
*
|
|
1898
|
-
* @param vector - The vector to round.
|
|
1899
|
-
* @returns The vector with rounded components.
|
|
1900
|
-
*/
|
|
1901
|
-
round(vector: THREE.Vector3): void;
|
|
1902
|
-
private getFaceData;
|
|
1903
|
-
}
|
|
1904
|
-
export declare class UUID {
|
|
1905
|
-
private static _pattern;
|
|
1906
|
-
private static _lut;
|
|
1907
|
-
static create(): string;
|
|
1908
|
-
static validate(uuid: string): void;
|
|
1909
|
-
}
|
|
1910
|
-
import * as THREE from "three";
|
|
1911
|
-
import { Component, Components, Disposable, Event, World } from "../core";
|
|
1912
|
-
/**
|
|
1913
|
-
* Configuration interface for the VertexPicker component.
|
|
1914
|
-
*/
|
|
1915
|
-
export interface VertexPickerConfig {
|
|
1916
|
-
/**
|
|
1917
|
-
* If true, only vertices will be picked, not the closest point on the face.
|
|
1918
|
-
*/
|
|
1919
|
-
showOnlyVertex: boolean;
|
|
1920
|
-
/**
|
|
1921
|
-
* The maximum distance for snapping to a vertex.
|
|
1922
|
-
*/
|
|
1923
|
-
snapDistance: number;
|
|
1924
|
-
/**
|
|
1925
|
-
* The HTML element to use for previewing the picked vertex.
|
|
1926
|
-
*/
|
|
1927
|
-
previewElement: HTMLElement;
|
|
1928
|
-
}
|
|
1929
|
-
/**
|
|
1930
|
-
* A class that provides functionality for picking vertices in a 3D scene.
|
|
1931
|
-
*/
|
|
1932
|
-
export declare class VertexPicker extends Component implements Disposable {
|
|
1933
|
-
/** {@link Disposable.onDisposed} */
|
|
1934
|
-
readonly onDisposed: Event<unknown>;
|
|
1935
|
-
/**
|
|
1936
|
-
* An event that is triggered when a vertex is found.
|
|
1937
|
-
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
1938
|
-
*/
|
|
1939
|
-
readonly onVertexFound: Event<THREE.Vector3>;
|
|
1940
|
-
/**
|
|
1941
|
-
* An event that is triggered when a vertex is lost.
|
|
1942
|
-
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
1943
|
-
*/
|
|
1944
|
-
readonly onVertexLost: Event<THREE.Vector3>;
|
|
1945
|
-
/**
|
|
1946
|
-
* A reference to the Components instance associated with this VertexPicker.
|
|
1947
|
-
*/
|
|
1948
|
-
components: Components;
|
|
1949
|
-
/**
|
|
1950
|
-
* A reference to the working plane used for vertex picking.
|
|
1951
|
-
* This plane is used to determine which vertices are considered valid for picking.
|
|
1952
|
-
* If this value is null, all vertices are considered valid.
|
|
1953
|
-
*/
|
|
1954
|
-
workingPlane: THREE.Plane | null;
|
|
1955
|
-
private _pickedPoint;
|
|
1956
|
-
private _config;
|
|
1957
|
-
private _enabled;
|
|
1958
|
-
/**
|
|
1959
|
-
* Sets the enabled state of the VertexPicker.
|
|
1960
|
-
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
1961
|
-
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
1962
|
-
*
|
|
1963
|
-
* @param value - The new enabled state.
|
|
1964
|
-
*/
|
|
1965
|
-
set enabled(value: boolean);
|
|
1966
|
-
/**
|
|
1967
|
-
* Gets the current enabled state of the VertexPicker.
|
|
1968
|
-
*
|
|
1969
|
-
* @returns The current enabled state.
|
|
1970
|
-
*/
|
|
1971
|
-
get enabled(): boolean;
|
|
1972
|
-
/**
|
|
1973
|
-
* Sets the configuration for the VertexPicker component.
|
|
1974
|
-
*
|
|
1975
|
-
* @param value - A Partial object containing the configuration properties to update.
|
|
1976
|
-
* The properties not provided in the value object will retain their current values.
|
|
1977
|
-
*
|
|
1978
|
-
* @example
|
|
1979
|
-
* '''typescript
|
|
1980
|
-
* vertexPicker.config = {
|
|
1981
|
-
* snapDistance: 0.5,
|
|
1982
|
-
* showOnlyVertex: true,
|
|
1983
|
-
* };
|
|
1984
|
-
* '''
|
|
1985
|
-
*/
|
|
1986
|
-
set config(value: Partial<VertexPickerConfig>);
|
|
1987
|
-
/**
|
|
1988
|
-
* Gets the current configuration for the VertexPicker component.
|
|
1989
|
-
*
|
|
1990
|
-
* @returns A copy of the current VertexPickerConfig object.
|
|
1991
|
-
*
|
|
1992
|
-
* @example
|
|
1993
|
-
* '''typescript
|
|
1994
|
-
* const currentConfig = vertexPicker.config;
|
|
1995
|
-
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
1996
|
-
* '''
|
|
1997
|
-
*/
|
|
1998
|
-
get config(): Partial<VertexPickerConfig>;
|
|
1999
|
-
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
2000
|
-
/** {@link Disposable.dispose} */
|
|
2001
|
-
dispose(): void;
|
|
2002
|
-
/**
|
|
2003
|
-
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
2004
|
-
*
|
|
2005
|
-
* @param world - The World instance to use for raycasting.
|
|
2006
|
-
*
|
|
2007
|
-
* @returns The current picked point, or null if no point is picked.
|
|
2008
|
-
*
|
|
2009
|
-
* @remarks
|
|
2010
|
-
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
2011
|
-
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
2012
|
-
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
2013
|
-
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
2014
|
-
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
2015
|
-
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
2016
|
-
*/
|
|
2017
|
-
get(world: World): THREE.Vector3 | null;
|
|
2018
|
-
private getClosestVertex;
|
|
2019
|
-
private getVertices;
|
|
2020
|
-
private getVertex;
|
|
2021
|
-
}
|
|
1997
|
+
import * as WEBIFC from "web-ifc";
|
|
1998
|
+
import * as FRAG from "@thatopen/fragments";
|
|
1999
|
+
import { Component, Components } from "../../core";
|
|
2022
2000
|
/**
|
|
2023
|
-
*
|
|
2001
|
+
* 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).
|
|
2024
2002
|
*/
|
|
2025
|
-
export declare
|
|
2003
|
+
export declare class IfcJsonExporter extends Component {
|
|
2004
|
+
/**
|
|
2005
|
+
* A unique identifier for the component.
|
|
2006
|
+
* This UUID is used to register the component within the Components system.
|
|
2007
|
+
*/
|
|
2008
|
+
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
2009
|
+
/** {@link Component.enabled} */
|
|
2010
|
+
enabled: boolean;
|
|
2011
|
+
constructor(components: Components);
|
|
2012
|
+
/**
|
|
2013
|
+
* Exports all the properties of an IFC into an array of JS objects.
|
|
2014
|
+
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
2015
|
+
* @param modelID ID of the IFC model whose properties to extract.
|
|
2016
|
+
* @param indirect whether to get the indirect relationships as well.
|
|
2017
|
+
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
2018
|
+
* to make the location data available (e.g. absolute position of building).
|
|
2019
|
+
*/
|
|
2020
|
+
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
2021
|
+
}
|
|
2026
2022
|
import * as THREE from "three";
|
|
2027
2023
|
import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
|
|
2028
2024
|
/**
|
|
@@ -2112,11 +2108,18 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
|
|
|
2112
2108
|
resize(size?: THREE.Vector2): void;
|
|
2113
2109
|
private updatePlanes;
|
|
2114
2110
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2111
|
+
/**
|
|
2112
|
+
* A Set of unique numbers representing different types of IFC geometries.
|
|
2113
|
+
*/
|
|
2114
|
+
export declare const GeometryTypes: Set<number>;
|
|
2115
|
+
import * as WEBIFC from "web-ifc";
|
|
2116
|
+
import { IfcItemsCategories } from "../../../ifc";
|
|
2117
|
+
export declare class SpatialStructure {
|
|
2118
|
+
itemsByFloor: IfcItemsCategories;
|
|
2119
|
+
private _units;
|
|
2120
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2121
|
+
cleanUp(): void;
|
|
2122
|
+
}
|
|
2120
2123
|
import * as WEBIFC from "web-ifc";
|
|
2121
2124
|
/** Configuration of the IFC-fragment conversion. */
|
|
2122
2125
|
export declare class IfcFragmentSettings {
|
|
@@ -2159,14 +2162,6 @@ export declare class IfcFragmentSettings {
|
|
|
2159
2162
|
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2160
2163
|
}
|
|
2161
2164
|
import * as WEBIFC from "web-ifc";
|
|
2162
|
-
import { IfcItemsCategories } from "../../../ifc";
|
|
2163
|
-
export declare class SpatialStructure {
|
|
2164
|
-
itemsByFloor: IfcItemsCategories;
|
|
2165
|
-
private _units;
|
|
2166
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2167
|
-
cleanUp(): void;
|
|
2168
|
-
}
|
|
2169
|
-
import * as WEBIFC from "web-ifc";
|
|
2170
2165
|
export interface IfcItemsCategories {
|
|
2171
2166
|
[itemID: number]: number;
|
|
2172
2167
|
}
|
|
@@ -2215,937 +2210,893 @@ export declare class IfcPropertiesUtils {
|
|
|
2215
2210
|
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2216
2211
|
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2217
2212
|
}
|
|
2218
|
-
/**
|
|
2219
|
-
* 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.
|
|
2220
|
-
*/
|
|
2221
|
-
export declare class AsyncEvent<T> {
|
|
2222
|
-
/**
|
|
2223
|
-
* Add a callback to this event instance.
|
|
2224
|
-
* @param handler - the callback to be added to this event.
|
|
2225
|
-
*/
|
|
2226
|
-
add(handler: T extends void ? {
|
|
2227
|
-
(): Promise<void>;
|
|
2228
|
-
} : {
|
|
2229
|
-
(data: T): Promise<void>;
|
|
2230
|
-
}): void;
|
|
2231
|
-
/**
|
|
2232
|
-
* Removes a callback from this event instance.
|
|
2233
|
-
* @param handler - the callback to be removed from this event.
|
|
2234
|
-
*/
|
|
2235
|
-
remove(handler: T extends void ? {
|
|
2236
|
-
(): Promise<void>;
|
|
2237
|
-
} : {
|
|
2238
|
-
(data: T): Promise<void>;
|
|
2239
|
-
}): void;
|
|
2240
|
-
/** Triggers all the callbacks assigned to this event. */
|
|
2241
|
-
trigger: (data?: T) => Promise<void>;
|
|
2242
|
-
/** Gets rid of all the suscribed events. */
|
|
2243
|
-
reset(): void;
|
|
2244
|
-
private handlers;
|
|
2245
|
-
}
|
|
2246
|
-
/**
|
|
2247
|
-
* 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.
|
|
2248
|
-
*/
|
|
2249
|
-
export declare class Event<T> {
|
|
2250
|
-
/**
|
|
2251
|
-
* Add a callback to this event instance.
|
|
2252
|
-
* @param handler - the callback to be added to this event.
|
|
2253
|
-
*/
|
|
2254
|
-
add(handler: T extends void ? {
|
|
2255
|
-
(): void;
|
|
2256
|
-
} : {
|
|
2257
|
-
(data: T): void;
|
|
2258
|
-
}): void;
|
|
2259
|
-
/**
|
|
2260
|
-
* Removes a callback from this event instance.
|
|
2261
|
-
* @param handler - the callback to be removed from this event.
|
|
2262
|
-
*/
|
|
2263
|
-
remove(handler: T extends void ? {
|
|
2264
|
-
(): void;
|
|
2265
|
-
} : {
|
|
2266
|
-
(data: T): void;
|
|
2267
|
-
}): void;
|
|
2268
|
-
/** Triggers all the callbacks assigned to this event. */
|
|
2269
|
-
trigger: (data?: T) => void;
|
|
2270
|
-
/** Gets rid of all the suscribed events. */
|
|
2271
|
-
reset(): void;
|
|
2272
|
-
private handlers;
|
|
2273
|
-
}
|
|
2274
2213
|
import * as THREE from "three";
|
|
2275
|
-
import
|
|
2276
|
-
import { Event } from "./event";
|
|
2277
|
-
/**
|
|
2278
|
-
* 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.
|
|
2279
|
-
*/
|
|
2280
|
-
export interface Disposable {
|
|
2281
|
-
/**
|
|
2282
|
-
* Destroys the object from memory to prevent a
|
|
2283
|
-
* [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
2284
|
-
*/
|
|
2285
|
-
dispose: () => void | Promise<void>;
|
|
2286
|
-
/** Fired after the tool has been disposed. */
|
|
2287
|
-
readonly onDisposed: Event<any>;
|
|
2288
|
-
}
|
|
2214
|
+
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
2289
2215
|
/**
|
|
2290
|
-
*
|
|
2216
|
+
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
2217
|
+
*
|
|
2218
|
+
* @template T - The type of the scene. Default is BaseScene.
|
|
2219
|
+
* @template U - The type of the camera. Default is BaseCamera.
|
|
2220
|
+
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
2291
2221
|
*/
|
|
2292
|
-
export
|
|
2222
|
+
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
|
|
2293
2223
|
/**
|
|
2294
|
-
*
|
|
2295
|
-
* currently visible or not in the
|
|
2296
|
-
* [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
2224
|
+
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
2297
2225
|
*/
|
|
2298
|
-
|
|
2299
|
-
}
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2226
|
+
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
2227
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2228
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
2229
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2230
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
2231
|
+
/** {@link Disposable.onDisposed} */
|
|
2232
|
+
readonly onDisposed: Event<unknown>;
|
|
2304
2233
|
/**
|
|
2305
|
-
*
|
|
2306
|
-
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2307
|
-
* component.
|
|
2234
|
+
* 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.
|
|
2308
2235
|
*/
|
|
2309
|
-
|
|
2310
|
-
/** Event that fires when the component has been resized. */
|
|
2311
|
-
onResize: Event<THREE.Vector2>;
|
|
2236
|
+
isDisposing: boolean;
|
|
2312
2237
|
/**
|
|
2313
|
-
*
|
|
2314
|
-
*
|
|
2315
|
-
* component.
|
|
2238
|
+
* Indicates whether the world is currently enabled.
|
|
2239
|
+
* When disabled, the world will not be updated.
|
|
2316
2240
|
*/
|
|
2317
|
-
|
|
2318
|
-
}
|
|
2319
|
-
/** Whether this component should be updated each frame. */
|
|
2320
|
-
export interface Updateable {
|
|
2321
|
-
/** Actions that should be executed after updating the component. */
|
|
2322
|
-
onAfterUpdate: Event<any>;
|
|
2323
|
-
/** Actions that should be executed before updating the component. */
|
|
2324
|
-
onBeforeUpdate: Event<any>;
|
|
2241
|
+
enabled: boolean;
|
|
2325
2242
|
/**
|
|
2326
|
-
*
|
|
2327
|
-
* instance, a renderer component will make a render each frame.
|
|
2243
|
+
* A unique identifier for the world.
|
|
2328
2244
|
*/
|
|
2329
|
-
|
|
2330
|
-
}
|
|
2331
|
-
/** Basic type to describe the progress of any kind of process. */
|
|
2332
|
-
export interface Progress {
|
|
2333
|
-
/** The amount of things that have been done already. */
|
|
2334
|
-
current: number;
|
|
2335
|
-
/** The total amount of things to be done by the process. */
|
|
2336
|
-
total: number;
|
|
2337
|
-
}
|
|
2338
|
-
/**
|
|
2339
|
-
* Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
|
|
2340
|
-
*/
|
|
2341
|
-
export interface Createable {
|
|
2342
|
-
/** Creates a new instance of an element (e.g. a new Dimension). */
|
|
2343
|
-
create: (data: any) => void;
|
|
2245
|
+
uuid: string;
|
|
2344
2246
|
/**
|
|
2345
|
-
*
|
|
2346
|
-
* instance of whatever the component creates.
|
|
2247
|
+
* An optional name for the world.
|
|
2347
2248
|
*/
|
|
2348
|
-
|
|
2249
|
+
name?: string;
|
|
2250
|
+
private _scene?;
|
|
2251
|
+
private _camera?;
|
|
2252
|
+
private _renderer;
|
|
2349
2253
|
/**
|
|
2350
|
-
*
|
|
2351
|
-
*
|
|
2352
|
-
*/
|
|
2353
|
-
cancelCreation?: (data: any) => void;
|
|
2354
|
-
/** Deletes an existing instance of an element (e.g. a Dimension). */
|
|
2355
|
-
delete: (data: any) => void;
|
|
2356
|
-
}
|
|
2357
|
-
/**
|
|
2358
|
-
* Whether this component supports to be configured.
|
|
2359
|
-
*/
|
|
2360
|
-
export interface Configurable<T extends Record<string, any>> {
|
|
2361
|
-
/** Wether this components has been already configured. */
|
|
2362
|
-
isSetup: boolean;
|
|
2363
|
-
/** Use the provided configuration to setup the tool. */
|
|
2364
|
-
setup: (config?: Partial<T>) => void | Promise<void>;
|
|
2365
|
-
/** Fired after successfully calling {@link Configurable.setup()} */
|
|
2366
|
-
readonly onSetup: Event<any>;
|
|
2367
|
-
/** Object holding the tool configuration. Is not meant to be edited directly, if you need
|
|
2368
|
-
* to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
|
|
2254
|
+
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
2255
|
+
* @returns The current scene.
|
|
2369
2256
|
*/
|
|
2370
|
-
|
|
2371
|
-
}
|
|
2372
|
-
/**
|
|
2373
|
-
* Whether a camera uses the Camera Controls library.
|
|
2374
|
-
*/
|
|
2375
|
-
export interface CameraControllable {
|
|
2257
|
+
get scene(): T;
|
|
2376
2258
|
/**
|
|
2377
|
-
*
|
|
2378
|
-
*
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
2383
|
-
import { Components } from "../../Components";
|
|
2384
|
-
/**
|
|
2385
|
-
* Base class of the library. Useful for finding out the interfaces something implements.
|
|
2386
|
-
*/
|
|
2387
|
-
export declare abstract class Base {
|
|
2388
|
-
components: Components;
|
|
2389
|
-
constructor(components: Components);
|
|
2390
|
-
/** Whether is component is {@link Disposable}. */
|
|
2391
|
-
isDisposeable: () => this is Disposable;
|
|
2392
|
-
/** Whether is component is {@link Resizeable}. */
|
|
2393
|
-
isResizeable: () => this is Resizeable;
|
|
2394
|
-
/** Whether is component is {@link Updateable}. */
|
|
2395
|
-
isUpdateable: () => this is Updateable;
|
|
2396
|
-
/** Whether is component is {@link Hideable}. */
|
|
2397
|
-
isHideable: () => this is Hideable;
|
|
2398
|
-
/** Whether is component is {@link Configurable}. */
|
|
2399
|
-
isConfigurable: () => this is Configurable<any>;
|
|
2400
|
-
}
|
|
2401
|
-
import * as THREE from "three";
|
|
2402
|
-
import CameraControls from "camera-controls";
|
|
2403
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
2404
|
-
import { CameraControllable } from "./interfaces";
|
|
2405
|
-
/**
|
|
2406
|
-
* Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
|
|
2407
|
-
*/
|
|
2408
|
-
export declare abstract class BaseCamera extends BaseWorldItem {
|
|
2259
|
+
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
2260
|
+
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
2261
|
+
* @param scene - The new scene to be set.
|
|
2262
|
+
*/
|
|
2263
|
+
set scene(scene: T);
|
|
2409
2264
|
/**
|
|
2410
|
-
*
|
|
2265
|
+
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
2266
|
+
* @returns The current camera.
|
|
2411
2267
|
*/
|
|
2412
|
-
|
|
2268
|
+
get camera(): U;
|
|
2413
2269
|
/**
|
|
2414
|
-
*
|
|
2270
|
+
* Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
|
|
2271
|
+
* sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
|
|
2272
|
+
* @param camera - The new camera to be set.
|
|
2415
2273
|
*/
|
|
2416
|
-
|
|
2274
|
+
set camera(camera: U);
|
|
2417
2275
|
/**
|
|
2418
|
-
*
|
|
2419
|
-
*
|
|
2276
|
+
* Getter for the renderer.
|
|
2277
|
+
* @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).
|
|
2420
2278
|
*/
|
|
2421
|
-
|
|
2279
|
+
get renderer(): S | null;
|
|
2422
2280
|
/**
|
|
2423
|
-
*
|
|
2424
|
-
*
|
|
2425
|
-
*
|
|
2281
|
+
* Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
|
|
2282
|
+
* sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
|
|
2283
|
+
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
2284
|
+
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
2426
2285
|
*/
|
|
2427
|
-
|
|
2286
|
+
set renderer(renderer: S | null);
|
|
2287
|
+
/** {@link Updateable.update} */
|
|
2288
|
+
update(delta?: number): void;
|
|
2289
|
+
/** {@link Disposable.dispose} */
|
|
2290
|
+
dispose(disposeResources?: boolean): void;
|
|
2428
2291
|
}
|
|
2429
|
-
import
|
|
2292
|
+
import * as THREE from "three";
|
|
2293
|
+
import { BaseScene, Configurable, Event } from "../../Types";
|
|
2294
|
+
import { Components } from "../../Components";
|
|
2430
2295
|
/**
|
|
2431
|
-
*
|
|
2296
|
+
* Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
|
|
2432
2297
|
*/
|
|
2433
|
-
export
|
|
2298
|
+
export interface SimpleSceneConfig {
|
|
2299
|
+
directionalLight: {
|
|
2300
|
+
color: THREE.Color;
|
|
2301
|
+
intensity: number;
|
|
2302
|
+
position: THREE.Vector3;
|
|
2303
|
+
};
|
|
2304
|
+
ambientLight: {
|
|
2305
|
+
color: THREE.Color;
|
|
2306
|
+
intensity: number;
|
|
2307
|
+
};
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* 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.
|
|
2311
|
+
*/
|
|
2312
|
+
export declare class SimpleScene extends BaseScene implements Configurable<{}> {
|
|
2313
|
+
/** {@link Configurable.isSetup} */
|
|
2314
|
+
isSetup: boolean;
|
|
2434
2315
|
/**
|
|
2435
|
-
*
|
|
2436
|
-
*
|
|
2437
|
-
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
2438
|
-
* will not be updated automatically each frame.
|
|
2316
|
+
* The underlying Three.js scene object.
|
|
2317
|
+
* It is used to define the 3D space containing objects, lights, and cameras.
|
|
2439
2318
|
*/
|
|
2440
|
-
|
|
2319
|
+
three: THREE.Scene;
|
|
2320
|
+
/** {@link Configurable.onSetup} */
|
|
2321
|
+
readonly onSetup: Event<SimpleScene>;
|
|
2322
|
+
/**
|
|
2323
|
+
* Configuration interface for the {@link SimpleScene}.
|
|
2324
|
+
* Defines properties for directional and ambient lights.
|
|
2325
|
+
*/
|
|
2326
|
+
config: Required<SimpleSceneConfig>;
|
|
2327
|
+
constructor(components: Components);
|
|
2328
|
+
/** {@link Configurable.setup} */
|
|
2329
|
+
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
2441
2330
|
}
|
|
2442
2331
|
import * as THREE from "three";
|
|
2443
|
-
import {
|
|
2444
|
-
import {
|
|
2445
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
2446
|
-
import { Disposable, Resizeable, Updateable } from "./interfaces";
|
|
2332
|
+
import { BaseRenderer, Event } from "../../Types";
|
|
2333
|
+
import { Components } from "../../Components";
|
|
2447
2334
|
/**
|
|
2448
|
-
*
|
|
2335
|
+
* A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
|
|
2449
2336
|
*/
|
|
2450
|
-
export declare
|
|
2337
|
+
export declare class SimpleRenderer extends BaseRenderer {
|
|
2451
2338
|
/**
|
|
2452
|
-
*
|
|
2453
|
-
*
|
|
2454
|
-
* @abstract
|
|
2455
|
-
* @type {THREE.WebGLRenderer}
|
|
2339
|
+
* Indicates whether the renderer is enabled. If it's not, it won't be updated.
|
|
2340
|
+
* Default is 'true'.
|
|
2456
2341
|
*/
|
|
2457
|
-
|
|
2458
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
2459
|
-
onAfterUpdate: Event<unknown>;
|
|
2460
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
2461
|
-
onBeforeUpdate: Event<unknown>;
|
|
2462
|
-
/** {@link Disposable.onDisposed} */
|
|
2463
|
-
readonly onDisposed: Event<undefined>;
|
|
2464
|
-
/** {@link Resizeable.onResize} */
|
|
2465
|
-
readonly onResize: Event<THREE.Vector2>;
|
|
2342
|
+
enabled: boolean;
|
|
2466
2343
|
/**
|
|
2467
|
-
*
|
|
2468
|
-
* planes used by the active renderer.
|
|
2344
|
+
* The HTML container of the THREE.js canvas where the scene is rendered.
|
|
2469
2345
|
*/
|
|
2470
|
-
|
|
2471
|
-
/** {@link Updateable.update} */
|
|
2472
|
-
abstract update(delta?: number): void | Promise<void>;
|
|
2473
|
-
/** {@link Disposable.dispose} */
|
|
2474
|
-
abstract dispose(): void;
|
|
2475
|
-
/** {@link Resizeable.getSize} */
|
|
2476
|
-
abstract getSize(): Vector2;
|
|
2477
|
-
/** {@link Resizeable.resize} */
|
|
2478
|
-
abstract resize(size: Vector2 | undefined): void;
|
|
2346
|
+
container: HTMLElement;
|
|
2479
2347
|
/**
|
|
2480
|
-
* The
|
|
2348
|
+
* The THREE.js WebGLRenderer instance.
|
|
2481
2349
|
*/
|
|
2482
|
-
|
|
2350
|
+
three: THREE.WebGLRenderer;
|
|
2351
|
+
protected _canvas: HTMLCanvasElement;
|
|
2352
|
+
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
2353
|
+
protected _resizeObserver: ResizeObserver | null;
|
|
2354
|
+
protected onContainerUpdated: Event<unknown>;
|
|
2355
|
+
private _resizing;
|
|
2483
2356
|
/**
|
|
2484
|
-
*
|
|
2357
|
+
* Constructor for the SimpleRenderer class.
|
|
2485
2358
|
*
|
|
2486
|
-
* @
|
|
2487
|
-
*
|
|
2488
|
-
*
|
|
2359
|
+
* @param components - The components instance.
|
|
2360
|
+
* @param container - The HTML container where the THREE.js canvas will be rendered.
|
|
2361
|
+
* @param parameters - Optional parameters for the THREE.js WebGLRenderer.
|
|
2489
2362
|
*/
|
|
2490
|
-
|
|
2363
|
+
constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
|
|
2364
|
+
/** {@link Updateable.update} */
|
|
2365
|
+
update(): void;
|
|
2366
|
+
/** {@link Disposable.dispose} */
|
|
2367
|
+
dispose(): void;
|
|
2368
|
+
/** {@link Resizeable.getSize}. */
|
|
2369
|
+
getSize(): THREE.Vector2;
|
|
2370
|
+
/** {@link Resizeable.resize} */
|
|
2371
|
+
resize: (size?: THREE.Vector2) => void;
|
|
2491
2372
|
/**
|
|
2492
|
-
* Sets
|
|
2373
|
+
* Sets up and manages the event listeners for the renderer.
|
|
2493
2374
|
*
|
|
2494
|
-
* @param active - A boolean indicating whether
|
|
2495
|
-
* @param plane - The clipping plane to be added or removed.
|
|
2496
|
-
* @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
|
|
2375
|
+
* @param active - A boolean indicating whether to activate or deactivate the event listeners.
|
|
2497
2376
|
*
|
|
2498
|
-
* @
|
|
2499
|
-
* This method adds or removes a clipping plane from the 'clippingPlanes' array.
|
|
2500
|
-
* If 'active' is 'true' and the plane is not already in the array, it is added.
|
|
2501
|
-
* If 'active' is 'false' and the plane is in the array, it is removed.
|
|
2502
|
-
* The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
|
|
2503
|
-
* excluding any planes marked as local.
|
|
2377
|
+
* @throws Will throw an error if the renderer does not have an HTML container.
|
|
2504
2378
|
*/
|
|
2505
|
-
|
|
2379
|
+
setupEvents(active: boolean): void;
|
|
2380
|
+
private resizeEvent;
|
|
2381
|
+
private setupRenderer;
|
|
2382
|
+
private onContextLost;
|
|
2383
|
+
private onContextBack;
|
|
2506
2384
|
}
|
|
2507
2385
|
import * as THREE from "three";
|
|
2508
|
-
import
|
|
2509
|
-
import { Event } from "
|
|
2510
|
-
import { Components } from "../../Components";
|
|
2511
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
2512
|
-
/**
|
|
2513
|
-
* Abstract class representing a base scene in the application. All scenes should use this class as a base.
|
|
2514
|
-
*/
|
|
2515
|
-
export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
|
|
2516
|
-
/** {@link Disposable.onDisposed} */
|
|
2517
|
-
readonly onDisposed: Event<unknown>;
|
|
2518
|
-
/**
|
|
2519
|
-
* Abstract property representing the three.js object associated with this scene.
|
|
2520
|
-
* It should be implemented by subclasses.
|
|
2521
|
-
*/
|
|
2522
|
-
abstract three: THREE.Object3D;
|
|
2523
|
-
protected constructor(components: Components);
|
|
2524
|
-
/** {@link Disposable.dispose} */
|
|
2525
|
-
dispose(): void;
|
|
2526
|
-
}
|
|
2527
|
-
import { Base } from "./base";
|
|
2528
|
-
import { World } from "./world";
|
|
2529
|
-
import { Event } from "./event";
|
|
2386
|
+
import CameraControls from "camera-controls";
|
|
2387
|
+
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
2530
2388
|
import { Components } from "../../Components";
|
|
2531
2389
|
/**
|
|
2532
|
-
*
|
|
2533
|
-
*/
|
|
2534
|
-
export declare abstract class BaseWorldItem extends Base {
|
|
2535
|
-
readonly worlds: Map<string, World>;
|
|
2536
|
-
/**
|
|
2537
|
-
* Event that is triggered when a world is added or removed from the 'worlds' map.
|
|
2538
|
-
* The event payload contains the world instance and the action ("added" or "removed").
|
|
2539
|
-
*/
|
|
2540
|
-
readonly onWorldChanged: Event<{
|
|
2541
|
-
world: World;
|
|
2542
|
-
action: "added" | "removed";
|
|
2543
|
-
}>;
|
|
2544
|
-
/**
|
|
2545
|
-
* The current world this item is associated with. It can be null if no world is currently active.
|
|
2546
|
-
*/
|
|
2547
|
-
currentWorld: World | null;
|
|
2548
|
-
protected constructor(components: Components);
|
|
2549
|
-
}
|
|
2550
|
-
import * as THREE from "three";
|
|
2551
|
-
import { BaseScene } from "./base-scene";
|
|
2552
|
-
import { BaseCamera } from "./base-camera";
|
|
2553
|
-
import { BaseRenderer } from "./base-renderer";
|
|
2554
|
-
import { Updateable, Disposable } from "./interfaces";
|
|
2555
|
-
/**
|
|
2556
|
-
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
2390
|
+
* 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.
|
|
2557
2391
|
*/
|
|
2558
|
-
export
|
|
2392
|
+
export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
|
|
2393
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2394
|
+
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
2395
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2396
|
+
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
2559
2397
|
/**
|
|
2560
|
-
*
|
|
2398
|
+
* Event that is triggered when the aspect of the camera has been updated.
|
|
2399
|
+
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
2561
2400
|
*/
|
|
2562
|
-
|
|
2401
|
+
readonly onAspectUpdated: Event<unknown>;
|
|
2402
|
+
/** {@link Disposable.onDisposed} */
|
|
2403
|
+
readonly onDisposed: Event<string>;
|
|
2563
2404
|
/**
|
|
2564
|
-
*
|
|
2405
|
+
* A three.js PerspectiveCamera or OrthographicCamera instance.
|
|
2406
|
+
* This camera is used for rendering the scene.
|
|
2565
2407
|
*/
|
|
2566
|
-
|
|
2408
|
+
three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
2409
|
+
private _allControls;
|
|
2567
2410
|
/**
|
|
2568
|
-
* The
|
|
2411
|
+
* The object that controls the camera. An instance of
|
|
2412
|
+
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
2413
|
+
* Transforming the camera directly will have no effect: you need to use this
|
|
2414
|
+
* object to move, rotate, look at objects, etc.
|
|
2569
2415
|
*/
|
|
2570
|
-
|
|
2416
|
+
get controls(): CameraControls;
|
|
2571
2417
|
/**
|
|
2572
|
-
*
|
|
2418
|
+
* Getter for the enabled state of the camera controls.
|
|
2419
|
+
* If the current world is null, it returns false.
|
|
2420
|
+
* Otherwise, it returns the enabled state of the camera controls.
|
|
2421
|
+
*
|
|
2422
|
+
* @returns {boolean} The enabled state of the camera controls.
|
|
2573
2423
|
*/
|
|
2574
|
-
|
|
2424
|
+
get enabled(): boolean;
|
|
2575
2425
|
/**
|
|
2576
|
-
*
|
|
2426
|
+
* Setter for the enabled state of the camera controls.
|
|
2427
|
+
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
2428
|
+
*
|
|
2429
|
+
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
2577
2430
|
*/
|
|
2578
|
-
|
|
2431
|
+
set enabled(enabled: boolean);
|
|
2432
|
+
constructor(components: Components);
|
|
2433
|
+
/** {@link Disposable.dispose} */
|
|
2434
|
+
dispose(): void;
|
|
2435
|
+
/** {@link Updateable.update} */
|
|
2436
|
+
update(_delta: number): void;
|
|
2579
2437
|
/**
|
|
2580
|
-
*
|
|
2438
|
+
* Updates the aspect of the camera to match the size of the
|
|
2439
|
+
* {@link Components.renderer}.
|
|
2581
2440
|
*/
|
|
2582
|
-
|
|
2441
|
+
updateAspect: () => void;
|
|
2442
|
+
private setupCamera;
|
|
2443
|
+
private newCameraControls;
|
|
2444
|
+
private setupEvents;
|
|
2445
|
+
private static getSubsetOfThree;
|
|
2583
2446
|
}
|
|
2584
2447
|
import * as THREE from "three";
|
|
2585
|
-
import
|
|
2586
|
-
import {
|
|
2448
|
+
import CameraControls from "camera-controls";
|
|
2449
|
+
import { Event } from "./event";
|
|
2587
2450
|
/**
|
|
2588
|
-
*
|
|
2451
|
+
* 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.
|
|
2589
2452
|
*/
|
|
2590
|
-
export interface
|
|
2591
|
-
/**
|
|
2592
|
-
* The color of the grid lines.
|
|
2593
|
-
*/
|
|
2594
|
-
color: THREE.Color;
|
|
2595
|
-
/**
|
|
2596
|
-
* The size of the primary grid lines.
|
|
2597
|
-
*/
|
|
2598
|
-
size1: number;
|
|
2453
|
+
export interface Disposable {
|
|
2599
2454
|
/**
|
|
2600
|
-
*
|
|
2455
|
+
* Destroys the object from memory to prevent a
|
|
2456
|
+
* [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
2601
2457
|
*/
|
|
2602
|
-
|
|
2458
|
+
dispose: () => void | Promise<void>;
|
|
2459
|
+
/** Fired after the tool has been disposed. */
|
|
2460
|
+
readonly onDisposed: Event<any>;
|
|
2461
|
+
}
|
|
2462
|
+
/**
|
|
2463
|
+
* 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).
|
|
2464
|
+
*/
|
|
2465
|
+
export interface Hideable {
|
|
2603
2466
|
/**
|
|
2604
|
-
*
|
|
2467
|
+
* Whether the geometric representation of this component is
|
|
2468
|
+
* currently visible or not in the
|
|
2469
|
+
* [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
2605
2470
|
*/
|
|
2606
|
-
|
|
2471
|
+
visible: boolean;
|
|
2607
2472
|
}
|
|
2608
2473
|
/**
|
|
2609
|
-
*
|
|
2474
|
+
* 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.
|
|
2610
2475
|
*/
|
|
2611
|
-
export
|
|
2612
|
-
/** {@link Disposable.onDisposed} */
|
|
2613
|
-
readonly onDisposed: Event<unknown>;
|
|
2614
|
-
/** The world instance to which this Raycaster belongs. */
|
|
2615
|
-
world: World;
|
|
2616
|
-
/** The components instance to which this grid belongs. */
|
|
2617
|
-
components: Components;
|
|
2618
|
-
/** {@link Hideable.visible} */
|
|
2619
|
-
get visible(): boolean;
|
|
2620
|
-
/** {@link Hideable.visible} */
|
|
2621
|
-
set visible(visible: boolean);
|
|
2622
|
-
/** The material of the grid. */
|
|
2623
|
-
get material(): THREE.ShaderMaterial;
|
|
2476
|
+
export interface Resizeable {
|
|
2624
2477
|
/**
|
|
2625
|
-
*
|
|
2626
|
-
*
|
|
2478
|
+
* Sets size of this component (e.g. the resolution of a
|
|
2479
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2480
|
+
* component.
|
|
2627
2481
|
*/
|
|
2628
|
-
|
|
2482
|
+
resize: (size?: THREE.Vector2) => void;
|
|
2483
|
+
/** Event that fires when the component has been resized. */
|
|
2484
|
+
onResize: Event<THREE.Vector2>;
|
|
2629
2485
|
/**
|
|
2630
|
-
*
|
|
2631
|
-
*
|
|
2486
|
+
* Gets the current size of this component (e.g. the resolution of a
|
|
2487
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
2488
|
+
* component.
|
|
2632
2489
|
*/
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2490
|
+
getSize: () => THREE.Vector2;
|
|
2491
|
+
}
|
|
2492
|
+
/** Whether this component should be updated each frame. */
|
|
2493
|
+
export interface Updateable {
|
|
2494
|
+
/** Actions that should be executed after updating the component. */
|
|
2495
|
+
onAfterUpdate: Event<any>;
|
|
2496
|
+
/** Actions that should be executed before updating the component. */
|
|
2497
|
+
onBeforeUpdate: Event<any>;
|
|
2498
|
+
/**
|
|
2499
|
+
* Function used to update the state of this component each frame. For
|
|
2500
|
+
* instance, a renderer component will make a render each frame.
|
|
2501
|
+
*/
|
|
2502
|
+
update(delta?: number): void;
|
|
2503
|
+
}
|
|
2504
|
+
/** Basic type to describe the progress of any kind of process. */
|
|
2505
|
+
export interface Progress {
|
|
2506
|
+
/** The amount of things that have been done already. */
|
|
2507
|
+
current: number;
|
|
2508
|
+
/** The total amount of things to be done by the process. */
|
|
2509
|
+
total: number;
|
|
2642
2510
|
}
|
|
2643
|
-
import * as THREE from "three";
|
|
2644
|
-
import { Components } from "../../Components";
|
|
2645
|
-
import { AsyncEvent, Event, World } from "../../Types";
|
|
2646
2511
|
/**
|
|
2647
|
-
*
|
|
2512
|
+
* Whether this component supports create and destroy operations. This generally applies for components that work with instances, such as clipping planes or dimensions.
|
|
2648
2513
|
*/
|
|
2649
|
-
export interface
|
|
2514
|
+
export interface Createable {
|
|
2515
|
+
/** Creates a new instance of an element (e.g. a new Dimension). */
|
|
2516
|
+
create: (data: any) => void;
|
|
2650
2517
|
/**
|
|
2651
|
-
*
|
|
2652
|
-
*
|
|
2518
|
+
* Finish the creation process of the component, successfully creating an
|
|
2519
|
+
* instance of whatever the component creates.
|
|
2653
2520
|
*/
|
|
2654
|
-
|
|
2521
|
+
endCreation?: (data: any) => void;
|
|
2655
2522
|
/**
|
|
2656
|
-
*
|
|
2657
|
-
*
|
|
2523
|
+
* Cancels the creation process of the component, going back to the state
|
|
2524
|
+
* before starting to create.
|
|
2658
2525
|
*/
|
|
2659
|
-
|
|
2660
|
-
/**
|
|
2661
|
-
|
|
2662
|
-
|
|
2526
|
+
cancelCreation?: (data: any) => void;
|
|
2527
|
+
/** Deletes an existing instance of an element (e.g. a Dimension). */
|
|
2528
|
+
delete: (data: any) => void;
|
|
2529
|
+
}
|
|
2530
|
+
/**
|
|
2531
|
+
* Whether this component supports to be configured.
|
|
2532
|
+
*/
|
|
2533
|
+
export interface Configurable<T extends Record<string, any>> {
|
|
2534
|
+
/** Wether this components has been already configured. */
|
|
2535
|
+
isSetup: boolean;
|
|
2536
|
+
/** Use the provided configuration to setup the tool. */
|
|
2537
|
+
setup: (config?: Partial<T>) => void | Promise<void>;
|
|
2538
|
+
/** Fired after successfully calling {@link Configurable.setup()} */
|
|
2539
|
+
readonly onSetup: Event<any>;
|
|
2540
|
+
/** Object holding the tool configuration. Is not meant to be edited directly, if you need
|
|
2541
|
+
* to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
|
|
2663
2542
|
*/
|
|
2664
|
-
|
|
2543
|
+
config: Required<T>;
|
|
2544
|
+
}
|
|
2545
|
+
/**
|
|
2546
|
+
* Whether a camera uses the Camera Controls library.
|
|
2547
|
+
*/
|
|
2548
|
+
export interface CameraControllable {
|
|
2665
2549
|
/**
|
|
2666
|
-
*
|
|
2667
|
-
*
|
|
2550
|
+
* An instance of CameraControls that provides camera control functionalities.
|
|
2551
|
+
* This instance is used to manipulate the camera.
|
|
2668
2552
|
*/
|
|
2669
|
-
|
|
2553
|
+
controls: CameraControls;
|
|
2670
2554
|
}
|
|
2671
2555
|
/**
|
|
2672
|
-
*
|
|
2556
|
+
* 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.
|
|
2673
2557
|
*/
|
|
2674
|
-
export declare class
|
|
2675
|
-
/** {@link Disposable.onDisposed} */
|
|
2676
|
-
readonly onDisposed: Event<string>;
|
|
2558
|
+
export declare class Event<T> {
|
|
2677
2559
|
/**
|
|
2678
|
-
*
|
|
2679
|
-
*
|
|
2680
|
-
* just before but not anymore.
|
|
2560
|
+
* Add a callback to this event instance.
|
|
2561
|
+
* @param handler - the callback to be added to this event.
|
|
2681
2562
|
*/
|
|
2682
|
-
|
|
2563
|
+
add(handler: T extends void ? {
|
|
2564
|
+
(): void;
|
|
2565
|
+
} : {
|
|
2566
|
+
(data: T): void;
|
|
2567
|
+
}): void;
|
|
2683
2568
|
/**
|
|
2684
|
-
*
|
|
2569
|
+
* Removes a callback from this event instance.
|
|
2570
|
+
* @param handler - the callback to be removed from this event.
|
|
2685
2571
|
*/
|
|
2686
|
-
|
|
2572
|
+
remove(handler: T extends void ? {
|
|
2573
|
+
(): void;
|
|
2574
|
+
} : {
|
|
2575
|
+
(data: T): void;
|
|
2576
|
+
}): void;
|
|
2577
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2578
|
+
trigger: (data?: T) => void;
|
|
2579
|
+
/** Gets rid of all the suscribed events. */
|
|
2580
|
+
reset(): void;
|
|
2581
|
+
private handlers;
|
|
2582
|
+
}
|
|
2583
|
+
import { Base } from "./base";
|
|
2584
|
+
/**
|
|
2585
|
+
* 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.
|
|
2586
|
+
*/
|
|
2587
|
+
export declare abstract class Component extends Base {
|
|
2687
2588
|
/**
|
|
2688
|
-
*
|
|
2689
|
-
*
|
|
2589
|
+
* Whether this component is active or not. The behaviour can vary depending
|
|
2590
|
+
* on the type of component. E.g. a disabled dimension tool will stop creating
|
|
2591
|
+
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
2592
|
+
* will not be updated automatically each frame.
|
|
2690
2593
|
*/
|
|
2691
|
-
|
|
2594
|
+
abstract enabled: boolean;
|
|
2595
|
+
}
|
|
2596
|
+
import { InverseAttribute } from "./types";
|
|
2597
|
+
export declare const relToAttributesMap: Map<number, {
|
|
2598
|
+
forRelating: InverseAttribute;
|
|
2599
|
+
forRelated: InverseAttribute;
|
|
2600
|
+
}>;
|
|
2601
|
+
/**
|
|
2602
|
+
* 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.
|
|
2603
|
+
*/
|
|
2604
|
+
export declare class AsyncEvent<T> {
|
|
2692
2605
|
/**
|
|
2693
|
-
*
|
|
2694
|
-
*
|
|
2606
|
+
* Add a callback to this event instance.
|
|
2607
|
+
* @param handler - the callback to be added to this event.
|
|
2695
2608
|
*/
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
/** The THREE.js renderer used to make the visibility test. */
|
|
2702
|
-
readonly renderer: THREE.WebGLRenderer;
|
|
2703
|
-
protected autoUpdate: boolean;
|
|
2704
|
-
protected updateInterval: number;
|
|
2705
|
-
protected readonly worker: Worker;
|
|
2706
|
-
protected readonly scene: THREE.Scene;
|
|
2707
|
-
private _width;
|
|
2708
|
-
private _height;
|
|
2709
|
-
private _availableColor;
|
|
2710
|
-
private readonly renderTarget;
|
|
2711
|
-
private readonly bufferSize;
|
|
2712
|
-
private readonly _buffer;
|
|
2713
|
-
protected _isWorkerBusy: boolean;
|
|
2714
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2715
|
-
/** {@link Disposable.dispose} */
|
|
2716
|
-
dispose(): void;
|
|
2609
|
+
add(handler: T extends void ? {
|
|
2610
|
+
(): Promise<void>;
|
|
2611
|
+
} : {
|
|
2612
|
+
(data: T): Promise<void>;
|
|
2613
|
+
}): void;
|
|
2717
2614
|
/**
|
|
2718
|
-
*
|
|
2719
|
-
*
|
|
2720
|
-
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
2721
|
-
* not true.
|
|
2615
|
+
* Removes a callback from this event instance.
|
|
2616
|
+
* @param handler - the callback to be removed from this event.
|
|
2722
2617
|
*/
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
private
|
|
2618
|
+
remove(handler: T extends void ? {
|
|
2619
|
+
(): Promise<void>;
|
|
2620
|
+
} : {
|
|
2621
|
+
(data: T): Promise<void>;
|
|
2622
|
+
}): void;
|
|
2623
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2624
|
+
trigger: (data?: T) => Promise<void>;
|
|
2625
|
+
/** Gets rid of all the suscribed events. */
|
|
2626
|
+
reset(): void;
|
|
2627
|
+
private handlers;
|
|
2733
2628
|
}
|
|
2734
|
-
|
|
2735
|
-
import {
|
|
2629
|
+
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
2630
|
+
import { Components } from "../../Components";
|
|
2736
2631
|
/**
|
|
2737
|
-
*
|
|
2632
|
+
* Base class of the library. Useful for finding out the interfaces something implements.
|
|
2738
2633
|
*/
|
|
2739
|
-
export declare class
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2634
|
+
export declare abstract class Base {
|
|
2635
|
+
components: Components;
|
|
2636
|
+
constructor(components: Components);
|
|
2637
|
+
/** Whether is component is {@link Disposable}. */
|
|
2638
|
+
isDisposeable: () => this is Disposable;
|
|
2639
|
+
/** Whether is component is {@link Resizeable}. */
|
|
2640
|
+
isResizeable: () => this is Resizeable;
|
|
2641
|
+
/** Whether is component is {@link Updateable}. */
|
|
2642
|
+
isUpdateable: () => this is Updateable;
|
|
2643
|
+
/** Whether is component is {@link Hideable}. */
|
|
2644
|
+
isHideable: () => this is Hideable;
|
|
2645
|
+
/** Whether is component is {@link Configurable}. */
|
|
2646
|
+
isConfigurable: () => this is Configurable<any>;
|
|
2745
2647
|
}
|
|
2746
|
-
import
|
|
2747
|
-
import {
|
|
2648
|
+
import { Base } from "./base";
|
|
2649
|
+
import { World } from "./world";
|
|
2650
|
+
import { Event } from "./event";
|
|
2748
2651
|
import { Components } from "../../Components";
|
|
2749
|
-
import { Event, World, Disposable } from "../../Types";
|
|
2750
2652
|
/**
|
|
2751
|
-
*
|
|
2653
|
+
* One of the elements that make a world. It can be either a scene, a camera or a renderer.
|
|
2752
2654
|
*/
|
|
2753
|
-
export declare class
|
|
2655
|
+
export declare abstract class BaseWorldItem extends Base {
|
|
2656
|
+
readonly worlds: Map<string, World>;
|
|
2754
2657
|
/**
|
|
2755
|
-
* Event triggered when
|
|
2756
|
-
*
|
|
2658
|
+
* Event that is triggered when a world is added or removed from the 'worlds' map.
|
|
2659
|
+
* The event payload contains the world instance and the action ("added" or "removed").
|
|
2757
2660
|
*/
|
|
2758
|
-
readonly
|
|
2759
|
-
|
|
2760
|
-
|
|
2661
|
+
readonly onWorldChanged: Event<{
|
|
2662
|
+
world: World;
|
|
2663
|
+
action: "added" | "removed";
|
|
2761
2664
|
}>;
|
|
2762
2665
|
/**
|
|
2763
|
-
*
|
|
2764
|
-
* Default value is 100.
|
|
2666
|
+
* The current world this item is associated with. It can be null if no world is currently active.
|
|
2765
2667
|
*/
|
|
2766
|
-
|
|
2668
|
+
currentWorld: World | null;
|
|
2669
|
+
protected constructor(components: Components);
|
|
2670
|
+
}
|
|
2671
|
+
import * as THREE from "three";
|
|
2672
|
+
import CameraControls from "camera-controls";
|
|
2673
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2674
|
+
import { CameraControllable } from "./interfaces";
|
|
2675
|
+
/**
|
|
2676
|
+
* Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
|
|
2677
|
+
*/
|
|
2678
|
+
export declare abstract class BaseCamera extends BaseWorldItem {
|
|
2767
2679
|
/**
|
|
2768
|
-
*
|
|
2769
|
-
* Used to keep track of color-coded meshes.
|
|
2680
|
+
* Whether the camera is enabled or not.
|
|
2770
2681
|
*/
|
|
2771
|
-
|
|
2682
|
+
abstract enabled: boolean;
|
|
2772
2683
|
/**
|
|
2773
|
-
*
|
|
2774
|
-
* Used to prevent concurrent processing.
|
|
2684
|
+
* The Three.js camera instance.
|
|
2775
2685
|
*/
|
|
2776
|
-
|
|
2777
|
-
private _colorCodeMeshMap;
|
|
2778
|
-
private _meshIDColorCodeMap;
|
|
2779
|
-
private _currentVisibleMeshes;
|
|
2780
|
-
private _recentlyHiddenMeshes;
|
|
2781
|
-
private _intervalID;
|
|
2782
|
-
private readonly _transparentMat;
|
|
2783
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2784
|
-
/** {@link Disposable.dispose} */
|
|
2785
|
-
dispose(): void;
|
|
2686
|
+
abstract three: THREE.Camera;
|
|
2786
2687
|
/**
|
|
2787
|
-
*
|
|
2788
|
-
*
|
|
2789
|
-
* @returns {void}
|
|
2688
|
+
* Optional CameraControls instance for controlling the camera.
|
|
2689
|
+
* This property is only available if the camera is controllable.
|
|
2790
2690
|
*/
|
|
2791
|
-
|
|
2691
|
+
abstract controls?: CameraControls;
|
|
2792
2692
|
/**
|
|
2793
|
-
*
|
|
2794
|
-
*
|
|
2795
|
-
* @
|
|
2796
|
-
* @returns {void}
|
|
2693
|
+
* Checks whether the instance is {@link CameraControllable}.
|
|
2694
|
+
*
|
|
2695
|
+
* @returns True if the instance is controllable, false otherwise.
|
|
2797
2696
|
*/
|
|
2798
|
-
|
|
2799
|
-
private handleWorkerMessage;
|
|
2800
|
-
private getAvailableMaterial;
|
|
2697
|
+
hasCameraControls: () => this is CameraControllable;
|
|
2801
2698
|
}
|
|
2802
2699
|
import * as THREE from "three";
|
|
2803
|
-
import {
|
|
2804
|
-
import {
|
|
2700
|
+
import { Vector2 } from "three";
|
|
2701
|
+
import { Event } from "./event";
|
|
2702
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2703
|
+
import { Disposable, Resizeable, Updateable } from "./interfaces";
|
|
2805
2704
|
/**
|
|
2806
|
-
*
|
|
2705
|
+
* Abstract class representing a renderer for a 3D world. All renderers should use this class as a base.
|
|
2807
2706
|
*/
|
|
2808
|
-
export declare class
|
|
2809
|
-
/** Event that fires when the user starts dragging a clipping plane. */
|
|
2810
|
-
readonly onDraggingStarted: Event<unknown>;
|
|
2811
|
-
/** Event that fires when the user stops dragging a clipping plane. */
|
|
2812
|
-
readonly onDraggingEnded: Event<unknown>;
|
|
2813
|
-
/** {@link Disposable.onDisposed} */
|
|
2814
|
-
readonly onDisposed: Event<unknown>;
|
|
2815
|
-
/**
|
|
2816
|
-
* The normal vector of the clipping plane.
|
|
2817
|
-
*/
|
|
2818
|
-
readonly normal: THREE.Vector3;
|
|
2819
|
-
/**
|
|
2820
|
-
* The origin point of the clipping plane.
|
|
2821
|
-
*/
|
|
2822
|
-
readonly origin: THREE.Vector3;
|
|
2707
|
+
export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
|
|
2823
2708
|
/**
|
|
2824
|
-
* The
|
|
2709
|
+
* The three.js WebGLRenderer instance associated with this renderer.
|
|
2710
|
+
*
|
|
2711
|
+
* @abstract
|
|
2712
|
+
* @type {THREE.WebGLRenderer}
|
|
2825
2713
|
*/
|
|
2826
|
-
|
|
2827
|
-
/**
|
|
2828
|
-
|
|
2829
|
-
/**
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
private readonly _arrowBoundBox;
|
|
2836
|
-
private readonly _planeMesh;
|
|
2837
|
-
private readonly _controls;
|
|
2838
|
-
private readonly _hiddenMaterial;
|
|
2714
|
+
abstract three: THREE.WebGLRenderer;
|
|
2715
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2716
|
+
onAfterUpdate: Event<unknown>;
|
|
2717
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2718
|
+
onBeforeUpdate: Event<unknown>;
|
|
2719
|
+
/** {@link Disposable.onDisposed} */
|
|
2720
|
+
readonly onDisposed: Event<undefined>;
|
|
2721
|
+
/** {@link Resizeable.onResize} */
|
|
2722
|
+
readonly onResize: Event<THREE.Vector2>;
|
|
2839
2723
|
/**
|
|
2840
|
-
*
|
|
2841
|
-
*
|
|
2724
|
+
* Event that fires when there has been a change to the list of clipping
|
|
2725
|
+
* planes used by the active renderer.
|
|
2842
2726
|
*/
|
|
2843
|
-
|
|
2727
|
+
readonly onClippingPlanesUpdated: Event<unknown>;
|
|
2728
|
+
/** {@link Updateable.update} */
|
|
2729
|
+
abstract update(delta?: number): void | Promise<void>;
|
|
2730
|
+
/** {@link Disposable.dispose} */
|
|
2731
|
+
abstract dispose(): void;
|
|
2732
|
+
/** {@link Resizeable.getSize} */
|
|
2733
|
+
abstract getSize(): Vector2;
|
|
2734
|
+
/** {@link Resizeable.resize} */
|
|
2735
|
+
abstract resize(size: Vector2 | undefined): void;
|
|
2844
2736
|
/**
|
|
2845
|
-
*
|
|
2846
|
-
* Updates the clipping plane state in the renderer and throws an error if no renderer is found.
|
|
2847
|
-
* @param {boolean} state - The new enabled state.
|
|
2737
|
+
* The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this instance of the renderer.
|
|
2848
2738
|
*/
|
|
2849
|
-
|
|
2850
|
-
/** {@link Hideable.visible } */
|
|
2851
|
-
get visible(): boolean;
|
|
2852
|
-
/** {@link Hideable.visible } */
|
|
2853
|
-
set visible(state: boolean);
|
|
2854
|
-
/** The meshes used for raycasting */
|
|
2855
|
-
get meshes(): THREE.Mesh[];
|
|
2856
|
-
/** The material of the clipping plane representation. */
|
|
2857
|
-
get planeMaterial(): THREE.Material | THREE.Material[];
|
|
2858
|
-
/** The material of the clipping plane representation. */
|
|
2859
|
-
set planeMaterial(material: THREE.Material | THREE.Material[]);
|
|
2860
|
-
/** The size of the clipping plane representation. */
|
|
2861
|
-
get size(): number;
|
|
2862
|
-
/** Sets the size of the clipping plane representation. */
|
|
2863
|
-
set size(size: number);
|
|
2739
|
+
clippingPlanes: THREE.Plane[];
|
|
2864
2740
|
/**
|
|
2865
|
-
*
|
|
2866
|
-
* The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
|
|
2867
|
-
* It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
|
|
2741
|
+
* Updates the clipping planes and triggers the 'onClippingPlanesUpdated' event.
|
|
2868
2742
|
*
|
|
2869
|
-
* @
|
|
2743
|
+
* @remarks
|
|
2744
|
+
* This method is typically called when there is a change to the list of clipping planes
|
|
2745
|
+
* used by the active renderer.
|
|
2870
2746
|
*/
|
|
2871
|
-
|
|
2872
|
-
constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
|
|
2747
|
+
updateClippingPlanes(): void;
|
|
2873
2748
|
/**
|
|
2874
|
-
* Sets
|
|
2875
|
-
* This method resets the clipping plane's state, updates the normal and origin,
|
|
2876
|
-
* and positions the helper object accordingly.
|
|
2749
|
+
* Sets or removes a clipping plane from the renderer.
|
|
2877
2750
|
*
|
|
2878
|
-
* @param
|
|
2879
|
-
* @param
|
|
2751
|
+
* @param active - A boolean indicating whether the clipping plane should be active or not.
|
|
2752
|
+
* @param plane - The clipping plane to be added or removed.
|
|
2753
|
+
* @param isLocal - An optional boolean indicating whether the clipping plane is local to the object. If not provided, it defaults to 'false'.
|
|
2880
2754
|
*
|
|
2881
|
-
* @
|
|
2755
|
+
* @remarks
|
|
2756
|
+
* This method adds or removes a clipping plane from the 'clippingPlanes' array.
|
|
2757
|
+
* If 'active' is 'true' and the plane is not already in the array, it is added.
|
|
2758
|
+
* If 'active' is 'false' and the plane is in the array, it is removed.
|
|
2759
|
+
* The 'three.clippingPlanes' property is then updated to reflect the current state of the 'clippingPlanes' array,
|
|
2760
|
+
* excluding any planes marked as local.
|
|
2882
2761
|
*/
|
|
2883
|
-
|
|
2884
|
-
/** {@link Updateable.update} */
|
|
2885
|
-
update: () => void;
|
|
2886
|
-
/** {@link Disposable.dispose} */
|
|
2887
|
-
dispose(): void;
|
|
2888
|
-
private reset;
|
|
2889
|
-
protected toggleControls(state: boolean): void;
|
|
2890
|
-
private newTransformControls;
|
|
2891
|
-
private initializeControls;
|
|
2892
|
-
private createArrowBoundingBox;
|
|
2893
|
-
private changeDrag;
|
|
2894
|
-
private notifyDraggingChanged;
|
|
2895
|
-
private preventCameraMovement;
|
|
2896
|
-
private newHelper;
|
|
2897
|
-
private static newPlaneMesh;
|
|
2762
|
+
setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
|
|
2898
2763
|
}
|
|
2899
2764
|
import * as THREE from "three";
|
|
2900
|
-
import {
|
|
2765
|
+
import { Disposable } from "./interfaces";
|
|
2766
|
+
import { Event } from "./event";
|
|
2767
|
+
import { Components } from "../../Components";
|
|
2768
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2901
2769
|
/**
|
|
2902
|
-
*
|
|
2903
|
-
*
|
|
2904
|
-
* @template T - The type of the scene. Default is BaseScene.
|
|
2905
|
-
* @template U - The type of the camera. Default is BaseCamera.
|
|
2906
|
-
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
2770
|
+
* Abstract class representing a base scene in the application. All scenes should use this class as a base.
|
|
2907
2771
|
*/
|
|
2908
|
-
export declare class
|
|
2909
|
-
/**
|
|
2910
|
-
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
2911
|
-
*/
|
|
2912
|
-
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
2913
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
2914
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
2915
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
2916
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
2772
|
+
export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
|
|
2917
2773
|
/** {@link Disposable.onDisposed} */
|
|
2918
2774
|
readonly onDisposed: Event<unknown>;
|
|
2919
2775
|
/**
|
|
2920
|
-
*
|
|
2776
|
+
* Abstract property representing the three.js object associated with this scene.
|
|
2777
|
+
* It should be implemented by subclasses.
|
|
2921
2778
|
*/
|
|
2922
|
-
|
|
2779
|
+
abstract three: THREE.Object3D;
|
|
2780
|
+
protected constructor(components: Components);
|
|
2781
|
+
/** {@link Disposable.dispose} */
|
|
2782
|
+
dispose(): void;
|
|
2783
|
+
}
|
|
2784
|
+
import * as THREE from "three";
|
|
2785
|
+
import { BaseScene } from "./base-scene";
|
|
2786
|
+
import { BaseCamera } from "./base-camera";
|
|
2787
|
+
import { BaseRenderer } from "./base-renderer";
|
|
2788
|
+
import { Updateable, Disposable } from "./interfaces";
|
|
2789
|
+
/**
|
|
2790
|
+
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
2791
|
+
*/
|
|
2792
|
+
export interface World extends Disposable, Updateable {
|
|
2923
2793
|
/**
|
|
2924
|
-
*
|
|
2925
|
-
* When disabled, the world will not be updated.
|
|
2794
|
+
* A set of meshes present in the world. This is taken into account for operations like raycasting.
|
|
2926
2795
|
*/
|
|
2927
|
-
|
|
2796
|
+
meshes: Set<THREE.Mesh>;
|
|
2928
2797
|
/**
|
|
2929
|
-
*
|
|
2798
|
+
* The base scene of the world.
|
|
2930
2799
|
*/
|
|
2931
|
-
|
|
2800
|
+
scene: BaseScene;
|
|
2932
2801
|
/**
|
|
2933
|
-
*
|
|
2802
|
+
* The base camera of the world.
|
|
2934
2803
|
*/
|
|
2935
|
-
|
|
2936
|
-
private _scene?;
|
|
2937
|
-
private _camera?;
|
|
2938
|
-
private _renderer;
|
|
2804
|
+
camera: BaseCamera;
|
|
2939
2805
|
/**
|
|
2940
|
-
*
|
|
2941
|
-
* @returns The current scene.
|
|
2806
|
+
* The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
|
|
2942
2807
|
*/
|
|
2943
|
-
|
|
2808
|
+
renderer: BaseRenderer | null;
|
|
2944
2809
|
/**
|
|
2945
|
-
*
|
|
2946
|
-
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
2947
|
-
* @param scene - The new scene to be set.
|
|
2810
|
+
* A unique identifier for the world.
|
|
2948
2811
|
*/
|
|
2949
|
-
|
|
2812
|
+
uuid: string;
|
|
2950
2813
|
/**
|
|
2951
|
-
*
|
|
2952
|
-
* @returns The current camera.
|
|
2814
|
+
* Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
|
|
2953
2815
|
*/
|
|
2954
|
-
|
|
2816
|
+
isDisposing: boolean;
|
|
2817
|
+
}
|
|
2818
|
+
import * as THREE from "three";
|
|
2819
|
+
import { Components } from "../../Components";
|
|
2820
|
+
import { Event, World, Disposable } from "../../Types";
|
|
2821
|
+
import { Mouse } from "./mouse";
|
|
2822
|
+
/**
|
|
2823
|
+
* 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.
|
|
2824
|
+
*/
|
|
2825
|
+
export declare class SimpleRaycaster implements Disposable {
|
|
2826
|
+
/** {@link Component.enabled} */
|
|
2827
|
+
enabled: boolean;
|
|
2828
|
+
/** The components instance to which this Raycaster belongs. */
|
|
2829
|
+
components: Components;
|
|
2830
|
+
/** {@link Disposable.onDisposed} */
|
|
2831
|
+
readonly onDisposed: Event<unknown>;
|
|
2832
|
+
/** The position of the mouse in the screen. */
|
|
2833
|
+
readonly mouse: Mouse;
|
|
2955
2834
|
/**
|
|
2956
|
-
*
|
|
2957
|
-
*
|
|
2958
|
-
* @param camera - The new camera to be set.
|
|
2835
|
+
* A reference to the Three.js Raycaster instance.
|
|
2836
|
+
* This is used for raycasting operations.
|
|
2959
2837
|
*/
|
|
2960
|
-
|
|
2838
|
+
readonly three: THREE.Raycaster;
|
|
2961
2839
|
/**
|
|
2962
|
-
*
|
|
2963
|
-
*
|
|
2840
|
+
* A reference to the world instance to which this Raycaster belongs.
|
|
2841
|
+
* This is used to access the camera and meshes.
|
|
2964
2842
|
*/
|
|
2965
|
-
|
|
2843
|
+
world: World;
|
|
2844
|
+
constructor(components: Components, world: World);
|
|
2845
|
+
/** {@link Disposable.dispose} */
|
|
2846
|
+
dispose(): void;
|
|
2966
2847
|
/**
|
|
2967
|
-
*
|
|
2968
|
-
*
|
|
2969
|
-
*
|
|
2970
|
-
*
|
|
2848
|
+
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
2849
|
+
* the first item found. This also takes into account the clipping planes
|
|
2850
|
+
* used by the renderer.
|
|
2851
|
+
*
|
|
2852
|
+
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
2853
|
+
* to query. If not provided, it will query all the meshes stored in
|
|
2854
|
+
* {@link Components.meshes}.
|
|
2971
2855
|
*/
|
|
2972
|
-
|
|
2973
|
-
/**
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2856
|
+
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
2857
|
+
/**
|
|
2858
|
+
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
2859
|
+
* This method also takes into account the clipping planes used by the renderer.
|
|
2860
|
+
*
|
|
2861
|
+
* @param origin - The origin of the ray.
|
|
2862
|
+
* @param direction - The direction of the ray.
|
|
2863
|
+
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
2864
|
+
* @returns The first intersection found or 'null' if no intersection was found.
|
|
2865
|
+
*/
|
|
2866
|
+
castRayFromVector(origin: THREE.Vector3, direction: THREE.Vector3, items?: THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[]): THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>> | null;
|
|
2867
|
+
private intersect;
|
|
2868
|
+
private filterClippingPlanes;
|
|
2977
2869
|
}
|
|
2978
2870
|
import * as THREE from "three";
|
|
2979
|
-
import {
|
|
2871
|
+
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
2980
2872
|
import { Components } from "../../Components";
|
|
2981
2873
|
/**
|
|
2982
|
-
* Configuration interface for the {@link
|
|
2874
|
+
* Configuration interface for the {@link SimpleGrid} class.
|
|
2983
2875
|
*/
|
|
2984
|
-
export interface
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2876
|
+
export interface GridConfig {
|
|
2877
|
+
/**
|
|
2878
|
+
* The color of the grid lines.
|
|
2879
|
+
*/
|
|
2880
|
+
color: THREE.Color;
|
|
2881
|
+
/**
|
|
2882
|
+
* The size of the primary grid lines.
|
|
2883
|
+
*/
|
|
2884
|
+
size1: number;
|
|
2885
|
+
/**
|
|
2886
|
+
* The size of the secondary grid lines.
|
|
2887
|
+
*/
|
|
2888
|
+
size2: number;
|
|
2889
|
+
/**
|
|
2890
|
+
* The distance at which the grid lines start to fade away.
|
|
2891
|
+
*/
|
|
2892
|
+
distance: number;
|
|
2994
2893
|
}
|
|
2995
2894
|
/**
|
|
2996
|
-
*
|
|
2895
|
+
* 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).
|
|
2997
2896
|
*/
|
|
2998
|
-
export declare class
|
|
2999
|
-
/** {@link
|
|
3000
|
-
|
|
2897
|
+
export declare class SimpleGrid implements Hideable, Disposable {
|
|
2898
|
+
/** {@link Disposable.onDisposed} */
|
|
2899
|
+
readonly onDisposed: Event<unknown>;
|
|
2900
|
+
/** The world instance to which this Raycaster belongs. */
|
|
2901
|
+
world: World;
|
|
2902
|
+
/** The components instance to which this grid belongs. */
|
|
2903
|
+
components: Components;
|
|
2904
|
+
/** {@link Hideable.visible} */
|
|
2905
|
+
get visible(): boolean;
|
|
2906
|
+
/** {@link Hideable.visible} */
|
|
2907
|
+
set visible(visible: boolean);
|
|
2908
|
+
/** The material of the grid. */
|
|
2909
|
+
get material(): THREE.ShaderMaterial;
|
|
3001
2910
|
/**
|
|
3002
|
-
*
|
|
3003
|
-
*
|
|
2911
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2912
|
+
* perspective cameras and false for orthographic cameras.
|
|
3004
2913
|
*/
|
|
3005
|
-
|
|
3006
|
-
/** {@link Configurable.onSetup} */
|
|
3007
|
-
readonly onSetup: Event<SimpleScene>;
|
|
2914
|
+
get fade(): boolean;
|
|
3008
2915
|
/**
|
|
3009
|
-
*
|
|
3010
|
-
*
|
|
2916
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2917
|
+
* perspective cameras and false for orthographic cameras.
|
|
3011
2918
|
*/
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
2919
|
+
set fade(active: boolean);
|
|
2920
|
+
/** The Three.js mesh that contains the infinite grid. */
|
|
2921
|
+
readonly three: THREE.Mesh;
|
|
2922
|
+
private _fade;
|
|
2923
|
+
constructor(components: Components, world: World, config: GridConfig);
|
|
2924
|
+
/** {@link Disposable.dispose} */
|
|
2925
|
+
dispose(): void;
|
|
2926
|
+
private setupEvents;
|
|
2927
|
+
private updateZoom;
|
|
3016
2928
|
}
|
|
3017
2929
|
import * as THREE from "three";
|
|
3018
|
-
import {
|
|
2930
|
+
import { Disposable, Event } from "../../Types";
|
|
2931
|
+
/**
|
|
2932
|
+
* A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
|
|
2933
|
+
*/
|
|
2934
|
+
export declare class Mouse implements Disposable {
|
|
2935
|
+
dom: HTMLCanvasElement;
|
|
2936
|
+
private _event?;
|
|
2937
|
+
private _position;
|
|
2938
|
+
/** {@link Disposable.onDisposed} */
|
|
2939
|
+
readonly onDisposed: Event<unknown>;
|
|
2940
|
+
constructor(dom: HTMLCanvasElement);
|
|
2941
|
+
/**
|
|
2942
|
+
* The real position of the mouse of the Three.js canvas.
|
|
2943
|
+
*/
|
|
2944
|
+
get position(): THREE.Vector2;
|
|
2945
|
+
/** {@link Disposable.dispose} */
|
|
2946
|
+
dispose(): void;
|
|
2947
|
+
private getPositionY;
|
|
2948
|
+
private getPositionX;
|
|
2949
|
+
private updateMouseInfo;
|
|
2950
|
+
private setupEvents;
|
|
2951
|
+
}
|
|
2952
|
+
import * as THREE from "three";
|
|
2953
|
+
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
3019
2954
|
import { Components } from "../../Components";
|
|
2955
|
+
import { Event, World, Disposable } from "../../Types";
|
|
3020
2956
|
/**
|
|
3021
|
-
* A
|
|
2957
|
+
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
3022
2958
|
*/
|
|
3023
|
-
export declare class
|
|
2959
|
+
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
3024
2960
|
/**
|
|
3025
|
-
*
|
|
3026
|
-
*
|
|
2961
|
+
* Event triggered when the visibility of meshes is updated.
|
|
2962
|
+
* Contains two sets: seen and unseen.
|
|
3027
2963
|
*/
|
|
3028
|
-
|
|
2964
|
+
readonly onViewUpdated: Event<{
|
|
2965
|
+
seen: Set<THREE.Mesh>;
|
|
2966
|
+
unseen: Set<THREE.Mesh>;
|
|
2967
|
+
}>;
|
|
3029
2968
|
/**
|
|
3030
|
-
*
|
|
2969
|
+
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
2970
|
+
* Default value is 100.
|
|
3031
2971
|
*/
|
|
3032
|
-
|
|
2972
|
+
threshold: number;
|
|
3033
2973
|
/**
|
|
3034
|
-
*
|
|
2974
|
+
* Map of color code to THREE.InstancedMesh.
|
|
2975
|
+
* Used to keep track of color-coded meshes.
|
|
3035
2976
|
*/
|
|
3036
|
-
|
|
3037
|
-
protected _canvas: HTMLCanvasElement;
|
|
3038
|
-
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
3039
|
-
protected _resizeObserver: ResizeObserver | null;
|
|
3040
|
-
protected onContainerUpdated: Event<unknown>;
|
|
3041
|
-
private _resizing;
|
|
2977
|
+
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
3042
2978
|
/**
|
|
3043
|
-
*
|
|
3044
|
-
*
|
|
3045
|
-
* @param components - The components instance.
|
|
3046
|
-
* @param container - The HTML container where the THREE.js canvas will be rendered.
|
|
3047
|
-
* @param parameters - Optional parameters for the THREE.js WebGLRenderer.
|
|
2979
|
+
* Flag to indicate if the renderer is currently processing.
|
|
2980
|
+
* Used to prevent concurrent processing.
|
|
3048
2981
|
*/
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
2982
|
+
isProcessing: boolean;
|
|
2983
|
+
private _colorCodeMeshMap;
|
|
2984
|
+
private _meshIDColorCodeMap;
|
|
2985
|
+
private _currentVisibleMeshes;
|
|
2986
|
+
private _recentlyHiddenMeshes;
|
|
2987
|
+
private _intervalID;
|
|
2988
|
+
private readonly _transparentMat;
|
|
2989
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
3052
2990
|
/** {@link Disposable.dispose} */
|
|
3053
2991
|
dispose(): void;
|
|
3054
|
-
/** {@link Resizeable.getSize}. */
|
|
3055
|
-
getSize(): THREE.Vector2;
|
|
3056
|
-
/** {@link Resizeable.resize} */
|
|
3057
|
-
resize: (size?: THREE.Vector2) => void;
|
|
3058
2992
|
/**
|
|
3059
|
-
*
|
|
3060
|
-
*
|
|
3061
|
-
* @
|
|
3062
|
-
*
|
|
3063
|
-
* @throws Will throw an error if the renderer does not have an HTML container.
|
|
2993
|
+
* 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.
|
|
2994
|
+
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2995
|
+
* @returns {void}
|
|
3064
2996
|
*/
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
2997
|
+
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2998
|
+
/**
|
|
2999
|
+
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
3000
|
+
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
3001
|
+
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
3002
|
+
* @returns {void}
|
|
3003
|
+
*/
|
|
3004
|
+
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
3005
|
+
private handleWorkerMessage;
|
|
3006
|
+
private getAvailableMaterial;
|
|
3070
3007
|
}
|
|
3071
3008
|
import * as THREE from "three";
|
|
3072
|
-
import CameraControls from "camera-controls";
|
|
3073
|
-
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
3074
3009
|
import { Components } from "../../Components";
|
|
3010
|
+
import { AsyncEvent, Event, World } from "../../Types";
|
|
3075
3011
|
/**
|
|
3076
|
-
*
|
|
3012
|
+
* Settings to configure the CullerRenderer.
|
|
3077
3013
|
*/
|
|
3078
|
-
export
|
|
3079
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
3080
|
-
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
3081
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
3082
|
-
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
3014
|
+
export interface CullerRendererSettings {
|
|
3083
3015
|
/**
|
|
3084
|
-
*
|
|
3085
|
-
*
|
|
3016
|
+
* Interval in milliseconds at which the visibility check should be performed.
|
|
3017
|
+
* Default value is 1000.
|
|
3086
3018
|
*/
|
|
3087
|
-
|
|
3019
|
+
updateInterval?: number;
|
|
3020
|
+
/**
|
|
3021
|
+
* Width of the render target used for visibility checks.
|
|
3022
|
+
* Default value is 512.
|
|
3023
|
+
*/
|
|
3024
|
+
width?: number;
|
|
3025
|
+
/**
|
|
3026
|
+
* Height of the render target used for visibility checks.
|
|
3027
|
+
* Default value is 512.
|
|
3028
|
+
*/
|
|
3029
|
+
height?: number;
|
|
3030
|
+
/**
|
|
3031
|
+
* Whether the visibility check should be performed automatically.
|
|
3032
|
+
* Default value is true.
|
|
3033
|
+
*/
|
|
3034
|
+
autoUpdate?: boolean;
|
|
3035
|
+
}
|
|
3036
|
+
/**
|
|
3037
|
+
* A base renderer to determine visibility on screen.
|
|
3038
|
+
*/
|
|
3039
|
+
export declare class CullerRenderer {
|
|
3088
3040
|
/** {@link Disposable.onDisposed} */
|
|
3089
3041
|
readonly onDisposed: Event<string>;
|
|
3090
3042
|
/**
|
|
3091
|
-
*
|
|
3092
|
-
*
|
|
3043
|
+
* Fires after making the visibility check to the meshes. It lists the
|
|
3044
|
+
* meshes that are currently visible, and the ones that were visible
|
|
3045
|
+
* just before but not anymore.
|
|
3093
3046
|
*/
|
|
3094
|
-
|
|
3095
|
-
private _allControls;
|
|
3047
|
+
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
3096
3048
|
/**
|
|
3097
|
-
*
|
|
3098
|
-
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
3099
|
-
* Transforming the camera directly will have no effect: you need to use this
|
|
3100
|
-
* object to move, rotate, look at objects, etc.
|
|
3049
|
+
* Whether this renderer is active or not. If not, it won't render anything.
|
|
3101
3050
|
*/
|
|
3102
|
-
|
|
3051
|
+
enabled: boolean;
|
|
3103
3052
|
/**
|
|
3104
|
-
*
|
|
3105
|
-
*
|
|
3106
|
-
* Otherwise, it returns the enabled state of the camera controls.
|
|
3107
|
-
*
|
|
3108
|
-
* @returns {boolean} The enabled state of the camera controls.
|
|
3053
|
+
* Needs to check whether there are objects that need to be hidden or shown.
|
|
3054
|
+
* You can bind this to the camera movement, to a certain interval, etc.
|
|
3109
3055
|
*/
|
|
3110
|
-
|
|
3056
|
+
needsUpdate: boolean;
|
|
3111
3057
|
/**
|
|
3112
|
-
*
|
|
3113
|
-
*
|
|
3114
|
-
*
|
|
3115
|
-
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
3058
|
+
* Render the internal scene used to determine the object visibility. Used
|
|
3059
|
+
* for debugging purposes.
|
|
3116
3060
|
*/
|
|
3117
|
-
|
|
3118
|
-
|
|
3061
|
+
renderDebugFrame: boolean;
|
|
3062
|
+
/** The components instance to which this renderer belongs. */
|
|
3063
|
+
components: Components;
|
|
3064
|
+
/** The world instance to which this renderer belongs. */
|
|
3065
|
+
readonly world: World;
|
|
3066
|
+
/** The THREE.js renderer used to make the visibility test. */
|
|
3067
|
+
readonly renderer: THREE.WebGLRenderer;
|
|
3068
|
+
protected autoUpdate: boolean;
|
|
3069
|
+
protected updateInterval: number;
|
|
3070
|
+
protected readonly worker: Worker;
|
|
3071
|
+
protected readonly scene: THREE.Scene;
|
|
3072
|
+
private _width;
|
|
3073
|
+
private _height;
|
|
3074
|
+
private _availableColor;
|
|
3075
|
+
private readonly renderTarget;
|
|
3076
|
+
private readonly bufferSize;
|
|
3077
|
+
private readonly _buffer;
|
|
3078
|
+
protected _isWorkerBusy: boolean;
|
|
3079
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
3119
3080
|
/** {@link Disposable.dispose} */
|
|
3120
3081
|
dispose(): void;
|
|
3121
|
-
/** {@link Updateable.update} */
|
|
3122
|
-
update(_delta: number): void;
|
|
3123
3082
|
/**
|
|
3124
|
-
*
|
|
3125
|
-
*
|
|
3083
|
+
* The function that the culler uses to reprocess the scene. Generally it's
|
|
3084
|
+
* better to call needsUpdate, but you can also call this to force it.
|
|
3085
|
+
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
3086
|
+
* not true.
|
|
3126
3087
|
*/
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
*/
|
|
3138
|
-
export declare class FirstPersonMode implements NavigationMode {
|
|
3139
|
-
private camera;
|
|
3140
|
-
/** {@link NavigationMode.enabled} */
|
|
3141
|
-
enabled: boolean;
|
|
3142
|
-
/** {@link NavigationMode.id} */
|
|
3143
|
-
readonly id = "FirstPerson";
|
|
3144
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3145
|
-
/** {@link NavigationMode.set} */
|
|
3146
|
-
set(active: boolean): void;
|
|
3147
|
-
private setupFirstPersonCamera;
|
|
3088
|
+
updateVisibility: (force?: boolean) => Promise<void>;
|
|
3089
|
+
protected getAvailableColor(): {
|
|
3090
|
+
r: number;
|
|
3091
|
+
g: number;
|
|
3092
|
+
b: number;
|
|
3093
|
+
code: string;
|
|
3094
|
+
};
|
|
3095
|
+
protected increaseColor(): void;
|
|
3096
|
+
protected decreaseColor(): void;
|
|
3097
|
+
private applySettings;
|
|
3148
3098
|
}
|
|
3099
|
+
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
3149
3100
|
import { NavigationMode } from "./types";
|
|
3150
3101
|
import { OrthoPerspectiveCamera } from "../index";
|
|
3151
3102
|
/**
|
|
@@ -3165,22 +3116,63 @@ export declare class OrbitMode implements NavigationMode {
|
|
|
3165
3116
|
import { NavigationMode } from "./types";
|
|
3166
3117
|
import { OrthoPerspectiveCamera } from "../index";
|
|
3167
3118
|
/**
|
|
3168
|
-
* A {@link NavigationMode} that allows
|
|
3119
|
+
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
3169
3120
|
*/
|
|
3170
|
-
export declare class
|
|
3121
|
+
export declare class FirstPersonMode implements NavigationMode {
|
|
3171
3122
|
private camera;
|
|
3172
3123
|
/** {@link NavigationMode.enabled} */
|
|
3173
3124
|
enabled: boolean;
|
|
3174
3125
|
/** {@link NavigationMode.id} */
|
|
3175
|
-
readonly id = "
|
|
3176
|
-
private mouseAction1?;
|
|
3177
|
-
private mouseAction2?;
|
|
3178
|
-
private mouseInitialized;
|
|
3179
|
-
private readonly defaultAzimuthSpeed;
|
|
3180
|
-
private readonly defaultPolarSpeed;
|
|
3126
|
+
readonly id = "FirstPerson";
|
|
3181
3127
|
constructor(camera: OrthoPerspectiveCamera);
|
|
3182
3128
|
/** {@link NavigationMode.set} */
|
|
3183
3129
|
set(active: boolean): void;
|
|
3130
|
+
private setupFirstPersonCamera;
|
|
3131
|
+
}
|
|
3132
|
+
import * as THREE from "three";
|
|
3133
|
+
import { CameraProjection } from "./types";
|
|
3134
|
+
import { Event } from "../../Types";
|
|
3135
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3136
|
+
/**
|
|
3137
|
+
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3138
|
+
*/
|
|
3139
|
+
export declare class ProjectionManager {
|
|
3140
|
+
/**
|
|
3141
|
+
* Event that fires when the {@link CameraProjection} changes.
|
|
3142
|
+
*/
|
|
3143
|
+
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3144
|
+
/**
|
|
3145
|
+
* Current projection mode of the camera.
|
|
3146
|
+
* Default is "Perspective".
|
|
3147
|
+
*/
|
|
3148
|
+
current: CameraProjection;
|
|
3149
|
+
/**
|
|
3150
|
+
* The camera controlled by this ProjectionManager.
|
|
3151
|
+
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3152
|
+
*/
|
|
3153
|
+
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3154
|
+
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3155
|
+
matchOrthoDistanceEnabled: boolean;
|
|
3156
|
+
private _component;
|
|
3157
|
+
private _previousDistance;
|
|
3158
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3159
|
+
/**
|
|
3160
|
+
* Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3161
|
+
*
|
|
3162
|
+
* @param projection - the new projection to set. If it is the current projection,
|
|
3163
|
+
* it will have no effect.
|
|
3164
|
+
*/
|
|
3165
|
+
set(projection: CameraProjection): Promise<void>;
|
|
3166
|
+
/**
|
|
3167
|
+
* Changes the current {@link CameraProjection} from Ortographic to Perspective
|
|
3168
|
+
* and vice versa.
|
|
3169
|
+
*/
|
|
3170
|
+
toggle(): Promise<void>;
|
|
3171
|
+
private setOrthoCamera;
|
|
3172
|
+
private getPerspectiveDims;
|
|
3173
|
+
private setupOrthoCamera;
|
|
3174
|
+
private getDistance;
|
|
3175
|
+
private setPerspectiveCamera;
|
|
3184
3176
|
}
|
|
3185
3177
|
/**
|
|
3186
3178
|
* The projection system of the camera.
|
|
@@ -3208,66 +3200,122 @@ export interface NavigationMode {
|
|
|
3208
3200
|
/** Whether this navigation mode is active or not. */
|
|
3209
3201
|
enabled: boolean;
|
|
3210
3202
|
}
|
|
3211
|
-
import
|
|
3212
|
-
import { CameraProjection } from "./types";
|
|
3213
|
-
import { Event } from "../../Types";
|
|
3203
|
+
import { NavigationMode } from "./types";
|
|
3214
3204
|
import { OrthoPerspectiveCamera } from "../index";
|
|
3215
3205
|
/**
|
|
3216
|
-
*
|
|
3206
|
+
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3217
3207
|
*/
|
|
3218
|
-
export declare class
|
|
3208
|
+
export declare class PlanMode implements NavigationMode {
|
|
3209
|
+
private camera;
|
|
3210
|
+
/** {@link NavigationMode.enabled} */
|
|
3211
|
+
enabled: boolean;
|
|
3212
|
+
/** {@link NavigationMode.id} */
|
|
3213
|
+
readonly id = "Plan";
|
|
3214
|
+
private mouseAction1?;
|
|
3215
|
+
private mouseAction2?;
|
|
3216
|
+
private mouseInitialized;
|
|
3217
|
+
private readonly defaultAzimuthSpeed;
|
|
3218
|
+
private readonly defaultPolarSpeed;
|
|
3219
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3220
|
+
/** {@link NavigationMode.set} */
|
|
3221
|
+
set(active: boolean): void;
|
|
3222
|
+
}
|
|
3223
|
+
import * as THREE from "three";
|
|
3224
|
+
import { Hideable, Disposable, Event, World } from "../../Types";
|
|
3225
|
+
import { Components } from "../../Components";
|
|
3226
|
+
/**
|
|
3227
|
+
* Each of the clipping planes created by the clipper.
|
|
3228
|
+
*/
|
|
3229
|
+
export declare class SimplePlane implements Disposable, Hideable {
|
|
3230
|
+
/** Event that fires when the user starts dragging a clipping plane. */
|
|
3231
|
+
readonly onDraggingStarted: Event<unknown>;
|
|
3232
|
+
/** Event that fires when the user stops dragging a clipping plane. */
|
|
3233
|
+
readonly onDraggingEnded: Event<unknown>;
|
|
3234
|
+
/** {@link Disposable.onDisposed} */
|
|
3235
|
+
readonly onDisposed: Event<unknown>;
|
|
3219
3236
|
/**
|
|
3220
|
-
*
|
|
3237
|
+
* The normal vector of the clipping plane.
|
|
3221
3238
|
*/
|
|
3222
|
-
readonly
|
|
3223
|
-
/**
|
|
3224
|
-
*
|
|
3225
|
-
* Default is "Perspective".
|
|
3239
|
+
readonly normal: THREE.Vector3;
|
|
3240
|
+
/**
|
|
3241
|
+
* The origin point of the clipping plane.
|
|
3226
3242
|
*/
|
|
3227
|
-
|
|
3243
|
+
readonly origin: THREE.Vector3;
|
|
3228
3244
|
/**
|
|
3229
|
-
* The
|
|
3230
|
-
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3245
|
+
* The THREE.js Plane object representing the clipping plane.
|
|
3231
3246
|
*/
|
|
3232
|
-
|
|
3233
|
-
/**
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3247
|
+
readonly three: THREE.Plane;
|
|
3248
|
+
/** The components instance to which this plane belongs. */
|
|
3249
|
+
components: Components;
|
|
3250
|
+
/** The world instance to which this plane belongs. */
|
|
3251
|
+
world: World;
|
|
3252
|
+
protected readonly _helper: THREE.Object3D;
|
|
3253
|
+
protected _visible: boolean;
|
|
3254
|
+
protected _enabled: boolean;
|
|
3255
|
+
private _controlsActive;
|
|
3256
|
+
private readonly _arrowBoundBox;
|
|
3257
|
+
private readonly _planeMesh;
|
|
3258
|
+
private readonly _controls;
|
|
3259
|
+
private readonly _hiddenMaterial;
|
|
3238
3260
|
/**
|
|
3239
|
-
*
|
|
3240
|
-
*
|
|
3241
|
-
* @param projection - the new projection to set. If it is the current projection,
|
|
3242
|
-
* it will have no effect.
|
|
3261
|
+
* Getter for the enabled state of the clipping plane.
|
|
3262
|
+
* @returns {boolean} The current enabled state.
|
|
3243
3263
|
*/
|
|
3244
|
-
|
|
3264
|
+
get enabled(): boolean;
|
|
3245
3265
|
/**
|
|
3246
|
-
*
|
|
3247
|
-
* and
|
|
3266
|
+
* Setter for the enabled state of the clipping plane.
|
|
3267
|
+
* Updates the clipping plane state in the renderer and throws an error if no renderer is found.
|
|
3268
|
+
* @param {boolean} state - The new enabled state.
|
|
3248
3269
|
*/
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3270
|
+
set enabled(state: boolean);
|
|
3271
|
+
/** {@link Hideable.visible } */
|
|
3272
|
+
get visible(): boolean;
|
|
3273
|
+
/** {@link Hideable.visible } */
|
|
3274
|
+
set visible(state: boolean);
|
|
3275
|
+
/** The meshes used for raycasting */
|
|
3276
|
+
get meshes(): THREE.Mesh[];
|
|
3277
|
+
/** The material of the clipping plane representation. */
|
|
3278
|
+
get planeMaterial(): THREE.Material | THREE.Material[];
|
|
3279
|
+
/** The material of the clipping plane representation. */
|
|
3280
|
+
set planeMaterial(material: THREE.Material | THREE.Material[]);
|
|
3281
|
+
/** The size of the clipping plane representation. */
|
|
3282
|
+
get size(): number;
|
|
3283
|
+
/** Sets the size of the clipping plane representation. */
|
|
3284
|
+
set size(size: number);
|
|
3261
3285
|
/**
|
|
3262
|
-
*
|
|
3263
|
-
*
|
|
3286
|
+
* Getter for the helper object of the clipping plane.
|
|
3287
|
+
* The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
|
|
3288
|
+
* It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
|
|
3289
|
+
*
|
|
3290
|
+
* @returns {THREE.Object3D} The helper object of the clipping plane.
|
|
3264
3291
|
*/
|
|
3265
|
-
|
|
3292
|
+
get helper(): THREE.Object3D<THREE.Object3DEventMap>;
|
|
3293
|
+
constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
|
|
3266
3294
|
/**
|
|
3267
|
-
*
|
|
3268
|
-
*
|
|
3295
|
+
* Sets the clipping plane's normal and origin from the given normal and point.
|
|
3296
|
+
* This method resets the clipping plane's state, updates the normal and origin,
|
|
3297
|
+
* and positions the helper object accordingly.
|
|
3298
|
+
*
|
|
3299
|
+
* @param normal - The new normal vector for the clipping plane.
|
|
3300
|
+
* @param point - The new origin point for the clipping plane.
|
|
3301
|
+
*
|
|
3302
|
+
* @returns {void}
|
|
3269
3303
|
*/
|
|
3270
|
-
|
|
3304
|
+
setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
|
|
3305
|
+
/** {@link Updateable.update} */
|
|
3306
|
+
update: () => void;
|
|
3307
|
+
/** {@link Disposable.dispose} */
|
|
3308
|
+
dispose(): void;
|
|
3309
|
+
private reset;
|
|
3310
|
+
protected toggleControls(state: boolean): void;
|
|
3311
|
+
private newTransformControls;
|
|
3312
|
+
private initializeControls;
|
|
3313
|
+
private createArrowBoundingBox;
|
|
3314
|
+
private changeDrag;
|
|
3315
|
+
private notifyDraggingChanged;
|
|
3316
|
+
private preventCameraMovement;
|
|
3317
|
+
private newHelper;
|
|
3318
|
+
private static newPlaneMesh;
|
|
3271
3319
|
}
|
|
3272
3320
|
import * as THREE from "three";
|
|
3273
3321
|
import * as WEBIFC from "web-ifc";
|
|
@@ -3284,114 +3332,37 @@ export declare class CivilReader {
|
|
|
3284
3332
|
} | undefined;
|
|
3285
3333
|
private getCurves;
|
|
3286
3334
|
}
|
|
3287
|
-
import
|
|
3288
|
-
export declare class IfcMetadataReader {
|
|
3289
|
-
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3290
|
-
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3291
|
-
}
|
|
3292
|
-
/**
|
|
3293
|
-
* 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.
|
|
3294
|
-
*/
|
|
3295
|
-
export interface StreamedGeometries {
|
|
3296
|
-
[id: number]: {
|
|
3297
|
-
/** The bounding box of the geometry as a Float32Array. */
|
|
3298
|
-
boundingBox: Float32Array;
|
|
3299
|
-
/** A boolean indicating whether the geometry has holes. */
|
|
3300
|
-
hasHoles: boolean;
|
|
3301
|
-
/** An optional file path for the geometry data. */
|
|
3302
|
-
geometryFile?: string;
|
|
3303
|
-
};
|
|
3304
|
-
}
|
|
3305
|
-
/**
|
|
3306
|
-
* A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
|
|
3307
|
-
*/
|
|
3308
|
-
export interface StreamedAsset {
|
|
3309
|
-
/** The unique identifier of the asset. */
|
|
3310
|
-
id: number;
|
|
3311
|
-
/** An array of geometries associated with the asset. */
|
|
3312
|
-
geometries: {
|
|
3313
|
-
/** The unique identifier of the geometry. */
|
|
3314
|
-
geometryID: number;
|
|
3315
|
-
/** The transformation matrix of the geometry as a number array. */
|
|
3316
|
-
transformation: number[];
|
|
3317
|
-
/** The color of the geometry as a number array. */
|
|
3318
|
-
color: number[];
|
|
3319
|
-
}[];
|
|
3320
|
-
}
|
|
3321
|
-
import * as THREE from "three";
|
|
3322
|
-
import { Disposable, Event } from "../../Types";
|
|
3335
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3323
3336
|
/**
|
|
3324
|
-
*
|
|
3337
|
+
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3325
3338
|
*/
|
|
3326
|
-
export declare class
|
|
3327
|
-
dom: HTMLCanvasElement;
|
|
3328
|
-
private _event?;
|
|
3329
|
-
private _position;
|
|
3330
|
-
/** {@link Disposable.onDisposed} */
|
|
3331
|
-
readonly onDisposed: Event<unknown>;
|
|
3332
|
-
constructor(dom: HTMLCanvasElement);
|
|
3339
|
+
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
3333
3340
|
/**
|
|
3334
|
-
*
|
|
3341
|
+
* Amount of properties to be streamed.
|
|
3342
|
+
* Defaults to 100 properties.
|
|
3335
3343
|
*/
|
|
3336
|
-
|
|
3337
|
-
/** {@link Disposable.dispose} */
|
|
3338
|
-
dispose(): void;
|
|
3339
|
-
private getPositionY;
|
|
3340
|
-
private getPositionX;
|
|
3341
|
-
private updateMouseInfo;
|
|
3342
|
-
private setupEvents;
|
|
3344
|
+
propertiesSize: number;
|
|
3343
3345
|
}
|
|
3344
|
-
import * as
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3346
|
+
import * as WEBIFC from "web-ifc";
|
|
3347
|
+
export declare class IfcMetadataReader {
|
|
3348
|
+
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3349
|
+
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3350
|
+
}
|
|
3351
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3348
3352
|
/**
|
|
3349
|
-
*
|
|
3353
|
+
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3350
3354
|
*/
|
|
3351
|
-
export declare class
|
|
3352
|
-
/** {@link Component.enabled} */
|
|
3353
|
-
enabled: boolean;
|
|
3354
|
-
/** The components instance to which this Raycaster belongs. */
|
|
3355
|
-
components: Components;
|
|
3356
|
-
/** {@link Disposable.onDisposed} */
|
|
3357
|
-
readonly onDisposed: Event<unknown>;
|
|
3358
|
-
/** The position of the mouse in the screen. */
|
|
3359
|
-
readonly mouse: Mouse;
|
|
3360
|
-
/**
|
|
3361
|
-
* A reference to the Three.js Raycaster instance.
|
|
3362
|
-
* This is used for raycasting operations.
|
|
3363
|
-
*/
|
|
3364
|
-
readonly three: THREE.Raycaster;
|
|
3365
|
-
/**
|
|
3366
|
-
* A reference to the world instance to which this Raycaster belongs.
|
|
3367
|
-
* This is used to access the camera and meshes.
|
|
3368
|
-
*/
|
|
3369
|
-
world: World;
|
|
3370
|
-
constructor(components: Components, world: World);
|
|
3371
|
-
/** {@link Disposable.dispose} */
|
|
3372
|
-
dispose(): void;
|
|
3355
|
+
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
3373
3356
|
/**
|
|
3374
|
-
*
|
|
3375
|
-
*
|
|
3376
|
-
* used by the renderer.
|
|
3377
|
-
*
|
|
3378
|
-
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
3379
|
-
* to query. If not provided, it will query all the meshes stored in
|
|
3380
|
-
* {@link Components.meshes}.
|
|
3357
|
+
* Minimum number of geometries to be streamed.
|
|
3358
|
+
* Defaults to 10 geometries.
|
|
3381
3359
|
*/
|
|
3382
|
-
|
|
3360
|
+
minGeometrySize: number;
|
|
3383
3361
|
/**
|
|
3384
|
-
*
|
|
3385
|
-
*
|
|
3386
|
-
*
|
|
3387
|
-
* @param origin - The origin of the ray.
|
|
3388
|
-
* @param direction - The direction of the ray.
|
|
3389
|
-
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3390
|
-
* @returns The first intersection found or 'null' if no intersection was found.
|
|
3362
|
+
* Minimum amount of assets to be streamed.
|
|
3363
|
+
* Defaults to 1000 assets.
|
|
3391
3364
|
*/
|
|
3392
|
-
|
|
3393
|
-
private intersect;
|
|
3394
|
-
private filterClippingPlanes;
|
|
3365
|
+
minAssetsSize: number;
|
|
3395
3366
|
}
|
|
3396
3367
|
export type RelationsMap = Map<number, Map<number, number[]>>;
|
|
3397
3368
|
export interface ModelsRelationMap {
|
|
@@ -3417,6 +3388,11 @@ export type InverseAttributes = [
|
|
|
3417
3388
|
"ContainsElements"
|
|
3418
3389
|
];
|
|
3419
3390
|
export type InverseAttribute = InverseAttributes[number];
|
|
3391
|
+
import { BufferGeometry } from "three";
|
|
3392
|
+
import * as THREE from "three";
|
|
3393
|
+
export declare class TransformHelper {
|
|
3394
|
+
getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
|
|
3395
|
+
}
|
|
3420
3396
|
import * as WEBIFC from "web-ifc";
|
|
3421
3397
|
import * as THREE from "three";
|
|
3422
3398
|
export declare class Units {
|
|
@@ -3427,10 +3403,34 @@ export declare class Units {
|
|
|
3427
3403
|
private getLengthUnits;
|
|
3428
3404
|
private getScaleMatrix;
|
|
3429
3405
|
}
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3406
|
+
/**
|
|
3407
|
+
* 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.
|
|
3408
|
+
*/
|
|
3409
|
+
export interface StreamedGeometries {
|
|
3410
|
+
[id: number]: {
|
|
3411
|
+
/** The bounding box of the geometry as a Float32Array. */
|
|
3412
|
+
boundingBox: Float32Array;
|
|
3413
|
+
/** A boolean indicating whether the geometry has holes. */
|
|
3414
|
+
hasHoles: boolean;
|
|
3415
|
+
/** An optional file path for the geometry data. */
|
|
3416
|
+
geometryFile?: string;
|
|
3417
|
+
};
|
|
3418
|
+
}
|
|
3419
|
+
/**
|
|
3420
|
+
* A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
|
|
3421
|
+
*/
|
|
3422
|
+
export interface StreamedAsset {
|
|
3423
|
+
/** The unique identifier of the asset. */
|
|
3424
|
+
id: number;
|
|
3425
|
+
/** An array of geometries associated with the asset. */
|
|
3426
|
+
geometries: {
|
|
3427
|
+
/** The unique identifier of the geometry. */
|
|
3428
|
+
geometryID: number;
|
|
3429
|
+
/** The transformation matrix of the geometry as a number array. */
|
|
3430
|
+
transformation: number[];
|
|
3431
|
+
/** The color of the geometry as a number array. */
|
|
3432
|
+
color: number[];
|
|
3433
|
+
}[];
|
|
3434
3434
|
}
|
|
3435
3435
|
|
|
3436
3436
|
}
|