1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Remove the character controller from the Animation class

This commit is contained in:
Chris Robinson 2013-04-24 07:10:41 -07:00
parent b80891099e
commit 333354fe62
4 changed files with 4 additions and 31 deletions

View File

@ -108,8 +108,6 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
if(!mAnimation) if(!mAnimation)
return; return;
mAnimation->setController(this);
getStateInfo(mState, &mCurrentGroup); getStateInfo(mState, &mCurrentGroup);
if(MWWorld::Class::get(mPtr).isActor()) if(MWWorld::Class::get(mPtr).isActor())
{ {
@ -126,17 +124,6 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
mAnimation->play(mCurrentGroup, "start", "stop", loop ? (~(size_t)0) : 0); mAnimation->play(mCurrentGroup, "start", "stop", loop ? (~(size_t)0) : 0);
} }
CharacterController::CharacterController(const CharacterController &rhs)
: mPtr(rhs.mPtr), mAnimation(rhs.mAnimation), mAnimQueue(rhs.mAnimQueue)
, mCurrentGroup(rhs.mCurrentGroup), mState(rhs.mState)
, mSkipAnim(rhs.mSkipAnim)
{
if(!mAnimation)
return;
/* We've been copied. Update the animation with the new controller. */
mAnimation->setController(this);
}
CharacterController::~CharacterController() CharacterController::~CharacterController()
{ {
} }

View File

@ -81,7 +81,6 @@ class CharacterController
public: public:
CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim, CharacterState state, bool loop); CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim, CharacterState state, bool loop);
CharacterController(const CharacterController &rhs);
virtual ~CharacterController(); virtual ~CharacterController();
void updatePtr(const MWWorld::Ptr &ptr); void updatePtr(const MWWorld::Ptr &ptr);

View File

@ -59,14 +59,13 @@ void Animation::destroyObjectList(Ogre::SceneManager *sceneMgr, NifOgre::ObjectL
Animation::Animation(const MWWorld::Ptr &ptr) Animation::Animation(const MWWorld::Ptr &ptr)
: mPtr(ptr) : mPtr(ptr)
, mController(NULL)
, mInsert(NULL) , mInsert(NULL)
, mSkelBase(NULL) , mSkelBase(NULL)
, mAccumRoot(NULL) , mAccumRoot(NULL)
, mNonAccumRoot(NULL) , mNonAccumRoot(NULL)
, mNonAccumCtrl(NULL)
, mAccumulate(0.0f) , mAccumulate(0.0f)
, mLastPosition(0.0f) , mLastPosition(0.0f)
, mNonAccumCtrl(NULL)
, mAnimVelocity(0.0f) , mAnimVelocity(0.0f)
, mAnimSpeedMult(1.0f) , mAnimSpeedMult(1.0f)
{ {
@ -299,12 +298,6 @@ bool Animation::hasAnimation(const std::string &anim)
} }
void Animation::setController(MWMechanics::CharacterController *controller)
{
mController = controller;
}
void Animation::setAccumulation(const Ogre::Vector3 &accum) void Animation::setAccumulation(const Ogre::Vector3 &accum)
{ {
mAccumulate = accum; mAccumulate = accum;

View File

@ -8,10 +8,6 @@
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
namespace MWMechanics
{
class CharacterController;
}
namespace MWRender namespace MWRender
{ {
@ -61,20 +57,20 @@ protected:
}; };
MWWorld::Ptr mPtr; MWWorld::Ptr mPtr;
MWMechanics::CharacterController *mController;
Ogre::SceneNode *mInsert; Ogre::SceneNode *mInsert;
Ogre::Entity *mSkelBase; Ogre::Entity *mSkelBase;
std::vector<ObjectInfo> mObjects; std::vector<ObjectInfo> mObjects;
Ogre::Node *mAccumRoot; Ogre::Node *mAccumRoot;
Ogre::Bone *mNonAccumRoot; Ogre::Bone *mNonAccumRoot;
NifOgre::NodeTargetValue<Ogre::Real> *mNonAccumCtrl;
Ogre::Vector3 mAccumulate; Ogre::Vector3 mAccumulate;
Ogre::Vector3 mLastPosition; Ogre::Vector3 mLastPosition;
NifOgre::NodeTargetValue<Ogre::Real> *mNonAccumCtrl; std::vector<Ogre::Controller<Ogre::Real> > mActiveCtrls;
float mAnimVelocity; float mAnimVelocity;
float mAnimSpeedMult; float mAnimSpeedMult;
std::vector<Ogre::Controller<Ogre::Real> > mActiveCtrls;
static const size_t sMaxLayers = 1; static const size_t sMaxLayers = 1;
AnimLayer mLayer[sMaxLayers]; AnimLayer mLayer[sMaxLayers];
@ -116,8 +112,6 @@ public:
Animation(const MWWorld::Ptr &ptr); Animation(const MWWorld::Ptr &ptr);
virtual ~Animation(); virtual ~Animation();
void setController(MWMechanics::CharacterController *controller);
void updatePtr(const MWWorld::Ptr &ptr); void updatePtr(const MWWorld::Ptr &ptr);
bool hasAnimation(const std::string &anim); bool hasAnimation(const std::string &anim);