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(); }