diff options
Diffstat (limited to 'lib/ray.rb')
-rw-r--r-- | lib/ray.rb | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -14,8 +14,11 @@ class Ray return Colour.new if depth <= 0 if rec = world.hit(self, Interval.new(0.0001, Float::INFINITY)) - dir = rec.normal + Vec3.random_unit - return Ray.new(rec.point, dir).colour(world, depth - 1) * 0.5 + if scat = rec.material.scatter(self, rec) + return scat.colour(world, depth - 1) * rec.material.attenuation + else + return Colour.new(0,0,0) + end end unit_dir = direction.unit |