diff options
author | Joe Crayne <joe@jerkface.net> | 2019-05-02 17:08:04 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-05-02 17:08:04 -0400 |
commit | 44ec6fa45b71d95650d05ea4e16550698ca7fb93 (patch) | |
tree | c40247b1cccea5a3c63473d47de50d5f56908d6c /hello_obj2.lc | |
parent | 5abe70c7457ebedc5e4e348e3dc5a7b830fab897 (diff) |
Use compiler-support for TextureCube.
Diffstat (limited to 'hello_obj2.lc')
-rw-r--r-- | hello_obj2.lc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/hello_obj2.lc b/hello_obj2.lc index db28333..991c3c2 100644 --- a/hello_obj2.lc +++ b/hello_obj2.lc | |||
@@ -11,7 +11,7 @@ point :: Vec 3 Float -> Vec 4 Float | |||
11 | point p = V4 p%x p%y p%z 1 | 11 | point p = V4 p%x p%y p%z 1 |
12 | 12 | ||
13 | 13 | ||
14 | makeFrame (cubemap :: Texture) | 14 | makeFrame (cubemap :: TextureCube) |
15 | (skybox :: PrimitiveStream Triangle ((Vec 3 Float))) | 15 | (skybox :: PrimitiveStream Triangle ((Vec 3 Float))) |
16 | (cameraPosition :: Vec 3 Float) | 16 | (cameraPosition :: Vec 3 Float) |
17 | (cam :: Mat 4 4 Float) | 17 | (cam :: Mat 4 4 Float) |
@@ -27,7 +27,7 @@ makeFrame (cubemap :: Texture) | |||
27 | p' = cam *. point (p + cameraPosition) | 27 | p' = cam *. point (p + cameraPosition) |
28 | in (p', texcoord)) | 28 | in (p', texcoord)) |
29 | & rasterizePrimitives (TriangleCtx CullNone PolygonFill NoOffset LastVertex) ((Smooth)) | 29 | & rasterizePrimitives (TriangleCtx CullNone PolygonFill NoOffset LastVertex) ((Smooth)) |
30 | & mapFragments (\((d)) -> ((texture2D (Sampler PointFilter MirroredRepeat cubemap) d%xy ))) | 30 | & mapFragments (\((d)) -> (( textureCube cubemap d ))) |
31 | & accumulateWith (DepthOp Always False, ColorOp NoBlending (V4 True True True True)) | 31 | & accumulateWith (DepthOp Always False, ColorOp NoBlending (V4 True True True True)) |
32 | `overlay` | 32 | `overlay` |
33 | prims | 33 | prims |
@@ -44,8 +44,9 @@ makeFrame (cubemap :: Texture) | |||
44 | in ((r + V4 0 0 0 (0.8)))) | 44 | in ((r + V4 0 0 0 (0.8)))) |
45 | & accumulateWith (DepthOp Less True, ColorOp blendplane (V4 True True True True)) | 45 | & accumulateWith (DepthOp Less True, ColorOp blendplane (V4 True True True True)) |
46 | 46 | ||
47 | textureCubeSlot s = Texture2DSlot s | 47 | textureCubeSlot s = TextureCubeSlot s |
48 | 48 | ||
49 | main :: Output | ||
49 | main = renderFrame $ | 50 | main = renderFrame $ |
50 | makeFrame (textureCubeSlot "CubeMap") | 51 | makeFrame (textureCubeSlot "CubeMap") |
51 | (fetch "SkyCube" ((Attribute "position"))) | 52 | (fetch "SkyCube" ((Attribute "position"))) |