Toy with different teapot scenes
This commit is contained in:
parent
ab349b1d7e
commit
dc19f09da9
23
src/main.rs
23
src/main.rs
@ -61,7 +61,7 @@ fn obj(path: &str) -> Scene {
|
|||||||
let object = obj_to_hitable(&std::path::Path::new(path));
|
let object = obj_to_hitable(&std::path::Path::new(path));
|
||||||
print!("Object hitbox: {:#?}", object.bounding_box(0.0, 1.0));
|
print!("Object hitbox: {:#?}", object.bounding_box(0.0, 1.0));
|
||||||
|
|
||||||
let difflight = Arc::new(Material::white_light(2.0));
|
let difflight = Arc::new(Material::white_light(4.0));
|
||||||
|
|
||||||
let world: HittableList = vec![
|
let world: HittableList = vec![
|
||||||
object,
|
object,
|
||||||
@ -71,26 +71,31 @@ fn obj(path: &str) -> Scene {
|
|||||||
2.0,
|
2.0,
|
||||||
-2.0,
|
-2.0,
|
||||||
2.0,
|
2.0,
|
||||||
5.0,
|
10.0,
|
||||||
difflight.clone()
|
difflight.clone()
|
||||||
)),
|
)),
|
||||||
Arc::new(Sphere::new(
|
Arc::new(Sphere::new(
|
||||||
Point3::new(-5.0, 5.0, 0.0),
|
Point3::new(-5.0, 5.0, 0.0),
|
||||||
1.0,
|
1.0,
|
||||||
Arc::new(Material::white_light(4.0))
|
difflight.clone()
|
||||||
)),
|
)),
|
||||||
Arc::new(Sphere::new(
|
Arc::new(Sphere::new(
|
||||||
Point3::new(4.0, 3.5, 1.0),
|
Point3::new(0.6, 3.5, -0.6),
|
||||||
1.0,
|
0.4,
|
||||||
Arc::new(Material::Metal(Metal::new(Color::new(1.0, 0.0, 0.0), 0.2)))
|
Arc::new(Material::Metal(Metal::new(Color::new(1.0, 0.0, 0.0), 0.2)))
|
||||||
|
)),
|
||||||
|
Arc::new(Sphere::new(
|
||||||
|
Point3::new(1.7, 0.4, 1.7),
|
||||||
|
0.4,
|
||||||
|
Arc::new(Material::solid(0.2, 0.2, 0.8))
|
||||||
)),
|
)),
|
||||||
Arc::new(Sphere::new(
|
Arc::new(Sphere::new(
|
||||||
Point3::new(0.0, 300.0, 0.0),
|
Point3::new(0.0, 300.0, 0.0),
|
||||||
300.0,
|
300.0,
|
||||||
Arc::new(Material::Lambertian(Lambertian::textured(Arc::new(NoiseTexture { noise: Perlin::new(), scale: 20.0 }))))
|
Arc::new(Material::Lambertian(Lambertian::textured(Arc::new(NoiseTexture { noise: Perlin::new(), scale: 0.1 }))))
|
||||||
))];
|
))];
|
||||||
|
|
||||||
let look_from = Point3::new(10.0, 6.0, 10.0);
|
let look_from = Point3::new(8.0, 10.0, 8.0);
|
||||||
let look_at = Point3::new(0.0, 1.0, 0.0);
|
let look_at = Point3::new(0.0, 1.0, 0.0);
|
||||||
let focus_dist = 2.0;
|
let focus_dist = 2.0;
|
||||||
|
|
||||||
@ -99,7 +104,7 @@ fn obj(path: &str) -> Scene {
|
|||||||
look_at,
|
look_at,
|
||||||
Vec3::new(0.0, 1.0, 0.0),
|
Vec3::new(0.0, 1.0, 0.0),
|
||||||
1.0,
|
1.0,
|
||||||
40.0,
|
30.0,
|
||||||
0.0,
|
0.0,
|
||||||
focus_dist,
|
focus_dist,
|
||||||
0.0,
|
0.0,
|
||||||
@ -830,7 +835,7 @@ fn next_week_final() -> Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
//rayon::ThreadPoolBuilder::new().num_threads(1).build_global().unwrap(); // Enable, to reduce load
|
rayon::ThreadPoolBuilder::new().num_threads(1).build_global().unwrap(); // Enable, to reduce load
|
||||||
// World
|
// World
|
||||||
let scene: u8 = 8;
|
let scene: u8 = 8;
|
||||||
let scene_setup = match scene {
|
let scene_setup = match scene {
|
||||||
|
Loading…
Reference in New Issue
Block a user