pub struct Mesh { /* private fields */ }
Expand description
Mesh data stored on the GPU as a vertex and index buffer. Cheap to clone.
Implementations§
Source§impl Mesh
impl Mesh
Sourcepub fn from_data(gfx: &impl Has<GraphicsContext>, raw: MeshData<'_>) -> Self
pub fn from_data(gfx: &impl Has<GraphicsContext>, raw: MeshData<'_>) -> Self
Create a new mesh from MeshData
.
Sourcepub fn new_line(
gfx: &impl Has<GraphicsContext>,
points: &[impl Into<Point2<f32>> + Clone],
width: f32,
color: Color,
) -> GameResult<Self>
pub fn new_line( gfx: &impl Has<GraphicsContext>, points: &[impl Into<Point2<f32>> + Clone], width: f32, color: Color, ) -> GameResult<Self>
Create a new mesh for a line of one or more connected segments.
Sourcepub fn new_circle(
gfx: &impl Has<GraphicsContext>,
mode: DrawMode,
point: impl Into<Point2<f32>>,
radius: f32,
tolerance: f32,
color: Color,
) -> GameResult<Self>
pub fn new_circle( gfx: &impl Has<GraphicsContext>, mode: DrawMode, point: impl Into<Point2<f32>>, radius: f32, tolerance: f32, color: Color, ) -> GameResult<Self>
Create a new mesh for a circle.
Sourcepub fn new_ellipse(
gfx: &impl Has<GraphicsContext>,
mode: DrawMode,
point: impl Into<Point2<f32>>,
radius1: f32,
radius2: f32,
tolerance: f32,
color: Color,
) -> GameResult<Self>
pub fn new_ellipse( gfx: &impl Has<GraphicsContext>, mode: DrawMode, point: impl Into<Point2<f32>>, radius1: f32, radius2: f32, tolerance: f32, color: Color, ) -> GameResult<Self>
Create a new mesh for an ellipse.
Sourcepub fn new_polyline(
gfx: &impl Has<GraphicsContext>,
mode: DrawMode,
points: &[impl Into<Point2<f32>> + Clone],
color: Color,
) -> GameResult<Self>
pub fn new_polyline( gfx: &impl Has<GraphicsContext>, mode: DrawMode, points: &[impl Into<Point2<f32>> + Clone], color: Color, ) -> GameResult<Self>
Create a new mesh for a series of connected lines.
Sourcepub fn new_polygon(
gfx: &impl Has<GraphicsContext>,
mode: DrawMode,
points: &[impl Into<Point2<f32>> + Clone],
color: Color,
) -> GameResult<Self>
pub fn new_polygon( gfx: &impl Has<GraphicsContext>, mode: DrawMode, points: &[impl Into<Point2<f32>> + Clone], color: Color, ) -> GameResult<Self>
Create a new mesh for closed polygon. The points given must be in clockwise order, otherwise at best the polygon will not draw.
Sourcepub fn new_rectangle(
gfx: &impl Has<GraphicsContext>,
mode: DrawMode,
bounds: Rect,
color: Color,
) -> GameResult<Self>
pub fn new_rectangle( gfx: &impl Has<GraphicsContext>, mode: DrawMode, bounds: Rect, color: Color, ) -> GameResult<Self>
Create a new mesh for a rectangle.
Sourcepub fn new_rounded_rectangle(
gfx: &impl Has<GraphicsContext>,
mode: DrawMode,
bounds: Rect,
radius: f32,
color: Color,
) -> GameResult<Self>
pub fn new_rounded_rectangle( gfx: &impl Has<GraphicsContext>, mode: DrawMode, bounds: Rect, radius: f32, color: Color, ) -> GameResult<Self>
Create a new mesh for a rounded rectangle.
Sourcepub fn from_triangles(
gfx: &impl Has<GraphicsContext>,
triangles: &[impl Into<Point2<f32>> + Clone],
color: Color,
) -> GameResult<Self>
pub fn from_triangles( gfx: &impl Has<GraphicsContext>, triangles: &[impl Into<Point2<f32>> + Clone], color: Color, ) -> GameResult<Self>
Create a new Mesh
from a raw list of triangle points.
Sourcepub fn wgpu(&self) -> (&Buffer, &Buffer)
pub fn wgpu(&self) -> (&Buffer, &Buffer)
Returns the WGPU vertex and index buffers of this mesh, in that order.
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
Returns the number of vertices in this mesh.
Sourcepub fn index_count(&self) -> usize
pub fn index_count(&self) -> usize
Returns the number of indices in this mesh.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mesh
impl !RefUnwindSafe for Mesh
impl Send for Mesh
impl Sync for Mesh
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> HasMut<T> for T
impl<T> HasMut<T> for T
Source§fn retrieve_mut(&mut self) -> &mut T
fn retrieve_mut(&mut self) -> &mut T
Method to retrieve the context type as mutable.
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