diff --git a/scwx-qt/source/scwx/qt/gl/draw/geo_icons.cpp b/scwx-qt/source/scwx/qt/gl/draw/geo_icons.cpp index 8eae57e9..1304ac22 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/geo_icons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/geo_icons.cpp @@ -41,15 +41,15 @@ struct GeoIconDrawItem std::chrono::sys_time startTime_ {}; std::chrono::sys_time endTime_ {}; - boost::gil::rgba8_pixel_t modulate_ {255, 255, 255, 255}; - double latitude_ {}; - double longitude_ {}; - double x_ {}; - double y_ {}; - units::degrees 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 latitude_ {}; + double longitude_ {}; + double x_ {}; + double y_ {}; + units::degrees angle_ {}; + std::string iconSheet_ {}; + std::size_t iconIndex_ {}; + std::string hoverText_ {}; }; class GeoIcons::Impl @@ -419,6 +419,15 @@ void GeoIcons::SetIconAngle(const std::shared_ptr& di, void GeoIcons::SetIconModulate(const std::shared_ptr& 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 GeoIcons::SetIconModulate(const std::shared_ptr& di, + boost::gil::rgba32f_pixel_t modulate) { di->modulate_ = modulate; } @@ -527,10 +536,10 @@ void GeoIcons::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(), { diff --git a/scwx-qt/source/scwx/qt/gl/draw/geo_icons.hpp b/scwx-qt/source/scwx/qt/gl/draw/geo_icons.hpp index 575692ca..4b69c8b4 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/geo_icons.hpp +++ b/scwx-qt/source/scwx/qt/gl/draw/geo_icons.hpp @@ -151,6 +151,15 @@ public: static void SetIconModulate(const std::shared_ptr& di, boost::gil::rgba8_pixel_t modulate); + /** + * Sets the modulate color of a geo icon. + * + * @param [in] di Geo icon draw item + * @param [in] modulate Modulate color + */ + static void SetIconModulate(const std::shared_ptr& di, + boost::gil::rgba32f_pixel_t modulate); + /** * Sets the hover text of a geo icon. * diff --git a/scwx-qt/source/scwx/qt/gl/draw/icons.cpp b/scwx-qt/source/scwx/qt/gl/draw/icons.cpp index 8ccee650..fbf60697 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/icons.cpp +++ b/scwx-qt/source/scwx/qt/gl/draw/icons.cpp @@ -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 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 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& di, void Icons::SetIconModulate(const std::shared_ptr& 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& 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(), { diff --git a/scwx-qt/source/scwx/qt/gl/draw/icons.hpp b/scwx-qt/source/scwx/qt/gl/draw/icons.hpp index 7e3ac356..5ce4c13b 100644 --- a/scwx-qt/source/scwx/qt/gl/draw/icons.hpp +++ b/scwx-qt/source/scwx/qt/gl/draw/icons.hpp @@ -128,6 +128,15 @@ public: static void SetIconModulate(const std::shared_ptr& di, boost::gil::rgba8_pixel_t modulate); + /** + * Sets the modulate color of an icon. + * + * @param [in] di Icon draw item + * @param [in] modulate Modulate color + */ + static void SetIconModulate(const std::shared_ptr& di, + boost::gil::rgba32f_pixel_t modulate); + /** * Sets the hover text of an icon. *