Refactor shaders, commit before major deletion of old code

This commit is contained in:
2021-03-10 19:34:15 +01:00
parent da86de6918
commit 06a8ae7c99
5 changed files with 70 additions and 19 deletions
+8
View File
@@ -40,7 +40,11 @@ data FullShader = FullShader
, _shaderVAO :: VAO
, _shaderPokeStrategy :: RenderType -> [[[Float]]]-- -> F.FoldM IO RenderType Int
, _shaderDrawPrimitive :: PrimitiveMode
, _shaderTexture :: Maybe ShaderTexture
}
data ShaderTexture = ShaderTexture
{ _textureObject :: TextureObject }
makeLenses ''VAO
makeLenses ''FullShader
@@ -51,6 +55,10 @@ drawShaders fss is =
where f fs i = do
currentProgram $= Just (_shaderProgram fs)
bindVertexArrayObject $= (Just (_vao $ _shaderVAO fs))
case _shaderTexture fs of
Just (ShaderTexture {_textureObject = to})
-> textureBinding Texture2D $= Just to
_ -> return ()
drawArrays (_shaderDrawPrimitive fs) 0 (fromIntegral i)