nx_voxgrid.nx
buildroot/runtime/nx_voxgrid.nx
about
nx_tissue.nx -- 3D voxel grid storage with palette packing.
Biology naming per [[feedback-naming-discipline-no-industry-
competitor-overlap]]: a tissue is a 3D mass of cells with shared
structure and function. Composes naturally with existing biology
primitives (cells form tissue, tissue holds the 3D structure of an
organ). Avoids:
- "chunk" (Minecraft trademark proximity, Java HashMap conflation)
- "lattice" (already taken by nx_lattice.nx -- 2D Minkowski math)
- "voxel_grid" (too descriptive of industry term)
- "volume" (generic infra term)
THIS IS THE OTHER UNLOCK PRIMITIVE for Minecraft-equivalent on $5
ESP32 class hardware. Pair with nx_palette (already shipped) and
a 32x32x32 (32768 voxel) tissue at 3 bits per voxel fits in 12288
bytes. Six tissues arrayed in a 3x2x1 grid form a walkable scene
in 72 KiB -- comfortably within ESP32 SRAM (520 KiB total).
Composes:
nx_palette -- the sub-byte packing layer (nx_palette_pack /
nx_palette_unpack); tissue wraps the (x,y,z) ->
linear-index addressing on top.
nx_budget -- tissue memory consumption is a RAM budget item;
caller registers nx_pal_packed_bytes() with budget
nx_tier -- bpp scales with tier (3bpp at MCU, 4bpp at family,
8bpp at workstation+ for cache friendliness)
nx_pathway -- a tissue lives in a cell; cell budget covers the
tissue's packed byte count
V1 ships cubic + cuboid tissues with palette indices. Real-time
streaming from flash to RAM (chunk paging) is queued; today the
caller materializes the whole tissue in RAM.
Gap list (V1 honest perf verdict):
- no flash-paging (whole tissue in RAM)
- no RLE compression atop palette pack (each voxel costs bpp bits)
- no greedy-meshing helper (caller's geometry layer)
- no neighbor-iteration helper (queued)
- no spatial hash (32^3 = 32K voxels still fits direct addressing)
dependencies 3 imports · 13 importers
diagram shows first 10 each side; +0 more imports, +3 more importers in the complete lists below.
imports: nx_syscalls.nxnx_tier.nxnx_palette.nx
imported by: nx_chunk_paginate.nxnx_chunk_paginate_test.nxnx_ecosystem_compose_test.nxnx_game_engine_compose_test.nxnx_minecraft_mcu_compose_test.nxnx_pets_voxel_view.nxnx_raycast_voxel.nxnx_raycast_voxel_test.nxnx_substrate_compose_test.nxnx_tissue_test.nxnx_voxel_native.nxnx_world_seed.nxnx_world_seed_test.nx
structs
| 70 | struct NxTissue |
consts
| 58 | const NX_TIS_OK: nx_int = 0 |
| 59 | const NX_TIS_ERR_BAD_BPP: nx_int = 1 |
| 60 | const NX_TIS_ERR_BAD_COORD: nx_int = 2 |
| 61 | const NX_TIS_ERR_BAD_INDEX: nx_int = 3 |
| 62 | const NX_TIS_ERR_BAD_DIM: nx_int = 4 |
functions
| 84 | func nx_tissue_new(dim_x: nx_size, |
| 110 | func nx_tissue_storage_bytes(t: *NxTissue) -> nx_size |
| 116 | func nx_tissue_in_bounds(t: *NxTissue, |
| 130 | func _tissue_linear_index(t: *NxTissue, |
| 142 | func _tissue_unpack_one(packed: *u8, linear: nx_size, bpp: nx_int) -> nx_int |
| 169 | func _tissue_pack_one(packed: *u8, linear: nx_size, bpp: nx_int, idx: nx_int) -> nx_int |
| 203 | func nx_tissue_set(t: *NxTissue, |
| 219 | func nx_tissue_get(t: *NxTissue, |
| 231 | func nx_tissue_count_nonzero(t: *NxTissue) -> nx_size |
| 254 | func nx_tissue_fill(t: *NxTissue, idx: nx_int) -> nx_int |