pub struct Mesh2D {
pub visibility: bool,
pub handle: MeshHandle,
pub shader: Option<Shader>,
pub transform: Transform2D,
pub draw_mode: DrawMode,
}Expand description
High-level mesh with visibility, shader, transform, and draw mode.
Cloning is cheap — the handle shares the same GPU buffers.
Fields§
§visibility: bool§handle: MeshHandle§shader: Option<Shader>§transform: Transform2D§draw_mode: DrawModeImplementations§
Source§impl Mesh2D
impl Mesh2D
Sourcepub fn set_shader(&mut self, shader: Shader)
pub fn set_shader(&mut self, shader: Shader)
Attaches a shader to this mesh.
Sourcepub fn remove_shader(&mut self)
pub fn remove_shader(&mut self)
Detaches the current shader.
Sourcepub fn get_draw_mode(&self) -> DrawMode
pub fn get_draw_mode(&self) -> DrawMode
Returns the current draw mode.
Sourcepub fn set_draw_mode(&mut self, draw_mode: DrawMode)
pub fn set_draw_mode(&mut self, draw_mode: DrawMode)
Sets the draw mode.
Sourcepub fn index_count(&self) -> u32
pub fn index_count(&self) -> u32
Returns the index count.
Sourcepub fn vertex_count(&self) -> u32
pub fn vertex_count(&self) -> u32
Returns the vertex count.
Sourcepub fn has_indices(&self) -> bool
pub fn has_indices(&self) -> bool
Returns true if this mesh uses indexed drawing.
Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Returns true when the mesh is both visible and non-empty.
Sourcepub fn set_visibility(&mut self, enable: bool)
pub fn set_visibility(&mut self, enable: bool)
Shows or hides this mesh.
Sourcepub fn toggle_visibility(&mut self)
pub fn toggle_visibility(&mut self)
Toggles visibility.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mesh2D
impl RefUnwindSafe for Mesh2D
impl Send for Mesh2D
impl Sync for Mesh2D
impl Unpin for Mesh2D
impl UnsafeUnpin for Mesh2D
impl UnwindSafe for Mesh2D
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
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>
Converts
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>
Converts
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