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

73 lines
2.1 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"
#include "../mwworld/environment.hpp"
2011-12-15 05:33:10 +00:00
#include <components/nif/node.hpp>
#include <map>
2012-01-05 00:47:06 +00:00
#include <openengine/bullet/physic.hpp>
2012-01-06 07:27:10 +00:00
namespace MWRender{
struct PosAndRot{
Ogre::Quaternion vecRot;
Ogre::Vector3 vecPos;
};
class Animation{
protected:
2012-01-06 02:45:17 +00:00
Ogre::SceneNode* insert;
OEngine::Render::OgreRenderer &mRend;
MWWorld::Environment& mEnvironment;
std::map<Nif::NiSkinData::BoneInfoCopy*, PosAndRot> vecRotPos;
static std::map<std::string, int> mUniqueIDs;
2012-03-05 22:46:29 +00:00
2012-01-05 04:48:25 +00:00
2012-01-06 02:45:17 +00:00
std::vector<std::vector<Nif::NiTriShapeCopy>* > shapeparts; //All the NiTriShape data that we need for animating an npc
2011-12-14 04:49:03 +00:00
float time;
float startTime;
float stopTime;
int animate;
2011-12-14 04:49:03 +00: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-06 02:45:17 +00:00
//Only shapes with morphing data will use a shape number
2011-12-14 04:49:03 +00:00
int shapeNumber;
std::vector<std::vector<int> > shapeIndexI;
2011-12-14 04:49:03 +00:00
2011-12-27 05:20:14 +00:00
//Ogre::SkeletonInstance* skel;
2012-01-06 02:45:17 +00:00
std::vector<Nif::NiTriShapeCopy>* shapes; //All the NiTriShapeData for a creature
2011-12-28 03:35:22 +00:00
std::vector<Ogre::Entity*> entityparts;
2011-12-27 05:20:14 +00:00
2011-12-14 04:49:03 +00:00
std::vector<Nif::NiKeyframeData>* transformations;
2012-01-06 05:55:02 +00:00
std::map<std::string,float>* textmappings;
Ogre::Entity* base;
2011-12-15 05:33:10 +00:00
void handleShapes(std::vector<Nif::NiTriShapeCopy>* allshapes, Ogre::Entity* creaturemodel, Ogre::SkeletonInstance *skel);
2011-12-28 03:35:22 +00:00
void handleAnimationTransforms();
2012-03-06 23:28:41 +00:00
bool timeIndex( float time, const std::vector<float> & times, int & i, int & j, float & x );
std::string getUniqueID(std::string mesh);
public:
2012-03-05 22:46:29 +00:00
Animation(MWWorld::Environment& _env, OEngine::Render::OgreRenderer& _rend): mRend(_rend), mEnvironment(_env), animate(0){};
virtual void runAnimation(float timepassed) = 0;
void startScript(std::string groupname, int mode, int loops);
void stopScript();
virtual ~Animation();
};
}
#endif