mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-22 20:38:56 -05:00
Feature/configuration (#605)
* Switch openspace.cfg file from a Dictionary-based loading to a variable based loading * Change ConfigurationManager to not use Dictionary anymore, but a struct with explicit configuration values instead
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
#include <openspace/util/syncdata.h>
|
||||
|
||||
#include <openspace/openspace.h>
|
||||
#include <openspace/engine/configurationmanager.h>
|
||||
#include <openspace/engine/configuration.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/interaction/navigationhandler.h>
|
||||
@@ -261,22 +261,9 @@ RenderEngine::RenderEngine()
|
||||
_doPerformanceMeasurements.onChange([this](){
|
||||
if (_doPerformanceMeasurements) {
|
||||
if (!_performanceManager) {
|
||||
std::string loggingDir = "${BASE}";
|
||||
constexpr const char* KeyDir = ConfigurationManager::LoggingDirectory;
|
||||
if (OsEng.configurationManager().hasKey(KeyDir)) {
|
||||
loggingDir = OsEng.configurationManager().value<std::string>(KeyDir);
|
||||
}
|
||||
|
||||
std::string prefix = "PM-";
|
||||
constexpr const char* KeyPrefix =
|
||||
ConfigurationManager::LoggingPerformancePrefix;
|
||||
if (OsEng.configurationManager().hasKey(KeyPrefix)) {
|
||||
prefix = OsEng.configurationManager().value<std::string>(KeyPrefix);
|
||||
}
|
||||
|
||||
_performanceManager = std::make_shared<performance::PerformanceManager>(
|
||||
loggingDir,
|
||||
prefix
|
||||
OsEng.configuration().logging.directory,
|
||||
OsEng.configuration().logging.performancePrefix
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -352,14 +339,9 @@ void RenderEngine::setRendererFromString(const std::string& renderingMethod) {
|
||||
|
||||
void RenderEngine::initialize() {
|
||||
_frameNumber = 0;
|
||||
std::string renderingMethod = DefaultRenderingMethod;
|
||||
|
||||
// If the user specified a rendering method that he would like to use, use that
|
||||
ConfigurationManager& confManager = OsEng.configurationManager();
|
||||
if (confManager.hasKeyAndValue<std::string>(KeyRenderingMethod)) {
|
||||
renderingMethod = confManager.value<std::string>(KeyRenderingMethod);
|
||||
}
|
||||
else {
|
||||
std::string renderingMethod = OsEng.configuration().renderingMethod;
|
||||
if (renderingMethod == "ABuffer") {
|
||||
using Version = ghoul::systemcapabilities::Version;
|
||||
|
||||
// The default rendering method has a requirement of OpenGL 4.3, so if we are
|
||||
@@ -370,17 +352,9 @@ void RenderEngine::initialize() {
|
||||
}
|
||||
}
|
||||
|
||||
if (confManager.hasKey(ConfigurationManager::KeyDisableMasterRendering)) {
|
||||
_disableMasterRendering = confManager.value<bool>(
|
||||
ConfigurationManager::KeyDisableMasterRendering
|
||||
);
|
||||
}
|
||||
|
||||
if (confManager.hasKey(ConfigurationManager::KeyDisableSceneOnMaster)) {
|
||||
_disableSceneTranslationOnMaster = confManager.value<bool>(
|
||||
ConfigurationManager::KeyDisableSceneOnMaster
|
||||
);
|
||||
}
|
||||
_disableMasterRendering = OsEng.configuration().isRenderingOnMasterDisabled;
|
||||
_disableSceneTranslationOnMaster =
|
||||
OsEng.configuration().isSceneTranslationOnMasterDisabled;
|
||||
|
||||
_raycasterManager = std::make_unique<RaycasterManager>();
|
||||
_deferredcasterManager = std::make_unique<DeferredcasterManager>();
|
||||
@@ -531,16 +505,11 @@ glm::ivec2 RenderEngine::renderingResolution() const {
|
||||
}
|
||||
|
||||
glm::ivec2 RenderEngine::fontResolution() const {
|
||||
std::string value;
|
||||
bool hasValue = OsEng.configurationManager().getValue(
|
||||
ConfigurationManager::KeyOnScreenTextScaling,
|
||||
value
|
||||
);
|
||||
if (hasValue && value == "framebuffer") {
|
||||
const std::string& value = OsEng.configuration().onScreenTextScaling;
|
||||
if (value == "framebuffer") {
|
||||
return OsEng.windowWrapper().currentWindowResolution();
|
||||
}
|
||||
else {
|
||||
// The default is to use the window size
|
||||
return OsEng.windowWrapper().currentWindowSize();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user