mirror of https://github.com/AxioDL/metaforce.git
Begin transitioning CCameraFilterPass
This commit is contained in:
parent
7cf863983a
commit
9bc0e7f2e6
|
@ -600,7 +600,7 @@ void CStateManager::DrawDebugStuff() const {
|
|||
|
||||
void CStateManager::RenderCamerasAndAreaLights() {
|
||||
x870_cameraManager->RenderCameras(*this);
|
||||
for (const CCameraFilterPassPoly& filter : xb84_camFilterPasses) {
|
||||
for (auto& filter : xb84_camFilterPasses) {
|
||||
filter.Draw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,8 +170,8 @@ private:
|
|||
CFinalInput xb54_finalInput;
|
||||
|
||||
static constexpr size_t numCameraPasses = 9;
|
||||
std::array<CCameraFilterPassPoly, numCameraPasses> xb84_camFilterPasses; // size: 0x2c
|
||||
std::array<CCameraBlurPass, numCameraPasses> xd14_camBlurPasses; // size: 0x34
|
||||
std::array<CCameraFilterPass, numCameraPasses> xb84_camFilterPasses; // size: 0x2c
|
||||
std::array<CCameraBlurPass, numCameraPasses> xd14_camBlurPasses; // size: 0x34
|
||||
|
||||
s32 xeec_hintIdx = -1;
|
||||
u32 xef0_hintPeriods = 0;
|
||||
|
@ -385,8 +385,8 @@ public:
|
|||
void ClearActiveRandom() { x900_activeRandom = nullptr; }
|
||||
CRumbleManager& GetRumbleManager() { return *x88c_rumbleManager; }
|
||||
const CRumbleManager& GetRumbleManager() const { return *x88c_rumbleManager; }
|
||||
CCameraFilterPassPoly& GetCameraFilterPass(int idx) { return xb84_camFilterPasses[idx]; }
|
||||
const CCameraFilterPassPoly& GetCameraFilterPass(int idx) const { return xb84_camFilterPasses[idx]; }
|
||||
CCameraFilterPass& GetCameraFilterPass(int idx) { return xb84_camFilterPasses[idx]; }
|
||||
const CCameraFilterPass& GetCameraFilterPass(int idx) const { return xb84_camFilterPasses[idx]; }
|
||||
CCameraBlurPass& GetCameraBlurPass(int idx) { return xd14_camBlurPasses[idx]; }
|
||||
const CCameraBlurPass& GetCameraBlurPass(int idx) const { return xd14_camBlurPasses[idx]; }
|
||||
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
#include "Runtime/Graphics/Shaders/CRandomStaticFilter.hpp"
|
||||
#include "Runtime/Graphics/Shaders/CScanLinesFilter.hpp"
|
||||
#include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp"
|
||||
#include "Runtime/Graphics/CGX.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <zeus/CColor.hpp>
|
||||
|
||||
namespace metaforce {
|
||||
|
||||
template <class S>
|
||||
void CCameraFilterPass<S>::Update(float dt) {
|
||||
void CCameraFilterPass::Update(float dt) {
|
||||
if (x10_remTime <= 0.f)
|
||||
return;
|
||||
|
||||
|
@ -31,26 +31,16 @@ void CCameraFilterPass<S>::Update(float dt) {
|
|||
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<S>::SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color,
|
||||
CAssetId txtr) {
|
||||
void CCameraFilterPass::SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color,
|
||||
CAssetId txtr) {
|
||||
if (time == 0.f) {
|
||||
xc_duration = 0.f;
|
||||
x10_remTime = 0.f;
|
||||
|
||||
if (txtr.IsValid())
|
||||
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;
|
||||
x0_curType = type;
|
||||
|
@ -90,28 +80,18 @@ void CCameraFilterPass<S>::SetFilter(EFilterType type, EFilterShape shape, float
|
|||
}
|
||||
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<S>::DisableFilter(float time) {
|
||||
void CCameraFilterPass::DisableFilter(float time) {
|
||||
SetFilter(EFilterType::Passthru, x8_shape, time, zeus::skWhite, {});
|
||||
}
|
||||
|
||||
template <class S>
|
||||
void CCameraFilterPass<S>::Draw() {
|
||||
if (!m_shader) {
|
||||
return;
|
||||
}
|
||||
m_shader->DrawFilter(x8_shape, x18_curColor, GetT(x4_nextType == EFilterType::Passthru));
|
||||
void CCameraFilterPass::Draw() {
|
||||
DrawFilter(x0_curType, x8_shape, x18_curColor, x24_texObj.GetObj(), GetT(x4_nextType == EFilterType::Passthru));
|
||||
}
|
||||
|
||||
float CCameraFilterPassBase::GetT(bool invert) const {
|
||||
float CCameraFilterPass::GetT(bool invert) const {
|
||||
float tmp;
|
||||
if (xc_duration == 0.f)
|
||||
tmp = 1.f;
|
||||
|
@ -122,41 +102,150 @@ float CCameraFilterPassBase::GetT(bool invert) const {
|
|||
return tmp;
|
||||
}
|
||||
|
||||
void CCameraFilterPassPoly::SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color,
|
||||
CAssetId txtr) {
|
||||
if (!m_filter || m_shape != shape) {
|
||||
m_shape = shape;
|
||||
switch (shape) {
|
||||
case EFilterShape::Fullscreen:
|
||||
case EFilterShape::FullscreenHalvesLeftRight:
|
||||
case EFilterShape::FullscreenHalvesTopBottom:
|
||||
case EFilterShape::FullscreenQuarters:
|
||||
if (txtr.IsValid())
|
||||
m_filter = std::make_unique<CCameraFilterPass<CTexturedQuadFilterAlpha>>();
|
||||
else
|
||||
m_filter = std::make_unique<CCameraFilterPass<CColoredQuadFilter>>();
|
||||
break;
|
||||
case EFilterShape::CinemaBars:
|
||||
m_filter = std::make_unique<CCameraFilterPass<CWideScreenFilter>>();
|
||||
break;
|
||||
case EFilterShape::ScanLinesEven:
|
||||
m_filter = std::make_unique<CCameraFilterPass<CScanLinesFilterEven>>();
|
||||
break;
|
||||
case EFilterShape::ScanLinesOdd:
|
||||
m_filter = std::make_unique<CCameraFilterPass<CScanLinesFilterOdd>>();
|
||||
break;
|
||||
case EFilterShape::RandomStatic:
|
||||
m_filter = std::make_unique<CCameraFilterPass<CRandomStaticFilter>>();
|
||||
break;
|
||||
case EFilterShape::CookieCutterDepthRandomStatic:
|
||||
m_filter = std::make_unique<CCameraFilterPass<CCookieCutterDepthRandomStaticFilter>>();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
void CCameraFilterPass::DrawFilter(EFilterType type, EFilterShape shape, const zeus::CColor& color, CTexture* tex,
|
||||
float lod) {
|
||||
switch (type) {
|
||||
case EFilterType::Multiply:
|
||||
g_Renderer->SetBlendMode_ColorMultiply();
|
||||
break;
|
||||
case EFilterType::Invert:
|
||||
g_Renderer->SetBlendMode_InvertDst();
|
||||
break;
|
||||
case EFilterType::Add:
|
||||
g_Renderer->SetBlendMode_AdditiveAlpha();
|
||||
break;
|
||||
case EFilterType::Subtract:
|
||||
CGX::SetBlendMode(GX::BM_SUBTRACT, GX::BL_ONE, GX::BL_ONE, GX::LO_CLEAR);
|
||||
break;
|
||||
case EFilterType::Blend:
|
||||
g_Renderer->SetBlendMode_AlphaBlended();
|
||||
break;
|
||||
case EFilterType::Widescreen:
|
||||
return;
|
||||
case EFilterType::SceneAdd:
|
||||
g_Renderer->SetBlendMode_AdditiveDestColor();
|
||||
break;
|
||||
case EFilterType::NoColor:
|
||||
g_Renderer->SetBlendMode_NoColorWrite();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (m_filter)
|
||||
m_filter->SetFilter(type, shape, time, color, txtr);
|
||||
DrawFilterShape(shape, color, tex, lod);
|
||||
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) {
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
#include <optional>
|
||||
|
||||
#include "Runtime/CToken.hpp"
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
#include "Runtime/Graphics/CTexture.hpp"
|
||||
#include "Runtime/Graphics/Shaders/CCameraBlurFilter.hpp"
|
||||
#include "Runtime/Graphics/Shaders/CXRayBlurFilter.hpp"
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
|
||||
#include <zeus/CColor.hpp>
|
||||
|
||||
|
@ -37,8 +37,8 @@ enum class EFilterShape {
|
|||
CookieCutterDepthRandomStatic
|
||||
};
|
||||
|
||||
class CCameraFilterPassBase {
|
||||
protected:
|
||||
class CCameraFilterPass {
|
||||
private:
|
||||
EFilterType x0_curType = EFilterType::Passthru;
|
||||
EFilterType x4_nextType = EFilterType::Passthru;
|
||||
EFilterShape x8_shape = EFilterShape::Fullscreen;
|
||||
|
@ -49,46 +49,24 @@ protected:
|
|||
zeus::CColor x1c_nextColor;
|
||||
CAssetId x20_nextTxtr;
|
||||
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:
|
||||
virtual ~CCameraFilterPassBase() = default;
|
||||
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 Update(float dt);
|
||||
void SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color, CAssetId txtr);
|
||||
void DisableFilter(float time) {
|
||||
if (m_filter)
|
||||
m_filter->DisableFilter(time);
|
||||
}
|
||||
void Draw() const {
|
||||
if (m_filter)
|
||||
m_filter->Draw();
|
||||
}
|
||||
void DisableFilter(float time);
|
||||
void Draw();
|
||||
|
||||
static void DrawFilter(EFilterType type, EFilterShape shape, const zeus::CColor& color, CTexture* tex, float lod);
|
||||
};
|
||||
|
||||
enum class EBlurType { NoBlur, LoBlur, HiBlur, Xray };
|
||||
|
|
|
@ -695,8 +695,23 @@ void CCubeRenderer::SetDebugOption(IRenderer::EDebugOption option, s32 value) {
|
|||
}
|
||||
|
||||
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;
|
||||
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); }
|
||||
|
@ -711,9 +726,9 @@ void CCubeRenderer::BeginTriangleFan(s32 nverts) { BeginPrimitive(EPrimitiveType
|
|||
|
||||
void CCubeRenderer::PrimVertex(const zeus::CVector3f& vertex) {
|
||||
--x18_primVertCount;
|
||||
CGraphics::StreamColor(x2e0_primColor);
|
||||
CGraphics::StreamNormal(x2e4_primNormal);
|
||||
CGraphics::StreamVertex(vertex);
|
||||
GXPosition3f32(vertex);
|
||||
GXNormal3f32(x2e4_primNormal);
|
||||
GXColor4f32(x2e0_primColor);
|
||||
}
|
||||
|
||||
void CCubeRenderer::PrimNormal(const zeus::CVector3f& normal) { x2e4_primNormal = normal; }
|
||||
|
@ -726,7 +741,7 @@ void CCubeRenderer::EndPrimitive() {
|
|||
while (x18_primVertCount > 0) {
|
||||
PrimVertex(zeus::skZero3f);
|
||||
}
|
||||
CGraphics::StreamEnd();
|
||||
CGX::End();
|
||||
}
|
||||
|
||||
void CCubeRenderer::SetAmbientColor(const zeus::CColor& color) { CGraphics::SetAmbientColor(color); }
|
||||
|
|
|
@ -127,8 +127,6 @@ CIOWin::EMessageReturn CCredits::Update(float dt, CArchitectureQueue& queue) {
|
|||
}
|
||||
[[fallthrough]];
|
||||
case 3: {
|
||||
m_videoFilter.Update(dt);
|
||||
m_textFilter.Update(dt);
|
||||
// if (!x28_->PumpIndexLoad())
|
||||
// break;
|
||||
x28_->Update(dt);
|
||||
|
@ -212,8 +210,7 @@ void CCredits::DrawVideo() {
|
|||
alpha = zeus::clamp(0.f, alpha, 1.f);
|
||||
zeus::CColor filterCol = zeus::skBlack;
|
||||
filterCol.a() = alpha;
|
||||
m_videoFilter.SetFilter(EFilterType::Blend, EFilterShape::Fullscreen, 1.f, filterCol, {});
|
||||
m_videoFilter.Draw();
|
||||
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, filterCol, nullptr, 1.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -221,8 +218,7 @@ void CCredits::DrawVideo() {
|
|||
void CCredits::DrawText() {
|
||||
float width = 896.f * CGraphics::GetViewportAspect();
|
||||
CGraphics::SetOrtho(0.f, width, 896.f, 0.f, -4096.f, 4096.f);
|
||||
auto region =
|
||||
std::make_pair<zeus::CVector2f, zeus::CVector2f>(zeus::CVector2f{0.f, 0.f}, zeus::CVector2f{width, 896.f});
|
||||
auto region = std::make_pair(zeus::CVector2f{0.f, 0.f}, zeus::CVector2f{width, 896.f});
|
||||
CGraphics::SetViewPointMatrix(zeus::CTransform());
|
||||
CGraphics::SetModelMatrix(zeus::CTransform::Translate((width - 1280.f) / 2.f, 0.f, 896.f));
|
||||
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});
|
||||
}
|
||||
}
|
||||
m_textFilter.SetFilter(EFilterType::Multiply, EFilterShape::CinemaBars, 1.f, zeus::skBlack, {});
|
||||
m_textFilter.Draw();
|
||||
CCameraFilterPass::DrawFilter(EFilterType::Multiply, EFilterShape::CinemaBars, zeus::skBlack, nullptr, 1.f);
|
||||
}
|
||||
|
||||
void CCredits::DrawText(CGuiTextSupport& text, const zeus::CVector3f& translation) {
|
||||
|
|
|
@ -37,9 +37,6 @@ class CCredits : public CIOWin {
|
|||
void DrawText();
|
||||
static void DrawText(CGuiTextSupport&, const zeus::CVector3f& translation);
|
||||
|
||||
CCameraFilterPassPoly m_videoFilter;
|
||||
CCameraFilterPassPoly m_textFilter;
|
||||
|
||||
public:
|
||||
CCredits();
|
||||
EMessageReturn OnMessage(const CArchitectureMessage&, CArchitectureQueue&) override;
|
||||
|
|
|
@ -69,7 +69,7 @@ private:
|
|||
std::vector<TLockedToken<CDependencyGroup>> xc8_inGameGuiDGRPs;
|
||||
std::vector<u32> xd8_;
|
||||
std::vector<CToken> xe8_pauseResources;
|
||||
CCameraFilterPass<CColoredQuadFilter> xf8_camFilter;
|
||||
CCameraFilterPass xf8_camFilter;
|
||||
CAssetId x124_pauseGameHudMessage;
|
||||
float x128_pauseGameHudTime = 0.f;
|
||||
std::list<CToken> x12c_;
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
namespace metaforce::MP1 {
|
||||
|
||||
CPlayerVisor::CPlayerVisor(CStateManager&) {
|
||||
// TODO
|
||||
// : x108_newScanPane(EFilterType::Blend, CGraphics::g_SpareTexture.get())
|
||||
xcc_scanFrameCorner = g_SimplePool->GetObj("CMDL_ScanFrameCorner");
|
||||
xd8_scanFrameCenterSide = g_SimplePool->GetObj("CMDL_ScanFrameCenterSide");
|
||||
xe4_scanFrameCenterTop = g_SimplePool->GetObj("CMDL_ScanFrameCenterTop");
|
||||
|
@ -289,37 +287,33 @@ CPlayerVisor::EScanWindowState CPlayerVisor::GetDesiredScanWindowState(const CSt
|
|||
}
|
||||
|
||||
void CPlayerVisor::LockUnlockAssets() {
|
||||
#if 0
|
||||
if (x1c_curVisor == CPlayerState::EPlayerVisor::Scan)
|
||||
x120_assetLockCountdown = 2;
|
||||
else if (x120_assetLockCountdown > 0)
|
||||
--x120_assetLockCountdown;
|
||||
if (x1c_curVisor == CPlayerState::EPlayerVisor::Scan) {
|
||||
x120_assetLockCountdown = 2;
|
||||
} else if (x120_assetLockCountdown > 0) {
|
||||
--x120_assetLockCountdown;
|
||||
}
|
||||
|
||||
if (x120_assetLockCountdown > 0)
|
||||
{
|
||||
xcc_scanFrameCorner.Lock();
|
||||
xd8_scanFrameCenterSide.Lock();
|
||||
xe4_scanFrameCenterTop.Lock();
|
||||
xf0_scanFrameStretchSide.Lock();
|
||||
xfc_scanFrameStretchTop.Lock();
|
||||
//x108_newScanPane.Lock();
|
||||
x114_scanShield.Lock();
|
||||
x124_scanIconNoncritical.Lock();
|
||||
x130_scanIconCritical.Lock();
|
||||
}
|
||||
else
|
||||
{
|
||||
xcc_scanFrameCorner.Unlock();
|
||||
xd8_scanFrameCenterSide.Unlock();
|
||||
xe4_scanFrameCenterTop.Unlock();
|
||||
xf0_scanFrameStretchSide.Unlock();
|
||||
xfc_scanFrameStretchTop.Unlock();
|
||||
//x108_newScanPane.Unlock();
|
||||
x114_scanShield.Unlock();
|
||||
x124_scanIconNoncritical.Unlock();
|
||||
x130_scanIconCritical.Unlock();
|
||||
}
|
||||
#endif
|
||||
if (x120_assetLockCountdown > 0) {
|
||||
xcc_scanFrameCorner.Lock();
|
||||
xd8_scanFrameCenterSide.Lock();
|
||||
xe4_scanFrameCenterTop.Lock();
|
||||
xf0_scanFrameStretchSide.Lock();
|
||||
xfc_scanFrameStretchTop.Lock();
|
||||
x108_newScanPane.Lock();
|
||||
x114_scanShield.Lock();
|
||||
x124_scanIconNoncritical.Lock();
|
||||
x130_scanIconCritical.Lock();
|
||||
} else {
|
||||
xcc_scanFrameCorner.Unlock();
|
||||
xd8_scanFrameCenterSide.Unlock();
|
||||
xe4_scanFrameCenterTop.Unlock();
|
||||
xf0_scanFrameStretchSide.Unlock();
|
||||
xfc_scanFrameStretchTop.Unlock();
|
||||
x108_newScanPane.Unlock();
|
||||
x114_scanShield.Unlock();
|
||||
x124_scanIconNoncritical.Unlock();
|
||||
x130_scanIconCritical.Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, CTargetingManager* tgtMgr) {
|
||||
|
@ -522,8 +516,8 @@ void CPlayerVisor::BeginTransitionIn(const CStateManager&) {
|
|||
switch (x1c_curVisor) {
|
||||
case CPlayerState::EPlayerVisor::XRay:
|
||||
x90_xrayBlur.SetBlur(EBlurType::Xray, 0.f, 0.f);
|
||||
// xc4_vpScaleX = 0.9f;
|
||||
// xc8_vpScaleY = 0.9f;
|
||||
xc4_vpScaleX = 0.9f;
|
||||
xc8_vpScaleY = 0.9f;
|
||||
CSfxManager::SfxStart(SFXui_into_visor, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
|
||||
break;
|
||||
case CPlayerState::EPlayerVisor::Scan:
|
||||
|
@ -542,8 +536,8 @@ void CPlayerVisor::FinishTransitionOut(const CStateManager&) {
|
|||
switch (x1c_curVisor) {
|
||||
case CPlayerState::EPlayerVisor::XRay:
|
||||
x90_xrayBlur.DisableBlur(0.f);
|
||||
// xc4_vpScaleX = 1.f;
|
||||
// xc8_vpScaleY = 1.f;
|
||||
xc4_vpScaleX = 1.f;
|
||||
xc8_vpScaleY = 1.f;
|
||||
break;
|
||||
case CPlayerState::EPlayerVisor::Scan:
|
||||
x64_scanDim.DisableFilter(0.f);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "Runtime/CPlayerState.hpp"
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
#include "Runtime/rstl.hpp"
|
||||
#include "Runtime/Audio/CSfxManager.hpp"
|
||||
#include "Runtime/CPlayerState.hpp"
|
||||
#include "Runtime/Camera/CCameraFilter.hpp"
|
||||
#include "Runtime/Graphics/CModel.hpp"
|
||||
#include "Runtime/Graphics/Shaders/CColoredQuadFilter.hpp"
|
||||
#include "Runtime/Graphics/Shaders/CTexturedQuadFilter.hpp"
|
||||
#include "Runtime/RetroTypes.hpp"
|
||||
#include "Runtime/rstl.hpp"
|
||||
|
||||
#include <zeus/CVector2f.hpp>
|
||||
|
||||
|
@ -45,21 +45,20 @@ class CPlayerVisor {
|
|||
float x58_scanMagInterp = 1.f;
|
||||
CSfxHandle x5c_visorLoopSfx;
|
||||
CSfxHandle x60_scanningLoopSfx;
|
||||
CCameraFilterPass<CColoredQuadFilter> x64_scanDim;
|
||||
CCameraFilterPass x64_scanDim;
|
||||
CCameraBlurPass x90_xrayBlur;
|
||||
float xc4_vpScaleX = 1.f;
|
||||
float xc8_vpScaleY = 1.f;
|
||||
TLockedToken<CModel> xcc_scanFrameCorner;
|
||||
TLockedToken<CModel> xd8_scanFrameCenterSide;
|
||||
TLockedToken<CModel> xe4_scanFrameCenterTop;
|
||||
TLockedToken<CModel> xf0_scanFrameStretchSide;
|
||||
TLockedToken<CModel> xfc_scanFrameStretchTop;
|
||||
TCachedToken<CModel> x108_newScanPane;
|
||||
// CTexturedQuadFilter x108_newScanPane;
|
||||
TLockedToken<CModel> x114_scanShield;
|
||||
TCachedToken<CModel> xcc_scanFrameCorner;
|
||||
TCachedToken<CModel> xd8_scanFrameCenterSide;
|
||||
TCachedToken<CModel> xe4_scanFrameCenterTop;
|
||||
TCachedToken<CModel> xf0_scanFrameStretchSide;
|
||||
TCachedToken<CModel> xfc_scanFrameStretchTop;
|
||||
TCachedToken<CModel> x108_newScanPane;
|
||||
TCachedToken<CModel> x114_scanShield;
|
||||
int x120_assetLockCountdown = 0;
|
||||
TLockedToken<CModel> x124_scanIconNoncritical;
|
||||
TLockedToken<CModel> x130_scanIconCritical;
|
||||
TCachedToken<CModel> x124_scanIconNoncritical;
|
||||
TCachedToken<CModel> x130_scanIconCritical;
|
||||
rstl::reserved_vector<SScanTarget, 64> x13c_scanTargets;
|
||||
TLockedToken<CTexture> x540_xrayPalette;
|
||||
float x54c_scanFrameColorInterp = 0.f;
|
||||
|
|
|
@ -111,7 +111,7 @@ class CSamusHud {
|
|||
std::unique_ptr<CActorLights> x33c_lights;
|
||||
rstl::reserved_vector<SCachedHudLight, 3> x340_hudLights;
|
||||
CSfxHandle x3a4_damageSfx;
|
||||
CCameraFilterPass<CColoredQuadFilter> x3a8_camFilter;
|
||||
CCameraFilterPass x3a8_camFilter;
|
||||
CGuiLight* x3d4_damageLight = nullptr;
|
||||
std::vector<zeus::CTransform> x3d8_lightTransforms;
|
||||
float x3e8_damageTIme = 0.f;
|
||||
|
@ -138,7 +138,7 @@ class CSamusHud {
|
|||
float x510_staticInterp = 0.f;
|
||||
float x514_staticCycleTimerHi = 0.f;
|
||||
float x518_staticCycleTimerLo = 0.f;
|
||||
CCameraFilterPass<CRandomStaticFilter> x51c_camFilter2;
|
||||
CCameraFilterPass x51c_camFilter2;
|
||||
CHUDMemoParms x548_hudMemoParms;
|
||||
TLockedToken<CStringTable> x550_hudMemoString;
|
||||
u32 x554_hudMemoIdx = 0;
|
||||
|
|
|
@ -23,7 +23,7 @@ CFireFlea::CDeathCameraEffect::CDeathCameraEffect(TUniqueId uid, TAreaId areaId,
|
|||
void CFireFlea::CDeathCameraEffect::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||
|
||||
void CFireFlea::CDeathCameraEffect::PreThink(float dt, CStateManager& mgr) {
|
||||
CCameraFilterPassPoly& filterPass = mgr.GetCameraFilterPass(5);
|
||||
auto& filterPass = mgr.GetCameraFilterPass(5);
|
||||
u32 r5 = x34_ + x38_;
|
||||
u32 r8 = r5 + x3c_;
|
||||
u32 r31 = r8 + x40_;
|
||||
|
|
|
@ -835,7 +835,7 @@ void CScriptSpecialFunction::ThinkChaffTarget(float dt, CStateManager& mgr) {
|
|||
const zeus::CAABox box(5.f - GetTranslation(), 5.f + GetTranslation());
|
||||
EntityList nearList;
|
||||
mgr.BuildNearList(nearList, box, CMaterialFilter::MakeInclude({EMaterialTypes::Projectile}), nullptr);
|
||||
CCameraFilterPassPoly& filter = mgr.GetCameraFilterPass(7);
|
||||
auto& filter = mgr.GetCameraFilterPass(7);
|
||||
|
||||
for (const auto& uid : nearList) {
|
||||
if (const TCastToPtr<CEnergyProjectile> proj = mgr.ObjectById(uid)) {
|
||||
|
|
Loading…
Reference in New Issue