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

Hacky scan visor rendering

This commit is contained in:
2022-05-09 17:13:38 -04:00
parent 1115b451a5
commit 9d634e6a05
15 changed files with 505 additions and 257 deletions

View File

@@ -473,21 +473,15 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr) {
// if (!GetIsGameDraw())
// g_Renderer->x318_26_requestRGBA6 = true;
if (x1d8_onScreenTexAlpha > 0.f && x1dc_onScreenTexTok.IsLoaded()) {
if (!m_onScreenQuad || m_onScreenQuad->GetTex().GetObj() != x1dc_onScreenTexTok.GetObj())
m_onScreenQuad.emplace(EFilterType::Blend, x1dc_onScreenTexTok);
// No depth read/write
// Alpha blend
int w = (CGraphics::GetViewportLeft() + (x1c4_onScreenTex.x4_origin.x - CGraphics::GetViewportWidth()) / 2 +
x1c4_onScreenTex.xc_extent.x) -
x1c4_onScreenTex.x4_origin.x;
int h = (CGraphics::GetViewportTop() + (x1c4_onScreenTex.x4_origin.y - CGraphics::GetViewportHeight()) / 2 -
x1c4_onScreenTex.xc_extent.y) -
x1c4_onScreenTex.x4_origin.y;
zeus::CRectangle rect(x1c4_onScreenTex.x4_origin.x / float(CGraphics::GetViewportWidth()),
x1c4_onScreenTex.x4_origin.y / float(CGraphics::GetViewportHeight()),
w / float(CGraphics::GetViewportWidth()), h / float(CGraphics::GetViewportHeight()));
m_onScreenQuad->draw(zeus::CColor(1.f, x1d8_onScreenTexAlpha), 1.f, rect);
g_Renderer->SetDepthReadWrite(false, false);
g_Renderer->SetBlendMode_AlphaBlended();
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
int w = x1c4_onScreenTex.x4_origin.x;
int h = x1c4_onScreenTex.x4_origin.y;
int x = CGraphics::GetViewportLeft() + (CGraphics::GetViewportWidth() - w) / 2 + x1c4_onScreenTex.xc_extent.x;
int y = CGraphics::GetViewportTop() + (CGraphics::GetViewportHeight() - h) / 2 - x1c4_onScreenTex.xc_extent.y;
CGraphics::Render2D(*x1dc_onScreenTexTok, x, y, w, h, zeus::CColor{1.f, x1d8_onScreenTexAlpha});
}
float staticAlpha = 0.f;
@@ -517,8 +511,10 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr) {
x40_samusReflection->Draw(stateMgr);
if (drawVisor) {
CGraphics::SetDepthRange(DEPTH_HUD, DEPTH_SCREEN_ACTORS);
if (staticAlpha > 0.f)
m_randomStatic.draw(zeus::CColor(1.f, staticAlpha), 1.f);
if (staticAlpha > 0.f) {
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::RandomStatic, zeus::CColor{1.f, staticAlpha},
nullptr, 1.f);
}
x34_samusHud->Draw(stateMgr, x1f4_visorStaticAlpha * (1.f - staticAlpha), x1e0_helmetVisMode,
x1ec_hudVisMode != EHudVisMode::Zero, x1e4_enableTargetingManager && !scanVisor);
}
@@ -552,10 +548,10 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr) {
CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_HUD);
x148_model_automapper->SetIsVisible(true);
x148_model_automapper->Draw(CGuiWidgetDrawParms(1.f, zeus::skZero3f));
// ZTest no write
CGraphics::SetDepthWriteMode(true, ERglEnum::GEqual, false);
x38_autoMapper->Draw(stateMgr, zeus::CTransform::Translate(0.f, 0.02f, 0.f) * x18c_mapCamXf,
mapAlpha * x1f4_visorStaticAlpha * t);
// Zest and write
CGraphics::SetDepthWriteMode(true, ERglEnum::LEqual, true);
x148_model_automapper->SetIsVisible(false);
}
@@ -590,7 +586,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr) {
dieDur = 6.f;
float alpha = zeus::clamp(0.f, stateMgr.GetPlayer().GetDeathTime() / dieDur, 1.f);
m_deathWhiteout.draw(zeus::CColor(1.f, alpha));
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, zeus::CColor{1.f, alpha}, nullptr, 1.f);
float zStart = dieDur - 0.5f - 0.5f - 1.f;
float xStart = 0.5f - zStart;
@@ -601,24 +597,24 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr) {
float colT = 1.f - zeus::clamp(0.f, (stateMgr.GetPlayer().GetDeathTime() - colStart) / 0.5f, 1.f);
SClipScreenRect rect(CGraphics::g_Viewport);
CGraphics::ResolveSpareTexture(rect);
m_deathBlackout.draw(zeus::skBlack);
float z = 0.5f * (zT * zT * zT * zT * zT * (CGraphics::GetViewportHeight()- 12.f) + 12.f);
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, zeus::skBlack, nullptr, 1.f);
float z = 0.5f * (zT * zT * zT * zT * zT * (CGraphics::GetViewportHeight() - 12.f) + 12.f);
float x = 0.5f * (xT * (CGraphics::GetViewportWidth() - 12.f) + 12.f);
const std::array<CTexturedQuadFilter::Vert, 4> verts{{
{{-x, 0.f, z}, {0.f, 0.f}},
{{-x, 0.f, -z}, {0.f, 1.f}},
{{x, 0.f, z}, {1.f, 0.f}},
{{x, 0.f, -z}, {1.f, 1.f}},
}};
// const std::array<CTexturedQuadFilter::Vert, 4> verts{{
// {{-x, 0.f, z}, {0.f, 0.f}},
// {{-x, 0.f, -z}, {0.f, 1.f}},
// {{x, 0.f, z}, {1.f, 0.f}},
// {{x, 0.f, -z}, {1.f, 1.f}},
// }};
// if (!m_deathRenderTexQuad)
// m_deathRenderTexQuad.emplace(EFilterType::Blend, CGraphics::g_SpareTexture.get());
// m_deathRenderTexQuad->drawVerts(zeus::CColor(1.f, colT), verts);
if (!m_deathDotQuad)
m_deathDotQuad.emplace(EFilterType::Multiply, x50_deathDot);
m_deathDotQuad->drawVerts(zeus::CColor(1.f, colT), verts);
// if (!m_deathDotQuad)
// m_deathDotQuad.emplace(EFilterType::Multiply, x50_deathDot);
// m_deathDotQuad->drawVerts(zeus::CColor(1.f, colT), verts);
}
}
}