deparallelize

This commit is contained in:
nek0 2017-11-15 18:28:38 +01:00
parent 08c28fe686
commit f7dac3e0b6

View file

@ -13,7 +13,6 @@ import Affection.Types
import Control.Monad import Control.Monad
import Control.Monad.State (get) import Control.Monad.State (get)
import qualified Control.Monad.Parallel as MP
import Data.Maybe import Data.Maybe
@ -34,7 +33,7 @@ updateParticle
-> Affection us [Particle] -> Affection us [Particle]
-- ^ processed 'Particle's -- ^ processed 'Particle's
updateParticle time func l = updateParticle time func l =
catMaybes <$> MP.mapM (\p -> do catMaybes <$> mapM (\p -> do
now <- elapsedTime <$> get now <- elapsedTime <$> get
if particleCreation p + particleTimeToLive p < now if particleCreation p + particleTimeToLive p < now
then do then do
@ -124,7 +123,7 @@ drawParticleSystem sys draw =
if not (null parts) if not (null parts)
then do then do
liftIO $ G.gegl_node_link (particleStackCont $ head parts) (partSysNode sys) liftIO $ G.gegl_node_link (particleStackCont $ head parts) (partSysNode sys)
MP.mapM_ (draw (partSysBuffer sys) (partSysNode sys)) parts mapM_ (draw (partSysBuffer sys) (partSysNode sys)) parts
else do else do
_ <- liftIO $ G.gegl_node_disconnect (partSysNode sys) "input" _ <- liftIO $ G.gegl_node_disconnect (partSysNode sys) "input"
return () return ()