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 { Material } from "@babylonjs/core/Materials/material";
import type { MultiMaterial } from "@babylonjs/core/Materials/multiMaterial";
import type { BaseTexture } from "@babylonjs/core/Materials/Textures/baseTexture";
import type { Geometry } from "@babylonjs/core/Meshes/geometry";
import { Mesh } from "@babylonjs/core/Meshes/mesh";
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 type { 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;
    readonly preserveSerializationData: boolean;
}
/** @internal */
export interface MmdModelBuildGeometryResult {
    readonly meshes: Mesh[];
    readonly geometries: Geometry[];
}
/** @internal */
export interface BuildMaterialResult {
    readonly materials: Material[];
    readonly multiMaterials: MultiMaterial[];
    readonly textureLoadPromise: Promise<void>;
}
/**
 * @internal
 * Base class of loader for MMD model (pmx / pmd / bpmx)
 */
export declare abstract class MmdModelLoader<LoadState extends MmdModelLoadState, ModelObject extends PmxObject | BpmxObject, BuildGeometryResult extends MmdModelBuildGeometryResult> 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;
    /**
     * Whether to preserve the data used for serialization (default: false)
     *
     * If you want to serialize the model, you need to set this property to true
     *
     * This property is used to serialize the model into bpmx file
     */
    preserveSerializationData: boolean;
    private _loggingEnabled;
    /** @internal */
    log: (message: string) => void;
    /** @internal */
    warn: (message: string) => void;
    /** @internal */
    error: (message: string) => void;
    private static readonly _SharedStandardMaterialBuilder;
    /**
     * 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<ISceneLoaderAsyncResult>;
    loadAsync(scene: Scene, data: LoadState, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise<void>;
    loadAssetContainerAsync(scene: Scene, data: LoadState, rootUrl: string, onProgress?: (event: ISceneLoaderProgressEvent) => void, _fileName?: string): Promise<AssetContainer>;
    private _loadAsyncInternal;
    protected abstract _parseFileAsync(arrayBuffer: ArrayBuffer): Promise<ModelObject>;
    protected _getProgressTaskCosts(state: LoadState, modelObject: ModelObject): ProgressTask[];
    protected abstract _buildGeometryAsync(state: LoadState, modelObject: ModelObject, rootMesh: Mesh, scene: Scene, assetContainer: Nullable<AssetContainer>, progress: Progress): Promise<BuildGeometryResult>;
    protected abstract _buildMaterialAsync(state: LoadState, modelObject: ModelObject, rootMesh: Mesh, meshes: Mesh[], textureNameMap: Nullable<Map<BaseTexture, string>>, scene: Scene, assetContainer: Nullable<AssetContainer>, rootUrl: string, progress: Progress): Promise<BuildMaterialResult>;
    protected _buildSkeletonAsync(state: LoadState, modelObject: ModelObject, meshes: Mesh[], scene: Scene, assetContainer: Nullable<AssetContainer>, bonesMetadata: MmdModelMetadata.Bone[] | MmdModelMetadata.SerializationBone[], progress: Progress): Promise<Nullable<Skeleton>>;
    protected abstract _buildMorphAsync(state: LoadState, modelObject: ModelObject, buildGeometryResult: BuildGeometryResult, scene: Scene, assetContainer: Nullable<AssetContainer>, morphsMetadata: MmdModelMetadata.Morph[], progress: Progress): Promise<MorphTargetManager[]>;
    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;
}
