Prevent crash when creating CCameraSceneNode while rendertarget has height 0

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6405 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-05-30 20:13:28 +00:00 committed by sfan5
parent 424eb85f4d
commit 3ce4b2b5dc

@ -28,16 +28,16 @@ CCameraSceneNode::CCameraSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 i
// set default projection // set default projection
Fovy = core::PI / 2.5f; // Field of view, in radians. Fovy = core::PI / 2.5f; // Field of view, in radians.
Aspect = 4.0f / 3.0f; // Aspect ratio.
const video::IVideoDriver* const d = mgr?mgr->getVideoDriver():0; const video::IVideoDriver* const d = mgr?mgr->getVideoDriver():0;
if (d) if (d)
{ {
Aspect = (f32)d->getCurrentRenderTargetSize().Width / if ( d->getCurrentRenderTargetSize().Height )
(f32)d->getCurrentRenderTargetSize().Height; Aspect = (f32)d->getCurrentRenderTargetSize().Width /
(f32)d->getCurrentRenderTargetSize().Height;
HasD3DStyleProjectionMatrix = d->getDriverType() != video::EDT_OPENGL; HasD3DStyleProjectionMatrix = d->getDriverType() != video::EDT_OPENGL;
} }
else
Aspect = 4.0f / 3.0f; // Aspect ratio.
ViewArea.setFarNearDistance(ZFar - ZNear); ViewArea.setFarNearDistance(ZFar - ZNear);
recalculateProjectionMatrix(); recalculateProjectionMatrix();