@lovelace_lol/embody 0.0.6 → 0.0.8

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.
Files changed (127) hide show
  1. package/README.md +541 -2394
  2. package/dist/index.d.ts +2 -100
  3. package/dist/index.js +7714 -12951
  4. package/dist/index.js.map +1 -1
  5. package/dist/three/annotations/DOMControls.d.ts +73 -0
  6. package/dist/three/annotations/DPthree.d.ts +113 -0
  7. package/dist/three/annotations/DPthree3DMarkers.d.ts +319 -0
  8. package/dist/three/annotations/DPthreeCameraController.d.ts +414 -0
  9. package/dist/three/annotations/DPthreeHTMLMarkers.d.ts +131 -0
  10. package/dist/three/annotations/DPthreeMarkers.d.ts +52 -0
  11. package/dist/three/annotations/adapter.d.ts +157 -0
  12. package/dist/three/annotations/animationFrameTaskScheduler.d.ts +18 -0
  13. package/dist/three/annotations/annotationAnchorModel.d.ts +16 -0
  14. package/dist/three/annotations/annotationCameraCore.d.ts +5 -0
  15. package/dist/three/annotations/boneResolutionProfile.d.ts +7 -0
  16. package/dist/three/annotations/index.d.ts +20 -0
  17. package/dist/three/annotations/loadFrame.d.ts +2 -0
  18. package/dist/three/annotations/markerSurfaceRaycast.d.ts +11 -0
  19. package/dist/three/annotations/markerVisibilityLifecycle.d.ts +21 -0
  20. package/dist/three/annotations/modelRenderPreparation.d.ts +6 -0
  21. package/dist/three/annotations/runtimeAnnotationPreview.d.ts +15 -0
  22. package/dist/three/annotations/runtimeAnnotationPreviewSide.d.ts +10 -0
  23. package/dist/three/annotations/runtimeAnnotationSidePreview.d.ts +5 -0
  24. package/dist/three/annotations/types.d.ts +262 -0
  25. package/dist/three/gaze.d.ts +122 -0
  26. package/dist/three/index.d.ts +147 -0
  27. package/dist/three/model.d.ts +31 -0
  28. package/dist/three/modelSkinning.d.ts +3 -0
  29. package/dist/three/reference-pose.d.ts +73 -0
  30. package/dist/three/scene.d.ts +253 -0
  31. package/dist/three/sceneRenderingBinding.d.ts +22 -0
  32. package/dist/three.js +7696 -8936
  33. package/dist/three.js.map +1 -1
  34. package/dist/wasm/README.md +551 -62
  35. package/dist/wasm/auto.d.ts +1 -0
  36. package/dist/wasm/embody_wasm.d.ts +388 -52
  37. package/dist/wasm/embody_wasm.js +1514 -119
  38. package/dist/wasm/embody_wasm_bg.wasm +0 -0
  39. package/dist/wasm/embody_wasm_bg.wasm.d.ts +115 -40
  40. package/dist/wasm/index.d.ts +126 -0
  41. package/dist/wasm.d.ts +1 -43
  42. package/dist/wasm.js +1043 -239
  43. package/dist/wasm.js.map +1 -1
  44. package/package.json +34 -39
  45. package/service-worker/character-asset-service-worker.js +295 -0
  46. package/dist/authoring/boneAuthoring.d.ts +0 -132
  47. package/dist/camera/annotationCameraAngles.d.ts +0 -28
  48. package/dist/camera/cameraRelativeGaze.d.ts +0 -15
  49. package/dist/camera/rustAnnotationCameraCore.d.ts +0 -136
  50. package/dist/cljs.cjs +0 -362
  51. package/dist/cljs.cjs.map +0 -1
  52. package/dist/cljs.d.ts +0 -5
  53. package/dist/cljs.js +0 -359
  54. package/dist/cljs.js.map +0 -1
  55. package/dist/core/TsClipCompiler.d.ts +0 -51
  56. package/dist/core/WasmRuntimeCore.d.ts +0 -41
  57. package/dist/core/compositeAxis.d.ts +0 -4
  58. package/dist/core/contracts/abi.d.ts +0 -70
  59. package/dist/core/contracts/clip.d.ts +0 -44
  60. package/dist/core/contracts/frame.d.ts +0 -27
  61. package/dist/core/contracts/host.d.ts +0 -28
  62. package/dist/core/contracts/ids.d.ts +0 -15
  63. package/dist/core/contracts/index.d.ts +0 -10
  64. package/dist/core/contracts/model.d.ts +0 -31
  65. package/dist/core/contracts/primitives.d.ts +0 -17
  66. package/dist/core/contracts/skeletonFit.d.ts +0 -41
  67. package/dist/core/index.d.ts +0 -6
  68. package/dist/core/types.d.ts +0 -472
  69. package/dist/core.cjs +0 -343
  70. package/dist/core.cjs.map +0 -1
  71. package/dist/core.js +0 -323
  72. package/dist/core.js.map +0 -1
  73. package/dist/engines/three/Embody.d.ts +0 -372
  74. package/dist/engines/three/ThreeAnimationRuntime.d.ts +0 -203
  75. package/dist/engines/three/ThreeClipAdapter.d.ts +0 -24
  76. package/dist/engines/three/ThreeFrameApplier.d.ts +0 -68
  77. package/dist/engines/three/ThreeModelInspector.d.ts +0 -54
  78. package/dist/engines/three/bakedClipPartitioning.d.ts +0 -16
  79. package/dist/engines/three/balanceUtils.d.ts +0 -3
  80. package/dist/engines/three/characterHost.d.ts +0 -80
  81. package/dist/engines/three/characterScene.d.ts +0 -98
  82. package/dist/engines/three/hair/HairPhysicsController.d.ts +0 -124
  83. package/dist/engines/three/index.d.ts +0 -20
  84. package/dist/engines/three/modelLoader.d.ts +0 -61
  85. package/dist/engines/three/profileTestScene.d.ts +0 -52
  86. package/dist/engines/three/types.d.ts +0 -20
  87. package/dist/hair/appearance.d.ts +0 -29
  88. package/dist/index.cjs +0 -14871
  89. package/dist/index.cjs.map +0 -1
  90. package/dist/interfaces/Animation.d.ts +0 -315
  91. package/dist/interfaces/EmbodyRuntime.d.ts +0 -90
  92. package/dist/interfaces/Hair.d.ts +0 -181
  93. package/dist/interfaces/HairPhysics.d.ts +0 -90
  94. package/dist/interfaces/index.d.ts +0 -11
  95. package/dist/mappings/extendPresetWithProfile.d.ts +0 -17
  96. package/dist/mappings/types.d.ts +0 -309
  97. package/dist/mappings/visemeSystem.d.ts +0 -26
  98. package/dist/physics/HairPhysics.d.ts +0 -86
  99. package/dist/physics/RustHairPhysics.d.ts +0 -18
  100. package/dist/physics/index.d.ts +0 -6
  101. package/dist/preset.cjs +0 -2005
  102. package/dist/preset.cjs.map +0 -1
  103. package/dist/preset.js +0 -2003
  104. package/dist/preset.js.map +0 -1
  105. package/dist/presets/bettaFish.d.ts +0 -328
  106. package/dist/presets/cc4.d.ts +0 -145
  107. package/dist/presets/index.d.ts +0 -30
  108. package/dist/presets/registry.d.ts +0 -57
  109. package/dist/profiles/resolveProfileConfig.d.ts +0 -36
  110. package/dist/profiles/rustResolvedProfile.d.ts +0 -31
  111. package/dist/profiles/types.d.ts +0 -118
  112. package/dist/regions/normalizeRegionTree.d.ts +0 -6
  113. package/dist/regions/regionMapping.d.ts +0 -17
  114. package/dist/regions/types.d.ts +0 -122
  115. package/dist/skeletonTemplates/humanoidSkeletonTemplates.d.ts +0 -32
  116. package/dist/test/setupWasm.d.ts +0 -1
  117. package/dist/three.cjs +0 -9550
  118. package/dist/three.cjs.map +0 -1
  119. package/dist/validation/analyzeModel.d.ts +0 -68
  120. package/dist/validation/extractModelData.d.ts +0 -90
  121. package/dist/validation/generateMappingCorrections.d.ts +0 -32
  122. package/dist/validation/geometryHelpers.d.ts +0 -66
  123. package/dist/validation/types.d.ts +0 -10
  124. package/dist/validation/validateMappings.d.ts +0 -77
  125. package/dist/wasm.cjs +0 -302
  126. package/dist/wasm.cjs.map +0 -1
  127. package/dist/wasmTypes.d.ts +0 -123
@@ -1,315 +0,0 @@
1
- /**
2
- * Animation Interface
3
- *
4
- * Groups AU/morph/viseme methods, transitions, and mixer playback.
5
- */
6
- import type { TransitionHandle, AnimationPlayOptions, AnimationClipInfo, AnimationState, AnimationActionHandle, ClipOptions, ClipHandle, CompositeRotation, CurvePoint, SnippetChannel, AnimationBlendMode, MorphTargetDelta, AddMorphTargetOptions } from '../core/types';
7
- /** Loop mode for mixer clips */
8
- export type MixerLoopMode = 'once' | 'repeat' | 'pingpong';
9
- export interface Animation {
10
- /**
11
- * Set AU value immediately (no transition)
12
- * @param id - AU number (e.g., 12 for smile) or string ('12L' for left side)
13
- * @param v - Value 0-1
14
- * @param balance - Optional L/R balance: -1 = left only, 0 = both, +1 = right only
15
- */
16
- setAU(id: number | string, v: number, balance?: number): void;
17
- /**
18
- * Transition AU value smoothly over time
19
- * @param id - AU number or string
20
- * @param to - Target value 0-1
21
- * @param durationMs - Transition duration in milliseconds
22
- * @param balance - Optional L/R balance
23
- */
24
- transitionAU(id: number | string, to: number, durationMs?: number, balance?: number): TransitionHandle;
25
- /**
26
- * Get current AU value (from cached auValues)
27
- */
28
- getAU(id: number): number;
29
- /**
30
- * Set a continuum AU pair immediately (no animation).
31
- * @param negAU - AU ID for negative direction (e.g., 61 for eyes left)
32
- * @param posAU - AU ID for positive direction (e.g., 62 for eyes right)
33
- * @param continuumValue - Value from -1 (full negative) to +1 (full positive)
34
- * @param balance - Optional L/R balance for bilateral morphs
35
- */
36
- setContinuum(negAU: number, posAU: number, continuumValue: number, balance?: number): void;
37
- /**
38
- * Smoothly transition a continuum AU pair (e.g., eyes left/right, head up/down).
39
- * @param negAU - AU ID for negative direction
40
- * @param posAU - AU ID for positive direction
41
- * @param continuumValue - Target value from -1 (full negative) to +1 (full positive)
42
- * @param durationMs - Transition duration in milliseconds
43
- * @param balance - Optional L/R balance for bilateral morphs
44
- */
45
- transitionContinuum(negAU: number, posAU: number, continuumValue: number, durationMs?: number, balance?: number): TransitionHandle;
46
- /**
47
- * Set morph target value immediately (by key)
48
- * @param key - Morph target name (morphTargetDictionary key)
49
- * @param v - Value 0-1
50
- * @param meshNames - Optional specific meshes to target
51
- */
52
- setMorph(key: string, v: number, meshNames?: string[]): void;
53
- /**
54
- * Set morph influence value immediately (by index)
55
- * @param index - Morph target index (morphTargetInfluences slot)
56
- * @param v - Value 0-1
57
- * @param meshNames - Optional specific meshes to target
58
- */
59
- setMorphInfluence(index: number, v: number, meshNames?: string[]): void;
60
- /**
61
- * Transition morph target value smoothly (by key)
62
- * @param key - Morph target name (morphTargetDictionary key)
63
- * @param to - Target value 0-1
64
- * @param durationMs - Transition duration in milliseconds
65
- * @param meshNames - Optional specific meshes to target
66
- */
67
- transitionMorph(key: string, to: number, durationMs?: number, meshNames?: string[]): TransitionHandle;
68
- /**
69
- * Transition morph influence value smoothly (by index)
70
- * @param index - Morph target index (morphTargetInfluences slot)
71
- * @param to - Target value 0-1
72
- * @param durationMs - Transition duration in milliseconds
73
- * @param meshNames - Optional specific meshes to target
74
- */
75
- transitionMorphInfluence(index: number, to: number, durationMs?: number, meshNames?: string[]): TransitionHandle;
76
- /**
77
- * Add or replace a runtime morph target on a mesh.
78
- * Returns the morphTargetInfluences index assigned to the target.
79
- */
80
- addMorphTarget(target: MorphTargetDelta, options?: AddMorphTargetOptions): number;
81
- /**
82
- * Add multiple runtime morph targets and return their assigned indices keyed
83
- * by "meshName:name".
84
- */
85
- addMorphTargets(targets: MorphTargetDelta[], options?: AddMorphTargetOptions): Record<string, number>;
86
- /**
87
- * Ensure a named morph influence slot exists on the mesh.
88
- * If the target is missing, a zero-delta morph target is created.
89
- */
90
- ensureMorphInfluence(meshName: string, morphName: string): number;
91
- /**
92
- * Rebuild runtime morph caches after external geometry or dictionary changes.
93
- */
94
- refreshMorphTargets(meshNames?: string[]): void;
95
- /**
96
- * Set viseme value immediately (for lip-sync)
97
- * @param visemeIndex - Viseme index 0-14
98
- * @param value - Value 0-1
99
- * @param jawScale - Jaw movement multiplier (default 1.0)
100
- */
101
- setViseme(visemeIndex: number, value: number, jawScale?: number): void;
102
- /**
103
- * Transition viseme value smoothly
104
- */
105
- transitionViseme(visemeIndex: number, to: number, durationMs?: number, jawScale?: number): TransitionHandle;
106
- /**
107
- * Set viseme value by profile-defined slot id.
108
- */
109
- setVisemeById?(slotId: string, value: number, jawScale?: number): void;
110
- /**
111
- * Transition viseme value smoothly by profile-defined slot id.
112
- */
113
- transitionVisemeById?(slotId: string, to: number, durationMs?: number, jawScale?: number): TransitionHandle;
114
- /**
115
- * Set mix weight for an AU (blend between morph and bone contribution)
116
- */
117
- setAUMixWeight(id: number, weight: number): void;
118
- /**
119
- * Get current mix weight for an AU
120
- */
121
- getAUMixWeight(id: number): number;
122
- /**
123
- * Check if an AU has bilateral bone bindings (L and R nodes)
124
- * Used to determine if a balance slider should be shown for bone-only bilateral AUs
125
- */
126
- hasLeftRightBones(auId: number): boolean;
127
- /**
128
- * Pause all transitions
129
- */
130
- pause(): void;
131
- /**
132
- * Resume all transitions
133
- */
134
- resume(): void;
135
- /**
136
- * Check if engine is paused
137
- */
138
- getPaused(): boolean;
139
- /**
140
- * Clear all active transitions
141
- */
142
- clearTransitions(): void;
143
- /**
144
- * Get count of active transitions
145
- */
146
- getActiveTransitionCount(): number;
147
- /**
148
- * Reset all facial animation to neutral state
149
- */
150
- resetToNeutral(): void;
151
- /**
152
- * Load animation clips from a GLTF/GLB file.
153
- * Call this after onReady() with the animations array from the GLTF loader.
154
- * @param clips - Array of AnimationClip objects from GLTF loader
155
- */
156
- loadAnimationClips(clips: unknown[]): void;
157
- /**
158
- * Get list of all loaded animation clips.
159
- */
160
- getAnimationClips(): AnimationClipInfo[];
161
- /**
162
- * Remove a loaded animation clip by name.
163
- * @param clipName - Name of the animation clip to remove
164
- * @returns True when the clip existed and was removed
165
- */
166
- removeAnimationClip(clipName: string): boolean;
167
- /**
168
- * Play a loaded animation clip by name.
169
- * @param clipName - Name of the animation clip to play
170
- * @param options - Playback options (speed, intensity, loop, etc.)
171
- * @returns Handle for controlling the animation, or null if clip not found
172
- */
173
- playAnimation(clipName: string, options?: AnimationPlayOptions): AnimationActionHandle | null;
174
- /**
175
- * Stop a specific animation by name.
176
- * @param clipName - Name of the animation to stop
177
- */
178
- stopAnimation(clipName: string): void;
179
- /**
180
- * Stop all currently playing animations.
181
- */
182
- stopAllAnimations(): void;
183
- /**
184
- * Pause a specific animation by name.
185
- * @param clipName - Name of the animation to pause
186
- */
187
- pauseAnimation(clipName: string): void;
188
- /**
189
- * Resume a paused animation by name.
190
- * @param clipName - Name of the animation to resume
191
- */
192
- resumeAnimation(clipName: string): void;
193
- /**
194
- * Pause all currently playing animations.
195
- */
196
- pauseAllAnimations(): void;
197
- /**
198
- * Resume all paused animations.
199
- */
200
- resumeAllAnimations(): void;
201
- /**
202
- * Set the playback speed for a specific animation.
203
- * @param clipName - Name of the animation
204
- * @param speed - Playback speed multiplier (1.0 = normal, 0.5 = half, 2.0 = double)
205
- */
206
- setAnimationSpeed(clipName: string, speed: number): void;
207
- /**
208
- * Set the intensity/weight for a specific animation.
209
- * @param clipName - Name of the animation
210
- * @param intensity - Weight value from 0 (no effect) to 1 (full effect)
211
- */
212
- setAnimationIntensity(clipName: string, intensity: number): void;
213
- /**
214
- * Set the loop mode for a specific animation.
215
- * @param clipName - Name of the animation
216
- * @param loopMode - Loop policy for the mixer action
217
- */
218
- setAnimationLoopMode(clipName: string, loopMode: MixerLoopMode): void;
219
- /**
220
- * Set the repeat count for a specific animation.
221
- * @param clipName - Name of the animation
222
- * @param repeatCount - Number of repetitions, or undefined for the mixer default
223
- */
224
- setAnimationRepeatCount(clipName: string, repeatCount?: number): void;
225
- /**
226
- * Set reverse playback for a specific animation.
227
- * @param clipName - Name of the animation
228
- * @param reverse - Whether the mixer action should run backwards
229
- */
230
- setAnimationReverse(clipName: string, reverse: boolean): void;
231
- /**
232
- * Set the blend mode for a specific animation.
233
- * @param clipName - Name of the animation
234
- * @param blendMode - Mixer blend mode wrapper exposed to downstream UIs
235
- */
236
- setAnimationBlendMode(clipName: string, blendMode: AnimationBlendMode): void;
237
- /**
238
- * Seek a specific animation to a time in seconds.
239
- * @param clipName - Name of the animation
240
- * @param time - Target time in seconds
241
- */
242
- seekAnimation(clipName: string, time: number): void;
243
- /**
244
- * Set the global time scale for all animations.
245
- * @param timeScale - Global time scale multiplier
246
- */
247
- setAnimationTimeScale(timeScale: number): void;
248
- /**
249
- * Get the current state of a specific animation.
250
- * @param clipName - Name of the animation
251
- * @returns Animation state or null if not found/playing
252
- */
253
- getAnimationState(clipName: string): AnimationState | null;
254
- /**
255
- * Get states of all currently playing animations.
256
- */
257
- getPlayingAnimations(): AnimationState[];
258
- /**
259
- * Crossfade from current animation(s) to a new animation.
260
- * @param clipName - Name of the target animation
261
- * @param duration - Crossfade duration in seconds
262
- * @param options - Additional playback options for the target animation
263
- */
264
- crossfadeTo(clipName: string, duration?: number, options?: AnimationPlayOptions): AnimationActionHandle | null;
265
- /**
266
- * Get the composite rotations configuration for the current preset.
267
- * Used by animation schedulers for coordinated head/eye movements.
268
- */
269
- getCompositeRotations(): CompositeRotation[];
270
- /**
271
- * Build and play an AnimationClip from curve data.
272
- * Used by animation schedulers to convert keyframe data to mixer clips.
273
- * @param clipName - Unique name for the clip
274
- * @param curves - Map of curve IDs to keyframe arrays
275
- * @param options - Playback options
276
- * @returns Handle for controlling the clip, or null if not supported
277
- */
278
- buildClip(clipName: string, curves: Record<string, Array<CurvePoint>>, options?: ClipOptions): ClipHandle | null;
279
- /**
280
- * Build and play an AnimationClip from typed channel data.
281
- * This is the preferred dynamic path when numeric IDs could mean different
282
- * namespaces, such as AU 1, viseme slot 1, or lip-sync control 103.
283
- */
284
- buildTypedClip(clipName: string, channels: SnippetChannel[], options?: ClipOptions): ClipHandle | null;
285
- /**
286
- * Update parameters on an active clip.
287
- * @param name - Name of the clip to update
288
- * @param params - Parameters to update
289
- * @returns true if clip was found and updated
290
- */
291
- updateClipParams(name: string, params: {
292
- weight?: number;
293
- rate?: number;
294
- loop?: boolean;
295
- loopMode?: MixerLoopMode;
296
- repeatCount?: number;
297
- reverse?: boolean;
298
- actionId?: string;
299
- }): boolean;
300
- /**
301
- * Clean up resources for a snippet/clip.
302
- * @param name - Name of the snippet to clean up
303
- */
304
- cleanupSnippet(name: string): void;
305
- /**
306
- * Check if the given curves can be played through buildClip.
307
- * Returns false if curves contain data that cannot be converted to mixer tracks.
308
- */
309
- supportsClipCurves(curves: Record<string, Array<CurvePoint>>): boolean;
310
- /**
311
- * Callback when a snippet finishes playback.
312
- * Used by animation schedulers for sequencing.
313
- */
314
- onSnippetEnd?(name: string): void;
315
- }
@@ -1,90 +0,0 @@
1
- /**
2
- * Embody Runtime Interface
3
- *
4
- * Defines the contract for 3D character animation engines.
5
- * Uses Three.js types directly - no framework abstraction overhead.
6
- */
7
- import type { Mesh, Object3D } from 'three';
8
- import type { Profile, MeshInfo } from '../mappings/types';
9
- import type { PresetType } from '../presets';
10
- import type { Animation } from './Animation';
11
- import type { Hair } from './Hair';
12
- import type { EmbodyAnimationRuntimeFactory } from '../core/types';
13
- /**
14
- * Payload for initializing the engine with a loaded model
15
- */
16
- export interface ReadyPayload {
17
- meshes: Mesh[];
18
- model: Object3D;
19
- }
20
- /**
21
- * Configuration options for the Embody engine
22
- */
23
- export interface EmbodyConfig {
24
- /** AU to morph target mappings (partial extensions merged into the preset). */
25
- profile?: Partial<Profile>;
26
- /** Preset type to resolve if profile is not provided. */
27
- presetType?: PresetType | string;
28
- /**
29
- * Optional animation runtime factory from `@lovelace_lol/embody/cljs`.
30
- * When supplied, dynamic snippet handles are owned by that runtime while
31
- * this engine remains the Three.js renderer connector.
32
- */
33
- animationRuntimeFactory?: EmbodyAnimationRuntimeFactory;
34
- }
35
- export type { MeshInfo } from '../mappings/types';
36
- /**
37
- * Embody Engine Interface
38
- *
39
- * The main interface for controlling 3D character facial animation.
40
- * Supports Action Units (AUs), morph targets, visemes, and bone control.
41
- */
42
- export interface EmbodyRuntime extends Animation, Hair {
43
- /**
44
- * Initialize the engine with a loaded model.
45
- * Call this after loading your 3D model.
46
- */
47
- onReady(payload: ReadyPayload): void;
48
- /**
49
- * Update animation state. Call each frame with delta time in seconds.
50
- * If using start(), this is called automatically.
51
- */
52
- update(deltaSeconds: number): void;
53
- /**
54
- * Start the internal animation loop (RAF-based).
55
- * Automatically calls update() each frame with delta time.
56
- */
57
- start(): void;
58
- /**
59
- * Stop the internal animation loop.
60
- */
61
- stop(): void;
62
- /**
63
- * Dispose engine resources and cleanup.
64
- * Stops the animation loop and clears all transitions.
65
- */
66
- dispose(): void;
67
- /**
68
- * Get list of all meshes in the model
69
- */
70
- getMeshList(): MeshInfo[];
71
- /**
72
- * Set mesh visibility
73
- */
74
- setMeshVisible(meshName: string, visible: boolean): void;
75
- /**
76
- * Highlight a mesh with an emissive glow effect
77
- * @param meshName - Name of the mesh to highlight (null to clear all highlights)
78
- * @param color - Highlight color (default: cyan)
79
- * @param intensity - Emissive intensity (default: 0.5)
80
- */
81
- highlightMesh(meshName: string | null, color?: number, intensity?: number): void;
82
- /**
83
- * Update AU mappings configuration
84
- */
85
- setProfile(profile: Profile): void;
86
- /**
87
- * Get current AU mappings configuration
88
- */
89
- getProfile(): Profile;
90
- }
@@ -1,181 +0,0 @@
1
- /**
2
- * Hair Interface
3
- *
4
- * Groups hair registration, styling, and physics methods.
5
- */
6
- import type { Mesh, Object3D } from 'three';
7
- export interface HairObjectRef {
8
- name: string;
9
- isMesh: boolean;
10
- isEyebrow: boolean;
11
- }
12
- export interface HairPhysicsDirectionConfig {
13
- yawSign: 1 | -1;
14
- pitchSign: 1 | -1;
15
- }
16
- export interface HairMorphTargetsConfig {
17
- swayLeft: string;
18
- swayRight: string;
19
- swayFront: string;
20
- fluffRight: string;
21
- fluffBottom: string;
22
- headUp: Record<string, number>;
23
- headDown: Record<string, number>;
24
- }
25
- export interface HairPhysicsRuntimeConfig {
26
- stiffness: number;
27
- damping: number;
28
- inertia: number;
29
- gravity: number;
30
- responseScale: number;
31
- idleSwayAmount: number;
32
- idleSwaySpeed: number;
33
- windStrength: number;
34
- windDirectionX: number;
35
- windDirectionZ: number;
36
- windTurbulence: number;
37
- windFrequency: number;
38
- idleClipDuration: number;
39
- impulseClipDuration: number;
40
- direction: HairPhysicsDirectionConfig;
41
- morphTargets: HairMorphTargetsConfig;
42
- }
43
- export type HairPhysicsRuntimeConfigUpdate = Partial<HairPhysicsRuntimeConfig> & {
44
- direction?: Partial<HairPhysicsDirectionConfig>;
45
- morphTargets?: Partial<HairMorphTargetsConfig>;
46
- };
47
- export interface HairObjectState {
48
- color?: {
49
- baseColor: string;
50
- emissive: string;
51
- emissiveIntensity: number;
52
- };
53
- outline?: {
54
- show: boolean;
55
- color: string;
56
- opacity: number;
57
- };
58
- visible?: boolean;
59
- scale?: {
60
- x: number;
61
- y: number;
62
- z: number;
63
- };
64
- position?: {
65
- x: number;
66
- y: number;
67
- z: number;
68
- };
69
- isEyebrow?: boolean;
70
- }
71
- export interface HairColorAppearance {
72
- name?: string;
73
- baseColor: string;
74
- emissive: string;
75
- emissiveIntensity: number;
76
- }
77
- export interface HairAppearanceState {
78
- hairColor: Required<Pick<HairColorAppearance, 'baseColor' | 'emissive' | 'emissiveIntensity'>> & {
79
- name?: string;
80
- };
81
- eyebrowColor: Required<Pick<HairColorAppearance, 'baseColor' | 'emissive' | 'emissiveIntensity'>> & {
82
- name?: string;
83
- };
84
- showOutline: boolean;
85
- outlineColor: string;
86
- outlineOpacity: number;
87
- }
88
- export interface Hair {
89
- /**
90
- * Register hair objects from a scene.
91
- * Returns engine-agnostic references for UI and runtime helpers.
92
- * Registration must not rewrite material colors.
93
- */
94
- registerHairObjects(objects: Object3D[]): HairObjectRef[];
95
- /**
96
- * Get hair objects registered in the engine.
97
- */
98
- getRegisteredHairObjects(): Mesh[];
99
- /**
100
- * Enable or disable hair physics simulation.
101
- */
102
- setHairPhysicsEnabled(enabled: boolean): void;
103
- /**
104
- * Check if hair physics is enabled.
105
- */
106
- isHairPhysicsEnabled(): boolean;
107
- /**
108
- * Update hair physics configuration.
109
- */
110
- setHairPhysicsConfig(config: HairPhysicsRuntimeConfigUpdate): void;
111
- /**
112
- * Get current hair physics configuration.
113
- */
114
- getHairPhysicsConfig(): HairPhysicsRuntimeConfig;
115
- /**
116
- * Validate hair morph target mappings against registered hair meshes.
117
- * Returns a list of missing morph keys (if any).
118
- */
119
- validateHairMorphTargets(): string[];
120
- /**
121
- * Get head rotation values used for hair physics (range -1 to 1).
122
- */
123
- getHeadRotation(): {
124
- yaw: number;
125
- pitch: number;
126
- roll: number;
127
- };
128
- /**
129
- * Manually tick hair physics (optional).
130
- */
131
- updateHairPhysics(dt: number): void;
132
- /**
133
- * Get available hair morph targets for a mesh.
134
- */
135
- getHairMorphTargets(meshName?: string): string[];
136
- /**
137
- * Set morph targets on specific meshes.
138
- */
139
- setMorphOnMeshes(meshNames: string[], morphKey: string, value: number): void;
140
- /**
141
- * Apply hair/eyebrow styling state to a mesh.
142
- */
143
- applyHairStateToObject(objectName: string, state: HairObjectState): void;
144
- /**
145
- * Sample current hair/eyebrow material appearance from registered meshes.
146
- * Does not mutate the scene.
147
- */
148
- getHairAppearance(): HairAppearanceState;
149
- /**
150
- * Apply color to registered non-eyebrow hair meshes.
151
- */
152
- setHairColor(color: HairColorAppearance | string): void;
153
- /**
154
- * Apply color to registered eyebrow meshes.
155
- */
156
- setEyebrowColor(color: HairColorAppearance | string): void;
157
- /**
158
- * Update hair base color only (keeps emissive settings).
159
- */
160
- setHairBaseColor(baseColor: string): void;
161
- /**
162
- * Update eyebrow base color only (keeps emissive settings).
163
- */
164
- setEyebrowBaseColor(baseColor: string): void;
165
- /**
166
- * Update hair glow (emissive + intensity).
167
- */
168
- setHairGlow(emissive: string, intensity: number): void;
169
- /**
170
- * Update eyebrow glow (emissive + intensity).
171
- */
172
- setEyebrowGlow(emissive: string, intensity: number): void;
173
- /**
174
- * Toggle/update hair mesh outline for all registered hair objects.
175
- */
176
- setHairOutline(outline: {
177
- show: boolean;
178
- color?: string;
179
- opacity?: number;
180
- }): void;
181
- }
@@ -1,90 +0,0 @@
1
- /**
2
- * Hair Physics Interface
3
- *
4
- * Defines the contract for hair physics simulation systems.
5
- * Implementations can use different physics models (spring-damper, verlet, etc.)
6
- */
7
- /**
8
- * Configuration for hair physics simulation
9
- */
10
- export interface HairPhysicsConfig {
11
- mass: number;
12
- stiffness: number;
13
- damping: number;
14
- gravity: number;
15
- headInfluence: number;
16
- windEnabled: boolean;
17
- windStrength: number;
18
- windDirectionX: number;
19
- windDirectionZ: number;
20
- windTurbulence: number;
21
- windFrequency: number;
22
- }
23
- /**
24
- * Hair strand definition for multi-strand simulation
25
- */
26
- export interface HairStrand {
27
- id: string;
28
- morphKeys: {
29
- left: string;
30
- right: string;
31
- front?: string;
32
- back?: string;
33
- };
34
- mass?: number;
35
- stiffness?: number;
36
- damping?: number;
37
- }
38
- /**
39
- * Current physics state of hair simulation
40
- */
41
- export interface HairState {
42
- x: number;
43
- z: number;
44
- vx: number;
45
- vz: number;
46
- }
47
- /**
48
- * Head orientation state for physics input
49
- */
50
- export interface HeadState {
51
- yaw: number;
52
- pitch: number;
53
- roll: number;
54
- yawVelocity: number;
55
- pitchVelocity: number;
56
- }
57
- /**
58
- * Output morph values from physics simulation
59
- */
60
- export interface HairMorphOutput {
61
- [morphKey: string]: number;
62
- }
63
- /**
64
- * Hair Physics simulation interface
65
- */
66
- export interface HairPhysics {
67
- /**
68
- * Update physics simulation
69
- * @param dt Delta time in seconds
70
- * @param headState Current head orientation and velocity
71
- * @returns Morph values to apply to hair meshes
72
- */
73
- update(dt: number, headState: HeadState): HairMorphOutput;
74
- /**
75
- * Get current physics state (for debugging/UI)
76
- */
77
- getState(): HairState;
78
- /**
79
- * Update configuration
80
- */
81
- setConfig(config: Partial<HairPhysicsConfig>): void;
82
- /**
83
- * Get current configuration
84
- */
85
- getConfig(): HairPhysicsConfig;
86
- /**
87
- * Reset physics state to rest position
88
- */
89
- reset(): void;
90
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Embody Interfaces
3
- *
4
- * Framework-agnostic interfaces for 3D character animation.
5
- * Implement these interfaces to add support for different 3D engines.
6
- */
7
- export type { EmbodyRuntime, ReadyPayload, EmbodyConfig, } from './EmbodyRuntime';
8
- export type { MeshInfo } from '../mappings/types';
9
- export type { Animation, MixerLoopMode } from './Animation';
10
- export type { HairPhysics, HairPhysicsConfig, HairStrand, HairState } from './HairPhysics';
11
- export type { Hair, HairPhysicsRuntimeConfig, HairPhysicsRuntimeConfigUpdate, HairPhysicsDirectionConfig, HairMorphTargetsConfig, HairObjectRef, HairObjectState, } from './Hair';