@thatopen/components 2.4.11 → 3.1.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/index.cjs +18440 -25937
- package/dist/index.d.ts +4530 -6
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.mjs +3 -3
- package/dist/index.mjs +18442 -25939
- package/package.json +8 -10
- package/dist/core/Clipper/index.d.ts +0 -142
- package/dist/core/Clipper/src/clipper-config.d.ts +0 -33
- package/dist/core/Clipper/src/index.d.ts +0 -1
- package/dist/core/Clipper/src/simple-plane.d.ts +0 -99
- package/dist/core/Components/index.d.ts +0 -93
- package/dist/core/ConfigManager/index.d.ts +0 -21
- package/dist/core/ConfigManager/src/configurator.d.ts +0 -13
- package/dist/core/ConfigManager/src/index.d.ts +0 -1
- package/dist/core/Cullers/index.d.ts +0 -56
- package/dist/core/Cullers/src/culler-renderer-config.d.ts +0 -74
- package/dist/core/Cullers/src/culler-renderer.d.ts +0 -76
- package/dist/core/Cullers/src/index.d.ts +0 -3
- package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +0 -59
- package/dist/core/Cullers/src/screen-culler-helper.d.ts +0 -1
- package/dist/core/Disposer/index.d.ts +0 -45
- package/dist/core/Grids/index.d.ts +0 -46
- package/dist/core/Grids/src/index.d.ts +0 -2
- package/dist/core/Grids/src/simple-grid-config.d.ts +0 -80
- package/dist/core/Grids/src/simple-grid.d.ts +0 -48
- package/dist/core/MiniMap/index.d.ts +0 -50
- package/dist/core/MiniMap/src/index.d.ts +0 -2
- package/dist/core/MiniMap/src/mini-map-config.d.ts +0 -112
- package/dist/core/MiniMap/src/mini-map.d.ts +0 -100
- package/dist/core/OrthoPerspectiveCamera/index.d.ts +0 -65
- package/dist/core/OrthoPerspectiveCamera/src/first-person-mode.d.ts +0 -16
- package/dist/core/OrthoPerspectiveCamera/src/index.d.ts +0 -5
- package/dist/core/OrthoPerspectiveCamera/src/orbit-mode.d.ts +0 -16
- package/dist/core/OrthoPerspectiveCamera/src/plan-mode.d.ts +0 -20
- package/dist/core/OrthoPerspectiveCamera/src/projections.d.ts +0 -45
- package/dist/core/OrthoPerspectiveCamera/src/types.d.ts +0 -26
- package/dist/core/Raycasters/index.d.ts +0 -43
- package/dist/core/Raycasters/src/index.d.ts +0 -2
- package/dist/core/Raycasters/src/mouse.d.ts +0 -24
- package/dist/core/Raycasters/src/simple-raycaster.d.ts +0 -54
- package/dist/core/ShadowedScene/index.d.ts +0 -57
- package/dist/core/ShadowedScene/src/distance-renderer.d.ts +0 -67
- package/dist/core/ShadowedScene/src/index.d.ts +0 -1
- package/dist/core/Types/index.d.ts +0 -1
- package/dist/core/Types/src/async-event.d.ts +0 -32
- package/dist/core/Types/src/base-camera.d.ts +0 -28
- package/dist/core/Types/src/base-renderer.d.ts +0 -65
- package/dist/core/Types/src/base-scene.d.ts +0 -25
- package/dist/core/Types/src/base-world-item.d.ts +0 -23
- package/dist/core/Types/src/base.d.ts +0 -19
- package/dist/core/Types/src/component-with-ui.d.ts +0 -18
- package/dist/core/Types/src/component.d.ts +0 -13
- package/dist/core/Types/src/config-types.d.ts +0 -47
- package/dist/core/Types/src/data-map.d.ts +0 -73
- package/dist/core/Types/src/data-set.d.ts +0 -58
- package/dist/core/Types/src/event-manager.d.ts +0 -30
- package/dist/core/Types/src/event.d.ts +0 -32
- package/dist/core/Types/src/index.d.ts +0 -15
- package/dist/core/Types/src/interfaces.d.ts +0 -117
- package/dist/core/Types/src/world.d.ts +0 -34
- package/dist/core/Viewpoints/index.d.ts +0 -38
- package/dist/core/Viewpoints/src/index.d.ts +0 -2
- package/dist/core/Viewpoints/src/types.d.ts +0 -36
- package/dist/core/Viewpoints/src/viewpoint.d.ts +0 -197
- package/dist/core/Viewpoints/src/viewpoints-config.d.ts +0 -23
- package/dist/core/Worlds/index.d.ts +0 -54
- package/dist/core/Worlds/src/index.d.ts +0 -5
- package/dist/core/Worlds/src/simple-camera.d.ts +0 -62
- package/dist/core/Worlds/src/simple-renderer.d.ts +0 -54
- package/dist/core/Worlds/src/simple-scene-config.d.ts +0 -59
- package/dist/core/Worlds/src/simple-scene.d.ts +0 -25
- package/dist/core/Worlds/src/simple-world.d.ts +0 -79
- package/dist/core/index.d.ts +0 -13
- package/dist/fragments/BoundingBoxer/index.d.ts +0 -208
- package/dist/fragments/Classifier/index.d.ts +0 -197
- package/dist/fragments/Exploder/index.d.ts +0 -50
- package/dist/fragments/FragmentsManager/index.d.ts +0 -152
- package/dist/fragments/Hider/index.d.ts +0 -38
- package/dist/fragments/IfcGeometryTiler/index.d.ts +0 -103
- package/dist/fragments/IfcGeometryTiler/src/base-types.d.ts +0 -29
- package/dist/fragments/IfcGeometryTiler/src/index.d.ts +0 -2
- package/dist/fragments/IfcGeometryTiler/src/streaming-settings.d.ts +0 -20
- package/dist/fragments/IfcLoader/index.d.ts +0 -116
- package/dist/fragments/IfcLoader/src/civil-reader.d.ts +0 -15
- package/dist/fragments/IfcLoader/src/ifc-fragment-settings.d.ts +0 -41
- package/dist/fragments/IfcLoader/src/ifc-metadata-reader.d.ts +0 -5
- package/dist/fragments/IfcLoader/src/index.d.ts +0 -5
- package/dist/fragments/IfcLoader/src/spatial-ids-finder.d.ts +0 -5
- package/dist/fragments/IfcLoader/src/spatial-structure.d.ts +0 -8
- package/dist/fragments/IfcLoader/src/transform-helper.d.ts +0 -5
- package/dist/fragments/IfcLoader/src/units.d.ts +0 -10
- package/dist/fragments/IfcPropertiesTiler/index.d.ts +0 -66
- package/dist/fragments/IfcPropertiesTiler/src/index.d.ts +0 -1
- package/dist/fragments/IfcPropertiesTiler/src/streaming-settings.d.ts +0 -11
- package/dist/fragments/index.d.ts +0 -8
- package/dist/ifc/IfcFinder/index.d.ts +0 -50
- package/dist/ifc/IfcFinder/src/ifc-basic-query.d.ts +0 -35
- package/dist/ifc/IfcFinder/src/ifc-finder-query.d.ts +0 -96
- package/dist/ifc/IfcFinder/src/ifc-property-query.d.ts +0 -36
- package/dist/ifc/IfcFinder/src/ifc-query-group.d.ts +0 -69
- package/dist/ifc/IfcFinder/src/index.d.ts +0 -4
- package/dist/ifc/IfcFinder/src/types.d.ts +0 -84
- package/dist/ifc/IfcIsolator/index.d.ts +0 -24
- package/dist/ifc/IfcJsonExporter/index.d.ts +0 -26
- package/dist/ifc/IfcJsonExporter/src/ifc-geometry-types.d.ts +0 -4
- package/dist/ifc/IfcJsonExporter/src/index.d.ts +0 -1
- package/dist/ifc/IfcPropertiesManager/index.d.ts +0 -289
- package/dist/ifc/IfcPropertiesManager/src/index.d.ts +0 -3
- package/dist/ifc/IfcPropertiesManager/src/rel-attrs.d.ts +0 -7
- package/dist/ifc/IfcPropertiesManager/src/rel-names.d.ts +0 -3
- package/dist/ifc/IfcPropertiesManager/src/types.d.ts +0 -18
- package/dist/ifc/IfcRelationsIndexer/index.d.ts +0 -195
- package/dist/ifc/IfcRelationsIndexer/src/index.d.ts +0 -2
- package/dist/ifc/IfcRelationsIndexer/src/newVersion.d.ts +0 -51
- package/dist/ifc/IfcRelationsIndexer/src/relToAttributesMap.d.ts +0 -5
- package/dist/ifc/IfcRelationsIndexer/src/types.d.ts +0 -73
- package/dist/ifc/Utils/ifc-categories.d.ts +0 -7
- package/dist/ifc/Utils/ifc-category-case.d.ts +0 -3
- package/dist/ifc/Utils/ifc-category-map.d.ts +0 -6
- package/dist/ifc/Utils/ifc-elements-map.d.ts +0 -11
- package/dist/ifc/Utils/index.d.ts +0 -5
- package/dist/ifc/Utils/properties-utils.d.ts +0 -25
- package/dist/ifc/index.d.ts +0 -6
- package/dist/measurement/MeasurementUtils/index.d.ts +0 -105
- package/dist/measurement/index.d.ts +0 -1
- package/dist/namespace.d.ts +0 -6018
- package/dist/openbim/BCFTopics/index.d.ts +0 -114
- package/dist/openbim/BCFTopics/src/Comment.d.ts +0 -40
- package/dist/openbim/BCFTopics/src/Topic.d.ts +0 -127
- package/dist/openbim/BCFTopics/src/bcf-topics-config.d.ts +0 -121
- package/dist/openbim/BCFTopics/src/importers/extensions.d.ts +0 -2
- package/dist/openbim/BCFTopics/src/importers/index.d.ts +0 -1
- package/dist/openbim/BCFTopics/src/index.d.ts +0 -5
- package/dist/openbim/BCFTopics/src/types.d.ts +0 -19
- package/dist/openbim/IDSSpecifications/index.d.ts +0 -60
- package/dist/openbim/IDSSpecifications/src/Specification.d.ts +0 -40
- package/dist/openbim/IDSSpecifications/src/exporters/parameter.d.ts +0 -2
- package/dist/openbim/IDSSpecifications/src/facets/Attribute.d.ts +0 -13
- package/dist/openbim/IDSSpecifications/src/facets/Classification.d.ts +0 -21
- package/dist/openbim/IDSSpecifications/src/facets/Entity.d.ts +0 -15
- package/dist/openbim/IDSSpecifications/src/facets/Facet.d.ts +0 -26
- package/dist/openbim/IDSSpecifications/src/facets/Material.d.ts +0 -10
- package/dist/openbim/IDSSpecifications/src/facets/PartOf.d.ts +0 -26
- package/dist/openbim/IDSSpecifications/src/facets/Property.d.ts +0 -25
- package/dist/openbim/IDSSpecifications/src/facets/index.d.ts +0 -5
- package/dist/openbim/IDSSpecifications/src/importers/attribute.d.ts +0 -3
- package/dist/openbim/IDSSpecifications/src/importers/classification.d.ts +0 -3
- package/dist/openbim/IDSSpecifications/src/importers/entity.d.ts +0 -3
- package/dist/openbim/IDSSpecifications/src/importers/index.d.ts +0 -3
- package/dist/openbim/IDSSpecifications/src/importers/parameter.d.ts +0 -2
- package/dist/openbim/IDSSpecifications/src/importers/property.d.ts +0 -3
- package/dist/openbim/IDSSpecifications/src/index.d.ts +0 -3
- package/dist/openbim/IDSSpecifications/src/types.d.ts +0 -70
- package/dist/openbim/index.d.ts +0 -2
- package/dist/utils/bbox.d.ts +0 -7
- package/dist/utils/geometry.d.ts +0 -1
- package/dist/utils/index.d.ts +0 -6
- package/dist/utils/materials.d.ts +0 -4
- package/dist/utils/section-generator.d.ts +0 -31
- package/dist/utils/uuid.d.ts +0 -6
- package/dist/utils/vertex-picker.d.ts +0 -116
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer, DataMap } from "../Types";
|
|
2
|
-
import { Components } from "../Components";
|
|
3
|
-
import { SimpleWorld } from "./src";
|
|
4
|
-
export * from "./src";
|
|
5
|
-
/**
|
|
6
|
-
* A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
|
|
7
|
-
*/
|
|
8
|
-
export declare class Worlds extends Component implements Updateable, Disposable {
|
|
9
|
-
/**
|
|
10
|
-
* A unique identifier for the component.
|
|
11
|
-
* This UUID is used to register the component within the Components system.
|
|
12
|
-
*/
|
|
13
|
-
static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
|
|
14
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
15
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
16
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
17
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
18
|
-
/** {@link Disposable.onDisposed} */
|
|
19
|
-
readonly onDisposed: Event<unknown>;
|
|
20
|
-
/**
|
|
21
|
-
* A collection of worlds managed by this component.
|
|
22
|
-
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
23
|
-
*/
|
|
24
|
-
list: DataMap<string, World>;
|
|
25
|
-
/** {@link Component.enabled} */
|
|
26
|
-
enabled: boolean;
|
|
27
|
-
constructor(components: Components);
|
|
28
|
-
/**
|
|
29
|
-
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
30
|
-
*
|
|
31
|
-
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
32
|
-
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
33
|
-
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
34
|
-
*
|
|
35
|
-
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
36
|
-
*/
|
|
37
|
-
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
38
|
-
/**
|
|
39
|
-
* Deletes a world from the list of worlds.
|
|
40
|
-
*
|
|
41
|
-
* @param {World} world - The world to be deleted.
|
|
42
|
-
*
|
|
43
|
-
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
44
|
-
*/
|
|
45
|
-
delete(world: World): void;
|
|
46
|
-
/**
|
|
47
|
-
* Disposes of the Worlds component and all its managed worlds.
|
|
48
|
-
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
49
|
-
* and triggers the onDisposed event.
|
|
50
|
-
*/
|
|
51
|
-
dispose(): void;
|
|
52
|
-
/** {@link Updateable.update} */
|
|
53
|
-
update(delta?: number): void | Promise<void>;
|
|
54
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
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 [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. Check out it's API to find out what features it offers.
|
|
7
|
-
*/
|
|
8
|
-
export declare class SimpleCamera extends BaseCamera implements Updateable, Disposable {
|
|
9
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
10
|
-
readonly onBeforeUpdate: Event<SimpleCamera>;
|
|
11
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
12
|
-
readonly onAfterUpdate: Event<SimpleCamera>;
|
|
13
|
-
/**
|
|
14
|
-
* Event that is triggered when the aspect of the camera has been updated.
|
|
15
|
-
* This event is useful when you need to perform actions after the aspect of the camera has been changed.
|
|
16
|
-
*/
|
|
17
|
-
readonly onAspectUpdated: Event<unknown>;
|
|
18
|
-
/** {@link Disposable.onDisposed} */
|
|
19
|
-
readonly onDisposed: Event<string>;
|
|
20
|
-
/**
|
|
21
|
-
* A three.js PerspectiveCamera or OrthographicCamera instance.
|
|
22
|
-
* This camera is used for rendering the scene.
|
|
23
|
-
*/
|
|
24
|
-
three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
25
|
-
private _allControls;
|
|
26
|
-
/**
|
|
27
|
-
* The object that controls the camera. An instance of
|
|
28
|
-
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls).
|
|
29
|
-
* Transforming the camera directly will have no effect: you need to use this
|
|
30
|
-
* object to move, rotate, look at objects, etc.
|
|
31
|
-
*/
|
|
32
|
-
get controls(): CameraControls;
|
|
33
|
-
/**
|
|
34
|
-
* Getter for the enabled state of the camera controls.
|
|
35
|
-
* If the current world is null, it returns false.
|
|
36
|
-
* Otherwise, it returns the enabled state of the camera controls.
|
|
37
|
-
*
|
|
38
|
-
* @returns {boolean} The enabled state of the camera controls.
|
|
39
|
-
*/
|
|
40
|
-
get enabled(): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Setter for the enabled state of the camera controls.
|
|
43
|
-
* If the current world is not null, it sets the enabled state of the camera controls to the provided value.
|
|
44
|
-
*
|
|
45
|
-
* @param {boolean} enabled - The new enabled state of the camera controls.
|
|
46
|
-
*/
|
|
47
|
-
set enabled(enabled: boolean);
|
|
48
|
-
constructor(components: Components);
|
|
49
|
-
/** {@link Disposable.dispose} */
|
|
50
|
-
dispose(): void;
|
|
51
|
-
/** {@link Updateable.update} */
|
|
52
|
-
update(_delta: number): void;
|
|
53
|
-
/**
|
|
54
|
-
* Updates the aspect of the camera to match the size of the
|
|
55
|
-
* {@link Components.renderer}.
|
|
56
|
-
*/
|
|
57
|
-
updateAspect: () => void;
|
|
58
|
-
private setupCamera;
|
|
59
|
-
private newCameraControls;
|
|
60
|
-
private setupEvents;
|
|
61
|
-
private static getSubsetOfThree;
|
|
62
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
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 [Objec3Ds](https://threejs.org/docs/#api/en/core/Object3D).
|
|
6
|
-
*/
|
|
7
|
-
export declare class SimpleRenderer extends BaseRenderer {
|
|
8
|
-
/**
|
|
9
|
-
* Indicates whether the renderer is enabled. If it's not, it won't be updated.
|
|
10
|
-
* Default is `true`.
|
|
11
|
-
*/
|
|
12
|
-
enabled: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* The HTML container of the THREE.js canvas where the scene is rendered.
|
|
15
|
-
*/
|
|
16
|
-
container: HTMLElement;
|
|
17
|
-
/**
|
|
18
|
-
* The THREE.js WebGLRenderer instance.
|
|
19
|
-
*/
|
|
20
|
-
three: THREE.WebGLRenderer;
|
|
21
|
-
protected _canvas: HTMLCanvasElement;
|
|
22
|
-
protected _parameters?: Partial<THREE.WebGLRendererParameters>;
|
|
23
|
-
protected _resizeObserver: ResizeObserver | null;
|
|
24
|
-
protected onContainerUpdated: Event<unknown>;
|
|
25
|
-
private _resizing;
|
|
26
|
-
/**
|
|
27
|
-
* Constructor for the SimpleRenderer class.
|
|
28
|
-
*
|
|
29
|
-
* @param components - The components instance.
|
|
30
|
-
* @param container - The HTML container where the THREE.js canvas will be rendered.
|
|
31
|
-
* @param parameters - Optional parameters for the THREE.js WebGLRenderer.
|
|
32
|
-
*/
|
|
33
|
-
constructor(components: Components, container: HTMLElement, parameters?: Partial<THREE.WebGLRendererParameters>);
|
|
34
|
-
/** {@link Updateable.update} */
|
|
35
|
-
update(): void;
|
|
36
|
-
/** {@link Disposable.dispose} */
|
|
37
|
-
dispose(): void;
|
|
38
|
-
/** {@link Resizeable.getSize}. */
|
|
39
|
-
getSize(): THREE.Vector2;
|
|
40
|
-
/** {@link Resizeable.resize} */
|
|
41
|
-
resize: (size?: THREE.Vector2) => void;
|
|
42
|
-
/**
|
|
43
|
-
* Sets up and manages the event listeners for the renderer.
|
|
44
|
-
*
|
|
45
|
-
* @param active - A boolean indicating whether to activate or deactivate the event listeners.
|
|
46
|
-
*
|
|
47
|
-
* @throws Will throw an error if the renderer does not have an HTML container.
|
|
48
|
-
*/
|
|
49
|
-
setupEvents(active: boolean): void;
|
|
50
|
-
private resizeEvent;
|
|
51
|
-
private setupRenderer;
|
|
52
|
-
private onContextLost;
|
|
53
|
-
private onContextBack;
|
|
54
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import { SimpleScene } from "./simple-scene";
|
|
3
|
-
import { ColorSettingsControl, NumberSettingControl, Vector3SettingControl } from "../../Types";
|
|
4
|
-
import { Configurator } from "../../ConfigManager";
|
|
5
|
-
type SimpleSceneConfigType = {
|
|
6
|
-
backgroundColor: ColorSettingsControl;
|
|
7
|
-
ambientLight: {
|
|
8
|
-
color: ColorSettingsControl;
|
|
9
|
-
intensity: NumberSettingControl;
|
|
10
|
-
};
|
|
11
|
-
directionalLight: {
|
|
12
|
-
color: ColorSettingsControl;
|
|
13
|
-
intensity: NumberSettingControl;
|
|
14
|
-
position: Vector3SettingControl;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
declare class DirectionalLightConfig {
|
|
18
|
-
private _list;
|
|
19
|
-
private _scene;
|
|
20
|
-
constructor(list: SimpleSceneConfigType, scene: SimpleScene);
|
|
21
|
-
get color(): THREE.Color;
|
|
22
|
-
set color(value: THREE.Color);
|
|
23
|
-
get intensity(): number;
|
|
24
|
-
set intensity(value: number);
|
|
25
|
-
get position(): THREE.Vector3;
|
|
26
|
-
set position(value: THREE.Vector3);
|
|
27
|
-
}
|
|
28
|
-
declare class AmbientLightConfig {
|
|
29
|
-
private _list;
|
|
30
|
-
private _scene;
|
|
31
|
-
constructor(list: SimpleSceneConfigType, scene: SimpleScene);
|
|
32
|
-
get color(): THREE.Color;
|
|
33
|
-
set color(value: THREE.Color);
|
|
34
|
-
get intensity(): number;
|
|
35
|
-
set intensity(value: number);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Configuration interface for the {@link SimpleScene}.
|
|
39
|
-
*/
|
|
40
|
-
export interface SimpleSceneConfig {
|
|
41
|
-
backgroundColor: THREE.Color;
|
|
42
|
-
directionalLight: {
|
|
43
|
-
color: THREE.Color;
|
|
44
|
-
intensity: number;
|
|
45
|
-
position: THREE.Vector3;
|
|
46
|
-
};
|
|
47
|
-
ambientLight: {
|
|
48
|
-
color: THREE.Color;
|
|
49
|
-
intensity: number;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export declare class SimpleSceneConfigManager extends Configurator<SimpleScene, SimpleSceneConfigType> {
|
|
53
|
-
protected _config: SimpleSceneConfigType;
|
|
54
|
-
ambientLight: AmbientLightConfig;
|
|
55
|
-
directionalLight: DirectionalLightConfig;
|
|
56
|
-
get backgroundColor(): THREE.Color;
|
|
57
|
-
set backgroundColor(value: THREE.Color);
|
|
58
|
-
}
|
|
59
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import { BaseScene, Configurable, Event } from "../../Types";
|
|
3
|
-
import { Components } from "../../Components";
|
|
4
|
-
import { SimpleSceneConfig, SimpleSceneConfigManager } from "./simple-scene-config";
|
|
5
|
-
/**
|
|
6
|
-
* A basic 3D [scene](https://threejs.org/docs/#api/en/scenes/Scene) to add objects hierarchically, and easily dispose them when you are finished with it.
|
|
7
|
-
*/
|
|
8
|
-
export declare class SimpleScene extends BaseScene implements Configurable<SimpleSceneConfigManager, SimpleSceneConfig> {
|
|
9
|
-
/** {@link Configurable.onSetup} */
|
|
10
|
-
readonly onSetup: Event<unknown>;
|
|
11
|
-
/** {@link Configurable.isSetup} */
|
|
12
|
-
isSetup: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* The underlying Three.js scene object.
|
|
15
|
-
* It is used to define the 3D space containing objects, lights, and cameras.
|
|
16
|
-
*/
|
|
17
|
-
three: THREE.Scene;
|
|
18
|
-
/** {@link Configurable.config} */
|
|
19
|
-
config: SimpleSceneConfigManager;
|
|
20
|
-
protected _defaultConfig: SimpleSceneConfig;
|
|
21
|
-
constructor(components: Components);
|
|
22
|
-
/** {@link Configurable.setup} */
|
|
23
|
-
setup(config?: Partial<SimpleSceneConfig>): void;
|
|
24
|
-
dispose(): void;
|
|
25
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import { Event, Base, World, BaseScene, BaseCamera, BaseRenderer, Disposable, Updateable } from "../../Types";
|
|
3
|
-
/**
|
|
4
|
-
* A class representing a simple world in a 3D environment. It extends the Base class and implements the World interface.
|
|
5
|
-
*
|
|
6
|
-
* @template T - The type of the scene. Default is BaseScene.
|
|
7
|
-
* @template U - The type of the camera. Default is BaseCamera.
|
|
8
|
-
* @template S - The type of the renderer. Default is BaseRenderer.
|
|
9
|
-
*/
|
|
10
|
-
export declare class SimpleWorld<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer> extends Base implements World, Disposable, Updateable {
|
|
11
|
-
/**
|
|
12
|
-
* All the loaded [meshes](https://threejs.org/docs/#api/en/objects/Mesh). These meshes will be taken into account in operations like raycasting.
|
|
13
|
-
*/
|
|
14
|
-
readonly meshes: Set<THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>>;
|
|
15
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
16
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
17
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
18
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
19
|
-
/** {@link Disposable.onDisposed} */
|
|
20
|
-
readonly onDisposed: Event<unknown>;
|
|
21
|
-
/**
|
|
22
|
-
* Indicates whether the world is currently being disposed. This is useful to prevent trying to access world's elements when it's being disposed, which could cause errors when you dispose a world.
|
|
23
|
-
*/
|
|
24
|
-
isDisposing: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Indicates whether the world is currently enabled.
|
|
27
|
-
* When disabled, the world will not be updated.
|
|
28
|
-
*/
|
|
29
|
-
enabled: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* A unique identifier for the world. Is not meant to be changed at any moment.
|
|
32
|
-
*/
|
|
33
|
-
readonly uuid: string;
|
|
34
|
-
/**
|
|
35
|
-
* An optional name for the world.
|
|
36
|
-
*/
|
|
37
|
-
name?: string;
|
|
38
|
-
private _scene?;
|
|
39
|
-
private _camera?;
|
|
40
|
-
private _renderer;
|
|
41
|
-
/**
|
|
42
|
-
* Getter for the scene. If no scene is initialized, it throws an error.
|
|
43
|
-
* @returns The current scene.
|
|
44
|
-
*/
|
|
45
|
-
get scene(): T;
|
|
46
|
-
/**
|
|
47
|
-
* Setter for the scene. It sets the current scene, adds the world to the scene's worlds set,
|
|
48
|
-
* sets the current world in the scene, and triggers the scene's onWorldChanged event with the added action.
|
|
49
|
-
* @param scene - The new scene to be set.
|
|
50
|
-
*/
|
|
51
|
-
set scene(scene: T);
|
|
52
|
-
/**
|
|
53
|
-
* Getter for the camera. If no camera is initialized, it throws an error.
|
|
54
|
-
* @returns The current camera.
|
|
55
|
-
*/
|
|
56
|
-
get camera(): U;
|
|
57
|
-
/**
|
|
58
|
-
* Setter for the camera. It sets the current camera, adds the world to the camera's worlds set,
|
|
59
|
-
* sets the current world in the camera, and triggers the camera's onWorldChanged event with the added action.
|
|
60
|
-
* @param camera - The new camera to be set.
|
|
61
|
-
*/
|
|
62
|
-
set camera(camera: U);
|
|
63
|
-
/**
|
|
64
|
-
* Getter for the renderer.
|
|
65
|
-
* @returns The current renderer or null if no renderer is set. Some worlds don't need a renderer to work (when your mail goal is not to display a 3D viewport to the user).
|
|
66
|
-
*/
|
|
67
|
-
get renderer(): S | null;
|
|
68
|
-
/**
|
|
69
|
-
* Setter for the renderer. It sets the current renderer, adds the world to the renderer's worlds set,
|
|
70
|
-
* sets the current world in the renderer, and triggers the renderer's onWorldChanged event with the added action.
|
|
71
|
-
* If a new renderer is set, it also triggers the onWorldChanged event with the removed action for the old renderer.
|
|
72
|
-
* @param renderer - The new renderer to be set or null to remove the current renderer.
|
|
73
|
-
*/
|
|
74
|
-
set renderer(renderer: S | null);
|
|
75
|
-
/** {@link Updateable.update} */
|
|
76
|
-
update(delta?: number): void;
|
|
77
|
-
/** {@link Disposable.dispose} */
|
|
78
|
-
dispose(disposeResources?: boolean): void;
|
|
79
|
-
}
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from "./Components";
|
|
2
|
-
export * from "./Disposer";
|
|
3
|
-
export * from "./ShadowedScene";
|
|
4
|
-
export * from "./Raycasters";
|
|
5
|
-
export * from "./Types";
|
|
6
|
-
export * from "./Worlds";
|
|
7
|
-
export * from "./Grids";
|
|
8
|
-
export * from "./Clipper";
|
|
9
|
-
export * from "./Cullers";
|
|
10
|
-
export * from "./Viewpoints";
|
|
11
|
-
export * from "./MiniMap";
|
|
12
|
-
export * from "./OrthoPerspectiveCamera";
|
|
13
|
-
export * from "./ConfigManager";
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
3
|
-
import { FragmentsGroup } from "@thatopen/fragments";
|
|
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 it's fast, and should suffice for general use cases such as camera zooming or general boundary determination. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/BoundingBoxer). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/BoundingBoxer).
|
|
7
|
-
*/
|
|
8
|
-
export declare class BoundingBoxer extends Component implements Disposable {
|
|
9
|
-
static readonly uuid: "d1444724-dba6-4cdd-a0c7-68ee1450d166";
|
|
10
|
-
/** {@link Component.enabled} */
|
|
11
|
-
enabled: boolean;
|
|
12
|
-
/** {@link Disposable.onDisposed} */
|
|
13
|
-
readonly onDisposed: Event<unknown>;
|
|
14
|
-
private _absoluteMin;
|
|
15
|
-
private _absoluteMax;
|
|
16
|
-
private _meshes;
|
|
17
|
-
constructor(components: Components);
|
|
18
|
-
/**
|
|
19
|
-
* A static method to calculate the dimensions of a given bounding box.
|
|
20
|
-
*
|
|
21
|
-
* @param bbox - The bounding box to calculate the dimensions for.
|
|
22
|
-
* @returns An object containing the width, height, depth, and center of the bounding box.
|
|
23
|
-
*/
|
|
24
|
-
static getDimensions(bbox: THREE.Box3): {
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
depth: number;
|
|
28
|
-
center: THREE.Vector3;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* A static method to create a new bounding box boundary.
|
|
32
|
-
*
|
|
33
|
-
* @param positive - A boolean indicating whether to create a boundary for positive or negative values.
|
|
34
|
-
* @returns A new THREE.Vector3 representing the boundary.
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* This method is used to create a new boundary for calculating bounding boxes.
|
|
38
|
-
* It sets the x, y, and z components of the returned vector to positive or negative infinity,
|
|
39
|
-
* depending on the value of the `positive` parameter.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* const positiveBound = BoundingBoxer.newBound(true);
|
|
44
|
-
* console.log(positiveBound); // Output: Vector3 { x: Infinity, y: Infinity, z: Infinity }
|
|
45
|
-
*
|
|
46
|
-
* const negativeBound = BoundingBoxer.newBound(false);
|
|
47
|
-
* console.log(negativeBound); // Output: Vector3 { x: -Infinity, y: -Infinity, z: -Infinity }
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
static newBound(positive: boolean): THREE.Vector3;
|
|
51
|
-
/**
|
|
52
|
-
* A static method to calculate the bounding box of a set of points.
|
|
53
|
-
*
|
|
54
|
-
* @param points - An array of THREE.Vector3 representing the points.
|
|
55
|
-
* @param min - An optional THREE.Vector3 representing the minimum bounds. If not provided, it will be calculated.
|
|
56
|
-
* @param max - An optional THREE.Vector3 representing the maximum bounds. If not provided, it will be calculated.
|
|
57
|
-
* @returns A THREE.Box3 representing the bounding box of the given points.
|
|
58
|
-
*
|
|
59
|
-
* @remarks
|
|
60
|
-
* This method calculates the bounding box of a set of points by iterating through each point and updating the minimum and maximum bounds accordingly.
|
|
61
|
-
* If the `min` or `max` parameters are provided, they will be used as the initial bounds. Otherwise, the initial bounds will be set to positive and negative infinity.
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* const points = [
|
|
66
|
-
* new THREE.Vector3(1, 2, 3),
|
|
67
|
-
* new THREE.Vector3(4, 5, 6),
|
|
68
|
-
* new THREE.Vector3(7, 8, 9),
|
|
69
|
-
* ];
|
|
70
|
-
*
|
|
71
|
-
* const bbox = BoundingBoxer.getBounds(points);
|
|
72
|
-
* console.log(bbox); // Output: Box3 { min: Vector3 { x: 1, y: 2, z: 3 }, max: Vector3 { x: 7, y: 8, z: 9 } }
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
static getBounds(points: THREE.Vector3[], min?: THREE.Vector3, max?: THREE.Vector3): THREE.Box3;
|
|
76
|
-
/** {@link Disposable.dispose} */
|
|
77
|
-
dispose(): void;
|
|
78
|
-
/**
|
|
79
|
-
* Returns the bounding box of the calculated fragments.
|
|
80
|
-
*
|
|
81
|
-
* @returns A new THREE.Box3 instance representing the bounding box.
|
|
82
|
-
*
|
|
83
|
-
* @remarks
|
|
84
|
-
* This method clones the internal minimum and maximum vectors and returns a new THREE.Box3 instance.
|
|
85
|
-
* The returned box represents the bounding box of the calculated fragments.
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```typescript
|
|
89
|
-
* const boundingBox = boundingBoxer.get();
|
|
90
|
-
* console.log(boundingBox); // Output: Box3 { min: Vector3 { x: -10, y: -10, z: -10 }, max: Vector3 { x: 10, y: 10, z: 10 } }
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
get(): THREE.Box3;
|
|
94
|
-
/**
|
|
95
|
-
* Calculates and returns a sphere that encompasses the entire bounding box.
|
|
96
|
-
*
|
|
97
|
-
* @returns A new THREE.Sphere instance representing the calculated sphere.
|
|
98
|
-
*
|
|
99
|
-
* @remarks
|
|
100
|
-
* This method calculates the center and radius of a sphere that encompasses the entire bounding box.
|
|
101
|
-
* The center is calculated as the midpoint between the minimum and maximum bounds of the bounding box.
|
|
102
|
-
* The radius is calculated as the distance from the center to the minimum bound.
|
|
103
|
-
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```typescript
|
|
106
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
107
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
108
|
-
* const boundingSphere = boundingBoxer.getSphere();
|
|
109
|
-
* console.log(boundingSphere); // Output: Sphere { center: Vector3 { x: 0, y: 0, z: 0 }, radius: 10 }
|
|
110
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
getSphere(): THREE.Sphere;
|
|
113
|
-
/**
|
|
114
|
-
* Returns a THREE.Mesh instance representing the bounding box.
|
|
115
|
-
*
|
|
116
|
-
* @returns A new THREE.Mesh instance representing the bounding box.
|
|
117
|
-
*
|
|
118
|
-
* @remarks
|
|
119
|
-
* This method calculates the dimensions of the bounding box using the `getDimensions` method.
|
|
120
|
-
* It then creates a new THREE.BoxGeometry with the calculated dimensions.
|
|
121
|
-
* A new THREE.Mesh is created using the box geometry, and it is added to the `_meshes` array.
|
|
122
|
-
* The position of the mesh is set to the center of the bounding box.
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```typescript
|
|
126
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
127
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
128
|
-
* const boundingBoxMesh = boundingBoxer.getMesh();
|
|
129
|
-
* scene.add(boundingBoxMesh);
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
getMesh(): THREE.Mesh<THREE.BoxGeometry, THREE.Material | THREE.Material[], THREE.Object3DEventMap>;
|
|
133
|
-
/**
|
|
134
|
-
* Resets the internal minimum and maximum vectors to positive and negative infinity, respectively.
|
|
135
|
-
* This method is used to prepare the BoundingBoxer for a new set of fragments.
|
|
136
|
-
*
|
|
137
|
-
* @remarks
|
|
138
|
-
* This method is called when a new set of fragments is added to the BoundingBoxer.
|
|
139
|
-
* It ensures that the bounding box calculations are accurate and up-to-date.
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* ```typescript
|
|
143
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
144
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
145
|
-
* // ...
|
|
146
|
-
* boundingBoxer.reset();
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
reset(): void;
|
|
150
|
-
/**
|
|
151
|
-
* Adds a FragmentsGroup to the BoundingBoxer.
|
|
152
|
-
*
|
|
153
|
-
* @param group - The FragmentsGroup to add.
|
|
154
|
-
*
|
|
155
|
-
* @remarks
|
|
156
|
-
* This method iterates through each fragment in the provided FragmentsGroup,
|
|
157
|
-
* and calls the `addMesh` method for each fragment's mesh.
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* ```typescript
|
|
161
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
162
|
-
* boundingBoxer.add(fragmentsGroup);
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
add(group: FragmentsGroup): void;
|
|
166
|
-
/**
|
|
167
|
-
* Adds a mesh to the BoundingBoxer and calculates the bounding box.
|
|
168
|
-
*
|
|
169
|
-
* @param mesh - The mesh to add. It can be an instance of THREE.InstancedMesh, THREE.Mesh, or FRAGS.CurveMesh.
|
|
170
|
-
* @param itemIDs - An optional iterable of numbers representing the item IDs.
|
|
171
|
-
*
|
|
172
|
-
* @remarks
|
|
173
|
-
* This method calculates the bounding box of the provided mesh and updates the internal minimum and maximum vectors.
|
|
174
|
-
* If the mesh is an instance of THREE.InstancedMesh, it calculates the bounding box for each instance.
|
|
175
|
-
* If the mesh is an instance of FRAGS.FragmentMesh and itemIDs are provided, it calculates the bounding box for the specified item IDs.
|
|
176
|
-
*
|
|
177
|
-
* @example
|
|
178
|
-
* ```typescript
|
|
179
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
180
|
-
* boundingBoxer.addMesh(mesh);
|
|
181
|
-
* ```
|
|
182
|
-
*/
|
|
183
|
-
addMesh(mesh: THREE.InstancedMesh | THREE.Mesh | FRAGS.CurveMesh, itemIDs?: Iterable<number>): void;
|
|
184
|
-
/**
|
|
185
|
-
* Uses a FragmentIdMap to add its meshes to the bb calculation.
|
|
186
|
-
*
|
|
187
|
-
* This method iterates through the provided `fragmentIdMap`, retrieves the corresponding fragment from the `FragmentsManager`,
|
|
188
|
-
* and then calls the `addMesh` method for each fragment's mesh, passing the expression IDs as the second parameter.
|
|
189
|
-
*
|
|
190
|
-
* @param fragmentIdMap - A mapping of fragment IDs to their corresponding expression IDs.
|
|
191
|
-
*
|
|
192
|
-
* @remarks
|
|
193
|
-
* This method is used to add a mapping of fragment IDs to their corresponding expression IDs.
|
|
194
|
-
* It ensures that the bounding box calculations are accurate and up-to-date by updating the internal minimum and maximum vectors.
|
|
195
|
-
*
|
|
196
|
-
* @example
|
|
197
|
-
* ```typescript
|
|
198
|
-
* const boundingBoxer = components.get(BoundingBoxer);
|
|
199
|
-
* const fragmentIdMap: FRAGS.FragmentIdMap = {
|
|
200
|
-
* '5991fa75-2eef-4825-90b3-85177f51a9c9': [123, 245, 389],
|
|
201
|
-
* '3469077e-39bf-4fc9-b3e6-4a1d78ad52b0': [454, 587, 612],
|
|
202
|
-
* };
|
|
203
|
-
* boundingBoxer.addFragmentIdMap(fragmentIdMap);
|
|
204
|
-
* ```
|
|
205
|
-
*/
|
|
206
|
-
addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
|
|
207
|
-
private static getFragmentBounds;
|
|
208
|
-
}
|