pub struct MeshRange {
pub base_vertex: u32,
pub base_index: u32,
pub index_count: u32,
pub bounds: Aabb,
pub uv_range: UvRange,
pub flags: u32,
}Expand description
Where a mesh lives in the pools — §3.1’s three integers — and the box its vertices fit in.
Two of the three integers are draw_indexed’s own arguments — the draw is
draw_indexed(base_index..base_index + index_count, 0, …) — and
MeshRange::base_vertex is deliberately not the third. The
module docs say why it reaches the shader as data instead.
PartialEq but no longer Eq: MeshRange::bounds is floats, and total
equality over an f32 is a claim NaN makes untrue.
Fields§
§base_vertex: u32First vertex of this mesh in the vertex pool. Added to every index the shader reads, which is why the indices themselves are mesh-relative.
Never above i32::MAX: MeshPool::new refuses a vertex capacity that
a draw’s signed base vertex could not address, which is the width
VkDrawIndexedIndirectCommand::vertexOffset and its D3D12 and WebGPU
equivalents have — so a pool this rule allows is one §3.3’s indirect
draws can still address.
base_index: u32First index of this mesh in the index pool.
index_count: u32How many indices to draw.
bounds: AabbThe mesh’s local-space bounds: the smallest axis-aligned box holding
every vertex position MeshPool::upload was handed.
Computed by the pool rather than supplied by the caller, because the pool has the vertex bytes and a caller that got this wrong would produce geometry culled while it is on screen — a hole in the picture with nothing to fail. It travels with the range for the reason the module docs give: same lifetime, same table entry, same write.
uv_range: UvRangeThe scale and offset this mesh’s unorm16 UV lanes were quantised
against, on its way to GpuMesh::uv_range.
Supplied by the caller rather than computed here, unlike
bounds: the pool receives coordinates that are
already lanes, so the float range they came from is the one thing
about a mesh it cannot recover. crcbl_shaders::vertex::UvRange::from_uvs
is what the caller builds it with, over every coordinate the mesh
carries — and, for a DAG, over every coordinate every level carries.
flags: u32The mesh’s own bits, on their way to GpuMesh::flags — today only
GpuMesh::MESH_AUTHORED_TANGENTS.
Supplied by the caller for uv_range’s reason
exactly, and more strongly: the pool receives a snorm16x4 quaternion
per vertex and every such quaternion is a valid frame, so whether the
frame means anything for sampling a texture is the one thing about a
mesh that cannot be read back out of its bytes. It is a claim, and only
whoever built the vertices can make it.