pub struct ExampleVertices<'buffers, R: Renderable> { /* private fields */ }
Expand description
This structure provides for creating example objects, particularly with regard to their vertices
It uses arrays of [Pin]ned data structures so that the data can be safely self-referential
Implementations§
Source§impl<'a, R: Renderable> ExampleVertices<'a, R>
impl<'a, R: Renderable> ExampleVertices<'a, R>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new ExampleVertices
This should probably not be Pin<Box<>>
Sourcepub fn push_byte_buffer(&mut self, buffer: Box<dyn ByteBuffer>) -> usize
pub fn push_byte_buffer(&mut self, buffer: Box<dyn ByteBuffer>) -> usize
Push a new ByteBuffer implementation and return its index
Sourcepub fn push_index_accessor(
&mut self,
data: usize,
num: u32,
et: BufferElementType,
ofs: u32,
) -> usize
pub fn push_index_accessor( &mut self, data: usize, num: u32, et: BufferElementType, ofs: u32, ) -> usize
Create a new [BufferAccessor] on a particular ByteBuffer instance that has already been pushed
Sourcepub fn push_data_accessor(
&mut self,
data: usize,
num: u32,
et: BufferElementType,
ofs: u32,
stride: u32,
) -> usize
pub fn push_data_accessor( &mut self, data: usize, num: u32, et: BufferElementType, ofs: u32, stride: u32, ) -> usize
Create a new [BufferAccessor] on a particular ByteBuffer instance that has already been pushed
Sourcepub fn push_vertices(
&mut self,
indices: Option<usize>,
positions: usize,
attrs: &[(VertexAttr, usize)],
) -> ShortIndex
pub fn push_vertices( &mut self, indices: Option<usize>, positions: usize, attrs: &[(VertexAttr, usize)], ) -> ShortIndex
Create a new Vertices using a set of indices and positions
This extends the life of the BufferAccessor to that of the ExampleVertices
This is safe as the BufferAccessor’s are in the Vec for ExampleVertices
Sourcepub fn borrow_vertices(&self, vertices: ShortIndex) -> &Vertices<'_, R>
pub fn borrow_vertices(&self, vertices: ShortIndex) -> &Vertices<'_, R>
Borrow a set of vertices; this would allow (if mut!) the vertices to have attributes added