summaryrefslogtreecommitdiff
path: root/testdata/editor-examples/Stripes.lc
blob: 549e2e4d4e5aba25cebaaa5b70991c658ba8de73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

makeFrame (time :: Float)
          (vertexstream :: PrimitiveStream Triangle ((Vec 4 Float)))

    = foldl' overlay (imageFrame (emptyDepthImage 1, emptyColorImage navy))
    $ map (f . (/10)) [ 1 .. 10 ]
  where
    f sc =
          vertexstream
        & mapPrimitives (\((x)) -> (scale sc x, x))
        & rasterizePrimitives (TriangleCtx CullNone PolygonFill NoOffset LastVertex) ((Smooth))
        & filterFragments ffilter
        & mapFragments (\((x)) -> ((V4 sc' sc' sc' 1)))
        & accumulateWith (DepthOp Less True, ColorOp NoBlending (V4 True True True True))
      where
        sc' = 1 - sc
        ffilter ((v)) = sin (10 * (rotMatrixY (time) *. rotMatrixZ (time * sc) *. v)%x) > 0.5


main = renderFrame $
   makeFrame (Uniform "Time")
             (fetch "stream4" (Attribute "position4"))