summaryrefslogtreecommitdiff
path: root/hello.lc
blob: 5837a82737e2a46f6f4308b333b5904f0ef12765 (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"))