Separate keyframes logic to provide basis for osgAnimation integration.
parent
37661bffea
commit
f78a5d795c
@ -0,0 +1,68 @@
|
||||
#ifndef OPENMW_COMPONENTS_SCENEUTIL_KEYFRAME_HPP
|
||||
#define OPENMW_COMPONENTS_SCENEUTIL_KEYFRAME_HPP
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <osg/Node>
|
||||
|
||||
#include <components/sceneutil/controller.hpp>
|
||||
#include <components/sceneutil/textkeymap.hpp>
|
||||
|
||||
namespace SceneUtil
|
||||
{
|
||||
|
||||
class KeyframeController : public osg::NodeCallback, public SceneUtil::Controller
|
||||
{
|
||||
public:
|
||||
KeyframeController() {}
|
||||
|
||||
KeyframeController(const KeyframeController& copy, const osg::CopyOp& copyop)
|
||||
: osg::NodeCallback(copy, copyop)
|
||||
, SceneUtil::Controller(copy)
|
||||
{}
|
||||
META_Object(SceneUtil, KeyframeController)
|
||||
|
||||
virtual osg::Vec3f getTranslation(float time) const { return osg::Vec3f(); }
|
||||
|
||||
virtual void operator() (osg::Node* node, osg::NodeVisitor* nodeVisitor) { traverse(node, nodeVisitor); }
|
||||
};
|
||||
|
||||
/// Wrapper object containing an animation track as a ref-countable osg::Object.
|
||||
struct TextKeyMapHolder : public osg::Object
|
||||
{
|
||||
public:
|
||||
TextKeyMapHolder() {}
|
||||
TextKeyMapHolder(const TextKeyMapHolder& copy, const osg::CopyOp& copyop)
|
||||
: osg::Object(copy, copyop)
|
||||
, mTextKeys(copy.mTextKeys)
|
||||
{}
|
||||
|
||||
TextKeyMap mTextKeys;
|
||||
|
||||
META_Object(SceneUtil, TextKeyMapHolder)
|
||||
|
||||
};
|
||||
|
||||
/// Wrapper object containing the animation track and its KeyframeControllers.
|
||||
class KeyframeHolder : public osg::Object
|
||||
{
|
||||
public:
|
||||
KeyframeHolder() {}
|
||||
KeyframeHolder(const KeyframeHolder& copy, const osg::CopyOp& copyop)
|
||||
: mTextKeys(copy.mTextKeys)
|
||||
, mKeyframeControllers(copy.mKeyframeControllers)
|
||||
{
|
||||
}
|
||||
|
||||
TextKeyMap mTextKeys;
|
||||
|
||||
META_Object(SceneUtil, KeyframeHolder)
|
||||
|
||||
/// Controllers mapped to node name.
|
||||
typedef std::map<std::string, osg::ref_ptr<const KeyframeController> > KeyframeControllerMap;
|
||||
KeyframeControllerMap mKeyframeControllers;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,12 +1,12 @@
|
||||
#ifndef OPENMW_COMPONENTS_NIFOSG_TEXTKEYMAP
|
||||
#define OPENMW_COMPONENTS_NIFOSG_TEXTKEYMAP
|
||||
#ifndef OPENMW_COMPONENTS_SCENEUTIL_TEXTKEYMAP
|
||||
#define OPENMW_COMPONENTS_SCENEUTIL_TEXTKEYMAP
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace NifOsg
|
||||
namespace SceneUtil
|
||||
{
|
||||
class TextKeyMap
|
||||
{
|
Loading…
Reference in New Issue