From 1bc4829392b3c91737fbe4ddccd81098ac9d8a12 Mon Sep 17 00:00:00 2001 From: Nat Lasseter Date: Wed, 12 Jun 2024 22:51:25 +0100 Subject: chap 9.3 --- lib/camera.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/camera.rb') 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 -- cgit v1.2.1