Converted viewer camera references to use observer_ptr<> rather than ref_ptr<> or C pointers to avoid issues with circular references/dangling pointers.

This commit is contained in:
Robert Osfield 2009-01-27 14:11:37 +00:00
parent 29157f24d9
commit c7744b15a3
3 changed files with 4 additions and 4 deletions

View File

@ -103,7 +103,7 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
osg::ref_ptr< osg::Camera > _camera;
osg::Matrixd _viewProjection;
osg::Camera * _viewCamera;
osg::observer_ptr<osg::Camera> _viewCamera;
// Debug hud variables

View File

@ -53,7 +53,7 @@ class OSGSHADOW_EXPORT MinimalDrawBoundsShadowMap
osg::ref_ptr< osg::Image > _boundAnalysisImage;
osg::ref_ptr< osg::Texture2D > _boundAnalysisTexture;
osg::ref_ptr< osg::Camera > _boundAnalysisCamera;
osg::ref_ptr< osg::Camera > _mainCamera;
osg::observer_ptr< osg::Camera > _mainCamera;
void setShadowCameraProjectionMatrixPtr( osg::RefMatrix * projection )
{ _projection = projection; }

View File

@ -278,7 +278,7 @@ void DebugShadowMap::ViewData::updateDebugGeometry
transform[ num ] =
{ viewCam->getViewMatrix() *
// use near far clamped projection ( precomputed in cullDebugGeometry )
( viewCam == _viewCamera ? _viewProjection : viewCam->getProjectionMatrix() ),
( _viewCamera==viewCam ? _viewProjection : viewCam->getProjectionMatrix() ),
shadowCam->getViewMatrix() * shadowCam->getProjectionMatrix() },
inverse[ num ] =
{ osg::Matrix::inverse( transform[0] ),
@ -362,7 +362,7 @@ void DebugShadowMap::ViewData::cullDebugGeometry( )
}
}
updateDebugGeometry( _viewCamera, _camera.get() );
updateDebugGeometry( _viewCamera.get(), _camera.get() );
#if 1 // Add geometries of polytopes to main cam Render Stage
_transform[0]->accept( *_cv );