Skip to content

Commit

Permalink
Update obsolete syntax for trait bounds.
Browse files Browse the repository at this point in the history
Trait:Send+Share → Trait+Send+Share
rust-lang/rust#27
  • Loading branch information
gyng committed Jun 17, 2014
1 parent 1a68470 commit 62e03ce
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion geometry/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ pub struct Mesh {
pub position: Vec3, // Unimplemented
// rotation: Quaternion,
pub scale: f64, // Unimplemented
pub triangles: Vec<Box<Prim:Send+Share>>
pub triangles: Vec<Box<Prim+Send+Share>>
}
2 changes: 1 addition & 1 deletion geometry/prims/plane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct Plane {
pub b: f64,
pub c: f64,
pub d: f64,
pub material: Box<Material:Send+Share>
pub material: Box<Material+Send+Share>
}

impl Prim for Plane {
Expand Down
2 changes: 1 addition & 1 deletion geometry/prims/sphere.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use vec3::Vec3;
pub struct Sphere {
pub center: Vec3,
pub radius: f64,
pub material: Box<Material:Send+Share>
pub material: Box<Material+Send+Share>
}

impl Prim for Sphere {
Expand Down
4 changes: 2 additions & 2 deletions geometry/prims/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ pub struct Triangle {
pub n0: Vec3,
pub n1: Vec3,
pub n2: Vec3,
pub material: Box<Material:Send+Share>
pub material: Box<Material+Send+Share>
}

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<Material:Send+Share>) -> Triangle {
pub fn auto_normal(v0: Vec3, v1: Vec3, v2: Vec3, material: Box<Material+Send+Share>) -> Triangle {
// let n = (v1 - v0).cross(&(v2 - v0));
let n = (v1 - v0).cross(&(v2 - v0));
Triangle {
Expand Down
8 changes: 4 additions & 4 deletions my_scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Box<Light:Send+Share>> = Vec::new();
let mut lights: Vec<Box<Light+Send+Share>> = 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});

Expand All @@ -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<Box<Prim:Send+Share>> = Vec::new();
let mut prims: Vec<Box<Prim+Send+Share>> = 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
Expand Down Expand Up @@ -66,15 +66,15 @@ 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<Box<Light:Send+Share>> = Vec::new();
let mut lights: Vec<Box<Light+Send+Share>> = 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});

let red = CookTorranceMaterial {k_a: 0.0, k_d: 0.4, k_s: 0.5, k_sg: 0.6, k_tg: 0.0, gauss_constant: 50.0, roughness: 0.1, ior: 1.3, ambient: Vec3::one(), diffuse: Vec3 {x: 1.0, y: 0.25, z: 0.1}, specular: Vec3::one(), transmission: Vec3::zero()};
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<Box<Prim:Send+Share>> = Vec::new();
let mut prims: Vec<Box<Prim+Send+Share>> = 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});
Expand Down
4 changes: 2 additions & 2 deletions scene/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use light::Light;
use vec3::Vec3;

pub struct Scene {
pub lights: Vec<Box<Light:Send+Share>>,
pub prims: Vec<Box<Prim:Send+Share>>,
pub lights: Vec<Box<Light+Send+Share>>,
pub prims: Vec<Box<Prim+Send+Share>>,
pub background: Vec3
}
2 changes: 1 addition & 1 deletion util/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn from_obj(position: Vec3, scale: f64, material: CookTorranceMaterial /*Box

let mut vertices: Vec<Vec3> = Vec::new();
let mut normals: Vec<Vec3> = Vec::new();
let mut triangles: Vec<Box<Prim:Send+Share>> = Vec::new();
let mut triangles: Vec<Box<Prim+Send+Share>> = Vec::new();

for line_iter in file.lines() {
let line: String = match line_iter {
Expand Down

0 comments on commit 62e03ce

Please sign in to comment.