@thatopen/components 2.0.1 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,68 @@
1
1
  declare namespace OBC {
2
+ import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
3
+ import { Components } from "../Components";
4
+ import { SimpleWorld } from "./src";
5
+ export declare class Worlds extends Component implements Updateable, Disposable {
6
+ /**
7
+ * A unique identifier for the component.
8
+ * This UUID is used to register the component within the Components system.
9
+ */
10
+ static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
11
+ /**
12
+ * Event triggered after the update process of all worlds.
13
+ * Subscribers can listen to this event to perform actions post-update.
14
+ */
15
+ readonly onAfterUpdate: Event<unknown>;
16
+ /**
17
+ * Event triggered before the update process of all worlds.
18
+ * Subscribers can listen to this event to perform actions pre-update.
19
+ */
20
+ readonly onBeforeUpdate: Event<unknown>;
21
+ /**
22
+ * Event triggered when the Worlds component is disposed.
23
+ * Subscribers can listen to this event to perform cleanup actions.
24
+ */
25
+ readonly onDisposed: Event<unknown>;
26
+ readonly onWorldCreated: Event<World>;
27
+ readonly onWorldDeleted: Event<string>;
28
+ /**
29
+ * A collection of worlds managed by this component.
30
+ * The key is the unique identifier (UUID) of the world, and the value is the World instance.
31
+ */
32
+ list: Map<string, World>;
33
+ /**
34
+ * A flag indicating whether the Worlds component is enabled.
35
+ * If false, the update process will be skipped.
36
+ */
37
+ enabled: boolean;
38
+ constructor(components: Components);
39
+ /**
40
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
41
+ *
42
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
43
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
44
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
45
+ *
46
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
47
+ */
48
+ create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
49
+ delete(world: World): void;
50
+ dispose(): void;
51
+ update(delta?: number): void | Promise<void>;
52
+ }
53
+ import { Component, Disposable, World, Event } from "../Types";
54
+ import { SimpleRaycaster } from "./src";
55
+ import { Components } from "../Components";
56
+ export declare class Raycasters extends Component implements Disposable {
57
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
58
+ enabled: boolean;
59
+ list: Map<string, SimpleRaycaster>;
60
+ onDisposed: Event<unknown>;
61
+ constructor(components: Components);
62
+ get(world: World): SimpleRaycaster;
63
+ delete(world: World): void;
64
+ dispose(): void;
65
+ }
2
66
  import { Component, Disposable, Event } from "../Types";
3
67
  /**
4
68
  * The entry point of the Components library.
@@ -51,122 +115,17 @@ export declare class Components implements Disposable {
51
115
  private update;
52
116
  private static setupBVH;
53
117
  }
54
- import * as THREE from "three";
55
- import { Components } from "../Components";
56
- import { Component } from "../Types";
57
- /**
58
- * A tool to safely remove meshes and geometries from memory to
59
- * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
60
- */
61
- export declare class Disposer extends Component {
62
- private _disposedComponents;
63
- /** {@link Component.enabled} */
64
- enabled: boolean;
65
- static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
66
- constructor(components: Components);
67
- /**
68
- * {@link Component.uuid}.
69
- * @return the list of UUIDs of deleted components.
70
- */
71
- get(): Set<string>;
72
- /**
73
- * Removes a mesh, its geometry and its materials from memory. If you are
74
- * using any of these in other parts of the application, make sure that you
75
- * remove them from the mesh before disposing it.
76
- *
77
- * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
78
- * to remove.
79
- *
80
- * @param materials - whether to dispose the materials of the mesh.
81
- *
82
- * @param recursive - whether to recursively dispose the children of the mesh.
83
- */
84
- destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
85
- /**
86
- * Disposes a geometry from memory.
87
- *
88
- * @param geometry - the
89
- * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
90
- * to remove.
91
- */
92
- disposeGeometry(geometry: THREE.BufferGeometry): void;
93
- private disposeGeometryAndMaterials;
94
- private disposeChildren;
95
- private static disposeMaterial;
96
- }
97
- import { Component, Disposable, World, Event } from "../Types";
98
- import { SimpleRaycaster } from "./src";
99
- import { Components } from "../Components";
100
- export declare class Raycasters extends Component implements Disposable {
101
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
102
- enabled: boolean;
103
- list: Map<string, SimpleRaycaster>;
104
- onDisposed: Event<unknown>;
105
- constructor(components: Components);
106
- get(world: World): SimpleRaycaster;
107
- delete(world: World): void;
108
- dispose(): void;
109
- }
110
- import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
111
- import { Components } from "../Components";
112
- import { SimpleWorld } from "./src";
113
- export declare class Worlds extends Component implements Updateable, Disposable {
114
- /**
115
- * A unique identifier for the component.
116
- * This UUID is used to register the component within the Components system.
117
- */
118
- static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
119
- /**
120
- * Event triggered after the update process of all worlds.
121
- * Subscribers can listen to this event to perform actions post-update.
122
- */
123
- readonly onAfterUpdate: Event<unknown>;
124
- /**
125
- * Event triggered before the update process of all worlds.
126
- * Subscribers can listen to this event to perform actions pre-update.
127
- */
128
- readonly onBeforeUpdate: Event<unknown>;
129
- /**
130
- * Event triggered when the Worlds component is disposed.
131
- * Subscribers can listen to this event to perform cleanup actions.
132
- */
133
- readonly onDisposed: Event<unknown>;
134
- /**
135
- * A collection of worlds managed by this component.
136
- * The key is the unique identifier (UUID) of the world, and the value is the World instance.
137
- */
138
- list: Map<string, World>;
139
- /**
140
- * A flag indicating whether the Worlds component is enabled.
141
- * If false, the update process will be skipped.
142
- */
143
- enabled: boolean;
144
- constructor(components: Components);
145
- /**
146
- * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
147
- *
148
- * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
149
- * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
150
- * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
151
- *
152
- * @returns {SimpleWorld<T, U, S>} - The newly created SimpleWorld instance.
153
- *
154
- * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
155
- */
156
- create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
157
- delete(world: World): void;
158
- dispose(): void;
159
- update(delta?: number): void | Promise<void>;
160
- }
161
118
  import { Component, Disposable, World, Event } from "../Types";
162
119
  import { GridConfig, SimpleGrid } from "./src";
120
+ import { Components } from "../Components";
163
121
  export declare class Grids extends Component implements Disposable {
164
122
  static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
165
123
  list: Map<string, SimpleGrid>;
166
- onDisposed: Event<unknown>;
124
+ readonly onDisposed: Event<unknown>;
167
125
  config: Required<GridConfig>;
168
126
  /** {@link Component.enabled} */
169
127
  enabled: boolean;
128
+ constructor(components: Components);
170
129
  create(world: World): SimpleGrid;
171
130
  delete(world: World): void;
172
131
  dispose(): void;
@@ -224,6 +183,100 @@ export declare class Cullers extends Component implements Disposable {
224
183
  dispose(): void;
225
184
  }
226
185
  import * as THREE from "three";
186
+ import { Components } from "../Components";
187
+ import { SimpleCamera } from "..";
188
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
189
+ /**
190
+ * A flexible camera that uses
191
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
192
+ * easily control the camera in 2D and 3D. It supports multiple navigation
193
+ * modes, such as 2D floor plan navigation, first person and 3D orbit.
194
+ */
195
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
196
+ /**
197
+ * The current {@link NavigationMode}.
198
+ */
199
+ _mode: NavigationMode | null;
200
+ readonly projection: ProjectionManager;
201
+ readonly threeOrtho: THREE.OrthographicCamera;
202
+ readonly threePersp: THREE.PerspectiveCamera;
203
+ protected readonly _userInputButtons: any;
204
+ protected readonly _frustumSize = 50;
205
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
206
+ private previousSize;
207
+ get mode(): NavigationMode;
208
+ constructor(components: Components);
209
+ /** {@link Disposable.dispose} */
210
+ dispose(): void;
211
+ /**
212
+ * Sets a new {@link NavigationMode} and disables the previous one.
213
+ *
214
+ * @param mode - The {@link NavigationMode} to set.
215
+ */
216
+ set(mode: NavModeID): void;
217
+ /**
218
+ * Make the camera view fit all the specified meshes.
219
+ *
220
+ * @param meshes the meshes to fit. If it is not defined, it will
221
+ * evaluate {@link Components.meshes}.
222
+ * @param offset the distance to the fit object
223
+ */
224
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
225
+ /**
226
+ * Allows or prevents all user input.
227
+ *
228
+ * @param active - whether to enable or disable user inputs.
229
+ */
230
+ setUserInput(active: boolean): void;
231
+ private disableUserInput;
232
+ private enableUserInput;
233
+ private newOrthoCamera;
234
+ private setOrthoPerspCameraAspect;
235
+ }
236
+ import * as THREE from "three";
237
+ import { Components } from "../Components";
238
+ import { Component } from "../Types";
239
+ /**
240
+ * A tool to safely remove meshes and geometries from memory to
241
+ * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
242
+ */
243
+ export declare class Disposer extends Component {
244
+ private _disposedComponents;
245
+ /** {@link Component.enabled} */
246
+ enabled: boolean;
247
+ static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
248
+ constructor(components: Components);
249
+ /**
250
+ * {@link Component.uuid}.
251
+ * @return the list of UUIDs of deleted components.
252
+ */
253
+ get(): Set<string>;
254
+ /**
255
+ * Removes a mesh, its geometry and its materials from memory. If you are
256
+ * using any of these in other parts of the application, make sure that you
257
+ * remove them from the mesh before disposing it.
258
+ *
259
+ * @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
260
+ * to remove.
261
+ *
262
+ * @param materials - whether to dispose the materials of the mesh.
263
+ *
264
+ * @param recursive - whether to recursively dispose the children of the mesh.
265
+ */
266
+ destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
267
+ /**
268
+ * Disposes a geometry from memory.
269
+ *
270
+ * @param geometry - the
271
+ * [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
272
+ * to remove.
273
+ */
274
+ disposeGeometry(geometry: THREE.BufferGeometry): void;
275
+ private disposeGeometryAndMaterials;
276
+ private disposeChildren;
277
+ private static disposeMaterial;
278
+ }
279
+ import * as THREE from "three";
227
280
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
228
281
  import { SimplePlane } from "./src";
229
282
  import { Components } from "../Components";
@@ -338,56 +391,113 @@ export declare class MiniMaps extends Component implements Updateable, Disposabl
338
391
  dispose(): void;
339
392
  update(): void;
340
393
  }
341
- import * as THREE from "three";
342
- import { Components } from "../Components";
343
- import { SimpleCamera } from "..";
344
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
394
+ import * as WEBIFC from "web-ifc";
395
+ import * as FRAG from "@thatopen/fragments";
396
+ import { Component, Components } from "../../core";
345
397
  /**
346
- * A flexible camera that uses
347
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
348
- * easily control the camera in 2D and 3D. It supports multiple navigation
349
- * modes, such as 2D floor plan navigation, first person and 3D orbit.
398
+ * Object to export all the properties from an IFC to a JS object.
350
399
  */
351
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
400
+ export declare class IfcJsonExporter extends Component {
401
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
402
+ /** {@link Component.enabled} */
403
+ enabled: boolean;
404
+ constructor(components: Components);
352
405
  /**
353
- * The current {@link NavigationMode}.
406
+ * Exports all the properties of an IFC into an array of JS objects.
407
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
408
+ * @param modelID ID of the IFC model whose properties to extract.
409
+ * @param indirect whether to get the indirect relationships as well.
410
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
411
+ * to make the location data available (e.g. absolute position of building).
354
412
  */
355
- _mode: NavigationMode | null;
356
- readonly projection: ProjectionManager;
357
- readonly threeOrtho: THREE.OrthographicCamera;
358
- readonly threePersp: THREE.PerspectiveCamera;
359
- protected readonly _userInputButtons: any;
360
- protected readonly _frustumSize = 50;
361
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
362
- private previousSize;
363
- get mode(): NavigationMode;
413
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
414
+ }
415
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
416
+ import * as WEBIFC from "web-ifc";
417
+ import { FragmentsGroup } from "@thatopen/fragments";
418
+ import { Component, Disposable, Event, Components } from "../../core";
419
+ type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
420
+ type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
421
+ type NumericPropTypes = "IfcInteger" | "IfcReal";
422
+ interface ChangeMap {
423
+ [modelID: string]: Set<number>;
424
+ }
425
+ interface AttributeListener {
426
+ [modelID: string]: {
427
+ [expressID: number]: {
428
+ [attributeName: string]: Event<String | Boolean | Number>;
429
+ };
430
+ };
431
+ }
432
+ export declare class IfcPropertiesManager extends Component implements Disposable {
433
+ static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
434
+ /** {@link Disposable.onDisposed} */
435
+ readonly onDisposed: Event<string>;
436
+ readonly onRequestFile: Event<unknown>;
437
+ ifcToExport: ArrayBuffer | null;
438
+ readonly onElementToPset: Event<{
439
+ model: FragmentsGroup;
440
+ psetID: number;
441
+ elementID: number;
442
+ }>;
443
+ readonly onPropToPset: Event<{
444
+ model: FragmentsGroup;
445
+ psetID: number;
446
+ propID: number;
447
+ }>;
448
+ readonly onPsetRemoved: Event<{
449
+ model: FragmentsGroup;
450
+ psetID: number;
451
+ }>;
452
+ readonly onDataChanged: Event<{
453
+ model: FragmentsGroup;
454
+ expressID: number;
455
+ }>;
456
+ wasm: {
457
+ path: string;
458
+ absolute: boolean;
459
+ };
460
+ enabled: boolean;
461
+ attributeListeners: AttributeListener;
462
+ selectedModel?: FragmentsGroup;
463
+ changeMap: ChangeMap;
364
464
  constructor(components: Components);
365
- /** {@link Disposable.dispose} */
366
465
  dispose(): void;
367
- /**
368
- * Sets a new {@link NavigationMode} and disables the previous one.
369
- *
370
- * @param mode - The {@link NavigationMode} to set.
371
- */
372
- set(mode: NavModeID): void;
373
- /**
374
- * Make the camera view fit all the specified meshes.
375
- *
376
- * @param meshes the meshes to fit. If it is not defined, it will
377
- * evaluate {@link Components.meshes}.
378
- * @param offset the distance to the fit object
379
- */
380
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
381
- /**
382
- * Allows or prevents all user input.
383
- *
384
- * @param active - whether to enable or disable user inputs.
385
- */
386
- setUserInput(active: boolean): void;
387
- private disableUserInput;
388
- private enableUserInput;
389
- private newOrthoCamera;
390
- private setOrthoPerspCameraAspect;
466
+ private increaseMaxID;
467
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
468
+ private newGUID;
469
+ private getOwnerHistory;
470
+ private registerChange;
471
+ setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
472
+ newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
473
+ pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
474
+ rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
475
+ }>;
476
+ removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
477
+ private newSingleProperty;
478
+ newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
479
+ newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
480
+ newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
481
+ removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
482
+ addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
483
+ addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
484
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
485
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
486
+ }
487
+ export {};
488
+ import * as FRAGS from "@thatopen/fragments";
489
+ import { Components, Component } from "../../core";
490
+ export declare class Hider extends Component {
491
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
492
+ enabled: boolean;
493
+ constructor(components: Components);
494
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
495
+ isolate(items: FRAGS.FragmentIdMap): void;
496
+ private updateCulledVisibility;
497
+ }
498
+ import * as THREE from "three";
499
+ export declare class MaterialsUtils {
500
+ static isTransparent(material: THREE.Material): boolean;
391
501
  }
392
502
  import * as THREE from "three";
393
503
  import * as FRAGS from "@thatopen/fragments";
@@ -450,65 +560,35 @@ export declare class Classifier extends Component implements Disposable {
450
560
  byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
451
561
  byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
452
562
  byEntity(group: FRAGS.FragmentsGroup): void;
453
- byStorey(group: FRAGS.FragmentsGroup): void;
454
563
  byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
564
+ bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
455
565
  setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
456
566
  resetColor(items: FRAGS.FragmentIdMap): void;
457
- private saveItem;
567
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
458
568
  }
459
- import { Component, Disposable, Event, Components } from "../../core";
460
- export declare class Exploder extends Component implements Disposable {
461
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
462
- enabled: boolean;
463
- height: number;
464
- groupName: string;
465
- /** {@link Disposable.onDisposed} */
466
- readonly onDisposed: Event<unknown>;
467
- list: Set<string>;
468
- constructor(components: Components);
469
- dispose(): void;
470
- set(active: boolean): void;
471
- }
472
- import * as WEBIFC from "web-ifc";
473
- import * as FRAGS from "@thatopen/fragments";
474
- import { IfcFragmentSettings } from "./src";
475
- import { Component, Components, Event, Disposable } from "../../core";
476
- export declare class IfcLoader extends Component implements Disposable {
477
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
478
- readonly onIfcStartedLoading: Event<void>;
479
- readonly onSetup: Event<void>;
480
- /** {@link Disposable.onDisposed} */
481
- readonly onDisposed: Event<string>;
482
- settings: IfcFragmentSettings;
483
- enabled: boolean;
484
- webIfc: WEBIFC.IfcAPI;
485
- private _material;
486
- private _spatialTree;
487
- private _metaData;
488
- private _fragmentInstances;
489
- private _civil;
490
- private _visitedFragments;
491
- private _materialT;
492
- constructor(components: Components);
493
- dispose(): void;
494
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
495
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
496
- readIfcFile(data: Uint8Array): Promise<number>;
497
- private getAllGeometries;
498
- cleanUp(): void;
499
- private getMesh;
500
- private getGeometry;
501
- private autoSetWasm;
569
+ import * as THREE from "three";
570
+ import { Component, Components } from "../../core";
571
+ export interface MeasureEdge {
572
+ distance: number;
573
+ points: THREE.Vector3[];
502
574
  }
503
- import * as FRAGS from "@thatopen/fragments";
504
- import { Components, Component } from "../../core";
505
- export declare class FragmentHider extends Component {
506
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
575
+ export declare class MeasurementUtils extends Component {
507
576
  enabled: boolean;
577
+ static uuid: string;
508
578
  constructor(components: Components);
509
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
510
- isolate(items: FRAGS.FragmentIdMap): void;
511
- private updateCulledVisibility;
579
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
580
+ edges: MeasureEdge[];
581
+ indices: Set<number>;
582
+ } | null;
583
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
584
+ private getFaceData;
585
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
586
+ p1: THREE.Vector3;
587
+ p2: THREE.Vector3;
588
+ p3: THREE.Vector3;
589
+ faceNormal: THREE.Vector3;
590
+ };
591
+ private round;
512
592
  }
513
593
  import { Fragment, FragmentsGroup } from "@thatopen/fragments";
514
594
  import * as THREE from "three";
@@ -563,161 +643,48 @@ export declare class FragmentsManager extends Component implements Disposable {
563
643
  coordinate(models?: FragmentsGroup[]): void;
564
644
  }
565
645
  import * as WEBIFC from "web-ifc";
566
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
567
- import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
568
- export declare class IfcPropertiesTiler extends Component implements Disposable {
569
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
570
- onPropertiesStreamed: AsyncEvent<{
571
- type: number;
572
- data: {
573
- [id: number]: any;
574
- };
575
- }>;
576
- onProgress: AsyncEvent<number>;
577
- onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
646
+ import * as FRAGS from "@thatopen/fragments";
647
+ import { IfcFragmentSettings } from "./src";
648
+ import { Component, Components, Event, Disposable } from "../../core";
649
+ export declare class IfcLoader extends Component implements Disposable {
650
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
651
+ readonly onIfcStartedLoading: Event<void>;
652
+ readonly onSetup: Event<void>;
578
653
  /** {@link Disposable.onDisposed} */
579
654
  readonly onDisposed: Event<string>;
580
- enabled: boolean;
581
- settings: PropertiesStreamingSettings;
582
- webIfc: WEBIFC.IfcAPI;
583
- dispose(): Promise<void>;
584
- streamFromBuffer(data: Uint8Array): Promise<void>;
585
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
586
- private readIfcFile;
587
- private streamIfcFile;
588
- private streamAllProperties;
589
- private cleanUp;
590
- }
591
- import * as WEBIFC from "web-ifc";
592
- import { Components, Disposable, Event, Component } from "../../core";
593
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
594
- export declare class IfcGeometryTiler extends Component implements Disposable {
595
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
596
- onGeometryStreamed: Event<{
597
- buffer: Uint8Array;
598
- data: StreamedGeometries;
599
- }>;
600
- onAssetStreamed: Event<StreamedAsset[]>;
601
- onProgress: Event<number>;
602
- onIfcLoaded: Event<Uint8Array>;
603
- /** {@link Disposable.onDisposed} */
604
- readonly onDisposed: Event<unknown>;
605
- settings: IfcStreamingSettings;
655
+ settings: IfcFragmentSettings;
606
656
  enabled: boolean;
607
657
  webIfc: WEBIFC.IfcAPI;
658
+ private _material;
608
659
  private _spatialTree;
609
660
  private _metaData;
610
- private _visitedGeometries;
611
- private _streamSerializer;
612
- private _geometries;
613
- private _geometryCount;
661
+ private _fragmentInstances;
614
662
  private _civil;
615
- private _groupSerializer;
616
- private _assets;
617
- private _meshesWithHoles;
663
+ private _visitedFragments;
664
+ private _materialT;
618
665
  constructor(components: Components);
619
666
  dispose(): void;
620
- streamFromBuffer(data: Uint8Array): Promise<void>;
621
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
622
- private readIfcFile;
623
- private streamIfcFile;
624
- private streamAllGeometries;
625
- private cleanUp;
667
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
668
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
669
+ readIfcFile(data: Uint8Array): Promise<number>;
670
+ private getAllGeometries;
671
+ cleanUp(): void;
626
672
  private getMesh;
627
673
  private getGeometry;
628
- private streamAssets;
629
- private streamGeometries;
630
- }
631
- import * as THREE from "three";
632
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
633
- center: THREE.Vector3;
634
- halfSizes: THREE.Vector3;
635
- rotation: THREE.Matrix3;
636
- transformation: THREE.Matrix4;
637
- };
638
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
639
- import * as THREE from "three";
640
- export declare class MaterialsUtils {
641
- static isTransparent(material: THREE.Material): boolean;
642
- }
643
- import * as THREE from "three";
644
- import { Component, Components } from "../../core";
645
- export interface MeasureEdge {
646
- distance: number;
647
- points: THREE.Vector3[];
674
+ private autoSetWasm;
648
675
  }
649
- export declare class MeasurementUtils extends Component {
676
+ import { Component, Disposable, Event, Components } from "../../core";
677
+ export declare class Exploder extends Component implements Disposable {
678
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
650
679
  enabled: boolean;
651
- static uuid: string;
680
+ height: number;
681
+ groupName: string;
682
+ /** {@link Disposable.onDisposed} */
683
+ readonly onDisposed: Event<unknown>;
684
+ list: Set<string>;
652
685
  constructor(components: Components);
653
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
654
- edges: MeasureEdge[];
655
- indices: Set<number>;
656
- } | null;
657
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
658
- private getFaceData;
659
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
660
- p1: THREE.Vector3;
661
- p2: THREE.Vector3;
662
- p3: THREE.Vector3;
663
- faceNormal: THREE.Vector3;
664
- };
665
- private round;
666
- }
667
- export declare class UUID {
668
- private static _pattern;
669
- private static _lut;
670
- static create(): string;
671
- static validate(uuid: string): void;
672
- }
673
- import * as THREE from "three";
674
- import { Component, Components, Event, World } from "../core";
675
- export interface VertexPickerConfig {
676
- showOnlyVertex: boolean;
677
- snapDistance: number;
678
- previewElement: HTMLElement;
679
- }
680
- export declare class VertexPicker extends Component {
681
- onVertexFound: Event<THREE.Vector3>;
682
- onVertexLost: Event<THREE.Vector3>;
683
- components: Components;
684
- private _pickedPoint;
685
- private _config;
686
- private _enabled;
687
- private _workingPlane;
688
- set enabled(value: boolean);
689
- get enabled(): boolean;
690
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
691
- set workingPlane(plane: THREE.Plane | null);
692
- get workingPlane(): THREE.Plane | null;
693
- set config(value: Partial<VertexPickerConfig>);
694
- get config(): Partial<VertexPickerConfig>;
695
686
  dispose(): void;
696
- get(world: World): THREE.Vector3 | null;
697
- private getClosestVertex;
698
- private getVertices;
699
- private getVertex;
700
- }
701
- import * as WEBIFC from "web-ifc";
702
- import * as FRAG from "@thatopen/fragments";
703
- import { Component, Components } from "../../core";
704
- /**
705
- * Object to export all the properties from an IFC to a JS object.
706
- */
707
- export declare class IfcJsonExporter extends Component {
708
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
709
- /** {@link Component.enabled} */
710
- enabled: boolean;
711
- constructor(components: Components);
712
- /**
713
- * Exports all the properties of an IFC into an array of JS objects.
714
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
715
- * @param modelID ID of the IFC model whose properties to extract.
716
- * @param indirect whether to get the indirect relationships as well.
717
- * @param recursiveSpatial whether to get the properties of spatial items recursively
718
- * to make the location data available (e.g. absolute position of building).
719
- */
720
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
687
+ set(active: boolean): void;
721
688
  }
722
689
  import * as WEBIFC from "web-ifc";
723
690
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -851,109 +818,139 @@ export declare class IfcRelationsIndexer extends Component implements Disposable
851
818
  dispose(): void;
852
819
  }
853
820
  export type { InverseAttribute } from "./src/types";
821
+ import * as THREE from "three";
822
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
823
+ center: THREE.Vector3;
824
+ halfSizes: THREE.Vector3;
825
+ rotation: THREE.Matrix3;
826
+ transformation: THREE.Matrix4;
827
+ };
854
828
  import * as WEBIFC from "web-ifc";
855
- import { FragmentsGroup } from "@thatopen/fragments";
856
- import { Component, Disposable, Event, Components } from "../../core";
857
- type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
858
- type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
859
- type NumericPropTypes = "IfcInteger" | "IfcReal";
860
- interface ChangeMap {
861
- [modelID: string]: Set<number>;
862
- }
863
- interface AttributeListener {
864
- [modelID: string]: {
865
- [expressID: number]: {
866
- [attributeName: string]: Event<String | Boolean | Number>;
829
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
830
+ import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
831
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
832
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
833
+ onPropertiesStreamed: AsyncEvent<{
834
+ type: number;
835
+ data: {
836
+ [id: number]: any;
867
837
  };
868
- };
869
- }
870
- export declare class IfcPropertiesManager extends Component implements Disposable {
871
- static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
838
+ }>;
839
+ onProgress: AsyncEvent<number>;
840
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
872
841
  /** {@link Disposable.onDisposed} */
873
842
  readonly onDisposed: Event<string>;
874
- readonly onRequestFile: Event<unknown>;
875
- ifcToExport: ArrayBuffer | null;
876
- readonly onElementToPset: Event<{
877
- model: FragmentsGroup;
878
- psetID: number;
879
- elementID: number;
880
- }>;
881
- readonly onPropToPset: Event<{
882
- model: FragmentsGroup;
883
- psetID: number;
884
- propID: number;
885
- }>;
886
- readonly onPsetRemoved: Event<{
887
- model: FragmentsGroup;
888
- psetID: number;
889
- }>;
890
- readonly onDataChanged: Event<{
891
- model: FragmentsGroup;
892
- expressID: number;
893
- }>;
894
- wasm: {
895
- path: string;
896
- absolute: boolean;
897
- };
898
843
  enabled: boolean;
899
- attributeListeners: AttributeListener;
900
- selectedModel?: FragmentsGroup;
901
- changeMap: ChangeMap;
902
- constructor(components: Components);
903
- dispose(): void;
904
- private increaseMaxID;
905
- static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
906
- private newGUID;
907
- private getOwnerHistory;
908
- private registerChange;
909
- setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
910
- newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
911
- pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
912
- rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
913
- }>;
914
- removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
915
- private newSingleProperty;
916
- newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
917
- newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
918
- newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
919
- removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
920
- addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
921
- addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
922
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
923
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
844
+ settings: PropertiesStreamingSettings;
845
+ webIfc: WEBIFC.IfcAPI;
846
+ dispose(): Promise<void>;
847
+ streamFromBuffer(data: Uint8Array): Promise<void>;
848
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
849
+ private readIfcFile;
850
+ private streamIfcFile;
851
+ private streamAllProperties;
852
+ private cleanUp;
924
853
  }
925
- export {};
926
854
  import * as WEBIFC from "web-ifc";
927
- import { IfcItemsCategories } from "../../../ifc";
928
- export declare class SpatialStructure {
929
- itemsByFloor: IfcItemsCategories;
930
- private _units;
931
- setUp(webIfc: WEBIFC.IfcAPI): void;
932
- cleanUp(): void;
933
- }
934
- import * as THREE from "three";
935
- import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
936
- export declare class MiniMap implements Resizeable, Updateable, Disposable {
855
+ import { Components, Disposable, Event, Component } from "../../core";
856
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
857
+ export declare class IfcGeometryTiler extends Component implements Disposable {
858
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
859
+ onGeometryStreamed: Event<{
860
+ buffer: Uint8Array;
861
+ data: StreamedGeometries;
862
+ }>;
863
+ onAssetStreamed: Event<StreamedAsset[]>;
864
+ onProgress: Event<number>;
865
+ onIfcLoaded: Event<Uint8Array>;
937
866
  /** {@link Disposable.onDisposed} */
938
867
  readonly onDisposed: Event<unknown>;
939
- readonly onAfterUpdate: Event<unknown>;
940
- readonly onBeforeUpdate: Event<unknown>;
941
- readonly onResize: Event<THREE.Vector2>;
942
- frontOffset: number;
943
- overrideMaterial: THREE.MeshDepthMaterial;
944
- backgroundColor: THREE.Color;
945
- renderer: THREE.WebGLRenderer;
868
+ settings: IfcStreamingSettings;
946
869
  enabled: boolean;
947
- world: World;
948
- private _lockRotation;
949
- private _camera;
950
- private _plane;
951
- private _size;
952
- private _tempVector1;
953
- private _tempVector2;
954
- private _tempTarget;
955
- private readonly down;
956
- get lockRotation(): boolean;
870
+ webIfc: WEBIFC.IfcAPI;
871
+ private _spatialTree;
872
+ private _metaData;
873
+ private _visitedGeometries;
874
+ private _streamSerializer;
875
+ private _geometries;
876
+ private _geometryCount;
877
+ private _civil;
878
+ private _groupSerializer;
879
+ private _assets;
880
+ private _meshesWithHoles;
881
+ constructor(components: Components);
882
+ dispose(): void;
883
+ streamFromBuffer(data: Uint8Array): Promise<void>;
884
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
885
+ private readIfcFile;
886
+ private streamIfcFile;
887
+ private streamAllGeometries;
888
+ private cleanUp;
889
+ private getMesh;
890
+ private getGeometry;
891
+ private streamAssets;
892
+ private streamGeometries;
893
+ }
894
+ import * as THREE from "three";
895
+ import { Component, Components, Event, World } from "../core";
896
+ export interface VertexPickerConfig {
897
+ showOnlyVertex: boolean;
898
+ snapDistance: number;
899
+ previewElement: HTMLElement;
900
+ }
901
+ export declare class VertexPicker extends Component {
902
+ onVertexFound: Event<THREE.Vector3>;
903
+ onVertexLost: Event<THREE.Vector3>;
904
+ components: Components;
905
+ private _pickedPoint;
906
+ private _config;
907
+ private _enabled;
908
+ private _workingPlane;
909
+ set enabled(value: boolean);
910
+ get enabled(): boolean;
911
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
912
+ set workingPlane(plane: THREE.Plane | null);
913
+ get workingPlane(): THREE.Plane | null;
914
+ set config(value: Partial<VertexPickerConfig>);
915
+ get config(): Partial<VertexPickerConfig>;
916
+ dispose(): void;
917
+ get(world: World): THREE.Vector3 | null;
918
+ private getClosestVertex;
919
+ private getVertices;
920
+ private getVertex;
921
+ }
922
+ export declare const IfcElements: {
923
+ [key: number]: string;
924
+ };
925
+ export declare class UUID {
926
+ private static _pattern;
927
+ private static _lut;
928
+ static create(): string;
929
+ static validate(uuid: string): void;
930
+ }
931
+ import * as THREE from "three";
932
+ import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
933
+ export declare class MiniMap implements Resizeable, Updateable, Disposable {
934
+ /** {@link Disposable.onDisposed} */
935
+ readonly onDisposed: Event<unknown>;
936
+ readonly onAfterUpdate: Event<unknown>;
937
+ readonly onBeforeUpdate: Event<unknown>;
938
+ readonly onResize: Event<THREE.Vector2>;
939
+ frontOffset: number;
940
+ overrideMaterial: THREE.MeshDepthMaterial;
941
+ backgroundColor: THREE.Color;
942
+ renderer: THREE.WebGLRenderer;
943
+ enabled: boolean;
944
+ world: World;
945
+ private _lockRotation;
946
+ private _camera;
947
+ private _plane;
948
+ private _size;
949
+ private _tempVector1;
950
+ private _tempVector2;
951
+ private _tempTarget;
952
+ private readonly down;
953
+ get lockRotation(): boolean;
957
954
  set lockRotation(active: boolean);
958
955
  get zoom(): number;
959
956
  set zoom(value: number);
@@ -973,9 +970,6 @@ export interface IfcItemsCategories {
973
970
  export declare class IfcCategories {
974
971
  getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
975
972
  }
976
- export declare const IfcElements: {
977
- [key: number]: string;
978
- };
979
973
  import * as FRAGS from "@thatopen/fragments";
980
974
  export declare class IfcPropertiesUtils {
981
975
  static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
@@ -1004,97 +998,643 @@ export declare class IfcPropertiesUtils {
1004
998
  export declare const IfcCategoryMap: {
1005
999
  [key: number]: string;
1006
1000
  };
1001
+ import * as WEBIFC from "web-ifc";
1002
+ import { IfcItemsCategories } from "../../../ifc";
1003
+ export declare class SpatialStructure {
1004
+ itemsByFloor: IfcItemsCategories;
1005
+ private _units;
1006
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1007
+ cleanUp(): void;
1008
+ }
1009
+ import * as THREE from "three";
1010
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1011
+ import { Components } from "../../Components";
1012
+ import { Event, World } from "../../Types";
1007
1013
  /**
1008
- * Simple event handler by
1009
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1010
- * Keep in mind that:
1011
- * - If you want to remove it later, you might want to declare the callback as
1012
- * an object.
1013
- * - If you want to maintain the reference to 'this', you will need to declare
1014
- * the callback as an arrow function.
1014
+ * A renderer to determine a mesh visibility on screen
1015
1015
  */
1016
- export declare class Event<T> {
1017
- /**
1018
- * Add a callback to this event instance.
1019
- * @param handler - the callback to be added to this event.
1020
- */
1021
- add(handler: T extends void ? {
1022
- (): void;
1023
- } : {
1024
- (data: T): void;
1025
- }): void;
1026
- /**
1027
- * Removes a callback from this event instance.
1028
- * @param handler - the callback to be removed from this event.
1029
- */
1030
- remove(handler: T extends void ? {
1031
- (): void;
1032
- } : {
1033
- (data: T): void;
1034
- }): void;
1035
- /** Triggers all the callbacks assigned to this event. */
1036
- trigger: (data?: T) => void;
1037
- /** Gets rid of all the suscribed events. */
1038
- reset(): void;
1039
- private handlers;
1016
+ export declare class MeshCullerRenderer extends CullerRenderer {
1017
+ threshold: number;
1018
+ readonly onViewUpdated: Event<{
1019
+ seen: Set<THREE.Mesh>;
1020
+ unseen: Set<THREE.Mesh>;
1021
+ }>;
1022
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1023
+ isProcessing: boolean;
1024
+ private _colorCodeMeshMap;
1025
+ private _meshIDColorCodeMap;
1026
+ private _currentVisibleMeshes;
1027
+ private _recentlyHiddenMeshes;
1028
+ private _intervalID;
1029
+ private readonly _transparentMat;
1030
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1031
+ dispose(): void;
1032
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1033
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1034
+ private handleWorkerMessage;
1035
+ private getAvailableMaterial;
1036
+ }
1037
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1038
+ /// <reference types="node" />
1039
+ import * as THREE from "three";
1040
+ import { Hideable, Event, World } from "../../Types";
1041
+ import { Components } from "../../Components";
1042
+ export interface GridConfig {
1043
+ color: THREE.Color;
1044
+ size1: number;
1045
+ size2: number;
1046
+ distance: number;
1040
1047
  }
1041
1048
  /**
1042
- * Simple event handler by
1043
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1044
- * Keep in mind that:
1045
- * - If you want to remove it later, you might want to declare the callback as
1046
- * an object.
1047
- * - If you want to maintain the reference to 'this', you will need to declare
1048
- * the callback as an arrow function.
1049
+ * An infinite grid. Created by
1050
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1051
+ * and translated to typescript by
1052
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1049
1053
  */
1050
- export declare class AsyncEvent<T> {
1054
+ export declare class SimpleGrid implements Hideable, Disposable {
1055
+ /** {@link Disposable.onDisposed} */
1056
+ readonly onDisposed: Event<unknown>;
1057
+ world: World;
1058
+ components: Components;
1059
+ /** {@link Hideable.visible} */
1060
+ get visible(): boolean;
1061
+ /** {@link Hideable.visible} */
1062
+ set visible(visible: boolean);
1063
+ /** The material of the grid. */
1064
+ get material(): THREE.ShaderMaterial;
1051
1065
  /**
1052
- * Add a callback to this event instance.
1053
- * @param handler - the callback to be added to this event.
1066
+ * Whether the grid should fade away with distance. Recommended to be true for
1067
+ * perspective cameras and false for orthographic cameras.
1054
1068
  */
1055
- add(handler: T extends void ? {
1056
- (): Promise<void>;
1057
- } : {
1058
- (data: T): Promise<void>;
1059
- }): void;
1069
+ get fade(): boolean;
1060
1070
  /**
1061
- * Removes a callback from this event instance.
1062
- * @param handler - the callback to be removed from this event.
1071
+ * Whether the grid should fade away with distance. Recommended to be true for
1072
+ * perspective cameras and false for orthographic cameras.
1063
1073
  */
1064
- remove(handler: T extends void ? {
1065
- (): Promise<void>;
1066
- } : {
1067
- (data: T): Promise<void>;
1068
- }): void;
1069
- /** Triggers all the callbacks assigned to this event. */
1070
- trigger: (data?: T) => Promise<void>;
1071
- /** Gets rid of all the suscribed events. */
1072
- reset(): void;
1073
- private handlers;
1074
+ set fade(active: boolean);
1075
+ readonly three: THREE.Mesh;
1076
+ private _fade;
1077
+ constructor(components: Components, world: World, config: GridConfig);
1078
+ [Symbol.dispose](): void;
1079
+ /** {@link Disposable.dispose} */
1080
+ dispose(): void;
1081
+ private setupEvents;
1082
+ private updateZoom;
1074
1083
  }
1075
- import { InverseAttribute } from "./types";
1076
- export declare const relToAttributesMap: Map<number, {
1077
- forRelating: InverseAttribute;
1078
- forRelated: InverseAttribute;
1079
- }>;
1080
1084
  import * as THREE from "three";
1081
- import CameraControls from "camera-controls";
1082
- import { Event } from "./event";
1085
+ import { Disposable, Event } from "../../Types";
1083
1086
  /**
1084
- * Whether this component has to be manually destroyed once you are done with
1085
- * it to prevent
1086
- * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1087
- * This also ensures that the DOM events created by that component will be
1088
- * cleaned up.
1087
+ * A helper to easily get the real position of the mouse in the Three.js canvas
1088
+ * to work with tools like the
1089
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1090
+ * been transformed through CSS or doesn't occupy the whole screen.
1089
1091
  */
1090
- export interface Disposable {
1092
+ export declare class Mouse implements Disposable {
1093
+ dom: HTMLCanvasElement;
1094
+ private _event?;
1095
+ private _position;
1096
+ /** {@link Disposable.onDisposed} */
1097
+ readonly onDisposed: Event<unknown>;
1098
+ constructor(dom: HTMLCanvasElement);
1091
1099
  /**
1092
- * Destroys the object from memory to prevent a
1093
- * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1100
+ * The real position of the mouse of the Three.js canvas.
1094
1101
  */
1095
- dispose: () => void | Promise<void>;
1096
- /** Fired after the tool has been {@link Disposable.dispose()} */
1097
- readonly onDisposed: Event<any>;
1102
+ get position(): THREE.Vector2;
1103
+ /** {@link Disposable.dispose} */
1104
+ dispose(): void;
1105
+ private getPositionY;
1106
+ private getPositionX;
1107
+ private updateMouseInfo;
1108
+ private setupEvents;
1109
+ }
1110
+ import * as THREE from "three";
1111
+ import { Components } from "../../Components";
1112
+ import { AsyncEvent, Event, World } from "../../Types";
1113
+ export interface CullerRendererSettings {
1114
+ updateInterval?: number;
1115
+ width?: number;
1116
+ height?: number;
1117
+ autoUpdate?: boolean;
1118
+ }
1119
+ /**
1120
+ * A base renderer to determine visibility on screen
1121
+ */
1122
+ export declare class CullerRenderer {
1123
+ /** {@link Disposable.onDisposed} */
1124
+ readonly onDisposed: Event<string>;
1125
+ /**
1126
+ * Fires after making the visibility check to the meshes. It lists the
1127
+ * meshes that are currently visible, and the ones that were visible
1128
+ * just before but not anymore.
1129
+ */
1130
+ readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1131
+ /** {@link Component.enabled} */
1132
+ enabled: boolean;
1133
+ /**
1134
+ * Needs to check whether there are objects that need to be hidden or shown.
1135
+ * You can bind this to the camera movement, to a certain interval, etc.
1136
+ */
1137
+ needsUpdate: boolean;
1138
+ /**
1139
+ * Render the internal scene used to determine the object visibility. Used
1140
+ * for debugging purposes.
1141
+ */
1142
+ renderDebugFrame: boolean;
1143
+ components: Components;
1144
+ readonly world: World;
1145
+ readonly renderer: THREE.WebGLRenderer;
1146
+ protected autoUpdate: boolean;
1147
+ protected updateInterval: number;
1148
+ protected readonly worker: Worker;
1149
+ protected readonly scene: THREE.Scene;
1150
+ private _width;
1151
+ private _height;
1152
+ private _availableColor;
1153
+ private readonly renderTarget;
1154
+ private readonly bufferSize;
1155
+ private readonly _buffer;
1156
+ protected _isWorkerBusy: boolean;
1157
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1158
+ /** {@link Disposable.dispose} */
1159
+ dispose(): void;
1160
+ /**
1161
+ * The function that the culler uses to reprocess the scene. Generally it's
1162
+ * better to call needsUpdate, but you can also call this to force it.
1163
+ * @param force if true, it will refresh the scene even if needsUpdate is
1164
+ * not true.
1165
+ */
1166
+ updateVisibility: (force?: boolean) => Promise<void>;
1167
+ protected getAvailableColor(): {
1168
+ r: number;
1169
+ g: number;
1170
+ b: number;
1171
+ code: string;
1172
+ };
1173
+ protected increaseColor(): void;
1174
+ protected decreaseColor(): void;
1175
+ private applySettings;
1176
+ }
1177
+ import { InverseAttribute } from "./types";
1178
+ export declare const relToAttributesMap: Map<number, {
1179
+ forRelating: InverseAttribute;
1180
+ forRelated: InverseAttribute;
1181
+ }>;
1182
+ import * as THREE from "three";
1183
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1184
+ import { Components } from "../../Components";
1185
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1186
+ /**
1187
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1188
+ */
1189
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1190
+ readonly onAfterUpdate: Event<unknown>;
1191
+ readonly onBeforeUpdate: Event<unknown>;
1192
+ isDisposing: boolean;
1193
+ enabled: boolean;
1194
+ uuid: string;
1195
+ name?: string;
1196
+ readonly onDisposed: Event<unknown>;
1197
+ private _scene?;
1198
+ private _camera?;
1199
+ private _renderer;
1200
+ get scene(): T;
1201
+ set scene(scene: T);
1202
+ get camera(): U;
1203
+ set camera(camera: U);
1204
+ get renderer(): S | null;
1205
+ set renderer(renderer: S | null);
1206
+ constructor(components: Components);
1207
+ update(delta?: number): void;
1208
+ dispose(disposeResources?: boolean): void;
1209
+ }
1210
+ import * as THREE from "three";
1211
+ import { Components } from "../../Components";
1212
+ import { Event, World, Disposable } from "../../Types";
1213
+ import { Mouse } from "./mouse";
1214
+ /**
1215
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1216
+ * that allows to easily get items from the scene using the mouse and touch
1217
+ * events.
1218
+ */
1219
+ export declare class SimpleRaycaster implements Disposable {
1220
+ /** {@link Component.enabled} */
1221
+ enabled: boolean;
1222
+ components: Components;
1223
+ /** {@link Disposable.onDisposed} */
1224
+ readonly onDisposed: Event<unknown>;
1225
+ /** The position of the mouse in the screen. */
1226
+ readonly mouse: Mouse;
1227
+ readonly three: THREE.Raycaster;
1228
+ world: World;
1229
+ constructor(components: Components, world: World);
1230
+ /** {@link Disposable.dispose} */
1231
+ dispose(): void;
1232
+ /**
1233
+ * Throws a ray from the camera to the mouse or touch event point and returns
1234
+ * the first item found. This also takes into account the clipping planes
1235
+ * used by the renderer.
1236
+ *
1237
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1238
+ * to query. If not provided, it will query all the meshes stored in
1239
+ * {@link Components.meshes}.
1240
+ */
1241
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1242
+ 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;
1243
+ private intersect;
1244
+ private filterClippingPlanes;
1245
+ }
1246
+ import * as THREE from "three";
1247
+ import { Hideable, Disposable, Event, World } from "../../Types";
1248
+ import { Components } from "../../Components";
1249
+ /**
1250
+ * Each of the planes created by {@link SimpleClipper}.
1251
+ */
1252
+ export declare class SimplePlane implements Disposable, Hideable {
1253
+ /** Event that fires when the user starts dragging a clipping plane. */
1254
+ readonly onDraggingStarted: Event<unknown>;
1255
+ /** Event that fires when the user stops dragging a clipping plane. */
1256
+ readonly onDraggingEnded: Event<unknown>;
1257
+ /** {@link Disposable.onDisposed} */
1258
+ readonly onDisposed: Event<unknown>;
1259
+ readonly normal: THREE.Vector3;
1260
+ readonly origin: THREE.Vector3;
1261
+ readonly three: THREE.Plane;
1262
+ protected readonly _helper: THREE.Object3D;
1263
+ protected _visible: boolean;
1264
+ protected _enabled: boolean;
1265
+ components: Components;
1266
+ world: World;
1267
+ private _controlsActive;
1268
+ private readonly _arrowBoundBox;
1269
+ private readonly _planeMesh;
1270
+ private readonly _controls;
1271
+ private readonly _hiddenMaterial;
1272
+ get enabled(): boolean;
1273
+ /** {@link Component.enabled} */
1274
+ set enabled(state: boolean);
1275
+ /** {@link Hideable.visible } */
1276
+ get visible(): boolean;
1277
+ /** {@link Hideable.visible } */
1278
+ set visible(state: boolean);
1279
+ /** The meshes used for raycasting */
1280
+ get meshes(): THREE.Mesh[];
1281
+ /** The material of the clipping plane representation. */
1282
+ get planeMaterial(): THREE.Material | THREE.Material[];
1283
+ /** The material of the clipping plane representation. */
1284
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
1285
+ /** The size of the clipping plane representation. */
1286
+ get size(): number;
1287
+ /** Sets the size of the clipping plane representation. */
1288
+ set size(size: number);
1289
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1290
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1291
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
1292
+ /** {@link Updateable.update} */
1293
+ update: () => void;
1294
+ /** {@link Disposable.dispose} */
1295
+ dispose(): void;
1296
+ private reset;
1297
+ protected toggleControls(state: boolean): void;
1298
+ private newTransformControls;
1299
+ private initializeControls;
1300
+ private createArrowBoundingBox;
1301
+ private changeDrag;
1302
+ private notifyDraggingChanged;
1303
+ private preventCameraMovement;
1304
+ private newHelper;
1305
+ private static newPlaneMesh;
1306
+ }
1307
+ import * as THREE from "three";
1308
+ import { BaseScene, Configurable, Event } from "../../Types";
1309
+ import { Components } from "../../Components";
1310
+ export interface SimpleSceneConfig {
1311
+ directionalLight: {
1312
+ color: THREE.Color;
1313
+ intensity: number;
1314
+ position: THREE.Vector3;
1315
+ };
1316
+ ambientLight: {
1317
+ color: THREE.Color;
1318
+ intensity: number;
1319
+ };
1320
+ }
1321
+ /**
1322
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1323
+ * objects hierarchically, and easily dispose them when you are finished with it.
1324
+ * @noInheritDoc
1325
+ */
1326
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1327
+ /** {@link Configurable.isSetup} */
1328
+ isSetup: boolean;
1329
+ three: THREE.Scene;
1330
+ /** {@link Configurable.onSetup} */
1331
+ readonly onSetup: Event<SimpleScene>;
1332
+ config: Required<SimpleSceneConfig>;
1333
+ constructor(components: Components);
1334
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1335
+ setup(config?: Partial<SimpleSceneConfig>): void;
1336
+ }
1337
+ import { NavigationMode } from "./types";
1338
+ import { OrthoPerspectiveCamera } from "../index";
1339
+ /**
1340
+ * A {@link NavigationMode} that allows first person navigation,
1341
+ * simulating FPS video games.
1342
+ */
1343
+ export declare class FirstPersonMode implements NavigationMode {
1344
+ private camera;
1345
+ /** {@link NavigationMode.enabled} */
1346
+ enabled: boolean;
1347
+ /** {@link NavigationMode.id} */
1348
+ readonly id = "FirstPerson";
1349
+ constructor(camera: OrthoPerspectiveCamera);
1350
+ /** {@link NavigationMode.set} */
1351
+ set(active: boolean): void;
1352
+ private setupFirstPersonCamera;
1353
+ }
1354
+ import * as THREE from "three";
1355
+ import CameraControls from "camera-controls";
1356
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1357
+ import { Components } from "../../Components";
1358
+ /**
1359
+ * A basic camera that uses
1360
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1361
+ * easily control the camera in 2D and 3D. Check out it's API to find out
1362
+ * what features it offers.
1363
+ */
1364
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1365
+ /** {@link Updateable.onBeforeUpdate} */
1366
+ readonly onBeforeUpdate: Event<SimpleCamera>;
1367
+ /** {@link Updateable.onAfterUpdate} */
1368
+ readonly onAfterUpdate: Event<SimpleCamera>;
1369
+ readonly onAspectUpdated: Event<unknown>;
1370
+ /** {@link Disposable.onDisposed} */
1371
+ readonly onDisposed: Event<string>;
1372
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1373
+ private _allControls;
1374
+ /**
1375
+ * The object that controls the camera. An instance of
1376
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1377
+ * Transforming the camera directly will have no effect: you need to use this
1378
+ * object to move, rotate, look at objects, etc.
1379
+ */
1380
+ get controls(): CameraControls;
1381
+ /** {@link Component.enabled} */
1382
+ get enabled(): boolean;
1383
+ /** {@link Component.enabled} */
1384
+ set enabled(enabled: boolean);
1385
+ constructor(components: Components);
1386
+ /** {@link Disposable.dispose} */
1387
+ dispose(): void;
1388
+ /** {@link Updateable.update} */
1389
+ update(_delta: number): void;
1390
+ /**
1391
+ * Updates the aspect of the camera to match the size of the
1392
+ * {@link Components.renderer}.
1393
+ */
1394
+ updateAspect: () => void;
1395
+ private setupCamera;
1396
+ private newCameraControls;
1397
+ private setupEvents;
1398
+ private static getSubsetOfThree;
1399
+ }
1400
+ import * as THREE from "three";
1401
+ import { CameraProjection } from "./types";
1402
+ import { Event } from "../../Types";
1403
+ import { OrthoPerspectiveCamera } from "../index";
1404
+ /**
1405
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1406
+ */
1407
+ export declare class ProjectionManager {
1408
+ /**
1409
+ * Event that fires when the {@link CameraProjection} changes.
1410
+ */
1411
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1412
+ current: CameraProjection;
1413
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1414
+ private _component;
1415
+ private _previousDistance;
1416
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1417
+ matchOrthoDistanceEnabled: boolean;
1418
+ constructor(camera: OrthoPerspectiveCamera);
1419
+ /**
1420
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1421
+ *
1422
+ * @param projection - the new projection to set. If it is the current projection,
1423
+ * it will have no effect.
1424
+ */
1425
+ set(projection: CameraProjection): Promise<void>;
1426
+ /**
1427
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1428
+ * and vice versa.
1429
+ */
1430
+ toggle(): Promise<void>;
1431
+ private setOrthoCamera;
1432
+ private getPerspectiveDims;
1433
+ private setupOrthoCamera;
1434
+ private getDistance;
1435
+ private setPerspectiveCamera;
1436
+ }
1437
+ import { NavigationMode } from "./types";
1438
+ import { OrthoPerspectiveCamera } from "../index";
1439
+ /**
1440
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1441
+ * like many BIM tools.
1442
+ */
1443
+ export declare class PlanMode implements NavigationMode {
1444
+ private camera;
1445
+ /** {@link NavigationMode.enabled} */
1446
+ enabled: boolean;
1447
+ /** {@link NavigationMode.id} */
1448
+ readonly id = "Plan";
1449
+ private mouseAction1?;
1450
+ private mouseAction2?;
1451
+ private mouseInitialized;
1452
+ private readonly defaultAzimuthSpeed;
1453
+ private readonly defaultPolarSpeed;
1454
+ constructor(camera: OrthoPerspectiveCamera);
1455
+ /** {@link NavigationMode.set} */
1456
+ set(active: boolean): void;
1457
+ }
1458
+ /**
1459
+ * The projection system of the camera.
1460
+ */
1461
+ export type CameraProjection = "Perspective" | "Orthographic";
1462
+ /**
1463
+ * The extensible list of supported navigation modes.
1464
+ */
1465
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1466
+ /**
1467
+ * An object that determines the behavior of the camera controls
1468
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1469
+ */
1470
+ export interface NavigationMode {
1471
+ /** The unique ID of this navigation mode. */
1472
+ id: NavModeID;
1473
+ /**
1474
+ * Enable or disable this navigation mode.
1475
+ * When a new navigation mode is enabled, the previous navigation mode
1476
+ * must be disabled.
1477
+ *
1478
+ * @param active - whether to enable or disable this mode.
1479
+ * @param options - any additional data required to enable or disable it.
1480
+ * */
1481
+ set: (active: boolean, options?: any) => void;
1482
+ /** Whether this navigation mode is active or not. */
1483
+ enabled: boolean;
1484
+ }
1485
+ import * as THREE from "three";
1486
+ import { BaseRenderer, Event } from "../../Types";
1487
+ import { Components } from "../../Components";
1488
+ /**
1489
+ * A basic renderer capable of rendering
1490
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1491
+ */
1492
+ export declare class SimpleRenderer extends BaseRenderer {
1493
+ enabled: boolean;
1494
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
1495
+ container: HTMLElement;
1496
+ three: THREE.WebGLRenderer;
1497
+ protected _canvas: HTMLCanvasElement;
1498
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1499
+ protected _resizeObserver: ResizeObserver | null;
1500
+ protected onContainerUpdated: Event<unknown>;
1501
+ private _resizing;
1502
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1503
+ /** {@link Updateable.update} */
1504
+ update(): void;
1505
+ /** {@link Disposable.dispose} */
1506
+ dispose(): void;
1507
+ /** {@link Resizeable.getSize}. */
1508
+ getSize(): THREE.Vector2;
1509
+ /** {@link Resizeable.resize} */
1510
+ resize: (size?: THREE.Vector2) => void;
1511
+ setupEvents(active: boolean): void;
1512
+ private resizeEvent;
1513
+ private setupRenderer;
1514
+ private onContextLost;
1515
+ private onContextBack;
1516
+ }
1517
+ /**
1518
+ * Simple event handler by
1519
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1520
+ * Keep in mind that:
1521
+ * - If you want to remove it later, you might want to declare the callback as
1522
+ * an object.
1523
+ * - If you want to maintain the reference to 'this', you will need to declare
1524
+ * the callback as an arrow function.
1525
+ */
1526
+ export declare class Event<T> {
1527
+ /**
1528
+ * Add a callback to this event instance.
1529
+ * @param handler - the callback to be added to this event.
1530
+ */
1531
+ add(handler: T extends void ? {
1532
+ (): void;
1533
+ } : {
1534
+ (data: T): void;
1535
+ }): void;
1536
+ /**
1537
+ * Removes a callback from this event instance.
1538
+ * @param handler - the callback to be removed from this event.
1539
+ */
1540
+ remove(handler: T extends void ? {
1541
+ (): void;
1542
+ } : {
1543
+ (data: T): void;
1544
+ }): void;
1545
+ /** Triggers all the callbacks assigned to this event. */
1546
+ trigger: (data?: T) => void;
1547
+ /** Gets rid of all the suscribed events. */
1548
+ reset(): void;
1549
+ private handlers;
1550
+ }
1551
+ import { NavigationMode } from "./types";
1552
+ import { OrthoPerspectiveCamera } from "../index";
1553
+ /**
1554
+ * A {@link NavigationMode} that allows 3D navigation and panning
1555
+ * like in many 3D and CAD softwares.
1556
+ */
1557
+ export declare class OrbitMode implements NavigationMode {
1558
+ camera: OrthoPerspectiveCamera;
1559
+ /** {@link NavigationMode.enabled} */
1560
+ enabled: boolean;
1561
+ /** {@link NavigationMode.id} */
1562
+ readonly id = "Orbit";
1563
+ constructor(camera: OrthoPerspectiveCamera);
1564
+ /** {@link NavigationMode.set} */
1565
+ set(active: boolean): void;
1566
+ private activateOrbitControls;
1567
+ }
1568
+ /**
1569
+ * Simple event handler by
1570
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1571
+ * Keep in mind that:
1572
+ * - If you want to remove it later, you might want to declare the callback as
1573
+ * an object.
1574
+ * - If you want to maintain the reference to 'this', you will need to declare
1575
+ * the callback as an arrow function.
1576
+ */
1577
+ export declare class AsyncEvent<T> {
1578
+ /**
1579
+ * Add a callback to this event instance.
1580
+ * @param handler - the callback to be added to this event.
1581
+ */
1582
+ add(handler: T extends void ? {
1583
+ (): Promise<void>;
1584
+ } : {
1585
+ (data: T): Promise<void>;
1586
+ }): void;
1587
+ /**
1588
+ * Removes a callback from this event instance.
1589
+ * @param handler - the callback to be removed from this event.
1590
+ */
1591
+ remove(handler: T extends void ? {
1592
+ (): Promise<void>;
1593
+ } : {
1594
+ (data: T): Promise<void>;
1595
+ }): void;
1596
+ /** Triggers all the callbacks assigned to this event. */
1597
+ trigger: (data?: T) => Promise<void>;
1598
+ /** Gets rid of all the suscribed events. */
1599
+ reset(): void;
1600
+ private handlers;
1601
+ }
1602
+ import { Base } from "./base";
1603
+ /**
1604
+ * Components are the building blocks of this library. Components are singleton
1605
+ * elements that contain specific functionality. For instance, the SimpleClipper
1606
+ * Component can create, delete and handle 3D clipping planes. Components must be
1607
+ * unique (they can't be instanced more than once), and have a static UUID that
1608
+ * identifies them uniquely. The can be accessed globally using the {@link Components}
1609
+ * instance.
1610
+ */
1611
+ export declare abstract class Component extends Base {
1612
+ /**
1613
+ * Whether this component is active or not. The behaviour can vary depending
1614
+ * on the type of component. E.g. a disabled dimension tool will stop creating
1615
+ * dimensions, while a disabled camera will stop moving. A disabled component
1616
+ * will not be updated automatically each frame.
1617
+ */
1618
+ abstract enabled: boolean;
1619
+ }
1620
+ import * as THREE from "three";
1621
+ import CameraControls from "camera-controls";
1622
+ import { Event } from "./event";
1623
+ /**
1624
+ * Whether this component has to be manually destroyed once you are done with
1625
+ * it to prevent
1626
+ * [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1627
+ * This also ensures that the DOM events created by that component will be
1628
+ * cleaned up.
1629
+ */
1630
+ export interface Disposable {
1631
+ /**
1632
+ * Destroys the object from memory to prevent a
1633
+ * [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
1634
+ */
1635
+ dispose: () => void | Promise<void>;
1636
+ /** Fired after the tool has been {@link Disposable.dispose()} */
1637
+ readonly onDisposed: Event<any>;
1098
1638
  }
1099
1639
  /**
1100
1640
  * Whether the geometric representation of this component can be
@@ -1195,479 +1735,124 @@ export interface BVHGeometry extends THREE.BufferGeometry {
1195
1735
  disposeBoundsTree: () => void;
1196
1736
  }
1197
1737
  /**
1198
- * Whether a camera uses the Camera Controls library.
1199
- */
1200
- export interface CameraControllable {
1201
- controls: CameraControls;
1202
- }
1203
- import { Base } from "./base";
1204
- /**
1205
- * Components are the building blocks of this library. Components are singleton
1206
- * elements that contain specific functionality. For instance, the SimpleClipper
1207
- * Component can create, delete and handle 3D clipping planes. Components must be
1208
- * unique (they can't be instanced more than once), and have a static UUID that
1209
- * identifies them uniquely. The can be accessed globally using the {@link Components}
1210
- * instance.
1211
- */
1212
- export declare abstract class Component extends Base {
1213
- /**
1214
- * Whether this component is active or not. The behaviour can vary depending
1215
- * on the type of component. E.g. a disabled dimension tool will stop creating
1216
- * dimensions, while a disabled camera will stop moving. A disabled component
1217
- * will not be updated automatically each frame.
1218
- */
1219
- abstract enabled: boolean;
1220
- }
1221
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1222
- import { Components } from "../../Components";
1223
- /**
1224
- * Base class of the library. Useful for finding out the interfaces it implements.
1225
- */
1226
- export declare abstract class Base {
1227
- components: Components;
1228
- constructor(components: Components);
1229
- /** Whether is component is {@link Disposable}. */
1230
- isDisposeable: () => this is Disposable;
1231
- /** Whether is component is {@link Resizeable}. */
1232
- isResizeable: () => this is Resizeable;
1233
- /** Whether is component is {@link Updateable}. */
1234
- isUpdateable: () => this is Updateable;
1235
- /** Whether is component is {@link Hideable}. */
1236
- isHideable: () => this is Hideable;
1237
- /** Whether is component is {@link Configurable}. */
1238
- isConfigurable: () => this is Configurable<any>;
1239
- }
1240
- import { Base } from "./base";
1241
- import { World } from "./world";
1242
- import { Event } from "./event";
1243
- import { Components } from "../../Components";
1244
- /**
1245
- * One of the elements that make a world. It can be either a scene, a camera
1246
- * or a renderer.
1247
- */
1248
- export declare abstract class BaseWorldItem extends Base {
1249
- readonly worlds: Map<string, World>;
1250
- readonly onWorldChanged: Event<{
1251
- world: World;
1252
- action: "added" | "removed";
1253
- }>;
1254
- currentWorld: World | null;
1255
- protected constructor(components: Components);
1256
- }
1257
- import * as THREE from "three";
1258
- import CameraControls from "camera-controls";
1259
- import { BaseWorldItem } from "./base-world-item";
1260
- import { CameraControllable } from "./interfaces";
1261
- export declare abstract class BaseCamera extends BaseWorldItem {
1262
- abstract enabled: boolean;
1263
- abstract three: THREE.Camera;
1264
- abstract controls?: CameraControls;
1265
- /** Whether is instance is {@link CameraControllable}. */
1266
- hasCameraControls: () => this is CameraControllable;
1267
- }
1268
- import * as THREE from "three";
1269
- import { Vector2 } from "three";
1270
- import { Event } from "./event";
1271
- import { BaseWorldItem } from "./base-world-item";
1272
- import { Disposable, Resizeable, Updateable } from "./interfaces";
1273
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1274
- abstract three: THREE.WebGLRenderer;
1275
- /** {@link Updateable.onBeforeUpdate} */
1276
- onAfterUpdate: Event<unknown>;
1277
- /** {@link Updateable.onAfterUpdate} */
1278
- onBeforeUpdate: Event<unknown>;
1279
- /** {@link Disposable.onDisposed} */
1280
- readonly onDisposed: Event<undefined>;
1281
- readonly onResize: Event<THREE.Vector2>;
1282
- /**
1283
- * Event that fires when there has been a change to the list of clipping
1284
- * planes used by the active renderer.
1285
- */
1286
- readonly onClippingPlanesUpdated: Event<unknown>;
1287
- abstract update(delta?: number): void | Promise<void>;
1288
- abstract dispose(): void;
1289
- abstract getSize(): Vector2;
1290
- abstract resize(size: Vector2 | undefined): void;
1291
- /**
1292
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1293
- * instance of the renderer.
1294
- */
1295
- clippingPlanes: THREE.Plane[];
1296
- /**
1297
- * Forces the update of the clipping planes and all components that depend
1298
- * on them that are subscribed to 'onClippingPlanesUpdated'.
1299
- */
1300
- updateClippingPlanes(): void;
1301
- /**
1302
- * Adds or removes a
1303
- * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1304
- * to the renderer.
1305
- */
1306
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1307
- }
1308
- import * as THREE from "three";
1309
- import { Disposable } from "./interfaces";
1310
- import { Event } from "./event";
1311
- import { Components } from "../../Components";
1312
- import { BaseWorldItem } from "./base-world-item";
1313
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1314
- /** {@link Disposable.onDisposed} */
1315
- readonly onDisposed: Event<unknown>;
1316
- abstract three: THREE.Object3D;
1317
- protected constructor(components: Components);
1318
- /** {@link Disposable.dispose} */
1319
- dispose(): void;
1320
- }
1321
- import * as THREE from "three";
1322
- import { BaseScene } from "./base-scene";
1323
- import { BaseCamera } from "./base-camera";
1324
- import { BaseRenderer } from "./base-renderer";
1325
- import { Updateable, Disposable } from "./interfaces";
1326
- export interface World extends Disposable, Updateable {
1327
- meshes: Set<THREE.Mesh>;
1328
- scene: BaseScene;
1329
- camera: BaseCamera;
1330
- renderer: BaseRenderer | null;
1331
- uuid: string;
1332
- }
1333
- import * as THREE from "three";
1334
- import { Disposable, Event } from "../../Types";
1335
- /**
1336
- * A helper to easily get the real position of the mouse in the Three.js canvas
1337
- * to work with tools like the
1338
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1339
- * been transformed through CSS or doesn't occupy the whole screen.
1340
- */
1341
- export declare class Mouse implements Disposable {
1342
- dom: HTMLCanvasElement;
1343
- private _event?;
1344
- private _position;
1345
- /** {@link Disposable.onDisposed} */
1346
- readonly onDisposed: Event<unknown>;
1347
- constructor(dom: HTMLCanvasElement);
1348
- /**
1349
- * The real position of the mouse of the Three.js canvas.
1350
- */
1351
- get position(): THREE.Vector2;
1352
- /** {@link Disposable.dispose} */
1353
- dispose(): void;
1354
- private getPositionY;
1355
- private getPositionX;
1356
- private updateMouseInfo;
1357
- private setupEvents;
1358
- }
1359
- import * as THREE from "three";
1360
- import { Components } from "../../Components";
1361
- import { Event, World, Disposable } from "../../Types";
1362
- import { Mouse } from "./mouse";
1363
- /**
1364
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1365
- * that allows to easily get items from the scene using the mouse and touch
1366
- * events.
1367
- */
1368
- export declare class SimpleRaycaster implements Disposable {
1369
- /** {@link Component.enabled} */
1370
- enabled: boolean;
1371
- components: Components;
1372
- /** {@link Disposable.onDisposed} */
1373
- readonly onDisposed: Event<unknown>;
1374
- /** The position of the mouse in the screen. */
1375
- readonly mouse: Mouse;
1376
- readonly three: THREE.Raycaster;
1377
- world: World;
1378
- constructor(components: Components, world: World);
1379
- /** {@link Disposable.dispose} */
1380
- dispose(): void;
1381
- /**
1382
- * Throws a ray from the camera to the mouse or touch event point and returns
1383
- * the first item found. This also takes into account the clipping planes
1384
- * used by the renderer.
1385
- *
1386
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1387
- * to query. If not provided, it will query all the meshes stored in
1388
- * {@link Components.meshes}.
1389
- */
1390
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1391
- 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;
1392
- private intersect;
1393
- private filterClippingPlanes;
1394
- }
1395
- import * as THREE from "three";
1396
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1397
- import { Components } from "../../Components";
1398
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1399
- /**
1400
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1401
- */
1402
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1403
- readonly onAfterUpdate: Event<unknown>;
1404
- readonly onBeforeUpdate: Event<unknown>;
1405
- enabled: boolean;
1406
- uuid: string;
1407
- readonly onDisposed: Event<unknown>;
1408
- private _scene?;
1409
- private _camera?;
1410
- private _renderer;
1411
- get scene(): T;
1412
- set scene(scene: T);
1413
- get camera(): U;
1414
- set camera(camera: U);
1415
- get renderer(): S | null;
1416
- set renderer(renderer: S | null);
1417
- constructor(components: Components);
1418
- update(delta?: number): void;
1419
- dispose(disposeResources?: boolean): void;
1420
- }
1421
- import * as THREE from "three";
1422
- import { BaseScene, Configurable, Event } from "../../Types";
1423
- import { Components } from "../../Components";
1424
- export interface SimpleSceneConfig {
1425
- directionalLight: {
1426
- color: THREE.Color;
1427
- intensity: number;
1428
- position: THREE.Vector3;
1429
- };
1430
- ambientLight: {
1431
- color: THREE.Color;
1432
- intensity: number;
1433
- };
1738
+ * Whether a camera uses the Camera Controls library.
1739
+ */
1740
+ export interface CameraControllable {
1741
+ controls: CameraControls;
1434
1742
  }
1743
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1744
+ import { Components } from "../../Components";
1435
1745
  /**
1436
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1437
- * objects hierarchically, and easily dispose them when you are finished with it.
1438
- * @noInheritDoc
1746
+ * Base class of the library. Useful for finding out the interfaces it implements.
1439
1747
  */
1440
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1441
- /** {@link Configurable.isSetup} */
1442
- isSetup: boolean;
1443
- three: THREE.Scene;
1444
- /** {@link Configurable.onSetup} */
1445
- readonly onSetup: Event<SimpleScene>;
1446
- config: Required<SimpleSceneConfig>;
1748
+ export declare abstract class Base {
1749
+ components: Components;
1447
1750
  constructor(components: Components);
1448
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1449
- setup(config?: Partial<SimpleSceneConfig>): void;
1751
+ /** Whether is component is {@link Disposable}. */
1752
+ isDisposeable: () => this is Disposable;
1753
+ /** Whether is component is {@link Resizeable}. */
1754
+ isResizeable: () => this is Resizeable;
1755
+ /** Whether is component is {@link Updateable}. */
1756
+ isUpdateable: () => this is Updateable;
1757
+ /** Whether is component is {@link Hideable}. */
1758
+ isHideable: () => this is Hideable;
1759
+ /** Whether is component is {@link Configurable}. */
1760
+ isConfigurable: () => this is Configurable<any>;
1450
1761
  }
1451
- import * as THREE from "three";
1452
- import { BaseRenderer, Event } from "../../Types";
1762
+ import { Base } from "./base";
1763
+ import { World } from "./world";
1764
+ import { Event } from "./event";
1453
1765
  import { Components } from "../../Components";
1454
1766
  /**
1455
- * A basic renderer capable of rendering
1456
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1767
+ * One of the elements that make a world. It can be either a scene, a camera
1768
+ * or a renderer.
1457
1769
  */
1458
- export declare class SimpleRenderer extends BaseRenderer {
1459
- enabled: boolean;
1460
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1461
- container: HTMLElement;
1462
- three: THREE.WebGLRenderer;
1463
- protected _canvas: HTMLCanvasElement;
1464
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1465
- protected _resizeObserver: ResizeObserver | null;
1466
- protected onContainerUpdated: Event<unknown>;
1467
- private _resizing;
1468
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1469
- /** {@link Updateable.update} */
1470
- update(): void;
1471
- /** {@link Disposable.dispose} */
1472
- dispose(): void;
1473
- /** {@link Resizeable.getSize}. */
1474
- getSize(): THREE.Vector2;
1475
- /** {@link Resizeable.resize} */
1476
- resize: (size?: THREE.Vector2) => void;
1477
- setupEvents(active: boolean): void;
1478
- private resizeEvent;
1479
- private setupRenderer;
1480
- private onContextLost;
1481
- private onContextBack;
1770
+ export declare abstract class BaseWorldItem extends Base {
1771
+ readonly worlds: Map<string, World>;
1772
+ readonly onWorldChanged: Event<{
1773
+ world: World;
1774
+ action: "added" | "removed";
1775
+ }>;
1776
+ currentWorld: World | null;
1777
+ protected constructor(components: Components);
1482
1778
  }
1483
1779
  import * as THREE from "three";
1484
1780
  import CameraControls from "camera-controls";
1485
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1486
- import { Components } from "../../Components";
1487
- /**
1488
- * A basic camera that uses
1489
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1490
- * easily control the camera in 2D and 3D. Check out it's API to find out
1491
- * what features it offers.
1492
- */
1493
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1781
+ import { BaseWorldItem } from "./base-world-item";
1782
+ import { CameraControllable } from "./interfaces";
1783
+ export declare abstract class BaseCamera extends BaseWorldItem {
1784
+ abstract enabled: boolean;
1785
+ abstract three: THREE.Camera;
1786
+ abstract controls?: CameraControls;
1787
+ /** Whether is instance is {@link CameraControllable}. */
1788
+ hasCameraControls: () => this is CameraControllable;
1789
+ }
1790
+ import * as THREE from "three";
1791
+ import { Vector2 } from "three";
1792
+ import { Event } from "./event";
1793
+ import { BaseWorldItem } from "./base-world-item";
1794
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
1795
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1796
+ abstract three: THREE.WebGLRenderer;
1494
1797
  /** {@link Updateable.onBeforeUpdate} */
1495
- readonly onBeforeUpdate: Event<SimpleCamera>;
1798
+ onAfterUpdate: Event<unknown>;
1496
1799
  /** {@link Updateable.onAfterUpdate} */
1497
- readonly onAfterUpdate: Event<SimpleCamera>;
1498
- readonly onAspectUpdated: Event<unknown>;
1800
+ onBeforeUpdate: Event<unknown>;
1499
1801
  /** {@link Disposable.onDisposed} */
1500
- readonly onDisposed: Event<string>;
1501
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1502
- private _allControls;
1802
+ readonly onDisposed: Event<undefined>;
1803
+ readonly onResize: Event<THREE.Vector2>;
1503
1804
  /**
1504
- * The object that controls the camera. An instance of
1505
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1506
- * Transforming the camera directly will have no effect: you need to use this
1507
- * object to move, rotate, look at objects, etc.
1805
+ * Event that fires when there has been a change to the list of clipping
1806
+ * planes used by the active renderer.
1508
1807
  */
1509
- get controls(): CameraControls;
1510
- /** {@link Component.enabled} */
1511
- get enabled(): boolean;
1512
- /** {@link Component.enabled} */
1513
- set enabled(enabled: boolean);
1514
- constructor(components: Components);
1515
- /** {@link Disposable.dispose} */
1516
- dispose(): void;
1517
- /** {@link Updateable.update} */
1518
- update(_delta: number): void;
1808
+ readonly onClippingPlanesUpdated: Event<unknown>;
1809
+ abstract update(delta?: number): void | Promise<void>;
1810
+ abstract dispose(): void;
1811
+ abstract getSize(): Vector2;
1812
+ abstract resize(size: Vector2 | undefined): void;
1519
1813
  /**
1520
- * Updates the aspect of the camera to match the size of the
1521
- * {@link Components.renderer}.
1814
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1815
+ * instance of the renderer.
1522
1816
  */
1523
- updateAspect: () => void;
1524
- private setupCamera;
1525
- private newCameraControls;
1526
- private setupEvents;
1527
- private static getSubsetOfThree;
1528
- }
1529
- /// <reference types="node" />
1530
- import * as THREE from "three";
1531
- import { Hideable, Event, World } from "../../Types";
1532
- import { Components } from "../../Components";
1533
- export interface GridConfig {
1534
- color: THREE.Color;
1535
- size1: number;
1536
- size2: number;
1537
- distance: number;
1538
- }
1539
- /**
1540
- * An infinite grid. Created by
1541
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1542
- * and translated to typescript by
1543
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1544
- */
1545
- export declare class SimpleGrid implements Hideable, Disposable {
1546
- /** {@link Disposable.onDisposed} */
1547
- readonly onDisposed: Event<unknown>;
1548
- world: World;
1549
- components: Components;
1550
- /** {@link Hideable.visible} */
1551
- get visible(): boolean;
1552
- /** {@link Hideable.visible} */
1553
- set visible(visible: boolean);
1554
- /** The material of the grid. */
1555
- get material(): THREE.ShaderMaterial;
1817
+ clippingPlanes: THREE.Plane[];
1556
1818
  /**
1557
- * Whether the grid should fade away with distance. Recommended to be true for
1558
- * perspective cameras and false for orthographic cameras.
1819
+ * Forces the update of the clipping planes and all components that depend
1820
+ * on them that are subscribed to 'onClippingPlanesUpdated'.
1559
1821
  */
1560
- get fade(): boolean;
1822
+ updateClippingPlanes(): void;
1561
1823
  /**
1562
- * Whether the grid should fade away with distance. Recommended to be true for
1563
- * perspective cameras and false for orthographic cameras.
1824
+ * Adds or removes a
1825
+ * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1826
+ * to the renderer.
1564
1827
  */
1565
- set fade(active: boolean);
1566
- readonly three: THREE.Mesh;
1567
- private _fade;
1568
- constructor(components: Components, world: World, config: GridConfig);
1569
- [Symbol.dispose](): void;
1570
- /** {@link Disposable.dispose} */
1571
- dispose(): void;
1572
- private setupEvents;
1573
- private updateZoom;
1828
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1574
1829
  }
1575
1830
  import * as THREE from "three";
1831
+ import { Disposable } from "./interfaces";
1832
+ import { Event } from "./event";
1576
1833
  import { Components } from "../../Components";
1577
- import { AsyncEvent, Event, World } from "../../Types";
1578
- export interface CullerRendererSettings {
1579
- updateInterval?: number;
1580
- width?: number;
1581
- height?: number;
1582
- autoUpdate?: boolean;
1583
- }
1584
- /**
1585
- * A base renderer to determine visibility on screen
1586
- */
1587
- export declare class CullerRenderer {
1834
+ import { BaseWorldItem } from "./base-world-item";
1835
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1588
1836
  /** {@link Disposable.onDisposed} */
1589
- readonly onDisposed: Event<string>;
1590
- /**
1591
- * Fires after making the visibility check to the meshes. It lists the
1592
- * meshes that are currently visible, and the ones that were visible
1593
- * just before but not anymore.
1594
- */
1595
- readonly onViewUpdated: Event<any> | AsyncEvent<any>;
1596
- /** {@link Component.enabled} */
1597
- enabled: boolean;
1598
- /**
1599
- * Needs to check whether there are objects that need to be hidden or shown.
1600
- * You can bind this to the camera movement, to a certain interval, etc.
1601
- */
1602
- needsUpdate: boolean;
1603
- /**
1604
- * Render the internal scene used to determine the object visibility. Used
1605
- * for debugging purposes.
1606
- */
1607
- renderDebugFrame: boolean;
1608
- components: Components;
1609
- readonly world: World;
1610
- readonly renderer: THREE.WebGLRenderer;
1611
- protected autoUpdate: boolean;
1612
- protected updateInterval: number;
1613
- protected readonly worker: Worker;
1614
- protected readonly scene: THREE.Scene;
1615
- private _width;
1616
- private _height;
1617
- private _availableColor;
1618
- private readonly renderTarget;
1619
- private readonly bufferSize;
1620
- private readonly _buffer;
1621
- protected _isWorkerBusy: boolean;
1622
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1623
- /** {@link Disposable.dispose} */
1624
- dispose(): void;
1625
- /**
1626
- * The function that the culler uses to reprocess the scene. Generally it's
1627
- * better to call needsUpdate, but you can also call this to force it.
1628
- * @param force if true, it will refresh the scene even if needsUpdate is
1629
- * not true.
1630
- */
1631
- updateVisibility: (force?: boolean) => Promise<void>;
1632
- protected getAvailableColor(): {
1633
- r: number;
1634
- g: number;
1635
- b: number;
1636
- code: string;
1637
- };
1638
- protected increaseColor(): void;
1639
- protected decreaseColor(): void;
1640
- private applySettings;
1837
+ readonly onDisposed: Event<unknown>;
1838
+ abstract three: THREE.Object3D;
1839
+ protected constructor(components: Components);
1840
+ /** {@link Disposable.dispose} */
1841
+ dispose(): void;
1641
1842
  }
1642
1843
  import * as THREE from "three";
1643
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1644
- import { Components } from "../../Components";
1645
- import { Event, World } from "../../Types";
1646
- /**
1647
- * A renderer to determine a mesh visibility on screen
1648
- */
1649
- export declare class MeshCullerRenderer extends CullerRenderer {
1650
- threshold: number;
1651
- readonly onViewUpdated: Event<{
1652
- seen: Set<THREE.Mesh>;
1653
- unseen: Set<THREE.Mesh>;
1654
- }>;
1655
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1656
- isProcessing: boolean;
1657
- private _colorCodeMeshMap;
1658
- private _meshIDColorCodeMap;
1659
- private _currentVisibleMeshes;
1660
- private _recentlyHiddenMeshes;
1661
- private _intervalID;
1662
- private readonly _transparentMat;
1663
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1664
- dispose(): void;
1665
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1666
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1667
- private handleWorkerMessage;
1668
- private getAvailableMaterial;
1844
+ import { BaseScene } from "./base-scene";
1845
+ import { BaseCamera } from "./base-camera";
1846
+ import { BaseRenderer } from "./base-renderer";
1847
+ import { Updateable, Disposable } from "./interfaces";
1848
+ export interface World extends Disposable, Updateable {
1849
+ meshes: Set<THREE.Mesh>;
1850
+ scene: BaseScene;
1851
+ camera: BaseCamera;
1852
+ renderer: BaseRenderer | null;
1853
+ uuid: string;
1854
+ isDisposing: boolean;
1669
1855
  }
1670
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1671
1856
  import * as WEBIFC from "web-ifc";
1672
1857
  /** Configuration of the IFC-fragment conversion. */
1673
1858
  export declare class IfcFragmentSettings {
@@ -1714,135 +1899,6 @@ import * as WEBIFC from "web-ifc";
1714
1899
  export declare class IfcMetadataReader {
1715
1900
  get(webIfc: WEBIFC.IfcAPI, type: number): string;
1716
1901
  }
1717
- import { NavigationMode } from "./types";
1718
- import { OrthoPerspectiveCamera } from "../index";
1719
- /**
1720
- * A {@link NavigationMode} that allows first person navigation,
1721
- * simulating FPS video games.
1722
- */
1723
- export declare class FirstPersonMode implements NavigationMode {
1724
- private camera;
1725
- /** {@link NavigationMode.enabled} */
1726
- enabled: boolean;
1727
- /** {@link NavigationMode.id} */
1728
- readonly id = "FirstPerson";
1729
- constructor(camera: OrthoPerspectiveCamera);
1730
- /** {@link NavigationMode.set} */
1731
- set(active: boolean): void;
1732
- private setupFirstPersonCamera;
1733
- }
1734
- import { NavigationMode } from "./types";
1735
- import { OrthoPerspectiveCamera } from "../index";
1736
- /**
1737
- * A {@link NavigationMode} that allows 3D navigation and panning
1738
- * like in many 3D and CAD softwares.
1739
- */
1740
- export declare class OrbitMode implements NavigationMode {
1741
- camera: OrthoPerspectiveCamera;
1742
- /** {@link NavigationMode.enabled} */
1743
- enabled: boolean;
1744
- /** {@link NavigationMode.id} */
1745
- readonly id = "Orbit";
1746
- constructor(camera: OrthoPerspectiveCamera);
1747
- /** {@link NavigationMode.set} */
1748
- set(active: boolean): void;
1749
- private activateOrbitControls;
1750
- }
1751
- import { NavigationMode } from "./types";
1752
- import { OrthoPerspectiveCamera } from "../index";
1753
- /**
1754
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1755
- * like many BIM tools.
1756
- */
1757
- export declare class PlanMode implements NavigationMode {
1758
- private camera;
1759
- /** {@link NavigationMode.enabled} */
1760
- enabled: boolean;
1761
- /** {@link NavigationMode.id} */
1762
- readonly id = "Plan";
1763
- private mouseAction1?;
1764
- private mouseAction2?;
1765
- private mouseInitialized;
1766
- private readonly defaultAzimuthSpeed;
1767
- private readonly defaultPolarSpeed;
1768
- constructor(camera: OrthoPerspectiveCamera);
1769
- /** {@link NavigationMode.set} */
1770
- set(active: boolean): void;
1771
- }
1772
- import * as THREE from "three";
1773
- import { CameraProjection } from "./types";
1774
- import { Event } from "../../Types";
1775
- import { OrthoPerspectiveCamera } from "../index";
1776
- /**
1777
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1778
- */
1779
- export declare class ProjectionManager {
1780
- /**
1781
- * Event that fires when the {@link CameraProjection} changes.
1782
- */
1783
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1784
- current: CameraProjection;
1785
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1786
- private _component;
1787
- private _previousDistance;
1788
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1789
- matchOrthoDistanceEnabled: boolean;
1790
- constructor(camera: OrthoPerspectiveCamera);
1791
- /**
1792
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1793
- *
1794
- * @param projection - the new projection to set. If it is the current projection,
1795
- * it will have no effect.
1796
- */
1797
- set(projection: CameraProjection): Promise<void>;
1798
- /**
1799
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1800
- * and vice versa.
1801
- */
1802
- toggle(): Promise<void>;
1803
- private setOrthoCamera;
1804
- private getPerspectiveDims;
1805
- private setupOrthoCamera;
1806
- private getDistance;
1807
- private setPerspectiveCamera;
1808
- }
1809
- /**
1810
- * The projection system of the camera.
1811
- */
1812
- export type CameraProjection = "Perspective" | "Orthographic";
1813
- /**
1814
- * The extensible list of supported navigation modes.
1815
- */
1816
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1817
- /**
1818
- * An object that determines the behavior of the camera controls
1819
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1820
- */
1821
- export interface NavigationMode {
1822
- /** The unique ID of this navigation mode. */
1823
- id: NavModeID;
1824
- /**
1825
- * Enable or disable this navigation mode.
1826
- * When a new navigation mode is enabled, the previous navigation mode
1827
- * must be disabled.
1828
- *
1829
- * @param active - whether to enable or disable this mode.
1830
- * @param options - any additional data required to enable or disable it.
1831
- * */
1832
- set: (active: boolean, options?: any) => void;
1833
- /** Whether this navigation mode is active or not. */
1834
- enabled: boolean;
1835
- }
1836
- import { IfcFragmentSettings } from "../../IfcLoader/src";
1837
- /** Configuration of the IFC-fragment streaming. */
1838
- export declare class IfcStreamingSettings extends IfcFragmentSettings {
1839
- minGeometrySize: number;
1840
- minAssetsSize: number;
1841
- }
1842
- /** Configuration of the IFC-fragment streaming. */
1843
- export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1844
- propertiesSize: number;
1845
- }
1846
1902
  import * as WEBIFC from "web-ifc";
1847
1903
  import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1848
1904
  import { PropertiesStreamingSettings } from "./streaming-settings";
@@ -1885,76 +1941,15 @@ export interface StreamedAsset {
1885
1941
  color: number[];
1886
1942
  }[];
1887
1943
  }
1888
- import * as THREE from "three";
1889
- import { Hideable, Disposable, Event, World } from "../../Types";
1890
- import { Components } from "../../Components";
1891
- /**
1892
- * Each of the planes created by {@link SimpleClipper}.
1893
- */
1894
- export declare class SimplePlane implements Disposable, Hideable {
1895
- /** Event that fires when the user starts dragging a clipping plane. */
1896
- readonly onDraggingStarted: Event<unknown>;
1897
- /** Event that fires when the user stops dragging a clipping plane. */
1898
- readonly onDraggingEnded: Event<unknown>;
1899
- /** {@link Disposable.onDisposed} */
1900
- readonly onDisposed: Event<unknown>;
1901
- readonly normal: THREE.Vector3;
1902
- readonly origin: THREE.Vector3;
1903
- readonly three: THREE.Plane;
1904
- protected readonly _helper: THREE.Object3D;
1905
- protected _visible: boolean;
1906
- protected _enabled: boolean;
1907
- components: Components;
1908
- world: World;
1909
- private _controlsActive;
1910
- private readonly _arrowBoundBox;
1911
- private readonly _planeMesh;
1912
- private readonly _controls;
1913
- private readonly _hiddenMaterial;
1914
- get enabled(): boolean;
1915
- /** {@link Component.enabled} */
1916
- set enabled(state: boolean);
1917
- /** {@link Hideable.visible } */
1918
- get visible(): boolean;
1919
- /** {@link Hideable.visible } */
1920
- set visible(state: boolean);
1921
- /** The meshes used for raycasting */
1922
- get meshes(): THREE.Mesh[];
1923
- /** The material of the clipping plane representation. */
1924
- get planeMaterial(): THREE.Material | THREE.Material[];
1925
- /** The material of the clipping plane representation. */
1926
- set planeMaterial(material: THREE.Material | THREE.Material[]);
1927
- /** The size of the clipping plane representation. */
1928
- get size(): number;
1929
- /** Sets the size of the clipping plane representation. */
1930
- set size(size: number);
1931
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1932
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1933
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
1934
- /** {@link Updateable.update} */
1935
- update: () => void;
1936
- /** {@link Disposable.dispose} */
1937
- dispose(): void;
1938
- private reset;
1939
- protected toggleControls(state: boolean): void;
1940
- private newTransformControls;
1941
- private initializeControls;
1942
- private createArrowBoundingBox;
1943
- private changeDrag;
1944
- private notifyDraggingChanged;
1945
- private preventCameraMovement;
1946
- private newHelper;
1947
- private static newPlaneMesh;
1944
+ import { IfcFragmentSettings } from "../../IfcLoader/src";
1945
+ /** Configuration of the IFC-fragment streaming. */
1946
+ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1947
+ minGeometrySize: number;
1948
+ minAssetsSize: number;
1948
1949
  }
1949
- import * as WEBIFC from "web-ifc";
1950
- import * as THREE from "three";
1951
- export declare class Units {
1952
- factor: number;
1953
- complement: number;
1954
- apply(matrix: THREE.Matrix4): void;
1955
- setUp(webIfc: WEBIFC.IfcAPI): void;
1956
- private getLengthUnits;
1957
- private getScaleMatrix;
1950
+ /** Configuration of the IFC-fragment streaming. */
1951
+ export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1952
+ propertiesSize: number;
1958
1953
  }
1959
1954
  export type RelationsMap = Map<number, Map<number, number[]>>;
1960
1955
  export interface ModelsRelationMap {
@@ -1985,5 +1980,15 @@ import * as THREE from "three";
1985
1980
  export declare class TransformHelper {
1986
1981
  getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
1987
1982
  }
1983
+ import * as WEBIFC from "web-ifc";
1984
+ import * as THREE from "three";
1985
+ export declare class Units {
1986
+ factor: number;
1987
+ complement: number;
1988
+ apply(matrix: THREE.Matrix4): void;
1989
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1990
+ private getLengthUnits;
1991
+ private getScaleMatrix;
1992
+ }
1988
1993
 
1989
1994
  }