1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-11 09:36:37 +00:00
OpenMW/apps/openmw/mwrender/animation.hpp
Chris Robinson 3e9b0a333c Allow specifying the accumulation for animations
Animations that move a character may do so either visually or physically. An
axis' accumuluation value specifies whether the movement is visual (0) or
physical (1). Idle animations, for instance, typically don't physically move a
character, while death animations may physically move them along the X and Y
planes, but not along Z (the vertical movement is purely visual).
2013-01-18 14:25:32 -08:00

64 lines
1.7 KiB
C++

#ifndef _GAME_RENDER_ANIMATION_H
#define _GAME_RENDER_ANIMATION_H
#include <components/nifogre/ogre_nif_loader.hpp>
#include "../mwworld/ptr.hpp"
namespace MWMechanics
{
class CharacterController;
}
namespace MWRender
{
class Animation
{
protected:
MWWorld::Ptr mPtr;
MWMechanics::CharacterController *mController;
Ogre::SceneNode* mInsert;
NifOgre::EntityList mEntityList;
std::map<std::string,NifOgre::TextKeyMap> mTextKeys;
Ogre::Bone *mAccumRoot;
Ogre::Bone *mNonAccumRoot;
Ogre::Vector3 mAccumulate;
Ogre::Vector3 mStartPosition;
Ogre::Vector3 mLastPosition;
NifOgre::TextKeyMap *mCurrentKeys;
NifOgre::TextKeyMap::const_iterator mNextKey;
Ogre::AnimationState *mAnimState;
/* 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);
float findStart(const std::string &groupname, const std::string &start);
void createEntityList(Ogre::SceneNode *node, const std::string &model);
public:
Animation(const MWWorld::Ptr &ptr);
virtual ~Animation();
void setController(MWMechanics::CharacterController *controller);
std::vector<std::string> getAnimationNames();
// 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);
void play(const std::string &groupname, const std::string &start);
virtual void runAnimation(float timepassed);
};
}
#endif