Add explicit layer datatype

This commit is contained in:
2022-04-10 10:48:17 +01:00
parent edd82fb3ac
commit 77c3f83d20
27 changed files with 75 additions and 70 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ smokeCloudAt
smokeCloudAt col = makeCloudAt (drawCloudWith (4/3) 800 col)
drawCloudWith :: Float -> Float -> Color -> Cloud -> Picture
drawCloudWith radMult fadet col cl = setLayer 2
drawCloudWith radMult fadet col cl = setLayer MidLayer
. setDepth 25
$ circleSolidCol (withAlpha 0 col) (withAlpha a col) (radMult * _clRad cl)
where
+2 -2
View File
@@ -28,7 +28,7 @@ muzFlareAt :: Color -> Point3 -> Float -> World -> World
muzFlareAt col tranv dir w = w & instantParticles .:~ theFlare
where
theFlare = Particle
{ _ptDraw = const $ setLayer 1 . translate3 tranv $ theShape
{ _ptDraw = const $ setLayer BloomNoZWrite . translate3 tranv $ theShape
, _ptUpdate = ptSimpleTime 2
}
theShape = rotate dir . color col $ polygon
@@ -40,7 +40,7 @@ muzFlareAt col tranv dir w = w & instantParticles .:~ theFlare
flareCircleAt :: Color -> Float -> Point3 -> World -> World
flareCircleAt col alphax tranv = instantParticles .:~ Particle
{ _ptDraw = const . setLayer 1 . translate3 tranv
{ _ptDraw = const . setLayer BloomNoZWrite . translate3 tranv
$ circleSolidCol (withAlpha 0 0) (withAlpha alphax col) 50
, _ptUpdate = ptSimpleTime 1
}
+2 -3
View File
@@ -8,7 +8,6 @@ import Dodge.Data
import Dodge.Wall.Damage
import Dodge.Base
import Dodge.Zone
import Dodge.Picture.Layer
import Geometry
import Picture
import LensHelp
@@ -38,7 +37,7 @@ makeShockwaveAt is p rad dam push col = instantParticles .:~ Shockwave
{- Shockwave picture. -}
drawShockwave :: Particle -> Picture
drawShockwave pt = setDepth 20
. setLayer 1
. setLayer BloomLayer
. uncurryV translate (_ptPos pt)
. color (_ptColor pt)
$ thickCircle rad thickness
@@ -115,7 +114,7 @@ moveInverseShockwave w pt
drawInverseShockwave :: Particle -> Picture
drawInverseShockwave pt
= setLayer 1 $ setDepth 20 $ uncurryV translate p
= setLayer BloomLayer $ setDepth 20 $ uncurryV translate p
$ color cyan $ thickCircle rad thickness
where
p = _ptPos pt
+10 -10
View File
@@ -51,13 +51,13 @@ drawFlame
-> Picture
drawFlame rotd pt = pictures
[ glow
, aPic 3 prot2 25 (V2 (scaleChange + 1) 2 ) $ V4 2 (-1) (-1) 0.5
, aPic 3 prot 22 (V2 (scaleChange + 0.5) 1 ) $ V4 1 0.5 0 2
, aPic 1 prot3 20 (V2 scaleChange 0.5) $ V4 1 1 1 1
, aPic BloomNoZWrite prot2 25 (V2 (scaleChange + 1) 2 ) $ V4 2 (-1) (-1) 0.5
, aPic BloomNoZWrite prot 22 (V2 (scaleChange + 0.5) 1 ) $ V4 1 0.5 0 2
, aPic BloomLayer prot3 20 (V2 scaleChange 0.5) $ V4 1 1 1 1
]
where
ep = _ptPos pt
aPic :: Int -> (Point2 -> Point2) -> Float -> Point2 -> Color -> Picture
aPic :: Layer -> (Point2 -> Point2) -> Float -> Point2 -> Color -> Picture
aPic lay offset depth (V2 scalex scaley) col
= setLayer lay
. setDepth depth
@@ -66,7 +66,7 @@ drawFlame rotd pt = pictures
. scale scalex scaley
. color col
$ circleSolid 5
glow = setLayer 1 $ setDepth 0.3 $ uncurryV translate ep
glow = setLayer BloomNoZWrite $ setDepth 0.3 $ uncurryV translate ep
$ circleSolidCol (withAlpha 0 orange) (withAlpha 0.02 orange) 50
time = _ptTimer pt
scaleChange
@@ -202,7 +202,7 @@ makeFlamelet (V2 x y) z vel maycid size time w = w
drawStaticBall
:: Particle
-> Picture
drawStaticBall pt = setLayer 1
drawStaticBall pt = setLayer BloomNoZWrite
. setDepth (_ptZ pt + 20)
. uncurryV translate (_ptPos pt)
$ circleSolidCol (_ptColor pt) (withAlpha 0.5 white) (_ptWidth pt+5)
@@ -212,9 +212,9 @@ drawFlameletZ
-> Particle
-> Picture
drawFlameletZ rot pt = pictures
[ setLayer 1 pic
, setLayer 3 piu
, setLayer 3 pi2
[ setLayer BloomLayer pic
, setLayer BloomNoZWrite piu
, setLayer BloomNoZWrite pi2
]
where
z = _ptZ pt
@@ -292,7 +292,7 @@ makeGasCloud pos vel w = w
theCloud = Cloud
{ _clPos = addZ 20 pos
, _clVel = addZ 0 vel
, _clPict = \_ -> setLayer 2 . setDepth 30 $ color (withAlpha 0.05 col)
, _clPict = \_ -> setLayer MidLayer . setDepth 30 $ color (withAlpha 0.05 col)
$ circleSolid 20
, _clRad = 10
, _clAlt = 25