pub struct SkinnedVertex {
pub position: Vec3,
pub tex_coords: Vec2,
pub normal: Vec3,
pub tangent: Vec4,
pub joint_indices: [u16; 4],
pub joint_weights: [f32; 4],
/* private fields */
}Expand description
Same 4 fields as Vertex, plus skinning data.
_pad exists purely so this type has no implicit padding: glam::Vec4
is 16-byte aligned (SIMD-backed), which forces this whole struct’s
alignment to 16 — without an explicit trailing field to account for the
last 8 bytes, the compiler would insert invisible padding there
instead, and #[derive(bytemuck::Pod)] correctly refuses to compile a
type with any padding it can’t account for byte-for-byte.
Fields§
§position: Vec3§tex_coords: Vec2§normal: Vec3§tangent: Vec4§joint_indices: [u16; 4]Up to 4 joint indices this vertex is bound to, paired positionally
with joint_weights. u16, not u32 or u8: glTF’s JOINTS_n
accessor is spec-limited to UNSIGNED_BYTE/UNSIGNED_SHORT (never
UNSIGNED_INT), so u16 already covers every legal glTF skeleton
(up to 65535 joints) losslessly, at half the bytes of u32.
gltf_loader::load_gltf upconverts
u8-sourced JOINTS_0 data.
joint_weights: [f32; 4]Implementations§
Source§impl SkinnedVertex
impl SkinnedVertex
pub fn new( position: Vec3, tex_coords: Vec2, normal: Vec3, tangent: Vec4, joint_indices: [u16; 4], joint_weights: [f32; 4], ) -> Self
Sourcepub fn layout() -> VertexBufferLayout
pub fn layout() -> VertexBufferLayout
Occupies locations 0–3 (same meaning as
Vertex’s own 0–3) and 8–9 — deliberately
skipping 4–7 (reserved for InstanceVertex)
so a skinned mesh can still be instanced in one pipeline without
either layout changing. WGSL side: all integer vertex formats widen
to vec4<u32> regardless of source width, so declare
@location(8) joint_indices: vec4<u32> and
@location(9) joint_weights: vec4<f32>.
Trait Implementations§
Source§impl Clone for SkinnedVertex
impl Clone for SkinnedVertex
Source§fn clone(&self) -> SkinnedVertex
fn clone(&self) -> SkinnedVertex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SkinnedVertex
Source§impl Default for SkinnedVertex
impl Default for SkinnedVertex
Source§fn default() -> SkinnedVertex
fn default() -> SkinnedVertex
impl Pod for SkinnedVertex
Auto Trait Implementations§
impl Freeze for SkinnedVertex
impl RefUnwindSafe for SkinnedVertex
impl Send for SkinnedVertex
impl Sync for SkinnedVertex
impl Unpin for SkinnedVertex
impl UnsafeUnpin for SkinnedVertex
impl UnwindSafe for SkinnedVertex
Blanket Implementations§
impl<T> AnyBitPattern for Twhere
T: Pod,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Component for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Interleave for Twhere
T: Pod,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
impl<T> NoUninit for Twhere
T: Pod,
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().