summaryrefslogtreecommitdiff
path: root/examples/hello.lc
blob: 55e7c73032f41dc142f7cc502c8df5dfe002c0f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
makeFrame (time :: Float)
          (texture :: Texture)
          (prims :: Stream (Primitive 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"))