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