pub struct Mesh {
pub name: String,
pub positions: Vec<[f32; 3]>,
pub normals: Option<Vec<[f32; 3]>>,
pub uvs: Option<Vec<[f32; 2]>>,
pub indices: Option<Vec<u32>>,
pub skin: Option<Skin>,
pub stamp: u64,
}Expand description
A triangle-list mesh with optional vertex attributes and skin weights. 2D elements are meshes lying on the XY plane (normals +Z).
Fields§
§name: String§positions: Vec<[f32; 3]>§normals: Option<Vec<[f32; 3]>>§uvs: Option<Vec<[f32; 2]>>§indices: Option<Vec<u32>>Triangle indices; None means a flat, non-indexed triangle list.
skin: Option<Skin>§stamp: u64CPU→GPU invalidation stamp: unique at creation, refreshed by
Mesh::touch on every in-place edit. GPU mirrors key their buffers
on it so edits and address reuse (ABA) force a re-upload. Never
serialized, never compared for equality.
Implementations§
Source§impl Mesh
impl Mesh
Sourcepub fn touch(&mut self)
pub fn touch(&mut self)
Mark the content as edited in place: every GPU mirror must re-upload this mesh before drawing it again.
pub fn vertex_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Sourcepub fn compute_normals(&mut self)
pub fn compute_normals(&mut self)
Recompute smooth vertex normals from triangle faces.
pub fn iter_triangles(&self) -> impl Iterator<Item = [u32; 3]> + '_
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Mesh
impl<'de> Deserialize<'de> for Mesh
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Mesh
impl RefUnwindSafe for Mesh
impl Send for Mesh
impl Sync for Mesh
impl Unpin for Mesh
impl UnsafeUnpin for Mesh
impl UnwindSafe for Mesh
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more