aboutsummaryrefslogtreecommitdiff
path: root/lib/camera.rb
diff options
context:
space:
mode:
authorNat Lasseter <user@4574.co.uk>2024-06-12 22:51:25 +0100
committerNat Lasseter <user@4574.co.uk>2024-06-12 22:51:25 +0100
commit1bc4829392b3c91737fbe4ddccd81098ac9d8a12 (patch)
treec2339a79b1fdaf82955a5e38ed35a7f0a9481f21 /lib/camera.rb
parent51416f5dfac39b6ede8340b57b9bed4eb3edc646 (diff)
chap 9.3
Diffstat (limited to 'lib/camera.rb')
-rw-r--r--lib/camera.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/camera.rb b/lib/camera.rb
index f8721bb..6a3b190 100644
--- a/lib/camera.rb
+++ b/lib/camera.rb
@@ -1,8 +1,9 @@
class Camera
- def initialize(width = 100, aspect = 1.0, aliasing = 10)
+ def initialize(width = 100, aspect = 1.0, aliasing = 10, depth = 10)
@width = width
@aspect = aspect
@aliasing = aliasing
+ @depth = depth
# Height
@height = (@width / @aspect).to_i
@@ -40,7 +41,7 @@ class Camera
@width.times do |col|
p_colour = Colour.new
@aliasing.times do
- p_colour += get_ray(row, col).colour(world)
+ p_colour += get_ray(row, col).colour(world, @depth)
end
puts (p_colour / @aliasing).to_ppm
end