This commit is contained in:
jgk
2021-04-23 11:10:45 +02:00
parent c740ca0844
commit ffe4a8083b
14 changed files with 329 additions and 286 deletions
+30 -3
View File
@@ -1,14 +1,38 @@
{-# LANGUAGE TemplateHaskell #-}
{-
Datatypes used to setup and pass data to shaders.
-}
module Shader.Data
where
( VAO (..)
, FullShader (..)
, ShaderTexture (..)
-- lens functions
, vao
, vaoBufferTargets
, shaderProgram
, shaderUniforms
, shaderVAO
, shaderPokeStrategy
, shaderDrawPrimitive
, shaderTexture
, shaderCustomUnis
-- , textureObject
) where
import Graphics.Rendering.OpenGL
import Foreign
import Control.Lens
{- Vertex array object: contains the reference to the object,
and its buffer targets.
-}
data VAO = VAO
{ _vao :: VertexArrayObject
, _vaoBufferTargets :: [(BufferObject,Ptr Float,Int)]
}
{-
Datatype containing the necessary information for a single shader.
-}
data FullShader a = FullShader
{ _shaderProgram :: Program
, _shaderUniforms :: [UniformLocation]
@@ -18,7 +42,10 @@ data FullShader a = FullShader
, _shaderTexture :: Maybe ShaderTexture
, _shaderCustomUnis :: Maybe [UniformLocation]
}
data ShaderTexture = ShaderTexture
{-
Datatype containing the reference to a texture object.
-}
newtype ShaderTexture = ShaderTexture
{ _textureObject :: TextureObject }
makeLenses ''VAO