Refactor low light display
This commit is contained in:
@@ -10,6 +10,8 @@ import Dodge.WorldEvent.HelperParticle
|
|||||||
import Picture
|
import Picture
|
||||||
import Geometry
|
import Geometry
|
||||||
|
|
||||||
|
import Data.Maybe (maybeToList)
|
||||||
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
|
|
||||||
flareAt' :: Color -> Float -> Float -> Point2 -> World -> World
|
flareAt' :: Color -> Float -> Float -> Point2 -> World -> World
|
||||||
@@ -23,13 +25,15 @@ lowLightColAt col alphay p w = foldr (lowLightWidthHit 10 5 col alphay p) w ps
|
|||||||
where ps = map ((+.+) p) $ nRaysRad 20 30
|
where ps = map ((+.+) p) $ nRaysRad 20 30
|
||||||
|
|
||||||
lowLightWidthForHit :: Float -> Float -> Color -> Float -> Int -> Point2 -> Point2 -> World -> World
|
lowLightWidthForHit :: Float -> Float -> Color -> Float -> Int -> Point2 -> Point2 -> World -> World
|
||||||
lowLightWidthForHit len wdth col alphay t a b w
|
lowLightWidthForHit len wdth col alphay t a b w = w & particles' %~ (maybeToList glareLine ++)
|
||||||
= case thingsHitLongLine a b w of
|
where glareLine = glareBetween t len wdth col alphay a b w
|
||||||
((p, E3x2 wall):_)
|
|
||||||
-> over particles' ((:) (wallGlareFor t len wdth col alphay p wall)) w
|
glareBetween :: Int -> Float -> Float -> Color -> Float -> Point2 -> Point2 -> World -> Maybe Particle'
|
||||||
((p, E3x1 cr):_)
|
glareBetween 0 _ _ _ _ _ _ _ = Nothing
|
||||||
-> over particles' ((:) (crGlareFor t wdth col alphay p cr)) w
|
glareBetween t len wdth col alphay a b w
|
||||||
_ -> w
|
= Just $ Particle' {_ptPict' = lowLightPic len wdth col alphay a b w
|
||||||
|
,_ptUpdate' = \ w' _ -> (w',glareBetween (t-1) len wdth col alphay a b w')
|
||||||
|
}
|
||||||
|
|
||||||
lowLightPic :: Float -> Float -> Color -> Float -> Point2 -> Point2 -> World -> Picture
|
lowLightPic :: Float -> Float -> Color -> Float -> Point2 -> Point2 -> World -> Picture
|
||||||
lowLightPic len wdth col alphay a b w
|
lowLightPic len wdth col alphay a b w
|
||||||
|
|||||||
Reference in New Issue
Block a user