diff options
author | Yann Herklotz <git@yannherklotz.com> | 2021-01-02 20:19:24 +0000 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2021-01-02 20:19:24 +0000 |
commit | 47cb7b6abda067738205c2dcf579fa8807a54936 (patch) | |
tree | 76007ad74cfa7a98e50f4db2c558ee8fe41743d9 | |
parent | d619daf6f6ca589b573b64f827fe7ca38fb7ab7e (diff) | |
download | Vivant-47cb7b6abda067738205c2dcf579fa8807a54936.tar.gz Vivant-47cb7b6abda067738205c2dcf579fa8807a54936.zip |
Update colours and looks
-rw-r--r-- | src/Vivant.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Vivant.hs b/src/Vivant.hs index a3973a5..001b463 100644 --- a/src/Vivant.hs +++ b/src/Vivant.hs @@ -268,7 +268,7 @@ pixelRenderer n x y = createTerrain :: [[Float]] createTerrain = - fmap (\y -> fmap (\x -> fromIntegral (pixelRenderer 0 x y) / 15) [0..63]) [0..63] + fmap (\y -> fmap (\x -> fromIntegral (pixelRenderer 0 x y) / 20) [0..63]) [0..63] initResources :: IO Game initResources = do @@ -313,7 +313,7 @@ castV3 (V3 a b c) = GL.Vector3 a b c draw :: Game -> IO () draw game@(Game {gameProgram = Just p, gameVao = Just v, gameTerrain = Just t}) = do tick <- ticks - GL.clearColor $= GL.Color4 1 1 1 1 + GL.clearColor $= GL.Color4 0.2 0.2 0.2 1 GL.clear [GL.ColorBuffer, GL.DepthBuffer] GL.currentProgram $= gameProgram game @@ -327,7 +327,7 @@ draw game@(Game {gameProgram = Just p, gameVao = Just v, gameTerrain = Just t}) cameraPosition = cameraPos camera targetPosition = cameraPosition ^+^ cameraFront camera viewMatrix = lookAt cameraPosition targetPosition (cameraUp camera) - projectionMatrix = perspective (toRadians 45) (640 / 480) 0.1 1000 + projectionMatrix = perspective (toRadians 45) (640 / 480) 0.1 200 poke (gameViewP game) viewMatrix poke (gameProjectionP game) projectionMatrix @@ -336,7 +336,9 @@ draw game@(Game {gameProgram = Just p, gameVao = Just v, gameTerrain = Just t}) GL.glUniformMatrix4fv projection 1 1 (castPtr (gameProjectionP game)) ourColorLoc <- GL.uniformLocation p "light_pos" - GL.uniform ourColorLoc $= castV3 (cameraPos (gameCamera game)) + GL.uniform ourColorLoc $= + (GL.Vector3 (0::Float) (32 * sin (fromIntegral tick / 2000)) (16 * (abs $ cos (fromIntegral tick / 2000)))) + --castV3 (cameraPos (gameCamera game)) render $ terrainRenderer t |