You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/apps/openmw/mwrender/animation.hpp

66 lines
1.6 KiB
C++

#ifndef _GAME_RENDER_ANIMATION_H
#define _GAME_RENDER_ANIMATION_H
#include <components/nifogre/ogre_nif_loader.hpp>
#include "../mwworld/ptr.hpp"
namespace MWRender
{
class Animation
{
struct GroupTimes {
NifOgre::TextKeyMap::const_iterator mStart;
NifOgre::TextKeyMap::const_iterator mStop;
NifOgre::TextKeyMap::const_iterator mLoopStart;
NifOgre::TextKeyMap::const_iterator mLoopStop;
Ogre::AnimationState *mAnimState;
size_t mLoops;
GroupTimes()
: mAnimState(NULL), mLoops(0)
{ }
};
protected:
MWWorld::Ptr mPtr;
Ogre::SceneNode* mInsert;
NifOgre::EntityList mEntityList;
std::map<std::string,NifOgre::TextKeyMap> mTextKeys;
Ogre::Bone *mAccumRoot;
Ogre::Bone *mNonAccumRoot;
Ogre::Vector3 mStartPosition;
Ogre::Vector3 mLastPosition;
float mTime;
GroupTimes mCurGroup;
GroupTimes mNextGroup;
bool mSkipFrame;
/* 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);
bool findGroupTimes(const std::string &groupname, GroupTimes *times);
void createEntityList(Ogre::SceneNode *node, const std::string &model);
public:
Animation(const MWWorld::Ptr &ptr);
virtual ~Animation();
void playGroup(std::string groupname, int mode, int loops);
void skipAnim();
virtual void runAnimation(float timepassed);
};
}
#endif