u-space 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +16 -1
- package/dist/index.js +1578 -534
- package/dist/src/effects/MaterialEffects.d.ts +23 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/interactions/InteractionManager.d.ts +31 -0
- package/dist/src/interactions/Selection.d.ts +77 -0
- package/dist/src/interactions/index.d.ts +1 -0
- package/dist/src/managers/LightManager.d.ts +101 -0
- package/dist/src/managers/ObjectManager.d.ts +33 -1
- package/dist/src/managers/SceneManager.d.ts +57 -0
- package/dist/src/managers/index.d.ts +2 -0
- package/dist/src/objects/Model.d.ts +13 -1
- package/dist/src/tools/AnnotationManager.d.ts +104 -0
- package/dist/src/tools/ClippingTool.d.ts +96 -0
- package/dist/src/tools/MeasureTool.d.ts +80 -0
- package/dist/src/tools/index.d.ts +3 -0
- package/dist/src/viewers/CameraControls.d.ts +23 -0
- package/dist/src/viewers/Viewer.d.ts +52 -1
- package/docs/api-camera-controls.md +146 -0
- package/docs/api-effects.md +47 -5
- package/docs/api-interactions.md +107 -7
- package/docs/api-managers.md +181 -0
- package/docs/api-objects.md +46 -13
- package/docs/api-plugin-atmosphere.md +10 -0
- package/docs/api-plugin-curve-movement.md +38 -0
- package/docs/api-plugin-keyboard-controls.md +40 -0
- package/docs/api-plugin-minimap.md +36 -0
- package/docs/api-plugin-object-controls.md +67 -0
- package/docs/api-plugin-tiles.md +26 -0
- package/docs/api-plugin-topology-drawer.md +74 -0
- package/docs/api-plugin-tracking-controls.md +23 -0
- package/docs/api-plugin-u-manager.md +123 -0
- package/docs/api-tools.md +254 -0
- package/docs/api-viewer.md +85 -19
- package/docs/changelog.md +105 -0
- package/docs/examples-guide.md +104 -0
- package/docs/getting-started.md +1 -1
- package/docs/index.md +14 -12
- package/package.json +1 -1
- package/docs/api-plugins.md +0 -449
|
@@ -3,15 +3,38 @@ export interface HighlightColorOptions {
|
|
|
3
3
|
opacity?: number;
|
|
4
4
|
color?: ColorRepresentation;
|
|
5
5
|
overwrite?: boolean;
|
|
6
|
+
depthWrite?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface BreatheColorOptions {
|
|
8
9
|
color?: ColorRepresentation;
|
|
9
10
|
speed?: number;
|
|
10
11
|
intensity?: number;
|
|
11
12
|
}
|
|
13
|
+
export interface FadeOptions {
|
|
14
|
+
duration?: number;
|
|
15
|
+
}
|
|
12
16
|
export declare class MaterialEffects {
|
|
13
17
|
static highlightColor(object: Object3D | Object3D[], options?: HighlightColorOptions): void;
|
|
14
18
|
static removeHighlightColor(object: Object3D | Object3D[]): void;
|
|
15
19
|
static breatheColor(object: Object3D | Object3D[], options?: BreatheColorOptions): void;
|
|
16
20
|
static removeBreatheColor(object: Object3D | Object3D[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Enable wireframe mode on object(s).
|
|
23
|
+
*/
|
|
24
|
+
static wireframe(object: Object3D | Object3D[], enabled?: boolean): void;
|
|
25
|
+
/**
|
|
26
|
+
* Remove wireframe mode.
|
|
27
|
+
*/
|
|
28
|
+
static removeWireframe(object: Object3D | Object3D[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Fade in object(s) from fully transparent to original opacity.
|
|
31
|
+
* Returns a promise that resolves when animation is complete.
|
|
32
|
+
*/
|
|
33
|
+
static fadeIn(object: Object3D | Object3D[], options?: FadeOptions): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Fade out object(s) to fully transparent.
|
|
36
|
+
* Returns a promise that resolves when animation is complete.
|
|
37
|
+
*/
|
|
38
|
+
static fadeOut(object: Object3D | Object3D[], options?: FadeOptions): Promise<void>;
|
|
39
|
+
private static _fade;
|
|
17
40
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -25,11 +25,42 @@ export declare class InteractionManager {
|
|
|
25
25
|
* Disabled by default for performance optimization.
|
|
26
26
|
*/
|
|
27
27
|
pointerMoveEventsEnabled: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether interaction is enabled globally.
|
|
30
|
+
*/
|
|
31
|
+
private _enabled;
|
|
32
|
+
/**
|
|
33
|
+
* Objects excluded from raycasting (via addIgnore or setInteractable(false)).
|
|
34
|
+
*/
|
|
35
|
+
private _excludeSet;
|
|
28
36
|
constructor(domElement: HTMLElement, scene: Scene, camera: Camera);
|
|
29
37
|
/**
|
|
30
38
|
* Updates the camera reference (useful when switching cameras).
|
|
31
39
|
*/
|
|
32
40
|
setCamera(camera: Camera): void;
|
|
41
|
+
/**
|
|
42
|
+
* Enable all interactions.
|
|
43
|
+
*/
|
|
44
|
+
enable(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Disable all interactions.
|
|
47
|
+
*/
|
|
48
|
+
disable(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Set whether a specific object is interactable.
|
|
51
|
+
* When set to false, the object and its children are excluded from raycasting.
|
|
52
|
+
*/
|
|
53
|
+
setInteractable(object: Object3D, interactable: boolean): void;
|
|
54
|
+
/**
|
|
55
|
+
* Add an object to the exclude list (will not receive any events).
|
|
56
|
+
* Alias for `setInteractable(object, false)`.
|
|
57
|
+
*/
|
|
58
|
+
addIgnore(object: Object3D): void;
|
|
59
|
+
/**
|
|
60
|
+
* Remove an object from the exclude list.
|
|
61
|
+
* Alias for `setInteractable(object, true)`.
|
|
62
|
+
*/
|
|
63
|
+
removeIgnore(object: Object3D): void;
|
|
33
64
|
private _bindEvents;
|
|
34
65
|
private _updatePointer;
|
|
35
66
|
private _getIntersects;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type Scene, type Camera, type Object3D, EventDispatcher } from 'three/webgpu';
|
|
2
|
+
export interface SelectionEventMap {
|
|
3
|
+
select: {
|
|
4
|
+
objects: Object3D[];
|
|
5
|
+
};
|
|
6
|
+
deselect: {
|
|
7
|
+
objects: Object3D[];
|
|
8
|
+
};
|
|
9
|
+
change: {
|
|
10
|
+
selected: Set<Object3D>;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface BoxSelectionOptions {
|
|
14
|
+
/** CSS class for the selection box overlay */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Deep traversal into children for selection */
|
|
17
|
+
deep?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Manages object selection: single, multi, and box (rubber-band) selection.
|
|
21
|
+
*/
|
|
22
|
+
export declare class Selection extends EventDispatcher<SelectionEventMap> {
|
|
23
|
+
private scene;
|
|
24
|
+
private camera;
|
|
25
|
+
private domElement;
|
|
26
|
+
/** The container element for the selection box overlay (domElement's parent). */
|
|
27
|
+
private _container;
|
|
28
|
+
private _selected;
|
|
29
|
+
private _boxSelectionEnabled;
|
|
30
|
+
private _isSelecting;
|
|
31
|
+
private _startPoint;
|
|
32
|
+
private _endPoint;
|
|
33
|
+
private _selectionBox;
|
|
34
|
+
private _deep;
|
|
35
|
+
/**
|
|
36
|
+
* Objects available for selection (defaults to scene.children).
|
|
37
|
+
*/
|
|
38
|
+
targetObjects: Object3D[] | null;
|
|
39
|
+
constructor(domElement: HTMLElement, scene: Scene, camera: Camera);
|
|
40
|
+
get selected(): Set<Object3D>;
|
|
41
|
+
get selectedArray(): Object3D[];
|
|
42
|
+
/**
|
|
43
|
+
* Select one or more objects.
|
|
44
|
+
*/
|
|
45
|
+
select(objects: Object3D | Object3D[]): void;
|
|
46
|
+
/**
|
|
47
|
+
* Deselect one or more objects.
|
|
48
|
+
*/
|
|
49
|
+
deselect(objects: Object3D | Object3D[]): void;
|
|
50
|
+
/**
|
|
51
|
+
* Toggle selection of an object.
|
|
52
|
+
*/
|
|
53
|
+
toggle(object: Object3D): void;
|
|
54
|
+
/**
|
|
55
|
+
* Clear all selections.
|
|
56
|
+
*/
|
|
57
|
+
clear(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Check if an object is selected.
|
|
60
|
+
*/
|
|
61
|
+
isSelected(object: Object3D): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Enable rubber-band box selection mode.
|
|
64
|
+
*/
|
|
65
|
+
enableBoxSelection(options?: BoxSelectionOptions): void;
|
|
66
|
+
/**
|
|
67
|
+
* Disable box selection mode.
|
|
68
|
+
*/
|
|
69
|
+
disableBoxSelection(): void;
|
|
70
|
+
setCamera(camera: Camera): void;
|
|
71
|
+
private _onBoxPointerDown;
|
|
72
|
+
private _onBoxPointerMove;
|
|
73
|
+
private _onBoxPointerUp;
|
|
74
|
+
private _updateBoxElement;
|
|
75
|
+
private _getObjectsInBox;
|
|
76
|
+
dispose(): void;
|
|
77
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { type Scene, AmbientLight, DirectionalLight, PointLight, SpotLight, HemisphereLight, type ColorRepresentation, type Light } from 'three/webgpu';
|
|
2
|
+
export interface AmbientLightOptions {
|
|
3
|
+
color?: ColorRepresentation;
|
|
4
|
+
intensity?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface DirectionalLightOptions {
|
|
7
|
+
color?: ColorRepresentation;
|
|
8
|
+
intensity?: number;
|
|
9
|
+
position?: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
z: number;
|
|
13
|
+
};
|
|
14
|
+
castShadow?: boolean;
|
|
15
|
+
shadowMapSize?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface PointLightOptions {
|
|
18
|
+
color?: ColorRepresentation;
|
|
19
|
+
intensity?: number;
|
|
20
|
+
distance?: number;
|
|
21
|
+
decay?: number;
|
|
22
|
+
position?: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
z: number;
|
|
26
|
+
};
|
|
27
|
+
castShadow?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface SpotLightOptions {
|
|
30
|
+
color?: ColorRepresentation;
|
|
31
|
+
intensity?: number;
|
|
32
|
+
distance?: number;
|
|
33
|
+
angle?: number;
|
|
34
|
+
penumbra?: number;
|
|
35
|
+
decay?: number;
|
|
36
|
+
position?: {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
z: number;
|
|
40
|
+
};
|
|
41
|
+
target?: {
|
|
42
|
+
x: number;
|
|
43
|
+
y: number;
|
|
44
|
+
z: number;
|
|
45
|
+
};
|
|
46
|
+
castShadow?: boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface HemisphereLightOptions {
|
|
49
|
+
skyColor?: ColorRepresentation;
|
|
50
|
+
groundColor?: ColorRepresentation;
|
|
51
|
+
intensity?: number;
|
|
52
|
+
}
|
|
53
|
+
export type LightPreset = 'indoor' | 'outdoor' | 'studio' | 'warehouse';
|
|
54
|
+
/**
|
|
55
|
+
* Manages lights in the scene with convenient creation and preset support.
|
|
56
|
+
*/
|
|
57
|
+
export declare class LightManager {
|
|
58
|
+
private scene;
|
|
59
|
+
private lights;
|
|
60
|
+
private helpers;
|
|
61
|
+
constructor(scene: Scene);
|
|
62
|
+
addAmbient(id: string, options?: AmbientLightOptions): AmbientLight;
|
|
63
|
+
addDirectional(id: string, options?: DirectionalLightOptions): DirectionalLight;
|
|
64
|
+
addPoint(id: string, options?: PointLightOptions): PointLight;
|
|
65
|
+
addSpot(id: string, options?: SpotLightOptions): SpotLight;
|
|
66
|
+
addHemisphere(id: string, options?: HemisphereLightOptions): HemisphereLight;
|
|
67
|
+
/**
|
|
68
|
+
* Apply a lighting preset to the scene.
|
|
69
|
+
*/
|
|
70
|
+
applyPreset(preset: LightPreset): void;
|
|
71
|
+
/**
|
|
72
|
+
* Get a light by id.
|
|
73
|
+
*/
|
|
74
|
+
get(id: string): Light | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Remove a light by id.
|
|
77
|
+
*/
|
|
78
|
+
remove(id: string): void;
|
|
79
|
+
/**
|
|
80
|
+
* Remove all lights managed by this manager.
|
|
81
|
+
*/
|
|
82
|
+
removeAll(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Show a visual helper for a light.
|
|
85
|
+
*/
|
|
86
|
+
showHelper(id: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Hide (remove) the helper for a light.
|
|
89
|
+
*/
|
|
90
|
+
hideHelper(id: string): void;
|
|
91
|
+
/**
|
|
92
|
+
* Show helpers for all lights.
|
|
93
|
+
*/
|
|
94
|
+
showAllHelpers(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Hide all helpers.
|
|
97
|
+
*/
|
|
98
|
+
hideAllHelpers(): void;
|
|
99
|
+
private _register;
|
|
100
|
+
dispose(): void;
|
|
101
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { Box3, type Object3D } from 'three/webgpu';
|
|
2
2
|
/**
|
|
3
3
|
* Manages 3D objects with custom id and name caching for quick retrieval.
|
|
4
4
|
*/
|
|
@@ -57,4 +57,36 @@ export declare class ObjectManager {
|
|
|
57
57
|
* Get the number of unique cached objects.
|
|
58
58
|
*/
|
|
59
59
|
get size(): number;
|
|
60
|
+
/**
|
|
61
|
+
* Show an object by id.
|
|
62
|
+
*/
|
|
63
|
+
show(id: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Hide an object by id.
|
|
66
|
+
*/
|
|
67
|
+
hide(id: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Show only the specified objects, hide all others.
|
|
70
|
+
*/
|
|
71
|
+
isolate(ids: string[]): void;
|
|
72
|
+
/**
|
|
73
|
+
* Set the opacity of an object's materials.
|
|
74
|
+
*/
|
|
75
|
+
setOpacity(id: string, opacity: number): void;
|
|
76
|
+
/**
|
|
77
|
+
* Get the bounding box of an object by id, or all objects if no id provided.
|
|
78
|
+
*/
|
|
79
|
+
getBoundingBox(id?: string): Box3;
|
|
80
|
+
/**
|
|
81
|
+
* Iterate over all managed objects.
|
|
82
|
+
*/
|
|
83
|
+
forEach(callback: (object: Object3D, ids: Set<string>) => void): void;
|
|
84
|
+
/**
|
|
85
|
+
* Filter objects by a predicate.
|
|
86
|
+
*/
|
|
87
|
+
filter<T extends Object3D>(predicate: (object: Object3D) => boolean): T[];
|
|
88
|
+
/**
|
|
89
|
+
* Show all managed objects.
|
|
90
|
+
*/
|
|
91
|
+
showAll(): void;
|
|
60
92
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Scene, type ColorRepresentation } from 'three/webgpu';
|
|
2
|
+
export interface SceneSnapshot {
|
|
3
|
+
name: string;
|
|
4
|
+
background: ColorRepresentation | null;
|
|
5
|
+
environmentRotation: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
z: number;
|
|
9
|
+
};
|
|
10
|
+
children: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Manages multiple scenes and provides scene-level utilities.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SceneManager {
|
|
16
|
+
private scenes;
|
|
17
|
+
private _activeSceneKey;
|
|
18
|
+
/**
|
|
19
|
+
* Add a scene with a key.
|
|
20
|
+
*/
|
|
21
|
+
add(key: string, scene: Scene): void;
|
|
22
|
+
/**
|
|
23
|
+
* Create and register a new scene.
|
|
24
|
+
*/
|
|
25
|
+
create(key: string, options?: {
|
|
26
|
+
background?: ColorRepresentation;
|
|
27
|
+
}): Scene;
|
|
28
|
+
/**
|
|
29
|
+
* Get a scene by key.
|
|
30
|
+
*/
|
|
31
|
+
get(key: string): Scene | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Remove a scene by key.
|
|
34
|
+
*/
|
|
35
|
+
remove(key: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Get the currently active scene key.
|
|
38
|
+
*/
|
|
39
|
+
get activeKey(): string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Set the active scene key (for external use to track which scene is active).
|
|
42
|
+
*/
|
|
43
|
+
set activeKey(key: string | null);
|
|
44
|
+
/**
|
|
45
|
+
* List all registered scene keys.
|
|
46
|
+
*/
|
|
47
|
+
keys(): string[];
|
|
48
|
+
/**
|
|
49
|
+
* Serialize scene metadata to JSON (children names/ids, background, etc.).
|
|
50
|
+
*/
|
|
51
|
+
serialize(key: string): SceneSnapshot | null;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all scenes.
|
|
54
|
+
*/
|
|
55
|
+
clear(): void;
|
|
56
|
+
get size(): number;
|
|
57
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Object3D, AnimationMixer, type AnimationAction, type AnimationClip } from 'three/webgpu';
|
|
1
|
+
import { type Object3D, AnimationMixer, type AnimationAction, type AnimationClip, Box3, Vector3, type Material } from 'three/webgpu';
|
|
2
2
|
import { type InteractionEventMap } from '../interactions';
|
|
3
3
|
import { BaseGroup } from './BaseGroup';
|
|
4
4
|
export interface ModelParameters {
|
|
@@ -25,6 +25,18 @@ export declare class Model extends BaseGroup<InteractionEventMap> {
|
|
|
25
25
|
playAllAnimations(options?: PlayAnimationOptions): AnimationAction[];
|
|
26
26
|
stopAnimation(nameOrIndex?: string | number): void;
|
|
27
27
|
updateAnimation(delta: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Get the axis-aligned bounding box of this model.
|
|
30
|
+
*/
|
|
31
|
+
getBoundingBox(): Box3;
|
|
32
|
+
/**
|
|
33
|
+
* Get the center point of this model's bounding box.
|
|
34
|
+
*/
|
|
35
|
+
getCenter(): Vector3;
|
|
36
|
+
/**
|
|
37
|
+
* Set the material for all meshes in this model.
|
|
38
|
+
*/
|
|
39
|
+
setMaterial(material: Material): void;
|
|
28
40
|
static clearMemoryCache(): void;
|
|
29
41
|
static clearPersistentCache(): Promise<void>;
|
|
30
42
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Line, type Scene, type ColorRepresentation, Group } from 'three/webgpu';
|
|
2
|
+
export interface AnnotationOptions {
|
|
3
|
+
/** Position of the annotation anchor in 3D space */
|
|
4
|
+
position: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
z: number;
|
|
8
|
+
};
|
|
9
|
+
/** HTML content or text for the label */
|
|
10
|
+
content: string;
|
|
11
|
+
/** Offset from anchor position for the label (in 3D space) */
|
|
12
|
+
labelOffset?: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
z: number;
|
|
16
|
+
};
|
|
17
|
+
/** Whether to draw a leader line from anchor to label */
|
|
18
|
+
showLeaderLine?: boolean;
|
|
19
|
+
/** Leader line color */
|
|
20
|
+
lineColor?: ColorRepresentation;
|
|
21
|
+
/** CSS styles for the label element */
|
|
22
|
+
labelStyle?: Partial<CSSStyleDeclaration>;
|
|
23
|
+
}
|
|
24
|
+
export interface Annotation {
|
|
25
|
+
id: string;
|
|
26
|
+
options: AnnotationOptions;
|
|
27
|
+
group: Group;
|
|
28
|
+
labelElement: HTMLDivElement;
|
|
29
|
+
line: Line | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Manages 3D annotations with leader lines and HTML labels.
|
|
33
|
+
* Works with CSSRenderer for HTML overlay rendering.
|
|
34
|
+
*/
|
|
35
|
+
export declare class AnnotationManager {
|
|
36
|
+
private scene;
|
|
37
|
+
private annotations;
|
|
38
|
+
private _idCounter;
|
|
39
|
+
private _createCSSObject;
|
|
40
|
+
constructor(scene: Scene);
|
|
41
|
+
/**
|
|
42
|
+
* Set the CSS object factory function (from CSSRenderer).
|
|
43
|
+
* This allows annotations to be rendered as CSS2D/CSS2.5D objects.
|
|
44
|
+
*/
|
|
45
|
+
setCSSObjectFactory(factory: (element: HTMLElement) => any): void;
|
|
46
|
+
/**
|
|
47
|
+
* Add an annotation.
|
|
48
|
+
*/
|
|
49
|
+
add(id: string, options: AnnotationOptions): Annotation;
|
|
50
|
+
/**
|
|
51
|
+
* Quick-add a text annotation.
|
|
52
|
+
*/
|
|
53
|
+
addText(text: string, position: {
|
|
54
|
+
x: number;
|
|
55
|
+
y: number;
|
|
56
|
+
z: number;
|
|
57
|
+
}, options?: Partial<AnnotationOptions>): Annotation;
|
|
58
|
+
/**
|
|
59
|
+
* Update an annotation's content.
|
|
60
|
+
*/
|
|
61
|
+
updateContent(id: string, content: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Update an annotation's position.
|
|
64
|
+
*/
|
|
65
|
+
updatePosition(id: string, position: {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
z: number;
|
|
69
|
+
}): void;
|
|
70
|
+
/**
|
|
71
|
+
* Show an annotation.
|
|
72
|
+
*/
|
|
73
|
+
show(id: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Hide an annotation.
|
|
76
|
+
*/
|
|
77
|
+
hide(id: string): void;
|
|
78
|
+
/**
|
|
79
|
+
* Get an annotation by id.
|
|
80
|
+
*/
|
|
81
|
+
get(id: string): Annotation | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Remove an annotation.
|
|
84
|
+
*/
|
|
85
|
+
remove(id: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Remove all annotations.
|
|
88
|
+
*/
|
|
89
|
+
removeAll(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Show all annotations.
|
|
92
|
+
*/
|
|
93
|
+
showAll(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Hide all annotations.
|
|
96
|
+
*/
|
|
97
|
+
hideAll(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Get all annotation ids.
|
|
100
|
+
*/
|
|
101
|
+
keys(): string[];
|
|
102
|
+
get size(): number;
|
|
103
|
+
dispose(): void;
|
|
104
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Plane, type Scene, type Object3D, Box3, ClippingGroup, type ColorRepresentation } from 'three/webgpu';
|
|
2
|
+
export interface ClippingPlaneOptions {
|
|
3
|
+
normal?: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
z: number;
|
|
7
|
+
};
|
|
8
|
+
constant?: number;
|
|
9
|
+
showHelper?: boolean;
|
|
10
|
+
helperSize?: number;
|
|
11
|
+
helperColor?: ColorRepresentation;
|
|
12
|
+
}
|
|
13
|
+
export interface ClippingBoxOptions {
|
|
14
|
+
showHelpers?: boolean;
|
|
15
|
+
helperColor?: ColorRepresentation;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Provides clipping plane and clipping box functionality using ClippingGroup (WebGPU).
|
|
19
|
+
*
|
|
20
|
+
* Objects must be children of the ClippingGroup to be clipped.
|
|
21
|
+
* Use `clippingTool.group` to access the ClippingGroup and add objects to it,
|
|
22
|
+
* or call `clippingTool.attach(scene)` to reparent all scene children under the group.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ClippingTool {
|
|
25
|
+
private scene;
|
|
26
|
+
private planes;
|
|
27
|
+
private helpers;
|
|
28
|
+
/**
|
|
29
|
+
* The ClippingGroup node. Objects must be descendants of this group to be clipped.
|
|
30
|
+
*/
|
|
31
|
+
readonly group: ClippingGroup;
|
|
32
|
+
constructor(scene: Scene);
|
|
33
|
+
/**
|
|
34
|
+
* Move all current scene children (except the clipping group itself) into the ClippingGroup,
|
|
35
|
+
* so they are all subject to clipping.
|
|
36
|
+
*/
|
|
37
|
+
attach(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Move all children out of the ClippingGroup back to the scene root.
|
|
40
|
+
*/
|
|
41
|
+
detach(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Enable clipping.
|
|
44
|
+
*/
|
|
45
|
+
enable(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Disable clipping.
|
|
48
|
+
*/
|
|
49
|
+
disable(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Add a clipping plane.
|
|
52
|
+
*/
|
|
53
|
+
addPlane(id: string, options?: ClippingPlaneOptions): Plane;
|
|
54
|
+
/**
|
|
55
|
+
* Add six clipping planes that form a box around a Box3.
|
|
56
|
+
* Returns the six plane ids: `${id}_+x`, `${id}_-x`, etc.
|
|
57
|
+
*/
|
|
58
|
+
addBox(id: string, box: Box3, options?: ClippingBoxOptions): string[];
|
|
59
|
+
/**
|
|
60
|
+
* Add a clipping box from an object's bounding box with optional padding.
|
|
61
|
+
*/
|
|
62
|
+
addBoxFromObject(id: string, object: Object3D, padding?: number, options?: ClippingBoxOptions): string[];
|
|
63
|
+
/**
|
|
64
|
+
* Update a plane's constant (distance from origin).
|
|
65
|
+
*/
|
|
66
|
+
setPlaneConstant(id: string, constant: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove a clipping plane.
|
|
69
|
+
*/
|
|
70
|
+
removePlane(id: string): void;
|
|
71
|
+
/**
|
|
72
|
+
* Remove a clipping box (all 6 associated planes).
|
|
73
|
+
*/
|
|
74
|
+
removeBox(id: string): void;
|
|
75
|
+
/**
|
|
76
|
+
* Remove all clipping planes.
|
|
77
|
+
*/
|
|
78
|
+
removeAll(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Show a helper visualization for a clipping plane.
|
|
81
|
+
*/
|
|
82
|
+
showHelper(id: string, size?: number, color?: ColorRepresentation): void;
|
|
83
|
+
/**
|
|
84
|
+
* Hide a plane helper.
|
|
85
|
+
*/
|
|
86
|
+
hideHelper(id: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Get a plane by id.
|
|
89
|
+
*/
|
|
90
|
+
get(id: string): Plane | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Sync the planes map into the ClippingGroup's clippingPlanes array.
|
|
93
|
+
*/
|
|
94
|
+
private _syncPlanes;
|
|
95
|
+
dispose(): void;
|
|
96
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Vector3, type Scene, type ColorRepresentation, Group } from 'three/webgpu';
|
|
2
|
+
export interface MeasureStyleOptions {
|
|
3
|
+
lineColor?: ColorRepresentation;
|
|
4
|
+
/** @deprecated lineWidth is not supported in WebGPU renderer */
|
|
5
|
+
lineWidth?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface MeasureResult {
|
|
8
|
+
id: string;
|
|
9
|
+
type: 'distance' | 'area' | 'angle';
|
|
10
|
+
value: number;
|
|
11
|
+
unit: string;
|
|
12
|
+
points: Vector3[];
|
|
13
|
+
object: Group;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Provides measurement utilities for 3D scenes.
|
|
17
|
+
*/
|
|
18
|
+
export declare class MeasureTool {
|
|
19
|
+
private scene;
|
|
20
|
+
private measurements;
|
|
21
|
+
private _idCounter;
|
|
22
|
+
constructor(scene: Scene);
|
|
23
|
+
/**
|
|
24
|
+
* Measure distance between two points.
|
|
25
|
+
*/
|
|
26
|
+
measureDistance(pointA: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
z: number;
|
|
30
|
+
}, pointB: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
z: number;
|
|
34
|
+
}, options?: MeasureStyleOptions): MeasureResult;
|
|
35
|
+
/**
|
|
36
|
+
* Measure the area of a polygon defined by 3+ coplanar points.
|
|
37
|
+
*/
|
|
38
|
+
measureArea(points: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
z: number;
|
|
42
|
+
}[], options?: MeasureStyleOptions): MeasureResult;
|
|
43
|
+
/**
|
|
44
|
+
* Measure the angle between three points (vertex at the middle point).
|
|
45
|
+
*/
|
|
46
|
+
measureAngle(pointA: {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
z: number;
|
|
50
|
+
}, vertex: {
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
z: number;
|
|
54
|
+
}, pointC: {
|
|
55
|
+
x: number;
|
|
56
|
+
y: number;
|
|
57
|
+
z: number;
|
|
58
|
+
}, options?: MeasureStyleOptions): MeasureResult;
|
|
59
|
+
/**
|
|
60
|
+
* Get a measurement result by id.
|
|
61
|
+
*/
|
|
62
|
+
get(id: string): MeasureResult | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Remove a measurement by id.
|
|
65
|
+
*/
|
|
66
|
+
remove(id: string): void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove all measurements.
|
|
69
|
+
*/
|
|
70
|
+
removeAll(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Get all measurement results.
|
|
73
|
+
*/
|
|
74
|
+
getAll(): MeasureResult[];
|
|
75
|
+
/**
|
|
76
|
+
* Calculate polygon area using cross product method (Newell's method).
|
|
77
|
+
*/
|
|
78
|
+
private _calculatePolygonArea;
|
|
79
|
+
dispose(): void;
|
|
80
|
+
}
|