CRainSplashGenerator: Remove mutable specifier from m_renderer

We can just drop the const specifiers on relevant member functions to
get rid of the need for this.
This commit is contained in:
Lioncash 2020-04-09 21:40:46 -04:00
parent 2fadaf544d
commit cd0a3780c0
2 changed files with 19 additions and 15 deletions

View File

@ -22,7 +22,7 @@ CRainSplashGenerator::CRainSplashGenerator(const zeus::CVector3f& scale, u32 max
} BooTrace); } BooTrace);
} }
void CRainSplashGenerator::SSplashLine::Draw(float alpha, float dt, const zeus::CVector3f& pos) const { void CRainSplashGenerator::SSplashLine::Draw(float alpha, float dt, const zeus::CVector3f& pos) {
if (x0_t > 0.f) { if (x0_t > 0.f) {
float delta = dt * xc_speed; float delta = dt * xc_speed;
float vt = std::max(0.f, x0_t - delta * x15_length); float vt = std::max(0.f, x0_t - delta * x15_length);
@ -39,35 +39,39 @@ void CRainSplashGenerator::SSplashLine::Draw(float alpha, float dt, const zeus::
} }
} }
void CRainSplashGenerator::SRainSplash::Draw(float alpha, float dt, const zeus::CVector3f& pos) const { void CRainSplashGenerator::SRainSplash::Draw(float alpha, float dt, const zeus::CVector3f& pos) {
for (const SSplashLine& line : x0_lines) for (SSplashLine& line : x0_lines) {
line.Draw(alpha, dt, pos); line.Draw(alpha, dt, pos);
} }
}
void CRainSplashGenerator::DoDraw(const zeus::CTransform& xf) const { void CRainSplashGenerator::DoDraw(const zeus::CTransform& xf) {
SCOPED_GRAPHICS_DEBUG_GROUP("CRainSplashGenerator::DoDraw", zeus::skYellow); SCOPED_GRAPHICS_DEBUG_GROUP("CRainSplashGenerator::DoDraw", zeus::skYellow);
CGraphics::SetModelMatrix(xf); CGraphics::SetModelMatrix(xf);
if (x40_queueSize > 0) { if (x40_queueSize > 0) {
if (x38_queueTail <= x3c_queueHead) { if (x38_queueTail <= x3c_queueHead) {
for (size_t i = x3c_queueHead; i < x0_rainSplashes.size(); ++i) { for (size_t i = x3c_queueHead; i < x0_rainSplashes.size(); ++i) {
const SRainSplash& splash = x0_rainSplashes[i]; SRainSplash& splash = x0_rainSplashes[i];
splash.Draw(x30_alpha, x28_dt, splash.x64_pos); splash.Draw(x30_alpha, x28_dt, splash.x64_pos);
} }
for (size_t i = 0; i < x38_queueTail; ++i) { for (size_t i = 0; i < x38_queueTail; ++i) {
const SRainSplash& splash = x0_rainSplashes[i]; SRainSplash& splash = x0_rainSplashes[i];
splash.Draw(x30_alpha, x28_dt, splash.x64_pos); splash.Draw(x30_alpha, x28_dt, splash.x64_pos);
} }
} else { } else {
for (size_t i = x3c_queueHead; i < x38_queueTail; ++i) { for (size_t i = x3c_queueHead; i < x38_queueTail; ++i) {
const SRainSplash& splash = x0_rainSplashes[i]; SRainSplash& splash = x0_rainSplashes[i];
splash.Draw(x30_alpha, x28_dt, splash.x64_pos); splash.Draw(x30_alpha, x28_dt, splash.x64_pos);
} }
} }
} }
} }
void CRainSplashGenerator::Draw(const zeus::CTransform& xf) const { void CRainSplashGenerator::Draw(const zeus::CTransform& xf) {
if (x48_25_raining) if (!x48_25_raining) {
return;
}
DoDraw(xf); DoDraw(xf);
} }

View File

@ -23,10 +23,10 @@ class CRainSplashGenerator {
u8 x14_ = 3; u8 x14_ = 3;
u8 x15_length = 1; u8 x15_length = 1;
bool x16_active = true; // used to be one-bit bitfield bool x16_active = true; // used to be one-bit bitfield
mutable CLineRenderer m_renderer; CLineRenderer m_renderer;
explicit SSplashLine(boo::IGraphicsDataFactory::Context& ctx); explicit SSplashLine(boo::IGraphicsDataFactory::Context& ctx);
void Update(float dt, CStateManager& mgr); void Update(float dt, CStateManager& mgr);
void Draw(float alpha, float dt, const zeus::CVector3f& pos) const; void Draw(float alpha, float dt, const zeus::CVector3f& pos);
void SetActive() { x16_active = true; } void SetActive() { x16_active = true; }
}; };
struct SRainSplash { struct SRainSplash {
@ -40,7 +40,7 @@ class CRainSplashGenerator {
SRainSplash& operator=(SRainSplash&&) = default; SRainSplash& operator=(SRainSplash&&) = default;
void Update(float dt, CStateManager& mgr); void Update(float dt, CStateManager& mgr);
bool IsActive() const; bool IsActive() const;
void Draw(float alpha, float dt, const zeus::CVector3f& pos) const; void Draw(float alpha, float dt, const zeus::CVector3f& pos);
void SetPoint(const zeus::CVector3f& pos); void SetPoint(const zeus::CVector3f& pos);
}; };
std::vector<SRainSplash> x0_rainSplashes; std::vector<SRainSplash> x0_rainSplashes;
@ -60,7 +60,7 @@ class CRainSplashGenerator {
bool x48_25_raining : 1; bool x48_25_raining : 1;
void UpdateRainSplashRange(CStateManager& mgr, int start, int end, float dt); void UpdateRainSplashRange(CStateManager& mgr, int start, int end, float dt);
void UpdateRainSplashes(CStateManager& mgr, float magnitude, float dt); void UpdateRainSplashes(CStateManager& mgr, float magnitude, float dt);
void DoDraw(const zeus::CTransform& xf) const; void DoDraw(const zeus::CTransform& xf);
static u32 GetNextBestPt(u32 pt, const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn, CRandom16& rand, static u32 GetNextBestPt(u32 pt, const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn, CRandom16& rand,
float minZ); float minZ);
void AddPoint(const zeus::CVector3f& pos); void AddPoint(const zeus::CVector3f& pos);
@ -69,7 +69,7 @@ public:
CRainSplashGenerator(const zeus::CVector3f& scale, u32 maxSplashes, u32 genRate, float minZ, float alpha); CRainSplashGenerator(const zeus::CVector3f& scale, u32 maxSplashes, u32 genRate, float minZ, float alpha);
void Update(float dt, CStateManager& mgr); void Update(float dt, CStateManager& mgr);
void GeneratePoints(const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn); void GeneratePoints(const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn);
void Draw(const zeus::CTransform& xf) const; void Draw(const zeus::CTransform& xf);
bool IsRaining() const { return x48_25_raining; } bool IsRaining() const { return x48_25_raining; }
}; };