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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more