From 0ceab49df7dd6605192fe3adae26353ad5ca4701 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 30 Aug 2017 14:56:02 -0400 Subject: [PATCH] Update gitignore to include Mars texture Update SGCT reference Update Ghoul reference Prevent spherical grid to recreate grid each frame Add version and commit information (closes #395) --- .gitignore | 2 + CMakeLists.txt | 20 +++++++ ext/ghoul | 2 +- ext/sgct | 2 +- include/openspace/rendering/renderengine.h | 2 + .../rendering/renderablesphericalgrid.cpp | 2 + src/engine/openspaceengine.cpp | 1 + src/rendering/renderengine.cpp | 57 +++++++++++++++++++ support/cmake/openspace_header.template | 5 ++ 9 files changed, 91 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f3d422fad7..39179a8f4f 100644 --- a/.gitignore +++ b/.gitignore @@ -119,3 +119,5 @@ data/spice/plu055.bsp data/spice/Rosetta data/spice/sat375.bsp data/spice/new_horizons/ +data/scene/mars/map_datasets/mars_COL_v006_mars2000_rgb.tif +data/scene/mars/map_datasets/mars_COL_v006_mars2000_rgb.vrt diff --git a/CMakeLists.txt b/CMakeLists.txt index 2889800740..7ba5366fe6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,26 @@ endif () set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${OPENSPACE_CMAKE_EXT_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OPENSPACE_BASE_DIR}/bin) +########################################################################################## +# Main # +########################################################################################## + +# Get the current working branch +execute_process( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE OPENSPACE_GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +# Get the latest abbreviated commit hash of the working branch +execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE OPENSPACE_GIT_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE +) + option(OPENSPACE_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF) include(src/CMakeLists.txt) diff --git a/ext/ghoul b/ext/ghoul index 5a840979c7..3fd891bcc8 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 5a840979c7065818df3159c8104a9440908e8db8 +Subproject commit 3fd891bcc8a7b31eee4021033e9a1dbc72846f1d diff --git a/ext/sgct b/ext/sgct index acdecddb49..34d3ebb4dd 160000 --- a/ext/sgct +++ b/ext/sgct @@ -1 +1 @@ -Subproject commit acdecddb49793094d0033390b47bd87af805dc58 +Subproject commit 34d3ebb4ddae8524f512af12df943bd2aa058f46 diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index 75675902b4..f298be337f 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -95,6 +95,7 @@ public: const glm::mat4& projectionMatrix); void renderScreenLog(); + void renderVersionInformation(); void renderShutdownInformation(float timer, float fullTime); void postDraw(); @@ -200,6 +201,7 @@ private: properties::BoolProperty _showDate; properties::BoolProperty _showInfo; properties::BoolProperty _showLog; + properties::BoolProperty _showVersionInfo; properties::TriggerProperty _takeScreenshot; bool _shouldTakeScreenshot; diff --git a/modules/base/rendering/renderablesphericalgrid.cpp b/modules/base/rendering/renderablesphericalgrid.cpp index 9f368bbbae..0072e000fd 100644 --- a/modules/base/rendering/renderablesphericalgrid.cpp +++ b/modules/base/rendering/renderablesphericalgrid.cpp @@ -303,6 +303,8 @@ void RenderableSphericalGrid::update(const UpdateData&) { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _iBufferID); glBufferData(GL_ELEMENT_ARRAY_BUFFER, _isize * sizeof(int), _iarray.data(), GL_STATIC_DRAW); + + _gridIsDirty = false; } } diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 335eed19eb..7e817d875e 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1220,6 +1220,7 @@ void OpenSpaceEngine::postDraw() { if (isGuiWindow) { _renderEngine->renderScreenLog(); + _renderEngine->renderVersionInformation(); _console->render(); } diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 3f3716dc3a..e10b9bacdf 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -29,6 +29,7 @@ #endif #include +#include #include #include #include @@ -127,6 +128,13 @@ namespace { "log." }; + static const openspace::properties::Property::PropertyInfo ShowVersionInfo = { + "ShowVersion", + "Shows the version on-screen information", + "This value determines whether the GIT version information (branch and commit ) " + "hash are shown on the screen." + }; + static const openspace::properties::Property::PropertyInfo TakeScreenshotInfo = { "TakeScreenshot", "Take Screenshot", @@ -197,6 +205,7 @@ RenderEngine::RenderEngine() , _showDate(ShowDateInfo, true) , _showInfo(ShowInfoInfo, true) , _showLog(ShowLogInfo, true) + , _showVersionInfo(ShowVersionInfo, true) , _takeScreenshot(TakeScreenshotInfo) , _shouldTakeScreenshot(false) , _applyWarping(ApplyWarpingInfo, false) @@ -248,6 +257,7 @@ RenderEngine::RenderEngine() addProperty(_showDate); addProperty(_showInfo); addProperty(_showLog); + addProperty(_showVersionInfo); _nAaSamples.onChange([this](){ if (_renderer) { @@ -1287,6 +1297,53 @@ void RenderEngine::renderInformation() { } } +void RenderEngine::renderVersionInformation() { + if (!_showVersionInfo) { + return; + } + + using FR = ghoul::fontrendering::FontRenderer; + + FR::BoundingBoxInformation versionBox = FR::defaultRenderer().boundingBox( + *_fontInfo, + "%s", + OPENSPACE_VERSION_STRING_FULL + ); + + FR::BoundingBoxInformation commitBox = FR::defaultRenderer().boundingBox( + *_fontInfo, + "%s@%s", + OPENSPACE_GIT_BRANCH, + OPENSPACE_GIT_COMMIT + ); + + + + + FR::defaultRenderer().render( + *_fontInfo, + glm::vec2( + fontResolution().x - versionBox.boundingBox.x - 10.f, + 5.f + ), + glm::vec4(0.5, 0.5, 0.5, 1.f), + "%s", + OPENSPACE_VERSION_STRING_FULL + ); + + FR::defaultRenderer().render( + *_fontInfo, + glm::vec2( + fontResolution().x - commitBox.boundingBox.x - 10.f, + versionBox.boundingBox.y + 5.f + ), + glm::vec4(0.5, 0.5, 0.5, 1.f), + "%s@%s", + OPENSPACE_GIT_BRANCH, + OPENSPACE_GIT_COMMIT + ); +} + void RenderEngine::renderScreenLog() { if (!_showLog) { return; diff --git a/support/cmake/openspace_header.template b/support/cmake/openspace_header.template index 732e77c498..b728054104 100644 --- a/support/cmake/openspace_header.template +++ b/support/cmake/openspace_header.template @@ -37,6 +37,11 @@ constexpr int OPENSPACE_VERSION_PATCH = @OPENSPACE_VERSION_PATCH@; constexpr const char* OPENSPACE_VERSION_STRING = "@OPENSPACE_VERSION_STRING@"; +constexpr const char* OPENSPACE_VERSION_STRING_FULL = "@OPENSPACE_VERSION_MAJOR@.@OPENSPACE_VERSION_MINOR@.@OPENSPACE_VERSION_PATCH@ (@OPENSPACE_VERSION_STRING@)"; + +constexpr const char* OPENSPACE_GIT_BRANCH = "@OPENSPACE_GIT_BRANCH@"; +constexpr const char* OPENSPACE_GIT_COMMIT = "@OPENSPACE_GIT_COMMIT@"; + } // namespace openspace #endif // __OPENSPACE_CORE___OPENSPACE___H__