pub struct Mesh {
pub name: String,
pub positions: Vec<V3>,
pub normals: Option<Vec<V3>>,
pub colors: Option<Vec<V3>>,
pub indices: Vec<u32>,
pub material: Option<Material>,
pub uvs: Option<Vec<[f32; 2]>>,
pub texture: Option<Texture>,
pub surface: Surface,
}Expand description
One part of a model: triangles over shared vertices, drawn in one material.
Fields§
§name: String§positions: Vec<V3>§normals: Option<Vec<V3>>Normals from the file, one per position, when it has them.
colors: Option<Vec<V3>>Vertex colours (0..1), one per position, when the file has them; they replace the material colour.
indices: Vec<u32>Three indices into positions per triangle.
material: Option<Material>§uvs: Option<Vec<[f32; 2]>>Texture coordinates, one per position, in picture space (u right,
v down; see texture), when the file has them.
texture: Option<Texture>The material’s texture, drawn where the mesh has uvs; otherwise
(and where the picture couldn’t be read) the material colour is.
surface: SurfaceWhat the material adds to its colour and picture.
Implementations§
Source§impl Mesh
impl Mesh
pub fn triangle_count(&self) -> usize
Sourcepub fn sanitize(&mut self)
pub fn sanitize(&mut self)
Drops triangles that point past the vertices and lists that are not one per vertex, so the rest of the code can index freely.
Sourcepub fn textured(&self) -> Option<(&Texture, &[[f32; 2]])>
pub fn textured(&self) -> Option<(&Texture, &[[f32; 2]])>
The texture and coordinates to draw with, when the mesh has both.
Trait Implementations§
impl StructuralPartialEq for Mesh
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§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().