Expand description
The geometry the engine can build without any source file: voxel-chunk
streaming (build_chunk_mesh / build_chunk_impostor_mesh regenerate a
chunk’s mesh as it streams in), the glass/water quad generators the GPU
backends call, the procedural mesh generators (room, box, cylinder, plane,
sphere, terrain, skybox, extrude, heightfield-from-pixels), and the shared
low-level mesh math (per-vertex tangents, face normals, the vertex tuple
type).
The generators produce (Vec<Vert>, Vec<u16>); packing that into a payload
is crate::bake::mesh. The cook crate’s JSON compile front end parses
world.jsonl args and calls down into both.
Modules§
- glass_
quad - src/geometry/glass_quad.rs: flat rectangular quad for a GlassPanel.
- water_
grid - src/geometry/water_grid.rs: flat tessellated quad for a WaterSurface.
Structs§
- Chunk
Block Type - One palette entry for the chunk mesher: solidity plus per-face atlas UVs.
- Chunk
Generator - Deterministic terrain generator for one
VoxelWorld. - Heightfield
Field - The field a heightmap image displaces: grid extents, resolution, and the elevation range the red channel maps into.
- Palette
Slot - One entry resolved from a VoxelChunk palette.
Noneslots are non-solid (air) and emit no geometry; their neighbours treat them as empty. Public so the cook crate’scompile_voxel_chunk_payload(build-time mesher) can build the palette this crate’s runtimebuild_chunk_meshalso consumes.
Functions§
- build_
box - Build an axis-aligned box from half-extents
[x, y, z]. - build_
chunk_ impostor_ mesh - Build a coarse “impostor” mesh for one distant chunk from its terrain surface heights.
- build_
chunk_ mesh - Build a renderable mesh for one procedurally generated chunk.
- build_
cylinder - Build an upright cylinder from radius, height, and segment count.
- build_
extrude - Extrude
profile(an[x, z]polygon of at least 3 points, either winding) byheightalong Y, optionally rounding convex corners withcorner_radiussampled atcorner_segmentsarc points per corner. - build_
heightfield_ from_ pixels - Build a heightfield grid from decoded RGBA pixels: bilinear-sample the image’s red channel across the field’s grid and map it through the elevation range.
- build_
plane - Build a flat horizontal plane from half-width and half-depth.
- build_
room_ geometry - Build room geometry from explicit extents.
- build_
skybox - Build an inside-facing skybox cube with half-extent
sizeon all axes. Keepsizebelow the camera’s far plane so the sky is not clipped. - build_
sphere - Build a UV sphere from radius, ring count, and segment count.
- build_
terrain - Build a displaced terrain grid.
subdivisionsis the grid resolution per axis (clamped to 4..=255);amplitudeis the peak height above the base plane in metres. - build_
voxel_ mesh - Generate hidden-face-culled geometry for a voxel chunk.
- compute_
tangents - Compute a per-vertex tangent vector for every vertex in the mesh.
- payload_
joints_ to_ defs - Convert a payload-joint vec to the args-form vec the runtime
build_skeleton_from_joint_defsconsumes. Public so the client runtime init path can call it without re-implementing the field mapping.
Type Aliases§
- Vert
- Interleaved CPU vertex tuple the geometry generators produce before packing
into the GPU
Vertex: position, normal, color, uv. Public so the cook crate’s generators and payload compilers can name the same shape the runtime tangent pass consumes.