Added releaseGLObjects(..) and resizeGLObjectBuffers(..) to osgShadow::ShadowTechnique's
This commit is contained in:
@@ -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" )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user