aboutsummaryrefslogtreecommitdiff
path: root/lib/hittable.rb
diff options
context:
space:
mode:
authorNat Lasseter <user@4574.co.uk>2024-06-13 14:38:50 +0100
committerNat Lasseter <user@4574.co.uk>2024-06-13 14:38:50 +0100
commit69e0357135a49157ed7a8c2e57c331e960422e15 (patch)
tree2402ef255cf24afff14ac653826386e615faee8b /lib/hittable.rb
parentb976ce98be7275bf92e01f6c86bf2b694530481e (diff)
Chapter 11
Diffstat (limited to 'lib/hittable.rb')
-rw-r--r--lib/hittable.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/hittable.rb b/lib/hittable.rb
index facdd14..2a433d8 100644
--- a/lib/hittable.rb
+++ b/lib/hittable.rb
@@ -2,12 +2,12 @@ class HitRecord
def initialize(point, t, ray, out_normal, material)
@point = point
@t = t
- front_face = ray.direction.dot(out_normal) < 0
- @normal = front_face ? out_normal : -out_normal
+ @front_face = ray.direction.dot(out_normal) < 0
+ @normal = @front_face ? out_normal : -out_normal
@material = material
end
- attr_accessor :point, :normal, :t, :material
+ attr_reader :point, :normal, :t, :front_face, :material
end
class Hittable