diff options
author | Csaba Hruska <csaba.hruska@gmail.com> | 2016-01-19 15:59:35 +0100 |
---|---|---|
committer | Csaba Hruska <csaba.hruska@gmail.com> | 2016-01-19 16:10:49 +0100 |
commit | cb69693769ebfcdac605c90f38a20c788b08eaf3 (patch) | |
tree | 3689094c7ff13f45cc928a7dfaafff2652ed4c03 /testdata/example08.lc | |
parent | d5f3ef4a65218b966f7463511896fd901a4d1d77 (diff) |
normalise paths and fix self export handling
Diffstat (limited to 'testdata/example08.lc')
-rw-r--r-- | testdata/example08.lc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/testdata/example08.lc b/testdata/example08.lc new file mode 100644 index 00000000..b6ebbd0e --- /dev/null +++ b/testdata/example08.lc | |||
@@ -0,0 +1,40 @@ | |||
1 | time = Uniform "Time" :: Float | ||
2 | |||
3 | image color = FrameBuffer (DepthImage @1 1000.0, ColorImage @1 (color :: Vec 4 Float)) | ||
4 | |||
5 | triangleRasterCtx = TriangleCtx CullNone PolygonFill NoOffset LastVertex | ||
6 | colorFragmentCtx = (DepthOp Less True, ColorOp NoBlending (V4 True True True True)) | ||
7 | |||
8 | rasterizeWith = rasterizePrimitives | ||
9 | triangles = triangleRasterCtx | ||
10 | |||
11 | cubeVertexStream = fetch "stream4" Triangle (Attribute "position4" :: Vec 4 Float) | ||
12 | mapFragments2 s fs bg = accumulate colorFragmentCtx (\a -> fs a) s bg | ||
13 | |||
14 | cube fv f bg = (cubeVertexStream -- cube vertices | ||
15 | & mapPrimitives (\v -> (fv v, v)) | ||
16 | & rasterizeWith triangles Smooth -- rasterize | ||
17 | `mapFragments2` f) bg | ||
18 | |||
19 | trMat a b = a *. b | ||
20 | rotate' v = (Uniform "MVP" :: Mat 4 4 Float) *. v | ||
21 | trX a b = V4 (a :: Float) 0 0.0 0 + b | ||
22 | |||
23 | main = ScreenOut $ | ||
24 | foldl' (\fb a -> cube ( | ||
25 | trMat (rotMatrixZ $ time *! a) . | ||
26 | rotate' . | ||
27 | (trX (0.5 *! a +! sin time *! 0.1)) . | ||
28 | (scale 0.04) . | ||
29 | trMat (rotMatrixX (time *! 2.0 *! a)) | ||
30 | ) id fb) | ||
31 | (image navy) | ||
32 | [ a | x <- [ (-0.5,True) | ||
33 | , (0.0,True) | ||
34 | , (0.5,True) | ||
35 | , (0.3,True) | ||
36 | , (0.75,True) | ||
37 | ] `append` [(a,True) | a <- [(-1.0)..2.0]] | ||
38 | , let (a,b) = x | ||
39 | , b | ||
40 | ] | ||