Hlint pass

This commit is contained in:
jgk
2021-07-12 12:44:43 +02:00
parent 75254cd3e4
commit ac66b4b9d6
8 changed files with 85 additions and 96 deletions
+12 -9
View File
@@ -14,6 +14,7 @@ import Dodge.Creature.Test
--import Dodge.Creature.AlertLevel.Data
--import Dodge.Picture.Layer
import Dodge.Item.Data
import Dodge.Base.Window
import Picture
import Geometry
import Geometry.Vector3D
@@ -26,15 +27,17 @@ basicCrPict
-> Creature
-> World
-> Picture
basicCrPict col cr w = pictures $
targetingPic ++
[ tr . setDepth 0 $ color yellow $ circleSolid 10
, tr . piercingMod $ bluntScale $ naked col cr
, tr $ torso (light4 col) (0,-crad) (0,crad)
, trFeet $ feet cr
, tr $ arms col cr
, tr $ drawEquipment cr
]
basicCrPict col cr w
| dist (_crPos cr) (_cameraCenter w) > 1.5 * max (getWindowX w) (getWindowY w) = blank
| otherwise = pictures $
targetingPic ++
[ tr . setDepth 0 $ color yellow $ circleSolid 10
, tr . piercingMod $ bluntScale $ naked col cr
, tr $ torso (light4 col) (0,-crad) (0,crad)
, trFeet $ feet cr
, tr $ arms col cr
, tr $ drawEquipment cr
]
where
crad = _crRad cr
targetingPic = IM.elems $ IM.mapMaybeWithKey f $ _crInv cr
+25 -30
View File
@@ -11,7 +11,7 @@ import Dodge.Base
--import Dodge.Render.MenuScreen
import Dodge.Render.Picture
--import Dodge.Render.PerspectiveMatrix
--import Geometry
import Geometry
import Geometry.Data
--import Picture
import Render
@@ -51,31 +51,40 @@ doDrawing pdata w = do
wallPointsCol = wallsPointsAndCols w
windowPoints = wallsWindows w
lightPoints = lightsForGloom w
--viewFroms@(viewFromx,viewFromy) = _cameraViewFrom w
viewFroms = _cameraViewFrom w
pic = worldPictures w
-- bind as much data into vbos as feasible at this point
-- bind wall points and colors to vbo
nWalls <- F.foldM (pokeShader $ _wallTextureShader pdata) (map Render22x4 wallPointsCol)
bindShaderBuffers [_wallTextureShader pdata] [nWalls]
-- store foreground silhouette geometry into buffer
nSils <- F.foldM (pokeShader $ _lightingLineShadowShader pdata)
(concatMap polyToRender (foregroundPics w))
bindShaderBuffers [_lightingLineShadowShader pdata] [nSils]
-- store foreground geometry and floor into buffer
let addC (xx,yy) = (xx,yy,0)
nsurfVs <- F.foldM (pokeShader (_lightingSurfaceShader pdata))
$ (Render3 $ polyToTris $ map addC $ screenPolygon w)
: concatMap polyToGeoRender (foregroundPics w)
bindShaderBuffers [_lightingSurfaceShader pdata] [nsurfVs]
-- set the coordinate uniform ready for drawing elements using world coordinates
bufferUBO $ perspectiveMatrixb rot camzoom trans wins viewFroms
bindFramebuffer Framebuffer $= (fst $ _fboBase pdata)
bindFramebuffer Framebuffer $= fst (_fboBase pdata)
clearColor $= Color4 0 0 0 0
clear [ColorBuffer,DepthBuffer]
depthFunc $= Just Less
if w ^. config . wall_textured
then renderTextureWalls pdata nWalls
else renderBlankWalls pdata nWalls
-- _ <- setWallDepth pdata wallPoints (viewFromx,viewFromy)
_ <- renderFoldable pdata $ picToLTree (Just 0) (polysToPic $ foregroundPics w)
_ <- renderFoldable pdata $ picToLTree (Just 0) pic
_ <- renderShader (_textureArrayShader pdata) (_floorTiles w)
bindFramebuffer Framebuffer $= (fst $ _fboBloom pdata)
bindFramebuffer Framebuffer $= fst (_fboBloom pdata)
clear [ColorBuffer]
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
_ <- renderFoldable pdata $ picToLTree (Just 1) pic
bindFramebuffer Framebuffer $= (fst $ _fboColor pdata)
bindFramebuffer Framebuffer $= fst (_fboColor pdata)
clear [ColorBuffer]
depthMask $= Disabled
_ <- renderFoldable pdata $ picToLTree (Just 3) pic
@@ -83,35 +92,21 @@ doDrawing pdata w = do
_ <- renderFoldable pdata $ picToLTree (Just 5) pic
depthMask $= Enabled
bindFramebuffer Framebuffer $= (fst $ _fboFourth1 pdata)
bindFramebuffer Framebuffer $= fst (_fboFourth1 pdata)
viewport $= (Position 0 0, Size 300 300)
depthFunc $= Just Always
textureBinding Texture2D $= Just (snd $ _fboBloom pdata)
--colorMask $= Color4 Disabled Disabled Disabled Enabled
--blendFunc $= (One,One)
--blendEquation $= FuncReverseSubtract
--drawShader (_fullscreenAlphaHalveShader pdata) 4
--colorMask $= Color4 Enabled Enabled Enabled Enabled
--blendEquation $= FuncAdd
--clear [ColorBuffer]
--blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
blendFunc $= (One,Zero)
--textureBinding Texture2D $= Just (snd $ _fboFourth1 pdata)
blend $= Disabled
drawShader (_bloomBlurShader pdata) 4
--blendFunc $= (One,Zero)
replicateM_ 3 $ pingPongBetween (_fboFourth1 pdata) (_fboFourth2 pdata) (_bloomBlurShader pdata)
--replicateM_ 5 $ pingPongBlur pdata
--blend $= Enabled
viewport $= (Position 0 0, Size (round $ fst wins) (round $ snd wins))
blend $= Enabled
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
bindFramebuffer Framebuffer $= (fst $ _fboLighting pdata)
let scPol = screenPolygon w
createLightMap pdata (w ^. config . shadow_resolution) lightPoints
(foregroundPics w) scPol nWalls
bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
viewport $= (Position 0 0
,divideSize (w ^. config . shadow_resolution) $ Size (round $ fst wins) (round $ snd wins))
createLightMap pdata lightPoints nWalls nSils nsurfVs
viewport $= (Position 0 0, Size (round $ fst wins) (round $ snd wins))
colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0
@@ -119,7 +114,7 @@ doDrawing pdata w = do
depthMask $= Disabled
depthFunc $= Just Always
bindFramebuffer Framebuffer $= (fst $ _fboBase pdata)
bindFramebuffer Framebuffer $= fst (_fboBase pdata)
--drawShader (_fullscreenShader pdata) 4
--textureBinding Texture2D $= Just (snd3 $ _fbo2 pdata)
textureBinding Texture2D $= Just (snd $ _fboLighting pdata)
@@ -160,7 +155,7 @@ doDrawing pdata w = do
toList = snd (_fboBase pdata) : concat (repeat [snd $ _fbo2 pdata,snd $ _fbo3 pdata])
bindings = zipWith (>>) (map bindFBO fboList) (map bindTO toList)
activeTexture $= TextureUnit 1
sequence_ $ zipWith (>>) bindings $ map bindDrawDist rds
zipWithM_ (>>) bindings $ map bindDrawDist rds
activeTexture $= TextureUnit 0
-- draw overlay
bufferUBO $ isoMatrix 0 1 (0,0) (2,2)
+1 -1
View File
@@ -55,7 +55,7 @@ highPipe h x@(xx,xy) y =
]
where
(a,b) = y -.- x
(a',b') = 10 *.* (normalizeV $ vNormal (a,b))
(a',b') = 10 *.* normalizeV (vNormal (a,b))
girderZ :: Float -> Point2 -> Point2 -> Picture
girderZ w x y = setDepth 50 $ color red $ pictures $
+3
View File
@@ -161,6 +161,9 @@ checkEndGame w
| _crHP (you w) < 1 = haltSound $ w {_menuLayers = [GameOverMenu]}
| otherwise = w
--updateClouds :: World -> World
--updateClouds = (clouds .~ IM.empty) . (cloudsZone .~ IM.empty)
updateClouds :: World -> World
updateClouds w = IM.foldr' updateCloud w $ _clouds w