Struct solstice::mesh::IndexedMesh
source · pub struct IndexedMesh<V, I> { /* private fields */ }
Expand description
A mesh with vertex data that is indexed with separate data.
This is useful if you have a number of vertices that you would otherwise have to duplicate because indices are generally smaller than a vertex so duplicating them is more performant.
Implementations§
source§impl<V, I> IndexedMesh<V, I>where
V: Vertex,
I: Index,
impl<V, I> IndexedMesh<V, I>where V: Vertex, I: Index,
sourcepub fn new(
ctx: &mut Context,
vertex_count: usize,
index_count: usize
) -> Result<Self, GraphicsError>
pub fn new( ctx: &mut Context, vertex_count: usize, index_count: usize ) -> Result<Self, GraphicsError>
Construct a mesh with a given number of vertices and indices.
pub fn with_data( ctx: &mut Context, vertices: &[V], indices: &[I] ) -> Result<Self, GraphicsError>
sourcepub fn with_mesh(
ctx: &mut Context,
mesh: VertexMesh<V>,
index_count: usize
) -> Result<Self, GraphicsError>
pub fn with_mesh( ctx: &mut Context, mesh: VertexMesh<V>, index_count: usize ) -> Result<Self, GraphicsError>
Construct an indexed mesh from a non-indexed mesh.
sourcepub fn set_vertices(&self, ctx: &mut Context, vertices: &[V], offset: usize)
pub fn set_vertices(&self, ctx: &mut Context, vertices: &[V], offset: usize)
Write new data into a range of the Mesh’s vertex data.
sourcepub fn set_indices(&self, ctx: &mut Context, indices: &[I], offset: usize)
pub fn set_indices(&self, ctx: &mut Context, indices: &[I], offset: usize)
Write new data into a range of the Mesh’s vertex data.
pub fn set_draw_range(&mut self, draw_range: Option<Range<usize>>)
pub fn draw_range(&self) -> Range<usize>
pub fn set_draw_mode(&mut self, draw_mode: DrawMode)
pub fn len(&self) -> usize
Trait Implementations§
source§impl<V: Clone, I: Clone> Clone for IndexedMesh<V, I>
impl<V: Clone, I: Clone> Clone for IndexedMesh<V, I>
source§fn clone(&self) -> IndexedMesh<V, I>
fn clone(&self) -> IndexedMesh<V, I>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<V: Vertex, I: Index> MeshAttacher for IndexedMesh<V, I>
impl<V: Vertex, I: Index> MeshAttacher for IndexedMesh<V, I>
source§impl<V: PartialEq, I: PartialEq> PartialEq<IndexedMesh<V, I>> for IndexedMesh<V, I>
impl<V: PartialEq, I: PartialEq> PartialEq<IndexedMesh<V, I>> for IndexedMesh<V, I>
source§fn eq(&self, other: &IndexedMesh<V, I>) -> bool
fn eq(&self, other: &IndexedMesh<V, I>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.