import type { Bounds } from '../data-table';
import { BlockMaskBuffer } from '../voxel/block-mask-buffer';
/**
 * Solid leaf node marker: childMask = 0xFF, baseOffset = 0.
 * This is unambiguous because BFS layout guarantees children always come after
 * their parent, so baseOffset = 0 is never valid for an interior node.
 */
declare const SOLID_LEAF_MARKER: number;
/**
 * Sparse voxel octree using Laine-Karras node format.
 */
interface SparseOctree {
    /** Grid bounds aligned to 4x4x4 block boundaries */
    gridBounds: Bounds;
    /** Original Gaussian scene bounds */
    sceneBounds: Bounds;
    /** Size of each voxel in world units */
    voxelResolution: number;
    /** Voxels per leaf dimension (always 4) */
    leafSize: number;
    /** Maximum tree depth */
    treeDepth: number;
    /** Number of interior nodes */
    numInteriorNodes: number;
    /** Number of mixed leaf nodes */
    numMixedLeaves: number;
    /** All nodes in Laine-Karras format (interior + leaves) */
    nodes: Uint32Array;
    /** Voxel masks for mixed leaves: pairs of u32 (lo, hi) */
    leafData: Uint32Array;
}
/**
 * Build a sparse octree from accumulated voxelization blocks.
 *
 * Uses Structure-of-Arrays (SoA) representation and linear scans on sorted
 * Morton codes instead of Maps and per-node objects for performance.
 *
 * **Mutates `buffer` in place.** Phase 1 sorts the buffer's solid-morton,
 * mixed-morton, and mixed-mask typed arrays directly (no SoA copy) to keep
 * peak memory low on very large grids. After this call the buffer's blocks
 * are still semantically equivalent — same morton/mask pairs — but reordered
 * by morton ascending. Callers must not rely on insertion order being
 * preserved across this call.
 *
 * @param buffer - BlockMaskBuffer containing voxelized blocks. Mutated:
 * solid mortons, mixed mortons, and mixed masks are sorted in place.
 * @param gridBounds - Grid bounds aligned to block boundaries
 * @param sceneBounds - Original scene bounds
 * @param voxelResolution - Size of each voxel in world units
 * @returns Sparse octree structure
 */
declare function buildSparseOctree(buffer: BlockMaskBuffer, gridBounds: Bounds, sceneBounds: Bounds, voxelResolution: number): SparseOctree;
export { buildSparseOctree, SOLID_LEAF_MARKER };
export type { SparseOctree };
