Add Mesh::push_triangle

This commit is contained in:
Hanno Braun 2024-10-31 21:24:40 +01:00
parent e1f79bd171
commit 924e9a03d4
2 changed files with 5 additions and 1 deletions

View File

@ -8,4 +8,8 @@ impl Mesh {
pub fn push_vertex(&mut self, vertex: [f32; 3]) {
self.vertices.push(vertex);
}
pub fn push_triangle(&mut self, triangle: [u32; 3]) {
self.triangles.push(triangle);
}
}

View File

@ -29,7 +29,7 @@ pub fn model() -> anyhow::Result<Mesh> {
[4, 5, 7], // top
[4, 7, 6],
]
.map(|triangle| mesh.triangles.push(triangle));
.map(|triangle| mesh.push_triangle(triangle));
Ok(mesh)
}