Struct rin_graphics::Mesh [−][src]
pub struct Mesh<T> { /* fields omitted */ }
A Mesh with any vertex type
Contains vertices that can be of any type although rin define a few of the most commonly used and optionally indices
Also a primitive type that defines how the vertices / indices should be parsed
Implementations
impl<T> Mesh<T>
[src]
impl<T> Mesh<T>
[src]pub fn new(
vertices: Vec<T>,
indices: Vec<IndexT>,
primitive_type: PrimitiveType
) -> Mesh<T>
[src]
vertices: Vec<T>,
indices: Vec<IndexT>,
primitive_type: PrimitiveType
) -> Mesh<T>
Mesh from vertices, indices and primitive type
pub fn from_vertices(vertices: Vec<T>) -> Mesh<T>
[src]
Triangles mesh from vertices with no indices
pub fn from_vertices_and_type(vertices: Vec<T>, ty: PrimitiveType) -> Mesh<T>
[src]
Mesh with no indices from vertices and primitive type
pub fn from_iter_and_type<I: Iterator<Item = T>>(
vertices: I,
ty: PrimitiveType
) -> Mesh<T>
[src]
vertices: I,
ty: PrimitiveType
) -> Mesh<T>
Mesh with no indices from vertices iterator and primitive type
pub fn from_vertices_indices(vertices: Vec<T>, indices: Vec<IndexT>) -> Mesh<T>
[src]
Triangles mesh from vertices and indices
pub fn with_type(ty: PrimitiveType) -> Mesh<T>
[src]
Empty mesh with the specified primitive type
pub fn set_vertices(&mut self, vertices: Vec<T>)
[src]
Set the mesh vertices
pub fn set_indices(&mut self, indices: Vec<IndexT>)
[src]
Set the mesh vertices
pub fn indices(&self) -> &Vec<IndexT>
[src]
pub fn indices_mut(&mut self) -> &mut Vec<IndexT>
[src]
pub fn vertices(&self) -> &[T]
[src]
pub fn vertices_mut(&mut self) -> &mut Vec<T>
[src]
pub fn vertices_indices_mut(&mut self) -> (&mut Vec<T>, &mut Vec<IndexT>)
[src]
pub fn iter(&self) -> Iter<'_, T>
[src]
Iterator over the mesh vertices in the order they where inserted
pub fn iter_mut(&mut self) -> IterMut<'_, T>
[src]
Mutable iterator over the mesh vertices in the order they where inserted
pub fn into_iter(self) -> IntoIter<T>
[src]
Consume the mesh into an iterator over it’s vertices in the order they where inserted
pub fn pop(&mut self) -> Option<T>
[src]
Pop the last vertex
pub fn push(&mut self, value: T)
[src]
Push a vertex at the end of the mesh
pub fn extend<I: IntoIterator<Item = T>>(&mut self, other: I)
[src]
Extend the mesh with an iterator of new vertices
pub fn insert(&mut self, index: usize, element: T)
[src]
Insert a vertex at a certain position
pub fn get_mut(&mut self, index: usize) -> &mut T
[src]
Mutably get the vertex at the specified position.
Will panic if the vertex doesn’t exist
pub fn reserve(&mut self, capacity: usize)
[src]
Reserve as much capacity for vertices
pub unsafe fn set_len(&mut self, len: usize)
[src]
Unsafe operation that sets the len of the vertices collection
pub fn truncate(&mut self, len: usize)
[src]
Truncate the mesh vertices at the specified len
pub fn last(&self) -> Option<&T>
[src]
Last vertex if there’s any
pub fn last_mut(&mut self) -> Option<&mut T>
[src]
Last vertex mutably if there’s any
pub fn primitive_type(&self) -> PrimitiveType
[src]
Primitive type
pub fn set_primitive_type(&mut self, ty: PrimitiveType)
[src]
pub fn add_face(&mut self, i0: IndexT, i1: IndexT, i2: IndexT)
[src]
Add a triangle face (only for Triangles primitive type)
pub fn clear(&mut self)
[src]
Clear the mesh vertices and indices
pub fn clear_vertices(&mut self)
[src]
Clear the vertices
pub fn clear_indices(&mut self)
[src]
Clear the indices
pub fn len(&self) -> usize
[src]
Number of vertices
pub fn is_empty(&self) -> bool
[src]
Contains any vertices
pub fn as_slice(&self) -> MeshSlice<'_, T>
[src]
pub fn faces(&self) -> Box<dyn Iterator<Item = [&T; 3]>>
[src]
pub fn faces_mut(&mut self) -> Box<dyn Iterator<Item = [&mut T; 3]>>
[src]
impl<T: Clone> Mesh<T>
[src]
impl<T: Clone> Mesh<T>
[src]impl<T: Clone> Mesh<T>
[src]
impl<T: Clone> Mesh<T>
[src]pub fn extend_from_mesh(&mut self, other: &Mesh<T>)
[src]
Extend the mesh with another mesh
The vertices and indices will just be inserted at the end without taking into account the primitive types
pub fn extend_from_slice(&mut self, other: &[T])
[src]
Extend the mesh with a slice of new vertices
Trait Implementations
impl<'de, T> Deserialize<'de> for Mesh<T> where
T: Deserialize<'de>,
[src]
impl<'de, T> Deserialize<'de> for Mesh<T> where
T: Deserialize<'de>,
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T> FromIterator<T> for Mesh<T>
[src]
impl<T> FromIterator<T> for Mesh<T>
[src]fn from_iter<I>(iter: I) -> Mesh<T> where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
Auto Trait Implementations
impl<T> RefUnwindSafe for Mesh<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Mesh<T> where
T: Send,
T: Send,
impl<T> Sync for Mesh<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Mesh<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Mesh<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]
impl<T> Serialize for T where
T: Serialize + ?Sized,
[src]pub fn erased_serialize(
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
[src]
&self,
serializer: &mut dyn Serializer
) -> Result<Ok, Error>
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]pub fn to_subset(&self) -> Option<SS>
[src]
pub fn is_in_subset(&self) -> bool
[src]
pub fn to_subset_unchecked(&self) -> SS
[src]
pub fn from_subset(element: &SS) -> SP
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,