2011-11-24 01:48:54 -05:00
|
|
|
#ifndef _GAME_RENDER_ANIMATION_H
|
|
|
|
#define _GAME_RENDER_ANIMATION_H
|
|
|
|
#include <components/nif/data.hpp>
|
2011-12-11 22:40:00 -05:00
|
|
|
#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>
|
2011-12-17 01:29:08 -05:00
|
|
|
#include <map>
|
2012-01-04 19:47:06 -05:00
|
|
|
#include <openengine/bullet/physic.hpp>
|
2011-12-11 22:40:00 -05:00
|
|
|
|
2012-01-06 02:27:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-24 01:48:54 -05:00
|
|
|
namespace MWRender{
|
2011-12-11 22:40:00 -05:00
|
|
|
|
2012-01-12 16:03:07 -05:00
|
|
|
struct PosAndRot{
|
|
|
|
Ogre::Quaternion vecRot;
|
|
|
|
Ogre::Vector3 vecPos;
|
|
|
|
};
|
|
|
|
|
2011-11-24 01:48:54 -05:00
|
|
|
class Animation{
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2011-12-11 22:40:00 -05:00
|
|
|
protected:
|
2012-01-05 21:45:17 -05:00
|
|
|
Ogre::SceneNode* insert;
|
2011-12-11 22:40:00 -05:00
|
|
|
OEngine::Render::OgreRenderer &mRend;
|
2012-01-25 01:21:30 -05:00
|
|
|
std::map<Nif::NiSkinData::BoneInfoCopy*, PosAndRot> vecRotPos;
|
2011-12-17 01:29:08 -05:00
|
|
|
static std::map<std::string, int> mUniqueIDs;
|
2012-04-23 15:27:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2012-04-07 22:02:20 -04:00
|
|
|
|
2011-12-13 23:49:03 -05:00
|
|
|
|
|
|
|
float time;
|
|
|
|
float startTime;
|
|
|
|
float stopTime;
|
2011-12-28 21:52:05 -05:00
|
|
|
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-04-23 15:27:03 +02:00
|
|
|
|
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;
|
2011-12-27 19:19:45 -05:00
|
|
|
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
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2011-12-27 00:20:14 -05:00
|
|
|
|
2011-12-11 22:40:00 -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;
|
2011-12-11 22:40:00 -05:00
|
|
|
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 );
|
2011-12-17 01:29:08 -05:00
|
|
|
std::string getUniqueID(std::string mesh);
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2011-12-11 22:40:00 -05:00
|
|
|
public:
|
2012-04-23 15:27:03 +02:00
|
|
|
Animation(OEngine::Render::OgreRenderer& _rend);
|
2012-03-25 21:56:22 +02:00
|
|
|
virtual void runAnimation(float timepassed) = 0;
|
|
|
|
void startScript(std::string groupname, int mode, int loops);
|
|
|
|
void stopScript();
|
|
|
|
|
|
|
|
|
|
|
|
virtual ~Animation();
|
2012-04-23 15:27:03 +02:00
|
|
|
|
2011-11-24 01:48:54 -05:00
|
|
|
};
|
|
|
|
}
|
2012-03-25 21:56:22 +02:00
|
|
|
#endif
|