Simplify ceiling oclusions
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
#version 450 core
|
||||
layout (location = 0) in vec4 posID;
|
||||
layout (location = 1) in vec4 col;
|
||||
//layout (location = 2) in vec4 centerSize;
|
||||
layout (location = 2) in vec4 controls;
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
out vec4 vPosID;
|
||||
out vec4 vCol;
|
||||
//out vec4 vCenterSize;
|
||||
out vec4 vControls;
|
||||
void main()
|
||||
{
|
||||
gl_Position = theMat * vec4(posID.xyz,1);
|
||||
vPosID = posID;
|
||||
vCol = col;
|
||||
//vCenterSize = centerSize;
|
||||
vControls = controls;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#version 450 core
|
||||
layout(early_fragment_tests) in;
|
||||
layout(location=0)uniform vec3 lightPos;
|
||||
layout(location=1)uniform vec4 lumRad;
|
||||
layout (binding = 0) uniform sampler2D screenTexture;
|
||||
@@ -15,20 +16,11 @@ void main() {
|
||||
}
|
||||
vec4 normbit = texture(normals, vTexPos);
|
||||
vec3 norm = normbit.xyz;
|
||||
float y1 = dot(normalize(norm), normalize(distVec));
|
||||
float y1 = dot(norm, distVec);
|
||||
float y2 = float(y1 > 0 ? 1 : 0);
|
||||
//float y3 = clamp(0.5 * (y1 + 1),0,1) ;
|
||||
float y3 = clamp(2*y1 + 1,0,1) ;
|
||||
//float y3 = clamp(0.5 * (y1 + 2),0,1) ;
|
||||
//float y = float(normbit.w == 0 ? y3 : y2);
|
||||
float y = y2;
|
||||
//float x = 1 - dist / rad;
|
||||
float x = 1 - (pow(dist / rad,4));
|
||||
//float x = 1 ;
|
||||
//float x = 1 - (dist / rad);
|
||||
//float x = 1;
|
||||
//float x = 1 - max(0, ((dist + 10000) - rad) * 0.0001) ;
|
||||
//vec3 c = y* (x * x * x) * lumRad.rgb;
|
||||
vec3 c = y* x * lumRad.rgb;
|
||||
//vec3 c = x * lumRad.rgb;
|
||||
vec3 c = y2* x * lumRad.rgb;
|
||||
fColor = vec4(c, 0);
|
||||
}
|
||||
|
||||
@@ -67,10 +67,10 @@ void main() {
|
||||
|
||||
vec2 closeshift = (rad * normalize(closepoint - lightPos.xy)) + lightPos.xy - closepoint;
|
||||
vec2 shifto = (rad * normalize(closepoint - lightPos.xy)) + closepoint;
|
||||
//vec2 p1o = vec2( distance(p1,lightPos.xy) > rad ? p1 : shift(p1) );
|
||||
vec2 p1o = xoo;
|
||||
//vec2 p2o = vec2( distance(p2,lightPos.xy) > rad ? p2 : shift(p2) );
|
||||
vec2 p2o = yoo;
|
||||
vec2 p1o = vec2( distance(p1,lightPos.xy) > rad ? p1 : shift(p1) );
|
||||
//vec2 p1o = xoo;
|
||||
vec2 p2o = vec2( distance(p2,lightPos.xy) > rad ? p2 : shift(p2) );
|
||||
//vec2 p2o = yoo;
|
||||
|
||||
gl_Position = theMat * vec4(p1o,-500,1); EmitVertex();
|
||||
gl_Position = theMat * vec4(p1,-500,1); EmitVertex();
|
||||
|
||||
+39
-51
@@ -48,13 +48,9 @@ doDrawing' win pdata u = do
|
||||
checkGLError "during drawing"
|
||||
let w = _uvWorld u
|
||||
cfig = _uvConfig u
|
||||
rot = w ^. wCam . camRot
|
||||
camzoom = w ^. wCam . camZoom
|
||||
trans = w ^. wCam . camCenter
|
||||
wins = V2 (windowXFloat cfig) (windowYFloat cfig)
|
||||
(windowPoints, wallSPics, wallsToPoke) = wallsToDraw w
|
||||
lightPoints = lightsToRender cfig (w ^. wCam) (w ^. cWorld . lWorld)
|
||||
viewFroms@(V2 vfx vfy) = w ^. wCam . camViewFrom
|
||||
--(V2 vfx vfy) = w ^. wCam . camViewFrom
|
||||
shadV = _pictureShaders pdata
|
||||
nFls = w ^. cWorld . numberFloorVerxs
|
||||
nchs = w ^. cWorld . numberChasmVerxs
|
||||
@@ -98,7 +94,6 @@ doDrawing' win pdata u = do
|
||||
(pokeDust (pdata ^. cloudVBO . vboPtr) (pdata ^. cloudEBO . eboPtr))
|
||||
(nCloudVs', nCloudIs')
|
||||
(V.fromList $ w ^. cWorld . lWorld . dusts)
|
||||
|
||||
-- bind wall points, silhouette data, surface geometry
|
||||
bufferShaderLayers shadV pokeCounts
|
||||
mapM_
|
||||
@@ -115,8 +110,7 @@ doDrawing' win pdata u = do
|
||||
, (_silhouetteEBO pdata, nSilIndices)
|
||||
]
|
||||
-- set the coordinate uniform ready for drawing elements using world coordinates
|
||||
withArray (perspectiveMatrixb rot camzoom trans wins viewFroms) $
|
||||
glNamedBufferSubData (pdata ^. matUBO) 0 64
|
||||
bufferPerspectiveMatrixUBO cfig (w ^. wCam) (pdata ^. matUBO)
|
||||
setViewport _graphics_world_resolution cfig
|
||||
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboBase . _1 . unFBO)
|
||||
glDepthMask GL_TRUE
|
||||
@@ -131,27 +125,29 @@ doDrawing' win pdata u = do
|
||||
1
|
||||
0
|
||||
-- draw wall occlusions from the camera's point of view
|
||||
glDisable GL_CULL_FACE
|
||||
glEnable GL_STENCIL_TEST
|
||||
glStencilFunc GL_NOTEQUAL 128 255
|
||||
glStencilOp GL_KEEP GL_KEEP GL_REPLACE
|
||||
glEnable GL_CULL_FACE
|
||||
glCullFace GL_BACK
|
||||
unless (debugOn Remove_LOS cfig) $ do
|
||||
glUseProgram (pdata ^. ceilingStencilShader . shaderUINT)
|
||||
glProgramUniform3f
|
||||
(pdata ^. ceilingStencilShader . shaderUINT)
|
||||
0
|
||||
vfx
|
||||
vfy
|
||||
20
|
||||
glProgramUniform1f
|
||||
(pdata ^. ceilingStencilShader . shaderUINT)
|
||||
1
|
||||
1000 -- this should be the furthest on screen distance from the viewpoint
|
||||
-- glProgramUniform3f
|
||||
-- (pdata ^. ceilingStencilShader . shaderUINT)
|
||||
-- 0
|
||||
-- vfx
|
||||
-- vfy
|
||||
-- 20
|
||||
-- glProgramUniform1f
|
||||
-- (pdata ^. ceilingStencilShader . shaderUINT)
|
||||
-- 1
|
||||
-- 1000 -- this should be the furthest on screen distance from the viewpoint
|
||||
glBindVertexArray $ pdata ^. ceilingStencilShader . shaderVAO . vaoName
|
||||
glEnable GL_DEPTH_CLAMP
|
||||
glDrawArrays
|
||||
(_unPrimitiveMode $ pdata ^. ceilingStencilShader . shaderPrimitive)
|
||||
0
|
||||
(fromIntegral trueNWalls)
|
||||
glDisable GL_DEPTH_CLAMP
|
||||
glStencilMask 127 -- to alter last seven bits
|
||||
glStencilOp GL_KEEP GL_KEEP GL_KEEP
|
||||
-- clear color and normals
|
||||
@@ -162,7 +158,6 @@ doDrawing' win pdata u = do
|
||||
withArray [GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $
|
||||
glNamedFramebufferDrawBuffers (pdata ^. fboBase . _1 . unFBO) 3
|
||||
--draw walls onto base buffer
|
||||
-- maybe cull faces? maybe do this before?
|
||||
glEnable GL_CULL_FACE
|
||||
glCullFace GL_BACK
|
||||
glUseProgram (pdata ^. wallShader . shaderUINT)
|
||||
@@ -185,7 +180,7 @@ doDrawing' win pdata u = do
|
||||
glBindVertexArray $ pdata ^. chasmShader . shaderVAO . vaoName
|
||||
glDepthMask GL_FALSE
|
||||
glDrawBuffer GL_NONE
|
||||
glStencilOp GL_INCR GL_INCR GL_INCR
|
||||
glStencilOp GL_KEEP GL_KEEP GL_INCR
|
||||
with 0 $
|
||||
glClearNamedFramebufferiv
|
||||
(pdata ^. fboBase . _1 . unFBO)
|
||||
@@ -206,11 +201,9 @@ doDrawing' win pdata u = do
|
||||
(_unPrimitiveMode $ pdata ^. floorShader . shaderPrimitive)
|
||||
0
|
||||
(fromIntegral nFls)
|
||||
glDisable GL_STENCIL_TEST
|
||||
--glDisable GL_STENCIL_TEST
|
||||
glDisable GL_CULL_FACE
|
||||
glEnable GL_BLEND
|
||||
-- reset stencil to not draw on ceilings
|
||||
glStencilFunc GL_NOTEQUAL 128 255
|
||||
--draw lightmap into its own buffer
|
||||
createLightMap
|
||||
cfig
|
||||
@@ -232,16 +225,11 @@ doDrawing' win pdata u = do
|
||||
glBlendFunc GL_ZERO GL_ONE_MINUS_SRC_COLOR
|
||||
drawShader (_fullscreenShader pdata) 4
|
||||
with GL_COLOR_ATTACHMENT0 $
|
||||
glInvalidateNamedFramebufferData
|
||||
(pdata ^. fboLighting . _1 . unFBO)
|
||||
1
|
||||
glInvalidateNamedFramebufferData (pdata ^. fboLighting . _1 . unFBO) 1
|
||||
--draw bloom onto bloom buffer
|
||||
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboBloom . _1 . unFBO)
|
||||
withArray [0, 0, 0, 0] $
|
||||
glClearNamedFramebufferfv
|
||||
(pdata ^. fboBloom . _1 . unFBO)
|
||||
GL_COLOR
|
||||
0
|
||||
glClearNamedFramebufferfv (pdata ^. fboBloom . _1 . unFBO) GL_COLOR 0
|
||||
glDepthFunc GL_LESS
|
||||
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||
glDepthMask GL_FALSE
|
||||
@@ -251,7 +239,10 @@ doDrawing' win pdata u = do
|
||||
-- draw clouds to block bloom particles, transparency blocks some alpha
|
||||
glDepthMask GL_FALSE
|
||||
glBlendColor 0 0 0 0.1 -- using this and GL_CONSTANT_ALPHA below
|
||||
-- can allow for some underlighting of the clouds
|
||||
-- can allow for some bloom to bleed through underneath the clouds
|
||||
-- note that BloomNoZWrite will always be under the clouds, this should be
|
||||
-- rethought, either do another pass and write just the depth or even remove
|
||||
-- the layer entirely
|
||||
glBlendFuncSeparate GL_ZERO GL_ONE GL_CONSTANT_ALPHA GL_ONE_MINUS_SRC_ALPHA
|
||||
glUseProgram (pdata ^. cloudShader . shaderUINT)
|
||||
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
|
||||
@@ -271,7 +262,8 @@ doDrawing' win pdata u = do
|
||||
glDisable GL_BLEND
|
||||
drawShader (_bloomBlurShader pdata) 4
|
||||
when (cfig ^. graphics_bloom) $ do
|
||||
replicateM_ 2 $ pingPongBetween (_fboHalf1 pdata) (_fboHalf2 pdata) (_bloomBlurShader pdata)
|
||||
replicateM_ 2 $ pingPongBetween
|
||||
(_fboHalf1 pdata) (_fboHalf2 pdata) (_bloomBlurShader pdata)
|
||||
glEnable GL_BLEND
|
||||
setViewport _graphics_world_resolution cfig
|
||||
--draw clouds onto cloud buffer
|
||||
@@ -282,12 +274,11 @@ doDrawing' win pdata u = do
|
||||
--withArray [GL_COLOR_ATTACHMENT0, GL_NONE] $
|
||||
withArray [GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1] $
|
||||
glNamedFramebufferDrawBuffers (pdata ^. fboCloud . _1 . unFBO) 2
|
||||
withArray [0.5, 0.5, 0.5, 0] $ \ptr ->
|
||||
withArray [0.5, 0.5, 0.5, 0] $
|
||||
glClearNamedFramebufferfv
|
||||
(pdata ^. fboCloud . _1 . unFBO)
|
||||
GL_COLOR
|
||||
0
|
||||
ptr
|
||||
glUseProgram (pdata ^. cloudShader . shaderUINT)
|
||||
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
|
||||
glDrawElements
|
||||
@@ -307,20 +298,11 @@ doDrawing' win pdata u = do
|
||||
glDepthFunc GL_ALWAYS
|
||||
glDisable GL_BLEND
|
||||
withArray [GL_NONE, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $
|
||||
-- \ptr -> glDrawBuffers 3 ptr
|
||||
glNamedFramebufferDrawBuffers (pdata ^. fboCloud . _1 . unFBO) 3
|
||||
withArray [0, 0, 0, 0] $ \ptr ->
|
||||
glClearNamedFramebufferfv
|
||||
(pdata ^. fboCloud . _1 . unFBO)
|
||||
GL_COLOR
|
||||
1
|
||||
ptr
|
||||
withArray [0, 0, 0, 0] $ \ptr ->
|
||||
glClearNamedFramebufferfv
|
||||
(pdata ^. fboCloud . _1 . unFBO)
|
||||
GL_COLOR
|
||||
2
|
||||
ptr
|
||||
withArray [0, 0, 0, 0] $
|
||||
glClearNamedFramebufferfv (pdata ^. fboCloud . _1 . unFBO) GL_COLOR 1
|
||||
withArray [0, 0, 0, 0] $
|
||||
glClearNamedFramebufferfv (pdata ^. fboCloud . _1 . unFBO) GL_COLOR 2
|
||||
glEnable GL_BLEND
|
||||
-- we sum the positions weighted by alpha, and sum the alpha
|
||||
glBlendFuncSeparatei 1 GL_SRC_ALPHA GL_ONE GL_ONE GL_ONE
|
||||
@@ -430,13 +412,19 @@ doDrawing' win pdata u = do
|
||||
renderLayer DebugLayer shadV pokeCounts
|
||||
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. matUBO)
|
||||
withArray (scaleMatrix (2 / windowXFloat cfig) (2 / windowYFloat cfig)) $
|
||||
\ptr -> glNamedBufferSubData (pdata ^. matUBO) 0 64 ptr
|
||||
glNamedBufferSubData (pdata ^. matUBO) 0 64
|
||||
glDepthFunc GL_GEQUAL
|
||||
glDepthMask GL_TRUE
|
||||
with (-1) $ \ptr -> glClearNamedFramebufferfv 0 GL_DEPTH 0 ptr
|
||||
with (-1) $ glClearNamedFramebufferfv 0 GL_DEPTH 0
|
||||
renderLayer FixedCoordLayer shadV pokeCounts
|
||||
SDL.glSwapWindow win
|
||||
|
||||
bufferPerspectiveMatrixUBO :: Config -> Camera -> GLuint -> IO ()
|
||||
bufferPerspectiveMatrixUBO cfig cam uboid = withArray
|
||||
(perspectiveMatrixb (cam ^. camRot) (cam ^. camZoom) (cam ^. camCenter)
|
||||
(V2 (windowXFloat cfig) (windowYFloat cfig)) (cam ^. camViewFrom))
|
||||
$ glNamedBufferSubData uboid 0 64
|
||||
|
||||
getDistortions :: Config -> World -> [Distortion]
|
||||
getDistortions cfig w
|
||||
| cfig ^. graphics_distortions = w ^. cWorld . lWorld . distortions
|
||||
|
||||
+52
-36
@@ -1,53 +1,64 @@
|
||||
module MatrixHelper
|
||||
( perspectiveMatrixb
|
||||
, isoMatrix
|
||||
, scaleMatrix
|
||||
) where
|
||||
module MatrixHelper (
|
||||
perspectiveMatrixb,
|
||||
isoMatrix,
|
||||
scaleMatrix,
|
||||
) where
|
||||
|
||||
import Geometry.Data
|
||||
|
||||
import Linear.Matrix
|
||||
import Graphics.GL.Core45
|
||||
import Linear.Matrix
|
||||
|
||||
perspectiveMatrixb
|
||||
:: Float -- ^ Rotation
|
||||
-> Float -- ^ Zoom
|
||||
-> Point2 -- ^ Translation
|
||||
-> Point2 -- ^ Window size
|
||||
-> Point2 -- ^ View froms
|
||||
-> [GLfloat]
|
||||
perspectiveMatrixb ::
|
||||
-- | Rotation
|
||||
Float ->
|
||||
-- | Zoom
|
||||
Float ->
|
||||
-- | Translation
|
||||
Point2 ->
|
||||
-- | Window size
|
||||
Point2 ->
|
||||
-- | View froms
|
||||
Point2 ->
|
||||
[GLfloat]
|
||||
perspectiveMatrixb rot zoom (V2 tranx trany) (V2 winx winy) (V2 viewFromx viewFromy) =
|
||||
concatMap vToL
|
||||
. vToL
|
||||
. lmt
|
||||
$ scaleMat (V2 (2*zoom/winx) (2*zoom/winy))
|
||||
!*! rotMatr (-rot)
|
||||
!*! transMat (V2 (viewFromx-tranx) (viewFromy-trany))
|
||||
$ scaleMat (V2 (2 * zoom / winx) (2 * zoom / winy))
|
||||
!*! rotMatr (- rot)
|
||||
!*! transMat (V2 (viewFromx - tranx) (viewFromy - trany))
|
||||
!*! perMat 0.4
|
||||
!*! transMat (V2 (-viewFromx) (-viewFromy))
|
||||
!*! transMat (V2 (- viewFromx) (- viewFromy))
|
||||
!*! vertScale (negate 0.005)
|
||||
!*! vertTrans 20
|
||||
|
||||
isoMatrix
|
||||
:: Float -- ^ Rotation
|
||||
-> Float -- ^ Zoom
|
||||
-> Point2 -- ^ Translation
|
||||
-> Point2 -- ^ Window size
|
||||
-> [GLfloat]
|
||||
isoMatrix rot zoom (V2 tranx trany) (V2 winx winy) = concatMap vToL
|
||||
isoMatrix ::
|
||||
-- | Rotation
|
||||
Float ->
|
||||
-- | Zoom
|
||||
Float ->
|
||||
-- | Translation
|
||||
Point2 ->
|
||||
-- | Window size
|
||||
Point2 ->
|
||||
[GLfloat]
|
||||
isoMatrix rot zoom (V2 tranx trany) (V2 winx winy) =
|
||||
concatMap vToL
|
||||
. vToL
|
||||
. lmt
|
||||
$ scaleMat (V2 (2*zoom/winx) (2*zoom/winy))
|
||||
!*! rotMatr (-rot)
|
||||
!*! transMat (V2 (-tranx) (-trany))
|
||||
$ scaleMat (V2 (2 * zoom / winx) (2 * zoom / winy))
|
||||
!*! rotMatr (- rot)
|
||||
!*! transMat (V2 (- tranx) (- trany))
|
||||
|
||||
lmt :: V4 (V4 a) -> V4 (V4 a)
|
||||
lmt = Linear.Matrix.transpose
|
||||
|
||||
vToL :: V4 a -> [a]
|
||||
vToL (V4 a b c d) = [a,b,c,d]
|
||||
vToL (V4 a b c d) = [a, b, c, d]
|
||||
|
||||
perMat :: Float -> V4 (V4 Float)
|
||||
perMat x = V4
|
||||
perMat x =
|
||||
V4
|
||||
(V4 1 0 0 0)
|
||||
(V4 0 1 0 0)
|
||||
(V4 0 0 1 0)
|
||||
@@ -57,35 +68,40 @@ scaleMatrix :: Float -> Float -> [V4 Float]
|
||||
scaleMatrix x = vToL . scaleMat . V2 x
|
||||
|
||||
scaleMat :: Point2 -> V4 (V4 Float)
|
||||
scaleMat (V2 x y) = V4
|
||||
scaleMat (V2 x y) =
|
||||
V4
|
||||
(V4 x 0 0 0)
|
||||
(V4 0 y 0 0)
|
||||
(V4 0 0 1 0)
|
||||
(V4 0 0 0 1)
|
||||
|
||||
rotMatr :: Float -> V4 (V4 Float)
|
||||
rotMatr a = V4
|
||||
(V4 (cos a) (sin (-a)) 0 0)
|
||||
rotMatr a =
|
||||
V4
|
||||
(V4 (cos a) (sin (- a)) 0 0)
|
||||
(V4 (sin a) (cos a) 0 0)
|
||||
(V4 0 0 1 0)
|
||||
(V4 0 0 0 1)
|
||||
|
||||
transMat :: Point2 -> V4 (V4 Float)
|
||||
transMat (V2 x y) = V4
|
||||
transMat (V2 x y) =
|
||||
V4
|
||||
(V4 1 0 0 x)
|
||||
(V4 0 1 0 y)
|
||||
(V4 0 0 1 0)
|
||||
(V4 0 0 0 1)
|
||||
|
||||
vertScale :: Float -> V4 (V4 Float)
|
||||
vertScale s = V4
|
||||
vertScale s =
|
||||
V4
|
||||
(V4 1 0 0 0)
|
||||
(V4 0 1 0 0)
|
||||
(V4 0 0 s 0)
|
||||
(V4 0 0 0 1)
|
||||
|
||||
vertTrans :: Float -> V4 (V4 Float)
|
||||
vertTrans z = V4
|
||||
vertTrans z =
|
||||
V4
|
||||
(V4 1 0 0 0)
|
||||
(V4 0 1 0 0)
|
||||
(V4 0 0 1 (negate z))
|
||||
|
||||
+24
-12
@@ -5,8 +5,6 @@ module Preload.Render (
|
||||
cleanUpRenderPreload,
|
||||
) where
|
||||
|
||||
import Shape.Parameters
|
||||
import Shader.Parameters
|
||||
import Control.Concurrent
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
@@ -19,6 +17,8 @@ import Graphics.GL.Core45
|
||||
import Shader.AuxAddition
|
||||
import Shader.Compile
|
||||
import Shader.Data
|
||||
import Shader.Parameters
|
||||
import Shape.Parameters
|
||||
|
||||
{- BINDING LIST:
|
||||
0 base
|
||||
@@ -49,9 +49,13 @@ preloadRender = do
|
||||
shEBO <- setupEBO shPosVAO
|
||||
-- note the shape shader vao is distinct from the position vao, but they
|
||||
-- share an EBO
|
||||
shapeshader <- makeShaderUsingVBO "shape/basic" [vert, frag]
|
||||
shapeshader <-
|
||||
makeShaderUsingVBO
|
||||
"shape/basic"
|
||||
[vert, frag]
|
||||
shapeVerxAttributes
|
||||
pmTriangles shVBO
|
||||
pmTriangles
|
||||
shVBO
|
||||
glVertexArrayElementBuffer (shapeshader ^. shaderVAO . vaoName) (shEBO ^. eboName)
|
||||
|
||||
--setup silhouette edge VAO
|
||||
@@ -63,8 +67,13 @@ preloadRender = do
|
||||
let wallverxstrd = 8
|
||||
wallvbo <- setupVBO (floatSize * wallverxstrd)
|
||||
winvbo <- setupVBO (floatSize * 8)
|
||||
windowshader <- makeShaderUsingVBO
|
||||
"wall/window" [vert, geom, frag] (toFloatVAs [4, 4]) pmPoints winvbo
|
||||
windowshader <-
|
||||
makeShaderUsingVBO
|
||||
"wall/window"
|
||||
[vert, geom, frag]
|
||||
(toFloatVAs [4, 4])
|
||||
pmPoints
|
||||
winvbo
|
||||
wallshader <- makeShaderUsingVBO "wall/basic" [vert, geom, frag] (toFloatVAs [4, 4]) pmPoints wallvbo
|
||||
putStrLn "Setup lighting shaders"
|
||||
lightingWallShadShad <-
|
||||
@@ -100,7 +109,7 @@ preloadRender = do
|
||||
--initTexture2DArray 50 "data/texture/charMapVertBig.png" 2 32 64 95 GL_LINEAR_MIPMAP_NEAREST GL_LINEAR
|
||||
|
||||
putStrLn "Setup full screen shaders"
|
||||
(_,screentexturevao) <- setupStaticVBOVAO (toFloatVAs [2,2]) (concat cornerList)
|
||||
(_, screentexturevao) <- setupStaticVBOVAO (toFloatVAs [2, 2]) (concat cornerList)
|
||||
alphadivideshader <- makeShaderUsingVAO "texture2D/alphaDivide" [vert, frag] pmTriangleStrip screentexturevao
|
||||
fsShad <- makeShaderUsingVAO "texture/simple" [vert, frag] pmTriangleStrip screentexturevao
|
||||
bloomBlurShad <- makeShaderUsingVAO "texture/bloomBlur" [vert, frag] pmTriangleStrip screentexturevao
|
||||
@@ -120,10 +129,14 @@ preloadRender = do
|
||||
putStrLn "Setup chasm VBO, shader"
|
||||
let chasmverxstrd = 3
|
||||
chasmvbo <- setupVBOStatic (floatSize * chasmverxstrd)
|
||||
chasmshader <- makeShaderUsingVBO "positional/blank" [vert, frag] (toFloatVAs [3]) pmTriangles chasmvbo
|
||||
|
||||
chasmshader <-
|
||||
makeShaderUsingVBO
|
||||
"positional/blank"
|
||||
[vert, frag]
|
||||
(toFloatVAs [3])
|
||||
pmTriangles
|
||||
chasmvbo
|
||||
putStrLn "Setup cloud VBO, shader"
|
||||
--let cloudverxsizes = [4, 4, 4, 4]
|
||||
let cloudverxsizes = [4, 4, 4]
|
||||
cloudvbo <- setupVBO (floatSize * sum cloudverxsizes)
|
||||
(cloudshader, cloudebo) <-
|
||||
@@ -151,7 +164,6 @@ preloadRender = do
|
||||
-- reset to default framebuffer, ready for drawing direct to screen
|
||||
glBindFramebuffer GL_FRAMEBUFFER 0
|
||||
|
||||
|
||||
initializeGLState
|
||||
putStrLn "Return preload"
|
||||
return $
|
||||
@@ -177,7 +189,6 @@ preloadRender = do
|
||||
, _fboHalf1 = fboHalf1Name
|
||||
, _fboHalf2 = fboHalf2Name
|
||||
, _fboLighting = fboLightingName
|
||||
-- , _fboShadow = fboShadowName
|
||||
, _fboBase = fboBaseName
|
||||
, _fboCloud = fboCloudName
|
||||
, _fboBloom = fboBloomName
|
||||
@@ -221,6 +232,7 @@ cornerList =
|
||||
initializeGLState :: IO ()
|
||||
initializeGLState = do
|
||||
glEnable GL_DEPTH_TEST
|
||||
glEnable GL_STENCIL_TEST
|
||||
|
||||
cleanUpRenderPreload :: RenderData -> IO ()
|
||||
cleanUpRenderPreload _ = return ()
|
||||
|
||||
+7
-6
@@ -98,7 +98,7 @@ renderLightingNoShadows positiontexture normaltexture lightPoints pdata = do
|
||||
(fromIntegral (4 :: Int))
|
||||
--cleanup: may not be necessary, depending on what comes after...
|
||||
glDisable GL_CULL_FACE
|
||||
glDisable GL_STENCIL_TEST
|
||||
-- glDisable GL_STENCIL_TEST
|
||||
|
||||
|
||||
renderFlatLighting :: RenderData -> IO ()
|
||||
@@ -155,9 +155,8 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
|
||||
flip VFSM.mapM_ (VFSM.fromList lightPoints) $ \(V3 x y z, rad, V3 r g b) -> do
|
||||
-- note that the stencil shadows rely on the depth buffer
|
||||
glDepthFunc GL_LESS
|
||||
-- setup stencil
|
||||
glColorMask GL_FALSE GL_FALSE GL_FALSE GL_FALSE
|
||||
glStencilMask 127 -- so we only affect the last 7 bits
|
||||
-- setup stencil
|
||||
with 0 $
|
||||
glClearNamedFramebufferiv
|
||||
(pdata ^. fboLighting . _1 . unFBO)
|
||||
@@ -206,16 +205,18 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
|
||||
glDisable GL_CULL_FACE
|
||||
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_FALSE
|
||||
glStencilFunc GL_EQUAL 0 255
|
||||
glUseProgram (ltextShad ^. shaderUINT) --Just (_shadProg ltextShad)
|
||||
glUseProgram (ltextShad ^. shaderUINT)
|
||||
glUniform3f 0 x y z
|
||||
glUniform4f 1 r g b rad
|
||||
glBindVertexArray $ ltextShad ^. shaderVAO . vaoName -- Just (_vao $ _shadVAO ltextShad)
|
||||
glBindVertexArray $ ltextShad ^. shaderVAO . vaoName
|
||||
glDrawArrays
|
||||
(_unPrimitiveMode (_shaderPrimitive ltextShad))
|
||||
0
|
||||
(fromIntegral (4 :: Int))
|
||||
--cleanup: may not be necessary, depending on what comes after...
|
||||
glDisable GL_STENCIL_TEST
|
||||
-- glDisable GL_STENCIL_TEST
|
||||
glStencilFunc GL_NOTEQUAL 128 255
|
||||
glStencilOp GL_KEEP GL_KEEP GL_KEEP
|
||||
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
|
||||
|
||||
-- assumes that vertices have already been sent to the shader
|
||||
|
||||
@@ -2700,6 +2700,7 @@ brightX src/Color.hs 116;" f
|
||||
btSPic src/Dodge/Render/ShapePicture.hs 129;" f
|
||||
btText src/Dodge/Inventory/SelectionList.hs 237;" f
|
||||
bufferEBO src/Shader/Bind.hs 28;" f
|
||||
bufferPerspectiveMatrixUBO src/Dodge/Render.hs 420;" f
|
||||
bufferPokedVBO src/Shader/Bind.hs 19;" f
|
||||
bufferShaderLayers src/Shader/Bind.hs 36;" f
|
||||
bulletBeltBracer src/Dodge/Item/Equipment.hs 67;" f
|
||||
@@ -2792,7 +2793,7 @@ clang2S src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 676;" f
|
||||
clangS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 542;" f
|
||||
cldtPropagateFold src/Dodge/DoubleTree.hs 358;" f
|
||||
cleanUpPreload src/Preload.hs 10;" f
|
||||
cleanUpRenderPreload src/Preload/Render.hs 225;" f
|
||||
cleanUpRenderPreload src/Preload/Render.hs 236;" f
|
||||
cleanUpSoundPreload src/Preload.hs 15;" f
|
||||
cleanupHalted src/Sound.hs 117;" f
|
||||
cleatLabel src/Dodge/Cleat.hs 30;" f
|
||||
@@ -2878,7 +2879,7 @@ copier src/Dodge/Item/Scope.hs 88;" f
|
||||
copierItemUpdate src/Dodge/Creature/State.hs 131;" f
|
||||
copyItemToFloor src/Dodge/FloorItem.hs 14;" f
|
||||
corDoor src/Dodge/Room/Room.hs 385;" f
|
||||
cornerList src/Preload/Render.hs 203;" f
|
||||
cornerList src/Preload/Render.hs 214;" f
|
||||
corpseOrGib src/Dodge/Creature/Update.hs 111;" f
|
||||
corridor src/Dodge/Room/Corridor.hs 17;" f
|
||||
corridorBoss src/Dodge/LockAndKey.hs 133;" f
|
||||
@@ -3557,7 +3558,7 @@ getCrMoveSpeed src/Dodge/Creature/Statistics.hs 50;" f
|
||||
getCrsFromRooms src/Dodge/Room/Tutorial.hs 357;" f
|
||||
getCrsFromRooms' src/Dodge/Room/Tutorial.hs 344;" f
|
||||
getDebugMouseOver src/Dodge/Update.hs 377;" f
|
||||
getDistortions src/Dodge/Render.hs 438;" f
|
||||
getDistortions src/Dodge/Render.hs 426;" f
|
||||
getEdgesCrossing src/Dodge/Path.hs 42;" f
|
||||
getGrenadeHitEffect src/Dodge/HeldUse.hs 1264;" f
|
||||
getInventoryPath src/Dodge/Inventory/Path.hs 9;" f
|
||||
@@ -3709,7 +3710,7 @@ initWallZoning src/Dodge/Wall/Zone.hs 12;" f
|
||||
initialRoomTree src/Dodge/Floor.hs 24;" f
|
||||
initialWorld src/Dodge/Initialisation.hs 15;" f
|
||||
initialisePlaying src/Sound.hs 77;" f
|
||||
initializeGLState src/Preload/Render.hs 221;" f
|
||||
initializeGLState src/Preload/Render.hs 232;" f
|
||||
initializeOptionMenu src/Dodge/Menu/Option.hs 17;" f
|
||||
initializeOptionMenuBO src/Dodge/Menu/Option.hs 30;" f
|
||||
initializeTexture2D src/Framebuffer/Update.hs 209;" f
|
||||
@@ -3812,7 +3813,7 @@ isUsedLnkUnplaced src/Dodge/PlacementSpot.hs 174;" f
|
||||
isValidCommand src/Dodge/Debug/Terminal.hs 134;" f
|
||||
isVowel src/StringHelp.hs 8;" f
|
||||
isWalkable src/Dodge/WorldEvent/ThingsHit.hs 177;" f
|
||||
isoMatrix src/MatrixHelper.hs 30;" f
|
||||
isoMatrix src/MatrixHelper.hs 35;" f
|
||||
isotriBWH src/Geometry/Polygon.hs 22;" f
|
||||
itDim src/Dodge/Item/InvSize.hs 21;" f
|
||||
itEffectOnDrop src/Dodge/Item/BackgroundEffect.hs 67;" f
|
||||
@@ -3954,7 +3955,7 @@ listCursorChooseBorderScale src/Dodge/Render/List.hs 135;" f
|
||||
listGuard src/Dodge/Creature/ReaderUpdate.hs 195;" f
|
||||
listSelectionColorPicture src/Dodge/DisplayInventory.hs 302;" f
|
||||
litCorridor90 src/Dodge/Room/RoadBlock.hs 26;" f
|
||||
lmt src/MatrixHelper.hs 43;" f
|
||||
lmt src/MatrixHelper.hs 53;" f
|
||||
lnkMidPosInvSelsCol src/Dodge/Render/HUD.hs 387;" f
|
||||
loadDodgeConfig src/Dodge/Config.hs 30;" f
|
||||
loadMusic src/Dodge/SoundLogic/LoadSound.hs 30;" f
|
||||
@@ -4317,7 +4318,7 @@ pbsHit src/Dodge/WorldEvent/ThingsHit.hs 95;" f
|
||||
peZoneSize src/Dodge/Zoning/Pathing.hs 49;" f
|
||||
pedestalRoom src/Dodge/Room/Containing.hs 50;" f
|
||||
penThing src/Dodge/Bullet.hs 214;" f
|
||||
perMat src/MatrixHelper.hs 49;" f
|
||||
perMat src/MatrixHelper.hs 59;" f
|
||||
perceptionUpdate src/Dodge/Creature/Perception.hs 24;" f
|
||||
performAction src/Dodge/Creature/Action.hs 54;" f
|
||||
performActions src/Dodge/Creature/Action.hs 39;" f
|
||||
@@ -4685,7 +4686,7 @@ roomsContaining' src/Dodge/Room/Containing.hs 25;" f
|
||||
rootNotrootEff src/Dodge/Item/BackgroundEffect.hs 28;" f
|
||||
rose src/Color.hs 20;" f
|
||||
rotD src/Padding.hs 44;" f
|
||||
rotMatr src/MatrixHelper.hs 66;" f
|
||||
rotMatr src/MatrixHelper.hs 78;" f
|
||||
rotU src/Padding.hs 39;" f
|
||||
rotate src/Picture/Base.hs 153;" f
|
||||
rotate3 src/Geometry/Vector3D.hs 48;" f
|
||||
@@ -4738,8 +4739,8 @@ sawtoothFailS src/Dodge/SoundLogic/ExternallyGeneratedSounds.hs 714;" f
|
||||
scToTS src/Dodge/Event/Input.hs 34;" f
|
||||
scale src/Picture/Base.hs 149;" f
|
||||
scale3 src/Picture/Base.hs 145;" f
|
||||
scaleMat src/MatrixHelper.hs 59;" f
|
||||
scaleMatrix src/MatrixHelper.hs 56;" f
|
||||
scaleMat src/MatrixHelper.hs 70;" f
|
||||
scaleMatrix src/MatrixHelper.hs 67;" f
|
||||
scaleSH src/Shape.hs 269;" f
|
||||
scalp src/Dodge/Creature/Picture.hs 93;" f
|
||||
scancodeToHotkey src/Dodge/Creature/YourControl.hs 102;" f
|
||||
@@ -4826,7 +4827,7 @@ setTiles src/Dodge/Layout.hs 67;" f
|
||||
setTreeInts src/Dodge/Room/Tutorial.hs 98;" f
|
||||
setViewDistance src/Dodge/Update/Camera.hs 239;" f
|
||||
setViewPos src/Dodge/Creature/ReaderUpdate.hs 69;" f
|
||||
setViewport src/Dodge/Render.hs 443;" f
|
||||
setViewport src/Dodge/Render.hs 431;" f
|
||||
setVol src/Dodge/Config.hs 47;" f
|
||||
setWristShieldPos src/Dodge/Equipment.hs 49;" f
|
||||
setWristShieldPos src/Dodge/Euse.hs 38;" f
|
||||
@@ -5194,7 +5195,7 @@ tractorGunPic src/Dodge/Item/Draw/SPic.hs 437;" f
|
||||
tractorPullPos src/Dodge/TractorBeam/Update.hs 33;" f
|
||||
tractorSPic src/Dodge/TractorBeam/Draw.hs 10;" f
|
||||
tranRot src/Picture/Base.hs 124;" f
|
||||
transMat src/MatrixHelper.hs 73;" f
|
||||
transMat src/MatrixHelper.hs 86;" f
|
||||
transToHandle src/Dodge/Item/HeldOffset.hs 26;" f
|
||||
translate src/Picture/Base.hs 116;" f
|
||||
translate3 src/Picture/Base.hs 120;" f
|
||||
@@ -5455,15 +5456,15 @@ vInverse src/Geometry/Vector.hs 154;" f
|
||||
vNormal src/Geometry/Vector.hs 149;" f
|
||||
vNormaly src/Geometry/Vector3D.hs 72;" f
|
||||
vShape src/Dodge/Placement/Instance/LightSource.hs 130;" f
|
||||
vToL src/MatrixHelper.hs 46;" f
|
||||
vToL src/MatrixHelper.hs 56;" f
|
||||
vToQuat src/Quaternion.hs 42;" f
|
||||
validTerminalCommands src/Dodge/Debug/Terminal.hs 137;" f
|
||||
vasTightStride src/Shader/Compile.hs 297;" f
|
||||
vecBetweenSpeed src/Dodge/Base.hs 146;" f
|
||||
vecTurnTo src/Dodge/Movement/Turn.hs 19;" f
|
||||
vert src/Shader/Data.hs 102;" f
|
||||
vertScale src/MatrixHelper.hs 80;" f
|
||||
vertTrans src/MatrixHelper.hs 87;" f
|
||||
vertScale src/MatrixHelper.hs 94;" f
|
||||
vertTrans src/MatrixHelper.hs 102;" f
|
||||
verticalPipe src/Dodge/Picture.hs 19;" f
|
||||
verticalPipe src/Dodge/Placement/Instance/Pipe.hs 6;" f
|
||||
verticalWire src/Dodge/Wire.hs 23;" f
|
||||
|
||||
Reference in New Issue
Block a user