mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-03 01:09:34 -05:00
Layers maintenance (#2917)
* Separate layers for the Moon and Earth * One asset each for each server, New York, Utah, and Sweden * Add the layers asset files for Earth and Moon * Add new layers structure for Mars and Europa * Add layers assets for Mercury and Enceladus * Add more layer assets for all servers * Add layer assets for each server on the top asset level * Rename Venus Utah cloud combo layer asset (breaking change) * Clean up layer asset descriptions * Update layer asset version name * Fix base layers error * Add configuration option to choose layers server * Add Lua functions to access configuration settings * Extend configuration Lua function * Add layer server setting in setting gui + add 'None' as a server option * Add base layers when server 'None' is used * Add tests for the new Layer Server setting
This commit is contained in:
@@ -283,6 +283,11 @@ namespace {
|
||||
// multiprojector setups where a launcher window would be undesired
|
||||
std::optional<bool> bypassLauncher;
|
||||
|
||||
// Set which layer server should be preferd to be used, the options are
|
||||
// \"All\", \"NewYork\", \"Sweden\", \"Utah\" and \"None\".
|
||||
std::optional<std::string> layerServer [[codegen::inlist("All", "NewYork",
|
||||
"Sweden", "Utah", "None")]];
|
||||
|
||||
// The URL that is pinged to check which version of OpenSpace is the most current
|
||||
// if you don't want this request to happen, this value should not be set at all
|
||||
std::optional<std::string> versionCheckUrl;
|
||||
@@ -313,6 +318,152 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
ghoul::Dictionary Configuration::createDictionary() {
|
||||
ghoul::Dictionary res;
|
||||
|
||||
res.setValue("WindowConfiguration", windowConfiguration);
|
||||
res.setValue("Asset", asset);
|
||||
res.setValue("Profile", profile);
|
||||
res.setValue("PropertyVisibility", static_cast<int>(propertyVisibility));
|
||||
|
||||
ghoul::Dictionary globalCustomizationScriptsDict;
|
||||
for (size_t i = 0; i < globalCustomizationScripts.size(); ++i) {
|
||||
globalCustomizationScriptsDict.setValue(
|
||||
std::to_string(i),
|
||||
globalCustomizationScripts[i]
|
||||
);
|
||||
}
|
||||
res.setValue("GlobalCustomizationScripts", globalCustomizationScriptsDict);
|
||||
|
||||
ghoul::Dictionary fontsDict;
|
||||
for (auto it = fonts.begin(); it != fonts.end(); ++it) {
|
||||
fontsDict.setValue(it->first, it->second);
|
||||
}
|
||||
res.setValue("Fonts", fontsDict);
|
||||
|
||||
{
|
||||
ghoul::Dictionary fontSizeDict;
|
||||
fontSizeDict.setValue("FrameInfo", static_cast<double>(fontSize.frameInfo));
|
||||
fontSizeDict.setValue("Shutdown", static_cast<double>(fontSize.shutdown));
|
||||
fontSizeDict.setValue("Log", static_cast<double>(fontSize.log));
|
||||
fontSizeDict.setValue("CameraInfo", static_cast<double>(fontSize.cameraInfo));
|
||||
fontSizeDict.setValue("VersionInfo", static_cast<double>(fontSize.versionInfo));
|
||||
|
||||
res.setValue("FontSize", fontSizeDict);
|
||||
}
|
||||
|
||||
{
|
||||
ghoul::Dictionary loggingDict;
|
||||
loggingDict.setValue("Level", logging.level);
|
||||
loggingDict.setValue("ForceImmediateFlush", logging.forceImmediateFlush);
|
||||
loggingDict.setValue("CapabilitiesVerbosity", logging.capabilitiesVerbosity);
|
||||
|
||||
ghoul::Dictionary logsDict;
|
||||
for (size_t i = 0; i < logging.logs.size(); ++i) {
|
||||
logsDict.setValue(std::to_string(i), logging.logs[i]);
|
||||
}
|
||||
loggingDict.setValue("Logs", logsDict);
|
||||
|
||||
res.setValue("Logging", loggingDict);
|
||||
}
|
||||
|
||||
res.setValue("ScriptLog", scriptLog);
|
||||
|
||||
{
|
||||
ghoul::Dictionary documentationDict;
|
||||
documentationDict.setValue("Path", documentation.path);
|
||||
|
||||
res.setValue("Documentation", documentationDict);
|
||||
}
|
||||
|
||||
res.setValue("VersionCheckUrl", versionCheckUrl);
|
||||
res.setValue("UseMultithreadedInitialization", useMultithreadedInitialization);
|
||||
|
||||
{
|
||||
ghoul::Dictionary loadingScreenDict;
|
||||
loadingScreenDict.setValue("IsShowingMessages", loadingScreen.isShowingMessages);
|
||||
loadingScreenDict.setValue("IsShowingNodeNames", loadingScreen.isShowingNodeNames);
|
||||
loadingScreenDict.setValue(
|
||||
"IsShowingLogMessages",
|
||||
loadingScreen.isShowingLogMessages
|
||||
);
|
||||
|
||||
res.setValue("LoadingScreen", loadingScreenDict);
|
||||
}
|
||||
|
||||
res.setValue("IsCheckingOpenGLState", isCheckingOpenGLState);
|
||||
res.setValue("IsLoggingOpenGLCalls", isLoggingOpenGLCalls);
|
||||
res.setValue("IsPrintingEvents", isPrintingEvents);
|
||||
res.setValue("ConsoleKey", ghoul::to_string(consoleKey));
|
||||
res.setValue("ShutdownCountdown", static_cast<double>(shutdownCountdown));
|
||||
res.setValue("shouldUseScreenshotDate", shouldUseScreenshotDate);
|
||||
res.setValue("OnScreenTextScaling", onScreenTextScaling);
|
||||
res.setValue("UsePerProfileCache", usePerProfileCache);
|
||||
res.setValue("IsRenderingOnMasterDisabled", isRenderingOnMasterDisabled);
|
||||
res.setValue("GlobalRotation", static_cast<glm::dvec3>(globalRotation));
|
||||
res.setValue("ScreenSpaceRotation", static_cast<glm::dvec3>(screenSpaceRotation));
|
||||
res.setValue("MasterRotation", static_cast<glm::dvec3>(masterRotation));
|
||||
res.setValue("IsConsoleDisabled", isConsoleDisabled);
|
||||
res.setValue("BypassLauncher", bypassLauncher);
|
||||
res.setValue("LayerServer", layerServerToString(layerServer));
|
||||
|
||||
ghoul::Dictionary moduleConfigurationsDict;
|
||||
for (auto it = moduleConfigurations.begin(); it != moduleConfigurations.end(); ++it) {
|
||||
moduleConfigurationsDict.setValue(it->first, it->second);
|
||||
}
|
||||
res.setValue("ModuleConfigurations", moduleConfigurationsDict);
|
||||
|
||||
{
|
||||
ghoul::Dictionary openGLDebugContextDict;
|
||||
openGLDebugContextDict.setValue("IsActive", openGLDebugContext.isActive);
|
||||
openGLDebugContextDict.setValue("PrintStacktrace", openGLDebugContext.printStacktrace);
|
||||
openGLDebugContextDict.setValue("IsSynchronous", openGLDebugContext.isSynchronous);
|
||||
|
||||
ghoul::Dictionary identifierFiltersDict;
|
||||
for (size_t i = 0; i < openGLDebugContext.severityFilters.size(); ++i) {
|
||||
{
|
||||
ghoul::Dictionary identifierFilterDict;
|
||||
identifierFilterDict.setValue("Type", openGLDebugContext.identifierFilters[i].type);
|
||||
identifierFilterDict.setValue("Source", openGLDebugContext.identifierFilters[i].source);
|
||||
identifierFilterDict.setValue(
|
||||
"Identifier",
|
||||
static_cast<int>(openGLDebugContext.identifierFilters[i].identifier)
|
||||
);
|
||||
|
||||
openGLDebugContextDict.setValue(std::to_string(i), identifierFilterDict);
|
||||
}
|
||||
}
|
||||
openGLDebugContextDict.setValue("IdentifierFilters", identifierFiltersDict);
|
||||
|
||||
ghoul::Dictionary severityFiltersDict;
|
||||
for (size_t i = 0; i < openGLDebugContext.severityFilters.size(); ++i) {
|
||||
severityFiltersDict.setValue(
|
||||
std::to_string(i),
|
||||
openGLDebugContext.severityFilters[i]
|
||||
);
|
||||
}
|
||||
openGLDebugContextDict.setValue("SeverityFilters", severityFiltersDict);
|
||||
|
||||
res.setValue("OpenGLDebugContext", openGLDebugContextDict);
|
||||
}
|
||||
|
||||
{
|
||||
ghoul::Dictionary httpProxyDict;
|
||||
httpProxyDict.setValue("UsingHttpProxy", httpProxy.usingHttpProxy);
|
||||
httpProxyDict.setValue("Address", httpProxy.address);
|
||||
httpProxyDict.setValue("Port", static_cast<int>(httpProxy.port));
|
||||
httpProxyDict.setValue("Authentication", httpProxy.authentication);
|
||||
httpProxyDict.setValue("User", httpProxy.user);
|
||||
httpProxyDict.setValue("Password", httpProxy.password);
|
||||
|
||||
res.setValue("HttpProxy", httpProxyDict);
|
||||
}
|
||||
|
||||
res.setValue("SgctConfigNameInitialized", sgctConfigNameInitialized);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void parseLuaState(Configuration& configuration) {
|
||||
using namespace ghoul::lua;
|
||||
|
||||
@@ -456,6 +607,10 @@ void parseLuaState(Configuration& configuration) {
|
||||
}
|
||||
|
||||
c.bypassLauncher = p.bypassLauncher.value_or(c.bypassLauncher);
|
||||
|
||||
if (p.layerServer.has_value()) {
|
||||
c.layerServer = stringToLayerServer(*p.layerServer);
|
||||
}
|
||||
}
|
||||
|
||||
void patchConfiguration(Configuration& configuration, const Settings& settings) {
|
||||
@@ -472,6 +627,9 @@ void patchConfiguration(Configuration& configuration, const Settings& settings)
|
||||
if (settings.bypassLauncher.has_value()) {
|
||||
configuration.bypassLauncher = *settings.bypassLauncher;
|
||||
}
|
||||
if (settings.layerServer.has_value()) {
|
||||
configuration.layerServer = *settings.layerServer;
|
||||
}
|
||||
auto it = configuration.moduleConfigurations.find("GlobeBrowsing");
|
||||
// Just in case we have a configuration file that does not specify anything
|
||||
// about the globebrowsing module
|
||||
@@ -551,4 +709,26 @@ Configuration loadConfigurationFromFile(const std::filesystem::path& configurati
|
||||
return result;
|
||||
}
|
||||
|
||||
openspace::Configuration::LayerServer stringToLayerServer(std::string_view server) {
|
||||
using Server = openspace::Configuration::LayerServer;
|
||||
if (server == "All") { return Server::All; }
|
||||
else if (server == "NewYork") { return Server::NewYork; }
|
||||
else if (server == "Sweden") { return Server::Sweden; }
|
||||
else if (server == "Utah") { return Server::Utah; }
|
||||
else if (server == "None") { return Server::None; }
|
||||
else { throw ghoul::MissingCaseException(); }
|
||||
}
|
||||
|
||||
std::string layerServerToString(openspace::Configuration::LayerServer server) {
|
||||
using Server = openspace::Configuration::LayerServer;
|
||||
switch (server) {
|
||||
case Server::All: return "All";
|
||||
case Server::NewYork: return "NewYork";
|
||||
case Server::Sweden: return "Sweden";
|
||||
case Server::Utah: return "Utah";
|
||||
case Server::None: return "None";
|
||||
default: throw ghoul::MissingCaseException();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -1669,7 +1669,9 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() {
|
||||
codegen::lua::IsMaster,
|
||||
codegen::lua::Version,
|
||||
codegen::lua::ReadCSVFile,
|
||||
codegen::lua::ResetCamera
|
||||
codegen::lua::ResetCamera,
|
||||
codegen::lua::Configuration,
|
||||
codegen::lua::LayerServer
|
||||
},
|
||||
{
|
||||
absPath("${SCRIPTS}/core_scripts.lua")
|
||||
|
||||
@@ -235,4 +235,20 @@ namespace {
|
||||
openspace::setCameraFromProfile(*openspace::global::profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the whole configuration object as a Dictionary
|
||||
*/
|
||||
[[codegen::luawrap]] ghoul::Dictionary configuration() {
|
||||
openspace::Configuration& config = *openspace::global::configuration;
|
||||
return config.createDictionary();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current layer server from the configuration
|
||||
*/
|
||||
[[codegen::luawrap]] std::string layerServer() {
|
||||
openspace::Configuration& config = *openspace::global::configuration;
|
||||
return layerServerToString(config.layerServer);
|
||||
}
|
||||
|
||||
#include "openspaceengine_lua_codegen.cpp"
|
||||
|
||||
@@ -74,6 +74,11 @@ namespace version1 {
|
||||
}
|
||||
settings.bypassLauncher = get_to<bool>(json, "bypass");
|
||||
|
||||
std::optional<std::string> layerServer = get_to<std::string>(json, "layerserver");
|
||||
if (layerServer.has_value()) {
|
||||
settings.layerServer = stringToLayerServer(*layerServer);
|
||||
}
|
||||
|
||||
if (auto it = json.find("mrf"); it != json.end()) {
|
||||
if (!it->is_object()) {
|
||||
throw ghoul::RuntimeError("'mrf' is not an object");
|
||||
@@ -165,6 +170,9 @@ void saveSettings(const Settings& settings, const std::filesystem::path& filenam
|
||||
if (settings.bypassLauncher.has_value()) {
|
||||
json["bypass"] = *settings.bypassLauncher;
|
||||
}
|
||||
if (settings.layerServer.has_value()) {
|
||||
json["layerserver"] = layerServerToString(*settings.layerServer);
|
||||
}
|
||||
nlohmann::json mrf = nlohmann::json::object();
|
||||
if (settings.mrf.isEnabled.has_value()) {
|
||||
mrf["enabled"] = *settings.mrf.isEnabled;
|
||||
|
||||
Reference in New Issue
Block a user