Struct three_d::core::buffer::ElementBuffer
source · pub struct ElementBuffer { /* private fields */ }Expand description
A buffer containing 3 indices for each triangle to be rendered, which is why it is also known as an index buffer. The three indices refer to three places in a set of VertexBuffer where the data (position, normal etc.) is found for the three vertices of the triangle. See for example Program::draw_elements to use this for drawing.
Implementations§
source§impl ElementBuffer
impl ElementBuffer
sourcepub fn new_with_data<T: ElementBufferDataType>(
context: &Context,
data: &[T]
) -> Self
pub fn new_with_data<T: ElementBufferDataType>( context: &Context, data: &[T] ) -> Self
Creates a new element buffer and fills it with the given indices which must be divisable by 3.
sourcepub fn fill<T: ElementBufferDataType>(&mut self, data: &[T])
pub fn fill<T: ElementBufferDataType>(&mut self, data: &[T])
Fills the buffer with the given indices which must be divisable by 3.
sourcepub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
The number of triangles in the buffer.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for ElementBuffer
impl Send for ElementBuffer
impl Sync for ElementBuffer
impl Unpin for ElementBuffer
impl UnwindSafe for ElementBuffer
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