Cleanup, start to add creature silhouettes

This commit is contained in:
2021-09-02 11:06:04 +01:00
parent 02193add68
commit 9d2f42dbc9
16 changed files with 142 additions and 94 deletions
+6 -6
View File
@@ -33,7 +33,7 @@ addTexture texturePath shad = do
glTexSubImage2D GL_TEXTURE_2D 0 0 0 wtex htex GL_RGBA GL_UNSIGNED_BYTE ptr
textureFilter Texture2DArray $= ((Linear',Just Linear') , Linear')
generateMipmap' Texture2D
return $ shad & shaderTexture ?~ ShaderTexture {_textureObject = textureOb}
return $ shad & shadTex ?~ ShaderTexture {_textureObject = textureOb}
vaddTextureNoFilter :: String -> FullShader -> IO FullShader
vaddTextureNoFilter texturePath shad = do
@@ -48,7 +48,7 @@ vaddTextureNoFilter texturePath shad = do
--withArray texData $ \ptr -> do
V.unsafeWith (imageData tex) $ \ptr -> do
glTexSubImage2D GL_TEXTURE_2D 0 0 0 wtex htex GL_RGBA GL_UNSIGNED_BYTE ptr
return $ shad & shaderTexture ?~ ShaderTexture {_textureObject = textureOb}
return $ shad & shadTex ?~ ShaderTexture {_textureObject = textureOb}
addTextureNoFilter :: String -> FullShader -> IO FullShader
addTextureNoFilter texturePath shad = do
@@ -62,7 +62,7 @@ addTextureNoFilter texturePath shad = do
glTexStorage2D GL_TEXTURE_2D 1 GL_RGBA8 wtex htex
V.unsafeWith (imageData tex) $ \ptr -> do
glTexSubImage2D GL_TEXTURE_2D 0 0 0 wtex htex GL_RGBA GL_UNSIGNED_BYTE ptr
return $ shad & shaderTexture ?~ ShaderTexture {_textureObject = textureOb}
return $ shad & shadTex ?~ ShaderTexture {_textureObject = textureOb}
-- | for transforming a 256x256 image containing 64 tiles of 16x16 pixels into
-- an image that was directly readable by glTexSubImage3D, used the
@@ -84,7 +84,7 @@ addTextureArray texturePath shad = do
glTexSubImage3D GL_TEXTURE_2D_ARRAY 0 0 0 0 32 32 64 GL_RGBA GL_UNSIGNED_BYTE ptr
textureFilter Texture2DArray $= ((Linear',Just Linear') , Linear')
generateMipmap' Texture2DArray
return $ shad & shaderTexture ?~ ShaderTexture {_textureObject = textureOb}
return $ shad & shadTex ?~ ShaderTexture {_textureObject = textureOb}
-- I am completely unclear on why this works with its current parameters
tilesToLine
@@ -96,5 +96,5 @@ tilesToLine n w = concat . concat . transpose . chunksOf n . chunksOf w
addUniforms :: [String] -> FullShader -> IO FullShader
addUniforms uniStrings shad = do
uniLocs <- mapM (uniformLocation $ _shaderProgram shad) uniStrings
return $ shad & shaderCustomUnis %~ (++ uniLocs)
uniLocs <- mapM (uniformLocation $ _shadProg shad) uniStrings
return $ shad & shadUnis %~ (++ uniLocs)