forked from mirror/openmw-tes3mp
Update position by reference
This commit is contained in:
parent
9e05ee53da
commit
102b3bdef9
2 changed files with 8 additions and 7 deletions
|
@ -392,18 +392,19 @@ void Animation::updateSkeletonInstance(const Ogre::SkeletonInstance *skelsrc, Og
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Ogre::Vector3 Animation::updatePosition()
|
void Animation::updatePosition(Ogre::Vector3 &position)
|
||||||
{
|
{
|
||||||
Ogre::Vector3 posdiff;
|
Ogre::Vector3 posdiff;
|
||||||
|
|
||||||
/* Get the non-accumulation root's difference from the last update. */
|
/* Get the non-accumulation root's difference from the last update, and move the position
|
||||||
|
* accordingly.
|
||||||
|
*/
|
||||||
posdiff = (mNonAccumCtrl->getTranslation(mLayer[0].mTime) - mLastPosition) * mAccumulate;
|
posdiff = (mNonAccumCtrl->getTranslation(mLayer[0].mTime) - mLastPosition) * mAccumulate;
|
||||||
|
position += posdiff;
|
||||||
|
|
||||||
/* Translate the accumulation root back to compensate for the move. */
|
/* Translate the accumulation root back to compensate for the move. */
|
||||||
mLastPosition += posdiff;
|
mLastPosition += posdiff;
|
||||||
mAccumRoot->setPosition(-mLastPosition);
|
mAccumRoot->setPosition(-mLastPosition);
|
||||||
|
|
||||||
return posdiff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Animation::reset(size_t layeridx, const NifOgre::TextKeyMap &keys, NifOgre::NodeTargetValue<Ogre::Real> *nonaccumctrl, const std::string &groupname, const std::string &start, const std::string &stop)
|
bool Animation::reset(size_t layeridx, const NifOgre::TextKeyMap &keys, NifOgre::NodeTargetValue<Ogre::Real> *nonaccumctrl, const std::string &groupname, const std::string &start, const std::string &stop)
|
||||||
|
@ -602,14 +603,14 @@ Ogre::Vector3 Animation::runAnimation(float duration)
|
||||||
{
|
{
|
||||||
mLayer[layeridx].mTime = targetTime;
|
mLayer[layeridx].mTime = targetTime;
|
||||||
if(layeridx == 0 && mNonAccumCtrl)
|
if(layeridx == 0 && mNonAccumCtrl)
|
||||||
movement += updatePosition();
|
updatePosition(movement);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
NifOgre::TextKeyMap::const_iterator key(mLayer[layeridx].mNextKey++);
|
NifOgre::TextKeyMap::const_iterator key(mLayer[layeridx].mNextKey++);
|
||||||
mLayer[layeridx].mTime = key->first;
|
mLayer[layeridx].mTime = key->first;
|
||||||
if(layeridx == 0 && mNonAccumCtrl)
|
if(layeridx == 0 && mNonAccumCtrl)
|
||||||
movement += updatePosition();
|
updatePosition(movement);
|
||||||
|
|
||||||
mLayer[layeridx].mPlaying = (key != mLayer[layeridx].mStopKey);
|
mLayer[layeridx].mPlaying = (key != mLayer[layeridx].mStopKey);
|
||||||
timepassed = targetTime - mLayer[layeridx].mTime;
|
timepassed = targetTime - mLayer[layeridx].mTime;
|
||||||
|
|
|
@ -88,7 +88,7 @@ protected:
|
||||||
|
|
||||||
/* Updates the position of the accum root node for the current time, and
|
/* Updates the position of the accum root node for the current time, and
|
||||||
* returns the wanted movement vector from the previous update. */
|
* returns the wanted movement vector from the previous update. */
|
||||||
Ogre::Vector3 updatePosition();
|
void updatePosition(Ogre::Vector3 &position);
|
||||||
|
|
||||||
static NifOgre::TextKeyMap::const_iterator findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname);
|
static NifOgre::TextKeyMap::const_iterator findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue