summaryrefslogtreecommitdiff
path: root/examples/hello.lc
blob: cf5747287eb7d708b40bc12a086c392065b7928d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
makeFrame (time :: Float)
          (texture :: Texture)
          (prims :: PrimitiveStream Triangle (Vec 2 Float, Vec 2 Float))

    = imageFrame (emptyColorImage (V4 0 0 0.4 1))
  `overlay`
      prims
    & mapPrimitives (\(p,uv) -> (rotMatrixZ time *. (V4 p%x p%y (-1) 1), uv))
    & rasterizePrimitives (TriangleCtx CullNone PolygonFill NoOffset LastVertex) Smooth
    & mapFragments (\uv -> texture2D (Sampler PointFilter MirroredRepeat texture) uv)
    & accumulateWith (ColorOp NoBlending (V4 True True True True))

main = renderFrame $
   makeFrame (Uniform "time")
             (Texture2DSlot "diffuseTexture")
             (fetch_ "objects" (Attribute "position", Attribute "uv"))