Skip to main content

MeshRange

Struct MeshRange 

Source
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: u32

First 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: u32

First index of this mesh in the index pool.

§index_count: u32

How many indices to draw.

§bounds: Aabb

The 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: UvRange

The 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: u32

The 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.

Trait Implementations§

Source§

impl Clone for MeshRange

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for MeshRange

Source§

impl Debug for MeshRange

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MeshRange

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for MeshRange

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MeshRange

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HalThreadSafe for T
where T: Send + Sync,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.