Prepare for follow-on change

This commit is contained in:
Hanno Braun 2024-10-31 21:21:29 +01:00
parent 3931991aaf
commit 48c7a842a0

View File

@ -1,8 +1,9 @@
use crate::mesh::Mesh; use crate::mesh::Mesh;
pub fn model() -> anyhow::Result<Mesh> { pub fn model() -> anyhow::Result<Mesh> {
Ok(Mesh { let mut mesh = Mesh::default();
vertices: vec![
[
[-0.5, -0.5, -0.5], // 0 [-0.5, -0.5, -0.5], // 0
[0.5, -0.5, -0.5], // 1 [0.5, -0.5, -0.5], // 1
[-0.5, 0.5, -0.5], // 2 [-0.5, 0.5, -0.5], // 2
@ -11,8 +12,10 @@ pub fn model() -> anyhow::Result<Mesh> {
[0.5, -0.5, 0.5], // 5 [0.5, -0.5, 0.5], // 5
[-0.5, 0.5, 0.5], // 6 [-0.5, 0.5, 0.5], // 6
[0.5, 0.5, 0.5], // 7 [0.5, 0.5, 0.5], // 7
], ]
triangles: vec![ .map(|vertex| mesh.vertices.push(vertex));
[
[0, 4, 6], // left [0, 4, 6], // left
[0, 6, 2], [0, 6, 2],
[1, 3, 7], // right [1, 3, 7], // right
@ -25,6 +28,8 @@ pub fn model() -> anyhow::Result<Mesh> {
[1, 2, 3], [1, 2, 3],
[4, 5, 7], // top [4, 5, 7], // top
[4, 7, 6], [4, 7, 6],
], ]
}) .map(|triangle| mesh.triangles.push(triangle));
Ok(mesh)
} }