import type { AssetContainer } from "@babylonjs/core/assetContainer";
import { Texture } from "@babylonjs/core/Materials/Textures/texture";
import { Observable } from "@babylonjs/core/Misc/observable";
import type { Scene } from "@babylonjs/core/scene";
import type { Nullable } from "@babylonjs/core/types";
/**
 * MMD texture load options
 */
export interface IMmdTextureLoadOptions {
    /**
     * Defines if the texture will require mip maps or not (default: false)
     */
    noMipmap?: boolean;
    /**
     * Defines if the texture needs to be inverted on the y axis during loading (default: true)
     */
    invertY?: boolean;
    /**
     * Defines the sampling mode we want for the texture while fetching from it (Texture.NEAREST_SAMPLINGMODE...) (default: Texture.TRILINEAR_SAMPLINGMODE)
     */
    samplingMode?: number;
    /**
     * Defines if the buffer we are loading the texture from should be deleted after load (default: false)
     */
    deleteBuffer?: boolean;
    /**
     * Defines the format of the texture we are trying to load (Engine.TEXTUREFORMAT_RGBA...) (default: )
     */
    format?: number;
    /**
     * Defines an optional mime type information (default: undefined)
     */
    mimeType?: string;
}
declare class MmdTextureData {
    readonly cacheKey: string;
    private readonly _scene;
    private readonly _assetContainer;
    private readonly _options;
    private readonly _onLoad;
    private readonly _onError?;
    private _texture;
    constructor(cacheKey: string, scene: Scene, assetContainer: Nullable<AssetContainer>, urlOrTextureName: string, useLazyLoadWithBuffer: boolean, options: IMmdTextureLoadOptions, onLoad: Nullable<() => void>, onError?: Nullable<(message?: string, exception?: any) => void>);
    loadFromArrayBuffer(arrayBuffer: ArrayBuffer): void;
    private _onDisposeCallback;
    registerOnDisposeCallback(callback: () => void): void;
    unregisterOnDisposeCallback(): Nullable<() => void>;
    private _createTexture;
    get texture(): Nullable<Texture>;
}
/**
 * MMD async texture loader
 *
 * The MMD async texture loader caches redundant textures across multiple materials and simplifies asynchronous textural loading
 *
 * It also includes handling when multiple models are loaded at the same time
 */
export declare class MmdAsyncTextureLoader {
    /**
     * Observable which is notified when all textures of the model are loaded
     *
     * key: uniqueId, value: Observable<void>
     */
    readonly onModelTextureLoadedObservable: Map<number, Observable<void>>;
    /**
     * Texture cache
     *
     * This cache is used to avoid loading the same texture multiple times
     *
     * Once loaded, all textures are stored in the cache and deleted from the cache on their own when the texture is disposed
     *
     * key: requestString, value: texture
     */
    readonly textureCache: Map<string, MmdTextureData>;
    private readonly _textureLoadInfoMap;
    private readonly _loadingModels;
    private readonly _errorTexturesReferenceCount;
    private _incrementLeftLoadCount;
    private _decrementLeftLoadCount;
    /**
     * Notify that the model texture load request has been ended
     *
     * If all the textures are cached, no event callback is called
     *
     * so this method must be called and specified at the end of the model's text load request to handle such an edge case
     *
     * @param uniqueId Model unique id
     */
    loadModelTexturesEnd(uniqueId: number): void;
    private _addErrorTextureReferenceCount;
    private _removeErrorTexturesReferenceCount;
    private _handleTextureOnDispose;
    private _createTextureCacheKey;
    private _loadTextureAsyncInternal;
    /**
     * Load texture asynchronously
     *
     * All texture requests for one model must be executed within one synchronization routine without await
     *
     * Because the internally used left texture count mechanism requires knowing the total number of textures required at the time the request is processed
     *
     * @param uniqueId Model unique id
     * @param rootUrl Root url
     * @param relativeTexturePathOrIndex Relative texture path or shared toon texture index
     * @param scene Scene
     * @param assetContainer Asset container
     * @param options Texture load options
     * @returns Texture
     */
    loadTextureAsync(uniqueId: number, rootUrl: string, relativeTexturePathOrIndex: string | number, scene: Scene, assetContainer: Nullable<AssetContainer>, options: IMmdTextureLoadOptions): Promise<Nullable<Texture>>;
    /**
     * Load texture from buffer asynchronously
     *
     * All texture requests for one model must be executed within one synchronization routine without await
     *
     * Because the internally used left texture count mechanism requires knowing the total number of textures required at the time the request is processed
     *
     * @param uniqueId Model unique id
     * @param textureName Texture name
     * @param arrayBufferOrBlob Texture data encoded in PNG/JPG/BMP
     * @param scene Scene
     * @param assetContainer Asset container
     * @param options Texture load options
     * @param applyPathNormalization Whether to apply path normalization to the texture name (default: true)
     * @returns Texture
     */
    loadTextureFromBufferAsync(uniqueId: number, textureName: string, arrayBufferOrBlob: ArrayBuffer | Blob, scene: Scene, assetContainer: Nullable<AssetContainer>, options: IMmdTextureLoadOptions, applyPathNormalization?: boolean): Promise<Nullable<Texture>>;
}
export {};
