aboutsummaryrefslogtreecommitdiffstats
path: root/src/Vivant
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2021-01-03 14:39:37 +0000
committerYann Herklotz <git@yannherklotz.com>2021-01-03 14:39:37 +0000
commit7fac2a80c61aab48910b27d07d4ddbb404536dd3 (patch)
tree0bfc5f6ad94c9864532d174e2079a1ac8b6d013b /src/Vivant
parent3f26ce1b76fc2ff77740b71c9470e093ebde69b5 (diff)
downloadVivant-7fac2a80c61aab48910b27d07d4ddbb404536dd3.tar.gz
Vivant-7fac2a80c61aab48910b27d07d4ddbb404536dd3.zip
Format and hlint
Diffstat (limited to 'src/Vivant')
-rw-r--r--src/Vivant/Noise.hs15
-rw-r--r--src/Vivant/Renderer.hs2
-rw-r--r--src/Vivant/Terrain.hs5
3 files changed, 10 insertions, 12 deletions
diff --git a/src/Vivant/Noise.hs b/src/Vivant/Noise.hs
index bf2b197..a9a3b47 100644
--- a/src/Vivant/Noise.hs
+++ b/src/Vivant/Noise.hs
@@ -390,20 +390,19 @@ main = do
pixelRenderer, pixelRenderer' :: String -> Int -> Int -> Word8
pixelRenderer !n !x !y =
doubleToByte $
- ( ( perlin3
- permutation
- ( (fromIntegral x - 32) / 4,
- (fromIntegral y - 32) / 4,
- read n :: Double
- )
- )
+ ( perlin3
+ permutation
+ ( (fromIntegral x - 32) / 4,
+ (fromIntegral y - 32) / 4,
+ read n :: Double
+ )
+ 1
)
/ 2
* 128
pixelRenderer' !n x y =
- (\w -> doubleToByte $ ((w + 1) / 2 * 128)) -- w should be in [-1,+1]
+ (\w -> doubleToByte ((w + 1) / 2 * 128)) -- w should be in [-1,+1]
. perlin3 permutation
. (\(x, y, z) -> ((x -256) / 32, (y -256) / 32, (z -256) / 32))
$ (fromIntegral x, fromIntegral y, 0 :: Double)
diff --git a/src/Vivant/Renderer.hs b/src/Vivant/Renderer.hs
index 91a395f..3ad1bf0 100644
--- a/src/Vivant/Renderer.hs
+++ b/src/Vivant/Renderer.hs
@@ -20,7 +20,7 @@ getUniformLocation :: GL.UniformLocation -> GL.GLint
getUniformLocation (GL.UniformLocation i) = i
render :: Renderer -> IO ()
-render r@(Renderer {rendererProgram = Just p}) = do
+render r@Renderer {rendererProgram = Just p} = do
-- GL.currentProgram $= rendererProgram r
GL.bindVertexArrayObject $= rendererVao r
diff --git a/src/Vivant/Terrain.hs b/src/Vivant/Terrain.hs
index b73469a..c9c517a 100644
--- a/src/Vivant/Terrain.hs
+++ b/src/Vivant/Terrain.hs
@@ -27,9 +27,8 @@ normal a b c =
partition ::
(V.Storable a1, Enum a1, Num a1) => [[a1]] -> V.Vector a1
partition r =
- V.fromList . concat . concat
- . fmap (\(e, y) -> fmap (generateP y) $ zip (zip (uncurry zip e) $ tail (uncurry zip e)) [0 ..])
- $ zip (zip r $ tail r) [0 ..]
+ V.fromList . concat . concatMap (\(e, y) -> generateP y <$> zip (zip (uncurry zip e) $ tail (uncurry zip e)) [0 ..]) $
+ zip (zip r $ tail r) [0 ..]
where
generateP y (((z1, z2), (z3, z4)), x) =
let (n1x, n1y, n1z) = normal (x, y, z1) (x, y + 1, z2) (x + 1, y, z3)