Screen capture example is working again
@@ -40,13 +40,30 @@ fn main() {
// Camera
let mut camera = camera::PerspectiveCamera::new(vec3(5.0, 5.0, 5.0), vec3(0.0, 0.0, 0.0), vec3(0.0, 1.0, 0.0),
- screen.aspect(), 0.25 * ::std::f32::consts::PI, 0.1, 1000.0);
-
- let mut mesh = crate::mesh_generator::create_sphere(1).unwrap().to_dynamic();
- mesh.update_vertex_normals();
- let shaded_mesh = objects::ShadedMesh::create(&gl, &mesh.to_static()).unwrap();
-
- let plane = crate::objects::ShadedMesh::create(&gl, &mesh_generator::create_plane().unwrap()).unwrap();
+ degrees(45.0), screen.aspect(), 0.1, 1000.0);
+
+ let (meshes, _materials) = tobj::load_obj(&std::path::PathBuf::from("../Dust/examples/assets/models/suzanne.obj")).unwrap();
+ let mesh = meshes.first().unwrap();
+ let mut shaded_mesh = objects::ShadedMesh::create(&gl, &mesh.mesh.indices, &att!["position" => (mesh.mesh.positions.clone(), 3),
+ "normal" => (mesh.mesh.normals.clone(), 3)]).unwrap();
+
+ let plane_positions: Vec<f32> = vec![
+ -1.0, 0.0, -1.0,
+ 1.0, 0.0, -1.0,
+ 1.0, 0.0, 1.0,
+ -1.0, 0.0, 1.0
+ ];
+ let plane_normals: Vec<f32> = vec![
+ 0.0, 1.0, 0.0,
+ 0.0, 1.0, 0.0,
+ 0.0, 1.0, 0.0,
+ 0.0, 1.0, 0.0
+ ];
+ let plane_indices: Vec<u32> = vec![
+ 0, 2, 1,
+ 0, 3, 2,
+ ];
+ let plane = crate::objects::ShadedMesh::create(&gl, &plane_indices, &att!["position" => (plane_positions, 3), "normal" => (plane_normals, 3)]).unwrap();
let mut ambient_light = crate::light::AmbientLight::new();
ambient_light.base.intensity = 0.2;
@@ -93,7 +110,7 @@ fn main() {
// Geometry pass
renderer.geometry_pass_begin().unwrap();
render_scene(&camera);
- plane.render(&(Mat4::new_translation(&vec3(0.0, -1.0, 0.0)) * Mat4::new_scaling(10.0)), &camera);
+ plane.render(&(Mat4::from_translation(vec3(0.0, -1.0, 0.0)) * Mat4::from_scale(10.0)), &camera);
// Light pass
renderer.light_pass_begin(&camera).unwrap();
