1
0
Fork 0

Make lifetime of CameraViewportListener explicit.

MSVC is warning on this usage, as is the Mac release build. Working
around the issue for the moment.
This commit is contained in:
James Turner 2014-01-18 18:49:03 +00:00
parent 2a460d8e86
commit 49a0398fc6
2 changed files with 7 additions and 6 deletions

View file

@ -361,7 +361,7 @@ void CameraInfo::resized(double w, double h)
CameraInfo::~CameraInfo() CameraInfo::~CameraInfo()
{ {
delete viewportListener;
} }
osg::Camera* CameraInfo::getCamera(const std::string& k) const osg::Camera* CameraInfo::getCamera(const std::string& k) const
@ -1035,7 +1035,7 @@ CameraInfo* CameraGroup::buildCamera(SGPropertyNode* cameraNode)
// out of the SceneView objects in the viewer, and the coordinates // out of the SceneView objects in the viewer, and the coordinates
// of mouse events are somewhat bizzare. // of mouse events are somewhat bizzare.
info->viewportListener.reset(new CameraViewportListener(info, viewportNode, window->gc->getTraits())); info->viewportListener = new CameraViewportListener(info, viewportNode, window->gc->getTraits());
info->updateCameras(); info->updateCameras();
// Distortion camera needs the viewport which is created by addCamera(). // Distortion camera needs the viewport which is created by addCamera().
@ -1097,8 +1097,8 @@ CameraInfo* CameraGroup::buildGUICamera(SGPropertyNode* cameraNode,
camera->setRenderOrder(osg::Camera::POST_RENDER, 10000); camera->setRenderOrder(osg::Camera::POST_RENDER, 10000);
SGPropertyNode* viewportNode = cameraNode->getNode("viewport", true); SGPropertyNode* viewportNode = cameraNode->getNode("viewport", true);
result->viewportListener.reset(new CameraViewportListener(result, viewportNode, result->viewportListener = new CameraViewportListener(result, viewportNode,
window->gc->getTraits())); window->gc->getTraits());
// Disable statistics for the GUI camera. // Disable statistics for the GUI camera.
camera->setStats(0); camera->setStats(0);

View file

@ -101,7 +101,8 @@ struct CameraInfo : public osg::Referenced
worldPosCart( new osg::Uniform( "fg_CameraPositionCart", osg::Vec3f() ) ), worldPosCart( new osg::Uniform( "fg_CameraPositionCart", osg::Vec3f() ) ),
worldPosGeod( new osg::Uniform( "fg_CameraPositionGeod", osg::Vec3f() ) ), worldPosGeod( new osg::Uniform( "fg_CameraPositionGeod", osg::Vec3f() ) ),
du( new osg::Uniform( "fg_du",osg::Vec4() ) ), du( new osg::Uniform( "fg_du",osg::Vec4() ) ),
dv( new osg::Uniform( "fg_dv",osg::Vec4() ) ) dv( new osg::Uniform( "fg_dv",osg::Vec4() ) ),
viewportListener(NULL)
{ {
shadowMatrix[0] = new osg::Uniform("fg_ShadowMatrix_0", osg::Matrixf()); shadowMatrix[0] = new osg::Uniform("fg_ShadowMatrix_0", osg::Matrixf());
shadowMatrix[1] = new osg::Uniform("fg_ShadowMatrix_1", osg::Matrixf()); shadowMatrix[1] = new osg::Uniform("fg_ShadowMatrix_1", osg::Matrixf());
@ -167,7 +168,7 @@ struct CameraInfo : public osg::Referenced
osg::ref_ptr<osg::Uniform> dv; osg::ref_ptr<osg::Uniform> dv;
osg::ref_ptr<osg::Uniform> shadowMatrix[4]; osg::ref_ptr<osg::Uniform> shadowMatrix[4];
std::auto_ptr<CameraViewportListener> viewportListener; CameraViewportListener* viewportListener;
void setMatrices( osg::Camera* c ); void setMatrices( osg::Camera* c );