summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2013-12-02 22:17:05 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2013-12-02 22:17:05 +0100
commit915cfd6620a607721d9e4477ae917dc8e8e32f2f (patch)
tree2da25fb492c8291a1655f38b2a670c98ca06feaa
parent62c4ec17175be8f21a98e95d5eada1aef6e5be10 (diff)
downloadhaskell-915cfd6620a607721d9e4477ae917dc8e8e32f2f.tar.gz
haskell-915cfd6620a607721d9e4477ae917dc8e8e32f2f.tar.bz2
haskell-915cfd6620a607721d9e4477ae917dc8e8e32f2f.zip
sphere positions, camera
-rw-r--r--raytracer.hs21
1 files changed, 11 insertions, 10 deletions
diff --git a/raytracer.hs b/raytracer.hs
index 618c708..40ff6aa 100644
--- a/raytracer.hs
+++ b/raytracer.hs
@@ -15,14 +15,14 @@ data Sphere = Sphere Coord Double Color deriving (Show, Eq)
degrees = pi / 180
eye :: Coord
-eye = (0, -20, 20)
+eye = (-40, -60, 20)
x_of (x, _, _) = x
y_of (_, y, _) = y
z_of (_, _, z) = z
-sphere1 = Sphere (0, 80, 5) 10 (55,255,0)
-sphere2 = Sphere (80, 0, 5) 20 (255,60,0)
+sphere1 = Sphere (0, 80, 25) 10 (55,255,0)
+sphere2 = Sphere (80, 0, 35) 20 (255,60,200)
--sphere3 = Sphere (0, -80, 5) 20 (5,60,200)
--sphere4 = Sphere (-80, 0, 5) 20 (0,255,255)
--spheres = [sphere1, sphere2, sphere3, sphere4]
@@ -31,7 +31,8 @@ sphere2 = Sphere (80, 0, 5) 20 (255,60,0)
filename num = "foo/foo" ++ show num ++ ".ppm"
--spherepos = take 1 [0,20..]
-spherepos = take 10 [0,36..]
+--spherepos = take 10 [0,36..]
+spherepos = [36]
spheres num = [ trace ("Sphere at " ++
show (round (80 * sin(num * degrees))) ++ "," ++
@@ -46,18 +47,18 @@ writenum num = trace ("Rendering " ++ show (filename $ round num))
main = mapM writenum spherepos
-alpha1 = 0 * degrees
-alpha2 = 360 * degrees
+alpha1 = 100 * degrees
+alpha2 = 0 * degrees
beta1 = 70 * degrees
-beta2 = 180 * degrees
+beta2 = 120 * degrees
floorscale = 4
-w = 500
-h = 200
+w = 400
+h = 220
-oversampling = 1 -- each pixel is 2x2 rays
+oversampling = 1 -- each pixel is oversampling^2 rays
black :: Color
black = (0,0,0)