summaryrefslogtreecommitdiff
path: root/testdata/gfx04.lc
blob: 33ffc4ce13b89bb1e5b1935b45b49aa45409702f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
render fb = let
  modelViewProj = Uniform "MVP" :: Mat 4 4 Float
  blendFun x = Blend x ((SrcAlpha,OneMinusSrcAlpha),(SrcAlpha,OneMinusSrcAlpha)) (V4 1.0 1.0 1.0 1.0)
  blend'' = blendFun (FuncAdd,FuncAdd)
  blend = Blend (FuncAdd,FuncAdd) ((SrcAlpha,OneMinusSrcAlpha),(SrcAlpha,OneMinusSrcAlpha)) (V4 1.0 1.0 1.0 1.0)
  blend' = NoBlending
  polyMode          = PolygonLine 20.0
  polyMode'         = PolygonFill
  polyMode''        = PolygonPoint (PointSize 10.0)
  cull = CullNone
  cull' = CullFront
  rasterCtx         = TriangleCtx cull polyMode' NoOffset LastVertex
  fragmentCtx       = (DepthOp Less False, ColorOp blend (V4 True True True True))
  vertexStream      = fetch "stream" ( Attribute "position" :: Vec 3 Float
                                               , Attribute "normal"   :: Vec 3 Float
                                               )
  primitiveStream   = mapPrimitives (\(v,n) -> (PrimMulMatVec modelViewProj $ v3FToV4F v, v3FToV4F n)) vertexStream
  fragmentStream    = rasterizePrimitives rasterCtx ((Smooth)) primitiveStream
  fragmentShader ((v)) = ((PrimMul v (V4 1.0 1.4 1.0 0.6)))
  frame             = accumulate fragmentCtx fragmentShader fragmentStream fb
  in frame

main = let
  bgColor = V4 0.5 0.0 0.4 1.0
  bgColor' = V4 0.2 0.2 0.4 1.0
  emptyFB = FrameBuffer (depthImage1 1000.0,colorImage1 bgColor)
  modelViewProj = Uniform "MVP" :: Mat 4 4 Float
  out = render emptyFB
  in ScreenOut out