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, Global>,
indices: Vec<u32, Global>,
primitive_type: PrimitiveType
) -> Mesh<T>
[src]
vertices: Vec<T, Global>,
indices: Vec<u32, Global>,
primitive_type: PrimitiveType
) -> Mesh<T>
Mesh from vertices, indices and primitive type
pub fn from_vertices(vertices: Vec<T, Global>) -> Mesh<T>
[src]
Triangles mesh from vertices with no indices
pub fn from_vertices_and_type(
vertices: Vec<T, Global>,
ty: PrimitiveType
) -> Mesh<T>
[src]
vertices: Vec<T, Global>,
ty: PrimitiveType
) -> Mesh<T>
Mesh with no indices from vertices and primitive type
pub fn from_iter_and_type<I>(vertices: I, ty: PrimitiveType) -> Mesh<T> where
I: Iterator<Item = T>,
[src]
I: Iterator<Item = T>,
Mesh with no indices from vertices iterator and primitive type
pub fn from_vertices_indices(
vertices: Vec<T, Global>,
indices: Vec<u32, Global>
) -> Mesh<T>
[src]
vertices: Vec<T, Global>,
indices: Vec<u32, Global>
) -> Mesh<T>
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, Global>)
[src]
Set the mesh vertices
pub fn set_indices(&mut self, indices: Vec<u32, Global>)
[src]
Set the mesh vertices
pub fn indices(&self) -> &Vec<u32, Global>ⓘ
[src]
pub fn indices_mut(&mut self) -> &mut Vec<u32, Global>ⓘ
[src]
pub fn vertices(&self) -> &[T]ⓘ
[src]
pub fn vertices_mut(&mut self) -> &mut Vec<T, Global>ⓘ
[src]
pub fn vertices_indices_mut(
&mut self
) -> (&mut Vec<T, Global>, &mut Vec<u32, Global>)
[src]
&mut self
) -> (&mut Vec<T, Global>, &mut Vec<u32, Global>)
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, Global>
[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>(&mut self, other: I) where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
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: u32, i1: u32, i2: u32)
[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]>, Global>
[src]
pub fn faces_mut(&mut self) -> Box<dyn Iterator<Item = [&mut T; 3]>, Global>
[src]
impl<T> Mesh<T> where
T: Clone,
[src]
impl<T> Mesh<T> where
T: Clone,
[src]impl<T> Mesh<T> where
T: Clone,
[src]
impl<T> Mesh<T> where
T: Clone,
[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]pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Mesh<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Mesh<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl<T> FromIterator<T> for Mesh<T>
[src]
impl<T> FromIterator<T> for Mesh<T>
[src]pub fn from_iter<I>(iter: I) -> Mesh<T> where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
impl<T> Serialize for Mesh<T> where
T: Serialize,
[src]
impl<T> Serialize for Mesh<T> where
T: Serialize,
[src]pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
impl ToSimpleVao<Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>, Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>> for Mesh<Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>>
[src]
impl ToSimpleVao<Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>, Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>> for Mesh<Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>>
[src]pub fn to_simple_vao<C, B>(
&self,
gl: &C,
bindings: &B,
usage: u32
) -> Result<SimpleVao<Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>>, Error> where
C: CreationContext,
B: Bindings,
[src]
&self,
gl: &C,
bindings: &B,
usage: u32
) -> Result<SimpleVao<Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>>, Error> where
C: CreationContext,
B: Bindings,
pub fn as_simple_vao_data(
&self
) -> Data<'_, Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>>
[src]
&self
) -> Data<'_, Matrix<f32, U2, U1, <DefaultAllocator as Allocator<f32, U2, U1>>::Buffer>>
impl ToSimpleVao<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>, Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>> for Mesh<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
[src]
impl ToSimpleVao<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>, Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>> for Mesh<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
[src]pub fn to_simple_vao<C, B>(
&self,
gl: &C,
bindings: &B,
usage: u32
) -> Result<SimpleVao<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>, Error> where
C: CreationContext,
B: Bindings,
[src]
&self,
gl: &C,
bindings: &B,
usage: u32
) -> Result<SimpleVao<Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>, Error> where
C: CreationContext,
B: Bindings,
pub fn as_simple_vao_data(
&self
) -> Data<'_, Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
[src]
&self
) -> Data<'_, Matrix<f32, U3, U1, <DefaultAllocator as Allocator<f32, U3, U1>>::Buffer>>
impl<T> ToSimpleVao<T, Mesh<T>> for Mesh<T> where
T: 'static + VertexFormat + Clone,
[src]
impl<T> ToSimpleVao<T, Mesh<T>> for Mesh<T> where
T: 'static + VertexFormat + Clone,
[src]pub fn to_simple_vao<C, B>(
&self,
gl: &C,
bindings: &B,
usage: u32
) -> Result<SimpleVao<T>, Error> where
C: CreationContext,
B: Bindings,
[src]
&self,
gl: &C,
bindings: &B,
usage: u32
) -> Result<SimpleVao<T>, Error> where
C: CreationContext,
B: Bindings,
pub fn as_simple_vao_data(&self) -> Data<'_, T>
[src]
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> DowncastSync for T where
T: Any + Send + Sync,
[src]
impl<T> DowncastSync for T where
T: Any + Send + Sync,
[src]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>,