From 726cd425f20dcda56d9d17c1db6bcc2e28025ddc Mon Sep 17 00:00:00 2001 From: jgk Date: Fri, 25 Jun 2021 18:43:45 +0200 Subject: [PATCH] Tweak drawing parameters --- src/Dodge/Creature/Inanimate.hs | 8 ++------ src/Dodge/Creature/Picture.hs | 21 +++++++++++++-------- src/Dodge/Item/Draw.hs | 12 +++++++----- src/Dodge/Render.hs | 9 ++++++++- src/Dodge/WorldEvent/Cloud.hs | 2 +- src/Dodge/WorldEvent/SpawnParticle.hs | 6 +++--- src/Picture/Render.hs | 7 +------ src/Tile.hs | 2 +- 8 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/Dodge/Creature/Inanimate.hs b/src/Dodge/Creature/Inanimate.hs index eabc19e82..8ef21a8c7 100644 --- a/src/Dodge/Creature/Inanimate.hs +++ b/src/Dodge/Creature/Inanimate.hs @@ -33,12 +33,8 @@ lamp = defaultInanimate } lampPic :: Picture lampPic = pictures - [ setDepth 0 $ color white $ p - , setDepth (negate 0.1) $ color yellow $ p - , setDepth (negate 0.5) $ color green $ p - , setDepth (negate 0.4) $ color red $ p - , setDepth (negate 0.2) $ color blue $ p - , setDepth (negate 1) $ color white $ p + [ setDepth (0.09) $ color white $ p + , setDepth (0) $ color yellow $ p ] where p = pictures [circleSolid 3, polygon $ rectNSEW 5 0 5 0] diff --git a/src/Dodge/Creature/Picture.hs b/src/Dodge/Creature/Picture.hs index 711a41af1..2e2f77aa9 100644 --- a/src/Dodge/Creature/Picture.hs +++ b/src/Dodge/Creature/Picture.hs @@ -28,6 +28,7 @@ basicCrPict basicCrPict col cr w = pictures $ targetingPic ++ [ tr . piercingMod $ bluntScale $ naked col cr + , tr $ waist col , trFeet $ feet cr , tr $ arms col cr , tr $ drawEquipment cr @@ -53,6 +54,9 @@ basicCrPict col cr w = pictures $ _ -> id pastDams = _crPastDamage $ _crState cr +waist :: Color -> Picture +waist col = setDepth 0.025 . color (light4 col) . scale 0.5 1 $ circleSolid 8 + feet :: Creature -> Picture feet cr = case cr ^? crStance . carriage of Just (Walking sa LeftForward) -> setL @@ -68,7 +72,8 @@ feet cr = case cr ^? crStance . carriage of , translate 0 (-off) $ circleSolid 5 ] where - setL = onLayerL [levLayer CrLayer, -5] . color (greyN 0.3) . pictures + --setL = onLayerL [levLayer CrLayer, -5] . color (greyN 0.3) . pictures + setL = setDepth 0.049 . color (greyN 0.3) . pictures off = 5 sLen = _strideLength $ _crStance cr f i = 6 * fromIntegral (sLen - i) / fromIntegral sLen @@ -86,7 +91,8 @@ arms col cr _ -> blank where sc = scale 1 1 - setL = onLayerL [levLayer CrLayer, -4] . color (light4 col) . pictures + --setL = onLayerL [levLayer CrLayer, -4] . color (light4 col) . pictures + setL = setDepth 0.02 . color (light4 col) . pictures off = 8 sLen = _strideLength $ _crStance cr f i = negate 2 + negate 6 * fromIntegral (sLen - i) / fromIntegral sLen @@ -100,27 +106,26 @@ naked col cr | pdam > 200 = onCrL . color red $ circleSolid $ _crRad cr | pdam > 99 = onCrL . color white $ circleSolid $ _crRad cr | aimingOneHand = rotate (negate twistA * 0.5) $ pictures - [ translate (0.25 * crad) 0 $ circleSolid (crad * 0.5) + [ translate (0.25 * crad) 0 fhead , onCrL . translate 8 (-8) . color col' $ circleSolid 4 , translate 0 3 . rotate (negate 0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr , translate 0 (negate 3) . rotate 0.2 . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr ] | aimingTwist = translate 0 (0.5* crad) . rotate twistA $ pictures - [ aboveIt . translate (negate 0.25 * crad) 0.25 $ - circleSolid (crad * 0.5) + [ translate (negate 0.25 * crad) 0.25 fhead , onCrL . translate 12 4 . color col' $ circleSolid 4 , onCrL . translate 4 (-10) . color col' $ circleSolid 4 , onCrL . rotate (negate 0.2) . translate 2 3 . rotate (negate 0.4) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr , onCrL . rotate (negate 0.2) . translate 0 (negate 3) . rotate 0.2 . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr ] | otherwise = onCrL $ pictures - [ translate (0.25 * crad) 0 $ circleSolid (crad * 0.5) + [ translate (0.25 * crad) 0 fhead , translate 0 3 . rotate (negate 0.2) . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr , translate 0 (negate 3) . rotate 0.2 . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr ] where - aboveIt = onLayer HPtLayer - onCrL = onLayer CrLayer + fhead = setDepth (negate 0.01) $ circleSolid $ crad * 0.5 + onCrL = setDepth 0 twistA = negate 1 aimingOneHand = crIsAiming' cr && crIt ^? itAimStance == Just OneHand aimingTwist = crIsAiming' cr && crIt ^? itAimStance == Just TwoHandTwist diff --git a/src/Dodge/Item/Draw.hs b/src/Dodge/Item/Draw.hs index 8aeb83423..b63bad80d 100644 --- a/src/Dodge/Item/Draw.hs +++ b/src/Dodge/Item/Draw.hs @@ -16,17 +16,19 @@ pictureWeaponOnAim -> Picture pictureWeaponOnAim p cr posInInv | isSelected && _posture (_crStance cr) == Aiming && isTwisting - = onLayer PtLayer twistWep + = shoulderD twistWep | isSelected && _posture (_crStance cr) == Aiming && isOneHand - = onLayer PtLayer oneHandWep + = shoulderD oneHandWep | isSelected && _posture (_crStance cr) == Aiming - = onLayer PtLayer drawnWep + = shoulderD drawnWep | isSelected && isOneHand - = onLayerL [levLayer CrLayer, -5] holsteredOneHandWep + = handD holsteredOneHandWep | isSelected - = onLayerL [levLayer CrLayer, -3] holsteredWep + = handD holsteredWep | otherwise = blank where + shoulderD = setDepth $ negate 0.005 + handD = setDepth 0.01 isSelected = _crInvSel cr == posInInv drawnWep = uncurry translate (_crRad cr,0) p twistWep = uncurry translate (0.5 * _crRad cr,0) p diff --git a/src/Dodge/Render.hs b/src/Dodge/Render.hs index 581ceb3e9..4490ecd70 100644 --- a/src/Dodge/Render.hs +++ b/src/Dodge/Render.hs @@ -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 Picture.Render @@ -59,6 +59,13 @@ doDrawing pdata w = do -- set the coordinate uniform ready for drawing elements using world coordinates bufferUBO $ perspectiveMatrixb rot camzoom trans wins viewFroms + -- store floor position into buffer + let addC (xx,yy) = (xx,yy,0.1) + nsurfVs <- F.foldM (pokeShader (_lightingSurfaceShader pdata)) [Render3 + $ polyToTris $ map addC $ screenPolygon w ] + bindShaderBuffers [_lightingSurfaceShader pdata] [nsurfVs] + + depthFunc $= Just Less -- draw the lightmap. Probably changes the bound framebufferObject createLightMap pdata (w ^. config . shadow_resolution) wallPoints lightPoints viewFroms diff --git a/src/Dodge/WorldEvent/Cloud.hs b/src/Dodge/WorldEvent/Cloud.hs index 9e3374e48..2e3292b0e 100644 --- a/src/Dodge/WorldEvent/Cloud.hs +++ b/src/Dodge/WorldEvent/Cloud.hs @@ -26,7 +26,7 @@ makeCloudAt rad t drawFunc p w = w & clouds %~ IM.insert i theCloud drawCloudWith :: Float -> Float -> Color -> Cloud -> Picture drawCloudWith radMult fadet col cl = setLayer 2 - . setDepth (-0.5) + . setDepth (-0.02) $ circleSolidCol (withAlpha 0 col) (withAlpha a col) (radMult * _clRad cl) where a = min 1 $ fromIntegral (_clTimer cl) / fadet diff --git a/src/Dodge/WorldEvent/SpawnParticle.hs b/src/Dodge/WorldEvent/SpawnParticle.hs index 61e6d3541..284f7ae00 100644 --- a/src/Dodge/WorldEvent/SpawnParticle.hs +++ b/src/Dodge/WorldEvent/SpawnParticle.hs @@ -56,9 +56,9 @@ drawFlame rotd pt = thePic ep = _btPos' pt thePic = pictures [ glow - , aPic prot2 0.2998 (scaleChange + 1,2) red - , aPic prot 0.2996 (scaleChange + 0.5,1.5) orange - , aPic prot3 0.2994 (scaleChange,1) white + , aPic prot2 0.002998 (scaleChange + 1,2) red + , aPic prot 0.002996 (scaleChange + 0.5,1.5) orange + , aPic prot3 0.002994 (scaleChange,1) white ] aPic :: (Point2 -> Point2) -> Float -> Point2 -> Color -> Picture aPic offset depth (scalex,scaley) col diff --git a/src/Picture/Render.hs b/src/Picture/Render.hs index 3eb8b1720..2cfa20bcd 100644 --- a/src/Picture/Render.hs +++ b/src/Picture/Render.hs @@ -71,6 +71,7 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) _ = do bindShaderBuffers [_lightingWallShader pdata] [nWallLights] nWalls <- F.foldM (pokeShader $ _lightingOccludeShader pdata) (map Render22 wallPoints) bindShaderBuffers [_lightingOccludeShader pdata] [nWalls] + -- clear buffer to full alpha and furthest depth -- clearColor is specified in preloadRender clear [ColorBuffer,DepthBuffer] @@ -102,12 +103,6 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) _ = do pokeFourOff lightPtr 0 (x,y,r,lum) bindShaderBuffers [_lightingFloorShader pdata] [1] - nsurfVs <- F.foldM (pokeShader (_lightingSurfaceShader pdata)) [Render3 - [(0,0,0.1) - ,(500,0,0.1) - ,(-500,500,0.1) - ] ] - bindShaderBuffers [_lightingSurfaceShader pdata] [nsurfVs] -- stencil out walls colorMask $= Color4 Disabled Disabled Disabled Disabled diff --git a/src/Tile.hs b/src/Tile.hs index c2cccc9e2..36d42279f 100644 --- a/src/Tile.hs +++ b/src/Tile.hs @@ -10,7 +10,7 @@ tToRender t = map Render3x3 $ polyToTris $ zip ps3 coords3 where ps = _tilePoly t coords = map (calcTexCoord (_tileCenter t) (_tileX t) (_tileY t)) ps - ps3 = map (mkTrip 0.1) ps + ps3 = map (mkTrip 0.05) ps coords3 = map (mkTrip (_tileZ t)) coords mkTrip :: c -> (a,b) -> (a,b,c)