From Cedric Pinson, add missing files
This commit is contained in:
parent
b6ab5bbe27
commit
641769a681
42
include/osgAnimation/BoneMapVisitor
Normal file
42
include/osgAnimation/BoneMapVisitor
Normal file
@ -0,0 +1,42 @@
|
||||
/* -*-c++-*-
|
||||
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*
|
||||
* Authors:
|
||||
* Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||
*/
|
||||
|
||||
#ifndef OSGANIMATION_BONEMAP_VISITOR_H
|
||||
#define OSGANIMATION_BONEMAP_VISITOR_H 1
|
||||
|
||||
#include <osgAnimation/Export>
|
||||
#include <osgAnimation/Bone>
|
||||
#include <osg/NodeVisitor>
|
||||
|
||||
namespace osgAnimation
|
||||
{
|
||||
class OSGANIMATION_EXPORT BoneMapVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
META_NodeVisitor("osgAnimation","BoneMapVisitor")
|
||||
BoneMapVisitor();
|
||||
|
||||
void apply(osg::Node&);
|
||||
void apply(osg::Transform& node);
|
||||
const Bone::BoneMap& getBoneMap() const;
|
||||
|
||||
protected:
|
||||
Bone::BoneMap _map;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
43
include/osgAnimation/ComputeBindMatrixVisitor
Normal file
43
include/osgAnimation/ComputeBindMatrixVisitor
Normal file
@ -0,0 +1,43 @@
|
||||
/* -*-c++-*-
|
||||
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef COMPUTE_BIND_MATRIX_VISITOR_H
|
||||
#define COMPUTE_BIND_MATRIX_VISITOR_H 1
|
||||
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osgAnimation/Bone>
|
||||
|
||||
namespace osgAnimation
|
||||
{
|
||||
|
||||
class ComputeBindMatrixVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
ComputeBindMatrixVisitor(): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
void apply(osg::Node& node) { return; }
|
||||
void apply(osg::Transform& node)
|
||||
{
|
||||
osgAnimation::Bone* bone = dynamic_cast<osgAnimation::Bone*>(&node);
|
||||
if (!bone)
|
||||
return;
|
||||
if (bone->needToComputeBindMatrix())
|
||||
bone->computeBindMatrix();
|
||||
|
||||
traverse(node);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
42
include/osgAnimation/FindParentAnimationManagerVisitor
Normal file
42
include/osgAnimation/FindParentAnimationManagerVisitor
Normal file
@ -0,0 +1,42 @@
|
||||
/* -*-c++-*-
|
||||
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef FIND_PARENT_ANIMATIONMANAGER_VISITOR_H
|
||||
#define FIND_PARENT_ANIMATIONMANAGER_VISITOR_H 1
|
||||
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osgAnimation/Export>
|
||||
|
||||
namespace osgAnimation
|
||||
{
|
||||
class AnimationManagerBase;
|
||||
|
||||
/**
|
||||
* Find the nearest AnimationManager traversing parent to parent
|
||||
*/
|
||||
class OSGANIMATION_EXPORT FindParentAnimationManagerVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
FindParentAnimationManagerVisitor();
|
||||
void apply(osg::Node& node);
|
||||
osgAnimation::AnimationManagerBase* getAnimationManager();
|
||||
|
||||
protected:
|
||||
osg::ref_ptr<osgAnimation::AnimationManagerBase> _manager;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
35
src/osgAnimation/BoneMapVisitor.cpp
Normal file
35
src/osgAnimation/BoneMapVisitor.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
/* -*-c++-*-
|
||||
* Copyright (C) 2009 Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*
|
||||
* Authors:
|
||||
* Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||
*/
|
||||
|
||||
#include <osgAnimation/BoneMapVisitor>
|
||||
|
||||
osgAnimation::BoneMapVisitor::BoneMapVisitor() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
|
||||
|
||||
void osgAnimation::BoneMapVisitor::apply(osg::Node&) { return; }
|
||||
void osgAnimation::BoneMapVisitor::apply(osg::Transform& node)
|
||||
{
|
||||
Bone* bone = dynamic_cast<Bone*>(&node);
|
||||
if (bone)
|
||||
{
|
||||
_map[bone->getName()] = bone;
|
||||
traverse(node);
|
||||
}
|
||||
}
|
||||
const osgAnimation::Bone::BoneMap& osgAnimation::BoneMapVisitor::getBoneMap() const
|
||||
{
|
||||
return _map;
|
||||
}
|
34
src/osgAnimation/FindParentAnimationManagerVisitor.cpp
Normal file
34
src/osgAnimation/FindParentAnimationManagerVisitor.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
/* -*-c++-*-
|
||||
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osgAnimation/FindParentAnimationManagerVisitor>
|
||||
#include <osgAnimation/AnimationManagerBase>
|
||||
|
||||
osgAnimation::FindParentAnimationManagerVisitor::FindParentAnimationManagerVisitor() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_PARENTS) {}
|
||||
void osgAnimation::FindParentAnimationManagerVisitor::apply(osg::Node& node)
|
||||
{
|
||||
if (_manager.valid())
|
||||
return;
|
||||
osg::NodeCallback* callback = node.getUpdateCallback();
|
||||
while (callback)
|
||||
{
|
||||
_manager = dynamic_cast<osgAnimation::AnimationManagerBase*>(callback);
|
||||
if (_manager.valid())
|
||||
return;
|
||||
callback = callback->getNestedCallback();
|
||||
}
|
||||
traverse(node);
|
||||
}
|
||||
|
||||
osgAnimation::AnimationManagerBase* osgAnimation::FindParentAnimationManagerVisitor::getAnimationManager() { return _manager.get(); }
|
Loading…
Reference in New Issue
Block a user