From b1f10b1b701745e0591eb79f254aa68d22f84207 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 17 Jun 2021 15:39:16 +0200 Subject: [PATCH 1/9] Add the ability to specify RenderEngine font sizes in the configuration file (closes #1653) --- include/openspace/engine/configuration.h | 9 ++ include/openspace/rendering/renderengine.h | 5 +- openspace.cfg | 7 ++ src/engine/configuration.cpp | 21 +++++ src/rendering/renderengine.cpp | 99 +++++++++++----------- 5 files changed, 90 insertions(+), 51 deletions(-) diff --git a/include/openspace/engine/configuration.h b/include/openspace/engine/configuration.h index 83970d9fdf..eed5c055c5 100644 --- a/include/openspace/engine/configuration.h +++ b/include/openspace/engine/configuration.h @@ -53,6 +53,15 @@ struct Configuration { }; std::map fonts; + struct FontSizes { + float frameInfo; + float shutdown; + float log; + float cameraInfo; + float versionInfo; + }; + FontSizes fontSize; + struct Logging { std::string level = "Info"; bool forceImmediateFlush = false; diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index cc6698f165..28cee7e43a 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -233,8 +233,9 @@ private: std::vector _programs; std::shared_ptr _fontFrameInfo; - std::shared_ptr _fontInfo; - std::shared_ptr _fontDate; + std::shared_ptr _fontCameraInfo; + std::shared_ptr _fontVersionInfo; + std::shared_ptr _fontShutdown; std::shared_ptr _fontLog; struct { diff --git a/openspace.cfg b/openspace.cfg index bd01242ebc..3e4332c32a 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -188,6 +188,13 @@ Fonts = { Console = "${FONTS}/Inconsolata/Inconsolata-Regular.ttf", Loading = "${FONTS}/Roboto/Roboto-Regular.ttf" } +FontSize = { + FrameInfo = 32.0, + Shutdown = 30.0, + Log = 8.0, + CameraInfo = 12.0, + VersionInfo = 12.0 +} Logging = { LogDir = "${LOGS}", diff --git a/src/engine/configuration.cpp b/src/engine/configuration.cpp index f61dbc9ef7..7194824f06 100644 --- a/src/engine/configuration.cpp +++ b/src/engine/configuration.cpp @@ -69,6 +69,22 @@ namespace { // font std::optional> fonts; + struct FontSizes { + // The font size (in pt) used for printing optional information about the + // currently rendered frame + float frameInfo; + // The font size (in pt) used for rendering the shutdown text + float shutdown; + // The font size (in pt) used for rendering the screen log + float log; + // The font size (in pt) used for printing the camera friction state + float cameraInfo; + // The font size (in pt) used for printing the version information + float versionInfo; + }; + // Information about the hardcoded fontsizes used by the rendering engine itself + FontSizes fontSize; + struct Logging { // List from logmanager.cpp::levelFromString enum class Level { @@ -368,6 +384,11 @@ void parseLuaState(Configuration& configuration) { p.globalCustomizationScripts.value_or(c.globalCustomizationScripts); c.pathTokens = p.paths; c.fonts = p.fonts.value_or(c.fonts); + c.fontSize.frameInfo = p.fontSize.frameInfo; + c.fontSize.shutdown = p.fontSize.shutdown; + c.fontSize.log = p.fontSize.log; + c.fontSize.cameraInfo = p.fontSize.cameraInfo; + c.fontSize.versionInfo = p.fontSize.versionInfo; c.scriptLog = p.scriptLog.value_or(c.scriptLog); c.versionCheckUrl = p.versionCheckUrl.value_or(c.versionCheckUrl); c.useMultithreadedInitialization = diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 99aea3a92e..212321d0d9 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -532,28 +532,44 @@ void RenderEngine::initializeGL() { _horizFieldOfView = static_cast(global::windowDelegate->getHorizFieldOfView()); { - ZoneScopedN("Font: Mono") - TracyGpuZone("Font: Mono") - constexpr const float FontSizeFrameinfo = 32.f; - _fontFrameInfo = global::fontManager->font(KeyFontMono, FontSizeFrameinfo); + ZoneScopedN("Font: FrameInfo") + TracyGpuZone("Font: FrameInfo") + _fontFrameInfo = global::fontManager->font( + KeyFontMono, + global::configuration->fontSize.frameInfo + ); } { - ZoneScopedN("Font: Date") - TracyGpuZone("Font: Date") - constexpr const float FontSizeTime = 15.f; - _fontDate = global::fontManager->font(KeyFontMono, FontSizeTime); + ZoneScopedN("Font: Shutdown") + TracyGpuZone("Font: Shutdown") + _fontShutdown = global::fontManager->font( + KeyFontMono, + global::configuration->fontSize.shutdown + ); } { - ZoneScopedN("Font: Info") - TracyGpuZone("Font: Info") - constexpr const float FontSizeMono = 10.f; - _fontInfo = global::fontManager->font(KeyFontMono, FontSizeMono); + ZoneScopedN("Font: CameraInfo") + TracyGpuZone("Font: CameraInfo") + _fontCameraInfo = global::fontManager->font( + KeyFontMono, + global::configuration->fontSize.cameraInfo + ); + } + { + ZoneScopedN("Font: VersionInfo") + TracyGpuZone("Font: VersionInfo") + _fontVersionInfo = global::fontManager->font( + KeyFontMono, + global::configuration->fontSize.versionInfo + ); } { ZoneScopedN("Font: Log") TracyGpuZone("Font: Log") - constexpr const float FontSizeLight = 8.f; - _fontLog = global::fontManager->font(KeyFontLight, FontSizeLight); + _fontLog = global::fontManager->font( + KeyFontLight, + global::configuration->fontSize.log + ); } { @@ -874,12 +890,12 @@ void RenderEngine::renderEndscreen() { glm::vec2(global::windowDelegate->currentSubwindowSize()) / dpiScaling; glViewport(0, 0, res.x, res.y); - const glm::vec2 size = _fontDate->boundingBox("Shutting down"); + const glm::vec2 size = _fontShutdown->boundingBox("Shutting down"); glm::vec2 penPosition = glm::vec2( fontResolution().x / 2 - size.x / 2, fontResolution().y / 2 - size.y / 2 ); - RenderFont(*_fontDate, penPosition, "Shutting down"); + RenderFont(*_fontShutdown, penPosition, "Shutting down"); } void RenderEngine::renderShutdownInformation(float timer, float fullTime) { @@ -887,7 +903,7 @@ void RenderEngine::renderShutdownInformation(float timer, float fullTime) { timer = std::max(timer, 0.f); - const glm::vec2 size = _fontDate->boundingBox( + const glm::vec2 size = _fontShutdown->boundingBox( fmt::format("Shutdown in: {:.2f}s/{:.2f}s", timer, fullTime) ); @@ -897,14 +913,14 @@ void RenderEngine::renderShutdownInformation(float timer, float fullTime) { ); RenderFont( - *_fontDate, + *_fontShutdown, penPosition, fmt::format("Shutdown in: {:.2f}s/{:.2f}s", timer, fullTime), ghoul::fontrendering::CrDirection::Down ); RenderFont( - *_fontDate, + *_fontShutdown, penPosition, // Important: length of this string is the same as the shutdown time text // to make them align @@ -923,21 +939,6 @@ void RenderEngine::renderDashboard() { ); global::dashboard->render(penPosition); - -#ifdef REALTIME_CAMERA_POS_DISPLAY - penPosition += glm::vec2(0.f, -50.f); - - glm::dvec3 p = _camera->positionVec3(); - glm::dquat rot = _camera->rotationQuaternion(); - std::string fc = global::navigationHandler.focusNode()->identifier(); - RenderFont( - *_fontInfo, - penPosition, - fmt::format("Pos: {} {} {}\nOrientation: {} {} {} {}\nFocus: {}", - p.x, p.y, p.z, rot[0], rot[1], rot[2], rot[3], fc - ) - ); -#endif } void RenderEngine::postDraw() { @@ -1284,7 +1285,7 @@ void RenderEngine::renderCameraInformation() { const glm::vec4 EnabledColor = glm::vec4(0.2f, 0.75f, 0.2f, 1.f); const glm::vec4 DisabledColor = glm::vec4(0.55f, 0.2f, 0.2f, 1.f); - const glm::vec2 rotationBox = _fontInfo->boundingBox("Rotation"); + const glm::vec2 rotationBox = _fontCameraInfo->boundingBox("Rotation"); float penPosY = fontResolution().y - rotationBox.y; @@ -1303,14 +1304,14 @@ void RenderEngine::renderCameraInformation() { rotationBox.y }; FR::defaultRenderer().render( - *_fontInfo, + *_fontCameraInfo, glm::vec2(fontResolution().x - rotationBox.x - XSeparation, penPosY), "Rotation", nav.hasRotationalFriction() ? EnabledColor : DisabledColor ); penPosY -= rotationBox.y + YSeparation; - const glm::vec2 zoomBox = _fontInfo->boundingBox("Zoom"); + const glm::vec2 zoomBox = _fontCameraInfo->boundingBox("Zoom"); _cameraButtonLocations.zoom = { fontResolution().x - zoomBox.x - XSeparation, @@ -1319,14 +1320,14 @@ void RenderEngine::renderCameraInformation() { zoomBox.y }; FR::defaultRenderer().render( - *_fontInfo, + *_fontCameraInfo, glm::vec2(fontResolution().x - zoomBox.x - XSeparation, penPosY), "Zoom", nav.hasZoomFriction() ? EnabledColor : DisabledColor ); penPosY -= zoomBox.y + YSeparation; - const glm::vec2 rollBox = _fontInfo->boundingBox("Roll"); + const glm::vec2 rollBox = _fontCameraInfo->boundingBox("Roll"); _cameraButtonLocations.roll = { fontResolution().x - rollBox.x - XSeparation, @@ -1335,7 +1336,7 @@ void RenderEngine::renderCameraInformation() { rollBox.y }; FR::defaultRenderer().render( - *_fontInfo, + *_fontCameraInfo, glm::vec2(fontResolution().x - rollBox.x - XSeparation, penPosY), "Roll", nav.hasRollFriction() ? EnabledColor : DisabledColor @@ -1350,27 +1351,27 @@ void RenderEngine::renderVersionInformation() { } using FR = ghoul::fontrendering::FontRenderer; - const glm::vec2 versionBox = _fontInfo->boundingBox(_versionString); - const glm::vec2 commitBox = _fontInfo->boundingBox(OPENSPACE_GIT_FULL); + const glm::vec2 versionBox = _fontVersionInfo->boundingBox(_versionString); + const glm::vec2 commitBox = _fontVersionInfo->boundingBox(OPENSPACE_GIT_FULL); FR::defaultRenderer().render( - *_fontInfo, + *_fontVersionInfo, glm::vec2( fontResolution().x - versionBox.x - 10.f, 5.f ), _versionString, - glm::vec4(0.5, 0.5, 0.5, 1.f) + glm::vec4(0.5f, 0.5f, 0.5f, 1.f) ); // If a developer hasn't placed the Git command in the path, this variable will be // empty if (!std::string_view(OPENSPACE_GIT_COMMIT).empty()) { - // We check OPENSPACE_GIT_COMMIT but puse OPENSPACE_GIT_FULL on purpose since + // We check OPENSPACE_GIT_COMMIT but use OPENSPACE_GIT_FULL on purpose since // OPENSPACE_GIT_FULL will never be empty (always will contain at least @, but // checking for that is a bit brittle) FR::defaultRenderer().render( - *_fontInfo, + *_fontVersionInfo, glm::vec2(fontResolution().x - commitBox.x - 10.f, versionBox.y + 5.f), OPENSPACE_GIT_FULL, glm::vec4(0.5, 0.5, 0.5, 1.f) @@ -1384,15 +1385,15 @@ void RenderEngine::renderVersionInformation() { ZoneScopedN("Tracy Information") - const glm::vec2 tracyBox = _fontInfo->boundingBox("TRACY PROFILING ENABLED"); + const glm::vec2 tracyBox = _fontVersionInfo->boundingBox("TRACY PROFILING"); const glm::vec2 penPosition = glm::vec2( fontResolution().x - tracyBox.x - 10.f, versionBox.y + commitBox.y + 5.f ); FR::defaultRenderer().render( - *_fontInfo, + *_fontVersionInfo, penPosition, - "TRACY PROFILING ENABLED", + "TRACY PROFILING", glm::vec4(0.8f, 0.2f, 0.15f, 1.f) ); } From 741ed2ac05c58cd6fa901aa2784f5fe59075af09 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 18 Jun 2021 09:16:15 +0200 Subject: [PATCH 2/9] Remove remnant of scriptlogtype in log message --- include/openspace/scripting/scriptengine.h | 1 - src/engine/openspaceengine.cpp | 2 +- src/scripting/scriptengine.cpp | 4 +--- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/include/openspace/scripting/scriptengine.h b/include/openspace/scripting/scriptengine.h index 5890e6bb7e..94a187e1ca 100644 --- a/include/openspace/scripting/scriptengine.h +++ b/include/openspace/scripting/scriptengine.h @@ -125,7 +125,6 @@ private: // Logging variables bool _logFileExists = false; bool _logScripts = true; - std::string _logType; std::string _logFilename; }; diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index df7bd75df3..d063cea529 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -154,7 +154,7 @@ void OpenSpaceEngine::registerPathTokens() { using T = std::string; for (const std::pair& path : global::configuration->pathTokens) { std::string fullKey = "${" + path.first + "}"; - LDEBUG(fmt::format("Registering path {}: {}", fullKey, path.second)); + LDEBUG(fmt::format("Registering path '{}': '{}'", fullKey, path.second)); const bool overrideBase = (fullKey == "${BASE}"); if (overrideBase) { diff --git a/src/scripting/scriptengine.cpp b/src/scripting/scriptengine.cpp index b7c6b6541d..0c7a16a7ae 100644 --- a/src/scripting/scriptengine.cpp +++ b/src/scripting/scriptengine.cpp @@ -649,9 +649,7 @@ bool ScriptEngine::writeLog(const std::string& script) { _logFilename = absPath(global::configuration->scriptLog).string(); _logFileExists = true; - LDEBUG(fmt::format( - "Using script log of type '{}' to file '{}'", _logType, _logFilename - )); + LDEBUG(fmt::format("Using script log file '{}'", _logFilename)); // Test file and clear previous input std::ofstream file(_logFilename, std::ofstream::out | std::ofstream::trunc); From 7bea53a3552cf45746cf7fac828c3136b9e83f3e Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 18 Jun 2021 14:17:05 +0200 Subject: [PATCH 3/9] Comment out FOV for REXIS as it has an unsupported shape (closes #1650) --- .../missions/osirisrex/model.asset | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/data/assets/scene/solarsystem/missions/osirisrex/model.asset b/data/assets/scene/solarsystem/missions/osirisrex/model.asset index aab64ada66..33a2a694c6 100644 --- a/data/assets/scene/solarsystem/missions/osirisrex/model.asset +++ b/data/assets/scene/solarsystem/missions/osirisrex/model.asset @@ -130,34 +130,36 @@ local PolyCamFov = { } } -local RexisFov = { - Identifier = "REXIS FOV", - Parent = Rexis.Identifier, - Renderable = { - Type = "RenderableFov", - Body = "OSIRIS-REX", - Frame = "ORX_REXIS", - RGB = { 0.8, 0.7, 0.7 }, - Instrument = { - Name = "ORX_REXIS", - Method = "ELLIPSOID", - Aberration = "NONE" - }, - PotentialTargets = { BENNU_BODY }, - FrameConversions = { - [BENNU_BODY] = "IAU_BENNU" - } - }, - GUI = { - Name = "REXIS FOV", - Path = "/Solar System/Missions/OSIRIS REx/Instruments" - } -} +-- Commenting this out as REXIS' shape is circle, which is currently not supported in +-- the RenderableFOV class +-- local RexisFov = { +-- Identifier = "REXIS FOV", +-- Parent = Rexis.Identifier, +-- Renderable = { +-- Type = "RenderableFov", +-- Body = "OSIRIS-REX", +-- Frame = "ORX_REXIS", +-- RGB = { 0.8, 0.7, 0.7 }, +-- Instrument = { +-- Name = "ORX_REXIS", +-- Method = "ELLIPSOID", +-- Aberration = "NONE" +-- }, +-- PotentialTargets = { BENNU_BODY }, +-- FrameConversions = { +-- [BENNU_BODY] = "IAU_BENNU" +-- } +-- }, +-- GUI = { +-- Name = "REXIS FOV", +-- Path = "/Solar System/Missions/OSIRIS REx/Instruments" +-- } +-- } assetHelper.registerSceneGraphNodesAndExport(asset, { OsirisRex, PolyCam, Rexis, PolyCamFov, - RexisFov + -- RexisFov }) From 227a6607cc5609078182c022bf59678aa979292a Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 18 Jun 2021 14:50:23 +0200 Subject: [PATCH 4/9] Extend the skirts in local rendering again as cracks started to appear in globes (#closes 1647) --- modules/globebrowsing/shaders/localrenderer_vs.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/globebrowsing/shaders/localrenderer_vs.glsl b/modules/globebrowsing/shaders/localrenderer_vs.glsl index 642a2a2ae4..7d9a8b25a9 100644 --- a/modules/globebrowsing/shaders/localrenderer_vs.glsl +++ b/modules/globebrowsing/shaders/localrenderer_vs.glsl @@ -98,7 +98,7 @@ void main() { levelWeights = getLevelWeights(distToVertexOnEllipsoid); // Get the height value and apply skirts - float height = getTileHeightScaled(in_uv, levelWeights) - getTileVertexSkirtLength(); + float height = getTileHeightScaled(in_uv, levelWeights) - getTileVertexSkirtLength() * 100.0; // Translate the point along normal p += patchNormalCameraSpace * height; From 30df815a25505dad11f8948733d19ccbc923c555 Mon Sep 17 00:00:00 2001 From: Malin Ejdbo Date: Fri, 18 Jun 2021 16:30:00 +0200 Subject: [PATCH 5/9] Update jwst launch time frame --- data/assets/scene/solarsystem/missions/jwst/jwst.asset | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/data/assets/scene/solarsystem/missions/jwst/jwst.asset b/data/assets/scene/solarsystem/missions/jwst/jwst.asset index 6909b74699..ebaf97a6a5 100644 --- a/data/assets/scene/solarsystem/missions/jwst/jwst.asset +++ b/data/assets/scene/solarsystem/missions/jwst/jwst.asset @@ -115,8 +115,7 @@ local JWSTModel = { ModelScale = "Foot", InvertModelScale = true, EnableAnimation = true, - --TODO: Update theese when the new animation is finished - AnimationStartTime = "2018 10 01 15:00:00", + AnimationStartTime = "2018 10 01 14:05:52", AnimationMode = "Once", LightSources = { { @@ -130,7 +129,7 @@ local JWSTModel = { DisableFaceCulling = true }, GUI = { - Name = "James Webb Space Telescope", + Name = "James Webb Space Telescope Model", Path = "/Solar System/Missions/JWST", } } @@ -226,7 +225,7 @@ local JWSTLaunchModel = { Parent = JWSTLaunchPosition.Identifier, TimeFrame = { Type = "TimeFrameInterval", - Start = "2018 OCT 01 13:18:00", + Start = "2018 OCT 01 14:05:52", End = "2019 OCT 01" }, Transform = { @@ -245,8 +244,7 @@ local JWSTLaunchModel = { ModelScale = "Foot", InvertModelScale = true, EnableAnimation = true, - --TODO: Update theese when the new animation is finished - AnimationStartTime = "2018 10 01 15:00:00", + AnimationStartTime = "2018 10 01 14:05:52", AnimationMode = "Once", LightSources = { { From bf34c3a01661269d899e2fdfae2f28e968e8bed3 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 23 Jun 2021 00:40:22 +0200 Subject: [PATCH 6/9] Add the ability to RenderableFOV to always draw the field of view frustum --- .../rendering/renderablefov.cpp | 17 ++++++++++++++++- .../rendering/renderablefov.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/spacecraftinstruments/rendering/renderablefov.cpp b/modules/spacecraftinstruments/rendering/renderablefov.cpp index 775abfec35..9435d3b3bb 100644 --- a/modules/spacecraftinstruments/rendering/renderablefov.cpp +++ b/modules/spacecraftinstruments/rendering/renderablefov.cpp @@ -66,6 +66,13 @@ namespace { "making it more visible." }; + constexpr openspace::properties::Property::PropertyInfo AlwaysDrawFovInfo = { + "AlwaysDrawFov", + "Always Draw FOV", + "If this value is enabled, the field of view will always be drawn, regardless of " + "whether image information has been loaded or not" + }; + constexpr openspace::properties::Property::PropertyInfo DefaultStartColorInfo = { "Colors.DefaultStart", "Start of default color", @@ -160,6 +167,10 @@ namespace { // A table describing the instrument whose field of view should be rendered Instrument instrument; + // If this value is set to 'true', the field of view specified here will always be + // rendered, regardless of whether image information is currently available or not + std::optional alwaysDrawFov; + // A list of potential targets (specified as SPICE names) that the field of view // should be tested against std::vector potentialTargets; @@ -192,6 +203,7 @@ RenderableFov::RenderableFov(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _lineWidth(LineWidthInfo, 1.f, 1.f, 20.f) , _standOffDistance(StandoffDistanceInfo, 0.9999, 0.99, 1.0, 0.000001) + , _alwaysDrawFov(AlwaysDrawFovInfo, false) , _colors({ { DefaultStartColorInfo, glm::vec3(0.4f), glm::vec3(0.f), glm::vec3(1.f) }, { DefaultEndColorInfo, glm::vec3(0.85f), glm::vec3(0.f), glm::vec3(1.f) }, @@ -239,6 +251,9 @@ RenderableFov::RenderableFov(const ghoul::Dictionary& dictionary) _standOffDistance = p.standOffDistance.value_or(_standOffDistance); addProperty(_standOffDistance); + + _alwaysDrawFov = p.alwaysDrawFov.value_or(_alwaysDrawFov); + addProperty(_alwaysDrawFov); _simplifyBounds = p.simplifyBounds.value_or(_simplifyBounds); @@ -769,7 +784,7 @@ void RenderableFov::render(const RenderData& data, RendererTasks&) { } void RenderableFov::update(const UpdateData& data) { - _drawFOV = false; + _drawFOV = _alwaysDrawFov; if (ImageSequencer::ref().isReady()) { _drawFOV = ImageSequencer::ref().isInstrumentActive( data.time.j2000Seconds(), diff --git a/modules/spacecraftinstruments/rendering/renderablefov.h b/modules/spacecraftinstruments/rendering/renderablefov.h index 6ae7fe6513..f1a9c00352 100644 --- a/modules/spacecraftinstruments/rendering/renderablefov.h +++ b/modules/spacecraftinstruments/rendering/renderablefov.h @@ -77,6 +77,7 @@ private: // properties properties::FloatProperty _lineWidth; properties::DoubleProperty _standOffDistance; + properties::BoolProperty _alwaysDrawFov; ghoul::opengl::ProgramObject* _program = nullptr; UniformCache(modelViewProjection, defaultColorStart, defaultColorEnd, activeColor, targetInFieldOfViewColor, intersectionStartColor, intersectionEndColor, From 3d4c83cd9a8604fd72263090c79389c88142590a Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Thu, 24 Jun 2021 13:51:22 +0200 Subject: [PATCH 7/9] Prevent NaN values in StaticTranslation by limiting min and max size Also disable exponential slider for now, as they are not working well with this kind of range --- modules/base/translation/statictranslation.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/base/translation/statictranslation.cpp b/modules/base/translation/statictranslation.cpp index 228d6a7d62..ad72c2ae49 100644 --- a/modules/base/translation/statictranslation.cpp +++ b/modules/base/translation/statictranslation.cpp @@ -49,14 +49,11 @@ documentation::Documentation StaticTranslation::Documentation() { } StaticTranslation::StaticTranslation() - : _position( - PositionInfo, - glm::dvec3(0.0), - glm::dvec3(-std::numeric_limits::max()), - glm::dvec3(std::numeric_limits::max()) - ) + : _position(PositionInfo, glm::dvec3(0.0), glm::dvec3(-1e35), glm::dvec3(1e35)) { - _position.setExponent(20.f); + // @TODO (2021-06-24, emmbr) The exponential sliders do not handle ranges with + // negative values very well. When they do, this line can be uncommented + //_position.setExponent(20.f); addProperty(_position); _position.onChange([this]() { From d2a4d3201b5688ebc19aaa1fe5154fe33d64564d Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Thu, 24 Jun 2021 13:55:25 +0200 Subject: [PATCH 8/9] Add exponent to GlobeTranslation altitude slider --- modules/globebrowsing/src/globetranslation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/globebrowsing/src/globetranslation.cpp b/modules/globebrowsing/src/globetranslation.cpp index d1097c35de..c6599dd5cc 100644 --- a/modules/globebrowsing/src/globetranslation.cpp +++ b/modules/globebrowsing/src/globetranslation.cpp @@ -125,6 +125,7 @@ GlobeTranslation::GlobeTranslation(const ghoul::Dictionary& dictionary) addProperty(_latitude); _altitude = p.altitude.value_or(_altitude); + _altitude.setExponent(10.f); _altitude.onChange([this]() { _positionIsDirty = true; }); addProperty(_altitude); From 44080b2f94b7555bbd7ab8380cb9333209a1fe73 Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Thu, 24 Jun 2021 14:05:38 +0200 Subject: [PATCH 9/9] On second though, use a slightly lower exponent... --- modules/globebrowsing/src/globetranslation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/globebrowsing/src/globetranslation.cpp b/modules/globebrowsing/src/globetranslation.cpp index c6599dd5cc..ff902b8f67 100644 --- a/modules/globebrowsing/src/globetranslation.cpp +++ b/modules/globebrowsing/src/globetranslation.cpp @@ -125,7 +125,7 @@ GlobeTranslation::GlobeTranslation(const ghoul::Dictionary& dictionary) addProperty(_latitude); _altitude = p.altitude.value_or(_altitude); - _altitude.setExponent(10.f); + _altitude.setExponent(8.f); _altitude.onChange([this]() { _positionIsDirty = true; }); addProperty(_altitude);