From 97598bc17156be002c389a95b364e3c51df05ff8 Mon Sep 17 00:00:00 2001 From: jgk Date: Thu, 24 Jun 2021 17:58:15 +0200 Subject: [PATCH] Replace explicit matrix uniforms with single ubo --- shader/background.vert | 1 - shader/lighting/floor.geom | 12 ++++---- shader/lighting/floor.vert | 1 - shader/lighting/occlude.frag | 1 - shader/lighting/occlude.geom | 22 +++++++------- shader/lighting/occlude.vert | 1 - shader/lighting/wall.frag | 3 -- shader/lighting/wall.geom | 13 ++++----- shader/lighting/wall.vert | 1 - shader/texture/array.frag | 2 -- shader/texture/array.vert | 6 ++-- shader/texture/boxBlur.vert | 1 - shader/texture/grayscale.vert | 1 - shader/texture/simple.vert | 1 - shader/texture/simpleWorld.vert | 6 ++-- shader/wall/blank.geom | 13 ++++----- shader/wall/blank.vert | 2 -- shader/wall/texture.frag | 4 --- shader/wall/texture.geom | 13 ++++----- shader/wall/texture.vert | 2 -- src/Dodge/Render.hs | 9 +----- src/Picture/Render.hs | 20 ------------- src/Preload/Render.hs | 15 ---------- src/Shader.hs | 51 --------------------------------- src/Shader/Compile.hs | 10 +++---- src/Shader/Data.hs | 2 -- 26 files changed, 39 insertions(+), 174 deletions(-) diff --git a/shader/background.vert b/shader/background.vert index 14710c32e..879051755 100644 --- a/shader/background.vert +++ b/shader/background.vert @@ -1,7 +1,6 @@ #version 430 core layout (location = 0) in vec4 params; layout (location = 1) in vec2 texCoor; -uniform mat4 worldMat; void main() { gl_Position = vec4(0,0,0,0); diff --git a/shader/lighting/floor.geom b/shader/lighting/floor.geom index 7bf87da54..e6390de65 100644 --- a/shader/lighting/floor.geom +++ b/shader/lighting/floor.geom @@ -1,11 +1,9 @@ #version 430 core layout (points) in; layout (triangle_strip, max_vertices = 4) out; +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; out float lum; out vec2 dField; - -uniform mat4 worldMat; - void main() { lum = gl_in[0].gl_Position.w; @@ -13,16 +11,16 @@ void main() float gRad = gl_in[0].gl_Position.z; dField = vec2 ( 1, 1); - gl_Position = worldMat * vec4 (cenPos.x + gRad, cenPos.y + gRad, -0 , 1); + gl_Position = theMat * vec4 (cenPos.x + gRad, cenPos.y + gRad, -0 , 1); EmitVertex(); dField = vec2 (-1, 1); - gl_Position = worldMat * vec4 (cenPos.x - gRad, cenPos.y + gRad, -0 , 1); + gl_Position = theMat * vec4 (cenPos.x - gRad, cenPos.y + gRad, -0 , 1); EmitVertex(); dField = vec2 ( 1,-1); - gl_Position = worldMat * vec4 (cenPos.x + gRad, cenPos.y - gRad, -0 , 1); + gl_Position = theMat * vec4 (cenPos.x + gRad, cenPos.y - gRad, -0 , 1); EmitVertex(); dField = vec2 (-1,-1); - gl_Position = worldMat * vec4 (cenPos.x - gRad, cenPos.y - gRad, -0 , 1); + gl_Position = theMat * vec4 (cenPos.x - gRad, cenPos.y - gRad, -0 , 1); EmitVertex(); EndPrimitive(); diff --git a/shader/lighting/floor.vert b/shader/lighting/floor.vert index 6d5720315..65bedf150 100644 --- a/shader/lighting/floor.vert +++ b/shader/lighting/floor.vert @@ -1,6 +1,5 @@ #version 430 core layout (location = 0) in vec4 position; -uniform mat4 worldMat; void main() { gl_Position = position; diff --git a/shader/lighting/occlude.frag b/shader/lighting/occlude.frag index 5cb2ddb82..f2d723b40 100644 --- a/shader/lighting/occlude.frag +++ b/shader/lighting/occlude.frag @@ -1,6 +1,5 @@ #version 430 core out vec4 fColor; - void main() { fColor = vec4 (0.9,0.5,0,0); diff --git a/shader/lighting/occlude.geom b/shader/lighting/occlude.geom index 4f86b6432..38e798c13 100644 --- a/shader/lighting/occlude.geom +++ b/shader/lighting/occlude.geom @@ -1,11 +1,9 @@ #version 430 core layout (points) in; layout (triangle_strip, max_vertices = 11) out; - +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; uniform vec2 lightPos; -uniform mat4 worldMat; - -vec2 lightPosa = ( worldMat * vec4(lightPos,0,1) ).xy; +vec2 lightPosa = ( theMat * vec4(lightPos,0,1) ).xy; vec4 shift (vec4 p) { return vec4 (p.xy + (200 * (p.xy-lightPos)), 0 , 1); @@ -28,14 +26,14 @@ vec4 p6 = shift(p2); vec4 p7 = vec4 (p6.xy,-0.5,1); vec4 p8 = vec4 (p5.xy,-0.5,1); -vec4 a1 = worldMat * p1; -vec4 a2 = worldMat * p2; -vec4 a3 = worldMat * p3; -vec4 a4 = worldMat * p4; -vec4 a5 = worldMat * p5; -vec4 a6 = worldMat * p6; -vec4 a7 = worldMat * p7; -vec4 a8 = worldMat * p8; +vec4 a1 = theMat * p1; +vec4 a2 = theMat * p2; +vec4 a3 = theMat * p3; +vec4 a4 = theMat * p4; +vec4 a5 = theMat * p5; +vec4 a6 = theMat * p6; +vec4 a7 = theMat * p7; +vec4 a8 = theMat * p8; gl_Position = a4; EmitVertex(); gl_Position = a3; EmitVertex(); diff --git a/shader/lighting/occlude.vert b/shader/lighting/occlude.vert index 15bfe7fc0..6e6f93483 100644 --- a/shader/lighting/occlude.vert +++ b/shader/lighting/occlude.vert @@ -1,6 +1,5 @@ #version 430 core layout (location = 0) in vec4 poss; - void main() { gl_Position = poss; diff --git a/shader/lighting/wall.frag b/shader/lighting/wall.frag index 935723836..417b6f6b9 100644 --- a/shader/lighting/wall.frag +++ b/shader/lighting/wall.frag @@ -1,11 +1,8 @@ #version 430 core in vec2 cenPosT; in float lum; - in vec3 dField; - out vec4 fColor; - void main() { float c = pow (1 - min(1, dot(dField,dField)) , 2) * lum ; diff --git a/shader/lighting/wall.geom b/shader/lighting/wall.geom index 56ff79df5..3041a59c3 100644 --- a/shader/lighting/wall.geom +++ b/shader/lighting/wall.geom @@ -1,14 +1,11 @@ #version 430 core layout (points) in; layout (triangle_strip, max_vertices = 4) out; - +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; out vec3 dField; out float lum; - uniform vec2 lightPos; -uniform mat4 worldMat; uniform vec2 radLum; - float isLHS (vec2 startV, vec2 testV) { return sign( -startV.x * testV.y + startV.y * testV.x); @@ -31,10 +28,10 @@ if (isLHS (p1.xy - lightPos, p2.xy - lightPos) < 0) vec2 d1 = p1.xy - lightPos; vec2 d2 = p2.xy - lightPos; - vec4 a1 = shiftCloser( worldMat * p1 ); - vec4 a2 = shiftCloser( worldMat * p2 ); - vec4 a3 = shiftCloser( worldMat * p3 ); - vec4 a4 = shiftCloser( worldMat * p4 ); + vec4 a1 = shiftCloser( theMat * p1 ); + vec4 a2 = shiftCloser( theMat * p2 ); + vec4 a3 = shiftCloser( theMat * p3 ); + vec4 a4 = shiftCloser( theMat * p4 ); dField = vec3( d1.x/rad, d1.y/rad, 0); gl_Position = a1; diff --git a/shader/lighting/wall.vert b/shader/lighting/wall.vert index 15bfe7fc0..6e6f93483 100644 --- a/shader/lighting/wall.vert +++ b/shader/lighting/wall.vert @@ -1,6 +1,5 @@ #version 430 core layout (location = 0) in vec4 poss; - void main() { gl_Position = poss; diff --git a/shader/texture/array.frag b/shader/texture/array.frag index e7bdbc44c..5284df547 100644 --- a/shader/texture/array.frag +++ b/shader/texture/array.frag @@ -1,9 +1,7 @@ #version 430 core in vec3 vTexPos; out vec4 fColor; - uniform sampler2DArray tilesetSampler; - void main() { fColor = texture(tilesetSampler, vTexPos); diff --git a/shader/texture/array.vert b/shader/texture/array.vert index f0754f08e..40cd50f76 100644 --- a/shader/texture/array.vert +++ b/shader/texture/array.vert @@ -1,12 +1,10 @@ #version 430 core layout (location = 0) in vec3 pos; layout (location = 1) in vec3 texPos; +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; out vec3 vTexPos; - -uniform mat4 worldMat; - void main() { - gl_Position = worldMat * vec4(pos,1.0) ; + gl_Position = theMat * vec4(pos,1.0) ; vTexPos = texPos; } diff --git a/shader/texture/boxBlur.vert b/shader/texture/boxBlur.vert index 3b5b6116b..dc9e41d80 100644 --- a/shader/texture/boxBlur.vert +++ b/shader/texture/boxBlur.vert @@ -2,7 +2,6 @@ layout (location = 0) in vec2 pos; layout (location = 1) in vec2 texPos; out vec2 vTexPos; - void main() { gl_Position = vec4(pos,0,1); diff --git a/shader/texture/grayscale.vert b/shader/texture/grayscale.vert index 3b5b6116b..dc9e41d80 100644 --- a/shader/texture/grayscale.vert +++ b/shader/texture/grayscale.vert @@ -2,7 +2,6 @@ layout (location = 0) in vec2 pos; layout (location = 1) in vec2 texPos; out vec2 vTexPos; - void main() { gl_Position = vec4(pos,0,1); diff --git a/shader/texture/simple.vert b/shader/texture/simple.vert index 3b5b6116b..dc9e41d80 100644 --- a/shader/texture/simple.vert +++ b/shader/texture/simple.vert @@ -2,7 +2,6 @@ layout (location = 0) in vec2 pos; layout (location = 1) in vec2 texPos; out vec2 vTexPos; - void main() { gl_Position = vec4(pos,0,1); diff --git a/shader/texture/simpleWorld.vert b/shader/texture/simpleWorld.vert index d6179b042..34a1bdaa6 100644 --- a/shader/texture/simpleWorld.vert +++ b/shader/texture/simpleWorld.vert @@ -1,12 +1,10 @@ #version 430 core layout (location = 0) in vec3 pos; layout (location = 1) in vec2 texPos; +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; out vec2 vTexPos; - -uniform mat4 worldMat; - void main() { - gl_Position = worldMat * vec4(pos,1.0) ; + gl_Position = theMat * vec4(pos,1.0) ; vTexPos = texPos; } diff --git a/shader/wall/blank.geom b/shader/wall/blank.geom index aa7f69468..d73c224fa 100644 --- a/shader/wall/blank.geom +++ b/shader/wall/blank.geom @@ -1,12 +1,9 @@ #version 430 core layout (points) in; layout (triangle_strip, max_vertices = 4) out; - +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; in vec4 vColor []; out vec4 gColor; - -uniform mat4 worldMat; - // consider using isLHS to check if the wall is facing the center // this needs the view from point float isLHS (vec2 startV, vec2 testV) @@ -21,16 +18,16 @@ void main() vec4 p1 = vec4 (gl_in[0].gl_Position.xy,0,1); vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0,1); - vec4 a1 = worldMat * p1; - vec4 a2 = worldMat * p2; + vec4 a1 = theMat * p1; + vec4 a2 = theMat * p2; // if (0 > isLHS (a1.xy - a2.xy, a1.xy - "viewFromPoint")) { vec4 p3 = vec4 (p1.xy,-0.5,1); vec4 p4 = vec4 (p2.xy,-0.5,1); - vec4 a3 = worldMat * p3; - vec4 a4 = worldMat * p4; + vec4 a3 = theMat * p3; + vec4 a4 = theMat * p4; gl_Position = a1; EmitVertex(); gl_Position = a3; EmitVertex(); diff --git a/shader/wall/blank.vert b/shader/wall/blank.vert index 0456509f9..052c35659 100644 --- a/shader/wall/blank.vert +++ b/shader/wall/blank.vert @@ -1,9 +1,7 @@ #version 430 core layout (location = 0) in vec4 poss; layout (location = 1) in vec4 color; - out vec4 vColor; - void main() { gl_Position = poss; diff --git a/shader/wall/texture.frag b/shader/wall/texture.frag index 923312dcc..dfc5103be 100644 --- a/shader/wall/texture.frag +++ b/shader/wall/texture.frag @@ -1,13 +1,9 @@ #version 430 core in vec2 tPos; in vec4 gColor; - uniform sampler2D tex; - out vec4 fColor; - void main() { fColor = gColor * texture(tex,tPos); -// fColor = gColor; } diff --git a/shader/wall/texture.geom b/shader/wall/texture.geom index 266ba158f..10393a97a 100644 --- a/shader/wall/texture.geom +++ b/shader/wall/texture.geom @@ -1,13 +1,10 @@ #version 430 core layout (points) in; layout (triangle_strip, max_vertices = 4) out; - +layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ; in vec4 vColor []; out vec4 gColor; out vec2 tPos; - -uniform mat4 worldMat; - // consider using isLHS to check if the wall is facing the center float isLHS (vec2 startV, vec2 testV) { @@ -23,10 +20,10 @@ vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0,1); vec4 p3 = vec4 (p1.xy,-0.3,1); vec4 p4 = vec4 (p2.xy,-0.3,1); -vec4 a1 = worldMat * p1; -vec4 a2 = worldMat * p2; -vec4 a3 = worldMat * p3; -vec4 a4 = worldMat * p4; +vec4 a1 = theMat * p1; +vec4 a2 = theMat * p2; +vec4 a3 = theMat * p3; +vec4 a4 = theMat * p4; tPos = vec2 ( 1,-1) ; gl_Position = a1; EmitVertex(); tPos = vec2 ( 1, 1) ; gl_Position = a3; EmitVertex(); diff --git a/shader/wall/texture.vert b/shader/wall/texture.vert index 0456509f9..052c35659 100644 --- a/shader/wall/texture.vert +++ b/shader/wall/texture.vert @@ -1,9 +1,7 @@ #version 430 core layout (location = 0) in vec4 poss; layout (location = 1) in vec4 color; - out vec4 vColor; - void main() { gl_Position = poss; diff --git a/src/Dodge/Render.hs b/src/Dodge/Render.hs index 5457d14de..4632a1e26 100644 --- a/src/Dodge/Render.hs +++ b/src/Dodge/Render.hs @@ -56,6 +56,7 @@ doDrawing pdata w = do pic = worldPictures w wallPoints = map fst wallPointsCol + -- set the coordinate uniform ready for drawing elements using world coordinates let pmat = perspectiveMatrixb rot camzoom trans wins viewFroms withArray pmat $ \ptr -> bufferData UniformBuffer $= @@ -64,9 +65,6 @@ doDrawing pdata w = do ,StreamDraw ) - -- set the coordinate uniforms ready for drawing elements using world coordinates - --setIsoMatrixUniforms pdata rot camzoom trans wins - setPerpMatrixUniforms pdata rot camzoom trans wins viewFroms depthFunc $= Just Less -- draw the lightmap. Probably changes the bound framebufferObject createLightMap pdata (w ^. config . shadow_resolution) wallPoints lightPoints viewFroms @@ -109,7 +107,6 @@ doDrawing pdata w = do renderBlankWalls pdata windowPoints depthMask $= Enabled - forM_ (_pictureShaders pdata) $ setPerpMatUniform rot camzoom trans wins viewFroms depthFunc $= Just Lequal _ <- renderFoldable pdata $ picToLTree (Just 0) (foregroundPics w) @@ -132,10 +129,6 @@ doDrawing pdata w = do drawShader (_grayscaleShader pdata) 4 blend $= Enabled - -- reset the coordinate uniforms for pictures that are drawn wrt to window - -- coordinates - resetShaderUniforms (map extractProgAndUnis $ _pictureShaders pdata) - let pmata = perspectiveMatrixc 0 1 (0,0) (2,2) withArray pmata $ \ptr -> bufferData UniformBuffer $= diff --git a/src/Picture/Render.hs b/src/Picture/Render.hs index c1bfd773e..420ab6150 100644 --- a/src/Picture/Render.hs +++ b/src/Picture/Render.hs @@ -195,26 +195,6 @@ renderBackground pdata rot camZoom (tranx,trany) (winx,winy) = do textureBinding Texture2D $= _textureObject <$> _shaderTexture (_backgroundShader pdata) drawArrays Points 0 1 -setPerpMatrixUniforms - :: RenderData - -> Float -- ^ Rotation - -> Float -- ^ Zoom - -> (Float,Float) -- ^ Translation - -> (Float,Float) -- ^ Window size - -> (Float,Float) -- ^ ViewFrom - -> IO () -setPerpMatrixUniforms pdata rot czoom trans wins vfs = mapM_ (setPerpMatUniform rot czoom trans wins vfs) - ( _lightingFloorShader pdata - : _lightingWallShader pdata - : _lightingOccludeShader pdata - : _backgroundShader pdata - : _textureShader pdata - : _textureArrayShader pdata - : _wallBlankShader pdata - : _wallTextureShader pdata - : _pictureShaders pdata - ) - renderShader :: Foldable f => FullShader diff --git a/src/Preload/Render.hs b/src/Preload/Render.hs index 223e0c2e9..91b32edbf 100644 --- a/src/Preload/Render.hs +++ b/src/Preload/Render.hs @@ -56,15 +56,12 @@ preloadRender = do -- textured wallShader wlTexture <- makeShader "wall/texture" [vert,geom,frag] [4,4] Points pokeWPColStrat >>= addTexture "data/texture/grayscaleDirt.png" - ---- texture shader textShad <- makeShader "texture/simpleWorld" [vert,frag] [3,2] Triangles poke32 >>= addTexture "data/texture/ayene_wooden_floor.png" - ---- texture array shader textArrayShad <- makeShader "texture/array" [vert,frag] [3,3] Triangles poke33 >>= addTextureArray "data/texture/ayene_wooden_floor.png" - -- framebuffer for lighting (fbo,fboTO,fboRBO) <- setupFramebufferWithStencil framebuf2 <- setupFramebufferWithStencil @@ -91,7 +88,6 @@ preloadRender = do , _fbo3 = framebuf3 , _matUBO = theUBO } - cornerList :: [[Float]] cornerList = [[-1, 1,0,1] @@ -99,17 +95,6 @@ cornerList = ,[-1,-1,0,0] ,[ 1,-1,1,0] ] --- potential drawing setup ----- swapInterval $= ImmediateUpdates --- GL.blend $= GL.Enabled ----- GL.depthMask $= GL.Enabled --- GL.blendEquation $= GL.FuncAdd --- GL.blendFunc $= (GL.SrcAlpha,GL.OneMinusSrcAlpha) --- GL.clearColor $= GL.Color4 0 0.5 0 1 --- GL.clearDepth $= (200) --- swapInterval $= ImmediateUpdates --- GL.lineSmooth $= GL.Enabled - --------------------end preloadRender setupFramebufferWithStencil :: IO (FramebufferObject, TextureObject,RenderbufferObject) diff --git a/src/Shader.hs b/src/Shader.hs index 16ce371e4..8f9d28d87 100644 --- a/src/Shader.hs +++ b/src/Shader.hs @@ -3,11 +3,7 @@ module Shader , bindShaderBuffers , drawShader , drawShaders - , setShaderUniforms - , resetShaderUniforms - , extractProgAndUnis , freeShaderPointers - , setPerpMatUniform ) where import Geometry.Data import Shader.Data @@ -21,9 +17,6 @@ import Graphics.Rendering.OpenGL hiding (Point,translate,scale,imageHeight) import Linear.Matrix import Linear.V4 -extractProgAndUnis :: FullShader -> (Program,UniformLocation) -extractProgAndUnis s = (_shaderProgram s, _shaderMatrixUniform s) - bindArrayBuffers :: Int -> VBO -> IO () bindArrayBuffers numVs theVBO = do bindBuffer ArrayBuffer $= Just (_vbo theVBO) @@ -49,49 +42,5 @@ drawShader fs i = do _ -> return () drawArrays (_shaderDrawPrimitive fs) 0 (fromIntegral i) -resetShaderUniforms :: [(Program, UniformLocation)] -> IO () -{-# INLINE resetShaderUniforms #-} -resetShaderUniforms = setShaderUniforms 0 1 (0,0) (2,2) - -setShaderUniforms :: Float -> Float -> Point2 -> Point2 -> [(Program,UniformLocation)] -> IO () -{-# INLINE setShaderUniforms #-} -setShaderUniforms rot czoom (tranx,trany) (winx,winy) fss = do - let scalMat = Linear.Matrix.transpose $ - V4 (V4 (2*czoom/winx) 0 0 (0::GLfloat)) - (V4 0 (2*czoom/winy) 0 0) - (V4 0 0 1 0) - (V4 0 0 0 1) - let rotMat = Linear.Matrix.transpose $ - V4 (V4 (cos rot) (sin (-rot)) 0 0) - (V4 (sin rot) (cos rot) 0 0) - (V4 0 0 1 0) - (V4 0 0 0 1) - let tranMat = Linear.Matrix.transpose $ - V4 (V4 1 0 0 0) - (V4 0 1 0 0) - (V4 0 0 1 0) - (V4 (-tranx) (-trany) 0 1) - let wmat = scalMat !*! rotMat !*! tranMat - vToL (V4 a b c d) = [a,b,c,d] - wmata <- (newMatrix RowMajor $ concatMap vToL $ vToL wmat) :: IO (GLmatrix GLfloat) --- set common uniforms - forM_ fss $ \shad -> do - currentProgram $= Just (fst shad) - uniform (snd shad) $= wmata - -setPerpMatUniform - :: Float -- ^ rotation - -> Float -- ^ zoom - -> Point2 -- ^ translation - -> Point2 -- ^ window size - -> Point2 -- ^ viewfrom point - -> FullShader - -> IO () -setPerpMatUniform rot czoom trans wins vFrom shad = do - pmat <- (newMatrix RowMajor $ perspectiveMatrix rot czoom trans wins vFrom) :: IO (GLmatrix GLfloat) - currentProgram $= Just (_shaderProgram shad) - uniform (_shaderMatrixUniform shad) $= pmat - return () - freeShaderPointers :: FullShader -> IO () freeShaderPointers fs = free $ _vboPointer $ _vaoVBO $ _shaderVAO fs diff --git a/src/Shader/Compile.hs b/src/Shader/Compile.hs index d0a62daf9..47fe60e6c 100644 --- a/src/Shader/Compile.hs +++ b/src/Shader/Compile.hs @@ -25,11 +25,10 @@ makeShader -> (RenderType -> [[Float]]) -- ^ Poke strategy: method for creating a list of vertex data to be bound -> IO FullShader makeShader s shaderlist sizes pm renStrat = do - (prog,unis) <- makeSourcedShader s shaderlist - vaob <- setupVAO sizes + prog <- makeSourcedShader s shaderlist + vaob <- setupVAO sizes return $ FullShader { _shaderProgram = prog - , _shaderMatrixUniform = unis , _shaderVAO = vaob , _shaderPokeStrategy = renStrat , _shaderDrawPrimitive = pm @@ -40,12 +39,11 @@ makeShader s shaderlist sizes pm renStrat = do -- | Compile shader and get its uniform locations. -- supposes the shader code is in the shader folder, with the string names -- followed by .vert/.geom/.frag. -makeSourcedShader :: String -> [ShaderType] -> IO (Program, UniformLocation) +makeSourcedShader :: String -> [ShaderType] -> IO Program makeSourcedShader s sts = do sources <- forM sts $ \st -> BS.readFile ("shader/" ++ s ++ shaderTypeExt st) prog <- makeShaderProgram s $ zip sts sources - uniformLocations <- uniformLocation prog "worldMat" - return (prog,uniformLocations) + return prog shaderTypeExt :: ShaderType -> String shaderTypeExt VertexShader = ".vert" diff --git a/src/Shader/Data.hs b/src/Shader/Data.hs index ab532b135..117c628cb 100644 --- a/src/Shader/Data.hs +++ b/src/Shader/Data.hs @@ -12,7 +12,6 @@ module Shader.Data , vaoVBO , shaderProgram - , shaderMatrixUniform , shaderVAO , shaderPokeStrategy , shaderDrawPrimitive @@ -45,7 +44,6 @@ data VBO = VBO {- | Datatype containing the necessary information for a single shader. -} data FullShader = FullShader { _shaderProgram :: Program - , _shaderMatrixUniform :: UniformLocation , _shaderVAO :: VAO , _shaderPokeStrategy :: RenderType -> [[Float]]-- -> F.FoldM IO RenderType Int , _shaderDrawPrimitive :: PrimitiveMode