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);
}
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) {
float delta = dt * xc_speed;
float vt = std::max(0.f, x0_t - delta * x15_length);
@ -39,36 +39,40 @@ void CRainSplashGenerator::SSplashLine::Draw(float alpha, float dt, const zeus::
}
}
void CRainSplashGenerator::SRainSplash::Draw(float alpha, float dt, const zeus::CVector3f& pos) const {
for (const SSplashLine& line : x0_lines)
void CRainSplashGenerator::SRainSplash::Draw(float alpha, float dt, const zeus::CVector3f& pos) {
for (SSplashLine& line : x0_lines) {
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);
CGraphics::SetModelMatrix(xf);
if (x40_queueSize > 0) {
if (x38_queueTail <= x3c_queueHead) {
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);
}
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);
}
} else {
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);
}
}
}
}
void CRainSplashGenerator::Draw(const zeus::CTransform& xf) const {
if (x48_25_raining)
DoDraw(xf);
void CRainSplashGenerator::Draw(const zeus::CTransform& xf) {
if (!x48_25_raining) {
return;
}
DoDraw(xf);
}
CRainSplashGenerator::SSplashLine::SSplashLine(boo::IGraphicsDataFactory::Context& ctx)

View File

@ -23,10 +23,10 @@ class CRainSplashGenerator {
u8 x14_ = 3;
u8 x15_length = 1;
bool x16_active = true; // used to be one-bit bitfield
mutable CLineRenderer m_renderer;
CLineRenderer m_renderer;
explicit SSplashLine(boo::IGraphicsDataFactory::Context& ctx);
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; }
};
struct SRainSplash {
@ -40,7 +40,7 @@ class CRainSplashGenerator {
SRainSplash& operator=(SRainSplash&&) = default;
void Update(float dt, CStateManager& mgr);
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);
};
std::vector<SRainSplash> x0_rainSplashes;
@ -60,7 +60,7 @@ class CRainSplashGenerator {
bool x48_25_raining : 1;
void UpdateRainSplashRange(CStateManager& mgr, int start, int end, 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,
float minZ);
void AddPoint(const zeus::CVector3f& pos);
@ -69,7 +69,7 @@ public:
CRainSplashGenerator(const zeus::CVector3f& scale, u32 maxSplashes, u32 genRate, float minZ, float alpha);
void Update(float dt, CStateManager& mgr);
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; }
};