1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00
OpenMW/apps/openmw/mwrender/animation.hpp

72 lines
1.8 KiB
C++
Raw Normal View History

#ifndef _GAME_RENDER_ANIMATION_H
#define _GAME_RENDER_ANIMATION_H
#include <components/nif/data.hpp>
#include <openengine/ogre/renderer.hpp>
#include "../mwworld/refdata.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontalk.hpp"
2011-12-15 00:33:10 -05:00
#include <components/nif/node.hpp>
#include <map>
2012-01-04 19:47:06 -05:00
#include <openengine/bullet/physic.hpp>
2012-01-06 02:27:10 -05:00
namespace MWRender{
struct PosAndRot{
Ogre::Quaternion vecRot;
Ogre::Vector3 vecPos;
};
class Animation{
protected:
2012-01-05 21:45:17 -05:00
Ogre::SceneNode* insert;
OEngine::Render::OgreRenderer &mRend;
std::map<Nif::NiSkinData::BoneInfoCopy*, PosAndRot> vecRotPos;
static std::map<std::string, int> mUniqueIDs;
2012-04-07 22:02:20 -04:00
2011-12-13 23:49:03 -05:00
float time;
float startTime;
float stopTime;
int animate;
2011-12-13 23:49:03 -05:00
//Represents a rotation index for each bone
std::vector<int>rindexI;
//Represents a translation index for each bone
std::vector<int>tindexI;
2012-01-05 21:45:17 -05:00
//Only shapes with morphing data will use a shape number
2011-12-13 23:49:03 -05:00
int shapeNumber;
std::vector<std::vector<int> > shapeIndexI;
2011-12-13 23:49:03 -05:00
2011-12-27 00:20:14 -05:00
//Ogre::SkeletonInstance* skel;
2012-01-05 21:45:17 -05:00
std::vector<Nif::NiTriShapeCopy>* shapes; //All the NiTriShapeData for a creature
2011-12-27 00:20:14 -05:00
2011-12-13 23:49:03 -05:00
std::vector<Nif::NiKeyframeData>* transformations;
2012-01-06 00:55:02 -05:00
std::map<std::string,float>* textmappings;
Ogre::Entity* base;
2011-12-15 00:33:10 -05:00
void handleShapes(std::vector<Nif::NiTriShapeCopy>* allshapes, Ogre::Entity* creaturemodel, Ogre::SkeletonInstance *skel);
2011-12-27 22:35:22 -05:00
void handleAnimationTransforms();
2012-03-06 18:28:41 -05:00
bool timeIndex( float time, const std::vector<float> & times, int & i, int & j, float & x );
std::string getUniqueID(std::string mesh);
public:
Animation(OEngine::Render::OgreRenderer& _rend);
virtual void runAnimation(float timepassed) = 0;
void startScript(std::string groupname, int mode, int loops);
void stopScript();
virtual ~Animation();
};
}
#endif