2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 16:24:55 +00:00

Major graphics resource performance improvement

This commit is contained in:
Jack Andersen
2017-11-19 13:48:09 -10:00
parent 3522d757fc
commit cff5198e6b
14 changed files with 235 additions and 139 deletions

View File

@@ -148,6 +148,12 @@ void CGuiFrame::SetAspectConstraint(float c)
CGuiSys::ViewportResizeFrame(this);
}
void CGuiFrame::SetMaxAspect(float c)
{
m_maxAspect = c;
CGuiSys::ViewportResizeFrame(this);
}
void CGuiFrame::Update(float dt)
{
xc_headWidget->Update(dt);

View File

@@ -40,6 +40,7 @@ private:
zeus::CTransform m_aspectTransform;
float m_aspectConstraint = -1.f;
float m_maxAspect = -1.f;
public:
CGuiFrame(CAssetId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp);
@@ -65,6 +66,7 @@ public:
void Touch() const;
const zeus::CTransform& GetAspectTransform() const { return m_aspectTransform; }
void SetAspectConstraint(float c);
void SetMaxAspect(float c);
void Update(float dt);
void Draw(const CGuiWidgetDrawParms& parms) const;

View File

@@ -93,6 +93,13 @@ void CGuiSys::ViewportResizeFrame(CGuiFrame* frame)
}
frame->m_aspectTransform = zeus::CTransform::Scale({hPad, 1.f, vPad});
}
else if (frame->m_maxAspect > 0.f)
{
if (vpAspectRatio > frame->m_maxAspect)
frame->m_aspectTransform = zeus::CTransform::Scale({frame->m_maxAspect / vpAspectRatio, 1.f, 1.f});
else
frame->m_aspectTransform = zeus::CTransform::Identity();
}
}
}