mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-21 20:11:34 +00:00
Animation: cache getVelocity()
This commit is contained in:
parent
a2cede8f34
commit
ee4073541c
2 changed files with 10 additions and 0 deletions
|
@ -575,6 +575,8 @@ namespace MWRender
|
||||||
mAccumCtrl = NULL;
|
mAccumCtrl = NULL;
|
||||||
|
|
||||||
mAnimSources.clear();
|
mAnimSources.clear();
|
||||||
|
|
||||||
|
mAnimVelocities.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Animation::hasAnimation(const std::string &anim) const
|
bool Animation::hasAnimation(const std::string &anim) const
|
||||||
|
@ -952,6 +954,10 @@ namespace MWRender
|
||||||
if (!mAccumRoot)
|
if (!mAccumRoot)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
|
std::map<std::string, float>::const_iterator found = mAnimVelocities.find(groupname);
|
||||||
|
if (found != mAnimVelocities.end())
|
||||||
|
return found->second;
|
||||||
|
|
||||||
// Look in reverse; last-inserted source has priority.
|
// Look in reverse; last-inserted source has priority.
|
||||||
AnimSourceList::const_reverse_iterator animsrc(mAnimSources.rbegin());
|
AnimSourceList::const_reverse_iterator animsrc(mAnimSources.rbegin());
|
||||||
for(;animsrc != mAnimSources.rend();++animsrc)
|
for(;animsrc != mAnimSources.rend();++animsrc)
|
||||||
|
@ -999,6 +1005,8 @@ namespace MWRender
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mAnimVelocities.insert(std::make_pair(groupname, velocity));
|
||||||
|
|
||||||
return velocity;
|
return velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -274,6 +274,8 @@ protected:
|
||||||
|
|
||||||
float mAlpha;
|
float mAlpha;
|
||||||
|
|
||||||
|
mutable std::map<std::string, float> mAnimVelocities;
|
||||||
|
|
||||||
osg::ref_ptr<SceneUtil::LightListCallback> mLightListCallback;
|
osg::ref_ptr<SceneUtil::LightListCallback> mLightListCallback;
|
||||||
|
|
||||||
const NodeMap& getNodeMap() const;
|
const NodeMap& getNodeMap() const;
|
||||||
|
|
Loading…
Reference in a new issue