Added supoort for osg::CullSettings/Camera::InheritanceMaskActionOnAttributeSetting and InheritanceMask properties.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14904 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-06-09 16:49:20 +00:00
parent bd9bd3f8b2
commit 11a55ea6de
3 changed files with 62 additions and 8 deletions

View File

@ -54,7 +54,7 @@ PROJECT(OpenSceneGraph)
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
SET(OPENSCENEGRAPH_MINOR_VERSION 3)
SET(OPENSCENEGRAPH_PATCH_VERSION 8)
SET(OPENSCENEGRAPH_SOVERSION 122)
SET(OPENSCENEGRAPH_SOVERSION 123)
# set to 0 when not a release candidate, non zero means that any generated
# svn tags will be treated as release candidates of given number

View File

@ -1452,9 +1452,12 @@ public:
C& object = OBJECT_CAST<C&>(obj);
if ( is.isBinary() )
{
bool ok = false; is >> ok; //code from user serialized ensuring backwards-compatibility
if ( !ok ) return true;
if (is.getFileVersion()<123)
{
bool ok = false; is >> ok; //code from user serialized ensuring backwards-compatibility
if ( !ok ) return true;
}
P mask;
is >> mask;
(object.*_setter)( mask );
@ -1482,9 +1485,12 @@ public:
bool ok = ParentType::_defaultValue!=static_cast<P>(mask);
if ( os.isBinary() )
{
os << ok;
if ( !ok )
return true;
if (os.getFileVersion()<123)
{
os << ok;
if ( !ok )
return true;
}
os << (int)mask; //just write int value in binary case
}
else
@ -1838,12 +1844,23 @@ protected:
#define END_ENUM_SERIALIZER() \
wrapper->addSerializer(serializer.get(), osgDB::BaseSerializer::RW_ENUM); }
/** defaults to uint bitfield type.*/
#define BEGIN_BITFLAGS_SERIALIZER(PROP, DEF) \
{ typedef osgDB::BitFlagsSerializer<MyClass> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP)
#define BEGIN_UINT_BITFLAGS_SERIALIZER(PROP, DEF) \
{ typedef osgDB::BitFlagsSerializer<MyClass, unsigned int> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP)
#define BEGIN_INT_BITFLAGS_SERIALIZER(PROP, DEF) \
{ typedef osgDB::BitFlagsSerializer<MyClass, int> MySerializer; \
osg::ref_ptr<MySerializer> serializer = new MySerializer( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP)
#define ADD_BITFLAG_VALUE(VALUE_NAME, VALUE) \
serializer->add(#VALUE_NAME, VALUE)

View File

@ -228,4 +228,41 @@ REGISTER_OBJECT_WRAPPER( Camera,
ADD_OBJECT_SERIALIZER( PreDrawCallback, osg::Camera::DrawCallback, NULL ); // _preDrawCallback
ADD_OBJECT_SERIALIZER( PostDrawCallback, osg::Camera::DrawCallback, NULL ); // _postDrawCallback
ADD_OBJECT_SERIALIZER( FinalDrawCallback, osg::Camera::DrawCallback, NULL ); // _finalDrawCallback
{
UPDATE_TO_VERSION_SCOPED( 123 )
BEGIN_ENUM_SERIALIZER( InheritanceMaskActionOnAttributeSetting, DISABLE_ASSOCIATED_INHERITANCE_MASK_BIT );
ADD_ENUM_VALUE( DISABLE_ASSOCIATED_INHERITANCE_MASK_BIT );
ADD_ENUM_VALUE( DO_NOT_MODIFY_INHERITANCE_MASK );
END_ENUM_SERIALIZER();
BEGIN_INT_BITFLAGS_SERIALIZER(InheritanceMask, osg::Camera::ALL_VARIABLES);
ADD_BITFLAG_VALUE(COMPUTE_NEAR_FAR_MODE, osg::Camera::COMPUTE_NEAR_FAR_MODE);
ADD_BITFLAG_VALUE(CULLING_MODE, osg::Camera::CULLING_MODE);
ADD_BITFLAG_VALUE(LOD_SCALE, osg::Camera::LOD_SCALE);
ADD_BITFLAG_VALUE(SMALL_FEATURE_CULLING_PIXEL_SIZE, osg::Camera::SMALL_FEATURE_CULLING_PIXEL_SIZE);
ADD_BITFLAG_VALUE(CLAMP_PROJECTION_MATRIX_CALLBACK, osg::Camera::CLAMP_PROJECTION_MATRIX_CALLBACK);
ADD_BITFLAG_VALUE(NEAR_FAR_RATIO, osg::Camera::NEAR_FAR_RATIO);
ADD_BITFLAG_VALUE(IMPOSTOR_ACTIVE, osg::Camera::IMPOSTOR_ACTIVE);
ADD_BITFLAG_VALUE(DEPTH_SORT_IMPOSTOR_SPRITES, osg::Camera::DEPTH_SORT_IMPOSTOR_SPRITES);
ADD_BITFLAG_VALUE(IMPOSTOR_PIXEL_ERROR_THRESHOLD, osg::Camera::IMPOSTOR_PIXEL_ERROR_THRESHOLD);
ADD_BITFLAG_VALUE(NUM_FRAMES_TO_KEEP_IMPOSTORS_SPRITES, osg::Camera::NUM_FRAMES_TO_KEEP_IMPOSTORS_SPRITES);
ADD_BITFLAG_VALUE(CULL_MASK, osg::Camera::CULL_MASK);
ADD_BITFLAG_VALUE(CULL_MASK_LEFT, osg::Camera::CULL_MASK_LEFT);
ADD_BITFLAG_VALUE(CULL_MASK_RIGHT, osg::Camera::CULL_MASK_RIGHT);
ADD_BITFLAG_VALUE(CLEAR_COLOR, osg::Camera::CLEAR_COLOR);
ADD_BITFLAG_VALUE(CLEAR_MASK, osg::Camera::CLEAR_MASK);
ADD_BITFLAG_VALUE(LIGHTING_MODE, osg::Camera::LIGHTING_MODE);
ADD_BITFLAG_VALUE(LIGHT, osg::Camera::LIGHT);
ADD_BITFLAG_VALUE(DRAW_BUFFER, osg::Camera::DRAW_BUFFER);
ADD_BITFLAG_VALUE(READ_BUFFER, osg::Camera::READ_BUFFER);
ADD_BITFLAG_VALUE(NO_VARIABLES, osg::Camera::NO_VARIABLES);
/** ADD_BITFLAG_VALUE(ALL_VARIABLES, osg::Camera::ALL_VARIABLES);*/
END_BITFLAGS_SERIALIZER();
//ALL_VARIABLES
}
}