summaryrefslogtreecommitdiff
path: root/examples/pickInt.lc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pickInt.lc')
-rw-r--r--examples/pickInt.lc21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/pickInt.lc b/examples/pickInt.lc
new file mode 100644
index 0000000..a75bc19
--- /dev/null
+++ b/examples/pickInt.lc
@@ -0,0 +1,21 @@
1type FB = FrameBuffer 1 '[ 'Color (Vec 4 Int)]
2
3scene :: String -> FB -> FB
4scene 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 , V4 0 0 0 id))
13 $ fetch name ( Attribute "position" :: Vec 3 Float
14 , Attribute "color" :: Vec 4 Float
15 , Attribute "id" :: Int))
16 prevFB
17
18main :: Output
19main = TextureOut (V2 800 600) $
20 scene "objects" $
21 FrameBuffer ((colorImage1 (V4 0 0 0 0)))