import { AssetContainer } from "@babylonjs/core/assetContainer"; import { Skeleton } from "@babylonjs/core/Bones/skeleton"; import type { ISceneLoaderAsyncResult, ISceneLoaderPluginAsync, ISceneLoaderPluginExtensions, ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader"; import type { MultiMaterial } from "@babylonjs/core/Materials/multiMaterial"; import type { Geometry } from "@babylonjs/core/Meshes/geometry"; import { Mesh } from "@babylonjs/core/Meshes/mesh"; import type { VertexData } from "@babylonjs/core/Meshes/mesh.vertexData"; import type { MorphTargetManager } from "@babylonjs/core/Morph/morphTargetManager"; import type { Scene } from "@babylonjs/core/scene"; import type { Nullable } from "@babylonjs/core/types"; import type { IMmdMaterialBuilder } from "./IMmdMaterialBuilder"; import type { MmdModelMetadata } from "./mmdModelMetadata"; import type { BpmxObject } from "./Optimized/Parser/bpmxObject"; import type { ILogger } from "./Parser/ILogger"; import { PmxObject } from "./Parser/pmxObject"; import type { ProgressTask } from "./progress"; import { Progress } from "./progress"; /** @internal */ export interface MmdModelLoadState { readonly arrayBuffer: ArrayBuffer; readonly pmFileId: string; readonly materialBuilder: IMmdMaterialBuilder; readonly useSdef: boolean; readonly buildSkeleton: boolean; readonly buildMorph: boolean; readonly boundingBoxMargin: number; } /** @internal */ export interface BuildGeometryResult { readonly vertexData: VertexData; readonly geometry: Geometry; } /** @internal */ export interface BuildMaterialResult { readonly multiMaterial: MultiMaterial; readonly textureLoadPromise: Promise; } /** * @internal * Base class of loader for MMD model (pmx / pmd / bpmx) */ export declare abstract class MmdModelLoader implements ISceneLoaderPluginAsync, ILogger { /** * Name of the loader */ name: string; /** * Extensions supported by this loader */ extensions: ISceneLoaderPluginExtensions; /** * Material builder used by this loader * * This property can be overwritten to customize the material of the loaded model */ materialBuilder: IMmdMaterialBuilder; /** * Whether to use SDEF (default: true) * * Spherical Deformation(SDEF) is a feature that allows you to deform the model more naturally than the traditional skinning method * * But it uses more memory and is slower than the traditional skinning method * * If you are targeting a platform with limited memory or performance, you may want to disable this feature */ useSdef: boolean; /** * Whether to build skeleton (default: true) * * If you want to load a model without a skeleton, you can disable this feature * * This feature is useful when you want to load a model that is not animated (e.g. background object) */ buildSkeleton: boolean; /** * Whether to build morph (default: true) * * If you want to load a model without morph, you can disable this feature * * This feature is useful when you want to load a model that is not animated (e.g. background object) */ buildMorph: boolean; /** * Margin of the bounding box of the model (default: 10) * * This property is used to calculate the bounding box of the model * * If the bounding box of the model is too small, the model may not be rendered correctly * * This value may need to be set higher, especially in motion with a large movement range */ boundingBoxMargin: number; private _loggingEnabled; /** @internal */ log: (message: string) => void; /** @internal */ warn: (message: string) => void; /** @internal */ error: (message: string) => void; /** * Create a new MMD model loader */ constructor(name: string, extensions: ISceneLoaderPluginExtensions); importMeshAsync(_meshesNames: any, scene: Scene, data: LoadState, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise; loadAsync(scene: Scene, data: LoadState, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise; loadAssetContainerAsync(scene: Scene, data: LoadState, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise; private _loadAsyncInternal; protected abstract _parseFileAsync(arrayBuffer: ArrayBuffer): Promise; protected _getProgressTaskCosts(state: LoadState, modelObject: ModelObject): ProgressTask[]; protected abstract _buildGeometryAsync(state: LoadState, modelObject: ModelObject, mesh: Mesh, scene: Scene, assetContainer: Nullable, progress: Progress): Promise; protected abstract _buildMaterialAsync(state: LoadState, modelObject: ModelObject, mesh: Mesh, scene: Scene, assetContainer: Nullable, vertexData: VertexData, rootUrl: string, progress: Progress): Promise; protected abstract _buildSubMeshes(modelObject: ModelObject, mesh: Mesh): void; protected _buildSkeletonAsync(modelObject: ModelObject, mesh: Mesh, scene: Scene, assetContainer: Nullable, bonesMetadata: MmdModelMetadata.Bone[], progress: Progress): Promise; protected abstract _buildMorphAsync(modelObject: ModelObject, mesh: Mesh, scene: Scene, assetContainer: Nullable, vertexData: VertexData, morphsMetadata: MmdModelMetadata.Morph[], progress: Progress): Promise; private _applyBoundingBoxMargin; /** * Enable or disable debug logging (default: false) */ get loggingEnabled(): boolean; set loggingEnabled(value: boolean); private _logEnabled; private _logDisabled; private _warnEnabled; private _warnDisabled; private _errorEnabled; private _errorDisabled; }