summaryrefslogtreecommitdiff
path: root/testdata/fragment01.lc
blob: c285242ef05e946a0daa320620278d30eab77f8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
clear = FrameBuffer ((ColorImage @1 $ V4 1 0 0 0.5))

triangleRasterCtx = TriangleCtx CullNone PolygonFill NoOffset LastVertex
colorFragmentCtx = accumulationContext ((ColorOp NoBlending (V4 True True True True)))

rasterizeWith = rasterizePrimitives
triangles = triangleRasterCtx

quadVertexStream = fetch "quad" (Attribute "position" :: ((Vec 4 Float)))

transform s f =  mapPrimitives (\((v)) -> ((f v))) s

mapFragments2 s fs = accumulate colorFragmentCtx  ( \() -> ((fs))) s clear

render f = quadVertexStream                 -- id vertices
    `transform`    id
     &             rasterizeWith triangles ()  -- rasterize
    `mapFragments2` f
     &             ScreenOut                --  draw into screen

main = render blue