diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index fed1f55a0b..eefd275cce 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit fed1f55a0b259a70a5ad8461a4e56f07990609f1 +Subproject commit eefd275ccec15c9316e4bc91d7232f3beea083a2 diff --git a/data/assets/scene/digitaluniverse/stars.asset b/data/assets/scene/digitaluniverse/stars.asset index e269202667..d4b114322e 100644 --- a/data/assets/scene/digitaluniverse/stars.asset +++ b/data/assets/scene/digitaluniverse/stars.asset @@ -1,6 +1,6 @@ local assetHelper = asset.require('util/asset_helper') - +local colorLUT = asset.require('./stars_colormap').BvColorLUT local textures = asset.syncedResource({ Name = "Stars Textures", @@ -23,13 +23,6 @@ local sunspeck = asset.syncedResource({ Version = 1 }) -local colorLUT = asset.syncedResource({ - Name = "Stars Color Table", - Type = "HttpSynchronization", - Identifier = "stars_colormap", - Version = 2 -}) - local stars = { Identifier = "Stars", Renderable = { diff --git a/data/assets/scene/digitaluniverse/stars_colormap.asset b/data/assets/scene/digitaluniverse/stars_colormap.asset new file mode 100644 index 0000000000..f7f6432f7d --- /dev/null +++ b/data/assets/scene/digitaluniverse/stars_colormap.asset @@ -0,0 +1,22 @@ +local assetHelper = asset.require('util/asset_helper') + +local BvColorLUT = asset.syncedResource({ + Name = "Stars Color Table", + Type = "HttpSynchronization", + Identifier = "stars_colormap", + Version = 2 +}) + +asset.export("BvColorLUT", BvColorLUT) + +asset.meta = { + Name = "Stars B-V Colormap", + Version = "2.0", + Description = [[A lookup table that maps a B-V color index to an RGB color. + The B-V values are in the range (-0.4, 2.0) and each line maps a value + in that range to a color]], + Author = "OpenSpace Team", + URL = "https://www.amnh.org/research/hayden-planetarium/digital-universe", + License = "AMNH Digital Universe" +} + diff --git a/data/assets/scene/milkyway/exoplanets/exoplanets_data.asset b/data/assets/scene/milkyway/exoplanets/exoplanets_data.asset index 934d276c5c..76d4cddbdc 100644 --- a/data/assets/scene/milkyway/exoplanets/exoplanets_data.asset +++ b/data/assets/scene/milkyway/exoplanets/exoplanets_data.asset @@ -1,3 +1,5 @@ +local bvColorLUT = asset.require('scene/digitaluniverse/stars_colormap').BvColorLUT + local DataPath = asset.syncedResource({ Name = "Exoplanet Data Files", Type = "HttpSynchronization", @@ -7,9 +9,14 @@ local DataPath = asset.syncedResource({ asset.onInitialize(function () local p = "Modules.Exoplanets.DataFolder"; - if(openspace.getPropertyValue(p) == "") then + if (openspace.getPropertyValue(p) == "") then openspace.setPropertyValueSingle(p, DataPath) end + + p = "Modules.Exoplanets.BvColormap"; + if (openspace.getPropertyValue(p) == "") then + openspace.setPropertyValueSingle(p, bvColorLUT .. "/colorbv.cmap") + end end) asset.export("DataPath", DataPath) @@ -22,5 +29,5 @@ asset.meta = { Archive]], Author = "OpenSpace Team", URL = "https://exoplanetarchive.ipac.caltech.edu/docs/data.html", - License = "MIT license", + License = "MIT license" } diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset index e0de97af2a..4d3ae8016b 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset @@ -13,7 +13,7 @@ local models = asset.syncedResource({ Name = "ISS Models", Type = "HttpSynchronization", Identifier = "iss_model", - Version = 2 + Version = 3 }) local initializeAndAddNodes = function() @@ -59,37 +59,7 @@ local initializeAndAddNodes = function() }, Renderable = { Type = "RenderableModel", - GeometryFile = { - models .. "/0.obj", - models .. "/1.obj", - models .. "/2.obj", - models .. "/3.obj", - models .. "/4.obj", - models .. "/5.obj", - models .. "/6.obj", - models .. "/7.obj", - models .. "/8.obj", - models .. "/10.obj", - models .. "/11.obj", - models .. "/13.obj", - models .. "/14.obj", - models .. "/15.obj", - models .. "/16.obj", - models .. "/17.obj", - models .. "/19.obj", - models .. "/21.obj", - models .. "/22.obj", - models .. "/23.obj", - models .. "/24.obj", - models .. "/25.obj", - models .. "/foilsilver.obj", - models .. "/olive.obj", - models .. "/basemetal.obj", - models .. "/white_20.obj", - models .. "/plasticblack.obj", - models .. "/ecostresswhite.obj", - models .. "/plain.obj" - }, + GeometryFile = models .. "/ISS.fbx", LightSources = { { Type = "SceneGraphLightSource", diff --git a/ext/ghoul b/ext/ghoul index 2180f32860..1625701baa 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 2180f32860131b08831f9d4c2be5839b5aa48672 +Subproject commit 1625701baa17a568163d96a3532489d306d18e0e diff --git a/include/openspace/documentation/verifier.h b/include/openspace/documentation/verifier.h index 0126a804f7..47f61427b2 100644 --- a/include/openspace/documentation/verifier.h +++ b/include/openspace/documentation/verifier.h @@ -29,6 +29,7 @@ #include #include #include +#include namespace openspace::documentation { @@ -994,8 +995,15 @@ struct OrVerifier : public Verifier { * \param values The list of Verifiers that are to be tested * * \pre values must contain at least two values + * + * \todo: The use of the variant to use both raw pointers and shared pointers is + * definitely undesired. At the momement we are not handling the ownership of + * the verifiers very well and this must be cleaned up when doing a pass over + * the entire ownership model of the documentation/verifiers. For now it was + * necessary to make the codegen work in all cases without complications there */ - OrVerifier(const std::vector values); + OrVerifier(const std::vector>> values); /** * Checks whether the \p dictionary contains the \p key and whether this key passes diff --git a/modules/base/rendering/renderabletrail.cpp b/modules/base/rendering/renderabletrail.cpp index 42147ba54e..daab021b50 100644 --- a/modules/base/rendering/renderabletrail.cpp +++ b/modules/base/rendering/renderabletrail.cpp @@ -148,7 +148,8 @@ namespace { struct [[codegen::Dictionary(RenderableTrail)]] Parameters { // This object is used to compute locations along the path. Any Translation object // can be used here - std::monostate translation [[codegen::reference("core_transform_translation")]]; + ghoul::Dictionary translation + [[codegen::reference("core_transform_translation")]]; // [[codegen::verbatim(LineColorInfo.description)]] glm::vec3 color [[codegen::color()]]; diff --git a/modules/base/timeframe/timeframeunion.cpp b/modules/base/timeframe/timeframeunion.cpp index 05f7da7028..b630f940ea 100644 --- a/modules/base/timeframe/timeframeunion.cpp +++ b/modules/base/timeframe/timeframeunion.cpp @@ -41,7 +41,8 @@ namespace { struct [[codegen::Dictionary(TimeFrameUnion)]] Parameters { // [[codegen::verbatim(TimeFramesInfo.description)]] - std::vector timeFrames [[codegen::reference("core_time_frame")]]; + std::vector timeFrames + [[codegen::reference("core_time_frame")]]; }; #include "timeframeunion_codegen.cpp" } // namespace diff --git a/modules/exoplanets/exoplanetshelper.cpp b/modules/exoplanets/exoplanetshelper.cpp index 580dd7b5cd..f538f73f6f 100644 --- a/modules/exoplanets/exoplanetshelper.cpp +++ b/modules/exoplanets/exoplanetshelper.cpp @@ -24,6 +24,9 @@ #include +#include +#include +#include #include #include #include @@ -36,8 +39,6 @@ namespace { constexpr const char* _loggerCat = "ExoplanetsModule"; - - constexpr const char* BvColormapPath = "${SYNC}/http/stars_colormap/2/colorbv.cmap"; } namespace openspace::exoplanets { @@ -57,19 +58,37 @@ bool hasSufficientData(const ExoplanetDataEntry& p) { } glm::vec3 computeStarColor(float bv) { - std::ifstream colorMap(absPath(BvColormapPath), std::ios::in); + const ExoplanetsModule* module = global::moduleEngine->module(); + const std::string bvColormapPath = module->bvColormapPath(); + + std::ifstream colorMap(absPath(bvColormapPath), std::ios::in); if (!colorMap.good()) { LERROR(fmt::format( "Failed to open colormap data file: '{}'", - absPath(BvColormapPath) + absPath(bvColormapPath) )); - return glm::vec3(0.f, 0.f, 0.f); + return glm::vec3(0.f); } - const int t = static_cast(round(((bv + 0.4) / (2.0 + 0.4)) * 255)); + // Interpret the colormap cmap file + std::string line; + while (std::getline(colorMap, line)) { + if (line.empty() || (line[0] == '#')) { + continue; + } + break; + } + + // The first line is the width of the image, i.e number of values + std::istringstream ss(line); + int nValues; + ss >> nValues; + + // Find the line matching the input B-V value (B-V is in [-0.4,2.0]) + const int t = static_cast(round(((bv + 0.4) / (2.0 + 0.4)) * (nValues - 1))); std::string color; - for (int i = 0; i < t + 12; i++) { + for (int i = 0; i < t + 1; i++) { getline(colorMap, color); } colorMap.close(); diff --git a/modules/exoplanets/exoplanetsmodule.cpp b/modules/exoplanets/exoplanetsmodule.cpp index 6b2c4258be..a918bb6ca1 100644 --- a/modules/exoplanets/exoplanetsmodule.cpp +++ b/modules/exoplanets/exoplanetsmodule.cpp @@ -44,6 +44,12 @@ namespace { "The path to the folder containing the exoplanets data and lookup table" }; + constexpr const openspace::properties::Property::PropertyInfo BvColorMapInfo = { + "BvColormap", + "B-V Colormap", + "The path to a cmap file that maps a B-V color index to an RGB color" + }; + constexpr const openspace::properties::Property::PropertyInfo StarTextureInfo = { "StarTexture", "Star Texture", @@ -123,6 +129,9 @@ namespace { // [[codegen::verbatim(DataFolderInfo.description)]] std::optional dataFolder [[codegen::directory()]]; + // [[codegen::verbatim(BvColorMapInfo.description)]] + std::optional bvColormap; + // [[codegen::verbatim(StarTextureInfo.description)]] std::optional starTexture; @@ -160,6 +169,7 @@ using namespace exoplanets; ExoplanetsModule::ExoplanetsModule() : OpenSpaceModule(Name) , _exoplanetsDataFolder(DataFolderInfo) + , _bvColorMapPath(BvColorMapInfo) , _starTexturePath(StarTextureInfo) , _starGlareTexturePath(StarGlareTextureInfo) , _noDataTexturePath(NoDataTextureInfo) @@ -173,6 +183,7 @@ ExoplanetsModule::ExoplanetsModule() _exoplanetsDataFolder.setReadOnly(true); addProperty(_exoplanetsDataFolder); + addProperty(_bvColorMapPath); addProperty(_starTexturePath); addProperty(_starGlareTexturePath); addProperty(_noDataTexturePath); @@ -198,6 +209,10 @@ std::string ExoplanetsModule::lookUpTablePath() const { ); }; +std::string ExoplanetsModule::bvColormapPath() const { + return _bvColorMapPath; +} + std::string ExoplanetsModule::starTexturePath() const { return _starTexturePath; } @@ -280,6 +295,10 @@ void ExoplanetsModule::internalInitialize(const ghoul::Dictionary& dict) { _exoplanetsDataFolder = p.dataFolder.value().string(); } + if (p.bvColormap.has_value()) { + _bvColorMapPath = p.bvColormap.value().string(); + } + if (p.starTexture.has_value()) { _starTexturePath = p.starTexture.value().string(); } diff --git a/modules/exoplanets/exoplanetsmodule.h b/modules/exoplanets/exoplanetsmodule.h index fd2ef956f1..c089651587 100644 --- a/modules/exoplanets/exoplanetsmodule.h +++ b/modules/exoplanets/exoplanetsmodule.h @@ -43,6 +43,7 @@ public: std::string exoplanetsDataPath() const; std::string lookUpTablePath() const; + std::string bvColormapPath() const; std::string starTexturePath() const; std::string starGlareTexturePath() const; std::string noDataTexturePath() const; @@ -60,6 +61,7 @@ protected: void internalInitialize(const ghoul::Dictionary& dict) override; properties::StringProperty _exoplanetsDataFolder; + properties::StringProperty _bvColorMapPath; properties::StringProperty _starTexturePath; properties::StringProperty _starGlareTexturePath; properties::StringProperty _noDataTexturePath; diff --git a/modules/globebrowsing/src/layer.cpp b/modules/globebrowsing/src/layer.cpp index 7cc2745cb3..43039ef251 100644 --- a/modules/globebrowsing/src/layer.cpp +++ b/modules/globebrowsing/src/layer.cpp @@ -172,7 +172,7 @@ namespace { std::optional blendMode; // If the primary layer creation fails, this layer is used as a fallback - std::optional + std::optional fallback [[codegen::reference("globebrowsing_layer")]]; }; #include "layer_codegen.cpp" diff --git a/modules/space/rotation/spicerotation.cpp b/modules/space/rotation/spicerotation.cpp index 02b1b025c0..927c1c7ceb 100644 --- a/modules/space/rotation/spicerotation.cpp +++ b/modules/space/rotation/spicerotation.cpp @@ -64,7 +64,8 @@ namespace { std::optional, std::string>> kernels; // [[codegen::verbatim(TimeFrameInfo.description)]] - std::optional timeFrame [[codegen::reference("core_time_frame")]]; + std::optional timeFrame + [[codegen::reference("core_time_frame")]]; }; #include "spicerotation_codegen.cpp" } // namespace diff --git a/src/documentation/verifier.cpp b/src/documentation/verifier.cpp index ed326b1910..9de0012f2c 100644 --- a/src/documentation/verifier.cpp +++ b/src/documentation/verifier.cpp @@ -584,10 +584,17 @@ std::string AndVerifier::documentation() const { return ghoul::join(documentations, ", "); } -OrVerifier::OrVerifier(const std::vector values_) { +OrVerifier::OrVerifier( + const std::vector>> values_) +{ ghoul_assert(!values_.empty(), "values must not be empty"); - for (Verifier* v : values_) { - this->values.push_back(std::shared_ptr(v)); + for (const std::variant>& v : values_) { + if (std::holds_alternative(v)) { + this->values.push_back(std::shared_ptr(std::get(v))); + } + else { + this->values.push_back(std::get>(v)); + } } } diff --git a/support/coding/codegen b/support/coding/codegen index 1ca72c0202..b3c0a745fa 160000 --- a/support/coding/codegen +++ b/support/coding/codegen @@ -1 +1 @@ -Subproject commit 1ca72c0202e3bd4b61510f84797db131591c8ca3 +Subproject commit b3c0a745fa68e5f762de8a06732038e3a6fd5e02