pub struct VertexDataLayout { /* private fields */ }
Implementations§
Source§impl VertexDataLayout
impl VertexDataLayout
pub fn new( vertex_stride: usize, vertex_rate: RafxVertexAttributeRate, members: &[VertexMember], ) -> Self
Sourcepub fn build_vertex_layout<VertexT, F: FnOnce(&mut VertexMemberAccumulator<'_, VertexT>, &VertexT)>(
vertex: &VertexT,
vertex_rate: RafxVertexAttributeRate,
f: F,
) -> VertexDataLayout
pub fn build_vertex_layout<VertexT, F: FnOnce(&mut VertexMemberAccumulator<'_, VertexT>, &VertexT)>( vertex: &VertexT, vertex_rate: RafxVertexAttributeRate, f: F, ) -> VertexDataLayout
Example usage to define a vertex data layout and convert it into a VertexDataSetLayout
(VertexDataLayout::build_vertex_layout
creates a VertexDataLayout and the .into_set()
call makes it a single-buffer set
use rafx_framework::VertexDataLayout;
use rafx_api::{RafxFormat, RafxPrimitiveTopology, RafxVertexAttributeRate};
#[derive(Default, Copy, Clone)]
#[repr(C)]
pub struct ExampleVertex {
pub position: [f32; 3],
pub normal: [f32; 3],
pub tex_coord: [f32; 2],
}
VertexDataLayout::build_vertex_layout(&ExampleVertex::default(), RafxVertexAttributeRate::Vertex, |builder, vertex| {
builder.add_member(&vertex.position, "POSITION", RafxFormat::R32G32B32_SFLOAT);
builder.add_member(&vertex.normal, "NORMAL", RafxFormat::R32G32B32_SFLOAT);
builder.add_member(&vertex.tex_coord, "TEXCOORD", RafxFormat::R32G32_SFLOAT);
}).into_set(RafxPrimitiveTopology::TriangleList);
pub fn member(&self, name: &str) -> Option<&VertexDataMemberMeta>
pub fn members(&self) -> &FnvHashMap<String, VertexDataMemberMeta>
pub fn hash(&self) -> VertexDataLayoutHash
pub fn vertex_rate(&self) -> RafxVertexAttributeRate
pub fn vertex_stride(&self) -> usize
pub fn into_set( self, primitive_topology: RafxPrimitiveTopology, ) -> VertexDataSetLayout
pub fn intersects_with(&self, other: &Self) -> bool
pub fn is_subset_of(&self, other: &Self) -> bool
pub fn is_subset_of_multi(subsets: &[Self], others: &[Self]) -> bool
Trait Implementations§
Source§impl Clone for VertexDataLayout
impl Clone for VertexDataLayout
Source§fn clone(&self) -> VertexDataLayout
fn clone(&self) -> VertexDataLayout
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for VertexDataLayout
impl Debug for VertexDataLayout
Source§impl PartialEq for VertexDataLayout
impl PartialEq for VertexDataLayout
impl StructuralPartialEq for VertexDataLayout
Auto Trait Implementations§
impl Freeze for VertexDataLayout
impl RefUnwindSafe for VertexDataLayout
impl Send for VertexDataLayout
impl Sync for VertexDataLayout
impl Unpin for VertexDataLayout
impl UnwindSafe for VertexDataLayout
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> 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.