2011-11-24 06:48:54 +00:00
|
|
|
#ifndef _GAME_RENDER_ANIMATION_H
|
|
|
|
#define _GAME_RENDER_ANIMATION_H
|
2012-07-17 07:27:12 +00:00
|
|
|
|
2012-07-17 23:00:03 +00:00
|
|
|
#include <components/nifogre/ogre_nif_loader.hpp>
|
2012-01-06 07:27:10 +00:00
|
|
|
|
2013-01-07 01:05:48 +00:00
|
|
|
#include "../mwworld/ptr.hpp"
|
|
|
|
|
2013-01-16 19:01:08 +00:00
|
|
|
namespace MWMechanics
|
|
|
|
{
|
|
|
|
class CharacterController;
|
|
|
|
}
|
|
|
|
|
2013-01-06 05:12:08 +00:00
|
|
|
namespace MWRender
|
|
|
|
{
|
2011-12-12 03:40:00 +00:00
|
|
|
|
2013-01-06 05:12:08 +00:00
|
|
|
class Animation
|
|
|
|
{
|
2012-07-24 21:42:01 +00:00
|
|
|
struct GroupTimes {
|
2013-01-16 19:57:08 +00:00
|
|
|
NifOgre::TextKeyMap *mTextKeys;
|
|
|
|
|
2013-01-07 13:56:03 +00:00
|
|
|
NifOgre::TextKeyMap::const_iterator mStart;
|
|
|
|
NifOgre::TextKeyMap::const_iterator mStop;
|
|
|
|
NifOgre::TextKeyMap::const_iterator mLoopStart;
|
|
|
|
NifOgre::TextKeyMap::const_iterator mLoopStop;
|
2012-07-24 21:42:01 +00:00
|
|
|
|
2013-01-16 19:57:08 +00:00
|
|
|
NifOgre::TextKeyMap::const_iterator mNext;
|
|
|
|
|
2013-01-09 09:40:38 +00:00
|
|
|
Ogre::AnimationState *mAnimState;
|
2012-07-24 21:42:01 +00:00
|
|
|
size_t mLoops;
|
|
|
|
|
2013-01-16 19:57:08 +00:00
|
|
|
GroupTimes() : mTextKeys(NULL), mAnimState(NULL), mLoops(0)
|
2012-07-24 21:42:01 +00:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2012-07-13 03:12:18 +00:00
|
|
|
protected:
|
2013-01-07 01:05:48 +00:00
|
|
|
MWWorld::Ptr mPtr;
|
2013-01-16 19:01:08 +00:00
|
|
|
MWMechanics::CharacterController *mController;
|
2012-04-23 13:27:03 +00:00
|
|
|
|
2013-01-16 19:01:08 +00:00
|
|
|
Ogre::SceneNode* mInsert;
|
2012-07-17 23:00:03 +00:00
|
|
|
NifOgre::EntityList mEntityList;
|
2013-01-09 11:30:55 +00:00
|
|
|
std::map<std::string,NifOgre::TextKeyMap> mTextKeys;
|
2013-01-07 05:18:48 +00:00
|
|
|
Ogre::Bone *mAccumRoot;
|
|
|
|
Ogre::Bone *mNonAccumRoot;
|
2013-01-07 12:48:59 +00:00
|
|
|
Ogre::Vector3 mStartPosition;
|
2013-01-07 05:18:48 +00:00
|
|
|
Ogre::Vector3 mLastPosition;
|
|
|
|
|
2013-01-07 13:56:03 +00:00
|
|
|
float mTime;
|
|
|
|
GroupTimes mCurGroup;
|
|
|
|
GroupTimes mNextGroup;
|
|
|
|
|
|
|
|
bool mSkipFrame;
|
|
|
|
|
2013-01-07 05:18:48 +00:00
|
|
|
/* Updates the animation to the specified time, and moves the mPtr object
|
|
|
|
* based on the change since the last update or reset. */
|
|
|
|
void updatePosition(float time);
|
|
|
|
/* Updates the animation to the specified time, without moving the mPtr
|
|
|
|
* object. */
|
|
|
|
void resetPosition(float time);
|
2012-04-23 13:27:03 +00:00
|
|
|
|
2012-07-24 21:42:01 +00:00
|
|
|
bool findGroupTimes(const std::string &groupname, GroupTimes *times);
|
2012-07-24 20:51:48 +00:00
|
|
|
|
2013-01-05 07:19:48 +00:00
|
|
|
void createEntityList(Ogre::SceneNode *node, const std::string &model);
|
|
|
|
|
2012-07-13 03:12:18 +00:00
|
|
|
public:
|
2013-01-07 01:05:48 +00:00
|
|
|
Animation(const MWWorld::Ptr &ptr);
|
2012-07-13 03:12:18 +00:00
|
|
|
virtual ~Animation();
|
2012-07-20 07:53:12 +00:00
|
|
|
|
2013-01-16 19:01:08 +00:00
|
|
|
void setController(MWMechanics::CharacterController *controller);
|
2013-01-17 05:16:22 +00:00
|
|
|
std::vector<std::string> getAnimationNames();
|
2013-01-16 23:00:06 +00:00
|
|
|
|
2012-07-20 07:53:12 +00:00
|
|
|
void playGroup(std::string groupname, int mode, int loops);
|
|
|
|
void skipAnim();
|
2012-07-21 21:41:26 +00:00
|
|
|
virtual void runAnimation(float timepassed);
|
2011-11-24 06:48:54 +00:00
|
|
|
};
|
2012-07-13 03:12:18 +00:00
|
|
|
|
2011-11-24 06:48:54 +00:00
|
|
|
}
|
2012-03-25 19:56:22 +00:00
|
|
|
#endif
|