From Wang Rui, "The new osgShadow and osgFX serializers are attached, and some

modifications of the osgShadow header naming styles as well. The
osgDB::Serializer header is also changed to add new Vec2 serializer
macros because of the needs of osgShadow classes. It should compile
fine on both Windows and Linux. But I have only done a few tests to
generate .osgb, .osgt and .osgx formats with these new wrappers."
This commit is contained in:
Robert Osfield 2010-04-20 10:29:04 +00:00
parent a0781cba6c
commit a8c4fd8761
36 changed files with 496 additions and 21 deletions

View File

@ -747,7 +747,7 @@ public:
// ADDING MANIPULATORS
#define ADD_SERIALIZER(S) \
wrapper->addSerializer(S)
wrapper->addSerializer( (S) )
#define ADD_USER_SERIALIZER(PROP) \
wrapper->addSerializer( new osgDB::UserSerializer<MyClass>( \
@ -793,6 +793,16 @@ public:
wrapper->addSerializer( new osgDB::PropByValSerializer< MyClass, double >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP) )
#define ADD_VEC2F_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec2f >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP) )
#define ADD_VEC2D_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec2d >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP) )
#define ADD_VEC2_SERIALIZER(PROP, DEF) ADD_VEC2F_SERIALIZER(PROP, DEF)
#define ADD_VEC3F_SERIALIZER(PROP, DEF) \
wrapper->addSerializer( new osgDB::PropByRefSerializer< MyClass, osg::Vec3f >( \
#PROP, DEF, &MyClass::get##PROP, &MyClass::set##PROP) )

View File

@ -69,7 +69,7 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
void setDebugDraw( bool draw ) { _doDebugDraw = draw; }
/** Tell if debuging hud & rendering of debug volumes is active */
bool getDebugDraw( void ) { return _doDebugDraw; }
bool getDebugDraw( void ) const { return _doDebugDraw; }
protected:
/** Classic protected OSG destructor */

View File

@ -43,16 +43,16 @@ class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap
void setModellingSpaceToWorldTransform( const osg::Matrix & modellingSpaceToWorld )
{ _modellingSpaceToWorld = modellingSpaceToWorld; }
const osg::Matrix & getModellingSpaceToWorldTransform( void )
const osg::Matrix & getModellingSpaceToWorldTransform( void ) const
{ return _modellingSpaceToWorld; }
float getMaxFarPlane( )
float getMaxFarPlane( ) const
{ return _maxFarPlane; }
void setMaxFarPlane( float maxFarPlane )
{ _maxFarPlane = maxFarPlane; }
float getMinLightMargin( )
float getMinLightMargin( ) const
{ return _minLightMargin; }
void setMinLightMargin( float minLightMargin )
@ -70,7 +70,7 @@ class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap
{ _shadowReceivingCoarseBoundAccuracy = accuracy; }
ShadowReceivingCoarseBoundAccuracy
getShadowReceivingCoarseBoundAccuracy()
getShadowReceivingCoarseBoundAccuracy() const
{ return _shadowReceivingCoarseBoundAccuracy; }
protected:

View File

@ -64,28 +64,46 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
inline void setPolygonOffset(const osg::Vec2f& p) { _polgyonOffset = p;_user_polgyonOffset_set=true;}
/** Get the polygon offset osg::Vec2f(factor,unit) */
inline const osg::Vec2f& getPolygonOffset() { return _polgyonOffset;}
inline const osg::Vec2f& getPolygonOffset() const { return _polgyonOffset;}
/** Set the texture resolution */
inline void setTextureResolution(unsigned int resolution) { _resolution = resolution; }
/** Get the texture resolution */
inline unsigned int getTextureResolution() const { return _resolution; }
/** Set the max far distance */
inline void setMaxFarDistance(double farDist) { _setMaxFarDistance = farDist; _isSetMaxFarDistance = true; }
/** Get the max far distance */
inline double getMaxFarDistance() const { return _setMaxFarDistance; }
/** Set the factor for moving the virtual camera behind the real camera*/
inline void setMoveVCamBehindRCamFactor(double distFactor ) { _move_vcam_behind_rcam_factor = distFactor; }
/** Get the factor for moving the virtual camera behind the real camera*/
inline double getMoveVCamBehindRCamFactor() const { return _move_vcam_behind_rcam_factor; }
/** Set min near distance for splits */
inline void setMinNearDistanceForSplits(double nd){ _split_min_near_dist=nd; }
/** Get min near distance for splits */
inline double getMinNearDistanceForSplits() const { return _split_min_near_dist; }
/** set a user defined light for shadow simulation (sun light, ... )
* when this light get passed to pssm, the scene's light are no longer collected
* and simulated. just this user passed light, it needs to be a directional light.
*/
inline void setUserLight(osg::Light* light) { _userLight = light; }
/** get the user defined light for shadow simulation */
inline const osg::Light* getUserLight() const { return _userLight; }
/** Set the values for the ambient bias the shader will use.*/
void setAmbientBias(const osg::Vec2& ambientBias );
void setAmbientBias(const osg::Vec2d& ambientBias );
/** Get the values for the ambient bias the shader will use.*/
const osg::Vec2d& getAmbientBias() const { return _ambientBias; }
/**
* you can overwrite the fragment shader if you like to modify it yourself, own fragment shader can be used
@ -111,6 +129,9 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
/** set split calculation mode */
inline void setSplitCalculationMode(SplitCalcMode scm=SPLIT_EXP) { _SplitCalcMode = scm; }
/** get split calculation mode */
inline SplitCalcMode getSplitCalculationMode() const { return _SplitCalcMode; }
protected :

View File

@ -36,7 +36,7 @@ class OSGSHADOW_EXPORT SoftShadowMap : public ShadowMap
/** Set the values for width of the soft penumbra the shader will use.
* Zero is for hard shadow (no penumbra). 0.01 is already very soft penumbra.
* Default is 0.005.*/
void setSoftnessWidth(const float softnessWidth);
void setSoftnessWidth(float softnessWidth);
/** Get the value used for width of the soft penumbra in the shader.*/
float getSoftnessWidth() const { return _softnessWidth; }
@ -46,7 +46,7 @@ class OSGSHADOW_EXPORT SoftShadowMap : public ShadowMap
* High values (>64) cause 'pixelization' of the penumbra.
* Usually but not necessarily power of two number.
* Default is 32. */
void setJitteringScale(const float jitteringScale);
void setJitteringScale(float jitteringScale);
/** Get the value used for jittering scale in the shader.*/
float getJitteringScale() const { return _jitteringScale; }

View File

@ -42,13 +42,13 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap
void setBaseTextureUnit( unsigned int unit )
{ _baseTextureUnit = unit; dirty(); }
unsigned int getBaseTextureUnit( void )
unsigned int getBaseTextureUnit( void ) const
{ return _baseTextureUnit; }
void setShadowTextureUnit( unsigned int unit )
{ _shadowTextureUnit = unit; dirty(); }
unsigned int getShadowTextureUnit( void )
unsigned int getShadowTextureUnit( void ) const
{ return _shadowTextureUnit; }
// Texture Indices are changed by search and replace on shader source
@ -72,7 +72,7 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap
{ updateTextureCoordIndices( _baseTextureCoordIndex, index );
_baseTextureCoordIndex = index; }
unsigned int getBaseTextureCoordIndex( void )
unsigned int getBaseTextureCoordIndex( void ) const
{ return _baseTextureCoordIndex; }
// Texture Indices are changed by search and replace on shader source
@ -82,13 +82,13 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap
{ updateTextureCoordIndices( _shadowTextureCoordIndex, index );
_shadowTextureCoordIndex = index; }
unsigned int getShadowTextureCoordIndex( void )
unsigned int getShadowTextureCoordIndex( void ) const
{ return _shadowTextureCoordIndex; }
void setTextureSize( const osg::Vec2s& textureSize )
{ _textureSize = textureSize; dirty(); }
osg::Vec2s getTextureSize( )
const osg::Vec2s& getTextureSize() const
{ return _textureSize; }
void setLight( osg::Light* light )
@ -96,6 +96,9 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap
osg::Light* getLight( void )
{ return _light.get(); }
const osg::Light* getLight( void ) const
{ return _light.get(); }
osg::Shader * getShadowVertexShader()
{ return _shadowVertexShader.get(); }

View File

@ -446,13 +446,13 @@ mdata_read(Lib3dsFile *file, Lib3dsIo *io) {
static int
compare_node_id( const void *a, const void *b ) {
return (*((Lib3dsNode**)a))->node_id - (*((Lib3dsNode**)b))->node_id;
return (int)((*((Lib3dsNode**)a))->node_id) - (int)((*((Lib3dsNode**)b))->node_id);
}
static int
compare_node_id2( const void *a, const void *b ) {
return *((unsigned short*)a) - (*((Lib3dsNode**)b))->node_id;
return (int)(*((unsigned short*)a)) - (int)((*((Lib3dsNode**)b))->node_id);
}

View File

@ -275,10 +275,10 @@ ParallelSplitShadowMap::ParallelSplitShadowMap(const ParallelSplitShadowMap& cop
{
}
void ParallelSplitShadowMap::setAmbientBias(const osg::Vec2& ambientBias)
void ParallelSplitShadowMap::setAmbientBias(const osg::Vec2d& ambientBias)
{
_ambientBias = ambientBias;
if (_ambientBiasUniform ) _ambientBiasUniform->set(_ambientBias);
if (_ambientBiasUniform ) _ambientBiasUniform->set(osg::Vec2f(_ambientBias.x(), _ambientBias.y()));
}
void ParallelSplitShadowMap::init(){

View File

@ -177,13 +177,13 @@ ShadowMap(copy,copyop),
{
}
void SoftShadowMap::setJitteringScale(const float jitteringScale)
void SoftShadowMap::setJitteringScale(float jitteringScale)
{
_jitteringScale = jitteringScale;
if (_jitteringScaleUniform.valid()) _jitteringScaleUniform->set(_jitteringScale);
}
void SoftShadowMap::setSoftnessWidth(const float softnessWidth)
void SoftShadowMap::setSoftnessWidth(float softnessWidth)
{
_softnessWidth = softnessWidth;
if (_softnessWidthUniform.valid()) _softnessWidthUniform->set(_softnessWidth);

View File

@ -39,6 +39,8 @@ SET(TARGET_COMMON_LIBRARIES
ADD_SUBDIRECTORY(osg)
ADD_SUBDIRECTORY(osgAnimation)
ADD_SUBDIRECTORY(osgFX)
ADD_SUBDIRECTORY(osgParticle)
ADD_SUBDIRECTORY(osgShadow)
ADD_SUBDIRECTORY(osgTerrain)
ADD_SUBDIRECTORY(osgText)

View File

@ -0,0 +1,33 @@
#include <osgFX/AnisotropicLighting>
#include <osgDB/ReadFile>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
static bool checkLightingMap( const osgFX::AnisotropicLighting& effect )
{
if ( !effect.getLightingMap() ) return false;
return !effect.getLightingMap()->getFileName().empty();
}
static bool readLightingMap( osgDB::InputStream& is, osgFX::AnisotropicLighting& effect )
{
std::string fileName; is.readWrappedString( fileName );
effect.setLightingMap( osgDB::readImageFile(fileName) );
return true;
}
static bool writeLightingMap( osgDB::OutputStream& os, const osgFX::AnisotropicLighting& effect )
{
os.writeWrappedString( effect.getLightingMap()->getFileName() );
os << std::endl; return true;
}
REGISTER_OBJECT_WRAPPER( osgFX_AnisotropicLighting,
new osgFX::AnisotropicLighting,
osgFX::AnisotropicLighting,
"osg::Object osg::Node osg::Group osgFX::Effect osgFX::AnisotropicLighting" )
{
ADD_INT_SERIALIZER( LightNumber, 0 ); // _lightnum
ADD_USER_SERIALIZER( LightingMap ); // _texture
}

View File

@ -0,0 +1,16 @@
#include <osgFX/BumpMapping>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgFX_BumpMapping,
new osgFX::BumpMapping,
osgFX::BumpMapping,
"osg::Object osg::Node osg::Group osgFX::Effect osgFX::BumpMapping" )
{
ADD_INT_SERIALIZER( LightNumber, 0 ); // _lightnum
ADD_INT_SERIALIZER( DiffuseTextureUnit, 1 ); // _diffuse_unit
ADD_INT_SERIALIZER( NormalMapTextureUnit, 0 ); // _normal_unit
ADD_OBJECT_SERIALIZER( OverrideDiffuseTexture, osg::Texture2D, NULL ); // _diffuse_tex
ADD_OBJECT_SERIALIZER( OverrideNormalMapTexture, osg::Texture2D, NULL ); // _normal_tex
}

View File

@ -0,0 +1,7 @@
FILE(GLOB TARGET_SRC *.cpp)
FILE(GLOB TARGET_H *.h)
SET(TARGET_ADDED_LIBRARIES osgFX )
#### end var setup ###
SETUP_PLUGIN(osgfx)

View File

@ -0,0 +1,14 @@
#include <osgFX/Cartoon>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgFX_Cartoon,
new osgFX::Cartoon,
osgFX::Cartoon,
"osg::Object osg::Node osg::Group osgFX::Effect osgFX::Cartoon" )
{
ADD_VEC4_SERIALIZER( OutlineColor, osg::Vec4() );
ADD_FLOAT_SERIALIZER( OutlineLineWidth, 0.0f );
ADD_INT_SERIALIZER( LightNumber, 0 ); // _lightnum
}

View File

@ -0,0 +1,31 @@
#include <osgFX/Effect>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
static bool checkSelectedTechnique( const osgFX::Effect& effect )
{
return effect.getSelectedTechnique()!=osgFX::Effect::AUTO_DETECT;
}
static bool readSelectedTechnique( osgDB::InputStream& is, osgFX::Effect& effect )
{
int sel = 0; is >> sel;
effect.selectTechnique( sel );
return true;
}
static bool writeSelectedTechnique( osgDB::OutputStream& os, const osgFX::Effect& effect )
{
os << effect.getSelectedTechnique() << std::endl;
return true;
}
REGISTER_OBJECT_WRAPPER( osgFX_Effect,
/*new osgFX::Effect*/NULL,
osgFX::Effect,
"osg::Object osg::Node osg::Group osgFX::Effect" )
{
ADD_BOOL_SERIALIZER( Enabled, true ); // _enabled
ADD_USER_SERIALIZER( SelectedTechnique ); // _global_sel_tech
}

View File

@ -0,0 +1,41 @@
#include <osgFX/MultiTextureControl>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
static bool checkTextureWeights( const osgFX::MultiTextureControl& ctrl )
{
return ctrl.getNumTextureWeights()>0;
}
static bool readTextureWeights( osgDB::InputStream& is, osgFX::MultiTextureControl& ctrl )
{
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
float weight = 0.0f; is >> weight;
ctrl.setTextureWeight( i, weight );
}
is >> osgDB::END_BRACKET;
return true;
}
static bool writeTextureWeights( osgDB::OutputStream& os, const osgFX::MultiTextureControl& ctrl )
{
unsigned int size = ctrl.getNumTextureWeights();
os << size << osgDB::BEGIN_BRACKET << std::endl;
for ( unsigned int i=0; i<size; ++i )
{
os << ctrl.getTextureWeight(i);
}
os << osgDB::END_BRACKET << std::endl;
return true;
}
REGISTER_OBJECT_WRAPPER( osgFX_MultiTextureControl,
new osgFX::MultiTextureControl,
osgFX::MultiTextureControl,
"osg::Object osg::Node osg::Group osgFX::MultiTextureControl" )
{
ADD_USER_SERIALIZER( TextureWeights ); // _textureWeightList
}

View File

@ -0,0 +1,13 @@
#include <osgFX/Outline>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgFX_Outline,
new osgFX::Outline,
osgFX::Outline,
"osg::Object osg::Node osg::Group osgFX::Effect osgFX::Outline" )
{
ADD_FLOAT_SERIALIZER( Width, 0.0f ); // _width
ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color
}

View File

@ -0,0 +1,13 @@
#include <osgFX/Scribe>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgFX_Scribe,
new osgFX::Scribe,
osgFX::Scribe,
"osg::Object osg::Node osg::Group osgFX::Effect osgFX::Scribe" )
{
ADD_VEC4_SERIALIZER( WireframeColor, osg::Vec4() );
ADD_FLOAT_SERIALIZER( WireframeLineWidth, 0.0f );
}

View File

@ -0,0 +1,15 @@
#include <osgFX/SpecularHighlights>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgFX_SpecularHighlights,
new osgFX::SpecularHighlights,
osgFX::SpecularHighlights,
"osg::Object osg::Node osg::Group osgFX::Effect osgFX::SpecularHighlights" )
{
ADD_INT_SERIALIZER( LightNumber, 0 ); // _lightnum
ADD_INT_SERIALIZER( TextureUnit, 0 ); // _unit
ADD_VEC4_SERIALIZER( SpecularColor, osg::Vec4() ); // _color
ADD_FLOAT_SERIALIZER( SpecularExponent, 0.0f ); // _sexp
}

View File

@ -0,0 +1,7 @@
FILE(GLOB TARGET_SRC *.cpp)
FILE(GLOB TARGET_H *.h)
SET(TARGET_ADDED_LIBRARIES osgShadow )
#### end var setup ###
SETUP_PLUGIN(osgshadow)

View File

@ -0,0 +1,13 @@
#include <osgShadow/DebugShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_DebugShadowMap,
new osgShadow::DebugShadowMap,
osgShadow::DebugShadowMap,
"osg::Object osgShadow::ShadowTechnique osgShadow::ViewDependentShadowTechnique "
"osgShadow::DebugShadowMap" )
{
ADD_BOOL_SERIALIZER( DebugDraw, false ); // _doDebugDraw
}

View File

@ -0,0 +1,13 @@
#include <osgShadow/LightSpacePerspectiveShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_LightSpacePerspectiveShadowMapCB,
new osgShadow::LightSpacePerspectiveShadowMapCB,
osgShadow::LightSpacePerspectiveShadowMapCB,
"osg::Object osgShadow::ShadowTechnique osgShadow::ViewDependentShadowTechnique "
"osgShadow::DebugShadowMap osgShadow::StandardShadowMap osgShadow::MinimalShadowMap "
"osgShadow::MinimalCullBoundsShadowMap osgShadow::LightSpacePerspectiveShadowMapCB" )
{
}

View File

@ -0,0 +1,13 @@
#include <osgShadow/LightSpacePerspectiveShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_LightSpacePerspectiveShadowMapDB,
new osgShadow::LightSpacePerspectiveShadowMapDB,
osgShadow::LightSpacePerspectiveShadowMapDB,
"osg::Object osgShadow::ShadowTechnique osgShadow::ViewDependentShadowTechnique "
"osgShadow::DebugShadowMap osgShadow::StandardShadowMap osgShadow::MinimalShadowMap "
"osgShadow::MinimalDrawBoundsShadowMap osgShadow::LightSpacePerspectiveShadowMapDB" )
{
}

View File

@ -0,0 +1,13 @@
#include <osgShadow/LightSpacePerspectiveShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_LightSpacePerspectiveShadowMapVB,
new osgShadow::LightSpacePerspectiveShadowMapVB,
osgShadow::LightSpacePerspectiveShadowMapVB,
"osg::Object osgShadow::ShadowTechnique osgShadow::ViewDependentShadowTechnique "
"osgShadow::DebugShadowMap osgShadow::StandardShadowMap osgShadow::MinimalShadowMap "
"osgShadow::LightSpacePerspectiveShadowMapVB" )
{
}

View File

@ -0,0 +1,13 @@
#include <osgShadow/MinimalCullBoundsShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_MinimalCullBoundsShadowMap,
new osgShadow::MinimalCullBoundsShadowMap,
osgShadow::MinimalCullBoundsShadowMap,
"osg::Object osgShadow::ShadowTechnique osgShadow::ViewDependentShadowTechnique "
"osgShadow::DebugShadowMap osgShadow::StandardShadowMap osgShadow::MinimalShadowMap "
"osgShadow::MinimalCullBoundsShadowMap" )
{
}

View File

@ -0,0 +1,13 @@
#include <osgShadow/MinimalDrawBoundsShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_MinimalDrawBoundsShadowMap,
new osgShadow::MinimalDrawBoundsShadowMap,
osgShadow::MinimalDrawBoundsShadowMap,
"osg::Object osgShadow::ShadowTechnique osgShadow::ViewDependentShadowTechnique "
"osgShadow::DebugShadowMap osgShadow::StandardShadowMap osgShadow::MinimalShadowMap "
"osgShadow::MinimalDrawBoundsShadowMap" )
{
}

View File

@ -0,0 +1,21 @@
#include <osgShadow/MinimalShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_MinimalShadowMap,
new osgShadow::MinimalShadowMap,
osgShadow::MinimalShadowMap,
"osg::Object osgShadow::ShadowTechnique osgShadow::ViewDependentShadowTechnique "
"osgShadow::DebugShadowMap osgShadow::StandardShadowMap osgShadow::MinimalShadowMap" )
{
ADD_MATRIX_SERIALIZER( ModellingSpaceToWorldTransform, osg::Matrix() ); // _modellingSpaceToWorld
ADD_FLOAT_SERIALIZER( MaxFarPlane, FLT_MAX ); // _maxFarPlane
ADD_FLOAT_SERIALIZER( MinLightMargin, 0.0f ); // _minLightMargin
BEGIN_ENUM_SERIALIZER( ShadowReceivingCoarseBoundAccuracy, BOUNDING_BOX );
ADD_ENUM_VALUE( EMPTY_BOX );
ADD_ENUM_VALUE( BOUNDING_SPHERE );
ADD_ENUM_VALUE( BOUNDING_BOX );
END_ENUM_SERIALIZER(); // _shadowReceivingCoarseBoundAccuracy
}

View File

@ -0,0 +1,25 @@
#include <osgShadow/ParallelSplitShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_ParallelSplitShadowMap,
new osgShadow::ParallelSplitShadowMap,
osgShadow::ParallelSplitShadowMap,
"osg::Object osgShadow::ShadowTechnique osgShadow::ParallelSplitShadowMap" )
{
ADD_VEC2F_SERIALIZER( PolygonOffset, osg::Vec2f() ); // _polgyonOffset
ADD_UINT_SERIALIZER( TextureResolution, 1024 ); // _resolution
ADD_DOUBLE_SERIALIZER( MaxFarDistance, 0.0 ); // _setMaxFarDistance
ADD_DOUBLE_SERIALIZER( MoveVCamBehindRCamFactor, 0.0 ); // _move_vcam_behind_rcam_factor
ADD_DOUBLE_SERIALIZER( MinNearDistanceForSplits, 5.0 ); // _split_min_near_dist
ADD_OBJECT_SERIALIZER( UserLight, osg::Light, NULL ); // _userLight
ADD_VEC2D_SERIALIZER( AmbientBias, osg::Vec2d() ); // _ambientBias
BEGIN_ENUM_SERIALIZER2( SplitCalculationMode, osgShadow::ParallelSplitShadowMap::SplitCalcMode, SPLIT_EXP );
ADD_ENUM_VALUE( SPLIT_LINEAR );
ADD_ENUM_VALUE( SPLIT_EXP );
END_ENUM_SERIALIZER(); // _SplitCalcMode
}

View File

@ -0,0 +1,20 @@
#include <osgShadow/ShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_ShadowMap,
new osgShadow::ShadowMap,
osgShadow::ShadowMap,
"osg::Object osgShadow::ShadowTechnique osgShadow::ShadowMap" )
{
ADD_UINT_SERIALIZER( TextureUnit, 1 ); // _shadowTextureUnit
ADD_VEC2_SERIALIZER( PolygonOffset, osg::Vec2f() ); // _polyOffset
ADD_VEC2_SERIALIZER( AmbientBias, osg::Vec2d() ); // _ambientBias
ADD_SERIALIZER( (new osgDB::PropByRefSerializer<osgShadow::ShadowMap, osg::Vec2s>
("TextureSize", osg::Vec2s(1024, 1024),
&osgShadow::ShadowMap::getTextureSize,
&osgShadow::ShadowMap::setTextureSize))
); // _textureSize
}

View File

@ -0,0 +1,11 @@
#include <osgShadow/ShadowTechnique>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_ShadowTechnique,
new osgShadow::ShadowTechnique,
osgShadow::ShadowTechnique,
"osg::Object osgShadow::ShadowTechnique" )
{
}

View File

@ -0,0 +1,12 @@
#include <osgShadow/ShadowTexture>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_ShadowTexture,
new osgShadow::ShadowTexture,
osgShadow::ShadowTexture,
"osg::Object osgShadow::ShadowTechnique osgShadow::ShadowTexture" )
{
ADD_UINT_SERIALIZER( TextureUnit, 1 ); // _textureUnit
}

View File

@ -0,0 +1,18 @@
#include <osgShadow/ShadowVolume>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_ShadowVolume,
new osgShadow::ShadowVolume,
osgShadow::ShadowVolume,
"osg::Object osgShadow::ShadowTechnique osgShadow::ShadowVolume" )
{
BEGIN_ENUM_SERIALIZER4( osgShadow::ShadowVolumeGeometry, DrawMode, STENCIL_TWO_SIDED );
ADD_ENUM_CLASS_VALUE( osgShadow::ShadowVolumeGeometry, GEOMETRY );
ADD_ENUM_CLASS_VALUE( osgShadow::ShadowVolumeGeometry, STENCIL_TWO_PASS );
ADD_ENUM_CLASS_VALUE( osgShadow::ShadowVolumeGeometry, STENCIL_TWO_SIDED );
END_ENUM_SERIALIZER(); // _drawMode
ADD_BOOL_SERIALIZER( DynamicShadowVolumes, false ); // _dynamicShadowVolumes
}

View File

@ -0,0 +1,14 @@
#include <osgShadow/ShadowedScene>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_ShadowedScene,
new osgShadow::ShadowedScene,
osgShadow::ShadowedScene,
"osg::Object osg::Node osg::Group osgShadow::ShadowedScene" )
{
ADD_HEXINT_SERIALIZER( ReceivesShadowTraversalMask, 0xffffffff ); // _receivesShadowTraversalMask
ADD_HEXINT_SERIALIZER( CastsShadowTraversalMask, 0xffffffff ); // _castsShadowTraversalMask
ADD_OBJECT_SERIALIZER( ShadowTechnique, osgShadow::ShadowTechnique, NULL ); // _shadowTechnique
}

View File

@ -0,0 +1,15 @@
#include <osgShadow/SoftShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_SoftShadowMap,
new osgShadow::SoftShadowMap,
osgShadow::SoftShadowMap,
"osg::Object osgShadow::ShadowTechnique osgShadow::ShadowMap osgShadow::SoftShadowMap" )
{
ADD_FLOAT_SERIALIZER( SoftnessWidth, 0.0f ); // _softnessWidth
ADD_FLOAT_SERIALIZER( JitteringScale, 32.0f ); // _jitteringScale
ADD_UINT_SERIALIZER( JitterTextureUnit, 2 ); // _jitterTextureUnit
ADD_FLOAT_SERIALIZER( Bias, 0.0f );
}

View File

@ -0,0 +1,24 @@
#include <osgShadow/StandardShadowMap>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_StandardShadowMap,
new osgShadow::StandardShadowMap,
osgShadow::StandardShadowMap,
"osg::Object osgShadow::ShadowTechnique osgShadow::ViewDependentShadowTechnique "
"osgShadow::DebugShadowMap osgShadow::StandardShadowMap" )
{
ADD_UINT_SERIALIZER( BaseTextureUnit, 0 ); // _baseTextureUnit
ADD_UINT_SERIALIZER( ShadowTextureUnit, 1 ); // _shadowTextureUnit
ADD_UINT_SERIALIZER( BaseTextureCoordIndex, 0 ); // _baseTextureCoordIndex
ADD_UINT_SERIALIZER( ShadowTextureCoordIndex, 1 ); // _shadowTextureCoordIndex
ADD_SERIALIZER( (new osgDB::PropByRefSerializer<osgShadow::StandardShadowMap, osg::Vec2s>
("TextureSize", osg::Vec2s(1024, 1024),
&osgShadow::StandardShadowMap::getTextureSize,
&osgShadow::StandardShadowMap::setTextureSize))
); // _textureSize
ADD_OBJECT_SERIALIZER( Light, osg::Light, NULL ); // _light
}

View File

@ -0,0 +1,11 @@
#include <osgShadow/ViewDependentShadowTechnique>
#include <osgDB/ObjectWrapper>
#include <osgDB/InputStream>
#include <osgDB/OutputStream>
REGISTER_OBJECT_WRAPPER( osgShadow_ViewDependentShadowTechnique,
new osgShadow::ViewDependentShadowTechnique,
osgShadow::ViewDependentShadowTechnique,
"osg::Object osgShadow::ShadowTechnique osgShadow::ViewDependentShadowTechnique" )
{
}