@lovelace_lol/embody 0.0.15 → 0.0.17

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.
@@ -0,0 +1,70 @@
1
+ import { AnimationClip } from 'three';
2
+ import type { Object3D } from 'three';
3
+ import type { ThreeModelReferencePose } from './reference-pose';
4
+ type Vec3 = [number, number, number];
5
+ type Quat = [number, number, number, number];
6
+ type RigNode = {
7
+ id: string;
8
+ name: string;
9
+ parent: string | null;
10
+ translation: Vec3;
11
+ rotation: Quat;
12
+ scale: Vec3;
13
+ };
14
+ type Rig = {
15
+ metersPerUnit: number;
16
+ nodes: RigNode[];
17
+ humanoidBones: Record<string, string>;
18
+ };
19
+ type AnimationTrack = {
20
+ node: string;
21
+ path: 'rotation' | 'translation' | 'scale';
22
+ interpolation: 'STEP' | 'LINEAR';
23
+ times: number[];
24
+ values: number[];
25
+ };
26
+ /** Validated body-animation intermediate, not a file format. Persist the .vrma GLB bytes. */
27
+ export type VrmAnimationDocument = {
28
+ version: 1;
29
+ name: string;
30
+ durationSeconds: number;
31
+ rig: Rig;
32
+ tracks: AnimationTrack[];
33
+ };
34
+ /** Metres represented by one model coordinate unit; always supplied by the caller. */
35
+ export type VrmAnimationUnits = {
36
+ metersPerUnit: number;
37
+ };
38
+ export type VrmAnimationFile = {
39
+ name: string;
40
+ bytes: Uint8Array;
41
+ };
42
+ export type VrmAnimationInfo = {
43
+ name: string;
44
+ durationSeconds: number;
45
+ trackCount: number;
46
+ };
47
+ export type MixamoVrmAnimationOptions = {
48
+ /** Mixamo FBX generally uses centimeters (0.01); this is explicit, never inferred. */
49
+ metersPerUnit: number;
50
+ /** Authored T reference; omission requires skin bind inverses. Never pass frame zero. */
51
+ referencePose?: ThreeModelReferencePose;
52
+ };
53
+ export type VrmAnimationTargetOptions = {
54
+ metersPerUnit: number;
55
+ referencePose: ThreeModelReferencePose;
56
+ /** Existing Embody profile; resolved with Rust's humanoid characterization. */
57
+ profile?: unknown;
58
+ /** Explicit VRM role -> unique target bone name, taking precedence over profile. */
59
+ humanoidBones?: Record<string, string>;
60
+ name?: string;
61
+ };
62
+ /** Pure conversion with borrowed native objects: no mixer, scene mutation, loading or disposal. */
63
+ export declare function convertMixamoToVrmAnimation(source: Object3D, clip: AnimationClip, options: MixamoVrmAnimationOptions): Uint8Array;
64
+ /** Validates embedded binary/accessors, humanoid hierarchy, reference and supported channels. */
65
+ export declare function inspectVrmAnimation(bytes: Uint8Array): VrmAnimationDocument;
66
+ /** Builds native target-local tracks. The caller owns mixer scheduling and blending. */
67
+ export declare function createAnimationClipFromVrmAnimation(bytes: Uint8Array, target: Object3D, options: VrmAnimationTargetOptions): AnimationClip;
68
+ /** Browser FBX boundary: textures are never fetched; temporary parser objects are released. */
69
+ export declare function convertMixamoFbxToVrmAnimations(bytes: ArrayBuffer, options: VrmAnimationUnits): VrmAnimationFile[];
70
+ export {};