Initial pass at shadows from level geometry

This commit is contained in:
jgk
2021-06-29 15:27:26 +02:00
parent 089dcc3f5d
commit 3d16c33d33
20 changed files with 181 additions and 74 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ makeShader
:: String -- ^ First part of the name of the shader
-> [ShaderType] -- ^ Filetype extensions
-> [Int] -- ^ The input vertex sizes
-> PrimitiveMode
-> EPrimitiveMode
-> (RenderType -> [[Float]]) -- ^ Poke strategy: method for creating a list of vertex data to be bound
-> IO FullShader
makeShader s shaderlist sizes pm renStrat = do
+17 -1
View File
@@ -7,6 +7,7 @@ module Shader.Data
, VBO (..)
, FullShader (..)
, ShaderTexture (..)
, EPrimitiveMode (..)
-- | Lens functions
, vao
, vaoVBO
@@ -25,6 +26,7 @@ import Picture.Data
import Graphics.Rendering.OpenGL
import Foreign
import Control.Lens
--import Graphics.GL.Types
{- | Vertex array object: contains the reference to the object,
and its buffer targets. -}
data VAO = VAO
@@ -46,7 +48,7 @@ data FullShader = FullShader
{ _shaderProgram :: Program
, _shaderVAO :: VAO
, _shaderPokeStrategy :: RenderType -> [[Float]]-- -> F.FoldM IO RenderType Int
, _shaderDrawPrimitive :: PrimitiveMode
, _shaderDrawPrimitive :: EPrimitiveMode
, _shaderTexture :: Maybe ShaderTexture
, _shaderCustomUnis :: [UniformLocation]
}
@@ -54,5 +56,19 @@ data FullShader = FullShader
newtype ShaderTexture = ShaderTexture
{ _textureObject :: TextureObject }
data EPrimitiveMode
= EPoints
| ELines
| ELinesAdjacency
| ELineLoop
| ELineStrip
| ETriangles
| ETriangleStrip
| ETriangleFan
| EQuads
| EQuadStrip
| EPolygon
| EPatches
makeLenses ''VAO
makeLenses ''FullShader
+21
View File
@@ -0,0 +1,21 @@
module Shader.ExtraPrimitive
where
import Shader.Data
import Graphics.GL.Types
import Graphics.GL.Tokens
marshalEPrimitiveMode :: EPrimitiveMode -> GLenum
marshalEPrimitiveMode x = case x of
EPoints -> GL_POINTS
ELines -> GL_LINES
ELinesAdjacency -> GL_LINES_ADJACENCY
ELineLoop -> GL_LINE_LOOP
ELineStrip -> GL_LINE_STRIP
ETriangles -> GL_TRIANGLES
ETriangleStrip -> GL_TRIANGLE_STRIP
ETriangleFan -> GL_TRIANGLE_FAN
EQuads -> GL_QUADS
EQuadStrip -> GL_QUAD_STRIP
EPolygon -> GL_POLYGON
EPatches -> GL_PATCHES