2020-05-28 01:37:59 +02:00
|
|
|
//! Draw geometry using meshes of triangles.
|
2020-11-10 20:11:23 +01:00
|
|
|
use bytemuck::{Pod, Zeroable};
|
2020-05-28 01:37:59 +02:00
|
|
|
|
2020-05-19 17:15:44 +02:00
|
|
|
/// A set of [`Vertex2D`] and indices representing a list of triangles.
|
|
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
|
pub struct Mesh2D {
|
|
|
|
|
/// The vertices of the mesh
|
|
|
|
|
pub vertices: Vec<Vertex2D>,
|
|
|
|
|
/// The list of vertex indices that defines the triangles of the mesh.
|
|
|
|
|
pub indices: Vec<u32>,
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-29 10:52:58 -07:00
|
|
|
/// A two-dimensional vertex.
|
2020-11-10 20:11:23 +01:00
|
|
|
#[derive(Copy, Clone, Debug, Zeroable, Pod)]
|
2020-05-19 17:15:44 +02:00
|
|
|
#[repr(C)]
|
|
|
|
|
pub struct Vertex2D {
|
2022-09-29 10:52:58 -07:00
|
|
|
/// The vertex position in 2D space.
|
2020-05-19 17:15:44 +02:00
|
|
|
pub position: [f32; 2],
|
2022-10-06 07:28:05 -07:00
|
|
|
}
|