Protect against divide-by-zero in setCameraParameters
Found by Csaba Halász
This commit is contained in:
parent
1a05695ff5
commit
2b0ffae339
1 changed files with 5 additions and 3 deletions
|
@ -219,7 +219,9 @@ void CameraGroup::update(const osg::Vec3d& position,
|
||||||
|
|
||||||
void CameraGroup::setCameraParameters(float vfov, float aspectRatio)
|
void CameraGroup::setCameraParameters(float vfov, float aspectRatio)
|
||||||
{
|
{
|
||||||
_viewer->getCamera()->setProjectionMatrixAsPerspective(vfov,
|
if (vfov != 0.0f && aspectRatio != 0.0f)
|
||||||
|
_viewer->getCamera()
|
||||||
|
->setProjectionMatrixAsPerspective(vfov,
|
||||||
1.0f / aspectRatio,
|
1.0f / aspectRatio,
|
||||||
_zNear, _zFar);
|
_zNear, _zFar);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue