@thatopen/components 1.5.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Clipper/index.d.ts +104 -0
- package/dist/core/Clipper/src/index.d.ts +1 -0
- package/dist/core/Clipper/src/simple-plane.d.ts +61 -0
- package/dist/core/Components/index.d.ts +52 -0
- package/dist/core/Cullers/index.d.ts +23 -0
- package/dist/core/Cullers/src/culler-renderer.d.ts +66 -0
- package/dist/core/Cullers/src/index.d.ts +3 -0
- package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +27 -0
- package/dist/core/Cullers/src/screen-culler-helper.d.ts +1 -0
- package/dist/core/Disposer/index.d.ts +43 -0
- package/dist/core/Grids/index.d.ts +13 -0
- package/dist/core/Grids/src/index.d.ts +1 -0
- package/dist/core/Grids/src/simple-grid.d.ts +48 -0
- package/dist/core/Materials/index.d.ts +61 -0
- package/dist/core/Raycasters/index.d.ts +13 -0
- package/dist/core/Raycasters/src/index.d.ts +2 -0
- package/dist/core/Raycasters/src/mouse.d.ts +26 -0
- package/dist/core/Raycasters/src/simple-raycaster.d.ts +36 -0
- package/dist/core/Types/index.d.ts +1 -0
- package/dist/core/Types/src/base-camera.d.ts +11 -0
- package/dist/core/Types/src/base-renderer.d.ts +40 -0
- package/dist/core/Types/src/base-scene.d.ts +13 -0
- package/dist/core/Types/src/base-world-item.d.ts +17 -0
- package/dist/core/Types/src/base.d.ts +19 -0
- package/dist/core/Types/src/component.d.ts +18 -0
- package/dist/core/Types/src/event.d.ts +34 -0
- package/dist/core/Types/src/index.d.ts +9 -0
- package/dist/core/Types/src/interfaces.d.ts +134 -0
- package/dist/core/Types/src/world.d.ts +12 -0
- package/dist/core/Worlds/index.d.ts +17 -0
- package/dist/core/Worlds/src/index.d.ts +4 -0
- package/dist/core/Worlds/src/simple-camera.d.ts +46 -0
- package/dist/core/Worlds/src/simple-renderer.d.ts +32 -0
- package/dist/core/Worlds/src/simple-scene.d.ts +30 -0
- package/dist/core/Worlds/src/simple-world.d.ts +26 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/fragments/FragmentBoundingBox/index.d.ts +36 -0
- package/dist/fragments/FragmentClassifier/index.d.ts +30 -0
- package/dist/fragments/FragmentExploder/index.d.ts +15 -0
- package/dist/fragments/FragmentIfcLoader/index.d.ts +33 -0
- package/dist/fragments/FragmentIfcLoader/src/civil-reader.d.ts +15 -0
- package/dist/fragments/FragmentIfcLoader/src/ifc-fragment-settings.d.ts +27 -0
- package/dist/fragments/FragmentIfcLoader/src/ifc-metadata-reader.d.ts +4 -0
- package/dist/fragments/FragmentIfcLoader/src/index.d.ts +3 -0
- package/dist/fragments/FragmentIfcLoader/src/spatial-structure.d.ts +8 -0
- package/dist/fragments/FragmentIfcLoader/src/transform-helper.d.ts +5 -0
- package/dist/fragments/FragmentIfcLoader/src/units.d.ts +10 -0
- package/dist/fragments/FragmentIfcStreamer/index.d.ts +1 -0
- package/dist/fragments/FragmentIfcStreamer/src/base-types.d.ts +15 -0
- package/dist/fragments/FragmentIfcStreamer/src/fragment-ifc-stream-converter.d.ts +41 -0
- package/dist/fragments/FragmentIfcStreamer/src/fragment-props-stream-converter.d.ts +27 -0
- package/dist/fragments/FragmentIfcStreamer/src/index.d.ts +4 -0
- package/dist/fragments/FragmentIfcStreamer/src/streaming-settings.d.ts +10 -0
- package/dist/fragments/FragmentManager/index.d.ts +44 -0
- package/dist/fragments/index.d.ts +5 -0
- package/dist/ifc/IfcJsonExporter/index.d.ts +16 -0
- package/dist/ifc/IfcJsonExporter/src/ifc-geometry-types.d.ts +1 -0
- package/dist/ifc/IfcPropertiesFinder/index.d.ts +37 -0
- package/dist/ifc/IfcPropertiesFinder/src/types.d.ts +23 -0
- package/dist/ifc/IfcPropertiesIndexer/index.d.ts +31 -0
- package/dist/ifc/IfcPropertiesManager/index.d.ts +73 -0
- package/dist/ifc/Utils/ifc-categories.d.ts +7 -0
- package/dist/ifc/Utils/ifc-category-map.d.ts +3 -0
- package/dist/ifc/Utils/ifc-elements-map.d.ts +3 -0
- package/dist/ifc/Utils/index.d.ts +4 -0
- package/dist/ifc/Utils/properties-utils.d.ts +25 -0
- package/dist/ifc/index.d.ts +5 -0
- package/dist/index.cjs +88 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +9024 -0
- package/dist/namespace.d.ts +1744 -0
- package/dist/navigation/OrthoPerspectiveCamera/index.d.ts +49 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/first-person-mode.d.ts +16 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/index.d.ts +5 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/orbit-mode.d.ts +16 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/plan-mode.d.ts +20 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/projections.d.ts +37 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/types.d.ts +27 -0
- package/dist/navigation/index.d.ts +1 -0
- package/dist/utils/bbox.d.ts +7 -0
- package/dist/utils/geometry.d.ts +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/materials.d.ts +4 -0
- package/dist/utils/uuid.d.ts +6 -0
- package/package.json +10 -5
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { Disposable } from "./interfaces";
|
|
3
|
+
import { Event } from "./event";
|
|
4
|
+
import { Components } from "../../Components";
|
|
5
|
+
import { BaseWorldItem } from "./base-world-item";
|
|
6
|
+
export declare abstract class BaseScene extends BaseWorldItem implements Disposable {
|
|
7
|
+
/** {@link Disposable.onDisposed} */
|
|
8
|
+
readonly onDisposed: Event<unknown>;
|
|
9
|
+
abstract three: THREE.Object3D;
|
|
10
|
+
protected constructor(components: Components);
|
|
11
|
+
/** {@link Disposable.dispose} */
|
|
12
|
+
dispose(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
import { World } from "./world";
|
|
3
|
+
import { Event } from "./event";
|
|
4
|
+
import { Components } from "../../Components";
|
|
5
|
+
/**
|
|
6
|
+
* One of the elements that make a world. It can be either a scene, a camera
|
|
7
|
+
* or a renderer.
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class BaseWorldItem extends Base {
|
|
10
|
+
readonly worlds: Map<string, World>;
|
|
11
|
+
readonly onWorldChanged: Event<{
|
|
12
|
+
world: World;
|
|
13
|
+
action: "added" | "removed";
|
|
14
|
+
}>;
|
|
15
|
+
currentWorld: World | null;
|
|
16
|
+
protected constructor(components: Components);
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Disposable, Hideable, Resizeable, Updateable, Configurable } from "./interfaces";
|
|
2
|
+
import { Components } from "../../Components";
|
|
3
|
+
/**
|
|
4
|
+
* Base class of the library. Useful for finding out the interfaces it implements.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class Base {
|
|
7
|
+
components: Components;
|
|
8
|
+
constructor(components: Components);
|
|
9
|
+
/** Whether is component is {@link Disposable}. */
|
|
10
|
+
isDisposeable: () => this is Disposable;
|
|
11
|
+
/** Whether is component is {@link Resizeable}. */
|
|
12
|
+
isResizeable: () => this is Resizeable;
|
|
13
|
+
/** Whether is component is {@link Updateable}. */
|
|
14
|
+
isUpdateable: () => this is Updateable;
|
|
15
|
+
/** Whether is component is {@link Hideable}. */
|
|
16
|
+
isHideable: () => this is Hideable;
|
|
17
|
+
/** Whether is component is {@link Configurable}. */
|
|
18
|
+
isConfigurable: () => this is Configurable<any>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Base } from "./base";
|
|
2
|
+
/**
|
|
3
|
+
* Components are the building blocks of this library. Components are singleton
|
|
4
|
+
* elements that contain specific functionality. For instance, the SimpleClipper
|
|
5
|
+
* Component can create, delete and handle 3D clipping planes. Components must be
|
|
6
|
+
* unique (they can't be instanced more than once), and have a static UUID that
|
|
7
|
+
* identifies them uniquely. The can be accessed globally using the {@link Components}
|
|
8
|
+
* instance.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class Component extends Base {
|
|
11
|
+
/**
|
|
12
|
+
* Whether this component is active or not. The behaviour can vary depending
|
|
13
|
+
* on the type of component. E.g. a disabled dimension tool will stop creating
|
|
14
|
+
* dimensions, while a disabled camera will stop moving. A disabled component
|
|
15
|
+
* will not be updated automatically each frame.
|
|
16
|
+
*/
|
|
17
|
+
abstract enabled: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple event handler by
|
|
3
|
+
* [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540).
|
|
4
|
+
* Keep in mind that:
|
|
5
|
+
* - If you want to remove it later, you might want to declare the callback as
|
|
6
|
+
* an object.
|
|
7
|
+
* - If you want to maintain the reference to `this`, you will need to declare
|
|
8
|
+
* the callback as an arrow function.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Event<T> {
|
|
11
|
+
/**
|
|
12
|
+
* Add a callback to this event instance.
|
|
13
|
+
* @param handler - the callback to be added to this event.
|
|
14
|
+
*/
|
|
15
|
+
add(handler: T extends void ? {
|
|
16
|
+
(): void;
|
|
17
|
+
} : {
|
|
18
|
+
(data: T): void;
|
|
19
|
+
}): void;
|
|
20
|
+
/**
|
|
21
|
+
* Removes a callback from this event instance.
|
|
22
|
+
* @param handler - the callback to be removed from this event.
|
|
23
|
+
*/
|
|
24
|
+
remove(handler: T extends void ? {
|
|
25
|
+
(): void;
|
|
26
|
+
} : {
|
|
27
|
+
(data: T): void;
|
|
28
|
+
}): void;
|
|
29
|
+
/** Triggers all the callbacks assigned to this event. */
|
|
30
|
+
trigger: (data?: T) => void;
|
|
31
|
+
/** Gets rid of all the suscribed events. */
|
|
32
|
+
reset(): void;
|
|
33
|
+
private handlers;
|
|
34
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./event";
|
|
2
|
+
export * from "./interfaces";
|
|
3
|
+
export * from "./component";
|
|
4
|
+
export * from "./base";
|
|
5
|
+
export * from "./base-world-item";
|
|
6
|
+
export * from "./base-camera";
|
|
7
|
+
export * from "./base-renderer";
|
|
8
|
+
export * from "./base-scene";
|
|
9
|
+
export * from "./world";
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import CameraControls from "camera-controls";
|
|
3
|
+
import { Event } from "./event";
|
|
4
|
+
/**
|
|
5
|
+
* Whether this component has to be manually destroyed once you are done with
|
|
6
|
+
* it to prevent
|
|
7
|
+
* [memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
8
|
+
* This also ensures that the DOM events created by that component will be
|
|
9
|
+
* cleaned up.
|
|
10
|
+
*/
|
|
11
|
+
export interface Disposable {
|
|
12
|
+
/**
|
|
13
|
+
* Destroys the object from memory to prevent a
|
|
14
|
+
* [memory leak](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
15
|
+
*/
|
|
16
|
+
dispose: () => void | Promise<void>;
|
|
17
|
+
/** Fired after the tool has been {@link Disposable.dispose()} */
|
|
18
|
+
readonly onDisposed: Event<any>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Whether the geometric representation of this component can be
|
|
22
|
+
* hidden or shown in the
|
|
23
|
+
* [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
24
|
+
*/
|
|
25
|
+
export interface Hideable {
|
|
26
|
+
/**
|
|
27
|
+
* Whether the geometric representation of this component is
|
|
28
|
+
* currently visible or not in the
|
|
29
|
+
* [Three.js scene](https://threejs.org/docs/#api/en/scenes/Scene).
|
|
30
|
+
*/
|
|
31
|
+
visible: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Whether this component can be resized. The meaning of this can vary depending
|
|
35
|
+
* on the component: resizing a
|
|
36
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
37
|
+
* component could mean changing its resolution, whereas resizing a
|
|
38
|
+
* [Mesh](https://threejs.org/docs/#api/en/objects/Mesh) would change its scale.
|
|
39
|
+
*/
|
|
40
|
+
export interface Resizeable {
|
|
41
|
+
/**
|
|
42
|
+
* Sets size of this component (e.g. the resolution of a
|
|
43
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
44
|
+
* component.
|
|
45
|
+
*/
|
|
46
|
+
resize: (size?: THREE.Vector2) => void;
|
|
47
|
+
/** Event that fires when the component has been resized. */
|
|
48
|
+
onResize: Event<THREE.Vector2>;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the current size of this component (e.g. the resolution of a
|
|
51
|
+
* [Renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer)
|
|
52
|
+
* component.
|
|
53
|
+
*/
|
|
54
|
+
getSize: () => THREE.Vector2;
|
|
55
|
+
}
|
|
56
|
+
/** Whether this component should be updated each frame. */
|
|
57
|
+
export interface Updateable {
|
|
58
|
+
/** Actions that should be executed after updating the component. */
|
|
59
|
+
onAfterUpdate: Event<any>;
|
|
60
|
+
/** Actions that should be executed before updating the component. */
|
|
61
|
+
onBeforeUpdate: Event<any>;
|
|
62
|
+
/**
|
|
63
|
+
* Function used to update the state of this component each frame. For
|
|
64
|
+
* instance, a renderer component will make a render each frame.
|
|
65
|
+
*/
|
|
66
|
+
update(delta?: number): void | Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
/** Basic type to describe the progress of any kind of process. */
|
|
69
|
+
export interface Progress {
|
|
70
|
+
/** The amount of things that have been done already. */
|
|
71
|
+
current: number;
|
|
72
|
+
/** The total amount of things to be done by the process. */
|
|
73
|
+
total: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Whether this component supports create and destroy operations. This generally
|
|
77
|
+
* applies for components that work with instances, such as clipping planes or
|
|
78
|
+
* dimensions.
|
|
79
|
+
*/
|
|
80
|
+
export interface Createable {
|
|
81
|
+
readonly onBeforeCreate: Event<any>;
|
|
82
|
+
/** Creates a new instance of an element (e.g. a new Dimension). */
|
|
83
|
+
create: (data: any) => void;
|
|
84
|
+
/** Fired after successfully calling {@link Createable.create} */
|
|
85
|
+
readonly onAfterCreate: Event<any>;
|
|
86
|
+
/**
|
|
87
|
+
* Finish the creation process of the component, successfully creating an
|
|
88
|
+
* instance of whatever the component creates.
|
|
89
|
+
*/
|
|
90
|
+
endCreation: (data: any) => void;
|
|
91
|
+
/** Fired before calling {@link Createable.cancelCreation}. */
|
|
92
|
+
readonly onBeforeCancel: Event<any>;
|
|
93
|
+
/**
|
|
94
|
+
* Cancels the creation process of the component, going back to the state
|
|
95
|
+
* before starting to create.
|
|
96
|
+
*/
|
|
97
|
+
cancelCreation: (data: any) => void;
|
|
98
|
+
/** Fired after calling {@link Createable.cancelCreation}. */
|
|
99
|
+
readonly onAfterCancel: Event<any>;
|
|
100
|
+
/** Fired before calling {@link Createable.delete}. */
|
|
101
|
+
readonly onBeforeDelete: Event<any>;
|
|
102
|
+
/** Deletes an existing instance of an element (e.g. a Dimension). */
|
|
103
|
+
delete: (data: any) => void;
|
|
104
|
+
/** Fired after successfully calling {@link Createable.delete()} */
|
|
105
|
+
readonly onAfterDelete: Event<any>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Whether this component supports to be configured.
|
|
109
|
+
*/
|
|
110
|
+
export interface Configurable<T extends Record<string, any>> {
|
|
111
|
+
/** Wether this components has been already configured. */
|
|
112
|
+
isSetup: boolean;
|
|
113
|
+
/** Use the provided configuration to setup the tool. */
|
|
114
|
+
setup: (config?: Partial<T>) => void | Promise<void>;
|
|
115
|
+
/** Fired after successfully calling {@link Configurable.setup()} */
|
|
116
|
+
readonly onSetup: Event<any>;
|
|
117
|
+
/** Object holding the tool configuration. Is not meant to be edited directly, if you need
|
|
118
|
+
* to make changes to this object, use {@link Configurable.setup()} just after the tool is instantiated.
|
|
119
|
+
*/
|
|
120
|
+
config: Required<T>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* An interface to make [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) compatible with typescript.
|
|
124
|
+
*/
|
|
125
|
+
export interface BVHGeometry extends THREE.BufferGeometry {
|
|
126
|
+
boundsTree: Object | undefined;
|
|
127
|
+
disposeBoundsTree: () => void;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Whether a camera uses the Camera Controls library.
|
|
131
|
+
*/
|
|
132
|
+
export interface CameraControllable {
|
|
133
|
+
controls: CameraControls;
|
|
134
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { BaseScene } from "./base-scene";
|
|
3
|
+
import { BaseCamera } from "./base-camera";
|
|
4
|
+
import { BaseRenderer } from "./base-renderer";
|
|
5
|
+
import { Updateable, Disposable } from "./interfaces";
|
|
6
|
+
export interface World extends Disposable, Updateable {
|
|
7
|
+
meshes: Set<THREE.Mesh>;
|
|
8
|
+
scene: BaseScene;
|
|
9
|
+
camera: BaseCamera;
|
|
10
|
+
renderer: BaseRenderer | null;
|
|
11
|
+
uuid: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
2
|
+
import { Components } from "../Components";
|
|
3
|
+
import { SimpleWorld } from "./src";
|
|
4
|
+
export * from "./src";
|
|
5
|
+
export declare class Worlds extends Component implements Updateable, Disposable {
|
|
6
|
+
static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
|
|
7
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
8
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
9
|
+
readonly onDisposed: Event<unknown>;
|
|
10
|
+
list: Map<string, World>;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
constructor(components: Components);
|
|
13
|
+
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
14
|
+
delete(world: World): void;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
update(delta?: number): void | Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import CameraControls from "camera-controls";
|
|
3
|
+
import { Disposable, Updateable, Event, BaseCamera } from "../../Types";
|
|
4
|
+
import { Components } from "../../Components";
|
|
5
|
+
/**
|
|
6
|
+
* A basic camera that uses
|
|
7
|
+
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
|
|
8
|
+
* easily control the camera in 2D and 3D. Check out it's API to find out
|
|
9
|
+
* what features it offers.
|
|
10
|
+
*/
|
|
11
|
+
export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
|
|
12
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
13
|
+
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
14
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
15
|
+
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
16
|
+
readonly onAspectUpdated: Event<unknown>;
|
|
17
|
+
/** {@link Disposable.onDisposed} */
|
|
18
|
+
readonly onDisposed: Event<string>;
|
|
19
|
+
readonly three: THREE.PerspectiveCamera;
|
|
20
|
+
private _allControls;
|
|
21
|
+
/**
|
|
22
|
+
* The object that controls the camera. An instance of
|
|
23
|
+
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
24
|
+
* Transforming the camera directly will have no effect: you need to use this
|
|
25
|
+
* object to move, rotate, look at objects, etc.
|
|
26
|
+
*/
|
|
27
|
+
get controls(): CameraControls;
|
|
28
|
+
/** {@link Component.enabled} */
|
|
29
|
+
get enabled(): boolean;
|
|
30
|
+
/** {@link Component.enabled} */
|
|
31
|
+
set enabled(enabled: boolean);
|
|
32
|
+
constructor(components: Components);
|
|
33
|
+
/** {@link Disposable.dispose} */
|
|
34
|
+
dispose(): void;
|
|
35
|
+
/** {@link Updateable.update} */
|
|
36
|
+
update(_delta: number): void;
|
|
37
|
+
/**
|
|
38
|
+
* Updates the aspect of the camera to match the size of the
|
|
39
|
+
* {@link Components.renderer}.
|
|
40
|
+
*/
|
|
41
|
+
updateAspect: () => void;
|
|
42
|
+
private setupCamera;
|
|
43
|
+
private newCameraControls;
|
|
44
|
+
private setupEvents;
|
|
45
|
+
private static getSubsetOfThree;
|
|
46
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { BaseRenderer, Event } from "../../Types";
|
|
3
|
+
import { Components } from "../../Components";
|
|
4
|
+
/**
|
|
5
|
+
* A basic renderer capable of rendering
|
|
6
|
+
* ([Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
|
|
7
|
+
*/
|
|
8
|
+
export declare class SimpleRenderer extends BaseRenderer {
|
|
9
|
+
/** {@link Component.enabled} */
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
/** The HTML container of the THREE.js canvas where the scene is rendered. */
|
|
12
|
+
container: HTMLElement | null;
|
|
13
|
+
three: THREE.WebGLRenderer;
|
|
14
|
+
protected _canvas: HTMLCanvasElement;
|
|
15
|
+
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
16
|
+
protected onContainerUpdated: Event<HTMLElement>;
|
|
17
|
+
constructor(components: Components, container?: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
|
|
18
|
+
/** {@link Updateable.update} */
|
|
19
|
+
update(): void;
|
|
20
|
+
/** {@link Disposable.dispose} */
|
|
21
|
+
dispose(): void;
|
|
22
|
+
/** {@link Resizeable.getSize}. */
|
|
23
|
+
getSize(): THREE.Vector2;
|
|
24
|
+
/** {@link Resizeable.resize} */
|
|
25
|
+
resize: (size?: THREE.Vector2) => void;
|
|
26
|
+
setupEvents(active: boolean): void;
|
|
27
|
+
private resizeEvent;
|
|
28
|
+
private setupRenderer;
|
|
29
|
+
private onContextLost;
|
|
30
|
+
private onContextBack;
|
|
31
|
+
private updateContainer;
|
|
32
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { BaseScene, Configurable, Event } from "../../Types";
|
|
3
|
+
import { Components } from "../../Components";
|
|
4
|
+
export interface SimpleSceneConfig {
|
|
5
|
+
directionalLight: {
|
|
6
|
+
color: THREE.Color;
|
|
7
|
+
intensity: number;
|
|
8
|
+
position: THREE.Vector3;
|
|
9
|
+
};
|
|
10
|
+
ambientLight: {
|
|
11
|
+
color: THREE.Color;
|
|
12
|
+
intensity: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add
|
|
17
|
+
* objects hierarchically, and easily dispose them when you are finished with it.
|
|
18
|
+
* @noInheritDoc
|
|
19
|
+
*/
|
|
20
|
+
export declare class SimpleScene extends BaseScene implements Configurable<{}> {
|
|
21
|
+
/** {@link Configurable.isSetup} */
|
|
22
|
+
isSetup: boolean;
|
|
23
|
+
three: THREE.Scene;
|
|
24
|
+
/** {@link Configurable.onSetup} */
|
|
25
|
+
readonly onSetup: Event<SimpleScene>;
|
|
26
|
+
config: Required<SimpleSceneConfig>;
|
|
27
|
+
constructor(components: Components);
|
|
28
|
+
/** Creates a simple and nice default set up for the scene (e.g. lighting). */
|
|
29
|
+
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer } from "../../Types";
|
|
3
|
+
import { Components } from "../../Components";
|
|
4
|
+
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World {
|
|
5
|
+
/**
|
|
6
|
+
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh).
|
|
7
|
+
*/
|
|
8
|
+
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
9
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
10
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
uuid: string;
|
|
13
|
+
readonly onDisposed: Event<unknown>;
|
|
14
|
+
private _scene?;
|
|
15
|
+
private _camera?;
|
|
16
|
+
private _renderer;
|
|
17
|
+
get scene(): T;
|
|
18
|
+
set scene(scene: T);
|
|
19
|
+
get camera(): U;
|
|
20
|
+
set camera(camera: U);
|
|
21
|
+
get renderer(): S | null;
|
|
22
|
+
set renderer(renderer: S | null);
|
|
23
|
+
constructor(components: Components);
|
|
24
|
+
update(delta?: number): void;
|
|
25
|
+
dispose(disposeResources?: boolean): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import * as FRAGS from "bim-fragment";
|
|
3
|
+
import { FragmentsGroup } from "bim-fragment";
|
|
4
|
+
import { Component, Components, Disposable, Event } from "../../core";
|
|
5
|
+
/**
|
|
6
|
+
* A simple implementation of bounding box that works for fragments. The resulting bbox is not 100% precise, but
|
|
7
|
+
* it's fast, and should suffice for general use cases such as camera zooming or general boundary determination.
|
|
8
|
+
*/
|
|
9
|
+
export declare class FragmentBoundingBox extends Component implements Disposable {
|
|
10
|
+
static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
|
|
11
|
+
/** {@link Component.enabled} */
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
/** {@link Disposable.onDisposed} */
|
|
14
|
+
readonly onDisposed: Event<unknown>;
|
|
15
|
+
private _absoluteMin;
|
|
16
|
+
private _absoluteMax;
|
|
17
|
+
private _meshes;
|
|
18
|
+
constructor(components: Components);
|
|
19
|
+
static getDimensions(bbox: THREE.Box3): {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
depth: number;
|
|
23
|
+
center: THREE.Vector3;
|
|
24
|
+
};
|
|
25
|
+
static newBound(positive: boolean): THREE.Vector3;
|
|
26
|
+
static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
|
|
27
|
+
/** {@link Disposable.dispose} */
|
|
28
|
+
dispose(): void;
|
|
29
|
+
get(): THREE.Box3;
|
|
30
|
+
getSphere(): THREE.Sphere;
|
|
31
|
+
getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
32
|
+
reset(): void;
|
|
33
|
+
add(group: FragmentsGroup): void;
|
|
34
|
+
addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh): void;
|
|
35
|
+
private static getFragmentBounds;
|
|
36
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as FRAGS from "bim-fragment";
|
|
2
|
+
import { Disposable, Component, Event, Components } from "../../core";
|
|
3
|
+
export interface Classification {
|
|
4
|
+
[system: string]: {
|
|
5
|
+
[className: string]: FRAGS.FragmentIdMap;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export declare class FragmentClassifier extends Component implements Disposable {
|
|
9
|
+
static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
|
|
10
|
+
/** {@link Component.enabled} */
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
private _groupSystems;
|
|
13
|
+
/** {@link Disposable.onDisposed} */
|
|
14
|
+
readonly onDisposed: Event<unknown>;
|
|
15
|
+
constructor(components: Components);
|
|
16
|
+
private onFragmentsDisposed;
|
|
17
|
+
/** {@link Component.get} */
|
|
18
|
+
get(): Classification;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
remove(guid: string): void;
|
|
21
|
+
find(filter?: {
|
|
22
|
+
[name: string]: string[];
|
|
23
|
+
}): FRAGS.FragmentIdMap;
|
|
24
|
+
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
25
|
+
byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
|
|
26
|
+
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
27
|
+
byStorey(group: FRAGS.FragmentsGroup): void;
|
|
28
|
+
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
29
|
+
private saveItem;
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
2
|
+
export declare class FragmentExploder extends Component implements Disposable {
|
|
3
|
+
static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
height: number;
|
|
6
|
+
groupName: string;
|
|
7
|
+
/** {@link Disposable.onDisposed} */
|
|
8
|
+
readonly onDisposed: Event<string>;
|
|
9
|
+
list: Set<string>;
|
|
10
|
+
constructor(components: Components);
|
|
11
|
+
dispose(): void;
|
|
12
|
+
explode(): void;
|
|
13
|
+
reset(): void;
|
|
14
|
+
update(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as WEBIFC from "web-ifc";
|
|
2
|
+
import * as FRAGS from "bim-fragment";
|
|
3
|
+
import { IfcFragmentSettings } from "./src";
|
|
4
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
5
|
+
export declare class FragmentIfcLoader extends Component implements Disposable {
|
|
6
|
+
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
7
|
+
readonly onIfcLoaded: Event<FRAGS.FragmentsGroup>;
|
|
8
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
9
|
+
readonly onSetup: Event<void>;
|
|
10
|
+
/** {@link Disposable.onDisposed} */
|
|
11
|
+
readonly onDisposed: Event<string>;
|
|
12
|
+
settings: IfcFragmentSettings;
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
webIfc: WEBIFC.IfcAPI;
|
|
15
|
+
private _material;
|
|
16
|
+
private _spatialTree;
|
|
17
|
+
private _metaData;
|
|
18
|
+
private _fragmentInstances;
|
|
19
|
+
private _civil;
|
|
20
|
+
private _propertyExporter;
|
|
21
|
+
private _visitedFragments;
|
|
22
|
+
private _materialT;
|
|
23
|
+
constructor(components: Components);
|
|
24
|
+
dispose(): void;
|
|
25
|
+
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
26
|
+
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
27
|
+
readIfcFile(data: Uint8Array): Promise<number>;
|
|
28
|
+
private getAllGeometries;
|
|
29
|
+
cleanUp(): void;
|
|
30
|
+
private getMesh;
|
|
31
|
+
private getGeometry;
|
|
32
|
+
private autoSetWasm;
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import * as WEBIFC from "web-ifc";
|
|
3
|
+
import * as FRAGS from "bim-fragment";
|
|
4
|
+
export declare class CivilReader {
|
|
5
|
+
defLineMat: THREE.LineBasicMaterial;
|
|
6
|
+
read(webIfc: WEBIFC.IfcAPI): {
|
|
7
|
+
alignments: Map<number, FRAGS.Alignment>;
|
|
8
|
+
coordinationMatrix: THREE.Matrix4;
|
|
9
|
+
} | undefined;
|
|
10
|
+
get(civilItems: any): {
|
|
11
|
+
alignments: Map<number, FRAGS.Alignment>;
|
|
12
|
+
coordinationMatrix: THREE.Matrix4;
|
|
13
|
+
} | undefined;
|
|
14
|
+
private getCurves;
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as WEBIFC from "web-ifc";
|
|
2
|
+
/** Configuration of the IFC-fragment conversion. */
|
|
3
|
+
export declare class IfcFragmentSettings {
|
|
4
|
+
/** Whether to extract the IFC properties into a JSON. */
|
|
5
|
+
includeProperties: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Generate the geometry for categories that are not included by default,
|
|
8
|
+
* like IFCSPACE.
|
|
9
|
+
*/
|
|
10
|
+
optionalCategories: number[];
|
|
11
|
+
/** Whether to use the coordination data coming from the IFC files. */
|
|
12
|
+
coordinate: boolean;
|
|
13
|
+
/** Path of the WASM for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
14
|
+
wasm: {
|
|
15
|
+
path: string;
|
|
16
|
+
absolute: boolean;
|
|
17
|
+
logLevel?: WEBIFC.LogLevel;
|
|
18
|
+
};
|
|
19
|
+
/** List of categories that won't be converted to fragments. */
|
|
20
|
+
excludedCategories: Set<number>;
|
|
21
|
+
/** Whether to save the absolute location of all IFC items. */
|
|
22
|
+
saveLocations: boolean;
|
|
23
|
+
/** Loader settings for [web-ifc](https://github.com/ThatOpen/engine_web-ifc). */
|
|
24
|
+
webIfc: WEBIFC.LoaderSettings;
|
|
25
|
+
autoSetWasm: boolean;
|
|
26
|
+
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as WEBIFC from "web-ifc";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
export declare class Units {
|
|
4
|
+
factor: number;
|
|
5
|
+
complement: number;
|
|
6
|
+
apply(matrix: THREE.Matrix4): void;
|
|
7
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
8
|
+
private getLengthUnits;
|
|
9
|
+
private getScaleMatrix;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface StreamedGeometries {
|
|
2
|
+
[id: number]: {
|
|
3
|
+
boundingBox: Float32Array;
|
|
4
|
+
hasHoles: boolean;
|
|
5
|
+
geometryFile?: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface StreamedAsset {
|
|
9
|
+
id: number;
|
|
10
|
+
geometries: {
|
|
11
|
+
geometryID: number;
|
|
12
|
+
transformation: number[];
|
|
13
|
+
color: number[];
|
|
14
|
+
}[];
|
|
15
|
+
}
|