diff options
author | Csaba Hruska <csaba.hruska@gmail.com> | 2016-01-19 15:59:35 +0100 |
---|---|---|
committer | Csaba Hruska <csaba.hruska@gmail.com> | 2016-01-19 16:10:49 +0100 |
commit | cb69693769ebfcdac605c90f38a20c788b08eaf3 (patch) | |
tree | 3689094c7ff13f45cc928a7dfaafff2652ed4c03 /testdata/fetcharrays01.lc | |
parent | d5f3ef4a65218b966f7463511896fd901a4d1d77 (diff) |
normalise paths and fix self export handling
Diffstat (limited to 'testdata/fetcharrays01.lc')
-rw-r--r-- | testdata/fetcharrays01.lc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/testdata/fetcharrays01.lc b/testdata/fetcharrays01.lc new file mode 100644 index 00000000..57bbe40e --- /dev/null +++ b/testdata/fetcharrays01.lc | |||
@@ -0,0 +1,52 @@ | |||
1 | cubeNormals :: [Vec 3 Float] | ||
2 | cubeNormals = | ||
3 | [ V3 0.0 1.0 0.0, V3 0.0 1.0 0.0, V3 0.0 1.0 0.0 | ||
4 | , V3 0.0 1.0 0.0, V3 0.0 1.0 0.0, V3 0.0 1.0 0.0 | ||
5 | , V3 0.0 (-1.0) 0.0, V3 0.0 (-1.0) 0.0, V3 0.0 (-1.0) 0.0 | ||
6 | , V3 0.0 (-1.0) 0.0, V3 0.0 (-1.0) 0.0, V3 0.0 (-1.0) 0.0 | ||
7 | , V3 0.0 (-0.0) 1.0, V3 0.0 (-0.0) 1.0, V3 0.0 (-0.0) 1.0 | ||
8 | , V3 (-0.0) 0.0 1.0, V3 (-0.0) 0.0 1.0, V3 (-0.0) 0.0 1.0 | ||
9 | , V3 (-0.0) (-0.0) (-1.0), V3 (-0.0) (-0.0) (-1.0), V3 (-0.0) (-0.0) (-1.0) | ||
10 | , V3 0.0 0.0 (-1.0), V3 0.0 0.0 (-1.0), V3 0.0 0.0 (-1.0) | ||
11 | , V3 (-1.0) 0.0 0.0, V3 (-1.0) 0.0 0.0, V3 (-1.0) 0.0 0.0 | ||
12 | , V3 (-1.0) 0.0 0.0, V3 (-1.0) 0.0 0.0, V3 (-1.0) 0.0 0.0 | ||
13 | , V3 1.0 0.0 0.0, V3 1.0 0.0 0.0, V3 1.0 0.0 0.0 | ||
14 | , V3 1.0 0.0 0.0, V3 1.0 0.0 0.0, V3 1.0 0.0 0.0 | ||
15 | ] | ||
16 | |||
17 | cubeVertices :: [Vec 3 Float] | ||
18 | cubeVertices = | ||
19 | [ V3 1.0 1.0 1.0, V3 (-1.0) 1.0 1.0, V3 (-1.0) 1.0 (-1.0) | ||
20 | , V3 (-1.0) 1.0 (-1.0), V3 1.0 1.0 (-1.0), V3 1.0 1.0 1.0 | ||
21 | , V3 1.0 (-1.0) (-1.0), V3 (-1.0) (-1.0) (-1.0), V3 (-1.0) (-1.0) 1.0 | ||
22 | , V3 (-1.0) (-1.0) 1.0, V3 1.0 (-1.0) 1.0, V3 1.0 (-1.0) (-1.0) | ||
23 | , V3 1.0 (-1.0) 1.0, V3 (-1.0) (-1.0) 1.0, V3 (-1.0) 1.0 1.0 | ||
24 | , V3 (-1.0) 1.0 1.0, V3 1.0 1.0 1.0, V3 1.0 (-1.0) 1.0 | ||
25 | , V3 1.0 1.0 (-1.0), V3 (-1.0) 1.0 (-1.0), V3 (-1.0) (-1.0) (-1.0) | ||
26 | , V3 (-1.0) (-1.0) (-1.0), V3 1.0 (-1.0) (-1.0), V3 1.0 1.0 (-1.0) | ||
27 | , V3 (-1.0) (-1.0) 1.0, V3 (-1.0) (-1.0) (-1.0), V3 (-1.0) 1.0 (-1.0) | ||
28 | , V3 (-1.0) 1.0 (-1.0), V3 (-1.0) 1.0 1.0, V3 (-1.0) (-1.0) 1.0 | ||
29 | , V3 1.0 (-1.0) (-1.0), V3 1.0 (-1.0) 1.0, V3 1.0 1.0 1.0 | ||
30 | , V3 1.0 1.0 1.0, V3 1.0 1.0 (-1.0), V3 1.0 (-1.0) (-1.0) | ||
31 | ] | ||
32 | |||
33 | cubeVertexStream = fetchArrays Triangle (cubeVertices,cubeNormals) | ||
34 | |||
35 | clear = FrameBuffer $ (DepthImage @1 1000, ColorImage @1 red) -- ... | ||
36 | |||
37 | triangleRasterCtx = TriangleCtx CullNone PolygonFill NoOffset LastVertex | ||
38 | colorFragmentCtx = accumulationContext (DepthOp Less True, ColorOp NoBlending (V4 True True True True)) | ||
39 | |||
40 | rasterizeWith = rasterizePrimitives | ||
41 | triangles = triangleRasterCtx | ||
42 | |||
43 | mapFragments2 s fs = accumulate colorFragmentCtx ( \a -> fs a) s clear | ||
44 | transform s f = mapPrimitives (\(p,n) -> let v = v3FToV4F p in (f v, v)) s | ||
45 | |||
46 | rotate' v = (Uniform "MVP" :: Mat 4 4 Float) `PrimMulMatVec` v | ||
47 | |||
48 | main = cubeVertexStream -- cube vertices | ||
49 | `transform` (scale 0.5 . rotate') -- scale them | ||
50 | & rasterizeWith triangles Smooth -- rasterize | ||
51 | `mapFragments2` id | ||
52 | & ScreenOut -- draw into screen | ||