This commit is contained in:
nek0 2020-02-06 14:41:06 +01:00
parent 1101910c31
commit 4bf5fa6b87
2 changed files with 17 additions and 6 deletions

11
app/Classes/Renderable.hs Normal file
View file

@ -0,0 +1,11 @@
{-# LANGUAGE TypeFamilies #-}
module Classes.Renderable where
class Renderable a where
type VertexObjects a :: *
type ShaderObjects a :: *
type RenderableInfo a :: *
draw :: VertexObjects a -> ShaderObjects a -> RenderableInfo a -> IO ()

View file

@ -5,11 +5,11 @@ import Graphics.Rendering.OpenGL as GL
data RenderObjects = RenderObjects data RenderObjects = RenderObjects
{ roVAO :: GL.VertexArrayObject { roVAO :: GL.VertexArrayObject
, roVBO :: GL.BufferObject , roVBO :: GL.BufferObject
, shader ::
} }
class Renderable a where data GL.Uniform u => ShaderObjects u = Shaderobjects
type VertexObjects :: * { soVertexShader :: GL.Shader
, soFragmentShader :: GL.Shader
draw = do , soProgram :: GL.Program
, soUniforms :: [(String, u)]
}