Begin transitioning CCameraFilterPass

This commit is contained in:
Luke Street 2022-03-23 01:35:13 -04:00
parent 7cf863983a
commit 9bc0e7f2e6
13 changed files with 245 additions and 178 deletions

View File

@ -600,7 +600,7 @@ void CStateManager::DrawDebugStuff() const {
void CStateManager::RenderCamerasAndAreaLights() { void CStateManager::RenderCamerasAndAreaLights() {
x870_cameraManager->RenderCameras(*this); x870_cameraManager->RenderCameras(*this);
for (const CCameraFilterPassPoly& filter : xb84_camFilterPasses) { for (auto& filter : xb84_camFilterPasses) {
filter.Draw(); filter.Draw();
} }
} }

View File

@ -170,8 +170,8 @@ private:
CFinalInput xb54_finalInput; CFinalInput xb54_finalInput;
static constexpr size_t numCameraPasses = 9; static constexpr size_t numCameraPasses = 9;
std::array<CCameraFilterPassPoly, numCameraPasses> xb84_camFilterPasses; // size: 0x2c std::array<CCameraFilterPass, numCameraPasses> xb84_camFilterPasses; // size: 0x2c
std::array<CCameraBlurPass, numCameraPasses> xd14_camBlurPasses; // size: 0x34 std::array<CCameraBlurPass, numCameraPasses> xd14_camBlurPasses; // size: 0x34
s32 xeec_hintIdx = -1; s32 xeec_hintIdx = -1;
u32 xef0_hintPeriods = 0; u32 xef0_hintPeriods = 0;
@ -385,8 +385,8 @@ public:
void ClearActiveRandom() { x900_activeRandom = nullptr; } void ClearActiveRandom() { x900_activeRandom = nullptr; }
CRumbleManager& GetRumbleManager() { return *x88c_rumbleManager; } CRumbleManager& GetRumbleManager() { return *x88c_rumbleManager; }
const CRumbleManager& GetRumbleManager() const { return *x88c_rumbleManager; } const CRumbleManager& GetRumbleManager() const { return *x88c_rumbleManager; }
CCameraFilterPassPoly& GetCameraFilterPass(int idx) { return xb84_camFilterPasses[idx]; } CCameraFilterPass& GetCameraFilterPass(int idx) { return xb84_camFilterPasses[idx]; }
const CCameraFilterPassPoly& GetCameraFilterPass(int idx) const { return xb84_camFilterPasses[idx]; } const CCameraFilterPass& GetCameraFilterPass(int idx) const { return xb84_camFilterPasses[idx]; }
CCameraBlurPass& GetCameraBlurPass(int idx) { return xd14_camBlurPasses[idx]; } CCameraBlurPass& GetCameraBlurPass(int idx) { return xd14_camBlurPasses[idx]; }
const CCameraBlurPass& GetCameraBlurPass(int idx) const { return xd14_camBlurPasses[idx]; } const CCameraBlurPass& GetCameraBlurPass(int idx) const { return xd14_camBlurPasses[idx]; }

View File

@ -8,14 +8,14 @@
#include "Runtime/Graphics/Shaders/CRandomStaticFilter.hpp" #include "Runtime/Graphics/Shaders/CRandomStaticFilter.hpp"
#include "Runtime/Graphics/Shaders/CScanLinesFilter.hpp" #include "Runtime/Graphics/Shaders/CScanLinesFilter.hpp"
#include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp" #include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp"
#include "Runtime/Graphics/CGX.hpp"
#include <algorithm> #include <algorithm>
#include <zeus/CColor.hpp> #include <zeus/CColor.hpp>
namespace metaforce { namespace metaforce {
template <class S> void CCameraFilterPass::Update(float dt) {
void CCameraFilterPass<S>::Update(float dt) {
if (x10_remTime <= 0.f) if (x10_remTime <= 0.f)
return; return;
@ -31,26 +31,16 @@ void CCameraFilterPass<S>::Update(float dt) {
x20_nextTxtr = {}; x20_nextTxtr = {};
} }
} }
if (x0_curType == EFilterType::Passthru)
m_shader = std::nullopt;
else if (x0_curType != origType)
m_shader.emplace(x0_curType, x24_texObj);
} }
template <class S> void CCameraFilterPass::SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color,
void CCameraFilterPass<S>::SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color, CAssetId txtr) {
CAssetId txtr) {
if (time == 0.f) { if (time == 0.f) {
xc_duration = 0.f; xc_duration = 0.f;
x10_remTime = 0.f; x10_remTime = 0.f;
if (txtr.IsValid()) if (txtr.IsValid())
x24_texObj = g_SimplePool->GetObj({FOURCC('TXTR'), txtr}); x24_texObj = g_SimplePool->GetObj({FOURCC('TXTR'), txtr});
if (type == EFilterType::Passthru)
m_shader = std::nullopt;
else if (x0_curType != type || (x20_nextTxtr != txtr && txtr.IsValid()))
m_shader.emplace(type, x24_texObj);
x4_nextType = type; x4_nextType = type;
x0_curType = type; x0_curType = type;
@ -90,28 +80,18 @@ void CCameraFilterPass<S>::SetFilter(EFilterType type, EFilterShape shape, float
} }
x0_curType = x4_nextType; x0_curType = x4_nextType;
} }
if (x0_curType == EFilterType::Passthru)
m_shader = std::nullopt;
else if (x0_curType != origType || (x20_nextTxtr != origTxtr && x20_nextTxtr.IsValid()))
m_shader.emplace(x0_curType, x24_texObj);
} }
} }
template <class S> void CCameraFilterPass::DisableFilter(float time) {
void CCameraFilterPass<S>::DisableFilter(float time) {
SetFilter(EFilterType::Passthru, x8_shape, time, zeus::skWhite, {}); SetFilter(EFilterType::Passthru, x8_shape, time, zeus::skWhite, {});
} }
template <class S> void CCameraFilterPass::Draw() {
void CCameraFilterPass<S>::Draw() { DrawFilter(x0_curType, x8_shape, x18_curColor, x24_texObj.GetObj(), GetT(x4_nextType == EFilterType::Passthru));
if (!m_shader) {
return;
}
m_shader->DrawFilter(x8_shape, x18_curColor, GetT(x4_nextType == EFilterType::Passthru));
} }
float CCameraFilterPassBase::GetT(bool invert) const { float CCameraFilterPass::GetT(bool invert) const {
float tmp; float tmp;
if (xc_duration == 0.f) if (xc_duration == 0.f)
tmp = 1.f; tmp = 1.f;
@ -122,41 +102,150 @@ float CCameraFilterPassBase::GetT(bool invert) const {
return tmp; return tmp;
} }
void CCameraFilterPassPoly::SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color, void CCameraFilterPass::DrawFilter(EFilterType type, EFilterShape shape, const zeus::CColor& color, CTexture* tex,
CAssetId txtr) { float lod) {
if (!m_filter || m_shape != shape) { switch (type) {
m_shape = shape; case EFilterType::Multiply:
switch (shape) { g_Renderer->SetBlendMode_ColorMultiply();
case EFilterShape::Fullscreen: break;
case EFilterShape::FullscreenHalvesLeftRight: case EFilterType::Invert:
case EFilterShape::FullscreenHalvesTopBottom: g_Renderer->SetBlendMode_InvertDst();
case EFilterShape::FullscreenQuarters: break;
if (txtr.IsValid()) case EFilterType::Add:
m_filter = std::make_unique<CCameraFilterPass<CTexturedQuadFilterAlpha>>(); g_Renderer->SetBlendMode_AdditiveAlpha();
else break;
m_filter = std::make_unique<CCameraFilterPass<CColoredQuadFilter>>(); case EFilterType::Subtract:
break; CGX::SetBlendMode(GX::BM_SUBTRACT, GX::BL_ONE, GX::BL_ONE, GX::LO_CLEAR);
case EFilterShape::CinemaBars: break;
m_filter = std::make_unique<CCameraFilterPass<CWideScreenFilter>>(); case EFilterType::Blend:
break; g_Renderer->SetBlendMode_AlphaBlended();
case EFilterShape::ScanLinesEven: break;
m_filter = std::make_unique<CCameraFilterPass<CScanLinesFilterEven>>(); case EFilterType::Widescreen:
break; return;
case EFilterShape::ScanLinesOdd: case EFilterType::SceneAdd:
m_filter = std::make_unique<CCameraFilterPass<CScanLinesFilterOdd>>(); g_Renderer->SetBlendMode_AdditiveDestColor();
break; break;
case EFilterShape::RandomStatic: case EFilterType::NoColor:
m_filter = std::make_unique<CCameraFilterPass<CRandomStaticFilter>>(); g_Renderer->SetBlendMode_NoColorWrite();
break; break;
case EFilterShape::CookieCutterDepthRandomStatic: default:
m_filter = std::make_unique<CCameraFilterPass<CCookieCutterDepthRandomStaticFilter>>(); return;
break;
default:
break;
}
} }
if (m_filter) DrawFilterShape(shape, color, tex, lod);
m_filter->SetFilter(type, shape, time, color, txtr); g_Renderer->SetBlendMode_AlphaBlended();
}
void CCameraFilterPass::DrawFullScreenColoredQuad(const zeus::CColor& color) {
const auto [lt, rb] = g_Renderer->SetViewportOrtho(true, -4096.f, 4096.f);
g_Renderer->SetDepthReadWrite(false, false);
g_Renderer->BeginTriangleStrip(4);
g_Renderer->PrimColor(color);
g_Renderer->PrimVertex({lt.x() - 1.f, 0.f, 1.f + rb.y()});
g_Renderer->PrimVertex({lt.x() - 1.f, 0.f, lt.y() - 1.f});
g_Renderer->PrimVertex({1.f + rb.x(), 0.f, 1.f + rb.y()});
g_Renderer->PrimVertex({1.f + rb.x(), 0.f, lt.y() - 1.f});
g_Renderer->EndPrimitive();
}
void CCameraFilterPass::DrawFilterShape(EFilterShape shape, const zeus::CColor& color, CTexture* tex, float lod) {
switch (shape) {
default:
if (tex == nullptr) {
DrawFullScreenColoredQuad(color);
} else {
DrawFullScreenTexturedQuad(color, tex, lod);
}
break;
case EFilterShape::FullscreenQuarters:
if (tex == nullptr) {
DrawFullScreenColoredQuad(color);
} else {
DrawFullScreenTexturedQuadQuarters(color, tex, lod);
}
break;
case EFilterShape::CinemaBars:
DrawWideScreen(color, tex, lod);
break;
case EFilterShape::ScanLinesEven:
DrawScanLines(color, true);
break;
case EFilterShape::ScanLinesOdd:
DrawScanLines(color, false);
break;
case EFilterShape::RandomStatic:
DrawRandomStatic(color, 1.f, false);
break;
case EFilterShape::CookieCutterDepthRandomStatic:
DrawRandomStatic(color, lod, true);
break;
}
}
void CCameraFilterPass::DrawFullScreenTexturedQuadQuarters(const zeus::CColor& color, CTexture* tex, float lod) {
const auto [lt, rb] = g_Renderer->SetViewportOrtho(true, -4096.f, 4096.f);
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
g_Renderer->SetDepthReadWrite(false, false);
if (tex != nullptr) {
tex->Load(GX::TEXMAP0, EClampMode::Repeat);
}
CGraphics::SetCullMode(ERglCullMode::None);
for (int i = 0; i < 4; ++i) {
g_Renderer->SetModelMatrix(zeus::CTransform::Scale((i & 1) != 0 ? 1.f : -1.f, 0.f, (i & 2) != 0 ? 1.f : -1.f));
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
CGraphics::StreamColor(color);
CGraphics::StreamTexcoord(lod, lod);
CGraphics::StreamVertex(lt.x(), 0.f, rb.y());
CGraphics::StreamTexcoord(lod, 0.f);
CGraphics::StreamVertex(lt.x(), 0.f, 0.f);
CGraphics::StreamTexcoord(0.f, lod);
CGraphics::StreamVertex(0.f, 0.f, rb.y());
CGraphics::StreamTexcoord(0.f, 0.f);
CGraphics::StreamVertex(0.f, 0.f, 0.f);
CGraphics::StreamEnd();
}
CGraphics::SetCullMode(ERglCullMode::Front);
}
void CCameraFilterPass::DrawFullScreenTexturedQuad(const zeus::CColor& color, CTexture* tex, float lod) {
const float u = 0.5f - 0.5f * lod;
const float v = 0.5f + 0.5f * lod;
const auto [lt, rb] = g_Renderer->SetViewportOrtho(true, -4096.f, 4096.f);
g_Renderer->SetDepthReadWrite(false, false);
if (tex != nullptr) {
tex->Load(GX::TEXMAP0, EClampMode::Repeat);
}
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::sTevPass805a5ebc);
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::skPassThru);
CGraphics::StreamBegin(GX::TRIANGLESTRIP);
CGraphics::StreamColor(color);
CGraphics::StreamTexcoord(u, v);
CGraphics::StreamVertex(lt.x() - 1.f, 0.f, 1.f + rb.y());
CGraphics::StreamTexcoord(u, u);
CGraphics::StreamVertex(lt.x() - 1.f, 0.f, lt.y() - 1.f);
CGraphics::StreamTexcoord(v, v);
CGraphics::StreamVertex(1.f + rb.x(), 0.f, 1.f + rb.y());
CGraphics::StreamTexcoord(v, u);
CGraphics::StreamVertex(1.f + rb.x(), 0.f, lt.y() - 1.f);
CGraphics::StreamEnd();
}
void CCameraFilterPass::DrawRandomStatic(const zeus::CColor& color, float alpha, bool cookieCutterDepth) {
// TODO
}
void CCameraFilterPass::DrawScanLines(const zeus::CColor& color, bool even) {
const auto [lt, rb] = g_Renderer->SetViewportOrtho(true, -4096.f, 4096.f);
g_Renderer->SetDepthReadWrite(false, false);
g_Renderer->SetModelMatrix({});
// CGraphics::SetLineWidth(2.f, 5);
// g_Renderer->BeginLines(...);
// TODO
// CGraphics::SetLineWidth(1.f, 5);
}
void CCameraFilterPass::DrawWideScreen(const zeus::CColor& color, CTexture* tex, float lod) {
// TODO
} }
void CCameraBlurPass::Draw(bool clearDepth) { void CCameraBlurPass::Draw(bool clearDepth) {

View File

@ -4,10 +4,10 @@
#include <optional> #include <optional>
#include "Runtime/CToken.hpp" #include "Runtime/CToken.hpp"
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Graphics/CTexture.hpp" #include "Runtime/Graphics/CTexture.hpp"
#include "Runtime/Graphics/Shaders/CCameraBlurFilter.hpp" #include "Runtime/Graphics/Shaders/CCameraBlurFilter.hpp"
#include "Runtime/Graphics/Shaders/CXRayBlurFilter.hpp" #include "Runtime/Graphics/Shaders/CXRayBlurFilter.hpp"
#include "Runtime/RetroTypes.hpp"
#include <zeus/CColor.hpp> #include <zeus/CColor.hpp>
@ -37,8 +37,8 @@ enum class EFilterShape {
CookieCutterDepthRandomStatic CookieCutterDepthRandomStatic
}; };
class CCameraFilterPassBase { class CCameraFilterPass {
protected: private:
EFilterType x0_curType = EFilterType::Passthru; EFilterType x0_curType = EFilterType::Passthru;
EFilterType x4_nextType = EFilterType::Passthru; EFilterType x4_nextType = EFilterType::Passthru;
EFilterShape x8_shape = EFilterShape::Fullscreen; EFilterShape x8_shape = EFilterShape::Fullscreen;
@ -49,46 +49,24 @@ protected:
zeus::CColor x1c_nextColor; zeus::CColor x1c_nextColor;
CAssetId x20_nextTxtr; CAssetId x20_nextTxtr;
TLockedToken<CTexture> x24_texObj; // Used to be auto_ptr TLockedToken<CTexture> x24_texObj; // Used to be auto_ptr
float GetT(bool invert) const;
[[nodiscard]] float GetT(bool invert) const;
static void DrawFilterShape(EFilterShape shape, const zeus::CColor& color, CTexture* tex, float lod);
static void DrawFullScreenColoredQuad(const zeus::CColor& color);
static void DrawFullScreenTexturedQuad(const zeus::CColor& color, CTexture* tex, float lod);
static void DrawFullScreenTexturedQuadQuarters(const zeus::CColor& color, CTexture* tex, float lod);
static void DrawRandomStatic(const zeus::CColor& color, float alpha, bool cookieCutterDepth);
static void DrawScanLines(const zeus::CColor& color, bool even);
static void DrawWideScreen(const zeus::CColor& color, CTexture* tex, float lod);
public: public:
virtual ~CCameraFilterPassBase() = default; void Update(float dt);
virtual void Update(float dt) = 0;
virtual void SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color,
CAssetId txtr) = 0;
virtual void DisableFilter(float time) = 0;
virtual void Draw() = 0;
};
template <class S>
class CCameraFilterPass final : public CCameraFilterPassBase {
std::optional<S> m_shader;
public:
void Update(float dt) override;
void SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color, CAssetId txtr) override;
void DisableFilter(float time) override;
void Draw() override;
};
class CCameraFilterPassPoly {
EFilterShape m_shape{};
std::unique_ptr<CCameraFilterPassBase> m_filter;
public:
void Update(float dt) {
if (m_filter)
m_filter->Update(dt);
}
void SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color, CAssetId txtr); void SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color, CAssetId txtr);
void DisableFilter(float time) { void DisableFilter(float time);
if (m_filter) void Draw();
m_filter->DisableFilter(time);
} static void DrawFilter(EFilterType type, EFilterShape shape, const zeus::CColor& color, CTexture* tex, float lod);
void Draw() const {
if (m_filter)
m_filter->Draw();
}
}; };
enum class EBlurType { NoBlur, LoBlur, HiBlur, Xray }; enum class EBlurType { NoBlur, LoBlur, HiBlur, Xray };

View File

@ -695,8 +695,23 @@ void CCubeRenderer::SetDebugOption(IRenderer::EDebugOption option, s32 value) {
} }
void CCubeRenderer::BeginPrimitive(IRenderer::EPrimitiveType type, s32 nverts) { void CCubeRenderer::BeginPrimitive(IRenderer::EPrimitiveType type, s32 nverts) {
constexpr std::array vtxDescList{
GX::VtxDescList{GX::VA_POS, GX::DIRECT},
GX::VtxDescList{GX::VA_NRM, GX::DIRECT},
GX::VtxDescList{GX::VA_CLR0, GX::DIRECT},
GX::VtxDescList{},
};
CGX::SetChanCtrl(CGX::EChannelId::Channel0, false, GX::SRC_REG, GX::SRC_VTX, {}, GX::DF_NONE, GX::AF_NONE);
CGX::SetNumChans(1);
CGX::SetNumTexGens(0);
CGX::SetNumTevStages(1);
CGX::SetTevOrder(GX::TEVSTAGE0, GX::TEXCOORD_NULL, GX::TEXMAP_NULL, GX::COLOR0A0);
CGX::SetTevColorIn(GX::TEVSTAGE0, GX::CC_ZERO, GX::CC_ZERO, GX::CC_ZERO, GX::CC_RASC);
CGX::SetTevAlphaIn(GX::TEVSTAGE0, GX::CA_ZERO, GX::CA_ZERO, GX::CA_ZERO, GX::CA_RASA);
CGX::SetStandardTevColorAlphaOp(GX::TEVSTAGE0);
x18_primVertCount = nverts; x18_primVertCount = nverts;
CGraphics::StreamBegin(GX::Primitive(type)); CGX::SetVtxDescv(vtxDescList.data());
CGX::Begin(GX::Primitive(type), GX::VTXFMT0, nverts);
} }
void CCubeRenderer::BeginLines(s32 nverts) { BeginPrimitive(EPrimitiveType::Lines, nverts); } void CCubeRenderer::BeginLines(s32 nverts) { BeginPrimitive(EPrimitiveType::Lines, nverts); }
@ -711,9 +726,9 @@ void CCubeRenderer::BeginTriangleFan(s32 nverts) { BeginPrimitive(EPrimitiveType
void CCubeRenderer::PrimVertex(const zeus::CVector3f& vertex) { void CCubeRenderer::PrimVertex(const zeus::CVector3f& vertex) {
--x18_primVertCount; --x18_primVertCount;
CGraphics::StreamColor(x2e0_primColor); GXPosition3f32(vertex);
CGraphics::StreamNormal(x2e4_primNormal); GXNormal3f32(x2e4_primNormal);
CGraphics::StreamVertex(vertex); GXColor4f32(x2e0_primColor);
} }
void CCubeRenderer::PrimNormal(const zeus::CVector3f& normal) { x2e4_primNormal = normal; } void CCubeRenderer::PrimNormal(const zeus::CVector3f& normal) { x2e4_primNormal = normal; }
@ -726,7 +741,7 @@ void CCubeRenderer::EndPrimitive() {
while (x18_primVertCount > 0) { while (x18_primVertCount > 0) {
PrimVertex(zeus::skZero3f); PrimVertex(zeus::skZero3f);
} }
CGraphics::StreamEnd(); CGX::End();
} }
void CCubeRenderer::SetAmbientColor(const zeus::CColor& color) { CGraphics::SetAmbientColor(color); } void CCubeRenderer::SetAmbientColor(const zeus::CColor& color) { CGraphics::SetAmbientColor(color); }

View File

@ -127,8 +127,6 @@ CIOWin::EMessageReturn CCredits::Update(float dt, CArchitectureQueue& queue) {
} }
[[fallthrough]]; [[fallthrough]];
case 3: { case 3: {
m_videoFilter.Update(dt);
m_textFilter.Update(dt);
// if (!x28_->PumpIndexLoad()) // if (!x28_->PumpIndexLoad())
// break; // break;
x28_->Update(dt); x28_->Update(dt);
@ -212,8 +210,7 @@ void CCredits::DrawVideo() {
alpha = zeus::clamp(0.f, alpha, 1.f); alpha = zeus::clamp(0.f, alpha, 1.f);
zeus::CColor filterCol = zeus::skBlack; zeus::CColor filterCol = zeus::skBlack;
filterCol.a() = alpha; filterCol.a() = alpha;
m_videoFilter.SetFilter(EFilterType::Blend, EFilterShape::Fullscreen, 1.f, filterCol, {}); CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, filterCol, nullptr, 1.f);
m_videoFilter.Draw();
} }
} }
} }
@ -221,8 +218,7 @@ void CCredits::DrawVideo() {
void CCredits::DrawText() { void CCredits::DrawText() {
float width = 896.f * CGraphics::GetViewportAspect(); float width = 896.f * CGraphics::GetViewportAspect();
CGraphics::SetOrtho(0.f, width, 896.f, 0.f, -4096.f, 4096.f); CGraphics::SetOrtho(0.f, width, 896.f, 0.f, -4096.f, 4096.f);
auto region = auto region = std::make_pair(zeus::CVector2f{0.f, 0.f}, zeus::CVector2f{width, 896.f});
std::make_pair<zeus::CVector2f, zeus::CVector2f>(zeus::CVector2f{0.f, 0.f}, zeus::CVector2f{width, 896.f});
CGraphics::SetViewPointMatrix(zeus::CTransform()); CGraphics::SetViewPointMatrix(zeus::CTransform());
CGraphics::SetModelMatrix(zeus::CTransform::Translate((width - 1280.f) / 2.f, 0.f, 896.f)); CGraphics::SetModelMatrix(zeus::CTransform::Translate((width - 1280.f) / 2.f, 0.f, 896.f));
float dVar5 = (x48_ - (region.second.y() - region.first.y())); float dVar5 = (x48_ - (region.second.y() - region.first.y()));
@ -231,8 +227,7 @@ void CCredits::DrawText() {
DrawText(*text, {0.5f * (region.second.x() - text->GetExtentX()), 0.f, x48_ - offset.x}); DrawText(*text, {0.5f * (region.second.x() - text->GetExtentX()), 0.f, x48_ - offset.x});
} }
} }
m_textFilter.SetFilter(EFilterType::Multiply, EFilterShape::CinemaBars, 1.f, zeus::skBlack, {}); CCameraFilterPass::DrawFilter(EFilterType::Multiply, EFilterShape::CinemaBars, zeus::skBlack, nullptr, 1.f);
m_textFilter.Draw();
} }
void CCredits::DrawText(CGuiTextSupport& text, const zeus::CVector3f& translation) { void CCredits::DrawText(CGuiTextSupport& text, const zeus::CVector3f& translation) {

View File

@ -37,9 +37,6 @@ class CCredits : public CIOWin {
void DrawText(); void DrawText();
static void DrawText(CGuiTextSupport&, const zeus::CVector3f& translation); static void DrawText(CGuiTextSupport&, const zeus::CVector3f& translation);
CCameraFilterPassPoly m_videoFilter;
CCameraFilterPassPoly m_textFilter;
public: public:
CCredits(); CCredits();
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override; EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override;

View File

@ -69,7 +69,7 @@ private:
std::vector<TLockedToken<CDependencyGroup>> xc8_inGameGuiDGRPs; std::vector<TLockedToken<CDependencyGroup>> xc8_inGameGuiDGRPs;
std::vector<u32> xd8_; std::vector<u32> xd8_;
std::vector<CToken> xe8_pauseResources; std::vector<CToken> xe8_pauseResources;
CCameraFilterPass<CColoredQuadFilter> xf8_camFilter; CCameraFilterPass xf8_camFilter;
CAssetId x124_pauseGameHudMessage; CAssetId x124_pauseGameHudMessage;
float x128_pauseGameHudTime = 0.f; float x128_pauseGameHudTime = 0.f;
std::list<CToken> x12c_; std::list<CToken> x12c_;

View File

@ -15,8 +15,6 @@
namespace metaforce::MP1 { namespace metaforce::MP1 {
CPlayerVisor::CPlayerVisor(CStateManager&) { CPlayerVisor::CPlayerVisor(CStateManager&) {
// TODO
// : x108_newScanPane(EFilterType::Blend, CGraphics::g_SpareTexture.get())
xcc_scanFrameCorner = g_SimplePool->GetObj("CMDL_ScanFrameCorner"); xcc_scanFrameCorner = g_SimplePool->GetObj("CMDL_ScanFrameCorner");
xd8_scanFrameCenterSide = g_SimplePool->GetObj("CMDL_ScanFrameCenterSide"); xd8_scanFrameCenterSide = g_SimplePool->GetObj("CMDL_ScanFrameCenterSide");
xe4_scanFrameCenterTop = g_SimplePool->GetObj("CMDL_ScanFrameCenterTop"); xe4_scanFrameCenterTop = g_SimplePool->GetObj("CMDL_ScanFrameCenterTop");
@ -289,37 +287,33 @@ CPlayerVisor::EScanWindowState CPlayerVisor::GetDesiredScanWindowState(const CSt
} }
void CPlayerVisor::LockUnlockAssets() { void CPlayerVisor::LockUnlockAssets() {
#if 0 if (x1c_curVisor == CPlayerState::EPlayerVisor::Scan) {
if (x1c_curVisor == CPlayerState::EPlayerVisor::Scan) x120_assetLockCountdown = 2;
x120_assetLockCountdown = 2; } else if (x120_assetLockCountdown > 0) {
else if (x120_assetLockCountdown > 0) --x120_assetLockCountdown;
--x120_assetLockCountdown; }
if (x120_assetLockCountdown > 0) if (x120_assetLockCountdown > 0) {
{ xcc_scanFrameCorner.Lock();
xcc_scanFrameCorner.Lock(); xd8_scanFrameCenterSide.Lock();
xd8_scanFrameCenterSide.Lock(); xe4_scanFrameCenterTop.Lock();
xe4_scanFrameCenterTop.Lock(); xf0_scanFrameStretchSide.Lock();
xf0_scanFrameStretchSide.Lock(); xfc_scanFrameStretchTop.Lock();
xfc_scanFrameStretchTop.Lock(); x108_newScanPane.Lock();
//x108_newScanPane.Lock(); x114_scanShield.Lock();
x114_scanShield.Lock(); x124_scanIconNoncritical.Lock();
x124_scanIconNoncritical.Lock(); x130_scanIconCritical.Lock();
x130_scanIconCritical.Lock(); } else {
} xcc_scanFrameCorner.Unlock();
else xd8_scanFrameCenterSide.Unlock();
{ xe4_scanFrameCenterTop.Unlock();
xcc_scanFrameCorner.Unlock(); xf0_scanFrameStretchSide.Unlock();
xd8_scanFrameCenterSide.Unlock(); xfc_scanFrameStretchTop.Unlock();
xe4_scanFrameCenterTop.Unlock(); x108_newScanPane.Unlock();
xf0_scanFrameStretchSide.Unlock(); x114_scanShield.Unlock();
xfc_scanFrameStretchTop.Unlock(); x124_scanIconNoncritical.Unlock();
//x108_newScanPane.Unlock(); x130_scanIconCritical.Unlock();
x114_scanShield.Unlock(); }
x124_scanIconNoncritical.Unlock();
x130_scanIconCritical.Unlock();
}
#endif
} }
void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, CTargetingManager* tgtMgr) { void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, CTargetingManager* tgtMgr) {
@ -522,8 +516,8 @@ void CPlayerVisor::BeginTransitionIn(const CStateManager&) {
switch (x1c_curVisor) { switch (x1c_curVisor) {
case CPlayerState::EPlayerVisor::XRay: case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.SetBlur(EBlurType::Xray, 0.f, 0.f); x90_xrayBlur.SetBlur(EBlurType::Xray, 0.f, 0.f);
// xc4_vpScaleX = 0.9f; xc4_vpScaleX = 0.9f;
// xc8_vpScaleY = 0.9f; xc8_vpScaleY = 0.9f;
CSfxManager::SfxStart(SFXui_into_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(SFXui_into_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
break; break;
case CPlayerState::EPlayerVisor::Scan: case CPlayerState::EPlayerVisor::Scan:
@ -542,8 +536,8 @@ void CPlayerVisor::FinishTransitionOut(const CStateManager&) {
switch (x1c_curVisor) { switch (x1c_curVisor) {
case CPlayerState::EPlayerVisor::XRay: case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.DisableBlur(0.f); x90_xrayBlur.DisableBlur(0.f);
// xc4_vpScaleX = 1.f; xc4_vpScaleX = 1.f;
// xc8_vpScaleY = 1.f; xc8_vpScaleY = 1.f;
break; break;
case CPlayerState::EPlayerVisor::Scan: case CPlayerState::EPlayerVisor::Scan:
x64_scanDim.DisableFilter(0.f); x64_scanDim.DisableFilter(0.f);

View File

@ -1,13 +1,13 @@
#pragma once #pragma once
#include "Runtime/CPlayerState.hpp"
#include "Runtime/RetroTypes.hpp"
#include "Runtime/rstl.hpp"
#include "Runtime/Audio/CSfxManager.hpp" #include "Runtime/Audio/CSfxManager.hpp"
#include "Runtime/CPlayerState.hpp"
#include "Runtime/Camera/CCameraFilter.hpp" #include "Runtime/Camera/CCameraFilter.hpp"
#include "Runtime/Graphics/CModel.hpp" #include "Runtime/Graphics/CModel.hpp"
#include "Runtime/Graphics/Shaders/CColoredQuadFilter.hpp" #include "Runtime/Graphics/Shaders/CColoredQuadFilter.hpp"
#include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp" #include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp"
#include "Runtime/RetroTypes.hpp"
#include "Runtime/rstl.hpp"
#include <zeus/CVector2f.hpp> #include <zeus/CVector2f.hpp>
@ -45,21 +45,20 @@ class CPlayerVisor {
float x58_scanMagInterp = 1.f; float x58_scanMagInterp = 1.f;
CSfxHandle x5c_visorLoopSfx; CSfxHandle x5c_visorLoopSfx;
CSfxHandle x60_scanningLoopSfx; CSfxHandle x60_scanningLoopSfx;
CCameraFilterPass<CColoredQuadFilter> x64_scanDim; CCameraFilterPass x64_scanDim;
CCameraBlurPass x90_xrayBlur; CCameraBlurPass x90_xrayBlur;
float xc4_vpScaleX = 1.f; float xc4_vpScaleX = 1.f;
float xc8_vpScaleY = 1.f; float xc8_vpScaleY = 1.f;
TLockedToken<CModel> xcc_scanFrameCorner; TCachedToken<CModel> xcc_scanFrameCorner;
TLockedToken<CModel> xd8_scanFrameCenterSide; TCachedToken<CModel> xd8_scanFrameCenterSide;
TLockedToken<CModel> xe4_scanFrameCenterTop; TCachedToken<CModel> xe4_scanFrameCenterTop;
TLockedToken<CModel> xf0_scanFrameStretchSide; TCachedToken<CModel> xf0_scanFrameStretchSide;
TLockedToken<CModel> xfc_scanFrameStretchTop; TCachedToken<CModel> xfc_scanFrameStretchTop;
TCachedToken<CModel> x108_newScanPane; TCachedToken<CModel> x108_newScanPane;
// CTexturedQuadFilter x108_newScanPane; TCachedToken<CModel> x114_scanShield;
TLockedToken<CModel> x114_scanShield;
int x120_assetLockCountdown = 0; int x120_assetLockCountdown = 0;
TLockedToken<CModel> x124_scanIconNoncritical; TCachedToken<CModel> x124_scanIconNoncritical;
TLockedToken<CModel> x130_scanIconCritical; TCachedToken<CModel> x130_scanIconCritical;
rstl::reserved_vector<SScanTarget, 64> x13c_scanTargets; rstl::reserved_vector<SScanTarget, 64> x13c_scanTargets;
TLockedToken<CTexture> x540_xrayPalette; TLockedToken<CTexture> x540_xrayPalette;
float x54c_scanFrameColorInterp = 0.f; float x54c_scanFrameColorInterp = 0.f;

View File

@ -111,7 +111,7 @@ class CSamusHud {
std::unique_ptr<CActorLights> x33c_lights; std::unique_ptr<CActorLights> x33c_lights;
rstl::reserved_vector<SCachedHudLight, 3> x340_hudLights; rstl::reserved_vector<SCachedHudLight, 3> x340_hudLights;
CSfxHandle x3a4_damageSfx; CSfxHandle x3a4_damageSfx;
CCameraFilterPass<CColoredQuadFilter> x3a8_camFilter; CCameraFilterPass x3a8_camFilter;
CGuiLight* x3d4_damageLight = nullptr; CGuiLight* x3d4_damageLight = nullptr;
std::vector<zeus::CTransform> x3d8_lightTransforms; std::vector<zeus::CTransform> x3d8_lightTransforms;
float x3e8_damageTIme = 0.f; float x3e8_damageTIme = 0.f;
@ -138,7 +138,7 @@ class CSamusHud {
float x510_staticInterp = 0.f; float x510_staticInterp = 0.f;
float x514_staticCycleTimerHi = 0.f; float x514_staticCycleTimerHi = 0.f;
float x518_staticCycleTimerLo = 0.f; float x518_staticCycleTimerLo = 0.f;
CCameraFilterPass<CRandomStaticFilter> x51c_camFilter2; CCameraFilterPass x51c_camFilter2;
CHUDMemoParms x548_hudMemoParms; CHUDMemoParms x548_hudMemoParms;
TLockedToken<CStringTable> x550_hudMemoString; TLockedToken<CStringTable> x550_hudMemoString;
u32 x554_hudMemoIdx = 0; u32 x554_hudMemoIdx = 0;

View File

@ -23,7 +23,7 @@ CFireFlea::CDeathCameraEffect::CDeathCameraEffect(TUniqueId uid, TAreaId areaId,
void CFireFlea::CDeathCameraEffect::Accept(IVisitor& visitor) { visitor.Visit(this); } void CFireFlea::CDeathCameraEffect::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CFireFlea::CDeathCameraEffect::PreThink(float dt, CStateManager& mgr) { void CFireFlea::CDeathCameraEffect::PreThink(float dt, CStateManager& mgr) {
CCameraFilterPassPoly& filterPass = mgr.GetCameraFilterPass(5); auto& filterPass = mgr.GetCameraFilterPass(5);
u32 r5 = x34_ + x38_; u32 r5 = x34_ + x38_;
u32 r8 = r5 + x3c_; u32 r8 = r5 + x3c_;
u32 r31 = r8 + x40_; u32 r31 = r8 + x40_;

View File

@ -835,7 +835,7 @@ void CScriptSpecialFunction::ThinkChaffTarget(float dt, CStateManager& mgr) {
const zeus::CAABox box(5.f - GetTranslation(), 5.f + GetTranslation()); const zeus::CAABox box(5.f - GetTranslation(), 5.f + GetTranslation());
EntityList nearList; EntityList nearList;
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr); mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr);
CCameraFilterPassPoly& filter = mgr.GetCameraFilterPass(7); auto& filter = mgr.GetCameraFilterPass(7);
for (const auto& uid : nearList) { for (const auto& uid : nearList) {
if (const TCastToPtr<CEnergyProjectile> proj = mgr.ObjectById(uid)) { if (const TCastToPtr<CEnergyProjectile> proj = mgr.ObjectById(uid)) {