2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 15:44:56 +00:00

Graphics debug groups and bug fixes

This commit is contained in:
Jack Andersen
2019-07-20 22:42:52 -10:00
parent b4fe474de3
commit 5acf9ecbcf
90 changed files with 217 additions and 27 deletions

View File

@@ -55,6 +55,7 @@ void CAuiEnergyBarT01::Update(float dt) {
void CAuiEnergyBarT01::Draw(const CGuiWidgetDrawParms& drawParms) const {
if (!xbc_tex || !xbc_tex.IsLoaded() || !xd8_coordFunc)
return;
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiEnergyBarT01::Draw {}"), m_name).c_str(), zeus::skCyan);
CGraphics::SetModelMatrix(x34_worldXF);
const_cast<CEnergyBarShader&>(m_energyBarShader).updateModelMatrix();

View File

@@ -101,6 +101,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const {
CGraphics::SetModelMatrix(x34_worldXF);
if (!GetIsVisible() || !xb8_tex0Tok.IsLoaded())
return;
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CAuiImagePane::Draw {}"), m_name).c_str(), zeus::skCyan);
GetIsFinishedLoadingWidgetSpecific();
if (!m_filters || m_filters->m_texId != xb8_tex0Tok.GetObjectTag()->id)
const_cast<CAuiImagePane*>(this)->m_filters.emplace(const_cast<CAuiImagePane*>(this)->xb8_tex0Tok);

View File

@@ -412,6 +412,7 @@ void CCompoundTargetReticle::UpdateOrbitZoneGroup(float dt, const CStateManager&
void CCompoundTargetReticle::Draw(const CStateManager& mgr, bool hideLockon) const {
if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Unmorphed &&
!mgr.GetCameraManager()->IsInCinematicCamera()) {
SCOPED_GRAPHICS_DEBUG_GROUP("CCompoundTargetReticle::Draw", zeus::skCyan);
zeus::CTransform camXf = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr);
CGraphics::SetViewPointMatrix(camXf);
if (!hideLockon) {

View File

@@ -9,6 +9,8 @@ CIOWin::EMessageReturn CConsoleOutputWindow::OnMessage(const CArchitectureMessag
return EMessageReturn::Normal;
}
void CConsoleOutputWindow::Draw() const {}
void CConsoleOutputWindow::Draw() const {
//SCOPED_GRAPHICS_DEBUG_GROUP("CConsoleOutputWindow::Draw", zeus::skGreen);
}
} // namespace urde

View File

@@ -1,4 +1,5 @@
#include "CErrorOutputWindow.hpp"
#include "Graphics/CGraphics.hpp"
namespace urde {
@@ -13,6 +14,8 @@ CIOWin::EMessageReturn CErrorOutputWindow::OnMessage(const CArchitectureMessage&
return EMessageReturn::Normal;
}
void CErrorOutputWindow::Draw() const {}
void CErrorOutputWindow::Draw() const {
//SCOPED_GRAPHICS_DEBUG_GROUP("CErrorOutputWindow::Draw", zeus::skGreen);
}
} // namespace urde

View File

@@ -20,7 +20,7 @@ CGuiFrame::CGuiFrame(CAssetId id, CGuiSys& sys, int a, int b, int c, CSimplePool
m_indexedLights.reserve(8);
x10_rootWidget.reset(new CGuiWidget(CGuiWidget::CGuiWidgetParms(
this, false, 0, 0, false, false, false, zeus::skWhite, CGuiWidget::EGuiModelDrawFlags::Alpha, false,
x8_guiSys.x8_mode != CGuiSys::EUsageMode::Zero)));
x8_guiSys.x8_mode != CGuiSys::EUsageMode::Zero, "<root>"s)));
x8_guiSys.m_registeredFrames.insert(this);
}
@@ -131,6 +131,7 @@ void CGuiFrame::Reset() {
void CGuiFrame::Update(float dt) { xc_headWidget->Update(dt); }
void CGuiFrame::Draw(const CGuiWidgetDrawParms& parms) const {
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CGuiFrame::Draw FRME_{}"), x0_id).c_str(), zeus::skMagenta);
CGraphics::SetCullMode(ERglCullMode::None);
CGraphics::SetAmbientColor(zeus::skWhite);
DisableLights();

View File

@@ -41,6 +41,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const {
return;
if (GetIsVisible()) {
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CGuiModel::Draw {}"), m_name).c_str(), zeus::skCyan);
zeus::CColor moduCol = xa8_color2;
moduCol.a() *= parms.x0_alphaMod;
xb0_frame->EnableLights(xcc_lightMask, const_cast<CBooModel&>(model->GetInstance()));

View File

@@ -34,6 +34,7 @@ void CGuiTextPane::ScaleDimensions(const zeus::CVector3f& scale) {}
void CGuiTextPane::Draw(const CGuiWidgetDrawParms& parms) const {
if (!GetIsVisible())
return;
SCOPED_GRAPHICS_DEBUG_GROUP(fmt::format(fmt("CGuiTextPane::Draw {}"), m_name).c_str(), zeus::skCyan);
zeus::CVector2f dims = GetDimensions();

View File

@@ -188,6 +188,7 @@ void CGuiTextSupport::AutoSetExtent() {
void CGuiTextSupport::Render() const {
const_cast<CGuiTextSupport*>(this)->CheckAndRebuildRenderBuffer();
if (CTextRenderBuffer* buf = GetCurrentPageRenderBuffer()) {
SCOPED_GRAPHICS_DEBUG_GROUP("CGuiTextSupport::Draw", zeus::skBlue);
zeus::CTransform oldModel = CGraphics::g_GXModelMatrix;
CGraphics::SetModelMatrix(oldModel * zeus::CTransform::Scale(1.f, 1.f, -1.f));
buf->Render(x2c_geometryColor, x10_curTimeMod900);

View File

@@ -11,7 +11,8 @@ CGuiWidget::CGuiWidget(const CGuiWidgetParms& parms)
, xa4_color(parms.x10_color)
, xa8_color2(parms.x10_color)
, xac_drawFlags(parms.x14_drawFlags)
, xb0_frame(parms.x0_frame) {
, xb0_frame(parms.x0_frame)
, m_name(parms.m_name) {
xb6_24_pg = parms.xd_g;
xb6_25_isVisible = parms.xa_defaultVisible;
xb6_26_isActive = parms.xb_defaultActive;
@@ -41,7 +42,7 @@ CGuiWidget::CGuiWidgetParms CGuiWidget::ReadWidgetHeader(CGuiFrame* frame, CInpu
EGuiModelDrawFlags df = EGuiModelDrawFlags(in.readUint32Big());
return CGuiWidget::CGuiWidgetParms(frame, useAnimController, selfId, parentId, defaultVis, defaultActive, cullFaces,
color, df, true, false);
color, df, true, false, std::move(name));
}
std::shared_ptr<CGuiWidget> CGuiWidget::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp) {

View File

@@ -34,9 +34,10 @@ public:
bool xe_h;
zeus::CColor x10_color;
EGuiModelDrawFlags x14_drawFlags;
std::string m_name;
CGuiWidgetParms(CGuiFrame* frame, bool useAnimController, s16 selfId, s16 parentId, bool defaultVisible,
bool defaultActive, bool cullFaces, const zeus::CColor& color, EGuiModelDrawFlags drawFlags, bool g,
bool h)
bool h, std::string&& name)
: x0_frame(frame)
, x4_useAnimController(useAnimController)
, x6_selfId(selfId)
@@ -47,7 +48,8 @@ public:
, xd_g(g)
, xe_h(h)
, x10_color(color)
, x14_drawFlags(drawFlags) {}
, x14_drawFlags(drawFlags)
, m_name(std::move(name)) {}
};
protected:
@@ -76,6 +78,8 @@ protected:
std::optional<boo::SScrollDelta> m_lastScroll;
boo::SScrollDelta m_integerScroll;
std::string m_name;
public:
CGuiWidget(const CGuiWidgetParms& parms);

View File

@@ -67,6 +67,7 @@ void COrbitPointMarker::Update(float dt, const CStateManager& mgr) {
void COrbitPointMarker::Draw(const CStateManager& mgr) const {
if ((x1c_lastFreeOrbit || x20_interpTimer > 0.f) && g_tweakTargeting->DrawOrbitPoint() &&
x28_orbitPointModel.IsLoaded()) {
SCOPED_GRAPHICS_DEBUG_GROUP("COrbitPointMarker::Draw", zeus::skCyan);
const CGameCamera* curCam = mgr.GetCameraManager()->GetCurrentCamera(mgr);
zeus::CTransform camXf = mgr.GetCameraManager()->GetCurrentCameraTransform(mgr);
CGraphics::SetViewPointMatrix(camXf);

View File

@@ -49,6 +49,7 @@ CIOWin::EMessageReturn CSplashScreen::OnMessage(const CArchitectureMessage& msg,
void CSplashScreen::Draw() const {
if (!x25_textureLoaded)
return;
SCOPED_GRAPHICS_DEBUG_GROUP("CSplashScreen::Draw", zeus::skGreen);
zeus::CColor color;
if (x14_which == ESplashScreen::Nintendo)