animationmgr: avoid looping over all avars in favor of only active ones

This commit is contained in:
vaxerski 2023-07-20 19:26:10 +02:00
parent 7940f779e9
commit 6c1f4faff2
4 changed files with 23 additions and 9 deletions

View file

@ -58,12 +58,7 @@ void CAnimationManager::tick() {
std::vector<CAnimatedVariable*> animationEndedVars;
for (auto& av : m_lAnimatedVariables) {
// first of all, check if we need to update it at all
// TODO: this has a 100% cache miss rate, maybe move active avars to a separate vec
if (!av->m_bIsBeingAnimated)
continue;
for (auto& av : m_vActiveAnimatedVariables) {
if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !*PSHADOWSENABLED) {
av->warp(false);

View file

@ -25,7 +25,8 @@ class CAnimationManager {
std::unordered_map<std::string, CBezierCurve> getAllBeziers();
std::list<CAnimatedVariable*> m_lAnimatedVariables;
std::vector<CAnimatedVariable*> m_vAnimatedVariables;
std::vector<CAnimatedVariable*> m_vActiveAnimatedVariables;
wl_event_source* m_pAnimationTick;