diff --git a/geometry/mesh.rs b/geometry/mesh.rs index d54e77d..2807d0b 100644 --- a/geometry/mesh.rs +++ b/geometry/mesh.rs @@ -6,5 +6,5 @@ pub struct Mesh { pub position: Vec3, // Unimplemented // rotation: Quaternion, pub scale: f64, // Unimplemented - pub triangles: Vec> + pub triangles: Vec> } diff --git a/geometry/prims/plane.rs b/geometry/prims/plane.rs index e39e2c3..b06e6d8 100644 --- a/geometry/prims/plane.rs +++ b/geometry/prims/plane.rs @@ -9,7 +9,7 @@ pub struct Plane { pub b: f64, pub c: f64, pub d: f64, - pub material: Box + pub material: Box } impl Prim for Plane { diff --git a/geometry/prims/sphere.rs b/geometry/prims/sphere.rs index 33fa40c..bab2b6e 100644 --- a/geometry/prims/sphere.rs +++ b/geometry/prims/sphere.rs @@ -7,7 +7,7 @@ use vec3::Vec3; pub struct Sphere { pub center: Vec3, pub radius: f64, - pub material: Box + pub material: Box } impl Prim for Sphere { diff --git a/geometry/prims/triangle.rs b/geometry/prims/triangle.rs index f602edd..8e7c81a 100644 --- a/geometry/prims/triangle.rs +++ b/geometry/prims/triangle.rs @@ -11,13 +11,13 @@ pub struct Triangle { pub n0: Vec3, pub n1: Vec3, pub n2: Vec3, - pub material: Box + pub material: Box } impl Triangle { /// All three normals at vertices are perpendicular to the triangle plane #[allow(dead_code)] - pub fn auto_normal(v0: Vec3, v1: Vec3, v2: Vec3, material: Box) -> Triangle { + pub fn auto_normal(v0: Vec3, v1: Vec3, v2: Vec3, material: Box) -> Triangle { // let n = (v1 - v0).cross(&(v2 - v0)); let n = (v1 - v0).cross(&(v2 - v0)); Triangle { diff --git a/my_scene.rs b/my_scene.rs index c0ddc69..2508762 100644 --- a/my_scene.rs +++ b/my_scene.rs @@ -22,7 +22,7 @@ pub fn get_camera(image_width: int, image_height: int) -> Camera { #[allow(dead_code)] pub fn get_scene() -> Scene { - let mut lights: Vec> = Vec::new(); + let mut lights: Vec> = Vec::new(); // lights.push(box PointLight {position: Vec3 {x: 50.0, y: 20.0, z: 50.0}, color: Vec3::one()}); lights.push(box SphereLight {position: Vec3 {x: 50.0, y: 80.0, z: 50.0}, color: Vec3::one(), radius: 10.0}); @@ -33,7 +33,7 @@ pub fn get_scene() -> Scene { let shiny = PhongMaterial {k_a: 0.0, k_d: 0.5, k_s: 1.0, k_sg: 1.0, k_tg: 0.0, shininess: 50.0, ior: 1.0, ambient: Vec3::one(), diffuse: Vec3 {x: 1.0, y: 1.0, z: 1.0}, specular: Vec3::one(), transmission: Vec3::zero()}; let refract = PhongMaterial {k_a: 0.0, k_d: 0.0, k_s: 1.0, k_sg: 0.0, k_tg: 1.0, shininess: 40.0, ior: 3.0, ambient: Vec3::one(), diffuse: Vec3 {x: 1.0, y: 1.0, z: 1.0}, specular: Vec3::one(), transmission: Vec3 {x: 0.8, y: 0.8, z: 0.8}}; - let mut prims: Vec> = Vec::new(); + let mut prims: Vec> = Vec::new(); prims.push(box Plane {a: 0.0, b: 0.0, c: 1.0, d: 0.0, material: box grey }); // Ahead prims.push(box Plane {a: 0.0, b: -1.0, c: 0.0, d: 100.0, material: box grey }); // Bottom prims.push(box Plane {a: 0.0, b: 1.0, c: 0.0, d: 0.0, material: box grey }); // Top @@ -66,7 +66,7 @@ pub fn get_bunny_camera(image_width: int, image_height: int) -> Camera { #[allow(dead_code)] pub fn get_bunny_scene() -> Scene { - let mut lights: Vec> = Vec::new(); + let mut lights: Vec> = Vec::new(); lights.push(box SphereLight {position: Vec3 {x: 200.0, y: -200.0, z: 100.0}, color: Vec3::one(), radius: 40.0}); lights.push(box SphereLight {position: Vec3 {x: -95.0, y: 20.0, z: 170.0}, color: Vec3{x: 0.5, y: 0.5, z: 0.3}, radius: 15.0}); @@ -74,7 +74,7 @@ pub fn get_bunny_scene() -> Scene { let green = CookTorranceMaterial {k_a: 0.0, k_d: 0.5, k_s: 0.5, k_sg: 0.2, k_tg: 0.0, gauss_constant: 50.0, roughness: 0.3, ior: 1.5, ambient: Vec3::one(), diffuse: Vec3 {x: 0.2, y: 0.7, z: 0.2}, specular: Vec3::one(), transmission: Vec3::zero()}; let shiny = CookTorranceMaterial {k_a: 0.0, k_d: 0.2, k_s: 0.5, k_sg: 0.8, k_tg: 0.0, gauss_constant: 50.0, roughness: 0.1, ior: 1.5, ambient: Vec3::one(), diffuse: Vec3 {x: 0.9, y: 0.9, z: 0.1}, specular: Vec3 {x: 0.9, y: 0.9, z: 0.1}, transmission: Vec3::zero()}; - let mut prims: Vec> = Vec::new(); + let mut prims: Vec> = Vec::new(); prims.push(box Plane {a: 0.0, b: 0.0, c: 1.0, d: -10.0, material: box green}); prims.push(box Sphere {center: Vec3 {x: -75.0, y: 60.0, z: 50.0}, radius: 40.0, material: box shiny}); prims.push(box Sphere {center: Vec3 {x: -75.0, y: 60.0, z: 140.0}, radius: 40.0, material: box shiny}); diff --git a/scene/scene.rs b/scene/scene.rs index 75b931e..d668d32 100644 --- a/scene/scene.rs +++ b/scene/scene.rs @@ -3,7 +3,7 @@ use light::Light; use vec3::Vec3; pub struct Scene { - pub lights: Vec>, - pub prims: Vec>, + pub lights: Vec>, + pub prims: Vec>, pub background: Vec3 } diff --git a/util/import.rs b/util/import.rs index 0aebc90..26a2048 100644 --- a/util/import.rs +++ b/util/import.rs @@ -13,7 +13,7 @@ pub fn from_obj(position: Vec3, scale: f64, material: CookTorranceMaterial /*Box let mut vertices: Vec = Vec::new(); let mut normals: Vec = Vec::new(); - let mut triangles: Vec> = Vec::new(); + let mut triangles: Vec> = Vec::new(); for line_iter in file.lines() { let line: String = match line_iter {