2018-10-06 20:42:33 -07:00
|
|
|
#pragma once
|
2016-04-16 19:50:45 -07:00
|
|
|
|
2019-09-27 19:53:03 -07:00
|
|
|
#include <memory>
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
#include "Runtime/CToken.hpp"
|
2020-04-19 18:09:30 -07:00
|
|
|
#include "Runtime/Graphics/CTexture.hpp"
|
2019-09-27 19:53:03 -07:00
|
|
|
#include "Runtime/Graphics/Shaders/CCameraBlurFilter.hpp"
|
|
|
|
#include "Runtime/Graphics/Shaders/CXRayBlurFilter.hpp"
|
2022-03-22 22:35:13 -07:00
|
|
|
#include "Runtime/RetroTypes.hpp"
|
2019-09-27 19:53:03 -07:00
|
|
|
|
|
|
|
#include <zeus/CColor.hpp>
|
2016-04-16 19:50:45 -07:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
namespace metaforce {
|
2018-12-07 21:30:43 -08:00
|
|
|
enum class EFilterType {
|
|
|
|
Passthru,
|
|
|
|
Multiply,
|
|
|
|
Invert,
|
|
|
|
Add,
|
|
|
|
Subtract,
|
|
|
|
Blend,
|
|
|
|
Widescreen,
|
|
|
|
SceneAdd,
|
|
|
|
NoColor,
|
|
|
|
InvDstMultiply
|
2017-05-31 22:34:24 -07:00
|
|
|
};
|
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
enum class EFilterShape {
|
|
|
|
Fullscreen,
|
|
|
|
FullscreenHalvesLeftRight,
|
|
|
|
FullscreenHalvesTopBottom,
|
|
|
|
FullscreenQuarters,
|
|
|
|
CinemaBars,
|
|
|
|
ScanLinesEven,
|
|
|
|
ScanLinesOdd,
|
|
|
|
RandomStatic,
|
|
|
|
CookieCutterDepthRandomStatic
|
2017-05-31 22:34:24 -07:00
|
|
|
};
|
|
|
|
|
2022-03-22 22:35:13 -07:00
|
|
|
class CCameraFilterPass {
|
|
|
|
private:
|
2018-12-07 21:30:43 -08:00
|
|
|
EFilterType x0_curType = EFilterType::Passthru;
|
|
|
|
EFilterType x4_nextType = EFilterType::Passthru;
|
|
|
|
EFilterShape x8_shape = EFilterShape::Fullscreen;
|
|
|
|
float xc_duration = 0.f;
|
|
|
|
float x10_remTime = 0.f;
|
|
|
|
zeus::CColor x14_prevColor;
|
|
|
|
zeus::CColor x18_curColor;
|
|
|
|
zeus::CColor x1c_nextColor;
|
|
|
|
CAssetId x20_nextTxtr;
|
|
|
|
TLockedToken<CTexture> x24_texObj; // Used to be auto_ptr
|
2017-05-31 22:34:24 -07:00
|
|
|
|
2022-03-22 22:35:13 -07:00
|
|
|
[[nodiscard]] float GetT(bool invert) const;
|
2018-12-07 21:30:43 -08:00
|
|
|
|
2022-03-22 22:35:13 -07:00
|
|
|
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);
|
2018-12-07 21:30:43 -08:00
|
|
|
|
2016-08-19 21:22:13 -07:00
|
|
|
public:
|
2022-03-22 22:35:13 -07:00
|
|
|
void Update(float dt);
|
2018-12-07 21:30:43 -08:00
|
|
|
void SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color, CAssetId txtr);
|
2022-03-22 22:35:13 -07:00
|
|
|
void DisableFilter(float time);
|
|
|
|
void Draw();
|
|
|
|
|
|
|
|
static void DrawFilter(EFilterType type, EFilterShape shape, const zeus::CColor& color, CTexture* tex, float lod);
|
2017-05-31 22:34:24 -07:00
|
|
|
};
|
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
enum class EBlurType { NoBlur, LoBlur, HiBlur, Xray };
|
2017-05-31 22:34:24 -07:00
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
class CCameraBlurPass {
|
|
|
|
TLockedToken<CTexture> x0_paletteTex;
|
|
|
|
EBlurType x10_curType = EBlurType::NoBlur;
|
|
|
|
EBlurType x14_endType = EBlurType::NoBlur;
|
|
|
|
float x18_endValue = 0.f;
|
|
|
|
float x1c_curValue = 0.f;
|
|
|
|
float x20_startValue = 0.f;
|
|
|
|
float x24_totalTime = 0.f;
|
|
|
|
float x28_remainingTime = 0.f;
|
2022-05-19 00:57:30 -07:00
|
|
|
bool x2c_usePersistent = false;
|
|
|
|
bool x2d_noPersistentCopy = false;
|
|
|
|
u32 x30_persistentBuf = 0;
|
2017-11-16 00:05:10 -08:00
|
|
|
|
2017-03-23 22:30:16 -07:00
|
|
|
public:
|
2018-12-07 21:30:43 -08:00
|
|
|
void Draw(bool clearDepth = false);
|
|
|
|
void Update(float dt);
|
2022-05-19 00:57:30 -07:00
|
|
|
void SetBlur(EBlurType type, float amount, float duration, bool usePersistentFb);
|
2018-12-07 21:30:43 -08:00
|
|
|
void DisableBlur(float duration);
|
|
|
|
EBlurType GetCurrType() const { return x10_curType; }
|
2016-04-16 19:50:45 -07:00
|
|
|
};
|
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
} // namespace metaforce
|