diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/main.rs b/src/main.rs index 221752b..9cd2fc2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use rendering::camera::{Camera, Film, CameraSettings}; -use rendering::world::{Scene, Object, shapes::Sphere, Instancable}; +use rendering::world::{Scene, Object, shapes::{Rect, Plane, Sphere}, Instancable}; use rendering::trace::DefaultTracer; use rendering::core::{Vector2i, Vector3f, Spectrum}; use rendering::render::{RenderContext, RenderCoord}; @@ -15,33 +15,34 @@ fn main() { target: Vector3f::new_xyz(0.0, 0.0, -1.0), origin: Vector3f::new_xyz(0.0, 0.0, 1.0), up: Vector3f::new_xyz(0.0, 1.0, 0.0), - fov: 45.0, + fov: 50.0, filmsize: res, focus: None, - aperture: Some(10.0), - //aperture: None, + aperture: None, }); let brown = Arc::new(Lambertian::new(Spectrum::new_rgb(0.5, 0.3, 0.0))); let blue = Arc::new(Lambertian::new(Spectrum::new_rgb(0.0, 0.3, 0.7))); let green = Arc::new(Lambertian::new(Spectrum::new_rgb(0.0, 0.7, 0.3))); let metal = Arc::new(Reflectant::new(Spectrum::new_rgb(0.8, 0.8, 0.9), Some(1.0))); + let mirror = Arc::new(Reflectant::new(Spectrum::new_rgb(1.0, 1.0, 1.0), None)); let glass = Arc::new(Dielectric::new(1.5)); - let sun = Arc::new(DiffuseLight::new_white(50.0)); + let sun = Arc::new(DiffuseLight::new_white(14.0)); let mut scn = Scene::new(); scn.add_objects(vec![ Object::new(glass, Sphere::new(0.2).translate(0.0, 0.0, -1.0)), Object::new(blue, Sphere::new(0.5).translate(1.0, 0.0, -1.5)), - Object::new(green, Sphere::new(0.3).translate(0.5, 0.0, -2.5)), + Object::new(mirror, Rect::new(0.4, 0.7, Plane::XY).translate(0.5, 0.0, -2.5)), + Object::new(brown.clone(), Rect::new(10.0, 2.0, Plane::XY).translate(0.5, 0.0, -2.6)), Object::new(brown, Sphere::new(100.0).translate(0.0, -100.5, -1.0)), - Object::new(metal, Sphere::new(0.2).translate(-0.5, 0.0, -1.0)), - Object::new(sun, Sphere::new(0.4).translate(-1.0, 3.0, 0.0)), + Object::new(green, Sphere::new(0.4).translate(-0.5, 0.0, -2.0)), + //Object::new(sun, Sphere::new(0.4).translate(-1.0, 6.0, 0.0)), ]); - let tracer = DefaultTracer::new(&scn, Some(50), - //Some(Box::new(SkyLight::new())) - None + let tracer = DefaultTracer::new(&scn, Some(10), + Some(Box::new(SkyLight::new())) + //None ); let mut sampler = UniformSampler::new(); @@ -50,7 +51,7 @@ fn main() { let mut film = Film::new(res); { - let coord = RenderCoord::new(&mut film, Vector2i::new_xy(50, 50), 50); + let coord = RenderCoord::new(&mut film, Vector2i::new_xy(50, 50), 200); coord.run_threaded(&ctx, &mut sampler, 8); } |