Cleanup
This commit is contained in:
@@ -2,7 +2,7 @@ module Dodge.Render.Shadow where
|
||||
|
||||
import Shader.Parameters
|
||||
import Shader.ExtraPrimitive
|
||||
import Graphics.Rendering.OpenGL ( ($=), bindVertexArrayObject, bindBuffer
|
||||
import Graphics.Rendering.OpenGL ( ($=), bindBuffer
|
||||
, BufferTarget (..), bufferSubData, TransferDirection (..)
|
||||
)
|
||||
import Graphics.GL.Core43
|
||||
|
||||
@@ -19,7 +19,6 @@ import qualified Data.Vector.Unboxed.Mutable as UMV
|
||||
import qualified Data.Vector.Mutable as MV
|
||||
import Control.Monad.Primitive
|
||||
import Foreign
|
||||
import Graphics.Rendering.OpenGL hiding (Point,translate,scale,imageHeight)
|
||||
import Graphics.GL.Core45
|
||||
|
||||
drawShaderLay :: Int -> UMV.MVector (PrimState IO) Int -> Int -> FullShader' -> IO ()
|
||||
|
||||
+9
-48
@@ -2,20 +2,17 @@ module Shader.Compile (
|
||||
makeShader,
|
||||
makeByteStringShaderUsingVAO,
|
||||
makeShaderSized,
|
||||
-- makeShaderUsingShaderVAO,
|
||||
makeShaderUsingVAO,
|
||||
setupVAO,
|
||||
setupVertexAttribPointer,
|
||||
) where
|
||||
|
||||
import GLHelp
|
||||
import Control.Monad
|
||||
import qualified Data.ByteString as BS
|
||||
import qualified Data.ByteString.Unsafe as BU
|
||||
import Foreign
|
||||
import Foreign.C.String
|
||||
--import Control.Lens
|
||||
|
||||
import GLHelp
|
||||
import Graphics.GL.Core45
|
||||
import Graphics.Rendering.OpenGL hiding (Point, imageHeight, scale, translate)
|
||||
import Shader.Data
|
||||
@@ -102,7 +99,7 @@ makeShaderSized ::
|
||||
IO FullShader'
|
||||
makeShaderSized s shaderlist sizes ndraw pm = do
|
||||
prog <- makeSourcedShader s shaderlist
|
||||
vaob <- setupVAOSized sizes ndraw
|
||||
vaob <- setupVAOSized ndraw sizes
|
||||
return $
|
||||
FullShader'
|
||||
{ _shadProg' = prog
|
||||
@@ -129,57 +126,21 @@ shaderTypeExt' _ = undefined
|
||||
|
||||
-- I think that this requires that the correct shader program is bound?
|
||||
setupVAO :: [Int] -> IO VAO
|
||||
setupVAO sizes = do
|
||||
--theVAO <- genObjectName
|
||||
--bindVertexArrayObject $= Just theVAO
|
||||
setupVAO = setupVAOSized numDrawableElements
|
||||
|
||||
setupVAOSized :: Int -> [Int] -> IO VAO
|
||||
setupVAOSized ndraw sizes = do
|
||||
vaoname <- mglCreateSingle glGenVertexArrays
|
||||
glBindVertexArray vaoname
|
||||
theVBO <- setupVBO sizes
|
||||
theVBO <- setupVBOSized ndraw sizes
|
||||
return $
|
||||
VAO
|
||||
{ _vaoName = vaoname
|
||||
, _vaoVBO = theVBO
|
||||
}
|
||||
|
||||
setupVAOSized :: [Int] -> Int -> IO VAO
|
||||
setupVAOSized sizes ndraw = do
|
||||
vaoname <- mglCreateSingle glGenVertexArrays
|
||||
glBindVertexArray vaoname
|
||||
-- theVAO <- genObjectName
|
||||
--bindVertexArrayObject $= Just theVAO
|
||||
theVBO <- setupVBOSized sizes ndraw
|
||||
return $
|
||||
VAO
|
||||
{ _vaoName = vaoname
|
||||
, _vaoVBO = theVBO
|
||||
}
|
||||
|
||||
setupVBO :: [Int] -> IO VBO
|
||||
setupVBO sizes = do
|
||||
vboName <- genObjectName
|
||||
bindBuffer ArrayBuffer $= Just vboName
|
||||
forM_ (zip3 [0 ..] sizes offs) $ \(loc, siz, off) -> do
|
||||
setupVertexAttribPointer loc siz strd off
|
||||
thePtr <- mallocArray (strd * numDrawableElements)
|
||||
-- Allocate space
|
||||
bufferData ArrayBuffer
|
||||
$= ( fromIntegral $ floatSize * numDrawableElements * strd
|
||||
, nullPtr
|
||||
, StreamDraw
|
||||
)
|
||||
return $
|
||||
VBO
|
||||
{ _vbo = vboName
|
||||
, _vboPtr = thePtr
|
||||
, _vboAttribSizes = sizes
|
||||
, _vboStride = sum sizes
|
||||
}
|
||||
where
|
||||
strd = sum sizes
|
||||
offs = scanl (+) 0 sizes
|
||||
|
||||
setupVBOSized :: [Int] -> Int -> IO VBO
|
||||
setupVBOSized sizes ndraw = do
|
||||
setupVBOSized :: Int -> [Int] -> IO VBO
|
||||
setupVBOSized ndraw sizes = do
|
||||
vboName <- genObjectName
|
||||
bindBuffer ArrayBuffer $= Just vboName
|
||||
forM_ (zip3 [0 ..] sizes offs) $ \(loc, siz, off) -> do
|
||||
|
||||
Reference in New Issue
Block a user