diff options
author | Joshua Rahm <joshua.rahm@colorado.edu> | 2014-04-18 13:54:36 -0600 |
---|---|---|
committer | Joshua Rahm <joshua.rahm@colorado.edu> | 2014-04-18 13:54:36 -0600 |
commit | e1662612bec40fc131ecd306b66f6cb99f7f33e6 (patch) | |
tree | 746a288748690d4352d0ee45fe7a0fea4ab2b67e /Resources.hs | |
parent | e4754131548a55fea393d6fc9245b20fcd60c62c (diff) | |
download | terralloc-e1662612bec40fc131ecd306b66f6cb99f7f33e6.tar.gz terralloc-e1662612bec40fc131ecd306b66f6cb99f7f33e6.tar.bz2 terralloc-e1662612bec40fc131ecd306b66f6cb99f7f33e6.zip |
fixed reflection
Diffstat (limited to 'Resources.hs')
-rw-r--r-- | Resources.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Resources.hs b/Resources.hs index 532878c..4350d06 100644 --- a/Resources.hs +++ b/Resources.hs @@ -18,7 +18,7 @@ import Graphics.SDL.SDLHelp import Graphics.Glyph.BufferBuilder import Graphics.Glyph.Mat4 import Graphics.Glyph.Util -import Graphics.Glyph.ExtendedGL +import Graphics.Glyph.ExtendedGL as Ex import Graphics.Rendering.OpenGL as GL import Graphics.Rendering.OpenGL.Raw.Core31 @@ -195,10 +195,13 @@ displayHandle resources = do return () draw $ prepare (waterObj resources) $ \_ -> do + patchVertices $= 3 uniform (UniformLocation 4) $= pMatrix resources uniform (UniformLocation 5) $= l_mvMatrix uniform (UniformLocation 7) $= normalMatrix uniform (UniformLocation 8) $= l_mvMatrix `glslMatMul` lightPos + uniform (UniformLocation 9) $= Index1 ((fromIntegral $ time resources) / 20::GLfloat) + uniform (UniformLocation 10) $= Vec4 (r,g,b,a::GLfloat) return () SDL.glSwapBuffers @@ -315,7 +318,9 @@ makeResources surf builder forestB jungleB water = do (Just ("shaders/water.tcs","shaders/water.tes")) (Nothing::Maybe String) "shaders/water.vert" "shaders/water.frag" waterTexture <- load "textures/water.jpg" >>= textureFromSurface + skyTexture <- load "textures/skybox_top.png" >>= textureFromSurface location <- get (uniformLocation waterProg "texture") + skyLocation <- get (uniformLocation waterProg "skytex") Resources <$> pure surf <*> do CameraPosition @@ -331,9 +336,10 @@ makeResources surf builder forestB jungleB water = do <*> buildTerrainObject builder <*> buildForestObject forestB "tree.obj" "textures/wood_low.png" <*> buildForestObject jungleB "jungletree.obj" "textures/jungle_tree.png" - <*> (newDefaultGlyphObjectWithClosure water () $ \_ -> do + <*> (liftM (setPrimitiveMode Ex.Patches) $ newDefaultGlyphObjectWithClosure water () $ \_ -> do currentProgram $= Just waterProg setupTexturing waterTexture location 0 + setupTexturing skyTexture skyLocation 1 ) <*> pure 0 <*> pure 1 |