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

Reduce includes in animation.hpp

This commit is contained in:
scrawl 2015-06-14 23:13:26 +02:00
parent 9e049894e8
commit f017fd6860
5 changed files with 42 additions and 20 deletions

View File

@ -19,6 +19,8 @@
#include "character.hpp" #include "character.hpp"
#include <iostream>
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>
#include "movement.hpp" #include "movement.hpp"

View File

@ -17,6 +17,7 @@
#include <components/resource/texturemanager.hpp> #include <components/resource/texturemanager.hpp>
#include <components/nifosg/nifloader.hpp> // KeyframeHolder #include <components/nifosg/nifloader.hpp> // KeyframeHolder
#include <components/nifosg/controller.hpp>
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>
@ -204,6 +205,17 @@ namespace
namespace MWRender namespace MWRender
{ {
struct Animation::AnimSource
{
osg::ref_ptr<const NifOsg::KeyframeHolder> mKeyframes;
typedef std::map<std::string, osg::ref_ptr<NifOsg::KeyframeController> > ControllerMap;
ControllerMap mControllerMap[Animation::sNumGroups];
const std::multimap<float, std::string>& getTextKeys();
};
class ResetAccumRootCallback : public osg::NodeCallback class ResetAccumRootCallback : public osg::NodeCallback
{ {
public: public:
@ -1211,4 +1223,22 @@ namespace MWRender
addExtraLight(getOrCreateObjectRoot(), ptr.get<ESM::Light>()->mBase); addExtraLight(getOrCreateObjectRoot(), ptr.get<ESM::Light>()->mBase);
} }
Animation::AnimState::~AnimState()
{
}
// ------------------------------
PartHolder::PartHolder(osg::ref_ptr<osg::Node> node)
: mNode(node)
{
}
PartHolder::~PartHolder()
{
if (mNode->getNumParents())
mNode->getParent(0)->removeChild(mNode);
}
} }

View File

@ -3,7 +3,7 @@
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include <components/nifosg/controller.hpp> #include <components/sceneutil/controller.hpp>
namespace ESM namespace ESM
{ {
@ -18,6 +18,7 @@ namespace Resource
namespace NifOsg namespace NifOsg
{ {
class KeyframeHolder; class KeyframeHolder;
class KeyframeController;
} }
namespace MWRender namespace MWRender
@ -43,16 +44,9 @@ public:
class PartHolder class PartHolder
{ {
public: public:
PartHolder(osg::ref_ptr<osg::Node> node) PartHolder(osg::ref_ptr<osg::Node> node);
: mNode(node)
{
}
~PartHolder() ~PartHolder();
{
if (mNode->getNumParents())
mNode->getParent(0)->removeChild(mNode);
}
osg::ref_ptr<osg::Node> getNode() osg::ref_ptr<osg::Node> getNode()
{ {
@ -116,16 +110,7 @@ protected:
} }
}; };
struct AnimSource struct AnimSource;
{
osg::ref_ptr<const NifOsg::KeyframeHolder> mKeyframes;
typedef std::map<std::string, osg::ref_ptr<NifOsg::KeyframeController> > ControllerMap;
ControllerMap mControllerMap[sNumGroups];
const std::multimap<float, std::string>& getTextKeys();
};
struct AnimState { struct AnimState {
boost::shared_ptr<AnimSource> mSource; boost::shared_ptr<AnimSource> mSource;
@ -150,6 +135,8 @@ protected:
mPriority(0), mGroups(0), mAutoDisable(true) mPriority(0), mGroups(0), mAutoDisable(true)
{ {
} }
~AnimState();
float getTime() const float getTime() const
{ {
return *mTime; return *mTime;

View File

@ -1,6 +1,7 @@
#include "camera.hpp" #include "camera.hpp"
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>
#include <osg/Camera>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"

View File

@ -1,5 +1,7 @@
#include "characterpreview.hpp" #include "characterpreview.hpp"
#include <iostream>
#include <osg/Texture2D> #include <osg/Texture2D>
#include <osg/Camera> #include <osg/Camera>
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>