summaryrefslogtreecommitdiff
path: root/src/cube.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cube.rs')
-rw-r--r--src/cube.rs19
1 files changed, 13 insertions, 6 deletions
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<Vertex>; 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 {