blob: 20f82929e4831b39f885959b4d47e7f506b5969e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
time = Uniform "time" :: Float
sampler = Sampler PointFilter MirroredRepeat (Texture2DSlot "diffuseTexture")
main = let
emptyFB = FrameBuffer (colorImage1 (V4 0.0 0.0 0.4 1.0))
rasterCtx = TriangleCtx CullNone PolygonFill NoOffset LastVertex
fragmentCtx = (ColorOp NoBlending (V4 True True True True))
vertexShader (p,uv) = VertexOut (rotMatrixZ time *. (V4 p%x p%y (-1) 1)) 1.0 () (Smooth uv)
vertexStream = Fetch @Triangle "objects" (Attribute "position" :: Vec 2 Float, Attribute "uv" :: Vec 2 Float)
primitiveStream = Transform vertexShader vertexStream
fragmentStream = Rasterize rasterCtx primitiveStream
fragmentShader = FragmentShader $ \uv -> texture2D sampler uv
frame = accumulate fragmentCtx PassAll fragmentShader fragmentStream emptyFB
in ScreenOut frame
|