/** * Chunk/voxel coordinate math shared by the World Stores — the helpers every * voxel game re-derives (chunk keys, world→chunk mapping, the 4096-slot voxel * index). A chunk is a 16×16×16 voxel cube addressed by signed-int64 chunk * coordinates (decimal strings on the wire). */ import type { ChunkCoordinatesInput } from '../generated/graphql.js'; /** Voxels per chunk axis. */ export declare const CHUNK_SIZE = 16; /** Voxels per chunk (16³) — the length of a dense voxel array. */ export declare const CHUNK_VOLUME: number; /** A chunk coordinate with numeric axes (convenient client-side form). */ export interface ChunkCoord { x: number; y: number; z: number; } /** The stable string key a chunk is cached under: `"x:y:z"`. */ export declare function chunkKey(coord: ChunkCoord | ChunkCoordinatesInput): string; /** Parse a {@link chunkKey} back into numeric coordinates. */ export declare function parseChunkKey(key: string): ChunkCoord; /** Convert a numeric chunk coordinate to the wire form (decimal strings). */ export declare function toChunkInput(coord: ChunkCoord): ChunkCoordinatesInput; /** Convert a wire chunk coordinate (decimal strings) to numeric form. */ export declare function fromChunkInput(coord: ChunkCoordinatesInput): ChunkCoord; /** The chunk containing a world-space position. */ export declare function worldToChunk(x: number, y: number, z: number): ChunkCoord; /** The within-chunk voxel coordinate (0-15 per axis) of a world position. */ export declare function worldToLocalVoxel(x: number, y: number, z: number): { x: number; y: number; z: number; }; /** * The dense-array index of a within-chunk voxel coordinate: * `x + y*16 + z*256` (the platform's chunk `voxels` layout). */ export declare function voxelIndex(x: number, y: number, z: number): number; /** Invert {@link voxelIndex} back to within-chunk coordinates. */ export declare function voxelCoordFromIndex(index: number): { x: number; y: number; z: number; }; /** * Every chunk coordinate within a Chebyshev radius of `center` (the cube * `(2r+1)³`, matching `chunks.byDistance` semantics), center first. */ export declare function chunksAround(center: ChunkCoord, radius: number): ChunkCoord[]; /** Chebyshev (chunk-grid) distance between two chunk coordinates. */ export declare function chunkDistance(a: ChunkCoord, b: ChunkCoord): number; //# sourceMappingURL=keys.d.ts.map