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)
|
||||
|
||||
Reference in New Issue
Block a user