Struct rafx_framework::VertexDataLayout
source · 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 copy 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
source§fn eq(&self, other: &VertexDataLayout) -> bool
fn eq(&self, other: &VertexDataLayout) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for VertexDataLayout
Auto Trait Implementations§
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> 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.