pub enum TriangleBuffer {
Unindexed {
number_of_vertices: u32,
},
IndexedU8(ElementBuffer<u8>),
IndexedU16(ElementBuffer<u16>),
IndexedU32(ElementBuffer<u32>),
}Expand description
Buffer that defines the three vertices for each triangle in a mesh.
Variants§
Unindexed
Each triangle is defined by three consequitive elements in the VertexBuffers. All elements in the VertexBuffers are used exactly once.
IndexedU8(ElementBuffer<u8>)
Use an index buffer, with indices defined in u8 format, to index into the VertexBuffers.
Each triangle is defined by three consequitive indices in the ElementBuffer.
Elements in the VertexBuffers can be used multiple times.
IndexedU16(ElementBuffer<u16>)
Use an index buffer, with indices defined in u16 format, to index into the VertexBuffers.
Each triangle is defined by three consequitive indices in the ElementBuffer.
Elements in the VertexBuffers can be used multiple times.
IndexedU32(ElementBuffer<u32>)
Use an index buffer, with indices defined in u32 format, to index into the VertexBuffers.
Each triangle is defined by three consequitive indices in the ElementBuffer.
Elements in the VertexBuffers can be used multiple times.
Implementations§
Source§impl TriangleBuffer
impl TriangleBuffer
Sourcepub fn new(context: &Context, cpu_mesh: &CpuMesh) -> Self
pub fn new(context: &Context, cpu_mesh: &CpuMesh) -> Self
Create a new triangle buffer from a CpuMesh.
Sourcepub fn draw(
&self,
program: &Program,
render_states: RenderStates,
viewer: &dyn Viewer,
)
pub fn draw( &self, program: &Program, render_states: RenderStates, viewer: &dyn Viewer, )
Draw the triangles defined by this buffer.
Sourcepub fn draw_instanced(
&self,
program: &Program,
render_states: RenderStates,
viewer: &dyn Viewer,
instance_count: u32,
)
pub fn draw_instanced( &self, program: &Program, render_states: RenderStates, viewer: &dyn Viewer, instance_count: u32, )
Draw multiple instances of the triangles defined by this buffer.
Sourcepub fn vertex_count(&self) -> u32
pub fn vertex_count(&self) -> u32
Returns the number of vertices defined by this buffer.
Sourcepub fn triangle_count(&self) -> u32
pub fn triangle_count(&self) -> u32
Returns the number of triangles defined by this buffer.