Struct mod3d_base::example_objects::ExampleVertices
source · 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_accessor(
&mut self,
data: usize,
num: u32,
et: BufferElementType,
ofs: u32,
stride: u32,
) -> usize
pub fn push_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: usize,
positions: usize,
attrs: &[(VertexAttr, usize)],
) -> ShortIndex
pub fn push_vertices( &mut self, indices: 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
Trait Implementations§
source§impl<'a, R: Renderable> Default for ExampleVertices<'a, R>
impl<'a, R: Renderable> Default for ExampleVertices<'a, R>
Auto Trait Implementations§
impl<'buffers, R> !Freeze for ExampleVertices<'buffers, R>
impl<'buffers, R> !RefUnwindSafe for ExampleVertices<'buffers, R>
impl<'buffers, R> !Send for ExampleVertices<'buffers, R>
impl<'buffers, R> !Sync for ExampleVertices<'buffers, R>
impl<'buffers, R> Unpin for ExampleVertices<'buffers, R>
impl<'buffers, R> !UnwindSafe for ExampleVertices<'buffers, R>
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