Added releaseGLObjects(..) and resizeGLObjectBuffers(..) to osgShadow::ShadowTechnique's
This commit is contained in:
parent
f373bcf23d
commit
dcadd69c5a
@ -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;
|
||||
|
@ -123,6 +123,67 @@ DebugShadowMap::~DebugShadowMap()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void DebugShadowMap::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
osg::resizeGLObjectBuffers(_depthColorFragmentShader, maxSize);
|
||||
|
||||
ViewDependentShadowTechnique::resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
void DebugShadowMap::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
osg::releaseGLObjects(_depthColorFragmentShader, state);
|
||||
|
||||
ViewDependentShadowTechnique::releaseGLObjects(state);
|
||||
}
|
||||
|
||||
void DebugShadowMap::ViewData::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
BaseClass::ViewData::resizeGLObjectBuffers(maxSize);
|
||||
|
||||
osg::resizeGLObjectBuffers(_texture, maxSize);
|
||||
osg::resizeGLObjectBuffers(_camera, maxSize);
|
||||
osg::resizeGLObjectBuffers(_depthColorFragmentShader, maxSize);
|
||||
|
||||
for(PolytopeGeometryMap::iterator itr = _polytopeGeometryMap.begin();
|
||||
itr != _polytopeGeometryMap.end();
|
||||
++itr)
|
||||
{
|
||||
osg::resizeGLObjectBuffers(itr->second._geometry[0], maxSize);
|
||||
osg::resizeGLObjectBuffers(itr->second._geometry[1], maxSize);
|
||||
}
|
||||
|
||||
osg::resizeGLObjectBuffers(_geode[0], maxSize);
|
||||
osg::resizeGLObjectBuffers(_geode[1], maxSize);
|
||||
osg::resizeGLObjectBuffers(_transform[0], maxSize);
|
||||
osg::resizeGLObjectBuffers(_transform[1], maxSize);
|
||||
osg::resizeGLObjectBuffers(_cameraDebugHUD, maxSize);
|
||||
}
|
||||
|
||||
void DebugShadowMap::ViewData::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
BaseClass::ViewData::releaseGLObjects(state);
|
||||
|
||||
osg::releaseGLObjects(_texture, state);
|
||||
osg::releaseGLObjects(_camera, state);
|
||||
osg::releaseGLObjects(_depthColorFragmentShader, state);
|
||||
|
||||
for(PolytopeGeometryMap::const_iterator itr = _polytopeGeometryMap.begin();
|
||||
itr != _polytopeGeometryMap.end();
|
||||
++itr)
|
||||
{
|
||||
osg::releaseGLObjects(itr->second._geometry[0], state);
|
||||
osg::releaseGLObjects(itr->second._geometry[1], state);
|
||||
}
|
||||
|
||||
osg::releaseGLObjects(_geode[0], state);
|
||||
osg::releaseGLObjects(_geode[1], state);
|
||||
osg::releaseGLObjects(_transform[0], state);
|
||||
osg::releaseGLObjects(_transform[1], state);
|
||||
osg::releaseGLObjects(_cameraDebugHUD, state);
|
||||
}
|
||||
|
||||
void DebugShadowMap::ViewData::cull( void )
|
||||
{
|
||||
if( getDebugDraw() && !_cameraDebugHUD.valid() )
|
||||
|
@ -46,6 +46,22 @@ MinimalDrawBoundsShadowMap::~MinimalDrawBoundsShadowMap()
|
||||
{
|
||||
}
|
||||
|
||||
void MinimalDrawBoundsShadowMap::ViewData::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
BaseClass::ViewData::resizeGLObjectBuffers(maxSize);
|
||||
|
||||
_boundAnalysisTexture->resizeGLObjectBuffers(maxSize);
|
||||
_boundAnalysisCamera->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
void MinimalDrawBoundsShadowMap::ViewData::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
BaseClass::ViewData::releaseGLObjects(state);
|
||||
|
||||
_boundAnalysisTexture->releaseGLObjects(state);
|
||||
_boundAnalysisCamera->releaseGLObjects(state);
|
||||
}
|
||||
|
||||
void MinimalDrawBoundsShadowMap::ViewData::cullShadowReceivingScene( )
|
||||
{
|
||||
BaseClass::ViewData::cullShadowReceivingScene( );
|
||||
|
@ -272,6 +272,47 @@ ParallelSplitShadowMap::ParallelSplitShadowMap(const ParallelSplitShadowMap& cop
|
||||
{
|
||||
}
|
||||
|
||||
void ParallelSplitShadowMap::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
for(PSSMShadowSplitTextureMap::iterator itr = _PSSMShadowSplitTextureMap.begin();
|
||||
itr != _PSSMShadowSplitTextureMap.end();
|
||||
++itr)
|
||||
{
|
||||
itr->second.resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
void ParallelSplitShadowMap::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
for(PSSMShadowSplitTextureMap::const_iterator itr = _PSSMShadowSplitTextureMap.begin();
|
||||
itr != _PSSMShadowSplitTextureMap.end();
|
||||
++itr)
|
||||
{
|
||||
itr->second.releaseGLObjects(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ParallelSplitShadowMap::PSSMShadowSplitTexture::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
osg::resizeGLObjectBuffers(_camera, maxSize);
|
||||
osg::resizeGLObjectBuffers(_texture, maxSize);
|
||||
osg::resizeGLObjectBuffers(_stateset, maxSize);
|
||||
osg::resizeGLObjectBuffers(_debug_camera, maxSize);
|
||||
osg::resizeGLObjectBuffers(_debug_texture, maxSize);
|
||||
osg::resizeGLObjectBuffers(_debug_stateset, maxSize);
|
||||
}
|
||||
|
||||
void ParallelSplitShadowMap::PSSMShadowSplitTexture::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
osg::releaseGLObjects(_camera, state);
|
||||
osg::releaseGLObjects(_texture, state);
|
||||
osg::releaseGLObjects(_stateset, state);
|
||||
osg::releaseGLObjects(_debug_camera, state);
|
||||
osg::releaseGLObjects(_debug_texture, state);
|
||||
osg::releaseGLObjects(_debug_stateset, state);
|
||||
}
|
||||
|
||||
void ParallelSplitShadowMap::setAmbientBias(const osg::Vec2& ambientBias)
|
||||
{
|
||||
_ambientBias = ambientBias;
|
||||
|
@ -89,6 +89,42 @@ ShadowTechnique(copy,copyop),
|
||||
{
|
||||
}
|
||||
|
||||
void ShadowMap::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
osg::resizeGLObjectBuffers(_camera, maxSize);
|
||||
osg::resizeGLObjectBuffers(_texgen, maxSize);
|
||||
osg::resizeGLObjectBuffers(_texture, maxSize);
|
||||
osg::resizeGLObjectBuffers(_stateset, maxSize);
|
||||
osg::resizeGLObjectBuffers(_program, maxSize);
|
||||
|
||||
osg::resizeGLObjectBuffers(_ls, maxSize);
|
||||
|
||||
for(ShaderList::iterator itr = _shaderList.begin();
|
||||
itr != _shaderList.end();
|
||||
++itr)
|
||||
{
|
||||
osg::resizeGLObjectBuffers(*itr, maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
void ShadowMap::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
osg::releaseGLObjects(_camera, state);
|
||||
osg::releaseGLObjects(_texgen, state);
|
||||
osg::releaseGLObjects(_texture, state);
|
||||
osg::releaseGLObjects(_stateset, state);
|
||||
osg::releaseGLObjects(_program, state);
|
||||
|
||||
osg::releaseGLObjects(_ls, state);
|
||||
|
||||
for(ShaderList::const_iterator itr = _shaderList.begin();
|
||||
itr != _shaderList.end();
|
||||
++itr)
|
||||
{
|
||||
osg::releaseGLObjects(*itr, state);
|
||||
}
|
||||
}
|
||||
|
||||
void ShadowMap::setTextureUnit(unsigned int unit)
|
||||
{
|
||||
_shadowTextureUnit = unit;
|
||||
|
@ -30,6 +30,20 @@ ShadowTexture::ShadowTexture(const ShadowTexture& copy, const osg::CopyOp& copyo
|
||||
{
|
||||
}
|
||||
|
||||
void ShadowTexture::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
osg::resizeGLObjectBuffers(_camera, maxSize);
|
||||
osg::resizeGLObjectBuffers(_texture, maxSize);
|
||||
osg::resizeGLObjectBuffers(_stateset, maxSize);
|
||||
}
|
||||
|
||||
void ShadowTexture::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
osg::releaseGLObjects(_camera, state);
|
||||
osg::releaseGLObjects(_texture, state);
|
||||
osg::releaseGLObjects(_stateset, state);
|
||||
}
|
||||
|
||||
void ShadowTexture::setTextureUnit(unsigned int unit)
|
||||
{
|
||||
_textureUnit = unit;
|
||||
|
@ -53,6 +53,26 @@ ShadowVolume::~ShadowVolume()
|
||||
{
|
||||
}
|
||||
|
||||
void ShadowVolume::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
osg::resizeGLObjectBuffers(_occluder, maxSize);
|
||||
osg::resizeGLObjectBuffers(_shadowVolume, maxSize);
|
||||
osg::resizeGLObjectBuffers(_ss1, maxSize);
|
||||
osg::resizeGLObjectBuffers(_mainShadowStateSet, maxSize);
|
||||
osg::resizeGLObjectBuffers(_shadowVolumeStateSet, maxSize);
|
||||
osg::resizeGLObjectBuffers(_shadowedSceneStateSet, maxSize);
|
||||
}
|
||||
|
||||
void ShadowVolume::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
osg::releaseGLObjects(_occluder, state);
|
||||
osg::releaseGLObjects(_shadowVolume, state);
|
||||
osg::releaseGLObjects(_ss1, state);
|
||||
osg::releaseGLObjects(_mainShadowStateSet, state);
|
||||
osg::releaseGLObjects(_shadowVolumeStateSet, state);
|
||||
osg::releaseGLObjects(_shadowedSceneStateSet, state);
|
||||
}
|
||||
|
||||
void ShadowVolume::setDrawMode(osgShadow::ShadowVolumeGeometry::DrawMode drawMode)
|
||||
{
|
||||
if (_drawMode == drawMode) return;
|
||||
@ -351,6 +371,5 @@ void ShadowVolume::cull(osgUtil::CullVisitor& cv)
|
||||
|
||||
void ShadowVolume::cleanSceneGraph()
|
||||
{
|
||||
OSG_NOTICE<<className()<<"::cleanSceneGraph()) not implemented yet, but almost."<<std::endl;
|
||||
}
|
||||
|
||||
|
@ -365,6 +365,37 @@ StandardShadowMap::~StandardShadowMap(void)
|
||||
|
||||
}
|
||||
|
||||
void StandardShadowMap::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
osg::resizeGLObjectBuffers(_mainVertexShader, maxSize);
|
||||
osg::resizeGLObjectBuffers(_mainFragmentShader, maxSize);
|
||||
osg::resizeGLObjectBuffers(_shadowVertexShader, maxSize);
|
||||
osg::resizeGLObjectBuffers(_shadowFragmentShader, maxSize);
|
||||
|
||||
DebugShadowMap::resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
void StandardShadowMap::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
osg::releaseGLObjects(_mainVertexShader, state);
|
||||
osg::releaseGLObjects(_mainFragmentShader, state);
|
||||
osg::releaseGLObjects(_shadowVertexShader, state);
|
||||
osg::releaseGLObjects(_shadowFragmentShader, state);
|
||||
|
||||
DebugShadowMap::releaseGLObjects(state);
|
||||
}
|
||||
|
||||
void StandardShadowMap::ViewData::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
osg::resizeGLObjectBuffers(_stateset, maxSize);
|
||||
}
|
||||
|
||||
void StandardShadowMap::ViewData::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
osg::releaseGLObjects(_stateset, state);
|
||||
}
|
||||
|
||||
|
||||
void StandardShadowMap::updateTextureCoordIndices( unsigned int fromTextureCoordIndex, unsigned int toTextureCoordIndex )
|
||||
{
|
||||
|
||||
|
@ -37,6 +37,27 @@ ViewDependentShadowTechnique::~ViewDependentShadowTechnique(void)
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ViewDependentShadowTechnique::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
for(ViewDataMap::iterator itr = _viewDataMap.begin();
|
||||
itr != _viewDataMap.end();
|
||||
++itr)
|
||||
{
|
||||
itr->second->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewDependentShadowTechnique::releaseGLObjects(osg::State* state) const
|
||||
{
|
||||
for(ViewDataMap::const_iterator itr = _viewDataMap.begin();
|
||||
itr != _viewDataMap.end();
|
||||
++itr)
|
||||
{
|
||||
itr->second->releaseGLObjects(state);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewDependentShadowTechnique::traverse(osg::NodeVisitor& nv)
|
||||
{
|
||||
osgShadow::ShadowTechnique::traverse(nv);
|
||||
@ -96,14 +117,14 @@ ViewDependentShadowTechnique::ViewData *
|
||||
ViewDependentShadowTechnique::getViewDependentData( osgUtil::CullVisitor * cv )
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_viewDataMapMutex);
|
||||
return _viewDataMap[ cv ].get();
|
||||
return _viewDataMap[ osg::Identifier::get(cv) ].get();
|
||||
}
|
||||
|
||||
void ViewDependentShadowTechnique::setViewDependentData
|
||||
( osgUtil::CullVisitor * cv, ViewData * data )
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_viewDataMapMutex);
|
||||
_viewDataMap[ cv ] = data;
|
||||
_viewDataMap[ osg::Identifier::get(cv) ] = data;
|
||||
}
|
||||
|
||||
void ViewDependentShadowTechnique::ViewData::dirty( bool flag )
|
||||
|
@ -17,7 +17,7 @@ bool ShadowTechnique_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
REGISTER_DOTOSGWRAPPER(ShadowTechnique_Proxy)
|
||||
(
|
||||
new osgShadow::ShadowTechnique,
|
||||
0,
|
||||
"ShadowTechnique",
|
||||
"Object ShadowTechnique ",
|
||||
ShadowTechnique_readLocalData,
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgShadow_ShadowTechnique,
|
||||
new osgShadow::ShadowTechnique,
|
||||
0,
|
||||
osgShadow::ShadowTechnique,
|
||||
"osg::Object osgShadow::ShadowTechnique" )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user