summaryrefslogtreecommitdiff
path: root/testdata/editor-examples/Stripes.lc
diff options
context:
space:
mode:
authorCsaba Hruska <csaba.hruska@gmail.com>2016-02-05 17:51:27 +0100
committerCsaba Hruska <csaba.hruska@gmail.com>2016-02-05 17:51:27 +0100
commit749410713b5c1dce369c57d74fafd504ae068960 (patch)
treef70942ff63958b446b8963342fa0b413bffb903b /testdata/editor-examples/Stripes.lc
parentd392619689e78a1a379e8a7ba27b49cdba471b06 (diff)
add editor examples as tests
Diffstat (limited to 'testdata/editor-examples/Stripes.lc')
-rw-r--r--testdata/editor-examples/Stripes.lc24
1 files changed, 24 insertions, 0 deletions
diff --git a/testdata/editor-examples/Stripes.lc b/testdata/editor-examples/Stripes.lc
new file mode 100644
index 00000000..8558bfe2
--- /dev/null
+++ b/testdata/editor-examples/Stripes.lc
@@ -0,0 +1,24 @@
1
2makeFrame (time :: Float)
3 (vertexstream :: PrimitiveStream Triangle (Vec 4 Float))
4
5 = foldl' overlay (imageFrame (emptyDepthImage 1, emptyColorImage navy))
6 $ map (f . (/10)) [ 1 .. 10 ]
7 where
8 f sc =
9 vertexstream
10 & mapPrimitives (\x -> (scale sc x, x))
11 & rasterizePrimitives (TriangleCtx CullNone PolygonFill NoOffset LastVertex) Smooth
12 & filterFragments ffilter
13 & mapFragments (\x -> V4 sc' sc' sc' 1)
14 & accumulateWith (DepthOp Less True, ColorOp NoBlending (V4 True True True True))
15 where
16 sc' = 1 - sc
17 ffilter v = sin (10 * (rotMatrixY (time) *. rotMatrixZ (time * sc) *. v)%x) > 0.5
18
19
20main = renderFrame $
21 makeFrame (Uniform "Time")
22 (fetch_ "stream4" (Attribute "position4"))
23
24