aboutsummaryrefslogtreecommitdiff
path: root/color.go
diff options
context:
space:
mode:
authorMartin Lehoux <martin@lehoux.net>2020-04-04 15:30:25 -0700
committerMartin Lehoux <martin@lehoux.net>2020-04-04 15:30:25 -0700
commit19124e8c21b86dccb9e9d874c614aacb05c0fd4a (patch)
treedfa93ca17be594f1e12f375918c3a85203ffebab /color.go
parent4fbf7c999dd9aabd19a8b66d32461ad4c2722dc3 (diff)
feat - Display sphere
Diffstat (limited to 'color.go')
-rw-r--r--color.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/color.go b/color.go
index 2bee0af..3514be6 100644
--- a/color.go
+++ b/color.go
@@ -16,7 +16,10 @@ func LinearBlend(color1 Color, color2 Color, param float64) Color {
}
}
-func RayColor(ray Ray) Color {
+func RayColor(ray Ray, hitable Hitable) Color {
+ if hitable.Hit(ray) {
+ return Color{1.0, 0.0, 0.0}
+ }
param := 0.5 * (ray.direction.Unit().y + 1)
return LinearBlend(Color{0.5, 0.7, 1.0}, Color{1.0, 1.0, 1.0}, param)
}