Continue shader refactor
This commit is contained in:
+5
-13
@@ -5,6 +5,7 @@ module Preload.Render (
|
|||||||
cleanUpRenderPreload,
|
cleanUpRenderPreload,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Shader.Parameters
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
@@ -18,7 +19,6 @@ import Shader
|
|||||||
import Shader.AuxAddition
|
import Shader.AuxAddition
|
||||||
import Shader.Compile
|
import Shader.Compile
|
||||||
import Shader.Data
|
import Shader.Data
|
||||||
import Shader.Parameters
|
|
||||||
import Shape.Data
|
import Shape.Data
|
||||||
|
|
||||||
{- BINDING LIST:
|
{- BINDING LIST:
|
||||||
@@ -68,7 +68,7 @@ preloadRender = do
|
|||||||
|
|
||||||
-- setup shape geometry/cap VBO and two VAOs
|
-- setup shape geometry/cap VBO and two VAOs
|
||||||
putStrLn "Setup shape VBO, VAO, EBO"
|
putStrLn "Setup shape VBO, VAO, EBO"
|
||||||
shVBO <- setupVBO nShapeVerxComp
|
shVBO <- setupVBO (nShapeVerxComp)
|
||||||
shPosVAO <- setupVAOUsingVBO [VertexAttribute 4 GL_FLOAT GL_FALSE 0] shVBO
|
shPosVAO <- setupVAOUsingVBO [VertexAttribute 4 GL_FLOAT GL_FALSE 0] shVBO
|
||||||
shEBO <- setupEBO shPosVAO
|
shEBO <- setupEBO shPosVAO
|
||||||
-- note the shape shader vao is distinct from the position vao, but they
|
-- note the shape shader vao is distinct from the position vao, but they
|
||||||
@@ -83,8 +83,8 @@ preloadRender = do
|
|||||||
|
|
||||||
putStrLn "Setup wall/windows VBO, VAO, EBO, shader"
|
putStrLn "Setup wall/windows VBO, VAO, EBO, shader"
|
||||||
let wallverxstrd = 8
|
let wallverxstrd = 8
|
||||||
wallvbo <- setupVBO wallverxstrd
|
wallvbo <- setupVBO (wallverxstrd)
|
||||||
winvbo <- setupVBO 8
|
winvbo <- setupVBO (8)
|
||||||
windowshader <- makeShaderUsingVBO "wall/blank" [vert, geom, frag] (toFloatVAs [4, 4]) pmPoints winvbo
|
windowshader <- makeShaderUsingVBO "wall/blank" [vert, geom, frag] (toFloatVAs [4, 4]) pmPoints winvbo
|
||||||
wallshader <- makeShaderUsingVBO "wall/basic" [vert, geom, frag] (toFloatVAs [4, 4]) pmPoints wallvbo
|
wallshader <- makeShaderUsingVBO "wall/basic" [vert, geom, frag] (toFloatVAs [4, 4]) pmPoints wallvbo
|
||||||
putStrLn "Setup lighting shaders"
|
putStrLn "Setup lighting shaders"
|
||||||
@@ -124,15 +124,7 @@ preloadRender = do
|
|||||||
--initTexture2DArray 50 "data/texture/charMapVertBig.png" 2 32 64 95 GL_LINEAR_MIPMAP_NEAREST GL_LINEAR
|
--initTexture2DArray 50 "data/texture/charMapVertBig.png" 2 32 64 95 GL_LINEAR_MIPMAP_NEAREST GL_LINEAR
|
||||||
|
|
||||||
putStrLn "Setup full screen shaders"
|
putStrLn "Setup full screen shaders"
|
||||||
-- screentexturevbo <- mglCreate glCreateBuffers
|
(_,screentexturevao) <- setupStaticVBOVAO (toFloatVAs [2,2]) (concat cornerList)
|
||||||
-- withArray (concat cornerList) $ \ptr ->
|
|
||||||
-- glNamedBufferStorage
|
|
||||||
-- screentexturevbo
|
|
||||||
-- (fromIntegral $ floatSize * length (concat cornerList))
|
|
||||||
-- ptr
|
|
||||||
-- 0
|
|
||||||
-- screentexturevao <- setupVAOvbo (toFloatVAs [2, 2]) 4 screentexturevbo
|
|
||||||
(_,screentexturevao) <- setupStaticVBO (toFloatVAs [2,2]) (concat cornerList)
|
|
||||||
alphadivideshader <- makeShaderUsingVAO "texture2D/alphaDivide" [vert, frag] pmTriangleStrip screentexturevao
|
alphadivideshader <- makeShaderUsingVAO "texture2D/alphaDivide" [vert, frag] pmTriangleStrip screentexturevao
|
||||||
fsShad <- makeShaderUsingVAO "texture/simple" [vert, frag] pmTriangleStrip screentexturevao
|
fsShad <- makeShaderUsingVAO "texture/simple" [vert, frag] pmTriangleStrip screentexturevao
|
||||||
bloomBlurShad <- makeShaderUsingVAO "texture/bloomBlur" [vert, frag] pmTriangleStrip screentexturevao
|
bloomBlurShad <- makeShaderUsingVAO "texture/bloomBlur" [vert, frag] pmTriangleStrip screentexturevao
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ module Shader.Compile (
|
|||||||
setupVertexAttribPointer,
|
setupVertexAttribPointer,
|
||||||
makeSourcedShader,
|
makeSourcedShader,
|
||||||
toFloatVAs,
|
toFloatVAs,
|
||||||
setupStaticVBO
|
setupStaticVBOVAO
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Foreign.C.Types
|
import Foreign.C.Types
|
||||||
@@ -104,8 +104,8 @@ setupVBO vertexsize = do
|
|||||||
-- the input ptr is assumed to contain the correct amount of data according to
|
-- the input ptr is assumed to contain the correct amount of data according to
|
||||||
-- the specified number and type of vertices
|
-- the specified number and type of vertices
|
||||||
-- note the VBO here does not have a sensible ptr value
|
-- note the VBO here does not have a sensible ptr value
|
||||||
setupStaticVBO :: Storable a => [VertexAttribute] -> [a] -> IO (VBO,VAO)
|
setupStaticVBOVAO :: Storable a => [VertexAttribute] -> [a] -> IO (VBO,VAO)
|
||||||
setupStaticVBO vas vdata = withArrayLen vdata $ \i ptr -> do
|
setupStaticVBOVAO vas vdata = withArrayLen vdata $ \i ptr -> do
|
||||||
vboname <- mglCreate glCreateBuffers
|
vboname <- mglCreate glCreateBuffers
|
||||||
glNamedBufferStorage
|
glNamedBufferStorage
|
||||||
vboname
|
vboname
|
||||||
|
|||||||
Reference in New Issue
Block a user