diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index 9f089d8a46..85d23a654c 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -567,8 +567,50 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) addProperty(_generalProperties.performShading); addProperty(_generalProperties.useAccurateNormals); - addProperty(_generalProperties.eclipseShadowsEnabled); - addProperty(_generalProperties.eclipseHardShadows); + + // ================================================================ + // ======== Reads Shadow (Eclipses) Entries in asset file ========= + // ================================================================ + if (dictionary.hasValue(KeyShadowGroup)) { + ghoul::Dictionary shadowDictionary = + dictionary.value(KeyShadowGroup); + + std::vector> sourceArray; + ghoul::Dictionary sources = shadowDictionary.value("Sources"); + for (std::string_view k : sources.keys()) { + ghoul::Dictionary source = sources.value(k); + + std::string name = source.value("Name"); + double radius = source.value("Radius"); + sourceArray.emplace_back(name, radius); + } + + std::vector> casterArray; + ghoul::Dictionary casters = shadowDictionary.value("Casters"); + for (std::string_view k : casters.keys()) { + ghoul::Dictionary caster = casters.value(k); + + std::string name = caster.value("Name"); + double radius = caster.value("Radius"); + casterArray.emplace_back(name, radius); + } + + std::vector shadowConfArray; + for (const std::pair& source : sourceArray) { + for (const std::pair& caster : casterArray) { + Ellipsoid::ShadowConfiguration sc; + sc.source = source; + sc.caster = caster; + shadowConfArray.push_back(sc); + } + } + _ellipsoid.setShadowConfigurationArray(shadowConfArray); + } + + if (!_ellipsoid.shadowConfigurationArray().empty()) { + addProperty(_generalProperties.eclipseShadowsEnabled); + addProperty(_generalProperties.eclipseHardShadows); + } _shadowMappingPropertyOwner.addProperty(_generalProperties.shadowMapping); _shadowMappingPropertyOwner.addProperty(_generalProperties.zFightingPercentage); @@ -625,45 +667,6 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) _localChunkBuffer.resize(2048); _traversalMemory.resize(512); - // ================================================================ - // ======== Reads Shadow (Eclipses) Entries in asset file ========= - // ================================================================ - if (dictionary.hasValue(KeyShadowGroup)) { - ghoul::Dictionary shadowDictionary = - dictionary.value(KeyShadowGroup); - - std::vector> sourceArray; - ghoul::Dictionary sources = shadowDictionary.value("Sources"); - for (std::string_view k : sources.keys()) { - ghoul::Dictionary source = sources.value(k); - - std::string name = source.value("Name"); - double radius = source.value("Radius"); - sourceArray.emplace_back(name, radius); - } - - std::vector> casterArray; - ghoul::Dictionary casters = shadowDictionary.value("Casters"); - for (std::string_view k : casters.keys()) { - ghoul::Dictionary caster = casters.value(k); - - std::string name = caster.value("Name"); - double radius = caster.value("Radius"); - casterArray.emplace_back(name, radius); - } - - std::vector shadowConfArray; - for (const std::pair& source : sourceArray) { - for (const std::pair& caster : casterArray) { - Ellipsoid::ShadowConfiguration sc; - sc.source = source; - sc.caster = caster; - shadowConfArray.push_back(sc); - } - } - _ellipsoid.setShadowConfigurationArray(shadowConfArray); - } - // Labels Dictionary if (dictionary.hasValue(KeyLabels)) { _labelsDictionary = dictionary.value(KeyLabels);