pub trait VertexLoad<'a, C: ?Sized = ()>: Clone {
// Required methods
fn position(ctx: &C, reader: &SourceReader<'a, XYZ>, index: u32) -> Self;
fn add_normal(
&mut self,
ctx: &C,
reader: &SourceReader<'a, XYZ>,
index: u32,
);
fn add_texcoord(
&mut self,
ctx: &C,
reader: &SourceReader<'a, ST>,
index: u32,
set: Option<u32>,
);
}
Expand description
A trait, to be implemented by user types, to describe how to construct a vertex object
from the stored data.
The context C
is an arbitrary type that can be used for getting
(or modifying, with interior mutability) additional data to create the object.
Required Methods§
Sourcefn position(ctx: &C, reader: &SourceReader<'a, XYZ>, index: u32) -> Self
fn position(ctx: &C, reader: &SourceReader<'a, XYZ>, index: u32) -> Self
Construct a new vertex using only position data.
The position index
is provided as is, but the intended use is to call reader.get(i)
and use the resulting [f32; 3]
as the position.
Sourcefn add_normal(&mut self, ctx: &C, reader: &SourceReader<'a, XYZ>, index: u32)
fn add_normal(&mut self, ctx: &C, reader: &SourceReader<'a, XYZ>, index: u32)
Add normal data to a vertex.
The position index
is provided as is, but the intended use is to call reader.get(i)
and use the resulting [f32; 3]
as the normal.
Sourcefn add_texcoord(
&mut self,
ctx: &C,
reader: &SourceReader<'a, ST>,
index: u32,
set: Option<u32>,
)
fn add_texcoord( &mut self, ctx: &C, reader: &SourceReader<'a, ST>, index: u32, set: Option<u32>, )
Add texture coordinate data to a vertex.
The position index
is provided as is, but the intended use is to call reader.get(i)
and use the resulting [f32; 2]
as the u-v data.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.