Merge pull request #298 from lioncash/filter

CCameraFilter: Make Draw() non-const
This commit is contained in:
Luke Street 2020-04-09 10:46:37 -04:00 committed by GitHub
commit 529fced48a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -104,9 +104,11 @@ void CCameraFilterPass<S>::DisableFilter(float time) {
}
template <class S>
void CCameraFilterPass<S>::Draw() const {
if (m_shader)
const_cast<S&>(*m_shader).DrawFilter(x8_shape, x18_curColor, GetT(x4_nextType == EFilterType::Passthru));
void CCameraFilterPass<S>::Draw() {
if (!m_shader) {
return;
}
m_shader->DrawFilter(x8_shape, x18_curColor, GetT(x4_nextType == EFilterType::Passthru));
}
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,
CAssetId txtr) = 0;
virtual void DisableFilter(float time) = 0;
virtual void Draw() const = 0;
virtual void Draw() = 0;
};
template <class S>
@ -69,7 +69,7 @@ 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() const override;
void Draw() override;
};
class CCameraFilterPassPoly {
@ -107,8 +107,8 @@ class CCameraBlurPass {
// bool x2d_noPersistentCopy = false;
// u32 x30_persistentBuf = 0;
mutable std::optional<CCameraBlurFilter> m_shader;
mutable std::optional<CXRayBlurFilter> m_xrayShader;
std::optional<CCameraBlurFilter> m_shader;
std::optional<CXRayBlurFilter> m_xrayShader;
public:
void Draw(bool clearDepth = false);