openmw-tes3coop/apps/openmw/mwrender/animation.hpp

67 lines
1.7 KiB
C++
Raw Normal View History

#ifndef _GAME_RENDER_ANIMATION_H
#define _GAME_RENDER_ANIMATION_H
2012-07-17 23:00:03 +00:00
#include <components/nifogre/ogre_nif_loader.hpp>
2012-01-06 07:27:10 +00:00
#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;
size_t mLoops;
GroupTimes(NifOgre::TextKeyMap::const_iterator iter)
: mStart(iter), mStop(iter), mLoopStart(iter), mLoopStop(iter),
mLoops(0)
{ }
};
protected:
MWWorld::Ptr mPtr;
Ogre::SceneNode* mInsert;
2012-07-17 23:00:03 +00:00
NifOgre::EntityList mEntityList;
NifOgre::TextKeyMap mTextKeys;
Ogre::Bone *mAccumRoot;
Ogre::Bone *mNonAccumRoot;
Ogre::Vector3 mStartPosition;
Ogre::Vector3 mLastPosition;
float mTime;
GroupTimes mCurGroup;
GroupTimes mNextGroup;
Ogre::AnimationState *mAnimState;
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