1
0
Fork 0

Protect against divide-by-zero in setCameraParameters

Found by Csaba Halász
This commit is contained in:
timoore 2009-01-03 00:15:58 +00:00 committed by Tim Moore
parent 1a05695ff5
commit 2b0ffae339

View file

@ -219,9 +219,11 @@ void CameraGroup::update(const osg::Vec3d& position,
void CameraGroup::setCameraParameters(float vfov, float aspectRatio)
{
_viewer->getCamera()->setProjectionMatrixAsPerspective(vfov,
1.0f / aspectRatio,
_zNear, _zFar);
if (vfov != 0.0f && aspectRatio != 0.0f)
_viewer->getCamera()
->setProjectionMatrixAsPerspective(vfov,
1.0f / aspectRatio,
_zNear, _zFar);
}
}