Skip to main content

TriangleBuffer

Enum TriangleBuffer 

Source
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.

Fields

§number_of_vertices: u32

The number of vertices to draw

§

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

Source

pub fn new(context: &Context, cpu_mesh: &CpuMesh) -> Self

Create a new triangle buffer from a CpuMesh.

Source

pub fn draw( &self, program: &Program, render_states: RenderStates, viewer: &dyn Viewer, )

Draw the triangles defined by this buffer.

Source

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.

Source

pub fn vertex_count(&self) -> u32

Returns the number of vertices defined by this buffer.

Source

pub fn triangle_count(&self) -> u32

Returns the number of triangles defined by this buffer.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.