import type * as THREEType from 'three';
import type { GLTFExporter } from 'three/examples/jsm/exporters/GLTFExporter.js';
import type { BoxelDefinition, Primitive, Material, Texture, Pattern } from '@playdrop/boxel-core';
import { type VoxelFacePatch } from '../voxels/faces.js';
import type { BoxelSceneAnimation } from '../types.js';
interface TexturePixels {
    id: string;
    width: number;
    height: number;
    color: Uint8Array;
    emissive?: Uint8Array;
    hasEmissive: boolean;
    hasTransparency: boolean;
}
interface TextureAtlasRegion {
    uMin: number;
    vMin: number;
    uMax: number;
    vMax: number;
}
interface TextureAtlas {
    regions: Map<string, TextureAtlasRegion>;
    fallbackRegion: TextureAtlasRegion;
    map: THREEType.DataTexture;
    emissiveMap: THREEType.DataTexture | null;
    hasTransparency: boolean;
}
interface CachedVoxelPatch extends VoxelFacePatch {
    textureId: string;
}
export type ExportMode = 'hierarchical' | 'merged' | 'skinned';
interface ExportModelOptions {
    THREE: typeof THREEType;
    GLTFExporterCtor: new () => GLTFExporter;
    model: BoxelDefinition;
    mode?: ExportMode;
    binary?: boolean;
    animationIds?: string[] | null;
}
export declare function exportModelToGLB(options: ExportModelOptions): Promise<Blob>;
export declare function createBoxelSceneGraph(options: {
    THREE: typeof THREEType;
    model: BoxelDefinition;
    mode?: ExportMode;
}): SceneGraphResult;
interface ExportContext {
    THREE: typeof THREEType;
    model: BoxelDefinition;
    materialsById: Map<string, Material>;
    primitivesById: Map<string, Primitive>;
    texturesById: Map<string, Texture>;
    patternsById: Map<string, Pattern>;
    atlas: TextureAtlas | null;
    voxelSurfacesByPrimitive: Map<string, CachedVoxelPatch[]>;
    plainMaterialCache: Map<string, THREEType.MeshStandardMaterial>;
}
declare function createExportContext(THREE: typeof THREEType, model: BoxelDefinition): ExportContext;
interface AtlasBuildOptions {
    THREE: typeof THREEType;
    materialsById: Map<string, Material>;
    texturesById: Map<string, Texture>;
    patternsById: Map<string, Pattern>;
    usedTextureIds: Set<string>;
}
declare function buildTextureAtlas(options: AtlasBuildOptions, extraEntries?: TexturePixels[]): TextureAtlas | null;
declare function collectUsedTextureIds(model: BoxelDefinition, primitivesById: Map<string, Primitive>): Set<string>;
interface SceneGraphResult {
    root: THREEType.Object3D;
    nodeLookup: Map<string, THREEType.Object3D>;
    animations: BoxelSceneAnimation[];
    dispose: () => void;
}
declare function buildSceneGraph(context: ExportContext, mode: ExportMode): SceneGraphResult;
declare function resolveAnimationClips(sceneGraph: SceneGraphResult, mode: ExportMode, animationIds?: string[] | null): THREEType.AnimationClip[];
interface AppendGeometryOptions {
    THREE: typeof THREEType;
    geometry: THREEType.BufferGeometry;
    matrix: THREEType.Matrix4;
    customUVs?: Float32Array;
}
declare class MeshAccumulator {
    private readonly positions;
    private readonly normals;
    private readonly uvs;
    private readonly indices;
    private vertexCount;
    constructor(withUVs: boolean);
    appendGeometry(options: AppendGeometryOptions): void;
    hasGeometry(): boolean;
    build(THREE: typeof THREEType): THREEType.BufferGeometry;
}
export declare const __testing: {
    buildTextureAtlas: typeof buildTextureAtlas;
    collectUsedTextureIds: typeof collectUsedTextureIds;
    MeshAccumulator: typeof MeshAccumulator;
    createExportContext: typeof createExportContext;
    buildSceneGraph: typeof buildSceneGraph;
    resolveAnimationClips: typeof resolveAnimationClips;
};
export {};
