Added releaseGLObjects(..) and resizeGLObjectBuffers(..) to osgShadow::ShadowTechnique's
This commit is contained in:
@@ -77,7 +77,16 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
|
||||
/** Set the file name of debuging dump */
|
||||
void setDebugDump( const std::string & debugDumpFile ) { _debugDump = debugDumpFile; }
|
||||
|
||||
protected:
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
|
||||
protected:
|
||||
/** Classic protected OSG destructor */
|
||||
virtual ~DebugShadowMap();
|
||||
|
||||
@@ -182,6 +191,11 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
|
||||
const ConvexPolyhedron * hull );
|
||||
|
||||
void dump( const std::string & filename );
|
||||
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
META_ViewDependentShadowTechniqueData( ThisClass, ViewData )
|
||||
|
||||
@@ -76,6 +76,9 @@ class OSGSHADOW_EXPORT MinimalDrawBoundsShadowMap
|
||||
virtual void performBoundAnalysis( const osg::Camera& camera );
|
||||
|
||||
ViewData( void ): _boundAnalysisSize( 64, 64 ) {}
|
||||
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
};
|
||||
|
||||
friend struct ViewData;
|
||||
|
||||
@@ -134,6 +134,14 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
|
||||
inline SplitCalcMode getSplitCalculationMode() const { return _SplitCalcMode; }
|
||||
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~ParallelSplitShadowMap() {}
|
||||
@@ -169,7 +177,11 @@ class OSGSHADOW_EXPORT ParallelSplitShadowMap : public ShadowTechnique
|
||||
unsigned int _splitID;
|
||||
unsigned int _resolution;
|
||||
|
||||
osg::Uniform* _farDistanceSplit;
|
||||
osg::ref_ptr<osg::Uniform> _farDistanceSplit;
|
||||
|
||||
void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
void releaseGLObjects(osg::State* = 0) const;
|
||||
|
||||
};
|
||||
|
||||
typedef std::map<unsigned int,PSSMShadowSplitTexture> PSSMShadowSplitTextureMap;
|
||||
|
||||
@@ -83,6 +83,16 @@ class OSGSHADOW_EXPORT ShadowMap : public ShadowTechnique
|
||||
/** Clean scene graph from any shadow technique specific nodes, state and drawables.*/
|
||||
virtual void cleanSceneGraph();
|
||||
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
|
||||
|
||||
// debug methods
|
||||
|
||||
osg::ref_ptr<osg::Camera> makeDebugHUD();
|
||||
|
||||
@@ -35,7 +35,9 @@ class OSGSHADOW_EXPORT ShadowTechnique : public osg::Object
|
||||
|
||||
ShadowTechnique(const ShadowTechnique& es, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Object(osgShadow, ShadowTechnique);
|
||||
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const ShadowTechnique*>(obj)!=NULL; } \
|
||||
virtual const char* libraryName() const { return "osgShadow"; }\
|
||||
virtual const char* className() const { return "ShadowTechnique"; }
|
||||
|
||||
ShadowedScene* getShadowedScene() { return _shadowedScene; }
|
||||
|
||||
@@ -58,7 +60,15 @@ class OSGSHADOW_EXPORT ShadowTechnique : public osg::Object
|
||||
/** Dirty so that cached data structures are updated.*/
|
||||
virtual void dirty() { _dirty = true; }
|
||||
|
||||
protected :
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize) = 0;
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const = 0;
|
||||
|
||||
protected :
|
||||
|
||||
class OSGSHADOW_EXPORT CameraCullCallback : public osg::NodeCallback
|
||||
{
|
||||
|
||||
@@ -51,6 +51,14 @@ class OSGSHADOW_EXPORT ShadowTexture : public ShadowTechnique
|
||||
virtual void cleanSceneGraph();
|
||||
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~ShadowTexture() {}
|
||||
|
||||
@@ -53,6 +53,14 @@ class OSGSHADOW_EXPORT ShadowVolume : public ShadowTechnique
|
||||
virtual void cleanSceneGraph();
|
||||
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~ShadowVolume();
|
||||
@@ -60,7 +68,7 @@ class OSGSHADOW_EXPORT ShadowVolume : public ShadowTechnique
|
||||
osgShadow::ShadowVolumeGeometry::DrawMode _drawMode;
|
||||
bool _dynamicShadowVolumes;
|
||||
|
||||
osg::ref_ptr<osgShadow::OccluderGeometry> _occluder;
|
||||
osg::ref_ptr<osgShadow::OccluderGeometry> _occluder;
|
||||
|
||||
OpenThreads::Mutex _shadowVolumeMutex;
|
||||
osg::ref_ptr<osgShadow::ShadowVolumeGeometry> _shadowVolume;
|
||||
|
||||
@@ -124,7 +124,16 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap
|
||||
void setMainFragmentShader( osg::Shader * shader )
|
||||
{ _mainFragmentShader = shader; }
|
||||
|
||||
protected:
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
|
||||
protected:
|
||||
/** Classic protected OSG destructor */
|
||||
virtual ~StandardShadowMap(void);
|
||||
|
||||
@@ -188,6 +197,9 @@ class OSGSHADOW_EXPORT StandardShadowMap : public DebugShadowMap
|
||||
const osg::Vec3 &worldLightDir,
|
||||
const osg::Vec3 &worldLightUp
|
||||
= osg::Vec3(0,1,0) );
|
||||
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
};
|
||||
|
||||
friend struct ViewData;
|
||||
|
||||
@@ -171,7 +171,6 @@ class OSGSHADOW_EXPORT ViewDependentShadowMap : public ShadowTechnique
|
||||
|
||||
virtual osg::StateSet* selectStateSetForRenderingShadow(ViewDependentData& vdd) const;
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~ViewDependentShadowMap();
|
||||
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
#ifndef OSGSHADOW_VIEWDEPENDENTSHADOWTECHINIQUE
|
||||
#define OSGSHADOW_VIEWDEPENDENTSHADOWTECHINIQUE 1
|
||||
|
||||
#include <osg/Identifier>
|
||||
#include <osgShadow/ShadowTechnique>
|
||||
#include <map>
|
||||
#include <osgShadow/Export>
|
||||
#include <map>
|
||||
|
||||
namespace osgShadow {
|
||||
/**
|
||||
@@ -139,7 +140,16 @@ class OSGSHADOW_EXPORT ViewDependentShadowTechnique
|
||||
/** Traverse shadow scene graph.*/
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
|
||||
protected:
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const;
|
||||
|
||||
protected:
|
||||
/** Classic protected OSG destructor */
|
||||
~ViewDependentShadowTechnique( void );
|
||||
|
||||
@@ -196,6 +206,12 @@ class OSGSHADOW_EXPORT ViewDependentShadowTechnique
|
||||
*/
|
||||
osg::observer_ptr< ViewDependentShadowTechnique > _st;
|
||||
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize) {}
|
||||
|
||||
/** If State is non-zero, this function releases any associated OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(osg::State* = 0) const {}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -203,7 +219,7 @@ class OSGSHADOW_EXPORT ViewDependentShadowTechnique
|
||||
ViewDependentShadowTechnique uses this map to find VieData for each cull vitior
|
||||
*/
|
||||
|
||||
typedef std::map< osg::ref_ptr< osgUtil::CullVisitor >,
|
||||
typedef std::map< osg::ref_ptr< osg::Identifier >,
|
||||
osg::ref_ptr< ViewData > > ViewDataMap;
|
||||
|
||||
ViewDataMap _viewDataMap;
|
||||
|
||||
Reference in New Issue
Block a user