Stop overwriting depth buffer when combining cloud positions
This commit is contained in:
@@ -11,7 +11,7 @@ testEvent :: World -> World
|
|||||||
testEvent w = w
|
testEvent w = w
|
||||||
& cWorld . lWorld . worldEvents .~ SoundStart BackgroundSound (V2 0 0) foamSprayFadeOutS Nothing :
|
& cWorld . lWorld . worldEvents .~ SoundStart BackgroundSound (V2 0 0) foamSprayFadeOutS Nothing :
|
||||||
--[MakeStartCloudAt (V3 (cx + x) (cy + y) 5) | x <- [-5, -4 .. 5], y <- [-5, -4 .. 5]]
|
--[MakeStartCloudAt (V3 (cx + x) (cy + y) 5) | x <- [-5, -4 .. 5], y <- [-5, -4 .. 5]]
|
||||||
[MakeStartCloudAt (V3 (cx + x) (cy + y) 20) | x <- [0], y <- [0]]
|
[MakeStartCloudAt (V3 (cx + x) (cy + y) 200) | x <- [0], y <- [0]]
|
||||||
where
|
where
|
||||||
V2 cx cy = w ^?! cWorld . lWorld . creatures . ix 0 . crPos
|
V2 cx cy = w ^?! cWorld . lWorld . creatures . ix 0 . crPos
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ generateWorldFromSeed rdata i = do
|
|||||||
generateGraphs
|
generateGraphs
|
||||||
(roomList, bounds) <- layoutLevelFromSeed 0 i
|
(roomList, bounds) <- layoutLevelFromSeed 0 i
|
||||||
postGenerationProcessing rdata
|
postGenerationProcessing rdata
|
||||||
$! (generateLevelFromRoomList roomList initialWorld{_randGen = mkStdGen i})
|
$! generateLevelFromRoomList roomList initialWorld{_randGen = mkStdGen i}
|
||||||
& gwWorld . cWorld . cwGen . cwgRoomClipping .~ bounds
|
& gwWorld . cWorld . cwGen . cwgRoomClipping .~ bounds
|
||||||
& gwWorld . cWorld . cwGen . cwgSeed .~ i
|
& gwWorld . cWorld . cwGen . cwgSeed .~ i
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ doThrust pj w =
|
|||||||
& cWorld . lWorld . projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v)
|
& cWorld . lWorld . projectiles . ix i . prjVel %~ (\v -> accel +.+ frict *.* v)
|
||||||
& soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
|
& soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
|
||||||
& makeFlamelet (oldPos -.- vel) 0 (vel +.+ rotateV (pi + sparkD) accel) 3 10
|
& makeFlamelet (oldPos -.- vel) 0 (vel +.+ rotateV (pi + sparkD) accel) 3 10
|
||||||
& shellTrailCloud' trailage trailfadetime
|
& shellTrailCloud trailage trailfadetime
|
||||||
(addZ 20 (oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos)))
|
(addZ 20 (oldPos +.+ r1 +.+ 30 *.* normalizeV (oldPos -.- newPos)))
|
||||||
where
|
where
|
||||||
trailage = fst . randomR (300, 500) $ _randGen w
|
trailage = fst . randomR (300, 500) $ _randGen w
|
||||||
|
|||||||
+5
-6
@@ -190,7 +190,7 @@ doDrawing' win pdata u = do
|
|||||||
glDrawArrays
|
glDrawArrays
|
||||||
(marshalEPrimitiveMode $ pdata ^. floorShader . shadPrim' )
|
(marshalEPrimitiveMode $ pdata ^. floorShader . shadPrim' )
|
||||||
0
|
0
|
||||||
(fromIntegral $ nFls)
|
(fromIntegral nFls)
|
||||||
glEnable GL_BLEND
|
glEnable GL_BLEND
|
||||||
--draw lightmap into its own buffer
|
--draw lightmap into its own buffer
|
||||||
createLightMap
|
createLightMap
|
||||||
@@ -288,6 +288,7 @@ doDrawing' win pdata u = do
|
|||||||
glBlendFunci 2 GL_SRC_ALPHA GL_ONE
|
glBlendFunci 2 GL_SRC_ALPHA GL_ONE
|
||||||
glUseProgram (pdata ^. cloudShader . shaderUINT)
|
glUseProgram (pdata ^. cloudShader . shaderUINT)
|
||||||
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
|
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
|
||||||
|
glDepthMask GL_TRUE
|
||||||
glDrawElements
|
glDrawElements
|
||||||
(pdata ^. cloudShader . shaderPrimitive)
|
(pdata ^. cloudShader . shaderPrimitive)
|
||||||
(fromIntegral nCloudIs)
|
(fromIntegral nCloudIs)
|
||||||
@@ -301,11 +302,10 @@ doDrawing' win pdata u = do
|
|||||||
0
|
0
|
||||||
ptr
|
ptr
|
||||||
glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _2 . unTO)
|
glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _2 . unTO)
|
||||||
drawShader (pdata ^. alphaDivideShader) 4
|
|
||||||
glEnable GL_BLEND
|
|
||||||
----draw lightmap for cloud buffer
|
|
||||||
glDepthMask GL_FALSE
|
glDepthMask GL_FALSE
|
||||||
glDepthFunc GL_LEQUAL
|
drawShader (pdata ^. alphaDivideShader) 4
|
||||||
|
----draw lightmap for cloud buffer
|
||||||
|
glDepthFunc GL_LESS
|
||||||
glEnable GL_BLEND
|
glEnable GL_BLEND
|
||||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
|
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
|
||||||
createLightMap
|
createLightMap
|
||||||
@@ -316,7 +316,6 @@ doDrawing' win pdata u = do
|
|||||||
nSilIndices
|
nSilIndices
|
||||||
nIndices
|
nIndices
|
||||||
(_graphics_object_shadows $ _uvConfig u)
|
(_graphics_object_shadows $ _uvConfig u)
|
||||||
--(pdata ^. fboCloud . _2 . _2)
|
|
||||||
(pdata ^. fboPos . _2)
|
(pdata ^. fboPos . _2)
|
||||||
(pdata ^. fboCloud . _2 . _3)
|
(pdata ^. fboCloud . _2 . _3)
|
||||||
glInvalidateBufferData (pdata ^. vboShapes . vboName)
|
glInvalidateBufferData (pdata ^. vboShapes . vboName)
|
||||||
|
|||||||
@@ -34,4 +34,4 @@ startSeedGameConc seed pdata = do
|
|||||||
. saveWorldInSlot (LevelStartSlot 0)
|
. saveWorldInSlot (LevelStartSlot 0)
|
||||||
. (uvScreenLayers .~ [])
|
. (uvScreenLayers .~ [])
|
||||||
. (uvWorld .~ w)
|
. (uvWorld .~ w)
|
||||||
. (uvIOEffects %~ (\f uv -> ( (uvWorld . cWorld) (postWorldLoad (pdata ^?! renderData)) uv >>= f)))
|
. (uvIOEffects %~ (\f uv -> (uvWorld . cWorld) (postWorldLoad (pdata ^?! renderData)) uv >>= f))
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ module Dodge.WorldEvent.Cloud (
|
|||||||
smokeCloudAt,
|
smokeCloudAt,
|
||||||
makeThinSmokeAt,
|
makeThinSmokeAt,
|
||||||
makeThickSmokeAt,
|
makeThickSmokeAt,
|
||||||
shellTrailCloud',
|
shellTrailCloud,
|
||||||
spawnSmokeAtCursor,
|
spawnSmokeAtCursor,
|
||||||
makeStartCloudAt,
|
makeStartCloudAt,
|
||||||
) where
|
) where
|
||||||
@@ -29,8 +29,7 @@ makeCloudAt ::
|
|||||||
makeCloudAt drawFunc rad t alt p =
|
makeCloudAt drawFunc rad t alt p =
|
||||||
cWorld . lWorld . clouds
|
cWorld . lWorld . clouds
|
||||||
.:~ Cloud
|
.:~ Cloud
|
||||||
{ --makeCloudAt drawFunc rad t alt p = clouds %~ S.cons Cloud
|
{ _clPos = p
|
||||||
_clPos = p
|
|
||||||
, _clVel = V3 0 0 0
|
, _clVel = V3 0 0 0
|
||||||
, _clPict = drawFunc
|
, _clPict = drawFunc
|
||||||
, _clRad = rad
|
, _clRad = rad
|
||||||
@@ -60,13 +59,11 @@ makeThinSmokeAt = makeCloudAt (CloudColor 4 400 (withAlpha 0.05 black)) 5 400 50
|
|||||||
|
|
||||||
makeStartCloudAt :: Point3 -> World -> World
|
makeStartCloudAt :: Point3 -> World -> World
|
||||||
--makeStartCloudAt = makeCloudAt (CloudColor 2 800 white) 10 400 5
|
--makeStartCloudAt = makeCloudAt (CloudColor 2 800 white) 10 400 5
|
||||||
makeStartCloudAt = makeCloudAt (CloudColor 2 200 white) 10 400 50
|
--makeStartCloudAt = makeCloudAt (CloudColor 2 200 white) 10 400 50
|
||||||
|
makeStartCloudAt = makeCloudAt (CloudColor 2 200 white) 10 400 200
|
||||||
|
|
||||||
shellTrailCloud :: Point3 -> World -> World
|
shellTrailCloud :: Int -> Float -> Point3 -> World -> World
|
||||||
shellTrailCloud = makeCloudAt (CloudColor (3/2) 100 (greyN 0.5)) 15 400 80
|
shellTrailCloud age fadet = makeCloudAt (CloudColor (3/2) fadet (greyN 0.5)) 15 age 200
|
||||||
|
|
||||||
shellTrailCloud' :: Int -> Float -> Point3 -> World -> World
|
|
||||||
shellTrailCloud' age fadet = makeCloudAt (CloudColor (3/2) fadet (greyN 0.5)) 15 age 80
|
|
||||||
|
|
||||||
makeFlamerSmokeAt :: Point3 -> World -> World
|
makeFlamerSmokeAt :: Point3 -> World -> World
|
||||||
makeFlamerSmokeAt p w = makeCloudAt (CloudColor 4 300 (greyN x)) 6 200 40 p w
|
makeFlamerSmokeAt p w = makeCloudAt (CloudColor 4 300 (greyN x)) 6 200 40 p w
|
||||||
@@ -74,6 +71,6 @@ makeFlamerSmokeAt p w = makeCloudAt (CloudColor 4 300 (greyN x)) 6 200 40 p w
|
|||||||
x = fst $ randomR (0.5, 0.8) (_randGen w)
|
x = fst $ randomR (0.5, 0.8) (_randGen w)
|
||||||
|
|
||||||
spawnSmokeAtCursor :: World -> World
|
spawnSmokeAtCursor :: World -> World
|
||||||
spawnSmokeAtCursor w = shellTrailCloud (V3 x y 20) w
|
spawnSmokeAtCursor w = shellTrailCloud 400 100 (V3 x y 20) w
|
||||||
where
|
where
|
||||||
V2 x y = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
|
V2 x y = mouseWorldPos (w ^. input) (w ^. cWorld . camPos)
|
||||||
|
|||||||
+5
-6
@@ -47,10 +47,10 @@ createLightMap ::
|
|||||||
TO ->
|
TO ->
|
||||||
IO ()
|
IO ()
|
||||||
createLightMap cfig pdata lightPoints nWalls nSils nCaps shadsdrawtype
|
createLightMap cfig pdata lightPoints nWalls nSils nCaps shadsdrawtype
|
||||||
toPos
|
positiontexture
|
||||||
normaltexture
|
normaltexture
|
||||||
= case shadsdrawtype of
|
= case shadsdrawtype of
|
||||||
InstancingShads -> instanceLightMap cfig pdata lightPoints nWalls nSils nCaps toPos
|
InstancingShads -> instanceLightMap cfig pdata lightPoints nWalls nSils nCaps positiontexture
|
||||||
NoShadows -> do
|
NoShadows -> do
|
||||||
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
|
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
|
||||||
let ltextShad = _lightingTextureShader pdata
|
let ltextShad = _lightingTextureShader pdata
|
||||||
@@ -86,7 +86,7 @@ createLightMap cfig pdata lightPoints nWalls nSils nCaps shadsdrawtype
|
|||||||
--draw lightmap itself
|
--draw lightmap itself
|
||||||
glDepthFunc GL_ALWAYS
|
glDepthFunc GL_ALWAYS
|
||||||
-- bind world position texture
|
-- bind world position texture
|
||||||
bindTO toPos
|
glBindTextureUnit 0 (positiontexture ^. unTO)
|
||||||
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
|
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
|
||||||
glStencilFunc GL_EQUAL 0 255
|
glStencilFunc GL_EQUAL 0 255
|
||||||
glUseProgram (ltextShad ^. shadName)
|
glUseProgram (ltextShad ^. shadName)
|
||||||
@@ -114,7 +114,7 @@ createLightMap cfig pdata lightPoints nWalls nSils nCaps shadsdrawtype
|
|||||||
0
|
0
|
||||||
ptr
|
ptr
|
||||||
glDisable GL_CULL_FACE
|
glDisable GL_CULL_FACE
|
||||||
glBindTextureUnit 0 (toPos ^. unTO)
|
glBindTextureUnit 0 (positiontexture ^. unTO)
|
||||||
glDepthFunc GL_ALWAYS
|
glDepthFunc GL_ALWAYS
|
||||||
glDepthMask GL_FALSE
|
glDepthMask GL_FALSE
|
||||||
_ -> do
|
_ -> do
|
||||||
@@ -192,14 +192,13 @@ createLightMap cfig pdata lightPoints nWalls nSils nCaps shadsdrawtype
|
|||||||
glDepthFunc GL_ALWAYS
|
glDepthFunc GL_ALWAYS
|
||||||
-- bind world position texture
|
-- bind world position texture
|
||||||
glDisable GL_CULL_FACE
|
glDisable GL_CULL_FACE
|
||||||
bindTO toPos
|
glBindTextureUnit 0 (positiontexture ^. unTO)
|
||||||
glBindTextureUnit 1 (normaltexture ^. unTO)
|
glBindTextureUnit 1 (normaltexture ^. unTO)
|
||||||
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
|
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
|
||||||
glStencilFunc GL_EQUAL 0 255
|
glStencilFunc GL_EQUAL 0 255
|
||||||
glUseProgram (ltextShad ^. shadName) --Just (_shadProg ltextShad)
|
glUseProgram (ltextShad ^. shadName) --Just (_shadProg ltextShad)
|
||||||
glUniform3f 0 x y z
|
glUniform3f 0 x y z
|
||||||
glUniform4f 1 r g b rad
|
glUniform4f 1 r g b rad
|
||||||
--bindVertexArrayObject $= ltextShad ^? shadVAO' . vaoName -- Just (_vao $ _shadVAO ltextShad)
|
|
||||||
glBindVertexArray $ ltextShad ^. shadVAO . vaoName -- Just (_vao $ _shadVAO ltextShad)
|
glBindVertexArray $ ltextShad ^. shadVAO . vaoName -- Just (_vao $ _shadVAO ltextShad)
|
||||||
glDrawArrays
|
glDrawArrays
|
||||||
(marshalEPrimitiveMode (_shadPrim' ltextShad))
|
(marshalEPrimitiveMode (_shadPrim' ltextShad))
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ xCylinder n r x = rotateSHq (V3 0 1 0) (pi/2) . translateSHxy (-r) 0 . upperCyli
|
|||||||
|
|
||||||
xCylinder' :: Float -> Float -> Shape
|
xCylinder' :: Float -> Float -> Shape
|
||||||
xCylinder' r x = translateSHz r . rotateSHq (V3 0 1 0) (pi/2) . upperCylinder x $
|
xCylinder' r x = translateSHz r . rotateSHq (V3 0 1 0) (pi/2) . upperCylinder x $
|
||||||
[V2 r (r)
|
[V2 r r
|
||||||
,V2 (-r/2) (r/2)
|
,V2 (-r/2) (r/2)
|
||||||
,V2 (-r/2) (negate $ r/2)
|
,V2 (-r/2) (negate $ r/2)
|
||||||
,V2 r (-r)
|
,V2 r (-r)
|
||||||
|
|||||||
Reference in New Issue
Block a user