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,30 +1,35 @@
use crate::mesh::Mesh;
pub fn model() -> anyhow::Result<Mesh> {
Ok(Mesh {
vertices: vec![
[-0.5, -0.5, -0.5], // 0
[0.5, -0.5, -0.5], // 1
[-0.5, 0.5, -0.5], // 2
[0.5, 0.5, -0.5], // 3
[-0.5, -0.5, 0.5], // 4
[0.5, -0.5, 0.5], // 5
[-0.5, 0.5, 0.5], // 6
[0.5, 0.5, 0.5], // 7
],
triangles: vec![
[0, 4, 6], // left
[0, 6, 2],
[1, 3, 7], // right
[1, 7, 5],
[0, 1, 5], // front
[0, 5, 4],
[2, 7, 3], // back
[2, 6, 7],
[0, 2, 1], // bottom
[1, 2, 3],
[4, 5, 7], // top
[4, 7, 6],
],
})
let mut mesh = Mesh::default();
[
[-0.5, -0.5, -0.5], // 0
[0.5, -0.5, -0.5], // 1
[-0.5, 0.5, -0.5], // 2
[0.5, 0.5, -0.5], // 3
[-0.5, -0.5, 0.5], // 4
[0.5, -0.5, 0.5], // 5
[-0.5, 0.5, 0.5], // 6
[0.5, 0.5, 0.5], // 7
]
.map(|vertex| mesh.vertices.push(vertex));
[
[0, 4, 6], // left
[0, 6, 2],
[1, 3, 7], // right
[1, 7, 5],
[0, 1, 5], // front
[0, 5, 4],
[2, 7, 3], // back
[2, 6, 7],
[0, 2, 1], // bottom
[1, 2, 3],
[4, 5, 7], // top
[4, 7, 6],
]
.map(|triangle| mesh.triangles.push(triangle));
Ok(mesh)
}