Add Mesh::push_vertex

This commit is contained in:
Hanno Braun 2024-10-31 21:21:18 +01:00
parent 48c7a842a0
commit e1f79bd171
2 changed files with 7 additions and 1 deletions

View File

@ -3,3 +3,9 @@ pub struct Mesh {
pub vertices: Vec<[f32; 3]>,
pub triangles: Vec<[u32; 3]>,
}
impl Mesh {
pub fn push_vertex(&mut self, vertex: [f32; 3]) {
self.vertices.push(vertex);
}
}

View File

@ -13,7 +13,7 @@ pub fn model() -> anyhow::Result<Mesh> {
[-0.5, 0.5, 0.5], // 6
[0.5, 0.5, 0.5], // 7
]
.map(|vertex| mesh.vertices.push(vertex));
.map(|vertex| mesh.push_vertex(vertex));
[
[0, 4, 6], // left