[][src]Struct ggez::graphics::Mesh

pub struct Mesh { /* fields omitted */ }

2D polygon mesh.

All of its creation methods are just shortcuts for doing the same operation via a MeshBuilder.

Methods

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]

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]

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]

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]

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]

Create a new mesh for closed polygon.

pub fn new_rectangle(
    ctx: &mut Context,
    mode: DrawMode,
    bounds: Rect,
    color: Color
) -> GameResult<Mesh>
[src]

Create a new mesh for a rectangle

pub fn from_triangles<P>(
    ctx: &mut Context,
    triangles: &[P],
    color: Color
) -> GameResult<Mesh> where
    P: Into<Point2<f32>> + Clone
[src]

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>
) -> Mesh where
    V: Into<Vertex> + Clone
[src]

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.

This is the most primitive mesh-creation method, but allows you full control over the tesselation and texturing. As such it will panic or produce incorrect/invalid output (that may later cause drawing to panic), if:

  • indices contains a value out of bounds of verts
  • verts is longer than u32::MAX elements.

pub fn set_vertices(
    &mut self,
    ctx: &mut Context,
    verts: &[Vertex],
    indices: &[u32]
)
[src]

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.

Trait Implementations

impl Drawable for Mesh[src]

impl PartialEq<Mesh> for Mesh[src]

impl Clone for Mesh[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Mesh[src]

Auto Trait Implementations

impl Send for Mesh

impl Sync for Mesh

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 

impl<T> Erased for T

impl<T> SetParameter for T

default fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.