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:
parent
29157f24d9
commit
c7744b15a3
@ -103,7 +103,7 @@ class OSGSHADOW_EXPORT DebugShadowMap : public ViewDependentShadowTechnique
|
|||||||
osg::ref_ptr< osg::Camera > _camera;
|
osg::ref_ptr< osg::Camera > _camera;
|
||||||
|
|
||||||
osg::Matrixd _viewProjection;
|
osg::Matrixd _viewProjection;
|
||||||
osg::Camera * _viewCamera;
|
osg::observer_ptr<osg::Camera> _viewCamera;
|
||||||
|
|
||||||
// Debug hud variables
|
// Debug hud variables
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class OSGSHADOW_EXPORT MinimalDrawBoundsShadowMap
|
|||||||
osg::ref_ptr< osg::Image > _boundAnalysisImage;
|
osg::ref_ptr< osg::Image > _boundAnalysisImage;
|
||||||
osg::ref_ptr< osg::Texture2D > _boundAnalysisTexture;
|
osg::ref_ptr< osg::Texture2D > _boundAnalysisTexture;
|
||||||
osg::ref_ptr< osg::Camera > _boundAnalysisCamera;
|
osg::ref_ptr< osg::Camera > _boundAnalysisCamera;
|
||||||
osg::ref_ptr< osg::Camera > _mainCamera;
|
osg::observer_ptr< osg::Camera > _mainCamera;
|
||||||
|
|
||||||
void setShadowCameraProjectionMatrixPtr( osg::RefMatrix * projection )
|
void setShadowCameraProjectionMatrixPtr( osg::RefMatrix * projection )
|
||||||
{ _projection = projection; }
|
{ _projection = projection; }
|
||||||
|
@ -278,7 +278,7 @@ void DebugShadowMap::ViewData::updateDebugGeometry
|
|||||||
transform[ num ] =
|
transform[ num ] =
|
||||||
{ viewCam->getViewMatrix() *
|
{ viewCam->getViewMatrix() *
|
||||||
// use near far clamped projection ( precomputed in cullDebugGeometry )
|
// use near far clamped projection ( precomputed in cullDebugGeometry )
|
||||||
( viewCam == _viewCamera ? _viewProjection : viewCam->getProjectionMatrix() ),
|
( _viewCamera==viewCam ? _viewProjection : viewCam->getProjectionMatrix() ),
|
||||||
shadowCam->getViewMatrix() * shadowCam->getProjectionMatrix() },
|
shadowCam->getViewMatrix() * shadowCam->getProjectionMatrix() },
|
||||||
inverse[ num ] =
|
inverse[ num ] =
|
||||||
{ osg::Matrix::inverse( transform[0] ),
|
{ 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
|
#if 1 // Add geometries of polytopes to main cam Render Stage
|
||||||
_transform[0]->accept( *_cv );
|
_transform[0]->accept( *_cv );
|
||||||
|
Loading…
Reference in New Issue
Block a user