From Fabien Lavignotte,"Some other litte changes just to clean up the API.
TimeLine : remove virtual inheritance that is not needed RigGeometry : put some methods/members in private section (everything was public), use META_Object macro osganimationskinning.cpp : remove two lines that are not needed" Merged from svn/trunk: svn merge -r 9736:9737 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk
This commit is contained in:
@@ -252,9 +252,6 @@ int main (int argc, char* argv[])
|
||||
|
||||
initVertexMap(root.get(), right0.get(), right1.get(), geom, src.get());
|
||||
|
||||
geom->buildVertexSet();
|
||||
geom->buildTransformer(skelroot.get());
|
||||
|
||||
// let's run !
|
||||
viewer.setSceneData( scene );
|
||||
viewer.realize();
|
||||
|
||||
@@ -27,6 +27,47 @@ namespace osgAnimation
|
||||
{
|
||||
public:
|
||||
|
||||
RigGeometry();
|
||||
RigGeometry(const osg::Geometry& b);
|
||||
RigGeometry(const RigGeometry& b, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Object(osgAnimation, RigGeometry);
|
||||
|
||||
void setInfluenceMap(osgAnimation::VertexInfluenceMap* vertexInfluenceMap) { _vertexInfluenceMap = vertexInfluenceMap; }
|
||||
const osgAnimation::VertexInfluenceMap* getInfluenceMap() const { return _vertexInfluenceMap.get();}
|
||||
osgAnimation::VertexInfluenceMap* getInfluenceMap() { return _vertexInfluenceMap.get();}
|
||||
|
||||
const Skeleton* getSkeleton() const;
|
||||
Skeleton* getSkeleton();
|
||||
|
||||
void setNeedToComputeMatrix(bool state) { _needToComputeMatrix = state;}
|
||||
bool getNeedToComputeMatrix() const { return _needToComputeMatrix;}
|
||||
|
||||
void buildVertexSet();
|
||||
void buildTransformer(Skeleton* root);
|
||||
void computeMatrixFromRootSkeleton();
|
||||
|
||||
virtual void transformSoftwareMethod();
|
||||
const osgAnimation::VertexInfluenceSet& getVertexInfluenceSet() const { return _vertexInfluenceSet;}
|
||||
|
||||
const std::vector<osg::Vec3>& getPositionSource() const { return _positionSource;}
|
||||
const std::vector<osg::Vec3>& getNormalSource() const { return _normalSource;}
|
||||
|
||||
protected:
|
||||
|
||||
std::vector<osg::Vec3> _positionSource;
|
||||
std::vector<osg::Vec3> _normalSource;
|
||||
|
||||
osgAnimation::VertexInfluenceSet _vertexInfluenceSet;
|
||||
osg::ref_ptr<osgAnimation::VertexInfluenceMap> _vertexInfluenceMap;
|
||||
osgAnimation::TransformVertexFunctor _transformVertexes;
|
||||
|
||||
osg::Matrix _matrixFromSkeletonToGeometry;
|
||||
osg::Matrix _invMatrixFromSkeletonToGeometry;
|
||||
osg::observer_ptr<Skeleton> _root;
|
||||
bool _needToComputeMatrix;
|
||||
|
||||
|
||||
struct FindNearestParentSkeleton : public osg::NodeVisitor
|
||||
{
|
||||
osg::ref_ptr<osgAnimation::Skeleton> _root;
|
||||
@@ -73,7 +114,7 @@ namespace osgAnimation
|
||||
/** BuildVertexTransformerVisitor is used to setup RigGeometry drawable
|
||||
* throw a subgraph.
|
||||
*/
|
||||
struct BuildVertexTransformerVisitor : public osg::NodeVisitor
|
||||
struct BuildVertexTransformerVisitor : public osg::NodeVisitor
|
||||
{
|
||||
osg::ref_ptr<Skeleton> _root;
|
||||
BuildVertexTransformerVisitor(Skeleton* root): osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) { _root = root;}
|
||||
@@ -94,46 +135,7 @@ namespace osgAnimation
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
RigGeometry();
|
||||
RigGeometry(const osg::Geometry& b);
|
||||
RigGeometry(const RigGeometry& b, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
virtual osg::Object* cloneType() const { return new RigGeometry(); }
|
||||
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new RigGeometry(*this,copyop); }
|
||||
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const RigGeometry*>(obj)!=NULL; }
|
||||
virtual const char* libraryName() const { return "osgAnimation"; }
|
||||
virtual const char* className() const { return "RigGeometry"; }
|
||||
|
||||
|
||||
void setInfluenceMap(osgAnimation::VertexInfluenceMap* vertexInfluenceMap) { _vertexInfluenceMap = vertexInfluenceMap; }
|
||||
const osgAnimation::VertexInfluenceMap* getInfluenceMap() const { return _vertexInfluenceMap.get();}
|
||||
osgAnimation::VertexInfluenceMap* getInfluenceMap() { return _vertexInfluenceMap.get();}
|
||||
void buildVertexSet();
|
||||
void buildTransformer(Skeleton* root);
|
||||
void computeMatrixFromRootSkeleton();
|
||||
|
||||
void setNeedToComputeMatrix(bool state) { _needToComputeMatrix = state;}
|
||||
bool getNeedToComputeMatrix() const { return _needToComputeMatrix;}
|
||||
|
||||
const Skeleton* getSkeleton() const;
|
||||
Skeleton* getSkeleton();
|
||||
virtual void transformSoftwareMethod();
|
||||
const osgAnimation::VertexInfluenceSet& getVertexInfluenceSet() const { return _vertexInfluenceSet;}
|
||||
|
||||
std::vector<osg::Vec3> _positionSource;
|
||||
std::vector<osg::Vec3> _normalSource;
|
||||
|
||||
osgAnimation::VertexInfluenceSet _vertexInfluenceSet;
|
||||
osg::ref_ptr<osgAnimation::VertexInfluenceMap> _vertexInfluenceMap;
|
||||
osgAnimation::TransformVertexFunctor _transformVertexes;
|
||||
|
||||
osg::Matrix _matrixFromSkeletonToGeometry;
|
||||
osg::Matrix _invMatrixFromSkeletonToGeometry;
|
||||
osg::observer_ptr<Skeleton> _root;
|
||||
bool _needToComputeMatrix;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
namespace osgAnimation
|
||||
{
|
||||
|
||||
class Action : public virtual osg::Object
|
||||
class Action : public osg::Object
|
||||
{
|
||||
public:
|
||||
|
||||
class Callback : public virtual osg::Object
|
||||
class Callback : public osg::Object
|
||||
{
|
||||
public:
|
||||
Callback(){}
|
||||
@@ -162,7 +162,7 @@ namespace osgAnimation
|
||||
};
|
||||
|
||||
|
||||
class Timeline : public virtual osg::Object
|
||||
class Timeline : public osg::Object
|
||||
{
|
||||
protected:
|
||||
typedef std::pair<unsigned int, osg::ref_ptr<Action> > FrameAction;
|
||||
|
||||
@@ -11,12 +11,9 @@
|
||||
#include <osgIntrospection/Attributes>
|
||||
|
||||
#include <osg/CopyOp>
|
||||
#include <osg/Drawable>
|
||||
#include <osg/Geode>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/NodeVisitor>
|
||||
#include <osg/Object>
|
||||
#include <osg/Transform>
|
||||
#include <osg/Vec3>
|
||||
#include <osgAnimation/RigGeometry>
|
||||
#include <osgAnimation/Skeleton>
|
||||
#include <osgAnimation/VertexInfluence>
|
||||
@@ -84,6 +81,26 @@ BEGIN_OBJECT_REFLECTOR(osgAnimation::RigGeometry)
|
||||
__osgAnimation_VertexInfluenceMap_P1__getInfluenceMap,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osgAnimation::Skeleton *, getSkeleton,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_Skeleton_P1__getSkeleton,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osgAnimation::Skeleton *, getSkeleton,
|
||||
Properties::NON_VIRTUAL,
|
||||
__Skeleton_P1__getSkeleton,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setNeedToComputeMatrix, IN, bool, state,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setNeedToComputeMatrix__bool,
|
||||
"",
|
||||
"");
|
||||
I_Method0(bool, getNeedToComputeMatrix,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__getNeedToComputeMatrix,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, buildVertexSet,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__buildVertexSet,
|
||||
@@ -99,26 +116,6 @@ BEGIN_OBJECT_REFLECTOR(osgAnimation::RigGeometry)
|
||||
__void__computeMatrixFromRootSkeleton,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setNeedToComputeMatrix, IN, bool, state,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setNeedToComputeMatrix__bool,
|
||||
"",
|
||||
"");
|
||||
I_Method0(bool, getNeedToComputeMatrix,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__getNeedToComputeMatrix,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osgAnimation::Skeleton *, getSkeleton,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_Skeleton_P1__getSkeleton,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osgAnimation::Skeleton *, getSkeleton,
|
||||
Properties::NON_VIRTUAL,
|
||||
__Skeleton_P1__getSkeleton,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, transformSoftwareMethod,
|
||||
Properties::VIRTUAL,
|
||||
__void__transformSoftwareMethod,
|
||||
@@ -129,79 +126,33 @@ BEGIN_OBJECT_REFLECTOR(osgAnimation::RigGeometry)
|
||||
__C5_osgAnimation_VertexInfluenceSet_R1__getVertexInfluenceSet,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const std::vector< osg::Vec3 > &, getPositionSource,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_std_vectorT1_osg_Vec3__R1__getPositionSource,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const std::vector< osg::Vec3 > &, getNormalSource,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_std_vectorT1_osg_Vec3__R1__getNormalSource,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(osgAnimation::VertexInfluenceMap *, InfluenceMap,
|
||||
__osgAnimation_VertexInfluenceMap_P1__getInfluenceMap,
|
||||
__void__setInfluenceMap__osgAnimation_VertexInfluenceMap_P1);
|
||||
I_SimpleProperty(bool, NeedToComputeMatrix,
|
||||
__bool__getNeedToComputeMatrix,
|
||||
__void__setNeedToComputeMatrix__bool);
|
||||
I_SimpleProperty(const std::vector< osg::Vec3 > &, NormalSource,
|
||||
__C5_std_vectorT1_osg_Vec3__R1__getNormalSource,
|
||||
0);
|
||||
I_SimpleProperty(const std::vector< osg::Vec3 > &, PositionSource,
|
||||
__C5_std_vectorT1_osg_Vec3__R1__getPositionSource,
|
||||
0);
|
||||
I_SimpleProperty(osgAnimation::Skeleton *, Skeleton,
|
||||
__Skeleton_P1__getSkeleton,
|
||||
0);
|
||||
I_SimpleProperty(const osgAnimation::VertexInfluenceSet &, VertexInfluenceSet,
|
||||
__C5_osgAnimation_VertexInfluenceSet_R1__getVertexInfluenceSet,
|
||||
0);
|
||||
I_PublicMemberProperty(std::vector< osg::Vec3 >, _positionSource);
|
||||
I_PublicMemberProperty(std::vector< osg::Vec3 >, _normalSource);
|
||||
I_PublicMemberProperty(osgAnimation::VertexInfluenceSet, _vertexInfluenceSet);
|
||||
I_PublicMemberProperty(osg::ref_ptr< osgAnimation::VertexInfluenceMap >, _vertexInfluenceMap);
|
||||
I_PublicMemberProperty(osgAnimation::TransformVertexFunctor, _transformVertexes);
|
||||
I_PublicMemberProperty(osg::Matrix, _matrixFromSkeletonToGeometry);
|
||||
I_PublicMemberProperty(osg::Matrix, _invMatrixFromSkeletonToGeometry);
|
||||
I_PublicMemberProperty(osg::observer_ptr< osgAnimation::Skeleton >, _root);
|
||||
I_PublicMemberProperty(bool, _needToComputeMatrix);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgAnimation::RigGeometry::BuildVertexTransformerVisitor)
|
||||
I_DeclaringFile("osgAnimation/RigGeometry");
|
||||
I_BaseType(osg::NodeVisitor);
|
||||
I_Constructor1(IN, osgAnimation::Skeleton *, root,
|
||||
Properties::NON_EXPLICIT,
|
||||
____BuildVertexTransformerVisitor__Skeleton_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const char *, libraryName,
|
||||
Properties::VIRTUAL,
|
||||
__C5_char_P1__libraryName,
|
||||
"return the library name/namespapce of the visitor's. ",
|
||||
"Should be defined by derived classes. ");
|
||||
I_Method0(const char *, className,
|
||||
Properties::VIRTUAL,
|
||||
__C5_char_P1__className,
|
||||
"return the name of the visitor's class type. ",
|
||||
"Should be defined by derived classes. ");
|
||||
I_Method1(void, apply, IN, osg::Geode &, node,
|
||||
Properties::VIRTUAL,
|
||||
__void__apply__osg_Geode_R1,
|
||||
"",
|
||||
"");
|
||||
I_PublicMemberProperty(osg::ref_ptr< osgAnimation::Skeleton >, _root);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgAnimation::RigGeometry::FindNearestParentSkeleton)
|
||||
I_DeclaringFile("osgAnimation/RigGeometry");
|
||||
I_BaseType(osg::NodeVisitor);
|
||||
I_Constructor0(____FindNearestParentSkeleton,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, apply, IN, osg::Transform &, node,
|
||||
Properties::VIRTUAL,
|
||||
__void__apply__osg_Transform_R1,
|
||||
"",
|
||||
"");
|
||||
I_PublicMemberProperty(osg::ref_ptr< osgAnimation::Skeleton >, _root);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgAnimation::RigGeometry::UpdateVertex)
|
||||
I_DeclaringFile("osgAnimation/RigGeometry");
|
||||
I_BaseType(osg::Drawable::UpdateCallback);
|
||||
I_Constructor0(____UpdateVertex,
|
||||
"",
|
||||
"");
|
||||
I_Method2(void, update, IN, osg::NodeVisitor *, x, IN, osg::Drawable *, drw,
|
||||
Properties::VIRTUAL,
|
||||
__void__update__osg_NodeVisitor_P1__osg_Drawable_P1,
|
||||
"do customized update code. ",
|
||||
"");
|
||||
END_REFLECTOR
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ TYPE_NAME_ALIAS(std::map< unsigned int COMMA osg::ref_ptr< osgAnimation::Action
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgAnimation::Action)
|
||||
I_DeclaringFile("osgAnimation/Timeline");
|
||||
I_VirtualBaseType(osg::Object);
|
||||
I_BaseType(osg::Object);
|
||||
I_Method0(osg::Object *, cloneType,
|
||||
Properties::VIRTUAL,
|
||||
__osg_Object_P1__cloneType,
|
||||
@@ -138,7 +138,7 @@ END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgAnimation::Action::Callback)
|
||||
I_DeclaringFile("osgAnimation/Timeline");
|
||||
I_VirtualBaseType(osg::Object);
|
||||
I_BaseType(osg::Object);
|
||||
I_Constructor0(____Callback,
|
||||
"",
|
||||
"");
|
||||
@@ -322,7 +322,7 @@ END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osgAnimation::Timeline)
|
||||
I_DeclaringFile("osgAnimation/Timeline");
|
||||
I_VirtualBaseType(osg::Object);
|
||||
I_BaseType(osg::Object);
|
||||
I_Method0(osg::Object *, cloneType,
|
||||
Properties::VIRTUAL,
|
||||
__osg_Object_P1__cloneType,
|
||||
|
||||
Reference in New Issue
Block a user