Improve window drawing

This commit is contained in:
2025-10-28 09:58:44 +00:00
parent d6c4d3d609
commit 10503da955
9 changed files with 58 additions and 42 deletions
+19 -19
View File
@@ -11,7 +11,7 @@ module Dodge.WorldEvent.Explosion (
import Control.Monad
import Data.List
import Dodge.Data.World
--import Dodge.EnergyBall
import Dodge.EnergyBall
import Dodge.SoundLogic
import Dodge.WorldEvent.Shockwave
import Dodge.WorldEvent.SpawnParticle
@@ -20,7 +20,7 @@ import LensHelp
import Picture
import RandomHelp
import Linear.V3
--import Linear.Metric
import Linear.Metric
makePoisonExplosionAt ::
-- | Position
@@ -71,25 +71,25 @@ makeFlameExplosionAt p w =
-- particle passes through for the first frame of its existence
makeExplosionAt :: Point3 -> Point3 -> World -> World
--makeExplosionAt p vel w =
makeExplosionAt p _ w =
makeExplosionAt p vel w =
--makeExplosionAt p _ w =
w
& soundStart (Explosion (w ^. cWorld . lWorld . lClock)) (p ^. _xy) bangS Nothing
-- & addFlames
& addFlames
& cWorld . lWorld . worldEvents
.:~ MakeTempLight (LSParam p 150 (V3 1 0.5 0)) 20
-- & makeShockwaveAt [] p 50 50 1 white
& makeShockwaveAt [] p 50 5000 1 white
& makeShockwaveAt [] p 50 100 1 white
-- & makeShockwaveAt [] p 50 5000 1 white
where
-- fVs = fmap (`v2z` 0) $ replicateM 100 (randInCirc 1) & evalState $ _randGen w
-- fPs' = fmap (`v2z` 0) $ replicateM 100 (randInCirc 5) & evalState $ _randGen w
-- fdamps = replicateM 100 (state $ randomR (0,1)) & evalState $ _randGen w
-- inversePushOut v = (15 - norm v) * 0.01 *.*.* v
-- fVs' = zipWith (+.+.+) fVs $ map inversePushOut fPs'
-- sizes = randomRs (2, 9) $ _randGen w
-- times = randomRs (15, 20) $ _randGen w
-- mF q v damp size time = makeFlamelet
-- --(q - (2*v + 2* vel)) (v + damp *.*.* vel) size time
-- (q - (2*v )) (v + damp *.*.* vel) size time
-- newFs = zipWith4 (mF p) (zipWith (+) fPs' (fmap (3 *.*.*) fVs')) fdamps sizes times
-- addFlames w' = foldl' (flip ($)) w' newFs
fVs = fmap (`v2z` 0) $ replicateM 100 (randInCirc 1) & evalState $ _randGen w
fPs' = fmap (`v2z` 0) $ replicateM 100 (randInCirc 5) & evalState $ _randGen w
fdamps = replicateM 100 (state $ randomR (0,1)) & evalState $ _randGen w
inversePushOut v = (15 - norm v) * 0.01 *.*.* v
fVs' = zipWith (+.+.+) fVs $ map inversePushOut fPs'
sizes = randomRs (2, 9) $ _randGen w
times = randomRs (15, 20) $ _randGen w
mF q v damp size time = makeFlamelet
--(q - (2*v + 2* vel)) (v + damp *.*.* vel) size time
(q - (2*v )) (v + damp *.*.* vel) size time
newFs = zipWith4 (mF p) (zipWith (+) fPs' (fmap (3 *.*.*) fVs')) fdamps sizes times
addFlames w' = foldl' (flip ($)) w' newFs