diff options
Diffstat (limited to 'examples/pickIntDraw.lc')
-rw-r--r-- | examples/pickIntDraw.lc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/pickIntDraw.lc b/examples/pickIntDraw.lc new file mode 100644 index 0000000..fd1a587 --- /dev/null +++ b/examples/pickIntDraw.lc | |||
@@ -0,0 +1,21 @@ | |||
1 | type FB = FrameBuffer 1 '[ 'Color (Vec 4 Float)] | ||
2 | |||
3 | scene :: String -> FB -> FB | ||
4 | scene name prevFB = | ||
5 | Accumulate ((ColorOp NoBlending (one :: Vec 4 Bool))) | ||
6 | (mapFragments (\(uv, rgba) -> ((rgba))) | ||
7 | $ rasterizePrimitives (TriangleCtx CullFront PolygonFill NoOffset LastVertex) (Flat, Flat) | ||
8 | $ mapPrimitives | ||
9 | (\(pos, color, id)-> | ||
10 | ( (Uniform "viewProj" :: Mat 4 4 Float) *. (V4 pos%x pos%y 0 1) | ||
11 | , V2 0.0 0.0 | ||
12 | , color)) | ||
13 | $ fetch name ( Attribute "position" :: Vec 3 Float | ||
14 | , Attribute "color" :: Vec 4 Float | ||
15 | , Attribute "id" :: Int)) | ||
16 | prevFB | ||
17 | |||
18 | main :: Output | ||
19 | main = ScreenOut $ | ||
20 | scene "objects" $ | ||
21 | FrameBuffer ((colorImage1 (V4 0 0 0 0))) | ||