forked from teamnwah/openmw-tes3coop
Make an AnimationValue for each animation layer
This commit is contained in:
parent
68a9a4de5f
commit
7241267d5c
2 changed files with 26 additions and 22 deletions
|
@ -58,8 +58,7 @@ void Animation::destroyObjectList(Ogre::SceneManager *sceneMgr, NifOgre::ObjectL
|
|||
}
|
||||
|
||||
Animation::Animation(const MWWorld::Ptr &ptr)
|
||||
: mAnimationBaseValuePtr(OGRE_NEW AnimationValue(this, 0))
|
||||
, mPtr(ptr)
|
||||
: mPtr(ptr)
|
||||
, mController(NULL)
|
||||
, mInsert(NULL)
|
||||
, mSkelBase(NULL)
|
||||
|
@ -71,6 +70,9 @@ Animation::Animation(const MWWorld::Ptr &ptr)
|
|||
, mAnimVelocity(0.0f)
|
||||
, mAnimSpeedMult(1.0f)
|
||||
{
|
||||
for(size_t i = 0;i < sMaxLayers;i++)
|
||||
mAnimationValuePtr[i].bind(OGRE_NEW AnimationValue(this, i));
|
||||
|
||||
/* As long as we remain under 128 active controllers, we can avoid
|
||||
* reallocations. */
|
||||
mActiveCtrls.reserve(128);
|
||||
|
@ -153,7 +155,7 @@ void Animation::addObjectList(Ogre::SceneNode *node, const std::string &model, b
|
|||
for(size_t i = 0;i < objlist.mControllers.size();i++)
|
||||
{
|
||||
if(objlist.mControllers[i].getSource().isNull())
|
||||
objlist.mControllers[i].setSource(mAnimationBaseValuePtr);
|
||||
objlist.mControllers[i].setSource(mAnimationValuePtr[0]);
|
||||
}
|
||||
|
||||
mActiveCtrls.insert(mActiveCtrls.end(), objlist.mControllers.begin(), objlist.mControllers.end());
|
||||
|
|
|
@ -33,10 +33,6 @@ protected:
|
|||
virtual Ogre::Real getValue() const;
|
||||
virtual void setValue(Ogre::Real value);
|
||||
};
|
||||
Ogre::SharedPtr<Ogre::ControllerValue<Ogre::Real> > mAnimationBaseValuePtr;
|
||||
|
||||
MWWorld::Ptr mPtr;
|
||||
MWMechanics::CharacterController *mController;
|
||||
|
||||
struct ObjectInfo {
|
||||
NifOgre::ObjectList mObjectList;
|
||||
|
@ -47,20 +43,6 @@ protected:
|
|||
int mActiveLayers;
|
||||
};
|
||||
|
||||
Ogre::SceneNode *mInsert;
|
||||
Ogre::Entity *mSkelBase;
|
||||
std::vector<ObjectInfo> mObjects;
|
||||
Ogre::Node *mAccumRoot;
|
||||
Ogre::Bone *mNonAccumRoot;
|
||||
Ogre::Vector3 mAccumulate;
|
||||
Ogre::Vector3 mLastPosition;
|
||||
|
||||
NifOgre::NodeTargetValue<Ogre::Real> *mNonAccumCtrl;
|
||||
float mAnimVelocity;
|
||||
float mAnimSpeedMult;
|
||||
std::vector<Ogre::Controller<Ogre::Real> > mActiveCtrls;
|
||||
|
||||
static const size_t sMaxLayers = 1;
|
||||
struct AnimLayer {
|
||||
std::string mGroupName;
|
||||
std::vector<Ogre::Controller<Ogre::Real> > *mControllers;
|
||||
|
@ -76,7 +58,27 @@ protected:
|
|||
bool mLooping;
|
||||
|
||||
AnimLayer();
|
||||
} mLayer[sMaxLayers];
|
||||
};
|
||||
|
||||
MWWorld::Ptr mPtr;
|
||||
MWMechanics::CharacterController *mController;
|
||||
|
||||
Ogre::SceneNode *mInsert;
|
||||
Ogre::Entity *mSkelBase;
|
||||
std::vector<ObjectInfo> mObjects;
|
||||
Ogre::Node *mAccumRoot;
|
||||
Ogre::Bone *mNonAccumRoot;
|
||||
Ogre::Vector3 mAccumulate;
|
||||
Ogre::Vector3 mLastPosition;
|
||||
|
||||
NifOgre::NodeTargetValue<Ogre::Real> *mNonAccumCtrl;
|
||||
float mAnimVelocity;
|
||||
float mAnimSpeedMult;
|
||||
std::vector<Ogre::Controller<Ogre::Real> > mActiveCtrls;
|
||||
|
||||
static const size_t sMaxLayers = 1;
|
||||
AnimLayer mLayer[sMaxLayers];
|
||||
Ogre::SharedPtr<Ogre::ControllerValue<Ogre::Real> > mAnimationValuePtr[sMaxLayers];
|
||||
|
||||
static float calcAnimVelocity(const NifOgre::TextKeyMap &keys,
|
||||
NifOgre::NodeTargetValue<Ogre::Real> *nonaccumctrl,
|
||||
|
|
Loading…
Reference in a new issue