import type { Material } from "@babylonjs/core/Materials/material"; import type { Nullable } from "@babylonjs/core/types"; import type { MorphIndices } from "../../Animation/IMmdRuntimeAnimation"; import { MmdRuntimeAnimation } from "../../Animation/mmdRuntimeAnimation"; import type { ILogger } from "../../ILogger"; import type { MmdMorphControllerBase } from "../../mmdMorphControllerBase"; import type { MmdWasmModel } from "../mmdWasmModel"; import { MmdWasmAnimation } from "./mmdWasmAnimation"; /** * Mmd WASM runtime model animation * * An object with mmd animation and model binding information */ export declare class MmdWasmRuntimeModelAnimation extends MmdRuntimeAnimation { /** * Pointer to the animation data in wasm memory */ readonly ptr: number; private readonly _modelPtr; private _onDispose; /** * The animation data */ readonly animation: MmdWasmAnimation; private readonly _boneBindIndexMap; /** * Bone bind index map */ get boneBindIndexMap(): Int32Array; private readonly _movableBoneBindIndexMap; /** * Movable bone bind index map */ get movableBoneBindIndexMap(): Int32Array; private readonly _morphController; /** * Morph bind index map */ readonly morphBindIndexMap: readonly Nullable[]; private readonly _meshes; private readonly _ikSolverBindIndexMap; /** * IK solver bind index map */ get ikSolverBindIndexMap(): Int32Array; private _materialRecompileInduceInfo; private constructor(); /** * Dispose this instance * @param fromAnimation Dispose from animation (default: false) (internal use only) */ dispose(fromAnimation?: boolean): void; /** * Run wasm side animation evaluation * * Update bone / bone morphs / ik solver state * * IMPORTANT: when wasm runtime using buffered evaluation, this method must be called before waiting for the WasmMmdRuntime.lock * otherwise, it can cause a datarace * @param frameTime Frame time in 30fps */ wasmAnimate(frameTime: number): void; /** * Update vertex / uv morphs and visibility * @param frameTime Frame time in 30fps */ animate(frameTime: number): void; /** * Induce material recompile * * This method must run once before the animation runs * * This method prevents frame drop during animation by inducing properties to be recompiled that are used in morph animation * @param updateMorphTarget Whether to update morph target manager numMaxInfluencers * @param logger logger */ induceMaterialRecompile(updateMorphTarget: boolean, logger?: ILogger): void; /** * @internal * Bind animation to model and prepare material for morph animation * @param animation Animation to bind * @param model Bind target * @param onDispose Callback when this instance is disposed * @param retargetingMap Animation bone name to model bone name map * @param logger Logger * @return MmdRuntimeModelAnimation instance */ static Create(animation: MmdWasmAnimation, model: MmdWasmModel, onDispose: () => void, retargetingMap?: { [key: string]: string; }, logger?: ILogger): MmdWasmRuntimeModelAnimation; /** * Induce material recompile * * This method prevents frame drop during animation by inducing properties to be recompiled that are used in morph animation * * This method is exposed as public because it must be overrideable * * If you are using a material other than `MmdStandardMaterial`, you must implement this method yourself * @param materials Materials * @param morphController Morph controller * @param morphIndices Morph indices to induce recompile * @param logger logger */ static InduceMaterialRecompile: (materials: readonly Material[], morphController: MmdMorphControllerBase, morphIndices: readonly Nullable[], logger?: ILogger) => void; } declare module "./mmdWasmAnimation" { interface MmdWasmAnimation { /** * @internal */ _runtimeModelAnimations: MmdWasmRuntimeModelAnimation[]; /** * @internal * Create wasm runtime model animation * @param model Bind target * @param onDispose Callback when this instance is disposed * @param retargetingMap Animation bone name to model bone name map * @param logger Logger * @returns MmdRuntimeModelAnimation instance */ createWasmRuntimeModelAnimation(model: MmdWasmModel, onDispose: () => void, retargetingMap?: { [key: string]: string; }, logger?: ILogger): MmdWasmRuntimeModelAnimation; } }