mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 22:50:05 +00:00
Use floating point pixels for modulate color to allow lightening
This commit is contained in:
parent
9c8d851cf3
commit
87d2f84bde
4 changed files with 60 additions and 24 deletions
|
|
@ -34,13 +34,13 @@ static constexpr std::size_t kTextureBufferLength =
|
|||
|
||||
struct IconDrawItem
|
||||
{
|
||||
boost::gil::rgba8_pixel_t modulate_ {255, 255, 255, 255};
|
||||
double x_ {};
|
||||
double y_ {};
|
||||
units::degrees<double> angle_ {};
|
||||
std::string iconSheet_ {};
|
||||
std::size_t iconIndex_ {};
|
||||
std::string hoverText_ {};
|
||||
boost::gil::rgba32f_pixel_t modulate_ {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
double x_ {};
|
||||
double y_ {};
|
||||
units::degrees<double> angle_ {};
|
||||
std::string iconSheet_ {};
|
||||
std::size_t iconIndex_ {};
|
||||
std::string hoverText_ {};
|
||||
};
|
||||
|
||||
class Icons::Impl
|
||||
|
|
@ -314,6 +314,15 @@ void Icons::SetIconAngle(const std::shared_ptr<IconDrawItem>& di,
|
|||
|
||||
void Icons::SetIconModulate(const std::shared_ptr<IconDrawItem>& di,
|
||||
boost::gil::rgba8_pixel_t modulate)
|
||||
{
|
||||
di->modulate_ = {modulate[0] / 255.0f,
|
||||
modulate[1] / 255.0f,
|
||||
modulate[2] / 255.0f,
|
||||
modulate[3] / 255.0f};
|
||||
}
|
||||
|
||||
void Icons::SetIconModulate(const std::shared_ptr<IconDrawItem>& di,
|
||||
boost::gil::rgba32f_pixel_t modulate)
|
||||
{
|
||||
di->modulate_ = modulate;
|
||||
}
|
||||
|
|
@ -399,10 +408,10 @@ void Icons::Impl::UpdateBuffers()
|
|||
const float a = angle.value();
|
||||
|
||||
// Modulate color
|
||||
const float mc0 = di->modulate_[0] / 255.0f;
|
||||
const float mc1 = di->modulate_[1] / 255.0f;
|
||||
const float mc2 = di->modulate_[2] / 255.0f;
|
||||
const float mc3 = di->modulate_[3] / 255.0f;
|
||||
const float mc0 = di->modulate_[0];
|
||||
const float mc1 = di->modulate_[1];
|
||||
const float mc2 = di->modulate_[2];
|
||||
const float mc3 = di->modulate_[3];
|
||||
|
||||
newIconBuffer_.insert(newIconBuffer_.end(),
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue