u-space 0.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/README.md +21 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +1374 -0
- package/dist/plugins/atmosphere/Atmosphere.d.ts +9 -0
- package/dist/plugins/atmosphere/index.cjs +1 -0
- package/dist/plugins/atmosphere/index.d.ts +1 -0
- package/dist/plugins/atmosphere/index.js +15 -0
- package/dist/plugins/curve-movement/CurveMovement.d.ts +78 -0
- package/dist/plugins/curve-movement/CurveMovementCamera.d.ts +8 -0
- package/dist/plugins/curve-movement/CurveMovementObject.d.ts +14 -0
- package/dist/plugins/curve-movement/index.cjs +1 -0
- package/dist/plugins/curve-movement/index.d.ts +3 -0
- package/dist/plugins/curve-movement/index.js +153 -0
- package/dist/plugins/keyboard-controls/KeyboardControls.d.ts +31 -0
- package/dist/plugins/keyboard-controls/index.cjs +1 -0
- package/dist/plugins/keyboard-controls/index.d.ts +1 -0
- package/dist/plugins/keyboard-controls/index.js +67 -0
- package/dist/plugins/minimap/Minimap.d.ts +22 -0
- package/dist/plugins/minimap/index.cjs +1 -0
- package/dist/plugins/minimap/index.d.ts +1 -0
- package/dist/plugins/minimap/index.js +67 -0
- package/dist/plugins/tiles/ArcgisTilesRenderer.d.ts +14 -0
- package/dist/plugins/tiles/Globe.d.ts +22 -0
- package/dist/plugins/tiles/index.cjs +1 -0
- package/dist/plugins/tiles/index.d.ts +2 -0
- package/dist/plugins/tiles/index.js +179 -0
- package/dist/plugins/tiles/plugins/TileMaterialReplacementPlugin.d.ts +11 -0
- package/dist/plugins/tiles/plugins/fade/FadeMaterialManager.d.ts +17 -0
- package/dist/plugins/tiles/plugins/fade/TilesFadePlugin.d.ts +5 -0
- package/dist/plugins/tiles/plugins/fade/wrapFadeNodeMaterial.d.ts +3 -0
- package/dist/plugins/tracking-controls/TrackingControls.d.ts +13 -0
- package/dist/plugins/tracking-controls/index.cjs +1 -0
- package/dist/plugins/tracking-controls/index.d.ts +1 -0
- package/dist/plugins/tracking-controls/index.js +23 -0
- package/dist/plugins/u-manager/Watermarker.d.ts +12 -0
- package/dist/plugins/u-manager/constants.d.ts +5 -0
- package/dist/plugins/u-manager/index.cjs +86 -0
- package/dist/plugins/u-manager/index.d.ts +6 -0
- package/dist/plugins/u-manager/index.js +20877 -0
- package/dist/plugins/u-manager/license/decryptUtils.d.ts +5 -0
- package/dist/plugins/u-manager/loaders/AnimationsLoader.d.ts +59 -0
- package/dist/plugins/u-manager/loaders/BaseFileLoader.d.ts +5 -0
- package/dist/plugins/u-manager/loaders/PropertiesLoader.d.ts +12 -0
- package/dist/plugins/u-manager/loaders/SceneLoader.d.ts +15 -0
- package/dist/plugins/u-manager/loaders/TopologiesLoader.d.ts +10 -0
- package/dist/plugins/u-manager/loaders/VisionsLoader.d.ts +26 -0
- package/dist/plugins/u-manager/types.d.ts +84 -0
- package/dist/src/animations/Tween.d.ts +20 -0
- package/dist/src/animations/index.d.ts +1 -0
- package/dist/src/effects/MaterialEffects.d.ts +10 -0
- package/dist/src/effects/TSLEffects.d.ts +24 -0
- package/dist/src/effects/index.d.ts +2 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/interactions/InteractionEvent.d.ts +39 -0
- package/dist/src/interactions/InteractionManager.d.ts +55 -0
- package/dist/src/interactions/index.d.ts +2 -0
- package/dist/src/interfaces/base.d.ts +11 -0
- package/dist/src/interfaces/index.d.ts +1 -0
- package/dist/src/loaders/ModelLoaderManager.d.ts +40 -0
- package/dist/src/loaders/SBMLoader.d.ts +6 -0
- package/dist/src/loaders/SBMUtils.d.ts +5 -0
- package/dist/src/loaders/SBMXLoader.d.ts +6 -0
- package/dist/src/loaders/TextureLoaderManager.d.ts +11 -0
- package/dist/src/loaders/index.d.ts +4 -0
- package/dist/src/managers/ObjectManager.d.ts +60 -0
- package/dist/src/managers/index.d.ts +1 -0
- package/dist/src/objects/BaseGroup.d.ts +8 -0
- package/dist/src/objects/BaseMesh.d.ts +8 -0
- package/dist/src/objects/BaseSprite.d.ts +8 -0
- package/dist/src/objects/CircleMesh.d.ts +17 -0
- package/dist/src/objects/ExtrudeMesh.d.ts +17 -0
- package/dist/src/objects/Model.d.ts +17 -0
- package/dist/src/objects/ObjectUtils.d.ts +4 -0
- package/dist/src/objects/PlaneMesh.d.ts +17 -0
- package/dist/src/objects/Poi.d.ts +38 -0
- package/dist/src/objects/ShapeMesh.d.ts +17 -0
- package/dist/src/objects/SphereMesh.d.ts +20 -0
- package/dist/src/objects/Topology.d.ts +64 -0
- package/dist/src/objects/TubeMesh.d.ts +18 -0
- package/dist/src/objects/index.d.ts +13 -0
- package/dist/src/types.d.ts +1 -0
- package/dist/src/viewers/CameraControls.d.ts +19 -0
- package/dist/src/viewers/Info.d.ts +18 -0
- package/dist/src/viewers/RenderPipeline.d.ts +17 -0
- package/dist/src/viewers/RoomEnvironment.d.ts +11 -0
- package/dist/src/viewers/Viewer.d.ts +59 -0
- package/dist/src/viewers/ViewerHelper.d.ts +12 -0
- package/dist/src/viewers/index.d.ts +3 -0
- package/docs/api-interactions.md +64 -0
- package/docs/api-managers.md +54 -0
- package/docs/api-objects.md +65 -0
- package/docs/api-plugins.md +103 -0
- package/docs/api-viewer.md +84 -0
- package/docs/examples-guide.md +48 -0
- package/docs/getting-started.md +126 -0
- package/package.json +60 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MeshStandardNodeMaterial, PlaneGeometry, type MeshStandardNodeMaterialParameters } from 'three/webgpu';
|
|
2
|
+
import type { InteractionEventMap } from '../interactions';
|
|
3
|
+
import { BaseMesh } from './BaseMesh';
|
|
4
|
+
export interface PlaneMeshParameters {
|
|
5
|
+
geometryParameters?: {
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
widthSegments?: number;
|
|
9
|
+
heightSegments?: number;
|
|
10
|
+
};
|
|
11
|
+
materialParameters?: MeshStandardNodeMaterialParameters;
|
|
12
|
+
}
|
|
13
|
+
export declare class PlaneMesh extends BaseMesh<PlaneGeometry, MeshStandardNodeMaterial, InteractionEventMap> {
|
|
14
|
+
readonly isPlaneMesh = true;
|
|
15
|
+
type: string;
|
|
16
|
+
constructor({ geometryParameters, materialParameters }?: PlaneMeshParameters);
|
|
17
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { InteractionEventMap } from '../interactions';
|
|
2
|
+
import { BaseSprite } from './BaseSprite';
|
|
3
|
+
export interface PoiParameters {
|
|
4
|
+
/** Image URL or HTMLImageElement */
|
|
5
|
+
img?: string | CanvasImageSource;
|
|
6
|
+
/** Text content */
|
|
7
|
+
text?: string;
|
|
8
|
+
/** Font size in pixels */
|
|
9
|
+
fontSize?: number;
|
|
10
|
+
/** Font family */
|
|
11
|
+
fontFamily?: string;
|
|
12
|
+
/** Text color */
|
|
13
|
+
color?: string;
|
|
14
|
+
/** Icon size in pixels (applied to the image if present) */
|
|
15
|
+
iconSize?: number;
|
|
16
|
+
/** Padding between icon and text, and around the container */
|
|
17
|
+
padding?: number;
|
|
18
|
+
/** Background color of the POI (optional) */
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
/** Border radius for the background (optional) */
|
|
21
|
+
borderRadius?: number;
|
|
22
|
+
/** Text position relative to the icon */
|
|
23
|
+
textPosition?: 'top' | 'bottom' | 'left' | 'right';
|
|
24
|
+
}
|
|
25
|
+
export declare class Poi extends BaseSprite<InteractionEventMap> {
|
|
26
|
+
readonly isPoi = true;
|
|
27
|
+
type: string;
|
|
28
|
+
parameters: Required<PoiParameters>;
|
|
29
|
+
constructor(parameters?: PoiParameters);
|
|
30
|
+
/**
|
|
31
|
+
* Update the POI with new parameters
|
|
32
|
+
* @param parameters Partial POI parameters
|
|
33
|
+
*/
|
|
34
|
+
updateAsync(parameters?: Partial<PoiParameters>): Promise<void>;
|
|
35
|
+
private _loadImage;
|
|
36
|
+
private _drawRoundedRect;
|
|
37
|
+
dispose(): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MeshStandardNodeMaterial, ShapeGeometry, Shape, type MeshStandardNodeMaterialParameters } from 'three/webgpu';
|
|
2
|
+
import type { InteractionEventMap } from '../interactions';
|
|
3
|
+
import type { IPlaneVector2 } from '../interfaces';
|
|
4
|
+
import { BaseMesh } from './BaseMesh';
|
|
5
|
+
export interface ShapeMeshParameters {
|
|
6
|
+
geometryParameters?: {
|
|
7
|
+
shape?: Shape | Shape[];
|
|
8
|
+
curveSegments?: number;
|
|
9
|
+
};
|
|
10
|
+
materialParameters?: MeshStandardNodeMaterialParameters;
|
|
11
|
+
}
|
|
12
|
+
export declare class ShapeMesh extends BaseMesh<ShapeGeometry, MeshStandardNodeMaterial, InteractionEventMap> {
|
|
13
|
+
readonly isShapeMesh = true;
|
|
14
|
+
type: string;
|
|
15
|
+
constructor({ geometryParameters, materialParameters }?: ShapeMeshParameters);
|
|
16
|
+
static createFromPoints(points: IPlaneVector2[], parameters?: ShapeMeshParameters): ShapeMesh;
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SphereGeometry, MeshStandardNodeMaterial, type MeshStandardNodeMaterialParameters } from 'three/webgpu';
|
|
2
|
+
import type { InteractionEventMap } from '../interactions';
|
|
3
|
+
import { BaseMesh } from './BaseMesh';
|
|
4
|
+
export interface SphereMeshParameters {
|
|
5
|
+
geometryParameters?: {
|
|
6
|
+
radius?: number;
|
|
7
|
+
widthSegments?: number;
|
|
8
|
+
heightSegments?: number;
|
|
9
|
+
phiStart?: number;
|
|
10
|
+
phiLength?: number;
|
|
11
|
+
thetaStart?: number;
|
|
12
|
+
thetaLength?: number;
|
|
13
|
+
};
|
|
14
|
+
materialParameters?: MeshStandardNodeMaterialParameters;
|
|
15
|
+
}
|
|
16
|
+
export declare class SphereMesh extends BaseMesh<SphereGeometry, MeshStandardNodeMaterial, InteractionEventMap> {
|
|
17
|
+
readonly isSphereMesh = true;
|
|
18
|
+
type: string;
|
|
19
|
+
constructor({ geometryParameters, materialParameters }?: SphereMeshParameters);
|
|
20
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type Vector3, Group, type ColorRepresentation } from 'three/webgpu';
|
|
2
|
+
import type { InteractionEventMap } from '../interactions';
|
|
3
|
+
import { TubeMesh } from './TubeMesh';
|
|
4
|
+
import { BaseGroup } from './BaseGroup';
|
|
5
|
+
export interface TopologyParameters {
|
|
6
|
+
nodeColor?: ColorRepresentation;
|
|
7
|
+
nodeRadius?: number;
|
|
8
|
+
edgeColor?: ColorRepresentation;
|
|
9
|
+
edgeRadius?: number;
|
|
10
|
+
pathColor?: ColorRepresentation;
|
|
11
|
+
pathRadius?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class Topology extends BaseGroup<InteractionEventMap> {
|
|
14
|
+
readonly isTopology = true;
|
|
15
|
+
type: string;
|
|
16
|
+
parameters: Required<TopologyParameters>;
|
|
17
|
+
nodes: Map<string, Vector3>;
|
|
18
|
+
adjacencyMap: Map<string, Map<string, number>>;
|
|
19
|
+
graphGroup: Group<InteractionEventMap> | null;
|
|
20
|
+
pathMeshes: TubeMesh[];
|
|
21
|
+
constructor(parameters?: TopologyParameters);
|
|
22
|
+
/**
|
|
23
|
+
* Add a node to the topology graph.
|
|
24
|
+
* @param id Unique identifier for the node
|
|
25
|
+
* @param position 3D position of the node
|
|
26
|
+
*/
|
|
27
|
+
addNode(id: string, position: Vector3): void;
|
|
28
|
+
/**
|
|
29
|
+
* Remove a node from the topology graph.
|
|
30
|
+
* @param id Unique identifier for the node
|
|
31
|
+
*/
|
|
32
|
+
removeNode(id: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Add an edge between two nodes.
|
|
35
|
+
* @param from Node ID
|
|
36
|
+
* @param to Node ID
|
|
37
|
+
* @param weight Cost of the edge. Defaults to Euclidean distance.
|
|
38
|
+
* @param bidirectional If true, adds the reverse edge as well. Default true.
|
|
39
|
+
*/
|
|
40
|
+
addEdge(from: string, to: string, weight?: number, bidirectional?: boolean): void;
|
|
41
|
+
/**
|
|
42
|
+
* Remove an edge between two nodes.
|
|
43
|
+
* @param from Node ID
|
|
44
|
+
* @param to Node ID
|
|
45
|
+
* @param bidirectional If true, removes the reverse edge as well. Default true.
|
|
46
|
+
*/
|
|
47
|
+
removeEdge(from: string, to: string, bidirectional?: boolean): void;
|
|
48
|
+
/**
|
|
49
|
+
* Find the shortest path between start and end nodes using Dijkstra's algorithm.
|
|
50
|
+
*/
|
|
51
|
+
getShortestPath(startId: string, endId: string): Vector3[];
|
|
52
|
+
/**
|
|
53
|
+
* Renders the entire topology graph structure using TubeGeometry and Spheres.
|
|
54
|
+
*/
|
|
55
|
+
renderGraph(): void;
|
|
56
|
+
clearGraph(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Visualizes a path using TubeGeometry (CatmullRomCurve3).
|
|
59
|
+
*/
|
|
60
|
+
renderPath(points: Vector3[], color?: ColorRepresentation): TubeMesh | undefined;
|
|
61
|
+
clearPaths(): void;
|
|
62
|
+
dispose(): void;
|
|
63
|
+
getNeighbors(id: string): Map<string, number> | undefined;
|
|
64
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TubeGeometry, MeshStandardNodeMaterial, type Vector3, type Curve, type MeshStandardNodeMaterialParameters } from 'three/webgpu';
|
|
2
|
+
import type { InteractionEventMap } from '../interactions';
|
|
3
|
+
import { BaseMesh } from './BaseMesh';
|
|
4
|
+
export interface TubeMeshParameters {
|
|
5
|
+
geometryParameters?: {
|
|
6
|
+
path?: Curve<Vector3>;
|
|
7
|
+
tubularSegments?: number;
|
|
8
|
+
radius?: number;
|
|
9
|
+
radialSegments?: number;
|
|
10
|
+
closed?: boolean;
|
|
11
|
+
};
|
|
12
|
+
materialParameters?: MeshStandardNodeMaterialParameters;
|
|
13
|
+
}
|
|
14
|
+
export declare class TubeMesh extends BaseMesh<TubeGeometry, MeshStandardNodeMaterial, InteractionEventMap> {
|
|
15
|
+
readonly isTubeMesh = true;
|
|
16
|
+
type: string;
|
|
17
|
+
constructor({ geometryParameters, materialParameters }?: TubeMeshParameters);
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './BaseMesh';
|
|
2
|
+
export * from './BaseGroup';
|
|
3
|
+
export * from './BaseSprite';
|
|
4
|
+
export * from './Model';
|
|
5
|
+
export * from './Topology';
|
|
6
|
+
export * from './Poi';
|
|
7
|
+
export * from './SphereMesh';
|
|
8
|
+
export * from './TubeMesh';
|
|
9
|
+
export * from './ShapeMesh';
|
|
10
|
+
export * from './ExtrudeMesh';
|
|
11
|
+
export * from './PlaneMesh';
|
|
12
|
+
export * from './CircleMesh';
|
|
13
|
+
export * from './ObjectUtils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function reinterpretType<T>(_value: unknown): asserts _value is T;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import CameraControlsBase from 'camera-controls';
|
|
2
|
+
import { Box3, type Object3D } from 'three/webgpu';
|
|
3
|
+
export interface FlyToBoxOptions {
|
|
4
|
+
viewpoint?: 'current' | 'top' | 'bottom' | 'front' | 'back' | 'left' | 'right' | 'frontTop' | 'backTop' | 'leftTop' | 'rightTop' | 'leftFrontTop' | 'rightFrontTop' | 'leftBackTop' | 'rightBackTop';
|
|
5
|
+
enableTransition?: boolean;
|
|
6
|
+
padding?: number;
|
|
7
|
+
cover?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface FlyToObjectOptions extends FlyToBoxOptions {
|
|
10
|
+
}
|
|
11
|
+
export declare class CameraControls extends CameraControlsBase {
|
|
12
|
+
constructor(...args: ConstructorParameters<typeof CameraControlsBase>);
|
|
13
|
+
/**
|
|
14
|
+
* Set absolute angle for azimuth to avoid spinning
|
|
15
|
+
*/
|
|
16
|
+
absoluteRotations(): void;
|
|
17
|
+
flyToBox(box: Box3, options?: FlyToBoxOptions): Promise<boolean>;
|
|
18
|
+
flyToObject(object: Object3D, options?: FlyToObjectOptions): Promise<boolean>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type WebGPURenderer } from 'three/webgpu';
|
|
2
|
+
export declare class Info {
|
|
3
|
+
el: HTMLElement;
|
|
4
|
+
renderer: WebGPURenderer;
|
|
5
|
+
container: HTMLElement;
|
|
6
|
+
drawCallsText: HTMLElement;
|
|
7
|
+
frameCallsText: HTMLElement;
|
|
8
|
+
trianglesText: HTMLElement;
|
|
9
|
+
pointsText: HTMLElement;
|
|
10
|
+
linesText: HTMLElement;
|
|
11
|
+
timestampText: HTMLElement;
|
|
12
|
+
_enabled: boolean;
|
|
13
|
+
constructor(el: HTMLElement, renderer: WebGPURenderer);
|
|
14
|
+
update(): void;
|
|
15
|
+
enable(): void;
|
|
16
|
+
disable(): void;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Scene, type Camera, RenderPipeline as RenderPipelineBase, type Node } from 'three/webgpu';
|
|
2
|
+
type Args = [ConstructorParameters<typeof RenderPipelineBase>[0], Scene, Camera];
|
|
3
|
+
export declare class RenderPipeline extends RenderPipelineBase {
|
|
4
|
+
#private;
|
|
5
|
+
scene: Scene;
|
|
6
|
+
camera: Camera;
|
|
7
|
+
currentOutputNode: Node;
|
|
8
|
+
needsUpdateOutputNode: boolean;
|
|
9
|
+
constructor(...args: Args);
|
|
10
|
+
addOverlayPass(pass: Node): void;
|
|
11
|
+
removeOverlayPass(pass: Node): void;
|
|
12
|
+
setCamera(camera: Camera): void;
|
|
13
|
+
setCurrentOutputNode(node: Node): void;
|
|
14
|
+
resetCurrentOutputNode(): void;
|
|
15
|
+
render(): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PMREMGenerator, type Texture, type WebGPURenderer } from 'three/webgpu';
|
|
2
|
+
import { RoomEnvironment as RoomEnvironmentClass } from 'three/addons/environments/RoomEnvironment.js';
|
|
3
|
+
export declare class RoomEnvironment {
|
|
4
|
+
environment: RoomEnvironmentClass;
|
|
5
|
+
renderer: WebGPURenderer;
|
|
6
|
+
pmremGenerator: PMREMGenerator;
|
|
7
|
+
envMap: Texture | null;
|
|
8
|
+
constructor(renderer: WebGPURenderer);
|
|
9
|
+
update(): void;
|
|
10
|
+
dispose(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { EventDispatcher, WebGPURenderer, Scene, PerspectiveCamera, Timer, OrthographicCamera } from 'three/webgpu';
|
|
2
|
+
import { InteractionManager } from '../interactions';
|
|
3
|
+
import { ObjectManager } from '../managers';
|
|
4
|
+
import { RenderPipeline } from './RenderPipeline';
|
|
5
|
+
import { CameraControls } from './CameraControls';
|
|
6
|
+
import { RoomEnvironment } from './RoomEnvironment';
|
|
7
|
+
import { ViewerHelper } from './ViewerHelper';
|
|
8
|
+
import { Info } from './Info';
|
|
9
|
+
type ViewerRendererOptions = ConstructorParameters<typeof WebGPURenderer>['0'];
|
|
10
|
+
export interface ViewerOptions {
|
|
11
|
+
el: HTMLElement;
|
|
12
|
+
rendererOptions?: ViewerRendererOptions;
|
|
13
|
+
}
|
|
14
|
+
export interface ViewerEventMap {
|
|
15
|
+
beforeControlsUpdate: {
|
|
16
|
+
time: number;
|
|
17
|
+
};
|
|
18
|
+
afterControlsUpdate: {
|
|
19
|
+
time: number;
|
|
20
|
+
};
|
|
21
|
+
beforeRender: {
|
|
22
|
+
time: number;
|
|
23
|
+
};
|
|
24
|
+
afterRender: {
|
|
25
|
+
time: number;
|
|
26
|
+
};
|
|
27
|
+
cameraChange: {
|
|
28
|
+
camera: PerspectiveCamera | OrthographicCamera;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
declare class Viewer extends EventDispatcher<ViewerEventMap> {
|
|
32
|
+
el: HTMLElement;
|
|
33
|
+
renderer: WebGPURenderer;
|
|
34
|
+
scene: Scene;
|
|
35
|
+
camera: PerspectiveCamera | OrthographicCamera;
|
|
36
|
+
info: Info;
|
|
37
|
+
controls: CameraControls;
|
|
38
|
+
renderPipeline: RenderPipeline;
|
|
39
|
+
timer: Timer;
|
|
40
|
+
roomEnvironment: RoomEnvironment;
|
|
41
|
+
interactionManager: InteractionManager;
|
|
42
|
+
objectManager: ObjectManager;
|
|
43
|
+
viewerHelper: ViewerHelper;
|
|
44
|
+
frameCount: number;
|
|
45
|
+
frameloop: 'always' | 'demand';
|
|
46
|
+
constructor({ el, rendererOptions }: ViewerOptions);
|
|
47
|
+
onWindowResize: () => void;
|
|
48
|
+
init(): Promise<void>;
|
|
49
|
+
setCamera(camera: PerspectiveCamera | OrthographicCamera): void;
|
|
50
|
+
setCameraByType(type: 'perspective' | 'orthographic'): void;
|
|
51
|
+
render(frame?: number): Promise<void>;
|
|
52
|
+
private animate;
|
|
53
|
+
private _initRenderer;
|
|
54
|
+
createScene(): Scene;
|
|
55
|
+
createPerspectiveCamera(): PerspectiveCamera;
|
|
56
|
+
createOrthographicCamera(): OrthographicCamera;
|
|
57
|
+
dispose(): void;
|
|
58
|
+
}
|
|
59
|
+
export { Viewer };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PassNode } from 'three/webgpu';
|
|
2
|
+
import { ViewHelper as ViewHelperBase } from 'three/addons/helpers/ViewHelper.js';
|
|
3
|
+
import type { Viewer } from './Viewer';
|
|
4
|
+
declare class ViewerHelper extends ViewHelperBase {
|
|
5
|
+
viewer: Viewer;
|
|
6
|
+
overlayPass: PassNode;
|
|
7
|
+
constructor(viewer: Viewer);
|
|
8
|
+
_update: () => void;
|
|
9
|
+
enable(): this;
|
|
10
|
+
disable(): this;
|
|
11
|
+
}
|
|
12
|
+
export { ViewerHelper };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Interactions API
|
|
2
|
+
|
|
3
|
+
The `InteractionManager` provides a unified way to handle user input (mouse, touch, pointer) over 3D scenes. It resolves the raycasting from screen space to world space and dispatches corresponding events directly directly to the intersected 3D objects.
|
|
4
|
+
|
|
5
|
+
The `InteractionManager` is automatically instantiated within the `Viewer` at `viewer.interactionManager`.
|
|
6
|
+
|
|
7
|
+
## Enabling Interaction Events
|
|
8
|
+
|
|
9
|
+
By default, pointer move events might be disabled for performance reasons. You need to enable them if you want hover and drag effects. This should be explicitly set for interactive applications.
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
// Enable events on mouse move (like pointerenter and pointerleave)
|
|
13
|
+
viewer.interactionManager.pointerMoveEventsEnabled = true;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Targeting Objects
|
|
17
|
+
|
|
18
|
+
You can limit which objects the raycaster checks.
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
// Default behavior: checks the entire scene
|
|
22
|
+
viewer.interactionManager.targetObjects = [];
|
|
23
|
+
|
|
24
|
+
// Check only specific objects
|
|
25
|
+
// viewer.interactionManager.targetObjects = [myBox, myModel];
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Adding Event Listeners
|
|
29
|
+
|
|
30
|
+
Because `u-space` objects (and `BaseMesh`, `BaseGroup` by extension) support custom events, you can attach listeners natively just like a DOM element.
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
const myBox = new Mesh(geometry, material);
|
|
34
|
+
viewer.scene.add(myBox);
|
|
35
|
+
|
|
36
|
+
// Example listener attached directly to the 'Mesh' or 'Model'
|
|
37
|
+
myBox.addEventListener('click', (eventData) => {
|
|
38
|
+
// The underlying pointer event and raycast intersection information
|
|
39
|
+
const intersect = eventData.event.intersect;
|
|
40
|
+
|
|
41
|
+
console.log('Clicked at position:', intersect.point);
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Supported Events
|
|
46
|
+
|
|
47
|
+
The following event types can be listened to on interactive objects:
|
|
48
|
+
|
|
49
|
+
- `click`: Fired when the pointer clicks on an object.
|
|
50
|
+
- `dblclick`: Fired when the object is double-clicked rapidly.
|
|
51
|
+
- `pointerdown`: Fired when a pointer button is depressed over an object.
|
|
52
|
+
- `pointerup`: Fired when a pointer button is released, generally following a `pointerdown`.
|
|
53
|
+
- `pointerenter`: Fired when the cursor or pointer enters the boundaries of an object.
|
|
54
|
+
- `pointerleave`: Fired when the cursor or pointer leaves the boundaries of an object.
|
|
55
|
+
|
|
56
|
+
### Event Propagation
|
|
57
|
+
|
|
58
|
+
To stop an event from continuing to pass through the intersection hierarchy (e.g., clicking on a model inside a larger bounding box), you can stop its propagation using the event payload:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
myObject.addEventListener('click', (e) => {
|
|
62
|
+
e.event.stopPropagation();
|
|
63
|
+
});
|
|
64
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Managers API
|
|
2
|
+
|
|
3
|
+
`u-space` utilizes specialized managers for handling specific domain logic, such as `ObjectManager` for caching and registering 3D objects.
|
|
4
|
+
|
|
5
|
+
## ObjectManager
|
|
6
|
+
|
|
7
|
+
The `ObjectManager` provides a centralized dictionary/map layer to easily retrieve complex models or specific meshes by string IDs or string names without having to recursively traverse the Three.js scene graph.
|
|
8
|
+
|
|
9
|
+
The default instance is available via `viewer.objectManager`.
|
|
10
|
+
|
|
11
|
+
### Adding Objects
|
|
12
|
+
|
|
13
|
+
When you add an object to the manager, you must provide a unique identifier.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
const myModel = new Model();
|
|
17
|
+
// ... load logic
|
|
18
|
+
|
|
19
|
+
// Add with a specific unique ID
|
|
20
|
+
viewer.objectManager.add('my-unique-car-id', myModel);
|
|
21
|
+
|
|
22
|
+
// An object can be registered under multiple IDs
|
|
23
|
+
viewer.objectManager.add('player-vehicle', myModel);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Retrieving Objects
|
|
27
|
+
|
|
28
|
+
The manager gives you fast access to your objects.
|
|
29
|
+
|
|
30
|
+
#### `getById(id: string)`
|
|
31
|
+
|
|
32
|
+
Retrieves exactly one object (or `undefined`) matching the specific ID.
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
const car = viewer.objectManager.getById('my-unique-car-id');
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### `getByName(name: string)`
|
|
39
|
+
|
|
40
|
+
Because Three.js objects can share the same `.name` property, this method returns a `Set<Object3D>` encompassing all registered objects that match the requested name.
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// Assuming myModel.name = 'sedan'
|
|
44
|
+
const sedans = viewer.objectManager.getByName('sedan');
|
|
45
|
+
|
|
46
|
+
sedans.forEach((vehicle) => {
|
|
47
|
+
vehicle.position.y += 10;
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Utility Methods
|
|
52
|
+
|
|
53
|
+
- `getAll()`: Returns all tracked objects.
|
|
54
|
+
- `size`: Returns the total number of objects currently tracked by the manager.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Objects API
|
|
2
|
+
|
|
3
|
+
`u-space` provides several object wrappers that make manipulating and loading 3D assets easier, primarily extending Three.js's basic nodes.
|
|
4
|
+
|
|
5
|
+
## Models
|
|
6
|
+
|
|
7
|
+
The `Model` class extends `BaseGroup` (which in turn extends `THREE.Group`) and simplifies the process of asynchronously loading external 3D models like `glb` and `gltf` files. It features built-in support for different caching layers.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Model } from 'u-space';
|
|
11
|
+
|
|
12
|
+
const myModel = new Model();
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Loading Assets
|
|
16
|
+
|
|
17
|
+
The `loadAsync` method handles loading the asset from a URL and adding it to the group.
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
await myModel.loadAsync(options: ModelLoadOptions)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
#### `ModelLoadOptions`
|
|
24
|
+
|
|
25
|
+
| Property | Type | Description |
|
|
26
|
+
| :----------- | :-------- | :------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `url` | `string` | The URL of the `.gltf` or `.glb` file. |
|
|
28
|
+
| `cache` | `boolean` | (Optional) Enables in-memory caching. If a model has been loaded before, it retrieves it instantly from memory. Default `false`. |
|
|
29
|
+
| `persistent` | `boolean` | (Optional) Enables persistent disk-level caching using the browser's Cache API. Good for larger models. Default `false`. |
|
|
30
|
+
|
|
31
|
+
#### Caching Example
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
// Load a model from network and persist it
|
|
35
|
+
const model1 = new Model();
|
|
36
|
+
model1.loadAsync({ url: 'model.glb', persistent: true });
|
|
37
|
+
|
|
38
|
+
// Sometime later, this will load from Cache API
|
|
39
|
+
const model2 = new Model();
|
|
40
|
+
model2.loadAsync({ url: 'model.glb', persistent: true });
|
|
41
|
+
|
|
42
|
+
// This will load from fast Memory Cache
|
|
43
|
+
const model3 = new Model();
|
|
44
|
+
model3.loadAsync({ url: 'model.glb', cache: true, persistent: true });
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Clearing Caches
|
|
48
|
+
|
|
49
|
+
You can manually clear the internal caches using static methods on the `Model` class:
|
|
50
|
+
|
|
51
|
+
- `Model.clearMemoryCache()`: Clears the transient runtime memory cache.
|
|
52
|
+
- `await Model.clearPersistentCache()`: Completely clears the browser's persistent cache for `u-space` models.
|
|
53
|
+
|
|
54
|
+
## Meshes
|
|
55
|
+
|
|
56
|
+
`u-space` offers a variety of streamlined Mesh classes extending `BaseMesh`. These can be used to quickly construct common 3D shapes without needing to supply geometries or materials right away. They also include built-in interaction event dispatching.
|
|
57
|
+
|
|
58
|
+
- `CircleMesh`
|
|
59
|
+
- `ExtrudeMesh`
|
|
60
|
+
- `PlaneMesh`
|
|
61
|
+
- `ShapeMesh`
|
|
62
|
+
- `SphereMesh`
|
|
63
|
+
- `TubeMesh`
|
|
64
|
+
|
|
65
|
+
These are often initialized directly depending on their specific properties (usually extending `THREE.Mesh` parameters and geometries).
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Plugins API
|
|
2
|
+
|
|
3
|
+
`u-space` architecture includes a rich set of plugins for advanced features, ranging from GIS tile loading to keyboard controls and scene management. These are imported from the `u-space/plugins/*` namespace.
|
|
4
|
+
|
|
5
|
+
## Available Plugins
|
|
6
|
+
|
|
7
|
+
### `keyboard-controls`
|
|
8
|
+
|
|
9
|
+
Provides WASD or directional arrow-key translation and rotation for the active camera.
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { KeyboardControls, ACTION } from 'u-space/plugins/keyboard-controls';
|
|
13
|
+
|
|
14
|
+
const keyboardControls = new KeyboardControls(viewer);
|
|
15
|
+
|
|
16
|
+
// Optional: Customize movement speeds
|
|
17
|
+
// keyboardControls.moveDistanceDelta = 2;
|
|
18
|
+
// keyboardControls.rotateAngleDelta = (Math.PI / 180) * 2;
|
|
19
|
+
|
|
20
|
+
// Activate the listeners
|
|
21
|
+
keyboardControls.enable();
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### `minimap`
|
|
25
|
+
|
|
26
|
+
Generates a customizable 2D minimap tracking a specific target object within the 3D scene.
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { Minimap } from 'u-space/plugins/minimap';
|
|
30
|
+
|
|
31
|
+
const minimap = new Minimap(viewer);
|
|
32
|
+
minimap.target = myCharacterModel;
|
|
33
|
+
minimap.setSize(600, 200);
|
|
34
|
+
|
|
35
|
+
// Style the underlying minimap scene
|
|
36
|
+
minimap.scene.background = new THREE.Color(0xffffff);
|
|
37
|
+
|
|
38
|
+
minimap.enable();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### `tiles`
|
|
42
|
+
|
|
43
|
+
Provides integration with `3d-tiles-renderer` and geospatial data (like ArcGIS).
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { ArcgisTilesRenderer } from 'u-space/plugins/tiles';
|
|
47
|
+
|
|
48
|
+
const arcgisTilesRenderer = new ArcgisTilesRenderer(viewer);
|
|
49
|
+
|
|
50
|
+
// Pass longitude, latitude, and zoom level
|
|
51
|
+
arcgisTilesRenderer.invalidate(120.002269, 30.284849, 4);
|
|
52
|
+
arcgisTilesRenderer.enable();
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### `u-manager`
|
|
56
|
+
|
|
57
|
+
`u-manager` is a comprehensive suite of tools for loading, parsing, and managing complex scene scenarios, properties, visons (camera viewpoints), and animations.
|
|
58
|
+
|
|
59
|
+
#### Loaders
|
|
60
|
+
|
|
61
|
+
`u-manager` provides loaders to stream various structured data from a defined base path.
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { SceneLoader, TopologiesLoader } from 'u-space/plugins/u-manager';
|
|
65
|
+
|
|
66
|
+
// Topology loader for multiple models
|
|
67
|
+
const topologiesLoader = new TopologiesLoader();
|
|
68
|
+
topologiesLoader.setPath('./scenes/my-scene');
|
|
69
|
+
const topologies = await topologiesLoader.loadAsync();
|
|
70
|
+
viewer.scene.add(...topologies);
|
|
71
|
+
|
|
72
|
+
// Comprehensive Scene loader
|
|
73
|
+
const sceneLoader = new SceneLoader(viewer);
|
|
74
|
+
sceneLoader.setPath('./scenes/my-scene');
|
|
75
|
+
const group = await sceneLoader.loadAsync();
|
|
76
|
+
viewer.scene.add(group);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Parsers
|
|
80
|
+
|
|
81
|
+
Parsers take the data retrieved by Loaders and execute specific logic in the viewport.
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
import { VisionsLoader, VisionsParser } from 'u-space/plugins/u-manager';
|
|
85
|
+
|
|
86
|
+
// Load viewpoints
|
|
87
|
+
const visionsLoader = new VisionsLoader(viewer);
|
|
88
|
+
visionsLoader.setPath('./scenes/my-scene');
|
|
89
|
+
const visions = await visionsLoader.loadAsync();
|
|
90
|
+
|
|
91
|
+
// Parse and execute camera movement
|
|
92
|
+
const visionsParser = new VisionsParser(viewer);
|
|
93
|
+
// Assuming the loader returned an array of states for key 'HOME'
|
|
94
|
+
await visionsParser.flyTo(visions['HOME'][0]);
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Other Plugins
|
|
98
|
+
|
|
99
|
+
The plugins directory also includes:
|
|
100
|
+
|
|
101
|
+
- `atmosphere`: For sky rendering.
|
|
102
|
+
- `curve-movement`: For animating objects along predefined paths or splines.
|
|
103
|
+
- `tracking-controls`: Specialized controls for observing moving targets.
|