diff options
Diffstat (limited to 'hittable.go')
-rw-r--r-- | hittable.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hittable.go b/hittable.go index 42599ab..ac5e996 100644 --- a/hittable.go +++ b/hittable.go @@ -11,12 +11,14 @@ type HitRecord struct { P Vec3 N Vec3 T float64 + F bool Mat Material } func (rec *HitRecord) SetFaceNormal(r Ray, out_n Vec3) { - if r.Direction.Dot(out_n) < 0 { - rec.N = out_n + rec.F = r.Direction.Dot(out_n) < 0; + if rec.F { + rec.N = out_n; } else { rec.N = out_n.Neg(); } |