summaryrefslogtreecommitdiff
path: root/testdata/point01.lc
blob: 531d445a5ad41e78df369c63e61f0d5e7747be31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

vertices :: [(Vec 3 Float,Vec 4 Float)]
vertices = concat [[v i,v (i+!1.0)] | i <- [(-2)..2]]
  where v x = (V3 x 0.0 0.0,red)
clear = FrameBuffer (DepthImage @1 1000, ColorImage @1 navy)   -- ...

lines = LineCtx 1.0 LastVertex
points = PointCtx (ProgramPointSize $ \(_, _) -> 30.0) 1.0 LowerLeft

colorFragmentCtx = (DepthOp Less True, ColorOp NoBlending (V4 True True True True))

cubeVertexStream = fetchArrays (unzip vertices)

mapFragments2 s fs = accumulate colorFragmentCtx (\((a)) -> ((fs a))) s clear

rotate' v = (Uniform "MVP" :: Mat 4 4 Float) *. v

main =             cubeVertexStream         -- cube vertices
     &             mapPrimitives (\(p,c) -> (scale 0.5 . rotate' $ v3FToV4F p, c))
     &             rasterizePrimitives points ((Smooth))  -- rasterize
    `mapFragments2` id
     &             ScreenOut                --  draw into screen