CCameraFilter: Make Draw() non-const

Eliminates another usage of const_cast.
This commit is contained in:
Lioncash 2020-04-05 08:05:02 -04:00
parent b99122dae8
commit 6ba0641b79
2 changed files with 9 additions and 7 deletions

View File

@ -104,9 +104,11 @@ void CCameraFilterPass<S>::DisableFilter(float time) {
} }
template <class S> template <class S>
void CCameraFilterPass<S>::Draw() const { void CCameraFilterPass<S>::Draw() {
if (m_shader) if (!m_shader) {
const_cast<S&>(*m_shader).DrawFilter(x8_shape, x18_curColor, GetT(x4_nextType == EFilterType::Passthru)); return;
}
m_shader->DrawFilter(x8_shape, x18_curColor, GetT(x4_nextType == EFilterType::Passthru));
} }
float CCameraFilterPassBase::GetT(bool invert) const { float CCameraFilterPassBase::GetT(bool invert) const {

View File

@ -58,7 +58,7 @@ public:
virtual void SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color, virtual void SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color,
CAssetId txtr) = 0; CAssetId txtr) = 0;
virtual void DisableFilter(float time) = 0; virtual void DisableFilter(float time) = 0;
virtual void Draw() const = 0; virtual void Draw() = 0;
}; };
template <class S> template <class S>
@ -69,7 +69,7 @@ public:
void Update(float dt) override; void Update(float dt) override;
void SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color, CAssetId txtr) override; void SetFilter(EFilterType type, EFilterShape shape, float time, const zeus::CColor& color, CAssetId txtr) override;
void DisableFilter(float time) override; void DisableFilter(float time) override;
void Draw() const override; void Draw() override;
}; };
class CCameraFilterPassPoly { class CCameraFilterPassPoly {
@ -107,8 +107,8 @@ class CCameraBlurPass {
// bool x2d_noPersistentCopy = false; // bool x2d_noPersistentCopy = false;
// u32 x30_persistentBuf = 0; // u32 x30_persistentBuf = 0;
mutable std::optional<CCameraBlurFilter> m_shader; std::optional<CCameraBlurFilter> m_shader;
mutable std::optional<CXRayBlurFilter> m_xrayShader; std::optional<CXRayBlurFilter> m_xrayShader;
public: public:
void Draw(bool clearDepth = false); void Draw(bool clearDepth = false);