@lovelace_lol/embody 0.0.13 → 0.0.14
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 +94 -23
- package/dist/index.js +1617 -5898
- package/dist/index.js.map +1 -1
- package/dist/three/annotations/DOMControls.d.ts +5 -1
- package/dist/three/annotations/HtmlAnnotationMarkers.d.ts +5 -0
- package/dist/three/annotations/OverlayAnnotationMarkers.d.ts +1 -0
- package/dist/three/annotations/ThreeAnnotationController.d.ts +145 -0
- package/dist/three/annotations/ThreeAnnotationControls.d.ts +42 -0
- package/dist/three/annotations/ThreeAnnotationMarkers.d.ts +42 -0
- package/dist/three/annotations/ThreeAnnotationRenderer.d.ts +35 -0
- package/dist/three/annotations/{DPthree.d.ts → ThreeAnnotations.d.ts} +18 -27
- package/dist/three/annotations/adapter.d.ts +2 -8
- package/dist/three/annotations/annotationAnchorModel.d.ts +0 -4
- package/dist/three/annotations/index.d.ts +9 -8
- package/dist/three/annotations/lifecycleBridge.d.ts +26 -0
- package/dist/three/annotations/markerVisibilityLifecycle.d.ts +8 -7
- package/dist/three/annotations/modelObservation.d.ts +44 -0
- package/dist/three/annotations/runtime.d.ts +46 -0
- package/dist/three/annotations/runtimeAnnotationPreview.d.ts +2 -2
- package/dist/three/annotations/runtimeAnnotationPreviewSide.d.ts +0 -4
- package/dist/three/annotations/runtimeAnnotationSidePreview.d.ts +2 -1
- package/dist/three/annotations/types.d.ts +7 -8
- package/dist/three/characterHost.d.ts +5 -5
- package/dist/three.js +1617 -5898
- package/dist/three.js.map +1 -1
- package/dist/wasm/README.md +94 -23
- package/dist/wasm/embody_wasm.d.ts +191 -85
- package/dist/wasm/embody_wasm.js +455 -2
- package/dist/wasm/embody_wasm_bg.wasm +0 -0
- package/dist/wasm/embody_wasm_bg.wasm.d.ts +116 -83
- package/dist/wasm/index.d.ts +1 -1
- package/dist/wasm.js.map +1 -1
- package/package.json +2 -2
- package/dist/three/annotations/DPthree3DMarkers.d.ts +0 -320
- package/dist/three/annotations/DPthreeCameraController.d.ts +0 -415
- package/dist/three/annotations/DPthreeHTMLMarkers.d.ts +0 -131
- package/dist/three/annotations/DPthreeMarkers.d.ts +0 -52
- package/dist/three/annotations/animationFrameTaskScheduler.d.ts +0 -18
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Self-contained DOM controls for
|
|
2
|
+
* Self-contained DOM controls for ThreeAnnotationController
|
|
3
3
|
* No React dependencies - vanilla DOM manipulation
|
|
4
4
|
*/
|
|
5
5
|
export interface DOMControlRegion {
|
|
@@ -27,6 +27,10 @@ export declare function isRuntimeAnnotationRegionName(name: string): boolean;
|
|
|
27
27
|
export declare function filterCameraViewRegions<T extends {
|
|
28
28
|
name: string;
|
|
29
29
|
}>(regions: T[]): T[];
|
|
30
|
+
/**
|
|
31
|
+
* Format region name for display
|
|
32
|
+
* Converts snake_case to Title Case
|
|
33
|
+
*/
|
|
30
34
|
export declare function buildRegionDisplayOptions(regions: DOMControlRegion[]): Array<{
|
|
31
35
|
name: string;
|
|
32
36
|
label: string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ThreeAnnotationMarkers, type AnnotationMarkersConfig } from './ThreeAnnotationMarkers';
|
|
2
|
+
/** HTML rendering of the same Rust annotation state and layout. */
|
|
3
|
+
export declare class HtmlAnnotationMarkers extends ThreeAnnotationMarkers {
|
|
4
|
+
constructor(options: AnnotationMarkersConfig);
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HtmlAnnotationMarkers as OverlayAnnotationMarkers } from './HtmlAnnotationMarkers';
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { ThreeAnnotationControls } from './ThreeAnnotationControls';
|
|
3
|
+
import type { ThreeAnnotationControllerConfig, CharacterConfig, AnnotationAnchoredRegion, CameraState, MarkerStyle, MarkerStyleOverrides, LineConfig, ExpandedRegionState, RuntimeAnnotationOptions, RuntimeAnnotationRegionSummary, RegionChangeCallback } from './types';
|
|
4
|
+
export interface MarkerStateSnapshot {
|
|
5
|
+
visible: boolean;
|
|
6
|
+
style: MarkerStyle;
|
|
7
|
+
}
|
|
8
|
+
/** Native resource owner for one Rust AnnotationRuntime. Await create() or initialize Wasm before construction. */
|
|
9
|
+
export declare class ThreeAnnotationController {
|
|
10
|
+
readonly camera: THREE.PerspectiveCamera;
|
|
11
|
+
readonly scene: THREE.Scene;
|
|
12
|
+
readonly controls: ThreeAnnotationControls;
|
|
13
|
+
private readonly runtime;
|
|
14
|
+
private readonly markerRenderer;
|
|
15
|
+
private readonly resolveCharacterConfig;
|
|
16
|
+
private readonly selectRegion?;
|
|
17
|
+
private domElement;
|
|
18
|
+
private readonly manageCamera;
|
|
19
|
+
private observer;
|
|
20
|
+
private hostConfig;
|
|
21
|
+
private configSnapshot;
|
|
22
|
+
private configSnapshotRevision;
|
|
23
|
+
private configSnapshotHost;
|
|
24
|
+
private state;
|
|
25
|
+
private domControls;
|
|
26
|
+
private disposed;
|
|
27
|
+
private fallbackFrame;
|
|
28
|
+
private readonly flights;
|
|
29
|
+
private readonly markerStateListeners;
|
|
30
|
+
private readonly regionListeners;
|
|
31
|
+
private renderer;
|
|
32
|
+
private readonly playbackTimer;
|
|
33
|
+
private renderFrame;
|
|
34
|
+
private resizeRenderer;
|
|
35
|
+
private onRenderError;
|
|
36
|
+
private renderingSuspended;
|
|
37
|
+
private unbindRendering;
|
|
38
|
+
private renderingFailure;
|
|
39
|
+
private framePending;
|
|
40
|
+
private frameCompletion;
|
|
41
|
+
private modelPreparation;
|
|
42
|
+
private renderFailed;
|
|
43
|
+
private resizeObserver;
|
|
44
|
+
private boundResizeHandler;
|
|
45
|
+
static create(config: ThreeAnnotationControllerConfig): Promise<ThreeAnnotationController>;
|
|
46
|
+
constructor(config: ThreeAnnotationControllerConfig, nativeOptions?: {
|
|
47
|
+
captureInput?: boolean;
|
|
48
|
+
manageCamera?: boolean;
|
|
49
|
+
markerDefaults?: unknown;
|
|
50
|
+
});
|
|
51
|
+
private readState;
|
|
52
|
+
private call;
|
|
53
|
+
private sync;
|
|
54
|
+
private applyCameraState;
|
|
55
|
+
private isCurrent;
|
|
56
|
+
private requestFrame;
|
|
57
|
+
private settleFlights;
|
|
58
|
+
private waitForFlight;
|
|
59
|
+
private select;
|
|
60
|
+
private pick;
|
|
61
|
+
setModel(model: THREE.Object3D): void;
|
|
62
|
+
/** Drop native and Rust model observations before the host releases its model under a rendering lease. */
|
|
63
|
+
clearModel(): void;
|
|
64
|
+
getModel(): THREE.Object3D | null;
|
|
65
|
+
loadRegions(config: CharacterConfig): Promise<void>;
|
|
66
|
+
private configure;
|
|
67
|
+
prepareRegionsForReveal(config: CharacterConfig): void;
|
|
68
|
+
prepareRegionsAndMarkersForReveal(config: CharacterConfig, beforeReveal?: () => Promise<boolean>): Promise<void>;
|
|
69
|
+
private startConfiguredCamera;
|
|
70
|
+
loadMarkersForCurrentRegions(sliceSurfaceQueries?: boolean): Promise<void>;
|
|
71
|
+
private rebuild;
|
|
72
|
+
focusRegion(name: string, duration?: number): Promise<void>;
|
|
73
|
+
focusBones(bones: string[], duration?: number): Promise<void>;
|
|
74
|
+
focusMeshes(meshes: string[], duration?: number): Promise<void>;
|
|
75
|
+
focusFullBody(duration?: number): Promise<void>;
|
|
76
|
+
focusObjects(objects: THREE.Object3D[], duration?: number): Promise<void>;
|
|
77
|
+
private focus;
|
|
78
|
+
playIntroAnimation(orbitDuration?: number, zoomDuration?: number): Promise<void>;
|
|
79
|
+
animateToCameraState(state: CameraState, duration?: number): Promise<void>;
|
|
80
|
+
getCameraState(): CameraState;
|
|
81
|
+
setCameraState(state: CameraState): void;
|
|
82
|
+
getRegionNames(): string[];
|
|
83
|
+
getCurrentRegion(): string | null;
|
|
84
|
+
getCharacterConfig(): CharacterConfig | null;
|
|
85
|
+
getAnnotationRegions(): AnnotationAnchoredRegion[];
|
|
86
|
+
getAnnotationRegion(name: string): AnnotationAnchoredRegion | undefined;
|
|
87
|
+
setCurrentRegion(name: string | null): void;
|
|
88
|
+
getMarkersVisible(): boolean;
|
|
89
|
+
setMarkersVisible(visible: boolean): void;
|
|
90
|
+
getMarkerStyle(): MarkerStyle;
|
|
91
|
+
setMarkerStyle(style: MarkerStyle): void;
|
|
92
|
+
clearMarkers(): void;
|
|
93
|
+
subscribeMarkerState(listener: (state: MarkerStateSnapshot) => void): () => void;
|
|
94
|
+
onRegionChange(listener: RegionChangeCallback): () => void;
|
|
95
|
+
soloMarker(name: string | null): void;
|
|
96
|
+
getSoloedMarker(): string | null;
|
|
97
|
+
expandRegion(name: string, duration?: number): void;
|
|
98
|
+
setRegionExpansion(name: string, expanded: boolean, animation?: 'outward' | 'staggered', duration?: number): void;
|
|
99
|
+
collapseRegion(name: string, duration?: number): void;
|
|
100
|
+
toggleRegion(name: string, animation?: 'outward' | 'staggered', duration?: number): void;
|
|
101
|
+
private expandCommand;
|
|
102
|
+
getExpandedRegions(): ExpandedRegionState[];
|
|
103
|
+
setRegionLineStyle(name: string, line: Partial<LineConfig>): void;
|
|
104
|
+
setRegionStyle(name: string, style: Partial<MarkerStyleOverrides>): void;
|
|
105
|
+
updateRegionMeshes(name: string, meshes: string[]): void;
|
|
106
|
+
repositionMarker(name: string, position: {
|
|
107
|
+
x: number;
|
|
108
|
+
y: number;
|
|
109
|
+
z: number;
|
|
110
|
+
}): void;
|
|
111
|
+
getMarkerPosition(name: string): {
|
|
112
|
+
x: number;
|
|
113
|
+
y: number;
|
|
114
|
+
z: number;
|
|
115
|
+
} | null;
|
|
116
|
+
updateAnnotationRegion(name: string, update: Partial<AnnotationAnchoredRegion>): void;
|
|
117
|
+
removeAnnotationRegion(name: string): void;
|
|
118
|
+
showRuntimeBoneAnnotation(boneName: string, options?: RuntimeAnnotationOptions): RuntimeAnnotationRegionSummary;
|
|
119
|
+
showRuntimeAUAnnotations(auId: string | number, profile?: unknown, options?: RuntimeAnnotationOptions, morphTargetsByMesh?: unknown): RuntimeAnnotationRegionSummary[];
|
|
120
|
+
clearRuntimeAnnotations(): string[];
|
|
121
|
+
setDOMControlsVisible(visible: boolean): void;
|
|
122
|
+
updateDOMControls(): void;
|
|
123
|
+
update(): void;
|
|
124
|
+
dispose(): void;
|
|
125
|
+
private startRenderLoop;
|
|
126
|
+
private handleRenderError;
|
|
127
|
+
/**
|
|
128
|
+
* Stop the render loop
|
|
129
|
+
*/
|
|
130
|
+
private stopRenderLoop;
|
|
131
|
+
private setupResizeHandling;
|
|
132
|
+
/**
|
|
133
|
+
* Clean up resize handling
|
|
134
|
+
*/
|
|
135
|
+
private cleanupResizeHandling;
|
|
136
|
+
/**
|
|
137
|
+
* Prepare the currently visible material variants before first reveal.
|
|
138
|
+
* Borrows model/renderer; callers retain them until this promise settles,
|
|
139
|
+
* including after cancellation or controller disposal.
|
|
140
|
+
*/
|
|
141
|
+
prepareModelForRender(model: THREE.Object3D, options?: {
|
|
142
|
+
signal?: AbortSignal;
|
|
143
|
+
}): Promise<void>;
|
|
144
|
+
private cancelModelPreparation;
|
|
145
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { NativeAnnotationRuntime } from './runtime';
|
|
3
|
+
/** Native event capture and pose observation. Rust integrates every gesture. */
|
|
4
|
+
export declare class ThreeAnnotationControls extends THREE.EventDispatcher<{
|
|
5
|
+
change: {};
|
|
6
|
+
start: {};
|
|
7
|
+
end: {};
|
|
8
|
+
}> {
|
|
9
|
+
domElement: HTMLElement;
|
|
10
|
+
private readonly runtime;
|
|
11
|
+
private readonly advance;
|
|
12
|
+
private readonly captureInput;
|
|
13
|
+
readonly target: THREE.Vector3;
|
|
14
|
+
private disposed;
|
|
15
|
+
private previousTouchAction;
|
|
16
|
+
private connected;
|
|
17
|
+
constructor(domElement: HTMLElement, runtime: NativeAnnotationRuntime, advance: () => void, captureInput?: boolean);
|
|
18
|
+
connect(element: HTMLElement): void;
|
|
19
|
+
disconnect(): void;
|
|
20
|
+
get enabled(): boolean;
|
|
21
|
+
set enabled(enabled: boolean);
|
|
22
|
+
get enableDamping(): boolean;
|
|
23
|
+
set enableDamping(enableDamping: boolean);
|
|
24
|
+
get dampingFactor(): number;
|
|
25
|
+
set dampingFactor(dampingFactor: number);
|
|
26
|
+
get minDistance(): number;
|
|
27
|
+
set minDistance(minDistance: number);
|
|
28
|
+
get maxDistance(): number;
|
|
29
|
+
set maxDistance(maxDistance: number);
|
|
30
|
+
private read;
|
|
31
|
+
private settings;
|
|
32
|
+
update(): void;
|
|
33
|
+
notifyChange(): void;
|
|
34
|
+
private send;
|
|
35
|
+
private readonly down;
|
|
36
|
+
private readonly move;
|
|
37
|
+
private readonly up;
|
|
38
|
+
private readonly cancel;
|
|
39
|
+
private readonly wheel;
|
|
40
|
+
private readonly contextMenu;
|
|
41
|
+
dispose(): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { ThreeAnnotationController } from './ThreeAnnotationController';
|
|
3
|
+
import type { AnnotationAnchoredRegion, CharacterConfig, MarkerStyle, MarkerStyleOverrides, LineConfig, ExpandAnimation } from './types';
|
|
4
|
+
export interface AnnotationMarkersConfig {
|
|
5
|
+
scene: THREE.Scene;
|
|
6
|
+
camera: THREE.PerspectiveCamera;
|
|
7
|
+
domElement: HTMLElement;
|
|
8
|
+
onSelect: (name: string) => void;
|
|
9
|
+
config?: Partial<MarkerStyleOverrides> & {
|
|
10
|
+
lineLength?: number;
|
|
11
|
+
labelScale?: number;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Marker-only native view of the same Rust runtime used by the controller. */
|
|
15
|
+
export declare class ThreeAnnotationMarkers {
|
|
16
|
+
private readonly options;
|
|
17
|
+
private readonly style;
|
|
18
|
+
protected readonly controller: ThreeAnnotationController;
|
|
19
|
+
constructor(options: AnnotationMarkersConfig, style?: MarkerStyle);
|
|
20
|
+
setModel(model: THREE.Object3D): void;
|
|
21
|
+
loadRegions(config: CharacterConfig, options?: {
|
|
22
|
+
sliceSurfaceQueries?: boolean;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
setCurrentRegion(name: string | null): void;
|
|
25
|
+
updateRegion(name: string, update: Partial<AnnotationAnchoredRegion>): void;
|
|
26
|
+
removeRegion(name: string): void;
|
|
27
|
+
updateRegionMeshes(name: string, meshes: string[]): void;
|
|
28
|
+
repositionMarker(name: string, position: THREE.Vector3): void;
|
|
29
|
+
getMarkerPosition(name: string): THREE.Vector3 | null;
|
|
30
|
+
updateLineStyle(name: string, line: Partial<LineConfig>): void;
|
|
31
|
+
updateMarkerStyle(name: string, style: Partial<MarkerStyleOverrides>): void;
|
|
32
|
+
setSoloMarker(name: string | null): void;
|
|
33
|
+
getSoloedMarker(): string | null;
|
|
34
|
+
expandRegion(name: string, animation?: ExpandAnimation, duration?: number): void;
|
|
35
|
+
collapseRegion(name: string, duration?: number): void;
|
|
36
|
+
toggleRegion(name: string, animation?: ExpandAnimation, duration?: number): void;
|
|
37
|
+
getExpandedRegions(): import("./types").ExpandedRegionState[];
|
|
38
|
+
update(): void;
|
|
39
|
+
setVisible(visible: boolean): void;
|
|
40
|
+
clear(): void;
|
|
41
|
+
dispose(): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { AnnotationSnapshot, NativeAnnotationRuntime } from './runtime';
|
|
3
|
+
/** Applies Rust frame records to native objects. No annotation state machine. */
|
|
4
|
+
export declare class ThreeAnnotationRenderer {
|
|
5
|
+
private readonly runtime;
|
|
6
|
+
private readonly scene;
|
|
7
|
+
private readonly camera;
|
|
8
|
+
private domElement;
|
|
9
|
+
private readonly onPick;
|
|
10
|
+
private readonly onHover;
|
|
11
|
+
private readonly group;
|
|
12
|
+
private readonly objects;
|
|
13
|
+
private readonly overlay;
|
|
14
|
+
private readonly raycaster;
|
|
15
|
+
private readonly pointer;
|
|
16
|
+
private readonly viewProjection;
|
|
17
|
+
private overlayParent;
|
|
18
|
+
private releaseParentPosition;
|
|
19
|
+
private readonly overlayResizeObserver;
|
|
20
|
+
private style;
|
|
21
|
+
private revision;
|
|
22
|
+
private meshes;
|
|
23
|
+
setMeshes(meshes: THREE.Mesh[]): void;
|
|
24
|
+
constructor(runtime: NativeAnnotationRuntime, scene: THREE.Scene, camera: THREE.PerspectiveCamera, domElement: HTMLElement, onPick: (ids: number[]) => void, onHover: (id: number | null) => void);
|
|
25
|
+
private attachOverlay;
|
|
26
|
+
private layoutOverlay;
|
|
27
|
+
setDomElement(element: HTMLElement): void;
|
|
28
|
+
sync(snapshot: AnnotationSnapshot): void;
|
|
29
|
+
private create;
|
|
30
|
+
update(now: number): void;
|
|
31
|
+
private readonly click;
|
|
32
|
+
private remove;
|
|
33
|
+
clear(): void;
|
|
34
|
+
dispose(): void;
|
|
35
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import {
|
|
3
|
-
import type { CharacterConfig,
|
|
2
|
+
import { ThreeAnnotationController } from './ThreeAnnotationController';
|
|
3
|
+
import type { CharacterConfig, ThreeAnnotationControllerConfig, MarkerStyle, LineConfig, MarkerStyleOverrides, ExpandAnimation, ExpandedRegionState } from './types';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* ThreeAnnotations Configuration
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface ThreeAnnotationsConfig {
|
|
8
8
|
/** Three.js scene */
|
|
9
9
|
scene: THREE.Scene;
|
|
10
10
|
/** Three.js camera */
|
|
@@ -18,35 +18,35 @@ export interface DPthreeConfig {
|
|
|
18
18
|
/** Callback when a region is selected */
|
|
19
19
|
onRegionSelect?: (name: string) => void;
|
|
20
20
|
/** Camera controller options */
|
|
21
|
-
cameraOptions?: Partial<
|
|
21
|
+
cameraOptions?: Partial<ThreeAnnotationControllerConfig>;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* ThreeAnnotations - Camera & Marker System for Three.js
|
|
25
25
|
*
|
|
26
26
|
* Factory class that creates and manages camera controller and markers.
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* ```typescript
|
|
30
|
-
* const
|
|
30
|
+
* const annotations = await ThreeAnnotations.create({
|
|
31
31
|
* scene,
|
|
32
32
|
* camera,
|
|
33
33
|
* domElement: canvas,
|
|
34
34
|
* markerStyle: '3d',
|
|
35
35
|
* });
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
* await
|
|
39
|
-
*
|
|
37
|
+
* annotations.setModel(model);
|
|
38
|
+
* await annotations.loadCharacter(config);
|
|
39
|
+
* annotations.focus('head');
|
|
40
40
|
*
|
|
41
41
|
* // In render loop
|
|
42
|
-
*
|
|
42
|
+
* annotations.update();
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
export declare class
|
|
45
|
+
export declare class ThreeAnnotations {
|
|
46
46
|
private readonly cameraController;
|
|
47
|
-
private markerStyle;
|
|
48
47
|
private model;
|
|
49
|
-
|
|
48
|
+
static create(options: ThreeAnnotationsConfig): Promise<ThreeAnnotations>;
|
|
49
|
+
constructor(options: ThreeAnnotationsConfig);
|
|
50
50
|
setModel(model: THREE.Object3D): this;
|
|
51
51
|
loadCharacter(config: CharacterConfig): Promise<this>;
|
|
52
52
|
focus(regionName: string, duration?: number): Promise<void>;
|
|
@@ -57,7 +57,7 @@ export declare class DPthree {
|
|
|
57
57
|
setControlsVisible(visible: boolean): this;
|
|
58
58
|
getCameraState(): import("./types").CameraState;
|
|
59
59
|
setCameraState(position: [number, number, number], target: [number, number, number], _animate?: boolean): this;
|
|
60
|
-
get controller():
|
|
60
|
+
get controller(): ThreeAnnotationController;
|
|
61
61
|
update(): void;
|
|
62
62
|
expandRegion(name: string, duration?: number): this;
|
|
63
63
|
collapseRegion(name: string, duration?: number): this;
|
|
@@ -75,17 +75,8 @@ export declare class DPthree {
|
|
|
75
75
|
* @returns Validation result with found/missing bones and morphs
|
|
76
76
|
*/
|
|
77
77
|
validateCharacter(expectedBones?: Record<string, string>, expectedMorphs?: string[]): CharacterValidationResult;
|
|
78
|
-
/**
|
|
79
|
-
* Get all bone names in the loaded model
|
|
80
|
-
*/
|
|
81
78
|
getBoneNames(): string[];
|
|
82
|
-
/**
|
|
83
|
-
* Get all morph target names in the loaded model
|
|
84
|
-
*/
|
|
85
79
|
getMorphNames(): string[];
|
|
86
|
-
/**
|
|
87
|
-
* Get all mesh names in the loaded model
|
|
88
|
-
*/
|
|
89
80
|
getMeshNames(): string[];
|
|
90
81
|
}
|
|
91
82
|
export interface ValidationItem {
|
|
@@ -107,7 +98,7 @@ export interface CharacterValidationResult {
|
|
|
107
98
|
};
|
|
108
99
|
summary: string;
|
|
109
100
|
}
|
|
110
|
-
export {
|
|
111
|
-
export {
|
|
112
|
-
export {
|
|
101
|
+
export { ThreeAnnotationController as CameraController } from './ThreeAnnotationController';
|
|
102
|
+
export { ThreeAnnotationMarkers as Markers3D } from './ThreeAnnotationMarkers';
|
|
103
|
+
export { HtmlAnnotationMarkers as MarkersHTML } from './HtmlAnnotationMarkers';
|
|
113
104
|
export { CameraDOMControls as Controls } from './DOMControls';
|
|
@@ -134,7 +134,7 @@ export declare function getSemanticHorizontalSignForSide(side: 'left' | 'right',
|
|
|
134
134
|
export declare function getSemanticHorizontalSign(name: string, laterality: AnnotationLaterality): 1 | -1 | null;
|
|
135
135
|
export declare function resolveRegionCameraAngle(region: Region, laterality: AnnotationLaterality): number | undefined;
|
|
136
136
|
export declare function resolveRegionVisibilityCameraAngle(region: Region, laterality: AnnotationLaterality): number | undefined;
|
|
137
|
-
export declare function toWorldDirection(model: Object3D | null,
|
|
137
|
+
export declare function toWorldDirection(model: Object3D | null, direction: Vector3): Vector3;
|
|
138
138
|
export declare function getWorldDirectionForCameraAngle(model: Object3D | null, angle: number): Vector3;
|
|
139
139
|
export declare function getModelLocalOrbitAngle(model: Object3D | null, center: Vector3, position: Vector3): number;
|
|
140
140
|
export declare function passesMarkerCameraAngleGate(o: {
|
|
@@ -142,15 +142,9 @@ export declare function passesMarkerCameraAngleGate(o: {
|
|
|
142
142
|
currentCameraAngle?: number;
|
|
143
143
|
rangeDegrees?: number;
|
|
144
144
|
}): boolean;
|
|
145
|
-
/** Reduce scene objects to a world-space annotation anchor; numeric camera math stays in Rust. */
|
|
146
145
|
export declare function resolveFaceCenter(model: Object3D, region: Region, profile?: BoneResolutionProfile | null): {
|
|
147
146
|
center: Vector3;
|
|
148
|
-
|
|
149
|
-
debugInfo: string[];
|
|
150
|
-
headBonePosition?: undefined;
|
|
151
|
-
} | {
|
|
152
|
-
center: Vector3;
|
|
153
|
-
headBonePosition: Vector3 | undefined;
|
|
147
|
+
headBonePosition?: Vector3;
|
|
154
148
|
method: string;
|
|
155
149
|
debugInfo: string[];
|
|
156
150
|
};
|
|
@@ -7,10 +7,6 @@ export interface ResolvedMarkerAnchorRegion {
|
|
|
7
7
|
projection: MarkerAnchorProjectionMode;
|
|
8
8
|
useLegacyRegionSemantics: boolean;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Convert explicit marker-anchor intent into the legacy region target fields
|
|
12
|
-
* that the current marker renderers understand.
|
|
13
|
-
*/
|
|
14
10
|
export declare function resolveMarkerAnchorRegion(region: Region): ResolvedMarkerAnchorRegion;
|
|
15
11
|
export declare function shouldUseFaceCenterForMarkerAnchor(resolved: ResolvedMarkerAnchorRegion): boolean;
|
|
16
12
|
export declare function shouldProjectMarkerAnchorToSurface(resolved: ResolvedMarkerAnchorRegion, legacyDefault: boolean): boolean;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type {
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
1
|
+
export { ThreeAnnotations, CameraController, Markers3D, MarkersHTML, Controls } from './ThreeAnnotations';
|
|
2
|
+
export type { ThreeAnnotationsConfig, CharacterValidationResult, ValidationCategory, ValidationItem } from './ThreeAnnotations';
|
|
3
|
+
export { ThreeAnnotationController } from './ThreeAnnotationController';
|
|
4
|
+
export type { ThreeAnnotationControls } from './ThreeAnnotationControls';
|
|
5
|
+
export type { MarkerStateSnapshot } from './ThreeAnnotationController';
|
|
6
|
+
export { ThreeAnnotationMarkers } from './ThreeAnnotationMarkers';
|
|
7
|
+
export { HtmlAnnotationMarkers } from './HtmlAnnotationMarkers';
|
|
8
|
+
export { OverlayAnnotationMarkers } from './OverlayAnnotationMarkers';
|
|
8
9
|
export { CameraDOMControls, RUNTIME_ANNOTATION_REGION_PREFIX, filterCameraViewRegions, isRuntimeAnnotationRegionName, buildRegionDisplayOptions } from './DOMControls';
|
|
9
10
|
export type { DOMControlRegion, DOMControlsConfig } from './DOMControls';
|
|
10
11
|
export { resolveMarkerAnchorRegion, shouldProjectMarkerAnchorToSurface, shouldUseFaceCenterForMarkerAnchor } from './annotationAnchorModel';
|
|
@@ -17,4 +18,4 @@ export type { RuntimeAnnotationPreviewLifecycleOptions } from './runtimeAnnotati
|
|
|
17
18
|
export { inferRuntimeAnnotationPreviewSide, pickContinuumAnnotationAuId } from './runtimeAnnotationPreviewSide';
|
|
18
19
|
export { boneResolutionProfile } from './boneResolutionProfile';
|
|
19
20
|
export { resolveAnnotationCharacterConfig, RustAnnotationCameraCore, createRustAnnotationCameraCore, getDefaultAnnotationLaterality, getSemanticHorizontalSignForSide, getSemanticHorizontalSign, resolveRegionCameraAngle, resolveRegionVisibilityCameraAngle, toWorldDirection, getWorldDirectionForCameraAngle, getModelLocalOrbitAngle, passesMarkerCameraAngleGate, resolveFaceCenter, detectAnnotationLaterality, } from './adapter';
|
|
20
|
-
export type { AnnotationCharacterConfig, AnnotationAnchorPoint, AnnotationMarkerAnchor, AnnotationMarkerAnchorType, AnnotationFocusTarget, AnnotationAnchoredRegion, RuntimeAnnotationMetadata, RuntimeAnnotationOptions, RuntimeAnnotationRegionSummary, RuntimeAnnotationSide, RuntimeAnnotationTargetType, CameraState, FocusPosition,
|
|
21
|
+
export type { AnnotationCharacterConfig, AnnotationAnchorPoint, AnnotationMarkerAnchor, AnnotationMarkerAnchorType, AnnotationFocusTarget, AnnotationAnchoredRegion, RuntimeAnnotationMetadata, RuntimeAnnotationOptions, RuntimeAnnotationRegionSummary, RuntimeAnnotationSide, RuntimeAnnotationTargetType, CameraState, FocusPosition, ThreeAnnotationControllerConfig, RegionChangeCallback, CharacterChangeCallback, AnnotationRegion, AnnotationRegistry, AnnotationRegionChangeCallback, AnnotationCharacterChangeCallback, LineStyle, LineCurve, NamedDirection, LineConfig, MarkerStyleOverrides, ExpandAnimation, ExpandedRegionState, FallbackConfig, MarkerGroup, Region, MarkerStyle, BoneResolutionProfile, AnnotationLaterality, } from './types';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type LifecycleEffect = {
|
|
2
|
+
kind: 'visibility' | 'style' | 'previewStart' | 'previewEnd';
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
style?: '3d' | 'html';
|
|
5
|
+
};
|
|
6
|
+
/** Clock/queue transport only. All deadline and effect decisions belong to Rust. */
|
|
7
|
+
export declare class AnnotationLifecycleBridge {
|
|
8
|
+
private readonly mode;
|
|
9
|
+
private readonly duration;
|
|
10
|
+
private readonly apply;
|
|
11
|
+
private readiness;
|
|
12
|
+
private initializing;
|
|
13
|
+
private core;
|
|
14
|
+
private timer;
|
|
15
|
+
private pending;
|
|
16
|
+
private initialized;
|
|
17
|
+
private commandRevision;
|
|
18
|
+
constructor(mode: 'preview' | 'visibility', duration: number, apply: (effects: LifecycleEffect[]) => void);
|
|
19
|
+
/** The current attempt; dispatching after a failed attempt can start a retry. */
|
|
20
|
+
get ready(): Promise<void>;
|
|
21
|
+
private initialize;
|
|
22
|
+
private drainPending;
|
|
23
|
+
dispatch(operation: string, options?: unknown): void;
|
|
24
|
+
private execute;
|
|
25
|
+
isActive(): boolean;
|
|
26
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ThreeAnnotationController } from './ThreeAnnotationController';
|
|
2
2
|
import type { MarkerStyle } from './types';
|
|
3
3
|
export declare const DEFAULT_MARKER_AUTO_HIDE_MS = 5000;
|
|
4
4
|
export type MarkerLifecycleRevealOptions = {
|
|
@@ -10,12 +10,13 @@ export type MarkerLifecycleRevealSource = {
|
|
|
10
10
|
markerStyle?: MarkerStyle;
|
|
11
11
|
playIntroOnLoad?: boolean;
|
|
12
12
|
};
|
|
13
|
-
type
|
|
13
|
+
type Controller = Pick<ThreeAnnotationController, 'setMarkersVisible' | 'setMarkerStyle'>;
|
|
14
14
|
export declare function createMarkerLifecycleRevealOptions(config: MarkerLifecycleRevealSource | null | undefined): MarkerLifecycleRevealOptions;
|
|
15
|
-
export declare function createMarkerVisibilityLifecycle(getController: () =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export declare function createMarkerVisibilityLifecycle(getController: () => Controller | null, defaultDurationMs?: number): {
|
|
16
|
+
readonly ready: Promise<void>;
|
|
17
|
+
setManualVisibility: (visible: boolean) => void;
|
|
18
|
+
prepareForCharacterLoad: () => void;
|
|
19
|
+
showForCharacterLoad: (options?: MarkerLifecycleRevealOptions) => void;
|
|
20
|
+
dispose: () => void;
|
|
20
21
|
};
|
|
21
22
|
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { NativeAnnotationRuntime } from './runtime';
|
|
3
|
+
type Bounds = {
|
|
4
|
+
min: number[];
|
|
5
|
+
max: number[];
|
|
6
|
+
};
|
|
7
|
+
export interface AnnotationModelObservation {
|
|
8
|
+
bounds: Bounds;
|
|
9
|
+
quaternion: number[];
|
|
10
|
+
inverse: number[];
|
|
11
|
+
objects: {
|
|
12
|
+
id: number;
|
|
13
|
+
name: string;
|
|
14
|
+
kind: string;
|
|
15
|
+
parent: number | null;
|
|
16
|
+
position: number[];
|
|
17
|
+
bounds: Bounds | null;
|
|
18
|
+
matrix: number[];
|
|
19
|
+
inverse: number[];
|
|
20
|
+
morphNames: string[];
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
export declare function readAttribute(attribute: THREE.BufferAttribute | THREE.InterleavedBufferAttribute): Float32Array;
|
|
24
|
+
/** Stable native handle table. No region matching or anchor policy lives here. */
|
|
25
|
+
export declare class AnnotationModelObserver {
|
|
26
|
+
readonly model: THREE.Object3D;
|
|
27
|
+
readonly objects: Map<number, THREE.Object3D<THREE.Object3DEventMap>>;
|
|
28
|
+
readonly meshes: THREE.Mesh[];
|
|
29
|
+
private readonly ids;
|
|
30
|
+
constructor(model: THREE.Object3D);
|
|
31
|
+
id(object: THREE.Object3D): number | undefined;
|
|
32
|
+
capture(): AnnotationModelObservation;
|
|
33
|
+
observe(runtime: NativeAnnotationRuntime): void;
|
|
34
|
+
transforms(runtime: NativeAnnotationRuntime): Float32Array;
|
|
35
|
+
morphAnchors(runtime: NativeAnnotationRuntime): Record<string, {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
z: number;
|
|
39
|
+
}>;
|
|
40
|
+
/** Rust selects influenced vertices; Three evaluates the current native pose. */
|
|
41
|
+
observeFocus(runtime: NativeAnnotationRuntime, request: unknown): void;
|
|
42
|
+
}
|
|
43
|
+
export declare function observeAnnotationModel(model: THREE.Object3D): AnnotationModelObservation;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { requireInitializedEmbodyCore } from '@lovelace_lol/embody/wasm';
|
|
2
|
+
import type { AnnotationAnchoredRegion, AnnotationCharacterConfig, CameraState, ExpandedRegionState, MarkerStyle, MarkerStyleOverrides, LineConfig } from './types';
|
|
3
|
+
export declare function annotationQuery<T>(operation: string, payload: unknown): T;
|
|
4
|
+
export type NativeAnnotationRuntime = InstanceType<ReturnType<typeof requireInitializedEmbodyCore>['AnnotationRuntime']>;
|
|
5
|
+
export interface MarkerDescriptor {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
label: string;
|
|
9
|
+
title: string;
|
|
10
|
+
htmlText: string;
|
|
11
|
+
style: Required<Omit<MarkerStyleOverrides, 'line'>> & {
|
|
12
|
+
line: Required<LineConfig>;
|
|
13
|
+
};
|
|
14
|
+
radius: number;
|
|
15
|
+
arrowLength: number;
|
|
16
|
+
arrowRadius: number;
|
|
17
|
+
}
|
|
18
|
+
export interface AnnotationSnapshot {
|
|
19
|
+
generation: number;
|
|
20
|
+
revision: number;
|
|
21
|
+
descriptorRevision: number;
|
|
22
|
+
configRevision: number;
|
|
23
|
+
disposed: boolean;
|
|
24
|
+
loaded: boolean;
|
|
25
|
+
visible: boolean;
|
|
26
|
+
style: MarkerStyle;
|
|
27
|
+
currentRegion: string | null;
|
|
28
|
+
solo: string | null;
|
|
29
|
+
regions: AnnotationAnchoredRegion[];
|
|
30
|
+
config: AnnotationCharacterConfig;
|
|
31
|
+
descriptors: MarkerDescriptor[];
|
|
32
|
+
camera: CameraState;
|
|
33
|
+
expanded: ExpandedRegionState[];
|
|
34
|
+
}
|
|
35
|
+
export interface SurfaceQuery {
|
|
36
|
+
id: number;
|
|
37
|
+
generation: number;
|
|
38
|
+
phase: number;
|
|
39
|
+
origin: [number, number, number];
|
|
40
|
+
direction: [number, number, number];
|
|
41
|
+
far: number;
|
|
42
|
+
}
|
|
43
|
+
/** Only annotation contract data crosses Wasm; host resources/metadata stay borrowed. */
|
|
44
|
+
export declare function annotationConfigInput(config: AnnotationCharacterConfig): Record<string, unknown>;
|
|
45
|
+
/** Profile transport selects contract fields without traversing host metadata. */
|
|
46
|
+
export declare function annotationProfileInput(profile: unknown): unknown;
|
|
@@ -5,9 +5,9 @@ export interface RuntimeAnnotationPreviewLifecycleOptions {
|
|
|
5
5
|
onPreviewStart?: () => void;
|
|
6
6
|
onPreviewEnd?: () => void;
|
|
7
7
|
}
|
|
8
|
-
/** Framework-independent annotation preview lifetime; hosts supply input events. */
|
|
9
8
|
export declare function createRuntimeAnnotationPreviewLifecycle(options: RuntimeAnnotationPreviewLifecycleOptions): {
|
|
10
|
-
|
|
9
|
+
readonly ready: Promise<void>;
|
|
10
|
+
start: (forceRefresh?: boolean) => void;
|
|
11
11
|
end: () => void;
|
|
12
12
|
scheduleEnd: () => void;
|
|
13
13
|
isActive: () => boolean;
|
|
@@ -3,8 +3,4 @@ export declare function inferRuntimeAnnotationPreviewSide(auId: number, profile:
|
|
|
3
3
|
auToMorphs?: unknown;
|
|
4
4
|
auToBones?: unknown;
|
|
5
5
|
} | null | undefined): RuntimeAnnotationSide | undefined;
|
|
6
|
-
/**
|
|
7
|
-
* Pick which continuum AU to annotate. While a drag gesture is sticky, keep
|
|
8
|
-
* the original side so crossing 0 does not rebuild runtime markers mid-drag.
|
|
9
|
-
*/
|
|
10
6
|
export declare function pickContinuumAnnotationAuId(value: number, negId: number, posId: number, stickyId: number | null): number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import type { AnnotationAnchoredRegion, RuntimeAnnotationSide } from './types';
|
|
3
3
|
export declare function getRuntimeAnnotationSide(region: AnnotationAnchoredRegion): RuntimeAnnotationSide | null;
|
|
4
|
-
export declare function getRuntimeAUMorphAnchorPoint(region: AnnotationAnchoredRegion, mesh: THREE.Mesh): THREE.Vector3 | null;
|
|
5
4
|
export declare function getRuntimeAUMeshSideOffset(region: AnnotationAnchoredRegion, sideSign: number, modelSize: THREE.Vector3): THREE.Vector3 | null;
|
|
5
|
+
/** Reads native attributes; both candidate selection and anchor reduction run in Rust. */
|
|
6
|
+
export declare function getRuntimeAUMorphAnchorPoint(region: AnnotationAnchoredRegion, mesh: THREE.Mesh): THREE.Vector3 | null;
|