From 35643fef39da5671d437dda2c7a9e5b5e799cab6 Mon Sep 17 00:00:00 2001 From: Max Nuding Date: Fri, 8 Jul 2022 16:57:50 +0200 Subject: [PATCH] Prettify earth setting --- src/main.rs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index b7a9e57..c75c992 100644 --- a/src/main.rs +++ b/src/main.rs @@ -257,12 +257,28 @@ fn earth() -> Scene { let earth_material = Arc::new( Material::Lambertian(Lambertian::textured(Arc::new(earth_texture)))); world.push(Arc::new(Sphere { - center: Point3::new(0.0, 0.0, 0.0), + center: Point3::new(0.0, 2.0, 1.0), radius: 2.0, material: earth_material })); - let look_from = Point3::new(13.0, 2.0, 3.0); + let glass = Arc::new( + Material::Dielectric(Dielectric::new(1.5))); + world.push(Arc::new(Sphere { + center: Point3::new(-0.5,1.0, -1.5), + radius: 1.0, + material: glass + })); + + let noise = NoiseTexture { noise: Perlin::new(), scale: 4.0 }; + let noise_material = Arc::new(Material::Lambertian(Lambertian::textured(Arc::new(noise)))); + world.push(Arc::new(Sphere { + center: Point3::new(0.0, -1000.0, 0.0), + radius: 1000.0, + material: noise_material + })); + + let look_from = Point3::new(10.0, 6.0, 3.0); let look_at = Point3::new(0.0, 0.0, 0.0); let focus_dist = 2.0; @@ -271,7 +287,7 @@ fn earth() -> Scene { look_at, Vec3::new(0.0, 1.0, 0.0), DEFAULT_ASPECT_RATIO, - 20.0, + 40.0, 0.0, focus_dist, 0.0,