Tweak drawing parameters

This commit is contained in:
jgk
2021-06-25 18:43:45 +02:00
parent 06a92e70ee
commit 726cd425f2
8 changed files with 36 additions and 31 deletions
+2 -6
View File
@@ -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]
+13 -8
View File
@@ -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
+7 -5
View File
@@ -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
+8 -1
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 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
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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
+1 -6
View File
@@ -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
+1 -1
View File
@@ -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)