summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-01-17 19:20:22 +0100
committerHampusM <hampus@hampusmat.com>2025-01-17 19:20:22 +0100
commite69f05739e56d62361e5bb0dcc4db17289b0c2df (patch)
tree29c5b8a1beaebd79440e678268937fb40c7b7584 /src/main.rs
parent6fc7c0b2bf5547159b1d45c2ef9016df1f565dd8 (diff)
chore: replace cube obj with generated cube mesh
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index a982dbb..3055e28 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -17,6 +17,10 @@ use engine::file_format::wavefront::obj::parse as parse_obj;
use engine::input::Extension as InputExtension;
use engine::lighting::{AttenuationParams, GlobalLight, PointLight};
use engine::material::{Builder as MaterialBuilder, Flags as MaterialFlags};
+use engine::mesh::cube::{
+ create as cube_mesh_create,
+ CreationSpec as CubeMeshCreationSpec,
+};
use engine::renderer::opengl::Extension as OpenglRendererExtension;
use engine::transform::Position;
use engine::vector::Vec3;
@@ -82,8 +86,14 @@ fn main() -> Result<(), Box<dyn Error>>
})
.build(),
Position::from(Vec3 { x: -6.0, y: 3.0, z: 3.0 }),
- parse_obj(&read_to_string(Path::new(RESOURCE_DIR).join("cube.obj"))?)?
- .to_mesh()?,
+ cube_mesh_create(
+ CubeMeshCreationSpec::builder()
+ .width(2.0)
+ .height(2.0)
+ .depth(2.0)
+ .build(),
+ |face_verts, _, _| face_verts,
+ ),
MaterialBuilder::new().ambient(YELLOW * 5.0).build(),
MaterialFlags::builder().use_ambient_color(true).build(),
));