@thatopen/components 2.0.0-alpha.3 → 2.0.0-alpha.5

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,56 +1,4 @@
1
1
  declare namespace OBC {
2
- import { Component, Disposable, Event } from "../Types";
3
- /**
4
- * The entry point of the Components library.
5
- * It can:
6
- * - Create and access all the components of the library.
7
- * - Update all the updatable components automatically.
8
- * - Dispose all the components, preventing memory leaks.
9
- */
10
- export declare class Components implements Disposable {
11
- static readonly release = "1.4.21";
12
- /** {@link Disposable.onDisposed} */
13
- readonly onDisposed: Event<void>;
14
- /** The list of components created in this app. */
15
- readonly list: Map<string, Component>;
16
- /** If disabled, the animation loop will be stopped. */
17
- enabled: boolean;
18
- private _clock;
19
- add(uuid: string, instance: Component): void;
20
- /**
21
- * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
22
- * doesn't exist, it will instance it automatically.
23
- *
24
- * @param Component - The component to get or create.
25
- */
26
- get<U extends Component>(Component: new (components: Components) => U): U;
27
- constructor();
28
- /**
29
- * Initializes the library. It should be called at the start of the app after
30
- * initializing the scene, the renderer and the
31
- * camera. Additionally, if any component that need a raycaster is
32
- * used, the {@link raycaster} will need to be initialized.
33
- */
34
- init(): void;
35
- /**
36
- * Disposes the memory of all the components and tools of this instance of
37
- * the library. A memory leak will be created if:
38
- *
39
- * - An instance of the library ends up out of scope and this function isn't
40
- * called. This is especially relevant in Single Page Applications (React,
41
- * Angular, Vue, etc).
42
- *
43
- * - Any of the objects of this instance (meshes, geometries, etc) is
44
- * referenced by a reference type (object or array).
45
- *
46
- * You can learn more about how Three.js handles memory leaks
47
- * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
48
- *
49
- */
50
- dispose(): void;
51
- private update;
52
- private static setupBVH;
53
- }
54
2
  import { Component, Disposable, World, Event } from "../Types";
55
3
  import { SimpleRaycaster } from "./src";
56
4
  import { Components } from "../Components";
@@ -107,19 +55,6 @@ export declare class Disposer extends Component {
107
55
  private disposeChildren;
108
56
  private static disposeMaterial;
109
57
  }
110
- import { Component, Disposable, World, Event } from "../Types";
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): void;
120
- delete(world: World): void;
121
- dispose(): void;
122
- }
123
58
  import * as THREE from "three";
124
59
  import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
125
60
  import { SimplePlane } from "./src";
@@ -239,6 +174,58 @@ export declare class Worlds extends Component implements Updateable, Disposable
239
174
  dispose(): void;
240
175
  update(delta?: number): void | Promise<void>;
241
176
  }
177
+ import { Component, Disposable, Event } from "../Types";
178
+ /**
179
+ * The entry point of the Components library.
180
+ * It can:
181
+ * - Create and access all the components of the library.
182
+ * - Update all the updatable components automatically.
183
+ * - Dispose all the components, preventing memory leaks.
184
+ */
185
+ export declare class Components implements Disposable {
186
+ static readonly release = "1.4.21";
187
+ /** {@link Disposable.onDisposed} */
188
+ readonly onDisposed: Event<void>;
189
+ /** The list of components created in this app. */
190
+ readonly list: Map<string, Component>;
191
+ /** If disabled, the animation loop will be stopped. */
192
+ enabled: boolean;
193
+ private _clock;
194
+ add(uuid: string, instance: Component): void;
195
+ /**
196
+ * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
197
+ * doesn't exist, it will instance it automatically.
198
+ *
199
+ * @param Component - The component to get or create.
200
+ */
201
+ get<U extends Component>(Component: new (components: Components) => U): U;
202
+ constructor();
203
+ /**
204
+ * Initializes the library. It should be called at the start of the app after
205
+ * initializing the scene, the renderer and the
206
+ * camera. Additionally, if any component that need a raycaster is
207
+ * used, the {@link raycaster} will need to be initialized.
208
+ */
209
+ init(): void;
210
+ /**
211
+ * Disposes the memory of all the components and tools of this instance of
212
+ * the library. A memory leak will be created if:
213
+ *
214
+ * - An instance of the library ends up out of scope and this function isn't
215
+ * called. This is especially relevant in Single Page Applications (React,
216
+ * Angular, Vue, etc).
217
+ *
218
+ * - Any of the objects of this instance (meshes, geometries, etc) is
219
+ * referenced by a reference type (object or array).
220
+ *
221
+ * You can learn more about how Three.js handles memory leaks
222
+ * [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
223
+ *
224
+ */
225
+ dispose(): void;
226
+ private update;
227
+ private static setupBVH;
228
+ }
242
229
  import { Components } from "../Components";
243
230
  import { MeshCullerRenderer, CullerRendererSettings } from "./src";
244
231
  import { Component, Event, Disposable, World } from "../Types";
@@ -261,6 +248,19 @@ export declare class Cullers extends Component implements Disposable {
261
248
  /** {@link Disposable.dispose} */
262
249
  dispose(): void;
263
250
  }
251
+ import { Component, Disposable, World, Event } from "../Types";
252
+ import { GridConfig, SimpleGrid } from "./src";
253
+ export declare class Grids extends Component implements Disposable {
254
+ static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
255
+ list: Map<string, SimpleGrid>;
256
+ onDisposed: Event<unknown>;
257
+ config: Required<GridConfig>;
258
+ /** {@link Component.enabled} */
259
+ enabled: boolean;
260
+ create(world: World): void;
261
+ delete(world: World): void;
262
+ dispose(): void;
263
+ }
264
264
  import * as THREE from "three";
265
265
  import { Component, Disposable, Event, World } from "../Types";
266
266
  import { Components } from "../Components";
@@ -322,6 +322,131 @@ export declare class Materials extends Component implements Disposable {
322
322
  */
323
323
  removeMeshes(id: string, meshes: THREE.Mesh[]): void;
324
324
  }
325
+ import * as FRAGS from "@thatopen/fragments";
326
+ import { Disposable, Component, Event, Components } from "../../core";
327
+ export interface Classification {
328
+ [system: string]: {
329
+ [className: string]: FRAGS.FragmentIdMap;
330
+ };
331
+ }
332
+ export declare class FragmentClassifier extends Component implements Disposable {
333
+ static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
334
+ /** {@link Component.enabled} */
335
+ enabled: boolean;
336
+ private _groupSystems;
337
+ /** {@link Disposable.onDisposed} */
338
+ readonly onDisposed: Event<unknown>;
339
+ constructor(components: Components);
340
+ private onFragmentsDisposed;
341
+ /** {@link Component.get} */
342
+ get(): Classification;
343
+ dispose(): void;
344
+ remove(guid: string): void;
345
+ find(filter?: {
346
+ [name: string]: string[];
347
+ }): FRAGS.FragmentIdMap;
348
+ byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
349
+ byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
350
+ byEntity(group: FRAGS.FragmentsGroup): void;
351
+ byStorey(group: FRAGS.FragmentsGroup): void;
352
+ byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
353
+ private saveItem;
354
+ }
355
+ import * as THREE from "three";
356
+ export declare function obbFromPoints(vertices: ArrayLike<number>): {
357
+ center: THREE.Vector3;
358
+ halfSizes: THREE.Vector3;
359
+ rotation: THREE.Matrix3;
360
+ transformation: THREE.Matrix4;
361
+ };
362
+ export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
363
+ import * as THREE from "three";
364
+ export declare class MaterialsUtils {
365
+ static isTransparent(material: THREE.Material): boolean;
366
+ }
367
+ export declare class UUID {
368
+ private static _pattern;
369
+ private static _lut;
370
+ static create(): string;
371
+ static validate(uuid: string): void;
372
+ }
373
+ import * as THREE from "three";
374
+ import { Component, Components, Event, World, Disposable } from "../core";
375
+ export interface VertexPickerConfig {
376
+ showOnlyVertex: boolean;
377
+ snapDistance: number;
378
+ previewElement: HTMLElement;
379
+ }
380
+ export declare class VertexPicker extends Component implements Disposable {
381
+ onVertexFound: Event<THREE.Vector3>;
382
+ onVertexLost: Event<THREE.Vector3>;
383
+ components: Components;
384
+ private _pickedPoint;
385
+ private _config;
386
+ private _enabled;
387
+ private _workingPlane;
388
+ /** {@link Disposable.onDisposed} */
389
+ readonly onDisposed: Event<unknown>;
390
+ set enabled(value: boolean);
391
+ get enabled(): boolean;
392
+ constructor(components: Components, config?: Partial<VertexPickerConfig>);
393
+ [Symbol.dispose](): void;
394
+ set workingPlane(plane: THREE.Plane | null);
395
+ get workingPlane(): THREE.Plane | null;
396
+ set config(value: Partial<VertexPickerConfig>);
397
+ get config(): Partial<VertexPickerConfig>;
398
+ dispose(): void;
399
+ get(world: World): THREE.Vector3 | null;
400
+ private getClosestVertex;
401
+ private getVertices;
402
+ private getVertex;
403
+ }
404
+ import * as THREE from "three";
405
+ import * as FRAGS from "@thatopen/fragments";
406
+ import { FragmentsGroup } from "@thatopen/fragments";
407
+ import { Component, Components, Disposable, Event } from "../../core";
408
+ /**
409
+ * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
410
+ * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
411
+ */
412
+ export declare class FragmentBoundingBox extends Component implements Disposable {
413
+ static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
414
+ /** {@link Component.enabled} */
415
+ enabled: boolean;
416
+ /** {@link Disposable.onDisposed} */
417
+ readonly onDisposed: Event<unknown>;
418
+ private _absoluteMin;
419
+ private _absoluteMax;
420
+ private _meshes;
421
+ constructor(components: Components);
422
+ static getDimensions(bbox: THREE.Box3): {
423
+ width: number;
424
+ height: number;
425
+ depth: number;
426
+ center: THREE.Vector3;
427
+ };
428
+ static newBound(positive: boolean): THREE.Vector3;
429
+ static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
430
+ /** {@link Disposable.dispose} */
431
+ dispose(): void;
432
+ get(): THREE.Box3;
433
+ getSphere(): THREE.Sphere;
434
+ getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
435
+ reset(): void;
436
+ add(group: FragmentsGroup): void;
437
+ addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh): void;
438
+ private static getFragmentBounds;
439
+ }
440
+ import * as FRAGS from "@thatopen/fragments";
441
+ import { Components, Component } from "../../core";
442
+ export declare class FragmentHider extends Component {
443
+ static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
444
+ enabled: boolean;
445
+ constructor(components: Components);
446
+ set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
447
+ isolate(items: FRAGS.FragmentIdMap): void;
448
+ private updateCulledVisibility;
449
+ }
325
450
  import * as THREE from "three";
326
451
  export interface MeasureEdge {
327
452
  distance: number;
@@ -342,21 +467,148 @@ export declare class MeasurementUtils {
342
467
  };
343
468
  private static round;
344
469
  }
345
- export declare class UUID {
346
- private static _pattern;
347
- private static _lut;
348
- static create(): string;
349
- static validate(uuid: string): void;
470
+ import * as WEBIFC from "web-ifc";
471
+ import * as FRAGS from "@thatopen/fragments";
472
+ import { IfcFragmentSettings } from "./src";
473
+ import { Component, Components, Event, Disposable } from "../../core";
474
+ export declare class FragmentIfcLoader extends Component implements Disposable {
475
+ static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
476
+ readonly onIfcStartedLoading: Event<void>;
477
+ readonly onSetup: Event<void>;
478
+ /** {@link Disposable.onDisposed} */
479
+ readonly onDisposed: Event<string>;
480
+ settings: IfcFragmentSettings;
481
+ enabled: boolean;
482
+ webIfc: WEBIFC.IfcAPI;
483
+ private _material;
484
+ private _spatialTree;
485
+ private _metaData;
486
+ private _fragmentInstances;
487
+ private _civil;
488
+ private _propertyExporter;
489
+ private _visitedFragments;
490
+ private _materialT;
491
+ constructor(components: Components);
492
+ dispose(): void;
493
+ setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
494
+ load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
495
+ readIfcFile(data: Uint8Array): Promise<number>;
496
+ private getAllGeometries;
497
+ cleanUp(): void;
498
+ private getMesh;
499
+ private getGeometry;
500
+ private autoSetWasm;
501
+ }
502
+ import { Component, Disposable, Event, Components } from "../../core";
503
+ export declare class FragmentExploder extends Component implements Disposable {
504
+ static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
505
+ enabled: boolean;
506
+ height: number;
507
+ groupName: string;
508
+ /** {@link Disposable.onDisposed} */
509
+ readonly onDisposed: Event<string>;
510
+ list: Set<string>;
511
+ constructor(components: Components);
512
+ dispose(): void;
513
+ explode(): void;
514
+ reset(): void;
515
+ update(): void;
350
516
  }
517
+ import { Fragment, FragmentsGroup } from "@thatopen/fragments";
351
518
  import * as THREE from "three";
352
- export declare function obbFromPoints(vertices: ArrayLike<number>): {
353
- center: THREE.Vector3;
354
- halfSizes: THREE.Vector3;
355
- rotation: THREE.Matrix3;
356
- transformation: THREE.Matrix4;
357
- };
519
+ import { Component, Components, Event, Disposable } from "../../core";
520
+ /**
521
+ * Object that can efficiently load binary files that contain
522
+ * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
523
+ */
524
+ export declare class FragmentManager extends Component implements Disposable {
525
+ static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
526
+ /** {@link Disposable.onDisposed} */
527
+ readonly onDisposed: Event<unknown>;
528
+ readonly onFragmentsLoaded: Event<FragmentsGroup>;
529
+ readonly onFragmentsDisposed: Event<{
530
+ groupID: string;
531
+ fragmentIDs: string[];
532
+ }>;
533
+ /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
534
+ readonly list: Map<string, Fragment>;
535
+ readonly groups: Map<string, FragmentsGroup>;
536
+ /** {@link Component.enabled} */
537
+ enabled: boolean;
538
+ baseCoordinationModel: string;
539
+ private _loader;
540
+ /** The list of meshes of the created fragments. */
541
+ get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
542
+ constructor(components: Components);
543
+ /** {@link Disposable.dispose} */
544
+ dispose(): void;
545
+ disposeGroup(group: FragmentsGroup): void;
546
+ /**
547
+ * Loads one or many fragments into the scene.
548
+ * @param data - the bytes containing the data for the fragments to load.
549
+ * @param coordinate - whether this fragmentsgroup should be federated with the others.
550
+ * @returns the list of IDs of the loaded fragments.
551
+ */
552
+ load(data: Uint8Array, coordinate?: boolean): FragmentsGroup;
553
+ /**
554
+ * Export the specified fragments.
555
+ * @param group - the fragments group to be exported.
556
+ * @returns the exported data as binary buffer.
557
+ */
558
+ export(group: FragmentsGroup): Uint8Array;
559
+ coordinate(models?: FragmentsGroup[]): void;
560
+ }
561
+ import * as THREE from "three";
562
+ import { Components } from "../../core/Components";
563
+ import { SimpleCamera } from "../../core";
564
+ import { NavigationMode, NavModeID, ProjectionManager } from "./src";
565
+ /**
566
+ * A flexible camera that uses
567
+ * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
568
+ * easily control the camera in 2D and 3D. It supports multiple navigation
569
+ * modes, such as 2D floor plan navigation, first person and 3D orbit.
570
+ */
571
+ export declare class OrthoPerspectiveCamera extends SimpleCamera {
572
+ /**
573
+ * The current {@link NavigationMode}.
574
+ */
575
+ mode: NavigationMode;
576
+ readonly projection: ProjectionManager;
577
+ readonly threeOrtho: THREE.OrthographicCamera;
578
+ protected readonly _userInputButtons: any;
579
+ protected readonly _frustumSize = 50;
580
+ protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
581
+ get current(): THREE.PerspectiveCamera | THREE.OrthographicCamera;
582
+ constructor(components: Components);
583
+ /** {@link Disposable.dispose} */
584
+ dispose(): void;
585
+ /**
586
+ * Sets a new {@link NavigationMode} and disables the previous one.
587
+ *
588
+ * @param mode - The {@link NavigationMode} to set.
589
+ */
590
+ set(mode: NavModeID): void;
591
+ /**
592
+ * Make the camera view fit all the specified meshes.
593
+ *
594
+ * @param meshes the meshes to fit. If it is not defined, it will
595
+ * evaluate {@link Components.meshes}.
596
+ * @param offset the distance to the fit object
597
+ */
598
+ fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
599
+ /**
600
+ * Allows or prevents all user input.
601
+ *
602
+ * @param active - whether to enable or disable user inputs.
603
+ */
604
+ setUserInput(active: boolean): void;
605
+ private disableUserInput;
606
+ private enableUserInput;
607
+ private newOrthoCamera;
608
+ private setOrthoCameraAspect;
609
+ }
358
610
  import * as WEBIFC from "web-ifc";
359
- import * as FRAG from "bim-fragment";
611
+ import * as FRAG from "@thatopen/fragments";
360
612
  /**
361
613
  * Object to export all the properties from an IFC to a JS object.
362
614
  */
@@ -371,8 +623,39 @@ export declare class IfcJsonExporter {
371
623
  */
372
624
  export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
373
625
  }
626
+ import { FragmentsGroup } from "@thatopen/fragments";
627
+ import { Disposable, Event, Component, Components } from "../../core";
628
+ import { IfcPropertiesManager } from "../IfcPropertiesManager";
629
+ interface IndexMap {
630
+ [modelID: string]: {
631
+ [expressID: string]: Set<number>;
632
+ };
633
+ }
634
+ export declare class IfcPropertiesIndexer extends Component implements Disposable {
635
+ static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
636
+ /** {@link Disposable.onDisposed} */
637
+ readonly onDisposed: Event<string>;
638
+ enabled: boolean;
639
+ relationsToProcess: number[];
640
+ indexMap: IndexMap;
641
+ private _propertiesManager;
642
+ readonly onPropertiesManagerSet: Event<IfcPropertiesManager>;
643
+ set propertiesManager(manager: IfcPropertiesManager | null);
644
+ get propertiesManager(): IfcPropertiesManager | null;
645
+ constructor(components: Components);
646
+ private onFragmentsDisposed;
647
+ dispose(): Promise<void>;
648
+ getProperties(model: FragmentsGroup, id: string): Promise<any[] | null>;
649
+ private getNestedPsets;
650
+ private getPsetProperties;
651
+ process(model: FragmentsGroup): Promise<void>;
652
+ private setEntityIndex;
653
+ private cloneProperty;
654
+ private clonePropertyArray;
655
+ }
656
+ export {};
374
657
  import * as WEBIFC from "web-ifc";
375
- import { FragmentsGroup } from "bim-fragment";
658
+ import { FragmentsGroup } from "@thatopen/fragments";
376
659
  import { Component, Disposable, Event, Components } from "../../core";
377
660
  type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
378
661
  type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
@@ -423,7 +706,7 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
423
706
  get(): ChangeMap;
424
707
  dispose(): void;
425
708
  private increaseMaxID;
426
- static getIFCSchema(model: FragmentsGroup): import("bim-fragment").IfcSchema;
709
+ static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
427
710
  private newGUID;
428
711
  private getOwnerHistory;
429
712
  private registerChange;
@@ -444,8 +727,8 @@ export declare class IfcPropertiesManager extends Component implements Disposabl
444
727
  setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
445
728
  }
446
729
  export {};
447
- import * as FRAGS from "bim-fragment";
448
- import { FragmentsGroup } from "bim-fragment";
730
+ import * as FRAGS from "@thatopen/fragments";
731
+ import { FragmentsGroup } from "@thatopen/fragments";
449
732
  import { Disposable, Event, Component, Components } from "../../core";
450
733
  import { QueryGroup } from "./src/types";
451
734
  export interface QueryResult {
@@ -481,476 +764,78 @@ export declare class IfcPropertiesFinder extends Component implements Disposable
481
764
  private arrayUnion;
482
765
  private getConditionFunctions;
483
766
  }
767
+ import * as WEBIFC from "web-ifc";
768
+ import { IfcItemsCategories } from "../../../ifc";
769
+ export declare class SpatialStructure {
770
+ itemsByFloor: IfcItemsCategories;
771
+ private _units;
772
+ setUp(webIfc: WEBIFC.IfcAPI): void;
773
+ cleanUp(): void;
774
+ }
775
+ export declare const GeometryTypes: Set<number>;
776
+ import * as WEBIFC from "web-ifc";
777
+ export interface IfcItemsCategories {
778
+ [itemID: number]: number;
779
+ }
780
+ export declare class IfcCategories {
781
+ getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
782
+ }
783
+ export declare const IfcElements: {
784
+ [key: number]: string;
785
+ };
786
+ export declare const IfcCategoryMap: {
787
+ [key: number]: string;
788
+ };
789
+ import * as FRAGS from "@thatopen/fragments";
790
+ export declare class IfcPropertiesUtils {
791
+ static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
792
+ static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
793
+ [attribute: string]: any;
794
+ } | null>;
795
+ static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
796
+ [relatingID: number]: number[];
797
+ }>;
798
+ static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
799
+ static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
800
+ static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
801
+ static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
802
+ static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
803
+ key: string | null;
804
+ name: string | null;
805
+ }>;
806
+ static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
807
+ key: string | null;
808
+ value: number | null;
809
+ }>;
810
+ static isRel(expressID: number): boolean;
811
+ static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
812
+ static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
813
+ }
484
814
  import * as THREE from "three";
485
- import { Components } from "../../core/Components";
486
- import { SimpleCamera } from "../../core";
487
- import { NavigationMode, NavModeID, ProjectionManager } from "./src";
488
- /**
489
- * A flexible camera that uses
490
- * [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
491
- * easily control the camera in 2D and 3D. It supports multiple navigation
492
- * modes, such as 2D floor plan navigation, first person and 3D orbit.
493
- */
494
- export declare class OrthoPerspectiveCamera extends SimpleCamera {
815
+ import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
816
+ import { Components } from "../../Components";
817
+ export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
495
818
  /**
496
- * The current {@link NavigationMode}.
819
+ * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
497
820
  */
498
- mode: NavigationMode;
499
- readonly projection: ProjectionManager;
500
- readonly threeOrtho: THREE.OrthographicCamera;
501
- protected readonly _userInputButtons: any;
502
- protected readonly _frustumSize = 50;
503
- protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
504
- get current(): THREE.PerspectiveCamera | THREE.OrthographicCamera;
821
+ readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
822
+ readonly onAfterUpdate: Event<unknown>;
823
+ readonly onBeforeUpdate: Event<unknown>;
824
+ enabled: boolean;
825
+ uuid: string;
826
+ readonly onDisposed: Event<unknown>;
827
+ private _scene?;
828
+ private _camera?;
829
+ private _renderer;
830
+ get scene(): T;
831
+ set scene(scene: T);
832
+ get camera(): U;
833
+ set camera(camera: U);
834
+ get renderer(): S | null;
835
+ set renderer(renderer: S | null);
505
836
  constructor(components: Components);
506
- /** {@link Disposable.dispose} */
507
- dispose(): void;
508
- /**
509
- * Sets a new {@link NavigationMode} and disables the previous one.
510
- *
511
- * @param mode - The {@link NavigationMode} to set.
512
- */
513
- set(mode: NavModeID): void;
514
- /**
515
- * Make the camera view fit all the specified meshes.
516
- *
517
- * @param meshes the meshes to fit. If it is not defined, it will
518
- * evaluate {@link Components.meshes}.
519
- * @param offset the distance to the fit object
520
- */
521
- fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
522
- /**
523
- * Allows or prevents all user input.
524
- *
525
- * @param active - whether to enable or disable user inputs.
526
- */
527
- setUserInput(active: boolean): void;
528
- private disableUserInput;
529
- private enableUserInput;
530
- private newOrthoCamera;
531
- private setOrthoCameraAspect;
532
- }
533
- import { FragmentsGroup } from "bim-fragment";
534
- import { Disposable, Event, Component, Components } from "../../core";
535
- import { IfcPropertiesManager } from "../IfcPropertiesManager";
536
- interface IndexMap {
537
- [modelID: string]: {
538
- [expressID: string]: Set<number>;
539
- };
540
- }
541
- export declare class IfcPropertiesIndexer extends Component implements Disposable {
542
- static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
543
- /** {@link Disposable.onDisposed} */
544
- readonly onDisposed: Event<string>;
545
- enabled: boolean;
546
- relationsToProcess: number[];
547
- indexMap: IndexMap;
548
- private _propertiesManager;
549
- readonly onPropertiesManagerSet: Event<IfcPropertiesManager>;
550
- set propertiesManager(manager: IfcPropertiesManager | null);
551
- get propertiesManager(): IfcPropertiesManager | null;
552
- constructor(components: Components);
553
- private onFragmentsDisposed;
554
- dispose(): Promise<void>;
555
- getProperties(model: FragmentsGroup, id: string): Promise<any[] | null>;
556
- private getNestedPsets;
557
- private getPsetProperties;
558
- process(model: FragmentsGroup): Promise<void>;
559
- private setEntityIndex;
560
- private cloneProperty;
561
- private clonePropertyArray;
562
- }
563
- export {};
564
- import * as FRAGS from "bim-fragment";
565
- import { Disposable, Component, Event, Components } from "../../core";
566
- export interface Classification {
567
- [system: string]: {
568
- [className: string]: FRAGS.FragmentIdMap;
569
- };
570
- }
571
- export declare class FragmentClassifier extends Component implements Disposable {
572
- static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
573
- /** {@link Component.enabled} */
574
- enabled: boolean;
575
- private _groupSystems;
576
- /** {@link Disposable.onDisposed} */
577
- readonly onDisposed: Event<unknown>;
578
- constructor(components: Components);
579
- private onFragmentsDisposed;
580
- /** {@link Component.get} */
581
- get(): Classification;
582
- dispose(): void;
583
- remove(guid: string): void;
584
- find(filter?: {
585
- [name: string]: string[];
586
- }): FRAGS.FragmentIdMap;
587
- byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
588
- byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
589
- byEntity(group: FRAGS.FragmentsGroup): void;
590
- byStorey(group: FRAGS.FragmentsGroup): void;
591
- byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
592
- private saveItem;
593
- }
594
- import * as THREE from "three";
595
- import * as FRAGS from "bim-fragment";
596
- import { FragmentsGroup } from "bim-fragment";
597
- import { Component, Components, Disposable, Event } from "../../core";
598
- /**
599
- * A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
600
- * it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
601
- */
602
- export declare class FragmentBoundingBox extends Component implements Disposable {
603
- static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
604
- /** {@link Component.enabled} */
605
- enabled: boolean;
606
- /** {@link Disposable.onDisposed} */
607
- readonly onDisposed: Event<unknown>;
608
- private _absoluteMin;
609
- private _absoluteMax;
610
- private _meshes;
611
- constructor(components: Components);
612
- static getDimensions(bbox: THREE.Box3): {
613
- width: number;
614
- height: number;
615
- depth: number;
616
- center: THREE.Vector3;
617
- };
618
- static newBound(positive: boolean): THREE.Vector3;
619
- static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
620
- /** {@link Disposable.dispose} */
621
- dispose(): void;
622
- get(): THREE.Box3;
623
- getSphere(): THREE.Sphere;
624
- getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
625
- reset(): void;
626
- add(group: FragmentsGroup): void;
627
- addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh): void;
628
- private static getFragmentBounds;
629
- }
630
- import { Component, Disposable, Event, Components } from "../../core";
631
- export declare class FragmentExploder extends Component implements Disposable {
632
- static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
633
- enabled: boolean;
634
- height: number;
635
- groupName: string;
636
- /** {@link Disposable.onDisposed} */
637
- readonly onDisposed: Event<string>;
638
- list: Set<string>;
639
- constructor(components: Components);
640
- dispose(): void;
641
- explode(): void;
642
- reset(): void;
643
- update(): void;
644
- }
645
- import * as FRAGS from "bim-fragment";
646
- import { Components, Component } from "../../core";
647
- export declare class FragmentHider extends Component {
648
- static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
649
- enabled: boolean;
650
- constructor(components: Components);
651
- set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
652
- isolate(items: FRAGS.FragmentIdMap): void;
653
- private updateCulledVisibility;
654
- }
655
- import * as WEBIFC from "web-ifc";
656
- import * as FRAGS from "bim-fragment";
657
- import { IfcFragmentSettings } from "./src";
658
- import { Component, Components, Event, Disposable } from "../../core";
659
- export declare class FragmentIfcLoader extends Component implements Disposable {
660
- static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
661
- readonly onIfcStartedLoading: Event<void>;
662
- readonly onSetup: Event<void>;
663
- /** {@link Disposable.onDisposed} */
664
- readonly onDisposed: Event<string>;
665
- settings: IfcFragmentSettings;
666
- enabled: boolean;
667
- webIfc: WEBIFC.IfcAPI;
668
- private _material;
669
- private _spatialTree;
670
- private _metaData;
671
- private _fragmentInstances;
672
- private _civil;
673
- private _propertyExporter;
674
- private _visitedFragments;
675
- private _materialT;
676
- constructor(components: Components);
677
- dispose(): void;
678
- setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
679
- load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
680
- readIfcFile(data: Uint8Array): Promise<number>;
681
- private getAllGeometries;
682
- cleanUp(): void;
683
- private getMesh;
684
- private getGeometry;
685
- private autoSetWasm;
686
- }
687
- import { Fragment, FragmentsGroup } from "bim-fragment";
688
- import * as THREE from "three";
689
- import { Component, Components, Event, Disposable } from "../../core";
690
- /**
691
- * Object that can efficiently load binary files that contain
692
- * [fragment geometry](https://github.com/ThatOpen/engine_fragment).
693
- */
694
- export declare class FragmentManager extends Component implements Disposable {
695
- static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
696
- /** {@link Disposable.onDisposed} */
697
- readonly onDisposed: Event<unknown>;
698
- readonly onFragmentsLoaded: Event<FragmentsGroup>;
699
- readonly onFragmentsDisposed: Event<{
700
- groupID: string;
701
- fragmentIDs: string[];
702
- }>;
703
- /** All the created [fragments](https://github.com/ThatOpen/engine_fragment). */
704
- readonly list: Map<string, Fragment>;
705
- readonly groups: Map<string, FragmentsGroup>;
706
- /** {@link Component.enabled} */
707
- enabled: boolean;
708
- baseCoordinationModel: string;
709
- private _loader;
710
- /** The list of meshes of the created fragments. */
711
- get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
712
- constructor(components: Components);
713
- /** {@link Disposable.dispose} */
714
- dispose(): void;
715
- disposeGroup(group: FragmentsGroup): void;
716
- /**
717
- * Loads one or many fragments into the scene.
718
- * @param data - the bytes containing the data for the fragments to load.
719
- * @param coordinate - whether this fragmentsgroup should be federated with the others.
720
- * @returns the list of IDs of the loaded fragments.
721
- */
722
- load(data: Uint8Array, coordinate?: boolean): FragmentsGroup;
723
- /**
724
- * Export the specified fragments.
725
- * @param group - the fragments group to be exported.
726
- * @returns the exported data as binary buffer.
727
- */
728
- export(group: FragmentsGroup): Uint8Array;
729
- coordinate(models?: FragmentsGroup[]): void;
730
- }
731
- import * as THREE from "three";
732
- export declare class MaterialsUtils {
733
- static isTransparent(material: THREE.Material): boolean;
734
- }
735
- import * as THREE from "three";
736
- import { Component, Components, Event, World, Disposable } from "../core";
737
- export interface VertexPickerConfig {
738
- showOnlyVertex: boolean;
739
- snapDistance: number;
740
- previewElement: HTMLElement;
741
- }
742
- export declare class VertexPicker extends Component implements Disposable {
743
- onVertexFound: Event<THREE.Vector3>;
744
- onVertexLost: Event<THREE.Vector3>;
745
- components: Components;
746
- private _pickedPoint;
747
- private _config;
748
- private _enabled;
749
- private _workingPlane;
750
- /** {@link Disposable.onDisposed} */
751
- readonly onDisposed: Event<unknown>;
752
- set enabled(value: boolean);
753
- get enabled(): boolean;
754
- constructor(components: Components, config?: Partial<VertexPickerConfig>);
755
- [Symbol.dispose](): void;
756
- set workingPlane(plane: THREE.Plane | null);
757
- get workingPlane(): THREE.Plane | null;
758
- set config(value: Partial<VertexPickerConfig>);
759
- get config(): Partial<VertexPickerConfig>;
760
- dispose(): void;
761
- get(world: World): THREE.Vector3 | null;
762
- private getClosestVertex;
763
- private getVertices;
764
- private getVertex;
765
- }
766
- export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
767
- export declare const IfcCategoryMap: {
768
- [key: number]: string;
769
- };
770
- export declare const IfcElements: {
771
- [key: number]: string;
772
- };
773
- import * as FRAGS from "bim-fragment";
774
- export declare class IfcPropertiesUtils {
775
- static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
776
- static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
777
- [attribute: string]: any;
778
- } | null>;
779
- static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
780
- [relatingID: number]: number[];
781
- }>;
782
- static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
783
- static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
784
- static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
785
- static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
786
- static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
787
- key: string | null;
788
- name: string | null;
789
- }>;
790
- static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
791
- key: string | null;
792
- value: number | null;
793
- }>;
794
- static isRel(expressID: number): boolean;
795
- static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
796
- static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
797
- }
798
- import * as WEBIFC from "web-ifc";
799
- export interface IfcItemsCategories {
800
- [itemID: number]: number;
801
- }
802
- export declare class IfcCategories {
803
- getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
804
- }
805
- export declare const GeometryTypes: Set<number>;
806
- import * as THREE from "three";
807
- import { Components } from "../../Components";
808
- import { Event, World, Disposable } from "../../Types";
809
- import { Mouse } from "./mouse";
810
- /**
811
- * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
812
- * that allows to easily get items from the scene using the mouse and touch
813
- * events.
814
- */
815
- export declare class SimpleRaycaster implements Disposable {
816
- /** {@link Component.enabled} */
817
- enabled: boolean;
818
- components: Components;
819
- /** {@link Disposable.onDisposed} */
820
- readonly onDisposed: Event<unknown>;
821
- /** The position of the mouse in the screen. */
822
- readonly mouse: Mouse;
823
- readonly three: THREE.Raycaster;
824
- world: World;
825
- constructor(components: Components, world: World);
826
- /** {@link Disposable.dispose} */
827
- dispose(): void;
828
- /**
829
- * Throws a ray from the camera to the mouse or touch event point and returns
830
- * the first item found. This also takes into account the clipping planes
831
- * used by the renderer.
832
- *
833
- * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
834
- * to query. If not provided, it will query all the meshes stored in
835
- * {@link Components.meshes}.
836
- */
837
- castRay(items?: THREE.Mesh[]): THREE.Intersection | null;
838
- 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;
839
- private intersect;
840
- private filterClippingPlanes;
841
- }
842
- import { NavigationMode } from "./types";
843
- /**
844
- * A {@link NavigationMode} that allows first person navigation,
845
- * simulating FPS video games.
846
- */
847
- export declare class FirstPersonMode implements NavigationMode {
848
- private camera;
849
- /** {@link NavigationMode.enabled} */
850
- enabled: boolean;
851
- /** {@link NavigationMode.id} */
852
- readonly id = "FirstPerson";
853
- constructor(camera: any);
854
- /** {@link NavigationMode.set} */
855
- set(active: boolean): void;
856
- private setupFirstPersonCamera;
857
- }
858
- import * as THREE from "three";
859
- import { Disposable, Event } from "../../Types";
860
- /**
861
- * A helper to easily get the real position of the mouse in the Three.js canvas
862
- * to work with tools like the
863
- * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
864
- * been transformed through CSS or doesn't occupy the whole screen.
865
- */
866
- export declare class Mouse implements Disposable {
867
- dom: HTMLCanvasElement;
868
- private _event?;
869
- private _position;
870
- /** {@link Disposable.onDisposed} */
871
- readonly onDisposed: Event<unknown>;
872
- constructor(dom: HTMLCanvasElement);
873
- /**
874
- * The real position of the mouse of the Three.js canvas.
875
- */
876
- get position(): THREE.Vector2;
877
- /** {@link Disposable.dispose} */
878
- dispose(): void;
879
- private getPositionY;
880
- private getPositionX;
881
- private updateMouseInfo;
882
- private setupEvents;
883
- }
884
- import { NavigationMode } from "./types";
885
- /**
886
- * A {@link NavigationMode} that allows 3D navigation and panning
887
- * like in many 3D and CAD softwares.
888
- */
889
- export declare class OrbitMode implements NavigationMode {
890
- camera: any;
891
- /** {@link NavigationMode.enabled} */
892
- enabled: boolean;
893
- /** {@link NavigationMode.id} */
894
- readonly id = "Orbit";
895
- constructor(camera: any);
896
- /** {@link NavigationMode.set} */
897
- set(active: boolean): void;
898
- private activateOrbitControls;
899
- }
900
- import * as WEBIFC from "web-ifc";
901
- import { IfcItemsCategories } from "../../../ifc";
902
- export declare class SpatialStructure {
903
- itemsByFloor: IfcItemsCategories;
904
- private _units;
905
- setUp(webIfc: WEBIFC.IfcAPI): void;
906
- cleanUp(): void;
907
- }
908
- import { NavigationMode } from "./types";
909
- /**
910
- * A {@link NavigationMode} that allows to navigate floorplans in 2D,
911
- * like many BIM tools.
912
- */
913
- export declare class PlanMode implements NavigationMode {
914
- private camera;
915
- /** {@link NavigationMode.enabled} */
916
- enabled: boolean;
917
- /** {@link NavigationMode.id} */
918
- readonly id = "Plan";
919
- private mouseAction1?;
920
- private mouseAction2?;
921
- private mouseInitialized;
922
- private readonly defaultAzimuthSpeed;
923
- private readonly defaultPolarSpeed;
924
- constructor(camera: any);
925
- /** {@link NavigationMode.set} */
926
- set(active: boolean): void;
927
- }
928
- /**
929
- * The projection system of the camera.
930
- */
931
- export type CameraProjection = "Perspective" | "Orthographic";
932
- /**
933
- * The extensible list of supported navigation modes.
934
- */
935
- export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
936
- /**
937
- * An object that determines the behavior of the camera controls
938
- * and the user input (e.g. 2D floor plan mode, first person mode, etc).
939
- */
940
- export interface NavigationMode {
941
- /** The unique ID of this navigation mode. */
942
- id: NavModeID;
943
- /**
944
- * Enable or disable this navigation mode.
945
- * When a new navigation mode is enabled, the previous navigation mode
946
- * must be disabled.
947
- *
948
- * @param active - whether to enable or disable this mode.
949
- * @param options - any additional data required to enable or disable it.
950
- * */
951
- set: (active: boolean, options?: any) => void;
952
- /** Whether this navigation mode is active or not. */
953
- enabled: boolean;
837
+ update(delta?: number): void;
838
+ dispose(disposeResources?: boolean): void;
954
839
  }
955
840
  /// <reference types="node" />
956
841
  import * as THREE from "three";
@@ -1001,167 +886,34 @@ export declare class SimpleGrid implements Hideable, Disposable {
1001
886
  private updateZoom;
1002
887
  }
1003
888
  import * as THREE from "three";
1004
- import { CameraProjection } from "./types";
1005
- import { Event } from "../../../core";
1006
- import { OrthoPerspectiveCamera } from "../index";
1007
- /**
1008
- * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1009
- */
1010
- export declare class ProjectionManager {
1011
- /**
1012
- * Event that fires when the {@link CameraProjection} changes.
1013
- */
1014
- readonly onChanged: Event<THREE.Camera>;
1015
- current: CameraProjection;
1016
- camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1017
- private _component;
1018
- private _previousDistance;
1019
- /** Match Ortho zoom with Perspective distance when changing projection mode */
1020
- matchOrthoDistanceEnabled: boolean;
1021
- constructor(camera: OrthoPerspectiveCamera);
1022
- /**
1023
- * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1024
- *
1025
- * @param projection - the new projection to set. If it is the current projection,
1026
- * it will have no effect.
1027
- */
1028
- set(projection: CameraProjection): Promise<void>;
1029
- /**
1030
- * Changes the current {@link CameraProjection} from Ortographic to Perspective
1031
- * and vice versa.
1032
- */
1033
- toggle(): Promise<void>;
1034
- private setOrthoCamera;
1035
- private getDims;
1036
- private setupOrthoCamera;
1037
- private getDistance;
1038
- private setPerspectiveCamera;
1039
- }
1040
- import * as THREE from "three";
1041
- import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1042
- import { Components } from "../../Components";
1043
- import { Event, World } from "../../Types";
1044
- /**
1045
- * A renderer to determine a mesh visibility on screen
1046
- */
1047
- export declare class MeshCullerRenderer extends CullerRenderer {
1048
- threshold: number;
1049
- readonly onViewUpdated: Event<{
1050
- seen: Set<THREE.Mesh>;
1051
- unseen: Set<THREE.Mesh>;
1052
- }>;
1053
- colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1054
- isProcessing: boolean;
1055
- private _colorCodeMeshMap;
1056
- private _meshIDColorCodeMap;
1057
- private _currentVisibleMeshes;
1058
- private _recentlyHiddenMeshes;
1059
- private readonly _transparentMat;
1060
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1061
- dispose(): void;
1062
- add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1063
- remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1064
- private handleWorkerMessage;
1065
- private getAvailableMaterial;
1066
- }
1067
- import * as THREE from "three";
889
+ import { BaseScene, Configurable, Event } from "../../Types";
1068
890
  import { Components } from "../../Components";
1069
- import { Event, World } from "../../Types";
1070
- export interface CullerRendererSettings {
1071
- updateInterval?: number;
1072
- width?: number;
1073
- height?: number;
1074
- autoUpdate?: boolean;
1075
- }
1076
- /**
1077
- * A base renderer to determine visibility on screen
1078
- */
1079
- export declare class CullerRenderer {
1080
- /** {@link Disposable.onDisposed} */
1081
- readonly onDisposed: Event<string>;
1082
- /**
1083
- * Fires after making the visibility check to the meshes. It lists the
1084
- * meshes that are currently visible, and the ones that were visible
1085
- * just before but not anymore.
1086
- */
1087
- readonly onViewUpdated: Event<any>;
1088
- /** {@link Component.enabled} */
1089
- enabled: boolean;
1090
- /**
1091
- * Needs to check whether there are objects that need to be hidden or shown.
1092
- * You can bind this to the camera movement, to a certain interval, etc.
1093
- */
1094
- needsUpdate: boolean;
1095
- /**
1096
- * Render the internal scene used to determine the object visibility. Used
1097
- * for debugging purposes.
1098
- */
1099
- renderDebugFrame: boolean;
1100
- components: Components;
1101
- readonly world: World;
1102
- readonly renderer: THREE.WebGLRenderer;
1103
- protected autoUpdate: boolean;
1104
- protected updateInterval: number;
1105
- protected readonly worker: Worker;
1106
- protected readonly scene: THREE.Scene;
1107
- private _width;
1108
- private _height;
1109
- private _availableColor;
1110
- private readonly renderTarget;
1111
- private readonly bufferSize;
1112
- private readonly _buffer;
1113
- constructor(components: Components, world: World, settings?: CullerRendererSettings);
1114
- /** {@link Disposable.dispose} */
1115
- dispose(): void;
1116
- /**
1117
- * The function that the culler uses to reprocess the scene. Generally it's
1118
- * better to call needsUpdate, but you can also call this to force it.
1119
- * @param force if true, it will refresh the scene even if needsUpdate is
1120
- * not true.
1121
- */
1122
- updateVisibility: (force?: boolean) => Promise<void>;
1123
- protected getAvailableColor(): {
1124
- r: number;
1125
- g: number;
1126
- b: number;
1127
- code: string;
891
+ export interface SimpleSceneConfig {
892
+ directionalLight: {
893
+ color: THREE.Color;
894
+ intensity: number;
895
+ position: THREE.Vector3;
896
+ };
897
+ ambientLight: {
898
+ color: THREE.Color;
899
+ intensity: number;
1128
900
  };
1129
- protected increaseColor(): void;
1130
- protected decreaseColor(): void;
1131
- private applySettings;
1132
901
  }
1133
- export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1134
- import * as THREE from "three";
1135
- import { BaseRenderer, Event } from "../../Types";
1136
- import { Components } from "../../Components";
1137
902
  /**
1138
- * A basic renderer capable of rendering
1139
- * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
903
+ * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
904
+ * objects hierarchically, and easily dispose them when you are finished with it.
905
+ * @noInheritDoc
1140
906
  */
1141
- export declare class SimpleRenderer extends BaseRenderer {
1142
- /** {@link Component.enabled} */
1143
- enabled: boolean;
1144
- /** The HTML container of the THREE.js canvas where the scene is rendered. */
1145
- container: HTMLElement | null;
1146
- three: THREE.WebGLRenderer;
1147
- protected _canvas: HTMLCanvasElement;
1148
- protected _parameters?: Partial<THREE.WebGLRendererParameters>;
1149
- protected onContainerUpdated: Event<HTMLElement>;
1150
- constructor(components: Components, container?: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
1151
- /** {@link Updateable.update} */
1152
- update(): void;
1153
- /** {@link Disposable.dispose} */
1154
- dispose(): void;
1155
- /** {@link Resizeable.getSize}. */
1156
- getSize(): THREE.Vector2;
1157
- /** {@link Resizeable.resize} */
1158
- resize: (size?: THREE.Vector2) => void;
1159
- setupEvents(active: boolean): void;
1160
- private resizeEvent;
1161
- private setupRenderer;
1162
- private onContextLost;
1163
- private onContextBack;
1164
- private updateContainer;
907
+ export declare class SimpleScene extends BaseScene implements Configurable<{}> {
908
+ /** {@link Configurable.isSetup} */
909
+ isSetup: boolean;
910
+ three: THREE.Scene;
911
+ /** {@link Configurable.onSetup} */
912
+ readonly onSetup: Event<SimpleScene>;
913
+ config: Required<SimpleSceneConfig>;
914
+ constructor(components: Components);
915
+ /** Creates a simple and nice default set up for the scene (e.g. lighting). */
916
+ setup(config?: Partial<SimpleSceneConfig>): void;
1165
917
  }
1166
918
  import * as THREE from "three";
1167
919
  import CameraControls from "camera-controls";
@@ -1210,30 +962,36 @@ export declare class SimpleCamera extends BaseCamera implements Updateable, Disp
1210
962
  private static getSubsetOfThree;
1211
963
  }
1212
964
  import * as THREE from "three";
1213
- import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
965
+ import { BaseRenderer, Event } from "../../Types";
1214
966
  import { Components } from "../../Components";
1215
- export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
1216
- /**
1217
- * All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
1218
- */
1219
- readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
1220
- readonly onAfterUpdate: Event<unknown>;
1221
- readonly onBeforeUpdate: Event<unknown>;
967
+ /**
968
+ * A basic renderer capable of rendering
969
+ * ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
970
+ */
971
+ export declare class SimpleRenderer extends BaseRenderer {
972
+ /** {@link Component.enabled} */
1222
973
  enabled: boolean;
1223
- uuid: string;
1224
- readonly onDisposed: Event<unknown>;
1225
- private _scene?;
1226
- private _camera?;
1227
- private _renderer;
1228
- get scene(): T;
1229
- set scene(scene: T);
1230
- get camera(): U;
1231
- set camera(camera: U);
1232
- get renderer(): S | null;
1233
- set renderer(renderer: S | null);
1234
- constructor(components: Components);
1235
- update(delta?: number): void;
1236
- dispose(disposeResources?: boolean): void;
974
+ /** The HTML container of the THREE.js canvas where the scene is rendered. */
975
+ container: HTMLElement | null;
976
+ three: THREE.WebGLRenderer;
977
+ protected _canvas: HTMLCanvasElement;
978
+ protected _parameters?: Partial<THREE.WebGLRendererParameters>;
979
+ protected onContainerUpdated: Event<HTMLElement>;
980
+ constructor(components: Components, container?: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
981
+ /** {@link Updateable.update} */
982
+ update(): void;
983
+ /** {@link Disposable.dispose} */
984
+ dispose(): void;
985
+ /** {@link Resizeable.getSize}. */
986
+ getSize(): THREE.Vector2;
987
+ /** {@link Resizeable.resize} */
988
+ resize: (size?: THREE.Vector2) => void;
989
+ setupEvents(active: boolean): void;
990
+ private resizeEvent;
991
+ private setupRenderer;
992
+ private onContextLost;
993
+ private onContextBack;
994
+ private updateContainer;
1237
995
  }
1238
996
  /**
1239
997
  * Simple event handler by
@@ -1392,36 +1150,6 @@ export interface BVHGeometry extends THREE.BufferGeometry {
1392
1150
  export interface CameraControllable {
1393
1151
  controls: CameraControls;
1394
1152
  }
1395
- import * as THREE from "three";
1396
- import { BaseScene, Configurable, Event } from "../../Types";
1397
- import { Components } from "../../Components";
1398
- export interface SimpleSceneConfig {
1399
- directionalLight: {
1400
- color: THREE.Color;
1401
- intensity: number;
1402
- position: THREE.Vector3;
1403
- };
1404
- ambientLight: {
1405
- color: THREE.Color;
1406
- intensity: number;
1407
- };
1408
- }
1409
- /**
1410
- * A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
1411
- * objects hierarchically, and easily dispose them when you are finished with it.
1412
- * @noInheritDoc
1413
- */
1414
- export declare class SimpleScene extends BaseScene implements Configurable<{}> {
1415
- /** {@link Configurable.isSetup} */
1416
- isSetup: boolean;
1417
- three: THREE.Scene;
1418
- /** {@link Configurable.onSetup} */
1419
- readonly onSetup: Event<SimpleScene>;
1420
- config: Required<SimpleSceneConfig>;
1421
- constructor(components: Components);
1422
- /** Creates a simple and nice default set up for the scene (e.g. lighting). */
1423
- setup(config?: Partial<SimpleSceneConfig>): void;
1424
- }
1425
1153
  import { Base } from "./base";
1426
1154
  /**
1427
1155
  * Components are the building blocks of this library. Components are singleton
@@ -1440,78 +1168,330 @@ export declare abstract class Component extends Base {
1440
1168
  */
1441
1169
  abstract enabled: boolean;
1442
1170
  }
1443
- import { Base } from "./base";
1444
- import { World } from "./world";
1445
- import { Event } from "./event";
1171
+ import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1172
+ import { Components } from "../../Components";
1173
+ /**
1174
+ * Base class of the library. Useful for finding out the interfaces it implements.
1175
+ */
1176
+ export declare abstract class Base {
1177
+ components: Components;
1178
+ constructor(components: Components);
1179
+ /** Whether is component is {@link Disposable}. */
1180
+ isDisposeable: () => this is Disposable;
1181
+ /** Whether is component is {@link Resizeable}. */
1182
+ isResizeable: () => this is Resizeable;
1183
+ /** Whether is component is {@link Updateable}. */
1184
+ isUpdateable: () => this is Updateable;
1185
+ /** Whether is component is {@link Hideable}. */
1186
+ isHideable: () => this is Hideable;
1187
+ /** Whether is component is {@link Configurable}. */
1188
+ isConfigurable: () => this is Configurable<any>;
1189
+ }
1190
+ import { Base } from "./base";
1191
+ import { World } from "./world";
1192
+ import { Event } from "./event";
1193
+ import { Components } from "../../Components";
1194
+ /**
1195
+ * One of the elements that make a world. It can be either a scene, a camera
1196
+ * or a renderer.
1197
+ */
1198
+ export declare abstract class BaseWorldItem extends Base {
1199
+ readonly worlds: Map<string, World>;
1200
+ readonly onWorldChanged: Event<{
1201
+ world: World;
1202
+ action: "added" | "removed";
1203
+ }>;
1204
+ currentWorld: World | null;
1205
+ protected constructor(components: Components);
1206
+ }
1207
+ import * as THREE from "three";
1208
+ import CameraControls from "camera-controls";
1209
+ import { BaseWorldItem } from "./base-world-item";
1210
+ import { CameraControllable } from "./interfaces";
1211
+ export declare abstract class BaseCamera extends BaseWorldItem {
1212
+ abstract enabled: boolean;
1213
+ abstract three: THREE.Camera;
1214
+ abstract controls?: CameraControls;
1215
+ /** Whether is instance is {@link CameraControllable}. */
1216
+ hasCameraControls: () => this is CameraControllable;
1217
+ }
1218
+ import * as THREE from "three";
1219
+ import { Vector2 } from "three";
1220
+ import { Event } from "./event";
1221
+ import { BaseWorldItem } from "./base-world-item";
1222
+ import { Disposable, Resizeable, Updateable } from "./interfaces";
1223
+ export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1224
+ abstract three: THREE.WebGLRenderer;
1225
+ /** {@link Updateable.onBeforeUpdate} */
1226
+ onAfterUpdate: Event<unknown>;
1227
+ /** {@link Updateable.onAfterUpdate} */
1228
+ onBeforeUpdate: Event<unknown>;
1229
+ /** {@link Disposable.onDisposed} */
1230
+ readonly onDisposed: Event<undefined>;
1231
+ readonly onResize: Event<THREE.Vector2>;
1232
+ /**
1233
+ * Event that fires when there has been a change to the list of clipping
1234
+ * planes used by the active renderer.
1235
+ */
1236
+ readonly onClippingPlanesUpdated: Event<unknown>;
1237
+ abstract update(delta?: number): void | Promise<void>;
1238
+ abstract dispose(): void;
1239
+ abstract getSize(): Vector2;
1240
+ abstract resize(size: Vector2 | undefined): void;
1241
+ /**
1242
+ * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1243
+ * instance of the renderer.
1244
+ */
1245
+ clippingPlanes: THREE.Plane[];
1246
+ /**
1247
+ * Forces the update of the clipping planes and all components that depend
1248
+ * on them that are subscribed to 'onClippingPlanesUpdated'.
1249
+ */
1250
+ updateClippingPlanes(): void;
1251
+ /**
1252
+ * Adds or removes a
1253
+ * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1254
+ * to the renderer.
1255
+ */
1256
+ setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1257
+ }
1258
+ import * as THREE from "three";
1259
+ import { BaseScene } from "./base-scene";
1260
+ import { BaseCamera } from "./base-camera";
1261
+ import { BaseRenderer } from "./base-renderer";
1262
+ import { Updateable, Disposable } from "./interfaces";
1263
+ export interface World extends Disposable, Updateable {
1264
+ meshes: Set<THREE.Mesh>;
1265
+ scene: BaseScene;
1266
+ camera: BaseCamera;
1267
+ renderer: BaseRenderer | null;
1268
+ uuid: string;
1269
+ }
1270
+ import * as THREE from "three";
1271
+ import { Disposable } from "./interfaces";
1272
+ import { Event } from "./event";
1273
+ import { Components } from "../../Components";
1274
+ import { BaseWorldItem } from "./base-world-item";
1275
+ export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1276
+ /** {@link Disposable.onDisposed} */
1277
+ readonly onDisposed: Event<unknown>;
1278
+ abstract three: THREE.Object3D;
1279
+ protected constructor(components: Components);
1280
+ /** {@link Disposable.dispose} */
1281
+ dispose(): void;
1282
+ }
1283
+ import * as WEBIFC from "web-ifc";
1284
+ /** Configuration of the IFC-fragment conversion. */
1285
+ export declare class IfcFragmentSettings {
1286
+ /** Whether to extract the IFC properties into a JSON. */
1287
+ includeProperties: boolean;
1288
+ /**
1289
+ * Generate the geometry for categories that are not included by default,
1290
+ * like IFCSPACE.
1291
+ */
1292
+ optionalCategories: number[];
1293
+ /** Whether to use the coordination data coming from the IFC files. */
1294
+ coordinate: boolean;
1295
+ /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1296
+ wasm: {
1297
+ path: string;
1298
+ absolute: boolean;
1299
+ logLevel?: WEBIFC.LogLevel;
1300
+ };
1301
+ /** List of categories that won't be converted to fragments. */
1302
+ excludedCategories: Set<number>;
1303
+ /** Whether to save the absolute location of all IFC items. */
1304
+ saveLocations: boolean;
1305
+ /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1306
+ webIfc: WEBIFC.LoaderSettings;
1307
+ autoSetWasm: boolean;
1308
+ customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1309
+ }
1310
+ import * as THREE from "three";
1311
+ import * as WEBIFC from "web-ifc";
1312
+ import * as FRAGS from "@thatopen/fragments";
1313
+ export declare class CivilReader {
1314
+ defLineMat: THREE.LineBasicMaterial;
1315
+ read(webIfc: WEBIFC.IfcAPI): {
1316
+ alignments: Map<number, FRAGS.Alignment>;
1317
+ coordinationMatrix: THREE.Matrix4;
1318
+ } | undefined;
1319
+ get(civilItems: any): {
1320
+ alignments: Map<number, FRAGS.Alignment>;
1321
+ coordinationMatrix: THREE.Matrix4;
1322
+ } | undefined;
1323
+ private getCurves;
1324
+ }
1325
+ import * as WEBIFC from "web-ifc";
1326
+ export declare class IfcMetadataReader {
1327
+ get(webIfc: WEBIFC.IfcAPI, type: number): string;
1328
+ }
1329
+ import * as THREE from "three";
1330
+ import { Disposable, Event } from "../../Types";
1331
+ /**
1332
+ * A helper to easily get the real position of the mouse in the Three.js canvas
1333
+ * to work with tools like the
1334
+ * [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has
1335
+ * been transformed through CSS or doesn't occupy the whole screen.
1336
+ */
1337
+ export declare class Mouse implements Disposable {
1338
+ dom: HTMLCanvasElement;
1339
+ private _event?;
1340
+ private _position;
1341
+ /** {@link Disposable.onDisposed} */
1342
+ readonly onDisposed: Event<unknown>;
1343
+ constructor(dom: HTMLCanvasElement);
1344
+ /**
1345
+ * The real position of the mouse of the Three.js canvas.
1346
+ */
1347
+ get position(): THREE.Vector2;
1348
+ /** {@link Disposable.dispose} */
1349
+ dispose(): void;
1350
+ private getPositionY;
1351
+ private getPositionX;
1352
+ private updateMouseInfo;
1353
+ private setupEvents;
1354
+ }
1355
+ import * as THREE from "three";
1356
+ import { Components } from "../../Components";
1357
+ import { Event, World, Disposable } from "../../Types";
1358
+ import { Mouse } from "./mouse";
1359
+ /**
1360
+ * A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster)
1361
+ * that allows to easily get items from the scene using the mouse and touch
1362
+ * events.
1363
+ */
1364
+ export declare class SimpleRaycaster implements Disposable {
1365
+ /** {@link Component.enabled} */
1366
+ enabled: boolean;
1367
+ components: Components;
1368
+ /** {@link Disposable.onDisposed} */
1369
+ readonly onDisposed: Event<unknown>;
1370
+ /** The position of the mouse in the screen. */
1371
+ readonly mouse: Mouse;
1372
+ readonly three: THREE.Raycaster;
1373
+ world: World;
1374
+ constructor(components: Components, world: World);
1375
+ /** {@link Disposable.dispose} */
1376
+ dispose(): void;
1377
+ /**
1378
+ * Throws a ray from the camera to the mouse or touch event point and returns
1379
+ * the first item found. This also takes into account the clipping planes
1380
+ * used by the renderer.
1381
+ *
1382
+ * @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
1383
+ * to query. If not provided, it will query all the meshes stored in
1384
+ * {@link Components.meshes}.
1385
+ */
1386
+ castRay(items?: THREE.Mesh[]): THREE.Intersection | null;
1387
+ 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;
1388
+ private intersect;
1389
+ private filterClippingPlanes;
1390
+ }
1391
+ import * as THREE from "three";
1446
1392
  import { Components } from "../../Components";
1447
- /**
1448
- * One of the elements that make a world. It can be either a scene, a camera
1449
- * or a renderer.
1450
- */
1451
- export declare abstract class BaseWorldItem extends Base {
1452
- readonly worlds: Map<string, World>;
1453
- readonly onWorldChanged: Event<{
1454
- world: World;
1455
- action: "added" | "removed";
1456
- }>;
1457
- currentWorld: World | null;
1458
- protected constructor(components: Components);
1393
+ import { Event, World } from "../../Types";
1394
+ export interface CullerRendererSettings {
1395
+ updateInterval?: number;
1396
+ width?: number;
1397
+ height?: number;
1398
+ autoUpdate?: boolean;
1459
1399
  }
1460
- import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
1461
- import { Components } from "../../Components";
1462
1400
  /**
1463
- * Base class of the library. Useful for finding out the interfaces it implements.
1401
+ * A base renderer to determine visibility on screen
1464
1402
  */
1465
- export declare abstract class Base {
1403
+ export declare class CullerRenderer {
1404
+ /** {@link Disposable.onDisposed} */
1405
+ readonly onDisposed: Event<string>;
1406
+ /**
1407
+ * Fires after making the visibility check to the meshes. It lists the
1408
+ * meshes that are currently visible, and the ones that were visible
1409
+ * just before but not anymore.
1410
+ */
1411
+ readonly onViewUpdated: Event<any>;
1412
+ /** {@link Component.enabled} */
1413
+ enabled: boolean;
1414
+ /**
1415
+ * Needs to check whether there are objects that need to be hidden or shown.
1416
+ * You can bind this to the camera movement, to a certain interval, etc.
1417
+ */
1418
+ needsUpdate: boolean;
1419
+ /**
1420
+ * Render the internal scene used to determine the object visibility. Used
1421
+ * for debugging purposes.
1422
+ */
1423
+ renderDebugFrame: boolean;
1466
1424
  components: Components;
1467
- constructor(components: Components);
1468
- /** Whether is component is {@link Disposable}. */
1469
- isDisposeable: () => this is Disposable;
1470
- /** Whether is component is {@link Resizeable}. */
1471
- isResizeable: () => this is Resizeable;
1472
- /** Whether is component is {@link Updateable}. */
1473
- isUpdateable: () => this is Updateable;
1474
- /** Whether is component is {@link Hideable}. */
1475
- isHideable: () => this is Hideable;
1476
- /** Whether is component is {@link Configurable}. */
1477
- isConfigurable: () => this is Configurable<any>;
1478
- }
1479
- import * as THREE from "three";
1480
- import CameraControls from "camera-controls";
1481
- import { BaseWorldItem } from "./base-world-item";
1482
- import { CameraControllable } from "./interfaces";
1483
- export declare abstract class BaseCamera extends BaseWorldItem {
1484
- abstract enabled: boolean;
1485
- abstract three: THREE.Camera;
1486
- abstract controls?: CameraControls;
1487
- /** Whether is instance is {@link CameraControllable}. */
1488
- hasCameraControls: () => this is CameraControllable;
1425
+ readonly world: World;
1426
+ readonly renderer: THREE.WebGLRenderer;
1427
+ protected autoUpdate: boolean;
1428
+ protected updateInterval: number;
1429
+ protected readonly worker: Worker;
1430
+ protected readonly scene: THREE.Scene;
1431
+ private _width;
1432
+ private _height;
1433
+ private _availableColor;
1434
+ private readonly renderTarget;
1435
+ private readonly bufferSize;
1436
+ private readonly _buffer;
1437
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1438
+ /** {@link Disposable.dispose} */
1439
+ dispose(): void;
1440
+ /**
1441
+ * The function that the culler uses to reprocess the scene. Generally it's
1442
+ * better to call needsUpdate, but you can also call this to force it.
1443
+ * @param force if true, it will refresh the scene even if needsUpdate is
1444
+ * not true.
1445
+ */
1446
+ updateVisibility: (force?: boolean) => Promise<void>;
1447
+ protected getAvailableColor(): {
1448
+ r: number;
1449
+ g: number;
1450
+ b: number;
1451
+ code: string;
1452
+ };
1453
+ protected increaseColor(): void;
1454
+ protected decreaseColor(): void;
1455
+ private applySettings;
1489
1456
  }
1490
1457
  import * as THREE from "three";
1491
- import { Disposable } from "./interfaces";
1492
- import { Event } from "./event";
1458
+ import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
1493
1459
  import { Components } from "../../Components";
1494
- import { BaseWorldItem } from "./base-world-item";
1495
- export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
1496
- /** {@link Disposable.onDisposed} */
1497
- readonly onDisposed: Event<unknown>;
1498
- abstract three: THREE.Object3D;
1499
- protected constructor(components: Components);
1500
- /** {@link Disposable.dispose} */
1460
+ import { Event, World } from "../../Types";
1461
+ /**
1462
+ * A renderer to determine a mesh visibility on screen
1463
+ */
1464
+ export declare class MeshCullerRenderer extends CullerRenderer {
1465
+ threshold: number;
1466
+ readonly onViewUpdated: Event<{
1467
+ seen: Set<THREE.Mesh>;
1468
+ unseen: Set<THREE.Mesh>;
1469
+ }>;
1470
+ colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
1471
+ isProcessing: boolean;
1472
+ private _colorCodeMeshMap;
1473
+ private _meshIDColorCodeMap;
1474
+ private _currentVisibleMeshes;
1475
+ private _recentlyHiddenMeshes;
1476
+ private readonly _transparentMat;
1477
+ constructor(components: Components, world: World, settings?: CullerRendererSettings);
1501
1478
  dispose(): void;
1479
+ add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1480
+ remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
1481
+ private handleWorkerMessage;
1482
+ private getAvailableMaterial;
1502
1483
  }
1484
+ import * as WEBIFC from "web-ifc";
1503
1485
  import * as THREE from "three";
1504
- import { BaseScene } from "./base-scene";
1505
- import { BaseCamera } from "./base-camera";
1506
- import { BaseRenderer } from "./base-renderer";
1507
- import { Updateable, Disposable } from "./interfaces";
1508
- export interface World extends Disposable, Updateable {
1509
- meshes: Set<THREE.Mesh>;
1510
- scene: BaseScene;
1511
- camera: BaseCamera;
1512
- renderer: BaseRenderer | null;
1513
- uuid: string;
1486
+ export declare class Units {
1487
+ factor: number;
1488
+ complement: number;
1489
+ apply(matrix: THREE.Matrix4): void;
1490
+ setUp(webIfc: WEBIFC.IfcAPI): void;
1491
+ private getLengthUnits;
1492
+ private getScaleMatrix;
1514
1493
  }
1494
+ export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
1515
1495
  import { IfcFragmentSettings } from "../../FragmentIfcLoader/src";
1516
1496
  /** Configuration of the IFC-fragment streaming. */
1517
1497
  export declare class IfcStreamingSettings extends IfcFragmentSettings {
@@ -1522,45 +1502,88 @@ export declare class IfcStreamingSettings extends IfcFragmentSettings {
1522
1502
  export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
1523
1503
  propertiesSize: number;
1524
1504
  }
1525
- import * as THREE from "three";
1526
- import { Vector2 } from "three";
1527
- import { Event } from "./event";
1528
- import { BaseWorldItem } from "./base-world-item";
1529
- import { Disposable, Resizeable, Updateable } from "./interfaces";
1530
- export declare abstract class BaseRenderer extends BaseWorldItem implements Updateable, Disposable, Resizeable {
1531
- abstract three: THREE.WebGLRenderer;
1532
- /** {@link Updateable.onBeforeUpdate} */
1533
- onAfterUpdate: Event<unknown>;
1534
- /** {@link Updateable.onAfterUpdate} */
1535
- onBeforeUpdate: Event<unknown>;
1505
+ import * as WEBIFC from "web-ifc";
1506
+ import { Component, Disposable, Event } from "../../../core";
1507
+ import { PropertiesStreamingSettings } from "./streaming-settings";
1508
+ export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1509
+ static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1510
+ onPropertiesStreamed: Event<{
1511
+ type: number;
1512
+ data: {
1513
+ [id: number]: any;
1514
+ };
1515
+ }>;
1516
+ onProgress: Event<number>;
1517
+ onIndicesStreamed: Event<number[][]>;
1536
1518
  /** {@link Disposable.onDisposed} */
1537
- readonly onDisposed: Event<undefined>;
1538
- readonly onResize: Event<THREE.Vector2>;
1539
- /**
1540
- * Event that fires when there has been a change to the list of clipping
1541
- * planes used by the active renderer.
1542
- */
1543
- readonly onClippingPlanesUpdated: Event<unknown>;
1544
- abstract update(delta?: number): void | Promise<void>;
1545
- abstract dispose(): void;
1546
- abstract getSize(): Vector2;
1547
- abstract resize(size: Vector2 | undefined): void;
1548
- /**
1549
- * The list of [clipping planes](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes) used by this
1550
- * instance of the renderer.
1551
- */
1552
- clippingPlanes: THREE.Plane[];
1553
- /**
1554
- * Forces the update of the clipping planes and all components that depend
1555
- * on them that are subscribed to 'onClippingPlanesUpdated'.
1556
- */
1557
- updateClippingPlanes(): void;
1558
- /**
1559
- * Adds or removes a
1560
- * [clipping plane](https://threejs.org/docs/#api/en/renderers/WebGLRenderer.clippingPlanes)
1561
- * to the renderer.
1562
- */
1563
- setPlane(active: boolean, plane: THREE.Plane, isLocal?: boolean): void;
1519
+ readonly onDisposed: Event<string>;
1520
+ enabled: boolean;
1521
+ settings: PropertiesStreamingSettings;
1522
+ webIfc: WEBIFC.IfcAPI;
1523
+ dispose(): Promise<void>;
1524
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1525
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1526
+ private readIfcFile;
1527
+ private streamIfcFile;
1528
+ private streamAllProperties;
1529
+ private getIndices;
1530
+ private cleanUp;
1531
+ }
1532
+ import * as WEBIFC from "web-ifc";
1533
+ import { Components, Disposable, Event, Component } from "../../../core";
1534
+ import { IfcStreamingSettings } from "./streaming-settings";
1535
+ import { StreamedGeometries, StreamedAsset } from "./base-types";
1536
+ export declare class FragmentIfcStreamConverter extends Component implements Disposable {
1537
+ static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1538
+ onGeometryStreamed: Event<{
1539
+ buffer: Uint8Array;
1540
+ data: StreamedGeometries;
1541
+ }>;
1542
+ onAssetStreamed: Event<StreamedAsset[]>;
1543
+ onProgress: Event<number>;
1544
+ onIfcLoaded: Event<Uint8Array>;
1545
+ /** {@link Disposable.onDisposed} */
1546
+ readonly onDisposed: Event<unknown>;
1547
+ settings: IfcStreamingSettings;
1548
+ enabled: boolean;
1549
+ webIfc: WEBIFC.IfcAPI;
1550
+ private _spatialTree;
1551
+ private _metaData;
1552
+ private _visitedGeometries;
1553
+ private _streamSerializer;
1554
+ private _geometries;
1555
+ private _geometryCount;
1556
+ private _civil;
1557
+ private _groupSerializer;
1558
+ private _assets;
1559
+ private _meshesWithHoles;
1560
+ constructor(components: Components);
1561
+ dispose(): void;
1562
+ streamFromBuffer(data: Uint8Array): Promise<void>;
1563
+ streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1564
+ private readIfcFile;
1565
+ private streamIfcFile;
1566
+ private streamAllGeometries;
1567
+ private cleanUp;
1568
+ private getMesh;
1569
+ private getGeometry;
1570
+ private streamAssets;
1571
+ private streamGeometries;
1572
+ }
1573
+ export interface StreamedGeometries {
1574
+ [id: number]: {
1575
+ boundingBox: Float32Array;
1576
+ hasHoles: boolean;
1577
+ geometryFile?: string;
1578
+ };
1579
+ }
1580
+ export interface StreamedAsset {
1581
+ id: number;
1582
+ geometries: {
1583
+ geometryID: number;
1584
+ transformation: number[];
1585
+ color: number[];
1586
+ }[];
1564
1587
  }
1565
1588
  import * as THREE from "three";
1566
1589
  import { Hideable, Disposable, Event, World } from "../../Types";
@@ -1623,144 +1646,121 @@ export declare class SimplePlane implements Disposable, Hideable {
1623
1646
  private newHelper;
1624
1647
  private static newPlaneMesh;
1625
1648
  }
1626
- import * as WEBIFC from "web-ifc";
1627
- import { Components, Disposable, Event, Component } from "../../../core";
1628
- import { IfcStreamingSettings } from "./streaming-settings";
1629
- import { StreamedGeometries, StreamedAsset } from "./base-types";
1630
- export declare class FragmentIfcStreamConverter extends Component implements Disposable {
1631
- static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
1632
- onGeometryStreamed: Event<{
1633
- buffer: Uint8Array;
1634
- data: StreamedGeometries;
1635
- }>;
1636
- onAssetStreamed: Event<StreamedAsset[]>;
1637
- onProgress: Event<number>;
1638
- onIfcLoaded: Event<Uint8Array>;
1639
- /** {@link Disposable.onDisposed} */
1640
- readonly onDisposed: Event<unknown>;
1641
- settings: IfcStreamingSettings;
1642
- enabled: boolean;
1643
- webIfc: WEBIFC.IfcAPI;
1644
- private _spatialTree;
1645
- private _metaData;
1646
- private _visitedGeometries;
1647
- private _streamSerializer;
1648
- private _geometries;
1649
- private _geometryCount;
1650
- private _civil;
1651
- private _groupSerializer;
1652
- private _assets;
1653
- private _meshesWithHoles;
1654
- constructor(components: Components);
1655
- dispose(): void;
1656
- streamFromBuffer(data: Uint8Array): Promise<void>;
1657
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1658
- private readIfcFile;
1659
- private streamIfcFile;
1660
- private streamAllGeometries;
1661
- private cleanUp;
1662
- private getMesh;
1663
- private getGeometry;
1664
- private streamAssets;
1665
- private streamGeometries;
1666
- }
1667
- import * as WEBIFC from "web-ifc";
1668
- import { Component, Disposable, Event } from "../../../core";
1669
- import { PropertiesStreamingSettings } from "./streaming-settings";
1670
- export declare class FragmentPropsStreamConverter extends Component implements Disposable {
1671
- static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
1672
- onPropertiesStreamed: Event<{
1673
- type: number;
1674
- data: {
1675
- [id: number]: any;
1676
- };
1677
- }>;
1678
- onProgress: Event<number>;
1679
- onIndicesStreamed: Event<number[][]>;
1680
- /** {@link Disposable.onDisposed} */
1681
- readonly onDisposed: Event<string>;
1649
+ import { NavigationMode } from "./types";
1650
+ /**
1651
+ * A {@link NavigationMode} that allows 3D navigation and panning
1652
+ * like in many 3D and CAD softwares.
1653
+ */
1654
+ export declare class OrbitMode implements NavigationMode {
1655
+ camera: any;
1656
+ /** {@link NavigationMode.enabled} */
1682
1657
  enabled: boolean;
1683
- settings: PropertiesStreamingSettings;
1684
- webIfc: WEBIFC.IfcAPI;
1685
- dispose(): Promise<void>;
1686
- streamFromBuffer(data: Uint8Array): Promise<void>;
1687
- streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
1688
- private readIfcFile;
1689
- private streamIfcFile;
1690
- private streamAllProperties;
1691
- private getIndices;
1692
- private cleanUp;
1658
+ /** {@link NavigationMode.id} */
1659
+ readonly id = "Orbit";
1660
+ constructor(camera: any);
1661
+ /** {@link NavigationMode.set} */
1662
+ set(active: boolean): void;
1663
+ private activateOrbitControls;
1693
1664
  }
1694
- import * as WEBIFC from "web-ifc";
1695
- /** Configuration of the IFC-fragment conversion. */
1696
- export declare class IfcFragmentSettings {
1697
- /** Whether to extract the IFC properties into a JSON. */
1698
- includeProperties: boolean;
1665
+ import * as THREE from "three";
1666
+ import { CameraProjection } from "./types";
1667
+ import { Event } from "../../../core";
1668
+ import { OrthoPerspectiveCamera } from "../index";
1669
+ /**
1670
+ * Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1671
+ */
1672
+ export declare class ProjectionManager {
1699
1673
  /**
1700
- * Generate the geometry for categories that are not included by default,
1701
- * like IFCSPACE.
1674
+ * Event that fires when the {@link CameraProjection} changes.
1702
1675
  */
1703
- optionalCategories: number[];
1704
- /** Whether to use the coordination data coming from the IFC files. */
1705
- coordinate: boolean;
1706
- /** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1707
- wasm: {
1708
- path: string;
1709
- absolute: boolean;
1710
- logLevel?: WEBIFC.LogLevel;
1711
- };
1712
- /** List of categories that won't be converted to fragments. */
1713
- excludedCategories: Set<number>;
1714
- /** Whether to save the absolute location of all IFC items. */
1715
- saveLocations: boolean;
1716
- /** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
1717
- webIfc: WEBIFC.LoaderSettings;
1718
- autoSetWasm: boolean;
1719
- customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
1720
- }
1721
- import * as THREE from "three";
1722
- import * as WEBIFC from "web-ifc";
1723
- import * as FRAGS from "bim-fragment";
1724
- export declare class CivilReader {
1725
- defLineMat: THREE.LineBasicMaterial;
1726
- read(webIfc: WEBIFC.IfcAPI): {
1727
- alignments: Map<number, FRAGS.Alignment>;
1728
- coordinationMatrix: THREE.Matrix4;
1729
- } | undefined;
1730
- get(civilItems: any): {
1731
- alignments: Map<number, FRAGS.Alignment>;
1732
- coordinationMatrix: THREE.Matrix4;
1733
- } | undefined;
1734
- private getCurves;
1735
- }
1736
- import * as WEBIFC from "web-ifc";
1737
- export declare class IfcMetadataReader {
1738
- get(webIfc: WEBIFC.IfcAPI, type: number): string;
1676
+ readonly onChanged: Event<THREE.Camera>;
1677
+ current: CameraProjection;
1678
+ camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
1679
+ private _component;
1680
+ private _previousDistance;
1681
+ /** Match Ortho zoom with Perspective distance when changing projection mode */
1682
+ matchOrthoDistanceEnabled: boolean;
1683
+ constructor(camera: OrthoPerspectiveCamera);
1684
+ /**
1685
+ * Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
1686
+ *
1687
+ * @param projection - the new projection to set. If it is the current projection,
1688
+ * it will have no effect.
1689
+ */
1690
+ set(projection: CameraProjection): Promise<void>;
1691
+ /**
1692
+ * Changes the current {@link CameraProjection} from Ortographic to Perspective
1693
+ * and vice versa.
1694
+ */
1695
+ toggle(): Promise<void>;
1696
+ private setOrthoCamera;
1697
+ private getDims;
1698
+ private setupOrthoCamera;
1699
+ private getDistance;
1700
+ private setPerspectiveCamera;
1739
1701
  }
1740
- import * as WEBIFC from "web-ifc";
1741
- import * as THREE from "three";
1742
- export declare class Units {
1743
- factor: number;
1744
- complement: number;
1745
- apply(matrix: THREE.Matrix4): void;
1746
- setUp(webIfc: WEBIFC.IfcAPI): void;
1747
- private getLengthUnits;
1748
- private getScaleMatrix;
1702
+ import { NavigationMode } from "./types";
1703
+ /**
1704
+ * A {@link NavigationMode} that allows to navigate floorplans in 2D,
1705
+ * like many BIM tools.
1706
+ */
1707
+ export declare class PlanMode implements NavigationMode {
1708
+ private camera;
1709
+ /** {@link NavigationMode.enabled} */
1710
+ enabled: boolean;
1711
+ /** {@link NavigationMode.id} */
1712
+ readonly id = "Plan";
1713
+ private mouseAction1?;
1714
+ private mouseAction2?;
1715
+ private mouseInitialized;
1716
+ private readonly defaultAzimuthSpeed;
1717
+ private readonly defaultPolarSpeed;
1718
+ constructor(camera: any);
1719
+ /** {@link NavigationMode.set} */
1720
+ set(active: boolean): void;
1749
1721
  }
1750
- export interface StreamedGeometries {
1751
- [id: number]: {
1752
- boundingBox: Float32Array;
1753
- hasHoles: boolean;
1754
- geometryFile?: string;
1755
- };
1722
+ /**
1723
+ * The projection system of the camera.
1724
+ */
1725
+ export type CameraProjection = "Perspective" | "Orthographic";
1726
+ /**
1727
+ * The extensible list of supported navigation modes.
1728
+ */
1729
+ export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
1730
+ /**
1731
+ * An object that determines the behavior of the camera controls
1732
+ * and the user input (e.g. 2D floor plan mode, first person mode, etc).
1733
+ */
1734
+ export interface NavigationMode {
1735
+ /** The unique ID of this navigation mode. */
1736
+ id: NavModeID;
1737
+ /**
1738
+ * Enable or disable this navigation mode.
1739
+ * When a new navigation mode is enabled, the previous navigation mode
1740
+ * must be disabled.
1741
+ *
1742
+ * @param active - whether to enable or disable this mode.
1743
+ * @param options - any additional data required to enable or disable it.
1744
+ * */
1745
+ set: (active: boolean, options?: any) => void;
1746
+ /** Whether this navigation mode is active or not. */
1747
+ enabled: boolean;
1756
1748
  }
1757
- export interface StreamedAsset {
1758
- id: number;
1759
- geometries: {
1760
- geometryID: number;
1761
- transformation: number[];
1762
- color: number[];
1763
- }[];
1749
+ import { NavigationMode } from "./types";
1750
+ /**
1751
+ * A {@link NavigationMode} that allows first person navigation,
1752
+ * simulating FPS video games.
1753
+ */
1754
+ export declare class FirstPersonMode implements NavigationMode {
1755
+ private camera;
1756
+ /** {@link NavigationMode.enabled} */
1757
+ enabled: boolean;
1758
+ /** {@link NavigationMode.id} */
1759
+ readonly id = "FirstPerson";
1760
+ constructor(camera: any);
1761
+ /** {@link NavigationMode.set} */
1762
+ set(active: boolean): void;
1763
+ private setupFirstPersonCamera;
1764
1764
  }
1765
1765
  import { BufferGeometry } from "three";
1766
1766
  import * as THREE from "three";