import type { Document } from '@gltf-transform/core'; import { type Vec3 } from '../mat4'; /** * Re-pose the rest pose of a HELIX avatar into the T-pose VRM 1.0 requires, and re-skin the mesh to match. * * Why this exists: VRM's *normalized* humanoid (three-vrm, UniVRM, every VRMA clip) treats the rest pose as the * T-pose - identity rotation on every bone means "arms straight out". HELIX bodies rest in an A-pose, so an * unconverted export plays every VRMA clip with the arms lowered an extra ~50 degrees. * * Method: rotate each arm segment (upper arm, lower arm, hand) about its own joint so its direction toward the * next segment is exactly +-X (shortest arc, so the roll of the source pose is kept), pose the mesh into that * pose with linear blend skinning (positions, normals, tangents), and bake the posed skeleton as the new bind: * new inverse bind = inverse(posed joint world) * meshWorld. The rendered result at rest is the posed mesh, and * every joint's rest world matrix now matches its inverse bind exactly, as the spec wants. */ export interface TPoseReport { applied: boolean; /** Worst angle (degrees) of an arm segment away from horizontal before the change. */ maxArmDeviationDeg: number; /** Worst angle (degrees) of a leg segment away from vertical (reported, not changed). */ maxLegDeviationDeg: number; skippedReason?: string; } /** Shortest-arc rotation taking unit vector `a` to unit vector `b`, as [x,y,z,w]. */ export declare function arcQuat(a: Vec3, b: Vec3): [number, number, number, number]; export declare function armDeviationDeg(doc: Document): number; export declare function legDeviationDeg(doc: Document): number; /** A node that copies another's rotation (a VRM rotation constraint): it must be re-posed with its source. */ export interface RotationFollower { node: string; source: string; weight: number; } export declare function applyTPose(doc: Document, mode?: 'auto' | 'always', followers?: readonly RotationFollower[]): TPoseReport;