aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-08-04 17:21:03 +0200
committerJulian T <julian@jtle.dk>2021-08-04 17:21:03 +0200
commit02fedfc9653cb37219849de7dae14ae13d2f6c36 (patch)
treed76c804f6fcd1d8c9aa036251843198bf78eadd2 /src/main.rs
parent351d9132c0b2c54dfa9f50bfe328d25ccf059cea (diff)
Add translation and move center position from sphere
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index f98a806..221752b 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};
+use rendering::world::{Scene, Object, shapes::Sphere, Instancable};
use rendering::trace::DefaultTracer;
use rendering::core::{Vector2i, Vector3f, Spectrum};
use rendering::render::{RenderContext, RenderCoord};
@@ -31,12 +31,12 @@ fn main() {
let mut scn = Scene::new();
scn.add_objects(vec![
- Object::new(glass, Sphere::new(0.2, Vector3f::new_xyz(0.0, 0.0, -1.0))),
- Object::new(blue, Sphere::new(0.5, Vector3f::new_xyz(1.0, 0.0, -1.5))),
- Object::new(green, Sphere::new(0.3, Vector3f::new_xyz(0.5, 0.0, -2.5))),
- Object::new(brown, Sphere::new(100.0, Vector3f::new_xyz(0.0, -100.5, -1.0))),
- Object::new(metal, Sphere::new(0.2, Vector3f::new_xyz(-0.5, 0.0, -1.0))),
- Object::new(sun, Sphere::new(0.4, Vector3f::new_xyz(-1.0, 3.0, 0.0))),
+ 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(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)),
]);
let tracer = DefaultTracer::new(&scn, Some(50),