This commit is contained in:
Hanno Braun 2024-10-30 01:27:49 +01:00
parent 02348ebe9e
commit b610abeffc
3 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,4 @@
mod mesh;
mod model;
mod export;

View File

@ -0,0 +1,4 @@
pub struct Mesh {
pub vertices: Vec<[f64; 3]>,
pub triangles: Vec<[usize; 3]>,
}

View File

@ -1,4 +1,4 @@
use crate::export::export;
use crate::{export::export, mesh::Mesh};
pub fn model() -> anyhow::Result<()> {
let vertices = [
@ -27,7 +27,12 @@ pub fn model() -> anyhow::Result<()> {
[4, 7, 6],
];
export(vertices, triangles)?;
let mesh = Mesh {
vertices: vertices.into_iter().collect(),
triangles: triangles.into_iter().collect(),
};
export(mesh.vertices, mesh.triangles)?;
Ok(())
}