From c01e59635cdd5238117667273c4c586299b8a532 Mon Sep 17 00:00:00 2001 From: GPayne Date: Thu, 15 Aug 2019 08:51:18 -0600 Subject: [PATCH] Restored ability to change trail colors in satellite asset files. --- .../earth/satellites/misc/spacestations.asset | 2 +- modules/base/rendering/renderabletrail.cpp | 15 ++----------- .../space/rendering/renderablesatellites.cpp | 22 +++++++++++++++---- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/spacestations.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/spacestations.asset index 25476ee0a4..0c08f58e1f 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/spacestations.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/spacestations.asset @@ -4,7 +4,7 @@ local shared = asset.require('../satellites_shared') local group = { Title = "SpaceStations", Url = "http://celestrak.com/NORAD/elements/stations.txt", - TrailColor = { 0.0, 1.0, 0.0 } + TrailColor = { 1.0, 1.0, 0.0 } } local tle = shared.downloadTLEFile(asset, group.Url, group.Title) diff --git a/modules/base/rendering/renderabletrail.cpp b/modules/base/rendering/renderabletrail.cpp index 8f7cd62c66..facc9cc752 100644 --- a/modules/base/rendering/renderabletrail.cpp +++ b/modules/base/rendering/renderabletrail.cpp @@ -177,8 +177,8 @@ RenderableTrail::Appearance::Appearance() : properties::PropertyOwner(AppearanceInfo) , lineColor(LineColorInfo, glm::vec3(1.0f, 1.0f, 0.f), glm::vec3(0.f), glm::vec3(1.f)) , useLineFade(EnableFadeInfo, true) - , lineFade(FadeInfo, 0.4f, 0.f, 30.f) - , lineWidth(LineWidthInfo, 1.1f, 1.f, 20.f) + , lineFade(FadeInfo, 1.f, 0.f, 30.f) + , lineWidth(LineWidthInfo, 2.f, 1.f, 20.f) , pointSize(PointSizeInfo, 1, 1, 64) , renderingModes( RenderingModeInfo, @@ -201,17 +201,6 @@ RenderableTrail::Appearance::Appearance() RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary) : Renderable(dictionary) - /* - , _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f)) - , _useLineFade(EnableFadeInfo, true) - , _lineFade(FadeInfo, 1.f, 0.f, 30.f) - , _lineWidth(LineWidthInfo, 2.f, 1.f, 20.f) - , _pointSize(PointSizeInfo, 1, 1, 64) - , _renderingModes( - RenderingModeInfo, - properties::OptionProperty::DisplayType::Dropdown - ) - */ { addProperty(_opacity); registerUpdateRenderBinFromOpacity(); diff --git a/modules/space/rendering/renderablesatellites.cpp b/modules/space/rendering/renderablesatellites.cpp index d620960b13..fb4e81170a 100644 --- a/modules/space/rendering/renderablesatellites.cpp +++ b/modules/space/rendering/renderablesatellites.cpp @@ -51,7 +51,7 @@ namespace { constexpr const char* ProgramName = "RenderableSatellites"; - constexpr const char* _loggerCat = "SpaceDebris"; + constexpr const char* _loggerCat = "Satellites"; static const openspace::properties::Property::PropertyInfo PathInfo = { "Path", @@ -77,7 +77,12 @@ namespace { "The fading factor that is applied to the trail if the 'EnableFade' value is " "'true'. If it is 'false', this setting has no effect. The higher the number, " "the less fading is applied." -}; + }; + constexpr openspace::properties::Property::PropertyInfo LineColorInfo = { + "Color", + "Color", + "This value determines the RGB main color for the lines and points of the trail." + }; constexpr const char* KeyFile = "Path"; constexpr const char* KeyLineNum = "LineNumber"; @@ -303,13 +308,18 @@ documentation::Documentation RenderableSatellites::Documentation() { Optional::Yes, LineWidthInfo.description }, - { FadeInfo.identifier, new DoubleVerifier, Optional::Yes, FadeInfo.description - } + }, + { + LineColorInfo.identifier, + new DoubleVector3Verifier, + Optional::No, + LineColorInfo.description + }, } }; } @@ -334,6 +344,10 @@ RenderableSatellites::RenderableSatellites(const ghoul::Dictionary& dictionary) _lineFade = static_cast(dictionary.value(FadeInfo.identifier)); + if (dictionary.hasKeyAndValue(LineColorInfo.identifier)) { + _appearance.lineColor = dictionary.value(LineColorInfo.identifier); + } + addPropertySubOwner(_appearance); addProperty(_path); addProperty(_nSegments);