summaryrefslogtreecommitdiff
path: root/testdata/helloWorld.lc
blob: f1589c12ae8b53a3ad6d84536d12ad3cd6ee236c (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
25
26
27
28
29
30
31
32
33
34
35

makeFrame (projmat :: Mat 4 4 Float)
          (prims :: Stream (Primitive Triangle (Vec 4 Float)))

    = imageFrame (emptyDepthImage 1000, emptyColorImage navy)
  `overlay`
      prims
    & mapPrimitives (\x -> (scale 0.5 $ projmat *. x, x))
    & rasterizePrimitives (TriangleCtx CullNone PolygonFill NoOffset LastVertex) Smooth
    & filterFragments (\_ -> True)
    & mapFragments (\x -> x)
    & accumulateWith (defaultFragOp @(Depth Float) @_{-DepthOp Less True-}, ColorOp NoBlending (V4 True True True True))

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

{-
makeFrame (projmat :: Mat 4 4 Float)
          (vertices :: Stream (Primitive Triangle (Vec 4 Float)))

    = imageFrame ({-emptyDepthImage 1000, -}emptyColorImage navy)
  `overlay`
      vertices
    & transformVertices (\x -> x)
    & rasterize (scale 0.5 . (projmat *.)) Smooth (TriangleCtx CullNone PolygonFill NoOffset LastVertex)
    & filterFragments (\_ -> True)
    & mapFragments (\x -> x)
--    & noDepths
    & accumulateWith ({-DepthOp Less True, -}ColorOp NoBlending (V4 True True True True))

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