2011-11-24 01:48:54 -05:00
|
|
|
#ifndef _GAME_RENDER_ANIMATION_H
|
|
|
|
#define _GAME_RENDER_ANIMATION_H
|
2012-07-17 09:27:12 +02:00
|
|
|
|
2012-07-17 16:00:03 -07:00
|
|
|
#include <components/nifogre/ogre_nif_loader.hpp>
|
2012-01-06 02:27:10 -05:00
|
|
|
|
2013-01-06 17:05:48 -08:00
|
|
|
#include "../mwworld/ptr.hpp"
|
|
|
|
|
2013-01-16 11:01:08 -08:00
|
|
|
namespace MWMechanics
|
|
|
|
{
|
|
|
|
class CharacterController;
|
|
|
|
}
|
|
|
|
|
2013-01-05 21:12:08 -08:00
|
|
|
namespace MWRender
|
|
|
|
{
|
2011-12-11 22:40:00 -05:00
|
|
|
|
2013-01-05 21:12:08 -08:00
|
|
|
class Animation
|
|
|
|
{
|
2012-07-12 20:12:18 -07:00
|
|
|
protected:
|
2013-01-06 17:05:48 -08:00
|
|
|
MWWorld::Ptr mPtr;
|
2013-01-16 11:01:08 -08:00
|
|
|
MWMechanics::CharacterController *mController;
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2013-01-16 11:01:08 -08:00
|
|
|
Ogre::SceneNode* mInsert;
|
2012-07-17 16:00:03 -07:00
|
|
|
NifOgre::EntityList mEntityList;
|
2013-01-09 03:30:55 -08:00
|
|
|
std::map<std::string,NifOgre::TextKeyMap> mTextKeys;
|
2013-01-06 21:18:48 -08:00
|
|
|
Ogre::Bone *mAccumRoot;
|
|
|
|
Ogre::Bone *mNonAccumRoot;
|
2013-01-18 14:25:32 -08:00
|
|
|
Ogre::Vector3 mAccumulate;
|
2013-01-07 04:48:59 -08:00
|
|
|
Ogre::Vector3 mStartPosition;
|
2013-01-06 21:18:48 -08:00
|
|
|
Ogre::Vector3 mLastPosition;
|
|
|
|
|
2013-01-17 13:18:40 -08:00
|
|
|
NifOgre::TextKeyMap *mCurrentKeys;
|
|
|
|
NifOgre::TextKeyMap::const_iterator mNextKey;
|
|
|
|
Ogre::AnimationState *mAnimState;
|
2013-01-18 21:40:47 -08:00
|
|
|
float mAnimSpeedMult;
|
2013-01-07 05:56:03 -08:00
|
|
|
|
2013-01-18 17:05:58 -08:00
|
|
|
/* Updates the animation to the specified time, and returns the movement
|
|
|
|
* vector since the last update or reset. */
|
2013-01-18 16:21:29 -08:00
|
|
|
Ogre::Vector3 updatePosition(float time);
|
2013-01-18 17:05:58 -08:00
|
|
|
/* Updates the animation to the specified time, without moving anything. */
|
2013-01-06 21:18:48 -08:00
|
|
|
void resetPosition(float time);
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2013-01-17 13:18:40 -08:00
|
|
|
float findStart(const std::string &groupname, const std::string &start);
|
2012-07-24 13:51:48 -07:00
|
|
|
|
2013-01-04 23:19:48 -08:00
|
|
|
void createEntityList(Ogre::SceneNode *node, const std::string &model);
|
|
|
|
|
2012-07-12 20:12:18 -07:00
|
|
|
public:
|
2013-01-06 17:05:48 -08:00
|
|
|
Animation(const MWWorld::Ptr &ptr);
|
2012-07-12 20:12:18 -07:00
|
|
|
virtual ~Animation();
|
2012-07-20 00:53:12 -07:00
|
|
|
|
2013-01-16 11:01:08 -08:00
|
|
|
void setController(MWMechanics::CharacterController *controller);
|
2013-01-16 21:16:22 -08:00
|
|
|
std::vector<std::string> getAnimationNames();
|
2013-01-16 15:00:06 -08:00
|
|
|
|
2013-01-18 14:25:32 -08: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-18 21:40:47 -08:00
|
|
|
void setSpeedMult(float speedmult)
|
|
|
|
{ mAnimSpeedMult = speedmult; }
|
|
|
|
|
2013-01-17 13:18:40 -08:00
|
|
|
void play(const std::string &groupname, const std::string &start);
|
2013-01-18 16:21:29 -08:00
|
|
|
virtual Ogre::Vector3 runAnimation(float timepassed);
|
2011-11-24 01:48:54 -05:00
|
|
|
};
|
2012-07-12 20:12:18 -07:00
|
|
|
|
2011-11-24 01:48:54 -05:00
|
|
|
}
|
2012-03-25 21:56:22 +02:00
|
|
|
#endif
|