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

pub struct Mesh { /* fields omitted */ }
Expand description

2D polygon mesh.

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

Implementations

Create a new mesh for a line of one or more connected segments.

Create a new mesh for a circle.

Create a new mesh for an ellipse.

Create a new mesh for series of connected lines.

Create a new mesh for closed polygon. The points given must be in clockwise order, otherwise at best the polygon will not draw.

Create a new mesh for a rectangle

Create a new mesh for a rounded rectangle

Create a new Mesh from a raw list of triangle points.

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 of verts
  • verts is longer than u32::MAX elements.
  • indices do not specify triangles in clockwise order.

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.

Returns a slice for this mesh that could be used for manual draw call submission

Returns a vertex buffer for this mesh that could be used for manual draw call submission

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Draws the drawable onto the rendering target.

Returns a bounding box in the form of a Rect. Read more

Sets the blend mode to be used when drawing this drawable. This overrides the general graphics::set_blend_mode(). If None is set, defers to the blend mode set by graphics::set_blend_mode(). Read more

Gets the blend mode to be used when drawing this drawable.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.