2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-21 21:39:11 +00:00

CGraphics: Viewport fixes

This commit is contained in:
2022-02-27 14:46:15 -08:00
parent fb69d3fdba
commit 44f9d6648a
30 changed files with 340 additions and 333 deletions

View File

@@ -76,17 +76,18 @@ void CGuiSys::OnViewportResize() {
void CGuiSys::ViewportResizeFrame(CGuiFrame* frame) {
if (frame->m_aspectConstraint > 0.f) {
float hPad, vPad;
if (g_Viewport.aspect >= frame->m_aspectConstraint) {
hPad = frame->m_aspectConstraint / g_Viewport.aspect;
if (CGraphics::GetViewportAspect() >= frame->m_aspectConstraint) {
hPad = frame->m_aspectConstraint / CGraphics::GetViewportAspect();
vPad = frame->m_aspectConstraint / 1.38f;
} else {
hPad = 1.f;
vPad = g_Viewport.aspect / 1.38f;
vPad = CGraphics::GetViewportAspect() / 1.38f;
}
frame->m_aspectTransform = zeus::CTransform::Scale({hPad, 1.f, vPad});
} else if (frame->m_maxAspect > 0.f) {
if (g_Viewport.aspect > frame->m_maxAspect)
frame->m_aspectTransform = zeus::CTransform::Scale({frame->m_maxAspect / g_Viewport.aspect, 1.f, 1.f});
if (CGraphics::GetViewportAspect() > frame->m_maxAspect)
frame->m_aspectTransform =
zeus::CTransform::Scale({frame->m_maxAspect / CGraphics::GetViewportAspect(), 1.f, 1.f});
else
frame->m_aspectTransform = zeus::CTransform();
}