summaryrefslogtreecommitdiff
path: root/testdata/Spiral.lc
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-02-18 18:34:47 +0100
committerPéter Diviánszky <divipp@gmail.com>2016-02-19 02:50:09 +0100
commit998ae8f884f4b1d4e092ebdf3a441b97b2cf05b7 (patch)
tree6ced17ee38fa78de69b05c8765288ecabe52fb6e /testdata/Spiral.lc
parent27c8f3aeb2d13da0bec522ee8a8a98f534fa39e8 (diff)
tuples are heterogeneous lists
Diffstat (limited to 'testdata/Spiral.lc')
-rw-r--r--testdata/Spiral.lc16
1 files changed, 8 insertions, 8 deletions
diff --git a/testdata/Spiral.lc b/testdata/Spiral.lc
index 309316a0..19c08671 100644
--- a/testdata/Spiral.lc
+++ b/testdata/Spiral.lc
@@ -1,8 +1,8 @@
1vertices' = [V3 i 0.0 0.0 | i <- [(-5.0)..5.0] ] 1vertices' = [V3 i 0.0 0.0 | i <- [(-5.0)..5.0] ]
2 2
3lineVertexStream = fetchArrays Line $ concat [[v1, v2] | (v1, v2) <- pairs vertices'] 3lineVertexStream = fetchArrays Line ((concat [[v1, v2] | (v1, v2) <- pairs vertices']))
4 4
5clear = FrameBuffer $ (DepthImage @1 1000, ColorImage @1 white) -- ... 5clear = FrameBuffer (DepthImage @1 1000, ColorImage @1 white) -- ...
6 6
7lines = LineCtx 1.0 LastVertex 7lines = LineCtx 1.0 LastVertex
8colorFragmentCtx = accumulationContext (DepthOp Less True, ColorOp NoBlending (V4 True True True True)) 8colorFragmentCtx = accumulationContext (DepthOp Less True, ColorOp NoBlending (V4 True True True True))
@@ -11,18 +11,18 @@ m = Uniform "Mouse" :: Vec 2 Float
11 11
12rasterizeWith = rasterizePrimitives 12rasterizeWith = rasterizePrimitives
13 13
14mapFragments2 s fs = accumulate colorFragmentCtx ( \a -> fs a) s clear 14mapFragments2 s fs = accumulate colorFragmentCtx ( \((a)) -> ((fs a))) s clear
15transform s f = mapPrimitives (\(p) -> let v = v3FToV4F p in (f v, v)) s 15transform s f = mapPrimitives (\((p)) -> let v = v3FToV4F p in (f v, v)) s
16 16
17trans :: Vec 4 Float -> Vec 4 Float 17trans :: Vec 4 Float -> Vec 4 Float
18trans (V4 i' _ _ _) = V4 (j *! sin i) (j *! cos i) (m%y *! i) 1.0 18trans (V4 i' _ _ _) = V4 (j * sin i) (j * cos i) (m%y * i) 1.0
19 where i = 0.9 *! i' 19 where i = 0.9 * i'
20 j = exp ((m%x -! 0.5) *! i') 20 j = exp ((m%x - 0.5) * i')
21 21
22rotate' v = (Uniform "MVP" :: Mat 4 4 Float) *. v 22rotate' v = (Uniform "MVP" :: Mat 4 4 Float) *. v
23 23
24main = lineVertexStream -- cube vertices 24main = lineVertexStream -- cube vertices
25 `transform` ((scale 0.5 . rotate') . trans) -- scale them 25 `transform` ((scale 0.5 . rotate') . trans) -- scale them
26 & rasterizeWith lines Smooth -- rasterize 26 & rasterizeWith lines ((Smooth)) -- rasterize
27 `mapFragments2` id 27 `mapFragments2` id
28 & ScreenOut -- draw into screen 28 & ScreenOut -- draw into screen