@lovelace_lol/embody 0.0.12 → 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 +106 -23
- package/dist/index.js +3286 -5900
- 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/authoring.d.ts +1 -1
- package/dist/three/characterHost.d.ts +33 -5
- package/dist/three/characterTexturePalette.d.ts +6 -0
- package/dist/three/editor/SkeletonOverlay.d.ts +128 -0
- package/dist/three/editor/morphVertexPreview.d.ts +35 -0
- package/dist/three/index.d.ts +2 -0
- package/dist/three/modelMorphLayout.d.ts +13 -0
- package/dist/three/scene.d.ts +5 -0
- package/dist/three/sceneInkBackground.d.ts +11 -0
- package/dist/three/sceneInkBackgroundStyle.d.ts +5 -0
- package/dist/three.js +3286 -5900
- package/dist/three.js.map +1 -1
- package/dist/wasm/README.md +106 -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/README.md
CHANGED
|
@@ -33,7 +33,8 @@ The Rust core owns:
|
|
|
33
33
|
(`morphTarget` / `boneTransform` tracks) for the host mixer to schedule
|
|
34
34
|
- mesh-category routing and material profile data
|
|
35
35
|
- hair curves, hair physics, and appearance normalization
|
|
36
|
-
- annotation camera/marker
|
|
36
|
+
- annotation regions, camera gestures/flights/orbits, marker placement and visibility,
|
|
37
|
+
preview/reveal lifecycles, and humanoid template fitting
|
|
37
38
|
- profile-aware screen-space gaze geometry for eye/head AU trajectories
|
|
38
39
|
- renderer-neutral model analysis and packed live frame generation
|
|
39
40
|
|
|
@@ -53,9 +54,9 @@ disable the AU's mapped morphs or the viseme shapes.
|
|
|
53
54
|
The TypeScript adapter is intentionally limited to operations that require
|
|
54
55
|
Three.js objects: scene traversal, ClipIR ↔ `AnimationClip` conversion, frame
|
|
55
56
|
application, material writes, model loading/disposal, and default scene
|
|
56
|
-
construction.
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
construction. Annotation adapters capture DOM input, observe native geometry,
|
|
58
|
+
apply Rust camera/marker frames, render labels and release native resources.
|
|
59
|
+
Camera integration, region selection and marker state belong to Rust.
|
|
59
60
|
|
|
60
61
|
`ThreeFrameApplier.applyMeshMaterialConfigs(model, profile.meshes)` replays named
|
|
61
62
|
mesh visibility and material overrides when a host binds or replaces a profile.
|
|
@@ -67,31 +68,95 @@ do not need a separate mesh-visibility replay loop.
|
|
|
67
68
|
|
|
68
69
|
### Annotation runtime
|
|
69
70
|
|
|
70
|
-
`
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
`AnnotationRuntime` in `src/annotation_runtime/` owns the annotation behavior
|
|
72
|
+
and mutable state in Rust/Wasm: camera input and damping, framing and intro
|
|
73
|
+
transitions, authored/runtime regions, AU/bone target selection, laterality,
|
|
74
|
+
anchors, surface-query planning, expansion, solo, styles, visibility and layout.
|
|
75
|
+
`AnnotationLifecycle` owns preview/reveal deadlines and the effects they emit.
|
|
76
|
+
There is no TypeScript annotation state machine or OrbitControls dependency.
|
|
77
|
+
|
|
78
|
+
`ThreeAnnotationController` and the `ThreeAnnotations` convenience facade from
|
|
79
|
+
`@lovelace_lol/embody/three` provide native adapters. `ThreeAnnotationMarkers`,
|
|
80
|
+
`HtmlAnnotationMarkers`, and its `OverlayAnnotationMarkers` alias provide
|
|
81
|
+
marker-only views of the same Rust runtime. Their TypeScript code captures input,
|
|
82
|
+
serializes model observations, calls native raycasts and skinned-vertex evaluation,
|
|
83
|
+
applies packed Rust frames, creates labels, and owns renderer resources. Three
|
|
84
|
+
continues to own scene objects and GPU operations; those APIs cannot be replaced
|
|
85
|
+
by renderer-neutral Rust. Both marker styles share the same state and selection
|
|
86
|
+
rules. HTML occlusion uses Rust-planned rays evaluated by Three.
|
|
87
|
+
|
|
88
|
+
Rust fits marker endpoints before marker loading returns and on each update,
|
|
89
|
+
including additions, endpoint separation and reveal overshoot. Clipping uses
|
|
90
|
+
the displayed label dimensions and preserves the minimum leader-line length;
|
|
91
|
+
temporary overshoot clipping does not restart the reveal. Sphere sizing retains
|
|
92
|
+
the close-up scale and clamped distance scaling outside that range. Explicit
|
|
93
|
+
`markerAnchor.projectToSurface: false` also applies to `objects: ['*']` anchors.
|
|
94
|
+
HTML overlays align with the canvas rectangle inside its container, update on
|
|
95
|
+
resize/rebind, and restore borrowed parent positioning when the final view is
|
|
96
|
+
disposed. These coordinates assume axis-aligned CSS boxes without transforms.
|
|
97
|
+
|
|
98
|
+
AU morph anchors currently sample native deformed vertices during marker
|
|
99
|
+
preparation, then follow the selected object's transform. They do not yet
|
|
100
|
+
resample morph weights or skinning on subsequent frames. Animated surface
|
|
101
|
+
tracking requires cached vertex candidates and per-frame pose observations;
|
|
102
|
+
ordinary object-transform tracking does not provide that behavior.
|
|
103
|
+
|
|
104
|
+
This is a breaking replacement of the DPthree exports. Use
|
|
105
|
+
`ThreeAnnotationController.create(options)` or `ThreeAnnotations.create(options)`
|
|
106
|
+
to await Wasm initialization; synchronous constructors require an already initialized
|
|
107
|
+
core. Replace DPthree-prefixed types with `AnnotationCharacterConfig`,
|
|
108
|
+
`AnnotationRegion`, `AnnotationRegistry`, and the corresponding callback types.
|
|
109
|
+
The `controls` bridge retains `target`, `enabled`, damping/distance settings,
|
|
110
|
+
`update()`, and `change`/`start`/`end` listeners, but is not a Three `OrbitControls`
|
|
111
|
+
instance. Region and camera snapshots are observations; mutate through controller
|
|
112
|
+
methods. Explicit `undefined` fields in `updateAnnotationRegion` remove overrides.
|
|
113
|
+
`getCharacterConfig()` retains snapshot identity until configuration content or
|
|
114
|
+
the model changes; selection, visibility and camera input do not replace it.
|
|
115
|
+
Call `clearModel()` before releasing a removed model's native resources. The
|
|
116
|
+
controller retains renderer rebinding, canvas input reconnect and resource-drain
|
|
117
|
+
support through the scene's rendering controller.
|
|
118
|
+
Runtime preview region IDs retain the `runtime:annotation:` namespace.
|
|
119
|
+
|
|
120
|
+
When the annotation controller owns the renderer loop, it advances registered
|
|
121
|
+
native character mixers before observing annotation transforms and drawing the
|
|
122
|
+
scene. The first frame establishes the timer origin; skipped asynchronous draws
|
|
123
|
+
do not accumulate playback time. External render loops use the existing
|
|
124
|
+
`createScenePlaybackFrame` integration to advance character playback.
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import { ThreeAnnotations } from '@lovelace_lol/embody/three';
|
|
128
|
+
|
|
129
|
+
const annotations = await ThreeAnnotations.create({ scene, camera, domElement: canvas });
|
|
130
|
+
annotations.setModel(model);
|
|
131
|
+
await annotations.loadCharacter({ characterId: 'character', profilePresetId: 'cc4' });
|
|
132
|
+
// Host-owned render loop: call annotations.update() before renderer.render(...).
|
|
133
|
+
```
|
|
77
134
|
|
|
78
135
|
Applications pass `AnnotationCharacterConfig`; storage, agency, editor and
|
|
79
136
|
character-asset metadata remain host concerns. `loadRegions` defaults to
|
|
80
137
|
`resolveAnnotationCharacterConfig`, which resolves annotation and AU mapping
|
|
81
138
|
fields from an Embody preset without serializing unrelated host metadata.
|
|
82
139
|
An optional `resolveCharacterConfig` callback supports host profile intake.
|
|
140
|
+
`prepareRegionsForReveal` defers native marker construction until the first
|
|
141
|
+
`setMarkersVisible(true)` call. Later visibility changes reuse those resources;
|
|
142
|
+
Rust's loaded state resets when the model or configuration is replaced.
|
|
83
143
|
`prepareRegionsAndMarkersForReveal` accepts an already-resolved profile and
|
|
84
144
|
prepares native surface queries while the model pose is still stable.
|
|
85
145
|
Initial queries yield to a browser paint between meshes once a 4 ms slice is
|
|
86
|
-
spent. Each native mesh raycast is indivisible;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
146
|
+
spent. Each native mesh raycast is indivisible; slicing does not reduce total
|
|
147
|
+
raycast CPU time. Interactive edits retain synchronous queries so a marker samples
|
|
148
|
+
one pose. Rust generations reject stale profile, surface and reveal completions
|
|
149
|
+
after replacement, clearing, region edits or disposal. Camera requests settle when
|
|
150
|
+
completed or cancelled, including controller disposal.
|
|
151
|
+
|
|
152
|
+
The direct Wasm boundary uses JSON commands/snapshots for configuration and
|
|
153
|
+
primitive model observations with stable object IDs. Frames, vertex candidates,
|
|
154
|
+
transform observations and ray results use packed typed arrays; coordinates are
|
|
155
|
+
world-space, camera/visibility angles are degrees, durations are milliseconds,
|
|
156
|
+
and viewport dimensions are CSS pixels. The layouts and operations are maintained
|
|
157
|
+
in [the Rust runtime](src/annotation_runtime/mod.rs) and
|
|
158
|
+
[marker frames](src/annotation_runtime/markers.rs); generated Wasm declarations
|
|
159
|
+
remain the ABI type source. IDs are scoped to one model lifetime.
|
|
95
160
|
|
|
96
161
|
For first reveal, call `controller.prepareModelForRender(model, { signal })`
|
|
97
162
|
from the existing `beforeReveal` callback (or directly before attaching the
|
|
@@ -103,8 +168,14 @@ it settles, even after `controller.dispose()`. This prepares visible variants,
|
|
|
103
168
|
not every future hidden material or animation state. See the
|
|
104
169
|
[model readiness contract](docs/SCENE_READINESS.md#model-readiness).
|
|
105
170
|
|
|
106
|
-
`createMarkerVisibilityLifecycle`
|
|
107
|
-
`
|
|
171
|
+
`createMarkerVisibilityLifecycle` and `createRuntimeAnnotationPreviewLifecycle`
|
|
172
|
+
transport host events to `AnnotationLifecycle`; browser timers only wake Rust at
|
|
173
|
+
its next deadline. Factories can queue input while Wasm initializes; `ready`
|
|
174
|
+
reports the current initialization attempt. After an initialization failure,
|
|
175
|
+
the next command retries or adopts a core initialized by another scene. Failed
|
|
176
|
+
attempts discard their queued input. `dispose()` also discards pending input,
|
|
177
|
+
cancels timers and frees the runtime, so cleanup before readiness cannot replay
|
|
178
|
+
callbacks. Later calls create a fresh runtime, preserving host effect-replay cleanup.
|
|
108
179
|
React hosts forward user events and subscribe to controller state. They do not
|
|
109
180
|
need local copies of the camera, marker, placement or timer algorithms.
|
|
110
181
|
The convenience facade delegates to one controller-owned marker layer.
|
|
@@ -177,7 +248,7 @@ controller immediately. `ready` reports the initial attempt; failure retains the
|
|
|
177
248
|
controller for recovery through `setSettings`. `getSettings`, `getSnapshot` and
|
|
178
249
|
`subscribe` expose the requested preference, actual backend, status and errors.
|
|
179
250
|
Live changes prepare and replace only backend resources, preserving the character,
|
|
180
|
-
scene, camera, lighting and marker state. `
|
|
251
|
+
scene, camera, lighting and marker state. `ThreeAnnotationController({ rendering,
|
|
181
252
|
scene, camera, domElement: container })` retargets its existing loop and controls;
|
|
182
253
|
hosts persist settings and display status without recreating the scene.
|
|
183
254
|
|
|
@@ -549,3 +620,15 @@ values/curves, using their original profile mappings. `LEGACY_BODY_CONTROL_AUS`
|
|
|
549
620
|
is a deprecated reader-only historical identity snapshot for old CC4 records;
|
|
550
621
|
it is never consulted for current controls, actuation or profile compilation.
|
|
551
622
|
Unknown legacy names must be reported rather than silently omitted.
|
|
623
|
+
|
|
624
|
+
### Character-derived studio background
|
|
625
|
+
|
|
626
|
+
The Three `createCharacterHost` paints its container with soft gradients sampled
|
|
627
|
+
from the selected model's material and texture colors. The studio uses the
|
|
628
|
+
original visible ink strengths (24/12%, 22/10%, 18%) over a gunmetal base.
|
|
629
|
+
Embody owns palette extraction and updates after successful character replacement;
|
|
630
|
+
late extraction cannot repaint a newer selection or a disposed host. Disposal
|
|
631
|
+
restores the container's original inline background. Explicit saved backgrounds,
|
|
632
|
+
including `null` transparency, non-studio scene types and external scenes retain
|
|
633
|
+
their authored appearance. Polymer forwards the host; applications do not sample
|
|
634
|
+
textures or construct a second scene background.
|