mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 17:15:35 +00:00
Don't copy osga-data in base class keyframecontroller, fix warnings.
This commit is contained in:
parent
6e77ad1f6a
commit
32d4344803
5 changed files with 20 additions and 21 deletions
|
@ -31,7 +31,7 @@ namespace OsgAOpenMW
|
|||
|
||||
osg::ref_ptr<OsgaController::KeyframeController> callback = new OsgaController::KeyframeController();
|
||||
|
||||
std::vector<SceneUtil::EmulatedAnimation> emulatedAnimations;
|
||||
std::vector<OsgaController::EmulatedAnimation> emulatedAnimations;
|
||||
|
||||
for (auto animation : mAnimationManager->getAnimationList())
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ namespace OsgAOpenMW
|
|||
mTarget.mTextKeys.emplace(startTime, std::move(loopstart));
|
||||
mTarget.mTextKeys.emplace(stopTime, std::move(loopstop));
|
||||
|
||||
SceneUtil::EmulatedAnimation emulatedAnimation;
|
||||
OsgaController::EmulatedAnimation emulatedAnimation;
|
||||
emulatedAnimation.mStartTime = startTime;
|
||||
emulatedAnimation.mStopTime = stopTime;
|
||||
emulatedAnimation.mName = animationName;
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace OsgAOpenMW
|
|||
public:
|
||||
RetrieveAnimationsVisitor(SceneUtil::KeyframeHolder& target, osg::ref_ptr<osgAnimation::BasicAnimationManager> animationManager);
|
||||
|
||||
virtual void apply(osg::Node& node);
|
||||
virtual void apply(osg::Node& node) override;
|
||||
|
||||
private:
|
||||
SceneUtil::KeyframeHolder& mTarget;
|
||||
|
|
|
@ -11,13 +11,6 @@
|
|||
|
||||
namespace SceneUtil
|
||||
{
|
||||
struct EmulatedAnimation
|
||||
{
|
||||
float mStartTime;
|
||||
float mStopTime;
|
||||
std::string mName;
|
||||
};
|
||||
|
||||
class KeyframeController : public osg::NodeCallback, public SceneUtil::Controller
|
||||
{
|
||||
public:
|
||||
|
@ -26,18 +19,12 @@ namespace SceneUtil
|
|||
KeyframeController(const KeyframeController& copy, const osg::CopyOp& copyop)
|
||||
: osg::NodeCallback(copy, copyop)
|
||||
, SceneUtil::Controller(copy)
|
||||
, mMergedAnimationTracks(copy.mMergedAnimationTracks)
|
||||
, mEmulatedAnimations(copy.mEmulatedAnimations)
|
||||
{}
|
||||
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); }
|
||||
|
||||
protected:
|
||||
std::vector<osg::ref_ptr<Resource::Animation>> mMergedAnimationTracks; // Used only by osgAnimation-based formats (e.g. dae)
|
||||
std::vector<EmulatedAnimation> mEmulatedAnimations;
|
||||
virtual void operator() (osg::Node* node, osg::NodeVisitor* nodeVisitor) override { traverse(node, nodeVisitor); }
|
||||
};
|
||||
|
||||
/// Wrapper object containing an animation track as a ref-countable osg::Object.
|
||||
|
|
|
@ -102,6 +102,8 @@ namespace OsgaController
|
|||
}
|
||||
|
||||
KeyframeController::KeyframeController(const KeyframeController ©, const osg::CopyOp ©op) : SceneUtil::KeyframeController(copy, copyop)
|
||||
, mMergedAnimationTracks(copy.mMergedAnimationTracks)
|
||||
, mEmulatedAnimations(copy.mEmulatedAnimations)
|
||||
{
|
||||
mLinker = nullptr;
|
||||
}
|
||||
|
@ -183,7 +185,7 @@ namespace OsgaController
|
|||
traverse(node, nv);
|
||||
}
|
||||
|
||||
void KeyframeController::setEmulatedAnimations(std::vector<SceneUtil::EmulatedAnimation> emulatedAnimations)
|
||||
void KeyframeController::setEmulatedAnimations(std::vector<EmulatedAnimation> emulatedAnimations)
|
||||
{
|
||||
mEmulatedAnimations = emulatedAnimations;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,13 @@
|
|||
|
||||
namespace OsgaController
|
||||
{
|
||||
struct EmulatedAnimation
|
||||
{
|
||||
float mStartTime;
|
||||
float mStopTime;
|
||||
std::string mName;
|
||||
};
|
||||
|
||||
class LinkVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
@ -29,9 +36,9 @@ namespace OsgaController
|
|||
|
||||
virtual void setAnimation(Resource::Animation* animation);
|
||||
|
||||
virtual void apply(osg::Node& node);
|
||||
virtual void apply(osg::Node& node) override;
|
||||
|
||||
virtual void apply(osg::Geode& node);
|
||||
virtual void apply(osg::Geode& node) override;
|
||||
|
||||
protected:
|
||||
Resource::Animation* mAnimation;
|
||||
|
@ -57,13 +64,16 @@ namespace OsgaController
|
|||
void operator() (osg::Node*, osg::NodeVisitor*) override;
|
||||
|
||||
/// @brief Sets details of the animations
|
||||
void setEmulatedAnimations(std::vector<SceneUtil::EmulatedAnimation> emulatedAnimations);
|
||||
void setEmulatedAnimations(std::vector<EmulatedAnimation> emulatedAnimations);
|
||||
|
||||
/// @brief Adds an animation track to a model
|
||||
void addMergedAnimationTrack(osg::ref_ptr<Resource::Animation> animationTrack);
|
||||
|
||||
private:
|
||||
bool mNeedToLink = true;
|
||||
osg::ref_ptr<LinkVisitor> mLinker;
|
||||
std::vector<osg::ref_ptr<Resource::Animation>> mMergedAnimationTracks; // Used only by osgAnimation-based formats (e.g. dae)
|
||||
std::vector<EmulatedAnimation> mEmulatedAnimations;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue