/**
 * Avatar Core WASM 内存管理工具
 *
 * 提供高效的内存分配、数据传递和零拷贝访问功能
 * 专门为 avatar_core_wasm 优化
 */
interface WASMModule {
    _malloc: (size: number) => number;
    _free: (ptr: number) => void;
    writeArrayToMemory: (array: Uint8Array, ptr: number) => void;
    HEAPU8: Uint8Array;
    HEAP32: Int32Array;
    HEAPF32: Float32Array;
    getValue: (ptr: number, type: string) => number;
    setValue: (ptr: number, value: number, type: string) => void;
}
interface MemoryAllocation {
    ptr: number;
    size: number;
}
export interface TemplateResources {
    flameModel: ArrayBuffer;
    flameTemplate: ArrayBuffer;
    teethPb: ArrayBuffer;
    teethNpz: ArrayBuffer;
}
export interface CharacterData {
    shape: ArrayBuffer;
    pointCloud: ArrayBuffer;
}
export interface ExpressionParams {
    expression?: number[];
    jaw?: number[];
    eyeR?: number[];
    eyeL?: number[];
    pose?: number[];
    neck?: number[];
    translation?: number[];
}
export interface ArrayMetadata {
    ptr: number;
    size: number;
    dtype: string;
}
export declare class AvatarCoreMemoryManager {
    private module;
    private allocatedPointers;
    private structPointers;
    constructor(wasmModule: WASMModule);
    /**
     * 分配 WASM 内存并复制数据 - 纯 API 方式
     */
    allocateAndCopy(arrayBuffer: ArrayBuffer): MemoryAllocation;
    /**
     * 创建 AvatarTemplateConfig 结构体
     */
    createTemplateConfig(resources: TemplateResources): number;
    /**
     * 创建 AvatarCharacterData 结构体 - 新版 Emscripten 方式
     */
    createCharacterData(shapeBuffer: ArrayBuffer, plyBuffer: ArrayBuffer, characterId?: string): {
        dataPtr: number;
        shapePtr: number;
        plyPtr: number;
    };
    /**
     * 读取 AvatarFlameParams 结构体数据
     * Used to extract current animation frame parameters from WASM memory
     */
    readFlameParams(paramsPtr: number): {
        shape_params: number[];
        expr_params: number[];
        rotation: number[];
        translation: number[];
        neck_pose: number[];
        jaw_pose: number[];
        eyes_pose: number[];
        eyelid: number[];
        has_eyelid: boolean;
    };
    /**
     * 创建 AvatarFlameParams 结构体 - 新版 Emscripten 方式
     */
    createFlameParams(params: {
        shape_params?: number[];
        expr_params?: number[];
        rotation?: number[];
        translation?: number[];
        neck_pose?: number[];
        jaw_pose?: number[];
        eyes_pose?: number[];
        eyelid?: number[];
        has_eyelid?: boolean;
    }): number;
    /**
     * 读取 AvatarSplatPointFlatArray 结构体数据（预计算协方差）
     *
     * 结构体布局:
     * - AvatarSplatPointFlat* points (0-3, 32位指针)
     * - uint32_t point_count (4-7)
     * - float compute_time_ms (8-11)
     *
     * 每个点布局 (52 bytes):
     * - position[3]   (12 bytes)
     * - color[4]      (16 bytes, RGBA)
     * - covariance[6] (24 bytes, 预计算好的协方差矩阵上三角)
     *
     * ⚠️ 使用 getValue 逐个读取，避免动态内存的 HEAPF32 detachment 问题
     */
    readSplatPointFlatArray(arrayPtr: number): Float32Array | null;
    /**
     * 读取AvatarMeshData结构体数据
     */
    readMeshData(outputPtr: number): {
        vertices: Float32Array;
        vertexCount: number;
        faces: Uint32Array;
        faceCount: number;
        landmarks: Float32Array | null;
        landmarkCount: number;
        computeTime: number;
    };
    /**
     * 释放指定指针的内存
     */
    free(ptr: number): void;
    /**
     * 释放结构体内存
     */
    freeStruct(name: string): void;
    /**
     * 清理所有分配的内存
     */
    cleanup(): void;
    /**
     * 获取内存使用统计
     */
    getMemoryStats(): {
        allocatedPointers: number;
        structPointers: number;
        totalAllocatedMB: number;
    };
}
export {};
//# sourceMappingURL=avatarCoreMemory.d.ts.map