@thatopen/components 2.0.0 → 2.0.3

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,17 @@
1
1
  declare namespace OBC {
2
+ import { Component, Disposable, World, Event } from "../Types";
3
+ import { SimpleRaycaster } from "./src";
4
+ import { Components } from "../Components";
5
+ export declare class Raycasters extends Component implements Disposable {
6
+ static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
7
+ enabled: boolean;
8
+ list: Map<string, SimpleRaycaster>;
9
+ onDisposed: Event<unknown>;
10
+ constructor(components: Components);
11
+ get(world: World): SimpleRaycaster;
12
+ delete(world: World): void;
13
+ dispose(): void;
14
+ }
2
15
  import * as THREE from "three";
3
16
  import { Components } from "../Components";
4
17
  import { Component } from "../Types";
@@ -95,16 +108,84 @@ export declare class Components implements Disposable {
95
108
  private static setupBVH;
96
109
  }
97
110
  import { Component, Disposable, World, Event } from "../Types";
98
- import { SimpleRaycaster } from "./src";
111
+ import { GridConfig, SimpleGrid } from "./src";
112
+ export declare class Grids extends Component implements Disposable {
113
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
114
+ list: Map<string, SimpleGrid>;
115
+ onDisposed: Event<unknown>;
116
+ config: Required<GridConfig>;
117
+ /** {@link Component.enabled} */
118
+ enabled: boolean;
119
+ create(world: World): SimpleGrid;
120
+ delete(world: World): void;
121
+ dispose(): void;
122
+ }
123
+ import { MiniMap } from "./src";
124
+ import { Component, Updateable, World, Event, Disposable } from "../Types";
99
125
  import { Components } from "../Components";
100
- export declare class Raycasters extends Component implements Disposable {
101
- static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
126
+ export declare class MiniMaps extends Component implements Updateable, Disposable {
127
+ static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
128
+ readonly onAfterUpdate: Event<unknown>;
129
+ readonly onBeforeUpdate: Event<unknown>;
130
+ readonly onDisposed: Event<unknown>;
102
131
  enabled: boolean;
103
- list: Map<string, SimpleRaycaster>;
104
- onDisposed: Event<unknown>;
132
+ list: Map<string, MiniMap>;
105
133
  constructor(components: Components);
106
- get(world: World): SimpleRaycaster;
134
+ create(world: World): MiniMap;
135
+ delete(id: string): void;
136
+ dispose(): void;
137
+ update(): void;
138
+ }
139
+ import { Components } from "../Components";
140
+ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
141
+ import { Component, Event, Disposable, World } from "../Types";
142
+ /**
143
+ * A tool to handle big scenes efficiently by automatically hiding the objects
144
+ * that are not visible to the camera.
145
+ */
146
+ export declare class Cullers extends Component implements Disposable {
147
+ /**
148
+ * A unique identifier for the Cullers component.
149
+ */
150
+ static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
151
+ /**
152
+ * Indicates whether the Cullers component is enabled.
153
+ */
154
+ private _enabled;
155
+ /**
156
+ * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
157
+ */
158
+ list: Map<string, MeshCullerRenderer>;
159
+ /**
160
+ * An event that is triggered when the Cullers component is disposed.
161
+ */
162
+ readonly onDisposed: Event<unknown>;
163
+ /**
164
+ * Gets the enabled state of the Cullers component.
165
+ *
166
+ * @returns The current enabled state.
167
+ */
168
+ get enabled(): boolean;
169
+ /**
170
+ * Sets the enabled state of the Cullers component.
171
+ * Also sets the enabled state of all MeshCullerRenderer instances.
172
+ *
173
+ * @param value - The new enabled state.
174
+ */
175
+ set enabled(value: boolean);
176
+ constructor(components: Components);
177
+ /**
178
+ * Creates a new MeshCullerRenderer for the given world.
179
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
180
+ *
181
+ * @param world - The world for which to create the MeshCullerRenderer.
182
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
183
+ *
184
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
185
+ */
186
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
107
187
  delete(world: World): void;
188
+ /** {@link Disposable.dispose} */
108
189
  dispose(): void;
109
190
  }
110
191
  import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
@@ -131,6 +212,8 @@ export declare class Worlds extends Component implements Updateable, Disposable
131
212
  * Subscribers can listen to this event to perform cleanup actions.
132
213
  */
133
214
  readonly onDisposed: Event<unknown>;
215
+ readonly onWorldCreated: Event<World>;
216
+ readonly onWorldDeleted: Event<string>;
134
217
  /**
135
218
  * A collection of worlds managed by this component.
136
219
  * The key is the unique identifier (UUID) of the world, and the value is the World instance.
@@ -143,22 +226,71 @@ export declare class Worlds extends Component implements Updateable, Disposable
143
226
  enabled: boolean;
144
227
  constructor(components: Components);
145
228
  /**
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
- */
229
+ * Creates a new instance of a SimpleWorld and adds it to the list of worlds.
230
+ *
231
+ * @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
232
+ * @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
233
+ * @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
234
+ *
235
+ * @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
236
+ */
156
237
  create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
157
238
  delete(world: World): void;
158
239
  dispose(): void;
159
240
  update(delta?: number): void | Promise<void>;
160
241
  }
161
242
  import * as THREE from "three";
243
+ import { Components } from "../Components";
244
+ import { SimpleCamera } from "..";
245
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
246
+ /**
247
+ * A flexible camera that uses
248
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
249
+ * easily control the camera in 2D and 3D. It supports multiple navigation
250
+ * modes, such as 2D floor plan navigation, first person and 3D orbit.
251
+ */
252
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
253
+ /**
254
+ * The current {@link NavigationMode}.
255
+ */
256
+ _mode: NavigationMode | null;
257
+ readonly projection: ProjectionManager;
258
+ readonly threeOrtho: THREE.OrthographicCamera;
259
+ readonly threePersp: THREE.PerspectiveCamera;
260
+ protected readonly _userInputButtons: any;
261
+ protected readonly _frustumSize = 50;
262
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
263
+ private previousSize;
264
+ get mode(): NavigationMode;
265
+ constructor(components: Components);
266
+ /** {@link Disposable.dispose} */
267
+ dispose(): void;
268
+ /**
269
+ * Sets a new {@link NavigationMode} and disables the previous one.
270
+ *
271
+ * @param mode - The {@link NavigationMode} to set.
272
+ */
273
+ set(mode: NavModeID): void;
274
+ /**
275
+ * Make the camera view fit all the specified meshes.
276
+ *
277
+ * @param meshes the meshes to fit. If it is not defined, it will
278
+ * evaluate {@link Components.meshes}.
279
+ * @param offset the distance to the fit object
280
+ */
281
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
282
+ /**
283
+ * Allows or prevents all user input.
284
+ *
285
+ * @param active - whether to enable or disable user inputs.
286
+ */
287
+ setUserInput(active: boolean): void;
288
+ private disableUserInput;
289
+ private enableUserInput;
290
+ private newOrthoCamera;
291
+ private setOrthoPerspCameraAspect;
292
+ }
293
+ import * as THREE from "three";
162
294
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
163
295
  import { SimplePlane } from "./src";
164
296
  import { Components } from "../Components";
@@ -257,204 +389,262 @@ export declare class Clipper extends Component implements Createable, Disposable
257
389
  private _onStartDragging;
258
390
  private _onEndDragging;
259
391
  }
260
- import { Component, Disposable, World, Event } from "../Types";
261
- import { GridConfig, SimpleGrid } from "./src";
262
- export declare class Grids extends Component implements Disposable {
263
- static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
264
- list: Map<string, SimpleGrid>;
265
- onDisposed: Event<unknown>;
266
- config: Required<GridConfig>;
392
+ import * as THREE from "three";
393
+ import * as FRAGS from "@thatopen/fragments";
394
+ import { Disposable, Component, Event, Components } from "../../core";
395
+ export interface Classification {
396
+ [system: string]: {
397
+ [className: string]: FRAGS.FragmentIdMap;
398
+ };
399
+ }
400
+ export declare class Classifier extends Component implements Disposable {
401
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
267
402
  /** {@link Component.enabled} */
268
403
  enabled: boolean;
269
- create(world: World): SimpleGrid;
270
- delete(world: World): void;
404
+ list: Classification;
405
+ /** {@link Disposable.onDisposed} */
406
+ readonly onDisposed: Event<unknown>;
407
+ constructor(components: Components);
408
+ private onFragmentsDisposed;
271
409
  dispose(): void;
410
+ remove(guid: string): void;
411
+ find(filter?: {
412
+ [name: string]: string[];
413
+ }): FRAGS.FragmentIdMap;
414
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
415
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
416
+ byEntity(group: FRAGS.FragmentsGroup): void;
417
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
418
+ bySpatialStructure(model: FRAGS.FragmentsGroup): Promise<void>;
419
+ setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
420
+ resetColor(items: FRAGS.FragmentIdMap): void;
421
+ protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number): void;
272
422
  }
423
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
273
424
  import * as THREE from "three";
274
- import { Components } from "../Components";
275
- import { SimpleCamera } from "..";
276
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
425
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
426
+ center: THREE.Vector3;
427
+ halfSizes: THREE.Vector3;
428
+ rotation: THREE.Matrix3;
429
+ transformation: THREE.Matrix4;
430
+ };
431
+ import * as THREE from "three";
432
+ export declare class MaterialsUtils {
433
+ static isTransparent(material: THREE.Material): boolean;
434
+ }
435
+ export declare class UUID {
436
+ private static _pattern;
437
+ private static _lut;
438
+ static create(): string;
439
+ static validate(uuid: string): void;
440
+ }
441
+ import * as THREE from "three";
442
+ import * as FRAGS from "@thatopen/fragments";
443
+ import { FragmentsGroup } from "@thatopen/fragments";
444
+ import { Component, Components, Disposable, Event } from "../../core";
277
445
  /**
278
- * A flexible camera that uses
279
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
280
- * easily control the camera in 2D and 3D. It supports multiple navigation
281
- * modes, such as 2D floor plan navigation, first person and 3D orbit.
446
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
447
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
282
448
  */
283
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
284
- /**
285
- * The current {@link NavigationMode}.
286
- */
287
- _mode: NavigationMode | null;
288
- readonly projection: ProjectionManager;
289
- readonly threeOrtho: THREE.OrthographicCamera;
290
- readonly threePersp: THREE.PerspectiveCamera;
291
- protected readonly _userInputButtons: any;
292
- protected readonly _frustumSize = 50;
293
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
294
- private previousSize;
295
- get mode(): NavigationMode;
449
+ export declare class BoundingBoxer extends Component implements Disposable {
450
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
451
+ /** {@link Component.enabled} */
452
+ enabled: boolean;
453
+ /** {@link Disposable.onDisposed} */
454
+ readonly onDisposed: Event<unknown>;
455
+ private _absoluteMin;
456
+ private _absoluteMax;
457
+ private _meshes;
296
458
  constructor(components: Components);
459
+ static getDimensions(bbox: THREE.Box3): {
460
+ width: number;
461
+ height: number;
462
+ depth: number;
463
+ center: THREE.Vector3;
464
+ };
465
+ static newBound(positive: boolean): THREE.Vector3;
466
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
297
467
  /** {@link Disposable.dispose} */
298
468
  dispose(): void;
299
- /**
300
- * Sets a new {@link NavigationMode} and disables the previous one.
301
- *
302
- * @param mode - The {@link NavigationMode} to set.
303
- */
304
- set(mode: NavModeID): void;
305
- /**
306
- * Make the camera view fit all the specified meshes.
307
- *
308
- * @param meshes the meshes to fit. If it is not defined, it will
309
- * evaluate {@link Components.meshes}.
310
- * @param offset the distance to the fit object
311
- */
312
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
313
- /**
314
- * Allows or prevents all user input.
315
- *
316
- * @param active - whether to enable or disable user inputs.
317
- */
318
- setUserInput(active: boolean): void;
319
- private disableUserInput;
320
- private enableUserInput;
321
- private newOrthoCamera;
322
- private setOrthoPerspCameraAspect;
469
+ get(): THREE.Box3;
470
+ getSphere(): THREE.Sphere;
471
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
472
+ reset(): void;
473
+ add(group: FragmentsGroup): void;
474
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
475
+ private static getFragmentBounds;
323
476
  }
324
- import { Components } from "../Components";
325
- import { MeshCullerRenderer, CullerRendererSettings } from "./src";
326
- import { Component, Event, Disposable, World } from "../Types";
327
- /**
328
- * A tool to handle big scenes efficiently by automatically hiding the objects
329
- * that are not visible to the camera.
330
- */
331
- export declare class Cullers extends Component implements Disposable {
332
- /**
333
- * A unique identifier for the Cullers component.
334
- */
335
- static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
336
- /**
337
- * Indicates whether the Cullers component is enabled.
338
- */
339
- private _enabled;
340
- /**
341
- * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
342
- */
343
- list: Map<string, MeshCullerRenderer>;
344
- /**
345
- * An event that is triggered when the Cullers component is disposed.
346
- */
477
+ import { Component, Disposable, Event, Components } from "../../core";
478
+ export declare class Exploder extends Component implements Disposable {
479
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
480
+ enabled: boolean;
481
+ height: number;
482
+ groupName: string;
483
+ /** {@link Disposable.onDisposed} */
347
484
  readonly onDisposed: Event<unknown>;
348
- /**
349
- * Gets the enabled state of the Cullers component.
350
- *
351
- * @returns The current enabled state.
352
- */
353
- get enabled(): boolean;
354
- /**
355
- * Sets the enabled state of the Cullers component.
356
- * Also sets the enabled state of all MeshCullerRenderer instances.
357
- *
358
- * @param value - The new enabled state.
359
- */
360
- set enabled(value: boolean);
485
+ list: Set<string>;
361
486
  constructor(components: Components);
362
- /**
363
- * Creates a new MeshCullerRenderer for the given world.
364
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
365
- *
366
- * @param world - The world for which to create the MeshCullerRenderer.
367
- * @param config - Optional configuration settings for the MeshCullerRenderer.
368
- *
369
- * @returns The newly created or existing MeshCullerRenderer for the given world.
370
- */
371
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
372
- delete(world: World): void;
373
- /** {@link Disposable.dispose} */
374
487
  dispose(): void;
488
+ set(active: boolean): void;
375
489
  }
376
- import { MiniMap } from "./src";
377
- import { Component, Updateable, World, Event, Disposable } from "../Types";
378
- import { Components } from "../Components";
379
- export declare class MiniMaps extends Component implements Updateable, Disposable {
380
- static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
381
- readonly onAfterUpdate: Event<unknown>;
382
- readonly onBeforeUpdate: Event<unknown>;
490
+ import * as WEBIFC from "web-ifc";
491
+ import * as FRAGS from "@thatopen/fragments";
492
+ import { IfcFragmentSettings } from "./src";
493
+ import { Component, Components, Event, Disposable } from "../../core";
494
+ export declare class IfcLoader extends Component implements Disposable {
495
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
496
+ readonly onIfcStartedLoading: Event<void>;
497
+ readonly onSetup: Event<void>;
498
+ /** {@link Disposable.onDisposed} */
499
+ readonly onDisposed: Event<string>;
500
+ settings: IfcFragmentSettings;
501
+ enabled: boolean;
502
+ webIfc: WEBIFC.IfcAPI;
503
+ private _material;
504
+ private _spatialTree;
505
+ private _metaData;
506
+ private _fragmentInstances;
507
+ private _civil;
508
+ private _visitedFragments;
509
+ private _materialT;
510
+ constructor(components: Components);
511
+ dispose(): void;
512
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
513
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
514
+ readIfcFile(data: Uint8Array): Promise<number>;
515
+ private getAllGeometries;
516
+ cleanUp(): void;
517
+ private getMesh;
518
+ private getGeometry;
519
+ private autoSetWasm;
520
+ }
521
+ import * as FRAGS from "@thatopen/fragments";
522
+ import { Components, Component } from "../../core";
523
+ export declare class Hider extends Component {
524
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
525
+ enabled: boolean;
526
+ constructor(components: Components);
527
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
528
+ isolate(items: FRAGS.FragmentIdMap): void;
529
+ private updateCulledVisibility;
530
+ }
531
+ import * as WEBIFC from "web-ifc";
532
+ import { Components, Disposable, Event, Component } from "../../core";
533
+ import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
534
+ export declare class IfcGeometryTiler extends Component implements Disposable {
535
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
536
+ onGeometryStreamed: Event<{
537
+ buffer: Uint8Array;
538
+ data: StreamedGeometries;
539
+ }>;
540
+ onAssetStreamed: Event<StreamedAsset[]>;
541
+ onProgress: Event<number>;
542
+ onIfcLoaded: Event<Uint8Array>;
543
+ /** {@link Disposable.onDisposed} */
383
544
  readonly onDisposed: Event<unknown>;
545
+ settings: IfcStreamingSettings;
384
546
  enabled: boolean;
385
- list: Map<string, MiniMap>;
547
+ webIfc: WEBIFC.IfcAPI;
548
+ private _spatialTree;
549
+ private _metaData;
550
+ private _visitedGeometries;
551
+ private _streamSerializer;
552
+ private _geometries;
553
+ private _geometryCount;
554
+ private _civil;
555
+ private _groupSerializer;
556
+ private _assets;
557
+ private _meshesWithHoles;
386
558
  constructor(components: Components);
387
- create(world: World): MiniMap;
388
- delete(id: string): void;
389
559
  dispose(): void;
390
- update(): void;
560
+ streamFromBuffer(data: Uint8Array): Promise<void>;
561
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
562
+ private readIfcFile;
563
+ private streamIfcFile;
564
+ private streamAllGeometries;
565
+ private cleanUp;
566
+ private getMesh;
567
+ private getGeometry;
568
+ private streamAssets;
569
+ private streamGeometries;
391
570
  }
392
571
  import * as WEBIFC from "web-ifc";
393
- import * as FRAG from "@thatopen/fragments";
394
- import { Component, Components } from "../../core";
572
+ import { AsyncEvent, Component, Disposable, Event } from "../../core";
573
+ import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
574
+ export declare class IfcPropertiesTiler extends Component implements Disposable {
575
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
576
+ onPropertiesStreamed: AsyncEvent<{
577
+ type: number;
578
+ data: {
579
+ [id: number]: any;
580
+ };
581
+ }>;
582
+ onProgress: AsyncEvent<number>;
583
+ onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
584
+ /** {@link Disposable.onDisposed} */
585
+ readonly onDisposed: Event<string>;
586
+ enabled: boolean;
587
+ settings: PropertiesStreamingSettings;
588
+ webIfc: WEBIFC.IfcAPI;
589
+ dispose(): Promise<void>;
590
+ streamFromBuffer(data: Uint8Array): Promise<void>;
591
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
592
+ private readIfcFile;
593
+ private streamIfcFile;
594
+ private streamAllProperties;
595
+ private cleanUp;
596
+ }
597
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
598
+ import * as THREE from "three";
599
+ import * as FRAGS from "@thatopen/fragments";
600
+ import { Component, Components, Event, Disposable } from "../../core";
601
+ import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
395
602
  /**
396
- * Object to export all the properties from an IFC to a JS object.
603
+ * Object that can efficiently load binary files that contain
604
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
397
605
  */
398
- export declare class IfcJsonExporter extends Component {
399
- static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
606
+ export declare class FragmentsManager extends Component implements Disposable {
607
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
608
+ /** {@link Disposable.onDisposed} */
609
+ readonly onDisposed: Event<unknown>;
610
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
611
+ readonly onFragmentsDisposed: Event<{
612
+ groupID: string;
613
+ fragmentIDs: string[];
614
+ }>;
615
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
616
+ readonly list: Map<string, Fragment>;
617
+ readonly groups: Map<string, FragmentsGroup>;
400
618
  /** {@link Component.enabled} */
401
619
  enabled: boolean;
620
+ baseCoordinationModel: string;
621
+ private _loader;
622
+ /** The list of meshes of the created fragments. */
623
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
402
624
  constructor(components: Components);
625
+ /** {@link Disposable.dispose} */
626
+ dispose(): void;
627
+ disposeGroup(group: FragmentsGroup): void;
403
628
  /**
404
- * Exports all the properties of an IFC into an array of JS objects.
405
- * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
406
- * @param modelID ID of the IFC model whose properties to extract.
407
- * @param indirect whether to get the indirect relationships as well.
408
- * @param recursiveSpatial whether to get the properties of spatial items recursively
409
- * to make the location data available (e.g. absolute position of building).
629
+ * Loads a binar file that contain fragment geometry.
630
+ * @param data - The binary data to load.
631
+ * @param config - Optional configuration for loading.
632
+ * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
633
+ * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
634
+ * @returns The loaded FragmentsGroup.
410
635
  */
411
- export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
412
- }
413
- import * as THREE from "three";
414
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
415
- center: THREE.Vector3;
416
- halfSizes: THREE.Vector3;
417
- rotation: THREE.Matrix3;
418
- transformation: THREE.Matrix4;
419
- };
420
- export declare class UUID {
421
- private static _pattern;
422
- private static _lut;
423
- static create(): string;
424
- static validate(uuid: string): void;
425
- }
426
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
427
- import * as THREE from "three";
428
- export declare class MaterialsUtils {
429
- static isTransparent(material: THREE.Material): boolean;
430
- }
431
- import * as THREE from "three";
432
- import { Component, Components, Event, World } from "../core";
433
- export interface VertexPickerConfig {
434
- showOnlyVertex: boolean;
435
- snapDistance: number;
436
- previewElement: HTMLElement;
437
- }
438
- export declare class VertexPicker extends Component {
439
- onVertexFound: Event<THREE.Vector3>;
440
- onVertexLost: Event<THREE.Vector3>;
441
- components: Components;
442
- private _pickedPoint;
443
- private _config;
444
- private _enabled;
445
- private _workingPlane;
446
- set enabled(value: boolean);
447
- get enabled(): boolean;
448
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
449
- set workingPlane(plane: THREE.Plane | null);
450
- get workingPlane(): THREE.Plane | null;
451
- set config(value: Partial<VertexPickerConfig>);
452
- get config(): Partial<VertexPickerConfig>;
453
- dispose(): void;
454
- get(world: World): THREE.Vector3 | null;
455
- private getClosestVertex;
456
- private getVertices;
457
- private getVertex;
636
+ load(data: Uint8Array, config?: Partial<{
637
+ coordinate: boolean;
638
+ properties: FRAGS.IfcProperties;
639
+ relationsMap: RelationsMap;
640
+ }>): FragmentsGroup;
641
+ /**
642
+ * Export the specified fragments.
643
+ * @param group - the fragments group to be exported.
644
+ * @returns the exported data as binary buffer.
645
+ */
646
+ export(group: FragmentsGroup): Uint8Array;
647
+ coordinate(models?: FragmentsGroup[]): void;
458
648
  }
459
649
  import * as WEBIFC from "web-ifc";
460
650
  import { FragmentsGroup } from "@thatopen/fragments";
@@ -656,249 +846,94 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
656
846
  removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
657
847
  addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
658
848
  addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
659
- saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
660
- setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
661
- }
662
- export {};
663
- import * as FRAGS from "@thatopen/fragments";
664
- import { Components, Component } from "../../core";
665
- export declare class FragmentHider extends Component {
666
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
667
- enabled: boolean;
668
- constructor(components: Components);
669
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
670
- isolate(items: FRAGS.FragmentIdMap): void;
671
- private updateCulledVisibility;
672
- }
673
- import * as THREE from "three";
674
- import * as FRAGS from "@thatopen/fragments";
675
- import { Disposable, Component, Event, Components } from "../../core";
676
- export interface Classification {
677
- [system: string]: {
678
- [className: string]: FRAGS.FragmentIdMap;
679
- };
680
- }
681
- export declare class Classifier extends Component implements Disposable {
682
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
683
- /** {@link Component.enabled} */
684
- enabled: boolean;
685
- list: Classification;
686
- /** {@link Disposable.onDisposed} */
687
- readonly onDisposed: Event<unknown>;
688
- constructor(components: Components);
689
- private onFragmentsDisposed;
690
- dispose(): void;
691
- remove(guid: string): void;
692
- find(filter?: {
693
- [name: string]: string[];
694
- }): FRAGS.FragmentIdMap;
695
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
696
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
697
- byEntity(group: FRAGS.FragmentsGroup): void;
698
- byStorey(group: FRAGS.FragmentsGroup): void;
699
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
700
- setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
701
- resetColor(items: FRAGS.FragmentIdMap): void;
702
- private saveItem;
703
- }
704
- import * as WEBIFC from "web-ifc";
705
- import * as FRAGS from "@thatopen/fragments";
706
- import { IfcFragmentSettings } from "./src";
707
- import { Component, Components, Event, Disposable } from "../../core";
708
- export declare class IfcLoader extends Component implements Disposable {
709
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
710
- readonly onIfcStartedLoading: Event<void>;
711
- readonly onSetup: Event<void>;
712
- /** {@link Disposable.onDisposed} */
713
- readonly onDisposed: Event<string>;
714
- settings: IfcFragmentSettings;
715
- enabled: boolean;
716
- webIfc: WEBIFC.IfcAPI;
717
- private _material;
718
- private _spatialTree;
719
- private _metaData;
720
- private _fragmentInstances;
721
- private _civil;
722
- private _visitedFragments;
723
- private _materialT;
724
- constructor(components: Components);
725
- dispose(): void;
726
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
727
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
728
- readIfcFile(data: Uint8Array): Promise<number>;
729
- private getAllGeometries;
730
- cleanUp(): void;
731
- private getMesh;
732
- private getGeometry;
733
- private autoSetWasm;
734
- }
735
- import * as THREE from "three";
736
- import * as FRAGS from "@thatopen/fragments";
737
- import { FragmentsGroup } from "@thatopen/fragments";
738
- import { Component, Components, Disposable, Event } from "../../core";
739
- /**
740
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
741
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
742
- */
743
- export declare class BoundingBoxer extends Component implements Disposable {
744
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
745
- /** {@link Component.enabled} */
746
- enabled: boolean;
747
- /** {@link Disposable.onDisposed} */
748
- readonly onDisposed: Event<unknown>;
749
- private _absoluteMin;
750
- private _absoluteMax;
751
- private _meshes;
752
- constructor(components: Components);
753
- static getDimensions(bbox: THREE.Box3): {
754
- width: number;
755
- height: number;
756
- depth: number;
757
- center: THREE.Vector3;
758
- };
759
- static newBound(positive: boolean): THREE.Vector3;
760
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
761
- /** {@link Disposable.dispose} */
762
- dispose(): void;
763
- get(): THREE.Box3;
764
- getSphere(): THREE.Sphere;
765
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
766
- reset(): void;
767
- add(group: FragmentsGroup): void;
768
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
769
- private static getFragmentBounds;
770
- }
771
- import { Fragment, FragmentsGroup } from "@thatopen/fragments";
772
- import * as THREE from "three";
773
- import * as FRAGS from "@thatopen/fragments";
774
- import { Component, Components, Event, Disposable } from "../../core";
775
- import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
776
- /**
777
- * Object that can efficiently load binary files that contain
778
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
779
- */
780
- export declare class FragmentsManager extends Component implements Disposable {
781
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
782
- /** {@link Disposable.onDisposed} */
783
- readonly onDisposed: Event<unknown>;
784
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
785
- readonly onFragmentsDisposed: Event<{
786
- groupID: string;
787
- fragmentIDs: string[];
788
- }>;
789
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
790
- readonly list: Map<string, Fragment>;
791
- readonly groups: Map<string, FragmentsGroup>;
792
- /** {@link Component.enabled} */
793
- enabled: boolean;
794
- baseCoordinationModel: string;
795
- private _loader;
796
- /** The list of meshes of the created fragments. */
797
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
798
- constructor(components: Components);
799
- /** {@link Disposable.dispose} */
800
- dispose(): void;
801
- disposeGroup(group: FragmentsGroup): void;
802
- /**
803
- * Loads a binar file that contain fragment geometry.
804
- * @param data - The binary data to load.
805
- * @param config - Optional configuration for loading.
806
- * @param config.coordinate - Whether to apply coordinate transformation. Default is true.
807
- * @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
808
- * @returns The loaded FragmentsGroup.
809
- */
810
- load(data: Uint8Array, config?: Partial<{
811
- coordinate: boolean;
812
- properties: FRAGS.IfcProperties;
813
- relationsMap: RelationsMap;
814
- }>): FragmentsGroup;
815
- /**
816
- * Export the specified fragments.
817
- * @param group - the fragments group to be exported.
818
- * @returns the exported data as binary buffer.
819
- */
820
- export(group: FragmentsGroup): Uint8Array;
821
- coordinate(models?: FragmentsGroup[]): void;
822
- }
823
- import { Component, Disposable, Event, Components } from "../../core";
824
- export declare class Exploder extends Component implements Disposable {
825
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
826
- enabled: boolean;
827
- height: number;
828
- groupName: string;
829
- /** {@link Disposable.onDisposed} */
830
- readonly onDisposed: Event<unknown>;
831
- list: Set<string>;
832
- constructor(components: Components);
833
- dispose(): void;
834
- set(active: boolean): void;
835
- }
836
- import * as WEBIFC from "web-ifc";
837
- import { Components, Disposable, Event, Component } from "../../core";
838
- import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
839
- export declare class IfcGeometryTiler extends Component implements Disposable {
840
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
841
- onGeometryStreamed: Event<{
842
- buffer: Uint8Array;
843
- data: StreamedGeometries;
844
- }>;
845
- onAssetStreamed: Event<StreamedAsset[]>;
846
- onProgress: Event<number>;
847
- onIfcLoaded: Event<Uint8Array>;
848
- /** {@link Disposable.onDisposed} */
849
- readonly onDisposed: Event<unknown>;
850
- settings: IfcStreamingSettings;
849
+ saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
850
+ setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
851
+ }
852
+ export {};
853
+ import * as WEBIFC from "web-ifc";
854
+ import * as FRAG from "@thatopen/fragments";
855
+ import { Component, Components } from "../../core";
856
+ /**
857
+ * Object to export all the properties from an IFC to a JS object.
858
+ */
859
+ export declare class IfcJsonExporter extends Component {
860
+ static readonly uuid: "b32c4332-cd67-436e-ba7f-196646c7a635";
861
+ /** {@link Component.enabled} */
851
862
  enabled: boolean;
852
- webIfc: WEBIFC.IfcAPI;
853
- private _spatialTree;
854
- private _metaData;
855
- private _visitedGeometries;
856
- private _streamSerializer;
857
- private _geometries;
858
- private _geometryCount;
859
- private _civil;
860
- private _groupSerializer;
861
- private _assets;
862
- private _meshesWithHoles;
863
863
  constructor(components: Components);
864
+ /**
865
+ * Exports all the properties of an IFC into an array of JS objects.
866
+ * @param webIfc The instance of [web-ifc]{@link https://github.com/ThatOpen/engine_web-ifc} to use.
867
+ * @param modelID ID of the IFC model whose properties to extract.
868
+ * @param indirect whether to get the indirect relationships as well.
869
+ * @param recursiveSpatial whether to get the properties of spatial items recursively
870
+ * to make the location data available (e.g. absolute position of building).
871
+ */
872
+ export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
873
+ }
874
+ import * as THREE from "three";
875
+ import { Component, Components, Event, World } from "../core";
876
+ export interface VertexPickerConfig {
877
+ showOnlyVertex: boolean;
878
+ snapDistance: number;
879
+ previewElement: HTMLElement;
880
+ }
881
+ export declare class VertexPicker extends Component {
882
+ onVertexFound: Event<THREE.Vector3>;
883
+ onVertexLost: Event<THREE.Vector3>;
884
+ components: Components;
885
+ private _pickedPoint;
886
+ private _config;
887
+ private _enabled;
888
+ private _workingPlane;
889
+ set enabled(value: boolean);
890
+ get enabled(): boolean;
891
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
892
+ set workingPlane(plane: THREE.Plane | null);
893
+ get workingPlane(): THREE.Plane | null;
894
+ set config(value: Partial<VertexPickerConfig>);
895
+ get config(): Partial<VertexPickerConfig>;
864
896
  dispose(): void;
865
- streamFromBuffer(data: Uint8Array): Promise<void>;
866
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
867
- private readIfcFile;
868
- private streamIfcFile;
869
- private streamAllGeometries;
870
- private cleanUp;
871
- private getMesh;
872
- private getGeometry;
873
- private streamAssets;
874
- private streamGeometries;
897
+ get(world: World): THREE.Vector3 | null;
898
+ private getClosestVertex;
899
+ private getVertices;
900
+ private getVertex;
875
901
  }
876
902
  import * as WEBIFC from "web-ifc";
877
- import { AsyncEvent, Component, Disposable, Event } from "../../core";
878
- import { PropertiesStreamingSettings } from "../IfcGeometryTiler";
879
- export declare class IfcPropertiesTiler extends Component implements Disposable {
880
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
881
- onPropertiesStreamed: AsyncEvent<{
882
- type: number;
883
- data: {
884
- [id: number]: any;
885
- };
886
- }>;
887
- onProgress: AsyncEvent<number>;
888
- onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
889
- /** {@link Disposable.onDisposed} */
890
- readonly onDisposed: Event<string>;
903
+ import { IfcItemsCategories } from "../../../ifc";
904
+ export declare class SpatialStructure {
905
+ itemsByFloor: IfcItemsCategories;
906
+ private _units;
907
+ setUp(webIfc: WEBIFC.IfcAPI): void;
908
+ cleanUp(): void;
909
+ }
910
+ import * as THREE from "three";
911
+ import { Component, Components } from "../../core";
912
+ export interface MeasureEdge {
913
+ distance: number;
914
+ points: THREE.Vector3[];
915
+ }
916
+ export declare class MeasurementUtils extends Component {
891
917
  enabled: boolean;
892
- settings: PropertiesStreamingSettings;
893
- webIfc: WEBIFC.IfcAPI;
894
- dispose(): Promise<void>;
895
- streamFromBuffer(data: Uint8Array): Promise<void>;
896
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
897
- private readIfcFile;
898
- private streamIfcFile;
899
- private streamAllProperties;
900
- private cleanUp;
918
+ static uuid: string;
919
+ constructor(components: Components);
920
+ getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
921
+ edges: MeasureEdge[];
922
+ indices: Set<number>;
923
+ } | null;
924
+ static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
925
+ private getFaceData;
926
+ getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
927
+ p1: THREE.Vector3;
928
+ p2: THREE.Vector3;
929
+ p3: THREE.Vector3;
930
+ faceNormal: THREE.Vector3;
931
+ };
932
+ private round;
901
933
  }
934
+ export declare const IfcElements: {
935
+ [key: number]: string;
936
+ };
902
937
  import * as THREE from "three";
903
938
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
904
939
  export declare class MiniMap implements Resizeable, Updateable, Disposable {
@@ -933,30 +968,7 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
933
968
  resize(size?: THREE.Vector2): void;
934
969
  private updatePlanes;
935
970
  }
936
- import * as THREE from "three";
937
- import { Component, Components } from "../../core";
938
- export interface MeasureEdge {
939
- distance: number;
940
- points: THREE.Vector3[];
941
- }
942
- export declare class MeasurementUtils extends Component {
943
- enabled: boolean;
944
- static uuid: string;
945
- constructor(components: Components);
946
- getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
947
- edges: MeasureEdge[];
948
- indices: Set<number>;
949
- } | null;
950
- static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
951
- private getFaceData;
952
- getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
953
- p1: THREE.Vector3;
954
- p2: THREE.Vector3;
955
- p3: THREE.Vector3;
956
- faceNormal: THREE.Vector3;
957
- };
958
- private round;
959
- }
971
+ export declare const GeometryTypes: Set<number>;
960
972
  import * as FRAGS from "@thatopen/fragments";
961
973
  export declare class IfcPropertiesUtils {
962
974
  static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
@@ -982,10 +994,14 @@ export declare class IfcPropertiesUtils {
982
994
  static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
983
995
  static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
984
996
  }
985
- export declare const IfcElements: {
997
+ import { InverseAttribute } from "./types";
998
+ export declare const relToAttributesMap: Map<number, {
999
+ forRelating: InverseAttribute;
1000
+ forRelated: InverseAttribute;
1001
+ }>;
1002
+ export declare const IfcCategoryMap: {
986
1003
  [key: number]: string;
987
1004
  };
988
- export declare const GeometryTypes: Set<number>;
989
1005
  import * as WEBIFC from "web-ifc";
990
1006
  export interface IfcItemsCategories {
991
1007
  [itemID: number]: number;
@@ -993,132 +1009,95 @@ export interface IfcItemsCategories {
993
1009
  export declare class IfcCategories {
994
1010
  getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
995
1011
  }
996
- export declare const IfcCategoryMap: {
997
- [key: number]: string;
998
- };
999
- import { InverseAttribute } from "./types";
1000
- export declare const relToAttributesMap: Map<number, {
1001
- forRelating: InverseAttribute;
1002
- forRelated: InverseAttribute;
1003
- }>;
1004
- import { NavigationMode } from "./types";
1005
- import { OrthoPerspectiveCamera } from "../index";
1006
- /**
1007
- * A {@link NavigationMode} that allows first person navigation,
1008
- * simulating FPS video games.
1009
- */
1010
- export declare class FirstPersonMode implements NavigationMode {
1011
- private camera;
1012
- /** {@link NavigationMode.enabled} */
1013
- enabled: boolean;
1014
- /** {@link NavigationMode.id} */
1015
- readonly id = "FirstPerson";
1016
- constructor(camera: OrthoPerspectiveCamera);
1017
- /** {@link NavigationMode.set} */
1018
- set(active: boolean): void;
1019
- private setupFirstPersonCamera;
1020
- }
1021
1012
  import * as THREE from "three";
1022
- import { CameraProjection } from "./types";
1023
- import { Event } from "../../Types";
1024
- import { OrthoPerspectiveCamera } from "../index";
1013
+ import { Disposable, Event } from "../../Types";
1025
1014
  /**
1026
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1015
+ * A helper to easily get the real position of the mouse in the Three.js canvas
1016
+ * to work with tools like the
1017
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1018
+ * been transformed through CSS or doesn't occupy the whole screen.
1027
1019
  */
1028
- export declare class ProjectionManager {
1029
- /**
1030
- * Event that fires when the {@link CameraProjection} changes.
1031
- */
1032
- readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1033
- current: CameraProjection;
1034
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1035
- private _component;
1036
- private _previousDistance;
1037
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1038
- matchOrthoDistanceEnabled: boolean;
1039
- constructor(camera: OrthoPerspectiveCamera);
1040
- /**
1041
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1042
- *
1043
- * @param projection - the new projection to set. If it is the current projection,
1044
- * it will have no effect.
1045
- */
1046
- set(projection: CameraProjection): Promise<void>;
1020
+ export declare class Mouse implements Disposable {
1021
+ dom: HTMLCanvasElement;
1022
+ private _event?;
1023
+ private _position;
1024
+ /** {@link Disposable.onDisposed} */
1025
+ readonly onDisposed: Event<unknown>;
1026
+ constructor(dom: HTMLCanvasElement);
1047
1027
  /**
1048
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1049
- * and vice versa.
1028
+ * The real position of the mouse of the Three.js canvas.
1050
1029
  */
1051
- toggle(): Promise<void>;
1052
- private setOrthoCamera;
1053
- private getPerspectiveDims;
1054
- private setupOrthoCamera;
1055
- private getDistance;
1056
- private setPerspectiveCamera;
1057
- }
1058
- /**
1059
- * The projection system of the camera.
1060
- */
1061
- export type CameraProjection = "Perspective" | "Orthographic";
1062
- /**
1063
- * The extensible list of supported navigation modes.
1064
- */
1065
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1066
- /**
1067
- * An object that determines the behavior of the camera controls
1068
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1069
- */
1070
- export interface NavigationMode {
1071
- /** The unique ID of this navigation mode. */
1072
- id: NavModeID;
1073
- /**
1074
- * Enable or disable this navigation mode.
1075
- * When a new navigation mode is enabled, the previous navigation mode
1076
- * must be disabled.
1077
- *
1078
- * @param active - whether to enable or disable this mode.
1079
- * @param options - any additional data required to enable or disable it.
1080
- * */
1081
- set: (active: boolean, options?: any) => void;
1082
- /** Whether this navigation mode is active or not. */
1083
- enabled: boolean;
1030
+ get position(): THREE.Vector2;
1031
+ /** {@link Disposable.dispose} */
1032
+ dispose(): void;
1033
+ private getPositionY;
1034
+ private getPositionX;
1035
+ private updateMouseInfo;
1036
+ private setupEvents;
1084
1037
  }
1085
- import { NavigationMode } from "./types";
1086
- import { OrthoPerspectiveCamera } from "../index";
1038
+ import * as THREE from "three";
1039
+ import { Components } from "../../Components";
1040
+ import { Event, World, Disposable } from "../../Types";
1041
+ import { Mouse } from "./mouse";
1087
1042
  /**
1088
- * A {@link NavigationMode} that allows 3D navigation and panning
1089
- * like in many 3D and CAD softwares.
1043
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1044
+ * that allows to easily get items from the scene using the mouse and touch
1045
+ * events.
1090
1046
  */
1091
- export declare class OrbitMode implements NavigationMode {
1092
- camera: OrthoPerspectiveCamera;
1093
- /** {@link NavigationMode.enabled} */
1047
+ export declare class SimpleRaycaster implements Disposable {
1048
+ /** {@link Component.enabled} */
1094
1049
  enabled: boolean;
1095
- /** {@link NavigationMode.id} */
1096
- readonly id = "Orbit";
1097
- constructor(camera: OrthoPerspectiveCamera);
1098
- /** {@link NavigationMode.set} */
1099
- set(active: boolean): void;
1100
- private activateOrbitControls;
1050
+ components: Components;
1051
+ /** {@link Disposable.onDisposed} */
1052
+ readonly onDisposed: Event<unknown>;
1053
+ /** The position of the mouse in the screen. */
1054
+ readonly mouse: Mouse;
1055
+ readonly three: THREE.Raycaster;
1056
+ world: World;
1057
+ constructor(components: Components, world: World);
1058
+ /** {@link Disposable.dispose} */
1059
+ dispose(): void;
1060
+ /**
1061
+ * Throws a ray from the camera to the mouse or touch event point and returns
1062
+ * the first item found. This also takes into account the clipping planes
1063
+ * used by the renderer.
1064
+ *
1065
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1066
+ * to query. If not provided, it will query all the meshes stored in
1067
+ * {@link Components.meshes}.
1068
+ */
1069
+ castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1070
+ 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;
1071
+ private intersect;
1072
+ private filterClippingPlanes;
1101
1073
  }
1102
- import { NavigationMode } from "./types";
1103
- import { OrthoPerspectiveCamera } from "../index";
1074
+ import * as THREE from "three";
1075
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1076
+ import { Components } from "../../Components";
1077
+ import { Event, World } from "../../Types";
1104
1078
  /**
1105
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1106
- * like many BIM tools.
1079
+ * A renderer to determine a mesh visibility on screen
1107
1080
  */
1108
- export declare class PlanMode implements NavigationMode {
1109
- private camera;
1110
- /** {@link NavigationMode.enabled} */
1111
- enabled: boolean;
1112
- /** {@link NavigationMode.id} */
1113
- readonly id = "Plan";
1114
- private mouseAction1?;
1115
- private mouseAction2?;
1116
- private mouseInitialized;
1117
- private readonly defaultAzimuthSpeed;
1118
- private readonly defaultPolarSpeed;
1119
- constructor(camera: OrthoPerspectiveCamera);
1120
- /** {@link NavigationMode.set} */
1121
- set(active: boolean): void;
1081
+ export declare class MeshCullerRenderer extends CullerRenderer {
1082
+ threshold: number;
1083
+ readonly onViewUpdated: Event<{
1084
+ seen: Set<THREE.Mesh>;
1085
+ unseen: Set<THREE.Mesh>;
1086
+ }>;
1087
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1088
+ isProcessing: boolean;
1089
+ private _colorCodeMeshMap;
1090
+ private _meshIDColorCodeMap;
1091
+ private _currentVisibleMeshes;
1092
+ private _recentlyHiddenMeshes;
1093
+ private _intervalID;
1094
+ private readonly _transparentMat;
1095
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1096
+ dispose(): void;
1097
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1098
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1099
+ private handleWorkerMessage;
1100
+ private getAvailableMaterial;
1122
1101
  }
1123
1102
  import * as THREE from "three";
1124
1103
  import { Components } from "../../Components";
@@ -1188,104 +1167,176 @@ export declare class CullerRenderer {
1188
1167
  private applySettings;
1189
1168
  }
1190
1169
  import * as THREE from "three";
1170
+ import { BaseRenderer, Event } from "../../Types";
1191
1171
  import { Components } from "../../Components";
1192
- import { Event, World, Disposable } from "../../Types";
1193
- import { Mouse } from "./mouse";
1194
1172
  /**
1195
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1196
- * that allows to easily get items from the scene using the mouse and touch
1197
- * events.
1173
+ * A basic renderer capable of rendering
1174
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1198
1175
  */
1199
- export declare class SimpleRaycaster implements Disposable {
1200
- /** {@link Component.enabled} */
1176
+ export declare class SimpleRenderer extends BaseRenderer {
1201
1177
  enabled: boolean;
1202
- components: Components;
1203
- /** {@link Disposable.onDisposed} */
1204
- readonly onDisposed: Event<unknown>;
1205
- /** The position of the mouse in the screen. */
1206
- readonly mouse: Mouse;
1207
- readonly three: THREE.Raycaster;
1208
- world: World;
1209
- constructor(components: Components, world: World);
1178
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
1179
+ container: HTMLElement;
1180
+ three: THREE.WebGLRenderer;
1181
+ protected _canvas: HTMLCanvasElement;
1182
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1183
+ protected _resizeObserver: ResizeObserver | null;
1184
+ protected onContainerUpdated: Event<unknown>;
1185
+ private _resizing;
1186
+ constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1187
+ /** {@link Updateable.update} */
1188
+ update(): void;
1210
1189
  /** {@link Disposable.dispose} */
1211
1190
  dispose(): void;
1191
+ /** {@link Resizeable.getSize}. */
1192
+ getSize(): THREE.Vector2;
1193
+ /** {@link Resizeable.resize} */
1194
+ resize: (size?: THREE.Vector2) => void;
1195
+ setupEvents(active: boolean): void;
1196
+ private resizeEvent;
1197
+ private setupRenderer;
1198
+ private onContextLost;
1199
+ private onContextBack;
1200
+ }
1201
+ import * as THREE from "three";
1202
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1203
+ import { Components } from "../../Components";
1204
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1212
1205
  /**
1213
- * Throws a ray from the camera to the mouse or touch event point and returns
1214
- * the first item found. This also takes into account the clipping planes
1215
- * used by the renderer.
1216
- *
1217
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1218
- * to query. If not provided, it will query all the meshes stored in
1219
- * {@link Components.meshes}.
1206
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1220
1207
  */
1221
- castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
1222
- 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;
1223
- private intersect;
1224
- private filterClippingPlanes;
1208
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1209
+ readonly onAfterUpdate: Event<unknown>;
1210
+ readonly onBeforeUpdate: Event<unknown>;
1211
+ isDisposing: boolean;
1212
+ enabled: boolean;
1213
+ uuid: string;
1214
+ name?: string;
1215
+ readonly onDisposed: Event<unknown>;
1216
+ private _scene?;
1217
+ private _camera?;
1218
+ private _renderer;
1219
+ get scene(): T;
1220
+ set scene(scene: T);
1221
+ get camera(): U;
1222
+ set camera(camera: U);
1223
+ get renderer(): S | null;
1224
+ set renderer(renderer: S | null);
1225
+ constructor(components: Components);
1226
+ update(delta?: number): void;
1227
+ dispose(disposeResources?: boolean): void;
1228
+ }
1229
+ /**
1230
+ * Simple event handler by
1231
+ * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1232
+ * Keep in mind that:
1233
+ * - If you want to remove it later, you might want to declare the callback as
1234
+ * an object.
1235
+ * - If you want to maintain the reference to 'this', you will need to declare
1236
+ * the callback as an arrow function.
1237
+ */
1238
+ export declare class Event<T> {
1239
+ /**
1240
+ * Add a callback to this event instance.
1241
+ * @param handler - the callback to be added to this event.
1242
+ */
1243
+ add(handler: T extends void ? {
1244
+ (): void;
1245
+ } : {
1246
+ (data: T): void;
1247
+ }): void;
1248
+ /**
1249
+ * Removes a callback from this event instance.
1250
+ * @param handler - the callback to be removed from this event.
1251
+ */
1252
+ remove(handler: T extends void ? {
1253
+ (): void;
1254
+ } : {
1255
+ (data: T): void;
1256
+ }): void;
1257
+ /** Triggers all the callbacks assigned to this event. */
1258
+ trigger: (data?: T) => void;
1259
+ /** Gets rid of all the suscribed events. */
1260
+ reset(): void;
1261
+ private handlers;
1225
1262
  }
1226
1263
  import * as THREE from "three";
1227
- import { Disposable, Event } from "../../Types";
1264
+ import { BaseScene, Configurable, Event } from "../../Types";
1265
+ import { Components } from "../../Components";
1266
+ export interface SimpleSceneConfig {
1267
+ directionalLight: {
1268
+ color: THREE.Color;
1269
+ intensity: number;
1270
+ position: THREE.Vector3;
1271
+ };
1272
+ ambientLight: {
1273
+ color: THREE.Color;
1274
+ intensity: number;
1275
+ };
1276
+ }
1228
1277
  /**
1229
- * A helper to easily get the real position of the mouse in the Three.js canvas
1230
- * to work with tools like the
1231
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1232
- * been transformed through CSS or doesn't occupy the whole screen.
1278
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1279
+ * objects hierarchically, and easily dispose them when you are finished with it.
1280
+ * @noInheritDoc
1233
1281
  */
1234
- export declare class Mouse implements Disposable {
1235
- dom: HTMLCanvasElement;
1236
- private _event?;
1237
- private _position;
1282
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1283
+ /** {@link Configurable.isSetup} */
1284
+ isSetup: boolean;
1285
+ three: THREE.Scene;
1286
+ /** {@link Configurable.onSetup} */
1287
+ readonly onSetup: Event<SimpleScene>;
1288
+ config: Required<SimpleSceneConfig>;
1289
+ constructor(components: Components);
1290
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1291
+ setup(config?: Partial<SimpleSceneConfig>): void;
1292
+ }
1293
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1294
+ /// <reference types="node" />
1295
+ import * as THREE from "three";
1296
+ import { Hideable, Event, World } from "../../Types";
1297
+ import { Components } from "../../Components";
1298
+ export interface GridConfig {
1299
+ color: THREE.Color;
1300
+ size1: number;
1301
+ size2: number;
1302
+ distance: number;
1303
+ }
1304
+ /**
1305
+ * An infinite grid. Created by
1306
+ * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1307
+ * and translated to typescript by
1308
+ * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1309
+ */
1310
+ export declare class SimpleGrid implements Hideable, Disposable {
1238
1311
  /** {@link Disposable.onDisposed} */
1239
1312
  readonly onDisposed: Event<unknown>;
1240
- constructor(dom: HTMLCanvasElement);
1313
+ world: World;
1314
+ components: Components;
1315
+ /** {@link Hideable.visible} */
1316
+ get visible(): boolean;
1317
+ /** {@link Hideable.visible} */
1318
+ set visible(visible: boolean);
1319
+ /** The material of the grid. */
1320
+ get material(): THREE.ShaderMaterial;
1241
1321
  /**
1242
- * The real position of the mouse of the Three.js canvas.
1322
+ * Whether the grid should fade away with distance. Recommended to be true for
1323
+ * perspective cameras and false for orthographic cameras.
1243
1324
  */
1244
- get position(): THREE.Vector2;
1325
+ get fade(): boolean;
1326
+ /**
1327
+ * Whether the grid should fade away with distance. Recommended to be true for
1328
+ * perspective cameras and false for orthographic cameras.
1329
+ */
1330
+ set fade(active: boolean);
1331
+ readonly three: THREE.Mesh;
1332
+ private _fade;
1333
+ constructor(components: Components, world: World, config: GridConfig);
1334
+ [Symbol.dispose](): void;
1245
1335
  /** {@link Disposable.dispose} */
1246
1336
  dispose(): void;
1247
- private getPositionY;
1248
- private getPositionX;
1249
- private updateMouseInfo;
1250
1337
  private setupEvents;
1338
+ private updateZoom;
1251
1339
  }
1252
- import * as THREE from "three";
1253
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1254
- import { Components } from "../../Components";
1255
- import { Event, World } from "../../Types";
1256
- /**
1257
- * A renderer to determine a mesh visibility on screen
1258
- */
1259
- export declare class MeshCullerRenderer extends CullerRenderer {
1260
- threshold: number;
1261
- readonly onViewUpdated: Event<{
1262
- seen: Set<THREE.Mesh>;
1263
- unseen: Set<THREE.Mesh>;
1264
- }>;
1265
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1266
- isProcessing: boolean;
1267
- private _colorCodeMeshMap;
1268
- private _meshIDColorCodeMap;
1269
- private _currentVisibleMeshes;
1270
- private _recentlyHiddenMeshes;
1271
- private _intervalID;
1272
- private readonly _transparentMat;
1273
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1274
- dispose(): void;
1275
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1276
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1277
- private handleWorkerMessage;
1278
- private getAvailableMaterial;
1279
- }
1280
- import * as WEBIFC from "web-ifc";
1281
- import { IfcItemsCategories } from "../../../ifc";
1282
- export declare class SpatialStructure {
1283
- itemsByFloor: IfcItemsCategories;
1284
- private _units;
1285
- setUp(webIfc: WEBIFC.IfcAPI): void;
1286
- cleanUp(): void;
1287
- }
1288
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1289
1340
  /**
1290
1341
  * Simple event handler by
1291
1342
  * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
@@ -1295,32 +1346,193 @@ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y
1295
1346
  * - If you want to maintain the reference to 'this', you will need to declare
1296
1347
  * the callback as an arrow function.
1297
1348
  */
1298
- export declare class Event<T> {
1349
+ export declare class AsyncEvent<T> {
1299
1350
  /**
1300
1351
  * Add a callback to this event instance.
1301
1352
  * @param handler - the callback to be added to this event.
1302
1353
  */
1303
1354
  add(handler: T extends void ? {
1304
- (): void;
1355
+ (): Promise<void>;
1305
1356
  } : {
1306
- (data: T): void;
1357
+ (data: T): Promise<void>;
1307
1358
  }): void;
1308
1359
  /**
1309
1360
  * Removes a callback from this event instance.
1310
1361
  * @param handler - the callback to be removed from this event.
1311
1362
  */
1312
1363
  remove(handler: T extends void ? {
1313
- (): void;
1364
+ (): Promise<void>;
1314
1365
  } : {
1315
- (data: T): void;
1366
+ (data: T): Promise<void>;
1316
1367
  }): void;
1317
1368
  /** Triggers all the callbacks assigned to this event. */
1318
- trigger: (data?: T) => void;
1369
+ trigger: (data?: T) => Promise<void>;
1319
1370
  /** Gets rid of all the suscribed events. */
1320
1371
  reset(): void;
1321
1372
  private handlers;
1322
1373
  }
1323
1374
  import * as THREE from "three";
1375
+ import { Hideable, Disposable, Event, World } from "../../Types";
1376
+ import { Components } from "../../Components";
1377
+ /**
1378
+ * Each of the planes created by {@link SimpleClipper}.
1379
+ */
1380
+ export declare class SimplePlane implements Disposable, Hideable {
1381
+ /** Event that fires when the user starts dragging a clipping plane. */
1382
+ readonly onDraggingStarted: Event<unknown>;
1383
+ /** Event that fires when the user stops dragging a clipping plane. */
1384
+ readonly onDraggingEnded: Event<unknown>;
1385
+ /** {@link Disposable.onDisposed} */
1386
+ readonly onDisposed: Event<unknown>;
1387
+ readonly normal: THREE.Vector3;
1388
+ readonly origin: THREE.Vector3;
1389
+ readonly three: THREE.Plane;
1390
+ protected readonly _helper: THREE.Object3D;
1391
+ protected _visible: boolean;
1392
+ protected _enabled: boolean;
1393
+ components: Components;
1394
+ world: World;
1395
+ private _controlsActive;
1396
+ private readonly _arrowBoundBox;
1397
+ private readonly _planeMesh;
1398
+ private readonly _controls;
1399
+ private readonly _hiddenMaterial;
1400
+ get enabled(): boolean;
1401
+ /** {@link Component.enabled} */
1402
+ set enabled(state: boolean);
1403
+ /** {@link Hideable.visible } */
1404
+ get visible(): boolean;
1405
+ /** {@link Hideable.visible } */
1406
+ set visible(state: boolean);
1407
+ /** The meshes used for raycasting */
1408
+ get meshes(): THREE.Mesh[];
1409
+ /** The material of the clipping plane representation. */
1410
+ get planeMaterial(): THREE.Material | THREE.Material[];
1411
+ /** The material of the clipping plane representation. */
1412
+ set planeMaterial(material: THREE.Material | THREE.Material[]);
1413
+ /** The size of the clipping plane representation. */
1414
+ get size(): number;
1415
+ /** Sets the size of the clipping plane representation. */
1416
+ set size(size: number);
1417
+ get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1418
+ constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1419
+ setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
1420
+ /** {@link Updateable.update} */
1421
+ update: () => void;
1422
+ /** {@link Disposable.dispose} */
1423
+ dispose(): void;
1424
+ private reset;
1425
+ protected toggleControls(state: boolean): void;
1426
+ private newTransformControls;
1427
+ private initializeControls;
1428
+ private createArrowBoundingBox;
1429
+ private changeDrag;
1430
+ private notifyDraggingChanged;
1431
+ private preventCameraMovement;
1432
+ private newHelper;
1433
+ private static newPlaneMesh;
1434
+ }
1435
+ import * as THREE from "three";
1436
+ import CameraControls from "camera-controls";
1437
+ import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1438
+ import { Components } from "../../Components";
1439
+ /**
1440
+ * A basic camera that uses
1441
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1442
+ * easily control the camera in 2D and 3D. Check out it's API to find out
1443
+ * what features it offers.
1444
+ */
1445
+ export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1446
+ /** {@link Updateable.onBeforeUpdate} */
1447
+ readonly onBeforeUpdate: Event<SimpleCamera>;
1448
+ /** {@link Updateable.onAfterUpdate} */
1449
+ readonly onAfterUpdate: Event<SimpleCamera>;
1450
+ readonly onAspectUpdated: Event<unknown>;
1451
+ /** {@link Disposable.onDisposed} */
1452
+ readonly onDisposed: Event<string>;
1453
+ three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1454
+ private _allControls;
1455
+ /**
1456
+ * The object that controls the camera. An instance of
1457
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1458
+ * Transforming the camera directly will have no effect: you need to use this
1459
+ * object to move, rotate, look at objects, etc.
1460
+ */
1461
+ get controls(): CameraControls;
1462
+ /** {@link Component.enabled} */
1463
+ get enabled(): boolean;
1464
+ /** {@link Component.enabled} */
1465
+ set enabled(enabled: boolean);
1466
+ constructor(components: Components);
1467
+ /** {@link Disposable.dispose} */
1468
+ dispose(): void;
1469
+ /** {@link Updateable.update} */
1470
+ update(_delta: number): void;
1471
+ /**
1472
+ * Updates the aspect of the camera to match the size of the
1473
+ * {@link Components.renderer}.
1474
+ */
1475
+ updateAspect: () => void;
1476
+ private setupCamera;
1477
+ private newCameraControls;
1478
+ private setupEvents;
1479
+ private static getSubsetOfThree;
1480
+ }
1481
+ import { Base } from "./base";
1482
+ /**
1483
+ * Components are the building blocks of this library. Components are singleton
1484
+ * elements that contain specific functionality. For instance, the SimpleClipper
1485
+ * Component can create, delete and handle 3D clipping planes. Components must be
1486
+ * unique (they can't be instanced more than once), and have a static UUID that
1487
+ * identifies them uniquely. The can be accessed globally using the {@link Components}
1488
+ * instance.
1489
+ */
1490
+ export declare abstract class Component extends Base {
1491
+ /**
1492
+ * Whether this component is active or not. The behaviour can vary depending
1493
+ * on the type of component. E.g. a disabled dimension tool will stop creating
1494
+ * dimensions, while a disabled camera will stop moving. A disabled component
1495
+ * will not be updated automatically each frame.
1496
+ */
1497
+ abstract enabled: boolean;
1498
+ }
1499
+ import { Base } from "./base";
1500
+ import { World } from "./world";
1501
+ import { Event } from "./event";
1502
+ import { Components } from "../../Components";
1503
+ /**
1504
+ * One of the elements that make a world. It can be either a scene, a camera
1505
+ * or a renderer.
1506
+ */
1507
+ export declare abstract class BaseWorldItem extends Base {
1508
+ readonly worlds: Map<string, World>;
1509
+ readonly onWorldChanged: Event<{
1510
+ world: World;
1511
+ action: "added" | "removed";
1512
+ }>;
1513
+ currentWorld: World | null;
1514
+ protected constructor(components: Components);
1515
+ }
1516
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1517
+ import { Components } from "../../Components";
1518
+ /**
1519
+ * Base class of the library. Useful for finding out the interfaces it implements.
1520
+ */
1521
+ export declare abstract class Base {
1522
+ components: Components;
1523
+ constructor(components: Components);
1524
+ /** Whether is component is {@link Disposable}. */
1525
+ isDisposeable: () => this is Disposable;
1526
+ /** Whether is component is {@link Resizeable}. */
1527
+ isResizeable: () => this is Resizeable;
1528
+ /** Whether is component is {@link Updateable}. */
1529
+ isUpdateable: () => this is Updateable;
1530
+ /** Whether is component is {@link Hideable}. */
1531
+ isHideable: () => this is Hideable;
1532
+ /** Whether is component is {@link Configurable}. */
1533
+ isConfigurable: () => this is Configurable<any>;
1534
+ }
1535
+ import * as THREE from "three";
1324
1536
  import CameraControls from "camera-controls";
1325
1537
  import { Event } from "./event";
1326
1538
  /**
@@ -1430,53 +1642,18 @@ export interface Configurable<T extends Record<string, any>> {
1430
1642
  */
1431
1643
  config: Required<T>;
1432
1644
  }
1433
- /**
1434
- * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
1435
- */
1436
- export interface BVHGeometry extends THREE.BufferGeometry {
1437
- boundsTree: Object | undefined;
1438
- disposeBoundsTree: () => void;
1439
- }
1440
- /**
1441
- * Whether a camera uses the Camera Controls library.
1442
- */
1443
- export interface CameraControllable {
1444
- controls: CameraControls;
1445
- }
1446
- import { Base } from "./base";
1447
- import { World } from "./world";
1448
- import { Event } from "./event";
1449
- import { Components } from "../../Components";
1450
- /**
1451
- * One of the elements that make a world. It can be either a scene, a camera
1452
- * or a renderer.
1645
+ /**
1646
+ * An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
1453
1647
  */
1454
- export declare abstract class BaseWorldItem extends Base {
1455
- readonly worlds: Map<string, World>;
1456
- readonly onWorldChanged: Event<{
1457
- world: World;
1458
- action: "added" | "removed";
1459
- }>;
1460
- currentWorld: World | null;
1461
- protected constructor(components: Components);
1648
+ export interface BVHGeometry extends THREE.BufferGeometry {
1649
+ boundsTree: Object | undefined;
1650
+ disposeBoundsTree: () => void;
1462
1651
  }
1463
- import { Base } from "./base";
1464
1652
  /**
1465
- * Components are the building blocks of this library. Components are singleton
1466
- * elements that contain specific functionality. For instance, the SimpleClipper
1467
- * Component can create, delete and handle 3D clipping planes. Components must be
1468
- * unique (they can't be instanced more than once), and have a static UUID that
1469
- * identifies them uniquely. The can be accessed globally using the {@link Components}
1470
- * instance.
1653
+ * Whether a camera uses the Camera Controls library.
1471
1654
  */
1472
- export declare abstract class Component extends Base {
1473
- /**
1474
- * Whether this component is active or not. The behaviour can vary depending
1475
- * on the type of component. E.g. a disabled dimension tool will stop creating
1476
- * dimensions, while a disabled camera will stop moving. A disabled component
1477
- * will not be updated automatically each frame.
1478
- */
1479
- abstract enabled: boolean;
1655
+ export interface CameraControllable {
1656
+ controls: CameraControls;
1480
1657
  }
1481
1658
  import * as THREE from "three";
1482
1659
  import CameraControls from "camera-controls";
@@ -1490,19 +1667,6 @@ export declare abstract class BaseCamera extends BaseWorldItem {
1490
1667
  hasCameraControls: () => this is CameraControllable;
1491
1668
  }
1492
1669
  import * as THREE from "three";
1493
- import { Disposable } from "./interfaces";
1494
- import { Event } from "./event";
1495
- import { Components } from "../../Components";
1496
- import { BaseWorldItem } from "./base-world-item";
1497
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1498
- /** {@link Disposable.onDisposed} */
1499
- readonly onDisposed: Event<unknown>;
1500
- abstract three: THREE.Object3D;
1501
- protected constructor(components: Components);
1502
- /** {@link Disposable.dispose} */
1503
- dispose(): void;
1504
- }
1505
- import * as THREE from "three";
1506
1670
  import { Vector2 } from "three";
1507
1671
  import { Event } from "./event";
1508
1672
  import { BaseWorldItem } from "./base-world-item";
@@ -1543,161 +1707,6 @@ export declare abstract class BaseRenderer extends BaseWorldItem implements Upda
1543
1707
  setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1544
1708
  }
1545
1709
  import * as THREE from "three";
1546
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
1547
- import { Components } from "../../Components";
1548
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1549
- /**
1550
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1551
- */
1552
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1553
- readonly onAfterUpdate: Event<unknown>;
1554
- readonly onBeforeUpdate: Event<unknown>;
1555
- enabled: boolean;
1556
- uuid: string;
1557
- readonly onDisposed: Event<unknown>;
1558
- private _scene?;
1559
- private _camera?;
1560
- private _renderer;
1561
- get scene(): T;
1562
- set scene(scene: T);
1563
- get camera(): U;
1564
- set camera(camera: U);
1565
- get renderer(): S | null;
1566
- set renderer(renderer: S | null);
1567
- constructor(components: Components);
1568
- update(delta?: number): void;
1569
- dispose(disposeResources?: boolean): void;
1570
- }
1571
- /**
1572
- * Simple event handler by
1573
- * [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
1574
- * Keep in mind that:
1575
- * - If you want to remove it later, you might want to declare the callback as
1576
- * an object.
1577
- * - If you want to maintain the reference to 'this', you will need to declare
1578
- * the callback as an arrow function.
1579
- */
1580
- export declare class AsyncEvent<T> {
1581
- /**
1582
- * Add a callback to this event instance.
1583
- * @param handler - the callback to be added to this event.
1584
- */
1585
- add(handler: T extends void ? {
1586
- (): Promise<void>;
1587
- } : {
1588
- (data: T): Promise<void>;
1589
- }): void;
1590
- /**
1591
- * Removes a callback from this event instance.
1592
- * @param handler - the callback to be removed from this event.
1593
- */
1594
- remove(handler: T extends void ? {
1595
- (): Promise<void>;
1596
- } : {
1597
- (data: T): Promise<void>;
1598
- }): void;
1599
- /** Triggers all the callbacks assigned to this event. */
1600
- trigger: (data?: T) => Promise<void>;
1601
- /** Gets rid of all the suscribed events. */
1602
- reset(): void;
1603
- private handlers;
1604
- }
1605
- /// <reference types="node" />
1606
- import * as THREE from "three";
1607
- import { Hideable, Event, World } from "../../Types";
1608
- import { Components } from "../../Components";
1609
- export interface GridConfig {
1610
- color: THREE.Color;
1611
- size1: number;
1612
- size2: number;
1613
- distance: number;
1614
- }
1615
- /**
1616
- * An infinite grid. Created by
1617
- * [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper)
1618
- * and translated to typescript by
1619
- * [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
1620
- */
1621
- export declare class SimpleGrid implements Hideable, Disposable {
1622
- /** {@link Disposable.onDisposed} */
1623
- readonly onDisposed: Event<unknown>;
1624
- world: World;
1625
- components: Components;
1626
- /** {@link Hideable.visible} */
1627
- get visible(): boolean;
1628
- /** {@link Hideable.visible} */
1629
- set visible(visible: boolean);
1630
- /** The material of the grid. */
1631
- get material(): THREE.ShaderMaterial;
1632
- /**
1633
- * Whether the grid should fade away with distance. Recommended to be true for
1634
- * perspective cameras and false for orthographic cameras.
1635
- */
1636
- get fade(): boolean;
1637
- /**
1638
- * Whether the grid should fade away with distance. Recommended to be true for
1639
- * perspective cameras and false for orthographic cameras.
1640
- */
1641
- set fade(active: boolean);
1642
- readonly three: THREE.Mesh;
1643
- private _fade;
1644
- constructor(components: Components, world: World, config: GridConfig);
1645
- [Symbol.dispose](): void;
1646
- /** {@link Disposable.dispose} */
1647
- dispose(): void;
1648
- private setupEvents;
1649
- private updateZoom;
1650
- }
1651
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1652
- import { Components } from "../../Components";
1653
- /**
1654
- * Base class of the library. Useful for finding out the interfaces it implements.
1655
- */
1656
- export declare abstract class Base {
1657
- components: Components;
1658
- constructor(components: Components);
1659
- /** Whether is component is {@link Disposable}. */
1660
- isDisposeable: () => this is Disposable;
1661
- /** Whether is component is {@link Resizeable}. */
1662
- isResizeable: () => this is Resizeable;
1663
- /** Whether is component is {@link Updateable}. */
1664
- isUpdateable: () => this is Updateable;
1665
- /** Whether is component is {@link Hideable}. */
1666
- isHideable: () => this is Hideable;
1667
- /** Whether is component is {@link Configurable}. */
1668
- isConfigurable: () => this is Configurable<any>;
1669
- }
1670
- import * as THREE from "three";
1671
- import { BaseScene, Configurable, Event } from "../../Types";
1672
- import { Components } from "../../Components";
1673
- export interface SimpleSceneConfig {
1674
- directionalLight: {
1675
- color: THREE.Color;
1676
- intensity: number;
1677
- position: THREE.Vector3;
1678
- };
1679
- ambientLight: {
1680
- color: THREE.Color;
1681
- intensity: number;
1682
- };
1683
- }
1684
- /**
1685
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1686
- * objects hierarchically, and easily dispose them when you are finished with it.
1687
- * @noInheritDoc
1688
- */
1689
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1690
- /** {@link Configurable.isSetup} */
1691
- isSetup: boolean;
1692
- three: THREE.Scene;
1693
- /** {@link Configurable.onSetup} */
1694
- readonly onSetup: Event<SimpleScene>;
1695
- config: Required<SimpleSceneConfig>;
1696
- constructor(components: Components);
1697
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1698
- setup(config?: Partial<SimpleSceneConfig>): void;
1699
- }
1700
- import * as THREE from "three";
1701
1710
  import { BaseScene } from "./base-scene";
1702
1711
  import { BaseCamera } from "./base-camera";
1703
1712
  import { BaseRenderer } from "./base-renderer";
@@ -1708,145 +1717,139 @@ export interface World extends Disposable, Updateable {
1708
1717
  camera: BaseCamera;
1709
1718
  renderer: BaseRenderer | null;
1710
1719
  uuid: string;
1720
+ isDisposing: boolean;
1711
1721
  }
1712
- import * as THREE from "three";
1713
- import { BaseRenderer, Event } from "../../Types";
1714
- import { Components } from "../../Components";
1722
+ import { NavigationMode } from "./types";
1723
+ import { OrthoPerspectiveCamera } from "../index";
1715
1724
  /**
1716
- * A basic renderer capable of rendering
1717
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
1725
+ * A {@link NavigationMode} that allows 3D navigation and panning
1726
+ * like in many 3D and CAD softwares.
1718
1727
  */
1719
- export declare class SimpleRenderer extends BaseRenderer {
1728
+ export declare class OrbitMode implements NavigationMode {
1729
+ camera: OrthoPerspectiveCamera;
1730
+ /** {@link NavigationMode.enabled} */
1720
1731
  enabled: boolean;
1721
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1722
- container: HTMLElement;
1723
- three: THREE.WebGLRenderer;
1724
- protected _canvas: HTMLCanvasElement;
1725
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1726
- protected _resizeObserver: ResizeObserver | null;
1727
- protected onContainerUpdated: Event<unknown>;
1728
- private _resizing;
1729
- constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1730
- /** {@link Updateable.update} */
1731
- update(): void;
1732
+ /** {@link NavigationMode.id} */
1733
+ readonly id = "Orbit";
1734
+ constructor(camera: OrthoPerspectiveCamera);
1735
+ /** {@link NavigationMode.set} */
1736
+ set(active: boolean): void;
1737
+ private activateOrbitControls;
1738
+ }
1739
+ import { NavigationMode } from "./types";
1740
+ import { OrthoPerspectiveCamera } from "../index";
1741
+ /**
1742
+ * A {@link NavigationMode} that allows first person navigation,
1743
+ * simulating FPS video games.
1744
+ */
1745
+ export declare class FirstPersonMode implements NavigationMode {
1746
+ private camera;
1747
+ /** {@link NavigationMode.enabled} */
1748
+ enabled: boolean;
1749
+ /** {@link NavigationMode.id} */
1750
+ readonly id = "FirstPerson";
1751
+ constructor(camera: OrthoPerspectiveCamera);
1752
+ /** {@link NavigationMode.set} */
1753
+ set(active: boolean): void;
1754
+ private setupFirstPersonCamera;
1755
+ }
1756
+ import * as THREE from "three";
1757
+ import { Disposable } from "./interfaces";
1758
+ import { Event } from "./event";
1759
+ import { Components } from "../../Components";
1760
+ import { BaseWorldItem } from "./base-world-item";
1761
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1762
+ /** {@link Disposable.onDisposed} */
1763
+ readonly onDisposed: Event<unknown>;
1764
+ abstract three: THREE.Object3D;
1765
+ protected constructor(components: Components);
1732
1766
  /** {@link Disposable.dispose} */
1733
1767
  dispose(): void;
1734
- /** {@link Resizeable.getSize}. */
1735
- getSize(): THREE.Vector2;
1736
- /** {@link Resizeable.resize} */
1737
- resize: (size?: THREE.Vector2) => void;
1738
- setupEvents(active: boolean): void;
1739
- private resizeEvent;
1740
- private setupRenderer;
1741
- private onContextLost;
1742
- private onContextBack;
1743
1768
  }
1744
1769
  import * as THREE from "three";
1745
- import CameraControls from "camera-controls";
1746
- import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
1747
- import { Components } from "../../Components";
1770
+ import { CameraProjection } from "./types";
1771
+ import { Event } from "../../Types";
1772
+ import { OrthoPerspectiveCamera } from "../index";
1748
1773
  /**
1749
- * A basic camera that uses
1750
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
1751
- * easily control the camera in 2D and 3D. Check out it's API to find out
1752
- * what features it offers.
1774
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1753
1775
  */
1754
- export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
1755
- /** {@link Updateable.onBeforeUpdate} */
1756
- readonly onBeforeUpdate: Event<SimpleCamera>;
1757
- /** {@link Updateable.onAfterUpdate} */
1758
- readonly onAfterUpdate: Event<SimpleCamera>;
1759
- readonly onAspectUpdated: Event<unknown>;
1760
- /** {@link Disposable.onDisposed} */
1761
- readonly onDisposed: Event<string>;
1762
- three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1763
- private _allControls;
1776
+ export declare class ProjectionManager {
1764
1777
  /**
1765
- * The object that controls the camera. An instance of
1766
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
1767
- * Transforming the camera directly will have no effect: you need to use this
1768
- * object to move, rotate, look at objects, etc.
1778
+ * Event that fires when the {@link CameraProjection} changes.
1769
1779
  */
1770
- get controls(): CameraControls;
1771
- /** {@link Component.enabled} */
1772
- get enabled(): boolean;
1773
- /** {@link Component.enabled} */
1774
- set enabled(enabled: boolean);
1775
- constructor(components: Components);
1776
- /** {@link Disposable.dispose} */
1777
- dispose(): void;
1778
- /** {@link Updateable.update} */
1779
- update(_delta: number): void;
1780
+ readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
1781
+ current: CameraProjection;
1782
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1783
+ private _component;
1784
+ private _previousDistance;
1785
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1786
+ matchOrthoDistanceEnabled: boolean;
1787
+ constructor(camera: OrthoPerspectiveCamera);
1780
1788
  /**
1781
- * Updates the aspect of the camera to match the size of the
1782
- * {@link Components.renderer}.
1789
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1790
+ *
1791
+ * @param projection - the new projection to set. If it is the current projection,
1792
+ * it will have no effect.
1783
1793
  */
1784
- updateAspect: () => void;
1785
- private setupCamera;
1786
- private newCameraControls;
1787
- private setupEvents;
1788
- private static getSubsetOfThree;
1794
+ set(projection: CameraProjection): Promise<void>;
1795
+ /**
1796
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1797
+ * and vice versa.
1798
+ */
1799
+ toggle(): Promise<void>;
1800
+ private setOrthoCamera;
1801
+ private getPerspectiveDims;
1802
+ private setupOrthoCamera;
1803
+ private getDistance;
1804
+ private setPerspectiveCamera;
1789
1805
  }
1790
- import * as THREE from "three";
1791
- import { Hideable, Disposable, Event, World } from "../../Types";
1792
- import { Components } from "../../Components";
1793
1806
  /**
1794
- * Each of the planes created by {@link SimpleClipper}.
1807
+ * The projection system of the camera.
1795
1808
  */
1796
- export declare class SimplePlane implements Disposable, Hideable {
1797
- /** Event that fires when the user starts dragging a clipping plane. */
1798
- readonly onDraggingStarted: Event<unknown>;
1799
- /** Event that fires when the user stops dragging a clipping plane. */
1800
- readonly onDraggingEnded: Event<unknown>;
1801
- /** {@link Disposable.onDisposed} */
1802
- readonly onDisposed: Event<unknown>;
1803
- readonly normal: THREE.Vector3;
1804
- readonly origin: THREE.Vector3;
1805
- readonly three: THREE.Plane;
1806
- protected readonly _helper: THREE.Object3D;
1807
- protected _visible: boolean;
1808
- protected _enabled: boolean;
1809
- components: Components;
1810
- world: World;
1811
- private _controlsActive;
1812
- private readonly _arrowBoundBox;
1813
- private readonly _planeMesh;
1814
- private readonly _controls;
1815
- private readonly _hiddenMaterial;
1816
- get enabled(): boolean;
1817
- /** {@link Component.enabled} */
1818
- set enabled(state: boolean);
1819
- /** {@link Hideable.visible } */
1820
- get visible(): boolean;
1821
- /** {@link Hideable.visible } */
1822
- set visible(state: boolean);
1823
- /** The meshes used for raycasting */
1824
- get meshes(): THREE.Mesh[];
1825
- /** The material of the clipping plane representation. */
1826
- get planeMaterial(): THREE.Material | THREE.Material[];
1827
- /** The material of the clipping plane representation. */
1828
- set planeMaterial(material: THREE.Material | THREE.Material[]);
1829
- /** The size of the clipping plane representation. */
1830
- get size(): number;
1831
- /** Sets the size of the clipping plane representation. */
1832
- set size(size: number);
1833
- get helper(): THREE.Object3D<THREE.Object3DEventMap>;
1834
- constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
1835
- setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
1836
- /** {@link Updateable.update} */
1837
- update: () => void;
1838
- /** {@link Disposable.dispose} */
1839
- dispose(): void;
1840
- private reset;
1841
- protected toggleControls(state: boolean): void;
1842
- private newTransformControls;
1843
- private initializeControls;
1844
- private createArrowBoundingBox;
1845
- private changeDrag;
1846
- private notifyDraggingChanged;
1847
- private preventCameraMovement;
1848
- private newHelper;
1849
- private static newPlaneMesh;
1809
+ export type CameraProjection = "Perspective" | "Orthographic";
1810
+ /**
1811
+ * The extensible list of supported navigation modes.
1812
+ */
1813
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1814
+ /**
1815
+ * An object that determines the behavior of the camera controls
1816
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1817
+ */
1818
+ export interface NavigationMode {
1819
+ /** The unique ID of this navigation mode. */
1820
+ id: NavModeID;
1821
+ /**
1822
+ * Enable or disable this navigation mode.
1823
+ * When a new navigation mode is enabled, the previous navigation mode
1824
+ * must be disabled.
1825
+ *
1826
+ * @param active - whether to enable or disable this mode.
1827
+ * @param options - any additional data required to enable or disable it.
1828
+ * */
1829
+ set: (active: boolean, options?: any) => void;
1830
+ /** Whether this navigation mode is active or not. */
1831
+ enabled: boolean;
1832
+ }
1833
+ import { NavigationMode } from "./types";
1834
+ import { OrthoPerspectiveCamera } from "../index";
1835
+ /**
1836
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1837
+ * like many BIM tools.
1838
+ */
1839
+ export declare class PlanMode implements NavigationMode {
1840
+ private camera;
1841
+ /** {@link NavigationMode.enabled} */
1842
+ enabled: boolean;
1843
+ /** {@link NavigationMode.id} */
1844
+ readonly id = "Plan";
1845
+ private mouseAction1?;
1846
+ private mouseAction2?;
1847
+ private mouseInitialized;
1848
+ private readonly defaultAzimuthSpeed;
1849
+ private readonly defaultPolarSpeed;
1850
+ constructor(camera: OrthoPerspectiveCamera);
1851
+ /** {@link NavigationMode.set} */
1852
+ set(active: boolean): void;
1850
1853
  }
1851
1854
  import { IfcFragmentSettings } from "../../IfcLoader/src";
1852
1855
  /** Configuration of the IFC-fragment streaming. */
@@ -1858,21 +1861,6 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1858
1861
  export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1859
1862
  propertiesSize: number;
1860
1863
  }
1861
- export interface StreamedGeometries {
1862
- [id: number]: {
1863
- boundingBox: Float32Array;
1864
- hasHoles: boolean;
1865
- geometryFile?: string;
1866
- };
1867
- }
1868
- export interface StreamedAsset {
1869
- id: number;
1870
- geometries: {
1871
- geometryID: number;
1872
- transformation: number[];
1873
- color: number[];
1874
- }[];
1875
- }
1876
1864
  import * as WEBIFC from "web-ifc";
1877
1865
  /** Configuration of the IFC-fragment conversion. */
1878
1866
  export declare class IfcFragmentSettings {
@@ -1900,6 +1888,21 @@ export declare class IfcFragmentSettings {
1900
1888
  autoSetWasm: boolean;
1901
1889
  customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1902
1890
  }
1891
+ export interface StreamedGeometries {
1892
+ [id: number]: {
1893
+ boundingBox: Float32Array;
1894
+ hasHoles: boolean;
1895
+ geometryFile?: string;
1896
+ };
1897
+ }
1898
+ export interface StreamedAsset {
1899
+ id: number;
1900
+ geometries: {
1901
+ geometryID: number;
1902
+ transformation: number[];
1903
+ color: number[];
1904
+ }[];
1905
+ }
1903
1906
  import * as WEBIFC from "web-ifc";
1904
1907
  import { AsyncEvent, Component, Disposable, Event } from "../../../core";
1905
1908
  import { PropertiesStreamingSettings } from "./streaming-settings";
@@ -1931,15 +1934,20 @@ import * as WEBIFC from "web-ifc";
1931
1934
  export declare class IfcMetadataReader {
1932
1935
  get(webIfc: WEBIFC.IfcAPI, type: number): string;
1933
1936
  }
1934
- import * as WEBIFC from "web-ifc";
1935
1937
  import * as THREE from "three";
1936
- export declare class Units {
1937
- factor: number;
1938
- complement: number;
1939
- apply(matrix: THREE.Matrix4): void;
1940
- setUp(webIfc: WEBIFC.IfcAPI): void;
1941
- private getLengthUnits;
1942
- private getScaleMatrix;
1938
+ import * as WEBIFC from "web-ifc";
1939
+ import * as FRAGS from "@thatopen/fragments";
1940
+ export declare class CivilReader {
1941
+ defLineMat: THREE.LineBasicMaterial;
1942
+ read(webIfc: WEBIFC.IfcAPI): {
1943
+ alignments: Map<number, FRAGS.Alignment>;
1944
+ coordinationMatrix: THREE.Matrix4;
1945
+ } | undefined;
1946
+ get(civilItems: any): {
1947
+ alignments: Map<number, FRAGS.Alignment>;
1948
+ coordinationMatrix: THREE.Matrix4;
1949
+ } | undefined;
1950
+ private getCurves;
1943
1951
  }
1944
1952
  export type RelationsMap = Map<number, Map<number, number[]>>;
1945
1953
  export interface ModelsRelationMap {
@@ -1965,25 +1973,20 @@ export type InverseAttributes = [
1965
1973
  "ContainsElements"
1966
1974
  ];
1967
1975
  export type InverseAttribute = InverseAttributes[number];
1976
+ import * as WEBIFC from "web-ifc";
1977
+ import * as THREE from "three";
1978
+ export declare class Units {
1979
+ factor: number;
1980
+ complement: number;
1981
+ apply(matrix: THREE.Matrix4): void;
1982
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1983
+ private getLengthUnits;
1984
+ private getScaleMatrix;
1985
+ }
1968
1986
  import { BufferGeometry } from "three";
1969
1987
  import * as THREE from "three";
1970
1988
  export declare class TransformHelper {
1971
1989
  getHelper(geometries: BufferGeometry[]): THREE.Object3D<THREE.Object3DEventMap>;
1972
1990
  }
1973
- import * as THREE from "three";
1974
- import * as WEBIFC from "web-ifc";
1975
- import * as FRAGS from "@thatopen/fragments";
1976
- export declare class CivilReader {
1977
- defLineMat: THREE.LineBasicMaterial;
1978
- read(webIfc: WEBIFC.IfcAPI): {
1979
- alignments: Map<number, FRAGS.Alignment>;
1980
- coordinationMatrix: THREE.Matrix4;
1981
- } | undefined;
1982
- get(civilItems: any): {
1983
- alignments: Map<number, FRAGS.Alignment>;
1984
- coordinationMatrix: THREE.Matrix4;
1985
- } | undefined;
1986
- private getCurves;
1987
- }
1988
1991
 
1989
1992
  }