Fix aspect ratio calculation for negative viewport height

This commit is contained in:
baldurk
2021-01-19 17:10:09 +00:00
parent 64131e0510
commit 1fe92989b7
+5 -1
View File
@@ -3826,7 +3826,11 @@ void BufferViewer::camGuess_changed(double value)
// take a guess for the aspect ratio, for if the user hasn't overridden it
Viewport vp = m_Ctx.CurPipelineState().GetViewport(0);
m_Config.aspect = (vp.width > 0.0f && vp.height > 0.0f) ? (vp.width / vp.height) : 1.0f;
float vpWidth = qAbs(vp.width);
float vpHeight = qAbs(vp.height);
m_Config.aspect = (vpWidth > 0.0f && vpHeight > 0.0f) ? (vpWidth / vpHeight) : 1.0f;
if(ui->aspectGuess->value() > 0.0)
m_Config.aspect = ui->aspectGuess->value();