diff options
-rw-r--r-- | res/cube.obj | 43 | ||||
-rw-r--r-- | src/main.rs | 14 |
2 files changed, 12 insertions, 45 deletions
diff --git a/res/cube.obj b/res/cube.obj deleted file mode 100644 index 59c3fd8..0000000 --- a/res/cube.obj +++ /dev/null @@ -1,43 +0,0 @@ -o Cube -v 1.000000 1.000000 -1.000000 -v 1.000000 -1.000000 -1.000000 -v 1.000000 1.000000 1.000000 -v 1.000000 -1.000000 1.000000 -v -1.000000 1.000000 -1.000000 -v -1.000000 -1.000000 -1.000000 -v -1.000000 1.000000 1.000000 -v -1.000000 -1.000000 1.000000 -vn -0.0000 1.0000 -0.0000 -vn -0.0000 -0.0000 1.0000 -vn -1.0000 -0.0000 -0.0000 -vn -0.0000 -1.0000 -0.0000 -vn 1.0000 -0.0000 -0.0000 -vn -0.0000 -0.0000 -1.0000 -vt 0.875000 0.500000 -vt 0.625000 0.750000 -vt 0.625000 0.500000 -vt 0.375000 1.000000 -vt 0.375000 0.750000 -vt 0.625000 0.000000 -vt 0.375000 0.250000 -vt 0.375000 0.000000 -vt 0.375000 0.500000 -vt 0.125000 0.750000 -vt 0.125000 0.500000 -vt 0.625000 0.250000 -vt 0.875000 0.750000 -vt 0.625000 1.000000 -s 0 -f 5//1 3//1 1//1 -f 5/1/1 3/2/1 1/3/1 -f 3/2/2 8/4/2 4/5/2 -f 7/6/3 6/7/3 8/8/3 -f 2/9/4 8/10/4 6/11/4 -f 1/3/5 4/5/5 2/9/5 -f 5/12/6 2/9/6 6/7/6 -f 5/1/1 7/13/1 3/2/1 -f 3/2/2 7/14/2 8/4/2 -f 7/6/3 5/12/3 6/7/3 -f 2/9/4 4/5/4 8/10/4 -f 1/3/5 3/2/5 4/5/5 -f 5/12/6 1/3/6 2/9/6 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(), )); |