pub struct Mesh {
    pub indices: Vec<u32, Global>,
    pub vertices: Vec<Vertex, Global>,
    pub texture_id: TextureId,
}
Expand description

Textured triangles in two dimensions.

Fields

indices: Vec<u32, Global>

Draw as triangles (i.e. the length is always multiple of three).

If you only support 16-bit indices you can use Mesh::split_to_u16.

egui is NOT consistent with what winding order it uses, so turn off backface culling.

vertices: Vec<Vertex, Global>

The vertex data indexed by indices.

texture_id: TextureId

The texture to use when drawing these triangles.

Implementations

Restore to default state, but without freeing memory.

Are all indices within the bounds of the contained vertices?

Calculate a bounding rectangle.

Append all the indices and vertices of other to self.

Append all the indices and vertices of other to self without taking ownership.

Add a triangle.

Make room for this many additional triangles (will reserve 3x as many indices). See also reserve_vertices.

Make room for this many additional vertices. See also reserve_triangles.

Rectangle with a texture and color.

Uniformly colored rectangle.

This is for platforms that only support 16-bit index buffers.

Splits this mesh into many smaller meshes (if needed) where the smaller meshes have 16-bit indices.

Translate location by this much, in-place

Rotate by some angle about an origin, in-place.

Origin is a position in screen space.

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
Returns the “default value” for a type. Read more
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.