Issue/1440 - Exoplanet Panel and settings update (#2943)

* Add tags that can be used to set object visibility from UI

* Add module property for hiding/showing orbiting uncertainty disc

* Add tag for 1 AU ring and change color to something that's different from orbits

* Add property for circle color

* Add temporary gui hash for easier testing

* Update modules/exoplanets/exoplanetsmodule.cpp

Co-authored-by: Alexander Bock <alexander.bock@liu.se>

* Update GUI hash to correct commit on webgui master

---------

Co-authored-by: Alexander Bock <alexander.bock@liu.se>
This commit is contained in:
Emma Broman
2023-11-15 14:18:04 +01:00
committed by GitHub
parent f3c4fc54db
commit 639419a51b
4 changed files with 60 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ local guiCustomization = asset.require("customization/gui")
-- Select which commit hashes to use for the frontend and backend
local frontendHash = "26e709be4e4b17d7fcdbd8f53cf681f4f4126b29"
local frontendHash = "ab3222e9b281ba9964205426a134d6ce5b404d43"
local frontend = asset.resource({
Identifier = "WebGuiFrontend",

View File

@@ -110,6 +110,15 @@ namespace {
openspace::properties::Property::Visibility::AdvancedUser
};
constexpr openspace::properties::Property::PropertyInfo ComparisonCircleColorInfo = {
"ComparisonCircleColor",
"Comparison Circle Color",
"Decides the color of the 1 AU size comparison circles that are generated as part "
"of an exoplanet system. Changing the color will not modify already existing "
"circles",
openspace::properties::Property::Visibility::NoviceUser
};
constexpr openspace::properties::Property::PropertyInfo ShowComparisonCircleInfo = {
"ShowComparisonCircle",
"Show Comparison Circle",
@@ -119,6 +128,14 @@ namespace {
openspace::properties::Property::Visibility::NoviceUser
};
constexpr openspace::properties::Property::PropertyInfo ShowOrbitUncertaintyInfo = {
"ShowOrbitUncertainty",
"Show Orbit Uncertainty",
"If true, a disc showing the uncertainty for each planetary orbit is enabled per "
"default when an exoplanet system is created",
openspace::properties::Property::Visibility::User
};
constexpr openspace::properties::Property::PropertyInfo ShowHabitableZoneInfo = {
"ShowHabitableZone",
"Show Habitable Zone",
@@ -174,9 +191,15 @@ namespace {
// [[codegen::verbatim(HabitableZoneTextureInfo.description)]]
std::optional<std::filesystem::path> habitableZoneTexture;
// [[codegen::verbatim(ComparisonCircleColorInfo.description)]]
std::optional<glm::vec3> comparisonCircleColor [[codegen::color()]];
// [[codegen::verbatim(ShowComparisonCircleInfo.description)]]
std::optional<bool> showComparisonCircle;
// [[codegen::verbatim(ShowOrbitUncertaintyInfo.description)]]
std::optional<bool> showOrbitUncertainty;
// [[codegen::verbatim(ShowHabitableZoneInfo.description)]]
std::optional<bool> showHabitableZone;
@@ -203,7 +226,14 @@ ExoplanetsModule::ExoplanetsModule()
, _noDataTexturePath(NoDataTextureInfo)
, _orbitDiscTexturePath(OrbitDiscTextureInfo)
, _habitableZoneTexturePath(HabitableZoneTextureInfo)
, _comparisonCircleColor(
ComparisonCircleColorInfo,
glm::vec3(0.f, 0.8f, 0.8f),
glm::vec3(0.f),
glm::vec3(1.f)
)
, _showComparisonCircle(ShowComparisonCircleInfo, false)
, _showOrbitUncertainty(ShowOrbitUncertaintyInfo, true)
, _showHabitableZone(ShowHabitableZoneInfo, true)
, _useOptimisticZone(UseOptimisticZoneInfo, true)
, _habitableZoneOpacity(HabitableZoneOpacityInfo, 0.1f, 0.f, 1.f)
@@ -220,7 +250,10 @@ ExoplanetsModule::ExoplanetsModule()
addProperty(_orbitDiscTexturePath);
addProperty(_habitableZoneTexturePath);
_comparisonCircleColor.setViewOption(properties::Property::ViewOptions::Color);
addProperty(_comparisonCircleColor);
addProperty(_showComparisonCircle);
addProperty(_showOrbitUncertainty);
addProperty(_showHabitableZone);
addProperty(_useOptimisticZone);
@@ -279,10 +312,18 @@ std::string ExoplanetsModule::habitableZoneTexturePath() const {
return _habitableZoneTexturePath;
}
glm::vec3 ExoplanetsModule::comparisonCircleColor() const {
return _comparisonCircleColor;
}
bool ExoplanetsModule::showComparisonCircle() const {
return _showComparisonCircle;
}
bool ExoplanetsModule::showOrbitUncertainty() const {
return _showOrbitUncertainty;
}
bool ExoplanetsModule::showHabitableZone() const {
return _showHabitableZone;
}
@@ -328,7 +369,9 @@ void ExoplanetsModule::internalInitialize(const ghoul::Dictionary& dict) {
_habitableZoneTexturePath = p.habitableZoneTexture.value().string();
}
_comparisonCircleColor = p.comparisonCircleColor.value_or(_comparisonCircleColor);
_showComparisonCircle = p.showComparisonCircle.value_or(_showComparisonCircle);
_showOrbitUncertainty = p.showOrbitUncertainty.value_or(_showOrbitUncertainty);
_showHabitableZone = p.showHabitableZone.value_or(_showHabitableZone);
_useOptimisticZone = p.useOptimisticZone.value_or(_useOptimisticZone);

View File

@@ -31,6 +31,7 @@
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/vector/vec3property.h>
namespace openspace {
@@ -51,7 +52,9 @@ public:
std::string noDataTexturePath() const;
std::string orbitDiscTexturePath() const;
std::string habitableZoneTexturePath() const;
glm::vec3 comparisonCircleColor() const;
bool showComparisonCircle() const;
bool showOrbitUncertainty() const;
bool showHabitableZone() const;
bool useOptimisticZone() const;
float habitableZoneOpacity() const;
@@ -71,7 +74,9 @@ protected:
properties::StringProperty _orbitDiscTexturePath;
properties::StringProperty _habitableZoneTexturePath;
properties::Vec3Property _comparisonCircleColor;
properties::BoolProperty _showComparisonCircle;
properties::BoolProperty _showOrbitUncertainty;
properties::BoolProperty _showHabitableZone;
properties::BoolProperty _useOptimisticZone;

View File

@@ -355,11 +355,14 @@ void createExoplanetSystem(const std::string& starName,
const std::string discTexture = module->orbitDiscTexturePath();
bool isDiscEnabled = module->showOrbitUncertainty();
const std::string discNode = "{"
"Identifier = '" + planetIdentifier + "_Disc',"
"Parent = '" + starIdentifier + "',"
"Renderable = {"
"Type = 'RenderableOrbitDisc',"
"Enabled = " + (isDiscEnabled ? "true" : "false") + ","
"Texture = openspace.absPath('" +
formatPathToLua(discTexture) +
"'),"
@@ -377,6 +380,7 @@ void createExoplanetSystem(const std::string& starName,
"Rotation = " + ghoul::to_string(rotationMat3) + ""
"}"
"},"
"Tag = {'exoplanet_uncertainty_disc'},"
"GUI = {"
"Name = '" + planetName + " Disc',"
"Path = '" + guiPath + "'"
@@ -402,7 +406,7 @@ void createExoplanetSystem(const std::string& starName,
const glm::dmat3 meanOrbitPlaneRotationMatrix = static_cast<glm::dmat3>(rotation);
bool isCircleEnabled = module->showComparisonCircle();
const std::string isCircleEnabledString = isCircleEnabled ? "true" : "false";
glm::vec3 circleColor = module->comparisonCircleColor();
// 1 AU Size Comparison Circle
const std::string circle = "{"
@@ -410,8 +414,9 @@ void createExoplanetSystem(const std::string& starName,
"Parent = '" + starIdentifier + "',"
"Renderable = {"
"Type = 'RenderableRadialGrid',"
"Enabled = " + isCircleEnabledString + ","
"Enabled = " + (isCircleEnabled ? "true" : "false") + ","
"Radii = { 0.0, 1.0 },"
"Color = " + ghoul::to_string(circleColor) + ","
"CircleSegments = 64,"
"LineWidth = 2.0,"
"},"
@@ -425,6 +430,7 @@ void createExoplanetSystem(const std::string& starName,
"Scale = " + std::to_string(distanceconstants::AstronomicalUnit) + ""
"}"
"},"
"Tag = {'exoplanet_1au_ring'},"
"GUI = {"
"Name = '1 AU Size Comparison Circle',"
"Path = '" + guiPath + "'"
@@ -455,13 +461,8 @@ void createExoplanetSystem(const std::string& starName,
"above freezing anywhere on the planet";
const std::string hzTexture = module->habitableZoneTexturePath();
bool isHzEnabled = module->showHabitableZone();
const std::string isHzEnabledString = isHzEnabled ? "true" : "false";
bool useOptimistic = module->useOptimisticZone();
const std::string useOptimisticString = useOptimistic ? "true" : "false";
float opacity = module->habitableZoneOpacity();
const std::string zoneDiscNode = "{"
@@ -469,11 +470,11 @@ void createExoplanetSystem(const std::string& starName,
"Parent = '" + starIdentifier + "',"
"Renderable = {"
"Type = 'RenderableHabitableZone',"
"Enabled = " + isHzEnabledString + ","
"Enabled = " + (isHzEnabled ? "true" : "false") + ","
"Texture = openspace.absPath('" + formatPathToLua(hzTexture) + "'),"
"Luminosity = " + std::to_string(system.starData.luminosity) + ","
"EffectiveTemperature = " + std::to_string(system.starData.teff) + ","
"Optimistic = " + useOptimisticString + ","
"Optimistic = " + (useOptimistic ? "true" : "false") + ","
"Opacity = " + std::to_string(opacity) + ""
"},"
"Transform = {"
@@ -482,6 +483,7 @@ void createExoplanetSystem(const std::string& starName,
"Rotation = " + ghoul::to_string(meanOrbitPlaneRotationMatrix) + ""
"}"
"},"
"Tag = {'exoplanet_habitable_zone'},"
"GUI = {"
"Name = '" + starName + " Habitable Zone',"
"Path = '" + guiPath + "',"