From Wojciech Lewandowski, various tweaks to osgShadow shadow mapping classes to improve consistency and enable more debug info output

This commit is contained in:
Robert Osfield
2011-02-23 16:45:44 +00:00
parent c45717fef0
commit 9cfb248b46
12 changed files with 107 additions and 24 deletions

View File

@@ -63,7 +63,7 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
DebugShadowMap(const DebugShadowMap& dsm, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
/** Declaration of standard OSG object methods */
META_Object( ViewDependentShadow, DebugShadowMap );
META_Object( osgShadow, DebugShadowMap );
/** Turn on/off debuging hud & rendering of debug volumes in main view */
void setDebugDraw( bool draw ) { _doDebugDraw = draw; }
@@ -71,6 +71,12 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
/** Tell if debuging hud & rendering of debug volumes is active */
bool getDebugDraw( void ) const { return _doDebugDraw; }
/** Get the file name of debuging dump */
std::string getDebugDump( void ) const { return _debugDump; }
/** Set the file name of debuging dump */
void setDebugDump( const std::string & debugDumpFile ) { _debugDump = debugDumpFile; }
protected:
/** Classic protected OSG destructor */
virtual ~DebugShadowMap();
@@ -86,6 +92,7 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
osg::Vec2s _orthoOrigin;
bool _doDebugDraw;
std::string _debugDump;
osg::ref_ptr< osg::Shader > _depthColorFragmentShader;
@@ -120,16 +127,17 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
typedef std::map< std::string, PolytopeGeometry > PolytopeGeometryMap;
osg::Vec2s _hudSize;
osg::Vec2s _hudOrigin;
osg::Vec2s _hudSize;
osg::Vec2s _hudOrigin;
osg::Vec2s _viewportSize;
osg::Vec2s _viewportOrigin;
osg::Vec2s _orthoSize;
osg::Vec2s _orthoOrigin;
bool *_doDebugDrawPtr;
std::string *_debugDumpPtr;
PolytopeGeometryMap _polytopeGeometryMap;
PolytopeGeometryMap _polytopeGeometryMap;
osg::ref_ptr< osg::Geode > _geode[2];
osg::ref_ptr< osg::MatrixTransform > _transform[2];
@@ -139,7 +147,8 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
osg::ref_ptr<osg::Camera> _cameraDebugHUD;
bool getDebugDraw() { return *_doDebugDrawPtr; }
bool getDebugDraw() { return *_doDebugDrawPtr; }
std::string * getDebugDump() { return _debugDumpPtr; }
virtual void init( ThisClass * st, osgUtil::CullVisitor * cv );
@@ -172,7 +181,7 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
const osg::Camera * shadowCam,
const ConvexPolyhedron * hull );
void dump( const char * filename = "DebugShadowDump.osg" );
void dump( const std::string & filename );
};
META_ViewDependentShadowTechniqueData( ThisClass, ViewData )

View File

@@ -66,7 +66,7 @@ class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapDB: public ProjectionShadow
}
/** Declaration of standard OSG object methods */
META_Object( ViewDependentShadow, LightSpacePerspectiveShadowMapDB );
META_Object( osgShadow, LightSpacePerspectiveShadowMapDB );
};
// Optimized for cull traversal shadow bounds
@@ -89,7 +89,7 @@ class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapCB: public ProjectionShadow
}
/** Declaration of standard OSG object methods */
META_Object( ViewDependentShadow, LightSpacePerspectiveShadowMapCB );
META_Object( osgShadow, LightSpacePerspectiveShadowMapCB );
};
// Optimized for view frustum bounds
@@ -112,7 +112,7 @@ class OSGSHADOW_EXPORT LightSpacePerspectiveShadowMapVB: public ProjectionShadow
}
/** Declaration of standard OSG object methods */
META_Object( ViewDependentShadow, LightSpacePerspectiveShadowMapVB );
META_Object( osgShadow, LightSpacePerspectiveShadowMapVB );
};
typedef LightSpacePerspectiveShadowMapDB LightSpacePerspectiveShadowMap;

View File

@@ -39,7 +39,7 @@ class OSGSHADOW_EXPORT MinimalCullBoundsShadowMap
const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
/** Declaration of standard OSG object methods */
META_Object( ViewDependentShadow, MinimalCullBoundsShadowMap );
META_Object( osgShadow, MinimalCullBoundsShadowMap );
protected:
/** Classic protected OSG destructor */

View File

@@ -40,7 +40,7 @@ class OSGSHADOW_EXPORT MinimalDrawBoundsShadowMap
const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
/** Declaration of standard OSG object methods */
META_Object( ViewDependentShadow, MinimalDrawBoundsShadowMap );
META_Object( osgShadow, MinimalDrawBoundsShadowMap );
protected:
/** Classic protected OSG destructor */

View File

@@ -38,7 +38,7 @@ class OSGSHADOW_EXPORT MinimalShadowMap : public StandardShadowMap
const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
/** Declaration of standard OSG object methods */
META_Object( ViewDependentShadow, MinimalShadowMap );
META_Object( osgShadow, MinimalShadowMap );
void setModellingSpaceToWorldTransform( const osg::Matrix & modellingSpaceToWorld )
{ _modellingSpaceToWorld = modellingSpaceToWorld; }

View File

@@ -43,7 +43,7 @@ class OSGSHADOW_EXPORT ProjectionShadowMap : public MinimalBoundsBaseClass
}
/** Declaration of standard OSG object methods */
META_Object( ViewDependentShadow, ProjectionShadowMap );
META_Object( osgShadow, ProjectionShadowMap );
protected:

View File

@@ -37,7 +37,7 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap
const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
/** Declaration of standard OSG object methods */
META_Object( ViewDependentShadow, StandardShadowMap );
META_Object( osgShadow, StandardShadowMap );
void setBaseTextureUnit( unsigned int unit )
{ _baseTextureUnit = unit; dirty(); }

View File

@@ -119,7 +119,7 @@ class OSGSHADOW_EXPORT ViewDependentShadowTechnique
/** Declaration of standard OSG object methods */
META_Object( ViewDependentShadow, ViewDependentShadowTechnique );
META_Object( osgShadow, ViewDependentShadowTechnique );
/** Dirty view data bits and force update of view data resources */
virtual void dirty();