Allow tweaking z buffer when rendering polygon, improve explosion render

This commit is contained in:
2021-07-03 23:56:01 +02:00
parent 532f491327
commit 9df19a9e85
33 changed files with 339 additions and 82 deletions
+13 -6
View File
@@ -16,6 +16,7 @@ import Dodge.Creature.Test
import Dodge.Item.Data
import Picture
import Geometry
import Geometry.Vector3D
import Control.Lens
import Data.List
@@ -29,12 +30,13 @@ basicCrPict col cr w = pictures $
targetingPic ++
[ tr . setDepth 0 $ color yellow $ circleSolid 10
, tr . piercingMod $ bluntScale $ naked col cr
, tr $ waist col
, 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
f invid it = fmap ((\g -> g invid it cr w) . snd) (it ^? itTargeting . _Just)
tr = uncurry translate (_crPos cr) . rotate (_crDir cr)
@@ -55,9 +57,6 @@ basicCrPict col cr w = pictures $
_ -> id
pastDams = _crPastDamage $ _crState cr
waist :: Color -> Picture
waist col = setDepth 10 . color (light4 col) . scale 0.5 1 $ circleSolid 8
feet :: Creature -> Picture
feet cr = case cr ^? crStance . carriage of
Just (Walking sa LeftForward) -> setL
@@ -99,7 +98,15 @@ arms col cr
f i = negate 2 + negate 6 * fromIntegral (sLen - i) / fromIntegral sLen
aimingTwist = crIsAiming' cr -- && crIt ^? itAimStance == Just TwoHandTwist
--crIt = _crInv cr IM.! _crInvSel cr
torso :: Color -> Point2 -> Point2 -> Picture
torso col x y = color col $ pictures
[ poly3 [addZ 20 x, addZ 12 v, addZ 12 ((0,0) -.- v), addZ 20 y]
, setDepth 12 . rotate a . scale 1 1 $ circleSolid $ magV v
]
where
v = 0.25 *.* (x -.- y)
a = argV v
naked :: Color -> Creature -> Picture
naked col cr
@@ -125,7 +132,7 @@ naked col cr
, shoulderH . translate 0 (negate 3) . rotate 0.2 . scale 0.5 1 $ color col' $ circleSolid $ _crRad cr
]
where
fhead = setDepth 30 $ circleSolid $ crad * 0.5
fhead = setDepth 22 $ circleSolid $ crad * 0.5
shoulderH = setDepth 20
twistA = negate 1
aimingOneHand = crIsAiming' cr && crIt ^? itAimStance == Just OneHand