Skip to main content

Crate roxlap_scene

Crate roxlap_scene 

Source
Expand description

roxlap scene-graph layer — many independent chunked voxel grids in a single 3D scene.

See PORTING-SCENE.md at the workspace root for the substage roadmap. This crate is the layer above voxlap’s per-chunk renderer (roxlap-core): a Scene holds a sparse set of Grids, each with its own f64 world position + arbitrary 3D rotation. Future stages will add per-grid raycast composition (S3), cross-chunk gline within a grid (S4), per-grid rotation (S5), far-LOD billboards / planet proxies (S6), and streaming + procedural generation (S7).

S2.0 lands the type skeleton + grid registration only. S2.1 adds the addr module — world ↔ grid-local ↔ chunk + voxel-in-chunk decomposition, the canonical f64↔i32 boundary helper called out by risk R5 in PORTING-SCENE.md. S2.2 adds the chunks module (sparse storage with on-demand chunk allocation) and the Grid edit API (Grid::set_voxel, Grid::set_rect, Grid::set_sphere) which decompose multi-chunk operations and delegate to roxlap_formats::edit. S2.3 adds the snapshot module — a serde-friendly view of the scene that round-trips through Serialize + Deserialize (chunks encode via roxlap_formats::vxl::serialize / parse). Rendering composition is still owed (S3+).

Re-exports§

pub use addr::grid_local_to_world;
pub use addr::voxel_global;
pub use addr::voxel_split;
pub use addr::world_to_grid_local;
pub use addr::GridLocalPos;
pub use billboard::canonical_viewpoints;
pub use billboard::BillboardCache;
pub use billboard::BillboardSnapshot;
pub use lod::select_lod;
pub use lod::Lod;
pub use lod::LodThresholds;
pub use streaming::ChunkGenerator;
pub use streaming::StreamRadius;

Modules§

addr
Address math for the world ↔ grid-local ↔ chunk + voxel coordinate spaces.
billboard
Billboard impostor cache — S6.2 of PORTING-SCENE.md § S6.
cavegen
Adapter wrapping roxlap-cavegen’s Generator presets as a crate::ChunkGenerator (S7.5).
chunks
Sparse chunk storage helpers.
edit
Multi-chunk edit API on Grid.
lod
Per-grid LOD tier selection — S6.0 of PORTING-SCENE.md § S6.
render
Scene-level rendering — drives roxlap_core::opticast::opticast across the grids of a Scene.
snapshot
Serde-friendly snapshot of a Scene.
streaming
Streaming + procedural-generation hooks.

Structs§

Grid
One independent voxel grid in a scene. Holds its world placement and a sparse map of populated chunks. Empty chunk slots are implicit air and skipped during rendering / raycasts.
GridAddr
Address of one voxel inside a scene: which grid it belongs to, which chunk within that grid, and the voxel’s offset inside that chunk.
GridId
Stable identifier for a grid registered in a Scene. Issued by Scene::add_grid; persists across edits but a removed grid’s id is not reissued.
GridTransform
f64 world placement of one grid: position + orientation.
Scene
Top-level scene container. Holds a flat collection of grids keyed by GridId.

Constants§

CHUNK_SIZE_XY
XY size of one chunk in voxels. The plan locks 128 — keeps chunks compact (~2 MB worst-case dense-slab footprint inside each Vxl) and divides cleanly into voxlap’s 2048 reference world size.
CHUNK_SIZE_Z
Z size of one chunk in voxels. Locked at 256 to preserve voxlap’s existing slab byte format unchanged inside each chunk — the per-chunk renderer doesn’t need to know it’s living inside a scene-graph.