Removed files as they all have the incorrectly have the execution bit enabled, will add back in with this fixed.
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( AlphaFunc,
|
||||
new osg::AlphaFunc,
|
||||
osg::AlphaFunc,
|
||||
"osg::Object osg::StateAttribute osg::AlphaFunc" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER2( Function, osg::AlphaFunc::ComparisonFunction, ALWAYS );
|
||||
ADD_ENUM_VALUE( NEVER );
|
||||
ADD_ENUM_VALUE( LESS );
|
||||
ADD_ENUM_VALUE( EQUAL );
|
||||
ADD_ENUM_VALUE( LEQUAL );
|
||||
ADD_ENUM_VALUE( GREATER );
|
||||
ADD_ENUM_VALUE( NOTEQUAL );
|
||||
ADD_ENUM_VALUE( GEQUAL );
|
||||
ADD_ENUM_VALUE( ALWAYS );
|
||||
END_ENUM_SERIALIZER(); // _comparisonFunc
|
||||
|
||||
ADD_FLOAT_SERIALIZER( ReferenceValue, 1.0f ); // _referenceValue
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST dynamic_cast
|
||||
|
||||
#include <osg/AnimationPath>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkTimeControlPointMap( const osg::AnimationPath& path )
|
||||
{
|
||||
return path.getTimeControlPointMap().size()>0;
|
||||
}
|
||||
|
||||
static bool readTimeControlPointMap( osgDB::InputStream& is, osg::AnimationPath& path )
|
||||
{
|
||||
unsigned int size = 0; is >> size;
|
||||
if ( size>0 )
|
||||
{
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
double time = 0.0;
|
||||
osg::Vec3d pos, scale;
|
||||
osg::Quat rot;
|
||||
is >> osgDB::PROPERTY("Time") >> time >> osgDB::BEGIN_BRACKET;
|
||||
is >> osgDB::PROPERTY("Position") >> pos;
|
||||
is >> osgDB::PROPERTY("Rotation") >> rot;
|
||||
is >> osgDB::PROPERTY("Scale") >> scale;
|
||||
is >> osgDB::END_BRACKET;
|
||||
path.insert( time, osg::AnimationPath::ControlPoint(pos, rot, scale) );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeTimeControlPointMap( osgDB::OutputStream& os, const osg::AnimationPath& path )
|
||||
{
|
||||
const osg::AnimationPath::TimeControlPointMap& map = path.getTimeControlPointMap();
|
||||
os << map.size();
|
||||
if ( map.size()>0 )
|
||||
{
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::AnimationPath::TimeControlPointMap::const_iterator itr=map.begin();
|
||||
itr!=map.end(); ++itr )
|
||||
{
|
||||
const osg::AnimationPath::ControlPoint& pt = itr->second;
|
||||
os << osgDB::PROPERTY("Time") << itr->first << osgDB::BEGIN_BRACKET << std::endl;
|
||||
os << osgDB::PROPERTY("Position") << pt.getPosition() << std::endl;
|
||||
os << osgDB::PROPERTY("Rotation") << pt.getRotation() << std::endl;
|
||||
os << osgDB::PROPERTY("Scale") << pt.getScale() << std::endl;
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET;
|
||||
}
|
||||
os << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( AnimationPath,
|
||||
new osg::AnimationPath,
|
||||
osg::AnimationPath,
|
||||
"osg::Object osg::AnimationPath" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( TimeControlPointMap ); // _timeControlPointMap
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( LoopMode, NO_LOOPING );
|
||||
ADD_ENUM_VALUE( SWING );
|
||||
ADD_ENUM_VALUE( LOOP );
|
||||
ADD_ENUM_VALUE( NO_LOOPING );
|
||||
END_ENUM_SERIALIZER(); //_loopMode
|
||||
}
|
||||
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST static_cast
|
||||
@@ -1,23 +0,0 @@
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST dynamic_cast
|
||||
|
||||
#include <osg/AnimationPath>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( AnimationPathCallback,
|
||||
new osg::AnimationPathCallback,
|
||||
osg::AnimationPathCallback,
|
||||
"osg::Object osg::NodeCallback osg::AnimationPathCallback" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( AnimationPath, osg::AnimationPath, NULL ); // _animationPath
|
||||
ADD_VEC3D_SERIALIZER( PivotPoint, osg::Vec3d() ); // _pivotPoint
|
||||
ADD_BOOL_SERIALIZER( UseInverseMatrix, false ); // _useInverseMatrix
|
||||
ADD_DOUBLE_SERIALIZER( TimeOffset, 0.0 ); // _timeOffset
|
||||
ADD_DOUBLE_SERIALIZER( TimeMultiplier, 1.0 ); // _timeMultiplier
|
||||
ADD_BOOL_SERIALIZER( Pause, false ); // _pause
|
||||
}
|
||||
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST static_cast
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <osg/AudioStream>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( AudioSink,
|
||||
/*new osg::AudioSink*/NULL,
|
||||
osg::AudioSink,
|
||||
"osg::Object osg::AudioSink" )
|
||||
{
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <osg/AudioStream>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( AudioStream,
|
||||
/*new osg::AudioStream*/NULL,
|
||||
osg::AudioStream,
|
||||
"osg::Object osg::AudioStream" )
|
||||
{
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#include <osg/AutoTransform>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( AutoTransform,
|
||||
new osg::AutoTransform,
|
||||
osg::AutoTransform,
|
||||
"osg::Object osg::Node osg::Group osg::Transform osg::AutoTransform" )
|
||||
{
|
||||
ADD_DOUBLE_SERIALIZER( MinimumScale, 0.0 ); // _minimumScale
|
||||
ADD_DOUBLE_SERIALIZER( MaximumScale, 0.0 ); // _maximumScale
|
||||
ADD_VEC3D_SERIALIZER( Position, osg::Vec3d() ); // _position
|
||||
ADD_VEC3D_SERIALIZER( Scale, osg::Vec3d() ); // _scale
|
||||
ADD_VEC3D_SERIALIZER( PivotPoint, osg::Vec3d() ); // _pivotPoint
|
||||
ADD_FLOAT_SERIALIZER( AutoUpdateEyeMovementTolerance, 0.0f ); // _autoUpdateEyeMovementTolerance
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( AutoRotateMode, NO_ROTATION );
|
||||
ADD_ENUM_VALUE( NO_ROTATION );
|
||||
ADD_ENUM_VALUE( ROTATE_TO_SCREEN );
|
||||
ADD_ENUM_VALUE( ROTATE_TO_CAMERA );
|
||||
END_ENUM_SERIALIZER(); // _autoRotateMode
|
||||
|
||||
ADD_BOOL_SERIALIZER( AutoScaleToScreen, false ); // _autoScaleToScreen
|
||||
ADD_QUAT_SERIALIZER( Rotation, osg::Quat() ); // _rotation
|
||||
ADD_FLOAT_SERIALIZER( AutoScaleTransitionWidthRatio, 0.25f ); // _autoScaleTransitionWidthRatio
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
#include <osg/Billboard>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkPositionList( const osg::Billboard& node )
|
||||
{
|
||||
return node.getPositionList().size()>0;
|
||||
}
|
||||
|
||||
static bool readPositionList( osgDB::InputStream& is, osg::Billboard& node )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osg::Vec3d pos; is >> pos;
|
||||
node.setPosition( i, pos );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writePositionList( osgDB::OutputStream& os, const osg::Billboard& node )
|
||||
{
|
||||
const osg::Billboard::PositionList& posList = node.getPositionList();
|
||||
os << posList.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::Billboard::PositionList::const_iterator itr=posList.begin();
|
||||
itr!=posList.end(); ++itr )
|
||||
{
|
||||
os << osg::Vec3d(*itr) << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Billboard,
|
||||
new osg::Billboard,
|
||||
osg::Billboard,
|
||||
"osg::Object osg::Node osg::Geode osg::Billboard" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( Mode, AXIAL_ROT );
|
||||
ADD_ENUM_VALUE( POINT_ROT_EYE );
|
||||
ADD_ENUM_VALUE( POINT_ROT_WORLD );
|
||||
ADD_ENUM_VALUE( AXIAL_ROT );
|
||||
END_ENUM_SERIALIZER(); // _mode
|
||||
|
||||
ADD_VEC3_SERIALIZER( Axis, osg::Vec3f() ); // _axis
|
||||
ADD_VEC3_SERIALIZER( Normal, osg::Vec3f() ); // _normal
|
||||
ADD_USER_SERIALIZER( PositionList ); // _positionList
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <osg/BlendColor>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( BlendColor,
|
||||
new osg::BlendColor,
|
||||
osg::BlendColor,
|
||||
"osg::Object osg::StateAttribute osg::BlendColor" )
|
||||
{
|
||||
ADD_VEC4_SERIALIZER( ConstantColor, osg::Vec4() ); // _constantColor
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#include <osg/BlendEquation>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( BlendEquation,
|
||||
new osg::BlendEquation,
|
||||
osg::BlendEquation,
|
||||
"osg::Object osg::StateAttribute osg::BlendEquation" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER2( EquationRGB, osg::BlendEquation::Equation, FUNC_ADD );
|
||||
ADD_ENUM_VALUE( RGBA_MIN );
|
||||
ADD_ENUM_VALUE( RGBA_MAX );
|
||||
ADD_ENUM_VALUE( ALPHA_MIN );
|
||||
ADD_ENUM_VALUE( ALPHA_MAX );
|
||||
ADD_ENUM_VALUE( LOGIC_OP );
|
||||
ADD_ENUM_VALUE( FUNC_ADD );
|
||||
ADD_ENUM_VALUE( FUNC_SUBTRACT );
|
||||
ADD_ENUM_VALUE( FUNC_REVERSE_SUBTRACT );
|
||||
END_ENUM_SERIALIZER(); // _equationRGB
|
||||
|
||||
BEGIN_ENUM_SERIALIZER2( EquationAlpha, osg::BlendEquation::Equation, FUNC_ADD );
|
||||
ADD_ENUM_VALUE( RGBA_MIN );
|
||||
ADD_ENUM_VALUE( RGBA_MAX );
|
||||
ADD_ENUM_VALUE( ALPHA_MIN );
|
||||
ADD_ENUM_VALUE( ALPHA_MAX );
|
||||
ADD_ENUM_VALUE( LOGIC_OP );
|
||||
ADD_ENUM_VALUE( FUNC_ADD );
|
||||
ADD_ENUM_VALUE( FUNC_SUBTRACT );
|
||||
ADD_ENUM_VALUE( FUNC_REVERSE_SUBTRACT );
|
||||
END_ENUM_SERIALIZER(); // _equationAlpha
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/BlendFunc>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( BlendFunc,
|
||||
new osg::BlendFunc,
|
||||
osg::BlendFunc,
|
||||
"osg::Object osg::StateAttribute osg::BlendFunc" )
|
||||
{
|
||||
ADD_GLENUM_SERIALIZER( SourceRGB, GLenum, GL_NONE ); // _source_factor
|
||||
ADD_GLENUM_SERIALIZER( SourceAlpha, GLenum, GL_NONE ); // _source_factor_alpha
|
||||
ADD_GLENUM_SERIALIZER( DestinationRGB, GLenum, GL_NONE ); // _destination_factor
|
||||
ADD_GLENUM_SERIALIZER( DestinationAlpha, GLenum, GL_NONE ); // _destination_factor_alpha
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Box,
|
||||
new osg::Box,
|
||||
osg::Box,
|
||||
"osg::Object osg::Shape osg::Box" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( Center, osg::Vec3() ); // _center
|
||||
ADD_VEC3_SERIALIZER( HalfLengths, osg::Vec3() ); // _halfLengths
|
||||
ADD_QUAT_SERIALIZER( Rotation, osg::Quat() ); // _rotation
|
||||
}
|
||||
@@ -1,271 +0,0 @@
|
||||
#include <osg/Camera>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
BEGIN_USER_TABLE( RenderOrder, osg::Camera );
|
||||
ADD_USER_VALUE( PRE_RENDER );
|
||||
ADD_USER_VALUE( NESTED_RENDER );
|
||||
ADD_USER_VALUE( POST_RENDER );
|
||||
END_USER_TABLE()
|
||||
|
||||
USER_READ_FUNC( RenderOrder, readOrderValue )
|
||||
USER_WRITE_FUNC( RenderOrder, writeOrderValue )
|
||||
|
||||
BEGIN_USER_TABLE( BufferComponent, osg::Camera );
|
||||
ADD_USER_VALUE( DEPTH_BUFFER );
|
||||
ADD_USER_VALUE( STENCIL_BUFFER );
|
||||
ADD_USER_VALUE( PACKED_DEPTH_STENCIL_BUFFER );
|
||||
ADD_USER_VALUE( COLOR_BUFFER );
|
||||
ADD_USER_VALUE( COLOR_BUFFER0 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER1 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER2 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER3 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER4 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER5 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER6 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER7 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER8 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER9 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER10 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER11 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER12 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER13 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER14 );
|
||||
ADD_USER_VALUE( COLOR_BUFFER15 );
|
||||
END_USER_TABLE()
|
||||
|
||||
USER_READ_FUNC( BufferComponent, readBufferComponent )
|
||||
USER_WRITE_FUNC( BufferComponent, writeBufferComponent )
|
||||
|
||||
static osg::Camera::Attachment readBufferAttachment( osgDB::InputStream& is )
|
||||
{
|
||||
osg::Camera::Attachment attachment;
|
||||
char type = -1; is >> osgDB::PROPERTY("Type") >> type;
|
||||
if ( type==0 )
|
||||
{
|
||||
is >> osgDB::PROPERTY("InternalFormat") >> attachment._internalFormat;
|
||||
return attachment;
|
||||
}
|
||||
else if ( type==1 )
|
||||
{
|
||||
is >> osgDB::PROPERTY("Image");
|
||||
attachment._image = dynamic_cast<osg::Image*>( is.readObject() );
|
||||
}
|
||||
else if ( type==2 )
|
||||
{
|
||||
is >> osgDB::PROPERTY("Texture");
|
||||
attachment._texture = dynamic_cast<osg::Texture*>( is.readObject() );
|
||||
is >> osgDB::PROPERTY("Level") >> attachment._level;
|
||||
is >> osgDB::PROPERTY("Face") >> attachment._face;
|
||||
is >> osgDB::PROPERTY("MipMapGeneration") >> attachment._mipMapGeneration;
|
||||
}
|
||||
else
|
||||
return attachment;
|
||||
|
||||
is >> osgDB::PROPERTY("MultisampleSamples") >> attachment._multisampleSamples;
|
||||
is >> osgDB::PROPERTY("MultisampleColorSamples") >> attachment._multisampleColorSamples;
|
||||
return attachment;
|
||||
}
|
||||
|
||||
static void writeBufferAttachment( osgDB::OutputStream& os, const osg::Camera::Attachment& attachment )
|
||||
{
|
||||
os << osgDB::PROPERTY("Type");
|
||||
if ( attachment._internalFormat!=GL_NONE )
|
||||
{
|
||||
os << (char)0 << std::endl;
|
||||
os << osgDB::PROPERTY("InternalFormat") << GLENUM(attachment._internalFormat) << std::endl;
|
||||
return;
|
||||
}
|
||||
else if ( attachment._image.valid() )
|
||||
{
|
||||
os << (char)1 << std::endl;
|
||||
os << osgDB::PROPERTY("Image") << attachment._image.get();
|
||||
}
|
||||
else if ( attachment._texture.valid() )
|
||||
{
|
||||
os << (char)2 << std::endl;
|
||||
os << osgDB::PROPERTY("Texture") << attachment._texture.get();
|
||||
os << osgDB::PROPERTY("Level") << attachment._level << std::endl;
|
||||
os << osgDB::PROPERTY("Face") << attachment._face << std::endl;
|
||||
os << osgDB::PROPERTY("MipMapGeneration") << attachment._mipMapGeneration << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
os << (char)-1 << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
os << osgDB::PROPERTY("MultisampleSamples") << attachment._multisampleSamples << std::endl;
|
||||
os << osgDB::PROPERTY("MultisampleColorSamples") << attachment._multisampleColorSamples << std::endl;
|
||||
}
|
||||
|
||||
// _clearMask
|
||||
static bool checkClearMask( const osg::Camera& node )
|
||||
{
|
||||
return node.getClearMask()!=(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
static bool readClearMask( osgDB::InputStream& is, osg::Camera& node )
|
||||
{
|
||||
GLbitfield mask = 0;
|
||||
if ( is.isBinary() )
|
||||
{
|
||||
int maskValue; is >> maskValue;
|
||||
mask = (GLbitfield)maskValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string maskSetString; is >> maskSetString;
|
||||
osgDB::StringList maskList; osgDB::split( maskSetString, maskList, '|' );
|
||||
for ( unsigned int i=0; i<maskList.size(); ++i )
|
||||
{
|
||||
const std::string& maskValue = maskList[i];
|
||||
if ( maskValue=="COLOR" ) mask |= GL_COLOR_BUFFER_BIT;
|
||||
else if ( maskValue=="DEPTH" ) mask |= GL_DEPTH_BUFFER_BIT;
|
||||
else if ( maskValue=="ACCUM" ) mask |= GL_ACCUM_BUFFER_BIT;
|
||||
else if ( maskValue=="STENCIL" ) mask |= GL_STENCIL_BUFFER_BIT;
|
||||
}
|
||||
}
|
||||
node.setClearMask( mask );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeClearMask( osgDB::OutputStream& os, const osg::Camera& node )
|
||||
{
|
||||
GLbitfield mask = node.getClearMask();
|
||||
if ( os.isBinary() )
|
||||
os << (int)mask;
|
||||
else
|
||||
{
|
||||
std::string maskString;
|
||||
if ( mask==GL_COLOR_BUFFER_BIT ) maskString += std::string("COLOR|");
|
||||
if ( mask==GL_DEPTH_BUFFER_BIT ) maskString += std::string("DEPTH|");
|
||||
if ( mask==GL_ACCUM_BUFFER_BIT ) maskString += std::string("ACCUM|");
|
||||
if ( mask==GL_STENCIL_BUFFER_BIT ) maskString += std::string("STENCIL|");
|
||||
if ( !maskString.size() ) maskString = std::string("NONE|");
|
||||
os << maskString.substr(0, maskString.size()-1) << std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// _renderOrder & _renderOrderNum
|
||||
static bool checkRenderOrder( const osg::Camera& node )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool readRenderOrder( osgDB::InputStream& is, osg::Camera& node )
|
||||
{
|
||||
int order = readOrderValue(is);
|
||||
int orderNumber = 0; is >> orderNumber;
|
||||
node.setRenderOrder( static_cast<osg::Camera::RenderOrder>(order), orderNumber );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeRenderOrder( osgDB::OutputStream& os, const osg::Camera& node )
|
||||
{
|
||||
writeOrderValue( os, (int)node.getRenderOrder() );
|
||||
os << node.getRenderOrderNum() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _bufferAttachmentMap
|
||||
static bool checkBufferAttachmentMap( const osg::Camera& node )
|
||||
{
|
||||
return node.getBufferAttachmentMap().size()>0;
|
||||
}
|
||||
|
||||
static bool readBufferAttachmentMap( osgDB::InputStream& is, osg::Camera& node )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
is >> osgDB::PROPERTY("Attachment");
|
||||
osg::Camera::BufferComponent bufferComponent =
|
||||
static_cast<osg::Camera::BufferComponent>( readBufferComponent(is) );
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
osg::Camera::Attachment attachment = readBufferAttachment(is);
|
||||
is >> osgDB::END_BRACKET;
|
||||
|
||||
if ( attachment._internalFormat!=GL_NONE )
|
||||
{
|
||||
node.attach( bufferComponent, attachment._internalFormat );
|
||||
}
|
||||
else if ( attachment._image.valid() )
|
||||
{
|
||||
node.attach( bufferComponent, attachment._image.get(),
|
||||
attachment._multisampleSamples, attachment._multisampleColorSamples );
|
||||
}
|
||||
else if ( attachment._texture.valid() )
|
||||
{
|
||||
node.attach( bufferComponent, attachment._texture.get(),
|
||||
attachment._level, attachment._face, attachment._mipMapGeneration,
|
||||
attachment._multisampleSamples, attachment._multisampleColorSamples );
|
||||
}
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeBufferAttachmentMap( osgDB::OutputStream& os, const osg::Camera& node )
|
||||
{
|
||||
const osg::Camera::BufferAttachmentMap& map = node.getBufferAttachmentMap();
|
||||
os << map.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::Camera::BufferAttachmentMap::const_iterator itr=map.begin();
|
||||
itr!=map.end(); ++itr )
|
||||
{
|
||||
os << osgDB::PROPERTY("Attachment"); writeBufferComponent( os, itr->first );
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
writeBufferAttachment( os, itr->second );
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Camera,
|
||||
new osg::Camera,
|
||||
osg::Camera,
|
||||
"osg::Object osg::Node osg::Group osg::Transform osg::Camera" )
|
||||
{
|
||||
ADD_BOOL_SERIALIZER( AllowEventFocus, true ); // _allowEventFocus
|
||||
ADD_USER_SERIALIZER( ClearMask ); // _clearMask
|
||||
ADD_VEC4_SERIALIZER( ClearColor, osg::Vec4() ); // _clearColor
|
||||
ADD_VEC4_SERIALIZER( ClearAccum, osg::Vec4() ); // _clearAccum
|
||||
ADD_DOUBLE_SERIALIZER( ClearDepth, 1.0 ); // _clearDepth
|
||||
ADD_INT_SERIALIZER( ClearStencil, 0 ); // _clearStencil
|
||||
ADD_OBJECT_SERIALIZER( ColorMask, osg::ColorMask, NULL ); // _colorMask
|
||||
ADD_OBJECT_SERIALIZER( Viewport, osg::Viewport, NULL ); // _viewport
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( TransformOrder, PRE_MULTIPLY );
|
||||
ADD_ENUM_VALUE( PRE_MULTIPLY );
|
||||
ADD_ENUM_VALUE( POST_MULTIPLY );
|
||||
END_ENUM_SERIALIZER(); // _transformOrder
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( ProjectionResizePolicy, HORIZONTAL );
|
||||
ADD_ENUM_VALUE( FIXED );
|
||||
ADD_ENUM_VALUE( HORIZONTAL );
|
||||
ADD_ENUM_VALUE( VERTICAL );
|
||||
END_ENUM_SERIALIZER(); // _projectionResizePolicy
|
||||
|
||||
ADD_MATRIXD_SERIALIZER( ProjectionMatrix, osg::Matrixd() ); // _projectionMatrix
|
||||
ADD_MATRIXD_SERIALIZER( ViewMatrix, osg::Matrixd() ); // _viewMatrix
|
||||
ADD_USER_SERIALIZER( RenderOrder ); // _renderOrder & _renderOrderNum
|
||||
ADD_GLENUM_SERIALIZER( DrawBuffer, GLenum, GL_NONE ); // _drawBuffer
|
||||
ADD_GLENUM_SERIALIZER( ReadBuffer, GLenum, GL_NONE ); // _readBuffer
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( RenderTargetImplementation, FRAME_BUFFER );
|
||||
ADD_ENUM_VALUE( FRAME_BUFFER_OBJECT );
|
||||
ADD_ENUM_VALUE( PIXEL_BUFFER_RTT );
|
||||
ADD_ENUM_VALUE( PIXEL_BUFFER );
|
||||
ADD_ENUM_VALUE( FRAME_BUFFER );
|
||||
ADD_ENUM_VALUE( SEPERATE_WINDOW );
|
||||
END_ENUM_SERIALIZER(); // _renderTargetImplementation
|
||||
|
||||
ADD_USER_SERIALIZER( BufferAttachmentMap ); // _bufferAttachmentMap
|
||||
ADD_OBJECT_SERIALIZER( InitialDrawCallback, osg::Camera::DrawCallback, NULL ); // _initialDrawCallback
|
||||
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
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#include <osg/CameraView>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( CameraView,
|
||||
new osg::CameraView,
|
||||
osg::CameraView,
|
||||
"osg::Object osg::Node osg::Group osg::Transform osg::CameraView" )
|
||||
{
|
||||
ADD_VEC3D_SERIALIZER( Position, osg::Vec3d() ); // _position
|
||||
ADD_QUAT_SERIALIZER( Attitude, osg::Quat() ); // _attitude
|
||||
ADD_DOUBLE_SERIALIZER( FieldOfView, 60.0 ); // _fieldOfView
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( FieldOfViewMode, VERTICAL );
|
||||
ADD_ENUM_VALUE( UNCONSTRAINED );
|
||||
ADD_ENUM_VALUE( HORIZONTAL );
|
||||
ADD_ENUM_VALUE( VERTICAL );
|
||||
END_ENUM_SERIALIZER(); // _fieldOfViewMode
|
||||
|
||||
ADD_DOUBLE_SERIALIZER( FocalLength, 0.0 ); // _focalLength
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Capsule,
|
||||
new osg::Capsule,
|
||||
osg::Capsule,
|
||||
"osg::Object osg::Shape osg::Capsule" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( Center, osg::Vec3() ); // _center
|
||||
ADD_FLOAT_SERIALIZER( Radius, 0.0f ); // _radius
|
||||
ADD_FLOAT_SERIALIZER( Height, 0.0f ); // _height
|
||||
ADD_QUAT_SERIALIZER( Rotation, osg::Quat() ); // _rotation
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <osg/ClampColor>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ClampColor,
|
||||
new osg::ClampColor,
|
||||
osg::ClampColor,
|
||||
"osg::Object osg::StateAttribute osg::ClampColor" )
|
||||
{
|
||||
ADD_GLENUM_SERIALIZER( ClampVertexColor, GLenum, GL_FIXED_ONLY ); // _clampVertexColor
|
||||
ADD_GLENUM_SERIALIZER( ClampFragmentColor, GLenum, GL_FIXED_ONLY ); // _clampFragmentColor
|
||||
ADD_GLENUM_SERIALIZER( ClampReadColor, GLenum, GL_FIXED_ONLY ); // _clampReadColor
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
#include <osg/ClearNode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
// _clearMask
|
||||
static bool checkClearMask( const osg::ClearNode& node )
|
||||
{
|
||||
return node.getClearMask()!=(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
static bool readClearMask( osgDB::InputStream& is, osg::ClearNode& node )
|
||||
{
|
||||
GLbitfield mask = GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT;
|
||||
if ( is.isBinary() )
|
||||
{
|
||||
int maskValue; is >> maskValue;
|
||||
mask = (GLbitfield)maskValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string maskSetString; is >> maskSetString;
|
||||
osgDB::StringList maskList; osgDB::split( maskSetString, maskList, '|' );
|
||||
for ( unsigned int i=0; i<maskList.size(); ++i )
|
||||
{
|
||||
const std::string& maskValue = maskList[i];
|
||||
if ( maskValue=="COLOR" ) mask |= GL_COLOR_BUFFER_BIT;
|
||||
else if ( maskValue=="DEPTH" ) mask |= GL_DEPTH_BUFFER_BIT;
|
||||
else if ( maskValue=="ACCUM" ) mask |= GL_ACCUM_BUFFER_BIT;
|
||||
else if ( maskValue=="STENCIL" ) mask |= GL_STENCIL_BUFFER_BIT;
|
||||
}
|
||||
}
|
||||
node.setClearMask( mask );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeClearMask( osgDB::OutputStream& os, const osg::ClearNode& node )
|
||||
{
|
||||
GLbitfield mask = node.getClearMask();
|
||||
if ( os.isBinary() )
|
||||
os << (int)mask;
|
||||
else
|
||||
{
|
||||
std::string maskString;
|
||||
if ( mask==GL_COLOR_BUFFER_BIT ) maskString += std::string("COLOR|");
|
||||
if ( mask==GL_DEPTH_BUFFER_BIT ) maskString += std::string("DEPTH|");
|
||||
if ( mask==GL_ACCUM_BUFFER_BIT ) maskString += std::string("ACCUM|");
|
||||
if ( mask==GL_STENCIL_BUFFER_BIT ) maskString += std::string("STENCIL|");
|
||||
if ( !maskString.size() ) maskString = std::string("NONE|");
|
||||
os << maskString.substr(0, maskString.size()-1) << std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ClearNode,
|
||||
new osg::ClearNode,
|
||||
osg::ClearNode,
|
||||
"osg::Object osg::Node osg::Group osg::ClearNode" )
|
||||
{
|
||||
ADD_BOOL_SERIALIZER( RequiresClear, true ); // _requiresClear
|
||||
ADD_VEC4_SERIALIZER( ClearColor, osg::Vec4(0.0f, 0.0f, 0.0f, 1.0f) ); // _clearColor
|
||||
ADD_USER_SERIALIZER( ClearMask ); // _clearMask
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#include <osg/ClipNode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ClipNode,
|
||||
new osg::ClipNode,
|
||||
osg::ClipNode,
|
||||
"osg::Object osg::Node osg::Group osg::ClipNode" )
|
||||
{
|
||||
ADD_LIST_SERIALIZER( ClipPlaneList, osg::ClipNode::ClipPlaneList ); // _planes
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( ReferenceFrame, RELATIVE_RF );
|
||||
ADD_ENUM_VALUE( RELATIVE_RF );
|
||||
ADD_ENUM_VALUE( ABSOLUTE_RF );
|
||||
END_ENUM_SERIALIZER(); // _referenceFrame
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/ClipPlane>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ClipPlane,
|
||||
new osg::ClipPlane,
|
||||
osg::ClipPlane,
|
||||
"osg::Object osg::StateAttribute osg::ClipPlane" )
|
||||
{
|
||||
ADD_VEC4D_SERIALIZER( ClipPlane, osg::Vec4d() ); // _clipPlane
|
||||
ADD_UINT_SERIALIZER( ClipPlaneNum, 0 ); // _clipPlaneNum
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST dynamic_cast
|
||||
|
||||
#include <osg/ClusterCullingCallback>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ClusterCullingCallback,
|
||||
new osg::ClusterCullingCallback,
|
||||
osg::ClusterCullingCallback,
|
||||
"osg::Object osg::NodeCallback osg::ClusterCullingCallback" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( ControlPoint, osg::Vec3() ); // _controlPoint
|
||||
ADD_VEC3_SERIALIZER( Normal, osg::Vec3() ); // _normal
|
||||
ADD_FLOAT_SERIALIZER( Radius, -1.0f ); // _radius
|
||||
ADD_FLOAT_SERIALIZER( Deviation, -1.0f ); // _deviation
|
||||
}
|
||||
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST static_cast
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/ColorMask>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ColorMask,
|
||||
new osg::ColorMask,
|
||||
osg::ColorMask,
|
||||
"osg::Object osg::StateAttribute osg::ColorMask" )
|
||||
{
|
||||
ADD_BOOL_SERIALIZER( RedMask, true ); // _red
|
||||
ADD_BOOL_SERIALIZER( GreenMask, true ); // _green
|
||||
ADD_BOOL_SERIALIZER( BlueMask, true ); // _blue
|
||||
ADD_BOOL_SERIALIZER( AlphaMask, true ); // _alpha
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <osg/ColorMatrix>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ColorMatrix,
|
||||
new osg::ColorMatrix,
|
||||
osg::ColorMatrix,
|
||||
"osg::Object osg::StateAttribute osg::ColorMatrix" )
|
||||
{
|
||||
ADD_MATRIX_SERIALIZER( Matrix, osg::Matrix() ); // _matrix
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkChildren( const osg::CompositeShape& shape )
|
||||
{
|
||||
return shape.getNumChildren()>0;
|
||||
}
|
||||
|
||||
static bool readChildren( osgDB::InputStream& is, osg::CompositeShape& shape )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osg::Shape* child = dynamic_cast<osg::Shape*>( is.readObject() );
|
||||
if ( child ) shape.addChild( child );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeChildren( osgDB::OutputStream& os, const osg::CompositeShape& shape )
|
||||
{
|
||||
unsigned int size = shape.getNumChildren();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
os << shape.getChild(i);
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( CompositeShape,
|
||||
new osg::CompositeShape,
|
||||
osg::CompositeShape,
|
||||
"osg::Object osg::Shape osg::CompositeShape" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( Shape, osg::Shape, NULL ); // _shape
|
||||
ADD_USER_SERIALIZER( Children ); //_children
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Cone,
|
||||
new osg::Cone,
|
||||
osg::Cone,
|
||||
"osg::Object osg::Shape osg::Cone" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( Center, osg::Vec3() ); // _center
|
||||
ADD_FLOAT_SERIALIZER( Radius, 0.0f ); // _radius
|
||||
ADD_FLOAT_SERIALIZER( Height, 0.0f ); // _height
|
||||
ADD_QUAT_SERIALIZER( Rotation, osg::Quat() ); // _rotation
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ConvexHull,
|
||||
new osg::ConvexHull,
|
||||
osg::ConvexHull,
|
||||
"osg::Object osg::Shape osg::TriangleMesh osg::ConvexHull" )
|
||||
{
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
#include <osg/ConvexPlanarOccluder>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static void readConvexPlanarPolygon( osgDB::InputStream& is, osg::ConvexPlanarPolygon& polygon )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osg::Vec3d vertex; is >> vertex;
|
||||
polygon.add( vertex );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
}
|
||||
|
||||
static void writeConvexPlanarPolygon( osgDB::OutputStream& os, const osg::ConvexPlanarPolygon& polygon )
|
||||
{
|
||||
const osg::ConvexPlanarPolygon::VertexList& vertices = polygon.getVertexList();
|
||||
os << vertices.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::ConvexPlanarPolygon::VertexList::const_iterator itr=vertices.begin();
|
||||
itr!=vertices.end(); ++itr )
|
||||
{
|
||||
os << osg::Vec3d(*itr) << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
}
|
||||
|
||||
// _occluder
|
||||
static bool checkOccluder( const osg::ConvexPlanarOccluder& obj )
|
||||
{
|
||||
return obj.getOccluder().getVertexList().size()>0;
|
||||
}
|
||||
|
||||
static bool readOccluder( osgDB::InputStream& is, osg::ConvexPlanarOccluder& obj )
|
||||
{
|
||||
osg::ConvexPlanarPolygon polygon;
|
||||
readConvexPlanarPolygon( is, polygon );
|
||||
obj.setOccluder( polygon );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeOccluder( osgDB::OutputStream& os, const osg::ConvexPlanarOccluder& obj )
|
||||
{
|
||||
writeConvexPlanarPolygon( os, obj.getOccluder() );
|
||||
return true;
|
||||
}
|
||||
|
||||
// _holeList
|
||||
static bool checkHoles( const osg::ConvexPlanarOccluder& obj )
|
||||
{
|
||||
return obj.getHoleList().size()>0;
|
||||
}
|
||||
|
||||
static bool readHoles( osgDB::InputStream& is, osg::ConvexPlanarOccluder& obj )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osg::ConvexPlanarPolygon polygon;
|
||||
is >> osgDB::PROPERTY("Polygon");
|
||||
readConvexPlanarPolygon( is, polygon );
|
||||
obj.addHole( polygon );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeHoles( osgDB::OutputStream& os, const osg::ConvexPlanarOccluder& obj )
|
||||
{
|
||||
const osg::ConvexPlanarOccluder::HoleList& holes = obj.getHoleList();
|
||||
os << holes.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::ConvexPlanarOccluder::HoleList::const_iterator itr=holes.begin();
|
||||
itr!=holes.end(); ++itr )
|
||||
{
|
||||
os << osgDB::PROPERTY("Polygon");
|
||||
writeConvexPlanarPolygon( os, *itr );
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ConvexPlanarOccluder,
|
||||
new osg::ConvexPlanarOccluder,
|
||||
osg::ConvexPlanarOccluder,
|
||||
"osg::Object osg::ConvexPlanarOccluder" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Occluder ); // _occluder
|
||||
ADD_USER_SERIALIZER( Holes ); // _holeList
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <osg/CoordinateSystemNode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( CoordinateSystemNode,
|
||||
new osg::CoordinateSystemNode,
|
||||
osg::CoordinateSystemNode,
|
||||
"osg::Object osg::Node osg::Group osg::CoordinateSystemNode" )
|
||||
{
|
||||
ADD_STRING_SERIALIZER( Format, "" ); // _format
|
||||
ADD_STRING_SERIALIZER( CoordinateSystem, "" ); // _cs
|
||||
ADD_OBJECT_SERIALIZER( EllipsoidModel, osg::EllipsoidModel, NULL ); // _ellipsoidModel
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#include <osg/CullFace>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( CullFace,
|
||||
new osg::CullFace,
|
||||
osg::CullFace,
|
||||
"osg::Object osg::StateAttribute osg::CullFace" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( Mode, BACK );
|
||||
ADD_ENUM_VALUE( FRONT );
|
||||
ADD_ENUM_VALUE( BACK );
|
||||
ADD_ENUM_VALUE( FRONT_AND_BACK );
|
||||
END_ENUM_SERIALIZER(); // _mode
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Cylinder,
|
||||
new osg::Cylinder,
|
||||
osg::Cylinder,
|
||||
"osg::Object osg::Shape osg::Cylinder" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( Center, osg::Vec3() ); // _center
|
||||
ADD_FLOAT_SERIALIZER( Radius, 0.0f ); // _radius
|
||||
ADD_FLOAT_SERIALIZER( Height, 0.0f ); // _height
|
||||
ADD_QUAT_SERIALIZER( Rotation, osg::Quat() ); // _rotation
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#include <osg/Depth>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Depth,
|
||||
new osg::Depth,
|
||||
osg::Depth,
|
||||
"osg::Object osg::StateAttribute osg::Depth" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( Function, LESS );
|
||||
ADD_ENUM_VALUE( NEVER );
|
||||
ADD_ENUM_VALUE( LESS );
|
||||
ADD_ENUM_VALUE( EQUAL );
|
||||
ADD_ENUM_VALUE( LEQUAL );
|
||||
ADD_ENUM_VALUE( GREATER );
|
||||
ADD_ENUM_VALUE( NOTEQUAL );
|
||||
ADD_ENUM_VALUE( GEQUAL );
|
||||
ADD_ENUM_VALUE( ALWAYS );
|
||||
END_ENUM_SERIALIZER(); // _func
|
||||
|
||||
ADD_DOUBLE_SERIALIZER( ZNear, 0.0 ); // _zNear
|
||||
ADD_DOUBLE_SERIALIZER( ZFar, 1.0 ); // _zFar
|
||||
ADD_BOOL_SERIALIZER( WriteMask, true ); // _depthWriteMask
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#include <osg/DrawPixels>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkArea( const osg::DrawPixels& drawable )
|
||||
{
|
||||
return drawable.getUseSubImage();
|
||||
}
|
||||
|
||||
static bool readArea( osgDB::InputStream& is, osg::DrawPixels& drawable )
|
||||
{
|
||||
unsigned int x, y, w, h;
|
||||
is >> x >> y >> w >> h;
|
||||
drawable.setSubImageDimensions( x, y, w, h );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeArea( osgDB::OutputStream& os, const osg::DrawPixels& drawable )
|
||||
{
|
||||
unsigned int x, y, w, h;
|
||||
drawable.getSubImageDimensions( x, y, w, h );
|
||||
os << x << y << w << h << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( DrawPixels,
|
||||
new osg::DrawPixels,
|
||||
osg::DrawPixels,
|
||||
"osg::Object osg::Drawable osg::DrawPixels" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( Position, osg::Vec3() ); // _position
|
||||
ADD_IMAGE_SERIALIZER( Image, osg::Image, NULL ); // _image
|
||||
ADD_BOOL_SERIALIZER( UseSubImage, false ); // _useSubImage
|
||||
ADD_USER_SERIALIZER( Area ); // _offsetX, _offsetY, _width, _height
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
#include <osg/Drawable>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkInitialBound( const osg::Drawable& drawable )
|
||||
{
|
||||
return drawable.getInitialBound().valid();
|
||||
}
|
||||
|
||||
static bool readInitialBound( osgDB::InputStream& is, osg::Drawable& drawable )
|
||||
{
|
||||
osg::Vec3d min, max;
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
is >> osgDB::PROPERTY("Minimum") >> min;
|
||||
is >> osgDB::PROPERTY("Maximum") >> max;
|
||||
is >> osgDB::END_BRACKET;
|
||||
drawable.setInitialBound( osg::BoundingBox(min, max) );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeInitialBound( osgDB::OutputStream& os, const osg::Drawable& drawable )
|
||||
{
|
||||
const osg::BoundingBox& bb = drawable.getInitialBound();
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
os << osgDB::PROPERTY("Minimum") << osg::Vec3d(bb._min) << std::endl;
|
||||
os << osgDB::PROPERTY("Maximum") << osg::Vec3d(bb._max) << std::endl;
|
||||
os << osgDB::END_BRACKET;
|
||||
os << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Drawable,
|
||||
/*new osg::Drawable*/NULL,
|
||||
osg::Drawable,
|
||||
"osg::Object osg::Drawable" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( StateSet, osg::StateSet, NULL ); // _stateset
|
||||
ADD_USER_SERIALIZER( InitialBound ); // _initialBound
|
||||
ADD_OBJECT_SERIALIZER( ComputeBoundingBoxCallback,
|
||||
osg::Drawable::ComputeBoundingBoxCallback, NULL ); // _computeBoundCallback
|
||||
ADD_OBJECT_SERIALIZER( Shape, osg::Shape, NULL ); // _shape
|
||||
ADD_BOOL_SERIALIZER( SupportsDisplayList, true ); // _supportsDisplayList
|
||||
ADD_BOOL_SERIALIZER( UseDisplayList, true ); // _useDisplayList
|
||||
ADD_BOOL_SERIALIZER( UseVertexBufferObjects, false ); // _useVertexBufferObjects
|
||||
ADD_OBJECT_SERIALIZER( UpdateCallback, osg::Drawable::UpdateCallback, NULL ); // _updateCallback
|
||||
ADD_OBJECT_SERIALIZER( EventCallback, osg::Drawable::EventCallback, NULL ); // _eventCallback
|
||||
ADD_OBJECT_SERIALIZER( CullCallback, osg::Drawable::CullCallback, NULL ); // _cullCallback
|
||||
ADD_OBJECT_SERIALIZER( DrawCallback, osg::Drawable::DrawCallback, NULL ); // _drawCallback
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/CoordinateSystemNode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( EllipsoidModel,
|
||||
new osg::EllipsoidModel,
|
||||
osg::EllipsoidModel,
|
||||
"osg::Object osg::EllipsoidModel" )
|
||||
{
|
||||
ADD_DOUBLE_SERIALIZER( RadiusEquator, 0.0 ); // _radiusEquator
|
||||
ADD_DOUBLE_SERIALIZER( RadiusPolar, 0.0 ); // _radiusPolar
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#include <osg/Fog>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Fog,
|
||||
new osg::Fog,
|
||||
osg::Fog,
|
||||
"osg::Object osg::StateAttribute osg::Fog" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( Mode, LINEAR );
|
||||
ADD_ENUM_VALUE( LINEAR );
|
||||
ADD_ENUM_VALUE( EXP );
|
||||
ADD_ENUM_VALUE( EXP2 );
|
||||
END_ENUM_SERIALIZER(); // _mode
|
||||
|
||||
ADD_FLOAT_SERIALIZER( Start, 0.0f ); // _start
|
||||
ADD_FLOAT_SERIALIZER( End, 1.0f ); // _end
|
||||
ADD_FLOAT_SERIALIZER( Density, 1.0f ); // _density
|
||||
ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color
|
||||
ADD_GLENUM_SERIALIZER( FogCoordinateSource, GLint, GL_NONE ); // _fogCoordinateSource
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
#include <osg/FragmentProgram>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
// _programLocalParameters
|
||||
static bool checkLocalParameters( const osg::FragmentProgram& fp )
|
||||
{
|
||||
return fp.getLocalParameters().size()>0;
|
||||
}
|
||||
|
||||
static bool readLocalParameters( osgDB::InputStream& is, osg::FragmentProgram& fp )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
GLuint key; osg::Vec4d value;
|
||||
is >> key >> value;
|
||||
fp.setProgramLocalParameter( key, value );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeLocalParameters( osgDB::OutputStream& os, const osg::FragmentProgram& fp )
|
||||
{
|
||||
const osg::FragmentProgram::LocalParamList& params = fp.getLocalParameters();
|
||||
os << params.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::FragmentProgram::LocalParamList::const_iterator itr=params.begin();
|
||||
itr!=params.end(); ++itr )
|
||||
{
|
||||
os << itr->first << osg::Vec4d(itr->second) << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _matrixList
|
||||
static bool checkMatrices( const osg::FragmentProgram& fp )
|
||||
{
|
||||
return fp.getMatrices().size()>0;
|
||||
}
|
||||
|
||||
static bool readMatrices( osgDB::InputStream& is, osg::FragmentProgram& fp )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
unsigned int key; osg::Matrixd value;
|
||||
is >> key >> value;
|
||||
fp.setMatrix( key, value );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeMatrices( osgDB::OutputStream& os, const osg::FragmentProgram& fp )
|
||||
{
|
||||
const osg::FragmentProgram::MatrixList& matrices = fp.getMatrices();
|
||||
os << matrices.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::FragmentProgram::MatrixList::const_iterator itr=matrices.begin();
|
||||
itr!=matrices.end(); ++itr )
|
||||
{
|
||||
os << (unsigned int)itr->first << osg::Matrixd(itr->second) << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( FragmentProgram,
|
||||
new osg::FragmentProgram,
|
||||
osg::FragmentProgram,
|
||||
"osg::Object osg::StateAttribute osg::FragmentProgram" )
|
||||
{
|
||||
ADD_STRING_SERIALIZER( FragmentProgram, "" ); // _fragmentProgram
|
||||
ADD_USER_SERIALIZER( LocalParameters ); // _programLocalParameters
|
||||
ADD_USER_SERIALIZER( Matrices ); // _matrixList
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/FrontFace>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( FrontFace,
|
||||
new osg::FrontFace,
|
||||
osg::FrontFace,
|
||||
"osg::Object osg::StateAttribute osg::FrontFace" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( Mode, COUNTER_CLOCKWISE );
|
||||
ADD_ENUM_VALUE( CLOCKWISE );
|
||||
ADD_ENUM_VALUE( COUNTER_CLOCKWISE );
|
||||
END_ENUM_SERIALIZER(); // _mode
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
#include <osg/Geode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkDrawables( const osg::Geode& node )
|
||||
{
|
||||
return node.getNumDrawables()>0;
|
||||
}
|
||||
|
||||
static bool readDrawables( osgDB::InputStream& is, osg::Geode& node )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osg::Drawable* drawable = dynamic_cast<osg::Drawable*>( is.readObject() );
|
||||
if ( drawable ) node.addDrawable( drawable );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeDrawables( osgDB::OutputStream& os, const osg::Geode& node )
|
||||
{
|
||||
unsigned int size = node.getNumDrawables();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
os << node.getDrawable(i);
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Geode,
|
||||
new osg::Geode,
|
||||
osg::Geode,
|
||||
"osg::Object osg::Node osg::Geode" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Drawables ); // _drawables
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
#include <osg/Geometry>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
BEGIN_USER_TABLE( AttributeBinding, osg::Geometry );
|
||||
ADD_USER_VALUE( BIND_OFF );
|
||||
ADD_USER_VALUE( BIND_OVERALL );
|
||||
ADD_USER_VALUE( BIND_PER_PRIMITIVE_SET );
|
||||
ADD_USER_VALUE( BIND_PER_PRIMITIVE );
|
||||
ADD_USER_VALUE( BIND_PER_VERTEX );
|
||||
END_USER_TABLE()
|
||||
|
||||
USER_READ_FUNC( AttributeBinding, readAttributeBinding )
|
||||
USER_WRITE_FUNC( AttributeBinding, writeAttributeBinding )
|
||||
|
||||
static void readArrayData( osgDB::InputStream& is, osg::Geometry::ArrayData& data )
|
||||
{
|
||||
bool hasArray = false;
|
||||
is >> osgDB::PROPERTY("Array") >> hasArray;
|
||||
if ( hasArray ) data.array = is.readArray();
|
||||
|
||||
bool hasIndices = false;
|
||||
is >> osgDB::PROPERTY("Indices") >> hasIndices;
|
||||
if ( hasIndices ) data.indices = dynamic_cast<osg::IndexArray*>( is.readArray() );
|
||||
|
||||
is >> osgDB::PROPERTY("Binding");
|
||||
data.binding = (osg::Geometry::AttributeBinding)readAttributeBinding(is);
|
||||
|
||||
int normalizeValue = 0;
|
||||
is >> osgDB::PROPERTY("Normalize") >> normalizeValue;
|
||||
data.normalize = normalizeValue;
|
||||
}
|
||||
|
||||
static void writeArrayData( osgDB::OutputStream& os, const osg::Geometry::ArrayData& data )
|
||||
{
|
||||
os << osgDB::PROPERTY("Array") << data.array.valid();
|
||||
if ( data.array.valid() ) os << data.array.get();
|
||||
else os << std::endl;
|
||||
|
||||
os << osgDB::PROPERTY("Indices") << data.indices.valid();
|
||||
if ( data.indices.valid() ) os << data.indices.get();
|
||||
else os << std::endl;
|
||||
|
||||
os << osgDB::PROPERTY("Binding"); writeAttributeBinding(os, data.binding); os << std::endl;
|
||||
os << osgDB::PROPERTY("Normalize") << (int)data.normalize << std::endl;
|
||||
}
|
||||
|
||||
#define ADD_ARRAYDATA_FUNCTIONS( PROP ) \
|
||||
static bool check##PROP( const osg::Geometry& geom ) \
|
||||
{ return geom.get##PROP().array.valid(); } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osg::Geometry& geom ) { \
|
||||
osg::Geometry::ArrayData data; \
|
||||
is >> osgDB::BEGIN_BRACKET; readArrayData(is, data); \
|
||||
is >> osgDB::END_BRACKET; \
|
||||
geom.set##PROP(data); \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::Geometry& geom ) { \
|
||||
os << osgDB::BEGIN_BRACKET << std::endl; \
|
||||
writeArrayData(os, geom.get##PROP()); \
|
||||
os << osgDB::END_BRACKET << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
ADD_ARRAYDATA_FUNCTIONS( VertexData )
|
||||
ADD_ARRAYDATA_FUNCTIONS( NormalData )
|
||||
ADD_ARRAYDATA_FUNCTIONS( ColorData )
|
||||
ADD_ARRAYDATA_FUNCTIONS( SecondaryColorData )
|
||||
ADD_ARRAYDATA_FUNCTIONS( FogCoordData )
|
||||
|
||||
#define ADD_ARRAYLIST_FUNCTIONS( PROP, LISTNAME ) \
|
||||
static bool check##PROP( const osg::Geometry& geom ) \
|
||||
{ return geom.get##LISTNAME().size()>0; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osg::Geometry& geom ) { \
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; \
|
||||
for ( unsigned int i=0; i<size; ++i ) { \
|
||||
osg::Geometry::ArrayData data; \
|
||||
is >> osgDB::PROPERTY("Data") >> osgDB::BEGIN_BRACKET; \
|
||||
readArrayData(is, data); \
|
||||
is >> osgDB::END_BRACKET; geom.set##PROP(i, data); } \
|
||||
is >> osgDB::END_BRACKET; \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::Geometry& geom ) { \
|
||||
const osg::Geometry::ArrayDataList& LISTNAME = geom.get##LISTNAME(); \
|
||||
os << LISTNAME.size() << osgDB::BEGIN_BRACKET << std::endl; \
|
||||
for ( osg::Geometry::ArrayDataList::const_iterator itr=LISTNAME.begin(); \
|
||||
itr!=LISTNAME.end(); ++itr ) { \
|
||||
os << osgDB::PROPERTY("Data") << osgDB::BEGIN_BRACKET << std::endl; \
|
||||
writeArrayData(os, *itr); os << osgDB::END_BRACKET << std::endl; \
|
||||
} \
|
||||
os << osgDB::END_BRACKET << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
ADD_ARRAYLIST_FUNCTIONS( TexCoordData, TexCoordArrayList )
|
||||
ADD_ARRAYLIST_FUNCTIONS( VertexAttribData, VertexAttribArrayList )
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Geometry,
|
||||
new osg::Geometry,
|
||||
osg::Geometry,
|
||||
"osg::Object osg::Drawable osg::Geometry" )
|
||||
{
|
||||
ADD_LIST_SERIALIZER( PrimitiveSetList, osg::Geometry::PrimitiveSetList ); // _primitives
|
||||
ADD_USER_SERIALIZER( VertexData ); // _vertexData
|
||||
ADD_USER_SERIALIZER( NormalData ); // _normalData
|
||||
ADD_USER_SERIALIZER( ColorData ); // _colorData
|
||||
ADD_USER_SERIALIZER( SecondaryColorData ); // _secondaryColorData
|
||||
ADD_USER_SERIALIZER( FogCoordData ); // _fogCoordData
|
||||
ADD_USER_SERIALIZER( TexCoordData ); // _texCoordList
|
||||
ADD_USER_SERIALIZER( VertexAttribData ); // _vertexAttribList
|
||||
ADD_BOOL_SERIALIZER( FastPathHint, true ); // _fastPathHint
|
||||
ADD_OBJECT_SERIALIZER( InternalOptimizedGeometry, osg::Geometry, NULL ); // _internalOptimizedGeometry
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
#include <osg/Group>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkChildren( const osg::Group& node )
|
||||
{
|
||||
return node.getNumChildren()>0;
|
||||
}
|
||||
|
||||
static bool readChildren( osgDB::InputStream& is, osg::Group& node )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osg::Node* child = dynamic_cast<osg::Node*>( is.readObject() );
|
||||
if ( child ) node.addChild( child );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeChildren( osgDB::OutputStream& os, const osg::Group& node )
|
||||
{
|
||||
unsigned int size = node.getNumChildren();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
os << node.getChild(i);
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Group,
|
||||
new osg::Group,
|
||||
osg::Group,
|
||||
"osg::Object osg::Node osg::Group" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Children ); // _children
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
// _columns, _rows
|
||||
static bool checkArea( const osg::HeightField& shape )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool readArea( osgDB::InputStream& is, osg::HeightField& shape )
|
||||
{
|
||||
unsigned int numCols, numRows;
|
||||
is >> numCols >> numRows;
|
||||
shape.allocate( numCols, numRows );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeArea( osgDB::OutputStream& os, const osg::HeightField& shape )
|
||||
{
|
||||
os << shape.getNumColumns() << shape.getNumRows() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _heights
|
||||
static bool checkHeights( const osg::HeightField& shape )
|
||||
{
|
||||
return shape.getFloatArray()!=NULL;
|
||||
}
|
||||
|
||||
static bool readHeights( osgDB::InputStream& is, osg::HeightField& shape )
|
||||
{
|
||||
osg::FloatArray* array = dynamic_cast<osg::FloatArray*>( is.readArray() );
|
||||
if ( array )
|
||||
{
|
||||
unsigned int numCols = shape.getNumColumns(), numRows = shape.getNumRows();
|
||||
if ( array->size()<numRows*numCols ) return false;
|
||||
|
||||
unsigned int index = 0;
|
||||
for ( unsigned int r=0; r<numRows; ++r )
|
||||
{
|
||||
for ( unsigned int c=0; c<numCols; ++c )
|
||||
shape.setHeight( c, r, (*array)[index++] );
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeHeights( osgDB::OutputStream& os, const osg::HeightField& shape )
|
||||
{
|
||||
os.writeArray( shape.getFloatArray() );
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( HeightField,
|
||||
new osg::HeightField,
|
||||
osg::HeightField,
|
||||
"osg::Object osg::Shape osg::HeightField" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Area ); // _columns, _rows
|
||||
ADD_VEC3_SERIALIZER( Origin, osg::Vec3() ); // _origin
|
||||
ADD_FLOAT_SERIALIZER( XInterval, 0.0f ); // _dx
|
||||
ADD_FLOAT_SERIALIZER( YInterval, 0.0f ); // _dy
|
||||
ADD_FLOAT_SERIALIZER( SkirtHeight, 0.0f ); // _skirtHeight
|
||||
ADD_UINT_SERIALIZER( BorderWidth, 0 ); // _borderWidth
|
||||
ADD_QUAT_SERIALIZER( Rotation, osg::Quat() ); // _rotation
|
||||
ADD_USER_SERIALIZER( Heights ); // _heights
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/Hint>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Hint,
|
||||
new osg::Hint,
|
||||
osg::Hint,
|
||||
"osg::Object osg::StateAttribute osg::Hint" )
|
||||
{
|
||||
ADD_GLENUM_SERIALIZER( Target, GLenum, GL_NONE ); // _target
|
||||
ADD_GLENUM_SERIALIZER( Mode, GLenum, GL_DONT_CARE ); // _mode
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <osg/Image>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Image,
|
||||
new osg::Image,
|
||||
osg::Image,
|
||||
"osg::Object osg::Image" )
|
||||
{
|
||||
// Everything is done in OutputStream and InputStream classes
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
#include <osg/ImageSequence>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
// _fileNames
|
||||
static bool checkFileNames( const osg::ImageSequence& image )
|
||||
{
|
||||
return image.getNumImageFiles()>0;
|
||||
}
|
||||
|
||||
static bool readFileNames( osgDB::InputStream& is, osg::ImageSequence& image )
|
||||
{
|
||||
unsigned int files = 0; is >> files >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<files; ++i )
|
||||
{
|
||||
std::string filename; is.readWrappedString( filename );
|
||||
image.addImageFile( filename );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeFileNames( osgDB::OutputStream& os, const osg::ImageSequence& image )
|
||||
{
|
||||
const osg::ImageSequence::FileNames& files = image.getFileNames();
|
||||
os << files.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::ImageSequence::FileNames::const_iterator itr=files.begin();
|
||||
itr!=files.end(); ++itr )
|
||||
{
|
||||
os.writeWrappedString( *itr );
|
||||
os << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _images
|
||||
static bool checkImages( const osg::ImageSequence& image )
|
||||
{
|
||||
return image.getNumImages()>0;
|
||||
}
|
||||
|
||||
static bool readImages( osgDB::InputStream& is, osg::ImageSequence& image )
|
||||
{
|
||||
unsigned int images = 0; is >> images >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<images; ++i )
|
||||
{
|
||||
osg::Image* img = dynamic_cast<osg::Image*>( is.readObject() );
|
||||
if ( img ) image.addImage( img );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeImages( osgDB::OutputStream& os, const osg::ImageSequence& image )
|
||||
{
|
||||
const osg::ImageSequence::Images& images = image.getImages();
|
||||
os << images.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::ImageSequence::Images::const_iterator itr=images.begin();
|
||||
itr!=images.end(); ++itr )
|
||||
{
|
||||
os.writeObject( (*itr).get() );
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ImageSequence,
|
||||
new osg::ImageSequence,
|
||||
osg::ImageSequence,
|
||||
"osg::Object osg::Image osg::ImageStream osg::ImageSequence" )
|
||||
{
|
||||
ADD_DOUBLE_SERIALIZER( ReferenceTime, DBL_MAX ); // _referenceTime
|
||||
ADD_DOUBLE_SERIALIZER( TimeMultiplier, 1.0 ); // _timeMultiplier
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( Mode, PRE_LOAD_ALL_IMAGES );
|
||||
ADD_ENUM_VALUE( PRE_LOAD_ALL_IMAGES );
|
||||
ADD_ENUM_VALUE( PAGE_AND_RETAIN_IMAGES );
|
||||
ADD_ENUM_VALUE( PAGE_AND_DISCARD_USED_IMAGES );
|
||||
END_ENUM_SERIALIZER(); // _mode
|
||||
|
||||
ADD_DOUBLE_SERIALIZER( Length, 1.0 ); // _length
|
||||
ADD_USER_SERIALIZER( FileNames ); // _fileNames
|
||||
ADD_USER_SERIALIZER( Images ); // _images
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#include <osg/ImageStream>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ImageStream,
|
||||
new osg::ImageStream,
|
||||
osg::ImageStream,
|
||||
"osg::Object osg::Image osg::ImageStream" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( LoopingMode, NO_LOOPING );
|
||||
ADD_ENUM_VALUE( NO_LOOPING );
|
||||
ADD_ENUM_VALUE( LOOPING );
|
||||
END_ENUM_SERIALIZER(); // _loopingMode
|
||||
|
||||
ADD_LIST_SERIALIZER( AudioStreams, osg::ImageStream::AudioStreams ); // _audioStreams
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
#include <osg/LOD>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
// _userDefinedCenter, _radius
|
||||
static bool checkUserCenter( const osg::LOD& node )
|
||||
{
|
||||
return node.getCenterMode()==osg::LOD::USER_DEFINED_CENTER;
|
||||
}
|
||||
|
||||
static bool readUserCenter( osgDB::InputStream& is, osg::LOD& node )
|
||||
{
|
||||
osg::Vec3d center; double radius;
|
||||
is >> center >> radius;
|
||||
node.setCenter( center ); node.setRadius( radius );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeUserCenter( osgDB::OutputStream& os, const osg::LOD& node )
|
||||
{
|
||||
os << osg::Vec3d(node.getCenter()) << (double)node.getRadius() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _rangeList
|
||||
static bool checkRangeList( const osg::LOD& node )
|
||||
{
|
||||
return node.getNumRanges()>0;
|
||||
}
|
||||
|
||||
static bool readRangeList( osgDB::InputStream& is, osg::LOD& node )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
float min, max;
|
||||
is >> min >> max;
|
||||
node.setRange( i, min, max );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeRangeList( osgDB::OutputStream& os, const osg::LOD& node )
|
||||
{
|
||||
const osg::LOD::RangeList& ranges = node.getRangeList();
|
||||
os << ranges.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::LOD::RangeList::const_iterator itr=ranges.begin();
|
||||
itr!=ranges.end(); ++itr )
|
||||
{
|
||||
os << itr->first << itr->second << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( LOD,
|
||||
new osg::LOD,
|
||||
osg::LOD,
|
||||
"osg::Object osg::Node osg::Group osg::LOD" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( CenterMode, USE_BOUNDING_SPHERE_CENTER );
|
||||
ADD_ENUM_VALUE( USE_BOUNDING_SPHERE_CENTER );
|
||||
ADD_ENUM_VALUE( USER_DEFINED_CENTER );
|
||||
END_ENUM_SERIALIZER(); // _centerMode
|
||||
|
||||
ADD_USER_SERIALIZER( UserCenter ); // _userDefinedCenter, _radius
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( RangeMode, DISTANCE_FROM_EYE_POINT );
|
||||
ADD_ENUM_VALUE( DISTANCE_FROM_EYE_POINT );
|
||||
ADD_ENUM_VALUE( PIXEL_SIZE_ON_SCREEN );
|
||||
END_ENUM_SERIALIZER(); // _rangeMode
|
||||
|
||||
ADD_USER_SERIALIZER( RangeList ); // _rangeList
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#include <osg/Light>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Light,
|
||||
new osg::Light,
|
||||
osg::Light,
|
||||
"osg::Object osg::StateAttribute osg::Light" )
|
||||
{
|
||||
ADD_INT_SERIALIZER( LightNum, 0 ); // _lightnum
|
||||
ADD_VEC4_SERIALIZER( Ambient, osg::Vec4() ); // _ambient
|
||||
ADD_VEC4_SERIALIZER( Diffuse, osg::Vec4() ); // _diffuse
|
||||
ADD_VEC4_SERIALIZER( Specular, osg::Vec4() ); // _specular
|
||||
ADD_VEC4_SERIALIZER( Position, osg::Vec4() ); // _position
|
||||
ADD_VEC3_SERIALIZER( Direction, osg::Vec3() ); // _direction
|
||||
ADD_FLOAT_SERIALIZER( ConstantAttenuation, 1.0f ); // _constant_attenuation
|
||||
ADD_FLOAT_SERIALIZER( LinearAttenuation, 0.0f ); // _linear_attenuation
|
||||
ADD_FLOAT_SERIALIZER( QuadraticAttenuation, 0.0f ); // _quadratic_attenuation
|
||||
ADD_FLOAT_SERIALIZER( SpotExponent, 0.0f ); // _spot_exponent
|
||||
ADD_FLOAT_SERIALIZER( SpotCutoff, 180.0f ); // _spot_cutoff
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#include <osg/LightModel>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( LightModel,
|
||||
new osg::LightModel,
|
||||
osg::LightModel,
|
||||
"osg::Object osg::StateAttribute osg::LightModel" )
|
||||
{
|
||||
ADD_VEC4_SERIALIZER( AmbientIntensity, osg::Vec4() ); // _ambient
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( ColorControl, SINGLE_COLOR );
|
||||
ADD_ENUM_VALUE( SEPARATE_SPECULAR_COLOR );
|
||||
ADD_ENUM_VALUE( SINGLE_COLOR );
|
||||
END_ENUM_SERIALIZER(); // _colorControl
|
||||
|
||||
ADD_BOOL_SERIALIZER( LocalViewer, false ); // _localViewer
|
||||
ADD_BOOL_SERIALIZER( TwoSided, false ); // _twoSided
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#include <osg/LightSource>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( LightSource,
|
||||
new osg::LightSource,
|
||||
osg::LightSource,
|
||||
"osg::Object osg::Node osg::Group osg::LightSource" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( Light, osg::Light, NULL ); // _light
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( ReferenceFrame, RELATIVE_RF );
|
||||
ADD_ENUM_VALUE( RELATIVE_RF );
|
||||
ADD_ENUM_VALUE( ABSOLUTE_RF );
|
||||
END_ENUM_SERIALIZER(); // _referenceFrame
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/LineStipple>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( LineStipple,
|
||||
new osg::LineStipple,
|
||||
osg::LineStipple,
|
||||
"osg::Object osg::StateAttribute osg::LineStipple" )
|
||||
{
|
||||
ADD_INT_SERIALIZER( Factor, 1 ); // _factor
|
||||
ADD_HEXSHORT_SERIALIZER( Pattern, 0xffff ); // _pattern
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <osg/LineWidth>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( LineWidth,
|
||||
new osg::LineWidth,
|
||||
osg::LineWidth,
|
||||
"osg::Object osg::StateAttribute osg::LineWidth" )
|
||||
{
|
||||
ADD_FLOAT_SERIALIZER( Width, 1.0f ); // _width
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#include <osg/LogicOp>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( LogicOp,
|
||||
new osg::LogicOp,
|
||||
osg::LogicOp,
|
||||
"osg::Object osg::StateAttribute osg::LogicOp" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( Opcode, COPY );
|
||||
ADD_ENUM_VALUE( CLEAR );
|
||||
ADD_ENUM_VALUE( SET );
|
||||
ADD_ENUM_VALUE( COPY );
|
||||
ADD_ENUM_VALUE( COPY_INVERTED );
|
||||
ADD_ENUM_VALUE( NOOP );
|
||||
ADD_ENUM_VALUE( INVERT );
|
||||
ADD_ENUM_VALUE( AND );
|
||||
ADD_ENUM_VALUE( NAND );
|
||||
ADD_ENUM_VALUE( OR );
|
||||
ADD_ENUM_VALUE( NOR );
|
||||
ADD_ENUM_VALUE( XOR );
|
||||
ADD_ENUM_VALUE( EQUIV );
|
||||
ADD_ENUM_VALUE( AND_REVERSE );
|
||||
ADD_ENUM_VALUE( AND_INVERTED );
|
||||
ADD_ENUM_VALUE( OR_REVERSE );
|
||||
ADD_ENUM_VALUE( OR_INVERTED );
|
||||
END_ENUM_SERIALIZER(); // _opcode
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
#include <osg/Material>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#define MATERIAL_FUNC( PROP, TYPE ) \
|
||||
static bool check##PROP( const osg::Material& attr ) { return true; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osg::Material& attr ) { \
|
||||
bool frontAndBack; TYPE value1, value2; \
|
||||
is >> frontAndBack; \
|
||||
is >> osgDB::PROPERTY("Front") >> value1; \
|
||||
is >> osgDB::PROPERTY("Back") >> value2; \
|
||||
if ( frontAndBack ) \
|
||||
attr.set##PROP(osg::Material::FRONT_AND_BACK, value1); \
|
||||
else { \
|
||||
attr.set##PROP(osg::Material::FRONT, value1); \
|
||||
attr.set##PROP(osg::Material::BACK, value2); \
|
||||
} \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::Material& attr ) { \
|
||||
os << attr.get##PROP##FrontAndBack(); \
|
||||
os << osgDB::PROPERTY("Front") << TYPE(attr.get##PROP(osg::Material::FRONT)); \
|
||||
os << osgDB::PROPERTY("Back") << TYPE(attr.get##PROP(osg::Material::BACK)) << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
MATERIAL_FUNC( Ambient, osg::Vec4f )
|
||||
MATERIAL_FUNC( Diffuse, osg::Vec4f )
|
||||
MATERIAL_FUNC( Specular, osg::Vec4f )
|
||||
MATERIAL_FUNC( Emission, osg::Vec4f )
|
||||
MATERIAL_FUNC( Shininess, float )
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Material,
|
||||
new osg::Material,
|
||||
osg::Material,
|
||||
"osg::Object osg::StateAttribute osg::Material" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( ColorMode, OFF );
|
||||
ADD_ENUM_VALUE( AMBIENT );
|
||||
ADD_ENUM_VALUE( DIFFUSE );
|
||||
ADD_ENUM_VALUE( SPECULAR );
|
||||
ADD_ENUM_VALUE( EMISSION );
|
||||
ADD_ENUM_VALUE( AMBIENT_AND_DIFFUSE );
|
||||
ADD_ENUM_VALUE( OFF );
|
||||
END_ENUM_SERIALIZER(); // _colorMode
|
||||
|
||||
ADD_USER_SERIALIZER( Ambient ); // _ambient
|
||||
ADD_USER_SERIALIZER( Diffuse ); // _diffuse
|
||||
ADD_USER_SERIALIZER( Specular ); // _specular
|
||||
ADD_USER_SERIALIZER( Emission ); // _emission
|
||||
ADD_USER_SERIALIZER( Shininess ); // _shininess
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( MatrixTransform,
|
||||
new osg::MatrixTransform,
|
||||
osg::MatrixTransform,
|
||||
"osg::Object osg::Node osg::Group osg::Transform osg::MatrixTransform" )
|
||||
{
|
||||
ADD_MATRIX_SERIALIZER( Matrix, osg::Matrix() ); // _matrix
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#include <osg/Multisample>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Multisample,
|
||||
new osg::Multisample,
|
||||
osg::Multisample,
|
||||
"osg::Object osg::StateAttribute osg::Multisample" )
|
||||
{
|
||||
ADD_FLOAT_SERIALIZER( Coverage, 0.0f ); // _coverage
|
||||
ADD_BOOL_SERIALIZER( Invert, false ); // _invert
|
||||
|
||||
BEGIN_ENUM_SERIALIZER2( Hint, osg::Multisample::Mode, DONT_CARE );
|
||||
ADD_ENUM_VALUE( FASTEST );
|
||||
ADD_ENUM_VALUE( NICEST );
|
||||
ADD_ENUM_VALUE( DONT_CARE );
|
||||
END_ENUM_SERIALIZER(); // _mode
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
#include <osg/Node>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
// _initialBound
|
||||
static bool checkInitialBound( const osg::Node& node )
|
||||
{
|
||||
return node.getInitialBound().valid();
|
||||
}
|
||||
|
||||
static bool readInitialBound( osgDB::InputStream& is, osg::Node& node )
|
||||
{
|
||||
osg::Vec3d center;
|
||||
double radius;
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
is >> osgDB::PROPERTY("Center") >> center;
|
||||
is >> osgDB::PROPERTY("Radius") >> radius;
|
||||
is >> osgDB::END_BRACKET;
|
||||
node.setInitialBound( osg::BoundingSphere(center, radius) );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeInitialBound( osgDB::OutputStream& os, const osg::Node& node )
|
||||
{
|
||||
const osg::BoundingSphere& bs = node.getInitialBound();
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
os << osgDB::PROPERTY("Center") << osg::Vec3d(bs.center()) << std::endl;
|
||||
os << osgDB::PROPERTY("Radius") << double(bs.radius()) << std::endl;
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _descriptions
|
||||
static bool checkDescriptions( const osg::Node& node )
|
||||
{
|
||||
return node.getDescriptions().size()>0;
|
||||
}
|
||||
|
||||
static bool readDescriptions( osgDB::InputStream& is, osg::Node& node )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
std::string value;
|
||||
is.readWrappedString( value );
|
||||
node.addDescription( value );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeDescriptions( osgDB::OutputStream& os, const osg::Node& node )
|
||||
{
|
||||
const osg::Node::DescriptionList& slist = node.getDescriptions();
|
||||
os << slist.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::Node::DescriptionList::const_iterator itr=slist.begin();
|
||||
itr!=slist.end(); ++itr )
|
||||
{
|
||||
os.writeWrappedString( *itr );
|
||||
os << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Node,
|
||||
new osg::Node,
|
||||
osg::Node,
|
||||
"osg::Object osg::Node" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( InitialBound ); // _initialBound
|
||||
ADD_OBJECT_SERIALIZER( ComputeBoundingSphereCallback,
|
||||
osg::Node::ComputeBoundingSphereCallback, NULL ); // _computeBoundCallback
|
||||
ADD_OBJECT_SERIALIZER( UpdateCallback, osg::NodeCallback, NULL ); // _updateCallback
|
||||
ADD_OBJECT_SERIALIZER( EventCallback, osg::NodeCallback, NULL ); // _eventCallback
|
||||
ADD_OBJECT_SERIALIZER( CullCallback, osg::NodeCallback, NULL ); // _cullCallback
|
||||
ADD_BOOL_SERIALIZER( CullingActive, true ); // _cullingActive
|
||||
ADD_HEXINT_SERIALIZER( NodeMask, 0xffffffff ); // _nodeMask
|
||||
ADD_USER_SERIALIZER( Descriptions ); // _descriptions
|
||||
ADD_OBJECT_SERIALIZER( StateSet, osg::StateSet, NULL ); // _stateset
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST dynamic_cast
|
||||
|
||||
#include <osg/Node>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( NodeCallback,
|
||||
new osg::NodeCallback,
|
||||
osg::NodeCallback,
|
||||
"osg::Object osg::NodeCallback" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( NestedCallback, osg::NodeCallback, NULL ); // _nestedCallback
|
||||
}
|
||||
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST static_cast
|
||||
@@ -1,18 +0,0 @@
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST dynamic_cast
|
||||
|
||||
#include <osg/NodeTrackerCallback>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( NodeTrackerCallback,
|
||||
new osg::NodeTrackerCallback,
|
||||
osg::NodeTrackerCallback,
|
||||
"osg::Object osg::NodeCallback osg::NodeTrackerCallback" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( TrackNode, osg::Node, NULL ); // _trackNodePath
|
||||
}
|
||||
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST static_cast
|
||||
@@ -1,18 +0,0 @@
|
||||
#include <osg/Object>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Object,
|
||||
/*new osg::Object*/NULL,
|
||||
osg::Object,
|
||||
"osg::Object" )
|
||||
{
|
||||
ADD_STRING_SERIALIZER( Name, "" ); // _name
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( DataVariance, UNSPECIFIED );
|
||||
ADD_ENUM_VALUE( STATIC );
|
||||
ADD_ENUM_VALUE( DYNAMIC );
|
||||
ADD_ENUM_VALUE( UNSPECIFIED );
|
||||
END_ENUM_SERIALIZER(); // _dataVariance
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <osg/OccluderNode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( OccluderNode,
|
||||
new osg::OccluderNode,
|
||||
osg::OccluderNode,
|
||||
"osg::Object osg::Node osg::Group osg::OccluderNode" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( Occluder, osg::ConvexPlanarOccluder, NULL ); // _occluder
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/OcclusionQueryNode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( OcclusionQueryNode,
|
||||
new osg::OcclusionQueryNode,
|
||||
osg::OcclusionQueryNode,
|
||||
"osg::Object osg::Node osg::Group osg::OcclusionQueryNode" )
|
||||
{
|
||||
ADD_BOOL_SERIALIZER( QueriesEnabled, true ); // _enabled
|
||||
ADD_UINT_SERIALIZER( VisibilityThreshold, 0 ); // _visThreshold
|
||||
ADD_INT_SERIALIZER( QueryFrameCount, 0 ); // _queryFrameCount
|
||||
ADD_BOOL_SERIALIZER( DebugDisplay, false ); // _debugBB
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#include <osg/PagedLOD>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkRangeDataList( const osg::PagedLOD& node )
|
||||
{
|
||||
return node.getNumFileNames()>0;
|
||||
}
|
||||
|
||||
static bool readRangeDataList( osgDB::InputStream& is, osg::PagedLOD& node )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
std::string name; is.readWrappedString( name );
|
||||
float offset, scale;
|
||||
double timeStamp;
|
||||
int frameNumber;
|
||||
is >> offset >> scale >> timeStamp >> frameNumber;
|
||||
|
||||
node.setFileName( i, name );
|
||||
node.setPriorityOffset( i, offset );
|
||||
node.setPriorityScale( i, scale );
|
||||
node.setTimeStamp( i, timeStamp );
|
||||
node.setFrameNumber( i, frameNumber );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeRangeDataList( osgDB::OutputStream& os, const osg::PagedLOD& node )
|
||||
{
|
||||
unsigned int size = node.getNumFileNames();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
os.writeWrappedString( node.getFileName(i) );
|
||||
os << node.getPriorityOffset(i) << node.getPriorityScale(i)
|
||||
<< node.getTimeStamp(i) << node.getFrameNumber(i) << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( PagedLOD,
|
||||
new osg::PagedLOD,
|
||||
osg::PagedLOD,
|
||||
"osg::Object osg::Node osg::LOD osg::PagedLOD" )
|
||||
{
|
||||
// Note: osg::Group is not in the list to prevent recording dynamic loaded children
|
||||
|
||||
ADD_STRING_SERIALIZER( DatabasePath, "" ); // _databasePath
|
||||
ADD_INT_SERIALIZER( FrameNumberOfLastTraversal, 0 ); // _frameNumberOfLastTraversal
|
||||
ADD_UINT_SERIALIZER( NumChildrenThatCannotBeExpired, 0 ); // _numChildrenThatCannotBeExpired
|
||||
ADD_BOOL_SERIALIZER( DisableExternalChildrenPaging, false ); // _disableExternalChildrenPaging
|
||||
ADD_USER_SERIALIZER( RangeDataList ); // _perRangeDataList
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#include <osg/Point>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Point,
|
||||
new osg::Point,
|
||||
osg::Point,
|
||||
"osg::Object osg::StateAttribute osg::Point" )
|
||||
{
|
||||
ADD_FLOAT_SERIALIZER( Size, 0.0f ); // _size
|
||||
ADD_FLOAT_SERIALIZER( FadeThresholdSize, 0.0f ); // _fadeThresholdSize
|
||||
ADD_VEC3_SERIALIZER( DistanceAttenuation, osg::Vec3() ); // _distanceAttenuation
|
||||
ADD_FLOAT_SERIALIZER( MinSize, 0.0f ); // _minSize
|
||||
ADD_FLOAT_SERIALIZER( MaxSize, 0.0f ); // _maxSize
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/PointSprite>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( PointSprite,
|
||||
new osg::PointSprite,
|
||||
osg::PointSprite,
|
||||
"osg::Object osg::StateAttribute osg::PointSprite" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( CoordOriginMode, UPPER_LEFT );
|
||||
ADD_ENUM_VALUE( UPPER_LEFT );
|
||||
ADD_ENUM_VALUE( LOWER_LEFT );
|
||||
END_ENUM_SERIALIZER(); // _coordOriginMode
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#include <osg/PolygonMode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
BEGIN_USER_TABLE( Mode, osg::PolygonMode );
|
||||
ADD_USER_VALUE( POINT );
|
||||
ADD_USER_VALUE( LINE );
|
||||
ADD_USER_VALUE( FILL );
|
||||
END_USER_TABLE()
|
||||
|
||||
USER_READ_FUNC( Mode, readModeValue )
|
||||
USER_WRITE_FUNC( Mode, writeModeValue )
|
||||
|
||||
// _modeFront, _modeBack
|
||||
static bool checkMode( const osg::PolygonMode& attr )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool readMode( osgDB::InputStream& is, osg::PolygonMode& attr )
|
||||
{
|
||||
bool frontAndBack;
|
||||
is >> osgDB::PROPERTY("UseFrontAndBack") >> frontAndBack;
|
||||
is >> osgDB::PROPERTY("Front"); int value1 = readModeValue(is);
|
||||
is >> osgDB::PROPERTY("Back"); int value2 = readModeValue(is);
|
||||
|
||||
if ( frontAndBack )
|
||||
attr.setMode( osg::PolygonMode::FRONT_AND_BACK, (osg::PolygonMode::Mode)value1 );
|
||||
else
|
||||
{
|
||||
attr.setMode(osg::PolygonMode::FRONT, (osg::PolygonMode::Mode)value1);
|
||||
attr.setMode(osg::PolygonMode::BACK, (osg::PolygonMode::Mode)value2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeMode( osgDB::OutputStream& os, const osg::PolygonMode& attr )
|
||||
{
|
||||
os << osgDB::PROPERTY("UseFrontAndBack") << attr.getFrontAndBack() << std::endl;
|
||||
|
||||
os << osgDB::PROPERTY("Front");
|
||||
writeModeValue( os, (int)attr.getMode(osg::PolygonMode::FRONT) );
|
||||
os << std::endl;
|
||||
|
||||
os << osgDB::PROPERTY("Back");
|
||||
writeModeValue( os, (int)attr.getMode(osg::PolygonMode::BACK) );
|
||||
os << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( PolygonMode,
|
||||
new osg::PolygonMode,
|
||||
osg::PolygonMode,
|
||||
"osg::Object osg::StateAttribute osg::PolygonMode" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Mode ); // _modeFront, _modeBack
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/PolygonOffset>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( PolygonOffset,
|
||||
new osg::PolygonOffset,
|
||||
osg::PolygonOffset,
|
||||
"osg::Object osg::StateAttribute osg::PolygonOffset" )
|
||||
{
|
||||
ADD_FLOAT_SERIALIZER( Factor, 0.0f ); // _factor
|
||||
ADD_FLOAT_SERIALIZER( Units, 0.0f ); // _units
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#include <osg/PolygonStipple>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkMask( const osg::PolygonStipple& attr )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool readMask( osgDB::InputStream& is, osg::PolygonStipple& attr )
|
||||
{
|
||||
char mask[128] = {0};
|
||||
if ( is.isBinary() )
|
||||
{
|
||||
unsigned int size; is >> size;
|
||||
is.readCharArray( mask, size );
|
||||
}
|
||||
else
|
||||
{
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<128; ++i )
|
||||
{
|
||||
is >> std::hex >> mask[i] >> std::dec;
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
}
|
||||
attr.setMask( (GLubyte*)mask );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeMask( osgDB::OutputStream& os, const osg::PolygonStipple& attr )
|
||||
{
|
||||
if ( os.isBinary() )
|
||||
{
|
||||
os << (unsigned int)128;
|
||||
os.writeCharArray( (char*)attr.getMask(), 128 );
|
||||
}
|
||||
else
|
||||
{
|
||||
const GLubyte* mask = attr.getMask();
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<128; ++i )
|
||||
{
|
||||
os << std::hex << mask[i] << std::dec << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( PolygonStipple,
|
||||
new osg::PolygonStipple,
|
||||
osg::PolygonStipple,
|
||||
"osg::Object osg::StateAttribute osg::PolygonStipple" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Mask ); // _mask
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/PositionAttitudeTransform>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( PositionAttitudeTransform,
|
||||
new osg::PositionAttitudeTransform,
|
||||
osg::PositionAttitudeTransform,
|
||||
"osg::Object osg::Node osg::Group osg::Transform osg::PositionAttitudeTransform" )
|
||||
{
|
||||
ADD_VEC3D_SERIALIZER( Position, osg::Vec3d() ); // _position
|
||||
ADD_QUAT_SERIALIZER( Attitude, osg::Quat() ); // _attitude
|
||||
ADD_VEC3D_SERIALIZER( Scale, osg::Vec3d() ); // _scale
|
||||
ADD_VEC3D_SERIALIZER( PivotPoint, osg::Vec3d() ); // _pivotPoint
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
#include <osg/Program>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#define PROGRAM_LIST_FUNC( PROP, TYPE, DATA ) \
|
||||
static bool check##PROP(const osg::Program& attr) \
|
||||
{ return attr.get##TYPE().size()>0; } \
|
||||
static bool read##PROP(osgDB::InputStream& is, osg::Program& attr) { \
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET; \
|
||||
for ( unsigned int i=0; i<size; ++i ) { \
|
||||
std::string key; unsigned int value; \
|
||||
is >> key >> value; attr.add##DATA(key, value); \
|
||||
} \
|
||||
is >> osgDB::END_BRACKET; \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::Program& attr ) \
|
||||
{ \
|
||||
const osg::Program::TYPE& plist = attr.get##TYPE(); \
|
||||
os << plist.size() << osgDB::BEGIN_BRACKET << std::endl; \
|
||||
for ( osg::Program::TYPE::const_iterator itr=plist.begin(); \
|
||||
itr!=plist.end(); ++itr ) { \
|
||||
os << itr->first << itr->second << std::endl; \
|
||||
} \
|
||||
os << osgDB::END_BRACKET << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
PROGRAM_LIST_FUNC( AttribBinding, AttribBindingList, BindAttribLocation )
|
||||
PROGRAM_LIST_FUNC( FragDataBinding, FragDataBindingList, BindFragDataLocation )
|
||||
|
||||
#define PROGRAM_PARAMETER_FUNC( PROP, NAME ) \
|
||||
static bool check##PROP(const osg::Program& attr) \
|
||||
{ return attr.getParameter(NAME)!=GL_NONE; } \
|
||||
static bool read##PROP(osgDB::InputStream& is, osg::Program& attr) { \
|
||||
int value; is >> osgDB::PROPERTY(#NAME) >> value; \
|
||||
attr.setParameter(NAME, value); \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP(osgDB::OutputStream& os, const osg::Program& attr) { \
|
||||
os << osgDB::PROPERTY(#NAME) << (int)attr.getParameter(NAME) << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
PROGRAM_PARAMETER_FUNC( GeometryVerticesOut, GL_GEOMETRY_VERTICES_OUT_EXT )
|
||||
PROGRAM_PARAMETER_FUNC( GeometryInputType, GL_GEOMETRY_INPUT_TYPE_EXT )
|
||||
PROGRAM_PARAMETER_FUNC( GeometryOutputType, GL_GEOMETRY_OUTPUT_TYPE_EXT )
|
||||
|
||||
// _shaderList
|
||||
static bool checkShaders( const osg::Program& attr )
|
||||
{
|
||||
return attr.getNumShaders()>0;
|
||||
}
|
||||
|
||||
static bool readShaders( osgDB::InputStream& is, osg::Program& attr )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osg::Shader* shader = dynamic_cast<osg::Shader*>( is.readObject() );
|
||||
if ( shader ) attr.addShader( shader );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeShaders( osgDB::OutputStream& os, const osg::Program& attr )
|
||||
{
|
||||
unsigned int size = attr.getNumShaders();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
os << attr.getShader(i);
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Program,
|
||||
new osg::Program,
|
||||
osg::Program,
|
||||
"osg::Object osg::StateAttribute osg::Program" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( AttribBinding ); // _attribBindingList
|
||||
ADD_USER_SERIALIZER( FragDataBinding ); // _fragDataBindingList
|
||||
ADD_USER_SERIALIZER( Shaders ); // _shaderList
|
||||
ADD_USER_SERIALIZER( GeometryVerticesOut ); // _geometryVerticesOut
|
||||
ADD_USER_SERIALIZER( GeometryInputType ); // _geometryInputType
|
||||
ADD_USER_SERIALIZER( GeometryOutputType ); // _geometryOutputType
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <osg/Projection>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Projection,
|
||||
new osg::Projection,
|
||||
osg::Projection,
|
||||
"osg::Object osg::Node osg::Group osg::Projection" )
|
||||
{
|
||||
ADD_MATRIX_SERIALIZER( Matrix, osg::Matrix() ); // _matrix
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
#include <osg/ProxyNode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
// _filenameList
|
||||
static bool checkFileNames( const osg::ProxyNode& node )
|
||||
{
|
||||
return node.getNumFileNames()>0;
|
||||
}
|
||||
|
||||
static bool readFileNames( osgDB::InputStream& is, osg::ProxyNode& node )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
std::string value;
|
||||
is.readWrappedString( value );
|
||||
node.setFileName( i, value );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeFileNames( osgDB::OutputStream& os, const osg::ProxyNode& node )
|
||||
{
|
||||
os << node.getNumFileNames() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<node.getNumFileNames(); ++i )
|
||||
{
|
||||
os.writeWrappedString( node.getFileName(i) );
|
||||
os << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _userDefinedCenter, _radius
|
||||
static bool checkUserCenter( const osg::ProxyNode& node )
|
||||
{
|
||||
return node.getCenterMode()==osg::ProxyNode::USER_DEFINED_CENTER;
|
||||
}
|
||||
|
||||
static bool readUserCenter( osgDB::InputStream& is, osg::ProxyNode& node )
|
||||
{
|
||||
osg::Vec3d center; double radius;
|
||||
is >> center >> radius;
|
||||
node.setCenter( center ); node.setRadius( radius );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeUserCenter( osgDB::OutputStream& os, const osg::ProxyNode& node )
|
||||
{
|
||||
os << osg::Vec3d(node.getCenter()) << (double)node.getRadius() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ProxyNode,
|
||||
new osg::ProxyNode,
|
||||
osg::ProxyNode,
|
||||
"osg::Object osg::Node osg::ProxyNode" )
|
||||
{
|
||||
// Note: osg::Group is not in the list to prevent recording dynamic loaded children
|
||||
|
||||
ADD_USER_SERIALIZER( FileNames ); // _filenameList
|
||||
ADD_STRING_SERIALIZER( DatabasePath, "" ); // _databasePath
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( LoadingExternalReferenceMode, LOAD_IMMEDIATELY );
|
||||
ADD_ENUM_VALUE( LOAD_IMMEDIATELY );
|
||||
ADD_ENUM_VALUE( DEFER_LOADING_TO_DATABASE_PAGER );
|
||||
ADD_ENUM_VALUE( NO_AUTOMATIC_LOADING );
|
||||
END_ENUM_SERIALIZER(); // _loadingExtReference
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( CenterMode, USE_BOUNDING_SPHERE_CENTER );
|
||||
ADD_ENUM_VALUE( USE_BOUNDING_SPHERE_CENTER );
|
||||
ADD_ENUM_VALUE( USER_DEFINED_CENTER );
|
||||
END_ENUM_SERIALIZER(); // _centerMode
|
||||
|
||||
ADD_USER_SERIALIZER( UserCenter ); // _userDefinedCenter, _radius
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#include <osg/Scissor>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkArea( const osg::Scissor& attr )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool readArea( osgDB::InputStream& is, osg::Scissor& attr )
|
||||
{
|
||||
int x, y, w, h;
|
||||
is >> x >> y >> w >> h;
|
||||
attr.setScissor( x, y, w, h );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeArea( osgDB::OutputStream& os, const osg::Scissor& attr )
|
||||
{
|
||||
os << attr.x() << attr.y() << attr.width() << attr.height() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Scissor,
|
||||
new osg::Scissor,
|
||||
osg::Scissor,
|
||||
"osg::Object osg::StateAttribute osg::Scissor" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Area ); // _x, _y, _width, _height
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#include <osg/Sequence>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Sequence,
|
||||
new osg::Sequence,
|
||||
osg::Sequence,
|
||||
"osg::Object osg::Node osg::Group osg::Sequence" )
|
||||
{
|
||||
ADD_LIST_SERIALIZER( TimeList, std::vector<double> ); // _frameTime
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( LoopMode, LOOP );
|
||||
ADD_ENUM_VALUE( LOOP );
|
||||
ADD_ENUM_VALUE( SWING );
|
||||
END_ENUM_SERIALIZER(); // _loopMode
|
||||
|
||||
ADD_INT_SERIALIZER( Begin, 0 ); // _begin
|
||||
ADD_INT_SERIALIZER( End, -1 ); // _end
|
||||
ADD_FLOAT_SERIALIZER( Speed, 0.0f ); // _speed
|
||||
ADD_INT_SERIALIZER( NumRepeats, -1 ); // _nreps
|
||||
ADD_DOUBLE_SERIALIZER( DefaultTime, 1.0 ); // _defaultTime
|
||||
ADD_DOUBLE_SERIALIZER( LastFrameTime, 0.0 ); // _lastFrameTime
|
||||
|
||||
BEGIN_ENUM_SERIALIZER2( Mode, osg::Sequence::SequenceMode, STOP );
|
||||
ADD_ENUM_VALUE( START );
|
||||
ADD_ENUM_VALUE( STOP );
|
||||
ADD_ENUM_VALUE( PAUSE );
|
||||
ADD_ENUM_VALUE( RESUME );
|
||||
END_ENUM_SERIALIZER(); // _mode
|
||||
|
||||
ADD_BOOL_SERIALIZER( Sync, false ); // _sync
|
||||
ADD_BOOL_SERIALIZER( ClearOnStop, false ); // _clearOnStop
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/ShadeModel>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ShadeModel,
|
||||
new osg::ShadeModel,
|
||||
osg::ShadeModel,
|
||||
"osg::Object osg::StateAttribute osg::ShadeModel" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( Mode, SMOOTH );
|
||||
ADD_ENUM_VALUE( FLAT );
|
||||
ADD_ENUM_VALUE( SMOOTH );
|
||||
END_ENUM_SERIALIZER(); // _mode
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
#include <osg/Shader>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkShaderSource( const osg::Shader& shader )
|
||||
{
|
||||
return !shader.getShaderSource().empty();
|
||||
}
|
||||
|
||||
static bool readShaderSource( osgDB::InputStream& is, osg::Shader& shader )
|
||||
{
|
||||
std::string code;
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
std::string line;
|
||||
is.readWrappedString( line );
|
||||
code.append( line ); code.append( 1, '\n' );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
shader.setShaderSource( code );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeShaderSource( osgDB::OutputStream& os, const osg::Shader& shader )
|
||||
{
|
||||
std::vector<std::string> lines;
|
||||
std::istringstream iss( shader.getShaderSource() );
|
||||
std::string line;
|
||||
while ( std::getline(iss, line) )
|
||||
{
|
||||
lines.push_back( line );
|
||||
}
|
||||
|
||||
os << lines.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( std::vector<std::string>::const_iterator itr=lines.begin();
|
||||
itr!=lines.end(); ++itr )
|
||||
{
|
||||
os.writeWrappedString( *itr );
|
||||
os << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Shader,
|
||||
new osg::Shader,
|
||||
osg::Shader,
|
||||
"osg::Object osg::Shader" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER3( Type, UNDEFINED );
|
||||
ADD_ENUM_VALUE( VERTEX );
|
||||
ADD_ENUM_VALUE( FRAGMENT );
|
||||
ADD_ENUM_VALUE( GEOMETRY );
|
||||
ADD_ENUM_VALUE( UNDEFINED );
|
||||
END_ENUM_SERIALIZER(); // _type
|
||||
|
||||
ADD_USER_SERIALIZER( ShaderSource ); // _shaderSource
|
||||
ADD_OBJECT_SERIALIZER( ShaderBinary, osg::ShaderBinary, NULL ); // _shaderBinary
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
#include <osg/Shader>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/Serializer>
|
||||
|
||||
static bool checkData( const osg::ShaderBinary& sb )
|
||||
{
|
||||
return sb.getSize()>0;
|
||||
}
|
||||
|
||||
static bool readData( osgDB::InputStream& is, osg::ShaderBinary& sb )
|
||||
{
|
||||
unsigned int size; is >> size;
|
||||
char* data = new char[size];
|
||||
if ( is.isBinary() )
|
||||
{
|
||||
is.readCharArray( data, size );
|
||||
}
|
||||
else
|
||||
{
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
is >> std::hex >> data[i] >> std::dec;
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
}
|
||||
sb.assign( size, (unsigned char*)data );
|
||||
delete data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeData( osgDB::OutputStream& os, const osg::ShaderBinary& sb )
|
||||
{
|
||||
if ( os.isBinary() )
|
||||
{
|
||||
os << (unsigned int)sb.getSize();
|
||||
os.writeCharArray( (char*)sb.getData(), sb.getSize() );
|
||||
}
|
||||
else
|
||||
{
|
||||
const unsigned char* data = sb.getData();
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<sb.getSize(); ++i )
|
||||
{
|
||||
os << std::hex << data[i] << std::dec << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ShaderBinary,
|
||||
new osg::ShaderBinary,
|
||||
osg::ShaderBinary,
|
||||
"osg::Object osg::ShaderBinary" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Data ); // _data
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Shape,
|
||||
/*new osg::Shape*/NULL,
|
||||
osg::Shape,
|
||||
"osg::Object osg::Shape" )
|
||||
{
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/ShapeDrawable>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( ShapeDrawable,
|
||||
new osg::ShapeDrawable,
|
||||
osg::ShapeDrawable,
|
||||
"osg::Object osg::Drawable osg::ShapeDrawable" )
|
||||
{
|
||||
ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color
|
||||
ADD_OBJECT_SERIALIZER( TessellationHints, osg::TessellationHints, NULL ); // _tessellationHints
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Sphere,
|
||||
new osg::Sphere,
|
||||
osg::Sphere,
|
||||
"osg::Object osg::Shape osg::Sphere" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( Center, osg::Vec3() ); // _center
|
||||
ADD_FLOAT_SERIALIZER( Radius, 0.0f ); // _radius
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/StateAttribute>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( StateAttribute,
|
||||
/*new osg::StateAttribute*/NULL,
|
||||
osg::StateAttribute,
|
||||
"osg::Object osg::StateAttribute" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( UpdateCallback, osg::StateAttributeCallback, NULL ); // _updateCallback
|
||||
ADD_OBJECT_SERIALIZER( EventCallback, osg::StateAttributeCallback, NULL ); // _eventCallback
|
||||
}
|
||||
@@ -1,306 +0,0 @@
|
||||
#include <osg/StateSet>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static int readValue( osgDB::InputStream& is )
|
||||
{
|
||||
int value = osg::StateAttribute::INHERIT;
|
||||
if ( is.isBinary() )
|
||||
is >> value;
|
||||
else
|
||||
{
|
||||
std::string enumValue;
|
||||
is >> enumValue;
|
||||
if ( enumValue=="OFF" ) value = osg::StateAttribute::OFF;
|
||||
else if ( enumValue=="ON" ) value = osg::StateAttribute::ON;
|
||||
else if ( enumValue=="INHERIT" ) value = osg::StateAttribute::INHERIT;
|
||||
else if ( enumValue=="OFF|OVERRIDE" )
|
||||
value = osg::StateAttribute::OFF|osg::StateAttribute::OVERRIDE;
|
||||
else if ( enumValue=="OFF|PROTECTED" )
|
||||
value = osg::StateAttribute::OFF|osg::StateAttribute::PROTECTED;
|
||||
else if ( enumValue=="ON|OVERRIDE" )
|
||||
value = osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE;
|
||||
else if ( enumValue=="ON|PROTECTED" )
|
||||
value = osg::StateAttribute::ON|osg::StateAttribute::PROTECTED;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
static void readModes( osgDB::InputStream& is, osg::StateSet::ModeList& modes )
|
||||
{
|
||||
unsigned int size = 0; is >> size;
|
||||
if ( size>0 )
|
||||
{
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
DEF_GLENUM(mode); is >> mode;
|
||||
int value = readValue( is );
|
||||
modes[mode.get()] = (osg::StateAttribute::Values)value;
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
}
|
||||
}
|
||||
|
||||
static void readAttributes( osgDB::InputStream& is, osg::StateSet::AttributeList& attrs )
|
||||
{
|
||||
unsigned int size = 0; is >> size;
|
||||
if ( size>0 )
|
||||
{
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osg::StateAttribute* sa = dynamic_cast<osg::StateAttribute*>( is.readObject() );
|
||||
is >> osgDB::PROPERTY("Value");
|
||||
int value = readValue( is );
|
||||
if ( sa )
|
||||
attrs[sa->getTypeMemberPair()] = osg::StateSet::RefAttributePair(sa,value);
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
}
|
||||
}
|
||||
|
||||
static void writeValue( osgDB::OutputStream& os, int value )
|
||||
{
|
||||
if ( os.isBinary() )
|
||||
os << value;
|
||||
else
|
||||
{
|
||||
if ( value==osg::StateAttribute::OFF ) os << std::string("OFF");
|
||||
else if ( value==osg::StateAttribute::ON ) os << std::string("ON");
|
||||
else if ( value==osg::StateAttribute::INHERIT ) os << std::string("INHERIT");
|
||||
else if ( value==osg::StateAttribute::OFF+osg::StateAttribute::OVERRIDE )
|
||||
os << std::string("OFF|OVERRIDE");
|
||||
else if ( value==osg::StateAttribute::OFF+osg::StateAttribute::PROTECTED )
|
||||
os << std::string("OFF|PROTECTED");
|
||||
else if ( value==osg::StateAttribute::ON+osg::StateAttribute::OVERRIDE )
|
||||
os << std::string("ON|OVERRIDE");
|
||||
else if ( value==osg::StateAttribute::ON+osg::StateAttribute::PROTECTED )
|
||||
os << std::string("ON|PROTECTED");
|
||||
else os << std::string("INHERIT");
|
||||
}
|
||||
}
|
||||
|
||||
static void writeModes( osgDB::OutputStream& os, const osg::StateSet::ModeList& modes )
|
||||
{
|
||||
os << modes.size();
|
||||
if ( modes.size()>0 )
|
||||
{
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::StateSet::ModeList::const_iterator itr=modes.begin();
|
||||
itr!=modes.end(); ++itr )
|
||||
{
|
||||
os << GLENUM(itr->first);
|
||||
writeValue(os, itr->second);
|
||||
os << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET;
|
||||
}
|
||||
os << std::endl;
|
||||
}
|
||||
|
||||
static void writeAttributes( osgDB::OutputStream& os, const osg::StateSet::AttributeList& attrs )
|
||||
{
|
||||
os << attrs.size();
|
||||
if ( attrs.size()>0 )
|
||||
{
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::StateSet::AttributeList::const_iterator itr=attrs.begin();
|
||||
itr!=attrs.end(); ++itr )
|
||||
{
|
||||
os << itr->second.first.get();
|
||||
os << osgDB::PROPERTY("Value");
|
||||
writeValue(os, itr->second.second);
|
||||
os << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET;
|
||||
}
|
||||
os << std::endl;
|
||||
}
|
||||
|
||||
// _modeList
|
||||
static bool checkModeList( const osg::StateSet& ss )
|
||||
{
|
||||
return ss.getModeList().size()>0;
|
||||
}
|
||||
|
||||
static bool readModeList( osgDB::InputStream& is, osg::StateSet& ss )
|
||||
{
|
||||
osg::StateSet::ModeList modes; readModes( is, modes );
|
||||
for ( osg::StateSet::ModeList::iterator itr=modes.begin();
|
||||
itr!=modes.end(); ++itr )
|
||||
{
|
||||
ss.setMode( itr->first, itr->second );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeModeList( osgDB::OutputStream& os, const osg::StateSet& ss )
|
||||
{
|
||||
writeModes( os, ss.getModeList() );
|
||||
return true;
|
||||
}
|
||||
|
||||
// _attributeList
|
||||
static bool checkAttributeList( const osg::StateSet& ss )
|
||||
{
|
||||
return ss.getAttributeList().size()>0;
|
||||
}
|
||||
|
||||
static bool readAttributeList( osgDB::InputStream& is, osg::StateSet& ss )
|
||||
{
|
||||
osg::StateSet::AttributeList attrs; readAttributes( is, attrs );
|
||||
for ( osg::StateSet::AttributeList::iterator itr=attrs.begin();
|
||||
itr!=attrs.end(); ++itr )
|
||||
{
|
||||
ss.setAttribute( itr->second.first.get(), itr->second.second );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeAttributeList( osgDB::OutputStream& os, const osg::StateSet& ss )
|
||||
{
|
||||
writeAttributes( os, ss.getAttributeList() );
|
||||
return true;
|
||||
}
|
||||
|
||||
// _textureModeList
|
||||
static bool checkTextureModeList( const osg::StateSet& ss )
|
||||
{
|
||||
return ss.getTextureModeList().size()>0;
|
||||
}
|
||||
|
||||
static bool readTextureModeList( osgDB::InputStream& is, osg::StateSet& ss )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
osg::StateSet::ModeList modes;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
is >> osgDB::PROPERTY("Data");
|
||||
readModes( is, modes );
|
||||
for ( osg::StateSet::ModeList::iterator itr=modes.begin();
|
||||
itr!=modes.end(); ++itr )
|
||||
{
|
||||
ss.setTextureMode( i, itr->first, itr->second );
|
||||
}
|
||||
modes.clear();
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeTextureModeList( osgDB::OutputStream& os, const osg::StateSet& ss )
|
||||
{
|
||||
const osg::StateSet::TextureModeList& tml = ss.getTextureModeList();
|
||||
os << tml.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::StateSet::TextureModeList::const_iterator itr=tml.begin();
|
||||
itr!=tml.end(); ++itr )
|
||||
{
|
||||
os << osgDB::PROPERTY("Data");
|
||||
writeModes( os, *itr );
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _textureAttributeList
|
||||
static bool checkTextureAttributeList( const osg::StateSet& ss )
|
||||
{
|
||||
return ss.getTextureAttributeList().size()>0;
|
||||
}
|
||||
|
||||
static bool readTextureAttributeList( osgDB::InputStream& is, osg::StateSet& ss )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
osg::StateSet::AttributeList attrs;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
is >> osgDB::PROPERTY("Data");
|
||||
readAttributes( is, attrs );
|
||||
for ( osg::StateSet::AttributeList::iterator itr=attrs.begin();
|
||||
itr!=attrs.end(); ++itr )
|
||||
{
|
||||
ss.setTextureAttribute( i, itr->second.first.get(), itr->second.second );
|
||||
}
|
||||
attrs.clear();
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeTextureAttributeList( osgDB::OutputStream& os, const osg::StateSet& ss )
|
||||
{
|
||||
const osg::StateSet::TextureAttributeList& tal = ss.getTextureAttributeList();
|
||||
os << tal.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::StateSet::TextureAttributeList::const_iterator itr=tal.begin();
|
||||
itr!=tal.end(); ++itr )
|
||||
{
|
||||
os << osgDB::PROPERTY("Data");
|
||||
writeAttributes( os, *itr );
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _uniformList
|
||||
static bool checkUniformList( const osg::StateSet& ss )
|
||||
{
|
||||
return ss.getUniformList().size()>0;
|
||||
}
|
||||
|
||||
static bool readUniformList( osgDB::InputStream& is, osg::StateSet& ss )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osg::Uniform* uniform = dynamic_cast<osg::Uniform*>( is.readObject() );
|
||||
is >> osgDB::PROPERTY("Value");
|
||||
int value = readValue( is );
|
||||
if ( uniform )
|
||||
ss.addUniform( uniform, (osg::StateAttribute::Values)value );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeUniformList( osgDB::OutputStream& os, const osg::StateSet& ss )
|
||||
{
|
||||
const osg::StateSet::UniformList& ul = ss.getUniformList();
|
||||
os << ul.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::StateSet::UniformList::const_iterator itr=ul.begin();
|
||||
itr!=ul.end(); ++itr )
|
||||
{
|
||||
os << itr->second.first.get();
|
||||
os << osgDB::PROPERTY("Value");
|
||||
writeValue(os, itr->second.second);
|
||||
os << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( StateSet,
|
||||
new osg::StateSet,
|
||||
osg::StateSet,
|
||||
"osg::Object osg::StateSet" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( ModeList ); // _modeList
|
||||
ADD_USER_SERIALIZER( AttributeList ); // _attributeList
|
||||
ADD_USER_SERIALIZER( TextureModeList ); // _textureModeList
|
||||
ADD_USER_SERIALIZER( TextureAttributeList ); // _textureAttributeList
|
||||
ADD_USER_SERIALIZER( UniformList ); // _uniformList
|
||||
ADD_INT_SERIALIZER( RenderingHint, osg::StateSet::DEFAULT_BIN ); // _renderingHint
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( RenderBinMode, INHERIT_RENDERBIN_DETAILS );
|
||||
ADD_ENUM_VALUE( INHERIT_RENDERBIN_DETAILS );
|
||||
ADD_ENUM_VALUE( USE_RENDERBIN_DETAILS );
|
||||
ADD_ENUM_VALUE( OVERRIDE_RENDERBIN_DETAILS );
|
||||
END_ENUM_SERIALIZER(); // _binMode
|
||||
|
||||
ADD_INT_SERIALIZER( BinNumber, 0 ); // _binNum
|
||||
ADD_STRING_SERIALIZER( BinName, "" ); // _binName
|
||||
ADD_BOOL_SERIALIZER( NestRenderBins, true ); // _nestRenderBins
|
||||
ADD_OBJECT_SERIALIZER( UpdateCallback, osg::StateSet::Callback, NULL ); // _updateCallback
|
||||
ADD_OBJECT_SERIALIZER( EventCallback, osg::StateSet::Callback, NULL ); // _eventCallback
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
#include <osg/Stencil>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Stencil,
|
||||
new osg::Stencil,
|
||||
osg::Stencil,
|
||||
"osg::Object osg::StateAttribute osg::Stencil" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( Function, ALWAYS );
|
||||
ADD_ENUM_VALUE( NEVER );
|
||||
ADD_ENUM_VALUE( LESS );
|
||||
ADD_ENUM_VALUE( EQUAL );
|
||||
ADD_ENUM_VALUE( LEQUAL );
|
||||
ADD_ENUM_VALUE( GREATER );
|
||||
ADD_ENUM_VALUE( NOTEQUAL );
|
||||
ADD_ENUM_VALUE( GEQUAL );
|
||||
ADD_ENUM_VALUE( ALWAYS );
|
||||
END_ENUM_SERIALIZER(); // _func
|
||||
|
||||
ADD_INT_SERIALIZER( FunctionRef, 0 ); // _funcRef
|
||||
ADD_HEXINT_SERIALIZER( FunctionMask, ~0u ); // _funcMask
|
||||
|
||||
BEGIN_ENUM_SERIALIZER2( StencilFailOperation, osg::Stencil::Operation, KEEP );
|
||||
ADD_ENUM_VALUE( KEEP );
|
||||
ADD_ENUM_VALUE( ZERO );
|
||||
ADD_ENUM_VALUE( REPLACE );
|
||||
ADD_ENUM_VALUE( INCR );
|
||||
ADD_ENUM_VALUE( DECR );
|
||||
ADD_ENUM_VALUE( INVERT );
|
||||
ADD_ENUM_VALUE( INCR_WRAP );
|
||||
ADD_ENUM_VALUE( DECR_WRAP );
|
||||
END_ENUM_SERIALIZER(); // _sfail
|
||||
|
||||
BEGIN_ENUM_SERIALIZER2( StencilPassAndDepthFailOperation, osg::Stencil::Operation, KEEP );
|
||||
ADD_ENUM_VALUE( KEEP );
|
||||
ADD_ENUM_VALUE( ZERO );
|
||||
ADD_ENUM_VALUE( REPLACE );
|
||||
ADD_ENUM_VALUE( INCR );
|
||||
ADD_ENUM_VALUE( DECR );
|
||||
ADD_ENUM_VALUE( INVERT );
|
||||
ADD_ENUM_VALUE( INCR_WRAP );
|
||||
ADD_ENUM_VALUE( DECR_WRAP );
|
||||
END_ENUM_SERIALIZER(); // _zfail
|
||||
|
||||
BEGIN_ENUM_SERIALIZER2( StencilPassAndDepthPassOperation, osg::Stencil::Operation, KEEP );
|
||||
ADD_ENUM_VALUE( KEEP );
|
||||
ADD_ENUM_VALUE( ZERO );
|
||||
ADD_ENUM_VALUE( REPLACE );
|
||||
ADD_ENUM_VALUE( INCR );
|
||||
ADD_ENUM_VALUE( DECR );
|
||||
ADD_ENUM_VALUE( INVERT );
|
||||
ADD_ENUM_VALUE( INCR_WRAP );
|
||||
ADD_ENUM_VALUE( DECR_WRAP );
|
||||
END_ENUM_SERIALIZER(); // _zpass
|
||||
|
||||
ADD_HEXINT_SERIALIZER( WriteMask, ~0u ); // _writeMask
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
#include <osg/StencilTwoSided>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
BEGIN_USER_TABLE( Function, osg::StencilTwoSided );
|
||||
ADD_USER_VALUE( NEVER );
|
||||
ADD_USER_VALUE( LESS );
|
||||
ADD_USER_VALUE( EQUAL );
|
||||
ADD_USER_VALUE( LEQUAL );
|
||||
ADD_USER_VALUE( GREATER );
|
||||
ADD_USER_VALUE( NOTEQUAL );
|
||||
ADD_USER_VALUE( GEQUAL );
|
||||
ADD_USER_VALUE( ALWAYS );
|
||||
END_USER_TABLE()
|
||||
|
||||
USER_READ_FUNC( Function, readFunction )
|
||||
USER_WRITE_FUNC( Function, writeFunction )
|
||||
|
||||
BEGIN_USER_TABLE( Operation, osg::StencilTwoSided );
|
||||
ADD_USER_VALUE( KEEP );
|
||||
ADD_USER_VALUE( ZERO );
|
||||
ADD_USER_VALUE( REPLACE );
|
||||
ADD_USER_VALUE( INCR );
|
||||
ADD_USER_VALUE( DECR );
|
||||
ADD_USER_VALUE( INVERT );
|
||||
ADD_USER_VALUE( INCR_WRAP );
|
||||
ADD_USER_VALUE( DECR_WRAP );
|
||||
END_USER_TABLE()
|
||||
|
||||
USER_READ_FUNC( Operation, readOperation )
|
||||
USER_WRITE_FUNC( Operation, writeOperation )
|
||||
|
||||
#define STENCIL_INT_VALUE_FUNC( PROP, TYPE ) \
|
||||
static bool check##PROP( const osg::StencilTwoSided& attr ) { return true; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osg::StencilTwoSided& attr ) { \
|
||||
TYPE value1; is >> osgDB::PROPERTY("Front") >> value1; \
|
||||
TYPE value2; is >> osgDB::PROPERTY("Back") >> value2; \
|
||||
attr.set##PROP(osg::StencilTwoSided::FRONT, value1); \
|
||||
attr.set##PROP(osg::StencilTwoSided::BACK, value2); return true; } \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::StencilTwoSided& attr ) { \
|
||||
os << osgDB::PROPERTY("Front") << attr.get##PROP(osg::StencilTwoSided::FRONT); \
|
||||
os << osgDB::PROPERTY("Back") << attr.get##PROP(osg::StencilTwoSided::BACK); \
|
||||
os << std::endl; return true; }
|
||||
|
||||
#define STENCIL_USER_VALUE_FUNC( PROP, TYPE ) \
|
||||
static bool check##PROP( const osg::StencilTwoSided& attr ) { return true; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osg::StencilTwoSided& attr ) { \
|
||||
is >> osgDB::PROPERTY("Front"); int value1 = read##TYPE(is); \
|
||||
is >> osgDB::PROPERTY("Back"); int value2 = read##TYPE(is); \
|
||||
attr.set##PROP(osg::StencilTwoSided::FRONT, (osg::StencilTwoSided::TYPE)value1); \
|
||||
attr.set##PROP(osg::StencilTwoSided::BACK, (osg::StencilTwoSided::TYPE)value2); \
|
||||
return true; } \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::StencilTwoSided& attr ) { \
|
||||
os << osgDB::PROPERTY("Front"); write##TYPE(os, (int)attr.get##PROP(osg::StencilTwoSided::FRONT)); \
|
||||
os << osgDB::PROPERTY("Back"); write##TYPE(os, (int)attr.get##PROP(osg::StencilTwoSided::BACK)); \
|
||||
os << std::endl; return true; }
|
||||
|
||||
STENCIL_USER_VALUE_FUNC( Function, Function )
|
||||
STENCIL_INT_VALUE_FUNC( FunctionRef, int )
|
||||
STENCIL_INT_VALUE_FUNC( FunctionMask, unsigned int )
|
||||
STENCIL_USER_VALUE_FUNC( StencilFailOperation, Operation )
|
||||
STENCIL_USER_VALUE_FUNC( StencilPassAndDepthFailOperation, Operation )
|
||||
STENCIL_USER_VALUE_FUNC( StencilPassAndDepthPassOperation, Operation )
|
||||
STENCIL_INT_VALUE_FUNC( WriteMask, unsigned int )
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( StencilTwoSided,
|
||||
new osg::StencilTwoSided,
|
||||
osg::StencilTwoSided,
|
||||
"osg::Object osg::StateAttribute osg::StencilTwoSided" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Function ); // _func
|
||||
ADD_USER_SERIALIZER( FunctionRef ); // _funcRef
|
||||
ADD_USER_SERIALIZER( FunctionMask ); // _funcMask
|
||||
ADD_USER_SERIALIZER( StencilFailOperation ); // _sfail
|
||||
ADD_USER_SERIALIZER( StencilPassAndDepthFailOperation ); // _zfail
|
||||
ADD_USER_SERIALIZER( StencilPassAndDepthPassOperation ); // _zpass
|
||||
ADD_USER_SERIALIZER( WriteMask ); // _writeMask
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/Switch>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Switch,
|
||||
new osg::Switch,
|
||||
osg::Switch,
|
||||
"osg::Object osg::Node osg::Group osg::Switch" )
|
||||
{
|
||||
ADD_BOOL_SERIALIZER( NewChildDefaultValue, true ); // _newChildDefaultValue
|
||||
ADD_LIST_SERIALIZER( ValueList, osg::Switch::ValueList ); // _values
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#include <osg/ShapeDrawable>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TessellationHints,
|
||||
new osg::TessellationHints,
|
||||
osg::TessellationHints,
|
||||
"osg::Object osg::TessellationHints" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( TessellationMode, USE_SHAPE_DEFAULTS );
|
||||
ADD_ENUM_VALUE( USE_SHAPE_DEFAULTS );
|
||||
ADD_ENUM_VALUE( USE_TARGET_NUM_FACES );
|
||||
END_ENUM_SERIALIZER(); // _TessellationMode
|
||||
|
||||
ADD_FLOAT_SERIALIZER( DetailRatio, 1.0f ); // _detailRatio
|
||||
ADD_UINT_SERIALIZER( TargetNumFaces, 100 ); // _targetNumFaces
|
||||
ADD_BOOL_SERIALIZER( CreateFrontFace, true ); // _createFrontFace
|
||||
ADD_BOOL_SERIALIZER( CreateBackFace, false ); // _createBackFace
|
||||
ADD_BOOL_SERIALIZER( CreateNormals, true ); // _createNormals
|
||||
ADD_BOOL_SERIALIZER( CreateTextureCoords, false ); // _createTextureCoords
|
||||
ADD_BOOL_SERIALIZER( CreateTop, true ); // _createTop
|
||||
ADD_BOOL_SERIALIZER( CreateBody, true ); // _createBody
|
||||
ADD_BOOL_SERIALIZER( CreateBottom, true ); // _createBottom
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#include <osg/TexEnv>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TexEnv,
|
||||
new osg::TexEnv,
|
||||
osg::TexEnv,
|
||||
"osg::Object osg::StateAttribute osg::TexEnv" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( Mode, MODULATE );
|
||||
ADD_ENUM_VALUE( DECAL );
|
||||
ADD_ENUM_VALUE( MODULATE );
|
||||
ADD_ENUM_VALUE( BLEND );
|
||||
ADD_ENUM_VALUE( REPLACE );
|
||||
ADD_ENUM_VALUE( ADD );
|
||||
END_ENUM_SERIALIZER(); // _mode
|
||||
|
||||
ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#include <osg/TexEnvCombine>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TexEnvCombine,
|
||||
new osg::TexEnvCombine,
|
||||
osg::TexEnvCombine,
|
||||
"osg::Object osg::StateAttribute osg::TexEnvCombine" )
|
||||
{
|
||||
ADD_GLENUM_SERIALIZER( Combine_RGB, GLint, GL_NONE ); // _combine_RGB
|
||||
ADD_GLENUM_SERIALIZER( Combine_Alpha, GLint, GL_NONE ); // _combine_Alpha
|
||||
ADD_GLENUM_SERIALIZER( Source0_RGB, GLint, GL_NONE ); // _source0_RGB
|
||||
ADD_GLENUM_SERIALIZER( Source1_RGB, GLint, GL_NONE ); // _source1_RGB
|
||||
ADD_GLENUM_SERIALIZER( Source2_RGB, GLint, GL_NONE ); // _source2_RGB
|
||||
ADD_GLENUM_SERIALIZER( Source0_Alpha, GLint, GL_NONE ); // _source0_Alpha
|
||||
ADD_GLENUM_SERIALIZER( Source1_Alpha, GLint, GL_NONE ); // _source1_Alpha
|
||||
ADD_GLENUM_SERIALIZER( Source2_Alpha, GLint, GL_NONE ); // _source2_Alpha
|
||||
ADD_GLENUM_SERIALIZER( Operand0_RGB, GLint, GL_NONE ); // _operand0_RGB
|
||||
ADD_GLENUM_SERIALIZER( Operand1_RGB, GLint, GL_NONE ); // _operand1_RGB
|
||||
ADD_GLENUM_SERIALIZER( Operand2_RGB, GLint, GL_NONE ); // _operand2_RGB
|
||||
ADD_GLENUM_SERIALIZER( Operand0_Alpha, GLint, GL_NONE ); // _operand0_Alpha
|
||||
ADD_GLENUM_SERIALIZER( Operand1_Alpha, GLint, GL_NONE ); // _operand1_Alpha
|
||||
ADD_GLENUM_SERIALIZER( Operand2_Alpha, GLint, GL_NONE ); // _operand2_Alpha
|
||||
ADD_FLOAT_SERIALIZER( Scale_RGB, 1.0f ); // _scale_RGB
|
||||
ADD_FLOAT_SERIALIZER( Scale_Alpha, 1.0f ); // _scale_Alpha
|
||||
ADD_VEC4_SERIALIZER( ConstantColor, osg::Vec4() ); // _constantColor
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <osg/TexEnvFilter>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TexEnvFilter,
|
||||
new osg::TexEnvFilter,
|
||||
osg::TexEnvFilter,
|
||||
"osg::Object osg::StateAttribute osg::TexEnvFilter" )
|
||||
{
|
||||
ADD_FLOAT_SERIALIZER( LodBias, 0.0f ); // _lodBias
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
#include <osg/TexGen>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#define PLANE_FUNCTION( PROP, COORD ) \
|
||||
static bool check##PROP( const osg::TexGen& tex ) { return true; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osg::TexGen& tex ) { \
|
||||
osg::Plane plane; is >> plane; \
|
||||
tex.setPlane(COORD, plane); \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::TexGen& tex ) { \
|
||||
os << tex.getPlane(COORD) << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
PLANE_FUNCTION( PlaneS, osg::TexGen::S )
|
||||
PLANE_FUNCTION( PlaneT, osg::TexGen::T )
|
||||
PLANE_FUNCTION( PlaneR, osg::TexGen::R )
|
||||
PLANE_FUNCTION( PlaneQ, osg::TexGen::Q )
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TexGen,
|
||||
new osg::TexGen,
|
||||
osg::TexGen,
|
||||
"osg::Object osg::StateAttribute osg::TexGen" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( Mode, OBJECT_LINEAR );
|
||||
ADD_ENUM_VALUE( OBJECT_LINEAR );
|
||||
ADD_ENUM_VALUE( EYE_LINEAR );
|
||||
ADD_ENUM_VALUE( SPHERE_MAP );
|
||||
ADD_ENUM_VALUE( NORMAL_MAP );
|
||||
ADD_ENUM_VALUE( REFLECTION_MAP );
|
||||
END_ENUM_SERIALIZER(); // _mode
|
||||
|
||||
ADD_USER_SERIALIZER( PlaneS );
|
||||
ADD_USER_SERIALIZER( PlaneT );
|
||||
ADD_USER_SERIALIZER( PlaneR );
|
||||
ADD_USER_SERIALIZER( PlaneQ ); //_plane_s, _plane_t, _plane_r, _plane_q
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#include <osg/TexGenNode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TexGenNode,
|
||||
new osg::TexGenNode,
|
||||
osg::TexGenNode,
|
||||
"osg::Object osg::Node osg::Group osg::TexGenNode" )
|
||||
{
|
||||
ADD_UINT_SERIALIZER( TextureUnit, 0 ); // _textureUnit
|
||||
ADD_OBJECT_SERIALIZER( TexGen, osg::TexGen, NULL ); // _texgen
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( ReferenceFrame, RELATIVE_RF );
|
||||
ADD_ENUM_VALUE( RELATIVE_RF );
|
||||
ADD_ENUM_VALUE( ABSOLUTE_RF );
|
||||
END_ENUM_SERIALIZER(); // _referenceFrame
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/TexMat>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TexMat,
|
||||
new osg::TexMat,
|
||||
osg::TexMat,
|
||||
"osg::Object osg::StateAttribute osg::TexMat" )
|
||||
{
|
||||
ADD_MATRIX_SERIALIZER( Matrix, osg::Matrix() ); // _matrix
|
||||
ADD_BOOL_SERIALIZER( ScaleByTextureRectangleSize, false ); // _scaleByTextureRectangleSize
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
#include <osg/Texture>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#define WRAP_FUNCTIONS( PROP, VALUE ) \
|
||||
static bool check##PROP( const osg::Texture& tex ) { return true; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osg::Texture& tex ) { \
|
||||
DEF_GLENUM(mode); is >> mode; \
|
||||
tex.setWrap( VALUE, (osg::Texture::WrapMode)mode.get() ); \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::Texture& tex ) { \
|
||||
os << GLENUM(tex.getWrap(VALUE)) << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
WRAP_FUNCTIONS( WRAP_S, osg::Texture::WRAP_S )
|
||||
WRAP_FUNCTIONS( WRAP_T, osg::Texture::WRAP_T )
|
||||
WRAP_FUNCTIONS( WRAP_R, osg::Texture::WRAP_R )
|
||||
|
||||
#define FILTER_FUNCTIONS( PROP, VALUE ) \
|
||||
static bool check##PROP( const osg::Texture& tex ) { return true; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osg::Texture& tex ) { \
|
||||
DEF_GLENUM(mode); is >> mode; \
|
||||
tex.setFilter( VALUE, (osg::Texture::FilterMode)mode.get() ); \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::Texture& tex ) { \
|
||||
os << GLENUM(tex.getFilter(VALUE)) << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
FILTER_FUNCTIONS( MIN_FILTER, osg::Texture::MIN_FILTER )
|
||||
FILTER_FUNCTIONS( MAG_FILTER, osg::Texture::MAG_FILTER )
|
||||
|
||||
#define GL_FORMAT_FUNCTIONS( PROP ) \
|
||||
static bool check##PROP( const osg::Texture& tex ) { \
|
||||
return tex.get##PROP()!=GL_NONE; \
|
||||
} \
|
||||
static bool read##PROP( osgDB::InputStream& is, osg::Texture& tex ) { \
|
||||
DEF_GLENUM(mode); is >> mode; tex.set##PROP( mode.get() ); \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::Texture& tex ) { \
|
||||
os << GLENUM(tex.get##PROP()) << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
GL_FORMAT_FUNCTIONS( SourceFormat )
|
||||
GL_FORMAT_FUNCTIONS( SourceType )
|
||||
|
||||
static bool checkInternalFormat( const osg::Texture& tex )
|
||||
{ return tex.getInternalFormatMode()==osg::Texture::USE_USER_DEFINED_FORMAT; }
|
||||
|
||||
static bool readInternalFormat( osgDB::InputStream& is, osg::Texture& tex )
|
||||
{
|
||||
DEF_GLENUM(mode); is >> mode;
|
||||
if ( tex.getInternalFormatMode()==osg::Texture::USE_USER_DEFINED_FORMAT )
|
||||
tex.setInternalFormat( mode.get() );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeInternalFormat( osgDB::OutputStream& os, const osg::Texture& tex )
|
||||
{
|
||||
if ( os.isBinary() && tex.getInternalFormatMode()!=osg::Texture::USE_USER_DEFINED_FORMAT )
|
||||
os << GLENUM(GL_NONE) << std::endl; // Avoid use of OpenGL extensions
|
||||
else
|
||||
os << GLENUM(tex.getInternalFormat()) << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Texture,
|
||||
/*new osg::Texture*/NULL,
|
||||
osg::Texture,
|
||||
"osg::Object osg::StateAttribute osg::Texture" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( WRAP_S ); // _wrap_s
|
||||
ADD_USER_SERIALIZER( WRAP_T ); // _wrap_t
|
||||
ADD_USER_SERIALIZER( WRAP_R ); // _wrap_r
|
||||
ADD_USER_SERIALIZER( MIN_FILTER ); // _min_filter
|
||||
ADD_USER_SERIALIZER( MAG_FILTER ); // _mag_filter
|
||||
ADD_FLOAT_SERIALIZER( MaxAnisotropy, 1.0f ); // _maxAnisotropy
|
||||
ADD_BOOL_SERIALIZER( UseHardwareMipMapGeneration, true ); // _useHardwareMipMapGeneration
|
||||
ADD_BOOL_SERIALIZER( UnRefImageDataAfterApply, false ); // _unrefImageDataAfterApply
|
||||
ADD_BOOL_SERIALIZER( ClientStorageHint, false ); // _clientStorageHint
|
||||
ADD_BOOL_SERIALIZER( ResizeNonPowerOfTwoHint, false ); // _resizeNonPowerOfTwoHint
|
||||
ADD_VEC4D_SERIALIZER( BorderColor, osg::Vec4d(0.0,0.0,0.0,0.0) ); // _borderColor
|
||||
ADD_INT_SERIALIZER( BorderWidth, 0 ); // _borderWidth
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( InternalFormatMode, USE_IMAGE_DATA_FORMAT );
|
||||
ADD_ENUM_VALUE( USE_IMAGE_DATA_FORMAT );
|
||||
ADD_ENUM_VALUE( USE_USER_DEFINED_FORMAT );
|
||||
ADD_ENUM_VALUE( USE_ARB_COMPRESSION );
|
||||
ADD_ENUM_VALUE( USE_S3TC_DXT1_COMPRESSION );
|
||||
ADD_ENUM_VALUE( USE_S3TC_DXT3_COMPRESSION );
|
||||
ADD_ENUM_VALUE( USE_S3TC_DXT5_COMPRESSION );
|
||||
END_ENUM_SERIALIZER(); // _internalFormatMode
|
||||
|
||||
ADD_USER_SERIALIZER( InternalFormat ); // _internalFormat
|
||||
ADD_USER_SERIALIZER( SourceFormat ); // _sourceFormat
|
||||
ADD_USER_SERIALIZER( SourceType ); // _sourceType
|
||||
ADD_BOOL_SERIALIZER( ShadowComparison, false ); // _use_shadow_comparison
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( ShadowCompareFunc, LEQUAL );
|
||||
ADD_ENUM_VALUE( NEVER );
|
||||
ADD_ENUM_VALUE( LESS );
|
||||
ADD_ENUM_VALUE( EQUAL );
|
||||
ADD_ENUM_VALUE( LEQUAL );
|
||||
ADD_ENUM_VALUE( GREATER );
|
||||
ADD_ENUM_VALUE( NOTEQUAL );
|
||||
ADD_ENUM_VALUE( GEQUAL );
|
||||
ADD_ENUM_VALUE( ALWAYS );
|
||||
END_ENUM_SERIALIZER(); // _shadow_compare_func
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( ShadowTextureMode, LUMINANCE );
|
||||
ADD_ENUM_VALUE( LUMINANCE );
|
||||
ADD_ENUM_VALUE( INTENSITY );
|
||||
ADD_ENUM_VALUE( ALPHA );
|
||||
END_ENUM_SERIALIZER(); // _shadow_texture_mode
|
||||
|
||||
ADD_FLOAT_SERIALIZER( ShadowAmbient, 0.0f ); // _shadow_ambient
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <osg/Texture1D>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Texture1D,
|
||||
new osg::Texture1D,
|
||||
osg::Texture1D,
|
||||
"osg::Object osg::StateAttribute osg::Texture osg::Texture1D" )
|
||||
{
|
||||
ADD_IMAGE_SERIALIZER( Image, osg::Image, NULL ); // _image
|
||||
ADD_INT_SERIALIZER( TextureWidth, 0 ); // _textureWidth
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <osg/Texture2D>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Texture2D,
|
||||
new osg::Texture2D,
|
||||
osg::Texture2D,
|
||||
"osg::Object osg::StateAttribute osg::Texture osg::Texture2D" )
|
||||
{
|
||||
ADD_IMAGE_SERIALIZER( Image, osg::Image, NULL ); // _image
|
||||
ADD_INT_SERIALIZER( TextureWidth, 0 ); // _textureWidth
|
||||
ADD_INT_SERIALIZER( TextureHeight, 0 ); // _textureHeight
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
#include <osg/Texture2DArray>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkImages( const osg::Texture2DArray& tex )
|
||||
{
|
||||
return tex.getNumImages()>0;
|
||||
}
|
||||
|
||||
static bool readImages( osgDB::InputStream& is, osg::Texture2DArray& tex )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osg::Image* image = is.readImage();
|
||||
if ( image ) tex.setImage( i, image );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeImages( osgDB::OutputStream& os, const osg::Texture2DArray& tex )
|
||||
{
|
||||
unsigned int size = tex.getNumImages();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
os << tex.getImage(i);
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Texture2DArray,
|
||||
new osg::Texture2DArray,
|
||||
osg::Texture2DArray,
|
||||
"osg::Object osg::StateAttribute osg::Texture osg::Texture2DArray" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Images ); // _images
|
||||
ADD_INT_SERIALIZER( TextureWidth, 0 ); // _textureWidth
|
||||
ADD_INT_SERIALIZER( TextureHeight, 0 ); // _textureHeight
|
||||
ADD_INT_SERIALIZER( TextureDepth, 0 ); // _textureDepth
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <osg/Texture3D>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Texture3D,
|
||||
new osg::Texture3D,
|
||||
osg::Texture3D,
|
||||
"osg::Object osg::StateAttribute osg::Texture osg::Texture3D" )
|
||||
{
|
||||
ADD_IMAGE_SERIALIZER( Image, osg::Image, NULL ); // _image
|
||||
ADD_INT_SERIALIZER( TextureWidth, 0 ); // _textureWidth
|
||||
ADD_INT_SERIALIZER( TextureHeight, 0 ); // _textureHeight
|
||||
ADD_INT_SERIALIZER( TextureDepth, 0 ); // _textureDepth
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
#include <osg/TextureCubeMap>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#define FACE_IMAGE_FUNCTION( PROP, FACE ) \
|
||||
static bool check##PROP( const osg::TextureCubeMap& tex ) { return true; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osg::TextureCubeMap& tex ) { \
|
||||
bool hasImage; is >> hasImage; \
|
||||
if ( hasImage ) { \
|
||||
is >> osgDB::BEGIN_BRACKET; tex.setImage(FACE, is.readImage()); \
|
||||
is >> osgDB::END_BRACKET; \
|
||||
} \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osg::TextureCubeMap& tex ) { \
|
||||
const osg::Image* image = tex.getImage(FACE); \
|
||||
os << (image!=NULL); \
|
||||
if ( image!=NULL ) { \
|
||||
os << osgDB::BEGIN_BRACKET << std::endl << image; \
|
||||
os << osgDB::END_BRACKET; \
|
||||
} \
|
||||
os << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
FACE_IMAGE_FUNCTION( PosX, osg::TextureCubeMap::POSITIVE_X )
|
||||
FACE_IMAGE_FUNCTION( NegX, osg::TextureCubeMap::NEGATIVE_X )
|
||||
FACE_IMAGE_FUNCTION( PosY, osg::TextureCubeMap::POSITIVE_Y )
|
||||
FACE_IMAGE_FUNCTION( NegY, osg::TextureCubeMap::NEGATIVE_Y )
|
||||
FACE_IMAGE_FUNCTION( PosZ, osg::TextureCubeMap::POSITIVE_Z )
|
||||
FACE_IMAGE_FUNCTION( NegZ, osg::TextureCubeMap::NEGATIVE_Z )
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TextureCubeMap,
|
||||
new osg::TextureCubeMap,
|
||||
osg::TextureCubeMap,
|
||||
"osg::Object osg::StateAttribute osg::Texture osg::TextureCubeMap" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( PosX );
|
||||
ADD_USER_SERIALIZER( NegX );
|
||||
ADD_USER_SERIALIZER( PosY );
|
||||
ADD_USER_SERIALIZER( NegY );
|
||||
ADD_USER_SERIALIZER( PosZ );
|
||||
ADD_USER_SERIALIZER( NegZ ); // _images
|
||||
|
||||
ADD_INT_SERIALIZER( TextureWidth, 0 ); // _textureWidth
|
||||
ADD_INT_SERIALIZER( TextureHeight, 0 ); // _textureHeight
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <osg/TextureRectangle>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TextureRectangle,
|
||||
new osg::TextureRectangle,
|
||||
osg::TextureRectangle,
|
||||
"osg::Object osg::StateAttribute osg::Texture osg::TextureRectangle" )
|
||||
{
|
||||
ADD_IMAGE_SERIALIZER( Image, osg::Image, NULL ); // _image
|
||||
ADD_INT_SERIALIZER( TextureWidth, 0 ); // _textureWidth
|
||||
ADD_INT_SERIALIZER( TextureHeight, 0 ); // _textureHeight
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <osg/TransferFunction>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TransferFunction,
|
||||
new osg::TransferFunction,
|
||||
osg::TransferFunction,
|
||||
"osg::Object osg::TransferFunction" )
|
||||
{
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
#include <osg/TransferFunction>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkColorMap( const osg::TransferFunction1D& func )
|
||||
{
|
||||
return func.getColorMap().size()>0;
|
||||
}
|
||||
|
||||
static bool readColorMap( osgDB::InputStream& is, osg::TransferFunction1D& func )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
float key = 0.0f;
|
||||
osg::Vec4d value;
|
||||
is >> key >> value;
|
||||
func.setColor( key, value );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeColorMap( osgDB::OutputStream& os, const osg::TransferFunction1D& func )
|
||||
{
|
||||
const osg::TransferFunction1D::ColorMap& map = func.getColorMap();
|
||||
os << map.size() << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osg::TransferFunction1D::ColorMap::const_iterator itr=map.begin();
|
||||
itr!=map.end(); ++itr )
|
||||
{
|
||||
os << itr->first << itr->second << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TransferFunction1D,
|
||||
new osg::TransferFunction1D,
|
||||
osg::TransferFunction1D,
|
||||
"osg::Object osg::TransferFunction osg::TransferFunction1D" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( ColorMap ); // _colorMap
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#include <osg/Transform>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( Transform,
|
||||
new osg::Transform,
|
||||
osg::Transform,
|
||||
"osg::Object osg::Node osg::Group osg::Transform" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( ReferenceFrame, RELATIVE_RF );
|
||||
ADD_ENUM_VALUE( RELATIVE_RF );
|
||||
ADD_ENUM_VALUE( ABSOLUTE_RF );
|
||||
ADD_ENUM_VALUE( ABSOLUTE_RF_INHERIT_VIEWPOINT );
|
||||
END_ENUM_SERIALIZER(); // _referenceFrame
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#define ARRAY_FUNCTIONS( PROP, TYPE ) \
|
||||
static bool check##PROP(const osg::TriangleMesh& shape) { \
|
||||
return shape.get##PROP()!=NULL; \
|
||||
} \
|
||||
static bool read##PROP(osgDB::InputStream& is, osg::TriangleMesh& shape) { \
|
||||
shape.set##PROP( dynamic_cast<TYPE*>(is.readArray()) ); \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP(osgDB::OutputStream& os, const osg::TriangleMesh& shape) { \
|
||||
os << shape.get##PROP(); \
|
||||
return true; \
|
||||
}
|
||||
|
||||
ARRAY_FUNCTIONS( Vertices, osg::Vec3Array )
|
||||
ARRAY_FUNCTIONS( Indices, osg::IndexArray )
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( TriangleMesh,
|
||||
new osg::TriangleMesh,
|
||||
osg::TriangleMesh,
|
||||
"osg::Object osg::Shape osg::TriangleMesh" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Vertices ); // _vertices
|
||||
ADD_USER_SERIALIZER( Indices ); // _indices
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user