From c2419bfee851810a27672b40c77c829e4b4c2829 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 14 Apr 2024 12:36:31 +0200 Subject: chore: use new engine architecture --- src/cube.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/cube.rs') diff --git a/src/cube.rs b/src/cube.rs index d81eb76..9877b98 100644 --- a/src/cube.rs +++ b/src/cube.rs @@ -1,5 +1,5 @@ use engine::math::calc_triangle_surface_normal; -use engine::object::Builder as ObjectBuilder; +use engine::mesh::Mesh; use engine::vector::Vec3; use engine::vertex::{Builder as VertexBuilder, Vertex}; @@ -21,9 +21,9 @@ pub enum Corner BottomLeft, } -pub fn create_cube( +pub fn create_cube_mesh( vertex_builder_cb: impl Fn(VertexBuilder, Side, Corner) -> VertexBuilder, -) -> ObjectBuilder +) -> Mesh { let mut vertices: [Option; VertexIndex::VARIANT_CNT] = [(); VertexIndex::VARIANT_CNT].map(|()| None); @@ -456,9 +456,16 @@ pub fn create_cube( let indices = [front, back, right, left, top, bottom]; - ObjectBuilder::new() - .vertices(vertices.map(Option::unwrap)) - .indices(indices.into_iter().flatten().map(|index| index as u32)) + Mesh::new( + vertices.map(Option::unwrap).to_vec(), + Some( + indices + .into_iter() + .flatten() + .map(|index| index as u32) + .collect(), + ), + ) } macro_rules! one { -- cgit v1.2.3-18-g5258