diff --git a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp index 261de634a0688..e1023c451c7ff 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp +++ b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.cpp @@ -22,6 +22,7 @@ */ #include "ScmConstellationArtwork.hpp" +#include "ConstellationMgr.hpp" #include "StarMgr.hpp" #include "StelApp.hpp" #include "StelModuleMgr.hpp" @@ -36,11 +37,20 @@ scm::ScmConstellationArtwork::ScmConstellationArtwork(const std::arraygetArtIntensity(); + QObject::connect(constMgr, &ConstellationMgr::artIntensityChanged, [this](float v) { artIntensity = v; }); } void scm::ScmConstellationArtwork::setupArt() @@ -279,7 +289,7 @@ bool scm::ScmConstellationArtwork::save(const QString &filepath) const void scm::ScmConstellationArtwork::drawOptimized(StelPainter &sPainter, const SphericalRegion ®ion, const Vec3d &obsVelocity) const { - const float intensity = artOpacity * artIntensityFovScale; + const float intensity = artIntensity * artIntensityFovScale; if (artTexture && intensity > 0.0f && region.intersects(boundingCap)) { sPainter.setColor(intensity, intensity, intensity); diff --git a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp index 58a79f61f6cc0..ed2f20a8ae8e3 100644 --- a/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp +++ b/plugins/SkyCultureMaker/src/ScmConstellationArtwork.hpp @@ -35,6 +35,13 @@ namespace scm { +/** + * @brief Class that represents a constellation artwork. + * + * Due to the lambda capture of 'this' in QObject::connect, + * the address of a ScmConstellationArtwork instance must + * not change during its lifetime! + */ class ScmConstellationArtwork { public: @@ -129,6 +136,11 @@ class ScmConstellationArtwork */ void drawOptimized(StelPainter &sPainter, const SphericalRegion ®ion, const Vec3d &obsVelocity) const; + /** + * @brief Initializes the artwork values from the ConstellationMgr. + */ + void initValues(); + /// Holds the anchors of the artwork. std::array anchors; @@ -147,8 +159,8 @@ class ScmConstellationArtwork /// Holds the intensity scale based on the Field of View. float artIntensityFovScale = 1.0f; - /// Holds the opacity of the art. - float artOpacity = 0.42; + /// Holds the intensity of the art. + float artIntensity = 0.42; /// Indicates if the artwork has an image that can be drawn. bool hasArt = false;