{- | Flashes. projected naming conventions: three base types of light: glare : Draws color onto surfaces (not done) flare : coloured light drawn in space, fixed shapes light : removal of shadows (onto surfaces) duration (subject to modification): flash : short, abrupt changes in alpha glow : continuous, potentially long, fading, slow changes in alpha flicker : potentially long, moving, abrupt changes in alpha -} module Dodge.WorldEvent.Flash ( explosionFlashAt, muzFlareAt, flareCircleAt, ) where import Dodge.Data.World import Dodge.LightSource --import Dodge.Default import Geometry import LensHelp import Picture import System.Random muzFlareAt :: Color -> Point3 -> Float -> World -> World muzFlareAt col tranv dir w = w & cWorld . flares .:~ MuzFlare { _flarePoly = map (rotateV dir) [ V2 0 0 , V2 a (- b) , V2 c d ] , _flareColor = col , _flareTran3 = tranv , _flareTime = 2 } where (a : b : c : d : _) = randomRs (2, 20) (_randGen w) flareCircleAt :: Color -> Float -> Point3 -> World -> World flareCircleAt col alphax tranv = cWorld . flares .:~ CircFlare { _flareTime = 2 , _flareColor = col , _flareAlpha = alphax , _flareTran3 = tranv } explosionFlashAt :: Point2 -> World -> World explosionFlashAt p = cWorld . tempLightSources .:~ tlsTimeRadFunPos 20 150 (TLSFade 1 10) (addZ 20 p)