import type { Vec3 } from './types.ts'; /** Bricks per side of a tile. */ export declare const TILE_BRICKS = 4; /** Bricks per tile: a tile's page table has one entry each (tiles.wgsl). */ export declare const TILE_BRICK_COUNT: number; /** Words of a tile slot's record (tiles.wgsl): coordinates and state, then 27 neighbors. */ export declare const TILE_RECORD_WORDS = 32; /** Entries of the hash per row of its texture (tiles.wgsl findTile). */ export declare const HASH_ROW = 256; /** The tiles from `lo` to `hi`, inclusive. */ export interface TileBox { lo: Vec3; hi: Vec3; } /** The directory's GPU tables, rebuilt when the tiles change. */ export interface TileTables { /** Every tile slot's record: its tile's coordinates and state (FREE, LIVE or * CLOSING), then its 27 neighbors' slots, -1 where there is no tile. */ records: Int32Array; /** The open-addressed hash of tile coordinates: x, y, z and the slot, or -1 when empty, * in whole rows of `HASH_ROW` entries. */ hash: Int32Array; /** Boxes around the groups of touching tiles, merged until no two overlap: the renderer * marches each. */ clusters: TileBox[]; /** Every tile slot's tile coordinates and cluster, or -1 for a free slot, four words a * slot. */ tiles: Int32Array; } /** * The tiles of the sparse grid: cubes of 4x4x4 bricks at integer coordinates of the world * lattice, in which the GPU gives bricks pool slots. Tiles cover the sources and the * content with a tile of margin, and stay a while after nothing needs them, so the GPU * never waits on the CPU and the CPU never waits on readback. Each tile owns a slot that * indexes its page table and every per-brick array; slots are reused lowest first. */ export declare class TileDirectory { private readonly tiles; private readonly slots; /** Changes since the tables were last built. */ private dirty; /** Tile slots the GPU arrays hold. */ capacity: number; /** Slots given to tiles created since the last call to `takeCreated`. */ private created; /** Coordinates of every tile slot when the tables were last built. */ private snapshot; /** Below the ground, world y < 0, is solid: no tile is created there. */ ground: boolean; /** Counts the tables built: brick ids keep their meaning until it changes. */ version: number; get count(): number; /** Whether the tiles changed since the tables were last built. */ get changed(): boolean; /** Mark every tile overlapping the box of tile coordinates `lo` to `hi` as needed at * `step`, creating the missing ones. With the ground, tiles below it are never created. */ need(lo: Vec3, hi: Vec3, step: number): void; /** Remove the tiles that closed in the previous step, then close the tiles nothing has * needed for a while: the step being prepared frees their bricks' slots. */ retire(step: number): void; /** Remove every tile. */ clear(): void; /** The slot of the tile at `coord`, or -1. */ slotAt(coord: readonly number[]): number; /** Slots that need the GPU arrays to hold them. */ get slotsUsed(): number; /** Slots of the tiles created since the last call, whose page tables start empty. */ takeCreated(): number[]; /** The tile coordinates of every slot when the tables were last built, to read GPU * results recorded against them. */ get coordinates(): readonly (Vec3 | undefined)[]; /** Build the GPU tables for `capacity` slots, at least `slotsUsed`. */ tables(capacity: number): TileTables; /** Group the tiles that touch, faces, edges or corners, and box each group; then merge * boxes that overlap until none do, so every point lies in one box at most. */ private clusters; }