@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovelace_lol/embody",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Renderer-agnostic character animation runtime for facial AUs, visemes, and bone-driven motion",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"author": "Jonathan Sutton Fields",
|
|
93
93
|
"license": "MIT",
|
|
94
94
|
"packageManager": "npm@10.9.2",
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "1f88a30576b4be1f078d818d5b01d6d9eab000fc"
|
|
96
96
|
}
|
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import type { Region, CharacterConfig, MarkerStyleOverrides, LineConfig, ExpandAnimation, ExpandedRegionState } from './types';
|
|
3
|
-
interface MarkerConfig {
|
|
4
|
-
markerRadius?: number;
|
|
5
|
-
markerColor?: number;
|
|
6
|
-
lineColor?: number;
|
|
7
|
-
lineLength?: number;
|
|
8
|
-
labelColor?: string;
|
|
9
|
-
labelBackground?: string;
|
|
10
|
-
labelFontSize?: number;
|
|
11
|
-
labelScale?: number;
|
|
12
|
-
}
|
|
13
|
-
export declare function shouldShow3DMarker(params: {
|
|
14
|
-
name: string;
|
|
15
|
-
hiddenChildren: Set<string>;
|
|
16
|
-
soloedMarker: string | null;
|
|
17
|
-
markerAngle?: number;
|
|
18
|
-
currentCameraAngle?: number;
|
|
19
|
-
}): boolean;
|
|
20
|
-
export declare function resolveViewportConstrainedLineScale(params: {
|
|
21
|
-
startClip: THREE.Vector4;
|
|
22
|
-
endClip: THREE.Vector4;
|
|
23
|
-
safeX: number;
|
|
24
|
-
safeY: number;
|
|
25
|
-
minLengthRatio?: number;
|
|
26
|
-
}): {
|
|
27
|
-
visible: boolean;
|
|
28
|
-
lineScale: number;
|
|
29
|
-
};
|
|
30
|
-
export declare function resolveViewportSafeBounds(params: {
|
|
31
|
-
labelScaleX: number;
|
|
32
|
-
labelScaleY: number;
|
|
33
|
-
projectionXScale: number;
|
|
34
|
-
projectionYScale: number;
|
|
35
|
-
viewportWidth: number;
|
|
36
|
-
viewportHeight: number;
|
|
37
|
-
edgePaddingPx?: number;
|
|
38
|
-
}): {
|
|
39
|
-
safeX: number;
|
|
40
|
-
safeY: number;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Pure 3D visual markers for annotations.
|
|
44
|
-
*
|
|
45
|
-
* SIMPLE RULE: Lines always point AWAY from model center.
|
|
46
|
-
* - Horizontal: left annotations go left, right go right
|
|
47
|
-
* - Vertical: high annotations go up, low go down
|
|
48
|
-
*/
|
|
49
|
-
export declare class DPthree3DMarkers {
|
|
50
|
-
private scene;
|
|
51
|
-
private camera;
|
|
52
|
-
private domElement;
|
|
53
|
-
private model;
|
|
54
|
-
private regions;
|
|
55
|
-
private currentRegion;
|
|
56
|
-
private onSelect;
|
|
57
|
-
private config;
|
|
58
|
-
private markerGroup;
|
|
59
|
-
private markerMeshes;
|
|
60
|
-
private lineMeshes;
|
|
61
|
-
private lineEndpoints;
|
|
62
|
-
private labelSprites;
|
|
63
|
-
private labelScales;
|
|
64
|
-
private originalLineLengths;
|
|
65
|
-
private boneRefs;
|
|
66
|
-
private localOffsets;
|
|
67
|
-
private modelCenter;
|
|
68
|
-
private modelSize;
|
|
69
|
-
private modelMeshes;
|
|
70
|
-
private regionLoadHasFreshMatrices;
|
|
71
|
-
private isZoomedIn;
|
|
72
|
-
private zoomThreshold;
|
|
73
|
-
private autoCollapseThreshold;
|
|
74
|
-
private lastCameraDistance;
|
|
75
|
-
private markerLayoutDirty;
|
|
76
|
-
private visibilityAnimationActive;
|
|
77
|
-
private readonly visibilityAnimationScheduler;
|
|
78
|
-
private visibilityAnimationStates;
|
|
79
|
-
private activeMarkerVisibilityAnimations;
|
|
80
|
-
private markerVisibilityAnimationStates;
|
|
81
|
-
private markerTargetVisibility;
|
|
82
|
-
private markerAngleGateVisibility;
|
|
83
|
-
private markerViewportVisibility;
|
|
84
|
-
private hasCameraAngleUpdateSnapshot;
|
|
85
|
-
private lastCameraAngleUpdatePosition;
|
|
86
|
-
private lastCameraAngleUpdateQuaternion;
|
|
87
|
-
private raycaster;
|
|
88
|
-
private mouse;
|
|
89
|
-
private scratchClipStart;
|
|
90
|
-
private scratchClipEnd;
|
|
91
|
-
private readonly scratchClipStartValues;
|
|
92
|
-
private readonly scratchClipEndValues;
|
|
93
|
-
private scratchWorldEnd;
|
|
94
|
-
private scratchConstrainedEnd;
|
|
95
|
-
private tempSurfacePoint;
|
|
96
|
-
private scratchArrowDirection;
|
|
97
|
-
private scratchArrowQuaternion;
|
|
98
|
-
private arrowUp;
|
|
99
|
-
private charLineDefaults;
|
|
100
|
-
private charMarkerDefaults;
|
|
101
|
-
private resolvedStyles;
|
|
102
|
-
private expandedRegions;
|
|
103
|
-
private parentChildIndex;
|
|
104
|
-
private childParentIndex;
|
|
105
|
-
private hiddenChildren;
|
|
106
|
-
private soloedMarker;
|
|
107
|
-
private markerGroups;
|
|
108
|
-
private groupVisibility;
|
|
109
|
-
private arrowMeshes;
|
|
110
|
-
private characterConfig;
|
|
111
|
-
private laterality;
|
|
112
|
-
private regionLoadGeneration;
|
|
113
|
-
constructor(inputConfig: {
|
|
114
|
-
scene: THREE.Scene;
|
|
115
|
-
camera: THREE.PerspectiveCamera;
|
|
116
|
-
domElement: HTMLElement;
|
|
117
|
-
onSelect: (name: string) => void;
|
|
118
|
-
markerConfig?: MarkerConfig;
|
|
119
|
-
});
|
|
120
|
-
/** Preserve marker state while a scene replaces its renderer canvas. */
|
|
121
|
-
setDomElement(element: HTMLElement): void;
|
|
122
|
-
setModel(model: THREE.Object3D): void;
|
|
123
|
-
loadRegions(config: CharacterConfig, options?: {
|
|
124
|
-
sliceSurfaceQueries?: boolean;
|
|
125
|
-
}): Promise<void>;
|
|
126
|
-
/**
|
|
127
|
-
* Update a region's configuration and recreate its marker.
|
|
128
|
-
* This is the general method for updating any region properties.
|
|
129
|
-
*
|
|
130
|
-
* @param regionName - Name of the region to update
|
|
131
|
-
* @param update - Partial region config to merge with existing config
|
|
132
|
-
*/
|
|
133
|
-
updateRegion(regionName: string, update: Partial<Region>): void;
|
|
134
|
-
removeRegion(regionName: string): void;
|
|
135
|
-
/**
|
|
136
|
-
* Remove all marker components for a region (marker, line, label, bone refs)
|
|
137
|
-
*/
|
|
138
|
-
private removeMarkerComponents;
|
|
139
|
-
updateRegionMeshes(regionName: string, meshNames: string[]): void;
|
|
140
|
-
/**
|
|
141
|
-
* Reposition an existing marker to a new position.
|
|
142
|
-
* This moves the marker, line, and label without recreating them.
|
|
143
|
-
*
|
|
144
|
-
* @param regionName - Name of the region to reposition
|
|
145
|
-
* @param newPosition - New world position for the marker
|
|
146
|
-
*/
|
|
147
|
-
repositionMarker(regionName: string, newPosition: THREE.Vector3): void;
|
|
148
|
-
/**
|
|
149
|
-
* Get the current position of a marker
|
|
150
|
-
*/
|
|
151
|
-
getMarkerPosition(regionName: string): THREE.Vector3 | null;
|
|
152
|
-
/**
|
|
153
|
-
* Resolve the effective style for a region by merging:
|
|
154
|
-
* global defaults -> character defaults -> region style
|
|
155
|
-
*/
|
|
156
|
-
private resolveRegionStyle;
|
|
157
|
-
/**
|
|
158
|
-
* Resolve a named direction or custom vector to a THREE.Vector3.
|
|
159
|
-
* For 'camera' direction, returns direction from position toward current camera.
|
|
160
|
-
*/
|
|
161
|
-
private resolveLineDirection;
|
|
162
|
-
/**
|
|
163
|
-
* Create a bezier curve between two points.
|
|
164
|
-
*/
|
|
165
|
-
private createBezierCurve;
|
|
166
|
-
/**
|
|
167
|
-
* Create an arc curve between two points.
|
|
168
|
-
*/
|
|
169
|
-
private createArcCurve;
|
|
170
|
-
private unpackCurvePoints;
|
|
171
|
-
/**
|
|
172
|
-
* Create a styled line with support for dashed/dotted, curves, and arrow heads.
|
|
173
|
-
*/
|
|
174
|
-
private createStyledLine;
|
|
175
|
-
/**
|
|
176
|
-
* Create an arrow head cone mesh.
|
|
177
|
-
*/
|
|
178
|
-
private createArrowHead;
|
|
179
|
-
setCurrentRegion(name: string | null): void;
|
|
180
|
-
/**
|
|
181
|
-
* Create a marker for an annotation.
|
|
182
|
-
*
|
|
183
|
-
* Algorithm:
|
|
184
|
-
* 1. Find annotation center from bones/meshes
|
|
185
|
-
* 2. Determine best outward direction based on annotation type, cameraAngle, or style.lineDirection
|
|
186
|
-
* 3. Raycast from outside toward annotation center to find surface point
|
|
187
|
-
* 4. Line extends outward from surface with configured styling
|
|
188
|
-
*
|
|
189
|
-
*/
|
|
190
|
-
private resolveMarkerPlacement;
|
|
191
|
-
private createMarker;
|
|
192
|
-
private createMarkerInSlices;
|
|
193
|
-
private renderMarker;
|
|
194
|
-
/**
|
|
195
|
-
* Embody Rust owns endpoint layout; the Three adapter applies the returned positions
|
|
196
|
-
* to its Three.js marker geometry and labels.
|
|
197
|
-
*/
|
|
198
|
-
private separateOverlappingMarkers;
|
|
199
|
-
/**
|
|
200
|
-
* Determine the outward direction for marker placement based on annotation type.
|
|
201
|
-
*
|
|
202
|
-
* This uses semantic knowledge about body parts:
|
|
203
|
-
* - Face/eyes/mouth: forward (positive Z)
|
|
204
|
-
* - Back: backward (negative Z)
|
|
205
|
-
* - Left/right parts: semantic side, resolved against model laterality
|
|
206
|
-
* - Feet: down (negative Y)
|
|
207
|
-
* - If cameraAngle is specified, use that angle
|
|
208
|
-
* - Default: direction from model center to annotation center
|
|
209
|
-
*/
|
|
210
|
-
private getOutwardDirection;
|
|
211
|
-
/**
|
|
212
|
-
* Find surface point by raycasting from OUTSIDE toward the annotation center.
|
|
213
|
-
* This ensures we hit the outer surface facing the outward direction.
|
|
214
|
-
*/
|
|
215
|
-
private findSurfacePoint;
|
|
216
|
-
private findSurfacePointInSlices;
|
|
217
|
-
private getSuffixPattern;
|
|
218
|
-
/**
|
|
219
|
-
* Get center point and bounding box of annotation's bones/meshes.
|
|
220
|
-
* Uses fuzzy matching to handle bone names with numeric suffixes.
|
|
221
|
-
*/
|
|
222
|
-
private getRegionCenterAndBox;
|
|
223
|
-
private formatLabelText;
|
|
224
|
-
private buildLabelTexture;
|
|
225
|
-
private createLabelSprite;
|
|
226
|
-
private updateLabelSprite;
|
|
227
|
-
private updateMarkerStyles;
|
|
228
|
-
private getResolvedLineConfig;
|
|
229
|
-
private getViewportSafeBounds;
|
|
230
|
-
private updateMarkerGeometry;
|
|
231
|
-
private updateMarkerLineLayout;
|
|
232
|
-
private onClick;
|
|
233
|
-
/**
|
|
234
|
-
* Update marker positions to follow animated bones.
|
|
235
|
-
* Uses stored bone references and local offsets for efficiency.
|
|
236
|
-
*/
|
|
237
|
-
private updateMarkerPositions;
|
|
238
|
-
/**
|
|
239
|
-
* Find the primary bone for a region (for animation tracking).
|
|
240
|
-
*/
|
|
241
|
-
private findPrimaryBone;
|
|
242
|
-
/**
|
|
243
|
-
* Per-frame update: distance-based scaling + explicit cameraAngle visibility.
|
|
244
|
-
* Markers scale continuously with camera distance to maintain consistent screen size.
|
|
245
|
-
* Occlusion is handled by the GPU via depth testing (depthTest: true).
|
|
246
|
-
*/
|
|
247
|
-
update(): void;
|
|
248
|
-
private refreshLaterality;
|
|
249
|
-
/**
|
|
250
|
-
* Apply zoom-based scaling to all markers, lines, and labels.
|
|
251
|
-
* Runs on zoom threshold crossings and when marker geometry changes.
|
|
252
|
-
*/
|
|
253
|
-
private applyZoomScale;
|
|
254
|
-
setVisible(visible: boolean): void;
|
|
255
|
-
private readObjectOpacity;
|
|
256
|
-
private setObjectOpacity;
|
|
257
|
-
private captureVisibilityAnimationStates;
|
|
258
|
-
private getVisibilityAnimationFactors;
|
|
259
|
-
private applyVisibilityAnimationStates;
|
|
260
|
-
private restoreVisibilityAnimationStates;
|
|
261
|
-
private stopAllMarkerVisibilityAnimations;
|
|
262
|
-
private stopMarkerVisibilityAnimation;
|
|
263
|
-
private getMarkerTargetVisibility;
|
|
264
|
-
private setMarkerObjectsVisible;
|
|
265
|
-
private getMarkerFallbackOpacity;
|
|
266
|
-
private getMarkerBaseLabelScale;
|
|
267
|
-
private captureMarkerVisibilityAnimationState;
|
|
268
|
-
private animateMarkerVisibility;
|
|
269
|
-
private stopVisibilityAnimation;
|
|
270
|
-
private animateVisibility;
|
|
271
|
-
clear(): void;
|
|
272
|
-
/**
|
|
273
|
-
* Solo a specific marker - hide all others.
|
|
274
|
-
* Pass null to unsolo.
|
|
275
|
-
*/
|
|
276
|
-
setSoloMarker(regionName: string | null): void;
|
|
277
|
-
/**
|
|
278
|
-
* Get currently soloed marker name.
|
|
279
|
-
*/
|
|
280
|
-
getSoloedMarker(): string | null;
|
|
281
|
-
/**
|
|
282
|
-
* Expand a parent region to show its children.
|
|
283
|
-
*/
|
|
284
|
-
expandRegion(regionName: string, animation?: ExpandAnimation, duration?: number): Promise<void>;
|
|
285
|
-
/**
|
|
286
|
-
* Collapse a parent region to hide its children.
|
|
287
|
-
*/
|
|
288
|
-
collapseRegion(regionName: string, duration?: number): Promise<void>;
|
|
289
|
-
/**
|
|
290
|
-
* Toggle expand/collapse state.
|
|
291
|
-
*/
|
|
292
|
-
toggleRegion(regionName: string, animation?: ExpandAnimation, duration?: number): void;
|
|
293
|
-
/**
|
|
294
|
-
* Get expanded state of all regions.
|
|
295
|
-
*/
|
|
296
|
-
getExpandedRegions(): ExpandedRegionState[];
|
|
297
|
-
/**
|
|
298
|
-
* Collapse all currently expanded regions.
|
|
299
|
-
* Called automatically when zooming out past threshold.
|
|
300
|
-
*/
|
|
301
|
-
private collapseAllRegions;
|
|
302
|
-
/**
|
|
303
|
-
* Animate a child marker in place using the same visibility curve as regular markers.
|
|
304
|
-
*/
|
|
305
|
-
private animateMarkerIn;
|
|
306
|
-
/**
|
|
307
|
-
* Animate a child marker out in place using the same visibility curve as regular markers.
|
|
308
|
-
*/
|
|
309
|
-
private animateMarkerOut;
|
|
310
|
-
/**
|
|
311
|
-
* Update line style for a specific region at runtime.
|
|
312
|
-
*/
|
|
313
|
-
updateLineStyle(regionName: string, lineConfig: Partial<LineConfig>): void;
|
|
314
|
-
/**
|
|
315
|
-
* Update marker style for a specific region at runtime.
|
|
316
|
-
*/
|
|
317
|
-
updateMarkerStyle(regionName: string, styleOverrides: Partial<MarkerStyleOverrides>): void;
|
|
318
|
-
dispose(): void;
|
|
319
|
-
}
|
|
320
|
-
export {};
|