a little optimization
This commit is contained in:
parent
a028bb4204
commit
379a571147
1 changed files with 18 additions and 14 deletions
|
@ -117,21 +117,25 @@ updateParticleSystem
|
|||
-> Affection us ParticleSystem
|
||||
updateParticleSystem sys sec upd draw = do
|
||||
x <- catMaybes <$> mapM (updateParticle sec upd) (partStorList $ partSysParts sys)
|
||||
-- liftIO $ traceIO $ show $ length x
|
||||
-- x <- catMaybes <$> foldM (updateParticle sec upd) [] (reverse $ psParts sys)
|
||||
when (not $ null x) $ do
|
||||
-- liftIO $ G.gegl_node_link_many $ map particleStackCont (partStorList $ partSysParts sys)
|
||||
-- liftIO $ traceIO "linking last node to output"
|
||||
liftIO $ G.gegl_node_link (particleStackCont $ head x) (partSysNode sys)
|
||||
mapM_ (draw (partSysBuffer sys) (partSysNode sys)) x
|
||||
return $ sys
|
||||
{ partSysParts = (partSysParts sys)
|
||||
{ partStorList = x
|
||||
, partStorLatest =
|
||||
if null x
|
||||
then Nothing
|
||||
else partStorLatest (partSysParts sys)
|
||||
}
|
||||
}
|
||||
if (not $ null x)
|
||||
then do
|
||||
-- liftIO $ G.gegl_node_link_many $ map particleStackCont (partStorList $ partSysParts sys)
|
||||
-- liftIO $ traceIO "linking last node to output"
|
||||
liftIO $ G.gegl_node_link (particleStackCont $ head x) (partSysNode sys)
|
||||
mapM_ (draw (partSysBuffer sys) (partSysNode sys)) x
|
||||
return $ sys
|
||||
{ partSysParts = (partSysParts sys)
|
||||
{ partStorList = x
|
||||
, partStorLatest =
|
||||
if null x
|
||||
then Nothing
|
||||
else partStorLatest (partSysParts sys)
|
||||
}
|
||||
}
|
||||
else
|
||||
return sys
|
||||
|
||||
-- | Function for inserting a new 'Particle' into its 'PartileSystem'
|
||||
insertParticle
|
||||
|
|
Loading…
Reference in a new issue