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-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-18 22:25:32 +00:00
|
|
|
Ogre::Vector3 mAccumulate;
|
2013-01-07 12:48:59 +00:00
|
|
|
Ogre::Vector3 mStartPosition;
|
2013-01-07 05:18:48 +00:00
|
|
|
Ogre::Vector3 mLastPosition;
|
|
|
|
|
2013-01-17 21:18:40 +00:00
|
|
|
NifOgre::TextKeyMap *mCurrentKeys;
|
|
|
|
NifOgre::TextKeyMap::const_iterator mNextKey;
|
|
|
|
Ogre::AnimationState *mAnimState;
|
2013-01-19 05:40:47 +00:00
|
|
|
float mAnimSpeedMult;
|
2013-01-07 13:56:03 +00:00
|
|
|
|
2013-01-19 01:05:58 +00:00
|
|
|
/* Updates the animation to the specified time, and returns the movement
|
|
|
|
* vector since the last update or reset. */
|
2013-01-19 00:21:29 +00:00
|
|
|
Ogre::Vector3 updatePosition(float time);
|
2013-01-19 01:05:58 +00:00
|
|
|
/* Updates the animation to the specified time, without moving anything. */
|
2013-01-07 05:18:48 +00:00
|
|
|
void resetPosition(float time);
|
2012-04-23 13:27:03 +00:00
|
|
|
|
2013-01-17 21:18:40 +00:00
|
|
|
float findStart(const std::string &groupname, const std::string &start);
|
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-20 05:55:04 +00:00
|
|
|
|
|
|
|
bool hasAnimation(const std::string &anim);
|
2013-01-16 23:00:06 +00:00
|
|
|
|
2013-01-18 22:25:32 +00:00
|
|
|
// Specifies the axis' to accumulate on. Non-accumulated axis will just
|
|
|
|
// move visually, but not affect the actual movement. Each x/y/z value
|
|
|
|
// should be on the scale of 0 to 1.
|
|
|
|
void setAccumulation(const Ogre::Vector3 &accum);
|
|
|
|
|
2013-01-19 05:40:47 +00:00
|
|
|
void setSpeedMult(float speedmult)
|
|
|
|
{ mAnimSpeedMult = speedmult; }
|
|
|
|
|
2013-01-17 21:18:40 +00:00
|
|
|
void play(const std::string &groupname, const std::string &start);
|
2013-01-19 00:21:29 +00:00
|
|
|
virtual Ogre::Vector3 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
|