@thatopen/components 2.1.21 → 2.1.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/ifc/IfcRelationsIndexer/src/relToAttributesMap.d.ts +1 -1
- package/dist/ifc/IfcRelationsIndexer/src/types.d.ts +10 -2
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +178 -137
- package/dist/namespace.d.ts +1204 -1196
- package/package.json +2 -2
package/dist/namespace.d.ts
CHANGED
|
@@ -1,79 +1,48 @@
|
|
|
1
1
|
declare namespace OBC {
|
|
2
|
-
import
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
import { Components } from "../Components";
|
|
4
|
+
import { Component } from "../Types";
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
6
|
+
* A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
5
7
|
*/
|
|
6
|
-
export declare class
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
static readonly release = "2.1.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>;
|
|
8
|
+
export declare class Disposer extends Component {
|
|
9
|
+
private _disposedComponents;
|
|
10
|
+
/** {@link Component.enabled} */
|
|
11
|
+
enabled: boolean;
|
|
18
12
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
13
|
+
* A unique identifier for the component.
|
|
14
|
+
* This UUID is used to register the component within the Components system.
|
|
21
15
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
17
|
+
constructor(components: Components);
|
|
24
18
|
/**
|
|
25
|
-
*
|
|
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
|
|
19
|
+
* Return the UUIDs of all disposed components.
|
|
34
20
|
*/
|
|
35
|
-
|
|
21
|
+
get(): Set<string>;
|
|
36
22
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
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.
|
|
23
|
+
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
24
|
+
* using any of these in other parts of the application, make sure that you
|
|
25
|
+
* remove them from the mesh before disposing it.
|
|
44
26
|
*
|
|
45
|
-
* @
|
|
27
|
+
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
28
|
+
* to remove.
|
|
46
29
|
*
|
|
47
|
-
* @
|
|
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.
|
|
30
|
+
* @param materials - whether to dispose the materials of the mesh.
|
|
55
31
|
*
|
|
56
|
-
* @
|
|
32
|
+
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
57
33
|
*/
|
|
58
|
-
|
|
34
|
+
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
59
35
|
/**
|
|
60
|
-
* Disposes
|
|
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).
|
|
36
|
+
* Disposes a geometry from memory.
|
|
72
37
|
*
|
|
38
|
+
* @param geometry - the
|
|
39
|
+
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
40
|
+
* to remove.
|
|
73
41
|
*/
|
|
74
|
-
|
|
75
|
-
private
|
|
76
|
-
private
|
|
42
|
+
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
43
|
+
private disposeGeometryAndMaterials;
|
|
44
|
+
private disposeChildren;
|
|
45
|
+
private static disposeMaterial;
|
|
77
46
|
}
|
|
78
47
|
import { SimpleScene, SimpleSceneConfig } from "../Worlds";
|
|
79
48
|
import { DistanceRenderer } from "./src";
|
|
@@ -134,107 +103,81 @@ export declare class ShadowedScene extends SimpleScene implements Disposable {
|
|
|
134
103
|
updateShadows(): Promise<void>;
|
|
135
104
|
private recomputeShadows;
|
|
136
105
|
}
|
|
137
|
-
import
|
|
138
|
-
import { Components } from "../Components";
|
|
139
|
-
import { Component } from "../Types";
|
|
106
|
+
import { Component, Disposable, Event } from "../Types";
|
|
140
107
|
/**
|
|
141
|
-
*
|
|
108
|
+
* 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.
|
|
142
109
|
*/
|
|
143
|
-
export declare class
|
|
144
|
-
private _disposedComponents;
|
|
145
|
-
/** {@link Component.enabled} */
|
|
146
|
-
enabled: boolean;
|
|
110
|
+
export declare class Components implements Disposable {
|
|
147
111
|
/**
|
|
148
|
-
*
|
|
149
|
-
* This UUID is used to register the component within the Components system.
|
|
112
|
+
* The version of the @thatopen/components library.
|
|
150
113
|
*/
|
|
151
|
-
static readonly
|
|
152
|
-
|
|
114
|
+
static readonly release = "2.1.23";
|
|
115
|
+
/** {@link Disposable.onDisposed} */
|
|
116
|
+
readonly onDisposed: Event<void>;
|
|
153
117
|
/**
|
|
154
|
-
*
|
|
118
|
+
* The list of components created in this app.
|
|
119
|
+
* The keys are UUIDs and the values are instances of the components.
|
|
155
120
|
*/
|
|
156
|
-
|
|
121
|
+
readonly list: Map<string, Component>;
|
|
157
122
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
|
|
123
|
+
* If disabled, the animation loop will be stopped.
|
|
124
|
+
* Default value is false.
|
|
125
|
+
*/
|
|
126
|
+
enabled: boolean;
|
|
127
|
+
private _clock;
|
|
128
|
+
/**
|
|
129
|
+
* Adds a component to the list of components.
|
|
130
|
+
* Throws an error if a component with the same UUID already exists.
|
|
161
131
|
*
|
|
162
|
-
* @param
|
|
163
|
-
* to
|
|
132
|
+
* @param uuid - The unique identifier of the component.
|
|
133
|
+
* @param instance - The instance of the component to be added.
|
|
164
134
|
*
|
|
165
|
-
* @
|
|
135
|
+
* @throws Will throw an error if a component with the same UUID already exists.
|
|
166
136
|
*
|
|
167
|
-
* @
|
|
137
|
+
* @internal
|
|
168
138
|
*/
|
|
169
|
-
|
|
139
|
+
add(uuid: string, instance: Component): void;
|
|
170
140
|
/**
|
|
171
|
-
*
|
|
141
|
+
* Retrieves a component instance by its constructor function.
|
|
142
|
+
* If the component does not exist in the list, it will be created and added.
|
|
172
143
|
*
|
|
173
|
-
* @
|
|
174
|
-
*
|
|
175
|
-
* to remove.
|
|
176
|
-
*/
|
|
177
|
-
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
178
|
-
private disposeGeometryAndMaterials;
|
|
179
|
-
private disposeChildren;
|
|
180
|
-
private static disposeMaterial;
|
|
181
|
-
}
|
|
182
|
-
import * as THREE from "three";
|
|
183
|
-
import { Components } from "../Components";
|
|
184
|
-
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
185
|
-
import { Component, Event, Disposable, World } from "../Types";
|
|
186
|
-
/**
|
|
187
|
-
* 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).
|
|
188
|
-
*/
|
|
189
|
-
export declare class Cullers extends Component implements Disposable {
|
|
190
|
-
/**
|
|
191
|
-
* A unique identifier for the component.
|
|
192
|
-
* This UUID is used to register the component within the Components system.
|
|
193
|
-
*/
|
|
194
|
-
static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
|
|
195
|
-
/**
|
|
196
|
-
* An event that is triggered when the Cullers component is disposed.
|
|
197
|
-
*/
|
|
198
|
-
readonly onDisposed: Event<unknown>;
|
|
199
|
-
private _enabled;
|
|
200
|
-
/**
|
|
201
|
-
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
202
|
-
*/
|
|
203
|
-
list: Map<string, MeshCullerRenderer>;
|
|
204
|
-
/** {@link Component.enabled} */
|
|
205
|
-
get enabled(): boolean;
|
|
206
|
-
/** {@link Component.enabled} */
|
|
207
|
-
set enabled(value: boolean);
|
|
208
|
-
constructor(components: Components);
|
|
209
|
-
/**
|
|
210
|
-
* Creates a new MeshCullerRenderer for the given world.
|
|
211
|
-
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
144
|
+
* @template U - The type of the component to retrieve.
|
|
145
|
+
* @param Component - The constructor function of the component to retrieve.
|
|
212
146
|
*
|
|
213
|
-
* @
|
|
214
|
-
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
147
|
+
* @returns The instance of the requested component.
|
|
215
148
|
*
|
|
216
|
-
* @
|
|
149
|
+
* @throws Will throw an error if a component with the same UUID already exists.
|
|
150
|
+
*
|
|
151
|
+
* @internal
|
|
217
152
|
*/
|
|
218
|
-
|
|
153
|
+
get<U extends Component>(Component: new (components: Components) => U): U;
|
|
154
|
+
constructor();
|
|
219
155
|
/**
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
156
|
+
* Initializes the Components instance.
|
|
157
|
+
* This method starts the animation loop, sets the enabled flag to true,
|
|
158
|
+
* and calls the update method.
|
|
224
159
|
*
|
|
225
160
|
* @returns {void}
|
|
226
161
|
*/
|
|
227
|
-
|
|
228
|
-
/** {@link Disposable.dispose} */
|
|
229
|
-
dispose(): void;
|
|
162
|
+
init(): void;
|
|
230
163
|
/**
|
|
231
|
-
*
|
|
164
|
+
* Disposes the memory of all the components and tools of this instance of
|
|
165
|
+
* the library. A memory leak will be created if:
|
|
232
166
|
*
|
|
233
|
-
*
|
|
167
|
+
* - An instance of the library ends up out of scope and this function isn't
|
|
168
|
+
* called. This is especially relevant in Single Page Applications (React,
|
|
169
|
+
* Angular, Vue, etc).
|
|
170
|
+
*
|
|
171
|
+
* - Any of the objects of this instance (meshes, geometries,materials, etc) is
|
|
172
|
+
* referenced by a reference type (object or array).
|
|
173
|
+
*
|
|
174
|
+
* You can learn more about how Three.js handles memory leaks
|
|
175
|
+
* [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
234
176
|
*
|
|
235
|
-
* @returns {void}
|
|
236
177
|
*/
|
|
237
|
-
|
|
178
|
+
dispose(): void;
|
|
179
|
+
private update;
|
|
180
|
+
private static setupBVH;
|
|
238
181
|
}
|
|
239
182
|
import { Component, Disposable, World, Event } from "../Types";
|
|
240
183
|
import { SimpleRaycaster } from "./src";
|
|
@@ -278,39 +221,155 @@ export declare class Raycasters extends Component implements Disposable {
|
|
|
278
221
|
/** {@link Disposable.dispose} */
|
|
279
222
|
dispose(): void;
|
|
280
223
|
}
|
|
281
|
-
import
|
|
282
|
-
import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
|
|
283
|
-
import { SimplePlane } from "./src";
|
|
224
|
+
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
284
225
|
import { Components } from "../Components";
|
|
226
|
+
import { SimpleWorld } from "./src";
|
|
285
227
|
/**
|
|
286
|
-
* A
|
|
287
|
-
*
|
|
288
|
-
* @param components - the instance of {@link Components} used.
|
|
289
|
-
* E.g. {@link SimplePlane}.
|
|
228
|
+
* 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).
|
|
290
229
|
*/
|
|
291
|
-
export declare class
|
|
230
|
+
export declare class Worlds extends Component implements Updateable, Disposable {
|
|
292
231
|
/**
|
|
293
232
|
* A unique identifier for the component.
|
|
294
233
|
* This UUID is used to register the component within the Components system.
|
|
295
234
|
*/
|
|
296
|
-
static readonly uuid: "
|
|
297
|
-
/**
|
|
298
|
-
readonly
|
|
299
|
-
/**
|
|
300
|
-
readonly
|
|
235
|
+
static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
|
|
236
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
237
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
238
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
239
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
240
|
+
/** {@link Disposable.onDisposed} */
|
|
241
|
+
readonly onDisposed: Event<unknown>;
|
|
301
242
|
/**
|
|
302
|
-
*
|
|
243
|
+
* An event that is triggered when a new world is created.
|
|
244
|
+
* The event passes the newly created world as a parameter.
|
|
303
245
|
*/
|
|
304
|
-
readonly
|
|
246
|
+
readonly onWorldCreated: Event<World>;
|
|
305
247
|
/**
|
|
306
|
-
*
|
|
248
|
+
* An event that is triggered when a world is deleted.
|
|
249
|
+
* The event passes the UUID of the deleted world as a parameter.
|
|
307
250
|
*/
|
|
308
|
-
readonly
|
|
251
|
+
readonly onWorldDeleted: Event<string>;
|
|
309
252
|
/**
|
|
310
|
-
*
|
|
253
|
+
* A collection of worlds managed by this component.
|
|
254
|
+
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
311
255
|
*/
|
|
312
|
-
|
|
313
|
-
/**
|
|
256
|
+
list: Map<string, World>;
|
|
257
|
+
/** {@link Component.enabled} */
|
|
258
|
+
enabled: boolean;
|
|
259
|
+
constructor(components: Components);
|
|
260
|
+
/**
|
|
261
|
+
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
262
|
+
*
|
|
263
|
+
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
264
|
+
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
265
|
+
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
266
|
+
*
|
|
267
|
+
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
268
|
+
*/
|
|
269
|
+
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
270
|
+
/**
|
|
271
|
+
* Deletes a world from the list of worlds.
|
|
272
|
+
*
|
|
273
|
+
* @param {World} world - The world to be deleted.
|
|
274
|
+
*
|
|
275
|
+
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
276
|
+
*
|
|
277
|
+
* @returns {void}
|
|
278
|
+
*/
|
|
279
|
+
delete(world: World): void;
|
|
280
|
+
/**
|
|
281
|
+
* Disposes of the Worlds component and all its managed worlds.
|
|
282
|
+
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
283
|
+
* and triggers the onDisposed event.
|
|
284
|
+
*
|
|
285
|
+
* @returns {void}
|
|
286
|
+
*/
|
|
287
|
+
dispose(): void;
|
|
288
|
+
/** {@link Updateable.update} */
|
|
289
|
+
update(delta?: number): void | Promise<void>;
|
|
290
|
+
}
|
|
291
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
292
|
+
import { GridConfig, SimpleGrid } from "./src";
|
|
293
|
+
import { Components } from "../Components";
|
|
294
|
+
/**
|
|
295
|
+
* 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).
|
|
296
|
+
*/
|
|
297
|
+
export declare class Grids extends Component implements Disposable {
|
|
298
|
+
/**
|
|
299
|
+
* A unique identifier for the component.
|
|
300
|
+
* This UUID is used to register the component within the Components system.
|
|
301
|
+
*/
|
|
302
|
+
static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
|
|
303
|
+
/**
|
|
304
|
+
* A map of world UUIDs to their corresponding grid instances.
|
|
305
|
+
*/
|
|
306
|
+
list: Map<string, SimpleGrid>;
|
|
307
|
+
/**
|
|
308
|
+
* The default configuration for grid creation.
|
|
309
|
+
*/
|
|
310
|
+
config: Required<GridConfig>;
|
|
311
|
+
/** {@link Disposable.onDisposed} */
|
|
312
|
+
readonly onDisposed: Event<unknown>;
|
|
313
|
+
/** {@link Component.enabled} */
|
|
314
|
+
enabled: boolean;
|
|
315
|
+
constructor(components: Components);
|
|
316
|
+
/**
|
|
317
|
+
* Creates a new grid for the given world.
|
|
318
|
+
* Throws an error if a grid already exists for the world.
|
|
319
|
+
*
|
|
320
|
+
* @param world - The world to create the grid for.
|
|
321
|
+
* @returns The newly created grid.
|
|
322
|
+
*
|
|
323
|
+
* @throws Will throw an error if a grid already exists for the given world.
|
|
324
|
+
*/
|
|
325
|
+
create(world: World): SimpleGrid;
|
|
326
|
+
/**
|
|
327
|
+
* Deletes the grid associated with the given world.
|
|
328
|
+
* If a grid does not exist for the given world, this method does nothing.
|
|
329
|
+
*
|
|
330
|
+
* @param world - The world for which to delete the grid.
|
|
331
|
+
*
|
|
332
|
+
* @remarks
|
|
333
|
+
* This method will dispose of the grid and remove it from the internal list.
|
|
334
|
+
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
335
|
+
*/
|
|
336
|
+
delete(world: World): void;
|
|
337
|
+
/** {@link Disposable.dispose} */
|
|
338
|
+
dispose(): void;
|
|
339
|
+
}
|
|
340
|
+
import * as THREE from "three";
|
|
341
|
+
import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
|
|
342
|
+
import { SimplePlane } from "./src";
|
|
343
|
+
import { Components } from "../Components";
|
|
344
|
+
/**
|
|
345
|
+
* A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper).
|
|
346
|
+
*
|
|
347
|
+
* @param components - the instance of {@link Components} used.
|
|
348
|
+
* E.g. {@link SimplePlane}.
|
|
349
|
+
*/
|
|
350
|
+
export declare class Clipper extends Component implements Createable, Disposable, Hideable {
|
|
351
|
+
/**
|
|
352
|
+
* A unique identifier for the component.
|
|
353
|
+
* This UUID is used to register the component within the Components system.
|
|
354
|
+
*/
|
|
355
|
+
static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
|
|
356
|
+
/** Event that fires when the user starts dragging a clipping plane. */
|
|
357
|
+
readonly onBeforeDrag: Event<void>;
|
|
358
|
+
/** Event that fires when the user stops dragging a clipping plane. */
|
|
359
|
+
readonly onAfterDrag: Event<void>;
|
|
360
|
+
/**
|
|
361
|
+
* Event that fires when the user starts creating a clipping plane.
|
|
362
|
+
*/
|
|
363
|
+
readonly onBeforeCreate: Event<unknown>;
|
|
364
|
+
/**
|
|
365
|
+
* Event that fires when the user cancels the creation of a clipping plane.
|
|
366
|
+
*/
|
|
367
|
+
readonly onBeforeCancel: Event<unknown>;
|
|
368
|
+
/**
|
|
369
|
+
* Event that fires after the user cancels the creation of a clipping plane.
|
|
370
|
+
*/
|
|
371
|
+
readonly onAfterCancel: Event<unknown>;
|
|
372
|
+
/**
|
|
314
373
|
* Event that fires when the user starts deleting a clipping plane.
|
|
315
374
|
*/
|
|
316
375
|
readonly onBeforeDelete: Event<unknown>;
|
|
@@ -411,6 +470,63 @@ export declare class Clipper extends Component implements Createable, Disposable
|
|
|
411
470
|
}
|
|
412
471
|
import * as THREE from "three";
|
|
413
472
|
import { Components } from "../Components";
|
|
473
|
+
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
474
|
+
import { Component, Event, Disposable, World } from "../Types";
|
|
475
|
+
/**
|
|
476
|
+
* 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).
|
|
477
|
+
*/
|
|
478
|
+
export declare class Cullers extends Component implements Disposable {
|
|
479
|
+
/**
|
|
480
|
+
* A unique identifier for the component.
|
|
481
|
+
* This UUID is used to register the component within the Components system.
|
|
482
|
+
*/
|
|
483
|
+
static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
|
|
484
|
+
/**
|
|
485
|
+
* An event that is triggered when the Cullers component is disposed.
|
|
486
|
+
*/
|
|
487
|
+
readonly onDisposed: Event<unknown>;
|
|
488
|
+
private _enabled;
|
|
489
|
+
/**
|
|
490
|
+
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
491
|
+
*/
|
|
492
|
+
list: Map<string, MeshCullerRenderer>;
|
|
493
|
+
/** {@link Component.enabled} */
|
|
494
|
+
get enabled(): boolean;
|
|
495
|
+
/** {@link Component.enabled} */
|
|
496
|
+
set enabled(value: boolean);
|
|
497
|
+
constructor(components: Components);
|
|
498
|
+
/**
|
|
499
|
+
* Creates a new MeshCullerRenderer for the given world.
|
|
500
|
+
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
501
|
+
*
|
|
502
|
+
* @param world - The world for which to create the MeshCullerRenderer.
|
|
503
|
+
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
504
|
+
*
|
|
505
|
+
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
506
|
+
*/
|
|
507
|
+
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
508
|
+
/**
|
|
509
|
+
* Deletes the MeshCullerRenderer associated with the given world.
|
|
510
|
+
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
511
|
+
*
|
|
512
|
+
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
513
|
+
*
|
|
514
|
+
* @returns {void}
|
|
515
|
+
*/
|
|
516
|
+
delete(world: World): void;
|
|
517
|
+
/** {@link Disposable.dispose} */
|
|
518
|
+
dispose(): void;
|
|
519
|
+
/**
|
|
520
|
+
* Updates the given instanced meshes inside the all the cullers. You should use this if you change the count property, e.g. when changing the visibility of fragments.
|
|
521
|
+
*
|
|
522
|
+
* @param meshes - The meshes to update.
|
|
523
|
+
*
|
|
524
|
+
* @returns {void}
|
|
525
|
+
*/
|
|
526
|
+
updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
|
|
527
|
+
}
|
|
528
|
+
import * as THREE from "three";
|
|
529
|
+
import { Components } from "../Components";
|
|
414
530
|
import { SimpleCamera } from "..";
|
|
415
531
|
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
416
532
|
/**
|
|
@@ -473,55 +589,6 @@ export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
|
473
589
|
private newOrthoCamera;
|
|
474
590
|
private setOrthoPerspCameraAspect;
|
|
475
591
|
}
|
|
476
|
-
import { Component, Disposable, World, Event } from "../Types";
|
|
477
|
-
import { GridConfig, SimpleGrid } from "./src";
|
|
478
|
-
import { Components } from "../Components";
|
|
479
|
-
/**
|
|
480
|
-
* 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).
|
|
481
|
-
*/
|
|
482
|
-
export declare class Grids extends Component implements Disposable {
|
|
483
|
-
/**
|
|
484
|
-
* A unique identifier for the component.
|
|
485
|
-
* This UUID is used to register the component within the Components system.
|
|
486
|
-
*/
|
|
487
|
-
static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
|
|
488
|
-
/**
|
|
489
|
-
* A map of world UUIDs to their corresponding grid instances.
|
|
490
|
-
*/
|
|
491
|
-
list: Map<string, SimpleGrid>;
|
|
492
|
-
/**
|
|
493
|
-
* The default configuration for grid creation.
|
|
494
|
-
*/
|
|
495
|
-
config: Required<GridConfig>;
|
|
496
|
-
/** {@link Disposable.onDisposed} */
|
|
497
|
-
readonly onDisposed: Event<unknown>;
|
|
498
|
-
/** {@link Component.enabled} */
|
|
499
|
-
enabled: boolean;
|
|
500
|
-
constructor(components: Components);
|
|
501
|
-
/**
|
|
502
|
-
* Creates a new grid for the given world.
|
|
503
|
-
* Throws an error if a grid already exists for the world.
|
|
504
|
-
*
|
|
505
|
-
* @param world - The world to create the grid for.
|
|
506
|
-
* @returns The newly created grid.
|
|
507
|
-
*
|
|
508
|
-
* @throws Will throw an error if a grid already exists for the given world.
|
|
509
|
-
*/
|
|
510
|
-
create(world: World): SimpleGrid;
|
|
511
|
-
/**
|
|
512
|
-
* Deletes the grid associated with the given world.
|
|
513
|
-
* If a grid does not exist for the given world, this method does nothing.
|
|
514
|
-
*
|
|
515
|
-
* @param world - The world for which to delete the grid.
|
|
516
|
-
*
|
|
517
|
-
* @remarks
|
|
518
|
-
* This method will dispose of the grid and remove it from the internal list.
|
|
519
|
-
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
520
|
-
*/
|
|
521
|
-
delete(world: World): void;
|
|
522
|
-
/** {@link Disposable.dispose} */
|
|
523
|
-
dispose(): void;
|
|
524
|
-
}
|
|
525
592
|
import { MiniMap } from "./src";
|
|
526
593
|
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
527
594
|
import { Components } from "../Components";
|
|
@@ -569,231 +636,110 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
|
|
|
569
636
|
/** {@link Updateable.update} */
|
|
570
637
|
update(): void;
|
|
571
638
|
}
|
|
572
|
-
import
|
|
573
|
-
import
|
|
574
|
-
import {
|
|
639
|
+
import * as THREE from "three";
|
|
640
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
641
|
+
import { Component, Components } from "../../core";
|
|
575
642
|
/**
|
|
576
|
-
*
|
|
643
|
+
* Represents an edge measurement result.
|
|
577
644
|
*/
|
|
578
|
-
export
|
|
645
|
+
export interface MeasureEdge {
|
|
579
646
|
/**
|
|
580
|
-
*
|
|
581
|
-
* This UUID is used to register the component within the Components system.
|
|
647
|
+
* The distance between the two points of the edge.
|
|
582
648
|
*/
|
|
583
|
-
|
|
584
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
585
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
586
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
587
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
588
|
-
/** {@link Disposable.onDisposed} */
|
|
589
|
-
readonly onDisposed: Event<unknown>;
|
|
649
|
+
distance: number;
|
|
590
650
|
/**
|
|
591
|
-
*
|
|
592
|
-
* The event passes the newly created world as a parameter.
|
|
651
|
+
* The two points that define the edge.
|
|
593
652
|
*/
|
|
594
|
-
|
|
653
|
+
points: THREE.Vector3[];
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* 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).
|
|
657
|
+
*/
|
|
658
|
+
export declare class MeasurementUtils extends Component {
|
|
595
659
|
/**
|
|
596
|
-
*
|
|
597
|
-
*
|
|
598
|
-
*/
|
|
599
|
-
readonly onWorldDeleted: Event<string>;
|
|
600
|
-
/**
|
|
601
|
-
* A collection of worlds managed by this component.
|
|
602
|
-
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
660
|
+
* A unique identifier for the component.
|
|
661
|
+
* This UUID is used to register the component within the Components system.
|
|
603
662
|
*/
|
|
604
|
-
|
|
663
|
+
static uuid: string;
|
|
605
664
|
/** {@link Component.enabled} */
|
|
606
665
|
enabled: boolean;
|
|
607
666
|
constructor(components: Components);
|
|
608
667
|
/**
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
612
|
-
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
613
|
-
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
614
|
-
*
|
|
615
|
-
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
616
|
-
*/
|
|
617
|
-
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
618
|
-
/**
|
|
619
|
-
* Deletes a world from the list of worlds.
|
|
620
|
-
*
|
|
621
|
-
* @param {World} world - The world to be deleted.
|
|
622
|
-
*
|
|
623
|
-
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
668
|
+
* Utility method to calculate the distance from a point to a line segment.
|
|
624
669
|
*
|
|
625
|
-
* @
|
|
670
|
+
* @param point - The point from which to calculate the distance.
|
|
671
|
+
* @param lineStart - The start point of the line segment.
|
|
672
|
+
* @param lineEnd - The end point of the line segment.
|
|
673
|
+
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
674
|
+
* @returns The distance from the point to the line segment.
|
|
626
675
|
*/
|
|
627
|
-
|
|
676
|
+
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
628
677
|
/**
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
* and triggers the onDisposed event.
|
|
678
|
+
* Method to get the face of a mesh that contains a given triangle index.
|
|
679
|
+
* It also returns the edges of the found face and their indices.
|
|
632
680
|
*
|
|
633
|
-
* @
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
update(delta?: number): void | Promise<void>;
|
|
638
|
-
}
|
|
639
|
-
import * as THREE from "three";
|
|
640
|
-
export declare class MaterialsUtils {
|
|
641
|
-
static isTransparent(material: THREE.Material): boolean;
|
|
642
|
-
}
|
|
643
|
-
export declare class UUID {
|
|
644
|
-
private static _pattern;
|
|
645
|
-
private static _lut;
|
|
646
|
-
static create(): string;
|
|
647
|
-
static validate(uuid: string): void;
|
|
648
|
-
}
|
|
649
|
-
import * as THREE from "three";
|
|
650
|
-
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
651
|
-
center: THREE.Vector3;
|
|
652
|
-
halfSizes: THREE.Vector3;
|
|
653
|
-
rotation: THREE.Matrix3;
|
|
654
|
-
transformation: THREE.Matrix4;
|
|
655
|
-
};
|
|
656
|
-
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
657
|
-
import * as THREE from "three";
|
|
658
|
-
import { Component, Components, Disposable, Event, World } from "../core";
|
|
659
|
-
/**
|
|
660
|
-
* Configuration interface for the VertexPicker component.
|
|
661
|
-
*/
|
|
662
|
-
export interface VertexPickerConfig {
|
|
663
|
-
/**
|
|
664
|
-
* If true, only vertices will be picked, not the closest point on the face.
|
|
665
|
-
*/
|
|
666
|
-
showOnlyVertex: boolean;
|
|
667
|
-
/**
|
|
668
|
-
* The maximum distance for snapping to a vertex.
|
|
669
|
-
*/
|
|
670
|
-
snapDistance: number;
|
|
671
|
-
/**
|
|
672
|
-
* The HTML element to use for previewing the picked vertex.
|
|
673
|
-
*/
|
|
674
|
-
previewElement: HTMLElement;
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* A class that provides functionality for picking vertices in a 3D scene.
|
|
678
|
-
*/
|
|
679
|
-
export declare class VertexPicker extends Component implements Disposable {
|
|
680
|
-
/** {@link Disposable.onDisposed} */
|
|
681
|
-
readonly onDisposed: Event<unknown>;
|
|
682
|
-
/**
|
|
683
|
-
* An event that is triggered when a vertex is found.
|
|
684
|
-
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
685
|
-
*/
|
|
686
|
-
readonly onVertexFound: Event<THREE.Vector3>;
|
|
687
|
-
/**
|
|
688
|
-
* An event that is triggered when a vertex is lost.
|
|
689
|
-
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
690
|
-
*/
|
|
691
|
-
readonly onVertexLost: Event<THREE.Vector3>;
|
|
692
|
-
/**
|
|
693
|
-
* An event that is triggered when the picker is enabled or disabled
|
|
694
|
-
*/
|
|
695
|
-
readonly onEnabled: Event<boolean>;
|
|
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.
|
|
681
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
682
|
+
* @param triangleIndex - The index of the triangle within the mesh.
|
|
683
|
+
* @param instance - The instance of the mesh (optional).
|
|
684
|
+
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
704
685
|
*/
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
686
|
+
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
687
|
+
edges: MeasureEdge[];
|
|
688
|
+
indices: Set<number>;
|
|
689
|
+
} | null;
|
|
709
690
|
/**
|
|
710
|
-
*
|
|
711
|
-
*
|
|
712
|
-
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
691
|
+
* Method to get the vertices and normal of a mesh face at a given index.
|
|
692
|
+
* It also applies instance transformation if provided.
|
|
713
693
|
*
|
|
714
|
-
* @param
|
|
694
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
695
|
+
* @param faceIndex - The index of the face within the mesh.
|
|
696
|
+
* @param instance - The instance of the mesh (optional).
|
|
697
|
+
* @returns An object containing the vertices and normal of the face.
|
|
698
|
+
* @throws Will throw an error if the geometry is not indexed.
|
|
715
699
|
*/
|
|
716
|
-
|
|
700
|
+
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
701
|
+
p1: THREE.Vector3;
|
|
702
|
+
p2: THREE.Vector3;
|
|
703
|
+
p3: THREE.Vector3;
|
|
704
|
+
faceNormal: THREE.Vector3;
|
|
705
|
+
};
|
|
717
706
|
/**
|
|
718
|
-
*
|
|
707
|
+
* Method to round the vector's components to a specified number of decimal places.
|
|
708
|
+
* This is used to ensure numerical precision in edge detection.
|
|
719
709
|
*
|
|
720
|
-
* @
|
|
710
|
+
* @param vector - The vector to round.
|
|
711
|
+
* @returns The vector with rounded components.
|
|
721
712
|
*/
|
|
722
|
-
|
|
713
|
+
round(vector: THREE.Vector3): void;
|
|
723
714
|
/**
|
|
724
|
-
*
|
|
725
|
-
*
|
|
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.
|
|
715
|
+
* Calculates the volume of a set of fragments.
|
|
728
716
|
*
|
|
729
|
-
* @
|
|
730
|
-
*
|
|
731
|
-
* vertexPicker.config = {
|
|
732
|
-
* snapDistance: 0.5,
|
|
733
|
-
* showOnlyVertex: true,
|
|
734
|
-
* };
|
|
735
|
-
* '''
|
|
736
|
-
*/
|
|
737
|
-
set config(value: Partial<VertexPickerConfig>);
|
|
738
|
-
/**
|
|
739
|
-
* Gets the current configuration for the VertexPicker component.
|
|
717
|
+
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
718
|
+
* @returns The total volume of the fragments and the bounding sphere.
|
|
740
719
|
*
|
|
741
|
-
* @
|
|
720
|
+
* @remarks
|
|
721
|
+
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
722
|
+
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
742
723
|
*
|
|
743
|
-
* @
|
|
744
|
-
*
|
|
745
|
-
* const currentConfig = vertexPicker.config;
|
|
746
|
-
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
747
|
-
* '''
|
|
724
|
+
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
725
|
+
* @throws Will throw an error if the fragment manager is not available.
|
|
748
726
|
*/
|
|
749
|
-
|
|
750
|
-
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
751
|
-
/** {@link Disposable.dispose} */
|
|
752
|
-
dispose(): void;
|
|
727
|
+
getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
|
|
753
728
|
/**
|
|
754
|
-
*
|
|
755
|
-
*
|
|
756
|
-
* @param world - The World instance to use for raycasting.
|
|
729
|
+
* Calculates the total volume of a set of meshes.
|
|
757
730
|
*
|
|
758
|
-
* @
|
|
731
|
+
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
732
|
+
* @returns The total volume of the meshes and the bounding sphere.
|
|
759
733
|
*
|
|
760
734
|
* @remarks
|
|
761
|
-
* This method
|
|
762
|
-
*
|
|
763
|
-
*
|
|
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'.
|
|
767
|
-
*/
|
|
768
|
-
get(world: World): THREE.Vector3 | null;
|
|
769
|
-
private getClosestVertex;
|
|
770
|
-
private getVertices;
|
|
771
|
-
private getVertex;
|
|
772
|
-
}
|
|
773
|
-
import * as WEBIFC from "web-ifc";
|
|
774
|
-
import * as FRAG from "@thatopen/fragments";
|
|
775
|
-
import { Component, Components } from "../../core";
|
|
776
|
-
/**
|
|
777
|
-
* 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).
|
|
778
|
-
*/
|
|
779
|
-
export declare class IfcJsonExporter extends Component {
|
|
780
|
-
/**
|
|
781
|
-
* A unique identifier for the component.
|
|
782
|
-
* This UUID is used to register the component within the Components system.
|
|
783
|
-
*/
|
|
784
|
-
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
785
|
-
/** {@link Component.enabled} */
|
|
786
|
-
enabled: boolean;
|
|
787
|
-
constructor(components: Components);
|
|
788
|
-
/**
|
|
789
|
-
* Exports all the properties of an IFC into an array of JS objects.
|
|
790
|
-
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
791
|
-
* @param modelID ID of the IFC model whose properties to extract.
|
|
792
|
-
* @param indirect whether to get the indirect relationships as well.
|
|
793
|
-
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
794
|
-
* to make the location data available (e.g. absolute position of building).
|
|
735
|
+
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
736
|
+
* and its bounding sphere.
|
|
737
|
+
*
|
|
795
738
|
*/
|
|
796
|
-
|
|
739
|
+
getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
|
|
740
|
+
private getFaceData;
|
|
741
|
+
private getVolumeOfMesh;
|
|
742
|
+
private getSignedVolumeOfTriangle;
|
|
797
743
|
}
|
|
798
744
|
import * as WEBIFC from "web-ifc";
|
|
799
745
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
@@ -959,6 +905,31 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
|
|
|
959
905
|
getEntityChildren(model: FragmentsGroup, expressID: number, found?: Set<number>): Set<number>;
|
|
960
906
|
}
|
|
961
907
|
import * as WEBIFC from "web-ifc";
|
|
908
|
+
import * as FRAG from "@thatopen/fragments";
|
|
909
|
+
import { Component, Components } from "../../core";
|
|
910
|
+
/**
|
|
911
|
+
* 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).
|
|
912
|
+
*/
|
|
913
|
+
export declare class IfcJsonExporter extends Component {
|
|
914
|
+
/**
|
|
915
|
+
* A unique identifier for the component.
|
|
916
|
+
* This UUID is used to register the component within the Components system.
|
|
917
|
+
*/
|
|
918
|
+
static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
|
|
919
|
+
/** {@link Component.enabled} */
|
|
920
|
+
enabled: boolean;
|
|
921
|
+
constructor(components: Components);
|
|
922
|
+
/**
|
|
923
|
+
* Exports all the properties of an IFC into an array of JS objects.
|
|
924
|
+
* @param webIfc The instance of [web-ifc](https://github.com/ThatOpen/engine_web-ifc) to use.
|
|
925
|
+
* @param modelID ID of the IFC model whose properties to extract.
|
|
926
|
+
* @param indirect whether to get the indirect relationships as well.
|
|
927
|
+
* @param recursiveSpatial whether to get the properties of spatial items recursively
|
|
928
|
+
* to make the location data available (e.g. absolute position of building).
|
|
929
|
+
*/
|
|
930
|
+
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
931
|
+
}
|
|
932
|
+
import * as WEBIFC from "web-ifc";
|
|
962
933
|
import { FragmentsGroup } from "@thatopen/fragments";
|
|
963
934
|
import { Component, Disposable, Event, Components } from "../../core";
|
|
964
935
|
/**
|
|
@@ -1424,111 +1395,6 @@ export declare class BoundingBoxer extends Component implements Disposable {
|
|
|
1424
1395
|
}
|
|
1425
1396
|
import * as THREE from "three";
|
|
1426
1397
|
import * as FRAGS from "@thatopen/fragments";
|
|
1427
|
-
import { Component, Components } from "../../core";
|
|
1428
|
-
/**
|
|
1429
|
-
* Represents an edge measurement result.
|
|
1430
|
-
*/
|
|
1431
|
-
export interface MeasureEdge {
|
|
1432
|
-
/**
|
|
1433
|
-
* The distance between the two points of the edge.
|
|
1434
|
-
*/
|
|
1435
|
-
distance: number;
|
|
1436
|
-
/**
|
|
1437
|
-
* The two points that define the edge.
|
|
1438
|
-
*/
|
|
1439
|
-
points: THREE.Vector3[];
|
|
1440
|
-
}
|
|
1441
|
-
/**
|
|
1442
|
-
* 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).
|
|
1443
|
-
*/
|
|
1444
|
-
export declare class MeasurementUtils extends Component {
|
|
1445
|
-
/**
|
|
1446
|
-
* A unique identifier for the component.
|
|
1447
|
-
* This UUID is used to register the component within the Components system.
|
|
1448
|
-
*/
|
|
1449
|
-
static uuid: string;
|
|
1450
|
-
/** {@link Component.enabled} */
|
|
1451
|
-
enabled: boolean;
|
|
1452
|
-
constructor(components: Components);
|
|
1453
|
-
/**
|
|
1454
|
-
* Utility method to calculate the distance from a point to a line segment.
|
|
1455
|
-
*
|
|
1456
|
-
* @param point - The point from which to calculate the distance.
|
|
1457
|
-
* @param lineStart - The start point of the line segment.
|
|
1458
|
-
* @param lineEnd - The end point of the line segment.
|
|
1459
|
-
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
1460
|
-
* @returns The distance from the point to the line segment.
|
|
1461
|
-
*/
|
|
1462
|
-
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
1463
|
-
/**
|
|
1464
|
-
* Method to get the face of a mesh that contains a given triangle index.
|
|
1465
|
-
* It also returns the edges of the found face and their indices.
|
|
1466
|
-
*
|
|
1467
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1468
|
-
* @param triangleIndex - The index of the triangle within the mesh.
|
|
1469
|
-
* @param instance - The instance of the mesh (optional).
|
|
1470
|
-
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
1471
|
-
*/
|
|
1472
|
-
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
1473
|
-
edges: MeasureEdge[];
|
|
1474
|
-
indices: Set<number>;
|
|
1475
|
-
} | null;
|
|
1476
|
-
/**
|
|
1477
|
-
* Method to get the vertices and normal of a mesh face at a given index.
|
|
1478
|
-
* It also applies instance transformation if provided.
|
|
1479
|
-
*
|
|
1480
|
-
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1481
|
-
* @param faceIndex - The index of the face within the mesh.
|
|
1482
|
-
* @param instance - The instance of the mesh (optional).
|
|
1483
|
-
* @returns An object containing the vertices and normal of the face.
|
|
1484
|
-
* @throws Will throw an error if the geometry is not indexed.
|
|
1485
|
-
*/
|
|
1486
|
-
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
1487
|
-
p1: THREE.Vector3;
|
|
1488
|
-
p2: THREE.Vector3;
|
|
1489
|
-
p3: THREE.Vector3;
|
|
1490
|
-
faceNormal: THREE.Vector3;
|
|
1491
|
-
};
|
|
1492
|
-
/**
|
|
1493
|
-
* Method to round the vector's components to a specified number of decimal places.
|
|
1494
|
-
* This is used to ensure numerical precision in edge detection.
|
|
1495
|
-
*
|
|
1496
|
-
* @param vector - The vector to round.
|
|
1497
|
-
* @returns The vector with rounded components.
|
|
1498
|
-
*/
|
|
1499
|
-
round(vector: THREE.Vector3): void;
|
|
1500
|
-
/**
|
|
1501
|
-
* Calculates the volume of a set of fragments.
|
|
1502
|
-
*
|
|
1503
|
-
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
1504
|
-
* @returns The total volume of the fragments and the bounding sphere.
|
|
1505
|
-
*
|
|
1506
|
-
* @remarks
|
|
1507
|
-
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
1508
|
-
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
1509
|
-
*
|
|
1510
|
-
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
1511
|
-
* @throws Will throw an error if the fragment manager is not available.
|
|
1512
|
-
*/
|
|
1513
|
-
getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
|
|
1514
|
-
/**
|
|
1515
|
-
* Calculates the total volume of a set of meshes.
|
|
1516
|
-
*
|
|
1517
|
-
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
1518
|
-
* @returns The total volume of the meshes and the bounding sphere.
|
|
1519
|
-
*
|
|
1520
|
-
* @remarks
|
|
1521
|
-
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
1522
|
-
* and its bounding sphere.
|
|
1523
|
-
*
|
|
1524
|
-
*/
|
|
1525
|
-
getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
|
|
1526
|
-
private getFaceData;
|
|
1527
|
-
private getVolumeOfMesh;
|
|
1528
|
-
private getSignedVolumeOfTriangle;
|
|
1529
|
-
}
|
|
1530
|
-
import * as THREE from "three";
|
|
1531
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1532
1398
|
import { Disposable, Component, Event, Components } from "../../core";
|
|
1533
1399
|
/**
|
|
1534
1400
|
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
|
|
@@ -1751,6 +1617,140 @@ export declare class Exploder extends Component implements Disposable {
|
|
|
1751
1617
|
*/
|
|
1752
1618
|
set(active: boolean): void;
|
|
1753
1619
|
}
|
|
1620
|
+
import * as THREE from "three";
|
|
1621
|
+
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
1622
|
+
center: THREE.Vector3;
|
|
1623
|
+
halfSizes: THREE.Vector3;
|
|
1624
|
+
rotation: THREE.Matrix3;
|
|
1625
|
+
transformation: THREE.Matrix4;
|
|
1626
|
+
};
|
|
1627
|
+
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
1628
|
+
import * as THREE from "three";
|
|
1629
|
+
export declare class MaterialsUtils {
|
|
1630
|
+
static isTransparent(material: THREE.Material): boolean;
|
|
1631
|
+
}
|
|
1632
|
+
export declare class UUID {
|
|
1633
|
+
private static _pattern;
|
|
1634
|
+
private static _lut;
|
|
1635
|
+
static create(): string;
|
|
1636
|
+
static validate(uuid: string): void;
|
|
1637
|
+
}
|
|
1638
|
+
import * as THREE from "three";
|
|
1639
|
+
import { Component, Components, Disposable, Event, World } from "../core";
|
|
1640
|
+
/**
|
|
1641
|
+
* Configuration interface for the VertexPicker component.
|
|
1642
|
+
*/
|
|
1643
|
+
export interface VertexPickerConfig {
|
|
1644
|
+
/**
|
|
1645
|
+
* If true, only vertices will be picked, not the closest point on the face.
|
|
1646
|
+
*/
|
|
1647
|
+
showOnlyVertex: boolean;
|
|
1648
|
+
/**
|
|
1649
|
+
* The maximum distance for snapping to a vertex.
|
|
1650
|
+
*/
|
|
1651
|
+
snapDistance: number;
|
|
1652
|
+
/**
|
|
1653
|
+
* The HTML element to use for previewing the picked vertex.
|
|
1654
|
+
*/
|
|
1655
|
+
previewElement: HTMLElement;
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* A class that provides functionality for picking vertices in a 3D scene.
|
|
1659
|
+
*/
|
|
1660
|
+
export declare class VertexPicker extends Component implements Disposable {
|
|
1661
|
+
/** {@link Disposable.onDisposed} */
|
|
1662
|
+
readonly onDisposed: Event<unknown>;
|
|
1663
|
+
/**
|
|
1664
|
+
* An event that is triggered when a vertex is found.
|
|
1665
|
+
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
1666
|
+
*/
|
|
1667
|
+
readonly onVertexFound: Event<THREE.Vector3>;
|
|
1668
|
+
/**
|
|
1669
|
+
* An event that is triggered when a vertex is lost.
|
|
1670
|
+
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
1671
|
+
*/
|
|
1672
|
+
readonly onVertexLost: Event<THREE.Vector3>;
|
|
1673
|
+
/**
|
|
1674
|
+
* An event that is triggered when the picker is enabled or disabled
|
|
1675
|
+
*/
|
|
1676
|
+
readonly onEnabled: Event<boolean>;
|
|
1677
|
+
/**
|
|
1678
|
+
* A reference to the Components instance associated with this VertexPicker.
|
|
1679
|
+
*/
|
|
1680
|
+
components: Components;
|
|
1681
|
+
/**
|
|
1682
|
+
* A reference to the working plane used for vertex picking.
|
|
1683
|
+
* This plane is used to determine which vertices are considered valid for picking.
|
|
1684
|
+
* If this value is null, all vertices are considered valid.
|
|
1685
|
+
*/
|
|
1686
|
+
workingPlane: THREE.Plane | null;
|
|
1687
|
+
private _pickedPoint;
|
|
1688
|
+
private _config;
|
|
1689
|
+
private _enabled;
|
|
1690
|
+
/**
|
|
1691
|
+
* Sets the enabled state of the VertexPicker.
|
|
1692
|
+
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
1693
|
+
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
1694
|
+
*
|
|
1695
|
+
* @param value - The new enabled state.
|
|
1696
|
+
*/
|
|
1697
|
+
set enabled(value: boolean);
|
|
1698
|
+
/**
|
|
1699
|
+
* Gets the current enabled state of the VertexPicker.
|
|
1700
|
+
*
|
|
1701
|
+
* @returns The current enabled state.
|
|
1702
|
+
*/
|
|
1703
|
+
get enabled(): boolean;
|
|
1704
|
+
/**
|
|
1705
|
+
* Sets the configuration for the VertexPicker component.
|
|
1706
|
+
*
|
|
1707
|
+
* @param value - A Partial object containing the configuration properties to update.
|
|
1708
|
+
* The properties not provided in the value object will retain their current values.
|
|
1709
|
+
*
|
|
1710
|
+
* @example
|
|
1711
|
+
* '''typescript
|
|
1712
|
+
* vertexPicker.config = {
|
|
1713
|
+
* snapDistance: 0.5,
|
|
1714
|
+
* showOnlyVertex: true,
|
|
1715
|
+
* };
|
|
1716
|
+
* '''
|
|
1717
|
+
*/
|
|
1718
|
+
set config(value: Partial<VertexPickerConfig>);
|
|
1719
|
+
/**
|
|
1720
|
+
* Gets the current configuration for the VertexPicker component.
|
|
1721
|
+
*
|
|
1722
|
+
* @returns A copy of the current VertexPickerConfig object.
|
|
1723
|
+
*
|
|
1724
|
+
* @example
|
|
1725
|
+
* '''typescript
|
|
1726
|
+
* const currentConfig = vertexPicker.config;
|
|
1727
|
+
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
1728
|
+
* '''
|
|
1729
|
+
*/
|
|
1730
|
+
get config(): Partial<VertexPickerConfig>;
|
|
1731
|
+
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
1732
|
+
/** {@link Disposable.dispose} */
|
|
1733
|
+
dispose(): void;
|
|
1734
|
+
/**
|
|
1735
|
+
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
1736
|
+
*
|
|
1737
|
+
* @param world - The World instance to use for raycasting.
|
|
1738
|
+
*
|
|
1739
|
+
* @returns The current picked point, or null if no point is picked.
|
|
1740
|
+
*
|
|
1741
|
+
* @remarks
|
|
1742
|
+
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
1743
|
+
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
1744
|
+
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
1745
|
+
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
1746
|
+
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
1747
|
+
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
1748
|
+
*/
|
|
1749
|
+
get(world: World): THREE.Vector3 | null;
|
|
1750
|
+
private getClosestVertex;
|
|
1751
|
+
private getVertices;
|
|
1752
|
+
private getVertex;
|
|
1753
|
+
}
|
|
1754
1754
|
import * as FRAGS from "@thatopen/fragments";
|
|
1755
1755
|
import { Components, Component } from "../../core";
|
|
1756
1756
|
/**
|
|
@@ -2210,10 +2210,6 @@ export interface IfcItemsCategories {
|
|
|
2210
2210
|
export declare class IfcCategories {
|
|
2211
2211
|
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
2212
2212
|
}
|
|
2213
|
-
/**
|
|
2214
|
-
* A Set of unique numbers representing different types of IFC geometries.
|
|
2215
|
-
*/
|
|
2216
|
-
export declare const GeometryTypes: Set<number>;
|
|
2217
2213
|
/**
|
|
2218
2214
|
* A map of IFC element types to their corresponding names. The keys are the IFC entity type numbers, and the values are the names of the IFC entities.
|
|
2219
2215
|
*
|
|
@@ -2225,6 +2221,12 @@ export declare const GeometryTypes: Set<number>;
|
|
|
2225
2221
|
export declare const IfcElements: {
|
|
2226
2222
|
[key: number]: string;
|
|
2227
2223
|
};
|
|
2224
|
+
/**
|
|
2225
|
+
* A map that associates each unique integer identifier (IFC Entity ID) with its corresponding category name. This map is used to map IFC entities to their respective categories for easier identification and processing.
|
|
2226
|
+
*/
|
|
2227
|
+
export declare const IfcCategoryMap: {
|
|
2228
|
+
[key: number]: string;
|
|
2229
|
+
};
|
|
2228
2230
|
import * as FRAGS from "@thatopen/fragments";
|
|
2229
2231
|
export declare class IfcPropertiesUtils {
|
|
2230
2232
|
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
@@ -2251,11 +2253,9 @@ export declare class IfcPropertiesUtils {
|
|
|
2251
2253
|
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2252
2254
|
}
|
|
2253
2255
|
/**
|
|
2254
|
-
* A
|
|
2256
|
+
* A Set of unique numbers representing different types of IFC geometries.
|
|
2255
2257
|
*/
|
|
2256
|
-
export declare const
|
|
2257
|
-
[key: number]: string;
|
|
2258
|
-
};
|
|
2258
|
+
export declare const GeometryTypes: Set<number>;
|
|
2259
2259
|
import * as THREE from "three";
|
|
2260
2260
|
import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
|
|
2261
2261
|
/**
|
|
@@ -2346,12 +2346,60 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
|
|
|
2346
2346
|
private updatePlanes;
|
|
2347
2347
|
}
|
|
2348
2348
|
import { InverseAttribute } from "./types";
|
|
2349
|
-
export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711, {
|
|
2349
|
+
export declare const relToAttributesMap: Map<160246688 | 2655215786 | 919958153 | 1307041759 | 4186316022 | 781010003 | 307848117 | 3242617779 | 279856033 | 1204542856 | 2857406711 | 2565941209 | 2495723537 | 3268803585, {
|
|
2350
2350
|
forRelating: InverseAttribute;
|
|
2351
2351
|
forRelated: InverseAttribute;
|
|
2352
2352
|
}>;
|
|
2353
|
-
import * as
|
|
2354
|
-
import
|
|
2353
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
2354
|
+
import * as WEBIFC from "web-ifc";
|
|
2355
|
+
export declare class SpatialIdsFinder {
|
|
2356
|
+
static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
|
|
2357
|
+
}
|
|
2358
|
+
import * as WEBIFC from "web-ifc";
|
|
2359
|
+
/** Configuration of the IFC-fragment conversion. */
|
|
2360
|
+
export declare class IfcFragmentSettings {
|
|
2361
|
+
/** Whether to extract the IFC properties into a JSON. */
|
|
2362
|
+
includeProperties: boolean;
|
|
2363
|
+
/**
|
|
2364
|
+
* Generate the geometry for categories that are not included by default,
|
|
2365
|
+
* like IFCSPACE.
|
|
2366
|
+
*/
|
|
2367
|
+
optionalCategories: number[];
|
|
2368
|
+
/** Whether to use the coordination data coming from the IFC files. */
|
|
2369
|
+
coordinate: boolean;
|
|
2370
|
+
/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2371
|
+
wasm: {
|
|
2372
|
+
path: string;
|
|
2373
|
+
absolute: boolean;
|
|
2374
|
+
logLevel?: WEBIFC.LogLevel;
|
|
2375
|
+
};
|
|
2376
|
+
/** List of categories that won't be converted to fragments. */
|
|
2377
|
+
excludedCategories: Set<number>;
|
|
2378
|
+
/** Exclusive list of categories that will be converted to fragments. If this contains any category, any other categories will be ignored. */
|
|
2379
|
+
includedCategories: Set<number>;
|
|
2380
|
+
/** Whether to save the absolute location of all IFC items. */
|
|
2381
|
+
saveLocations: boolean;
|
|
2382
|
+
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2383
|
+
webIfc: WEBIFC.LoaderSettings;
|
|
2384
|
+
/**
|
|
2385
|
+
* Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2386
|
+
* If set to true, the path will be set to the default path of the WASM file.
|
|
2387
|
+
* If set to false, the path must be provided manually in the 'wasm.path' property.
|
|
2388
|
+
* Default value is true.
|
|
2389
|
+
*/
|
|
2390
|
+
autoSetWasm: boolean;
|
|
2391
|
+
/**
|
|
2392
|
+
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2393
|
+
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
2394
|
+
* If set to null, the default file location handler will be used.
|
|
2395
|
+
*
|
|
2396
|
+
* @param url - The URL of the file to locate.
|
|
2397
|
+
* @returns The absolute path of the file.
|
|
2398
|
+
*/
|
|
2399
|
+
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2400
|
+
}
|
|
2401
|
+
import * as THREE from "three";
|
|
2402
|
+
import { Event, World } from "../../Types";
|
|
2355
2403
|
import { Components } from "../../Components";
|
|
2356
2404
|
/**
|
|
2357
2405
|
* A base renderer to determine visibility on screen.
|
|
@@ -2417,186 +2465,66 @@ export declare class DistanceRenderer {
|
|
|
2417
2465
|
compute: () => Promise<void>;
|
|
2418
2466
|
private handleWorkerMessage;
|
|
2419
2467
|
}
|
|
2420
|
-
import * as THREE from "three";
|
|
2421
|
-
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
2422
|
-
import { Components } from "../../Components";
|
|
2423
|
-
import { Event, World, Disposable } from "../../Types";
|
|
2424
|
-
/**
|
|
2425
|
-
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
2426
|
-
*/
|
|
2427
|
-
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
2428
|
-
/**
|
|
2429
|
-
* Event triggered when the visibility of meshes is updated.
|
|
2430
|
-
* Contains two sets: seen and unseen.
|
|
2431
|
-
*/
|
|
2432
|
-
readonly onViewUpdated: Event<{
|
|
2433
|
-
seen: Set<THREE.Mesh>;
|
|
2434
|
-
unseen: Set<THREE.Mesh>;
|
|
2435
|
-
}>;
|
|
2436
|
-
/**
|
|
2437
|
-
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
2438
|
-
* Default value is 100.
|
|
2439
|
-
*/
|
|
2440
|
-
threshold: number;
|
|
2441
|
-
/**
|
|
2442
|
-
* Map of color code to THREE.InstancedMesh.
|
|
2443
|
-
* Used to keep track of color-coded meshes.
|
|
2444
|
-
*/
|
|
2445
|
-
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
2446
|
-
/**
|
|
2447
|
-
* Flag to indicate if the renderer is currently processing.
|
|
2448
|
-
* Used to prevent concurrent processing.
|
|
2449
|
-
*/
|
|
2450
|
-
isProcessing: boolean;
|
|
2451
|
-
private _colorCodeMeshMap;
|
|
2452
|
-
private _meshIDColorCodeMap;
|
|
2453
|
-
private _currentVisibleMeshes;
|
|
2454
|
-
private _recentlyHiddenMeshes;
|
|
2455
|
-
private _intervalID;
|
|
2456
|
-
private readonly _transparentMat;
|
|
2457
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2458
|
-
/** {@link Disposable.dispose} */
|
|
2459
|
-
dispose(): void;
|
|
2460
|
-
/**
|
|
2461
|
-
* 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.
|
|
2462
|
-
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2463
|
-
* @returns {void}
|
|
2464
|
-
*/
|
|
2465
|
-
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2466
|
-
/**
|
|
2467
|
-
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2468
|
-
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2469
|
-
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2470
|
-
* @returns {void}
|
|
2471
|
-
*/
|
|
2472
|
-
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2473
|
-
/**
|
|
2474
|
-
* Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
|
|
2475
|
-
*
|
|
2476
|
-
* @param meshes - The meshes to update.
|
|
2477
|
-
*
|
|
2478
|
-
* @returns {void}
|
|
2479
|
-
*/
|
|
2480
|
-
updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
|
|
2481
|
-
private handleWorkerMessage;
|
|
2482
|
-
private getAvailableMaterial;
|
|
2483
|
-
}
|
|
2484
|
-
import * as THREE from "three";
|
|
2485
|
-
import { Components } from "../../Components";
|
|
2486
|
-
import { AsyncEvent, Event, World } from "../../Types";
|
|
2487
2468
|
/**
|
|
2488
|
-
*
|
|
2469
|
+
* 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.
|
|
2489
2470
|
*/
|
|
2490
|
-
export
|
|
2491
|
-
/**
|
|
2492
|
-
* Interval in milliseconds at which the visibility check should be performed.
|
|
2493
|
-
* Default value is 1000.
|
|
2494
|
-
*/
|
|
2495
|
-
updateInterval?: number;
|
|
2496
|
-
/**
|
|
2497
|
-
* Width of the render target used for visibility checks.
|
|
2498
|
-
* Default value is 512.
|
|
2499
|
-
*/
|
|
2500
|
-
width?: number;
|
|
2471
|
+
export declare class Event<T> {
|
|
2501
2472
|
/**
|
|
2502
|
-
*
|
|
2503
|
-
*
|
|
2473
|
+
* Add a callback to this event instance.
|
|
2474
|
+
* @param handler - the callback to be added to this event.
|
|
2504
2475
|
*/
|
|
2505
|
-
|
|
2476
|
+
add(handler: T extends void ? {
|
|
2477
|
+
(): void;
|
|
2478
|
+
} : {
|
|
2479
|
+
(data: T): void;
|
|
2480
|
+
}): void;
|
|
2506
2481
|
/**
|
|
2507
|
-
*
|
|
2508
|
-
*
|
|
2482
|
+
* Removes a callback from this event instance.
|
|
2483
|
+
* @param handler - the callback to be removed from this event.
|
|
2509
2484
|
*/
|
|
2510
|
-
|
|
2485
|
+
remove(handler: T extends void ? {
|
|
2486
|
+
(): void;
|
|
2487
|
+
} : {
|
|
2488
|
+
(data: T): void;
|
|
2489
|
+
}): void;
|
|
2490
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
2491
|
+
trigger: (data?: T) => void;
|
|
2492
|
+
/** Gets rid of all the suscribed events. */
|
|
2493
|
+
reset(): void;
|
|
2494
|
+
private handlers;
|
|
2511
2495
|
}
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
* Fires after making the visibility check to the meshes. It lists the
|
|
2520
|
-
* meshes that are currently visible, and the ones that were visible
|
|
2521
|
-
* just before but not anymore.
|
|
2522
|
-
*/
|
|
2523
|
-
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
2524
|
-
/**
|
|
2525
|
-
* Whether this renderer is active or not. If not, it won't render anything.
|
|
2526
|
-
*/
|
|
2527
|
-
enabled: boolean;
|
|
2528
|
-
/**
|
|
2529
|
-
* Needs to check whether there are objects that need to be hidden or shown.
|
|
2530
|
-
* You can bind this to the camera movement, to a certain interval, etc.
|
|
2531
|
-
*/
|
|
2532
|
-
needsUpdate: boolean;
|
|
2533
|
-
/**
|
|
2534
|
-
* Render the internal scene used to determine the object visibility. Used
|
|
2535
|
-
* for debugging purposes.
|
|
2536
|
-
*/
|
|
2537
|
-
renderDebugFrame: boolean;
|
|
2538
|
-
/** The components instance to which this renderer belongs. */
|
|
2539
|
-
components: Components;
|
|
2540
|
-
/** The world instance to which this renderer belongs. */
|
|
2541
|
-
readonly world: World;
|
|
2542
|
-
/** The THREE.js renderer used to make the visibility test. */
|
|
2543
|
-
readonly renderer: THREE.WebGLRenderer;
|
|
2544
|
-
protected autoUpdate: boolean;
|
|
2545
|
-
protected updateInterval: number;
|
|
2546
|
-
protected readonly worker: Worker;
|
|
2547
|
-
protected readonly scene: THREE.Scene;
|
|
2548
|
-
private _width;
|
|
2549
|
-
private _height;
|
|
2550
|
-
private _availableColor;
|
|
2551
|
-
private readonly renderTarget;
|
|
2552
|
-
private readonly bufferSize;
|
|
2553
|
-
private readonly _buffer;
|
|
2554
|
-
protected _isWorkerBusy: boolean;
|
|
2555
|
-
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
2556
|
-
/** {@link Disposable.dispose} */
|
|
2557
|
-
dispose(): void;
|
|
2558
|
-
/**
|
|
2559
|
-
* The function that the culler uses to reprocess the scene. Generally it's
|
|
2560
|
-
* better to call needsUpdate, but you can also call this to force it.
|
|
2561
|
-
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
2562
|
-
* not true.
|
|
2563
|
-
*/
|
|
2564
|
-
updateVisibility: (force?: boolean) => Promise<void>;
|
|
2565
|
-
protected getAvailableColor(): {
|
|
2566
|
-
r: number;
|
|
2567
|
-
g: number;
|
|
2568
|
-
b: number;
|
|
2569
|
-
code: string;
|
|
2570
|
-
};
|
|
2571
|
-
protected increaseColor(): void;
|
|
2572
|
-
protected decreaseColor(): void;
|
|
2573
|
-
private applySettings;
|
|
2496
|
+
import * as WEBIFC from "web-ifc";
|
|
2497
|
+
import { IfcItemsCategories } from "../../../ifc";
|
|
2498
|
+
export declare class SpatialStructure {
|
|
2499
|
+
itemsByFloor: IfcItemsCategories;
|
|
2500
|
+
private _units;
|
|
2501
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2502
|
+
cleanUp(): void;
|
|
2574
2503
|
}
|
|
2575
|
-
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2576
2504
|
/**
|
|
2577
2505
|
* 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.
|
|
2578
2506
|
*/
|
|
2579
|
-
export declare class
|
|
2507
|
+
export declare class AsyncEvent<T> {
|
|
2580
2508
|
/**
|
|
2581
2509
|
* Add a callback to this event instance.
|
|
2582
2510
|
* @param handler - the callback to be added to this event.
|
|
2583
2511
|
*/
|
|
2584
2512
|
add(handler: T extends void ? {
|
|
2585
|
-
(): void
|
|
2513
|
+
(): Promise<void>;
|
|
2586
2514
|
} : {
|
|
2587
|
-
(data: T): void
|
|
2515
|
+
(data: T): Promise<void>;
|
|
2588
2516
|
}): void;
|
|
2589
2517
|
/**
|
|
2590
2518
|
* Removes a callback from this event instance.
|
|
2591
2519
|
* @param handler - the callback to be removed from this event.
|
|
2592
2520
|
*/
|
|
2593
2521
|
remove(handler: T extends void ? {
|
|
2594
|
-
(): void
|
|
2522
|
+
(): Promise<void>;
|
|
2595
2523
|
} : {
|
|
2596
|
-
(data: T): void
|
|
2524
|
+
(data: T): Promise<void>;
|
|
2597
2525
|
}): void;
|
|
2598
2526
|
/** Triggers all the callbacks assigned to this event. */
|
|
2599
|
-
trigger: (data?: T) => void
|
|
2527
|
+
trigger: (data?: T) => Promise<void>;
|
|
2600
2528
|
/** Gets rid of all the suscribed events. */
|
|
2601
2529
|
reset(): void;
|
|
2602
2530
|
private handlers;
|
|
@@ -2722,90 +2650,6 @@ export declare abstract class Component extends Base {
|
|
|
2722
2650
|
*/
|
|
2723
2651
|
abstract enabled: boolean;
|
|
2724
2652
|
}
|
|
2725
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
2726
|
-
import * as WEBIFC from "web-ifc";
|
|
2727
|
-
export declare class SpatialIdsFinder {
|
|
2728
|
-
static get(model: FRAGS.FragmentsGroup, webIfc: WEBIFC.IfcAPI): void;
|
|
2729
|
-
}
|
|
2730
|
-
import * as WEBIFC from "web-ifc";
|
|
2731
|
-
import { IfcItemsCategories } from "../../../ifc";
|
|
2732
|
-
export declare class SpatialStructure {
|
|
2733
|
-
itemsByFloor: IfcItemsCategories;
|
|
2734
|
-
private _units;
|
|
2735
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2736
|
-
cleanUp(): void;
|
|
2737
|
-
}
|
|
2738
|
-
import * as WEBIFC from "web-ifc";
|
|
2739
|
-
/** Configuration of the IFC-fragment conversion. */
|
|
2740
|
-
export declare class IfcFragmentSettings {
|
|
2741
|
-
/** Whether to extract the IFC properties into a JSON. */
|
|
2742
|
-
includeProperties: boolean;
|
|
2743
|
-
/**
|
|
2744
|
-
* Generate the geometry for categories that are not included by default,
|
|
2745
|
-
* like IFCSPACE.
|
|
2746
|
-
*/
|
|
2747
|
-
optionalCategories: number[];
|
|
2748
|
-
/** Whether to use the coordination data coming from the IFC files. */
|
|
2749
|
-
coordinate: boolean;
|
|
2750
|
-
/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2751
|
-
wasm: {
|
|
2752
|
-
path: string;
|
|
2753
|
-
absolute: boolean;
|
|
2754
|
-
logLevel?: WEBIFC.LogLevel;
|
|
2755
|
-
};
|
|
2756
|
-
/** List of categories that won't be converted to fragments. */
|
|
2757
|
-
excludedCategories: Set<number>;
|
|
2758
|
-
/** Exclusive list of categories that will be converted to fragments. If this contains any category, any other categories will be ignored. */
|
|
2759
|
-
includedCategories: Set<number>;
|
|
2760
|
-
/** Whether to save the absolute location of all IFC items. */
|
|
2761
|
-
saveLocations: boolean;
|
|
2762
|
-
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
2763
|
-
webIfc: WEBIFC.LoaderSettings;
|
|
2764
|
-
/**
|
|
2765
|
-
* Whether to automatically set the path to the WASM file for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2766
|
-
* If set to true, the path will be set to the default path of the WASM file.
|
|
2767
|
-
* If set to false, the path must be provided manually in the 'wasm.path' property.
|
|
2768
|
-
* Default value is true.
|
|
2769
|
-
*/
|
|
2770
|
-
autoSetWasm: boolean;
|
|
2771
|
-
/**
|
|
2772
|
-
* Custom function to handle the file location for [web-ifc](https://github.com/ThatOpen/engine_web-ifc).
|
|
2773
|
-
* This function will be called when [web-ifc](https://github.com/ThatOpen/engine_web-ifc) needs to locate a file.
|
|
2774
|
-
* If set to null, the default file location handler will be used.
|
|
2775
|
-
*
|
|
2776
|
-
* @param url - The URL of the file to locate.
|
|
2777
|
-
* @returns The absolute path of the file.
|
|
2778
|
-
*/
|
|
2779
|
-
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2780
|
-
}
|
|
2781
|
-
/**
|
|
2782
|
-
* 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.
|
|
2783
|
-
*/
|
|
2784
|
-
export declare class AsyncEvent<T> {
|
|
2785
|
-
/**
|
|
2786
|
-
* Add a callback to this event instance.
|
|
2787
|
-
* @param handler - the callback to be added to this event.
|
|
2788
|
-
*/
|
|
2789
|
-
add(handler: T extends void ? {
|
|
2790
|
-
(): Promise<void>;
|
|
2791
|
-
} : {
|
|
2792
|
-
(data: T): Promise<void>;
|
|
2793
|
-
}): void;
|
|
2794
|
-
/**
|
|
2795
|
-
* Removes a callback from this event instance.
|
|
2796
|
-
* @param handler - the callback to be removed from this event.
|
|
2797
|
-
*/
|
|
2798
|
-
remove(handler: T extends void ? {
|
|
2799
|
-
(): Promise<void>;
|
|
2800
|
-
} : {
|
|
2801
|
-
(data: T): Promise<void>;
|
|
2802
|
-
}): void;
|
|
2803
|
-
/** Triggers all the callbacks assigned to this event. */
|
|
2804
|
-
trigger: (data?: T) => Promise<void>;
|
|
2805
|
-
/** Gets rid of all the suscribed events. */
|
|
2806
|
-
reset(): void;
|
|
2807
|
-
private handlers;
|
|
2808
|
-
}
|
|
2809
2653
|
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
2810
2654
|
import { Components } from "../../Components";
|
|
2811
2655
|
/**
|
|
@@ -2849,6 +2693,34 @@ export declare abstract class BaseWorldItem extends Base {
|
|
|
2849
2693
|
protected constructor(components: Components);
|
|
2850
2694
|
}
|
|
2851
2695
|
import * as THREE from "three";
|
|
2696
|
+
import CameraControls from "camera-controls";
|
|
2697
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
2698
|
+
import { CameraControllable } from "./interfaces";
|
|
2699
|
+
/**
|
|
2700
|
+
* Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
|
|
2701
|
+
*/
|
|
2702
|
+
export declare abstract class BaseCamera extends BaseWorldItem {
|
|
2703
|
+
/**
|
|
2704
|
+
* Whether the camera is enabled or not.
|
|
2705
|
+
*/
|
|
2706
|
+
abstract enabled: boolean;
|
|
2707
|
+
/**
|
|
2708
|
+
* The Three.js camera instance.
|
|
2709
|
+
*/
|
|
2710
|
+
abstract three: THREE.Camera;
|
|
2711
|
+
/**
|
|
2712
|
+
* Optional CameraControls instance for controlling the camera.
|
|
2713
|
+
* This property is only available if the camera is controllable.
|
|
2714
|
+
*/
|
|
2715
|
+
abstract controls?: CameraControls;
|
|
2716
|
+
/**
|
|
2717
|
+
* Checks whether the instance is {@link CameraControllable}.
|
|
2718
|
+
*
|
|
2719
|
+
* @returns True if the instance is controllable, false otherwise.
|
|
2720
|
+
*/
|
|
2721
|
+
hasCameraControls: () => this is CameraControllable;
|
|
2722
|
+
}
|
|
2723
|
+
import * as THREE from "three";
|
|
2852
2724
|
import { Vector2 } from "three";
|
|
2853
2725
|
import { Event } from "./event";
|
|
2854
2726
|
import { BaseWorldItem } from "./base-world-item";
|
|
@@ -2937,50 +2809,6 @@ export declare abstract class BaseScene extends BaseWorldItem implements Disposa
|
|
|
2937
2809
|
/** {@link Disposable.dispose} */
|
|
2938
2810
|
dispose(): void;
|
|
2939
2811
|
}
|
|
2940
|
-
import { NavigationMode } from "./types";
|
|
2941
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
2942
|
-
/**
|
|
2943
|
-
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
2944
|
-
*/
|
|
2945
|
-
export declare class FirstPersonMode implements NavigationMode {
|
|
2946
|
-
private camera;
|
|
2947
|
-
/** {@link NavigationMode.enabled} */
|
|
2948
|
-
enabled: boolean;
|
|
2949
|
-
/** {@link NavigationMode.id} */
|
|
2950
|
-
readonly id = "FirstPerson";
|
|
2951
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
2952
|
-
/** {@link NavigationMode.set} */
|
|
2953
|
-
set(active: boolean): void;
|
|
2954
|
-
private setupFirstPersonCamera;
|
|
2955
|
-
}
|
|
2956
|
-
import * as THREE from "three";
|
|
2957
|
-
import CameraControls from "camera-controls";
|
|
2958
|
-
import { BaseWorldItem } from "./base-world-item";
|
|
2959
|
-
import { CameraControllable } from "./interfaces";
|
|
2960
|
-
/**
|
|
2961
|
-
* Abstract class representing a camera in a 3D world. All cameras should use this class as a base.
|
|
2962
|
-
*/
|
|
2963
|
-
export declare abstract class BaseCamera extends BaseWorldItem {
|
|
2964
|
-
/**
|
|
2965
|
-
* Whether the camera is enabled or not.
|
|
2966
|
-
*/
|
|
2967
|
-
abstract enabled: boolean;
|
|
2968
|
-
/**
|
|
2969
|
-
* The Three.js camera instance.
|
|
2970
|
-
*/
|
|
2971
|
-
abstract three: THREE.Camera;
|
|
2972
|
-
/**
|
|
2973
|
-
* Optional CameraControls instance for controlling the camera.
|
|
2974
|
-
* This property is only available if the camera is controllable.
|
|
2975
|
-
*/
|
|
2976
|
-
abstract controls?: CameraControls;
|
|
2977
|
-
/**
|
|
2978
|
-
* Checks whether the instance is {@link CameraControllable}.
|
|
2979
|
-
*
|
|
2980
|
-
* @returns True if the instance is controllable, false otherwise.
|
|
2981
|
-
*/
|
|
2982
|
-
hasCameraControls: () => this is CameraControllable;
|
|
2983
|
-
}
|
|
2984
2812
|
import * as THREE from "three";
|
|
2985
2813
|
import { BaseScene } from "./base-scene";
|
|
2986
2814
|
import { BaseCamera } from "./base-camera";
|
|
@@ -3016,6 +2844,55 @@ export interface World extends Disposable, Updateable {
|
|
|
3016
2844
|
isDisposing: boolean;
|
|
3017
2845
|
}
|
|
3018
2846
|
import { Event } from "./event";
|
|
2847
|
+
/**
|
|
2848
|
+
* A class that extends the built-in Set class and provides additional functionality.
|
|
2849
|
+
* It triggers events when items are added, deleted, or the set is cleared.
|
|
2850
|
+
*
|
|
2851
|
+
* @template T - The type of elements in the set.
|
|
2852
|
+
*/
|
|
2853
|
+
export declare class DataSet<T> extends Set<T> {
|
|
2854
|
+
/**
|
|
2855
|
+
* An event that is triggered when a new item is added to the set.
|
|
2856
|
+
*/
|
|
2857
|
+
readonly onItemAdded: Event<T>;
|
|
2858
|
+
/**
|
|
2859
|
+
* An event that is triggered when an item is deleted from the set.
|
|
2860
|
+
*/
|
|
2861
|
+
readonly onItemDeleted: Event<unknown>;
|
|
2862
|
+
/**
|
|
2863
|
+
* An event that is triggered when the set is cleared.
|
|
2864
|
+
*/
|
|
2865
|
+
readonly onCleared: Event<unknown>;
|
|
2866
|
+
/**
|
|
2867
|
+
* Constructs a new instance of the DataSet class.
|
|
2868
|
+
*
|
|
2869
|
+
* @param iterable - An optional iterable object to initialize the set with.
|
|
2870
|
+
*/
|
|
2871
|
+
constructor(iterable?: Iterable<T> | null);
|
|
2872
|
+
/**
|
|
2873
|
+
* Clears the set and triggers the onCleared event.
|
|
2874
|
+
*/
|
|
2875
|
+
clear(): void;
|
|
2876
|
+
/**
|
|
2877
|
+
* Adds a value to the set and triggers the onItemAdded event.
|
|
2878
|
+
*
|
|
2879
|
+
* @param value - The value to add to the set.
|
|
2880
|
+
* @returns - The set instance.
|
|
2881
|
+
*/
|
|
2882
|
+
add(value: T): this;
|
|
2883
|
+
/**
|
|
2884
|
+
* Deletes a value from the set and triggers the onItemDeleted event.
|
|
2885
|
+
*
|
|
2886
|
+
* @param value - The value to delete from the set.
|
|
2887
|
+
* @returns - True if the value was successfully deleted, false otherwise.
|
|
2888
|
+
*/
|
|
2889
|
+
delete(value: T): boolean;
|
|
2890
|
+
/**
|
|
2891
|
+
* Clears the set and resets the onItemAdded, onItemDeleted, and onCleared events.
|
|
2892
|
+
*/
|
|
2893
|
+
dispose(): void;
|
|
2894
|
+
}
|
|
2895
|
+
import { Event } from "./event";
|
|
3019
2896
|
/**
|
|
3020
2897
|
* A class that extends the built-in Map class and provides additional events for item set, update, delete, and clear operations.
|
|
3021
2898
|
*
|
|
@@ -3075,90 +2952,486 @@ export declare class DataMap<K, V> extends Map<K, V> {
|
|
|
3075
2952
|
*/
|
|
3076
2953
|
dispose(): void;
|
|
3077
2954
|
}
|
|
3078
|
-
import
|
|
2955
|
+
import * as THREE from "three";
|
|
2956
|
+
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
3079
2957
|
/**
|
|
3080
|
-
* A class
|
|
3081
|
-
* It triggers events when items are added, deleted, or the set is cleared.
|
|
2958
|
+
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
3082
2959
|
*
|
|
3083
|
-
* @template T - The type of
|
|
2960
|
+
* @template T - The type of the scene. Default is BaseScene.
|
|
2961
|
+
* @template U - The type of the camera. Default is BaseCamera.
|
|
2962
|
+
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
3084
2963
|
*/
|
|
3085
|
-
export declare class
|
|
2964
|
+
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
|
|
3086
2965
|
/**
|
|
3087
|
-
*
|
|
2966
|
+
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
3088
2967
|
*/
|
|
3089
|
-
readonly
|
|
2968
|
+
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
2969
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2970
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
2971
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2972
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
2973
|
+
/** {@link Disposable.onDisposed} */
|
|
2974
|
+
readonly onDisposed: Event<unknown>;
|
|
3090
2975
|
/**
|
|
3091
|
-
*
|
|
2976
|
+
* 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.
|
|
3092
2977
|
*/
|
|
3093
|
-
|
|
2978
|
+
isDisposing: boolean;
|
|
3094
2979
|
/**
|
|
3095
|
-
*
|
|
2980
|
+
* Indicates whether the world is currently enabled.
|
|
2981
|
+
* When disabled, the world will not be updated.
|
|
3096
2982
|
*/
|
|
3097
|
-
|
|
2983
|
+
enabled: boolean;
|
|
3098
2984
|
/**
|
|
3099
|
-
*
|
|
3100
|
-
*
|
|
3101
|
-
* @param iterable - An optional iterable object to initialize the set with.
|
|
2985
|
+
* A unique identifier for the world.
|
|
3102
2986
|
*/
|
|
3103
|
-
|
|
2987
|
+
uuid: string;
|
|
3104
2988
|
/**
|
|
3105
|
-
*
|
|
2989
|
+
* An optional name for the world.
|
|
3106
2990
|
*/
|
|
3107
|
-
|
|
2991
|
+
name?: string;
|
|
2992
|
+
private _scene?;
|
|
2993
|
+
private _camera?;
|
|
2994
|
+
private _renderer;
|
|
3108
2995
|
/**
|
|
3109
|
-
*
|
|
3110
|
-
*
|
|
3111
|
-
* @param value - The value to add to the set.
|
|
3112
|
-
* @returns - The set instance.
|
|
2996
|
+
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
2997
|
+
* @returns The current scene.
|
|
3113
2998
|
*/
|
|
3114
|
-
|
|
2999
|
+
get scene(): T;
|
|
3115
3000
|
/**
|
|
3116
|
-
*
|
|
3117
|
-
*
|
|
3118
|
-
* @param
|
|
3119
|
-
* @returns - True if the value was successfully deleted, false otherwise.
|
|
3001
|
+
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
3002
|
+
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
3003
|
+
* @param scene - The new scene to be set.
|
|
3120
3004
|
*/
|
|
3121
|
-
|
|
3005
|
+
set scene(scene: T);
|
|
3122
3006
|
/**
|
|
3123
|
-
*
|
|
3007
|
+
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
3008
|
+
* @returns The current camera.
|
|
3124
3009
|
*/
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3010
|
+
get camera(): U;
|
|
3011
|
+
/**
|
|
3012
|
+
* Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
|
|
3013
|
+
* sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
|
|
3014
|
+
* @param camera - The new camera to be set.
|
|
3015
|
+
*/
|
|
3016
|
+
set camera(camera: U);
|
|
3017
|
+
/**
|
|
3018
|
+
* Getter for the renderer.
|
|
3019
|
+
* @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).
|
|
3020
|
+
*/
|
|
3021
|
+
get renderer(): S | null;
|
|
3022
|
+
/**
|
|
3023
|
+
* Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
|
|
3024
|
+
* sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
|
|
3025
|
+
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
3026
|
+
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
3027
|
+
*/
|
|
3028
|
+
set renderer(renderer: S | null);
|
|
3029
|
+
/** {@link Updateable.update} */
|
|
3030
|
+
update(delta?: number): void;
|
|
3031
|
+
/** {@link Disposable.dispose} */
|
|
3032
|
+
dispose(disposeResources?: boolean): void;
|
|
3033
|
+
}
|
|
3034
|
+
import * as THREE from "three";
|
|
3035
|
+
import { BaseScene, Configurable, Event } from "../../Types";
|
|
3036
|
+
import { Components } from "../../Components";
|
|
3037
|
+
/**
|
|
3038
|
+
* Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
|
|
3039
|
+
*/
|
|
3040
|
+
export interface SimpleSceneConfig {
|
|
3041
|
+
directionalLight: {
|
|
3042
|
+
color: THREE.Color;
|
|
3043
|
+
intensity: number;
|
|
3044
|
+
position: THREE.Vector3;
|
|
3045
|
+
};
|
|
3046
|
+
ambientLight: {
|
|
3047
|
+
color: THREE.Color;
|
|
3048
|
+
intensity: number;
|
|
3049
|
+
};
|
|
3050
|
+
}
|
|
3051
|
+
/**
|
|
3052
|
+
* 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.
|
|
3053
|
+
*/
|
|
3054
|
+
export declare class SimpleScene extends BaseScene implements Configurable<{}> {
|
|
3055
|
+
/** {@link Configurable.isSetup} */
|
|
3056
|
+
isSetup: boolean;
|
|
3057
|
+
/**
|
|
3058
|
+
* The underlying Three.js scene object.
|
|
3059
|
+
* It is used to define the 3D space containing objects, lights, and cameras.
|
|
3060
|
+
*/
|
|
3061
|
+
three: THREE.Scene;
|
|
3062
|
+
/** {@link Configurable.onSetup} */
|
|
3063
|
+
readonly onSetup: Event<SimpleScene>;
|
|
3064
|
+
/**
|
|
3065
|
+
* Configuration interface for the {@link SimpleScene}.
|
|
3066
|
+
* Defines properties for directional and ambient lights.
|
|
3067
|
+
*/
|
|
3068
|
+
config: Required<SimpleSceneConfig>;
|
|
3069
|
+
constructor(components: Components);
|
|
3070
|
+
/** {@link Configurable.setup} */
|
|
3071
|
+
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
3072
|
+
}
|
|
3073
|
+
import * as THREE from "three";
|
|
3074
|
+
import { BaseRenderer, Event } from "../../Types";
|
|
3075
|
+
import { Components } from "../../Components";
|
|
3076
|
+
/**
|
|
3077
|
+
* A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
|
|
3078
|
+
*/
|
|
3079
|
+
export declare class SimpleRenderer extends BaseRenderer {
|
|
3080
|
+
/**
|
|
3081
|
+
* Indicates whether the renderer is enabled. If it's not, it won't be updated.
|
|
3082
|
+
* Default is 'true'.
|
|
3083
|
+
*/
|
|
3084
|
+
enabled: boolean;
|
|
3085
|
+
/**
|
|
3086
|
+
* The HTML container of the THREE.js canvas where the scene is rendered.
|
|
3087
|
+
*/
|
|
3088
|
+
container: HTMLElement;
|
|
3089
|
+
/**
|
|
3090
|
+
* The THREE.js WebGLRenderer instance.
|
|
3091
|
+
*/
|
|
3092
|
+
three: THREE.WebGLRenderer;
|
|
3093
|
+
protected _canvas: HTMLCanvasElement;
|
|
3094
|
+
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
3095
|
+
protected _resizeObserver: ResizeObserver | null;
|
|
3096
|
+
protected onContainerUpdated: Event<unknown>;
|
|
3097
|
+
private _resizing;
|
|
3098
|
+
/**
|
|
3099
|
+
* Constructor for the SimpleRenderer class.
|
|
3100
|
+
*
|
|
3101
|
+
* @param components - The components instance.
|
|
3102
|
+
* @param container - The HTML container where the THREE.js canvas will be rendered.
|
|
3103
|
+
* @param parameters - Optional parameters for the THREE.js WebGLRenderer.
|
|
3104
|
+
*/
|
|
3105
|
+
constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
|
|
3106
|
+
/** {@link Updateable.update} */
|
|
3107
|
+
update(): void;
|
|
3108
|
+
/** {@link Disposable.dispose} */
|
|
3109
|
+
dispose(): void;
|
|
3110
|
+
/** {@link Resizeable.getSize}. */
|
|
3111
|
+
getSize(): THREE.Vector2;
|
|
3112
|
+
/** {@link Resizeable.resize} */
|
|
3113
|
+
resize: (size?: THREE.Vector2) => void;
|
|
3114
|
+
/**
|
|
3115
|
+
* Sets up and manages the event listeners for the renderer.
|
|
3116
|
+
*
|
|
3117
|
+
* @param active - A boolean indicating whether to activate or deactivate the event listeners.
|
|
3118
|
+
*
|
|
3119
|
+
* @throws Will throw an error if the renderer does not have an HTML container.
|
|
3120
|
+
*/
|
|
3121
|
+
setupEvents(active: boolean): void;
|
|
3122
|
+
private resizeEvent;
|
|
3123
|
+
private setupRenderer;
|
|
3124
|
+
private onContextLost;
|
|
3125
|
+
private onContextBack;
|
|
3126
|
+
}
|
|
3127
|
+
import * as THREE from "three";
|
|
3128
|
+
import CameraControls from "camera-controls";
|
|
3129
|
+
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
3130
|
+
import { Components } from "../../Components";
|
|
3131
|
+
/**
|
|
3132
|
+
* 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.
|
|
3133
|
+
*/
|
|
3134
|
+
export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
|
|
3135
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
3136
|
+
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
3137
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
3138
|
+
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
3139
|
+
/**
|
|
3140
|
+
* Event that is triggered when the aspect of the camera has been updated.
|
|
3141
|
+
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
3142
|
+
*/
|
|
3143
|
+
readonly onAspectUpdated: Event<unknown>;
|
|
3144
|
+
/** {@link Disposable.onDisposed} */
|
|
3145
|
+
readonly onDisposed: Event<string>;
|
|
3146
|
+
/**
|
|
3147
|
+
* A three.js PerspectiveCamera or OrthographicCamera instance.
|
|
3148
|
+
* This camera is used for rendering the scene.
|
|
3149
|
+
*/
|
|
3150
|
+
three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3151
|
+
private _allControls;
|
|
3152
|
+
/**
|
|
3153
|
+
* The object that controls the camera. An instance of
|
|
3154
|
+
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
3155
|
+
* Transforming the camera directly will have no effect: you need to use this
|
|
3156
|
+
* object to move, rotate, look at objects, etc.
|
|
3157
|
+
*/
|
|
3158
|
+
get controls(): CameraControls;
|
|
3159
|
+
/**
|
|
3160
|
+
* Getter for the enabled state of the camera controls.
|
|
3161
|
+
* If the current world is null, it returns false.
|
|
3162
|
+
* Otherwise, it returns the enabled state of the camera controls.
|
|
3163
|
+
*
|
|
3164
|
+
* @returns {boolean} The enabled state of the camera controls.
|
|
3165
|
+
*/
|
|
3166
|
+
get enabled(): boolean;
|
|
3167
|
+
/**
|
|
3168
|
+
* Setter for the enabled state of the camera controls.
|
|
3169
|
+
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
3170
|
+
*
|
|
3171
|
+
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
3172
|
+
*/
|
|
3173
|
+
set enabled(enabled: boolean);
|
|
3174
|
+
constructor(components: Components);
|
|
3175
|
+
/** {@link Disposable.dispose} */
|
|
3176
|
+
dispose(): void;
|
|
3177
|
+
/** {@link Updateable.update} */
|
|
3178
|
+
update(_delta: number): void;
|
|
3179
|
+
/**
|
|
3180
|
+
* Updates the aspect of the camera to match the size of the
|
|
3181
|
+
* {@link Components.renderer}.
|
|
3182
|
+
*/
|
|
3183
|
+
updateAspect: () => void;
|
|
3184
|
+
private setupCamera;
|
|
3185
|
+
private newCameraControls;
|
|
3186
|
+
private setupEvents;
|
|
3187
|
+
private static getSubsetOfThree;
|
|
3188
|
+
}
|
|
3189
|
+
import * as THREE from "three";
|
|
3190
|
+
import { Disposable, Event } from "../../Types";
|
|
3191
|
+
/**
|
|
3192
|
+
* 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.
|
|
3193
|
+
*/
|
|
3194
|
+
export declare class Mouse implements Disposable {
|
|
3195
|
+
dom: HTMLCanvasElement;
|
|
3196
|
+
private _event?;
|
|
3197
|
+
private _position;
|
|
3198
|
+
/** {@link Disposable.onDisposed} */
|
|
3199
|
+
readonly onDisposed: Event<unknown>;
|
|
3200
|
+
constructor(dom: HTMLCanvasElement);
|
|
3201
|
+
/**
|
|
3202
|
+
* The real position of the mouse of the Three.js canvas.
|
|
3203
|
+
*/
|
|
3204
|
+
get position(): THREE.Vector2;
|
|
3205
|
+
/** {@link Disposable.dispose} */
|
|
3206
|
+
dispose(): void;
|
|
3207
|
+
private getPositionY;
|
|
3208
|
+
private getPositionX;
|
|
3209
|
+
private updateMouseInfo;
|
|
3210
|
+
private setupEvents;
|
|
3211
|
+
}
|
|
3212
|
+
import * as THREE from "three";
|
|
3213
|
+
import { Components } from "../../Components";
|
|
3214
|
+
import { Event, World, Disposable } from "../../Types";
|
|
3215
|
+
import { Mouse } from "./mouse";
|
|
3216
|
+
/**
|
|
3217
|
+
* 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.
|
|
3218
|
+
*/
|
|
3219
|
+
export declare class SimpleRaycaster implements Disposable {
|
|
3220
|
+
/** {@link Component.enabled} */
|
|
3221
|
+
enabled: boolean;
|
|
3222
|
+
/** The components instance to which this Raycaster belongs. */
|
|
3223
|
+
components: Components;
|
|
3224
|
+
/** {@link Disposable.onDisposed} */
|
|
3225
|
+
readonly onDisposed: Event<unknown>;
|
|
3226
|
+
/** The position of the mouse in the screen. */
|
|
3227
|
+
readonly mouse: Mouse;
|
|
3228
|
+
/**
|
|
3229
|
+
* A reference to the Three.js Raycaster instance.
|
|
3230
|
+
* This is used for raycasting operations.
|
|
3231
|
+
*/
|
|
3232
|
+
readonly three: THREE.Raycaster;
|
|
3233
|
+
/**
|
|
3234
|
+
* A reference to the world instance to which this Raycaster belongs.
|
|
3235
|
+
* This is used to access the camera and meshes.
|
|
3236
|
+
*/
|
|
3237
|
+
world: World;
|
|
3238
|
+
constructor(components: Components, world: World);
|
|
3239
|
+
/** {@link Disposable.dispose} */
|
|
3240
|
+
dispose(): void;
|
|
3241
|
+
/**
|
|
3242
|
+
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
3243
|
+
* the first item found. This also takes into account the clipping planes
|
|
3244
|
+
* used by the renderer.
|
|
3245
|
+
*
|
|
3246
|
+
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
3247
|
+
* to query. If not provided, it will query all the meshes stored in
|
|
3248
|
+
* {@link Components.meshes}.
|
|
3249
|
+
*/
|
|
3250
|
+
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
3251
|
+
/**
|
|
3252
|
+
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
3253
|
+
* This method also takes into account the clipping planes used by the renderer.
|
|
3254
|
+
*
|
|
3255
|
+
* @param origin - The origin of the ray.
|
|
3256
|
+
* @param direction - The direction of the ray.
|
|
3257
|
+
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3258
|
+
* @returns The first intersection found or 'null' if no intersection was found.
|
|
3259
|
+
*/
|
|
3260
|
+
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;
|
|
3261
|
+
private intersect;
|
|
3262
|
+
private filterClippingPlanes;
|
|
3263
|
+
}
|
|
3264
|
+
import * as THREE from "three";
|
|
3265
|
+
import { Components } from "../../Components";
|
|
3266
|
+
import { AsyncEvent, Event, World } from "../../Types";
|
|
3267
|
+
/**
|
|
3268
|
+
* Settings to configure the CullerRenderer.
|
|
3269
|
+
*/
|
|
3270
|
+
export interface CullerRendererSettings {
|
|
3271
|
+
/**
|
|
3272
|
+
* Interval in milliseconds at which the visibility check should be performed.
|
|
3273
|
+
* Default value is 1000.
|
|
3274
|
+
*/
|
|
3275
|
+
updateInterval?: number;
|
|
3276
|
+
/**
|
|
3277
|
+
* Width of the render target used for visibility checks.
|
|
3278
|
+
* Default value is 512.
|
|
3279
|
+
*/
|
|
3280
|
+
width?: number;
|
|
3281
|
+
/**
|
|
3282
|
+
* Height of the render target used for visibility checks.
|
|
3283
|
+
* Default value is 512.
|
|
3284
|
+
*/
|
|
3285
|
+
height?: number;
|
|
3286
|
+
/**
|
|
3287
|
+
* Whether the visibility check should be performed automatically.
|
|
3288
|
+
* Default value is true.
|
|
3289
|
+
*/
|
|
3290
|
+
autoUpdate?: boolean;
|
|
3291
|
+
}
|
|
3292
|
+
/**
|
|
3293
|
+
* A base renderer to determine visibility on screen.
|
|
3294
|
+
*/
|
|
3295
|
+
export declare class CullerRenderer {
|
|
3296
|
+
/** {@link Disposable.onDisposed} */
|
|
3297
|
+
readonly onDisposed: Event<string>;
|
|
3298
|
+
/**
|
|
3299
|
+
* Fires after making the visibility check to the meshes. It lists the
|
|
3300
|
+
* meshes that are currently visible, and the ones that were visible
|
|
3301
|
+
* just before but not anymore.
|
|
3302
|
+
*/
|
|
3303
|
+
readonly onViewUpdated: Event<any> | AsyncEvent<any>;
|
|
3304
|
+
/**
|
|
3305
|
+
* Whether this renderer is active or not. If not, it won't render anything.
|
|
3306
|
+
*/
|
|
3307
|
+
enabled: boolean;
|
|
3308
|
+
/**
|
|
3309
|
+
* Needs to check whether there are objects that need to be hidden or shown.
|
|
3310
|
+
* You can bind this to the camera movement, to a certain interval, etc.
|
|
3311
|
+
*/
|
|
3312
|
+
needsUpdate: boolean;
|
|
3313
|
+
/**
|
|
3314
|
+
* Render the internal scene used to determine the object visibility. Used
|
|
3315
|
+
* for debugging purposes.
|
|
3316
|
+
*/
|
|
3317
|
+
renderDebugFrame: boolean;
|
|
3318
|
+
/** The components instance to which this renderer belongs. */
|
|
3319
|
+
components: Components;
|
|
3320
|
+
/** The world instance to which this renderer belongs. */
|
|
3321
|
+
readonly world: World;
|
|
3322
|
+
/** The THREE.js renderer used to make the visibility test. */
|
|
3323
|
+
readonly renderer: THREE.WebGLRenderer;
|
|
3324
|
+
protected autoUpdate: boolean;
|
|
3325
|
+
protected updateInterval: number;
|
|
3326
|
+
protected readonly worker: Worker;
|
|
3327
|
+
protected readonly scene: THREE.Scene;
|
|
3328
|
+
private _width;
|
|
3329
|
+
private _height;
|
|
3330
|
+
private _availableColor;
|
|
3331
|
+
private readonly renderTarget;
|
|
3332
|
+
private readonly bufferSize;
|
|
3333
|
+
private readonly _buffer;
|
|
3334
|
+
protected _isWorkerBusy: boolean;
|
|
3335
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
3336
|
+
/** {@link Disposable.dispose} */
|
|
3337
|
+
dispose(): void;
|
|
3338
|
+
/**
|
|
3339
|
+
* The function that the culler uses to reprocess the scene. Generally it's
|
|
3340
|
+
* better to call needsUpdate, but you can also call this to force it.
|
|
3341
|
+
* @param force if true, it will refresh the scene even if needsUpdate is
|
|
3342
|
+
* not true.
|
|
3343
|
+
*/
|
|
3344
|
+
updateVisibility: (force?: boolean) => Promise<void>;
|
|
3345
|
+
protected getAvailableColor(): {
|
|
3346
|
+
r: number;
|
|
3347
|
+
g: number;
|
|
3348
|
+
b: number;
|
|
3349
|
+
code: string;
|
|
3350
|
+
};
|
|
3351
|
+
protected increaseColor(): void;
|
|
3352
|
+
protected decreaseColor(): void;
|
|
3353
|
+
private applySettings;
|
|
3354
|
+
}
|
|
3355
|
+
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
3356
|
+
import * as THREE from "three";
|
|
3357
|
+
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
3358
|
+
import { Components } from "../../Components";
|
|
3359
|
+
import { Event, World, Disposable } from "../../Types";
|
|
3360
|
+
/**
|
|
3361
|
+
* A renderer to hide/show meshes depending on their visibility from the user's point of view.
|
|
3131
3362
|
*/
|
|
3132
|
-
export declare class
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
readonly
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3363
|
+
export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
|
|
3364
|
+
/**
|
|
3365
|
+
* Event triggered when the visibility of meshes is updated.
|
|
3366
|
+
* Contains two sets: seen and unseen.
|
|
3367
|
+
*/
|
|
3368
|
+
readonly onViewUpdated: Event<{
|
|
3369
|
+
seen: Set<THREE.Mesh>;
|
|
3370
|
+
unseen: Set<THREE.Mesh>;
|
|
3371
|
+
}>;
|
|
3372
|
+
/**
|
|
3373
|
+
* Pixels in screen a geometry must occupy to be considered "seen".
|
|
3374
|
+
* Default value is 100.
|
|
3375
|
+
*/
|
|
3376
|
+
threshold: number;
|
|
3377
|
+
/**
|
|
3378
|
+
* Map of color code to THREE.InstancedMesh.
|
|
3379
|
+
* Used to keep track of color-coded meshes.
|
|
3380
|
+
*/
|
|
3381
|
+
colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
|
|
3382
|
+
/**
|
|
3383
|
+
* Flag to indicate if the renderer is currently processing.
|
|
3384
|
+
* Used to prevent concurrent processing.
|
|
3385
|
+
*/
|
|
3386
|
+
isProcessing: boolean;
|
|
3387
|
+
private _colorCodeMeshMap;
|
|
3388
|
+
private _meshIDColorCodeMap;
|
|
3389
|
+
private _currentVisibleMeshes;
|
|
3390
|
+
private _recentlyHiddenMeshes;
|
|
3391
|
+
private _intervalID;
|
|
3392
|
+
private readonly _transparentMat;
|
|
3393
|
+
constructor(components: Components, world: World, settings?: CullerRendererSettings);
|
|
3394
|
+
/** {@link Disposable.dispose} */
|
|
3395
|
+
dispose(): void;
|
|
3396
|
+
/**
|
|
3397
|
+
* 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.
|
|
3398
|
+
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
3399
|
+
* @returns {void}
|
|
3400
|
+
*/
|
|
3401
|
+
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
3402
|
+
/**
|
|
3403
|
+
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
3404
|
+
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
3405
|
+
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
3406
|
+
* @returns {void}
|
|
3407
|
+
*/
|
|
3408
|
+
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
3409
|
+
/**
|
|
3410
|
+
* Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
|
|
3411
|
+
*
|
|
3412
|
+
* @param meshes - The meshes to update.
|
|
3413
|
+
*
|
|
3414
|
+
* @returns {void}
|
|
3415
|
+
*/
|
|
3416
|
+
updateInstanced(meshes: Iterable<THREE.InstancedMesh>): void;
|
|
3417
|
+
private handleWorkerMessage;
|
|
3418
|
+
private getAvailableMaterial;
|
|
3142
3419
|
}
|
|
3143
3420
|
import { NavigationMode } from "./types";
|
|
3144
3421
|
import { OrthoPerspectiveCamera } from "../index";
|
|
3145
3422
|
/**
|
|
3146
|
-
* A {@link NavigationMode} that allows
|
|
3423
|
+
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
3147
3424
|
*/
|
|
3148
|
-
export declare class
|
|
3425
|
+
export declare class FirstPersonMode implements NavigationMode {
|
|
3149
3426
|
private camera;
|
|
3150
3427
|
/** {@link NavigationMode.enabled} */
|
|
3151
3428
|
enabled: boolean;
|
|
3152
3429
|
/** {@link NavigationMode.id} */
|
|
3153
|
-
readonly id = "
|
|
3154
|
-
private mouseAction1?;
|
|
3155
|
-
private mouseAction2?;
|
|
3156
|
-
private mouseInitialized;
|
|
3157
|
-
private readonly defaultAzimuthSpeed;
|
|
3158
|
-
private readonly defaultPolarSpeed;
|
|
3430
|
+
readonly id = "FirstPerson";
|
|
3159
3431
|
constructor(camera: OrthoPerspectiveCamera);
|
|
3160
3432
|
/** {@link NavigationMode.set} */
|
|
3161
3433
|
set(active: boolean): void;
|
|
3434
|
+
private setupFirstPersonCamera;
|
|
3162
3435
|
}
|
|
3163
3436
|
import * as THREE from "three";
|
|
3164
3437
|
import { CameraProjection } from "./types";
|
|
@@ -3205,6 +3478,42 @@ export declare class ProjectionManager {
|
|
|
3205
3478
|
private getDistance;
|
|
3206
3479
|
private setPerspectiveCamera;
|
|
3207
3480
|
}
|
|
3481
|
+
import { NavigationMode } from "./types";
|
|
3482
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3483
|
+
/**
|
|
3484
|
+
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
3485
|
+
*/
|
|
3486
|
+
export declare class OrbitMode implements NavigationMode {
|
|
3487
|
+
camera: OrthoPerspectiveCamera;
|
|
3488
|
+
/** {@link NavigationMode.enabled} */
|
|
3489
|
+
enabled: boolean;
|
|
3490
|
+
/** {@link NavigationMode.id} */
|
|
3491
|
+
readonly id = "Orbit";
|
|
3492
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3493
|
+
/** {@link NavigationMode.set} */
|
|
3494
|
+
set(active: boolean): void;
|
|
3495
|
+
private activateOrbitControls;
|
|
3496
|
+
}
|
|
3497
|
+
import { NavigationMode } from "./types";
|
|
3498
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3499
|
+
/**
|
|
3500
|
+
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3501
|
+
*/
|
|
3502
|
+
export declare class PlanMode implements NavigationMode {
|
|
3503
|
+
private camera;
|
|
3504
|
+
/** {@link NavigationMode.enabled} */
|
|
3505
|
+
enabled: boolean;
|
|
3506
|
+
/** {@link NavigationMode.id} */
|
|
3507
|
+
readonly id = "Plan";
|
|
3508
|
+
private mouseAction1?;
|
|
3509
|
+
private mouseAction2?;
|
|
3510
|
+
private mouseInitialized;
|
|
3511
|
+
private readonly defaultAzimuthSpeed;
|
|
3512
|
+
private readonly defaultPolarSpeed;
|
|
3513
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3514
|
+
/** {@link NavigationMode.set} */
|
|
3515
|
+
set(active: boolean): void;
|
|
3516
|
+
}
|
|
3208
3517
|
/**
|
|
3209
3518
|
* The projection system of the camera.
|
|
3210
3519
|
*/
|
|
@@ -3223,131 +3532,13 @@ export interface NavigationMode {
|
|
|
3223
3532
|
* Enable or disable this navigation mode.
|
|
3224
3533
|
* When a new navigation mode is enabled, the previous navigation mode
|
|
3225
3534
|
* must be disabled.
|
|
3226
|
-
*
|
|
3227
|
-
* @param active - whether to enable or disable this mode.
|
|
3228
|
-
* @param options - any additional data required to enable or disable it.
|
|
3229
|
-
* */
|
|
3230
|
-
set: (active: boolean, options?: any) => void;
|
|
3231
|
-
/** Whether this navigation mode is active or not. */
|
|
3232
|
-
enabled: boolean;
|
|
3233
|
-
}
|
|
3234
|
-
import * as THREE from "three";
|
|
3235
|
-
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
3236
|
-
/**
|
|
3237
|
-
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
3238
|
-
*
|
|
3239
|
-
* @template T - The type of the scene. Default is BaseScene.
|
|
3240
|
-
* @template U - The type of the camera. Default is BaseCamera.
|
|
3241
|
-
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
3242
|
-
*/
|
|
3243
|
-
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
|
|
3244
|
-
/**
|
|
3245
|
-
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
3246
|
-
*/
|
|
3247
|
-
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
3248
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
3249
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
3250
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
3251
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
3252
|
-
/** {@link Disposable.onDisposed} */
|
|
3253
|
-
readonly onDisposed: Event<unknown>;
|
|
3254
|
-
/**
|
|
3255
|
-
* 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.
|
|
3256
|
-
*/
|
|
3257
|
-
isDisposing: boolean;
|
|
3258
|
-
/**
|
|
3259
|
-
* Indicates whether the world is currently enabled.
|
|
3260
|
-
* When disabled, the world will not be updated.
|
|
3261
|
-
*/
|
|
3262
|
-
enabled: boolean;
|
|
3263
|
-
/**
|
|
3264
|
-
* A unique identifier for the world.
|
|
3265
|
-
*/
|
|
3266
|
-
uuid: string;
|
|
3267
|
-
/**
|
|
3268
|
-
* An optional name for the world.
|
|
3269
|
-
*/
|
|
3270
|
-
name?: string;
|
|
3271
|
-
private _scene?;
|
|
3272
|
-
private _camera?;
|
|
3273
|
-
private _renderer;
|
|
3274
|
-
/**
|
|
3275
|
-
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
3276
|
-
* @returns The current scene.
|
|
3277
|
-
*/
|
|
3278
|
-
get scene(): T;
|
|
3279
|
-
/**
|
|
3280
|
-
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
3281
|
-
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
3282
|
-
* @param scene - The new scene to be set.
|
|
3283
|
-
*/
|
|
3284
|
-
set scene(scene: T);
|
|
3285
|
-
/**
|
|
3286
|
-
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
3287
|
-
* @returns The current camera.
|
|
3288
|
-
*/
|
|
3289
|
-
get camera(): U;
|
|
3290
|
-
/**
|
|
3291
|
-
* Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
|
|
3292
|
-
* sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
|
|
3293
|
-
* @param camera - The new camera to be set.
|
|
3294
|
-
*/
|
|
3295
|
-
set camera(camera: U);
|
|
3296
|
-
/**
|
|
3297
|
-
* Getter for the renderer.
|
|
3298
|
-
* @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).
|
|
3299
|
-
*/
|
|
3300
|
-
get renderer(): S | null;
|
|
3301
|
-
/**
|
|
3302
|
-
* Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
|
|
3303
|
-
* sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
|
|
3304
|
-
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
3305
|
-
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
3306
|
-
*/
|
|
3307
|
-
set renderer(renderer: S | null);
|
|
3308
|
-
/** {@link Updateable.update} */
|
|
3309
|
-
update(delta?: number): void;
|
|
3310
|
-
/** {@link Disposable.dispose} */
|
|
3311
|
-
dispose(disposeResources?: boolean): void;
|
|
3312
|
-
}
|
|
3313
|
-
import * as THREE from "three";
|
|
3314
|
-
import { BaseScene, Configurable, Event } from "../../Types";
|
|
3315
|
-
import { Components } from "../../Components";
|
|
3316
|
-
/**
|
|
3317
|
-
* Configuration interface for the {@link SimpleScene}. Defines properties for directional and ambient lights.
|
|
3318
|
-
*/
|
|
3319
|
-
export interface SimpleSceneConfig {
|
|
3320
|
-
directionalLight: {
|
|
3321
|
-
color: THREE.Color;
|
|
3322
|
-
intensity: number;
|
|
3323
|
-
position: THREE.Vector3;
|
|
3324
|
-
};
|
|
3325
|
-
ambientLight: {
|
|
3326
|
-
color: THREE.Color;
|
|
3327
|
-
intensity: number;
|
|
3328
|
-
};
|
|
3329
|
-
}
|
|
3330
|
-
/**
|
|
3331
|
-
* 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.
|
|
3332
|
-
*/
|
|
3333
|
-
export declare class SimpleScene extends BaseScene implements Configurable<{}> {
|
|
3334
|
-
/** {@link Configurable.isSetup} */
|
|
3335
|
-
isSetup: boolean;
|
|
3336
|
-
/**
|
|
3337
|
-
* The underlying Three.js scene object.
|
|
3338
|
-
* It is used to define the 3D space containing objects, lights, and cameras.
|
|
3339
|
-
*/
|
|
3340
|
-
three: THREE.Scene;
|
|
3341
|
-
/** {@link Configurable.onSetup} */
|
|
3342
|
-
readonly onSetup: Event<SimpleScene>;
|
|
3343
|
-
/**
|
|
3344
|
-
* Configuration interface for the {@link SimpleScene}.
|
|
3345
|
-
* Defines properties for directional and ambient lights.
|
|
3346
|
-
*/
|
|
3347
|
-
config: Required<SimpleSceneConfig>;
|
|
3348
|
-
constructor(components: Components);
|
|
3349
|
-
/** {@link Configurable.setup} */
|
|
3350
|
-
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
3535
|
+
*
|
|
3536
|
+
* @param active - whether to enable or disable this mode.
|
|
3537
|
+
* @param options - any additional data required to enable or disable it.
|
|
3538
|
+
* */
|
|
3539
|
+
set: (active: boolean, options?: any) => void;
|
|
3540
|
+
/** Whether this navigation mode is active or not. */
|
|
3541
|
+
enabled: boolean;
|
|
3351
3542
|
}
|
|
3352
3543
|
import * as THREE from "three";
|
|
3353
3544
|
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
@@ -3507,213 +3698,6 @@ export declare class SimplePlane implements Disposable, Hideable {
|
|
|
3507
3698
|
private newHelper;
|
|
3508
3699
|
private static newPlaneMesh;
|
|
3509
3700
|
}
|
|
3510
|
-
import * as THREE from "three";
|
|
3511
|
-
import { Disposable, Event } from "../../Types";
|
|
3512
|
-
/**
|
|
3513
|
-
* 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.
|
|
3514
|
-
*/
|
|
3515
|
-
export declare class Mouse implements Disposable {
|
|
3516
|
-
dom: HTMLCanvasElement;
|
|
3517
|
-
private _event?;
|
|
3518
|
-
private _position;
|
|
3519
|
-
/** {@link Disposable.onDisposed} */
|
|
3520
|
-
readonly onDisposed: Event<unknown>;
|
|
3521
|
-
constructor(dom: HTMLCanvasElement);
|
|
3522
|
-
/**
|
|
3523
|
-
* The real position of the mouse of the Three.js canvas.
|
|
3524
|
-
*/
|
|
3525
|
-
get position(): THREE.Vector2;
|
|
3526
|
-
/** {@link Disposable.dispose} */
|
|
3527
|
-
dispose(): void;
|
|
3528
|
-
private getPositionY;
|
|
3529
|
-
private getPositionX;
|
|
3530
|
-
private updateMouseInfo;
|
|
3531
|
-
private setupEvents;
|
|
3532
|
-
}
|
|
3533
|
-
import * as THREE from "three";
|
|
3534
|
-
import CameraControls from "camera-controls";
|
|
3535
|
-
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
3536
|
-
import { Components } from "../../Components";
|
|
3537
|
-
/**
|
|
3538
|
-
* 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.
|
|
3539
|
-
*/
|
|
3540
|
-
export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
|
|
3541
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
3542
|
-
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
3543
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
3544
|
-
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
3545
|
-
/**
|
|
3546
|
-
* Event that is triggered when the aspect of the camera has been updated.
|
|
3547
|
-
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
3548
|
-
*/
|
|
3549
|
-
readonly onAspectUpdated: Event<unknown>;
|
|
3550
|
-
/** {@link Disposable.onDisposed} */
|
|
3551
|
-
readonly onDisposed: Event<string>;
|
|
3552
|
-
/**
|
|
3553
|
-
* A three.js PerspectiveCamera or OrthographicCamera instance.
|
|
3554
|
-
* This camera is used for rendering the scene.
|
|
3555
|
-
*/
|
|
3556
|
-
three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3557
|
-
private _allControls;
|
|
3558
|
-
/**
|
|
3559
|
-
* The object that controls the camera. An instance of
|
|
3560
|
-
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
3561
|
-
* Transforming the camera directly will have no effect: you need to use this
|
|
3562
|
-
* object to move, rotate, look at objects, etc.
|
|
3563
|
-
*/
|
|
3564
|
-
get controls(): CameraControls;
|
|
3565
|
-
/**
|
|
3566
|
-
* Getter for the enabled state of the camera controls.
|
|
3567
|
-
* If the current world is null, it returns false.
|
|
3568
|
-
* Otherwise, it returns the enabled state of the camera controls.
|
|
3569
|
-
*
|
|
3570
|
-
* @returns {boolean} The enabled state of the camera controls.
|
|
3571
|
-
*/
|
|
3572
|
-
get enabled(): boolean;
|
|
3573
|
-
/**
|
|
3574
|
-
* Setter for the enabled state of the camera controls.
|
|
3575
|
-
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
3576
|
-
*
|
|
3577
|
-
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
3578
|
-
*/
|
|
3579
|
-
set enabled(enabled: boolean);
|
|
3580
|
-
constructor(components: Components);
|
|
3581
|
-
/** {@link Disposable.dispose} */
|
|
3582
|
-
dispose(): void;
|
|
3583
|
-
/** {@link Updateable.update} */
|
|
3584
|
-
update(_delta: number): void;
|
|
3585
|
-
/**
|
|
3586
|
-
* Updates the aspect of the camera to match the size of the
|
|
3587
|
-
* {@link Components.renderer}.
|
|
3588
|
-
*/
|
|
3589
|
-
updateAspect: () => void;
|
|
3590
|
-
private setupCamera;
|
|
3591
|
-
private newCameraControls;
|
|
3592
|
-
private setupEvents;
|
|
3593
|
-
private static getSubsetOfThree;
|
|
3594
|
-
}
|
|
3595
|
-
import * as THREE from "three";
|
|
3596
|
-
import { Components } from "../../Components";
|
|
3597
|
-
import { Event, World, Disposable } from "../../Types";
|
|
3598
|
-
import { Mouse } from "./mouse";
|
|
3599
|
-
/**
|
|
3600
|
-
* 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.
|
|
3601
|
-
*/
|
|
3602
|
-
export declare class SimpleRaycaster implements Disposable {
|
|
3603
|
-
/** {@link Component.enabled} */
|
|
3604
|
-
enabled: boolean;
|
|
3605
|
-
/** The components instance to which this Raycaster belongs. */
|
|
3606
|
-
components: Components;
|
|
3607
|
-
/** {@link Disposable.onDisposed} */
|
|
3608
|
-
readonly onDisposed: Event<unknown>;
|
|
3609
|
-
/** The position of the mouse in the screen. */
|
|
3610
|
-
readonly mouse: Mouse;
|
|
3611
|
-
/**
|
|
3612
|
-
* A reference to the Three.js Raycaster instance.
|
|
3613
|
-
* This is used for raycasting operations.
|
|
3614
|
-
*/
|
|
3615
|
-
readonly three: THREE.Raycaster;
|
|
3616
|
-
/**
|
|
3617
|
-
* A reference to the world instance to which this Raycaster belongs.
|
|
3618
|
-
* This is used to access the camera and meshes.
|
|
3619
|
-
*/
|
|
3620
|
-
world: World;
|
|
3621
|
-
constructor(components: Components, world: World);
|
|
3622
|
-
/** {@link Disposable.dispose} */
|
|
3623
|
-
dispose(): void;
|
|
3624
|
-
/**
|
|
3625
|
-
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
3626
|
-
* the first item found. This also takes into account the clipping planes
|
|
3627
|
-
* used by the renderer.
|
|
3628
|
-
*
|
|
3629
|
-
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
3630
|
-
* to query. If not provided, it will query all the meshes stored in
|
|
3631
|
-
* {@link Components.meshes}.
|
|
3632
|
-
*/
|
|
3633
|
-
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
3634
|
-
/**
|
|
3635
|
-
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
3636
|
-
* This method also takes into account the clipping planes used by the renderer.
|
|
3637
|
-
*
|
|
3638
|
-
* @param origin - The origin of the ray.
|
|
3639
|
-
* @param direction - The direction of the ray.
|
|
3640
|
-
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3641
|
-
* @returns The first intersection found or 'null' if no intersection was found.
|
|
3642
|
-
*/
|
|
3643
|
-
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;
|
|
3644
|
-
private intersect;
|
|
3645
|
-
private filterClippingPlanes;
|
|
3646
|
-
}
|
|
3647
|
-
import * as THREE from "three";
|
|
3648
|
-
import { BaseRenderer, Event } from "../../Types";
|
|
3649
|
-
import { Components } from "../../Components";
|
|
3650
|
-
/**
|
|
3651
|
-
* A basic renderer capable of rendering [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
|
|
3652
|
-
*/
|
|
3653
|
-
export declare class SimpleRenderer extends BaseRenderer {
|
|
3654
|
-
/**
|
|
3655
|
-
* Indicates whether the renderer is enabled. If it's not, it won't be updated.
|
|
3656
|
-
* Default is 'true'.
|
|
3657
|
-
*/
|
|
3658
|
-
enabled: boolean;
|
|
3659
|
-
/**
|
|
3660
|
-
* The HTML container of the THREE.js canvas where the scene is rendered.
|
|
3661
|
-
*/
|
|
3662
|
-
container: HTMLElement;
|
|
3663
|
-
/**
|
|
3664
|
-
* The THREE.js WebGLRenderer instance.
|
|
3665
|
-
*/
|
|
3666
|
-
three: THREE.WebGLRenderer;
|
|
3667
|
-
protected _canvas: HTMLCanvasElement;
|
|
3668
|
-
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
3669
|
-
protected _resizeObserver: ResizeObserver | null;
|
|
3670
|
-
protected onContainerUpdated: Event<unknown>;
|
|
3671
|
-
private _resizing;
|
|
3672
|
-
/**
|
|
3673
|
-
* Constructor for the SimpleRenderer class.
|
|
3674
|
-
*
|
|
3675
|
-
* @param components - The components instance.
|
|
3676
|
-
* @param container - The HTML container where the THREE.js canvas will be rendered.
|
|
3677
|
-
* @param parameters - Optional parameters for the THREE.js WebGLRenderer.
|
|
3678
|
-
*/
|
|
3679
|
-
constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
|
|
3680
|
-
/** {@link Updateable.update} */
|
|
3681
|
-
update(): void;
|
|
3682
|
-
/** {@link Disposable.dispose} */
|
|
3683
|
-
dispose(): void;
|
|
3684
|
-
/** {@link Resizeable.getSize}. */
|
|
3685
|
-
getSize(): THREE.Vector2;
|
|
3686
|
-
/** {@link Resizeable.resize} */
|
|
3687
|
-
resize: (size?: THREE.Vector2) => void;
|
|
3688
|
-
/**
|
|
3689
|
-
* Sets up and manages the event listeners for the renderer.
|
|
3690
|
-
*
|
|
3691
|
-
* @param active - A boolean indicating whether to activate or deactivate the event listeners.
|
|
3692
|
-
*
|
|
3693
|
-
* @throws Will throw an error if the renderer does not have an HTML container.
|
|
3694
|
-
*/
|
|
3695
|
-
setupEvents(active: boolean): void;
|
|
3696
|
-
private resizeEvent;
|
|
3697
|
-
private setupRenderer;
|
|
3698
|
-
private onContextLost;
|
|
3699
|
-
private onContextBack;
|
|
3700
|
-
}
|
|
3701
|
-
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3702
|
-
/**
|
|
3703
|
-
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3704
|
-
*/
|
|
3705
|
-
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
3706
|
-
/**
|
|
3707
|
-
* Minimum number of geometries to be streamed.
|
|
3708
|
-
* Defaults to 10 geometries.
|
|
3709
|
-
*/
|
|
3710
|
-
minGeometrySize: number;
|
|
3711
|
-
/**
|
|
3712
|
-
* Minimum amount of assets to be streamed.
|
|
3713
|
-
* Defaults to 1000 assets.
|
|
3714
|
-
*/
|
|
3715
|
-
minAssetsSize: number;
|
|
3716
|
-
}
|
|
3717
3701
|
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3718
3702
|
/**
|
|
3719
3703
|
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
@@ -3740,6 +3724,27 @@ export declare class CivilReader {
|
|
|
3740
3724
|
} | undefined;
|
|
3741
3725
|
private getCurves;
|
|
3742
3726
|
}
|
|
3727
|
+
import * as WEBIFC from "web-ifc";
|
|
3728
|
+
export declare class IfcMetadataReader {
|
|
3729
|
+
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3730
|
+
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3731
|
+
}
|
|
3732
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3733
|
+
/**
|
|
3734
|
+
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3735
|
+
*/
|
|
3736
|
+
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
3737
|
+
/**
|
|
3738
|
+
* Minimum number of geometries to be streamed.
|
|
3739
|
+
* Defaults to 10 geometries.
|
|
3740
|
+
*/
|
|
3741
|
+
minGeometrySize: number;
|
|
3742
|
+
/**
|
|
3743
|
+
* Minimum amount of assets to be streamed.
|
|
3744
|
+
* Defaults to 1000 assets.
|
|
3745
|
+
*/
|
|
3746
|
+
minAssetsSize: number;
|
|
3747
|
+
}
|
|
3743
3748
|
/**
|
|
3744
3749
|
* 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.
|
|
3745
3750
|
*/
|
|
@@ -3770,9 +3775,14 @@ export interface StreamedAsset {
|
|
|
3770
3775
|
}[];
|
|
3771
3776
|
}
|
|
3772
3777
|
import * as WEBIFC from "web-ifc";
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3778
|
+
import * as THREE from "three";
|
|
3779
|
+
export declare class Units {
|
|
3780
|
+
factor: number;
|
|
3781
|
+
complement: number;
|
|
3782
|
+
apply(matrix: THREE.Matrix4): void;
|
|
3783
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3784
|
+
private getLengthUnits;
|
|
3785
|
+
private getScaleMatrix;
|
|
3776
3786
|
}
|
|
3777
3787
|
import * as WEBIFC from "web-ifc";
|
|
3778
3788
|
export type RelationsMap = Map<number, Map<number, number[]>>;
|
|
@@ -3801,7 +3811,12 @@ export type InverseAttributes = [
|
|
|
3801
3811
|
"AssignedToFlowElement",
|
|
3802
3812
|
"ConnectedTo",
|
|
3803
3813
|
"ConnectedFrom",
|
|
3804
|
-
"ReferencedBy"
|
|
3814
|
+
"ReferencedBy",
|
|
3815
|
+
"Declares",
|
|
3816
|
+
"HasContext",
|
|
3817
|
+
"Controls",
|
|
3818
|
+
"IsNestedBy",
|
|
3819
|
+
"Nests"
|
|
3805
3820
|
];
|
|
3806
3821
|
export type InverseAttribute = InverseAttributes[number];
|
|
3807
3822
|
/**
|
|
@@ -3818,19 +3833,12 @@ export type IfcRelations = [
|
|
|
3818
3833
|
typeof WEBIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,
|
|
3819
3834
|
typeof WEBIFC.IFCRELFLOWCONTROLELEMENTS,
|
|
3820
3835
|
typeof WEBIFC.IFCRELCONNECTSELEMENTS,
|
|
3821
|
-
typeof WEBIFC.IFCRELASSIGNSTOPRODUCT
|
|
3836
|
+
typeof WEBIFC.IFCRELASSIGNSTOPRODUCT,
|
|
3837
|
+
typeof WEBIFC.IFCRELDECLARES,
|
|
3838
|
+
typeof WEBIFC.IFCRELASSIGNSTOCONTROL,
|
|
3839
|
+
typeof WEBIFC.IFCRELNESTS
|
|
3822
3840
|
];
|
|
3823
3841
|
export type IfcRelation = IfcRelations[number];
|
|
3824
|
-
import * as WEBIFC from "web-ifc";
|
|
3825
|
-
import * as THREE from "three";
|
|
3826
|
-
export declare class Units {
|
|
3827
|
-
factor: number;
|
|
3828
|
-
complement: number;
|
|
3829
|
-
apply(matrix: THREE.Matrix4): void;
|
|
3830
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3831
|
-
private getLengthUnits;
|
|
3832
|
-
private getScaleMatrix;
|
|
3833
|
-
}
|
|
3834
3842
|
import { BufferGeometry } from "three";
|
|
3835
3843
|
import * as THREE from "three";
|
|
3836
3844
|
export declare class TransformHelper {
|