aboutsummaryrefslogtreecommitdiff
path: root/main.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 /main.go
parent4fbf7c999dd9aabd19a8b66d32461ad4c2722dc3 (diff)
feat - Display sphere
Diffstat (limited to 'main.go')
-rw-r--r--main.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/main.go b/main.go
index 981a324..a1cb2c9 100644
--- a/main.go
+++ b/main.go
@@ -8,12 +8,13 @@ func main() {
ORIGIN := Vec3D{0.0, 0.0, 0.0}
HORIZONTAL := Vec3D{4.0, 0.0, 0.0}
VERTICAL := Vec3D{0.0, 2.0, 0.0}
+ SPHERE := Sphere{Vec3D{0.0, 0.0, -1.0}, .5}
frame := Frame{}
for x := 0; x < HEIGHT; x++ {
for y := 0; y < WIDTH; y++ {
u, v := float64(y)/float64(WIDTH), float64(x)/float64(HEIGHT)
ray := Ray{ORIGIN, AddVec3D(AddVec3D(LOWER_LEFT_CORNER, ScalarProduct(u, HORIZONTAL)), ScalarProduct(v, VERTICAL))}
- color := RayColor(ray)
+ color := RayColor(ray, SPHERE)
frame[HEIGHT-1-x][y] = color.ToPixel()
}
}