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,5 @@
|
|
|
1
|
+
import type { ILicense, ITreeData } from '../types';
|
|
2
|
+
export declare function decryptWithDebugKey(license: ILicense): ITreeData[];
|
|
3
|
+
export declare function decryptWithKey(license: ILicense, key: string): ITreeData[];
|
|
4
|
+
export declare function decodeToBytes(input: string): Int8Array<ArrayBuffer>;
|
|
5
|
+
export declare function decodeString(encodedStr: string): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { EventDispatcher, Loader, type Object3D } from 'three/webgpu';
|
|
2
|
+
import { type AnimationModeType, type Tween, type Viewer } from 'u-space';
|
|
3
|
+
export declare class AnimationsLoader extends Loader {
|
|
4
|
+
constructor();
|
|
5
|
+
loadAsync(): Promise<IAnimations[]>;
|
|
6
|
+
}
|
|
7
|
+
export interface IKeyframe {
|
|
8
|
+
id: string;
|
|
9
|
+
uuid: string;
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z: number;
|
|
13
|
+
scaleX: number;
|
|
14
|
+
scaleY: number;
|
|
15
|
+
scaleZ: number;
|
|
16
|
+
rotationX: number;
|
|
17
|
+
rotationY: number;
|
|
18
|
+
rotationZ: number;
|
|
19
|
+
easing: AnimationModeType;
|
|
20
|
+
mode: string;
|
|
21
|
+
delay: number;
|
|
22
|
+
duration: number;
|
|
23
|
+
repeat: number;
|
|
24
|
+
yoyo: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 动画
|
|
28
|
+
*/
|
|
29
|
+
export interface IAnimations {
|
|
30
|
+
id: string;
|
|
31
|
+
sid: string;
|
|
32
|
+
modelId: string;
|
|
33
|
+
name: string;
|
|
34
|
+
keyframes: IKeyframe[];
|
|
35
|
+
}
|
|
36
|
+
export declare class AnimationsParser extends EventDispatcher<TAnimationsPlayerEventMap> {
|
|
37
|
+
viewer: Viewer;
|
|
38
|
+
target: Object3D;
|
|
39
|
+
tweenSet: Set<TTweenType>;
|
|
40
|
+
_initialTransformSymbol: symbol;
|
|
41
|
+
constructor(viewer: Viewer, target: Object3D);
|
|
42
|
+
initTransform(defaultTransform?: TTweenSource): TTweenSource;
|
|
43
|
+
getInitialTransform(): TTweenSource | undefined;
|
|
44
|
+
play(frames: IKeyframe[]): Promise<void>;
|
|
45
|
+
stop(): void;
|
|
46
|
+
reset(): void;
|
|
47
|
+
dispose(): void;
|
|
48
|
+
}
|
|
49
|
+
export type TTweenSource = Pick<IKeyframe, 'x' | 'y' | 'z' | 'rotationX' | 'rotationY' | 'rotationZ' | 'scaleX' | 'scaleY' | 'scaleZ'>;
|
|
50
|
+
export type TTweenType = Tween<TTweenSource>;
|
|
51
|
+
export type TAnimationsPlayerEventMap = {
|
|
52
|
+
update: {
|
|
53
|
+
source: TTweenSource;
|
|
54
|
+
tween: TTweenType;
|
|
55
|
+
};
|
|
56
|
+
start: {
|
|
57
|
+
tween: TTweenType;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Loader } from 'three/webgpu';
|
|
2
|
+
export declare class PropertiesLoader extends Loader {
|
|
3
|
+
constructor();
|
|
4
|
+
loadAsync(): Promise<IProperties[]>;
|
|
5
|
+
}
|
|
6
|
+
export interface IProperties {
|
|
7
|
+
modelId: string;
|
|
8
|
+
group: string;
|
|
9
|
+
key: string;
|
|
10
|
+
value: string | null;
|
|
11
|
+
label: string | null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Group, Loader } from 'three/webgpu';
|
|
2
|
+
import { type Viewer } from 'u-space';
|
|
3
|
+
export interface SceneLoaderOptions {
|
|
4
|
+
}
|
|
5
|
+
export declare class SceneLoader extends Loader<unknown, SceneLoaderOptions> {
|
|
6
|
+
#private;
|
|
7
|
+
viewer: Viewer;
|
|
8
|
+
key: string;
|
|
9
|
+
cachedIds: Set<string>;
|
|
10
|
+
constructor(viewer: Viewer);
|
|
11
|
+
setKey(key: string): this;
|
|
12
|
+
loadAsync(options?: SceneLoaderOptions): Promise<Group<import("three").Object3DEventMap>>;
|
|
13
|
+
clearCache(): void;
|
|
14
|
+
dispose(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Loader } from 'three/webgpu';
|
|
2
|
+
import { Topology } from 'u-space';
|
|
3
|
+
import type { ITopologyPath } from '../types';
|
|
4
|
+
export declare class TopologyParser {
|
|
5
|
+
parse(data: ITopologyPath): Topology;
|
|
6
|
+
}
|
|
7
|
+
export declare class TopologiesLoader extends Loader {
|
|
8
|
+
constructor();
|
|
9
|
+
loadAsync(): Promise<Topology[]>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Loader } from 'three/webgpu';
|
|
2
|
+
import type { IVector3, Viewer } from 'u-space';
|
|
3
|
+
export declare class VisionsLoader extends Loader {
|
|
4
|
+
constructor();
|
|
5
|
+
loadAsync(): Promise<IVisionsData>;
|
|
6
|
+
}
|
|
7
|
+
export declare class VisionsParser {
|
|
8
|
+
viewer: Viewer;
|
|
9
|
+
constructor(viewer: Viewer);
|
|
10
|
+
flyToPrimary(visions: IVisions[], enableTransition?: boolean): Promise<boolean>;
|
|
11
|
+
flyTo(vision: IVisions, enableTransition?: boolean): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export interface IVisions {
|
|
14
|
+
id: string;
|
|
15
|
+
uuid: string;
|
|
16
|
+
nodeId: string;
|
|
17
|
+
name: string;
|
|
18
|
+
code?: any;
|
|
19
|
+
camera: 'O' | 'P';
|
|
20
|
+
position: IVector3;
|
|
21
|
+
rotation: IVector3;
|
|
22
|
+
target: IVector3;
|
|
23
|
+
zoom: number;
|
|
24
|
+
primary: boolean;
|
|
25
|
+
}
|
|
26
|
+
export type IVisionsData = Record<string, IVisions[]>;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type IVector3 } from 'u-space';
|
|
2
|
+
export interface IMetadata {
|
|
3
|
+
platformVersion: number;
|
|
4
|
+
version: number;
|
|
5
|
+
name: string;
|
|
6
|
+
projectId: string;
|
|
7
|
+
sceneId: string;
|
|
8
|
+
cover: string | null;
|
|
9
|
+
flatModel: string;
|
|
10
|
+
treeModel: string;
|
|
11
|
+
resource: string;
|
|
12
|
+
exportTime: number;
|
|
13
|
+
authority: 'TRIAL' | 'OFFICIAL';
|
|
14
|
+
encryptWith: 'DEBUG' | 'SCENE' | 'COMPANY' | null;
|
|
15
|
+
environment: string | null;
|
|
16
|
+
previewSettings: string | null;
|
|
17
|
+
gisSettings: IGisSettings | null;
|
|
18
|
+
}
|
|
19
|
+
export interface IGisSettings {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
longitude: number;
|
|
22
|
+
latitude: number;
|
|
23
|
+
altitude: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ITreeData {
|
|
26
|
+
id: string;
|
|
27
|
+
pid: string | null;
|
|
28
|
+
sid: string;
|
|
29
|
+
name: string;
|
|
30
|
+
path: string | null;
|
|
31
|
+
renderType: 'GROUP' | '3D' | 'STUB' | 'POLYGON' | 'CIRCLE' | 'WATER_SURFACE' | 'DECAL' | 'AREA' | 'FLOOR' | 'ROOM' | 'GS';
|
|
32
|
+
deviceCode: string | null;
|
|
33
|
+
matrix: number[];
|
|
34
|
+
familyId: string | null;
|
|
35
|
+
children: ITreeData[];
|
|
36
|
+
visible: boolean;
|
|
37
|
+
shape?: {
|
|
38
|
+
height?: number;
|
|
39
|
+
radius?: number;
|
|
40
|
+
depth?: number;
|
|
41
|
+
points?: IVector3[];
|
|
42
|
+
};
|
|
43
|
+
boundingBox?: number[];
|
|
44
|
+
extra?: {
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export interface ILicense {
|
|
49
|
+
sign: string;
|
|
50
|
+
content: string;
|
|
51
|
+
version: number;
|
|
52
|
+
}
|
|
53
|
+
export interface ITopologyPath {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
position: IVector3;
|
|
57
|
+
rotation: IVector3;
|
|
58
|
+
scale: IVector3;
|
|
59
|
+
nodes: ITopologyNode[];
|
|
60
|
+
type: 'network';
|
|
61
|
+
linkWidth?: number;
|
|
62
|
+
linkColor?: [string];
|
|
63
|
+
nodeRadius?: number;
|
|
64
|
+
nodeColor?: string;
|
|
65
|
+
imgUrl?: string;
|
|
66
|
+
animation?: {
|
|
67
|
+
duration: 0;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export interface ITopologyNode {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
position: IVector3;
|
|
74
|
+
graphs: ITopologyNodeGraph[];
|
|
75
|
+
}
|
|
76
|
+
export interface ITopologyNodeGraph {
|
|
77
|
+
linkInfo: ITopologyEdge;
|
|
78
|
+
targetNodeId: string;
|
|
79
|
+
passable: 0 | 1 | 2 | 3;
|
|
80
|
+
}
|
|
81
|
+
export interface ITopologyEdge {
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Tween as TweenBase } from 'three/addons/libs/tween.module.js';
|
|
2
|
+
import type { Viewer, ViewerEventMap } from '../viewers';
|
|
3
|
+
declare class Tween<PropType extends Record<string, any>> extends TweenBase<PropType> {
|
|
4
|
+
viewer: Viewer;
|
|
5
|
+
constructor(viewer: Viewer, source: PropType);
|
|
6
|
+
_update: ({ time }: ViewerEventMap["afterControlsUpdate"]) => void;
|
|
7
|
+
easingByMode(mode: AnimationModeType): this;
|
|
8
|
+
start(time?: number, overrideStartingValues?: boolean): this;
|
|
9
|
+
stop(): this;
|
|
10
|
+
}
|
|
11
|
+
declare function tweenAnimation<PropType extends Record<string, any>>(viewer: Viewer, source: PropType, target: PropType, options?: AnimationOptions, onUpdate?: (source: PropType, tween: Tween<PropType>) => void, onStart?: (tween: Tween<PropType>) => void): Promise<void>;
|
|
12
|
+
export { Tween, tweenAnimation };
|
|
13
|
+
export type AnimationModeType = 'Linear.None' | 'Quadratic.In' | 'Quadratic.Out' | 'Quadratic.InOut' | 'Cubic.In' | 'Cubic.Out' | 'Cubic.InOut' | 'Quartic.In' | 'Quartic.Out' | 'Quartic.InOut' | 'Quintic.In' | 'Quintic.Out' | 'Quintic.InOut' | 'Sinusoidal.In' | 'Sinusoidal.Out' | 'Sinusoidal.InOut' | 'Exponential.In' | 'Exponential.Out' | 'Exponential.InOut' | 'Circular.In' | 'Circular.Out' | 'Circular.InOut' | 'Elastic.In' | 'Elastic.Out' | 'Elastic.InOut' | 'Back.In' | 'Back.Out' | 'Back.InOut' | 'Bounce.In' | 'Bounce.Out' | 'Bounce.InOut';
|
|
14
|
+
export interface AnimationOptions {
|
|
15
|
+
duration?: number;
|
|
16
|
+
delay?: number;
|
|
17
|
+
repeat?: number | boolean;
|
|
18
|
+
mode?: AnimationModeType;
|
|
19
|
+
yoyo?: boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tween';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Object3D, type ColorRepresentation } from 'three/webgpu';
|
|
2
|
+
export interface HighlightOptions {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
opacity?: number;
|
|
5
|
+
color?: ColorRepresentation;
|
|
6
|
+
overwrite?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class MaterialEffects {
|
|
9
|
+
static highlight(object: Object3D, options?: HighlightOptions): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ColorRepresentation } from 'three';
|
|
2
|
+
export declare class TSLEffects {
|
|
3
|
+
static flow(parameters?: {
|
|
4
|
+
baseColor?: ColorRepresentation;
|
|
5
|
+
flowColor?: ColorRepresentation;
|
|
6
|
+
speed?: number;
|
|
7
|
+
scale?: number;
|
|
8
|
+
intensity?: number;
|
|
9
|
+
}): import("three/webgpu").Node<"vec3">;
|
|
10
|
+
static breathe(parameters?: {
|
|
11
|
+
baseColor?: ColorRepresentation;
|
|
12
|
+
breathColor?: ColorRepresentation;
|
|
13
|
+
speed?: number;
|
|
14
|
+
intensity?: number;
|
|
15
|
+
}): import("three/webgpu").Node<"vec3">;
|
|
16
|
+
static fluid(parameters?: {
|
|
17
|
+
baseColor?: ColorRepresentation;
|
|
18
|
+
flowColor?: ColorRepresentation;
|
|
19
|
+
speed?: number;
|
|
20
|
+
scale?: number;
|
|
21
|
+
intensity?: number;
|
|
22
|
+
distortion?: number;
|
|
23
|
+
}): import("three/webgpu").Node<"vec3">;
|
|
24
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './viewers';
|
|
2
|
+
export * from './loaders';
|
|
3
|
+
export * from './interactions';
|
|
4
|
+
export * from './managers';
|
|
5
|
+
export * from './objects';
|
|
6
|
+
export * from './effects';
|
|
7
|
+
export * from './animations';
|
|
8
|
+
export * from './interfaces';
|
|
9
|
+
export * from './types';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Object3D, Intersection, Object3DEventMap } from 'three/webgpu';
|
|
2
|
+
export type InteractionEventType = 'click' | 'dblclick' | 'contextmenu' | 'pointerdown' | 'pointerup' | 'pointermove' | 'pointerenter' | 'pointerleave';
|
|
3
|
+
export interface InteractionEventParameters {
|
|
4
|
+
type: InteractionEventType;
|
|
5
|
+
target: Object3D<InteractionEventMap>;
|
|
6
|
+
intersect: Intersection<Object3D<InteractionEventMap>> | null;
|
|
7
|
+
originalEvent: PointerEvent | MouseEvent;
|
|
8
|
+
}
|
|
9
|
+
export type InteractionEventMap = Object3DEventMap & {
|
|
10
|
+
[K in InteractionEventType]: {
|
|
11
|
+
event: InteractionEvent;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Custom event class for 3D object interactions.
|
|
16
|
+
* Supports event bubbling via `stopPropagation()`.
|
|
17
|
+
*/
|
|
18
|
+
export declare class InteractionEvent {
|
|
19
|
+
/** The type of event (e.g., 'click', 'pointerdown'). */
|
|
20
|
+
readonly type: InteractionEventType;
|
|
21
|
+
/** The original 3D object that triggered the event. */
|
|
22
|
+
readonly target: Object3D<InteractionEventMap>;
|
|
23
|
+
/** The current 3D object during the bubbling phase. */
|
|
24
|
+
currentTarget: Object3D<InteractionEventMap>;
|
|
25
|
+
/** The intersection data from raycasting, or null if not applicable. */
|
|
26
|
+
readonly intersect: Intersection | null;
|
|
27
|
+
/** The original DOM event, or undefined if not applicable. */
|
|
28
|
+
readonly originalEvent: PointerEvent | MouseEvent;
|
|
29
|
+
private _propagationStopped;
|
|
30
|
+
constructor(init: InteractionEventParameters);
|
|
31
|
+
/**
|
|
32
|
+
* Stops the event from bubbling up the parent chain.
|
|
33
|
+
*/
|
|
34
|
+
stopPropagation(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Returns true if `stopPropagation()` has been called.
|
|
37
|
+
*/
|
|
38
|
+
get propagationStopped(): boolean;
|
|
39
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type Object3D, type Scene, type Camera } from 'three/webgpu';
|
|
2
|
+
import { type InteractionEventMap } from './InteractionEvent';
|
|
3
|
+
/**
|
|
4
|
+
* Manages pointer interactions with 3D objects in the scene.
|
|
5
|
+
* Handles raycasting and event dispatching with bubbling support.
|
|
6
|
+
*/
|
|
7
|
+
export declare class InteractionManager {
|
|
8
|
+
private domElement;
|
|
9
|
+
private scene;
|
|
10
|
+
private camera;
|
|
11
|
+
private raycaster;
|
|
12
|
+
private pointer;
|
|
13
|
+
private hoveredObject;
|
|
14
|
+
private pointerDownTime;
|
|
15
|
+
private pointerDownPos;
|
|
16
|
+
private clickTimer;
|
|
17
|
+
private longPressThreshold;
|
|
18
|
+
private moveThreshold;
|
|
19
|
+
/**
|
|
20
|
+
* The objects to check for intersections.
|
|
21
|
+
* If not set, it defaults to the children of the scene.
|
|
22
|
+
*/
|
|
23
|
+
targetObjects: Object3D<InteractionEventMap>[] | null;
|
|
24
|
+
/**
|
|
25
|
+
* Whether to enable pointer move events (pointermove, pointerenter, pointerleave).
|
|
26
|
+
* Disabled by default for performance optimization.
|
|
27
|
+
*/
|
|
28
|
+
pointerMoveEventsEnabled: boolean;
|
|
29
|
+
constructor(domElement: HTMLElement, scene: Scene, camera: Camera);
|
|
30
|
+
/**
|
|
31
|
+
* Updates the camera reference (useful when switching cameras).
|
|
32
|
+
*/
|
|
33
|
+
setCamera(camera: Camera): void;
|
|
34
|
+
private _bindEvents;
|
|
35
|
+
private _updatePointer;
|
|
36
|
+
private _getIntersects;
|
|
37
|
+
/**
|
|
38
|
+
* Dispatches an event to the target object and bubbles up the parent chain.
|
|
39
|
+
*/
|
|
40
|
+
private _dispatchToTarget;
|
|
41
|
+
/**
|
|
42
|
+
* Handles a DOM event by raycasting and dispatching to the first intersected object.
|
|
43
|
+
*/
|
|
44
|
+
private _handleEvent;
|
|
45
|
+
private _onClick;
|
|
46
|
+
private _onDblClick;
|
|
47
|
+
private _onContextMenu;
|
|
48
|
+
private _onPointerDown;
|
|
49
|
+
private _onPointerUp;
|
|
50
|
+
private _onPointerMove;
|
|
51
|
+
/**
|
|
52
|
+
* Cleans up event listeners.
|
|
53
|
+
*/
|
|
54
|
+
dispose(): void;
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './base';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { FileLoader, type Object3D, type WebGPURenderer, type LoadingManager } from 'three/webgpu';
|
|
2
|
+
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
|
3
|
+
import { FBXLoader } from 'three/addons/loaders/FBXLoader.js';
|
|
4
|
+
import { OBJLoader } from 'three/addons/loaders/OBJLoader.js';
|
|
5
|
+
import { STLLoader } from 'three/addons/loaders/STLLoader.js';
|
|
6
|
+
import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js';
|
|
7
|
+
import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
|
|
8
|
+
import { SBMXLoader } from './SBMXLoader';
|
|
9
|
+
import { SBMLoader } from './SBMLoader';
|
|
10
|
+
import type { InteractionEventMap } from '../interactions';
|
|
11
|
+
export interface LoadParameters {
|
|
12
|
+
persistent?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class ModelLoaderManager {
|
|
15
|
+
private static CACHE_NAME;
|
|
16
|
+
static fileLoader: FileLoader;
|
|
17
|
+
static dracoLoader: DRACOLoader;
|
|
18
|
+
static ktx2Loader: KTX2Loader;
|
|
19
|
+
static gltfLoader: GLTFLoader;
|
|
20
|
+
static sbmxLoader: SBMXLoader;
|
|
21
|
+
static sbmLoader: SBMLoader;
|
|
22
|
+
static fbxLoader: FBXLoader;
|
|
23
|
+
static objLoader: OBJLoader;
|
|
24
|
+
static stlLoader: STLLoader;
|
|
25
|
+
static setLoadingManager(loadingManager: LoadingManager): void;
|
|
26
|
+
/**
|
|
27
|
+
* Set the renderer to enable KTX2 support and other renderer-dependent features.
|
|
28
|
+
*/
|
|
29
|
+
static setRenderer(renderer: WebGPURenderer): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Configure Draco decoder path.
|
|
32
|
+
*/
|
|
33
|
+
static setDracoPath(path: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Configure KTX2 transcoder path.
|
|
36
|
+
*/
|
|
37
|
+
static setKTX2Path(path: string): void;
|
|
38
|
+
static loadAsync(url: string, parameters?: LoadParameters): Promise<Object3D<InteractionEventMap>>;
|
|
39
|
+
private static getPersistentData;
|
|
40
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Group, Loader } from 'three/webgpu';
|
|
2
|
+
export declare class SBMLoader extends Loader<Group, string> {
|
|
3
|
+
load(url: string, onLoad: (sbm: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (err: unknown) => void): void;
|
|
4
|
+
parse(data: ArrayBuffer, path: string, onLoad: (sbm: Group) => void, onError?: (err: unknown) => void): void;
|
|
5
|
+
parseAsync(data: ArrayBuffer | string, path: string): Promise<Group>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MeshStandardNodeMaterial } from 'three/webgpu';
|
|
2
|
+
export declare function decodeSbk(buffer: ArrayBuffer): ArrayBuffer | undefined;
|
|
3
|
+
export declare const getTextureName: (dataView: DataView, texnamelen: number, offset: number) => string;
|
|
4
|
+
export declare const generateSbmMaterial: (materialId: string, arr: number[], png: boolean) => MeshStandardNodeMaterial;
|
|
5
|
+
export declare const isPNG: (textureUrl?: string) => boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LoadingManager } from 'three/webgpu';
|
|
2
|
+
import { GLTFLoader, type GLTF } from 'three/addons/loaders/GLTFLoader.js';
|
|
3
|
+
export declare class SBMXLoader extends GLTFLoader {
|
|
4
|
+
constructor(manager?: LoadingManager);
|
|
5
|
+
parse(data: ArrayBuffer, path: string, onLoad: (gltf: GLTF) => void, onError?: (event: ErrorEvent) => void): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TextureLoader, CubeTextureLoader, type LoadingManager } from 'three/webgpu';
|
|
2
|
+
import { HDRLoader } from 'three/addons/loaders/HDRLoader.js';
|
|
3
|
+
export declare class TextureLoaderManager {
|
|
4
|
+
static textureLoader: TextureLoader;
|
|
5
|
+
static hdrLoader: HDRLoader;
|
|
6
|
+
static cubeTextureLoader: CubeTextureLoader;
|
|
7
|
+
static setLoadingManager(loadingManager: LoadingManager): void;
|
|
8
|
+
static loadAsyncTexture(url: string): Promise<import("three").Texture<HTMLImageElement>>;
|
|
9
|
+
static loadAsyncHDR(url: string): Promise<import("three").DataTexture>;
|
|
10
|
+
static loadAsyncCubeTexture(path: string, urls: string[]): Promise<import("three").CubeTexture<unknown>>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Object3D } from 'three/webgpu';
|
|
2
|
+
/**
|
|
3
|
+
* Manages 3D objects with custom id and name caching for quick retrieval.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ObjectManager {
|
|
6
|
+
private idMap;
|
|
7
|
+
private nameMap;
|
|
8
|
+
private typeMap;
|
|
9
|
+
private objectIds;
|
|
10
|
+
private allObjects;
|
|
11
|
+
/**
|
|
12
|
+
* Add an object with a custom id.
|
|
13
|
+
* One object can have multiple ids.
|
|
14
|
+
*/
|
|
15
|
+
add(id: string, object: Object3D): void;
|
|
16
|
+
/**
|
|
17
|
+
* Get an object by its custom id.
|
|
18
|
+
*/
|
|
19
|
+
getById<T extends Object3D>(id: string): T | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Get all objects with a given name.
|
|
22
|
+
*/
|
|
23
|
+
getByName<T extends Object3D>(name: string): Set<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Get all objects with a given type.
|
|
26
|
+
*/
|
|
27
|
+
getByType<T extends Object3D>(type: string): Set<T>;
|
|
28
|
+
/**
|
|
29
|
+
* Get all ids associated with an object.
|
|
30
|
+
*/
|
|
31
|
+
getObjectIds(object: Object3D): Set<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Remove an object and all its associated ids.
|
|
34
|
+
*/
|
|
35
|
+
remove(object: Object3D): void;
|
|
36
|
+
/**
|
|
37
|
+
* Remove an object by its id.
|
|
38
|
+
*/
|
|
39
|
+
removeById(id: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Remove all objects with a given name.
|
|
42
|
+
*/
|
|
43
|
+
removeByName(name: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Remove all objects with a given type.
|
|
46
|
+
*/
|
|
47
|
+
removeByType(type: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Clear all cached objects.
|
|
50
|
+
*/
|
|
51
|
+
clear(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Get all cached objects as a Set.
|
|
54
|
+
*/
|
|
55
|
+
getAll<T extends Object3D>(): Set<T>;
|
|
56
|
+
/**
|
|
57
|
+
* Get the number of unique cached objects.
|
|
58
|
+
*/
|
|
59
|
+
get size(): number;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ObjectManager';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Raycaster, type Intersection, type Object3DEventMap, Group } from 'three/webgpu';
|
|
2
|
+
export declare class BaseGroup<TEventMap extends Object3DEventMap = Object3DEventMap> extends Group<TEventMap> {
|
|
3
|
+
readonly isBaseGroup = true;
|
|
4
|
+
type: string;
|
|
5
|
+
ignoreInvisibleWhenRaycast: boolean;
|
|
6
|
+
constructor(...args: ConstructorParameters<typeof Group<TEventMap>>);
|
|
7
|
+
raycast(raycaster: Raycaster, intersects: Intersection[]): boolean | void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type BufferGeometry, type Intersection, type Material, type Object3DEventMap, type Raycaster, Mesh } from 'three/webgpu';
|
|
2
|
+
export declare class BaseMesh<TGeometry extends BufferGeometry = BufferGeometry, TMaterial extends Material | Material[] = Material | Material[], TEventMap extends Object3DEventMap = Object3DEventMap> extends Mesh<TGeometry, TMaterial, TEventMap> {
|
|
3
|
+
readonly isBaseMesh = true;
|
|
4
|
+
type: string;
|
|
5
|
+
ignoreInvisibleWhenRaycast: boolean;
|
|
6
|
+
constructor(...args: ConstructorParameters<typeof Mesh<TGeometry, TMaterial, TEventMap>>);
|
|
7
|
+
raycast(raycaster: Raycaster, intersects: Intersection[]): boolean | void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Raycaster, type Intersection, type Object3DEventMap, Sprite } from 'three/webgpu';
|
|
2
|
+
export declare class BaseSprite<TEventMap extends Object3DEventMap = Object3DEventMap> extends Sprite<TEventMap> {
|
|
3
|
+
readonly isBaseSprite = true;
|
|
4
|
+
type: string;
|
|
5
|
+
ignoreInvisibleWhenRaycast: boolean;
|
|
6
|
+
constructor(...args: ConstructorParameters<typeof Sprite<TEventMap>>);
|
|
7
|
+
raycast(raycaster: Raycaster, intersects: Intersection[]): boolean | void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CircleGeometry, MeshStandardNodeMaterial, type MeshStandardNodeMaterialParameters } from 'three/webgpu';
|
|
2
|
+
import type { InteractionEventMap } from '../interactions';
|
|
3
|
+
import { BaseMesh } from './BaseMesh';
|
|
4
|
+
export interface CircleMeshParameters {
|
|
5
|
+
geometryParameters?: {
|
|
6
|
+
radius?: number;
|
|
7
|
+
segments?: number;
|
|
8
|
+
thetaStart?: number;
|
|
9
|
+
thetaLength?: number;
|
|
10
|
+
};
|
|
11
|
+
materialParameters?: MeshStandardNodeMaterialParameters;
|
|
12
|
+
}
|
|
13
|
+
export declare class CircleMesh extends BaseMesh<CircleGeometry, MeshStandardNodeMaterial, InteractionEventMap> {
|
|
14
|
+
readonly isCircleMesh = true;
|
|
15
|
+
type: string;
|
|
16
|
+
constructor({ geometryParameters, materialParameters }?: CircleMeshParameters);
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ExtrudeGeometry, MeshStandardNodeMaterial, Shape, type ExtrudeGeometryOptions, 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 ExtrudeMeshParameters {
|
|
6
|
+
geometryParameters?: {
|
|
7
|
+
shape?: Shape | Shape[];
|
|
8
|
+
options?: ExtrudeGeometryOptions;
|
|
9
|
+
};
|
|
10
|
+
materialParameters?: MeshStandardNodeMaterialParameters;
|
|
11
|
+
}
|
|
12
|
+
export declare class ExtrudeMesh extends BaseMesh<ExtrudeGeometry, MeshStandardNodeMaterial, InteractionEventMap> {
|
|
13
|
+
readonly isExtrudeMesh = true;
|
|
14
|
+
type: string;
|
|
15
|
+
constructor({ geometryParameters, materialParameters }?: ExtrudeMeshParameters);
|
|
16
|
+
static createFromPoints(points: IPlaneVector2[], parameters?: ExtrudeMeshParameters): ExtrudeMesh;
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Object3D } from 'three/webgpu';
|
|
2
|
+
import { type InteractionEventMap } from '../interactions';
|
|
3
|
+
import { BaseGroup } from './BaseGroup';
|
|
4
|
+
export interface ModelParameters {
|
|
5
|
+
url: string;
|
|
6
|
+
cache?: boolean;
|
|
7
|
+
persistent?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class Model extends BaseGroup<InteractionEventMap> {
|
|
10
|
+
readonly isModel = true;
|
|
11
|
+
type: string;
|
|
12
|
+
private static memoryCache;
|
|
13
|
+
constructor();
|
|
14
|
+
loadAsync(parameters: ModelParameters): Promise<Object3D<import("three").Object3DEventMap> | null>;
|
|
15
|
+
static clearMemoryCache(): void;
|
|
16
|
+
static clearPersistentCache(): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Object3D, type Object3DEventMap, type Material, type BufferGeometry, Mesh } from 'three/webgpu';
|
|
2
|
+
export declare class ObjectUtils {
|
|
3
|
+
static traverseMeshes<TGeometry extends BufferGeometry, TMaterial extends Material, TEventMap extends Object3DEventMap>(object: Object3D, callback: (object: Mesh<TGeometry, TMaterial, TEventMap>) => void): void;
|
|
4
|
+
}
|