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,

source

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.

source

pub fn with_data( ctx: &mut Context, vertices: &[V], indices: &[I] ) -> Result<Self, GraphicsError>

source

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.

source

pub fn set_vertices(&self, ctx: &mut Context, vertices: &[V], offset: usize)

Write new data into a range of the Mesh’s vertex data.

source

pub fn set_indices(&self, ctx: &mut Context, indices: &[I], offset: usize)

Write new data into a range of the Mesh’s vertex data.

source

pub fn set_draw_range(&mut self, draw_range: Option<Range<usize>>)

source

pub fn draw_range(&self) -> Range<usize>

source

pub fn set_draw_mode(&mut self, draw_mode: DrawMode)

source

pub fn len(&self) -> usize

Trait Implementations§

source§

impl<V: Clone, I: Clone> Clone for IndexedMesh<V, I>

source§

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)

Performs copy-assignment from source. Read more
source§

impl<V: Debug, I: Debug> Debug for IndexedMesh<V, I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<V: Vertex, I: Index> Mesh for &IndexedMesh<V, I>

source§

fn attachments(&self) -> Vec<AttachedAttributes<'_>>

source§

fn draw( &self, ctx: &mut Context, draw_range: Range<usize>, draw_mode: DrawMode, instance_count: usize )

source§

impl<V: Vertex, I: Index> Mesh for IndexedMesh<V, I>

source§

fn attachments(&self) -> Vec<AttachedAttributes<'_>>

source§

fn draw( &self, ctx: &mut Context, draw_range: Range<usize>, draw_mode: DrawMode, instance_count: usize )

source§

impl<V: Vertex, I: Index> MeshAttacher for IndexedMesh<V, I>

source§

fn attach_with_step<'a, T: Mesh>( &'a self, other: &'a T, step: u32 ) -> MultiMesh<'a>

source§

fn attach<'a, T: Mesh>(&'a self, other: &'a T) -> MultiMesh<'a>

source§

impl<V: PartialEq, I: PartialEq> PartialEq<IndexedMesh<V, I>> for IndexedMesh<V, I>

source§

fn eq(&self, other: &IndexedMesh<V, I>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<V, I> StructuralPartialEq for IndexedMesh<V, I>

Auto Trait Implementations§

§

impl<V, I> RefUnwindSafe for IndexedMesh<V, I>where I: RefUnwindSafe, V: RefUnwindSafe,

§

impl<V, I> Send for IndexedMesh<V, I>where I: Send, V: Send,

§

impl<V, I> Sync for IndexedMesh<V, I>where I: Sync, V: Sync,

§

impl<V, I> Unpin for IndexedMesh<V, I>where I: Unpin, V: Unpin,

§

impl<V, I> UnwindSafe for IndexedMesh<V, I>where I: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.