[−][src]Struct ggez::graphics::Mesh
2D polygon mesh.
All of its creation methods are just shortcuts for doing the same operation
via a MeshBuilder
.
Implementations
impl Mesh
[src]
pub fn new_line<P>(
ctx: &mut Context,
points: &[P],
width: f32,
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>> + Clone,
[src]
ctx: &mut Context,
points: &[P],
width: f32,
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>> + Clone,
Create a new mesh for a line of one or more connected segments.
pub fn new_circle<P>(
ctx: &mut Context,
mode: DrawMode,
point: P,
radius: f32,
tolerance: f32,
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>>,
[src]
ctx: &mut Context,
mode: DrawMode,
point: P,
radius: f32,
tolerance: f32,
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>>,
Create a new mesh for a circle.
pub fn new_ellipse<P>(
ctx: &mut Context,
mode: DrawMode,
point: P,
radius1: f32,
radius2: f32,
tolerance: f32,
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>>,
[src]
ctx: &mut Context,
mode: DrawMode,
point: P,
radius1: f32,
radius2: f32,
tolerance: f32,
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>>,
Create a new mesh for an ellipse.
pub fn new_polyline<P>(
ctx: &mut Context,
mode: DrawMode,
points: &[P],
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>> + Clone,
[src]
ctx: &mut Context,
mode: DrawMode,
points: &[P],
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>> + Clone,
Create a new mesh for series of connected lines.
pub fn new_polygon<P>(
ctx: &mut Context,
mode: DrawMode,
points: &[P],
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>> + Clone,
[src]
ctx: &mut Context,
mode: DrawMode,
points: &[P],
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>> + Clone,
Create a new mesh for closed polygon. The points given must be in clockwise order, otherwise at best the polygon will not draw.
pub fn new_rectangle(
ctx: &mut Context,
mode: DrawMode,
bounds: Rect,
color: Color
) -> GameResult<Mesh>
[src]
ctx: &mut Context,
mode: DrawMode,
bounds: Rect,
color: Color
) -> GameResult<Mesh>
Create a new mesh for a rectangle
pub fn new_rounded_rectangle(
ctx: &mut Context,
mode: DrawMode,
bounds: Rect,
radius: f32,
color: Color
) -> GameResult<Mesh>
[src]
ctx: &mut Context,
mode: DrawMode,
bounds: Rect,
radius: f32,
color: Color
) -> GameResult<Mesh>
Create a new mesh for a rounded rectangle
pub fn from_triangles<P>(
ctx: &mut Context,
triangles: &[P],
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>> + Clone,
[src]
ctx: &mut Context,
triangles: &[P],
color: Color
) -> GameResult<Mesh> where
P: Into<Point2<f32>> + Clone,
Create a new Mesh
from a raw list of triangle points.
pub fn from_raw<V>(
ctx: &mut Context,
verts: &[V],
indices: &[u32],
texture: Option<Image>
) -> GameResult<Mesh> where
V: Into<Vertex> + Clone,
[src]
ctx: &mut Context,
verts: &[V],
indices: &[u32],
texture: Option<Image>
) -> GameResult<Mesh> where
V: Into<Vertex> + Clone,
Creates a Mesh
from a raw list of triangles defined from points
and indices, with the given UV texture coordinates. You may also
supply an Image
to use as a texture, if you pass None
, it will
just use a pure white texture. The indices should draw the points in
clockwise order, otherwise at best the mesh will not draw.
This is the most primitive mesh-creation method, but allows you full control over the tesselation and texturing. As such it will return an error, panic, or produce incorrect/invalid output (that may later cause drawing to panic), if:
indices
contains a value out of bounds ofverts
verts
is longer thanu32::MAX
elements.indices
do not specify triangles in clockwise order.
pub fn set_vertices(
&mut self,
ctx: &mut Context,
verts: &[Vertex],
indices: &[u32]
)
[src]
&mut self,
ctx: &mut Context,
verts: &[Vertex],
indices: &[u32]
)
Replaces the vertices in the Mesh
with the given ones. This MAY be faster
than re-creating a Mesh
with Mesh::from_raw()
due to
reusing memory instead of allocating and deallocating it, both on the CPU and
GPU side. There's too much variation in implementations and drivers to promise
it will actually be faster though. At worst, it will be the same speed.
pub fn get_slice(&self) -> &Slice<Resources>
[src]
Returns a slice for this mesh that could be used for manual draw call submission
pub fn get_vertex_buffer(&self) -> Buffer<Resources, Vertex>
[src]
Returns a vertex buffer for this mesh that could be used for manual draw call submission
Trait Implementations
impl Clone for Mesh
[src]
impl Debug for Mesh
[src]
impl Drawable for Mesh
[src]
pub fn draw(&self, ctx: &mut Context, param: DrawParam) -> GameResult
[src]
pub fn dimensions(&self, _ctx: &mut Context) -> Option<Rect>
[src]
pub fn set_blend_mode(&mut self, mode: Option<BlendMode>)
[src]
pub fn blend_mode(&self) -> Option<BlendMode>
[src]
impl PartialEq<Mesh> for Mesh
[src]
impl StructuralPartialEq for Mesh
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Mesh
[src]
impl Send for Mesh
[src]
impl Sync for Mesh
[src]
impl Unpin for Mesh
[src]
impl !UnwindSafe for Mesh
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,