summaryrefslogtreecommitdiff
path: root/testdata/editor-examples/Cube.lc
blob: 97a53e577e415260db4d3bfeb73c22fe24d2178b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
makeFrame (projmat :: Mat 4 4 Float)
          (vertexstream :: PrimitiveStream Triangle (Vec 4 Float))

          = imageFrame (emptyDepthImage 1, emptyColorImage navy)
  `overlay` fragments
  where
    fragments =
          vertexstream
        & mapPrimitives (\x -> (scale 0.5 (projmat *. x), x))
        & rasterizePrimitives (TriangleCtx CullNone PolygonFill NoOffset LastVertex) Smooth
        & accumulateWith (DepthOp Less True, ColorOp NoBlending (V4 True True True True))

main = renderFrame $
   makeFrame (Uniform "MVP")
             (fetch_ "stream4" (Attribute "position4"))