Use texture array for character rendering, condense rendering
This commit is contained in:
@@ -2,6 +2,7 @@ module Shader.AuxAddition
|
||||
( addSamplerTexture2D
|
||||
, vaddTextureNoFilter
|
||||
, addTextureArray
|
||||
, addTextureArray'
|
||||
, initTexture2D
|
||||
, initTexture2DArray
|
||||
, tilesToLine
|
||||
@@ -127,6 +128,20 @@ addTextureArray texturePath (shad,vbo) = do
|
||||
return (shad & shaderTextures .:~ TO texname
|
||||
, vbo)
|
||||
|
||||
addTextureArray' :: String -> GLsizei -> GLsizei -> GLsizei -> GLsizei -> GLenum -> GLenum
|
||||
-> Shader -> IO Shader
|
||||
addTextureArray' fp nlev w h d minfilt magfilt shad = do
|
||||
Right cmap <- readImage fp
|
||||
let texdata = convertRGBA8 cmap
|
||||
texname <- mglCreate $ glCreateTextures GL_TEXTURE_2D_ARRAY
|
||||
glTextureStorage3D texname nlev GL_RGBA8 w h d
|
||||
VS.unsafeWith (imageData texdata) $ \ptr -> do
|
||||
glTextureSubImage3D texname 0 0 0 0 w h d GL_RGBA GL_UNSIGNED_BYTE ptr
|
||||
glGenerateTextureMipmap texname
|
||||
glTextureParameteri texname GL_TEXTURE_MIN_FILTER (unsafeCoerce minfilt)
|
||||
glTextureParameteri texname GL_TEXTURE_MAG_FILTER (unsafeCoerce magfilt)
|
||||
return (shad & shaderTextures .:~ TO texname )
|
||||
|
||||
tilesToLine
|
||||
:: Int -- ^ Parameter a
|
||||
-> Int -- ^ Parameter b
|
||||
|
||||
Reference in New Issue
Block a user