diff options
author | Joe Crayne <joe@jerkface.net> | 2019-04-26 20:24:50 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-04-26 20:24:50 -0400 |
commit | cffec1ebd78808154e98b6f3ec46578372a1331f (patch) | |
tree | 2a1f4a6b703dc7f1a3c70b9b91862971da41f4e3 /meshsketch.lc | |
parent | 3ab58407dbdb5d6b595313315a92864a9b76706d (diff) |
Lambdacube code for MeshSketch.
Diffstat (limited to 'meshsketch.lc')
-rw-r--r-- | meshsketch.lc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/meshsketch.lc b/meshsketch.lc new file mode 100644 index 0000000..9ca422d --- /dev/null +++ b/meshsketch.lc | |||
@@ -0,0 +1,22 @@ | |||
1 | makeFrame (cam :: Mat 4 4 Float) | ||
2 | (skybox :: Texture) | ||
3 | (skypoints :: PrimitiveStream Point ((Vec 3 Float))) | ||
4 | |||
5 | = imageFrame (emptyDepthImage 1, emptyColorImage (V4 0 0 0.4 1)) | ||
6 | `overlay` | ||
7 | skypoints | ||
8 | & mapPrimitives (\((p)) -> ( cam *. V4 p%x p%y p%z 1, V3 p%x (-p%y) (-p%z) ) ) | ||
9 | & rasterizePrimitives (PointCtx (PointSize 1.0) | ||
10 | 1.0 -- GL_POINT_FADE_THRESHOLD | ||
11 | UpperLeft) -- texture y increases downward | ||
12 | ((Smooth)) | ||
13 | & mapFragments (\((d)) -> ((texture2D (Sampler PointFilter MirroredRepeat skybox) d%xy ))) | ||
14 | & accumulateWith (DepthOp Always True, ColorOp NoBlending (V4 True True True True)) | ||
15 | |||
16 | |||
17 | textureCubeSlot s = Texture2DSlot s | ||
18 | |||
19 | main = renderFrame $ | ||
20 | makeFrame (Uniform "Cam") | ||
21 | (textureCubeSlot "Skybox") | ||
22 | (fetch "skypoints" ((Attribute "position"))) | ||