aboutsummaryrefslogtreecommitdiff
path: root/color.go
diff options
context:
space:
mode:
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)
}