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: u32Vertex 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: usizeNumber of vertices in this slot’s region of the shared skinned vertex buffer.
index_offset: usizeElement offset into the shared skinned index buffer.
index_count: usizeNumber of indices to draw.
model: [[f32; 4]; 4]Column-major model-to-world matrix. Applied after skinning.
texture_slot: usizeIndex into the shared texture pool for this object’s albedo map.
normal_map_slot: usizeIndex into the shared texture pool for this object’s normal map, or
NO_NORMAL_MAP_SLOT when the object has no normal map.
material: MaterialUniformsPer-object material scalars.
visible: boolWhen false the object is skipped in both the shadow and main passes.
joint_count: usizeNumber 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
impl SkinnedDrawObject
Sourcepub fn active_lod(&self, distance: f32) -> (usize, usize)
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.
Sourcepub fn translation(&self) -> [f32; 3]
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.