#[repr(C)]pub struct PbrVertex {
pub position: [f32; 3],
pub normal: [f32; 3],
pub texcoord: [f32; 2],
pub tangent: [f32; 4],
}Expand description
PBR 顶点(位置 + 法线 + 纹理坐标 + 切线)
用于支持法线贴图的 PBR 渲染管线。
§内存布局
| 偏移 | 属性 | 格式 |
|---|---|---|
| 0 | position | Float32x3 |
| 12 | normal | Float32x3 |
| 24 | texcoord | Float32x2 |
| 32 | tangent | Float32x4 |
§示例
use anvilkit_render::renderer::buffer::PbrVertex;
let vertex = PbrVertex {
position: [0.0, 1.0, 0.0],
normal: [0.0, 1.0, 0.0],
texcoord: [0.5, 0.5],
tangent: [1.0, 0.0, 0.0, 1.0],
};
assert_eq!(std::mem::size_of::<PbrVertex>(), 48);Fields§
§position: [f32; 3]3D 位置 (x, y, z)
normal: [f32; 3]表面法线 (x, y, z)
texcoord: [f32; 2]纹理坐标 (u, v)
tangent: [f32; 4]切线 (x, y, z, w) — w 是 bitangent sign
Trait Implementations§
impl Copy for PbrVertex
impl Pod for PbrVertex
Auto Trait Implementations§
impl Freeze for PbrVertex
impl RefUnwindSafe for PbrVertex
impl Send for PbrVertex
impl Sync for PbrVertex
impl Unpin for PbrVertex
impl UnsafeUnpin for PbrVertex
impl UnwindSafe for PbrVertex
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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
If this function returns true, then it must be valid to reinterpret
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.