@thatopen/components 2.0.9 → 2.0.11

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.
Files changed (41) hide show
  1. package/dist/core/Clipper/index.d.ts +34 -6
  2. package/dist/core/Clipper/src/simple-plane.d.ts +40 -4
  3. package/dist/core/Components/index.d.ts +40 -16
  4. package/dist/core/Cullers/index.d.ts +23 -27
  5. package/dist/core/Cullers/src/culler-renderer.d.ts +26 -2
  6. package/dist/core/Cullers/src/mesh-culler-renderer.d.ts +32 -4
  7. package/dist/core/Disposer/index.d.ts +6 -4
  8. package/dist/core/Grids/index.d.ts +35 -1
  9. package/dist/core/Grids/src/simple-grid.d.ts +3 -0
  10. package/dist/core/MiniMap/index.d.ts +31 -0
  11. package/dist/core/MiniMap/src/index.d.ts +55 -0
  12. package/dist/core/OrthoPerspectiveCamera/index.d.ts +19 -6
  13. package/dist/core/OrthoPerspectiveCamera/src/first-person-mode.d.ts +1 -2
  14. package/dist/core/OrthoPerspectiveCamera/src/orbit-mode.d.ts +1 -2
  15. package/dist/core/OrthoPerspectiveCamera/src/plan-mode.d.ts +1 -2
  16. package/dist/core/OrthoPerspectiveCamera/src/projections.d.ts +10 -2
  17. package/dist/core/OrthoPerspectiveCamera/src/types.d.ts +1 -2
  18. package/dist/core/Raycasters/index.d.ts +29 -0
  19. package/dist/core/Raycasters/src/simple-raycaster.d.ts +18 -0
  20. package/dist/core/Types/src/async-event.d.ts +1 -7
  21. package/dist/core/Types/src/base-camera.d.ts +18 -1
  22. package/dist/core/Types/src/base-renderer.d.ts +34 -9
  23. package/dist/core/Types/src/base-scene.d.ts +7 -0
  24. package/dist/core/Types/src/base-world-item.d.ts +8 -2
  25. package/dist/core/Types/src/base.d.ts +1 -1
  26. package/dist/core/Types/src/component.d.ts +1 -6
  27. package/dist/core/Types/src/event.d.ts +1 -7
  28. package/dist/core/Types/src/interfaces.d.ts +9 -24
  29. package/dist/core/Types/src/world.d.ts +21 -0
  30. package/dist/core/Worlds/index.d.ts +31 -15
  31. package/dist/core/Worlds/src/simple-camera.d.ts +22 -6
  32. package/dist/core/Worlds/src/simple-renderer.d.ts +25 -3
  33. package/dist/core/Worlds/src/simple-scene.d.ts +13 -4
  34. package/dist/core/Worlds/src/simple-world.d.ts +57 -6
  35. package/dist/fragments/BoundingBoxer/index.d.ts +1 -2
  36. package/dist/fragments/FragmentsManager/index.d.ts +22 -2
  37. package/dist/ifc/IfcRelationsIndexer/index.d.ts +1 -2
  38. package/dist/index.cjs +5 -5
  39. package/dist/index.mjs +861 -382
  40. package/dist/namespace.d.ts +1414 -913
  41. package/package.json +2 -2
@@ -4,26 +4,47 @@ import { SimplePlane } from "./src";
4
4
  import { Components } from "../Components";
5
5
  export * from "./src";
6
6
  /**
7
- * A lightweight component to easily create and handle
8
- * [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
7
+ * A lightweight component to easily create and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes).
9
8
  *
10
9
  * @param components - the instance of {@link Components} used.
11
10
  * E.g. {@link SimplePlane}.
12
11
  */
13
12
  export declare class Clipper extends Component implements Createable, Disposable, Hideable {
13
+ /**
14
+ * A unique identifier for the component.
15
+ * This UUID is used to register the component within the Components system.
16
+ */
14
17
  static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
15
- /** {@link Createable.onAfterCreate} */
16
- readonly onAfterCreate: Event<SimplePlane>;
17
- /** {@link Createable.onAfterDelete} */
18
- readonly onAfterDelete: Event<SimplePlane>;
19
18
  /** Event that fires when the user starts dragging a clipping plane. */
20
19
  readonly onBeforeDrag: Event<void>;
21
20
  /** Event that fires when the user stops dragging a clipping plane. */
22
21
  readonly onAfterDrag: Event<void>;
22
+ /**
23
+ * Event that fires when the user starts creating a clipping plane.
24
+ */
23
25
  readonly onBeforeCreate: Event<unknown>;
26
+ /**
27
+ * Event that fires when the user cancels the creation of a clipping plane.
28
+ */
24
29
  readonly onBeforeCancel: Event<unknown>;
30
+ /**
31
+ * Event that fires after the user cancels the creation of a clipping plane.
32
+ */
25
33
  readonly onAfterCancel: Event<unknown>;
34
+ /**
35
+ * Event that fires when the user starts deleting a clipping plane.
36
+ */
26
37
  readonly onBeforeDelete: Event<unknown>;
38
+ /**
39
+ * Event that fires after a clipping plane has been created.
40
+ * @param plane - The newly created clipping plane.
41
+ */
42
+ readonly onAfterCreate: Event<SimplePlane>;
43
+ /**
44
+ * Event that fires after a clipping plane has been deleted.
45
+ * @param plane - The deleted clipping plane.
46
+ */
47
+ readonly onAfterDelete: Event<SimplePlane>;
27
48
  /** {@link Disposable.onDisposed} */
28
49
  readonly onDisposed: Event<string>;
29
50
  /**
@@ -39,7 +60,14 @@ export declare class Clipper extends Component implements Createable, Disposable
39
60
  * has to be `true` for this to apply.
40
61
  */
41
62
  toleranceOrthogonalY: number;
63
+ /**
64
+ * The type of clipping plane to be created.
65
+ * Default is {@link SimplePlane}.
66
+ */
42
67
  Type: new (...args: any) => SimplePlane;
68
+ /**
69
+ * A list of all the clipping planes created by this component.
70
+ */
43
71
  list: SimplePlane[];
44
72
  /** The material used in all the clipping planes. */
45
73
  private _material;
@@ -2,7 +2,7 @@ import * as THREE from "three";
2
2
  import { Hideable, Disposable, Event, World } from "../../Types";
3
3
  import { Components } from "../../Components";
4
4
  /**
5
- * Each of the planes created by {@link SimpleClipper}.
5
+ * Each of the planes created by the clipper.
6
6
  */
7
7
  export declare class SimplePlane implements Disposable, Hideable {
8
8
  /** Event that fires when the user starts dragging a clipping plane. */
@@ -11,21 +11,40 @@ export declare class SimplePlane implements Disposable, Hideable {
11
11
  readonly onDraggingEnded: Event<unknown>;
12
12
  /** {@link Disposable.onDisposed} */
13
13
  readonly onDisposed: Event<unknown>;
14
+ /**
15
+ * The normal vector of the clipping plane.
16
+ */
14
17
  readonly normal: THREE.Vector3;
18
+ /**
19
+ * The origin point of the clipping plane.
20
+ */
15
21
  readonly origin: THREE.Vector3;
22
+ /**
23
+ * The THREE.js Plane object representing the clipping plane.
24
+ */
16
25
  readonly three: THREE.Plane;
26
+ /** The components instance to which this plane belongs. */
27
+ components: Components;
28
+ /** The world instance to which this plane belongs. */
29
+ world: World;
17
30
  protected readonly _helper: THREE.Object3D;
18
31
  protected _visible: boolean;
19
32
  protected _enabled: boolean;
20
- components: Components;
21
- world: World;
22
33
  private _controlsActive;
23
34
  private readonly _arrowBoundBox;
24
35
  private readonly _planeMesh;
25
36
  private readonly _controls;
26
37
  private readonly _hiddenMaterial;
38
+ /**
39
+ * Getter for the enabled state of the clipping plane.
40
+ * @returns {boolean} The current enabled state.
41
+ */
27
42
  get enabled(): boolean;
28
- /** {@link Component.enabled} */
43
+ /**
44
+ * Setter for the enabled state of the clipping plane.
45
+ * Updates the clipping plane state in the renderer and throws an error if no renderer is found.
46
+ * @param {boolean} state - The new enabled state.
47
+ */
29
48
  set enabled(state: boolean);
30
49
  /** {@link Hideable.visible } */
31
50
  get visible(): boolean;
@@ -41,8 +60,25 @@ export declare class SimplePlane implements Disposable, Hideable {
41
60
  get size(): number;
42
61
  /** Sets the size of the clipping plane representation. */
43
62
  set size(size: number);
63
+ /**
64
+ * Getter for the helper object of the clipping plane.
65
+ * The helper object is a THREE.Object3D that contains the clipping plane mesh and other related objects.
66
+ * It is used for positioning, rotating, and scaling the clipping plane in the 3D scene.
67
+ *
68
+ * @returns {THREE.Object3D} The helper object of the clipping plane.
69
+ */
44
70
  get helper(): THREE.Object3D<THREE.Object3DEventMap>;
45
71
  constructor(components: Components, world: World, origin: THREE.Vector3, normal: THREE.Vector3, material: THREE.Material, size?: number, activateControls?: boolean);
72
+ /**
73
+ * Sets the clipping plane's normal and origin from the given normal and point.
74
+ * This method resets the clipping plane's state, updates the normal and origin,
75
+ * and positions the helper object accordingly.
76
+ *
77
+ * @param normal - The new normal vector for the clipping plane.
78
+ * @param point - The new origin point for the clipping plane.
79
+ *
80
+ * @returns {void}
81
+ */
46
82
  setFromNormalAndCoplanarPoint(normal: THREE.Vector3, point: THREE.Vector3): void;
47
83
  /** {@link Updateable.update} */
48
84
  update: () => void;
@@ -1,34 +1,58 @@
1
1
  import { Component, Disposable, Event } from "../Types";
2
2
  /**
3
- * The entry point of the Components library.
4
- * It can:
5
- * - Create and access all the components of the library.
6
- * - Update all the updatable components automatically.
7
- * - Dispose all the components, preventing memory leaks.
3
+ * The entry point of the Components library. It can create and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
8
4
  */
9
5
  export declare class Components implements Disposable {
10
- static readonly release = "1.4.21";
6
+ /**
7
+ * The version of the @thatopen/components library.
8
+ */
9
+ static readonly release = "2.0.11";
11
10
  /** {@link Disposable.onDisposed} */
12
11
  readonly onDisposed: Event<void>;
13
- /** The list of components created in this app. */
12
+ /**
13
+ * The list of components created in this app.
14
+ * The keys are UUIDs and the values are instances of the components.
15
+ */
14
16
  readonly list: Map<string, Component>;
15
- /** If disabled, the animation loop will be stopped. */
17
+ /**
18
+ * If disabled, the animation loop will be stopped.
19
+ * Default value is false.
20
+ */
16
21
  enabled: boolean;
17
22
  private _clock;
23
+ /**
24
+ * Adds a component to the list of components.
25
+ * Throws an error if a component with the same UUID already exists.
26
+ *
27
+ * @param uuid - The unique identifier of the component.
28
+ * @param instance - The instance of the component to be added.
29
+ *
30
+ * @throws Will throw an error if a component with the same UUID already exists.
31
+ *
32
+ * @internal
33
+ */
18
34
  add(uuid: string, instance: Component): void;
19
35
  /**
20
- * Retrieves a component. If it already exists in this app, it returns the instance of the component. If it
21
- * doesn't exist, it will instance it automatically.
36
+ * Retrieves a component instance by its constructor function.
37
+ * If the component does not exist in the list, it will be created and added.
38
+ *
39
+ * @template U - The type of the component to retrieve.
40
+ * @param Component - The constructor function of the component to retrieve.
22
41
  *
23
- * @param Component - The component to get or create.
42
+ * @returns The instance of the requested component.
43
+ *
44
+ * @throws Will throw an error if a component with the same UUID already exists.
45
+ *
46
+ * @internal
24
47
  */
25
48
  get<U extends Component>(Component: new (components: Components) => U): U;
26
49
  constructor();
27
50
  /**
28
- * Initializes the library. It should be called at the start of the app after
29
- * initializing the scene, the renderer and the
30
- * camera. Additionally, if any component that need a raycaster is
31
- * used, the {@link raycaster} will need to be initialized.
51
+ * Initializes the Components instance.
52
+ * This method starts the animation loop, sets the enabled flag to true,
53
+ * and calls the update method.
54
+ *
55
+ * @returns {void}
32
56
  */
33
57
  init(): void;
34
58
  /**
@@ -39,7 +63,7 @@ export declare class Components implements Disposable {
39
63
  * called. This is especially relevant in Single Page Applications (React,
40
64
  * Angular, Vue, etc).
41
65
  *
42
- * - Any of the objects of this instance (meshes, geometries, etc) is
66
+ * - Any of the objects of this instance (meshes, geometries,materials, etc) is
43
67
  * referenced by a reference type (object or array).
44
68
  *
45
69
  * You can learn more about how Three.js handles memory leaks
@@ -3,50 +3,46 @@ import { MeshCullerRenderer, CullerRendererSettings } from "./src";
3
3
  import { Component, Event, Disposable, World } from "../Types";
4
4
  export * from "./src";
5
5
  /**
6
- * A tool to handle big scenes efficiently by automatically hiding the objects
7
- * that are not visible to the camera.
6
+ * A component that manages and provides culling functionality for meshes in a 3D scene.
8
7
  */
9
8
  export declare class Cullers extends Component implements Disposable {
10
9
  /**
11
- * A unique identifier for the Cullers component.
10
+ * A unique identifier for the component.
11
+ * This UUID is used to register the component within the Components system.
12
12
  */
13
13
  static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
14
14
  /**
15
- * Indicates whether the Cullers component is enabled.
16
- */
15
+ * An event that is triggered when the Cullers component is disposed.
16
+ */
17
+ readonly onDisposed: Event<unknown>;
17
18
  private _enabled;
18
19
  /**
19
20
  * A map of MeshCullerRenderer instances, keyed by their world UUIDs.
20
21
  */
21
22
  list: Map<string, MeshCullerRenderer>;
23
+ /** {@link Component.enabled} */
24
+ get enabled(): boolean;
25
+ /** {@link Component.enabled} */
26
+ set enabled(value: boolean);
27
+ constructor(components: Components);
22
28
  /**
23
- * An event that is triggered when the Cullers component is disposed.
24
- */
25
- readonly onDisposed: Event<unknown>;
26
- /**
27
- * Gets the enabled state of the Cullers component.
29
+ * Creates a new MeshCullerRenderer for the given world.
30
+ * If a MeshCullerRenderer already exists for the world, it will return the existing one.
28
31
  *
29
- * @returns The current enabled state.
32
+ * @param world - The world for which to create the MeshCullerRenderer.
33
+ * @param config - Optional configuration settings for the MeshCullerRenderer.
34
+ *
35
+ * @returns The newly created or existing MeshCullerRenderer for the given world.
30
36
  */
31
- get enabled(): boolean;
37
+ create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
32
38
  /**
33
- * Sets the enabled state of the Cullers component.
34
- * Also sets the enabled state of all MeshCullerRenderer instances.
39
+ * Deletes the MeshCullerRenderer associated with the given world.
40
+ * If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
35
41
  *
36
- * @param value - The new enabled state.
42
+ * @param world - The world for which to delete the MeshCullerRenderer.
43
+ *
44
+ * @returns {void}
37
45
  */
38
- set enabled(value: boolean);
39
- constructor(components: Components);
40
- /**
41
- * Creates a new MeshCullerRenderer for the given world.
42
- * If a MeshCullerRenderer already exists for the world, it will return the existing one.
43
- *
44
- * @param world - The world for which to create the MeshCullerRenderer.
45
- * @param config - Optional configuration settings for the MeshCullerRenderer.
46
- *
47
- * @returns The newly created or existing MeshCullerRenderer for the given world.
48
- */
49
- create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
50
46
  delete(world: World): void;
51
47
  /** {@link Disposable.dispose} */
52
48
  dispose(): void;
@@ -1,14 +1,33 @@
1
1
  import * as THREE from "three";
2
2
  import { Components } from "../../Components";
3
3
  import { AsyncEvent, Event, World } from "../../Types";
4
+ /**
5
+ * Interface for settings to configure the CullerRenderer.
6
+ */
4
7
  export interface CullerRendererSettings {
8
+ /**
9
+ * Interval in milliseconds at which the visibility check should be performed.
10
+ * Default value is 1000.
11
+ */
5
12
  updateInterval?: number;
13
+ /**
14
+ * Width of the render target used for visibility checks.
15
+ * Default value is 512.
16
+ */
6
17
  width?: number;
18
+ /**
19
+ * Height of the render target used for visibility checks.
20
+ * Default value is 512.
21
+ */
7
22
  height?: number;
23
+ /**
24
+ * Whether the visibility check should be performed automatically.
25
+ * Default value is true.
26
+ */
8
27
  autoUpdate?: boolean;
9
28
  }
10
29
  /**
11
- * A base renderer to determine visibility on screen
30
+ * A base renderer to determine visibility on screen.
12
31
  */
13
32
  export declare class CullerRenderer {
14
33
  /** {@link Disposable.onDisposed} */
@@ -19,7 +38,9 @@ export declare class CullerRenderer {
19
38
  * just before but not anymore.
20
39
  */
21
40
  readonly onViewUpdated: Event<any> | AsyncEvent<any>;
22
- /** {@link Component.enabled} */
41
+ /**
42
+ * Whether this renderer is active or not. If not, it won't render anything.
43
+ */
23
44
  enabled: boolean;
24
45
  /**
25
46
  * Needs to check whether there are objects that need to be hidden or shown.
@@ -31,8 +52,11 @@ export declare class CullerRenderer {
31
52
  * for debugging purposes.
32
53
  */
33
54
  renderDebugFrame: boolean;
55
+ /** The components instance to which this renderer belongs. */
34
56
  components: Components;
57
+ /** The world instance to which this renderer belongs. */
35
58
  readonly world: World;
59
+ /** The THREE.js renderer used to make the visibility test. */
36
60
  readonly renderer: THREE.WebGLRenderer;
37
61
  protected autoUpdate: boolean;
38
62
  protected updateInterval: number;
@@ -1,17 +1,33 @@
1
1
  import * as THREE from "three";
2
2
  import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
3
3
  import { Components } from "../../Components";
4
- import { Event, World } from "../../Types";
4
+ import { Event, World, Disposable } from "../../Types";
5
5
  /**
6
- * A renderer to determine a mesh visibility on screen
6
+ * A renderer to determine a mesh visibility on screen.
7
7
  */
8
- export declare class MeshCullerRenderer extends CullerRenderer {
9
- threshold: number;
8
+ export declare class MeshCullerRenderer extends CullerRenderer implements Disposable {
9
+ /**
10
+ * Event triggered when the visibility of meshes is updated.
11
+ * Contains two sets: seen and unseen.
12
+ */
10
13
  readonly onViewUpdated: Event<{
11
14
  seen: Set<THREE.Mesh>;
12
15
  unseen: Set<THREE.Mesh>;
13
16
  }>;
17
+ /**
18
+ * Pixels in screen a geometry must occupy to be considered "seen".
19
+ * Default value is 100.
20
+ */
21
+ threshold: number;
22
+ /**
23
+ * Map of color code to THREE.InstancedMesh.
24
+ * Used to keep track of color-coded meshes.
25
+ */
14
26
  colorMeshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[]>>;
27
+ /**
28
+ * Flag to indicate if the renderer is currently processing.
29
+ * Used to prevent concurrent processing.
30
+ */
15
31
  isProcessing: boolean;
16
32
  private _colorCodeMeshMap;
17
33
  private _meshIDColorCodeMap;
@@ -20,8 +36,20 @@ export declare class MeshCullerRenderer extends CullerRenderer {
20
36
  private _intervalID;
21
37
  private readonly _transparentMat;
22
38
  constructor(components: Components, world: World, settings?: CullerRendererSettings);
39
+ /** {@link Disposable.dispose} */
23
40
  dispose(): void;
41
+ /**
42
+ * Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
43
+ * @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
44
+ * @returns {void}
45
+ */
24
46
  add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
47
+ /**
48
+ * Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
49
+ * When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
50
+ * @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
51
+ * @returns {void}
52
+ */
25
53
  remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
26
54
  private handleWorkerMessage;
27
55
  private getAvailableMaterial;
@@ -2,18 +2,20 @@ import * as THREE from "three";
2
2
  import { Components } from "../Components";
3
3
  import { Component } from "../Types";
4
4
  /**
5
- * A tool to safely remove meshes and geometries from memory to
6
- * [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
5
+ * A tool to safely remove meshes and geometries from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
7
6
  */
8
7
  export declare class Disposer extends Component {
9
8
  private _disposedComponents;
10
9
  /** {@link Component.enabled} */
11
10
  enabled: boolean;
11
+ /**
12
+ * A unique identifier for the component.
13
+ * This UUID is used to register the component within the Components system.
14
+ */
12
15
  static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
13
16
  constructor(components: Components);
14
17
  /**
15
- * {@link Component.uuid}.
16
- * @return the list of UUIDs of deleted components.
18
+ * Return the UUIDs of all disposed components.
17
19
  */
18
20
  get(): Set<string>;
19
21
  /**
@@ -1,15 +1,49 @@
1
1
  import { Component, Disposable, World, Event } from "../Types";
2
2
  import { GridConfig, SimpleGrid } from "./src";
3
3
  import { Components } from "../Components";
4
+ /**
5
+ * A component that manages and provides access to multiple grid instances. Each grid is associated with a unique world.
6
+ */
4
7
  export declare class Grids extends Component implements Disposable {
8
+ /**
9
+ * A unique identifier for the component.
10
+ * This UUID is used to register the component within the Components system.
11
+ */
5
12
  static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
13
+ /**
14
+ * A map of world UUIDs to their corresponding grid instances.
15
+ */
6
16
  list: Map<string, SimpleGrid>;
7
- readonly onDisposed: Event<unknown>;
17
+ /**
18
+ * The default configuration for grid creation.
19
+ */
8
20
  config: Required<GridConfig>;
21
+ /** {@link Disposable.onDisposed} */
22
+ readonly onDisposed: Event<unknown>;
9
23
  /** {@link Component.enabled} */
10
24
  enabled: boolean;
11
25
  constructor(components: Components);
26
+ /**
27
+ * Creates a new grid for the given world.
28
+ * Throws an error if a grid already exists for the world.
29
+ *
30
+ * @param world - The world to create the grid for.
31
+ * @returns The newly created grid.
32
+ *
33
+ * @throws Will throw an error if a grid already exists for the given world.
34
+ */
12
35
  create(world: World): SimpleGrid;
36
+ /**
37
+ * Deletes the grid associated with the given world.
38
+ * If a grid does not exist for the given world, this method does nothing.
39
+ *
40
+ * @param world - The world for which to delete the grid.
41
+ *
42
+ * @remarks
43
+ * This method will dispose of the grid and remove it from the internal list.
44
+ * If the world is disposed before calling this method, the grid will be automatically deleted.
45
+ */
13
46
  delete(world: World): void;
47
+ /** {@link Disposable.dispose} */
14
48
  dispose(): void;
15
49
  }
@@ -16,7 +16,9 @@ export interface GridConfig {
16
16
  export declare class SimpleGrid implements Hideable, Disposable {
17
17
  /** {@link Disposable.onDisposed} */
18
18
  readonly onDisposed: Event<unknown>;
19
+ /** The world instance to which this Raycaster belongs. */
19
20
  world: World;
21
+ /** The components instance to which this grid belongs. */
20
22
  components: Components;
21
23
  /** {@link Hideable.visible} */
22
24
  get visible(): boolean;
@@ -34,6 +36,7 @@ export declare class SimpleGrid implements Hideable, Disposable {
34
36
  * perspective cameras and false for orthographic cameras.
35
37
  */
36
38
  set fade(active: boolean);
39
+ /** The Three.js mesh that contains the infinite grid. */
37
40
  readonly three: THREE.Mesh;
38
41
  private _fade;
39
42
  constructor(components: Components, world: World, config: GridConfig);
@@ -1,16 +1,47 @@
1
1
  import { MiniMap } from "./src";
2
2
  import { Component, Updateable, World, Event, Disposable } from "../Types";
3
3
  import { Components } from "../Components";
4
+ /**
5
+ * A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID.
6
+ */
4
7
  export declare class MiniMaps extends Component implements Updateable, Disposable {
8
+ /**
9
+ * A unique identifier for the component.
10
+ * This UUID is used to register the component within the Components system.
11
+ */
5
12
  static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
13
+ /** {@link Updateable.onAfterUpdate} */
6
14
  readonly onAfterUpdate: Event<unknown>;
15
+ /** {@link Updateable.onBeforeUpdate} */
7
16
  readonly onBeforeUpdate: Event<unknown>;
17
+ /** {@link Disposable.onDisposed} */
8
18
  readonly onDisposed: Event<unknown>;
19
+ /** {@link Component.enabled} */
9
20
  enabled: boolean;
21
+ /**
22
+ * A collection of {@link MiniMap} instances, each associated with a unique world ID.
23
+ */
10
24
  list: Map<string, MiniMap>;
11
25
  constructor(components: Components);
26
+ /**
27
+ * Creates a new {@link MiniMap} instance associated with the given world.
28
+ * If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
29
+ *
30
+ * @param world - The {@link World} for which to create a {@link MiniMap} instance.
31
+ * @returns The newly created {@link MiniMap} instance.
32
+ * @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
33
+ */
12
34
  create(world: World): MiniMap;
35
+ /**
36
+ * Deletes a {@link MiniMap} instance associated with the given world ID.
37
+ * If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
38
+ *
39
+ * @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
40
+ * @returns {void}
41
+ */
13
42
  delete(id: string): void;
43
+ /** {@link Disposable.dispose} */
14
44
  dispose(): void;
45
+ /** {@link Updateable.update} */
15
46
  update(): void;
16
47
  }
@@ -1,16 +1,47 @@
1
1
  import * as THREE from "three";
2
2
  import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
3
+ /**
4
+ * A class representing a 2D minimap in a 3D world.
5
+ */
3
6
  export declare class MiniMap implements Resizeable, Updateable, Disposable {
4
7
  /** {@link Disposable.onDisposed} */
5
8
  readonly onDisposed: Event<unknown>;
9
+ /** {@link Updateable.onAfterUpdate} */
6
10
  readonly onAfterUpdate: Event<unknown>;
11
+ /** {@link Updateable.onBeforeUpdate} */
7
12
  readonly onBeforeUpdate: Event<unknown>;
13
+ /** {@link Resizeable.onResize} */
8
14
  readonly onResize: Event<THREE.Vector2>;
15
+ /**
16
+ * The front offset of the minimap.
17
+ * It determines how much the minimap's view is offset from the camera's view.
18
+ * By pushing the map to the front, what the user sees on screen corresponds with what they see on the map
19
+ */
9
20
  frontOffset: number;
21
+ /**
22
+ * The override material for the minimap.
23
+ * It is used to render the depth information of the world onto the minimap.
24
+ */
10
25
  overrideMaterial: THREE.MeshDepthMaterial;
26
+ /**
27
+ * The background color of the minimap.
28
+ * It is used to set the background color of the minimap's renderer.
29
+ */
11
30
  backgroundColor: THREE.Color;
31
+ /**
32
+ * The WebGL renderer for the minimap.
33
+ * It is used to render the minimap onto the screen.
34
+ */
12
35
  renderer: THREE.WebGLRenderer;
36
+ /**
37
+ * A flag indicating whether the minimap is enabled.
38
+ * If disabled, the minimap will not update or render.
39
+ */
13
40
  enabled: boolean;
41
+ /**
42
+ * The world in which the minimap is displayed.
43
+ * It provides access to the 3D scene, camera, and other relevant world elements.
44
+ */
14
45
  world: World;
15
46
  private _lockRotation;
16
47
  private _camera;
@@ -20,15 +51,39 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
20
51
  private _tempVector2;
21
52
  private _tempTarget;
22
53
  private readonly down;
54
+ /**
55
+ * Gets or sets whether the minimap rotation is locked.
56
+ * When rotation is locked, the minimap will always face the same direction as the camera.
57
+ */
23
58
  get lockRotation(): boolean;
59
+ /**
60
+ * Sets whether the minimap rotation is locked.
61
+ * When rotation is locked, the minimap will always face the same direction as the camera.
62
+ * @param active - If `true`, rotation is locked. If `false`, rotation is not locked.
63
+ */
24
64
  set lockRotation(active: boolean);
65
+ /**
66
+ * Gets the current zoom level of the minimap.
67
+ * The zoom level determines how much of the world is visible on the minimap.
68
+ * @returns The current zoom level of the minimap.
69
+ */
25
70
  get zoom(): number;
71
+ /**
72
+ * Sets the zoom level of the minimap.
73
+ * The zoom level determines how much of the world is visible on the minimap.
74
+ * @param value - The new zoom level of the minimap.
75
+ */
26
76
  set zoom(value: number);
27
77
  constructor(world: World);
78
+ /** {@link Disposable.dispose} */
28
79
  dispose(): void;
80
+ /** Returns the camera used by the MiniMap */
29
81
  get(): THREE.OrthographicCamera;
82
+ /** {@link Updateable.update} */
30
83
  update(): void;
84
+ /** {@link Resizeable.getSize} */
31
85
  getSize(): THREE.Vector2;
86
+ /** {@link Resizeable.resize} */
32
87
  resize(size?: THREE.Vector2): void;
33
88
  private updatePlanes;
34
89
  }