From a9021ac8dcdf5f2715b75ccca517283adff69be8 Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Tue, 7 Jul 2020 10:23:24 +0200 Subject: [PATCH] Separate GlobeLabels vec4 color into opacity and vec3 color This commit does not change the previous behavior. Note however that the behavior for opacity is a bit weird for this component. --- .../dwarf_planets/pluto/charon.asset | 2 +- .../dwarf_planets/pluto/pluto.asset | 2 +- .../solarsystem/planets/earth/earth.asset | 2 +- .../solarsystem/planets/earth/moon/moon.asset | 2 +- .../planets/jupiter/callisto/callisto.asset | 2 +- .../planets/jupiter/europa/europa.asset | 2 +- .../planets/jupiter/ganymede/ganymede.asset | 2 +- .../solarsystem/planets/jupiter/io/io.asset | 2 +- .../scene/solarsystem/planets/mars/mars.asset | 2 +- .../solarsystem/planets/mercury/mercury.asset | 2 +- .../planets/saturn/dione/dione.asset | 2 +- .../planets/saturn/enceladus/enceladus.asset | 2 +- .../planets/saturn/iapetus/iapetus.asset | 2 +- .../planets/saturn/mimas/mimas.asset | 2 +- .../planets/saturn/rhea/rhea.asset | 2 +- .../planets/saturn/tethys/tethys.asset | 2 +- .../planets/saturn/titan/titan.asset | 2 +- .../solarsystem/planets/venus/venus.asset | 2 +- .../src/globelabelscomponent.cpp | 30 +++++++++++++++---- .../globebrowsing/src/globelabelscomponent.h | 5 ++-- 20 files changed, 45 insertions(+), 26 deletions(-) diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/charon.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/charon.asset index 87139c2b9e..9b02a6352e 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/charon.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/charon.asset @@ -50,7 +50,7 @@ local Charon = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "planet_solarSystem", "planet_terrestrial" }, diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset index ce98ef30f8..62fa02ad0a 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset @@ -50,7 +50,7 @@ local Pluto = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "planet_solarSystem", "planet_terrestrial" }, diff --git a/data/assets/scene/solarsystem/planets/earth/earth.asset b/data/assets/scene/solarsystem/planets/earth/earth.asset index 1693d8ad15..db4e09d581 100644 --- a/data/assets/scene/solarsystem/planets/earth/earth.asset +++ b/data/assets/scene/solarsystem/planets/earth/earth.asset @@ -291,7 +291,7 @@ local Earth = { FadeOutStartingDistance = 80000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1500000.0, - LabelsColor = {1.0, 0.0, 0.0, 1.0} + LabelsColor = {1.0, 0.0, 0.0} } }, Tag = { "planet_solarSystem", "planet_terrestrial" }, diff --git a/data/assets/scene/solarsystem/planets/earth/moon/moon.asset b/data/assets/scene/solarsystem/planets/earth/moon/moon.asset index 642e0a0e90..d896642c2c 100644 --- a/data/assets/scene/solarsystem/planets/earth/moon/moon.asset +++ b/data/assets/scene/solarsystem/planets/earth/moon/moon.asset @@ -162,7 +162,7 @@ local Moon = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, GUI = { diff --git a/data/assets/scene/solarsystem/planets/jupiter/callisto/callisto.asset b/data/assets/scene/solarsystem/planets/jupiter/callisto/callisto.asset index d0b2496e52..7ee21f1966 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/callisto/callisto.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/callisto/callisto.asset @@ -58,7 +58,7 @@ local Callisto = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_jupiter" }, diff --git a/data/assets/scene/solarsystem/planets/jupiter/europa/europa.asset b/data/assets/scene/solarsystem/planets/jupiter/europa/europa.asset index d5e455bb9f..f589215dd3 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/europa/europa.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/europa/europa.asset @@ -67,7 +67,7 @@ local Europa = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_jupiter" }, diff --git a/data/assets/scene/solarsystem/planets/jupiter/ganymede/ganymede.asset b/data/assets/scene/solarsystem/planets/jupiter/ganymede/ganymede.asset index 513136ef98..d53036f909 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/ganymede/ganymede.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/ganymede/ganymede.asset @@ -58,7 +58,7 @@ local Ganymede = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_jupiter" }, diff --git a/data/assets/scene/solarsystem/planets/jupiter/io/io.asset b/data/assets/scene/solarsystem/planets/jupiter/io/io.asset index fb10f0b3a8..b34822bab3 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/io/io.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/io/io.asset @@ -58,7 +58,7 @@ local Io = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_jupiter" }, diff --git a/data/assets/scene/solarsystem/planets/mars/mars.asset b/data/assets/scene/solarsystem/planets/mars/mars.asset index f6d9b9d188..b9d8a2d13f 100644 --- a/data/assets/scene/solarsystem/planets/mars/mars.asset +++ b/data/assets/scene/solarsystem/planets/mars/mars.asset @@ -196,7 +196,7 @@ local Mars = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "planet_solarSystem", "planet_terrestrial" }, diff --git a/data/assets/scene/solarsystem/planets/mercury/mercury.asset b/data/assets/scene/solarsystem/planets/mercury/mercury.asset index 8eda6c5eb9..780b3a1ea9 100644 --- a/data/assets/scene/solarsystem/planets/mercury/mercury.asset +++ b/data/assets/scene/solarsystem/planets/mercury/mercury.asset @@ -214,7 +214,7 @@ local Mercury = { FadeOutStartingDistance = 80000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1500000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "planet_solarSystem", "planet_terrestrial" }, diff --git a/data/assets/scene/solarsystem/planets/saturn/dione/dione.asset b/data/assets/scene/solarsystem/planets/saturn/dione/dione.asset index ded4b6ae73..5e0014abf8 100644 --- a/data/assets/scene/solarsystem/planets/saturn/dione/dione.asset +++ b/data/assets/scene/solarsystem/planets/saturn/dione/dione.asset @@ -56,7 +56,7 @@ local Dione = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_saturn" }, diff --git a/data/assets/scene/solarsystem/planets/saturn/enceladus/enceladus.asset b/data/assets/scene/solarsystem/planets/saturn/enceladus/enceladus.asset index 8a66735198..4538de4a35 100644 --- a/data/assets/scene/solarsystem/planets/saturn/enceladus/enceladus.asset +++ b/data/assets/scene/solarsystem/planets/saturn/enceladus/enceladus.asset @@ -63,7 +63,7 @@ local Enceladus = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_saturn" }, diff --git a/data/assets/scene/solarsystem/planets/saturn/iapetus/iapetus.asset b/data/assets/scene/solarsystem/planets/saturn/iapetus/iapetus.asset index 892cc2c13e..5d6bba2f12 100644 --- a/data/assets/scene/solarsystem/planets/saturn/iapetus/iapetus.asset +++ b/data/assets/scene/solarsystem/planets/saturn/iapetus/iapetus.asset @@ -56,7 +56,7 @@ local Iapetus = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_saturn" }, diff --git a/data/assets/scene/solarsystem/planets/saturn/mimas/mimas.asset b/data/assets/scene/solarsystem/planets/saturn/mimas/mimas.asset index 53d9b7da21..a27427627c 100644 --- a/data/assets/scene/solarsystem/planets/saturn/mimas/mimas.asset +++ b/data/assets/scene/solarsystem/planets/saturn/mimas/mimas.asset @@ -56,7 +56,7 @@ local Mimas = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_saturn" }, diff --git a/data/assets/scene/solarsystem/planets/saturn/rhea/rhea.asset b/data/assets/scene/solarsystem/planets/saturn/rhea/rhea.asset index 008663ecf5..a218d2280a 100644 --- a/data/assets/scene/solarsystem/planets/saturn/rhea/rhea.asset +++ b/data/assets/scene/solarsystem/planets/saturn/rhea/rhea.asset @@ -56,7 +56,7 @@ local Rhea = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_saturn" }, diff --git a/data/assets/scene/solarsystem/planets/saturn/tethys/tethys.asset b/data/assets/scene/solarsystem/planets/saturn/tethys/tethys.asset index fea8618180..dc41241974 100644 --- a/data/assets/scene/solarsystem/planets/saturn/tethys/tethys.asset +++ b/data/assets/scene/solarsystem/planets/saturn/tethys/tethys.asset @@ -56,7 +56,7 @@ local Tethys = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_saturn" }, diff --git a/data/assets/scene/solarsystem/planets/saturn/titan/titan.asset b/data/assets/scene/solarsystem/planets/saturn/titan/titan.asset index a086c9eecb..5c871fb20a 100644 --- a/data/assets/scene/solarsystem/planets/saturn/titan/titan.asset +++ b/data/assets/scene/solarsystem/planets/saturn/titan/titan.asset @@ -63,7 +63,7 @@ local Titan = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 1350000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "moon_solarSystem", "moon_giants", "moon_saturn" }, diff --git a/data/assets/scene/solarsystem/planets/venus/venus.asset b/data/assets/scene/solarsystem/planets/venus/venus.asset index 486f2d2cab..0eb0654b9d 100644 --- a/data/assets/scene/solarsystem/planets/venus/venus.asset +++ b/data/assets/scene/solarsystem/planets/venus/venus.asset @@ -87,7 +87,7 @@ local Venus = { FadeOutStartingDistance = 1000000.0, LabelsForceDomeRendering = true, LabelsDistanceEPS = 3500000.0, - LabelsColor = {1.0, 1.0, 0.0, 1.0} + LabelsColor = {1.0, 1.0, 0.0} } }, Tag = { "planet_solarSystem", "planet_terrestrial" }, diff --git a/modules/globebrowsing/src/globelabelscomponent.cpp b/modules/globebrowsing/src/globelabelscomponent.cpp index e051411010..3d6b27583d 100644 --- a/modules/globebrowsing/src/globelabelscomponent.cpp +++ b/modules/globebrowsing/src/globelabelscomponent.cpp @@ -109,6 +109,12 @@ namespace { "Labels Color" }; + constexpr openspace::properties::Property::PropertyInfo LabelsOpacityInfo = { + "LabelsOpacity", + "Labels Opacity", + "Labels Opacity" + }; + constexpr openspace::properties::Property::PropertyInfo LabelsFadeInStartingDistanceInfo = { @@ -210,10 +216,16 @@ documentation::Documentation GlobeLabelsComponent::Documentation() { }, { LabelsColorInfo.identifier, - new Vector4Verifier(), + new DoubleVector3Verifier, Optional::Yes, LabelsColorInfo.description }, + { + LabelsOpacityInfo.identifier, + new DoubleVerifier, + Optional::Yes, + LabelsOpacityInfo.description + }, { LabelsFadeInStartingDistanceInfo.identifier, new DoubleVerifier, @@ -270,10 +282,11 @@ GlobeLabelsComponent::GlobeLabelsComponent() , _labelsMinHeight(LabelsMinHeightInfo, 100.0, 0.0, 10000.0) , _labelsColor( LabelsColorInfo, - glm::vec4(1.f, 1.f, 0.f, 1.f), - glm::vec4(0.f), - glm::vec4(1.f) + glm::vec3(1.f, 1.f, 0.f), + glm::vec3(0.f), + glm::vec3(1.f) ) + , _labelsOpacity(LabelsOpacityInfo, 1.f, 0.f, 1.f) , _labelsFadeInDist(LabelsFadeInStartingDistanceInfo, 1e6, 1e3, 1e8) , _labelsFadeOutDist(LabelsFadeOutStartingDistanceInfo, 1e4, 1, 1e7) , _labelsFadeInEnabled(LabelsFadeInEnabledInfo, false) @@ -291,6 +304,7 @@ GlobeLabelsComponent::GlobeLabelsComponent() addProperty(_labelsMinHeight); _labelsColor.setViewOption(properties::Property::ViewOptions::Color); addProperty(_labelsColor); + addProperty(_labelsOpacity); addProperty(_labelsFadeInDist); addProperty(_labelsFadeOutDist); addProperty(_labelsMinSize); @@ -355,7 +369,11 @@ void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary, } if (dictionary.hasKey(LabelsColorInfo.identifier)) { - _labelsColor = dictionary.value(LabelsColorInfo.identifier); + _labelsColor = dictionary.value(LabelsColorInfo.identifier); + } + + if (dictionary.hasKey(LabelsOpacityInfo.identifier)) { + _labelsOpacity = dictionary.value(LabelsOpacityInfo.identifier); } if (dictionary.hasKey(LabelsFadeInEnabledInfo.identifier)) { @@ -670,7 +688,7 @@ void GlobeLabelsComponent::renderLabels(const RenderData& data, float distToCamera, float fadeInVariable ) { - glm::vec4 textColor = _labelsColor; + glm::vec4 textColor = glm::vec4(glm::vec3(_labelsColor), _labelsOpacity); textColor.a *= fadeInVariable; glm::dvec4 cameraUpVecWorld = glm::dvec4(data.camera.lookUpVectorWorldSpace(), 0.0); diff --git a/modules/globebrowsing/src/globelabelscomponent.h b/modules/globebrowsing/src/globelabelscomponent.h index 98371f39e6..1bded12791 100644 --- a/modules/globebrowsing/src/globelabelscomponent.h +++ b/modules/globebrowsing/src/globelabelscomponent.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include @@ -89,7 +89,8 @@ private: properties::IntProperty _labelsMinSize; properties::FloatProperty _labelsSize; properties::FloatProperty _labelsMinHeight; - properties::Vec4Property _labelsColor; + properties::Vec3Property _labelsColor; + properties::FloatProperty _labelsOpacity; properties::FloatProperty _labelsFadeInDist; properties::FloatProperty _labelsFadeOutDist; properties::BoolProperty _labelsFadeInEnabled;