Refactored how the callbacks for updating geometry are managed in MorphGeometry and RigGeometry to address bugs in serialization.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14784 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-03-12 17:11:11 +00:00
parent dd2de7f132
commit e2f208af54
14 changed files with 107 additions and 82 deletions

View File

@@ -25,7 +25,7 @@ MorphGeometry::MorphGeometry() :
_morphNormals(true)
{
setUseDisplayList(false);
setUpdateCallback(new UpdateVertex);
setUpdateCallback(new UpdateMorphGeometry);
setDataVariance(osg::Object::DYNAMIC);
setUseVertexBufferObjects(true);
}
@@ -37,7 +37,7 @@ MorphGeometry::MorphGeometry(const osg::Geometry& b) :
_morphNormals(true)
{
setUseDisplayList(false);
setUpdateCallback(new UpdateVertex);
setUpdateCallback(new UpdateMorphGeometry);
setDataVariance(osg::Object::DYNAMIC);
setUseVertexBufferObjects(true);
}

View File

@@ -53,7 +53,7 @@ RigGeometry::RigGeometry()
{
_supportsDisplayList = false;
setUseVertexBufferObjects(true);
setUpdateCallback(new UpdateVertex);
setUpdateCallback(new UpdateRigGeometry);
setDataVariance(osg::Object::DYNAMIC);
_needToComputeMatrix = true;
_matrixFromSkeletonToGeometry = _invMatrixFromSkeletonToGeometry = osg::Matrix::identity();

View File

@@ -25,6 +25,8 @@ USE_SERIALIZER_WRAPPER(osgAnimation_UpdateMaterial)
USE_SERIALIZER_WRAPPER(osgAnimation_UpdateMatrixTransform)
USE_SERIALIZER_WRAPPER(osgAnimation_UpdateMorph)
USE_SERIALIZER_WRAPPER(osgAnimation_UpdateSkeleton)
USE_SERIALIZER_WRAPPER(osgAnimation_UpdateMorphGeometry)
USE_SERIALIZER_WRAPPER(osgAnimation_UpdateRigGeometry)
extern "C" void wrapper_serializer_library_osgAnimation(void) {}

View File

@@ -9,7 +9,7 @@
REGISTER_OBJECT_WRAPPER( osgAnimation_UpdateBone,
new osgAnimation::UpdateBone,
osgAnimation::UpdateBone,
"osg::Object osg::NodeCallback osgAnimation::UpdateMatrixTransform osgAnimation::UpdateBone" )
"osg::Object osg::Callback osg::NodeCallback osgAnimation::UpdateMatrixTransform osgAnimation::UpdateBone" )
{
}

View File

@@ -9,7 +9,7 @@
REGISTER_OBJECT_WRAPPER( osgAnimation_UpdateMaterial,
new osgAnimation::UpdateMaterial,
osgAnimation::UpdateMaterial,
"osg::Object osgAnimation::UpdateMaterial" )
"osg::Object osg::Callback osgAnimation::UpdateMaterial" )
{
}

View File

@@ -41,7 +41,7 @@ static bool writeStackedTransforms( osgDB::OutputStream& os, const osgAnimation:
REGISTER_OBJECT_WRAPPER( osgAnimation_UpdateMatrixTransform,
new osgAnimation::UpdateMatrixTransform,
osgAnimation::UpdateMatrixTransform,
"osg::Object osg::NodeCallback osgAnimation::UpdateMatrixTransform" )
"osg::Object osg::Callback osg::NodeCallback osgAnimation::UpdateMatrixTransform" )
{
ADD_USER_SERIALIZER( StackedTransforms ); // _transforms
}

View File

@@ -9,7 +9,7 @@
REGISTER_OBJECT_WRAPPER( osgAnimation_UpdateMorph,
new osgAnimation::UpdateMorph,
osgAnimation::UpdateMorph,
"osg::Object osg::NodeCallback osgAnimation::UpdateMorph" )
"osg::Object osg::Callback osg::NodeCallback osgAnimation::UpdateMorph" )
{
}

View File

@@ -0,0 +1,15 @@
#undef OBJECT_CAST
#define OBJECT_CAST dynamic_cast
#include <osgAnimation/MorphGeometry>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER(osgAnimation_UpdateMorphGeometry,
new osgAnimation::UpdateMorphGeometry,
osgAnimation::UpdateMorphGeometry,
"osg::Object osg::Callback osg::UpdateCallback osgAnimation::UpdateMorphGeometry") {}
#undef OBJECT_CAST
#define OBJECT_CAST static_cast

View File

@@ -0,0 +1,15 @@
#undef OBJECT_CAST
#define OBJECT_CAST dynamic_cast
#include <osgAnimation/RigGeometry>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER(osgAnimation_UpdateRigGeometry,
new osgAnimation::UpdateRigGeometry,
osgAnimation::UpdateRigGeometry,
"osg::Object osg::Callback osg::UpdateCallback osgAnimation::UpdateRigGeometry") {}
#undef OBJECT_CAST
#define OBJECT_CAST static_cast

View File

@@ -10,7 +10,7 @@ REGISTER_OBJECT_WRAPPER2( osgAnimation_UpdateSkeleton,
new osgAnimation::Skeleton::UpdateSkeleton,
osgAnimation::Skeleton::UpdateSkeleton,
"osgAnimation::UpdateSkeleton",
"osg::Object osg::NodeCallback osgAnimation::UpdateSkeleton" )
"osg::Object osg::Callback osg::NodeCallback osgAnimation::UpdateSkeleton" )
{
}

View File

@@ -1,16 +0,0 @@
#undef OBJECT_CAST
#define OBJECT_CAST dynamic_cast
#include <osgAnimation/RigGeometry>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER2(osg_Drawable_UpdateCallback,
new osgAnimation::RigGeometry::UpdateVertex,
osgAnimation::RigGeometry::UpdateVertex,
"osgAnimation::UpdateVertex",
"osg::Object osg::UpdateCallback osgAnimation::UpdateVertex") {}
#undef OBJECT_CAST
#define OBJECT_CAST static_cast