babylon-mmd
Version:
babylon.js mmd loader and runtime
160 lines (155 loc) • 10.3 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
export function init(): void;
export function allocateBuffer(size: number): number;
/**
* Deallocate a buffer allocated by `allocateBuffer`.
* # Safety
* `ptr` must be a pointer to a buffer allocated by `allocateBuffer`.
*/
export function deallocateBuffer(ptr: number, size: number): void;
export function createMmdRuntime(): MmdRuntime;
export function createAnimationPool(): AnimationPool;
export class AnimationPool {
private constructor();
free(): void;
allocateLengthsBuffer(count: number): number;
deallocateLengthsBuffer(ptr: number, count: number): void;
createBoneTracks(track_lengths: number, track_count: number): number;
getBoneTrackFrameNumbers(tracks: number, index: number): number;
getBoneTrackRotations(tracks: number, index: number): number;
getBoneTrackRotationInterpolations(tracks: number, index: number): number;
getBoneTrackPhysicsToggles(tracks: number, index: number): number;
createMovableBoneTracks(track_lengths: number, track_count: number): number;
getMovableBoneTrackFrameNumbers(tracks: number, index: number): number;
getMovableBoneTrackPositions(tracks: number, index: number): number;
getMovableBoneTrackPositionInterpolations(tracks: number, index: number): number;
getMovableBoneTrackRotations(tracks: number, index: number): number;
getMovableBoneTrackRotationInterpolations(tracks: number, index: number): number;
getMovableBoneTrackPhysicsToggles(tracks: number, index: number): number;
createMorphTracks(track_lengths: number, track_count: number): number;
getMorphTrackFrameNumbers(tracks: number, index: number): number;
getMorphTrackWeights(tracks: number, index: number): number;
createAnimation(bone_tracks_ptr: number, bone_track_count: number, movable_bone_tracks_ptr: number, movable_bone_track_count: number, morph_tracks_ptr: number, morph_track_count: number, property_track_length: number, property_track_ik_count: number): number;
getPropertyTrackFrameNumbers(animation_ptr: number): number;
getPropertyTrackIkStates(animation_ptr: number, index: number): number;
destroyAnimation(animation_ptr: number): void;
createBoneBindIndexMap(animation_ptr: number): number;
createMovableBoneBindIndexMap(animation_ptr: number): number;
createMorphBindIndexMap(animation_ptr: number, morph_lengths: number): number;
getNthMorphBindIndexMap(morph_bind_index_map: number, index: number): number;
createIkSolverBindIndexMap(animation_ptr: number): number;
createBoneToBodyBindIndexMap(animation_ptr: number, body_lengths: number): number;
getNthBoneToBodyBindIndexMap(bone_to_body_bind_index_map: number, index: number): number;
createRuntimeAnimation(animation_ptr: number, bone_bind_index_map: number, movable_bone_bind_index_map: number, morph_bind_index_map: number, ik_solver_bind_index_map: number, bone_to_body_bind_index_map: number): number;
destroyRuntimeAnimation(runtime_animation_ptr: number): void;
animateMmdModel(animation_ptr: number, mmd_model_ptr: number, frame_time: number): void;
}
export class MmdRuntime {
private constructor();
free(): void;
createMmdModel(serialized_metadata_ptr: number, serialized_metadata_size: number): number;
destroyMmdModel(ptr: number): void;
getAnimationArena(ptr: number): number;
getAnimationIkSolverStateArena(ptr: number): number;
getAnimationRigidBodyStateArena(ptr: number): number;
getAnimationRigidBodyStateArenaSize(ptr: number): number;
getAnimationMorphArena(ptr: number): number;
getBoneWorldMatrixArena(ptr: number): number;
createBoneWorldMatrixBackBuffer(ptr: number): number;
setRuntimeAnimation(ptr: number, runtime_animation: number): void;
useExternalPhysics(ptr: number, rigidbody_state_size: number): void;
beforePhysics(frame_time?: number | null): void;
afterPhysics(): void;
getLockStatePtr(): number;
swapWorldMatrixBuffer(): void;
acquireDiagnosticErrorResult(): number;
acquireDiagnosticWarningResult(): number;
acquireDiagnosticInfoResult(): number;
releaseDiagnosticResult(): void;
}
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly allocateBuffer: (a: number) => number;
readonly deallocateBuffer: (a: number, b: number) => void;
readonly createMmdRuntime: () => number;
readonly createAnimationPool: () => number;
readonly init: () => void;
readonly __wbg_animationpool_free: (a: number, b: number) => void;
readonly animationpool_allocateLengthsBuffer: (a: number, b: number) => number;
readonly animationpool_deallocateLengthsBuffer: (a: number, b: number, c: number) => void;
readonly animationpool_createBoneTracks: (a: number, b: number, c: number) => number;
readonly animationpool_getBoneTrackFrameNumbers: (a: number, b: number, c: number) => number;
readonly animationpool_getBoneTrackRotations: (a: number, b: number, c: number) => number;
readonly animationpool_getBoneTrackRotationInterpolations: (a: number, b: number, c: number) => number;
readonly animationpool_getBoneTrackPhysicsToggles: (a: number, b: number, c: number) => number;
readonly animationpool_createMovableBoneTracks: (a: number, b: number, c: number) => number;
readonly animationpool_getMovableBoneTrackFrameNumbers: (a: number, b: number, c: number) => number;
readonly animationpool_getMovableBoneTrackPositions: (a: number, b: number, c: number) => number;
readonly animationpool_getMovableBoneTrackPositionInterpolations: (a: number, b: number, c: number) => number;
readonly animationpool_getMovableBoneTrackRotations: (a: number, b: number, c: number) => number;
readonly animationpool_getMovableBoneTrackRotationInterpolations: (a: number, b: number, c: number) => number;
readonly animationpool_getMovableBoneTrackPhysicsToggles: (a: number, b: number, c: number) => number;
readonly animationpool_createMorphTracks: (a: number, b: number, c: number) => number;
readonly animationpool_getMorphTrackFrameNumbers: (a: number, b: number, c: number) => number;
readonly animationpool_getMorphTrackWeights: (a: number, b: number, c: number) => number;
readonly animationpool_createAnimation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
readonly animationpool_getPropertyTrackFrameNumbers: (a: number, b: number) => number;
readonly animationpool_getPropertyTrackIkStates: (a: number, b: number, c: number) => number;
readonly animationpool_destroyAnimation: (a: number, b: number) => void;
readonly animationpool_createBoneBindIndexMap: (a: number, b: number) => number;
readonly animationpool_createMovableBoneBindIndexMap: (a: number, b: number) => number;
readonly animationpool_createMorphBindIndexMap: (a: number, b: number, c: number) => number;
readonly animationpool_createIkSolverBindIndexMap: (a: number, b: number) => number;
readonly animationpool_createBoneToBodyBindIndexMap: (a: number, b: number, c: number) => number;
readonly animationpool_getNthBoneToBodyBindIndexMap: (a: number, b: number, c: number) => number;
readonly animationpool_createRuntimeAnimation: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
readonly animationpool_destroyRuntimeAnimation: (a: number, b: number) => void;
readonly animationpool_animateMmdModel: (a: number, b: number, c: number, d: number) => void;
readonly animationpool_getNthMorphBindIndexMap: (a: number, b: number, c: number) => number;
readonly __wbg_mmdruntime_free: (a: number, b: number) => void;
readonly mmdruntime_createMmdModel: (a: number, b: number, c: number) => number;
readonly mmdruntime_destroyMmdModel: (a: number, b: number) => void;
readonly mmdruntime_getAnimationArena: (a: number, b: number) => number;
readonly mmdruntime_getAnimationIkSolverStateArena: (a: number, b: number) => number;
readonly mmdruntime_getAnimationRigidBodyStateArena: (a: number, b: number) => number;
readonly mmdruntime_getAnimationRigidBodyStateArenaSize: (a: number, b: number) => number;
readonly mmdruntime_getAnimationMorphArena: (a: number, b: number) => number;
readonly mmdruntime_getBoneWorldMatrixArena: (a: number, b: number) => number;
readonly mmdruntime_createBoneWorldMatrixBackBuffer: (a: number, b: number) => number;
readonly mmdruntime_setRuntimeAnimation: (a: number, b: number, c: number) => void;
readonly mmdruntime_useExternalPhysics: (a: number, b: number, c: number) => void;
readonly mmdruntime_beforePhysics: (a: number, b: number) => void;
readonly mmdruntime_afterPhysics: (a: number) => void;
readonly mmdruntime_getLockStatePtr: (a: number) => number;
readonly mmdruntime_swapWorldMatrixBuffer: (a: number) => void;
readonly mmdruntime_acquireDiagnosticErrorResult: (a: number) => number;
readonly mmdruntime_acquireDiagnosticWarningResult: (a: number) => number;
readonly mmdruntime_acquireDiagnosticInfoResult: (a: number) => number;
readonly mmdruntime_releaseDiagnosticResult: (a: number) => void;
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_export_3: WebAssembly.Table;
readonly __wbindgen_start: () => void;
}
export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
*
* @returns {InitOutput}
*/
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;