Struct softrender::mesh::Mesh [] [src]

pub struct Mesh<V> {
    pub indices: Vec<u32>,
    pub vertices: Vec<Vertex<V>>,
}

Mesh structure with indexed vertices.

Fields

Vertex indices

If you are unfamiliar with vertex indices, it's a way of re-using vertices for multiple primitives.

For example (in 2D), for a rectangle made of two triangles, you would define the four points for each corner vertex:

vertex #: name         = (x,   y)
0:        bottom_left  = (0.0, 1.0)
1:        top_left     = (0.0, 1.0)
2:        bottom_right = (1.0, 0.0)
3:        top_right    = (1.0, 1.0)

then you'd have your index list be something like:

[0, 1, 2, // bottom half triangle
 1, 3, 2] // top half triangle

Note that both of those triangles go in a clockwise direction from vertex to vertex.

Vertices with their vertex data

Trait Implementations

impl<V: Clone> Clone for Mesh<V>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<V> Debug for Mesh<V>
[src]

Formats the value using the given formatter.