/** * MixamoRetargeter.ts * * Animation retargeting from Mixamo FBX skeleton to VRM and URDF skeletons. * * Takes parsed Mixamo animation data (bone-local transforms over time) and * remaps it onto target skeleton bone names, producing an engine-native * `AnimClip`. `AnimationEngine.playSkeletal()` is the production bridge that * samples this output into a matching `BoneSystem`; this module itself only * performs table-driven name mapping, offsets, and clip construction. * * Pattern: source-rig → humanoid canonical → target-rig * 1. Mixamo bone names are looked up via MIXAMO_BONE_MAP * 2. Canonical HumanoidBoneName serves as the pivot * 3. Target bone names are resolved via VRM_BONE_MAP or URDF_BONE_MAP * * @see HumanoidSkeleton.ts for bone mapping tables * @see AnimationClip.ts for the output AnimClip format * @module animation */ import { type HumanoidBoneName } from '../character/HumanoidSkeleton'; import { AnimClip, type ScalarInterpolationMode } from './AnimationClip'; /** A single keyframe for a bone's local transform. */ export interface MixamoKeyframe { time: number; position: [number, number, number]; rotation: [number, number, number, number]; scale?: [number, number, number]; } /** Animation curve for one Mixamo bone. */ export interface MixamoBoneAnimation { mixamoBoneName: string; keyframes: MixamoKeyframe[]; } /** Complete parsed Mixamo animation source. */ export interface MixamoAnimationSource { id: string; name: string; duration: number; boneAnimations: MixamoBoneAnimation[]; } /** Per-bone retargeting options. */ export interface BoneRetargetOptions { /** Override the target bone name (defaults to config map). */ targetBoneName?: string; /** Position scale factor for this bone. */ positionScale?: number; /** Rotation offset (euler radians) applied before output. */ rotationOffset?: [number, number, number]; /** Whether to invert the rotation quaternion. */ invertRotation?: boolean; /** Skip this bone entirely. */ skip?: boolean; } /** Target skeleton format. */ export type RetargetTarget = 'vrm' | 'urdf'; /** Configuration for the retargeting operation. */ export interface RetargetConfig { target: RetargetTarget; /** Optional per-bone overrides keyed by canonical HumanoidBoneName. */ boneOverrides?: Partial>; /** Global position scale (applied after per-bone scale). */ globalPositionScale?: number; /** Global rotation offset in radians [x, y, z]. */ globalRotationOffset?: [number, number, number]; /** * Scalar interpolation for position and scale tracks. Rotation always uses * normalized lerp. Legacy `slerp` is accepted as a migration alias for the * scalar `linear` behavior the old implementation actually performed. */ interpolationMode?: ScalarInterpolationMode | 'slerp'; /** Loop mode for the output clip. */ loop?: boolean; /** Speed multiplier. */ speed?: number; } /** * Mixamo animation retargeter. * * Converts Mixamo-sourced animation curves into target-skeleton `AnimClip` * tracks. Identical input and configuration produce identical output within * one runtime. The frozen P2-0 paper probe is scalar-only and does not use or * make a portability claim about this retargeter. * * @example * ```ts * import { MixamoRetargeter, vrmRetargetConfig } from '@holoscript/engine/animation'; * * const retargeter = new MixamoRetargeter(); * const source = parseMixamoFBX(fbxBuffer); // user-provided parser * const clip = retargeter.retarget(source, vrmRetargetConfig()); * * animationEngine.playSkeletal(clip, matchingBoneSystem); * ``` */ export declare class MixamoRetargeter { /** * Retarget a Mixamo animation to a target skeleton. * * @param source - Parsed Mixamo animation data. * @param config - Retargeting configuration (target skeleton, overrides). * @returns A new `AnimClip` with tracks mapped to the target skeleton. */ retarget(source: MixamoAnimationSource, config: RetargetConfig): AnimClip; private buildBoneTracks; } /** * Default retarget config for VRM 1.0 avatars. * * VRM uses Y-up, meters-scale coordinate system aligned with Mixamo output. * No global scale or rotation offset required for typical humanoids. */ export declare function vrmRetargetConfig(overrides?: Partial): RetargetConfig; /** * Default retarget config for URDF humanoid robots. * * URDF is typically Z-up with SI units (meters). Mixamo output is Y-up. * The retargeted animation may need a -90° X rotation for Z-up targets, * but this is often handled at the importer level. We keep identity by * default and let callers supply `globalRotationOffset` if needed. */ export declare function urdfRetargetConfig(overrides?: Partial): RetargetConfig; /** * One-shot retarget to VRM. * * @param source - Parsed Mixamo animation. * @param overrides - Optional config overrides. */ export declare function retargetToVRM(source: MixamoAnimationSource, overrides?: Partial): AnimClip; /** * One-shot retarget to URDF. * * @param source - Parsed Mixamo animation. * @param overrides - Optional config overrides. */ export declare function retargetToURDF(source: MixamoAnimationSource, overrides?: Partial): AnimClip; /** * List all Mixamo bone names that are retargetable to the given target format. * * Useful for UI "supported bones" display and validation. */ export declare function getRetargetableBones(target: RetargetTarget): string[]; /** * Check whether a specific Mixamo bone can be retargeted to the given target. */ export declare function isRetargetable(mixamoBoneName: string, target: RetargetTarget): boolean; //# sourceMappingURL=MixamoRetargeter.d.ts.map