Skip to content

Commit

Permalink
motion blur
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherBiscardi committed Aug 31, 2023
1 parent 81e1850 commit 4b52f30
Show file tree
Hide file tree
Showing 12 changed files with 293 additions and 106 deletions.
50 changes: 25 additions & 25 deletions examples/all-materials-spheres.rs
Expand Up @@ -22,31 +22,31 @@ fn main() -> io::Result<()> {
fuzz: 0.0,
};

world.push(Sphere {
center: DVec3::new(0.0, -100.5, -1.0),
radius: 100.0,
material: material_ground,
});
world.push(Sphere {
center: DVec3::new(0.0, 0.0, -1.0),
radius: 0.5,
material: material_center,
});
world.push(Sphere {
center: DVec3::new(-1.0, 0.0, -1.0),
radius: 0.5,
material: material_left.clone(),
});
world.push(Sphere {
center: DVec3::new(-1.0, 0.0, -1.0),
radius: -0.4,
material: material_left,
});
world.push(Sphere {
center: DVec3::new(1.0, 0.0, -1.0),
radius: 0.5,
material: material_right,
});
world.push(Sphere::new(
DVec3::new(0.0, -100.5, -1.0),
100.0,
material_ground,
));
world.push(Sphere::new(
DVec3::new(0.0, 0.0, -1.0),
0.5,
material_center,
));
world.push(Sphere::new(
DVec3::new(-1.0, 0.0, -1.0),
0.5,
material_left.clone(),
));
world.push(Sphere::new(
DVec3::new(-1.0, 0.0, -1.0),
-0.4,
material_left,
));
world.push(Sphere::new(
DVec3::new(1.0, 0.0, -1.0),
0.5,
material_right,
));

let camera = Camera::init()
.image_width(800)
Expand Down
30 changes: 15 additions & 15 deletions examples/all-shapes.rs
Expand Up @@ -25,26 +25,26 @@ fn main() -> io::Result<()> {
fuzz: 0.0,
};

world.push(Shapes::Sphere(Sphere {
center: DVec3::new(0.0, -100.5, -1.0),
radius: 100.0,
material: material_ground,
}));
world.push(Shapes::Sphere(Sphere::new(
DVec3::new(0.0, -100.5, -1.0),
100.0,
material_ground,
)));
world.push(Shapes::Box(a_box::Box {
center: DVec3::new(0.0, 0.0, -1.0),
size: DVec3::splat(0.2),
material: material_center,
}));
world.push(Shapes::Sphere(Sphere {
center: DVec3::new(-1.0, 0.0, -1.0),
radius: 0.5,
material: material_left.clone(),
}));
world.push(Shapes::Sphere(Sphere {
center: DVec3::new(-1.0, 0.0, -1.0),
radius: -0.4,
material: material_left,
}));
world.push(Shapes::Sphere(Sphere::new(
DVec3::new(-1.0, 0.0, -1.0),
0.5,
material_left.clone(),
)));
world.push(Shapes::Sphere(Sphere::new(
DVec3::new(-1.0, 0.0, -1.0),
-0.4,
material_left,
)));
world.push(Shapes::Cylinder(Cylinder {
start: DVec3::splat(-1.),
end: DVec3::splat(-2.),
Expand Down
10 changes: 5 additions & 5 deletions examples/box.rs
Expand Up @@ -19,11 +19,11 @@ fn main() -> io::Result<()> {
albedo: DVec3::new(0.1, 0.2, 0.5),
};

world.push(Shapes::Sphere(Sphere {
center: DVec3::new(0.0, -100.5, -1.0),
radius: 100.0,
material: material_ground,
}));
world.push(Shapes::Sphere(Sphere::new(
DVec3::new(0.0, -100.5, -1.0),
100.0,
material_ground,
)));
world.push(Shapes::Box(a_box::Box {
center: DVec3::new(3.0, 0.0, -1.0),
size: DVec3::ONE * 9.,
Expand Down
10 changes: 5 additions & 5 deletions examples/cylinder.rs
Expand Up @@ -19,11 +19,11 @@ fn main() -> io::Result<()> {
albedo: DVec3::new(0., 0., 1.),
};

world.push(Shapes::Sphere(Sphere {
center: DVec3::new(0.0, -100.5, -1.0),
radius: 100.0,
material: material_ground,
}));
world.push(Shapes::Sphere(Sphere::new(
DVec3::new(0.0, -100.5, -1.0),
100.0,
material_ground,
)));
world.push(Shapes::Cylinder(Cylinder {
start: DVec3::new(0.1, 0.1, -1.),
end: DVec3::new(0.1, -0.1, -1.),
Expand Down
40 changes: 20 additions & 20 deletions examples/raytracing-in-one-weekend-final-scene-more.rs
Expand Up @@ -13,13 +13,13 @@ fn main() -> io::Result<()> {

let mut world = vec![];

world.push(Shapes::Sphere(Sphere {
center: DVec3::new(0., -1000., 0.),
radius: 1000.,
material: Material::Lambertian {
world.push(Shapes::Sphere(Sphere::new(
DVec3::new(0., -1000., 0.),
1000.,
Material::Lambertian {
albedo: DVec3::new(0.5, 0.5, 0.5),
},
}));
)));

for (a, b) in
(-11..11).cartesian_product(-11..11).into_iter()
Expand Down Expand Up @@ -78,30 +78,30 @@ fn main() -> io::Result<()> {
}
}

world.push(Shapes::Sphere(Sphere {
center: DVec3::new(0., 1., 0.),
radius: 1.0,
material: Material::Dielectric {
world.push(Shapes::Sphere(Sphere::new(
DVec3::new(0., 1., 0.),
1.0,
Material::Dielectric {
index_of_refraction: 1.5,
},
}));
)));

world.push(Shapes::Sphere(Sphere {
center: DVec3::new(-4., 1., 0.),
radius: 1.0,
material: Material::Lambertian {
world.push(Shapes::Sphere(Sphere::new(
DVec3::new(-4., 1., 0.),
1.0,
Material::Lambertian {
albedo: DVec3::new(0.4, 0.2, 0.1),
},
}));
)));

world.push(Shapes::Sphere(Sphere {
center: DVec3::new(4., 1., 0.),
radius: 1.0,
material: Material::Metal {
world.push(Shapes::Sphere(Sphere::new(
DVec3::new(4., 1., 0.),
1.0,
Material::Metal {
albedo: DVec3::new(0.7, 0.6, 0.5),
fuzz: 0.0,
},
}));
)));

let camera = Camera::init()
.image_width(400)
Expand Down
46 changes: 21 additions & 25 deletions examples/raytracing-in-one-weekend-final-scene.rs
Expand Up @@ -12,13 +12,13 @@ fn main() -> io::Result<()> {

let mut world = vec![];

world.push(Sphere {
center: DVec3::new(0., -1000., 0.),
radius: 1000.,
material: Material::Lambertian {
world.push(Sphere::new(
DVec3::new(0., -1000., 0.),
1000.,
Material::Lambertian {
albedo: DVec3::new(0.5, 0.5, 0.5),
},
});
));

for (a, b) in
(-11..11).cartesian_product(-11..11).into_iter()
Expand Down Expand Up @@ -61,38 +61,34 @@ fn main() -> io::Result<()> {
}
};

world.push(Sphere {
center,
radius: 0.2,
material,
});
world.push(Sphere::new(center, 0.2, material));
}
}

world.push(Sphere {
center: DVec3::new(0., 1., 0.),
radius: 1.0,
material: Material::Dielectric {
world.push(Sphere::new(
DVec3::new(0., 1., 0.),
1.0,
Material::Dielectric {
index_of_refraction: 1.5,
},
});
));

world.push(Sphere {
center: DVec3::new(-4., 1., 0.),
radius: 1.0,
material: Material::Lambertian {
world.push(Sphere::new(
DVec3::new(-4., 1., 0.),
1.0,
Material::Lambertian {
albedo: DVec3::new(0.4, 0.2, 0.1),
},
});
));

world.push(Sphere {
center: DVec3::new(4., 1., 0.),
radius: 1.0,
material: Material::Metal {
world.push(Sphere::new(
DVec3::new(4., 1., 0.),
1.0,
Material::Metal {
albedo: DVec3::new(0.7, 0.6, 0.5),
fuzz: 0.0,
},
});
));

let camera = Camera::init()
.image_width(400)
Expand Down
10 changes: 5 additions & 5 deletions examples/rounded-box.rs
Expand Up @@ -18,11 +18,11 @@ fn main() -> io::Result<()> {
albedo: DVec3::new(0.1, 0.2, 0.5),
};

world.push(Shapes::Sphere(Sphere {
center: DVec3::new(0.0, -100.5, -1.0),
radius: 100.0,
material: material_ground,
}));
world.push(Shapes::Sphere(Sphere::new(
DVec3::new(0.0, -100.5, -1.0),
100.0,
material_ground,
)));
world.push(Shapes::RoundedBox(RoundedBox {
center: DVec3::new(0.0, 0.0, -1.0),
radius: 0.2,
Expand Down

0 comments on commit 4b52f30

Please sign in to comment.