Skip to main content

SkinnedDrawObject

Struct SkinnedDrawObject 

Source
pub struct SkinnedDrawObject {
Show 13 fields pub vertex_base: u32, pub vertex_count: usize, pub index_offset: usize, pub index_count: usize, pub model: [[f32; 4]; 4], pub texture_slot: usize, pub normal_map_slot: usize, pub material: MaterialUniforms, pub visible: bool, pub joint_count: usize, pub local_bb_min: [f32; 3], pub local_bb_max: [f32; 3], pub lod_alternates: Vec<LodSlice>,
}
Expand description

One skeletally animated draw: a slice of the shared skinned vertex/index buffers plus the per-joint matrix buffer the vertex shader blends.

Skinned objects deform every frame, so they are excluded from the static BVH and drawn unconditionally (after the visibility flag). The joint matrices live in a separate per-object GPU buffer the renderer rewrites each frame from AnimationSystem’s output.

Fields§

§vertex_base: u32

Vertex offset (in vertex units, not bytes) of this slot’s first vertex in the shared skinned vertex buffer. The shared index buffer holds absolute vertex indices (each slot’s mesh-relative indices are re-based onto this vertex_base at upload time), so the value is not consumed by the draw call itself, but the asset hot-reload’s rebuild_skinned_geometry path needs to know each slot’s vertex region to copy unchanged geometry across a size-changing rebuild.

§vertex_count: usize

Number of vertices in this slot’s region of the shared skinned vertex buffer.

§index_offset: usize

Element offset into the shared skinned index buffer.

§index_count: usize

Number of indices to draw.

§model: [[f32; 4]; 4]

Column-major model-to-world matrix. Applied after skinning.

§texture_slot: usize

Index into the shared texture pool for this object’s albedo map.

§normal_map_slot: usize

Index into the shared texture pool for this object’s normal map, or NO_NORMAL_MAP_SLOT when the object has no normal map.

§material: MaterialUniforms

Per-object material scalars.

§visible: bool

When false the object is skipped in both the shadow and main passes.

§joint_count: usize

Number of joints in this object’s skeleton, capped at MAX_JOINTS. The vertex shader only blends matrices below this count.

§local_bb_min: [f32; 3]

Mesh-local (object-space) bind-pose AABB, computed from the bind-pose vertices at load. The GPU-driven skinned fold pads this (animations reach past the bind pose) and transforms it by model to get the per-frame world bound the cull kernel frustum/Hi-Z tests. See pack_skinned_record.

§local_bb_max: [f32; 3]

Upper corner of the mesh-local bind-pose AABB.

§lod_alternates: Vec<LodSlice>

LOD1..N slices, in ascending switch_distance order. Empty when the SkinnedMesh declared lod_levels <= 1. Each slice points at a rebased index range in the shared skinned IB; QEM half-edge decimation keeps the vertex set unchanged so all LODs share this slot’s vertex_base / vertex_count.

Implementations§

Source§

impl SkinnedDrawObject

Source

pub fn active_lod(&self, distance: f32) -> (usize, usize)

Pick the active (index_offset, index_count) for this object given the camera distance to its model-matrix translation. Returns the LOD0 pair when no alternates are present or the distance is below the first threshold.

Source

pub fn translation(&self) -> [f32; 3]

World-space translation of this object (column 3 of the model matrix). Skinned objects have no static AABB (they deform every frame), so per-frame LOD picks use the model translation as the stand-in for an AABB centre.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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, <T as TryFrom<U>>::Error>

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.