Fix CFaceplateDecoration::Draw build

This commit is contained in:
Henrique Gemignani Passos Lima 2022-11-03 12:51:20 +02:00
parent 3fe752b50d
commit b9f422978b
No known key found for this signature in database
GPG Key ID: E224F951761145F8
2 changed files with 9 additions and 3 deletions

View File

@ -35,7 +35,7 @@ public:
}
void Get(float& r, float& g, float& b, float& a) const;
void Get(float& r, float& g, float& b) const;
// TODO check
// TODO check. Maybe this calls SetAlpha(uchar)?
void SetAlpha(float a) { mA = CCast::ToUint8(a * 255.f); }
void SetAlpha(uchar a) { mRgba = (mRgba & ~0xff) | a; }

View File

@ -24,14 +24,20 @@ void CFaceplateDecoration::Update(float dt, const CStateManager& stateMgr) {
}
}
// fake but close
static inline CColor ChangeAlpha(CColor color, float alpha) {
color.SetAlpha(CCast::ToUint8(alpha * 255.f));
return color;
}
void CFaceplateDecoration::Draw(const CStateManager& stateMgr) const {
if (x4_tex.valid() && x4_tex->IsLoaded()) {
CTexture* texture = TToken< CTexture >(*x4_tex).GetT();
float alpha = stateMgr.GetPlayer()->GetVisorSteam().GetAlpha();
if (!close_enough(alpha, 0.f)) {
CColor color(CColor::White(), alpha);
CCameraFilterPass::DrawFilter(CCameraFilterPass::kFT_Blend,
CCameraFilterPass::kFS_FullscreenQuarters, color, texture, 1.f);
CCameraFilterPass::kFS_FullscreenQuarters,
ChangeAlpha(CColor::White(), alpha), texture, 1.f);
}
}
}