Skip to main content

SkinnedInstanceDesc

Struct SkinnedInstanceDesc 

Source
pub struct SkinnedInstanceDesc<'a> {
    pub mesh: &'a SkinnedMesh,
    pub material: usize,
    pub transform: Mat4,
    pub bounds: Option<Aabb>,
}
Expand description

Where a skinned object is, and what it draws: InstanceDesc with a SkinnedMesh where the description’s mesh index would be.

The mesh is a reservation rather than an index because a skinned draw is not only a mesh — it also names a run of the vertex pool the skinning dispatch fills, and which of the reservation’s two runs that is changes every frame. ForwardRenderer::begin_skinned_frame is what keeps it current, so nothing here carries a parity.

Fields§

§mesh: &'a SkinnedMesh

The region this object is drawn out of, from ForwardRenderer::reserve_skinned.

§material: usize

Which SceneDesc::materials row it shades through, exactly as InstanceDesc::material.

§transform: Mat4

Where it is: a model matrix, on InstanceDesc::transform’s terms.

The joints are not in it — a palette carries each joint’s global transform times its inverse bind matrix, and this is what puts the deformed mesh in the world. See SkinRange::palette.

§bounds: Option<Aabb>

A model-space box around every pose this object will be drawn in until it is next set, in the space transform carries into the world — or None, which keeps it in every cull.

None is the safe default and the costly one. The region’s source mesh’s box is its bind pose, which says nothing about where a skinning dispatch moves the vertices, so an object without a box of its own is drawn by every camera and every shadow map wherever it is. With one, the frustum culls, the occlusion culls and the shadow cache’s footprints test it exactly as they test a rigid mesh’s box. The box has to contain every vertex the palette can put anywhere: a cull that finds it outside drops the whole object, so a box that misses part of a pose can make an object vanish while that part is on screen. ForwardRenderer::set_skinned_bounds moves it each frame, for a pose — a ragdoll — that travels far from the object’s origin.

Every corner must be finite and min must not exceed max on any axis. An inverted or non-finite box is refused rather than written, because the culls would read it as a box nothing reaches and drop the object everywhere — see InstancePoolError::InvalidBounds.

Trait Implementations§

Source§

impl<'a> Clone for SkinnedInstanceDesc<'a>

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<'a> Copy for SkinnedInstanceDesc<'a>

Source§

impl<'a> Debug for SkinnedInstanceDesc<'a>

Source§

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

Formats the value using the given formatter. Read more

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.