Tweak clouds

This commit is contained in:
2023-03-20 18:24:07 +00:00
parent 695f849f77
commit 7d0bb7f229
11 changed files with 88 additions and 63 deletions
-1
View File
@@ -86,7 +86,6 @@ data ResFactor = FullRes | HalfRes | QuarterRes
data ObjectShadows = GeoObjShads
| InstancingShads
| CPUObjShads
| NoObjShads
| NoShadows
| NoLighting
+7
View File
@@ -2,8 +2,15 @@ module Dodge.Event.Test (
testEvent,
) where
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Dodge.Data.World
import Control.Lens
import Geometry
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]]
where
V2 cx cy = w ^?! cWorld . lWorld . creatures . ix 0 . crPos
+53 -32
View File
@@ -132,7 +132,6 @@ doDrawing' win pdata u = do
GL_DEPTH
0
ptr
glDepthFunc GL_LESS
-- draw wall occlusions from the camera's point of view
glUseProgram (pdata ^. lightingWallShadShader . shadName)
@@ -203,7 +202,7 @@ doDrawing' win pdata u = do
nIndices
(u ^. uvConfig . graphics_object_shadows)
(pdata ^. fboBase . _2 . _2)
(drawCPUShadows pdata ws)
(pdata ^. fboBase . _2 . _3)
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
--apply lightmap to base buffer
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboBase . _1 . unFBO)
@@ -250,36 +249,58 @@ doDrawing' win pdata u = do
GL_COLOR
0
ptr
renderLayer MidLayer shadV layerCounts
-- glUseProgram (pdata ^. cloudShader . shaderUINT)
-- glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
-- glDrawElements
-- (pdata ^. cloudShader . shaderPrimitive)
-- (fromIntegral nCloudIs)
-- GL_UNSIGNED_SHORT
-- nullPtr
-- renderLayer MidLayer shadV layerCounts
glUseProgram (pdata ^. cloudShader . shaderUINT)
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
glDrawElements
(pdata ^. cloudShader . shaderPrimitive)
(fromIntegral nCloudIs)
GL_UNSIGNED_SHORT
nullPtr
drawShader (_windowShader pdata) nWins
-- when (_graphics_cloud_shadows cfig) $ do
-- ----render transparency depths
-- glDepthMask GL_TRUE
-- glDisable GL_BLEND
-- withArray [GL_NONE, GL_COLOR_ATTACHMENT1] $ \ptr -> glDrawBuffers 2 ptr
-- renderLayer MidLayer shadV layerCounts
-- drawShader (_windowShader pdata) nWins
-- ----draw lightmap for cloud buffer
-- glDepthMask GL_FALSE
-- glEnable GL_BLEND
-- glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
-- createLightMap
-- cfig
-- pdata
-- lightPoints
-- nWalls
-- nSilIndices
-- nIndices
-- (_graphics_object_shadows $ _uvConfig u)
-- (snd $ snd $ _fboCloud pdata)
-- (drawCPUShadows pdata ws)
when (_graphics_cloud_shadows cfig) $ do
----render transparency depths
glDepthMask GL_TRUE
glDepthFunc GL_ALWAYS
glDisable GL_BLEND
withArray [GL_NONE, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $ \ptr -> glDrawBuffers 3 ptr
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
glEnable GL_BLEND
glBlendColor 0.5 0.5 0.5 0.5
glBlendFunci 1 GL_ONE_MINUS_DST_ALPHA GL_DST_ALPHA
glBlendFunci 2 GL_ONE GL_ONE
glUseProgram (pdata ^. cloudShader . shaderUINT)
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
glDrawElements
(pdata ^. cloudShader . shaderPrimitive)
(fromIntegral nCloudIs)
GL_UNSIGNED_SHORT
nullPtr
drawShader (_windowShader pdata) nWins
----draw lightmap for cloud buffer
glDepthMask GL_FALSE
glDepthFunc GL_LEQUAL
glEnable GL_BLEND
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
createLightMap
cfig
pdata
lightPoints
nWalls
nSilIndices
nIndices
(_graphics_object_shadows $ _uvConfig u)
(pdata ^. fboCloud . _2 . _2)
(pdata ^. fboCloud . _2 . _3)
glInvalidateBufferData (pdata ^. vboShapes . vboName)
--apply lightmap to cloud buffer
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
@@ -300,7 +321,7 @@ doDrawing' win pdata u = do
drawShader (fst $ _fullscreenShader pdata) 4
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
--draw shadowed clouds onto base buffer
glBindTexture GL_TEXTURE_2D (_unTO . fst . snd $ _fboCloud pdata)
glBindTexture GL_TEXTURE_2D (pdata ^. fboCloud . _2 . _1 . unTO)
drawShader (fst $ _fullscreenShader pdata) 4
--set viewport for radial distortion
setViewportSize (round winx) (round winy)
+2 -1
View File
@@ -59,7 +59,8 @@ makeThinSmokeAt :: Point3 -> World -> World
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 800 white) 10 400 5
makeStartCloudAt = makeCloudAt (CloudColor 2 800 white) 10 400 50
shellTrailCloud :: Point3 -> World -> World
shellTrailCloud = makeCloudAt (CloudColor (4 / 3) 800 (greyN 0.5)) 15 400 40