From d7cb847ddaf88be4a7b69b0f22a8ac7e3758e103 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sun, 9 Sep 2018 11:31:22 -0400 Subject: [PATCH 001/109] Add spherical mirror configuration file with GUI window --- config/spherical_mirror_gui.xml | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 config/spherical_mirror_gui.xml diff --git a/config/spherical_mirror_gui.xml b/config/spherical_mirror_gui.xml new file mode 100644 index 0000000000..2da44b6241 --- /dev/null +++ b/config/spherical_mirror_gui.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 9ac41c65861c1119395f367e9797ab6bea8b8e5c Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 17 Sep 2018 14:57:40 -0400 Subject: [PATCH 002/109] Fix for taking screenshots Update Ghoul version --- apps/OpenSpace/main.cpp | 3 +-- ext/ghoul | 2 +- ext/sgct | 2 +- src/util/httprequest.cpp | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 34f777756c..75e9e892cb 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -309,11 +309,10 @@ void mainInitFunc() { std::tm* nowTime = std::localtime(&now); char mbstr[128]; strftime(mbstr, sizeof(mbstr), "%Y-%m-%d-%H-%M", nowTime); - screenshotPath += "/" + std::string(mbstr); FileSys.registerPathToken( "${SCREENSHOTS}", - absPath(screenshotPath), + absPath(screenshotPath + '/' + std::string(mbstr)), ghoul::filesystem::FileSystem::Override::Yes ); } diff --git a/ext/ghoul b/ext/ghoul index aa95228919..94acf4c2d4 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit aa95228919e2f72395cc895415f262ba88edd5e9 +Subproject commit 94acf4c2d4d73079329849e135d9b86b7ee3b390 diff --git a/ext/sgct b/ext/sgct index 6a344742d7..7037d71a8c 160000 --- a/ext/sgct +++ b/ext/sgct @@ -1 +1 @@ -Subproject commit 6a344742d7267d0966d381197c15e34e1afcf275 +Subproject commit 7037d71a8c34f5bbe98577260040a349cda4b7b9 diff --git a/src/util/httprequest.cpp b/src/util/httprequest.cpp index ca521ddb47..e49a652429 100644 --- a/src/util/httprequest.cpp +++ b/src/util/httprequest.cpp @@ -219,7 +219,7 @@ void SyncHttpDownload::download(HttpRequest::RequestOptions opt) { }); _httpRequest.perform(opt); deinitDownload(); - + LTRACE(fmt::format("End sync download '{}'", _httpRequest.url())); } From c03ddf76cc63c4922a49ae67c60b0a356c904960 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 17 Sep 2018 15:13:54 -0400 Subject: [PATCH 003/109] Remove external control callback --- include/openspace/engine/openspaceengine.h | 1 - src/engine/openspaceengine.cpp | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index 42c4245eea..0bf56f5948 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -79,7 +79,6 @@ public: void mouseButtonCallback(MouseButton button, MouseAction action); void mousePositionCallback(double x, double y); void mouseScrollWheelCallback(double posX, double posY); - void externalControlCallback(const char* receivedChars, int size, int clientId); void encode(); void decode(); diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index dbd99f0c21..8b58b0a9a8 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1239,18 +1239,6 @@ void OpenSpaceEngine::decode() { global::syncEngine.decodeSyncables(); } -void OpenSpaceEngine::externalControlCallback(const char* receivedChars, int size, - int /*clientId*/) -{ - // Not currently used anymore; should be replaced with a non-SGCT relient socket - - if (size == 0) { - return; - } - - global::networkEngine.handleMessage(std::string(receivedChars, size)); -} - void OpenSpaceEngine::toggleShutdownMode() { if (_shutdown.inShutdown) { // If we are already in shutdown mode, we want to disable it From a91eeb11f004216128cc16d57ec12b3486853f80 Mon Sep 17 00:00:00 2001 From: Emil Axelsson Date: Tue, 18 Sep 2018 23:02:49 +0200 Subject: [PATCH 004/109] Fix TaskRunner related issues --- apps/TaskRunner/main.cpp | 2 +- modules/kameleonvolume/kameleonvolumereader.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/TaskRunner/main.cpp b/apps/TaskRunner/main.cpp index 9088490c48..6fd9e29ede 100644 --- a/apps/TaskRunner/main.cpp +++ b/apps/TaskRunner/main.cpp @@ -108,9 +108,9 @@ int main(int argc, char** argv) { std::string configFile = configuration::findConfiguration(); global::configuration = configuration::loadConfigurationFromFile(configFile); + openspace::global::openSpaceEngine.registerPathTokens(); global::openSpaceEngine.initialize(); - ghoul::cmdparser::CommandlineParser commandlineParser( "OpenSpace TaskRunner", ghoul::cmdparser::CommandlineParser::AllowUnknownCommands::Yes diff --git a/modules/kameleonvolume/kameleonvolumereader.cpp b/modules/kameleonvolume/kameleonvolumereader.cpp index f697944a51..507de9a3ca 100644 --- a/modules/kameleonvolume/kameleonvolumereader.cpp +++ b/modules/kameleonvolume/kameleonvolumereader.cpp @@ -74,7 +74,7 @@ namespace { namespace openspace::kameleonvolume { KameleonVolumeReader::KameleonVolumeReader(std::string path) : _path(std::move(path)) { - if (!FileSys.fileExists(path)) { + if (!FileSys.fileExists(_path)) { throw ghoul::FileNotFoundError(_path); } From 0ca84d91f17a5bfd2f2d3b3fd051e940acbdec97 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 21 Sep 2018 14:25:51 -0400 Subject: [PATCH 005/109] Feature/cmake cleanup (#727) * Sweeping CMake cleanup * Cleaning up message log in CMake --- CMakeLists.txt | 183 ++++++++---------- apps/OpenSpace/CMakeLists.txt | 44 ++--- apps/Sync/CMakeLists.txt | 9 +- apps/Sync/include.cmake | 2 +- apps/TaskRunner/CMakeLists.txt | 9 +- apps/TaskRunner/include.cmake | 2 +- apps/Wormhole/CMakeLists.txt | 5 +- data/assets/default.scene | 4 + .../ESRI/World_Imagery.wms | 6 + ext/ghoul | 2 +- ext/sgct | 2 +- modules/globebrowsing/CMakeLists.txt | 8 +- modules/kameleon/CMakeLists.txt | 11 +- modules/sync/CMakeLists.txt | 15 +- modules/webbrowser/CMakeLists.txt | 1 + modules/webgui/cmake/webgui_helpers.cmake | 1 + src/CMakeLists.txt | 17 +- support/cmake/application_definition.cmake | 2 - support/cmake/handle_applications.cmake | 24 ++- support/cmake/handle_modules.cmake | 48 +++-- support/cmake/module_definition.cmake | 4 +- 21 files changed, 200 insertions(+), 199 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4c496ed59..57e8fdae89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,35 +25,39 @@ cmake_minimum_required(VERSION 3.8 FATAL_ERROR) project(OpenSpace) -message(STATUS "Generating OpenSpace project") set(OPENSPACE_VERSION_MAJOR 0) set(OPENSPACE_VERSION_MINOR 12) -set(OPENSPACE_VERSION_PATCH 0) -set(OPENSPACE_VERSION_STRING "Beta-2") +set(OPENSPACE_VERSION_PATCH 1) +set(OPENSPACE_VERSION_STRING "Beta-2 (WIP)") + set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}") -set(OPENSPACE_APPS_DIR "${OPENSPACE_BASE_DIR}/apps") -set(OPENSPACE_EXT_DIR "${OPENSPACE_BASE_DIR}/ext") set(OPENSPACE_CMAKE_EXT_DIR "${OPENSPACE_BASE_DIR}/support/cmake") set(GHOUL_BASE_DIR "${OPENSPACE_BASE_DIR}/ext/ghoul") include(${OPENSPACE_CMAKE_EXT_DIR}/module_common.cmake) include(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake) -include(${GHOUL_BASE_DIR}/support/cmake/copy_shared_libraries.cmake) include(${OPENSPACE_CMAKE_EXT_DIR}/handle_applications.cmake) include(${OPENSPACE_CMAKE_EXT_DIR}/handle_modules.cmake) +include(${GHOUL_BASE_DIR}/support/cmake/copy_shared_libraries.cmake) +include(${GHOUL_BASE_DIR}/support/cmake/handle_external_library.cmake) +include(${GHOUL_BASE_DIR}/support/cmake/message_macros.cmake) +include(${GHOUL_BASE_DIR}/support/cmake/include_gtest.cmake) + +begin_header("Configuring OpenSpace project") ########################################################################################## # Cleanup project # ########################################################################################## +set(OPENSPACE_APPS_DIR "${OPENSPACE_BASE_DIR}/apps") +set(OPENSPACE_EXT_DIR "${OPENSPACE_BASE_DIR}/ext") set_property(GLOBAL PROPERTY USE_FOLDERS On) set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER CMake) -# Test compiler -if (MSVC AND (MSVC_VERSION LESS 1910)) - message(FATAL_ERROR "OpenSpace requires at least Visual Studio 2017.2") -endif () +mark_as_advanced(CMAKE_BACKWARDS_COMPATIBILITY CMAKE_BUILD_TYPE CMAKE_DEBUG_POSTFIX + CMAKE_INSTALL_PREFIX CMAKE_OSX_ARCHITECTURES CMAKE_OSX_DEPLOYMENT_TARGET + CMAKE_OSX_SYSROOT CMAKE_RELEASE_POSTFIX) # Set build output directories set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${OPENSPACE_CMAKE_EXT_DIR}) @@ -100,28 +104,28 @@ include(src/CMakeLists.txt) ########################################################################################## # System libraries if (APPLE) - target_include_directories(libOpenSpace PUBLIC "/Developer/Headers/FlatCarbon") + begin_dependency("Core Libraries") + target_include_directories(openspace-core PUBLIC "/Developer/Headers/FlatCarbon") find_library(COREFOUNDATION_LIBRARY CoreFoundation) find_library(CARBON_LIBRARY Carbon) find_library(COCOA_LIBRARY Carbon) find_library(APP_SERVICES_LIBRARY ApplicationServices) mark_as_advanced(CARBON_LIBRARY COCOA_LIBRARY APP_SERVICES_LIBRARY) - target_link_libraries(libOpenSpace - ${CARBON_LIBRARY} - ${COREFOUNDATION_LIBRARY} - ${COCOA_LIBRARY} - ${APP_SERVICES_LIBRARY} - ) + target_link_libraries(openspace-core ${CARBON_LIBRARY} ${COREFOUNDATION_LIBRARY} + ${COCOA_LIBRARY} ${APP_SERVICES_LIBRARY}) + end_dependency() endif() # Ghoul add_subdirectory(${OPENSPACE_EXT_DIR}/ghoul) -target_link_libraries(libOpenSpace Ghoul) -set_property(TARGET Lua PROPERTY FOLDER "External") -set_property(TARGET lz4 PROPERTY FOLDER "External") +target_link_libraries(openspace-core Ghoul) +set_folder_location(Lua "External") +set_folder_location(lz4 "External") +set_folder_location(GhoulTest "Unit Tests") link_directories("${GHOUL_LIBRARY_DIRS}") # SGCT +begin_dependency("SGCT") set(SGCT_TEXT OFF CACHE BOOL "" FORCE) set(SGCT_BUILD_CSHARP_PROJECTS OFF CACHE BOOL "" FORCE) set(SGCT_LIGHT_ONLY ON CACHE BOOL "" FORCE) @@ -129,68 +133,62 @@ set(SGCT_CUSTOMOUTPUTDIRS OFF CACHE BOOL "" FORCE) set(JPEG_TURBO_WITH_SIMD OFF CACHE BOOL "" FORCE) add_subdirectory(${OPENSPACE_EXT_DIR}/sgct) -target_include_directories(libOpenSpace SYSTEM PUBLIC ${OPENSPACE_EXT_DIR}/sgct/include) -target_link_libraries( - libOpenSpace - sgct_light glew glfw png16_static quat tinyxml2static turbojpeg-static - vrpn - ${GLFW_LIBRARIES} -) - -if (TARGET sgct_light) - set_property(TARGET sgct_light PROPERTY FOLDER "External") -endif () -if (TARGET glew) - set_property(TARGET glew PROPERTY FOLDER "External/SGCT") -endif () -if (TARGET glfw) - set_property(TARGET glfw PROPERTY FOLDER "External/SGCT") -endif () -if (TARGET png16_static) - set_property(TARGET png16_static PROPERTY FOLDER "External/SGCT") -endif () -if (TARGET quat) - set_property(TARGET quat PROPERTY FOLDER "External/SGCT") -endif () -if (TARGET simd) - set_property(TARGET simd PROPERTY FOLDER "External/SGCT") -endif () -if (TARGET tinyxml2static) - set_property(TARGET tinyxml2static PROPERTY FOLDER "External/SGCT") -endif () -if (TARGET turbojpeg-static) - set_property(TARGET turbojpeg-static PROPERTY FOLDER "External/SGCT") -endif () -if (TARGET vrpn) - set_property(TARGET vrpn PROPERTY FOLDER "External/SGCT") -endif () -if (TARGET zlibstatic) - set_property(TARGET zlibstatic PROPERTY FOLDER "External/SGCT") -endif () - +target_include_directories(openspace-core SYSTEM PUBLIC ${OPENSPACE_EXT_DIR}/sgct/include) +target_link_libraries(openspace-core + sgct_light glew glfw png16_static quat tinyxml2static turbojpeg-static vrpn + ${GLFW_LIBRARIES}) if (UNIX AND (NOT APPLE)) - target_link_libraries(libOpenSpace Xcursor Xinerama X11) + target_link_libraries(openspace-core Xcursor Xinerama X11) endif () +mark_as_advanced(EXECUTABLE_OUTPUT_PATH GLFW_BUILD_DOCS GLFW_BUILD_EXAMPLES + GLFW_BUILD_TESTS GLFW_INSTALL GLFW_USE_HYBRID_HPG GLFW_USE_OSMESA GLFW_VULKAN_STATIC + INSTALL_BIN_DIR INSTALL_INC_DIR INSTALL_LIB_DIR INSTALL_MAN_DIR INSTALL_PKGCONFIG_DIR + IOKIT_LIBRARY JPEG_TURBO_FORCE32bit JPEG_TURBO_WITH_12BIT JPEG_TURBO_WITH_ARITH_DEC + JPEG_TURBO_WITH_ARITH_ENC JPEG_TURBO_WITH_JPEG7 JPEG_TURBO_WITH_JPEG8 + JPEG_TURBO_WITH_MEM_SRCDST JPEG_TURBO_WITH_SIMD JPEG_TURBO_WITH_TURBOJPEG LIB_SUFFIX + LIBRARY_OUTPUT_PATH M_LIBRARY SGCT_BUILD_ALUT SGCT_BUILD_CSHARP_PROJECTS + SGCT_CUSTOMOUTPUTDIRS SGCT_DOXYGEN SGCT_DOXYGEN_QUIET SGCT_EXAMPLES SGCT_INSTALL + SGCT_LIGHT_ONLY SGCT_NO_EXTERNAL_LIBRARIES SGCT_SPOUT_SUPPORT SGCT_TEXT + SGCT_USE_MSVC_RUNTIMES USE_MSVC_RUNTIME_LIBRARY_DLL) + +set_folder_location(sgct_light "External") +set_folder_location(glew "External/SGCT") +set_folder_location(glfw "External/SGCT") +set_folder_location(png16_static "External/SGCT") +set_folder_location(quat "External/SGCT") +set_folder_location(simd "External/SGCT") +set_folder_location(tinyxml2static "External/SGCT") +set_folder_location(turbojpeg-static "External/SGCT") +set_folder_location(vrpn "External/SGCT") +set_folder_location(zlibstatic "External/SGCT") +end_dependency("SGCT") + + # Spice +begin_dependency("Spice") add_subdirectory(${OPENSPACE_EXT_DIR}/spice) -target_link_libraries(libOpenSpace Spice) -set_property(TARGET Spice PROPERTY FOLDER "External") +target_link_libraries(openspace-core Spice) +set_folder_location(Spice "External") +end_dependency() # Curl +begin_dependency("CURL") if (WIN32) set(CURL_ROOT_DIR "${OPENSPACE_EXT_DIR}/curl") - target_include_directories(libOpenSpace SYSTEM PUBLIC ${CURL_ROOT_DIR}/include) - target_link_libraries(libOpenSpace ${CURL_ROOT_DIR}/lib/libcurl_imp.lib) - target_compile_definitions(libOpenSpace PUBLIC "OPENSPACE_CURL_ENABLED" "CURL_STATICLIB") + target_include_directories(openspace-core SYSTEM PUBLIC ${CURL_ROOT_DIR}/include) + target_link_libraries(openspace-core ${CURL_ROOT_DIR}/lib/libcurl_imp.lib) + target_compile_definitions(openspace-core PUBLIC + "OPENSPACE_CURL_ENABLED" "CURL_STATICLIB") else () find_package(CURL) if (CURL_FOUND) - target_include_directories(libOpenSpace SYSTEM PUBLIC ${CURL_INCLUDE_DIRS}) - target_link_libraries(libOpenSpace ${CURL_LIBRARIES}) - target_compile_definitions(libOpenSpace PUBLIC "OPENSPACE_CURL_ENABLED") + target_include_directories(openspace-core SYSTEM PUBLIC ${CURL_INCLUDE_DIRS}) + target_link_libraries(openspace-core ${CURL_LIBRARIES}) + target_compile_definitions(openspace-core PUBLIC "OPENSPACE_CURL_ENABLED") endif () endif() +end_dependency() # Qt # Unfortunately, we have to set this value manually; sigh @@ -200,16 +198,17 @@ if (APPLE) "~/Qt/5.6/clang_64/lib/cmake" "~/Qt/5.7/clang_64/lib/cmake" "~/Qt/5.8/clang_64/lib/cmake" - PARENT_SCOPE ) endif () if (MSVC) option(OPENSPACE_ENABLE_VLD "Enable the Visual Leak Detector" OFF) if (OPENSPACE_ENABLE_VLD) - target_compile_definitions(libOpenSpace PUBLIC "OPENSPACE_ENABLE_VLD") - target_link_libraries(libOpenSpace ${OPENSPACE_EXT_DIR}/vld/lib/vld.lib) - target_include_directories(libOpenSpace PUBLIC ${OPENSPACE_EXT_DIR}/vld) + begin_dependency("Visual Leak Detector") + target_compile_definitions(openspace-core PUBLIC "OPENSPACE_ENABLE_VLD") + target_link_libraries(openspace-core ${OPENSPACE_EXT_DIR}/vld/lib/vld.lib) + target_include_directories(openspace-core PUBLIC ${OPENSPACE_EXT_DIR}/vld) + end_dependency() endif () endif () @@ -219,30 +218,22 @@ endif () ########################################################################################## option(OPENSPACE_HAVE_TESTS "Activate the OpenSpace unit tests" ON) if (OPENSPACE_HAVE_TESTS) - if (NOT TARGET gtest) - set(BUILD_GTEST ON CACHE BOOL "") - set(BUILD_GMOCK OFF CACHE BOOL "") - set(gtest_force_shared_crt ON CACHE BOOL "") - add_subdirectory(${OPENSPACE_EXT_DIR}/ghoul/ext/googletest) - set_property(TARGET gtest PROPERTY FOLDER "External") - set_property(TARGET gtest_main PROPERTY FOLDER "External") - endif () + include_gtest("${GHOUL_BASE_DIR}/ext/googletest") file(GLOB_RECURSE OPENSPACE_TEST_FILES ${OPENSPACE_BASE_DIR}/tests/*.inl) - add_executable(OpenSpaceTest ${OPENSPACE_BASE_DIR}/tests/main.cpp ${OPENSPACE_TEST_FILES}) + target_include_directories(OpenSpaceTest PUBLIC "${OPENSPACE_BASE_DIR}/include" "${OPENSPACE_BASE_DIR}/tests" "${OPENSPACE_EXT_DIR}/ghoul/ext/googletest/googletest/include" ) target_compile_definitions(OpenSpaceTest PUBLIC - "GHL_THROW_ON_ASSERT" - "GTEST_HAS_TR1_TUPLE=0" + "GHL_THROW_ON_ASSERT" "GTEST_HAS_TR1_TUPLE=0" ) - target_link_libraries(OpenSpaceTest gtest libOpenSpace) + target_link_libraries(OpenSpaceTest gtest openspace-core) - set_property(TARGET OpenSpaceTest PROPERTY FOLDER "Unit Tests") + set_folder_location(OpenSpaceTest "Unit Tests") if (MSVC) set_target_properties(OpenSpaceTest PROPERTIES LINK_FLAGS @@ -251,37 +242,35 @@ if (OPENSPACE_HAVE_TESTS) endif () set_openspace_compile_settings(OpenSpaceTest) endif (OPENSPACE_HAVE_TESTS) -if (TARGET GhoulTest) - if (NOT TARGET gtest) - set(BUILD_GTEST ON CACHE BOOL "") - set(BUILD_GMOCK OFF CACHE BOOL "") - set(gtest_force_shared_crt ON CACHE BOOL "") - add_subdirectory(${OPENSPACE_EXT_DIR}/ghoul/ext/googletest) - endif () - set_property(TARGET gtest PROPERTY FOLDER "External") - set_property(TARGET GhoulTest PROPERTY FOLDER "Unit Tests") -endif () +begin_header("Configuring Modules") set(OPENSPACE_EXTERNAL_MODULES_PATHS "" CACHE STRING "List of external modules") handle_modules("${OPENSPACE_BASE_DIR}/modules" "${OPENSPACE_EXTERNAL_MODULES_PATHS}") +end_header("End: Configuring Modules") +message(STATUS "") +begin_header("Configuring Applications") handle_applications() +end_header("End: Configuring Applications") +message(STATUS "") ########################################################################################## # Misc settings # ########################################################################################## option(OPENSPACE_WITH_ABUFFER_RENDERER "Compile ABuffer Renderer" OFF) if (OPENSPACE_WITH_ABUFFER_RENDERER) - target_compile_definitions(libOpenSpace PUBLIC "OPENSPACE_WITH_ABUFFER_RENDERER") + target_compile_definitions(openspace-core PUBLIC "OPENSPACE_WITH_ABUFFER_RENDERER") endif () # Just in case, create the bin directory add_custom_command( - TARGET libOpenSpace + TARGET openspace-core PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ) # Manage the CPack packaging include(${OPENSPACE_CMAKE_EXT_DIR}/packaging.cmake) + +end_header("End: Configuring OpenSpace project") diff --git a/apps/OpenSpace/CMakeLists.txt b/apps/OpenSpace/CMakeLists.txt index c2be5d7a5f..406963976d 100644 --- a/apps/OpenSpace/CMakeLists.txt +++ b/apps/OpenSpace/CMakeLists.txt @@ -23,6 +23,7 @@ ########################################################################################## include(${GHOUL_BASE_DIR}/support/cmake/copy_shared_libraries.cmake) +include(${GHOUL_BASE_DIR}/support/cmake/message_macros.cmake) include(${OPENSPACE_CMAKE_EXT_DIR}/application_definition.cmake) include(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake) @@ -32,50 +33,43 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake) option(OPENSPACE_OPENVR_SUPPORT "Build OpenSpace application with OpenVR support" OFF) if (OPENSPACE_OPENVR_SUPPORT) + begin_header("Dependency: OpenVR") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OPENSPACE_EXT_DIR}/sgct/cmake/modules/") find_package(OpenVR REQUIRED) set(SGCT_OPENVR_DEFINITIONS OPENVR_SUPPORT) - if (NOT SGCT_OPENVR_INCLUDE_DIRECTORY) if (WIN32) find_path(SGCT_OPENVR_INCLUDE_DIRECTORY NAMES SGCTOpenVR.h - PATHS - $ENV{SGCT_ROOT_DIR}/additional_includes/openvr - ${OPENSPACE_EXT_DIR}/sgct/additional_includes/openvr - NO_DEFAULT_PATH + PATHS ${OPENSPACE_EXT_DIR}/sgct/additional_includes/openvr NO_DEFAULT_PATH REQUIRED ) else () find_path(SGCT_OPENVR_INCLUDE_DIRECTORY NAMES SGCTOpenVR.h PATH_SUFFIXES SGCTOpenVR - PATHS - $ENV{SGCT_ROOT_DIR}/additional_includes/openvr - ${OPENSPACE_EXT_DIR}/sgct/additional_includes/openvr + PATHS ${OPENSPACE_EXT_DIR}/sgct/additional_includes/openvr REQUIRED ) endif () - else() - set( - SGCT_OPENVR_FILES + else () + set(SGCT_OPENVR_FILES ${SGCT_OPENVR_INCLUDE_DIRECTORY}/SGCTOpenVR.h ${SGCT_OPENVR_INCLUDE_DIRECTORY}/SGCTOpenVR.cpp ) - endif() + endif () + end_header("Dependency: OpenVR") endif() ##### -# Spout +# Spout ##### if (SGCT_SPOUT_SUPPORT AND NOT OPENSPACE_MODULE_SPOUT) - set(SPOUT_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/ext/spout) - set(SPOUT_LIBRARY ${CMAKE_CURRENT_SOURCE_DIR}/ext/spout/SpoutLibrary.lib) - set(SPOUT_DEFINITIONS "OPENSPACE_HAS_SPOUT") - - add_external_library_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/ext/spout/SpoutLibrary.dll) + message(WARNING "Spout support from SGCT was requested, but OpenSpace Spout module was disabled") + message(STATUS "Enabling module as dependency") + set(OPENSPACE_MODULE_SPOUT ON CACHE BOOL "Build OPENSPACE_MODULE_SPOUTModule" FORCE) endif () set(MACOSX_BUNDLE_ICON_FILE openspace.icns) @@ -99,11 +93,7 @@ target_include_directories( ${SPOUT_INCLUDE_DIRS} ) -target_link_libraries(OpenSpace - libOpenSpace - ${OPENVR_LIBRARY} - ${SPOUT_LIBRARY} -) +target_link_libraries(OpenSpace openspace-core ${OPENVR_LIBRARY} ${SPOUT_LIBRARY}) target_compile_definitions(OpenSpace PRIVATE ${SGCT_OPENVR_DEFINITIONS} @@ -134,15 +124,19 @@ elseif (OPENSPACE_MODULE_WEBBROWSER) endif () if (OPENSPACE_MODULE_WEBGUI AND WEBGUI_MODULE_PATH) + begin_header("Building WebGUI source") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBGUI_MODULE_PATH}/cmake") include(webgui_helpers) build_webgui_source(OpenSpace) -elseif(OPENSPACE_MODULE_WEBGUI) + end_header("End: Building WebGUI source") +elseif (OPENSPACE_MODULE_WEBGUI) message(WARNING "WebGui is configured to be included, but the web source could not be found. Try configuring CMake again.") endif() # End Web Browser and Web gui if (MSVC) + begin_header("Dependency: Dbghelp") # This library is used for being able to output the callstack if an exception escapes target_link_libraries(OpenSpace Dbghelp.lib) -endif() + end_header() +endif () diff --git a/apps/Sync/CMakeLists.txt b/apps/Sync/CMakeLists.txt index 215e419bcf..8baaef8d22 100644 --- a/apps/Sync/CMakeLists.txt +++ b/apps/Sync/CMakeLists.txt @@ -31,15 +31,10 @@ set_source_files_properties( set(MACOSX_BUNDLE_ICON_FILE openspace.icns) -create_new_application( - Sync - MACOSX_BUNDLE +create_new_application(Sync MACOSX_BUNDLE ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/openspace.rc ${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns ) -target_link_libraries( - Sync - libOpenSpace -) +target_link_libraries(Sync openspace-core) diff --git a/apps/Sync/include.cmake b/apps/Sync/include.cmake index 7ac26b6f4f..99cad555da 100644 --- a/apps/Sync/include.cmake +++ b/apps/Sync/include.cmake @@ -1 +1 @@ -set(DEFAULT_APPLICATION ON) +set(DEFAULT_APPLICATION OFF) diff --git a/apps/TaskRunner/CMakeLists.txt b/apps/TaskRunner/CMakeLists.txt index 95c85044d1..7829a57b37 100644 --- a/apps/TaskRunner/CMakeLists.txt +++ b/apps/TaskRunner/CMakeLists.txt @@ -31,15 +31,10 @@ set_source_files_properties( set(MACOSX_BUNDLE_ICON_FILE openspace.icns) -create_new_application( - TaskRunner - MACOSX_BUNDLE +create_new_application(TaskRunner MACOSX_BUNDLE ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/openspace.rc ${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns ) -target_link_libraries( - TaskRunner - libOpenSpace -) +target_link_libraries(TaskRunner openspace-core) diff --git a/apps/TaskRunner/include.cmake b/apps/TaskRunner/include.cmake index 7ac26b6f4f..99cad555da 100644 --- a/apps/TaskRunner/include.cmake +++ b/apps/TaskRunner/include.cmake @@ -1 +1 @@ -set(DEFAULT_APPLICATION ON) +set(DEFAULT_APPLICATION OFF) diff --git a/apps/Wormhole/CMakeLists.txt b/apps/Wormhole/CMakeLists.txt index 9fc9569a31..e5ee75044d 100644 --- a/apps/Wormhole/CMakeLists.txt +++ b/apps/Wormhole/CMakeLists.txt @@ -39,7 +39,4 @@ create_new_application( ${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns ) -target_link_libraries( - Wormhole - libOpenSpace -) +target_link_libraries(Wormhole openspace-core) diff --git a/data/assets/default.scene b/data/assets/default.scene index 4ca508dae8..5accf4c830 100644 --- a/data/assets/default.scene +++ b/data/assets/default.scene @@ -85,6 +85,10 @@ asset.onInitialize(function () nil ) + openspace.setPropertyValueSingle('Scene.EarthAtmosphere.renderable.Enabled', false); + openspace.setPropertyValueSingle('Dashboard.Framerate.FrametimeType', 0); + + openspace.navigation.setCameraState({ Focus = earthAsset.Earth.Identifier, Position = { 0, 0, 0 }, diff --git a/data/assets/scene/solarsystem/planets/earth/map_service_configs/ESRI/World_Imagery.wms b/data/assets/scene/solarsystem/planets/earth/map_service_configs/ESRI/World_Imagery.wms index f7021fd20f..8b7db60839 100644 --- a/data/assets/scene/solarsystem/planets/earth/map_service_configs/ESRI/World_Imagery.wms +++ b/data/assets/scene/solarsystem/planets/earth/map_service_configs/ESRI/World_Imagery.wms @@ -19,4 +19,10 @@ 5 false 5 + + + ./gdalwmscache + .jpg + 21474836480 + diff --git a/ext/ghoul b/ext/ghoul index 94acf4c2d4..4be42e84f7 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 94acf4c2d4d73079329849e135d9b86b7ee3b390 +Subproject commit 4be42e84f7c02c70f69622db840bbaa6510ca543 diff --git a/ext/sgct b/ext/sgct index 7037d71a8c..4e74b6ba5b 160000 --- a/ext/sgct +++ b/ext/sgct @@ -1 +1 @@ -Subproject commit 7037d71a8c34f5bbe98577260040a349cda4b7b9 +Subproject commit 4e74b6ba5b074d39af9f9277367dd1f9a6ba3e29 diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index 91d80d1ad2..10ad550317 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -258,10 +258,10 @@ if (OPENSPACE_MODULE_GLOBEBROWSING_USE_GDAL) ${GDAL_INCLUDE_DIR} ) - target_link_libraries( - openspace-module-globebrowsing - ${GDAL_LIBRARY} - ) + target_link_libraries(openspace-module-globebrowsing ${GDAL_LIBRARY}) + + mark_as_advanced(GDAL_CONFIG GDAL_INCLUDE_DIR GDAL_LIBRARY) + endif () # WIN32 target_compile_definitions(openspace-module-globebrowsing PUBLIC GLOBEBROWSING_USE_GDAL) endif () # OPENSPACE_MODULE_GLOBEBROWSING_USE_GDAL diff --git a/modules/kameleon/CMakeLists.txt b/modules/kameleon/CMakeLists.txt index 21f2c29d4b..ca747f470e 100644 --- a/modules/kameleon/CMakeLists.txt +++ b/modules/kameleon/CMakeLists.txt @@ -23,6 +23,7 @@ ########################################################################################## include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) +include(${GHOUL_BASE_DIR}/support/cmake/handle_external_library.cmake) set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/kameleonwrapper.h @@ -52,10 +53,14 @@ create_new_module( mark_as_advanced(BUILD_SHARED_LIBS) # Change to set instead of option option(KAMELEON_USE_HDF5 "Kameleon use HDF5" OFF) set(KAMELEON_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ext/kameleon) - set(KAMELEON_INCLUDES ${KAMELEON_ROOT_DIR}/src) + set(KAMELEON_INCLUDES ${KAMELEON_ROOT_DIR}/src) add_subdirectory(${KAMELEON_ROOT_DIR}) target_include_directories(${kameleon_module} SYSTEM PUBLIC ${KAMELEON_INCLUDES}) target_link_libraries(${kameleon_module} ccmc) + mark_as_advanced(CDF_BUILD_ZLIB CDF_INCLUDES CDF_LIBRARY CDF_USE_STATIC_LIBS + CDF_USE_ZLIB HDF5_DIR HDF5_USE_STATIC_LIBRARIES KAMELEON_LIBRARY_ONLY + KAMELEON_USE_HDF5) + if (GHOUL_DISABLE_EXTERNAL_WARNINGS) if (MSVC) target_compile_options(ccmc PRIVATE "/W0" "/MP") @@ -64,7 +69,7 @@ create_new_module( target_compile_options(ccmc PRIVATE "-w") endif () endif () - set_property(TARGET ccmc PROPERTY FOLDER "External") + set_folder_location(ccmc "External") if (TARGET cdf) if (GHOUL_DISABLE_EXTERNAL_WARNINGS) if (MSVC) @@ -74,7 +79,7 @@ create_new_module( target_compile_options(cdf PRIVATE "-w") endif () endif () - set_property(TARGET cdf PROPERTY FOLDER "External") + set_folder_location(cdf "External") endif () # Boost find_package(Boost REQUIRED) diff --git a/modules/sync/CMakeLists.txt b/modules/sync/CMakeLists.txt index b04b19b372..e3a25f9699 100644 --- a/modules/sync/CMakeLists.txt +++ b/modules/sync/CMakeLists.txt @@ -44,11 +44,7 @@ set(SOURCE_FILES ) source_group("Source Files" FILES ${SOURCE_FILES}) -create_new_module( - "Sync" - sync_module - ${HEADER_FILES} ${SOURCE_FILES} -) +create_new_module("Sync" sync_module ${HEADER_FILES} ${SOURCE_FILES}) ##### # Libtorrent @@ -58,8 +54,8 @@ option(OPENSPACE_MODULE_SYNC_USE_LIBTORRENT "Use libtorrent" OFF) if (OPENSPACE_MODULE_SYNC_USE_LIBTORRENT) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) - SET(LIBTORRENT_encryption OFF CACHE BOOL "Use OpenSSL Encryption" FORCE) - SET(LIBTORRENT_shared OFF CACHE BOOL "Use Libtorrent as shared library" FORCE) + set(LIBTORRENT_encryption OFF CACHE BOOL "Use OpenSSL Encryption" FORCE) + set(LIBTORRENT_shared OFF CACHE BOOL "Use Libtorrent as shared library" FORCE) include_external_library( ${sync_module} @@ -73,4 +69,9 @@ if (OPENSPACE_MODULE_SYNC_USE_LIBTORRENT) ) target_compile_definitions(openspace-module-sync PUBLIC SYNC_USE_LIBTORRENT) + + mark_as_advanced(LIBTORRENT_build_examples LIBTORRENT_build_tests + LIBTORRENT_deprecated-functions LIBTORRENT_dht LIBTORRENT_encryption + LIBTORRENT_exceptions LIBTORRENT_exceptions LIBTORRENT_libiconv + LIBTORRENT_logging LIBTORRENT_shared LIBTORRENT_static_runtime) endif () # OPENSPACE_MODULE_SYNC_USE_LIBTORRENT \ No newline at end of file diff --git a/modules/webbrowser/CMakeLists.txt b/modules/webbrowser/CMakeLists.txt index d612cef32a..3fba31aa68 100644 --- a/modules/webbrowser/CMakeLists.txt +++ b/modules/webbrowser/CMakeLists.txt @@ -67,6 +67,7 @@ find_package(CEF REQUIRED) # Include the libcef_dll_wrapper target (executes libcef_dll/CMakeLists.txt). add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper) +mark_as_advanced(CEF_DEBUG_INFO_FLAG USE_ATL USE_OFFICIAL_BUILD_SANDBOX USE_SANDBOX) ########################################################################################## # Add CEF client files diff --git a/modules/webgui/cmake/webgui_helpers.cmake b/modules/webgui/cmake/webgui_helpers.cmake index eed90b8357..de02181e89 100644 --- a/modules/webgui/cmake/webgui_helpers.cmake +++ b/modules/webgui/cmake/webgui_helpers.cmake @@ -24,6 +24,7 @@ function(build_webgui_source target_name) set(NPM_COMMAND "npm" CACHE STRING "Location of NPM executable unless in PATH.") + mark_as_advanced(NPM_COMMAND) # copy webgui source add_custom_command( TARGET ${target_name} POST_BUILD diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ce9e85294c..951d7495f4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -418,13 +418,14 @@ endforeach () ########################################################################################## # Create OpenSpace target ########################################################################################## -add_library(libOpenSpace STATIC ${OPENSPACE_HEADER} ${OPENSPACE_SOURCE}) -# In order to be able to include libOpenSpace files -target_include_directories(libOpenSpace PUBLIC ${OPENSPACE_BASE_DIR}/include) -# In order to be able to include module files -target_include_directories(libOpenSpace PUBLIC ${OPENSPACE_BASE_DIR}) -# In order to be able to include the module_registration file -target_include_directories(libOpenSpace PUBLIC ${CMAKE_BINARY_DIR}/_generated/include) +add_library(openspace-core STATIC ${OPENSPACE_HEADER} ${OPENSPACE_SOURCE}) +target_include_directories(openspace-core PUBLIC + # In order to be able to include openspace-core files + ${OPENSPACE_BASE_DIR}/include + # In order to be able to include module files + ${OPENSPACE_BASE_DIR} + # In order to be able to include the module_registration file + ${CMAKE_BINARY_DIR}/_generated/include) configure_file( ${OPENSPACE_CMAKE_EXT_DIR}/openspace_header.template @@ -438,4 +439,4 @@ configure_file( @ONLY IMMEDIATE ) -set_openspace_compile_settings(libOpenSpace) +set_openspace_compile_settings(openspace-core) diff --git a/support/cmake/application_definition.cmake b/support/cmake/application_definition.cmake index ccc0a58322..71be2cf006 100644 --- a/support/cmake/application_definition.cmake +++ b/support/cmake/application_definition.cmake @@ -25,8 +25,6 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake) function (create_new_application application_name) - message(STATUS "Configuring application ${application_name}") - add_executable(${application_name} MACOSX_BUNDLE ${ARGN}) set_openspace_compile_settings(${application_name}) diff --git a/support/cmake/handle_applications.cmake b/support/cmake/handle_applications.cmake index 1cf87770a1..1f3110dbac 100644 --- a/support/cmake/handle_applications.cmake +++ b/support/cmake/handle_applications.cmake @@ -29,7 +29,26 @@ function (handle_applications) # Remove the .DS_Store present on Mac list(REMOVE_ITEM appDirs ".DS_Store") - message(STATUS "Configuration application") + # Print all the enabled modules + # message(STATUS "Enabled modules:") + # list(LENGTH enabled_module_names enabled_module_count) + # math(EXPR enabled_module_count "${enabled_module_count} - 1") + # foreach (val RANGE ${enabled_module_count}) + # list(GET enabled_module_names ${val} name) + # list(GET enabled_module_paths ${val} path) + + # message(STATUS "\t${name} (${path})") + # endforeach () + + message(STATUS "Enabled applications:") + foreach (app ${appDirs}) + string(TOUPPER ${app} upper_app) + if (OPENSPACE_APPLICATION_${upper_app}) + message(STATUS "\t${app} (${OPENSPACE_APPS_DIR}/${app})") + endif () + endforeach () + + # First create all of the options for the applications. In case that one of the # applications fail to include later, we still want all of them listed foreach (app ${appDirs}) @@ -44,8 +63,9 @@ function (handle_applications) set(app_dir "${OPENSPACE_APPS_DIR}/${app}") string(TOUPPER ${app} upper_app) if (OPENSPACE_APPLICATION_${upper_app}) - message(STATUS "Adding application ${app}") + begin_header("Application: ${app}") add_subdirectory(${app_dir}) + end_header("End: Application: ${app}") endif () endforeach () endfunction() diff --git a/support/cmake/handle_modules.cmake b/support/cmake/handle_modules.cmake index 10f38e6aa9..dfe21bbfe1 100644 --- a/support/cmake/handle_modules.cmake +++ b/support/cmake/handle_modules.cmake @@ -23,6 +23,7 @@ ########################################################################################## include(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake) +include(${GHOUL_BASE_DIR}/support/cmake/message_macros.cmake) function (handle_modules internal_module_path external_modules_paths) # @@ -45,16 +46,8 @@ function (handle_modules internal_module_path external_modules_paths) set(all_module_paths ${all_module_paths} ${paths}) endforeach () - list(LENGTH all_module_names len1) - math(EXPR len2 "${len1} - 1") - - # Debug: List all modules - # message(STATUS "All modules:") - # foreach (val RANGE ${len2}) - # list(GET all_module_names ${val} name) - # list(GET all_module_paths ${val} path) - # message(STATUS "\t${name} (${path})") - # endforeach () + list(LENGTH all_module_names all_module_names_count) + math(EXPR all_module_names_count "${all_module_names_count} - 1") # # Step 2: Create options for all modules with correct default values @@ -62,13 +55,13 @@ function (handle_modules internal_module_path external_modules_paths) set(enabled_module_names "") set(enabled_module_paths "") - foreach(val RANGE ${len2}) + foreach(val RANGE ${all_module_names_count}) list(GET all_module_names ${val} name) list(GET all_module_paths ${val} path) get_module_attribute_supported(${path} is_module_supported) if (NOT ${is_module_supported}) - message(STATUS "Skipping module ${path} as it is not supported on this machine") + message(STATUS "Skipping module ${name} (${path}) as it is not supported on this machine") continue() endif () @@ -86,9 +79,9 @@ function (handle_modules internal_module_path external_modules_paths) # Step 3: For each module that is default or enabled by the user, get the dependencies # set(dependencies "") - list(LENGTH enabled_module_names len1) - math(EXPR len2 "${len1} - 1") - foreach (val RANGE ${len2}) + list(LENGTH enabled_module_names enabled_module_count) + math(EXPR enabled_module_count "${enabled_module_count} - 1") + foreach (val RANGE ${enabled_module_count}) list(GET enabled_module_names ${val} name) list(GET enabled_module_paths ${val} path) @@ -123,35 +116,38 @@ function (handle_modules internal_module_path external_modules_paths) # Print all the enabled modules message(STATUS "Enabled modules:") - list(LENGTH enabled_module_names len1) - math(EXPR len2 "${len1} - 1") - foreach (val RANGE ${len2}) + list(LENGTH enabled_module_names enabled_module_count) + math(EXPR enabled_module_count "${enabled_module_count} - 1") + foreach (val RANGE ${enabled_module_count}) list(GET enabled_module_names ${val} name) list(GET enabled_module_paths ${val} path) - message(STATUS "\t${name} (${path})") + message(STATUS "\t${name} (${path})") endforeach () # - # Step 5: Add the subdirectories of all the enabled modules + # Step 5: Add the subdirectories of all enabled modules # set(module_class_names "") set(module_external_libraries "") - foreach (val RANGE ${len2}) + foreach (val RANGE ${enabled_module_count}) list(GET enabled_module_names ${val} name) list(GET enabled_module_paths ${val} path) create_library_name(${name} library_name) + begin_header("Module ${name} (${library_name})") add_subdirectory(${path}) + end_header("End: Module ${name}") + message(STATUS "") - # Only link libOpenSpace against the library if it has been set STATIC + # Only link openspace-core against the library if it has been set STATIC get_target_property(library_type ${library_name} TYPE) if (NOT ${library_type} STREQUAL "SHARED_LIBRARY") - target_link_libraries(libOpenSpace ${library_name}) + target_link_libraries(openspace-core ${library_name}) endif() create_define_name(${name} define_name) - target_compile_definitions(libOpenSpace PUBLIC "${define_name}") + target_compile_definitions(openspace-core PUBLIC "${define_name}") get_property(class_name GLOBAL PROPERTY CurrentModuleClassName) list(APPEND module_class_names ${class_name}) @@ -170,7 +166,7 @@ function (handle_modules internal_module_path external_modules_paths) set(MODULE_HEADERS "") set(MODULE_CLASSES "") set(MODULE_PATHS "") - foreach (val RANGE ${len2}) + foreach (val RANGE ${enabled_module_count}) list(GET enabled_module_names ${val} name) list(GET enabled_module_paths ${val} path) list(GET module_class_names ${val} class_name) @@ -195,7 +191,7 @@ function (handle_modules internal_module_path external_modules_paths) # The module path should include the 'modules' directory, which is removed for the # include path to make all of the includes look the same list(APPEND MODULE_PATHS " \"${path}/modules\",\n") - target_include_directories(libOpenSpace PUBLIC ${path}) + target_include_directories(openspace-core PUBLIC ${path}) endforeach () if (NOT "${MODULE_HEADERS}" STREQUAL "") diff --git a/support/cmake/module_definition.cmake b/support/cmake/module_definition.cmake index 231814f190..d9391f5a6e 100644 --- a/support/cmake/module_definition.cmake +++ b/support/cmake/module_definition.cmake @@ -38,8 +38,6 @@ function (create_new_module module_name output_library_name library_mode) # Create a library name of the style: openspace-module-${name} create_library_name(${module_name} library_name) - message(STATUS "Configuring module ${module_name}: ${library_name}") - # Add the module files to the list of sources get_module_files(${module_name} module_files) @@ -105,7 +103,7 @@ endfunction () # External dependencies are found using the find_package function and then linked function (handle_module_dependencies target_name module_name) # We always want to link against Ghoul and the core library - target_link_libraries(${library_name} Ghoul libOpenSpace) + target_link_libraries(${library_name} Ghoul openspace-core) if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include.cmake") include(${CMAKE_CURRENT_SOURCE_DIR}/include.cmake) From 4ed9fec9f9e1b9d3a4865da07040db1da4d786da Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 25 Sep 2018 12:23:55 -0400 Subject: [PATCH 006/109] Remove Clang warnings --- ext/ghoul | 2 +- include/openspace/util/httprequest.h | 1 - modules/spacecraftinstruments/util/projectioncomponent.cpp | 2 -- modules/sync/torrentclient.cpp | 3 ++- modules/sync/torrentclient.h | 4 +++- src/engine/openspaceengine.cpp | 1 + src/properties/scalar/wcharproperty.cpp | 2 ++ src/rendering/abufferrenderer.cpp | 2 ++ src/rendering/helper.cpp | 1 - src/rendering/luaconsole.cpp | 4 ---- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index 4be42e84f7..f3ac3f442c 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 4be42e84f7c02c70f69622db840bbaa6510ca543 +Subproject commit f3ac3f442c384ba5b0bed5c74e96002ae8f0a0da diff --git a/include/openspace/util/httprequest.h b/include/openspace/util/httprequest.h index ce4156c01d..ee160c22f3 100644 --- a/include/openspace/util/httprequest.h +++ b/include/openspace/util/httprequest.h @@ -122,7 +122,6 @@ private: ReadyState _readyState; Progress _progress; - RequestOptions _options; friend size_t curlfunctions::writeCallback(char* ptr, size_t size, size_t nmemb, void* userData); diff --git a/modules/spacecraftinstruments/util/projectioncomponent.cpp b/modules/spacecraftinstruments/util/projectioncomponent.cpp index 2588b9d611..1aa88ac82c 100644 --- a/modules/spacecraftinstruments/util/projectioncomponent.cpp +++ b/modules/spacecraftinstruments/util/projectioncomponent.cpp @@ -22,8 +22,6 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#pragma optimize ("", off) - #include #include diff --git a/modules/sync/torrentclient.cpp b/modules/sync/torrentclient.cpp index 51ee1164c1..f8232f1194 100644 --- a/modules/sync/torrentclient.cpp +++ b/modules/sync/torrentclient.cpp @@ -46,13 +46,14 @@ #pragma warning (pop) #endif // _MSC_VER -#endif // SYNC_USE_LIBTORRENT namespace { constexpr const char* _loggerCat = "TorrentClient"; constexpr const std::chrono::milliseconds PollInterval(1000); } // namespace +#endif // SYNC_USE_LIBTORRENT + namespace openspace { TorrentError::TorrentError(std::string msg) diff --git a/modules/sync/torrentclient.h b/modules/sync/torrentclient.h index e39ae1a93b..69ee76f6f1 100644 --- a/modules/sync/torrentclient.h +++ b/modules/sync/torrentclient.h @@ -102,10 +102,12 @@ private: void notify(TorrentId id); void pollAlerts(); +#ifdef SYNC_USE_LIBTORRENT libtorrent::session _session; bool _isInitialized = false; - std::atomic_bool _isActive = false; +#endif // SYNC_USE_LIBTORRENT + std::thread _torrentThread; std::condition_variable _abortNotifier; std::mutex _abortMutex; diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 8b58b0a9a8..4df6c302ed 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1326,6 +1326,7 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() { "clusterId", &luascriptfunctions::clusterId, {}, + "", "Returns the zero-based identifier for this OpenSpace instance in a " "cluster configuration. If this instance is not part of a cluster, this " "identifier is always 0." diff --git a/src/properties/scalar/wcharproperty.cpp b/src/properties/scalar/wcharproperty.cpp index ef7c5552c9..07c78317b1 100644 --- a/src/properties/scalar/wcharproperty.cpp +++ b/src/properties/scalar/wcharproperty.cpp @@ -31,6 +31,8 @@ namespace openspace::properties { +int _StubToPreventLinkerWarningAboutMissingExportSymbols; + // #define DEFAULT_FROM_LUA_LAMBDA(wchar_t, DEFAULT_VALUE) // [](lua_State* state, bool& success) -> wchar_t { // success = (lua_isnumber(state, -1) == 1); diff --git a/src/rendering/abufferrenderer.cpp b/src/rendering/abufferrenderer.cpp index b9d0b65012..b490a8659a 100644 --- a/src/rendering/abufferrenderer.cpp +++ b/src/rendering/abufferrenderer.cpp @@ -986,4 +986,6 @@ void ABufferRenderer::saveTextureToMemory(GLenum color_buffer_attachment, int wi } // namespace openspace +#else +int _StubToPreventLinkerWarningAboutMissingExportSymbols; #endif // OPENSPACE_WITH_ABUFFER_RENDERER diff --git a/src/rendering/helper.cpp b/src/rendering/helper.cpp index 72a1f343e6..4db66fc3c1 100644 --- a/src/rendering/helper.cpp +++ b/src/rendering/helper.cpp @@ -262,7 +262,6 @@ void deinitialize() { } glm::mat4 ortho(const glm::vec2& position, const glm::vec2& size, Anchor anchor) { - glm::ivec2 res = global::windowDelegate.currentDrawBufferResolution(); const float xSize = size.x; const float ySize = size.y; float xPos = (position.x - 0.5f) * 2.f; diff --git a/src/rendering/luaconsole.cpp b/src/rendering/luaconsole.cpp index 4636003249..a8a180d8c0 100644 --- a/src/rendering/luaconsole.cpp +++ b/src/rendering/luaconsole.cpp @@ -67,10 +67,6 @@ namespace { // when horizontal scrolling is required. constexpr const int NVisibleCharsAfterCursor = 5; - constexpr std::array UniformNames = { - "res", "color", "height", "ortho" - }; - constexpr openspace::properties::Property::PropertyInfo VisibleInfo = { "IsVisible", "Is Visible", From 14ba7373b9c4249284160a1704b8f66af3330236 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 4 Oct 2018 18:41:55 -0400 Subject: [PATCH 007/109] Reenable the atmosphere on master --- data/assets/default.scene | 3 --- 1 file changed, 3 deletions(-) diff --git a/data/assets/default.scene b/data/assets/default.scene index 5accf4c830..89cb6366f1 100644 --- a/data/assets/default.scene +++ b/data/assets/default.scene @@ -85,9 +85,6 @@ asset.onInitialize(function () nil ) - openspace.setPropertyValueSingle('Scene.EarthAtmosphere.renderable.Enabled', false); - openspace.setPropertyValueSingle('Dashboard.Framerate.FrametimeType', 0); - openspace.navigation.setCameraState({ Focus = earthAsset.Earth.Identifier, From 720336890356452c323fb39dd0a58547c2443afe Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sun, 7 Oct 2018 18:47:05 -0400 Subject: [PATCH 008/109] Update ghoul repository --- ext/ghoul | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ghoul b/ext/ghoul index f3ac3f442c..b36ad8bc6e 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit f3ac3f442c384ba5b0bed5c74e96002ae8f0a0da +Subproject commit b36ad8bc6e72926d7ffb021ecb94ea8439394eec From 53eebb05ba9c57392021858a5543745af9704662 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 8 Oct 2018 00:43:49 -0600 Subject: [PATCH 009/109] Update ghoul repository --- ext/ghoul | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ghoul b/ext/ghoul index f3ac3f442c..21d4450109 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit f3ac3f442c384ba5b0bed5c74e96002ae8f0a0da +Subproject commit 21d44501094cbe61407246cd94d898ff3ee8f507 From 8ddc794cda8cc91c6c7cce5119aaaf0a2530f5c8 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 8 Oct 2018 03:00:35 -0400 Subject: [PATCH 010/109] Feature/alex is flying (#729) * Correctly specify maximum text sizes for grids * Use StaticScale transformations in grids and remove fixed radius * Fix Verifier to let grids accept non-integer min and max sizes * Add a new scale that changes it's value based on the current time and a reference time * Add a proper radiosphere that grows in real time (closes #728) * Add default globe customization folders to the assets (closes #724) * Add new dashboarditem that shows the current camera velocity (closes #702) * Add ability to add interesting times to a scene (closes #715) * Reenable keybindings gui element * Add ShortcutManager * Add ability to bind keyless keybinds to use as arbitrary shortcuts (closes #710) --- data/assets/customization/globebrowsing.asset | 22 +- data/assets/scene/digitaluniverse/grids.asset | 72 +++++- include/openspace/engine/globals.h | 3 + .../openspace/interaction/keybindingmanager.h | 3 +- .../openspace/interaction/shortcutmanager.h | 59 +++++ include/openspace/scene/scene.h | 27 ++ modules/base/CMakeLists.txt | 4 + modules/base/basemodule.cpp | 6 + .../base/dashboard/dashboarditemdistance.cpp | 8 +- .../base/dashboard/dashboarditemvelocity.cpp | 238 ++++++++++++++++++ .../base/dashboard/dashboarditemvelocity.h | 68 +++++ .../rendering/renderablesphericalgrid.cpp | 28 +-- .../base/rendering/renderablesphericalgrid.h | 1 - modules/base/scale/timedependentscale.cpp | 105 ++++++++ modules/base/scale/timedependentscale.h | 54 ++++ .../rendering/renderablebillboardscloud.cpp | 4 +- .../rendering/renderabledumeshes.cpp | 4 +- modules/imgui/CMakeLists.txt | 2 + modules/imgui/include/gui.h | 5 +- modules/imgui/include/guishortcutscomponent.h | 41 +++ modules/imgui/src/guishortcutscomponent.cpp | 109 ++++++++ modules/imgui/src/guispacetimecomponent.cpp | 22 ++ scripts/core_scripts.lua | 14 ++ src/CMakeLists.txt | 3 + src/documentation/core_registration.cpp | 2 + src/engine/globals.cpp | 6 + src/interaction/keybindingmanager.cpp | 6 + src/interaction/shortcutmanager.cpp | 87 +++++++ src/interaction/shortcutmanager_lua.inl | 76 ++++++ src/scene/scene.cpp | 17 ++ src/scene/scene_lua.inl | 20 +- 31 files changed, 1063 insertions(+), 53 deletions(-) create mode 100644 include/openspace/interaction/shortcutmanager.h create mode 100644 modules/base/dashboard/dashboarditemvelocity.cpp create mode 100644 modules/base/dashboard/dashboarditemvelocity.h create mode 100644 modules/base/scale/timedependentscale.cpp create mode 100644 modules/base/scale/timedependentscale.h create mode 100644 modules/imgui/include/guishortcutscomponent.h create mode 100644 modules/imgui/src/guishortcutscomponent.cpp create mode 100644 src/interaction/shortcutmanager.cpp create mode 100644 src/interaction/shortcutmanager_lua.inl diff --git a/data/assets/customization/globebrowsing.asset b/data/assets/customization/globebrowsing.asset index e7dad3f248..726ac0bce9 100644 --- a/data/assets/customization/globebrowsing.asset +++ b/data/assets/customization/globebrowsing.asset @@ -1,6 +1,9 @@ -- Add require statements for assets exporting the neccessary globes -- example: --- asset.require('../scene/solarsystem/planets/mars/mars') +asset.require('../scene/solarsystem/planets/mars/mars') +asset.require('../scene/solarsystem/planets/earth/moon/moon') +asset.require('../scene/solarsystem/planets/mercury/mercury') + local CreateFocusNodes = false @@ -14,11 +17,12 @@ local vrt_folders = { -- Add folders here whose contents will be automatically added to the Mars globe -- If multiple folders are added, the results will be added sequentially, meaning that -- if areas overlap (for example CTX and HiRISE) and CTX is specified *after* HiRISE, - -- CTX will stomp over the HiRISE - -- + -- CTX will stomp over the HiRISE. + -- tl;dr: Specify CTX folders first, then HiRISE -- example: 'C:/OpenSpace/GlobeBrowsingData/Mars/CTX' - '', + openspace.absPath('${BASE}/../OpenSpaceData/Mars/CTX'), + openspace.absPath('${BASE}/../OpenSpaceData/Mars/HiRISE'), '', }, Moon = { @@ -27,6 +31,16 @@ local vrt_folders = { -- if areas overlap, images from the lower results will overwrite the images from former -- results -- example: 'C:/OpenSpace/GlobeBrowsingData/Moon' + openspace.absPath('${BASE}/../OpenSpaceData/Moon'), + '' + }, + Mercury = { + -- Add folders here whose contents will be automatically added to the Mercury globe + -- If multiple folders are added, the results will be added sequentially, meaning that + -- if areas overlap, images from the lower results will overwrite the images from former + -- results + -- example: 'C:/OpenSpace/GlobeBrowsingData/Mercury' + openspace.absPath('${BASE}/../OpenSpaceData/Mercury'), '' } } diff --git a/data/assets/scene/digitaluniverse/grids.asset b/data/assets/scene/digitaluniverse/grids.asset index 50f6319833..94bcbc062c 100644 --- a/data/assets/scene/digitaluniverse/grids.asset +++ b/data/assets/scene/digitaluniverse/grids.asset @@ -9,15 +9,46 @@ local speck = asset.syncedResource({ Version = 1 }) +local radio = { + Identifier = "RadioSphere", + Parent = transforms.SolarSystemBarycenter.Name, + Transform = { + Scale = { + Type = "TimeDependentScale", + ReferenceDate = "1901 DEC 12", -- Marconi's first atlantic transmission + Speed = 299792458 -- c + } + }, + Renderable = { + Type = "RenderableSphericalGrid", + Enabled = false, + GridColor = { 1.0, 1.0, 0.3, 0.75}, + LineWidth = 2.0, + GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, + -0.9938214 , -0.1109906, -0.0003515167, 0.0, + -0.09647644, 0.8622859, 0.4971472 , 0.0, + 0.0 , 0.0 , 0.0 , 1.0 } + }, + GUI = { + Name = "Radio Sphere", + Path = "/Other/Grids" + } +} + local ecliptic = { Identifier = "EclipticSphere", Parent = transforms.SolarSystemBarycenter.Name, + Transform = { + Scale = { + Type = "StaticScale", + Scale = 9.46377307652E17; + } + }, Renderable = { Type = "RenderableSphericalGrid", Enabled = false, GridColor = { 0.7, 0.0, 0.0, 0.5}, LineWidth = 2.0, - Radius = 9.46377307652E17; GridMatrix = { -0.05487554, 0.4941095, -0.8676661 , 0.0, -0.9938214 , -0.1109906, -0.0003515167, 0.0, -0.09647644, 0.8622859, 0.4971472 , 0.0, @@ -38,9 +69,11 @@ local eclipticLabels = { Color = { 1.0, 1.0, 1.0 }, Transparency = 0.65, LabelFile = speck .. "/eclip.label", + DrawLabels = true, TextColor = { 0.5, 0.5, 0.5, 1.0 }, TextSize = 15.4, TextMinSize = 5.0, + TextMaxSize = 18.0, Unit = "pc", TransformationMatrix = { -0.05487554, 0.4941095, -0.8676661, 0.0, @@ -58,12 +91,17 @@ local eclipticLabels = { local equatorial = { Identifier = "EquatorialSphere", Parent = transforms.SolarSystemBarycenter.Name, + Transform = { + Scale = { + Type = "StaticScale", + Scale = 6.2440846E17; + } + }, Renderable = { Type = "RenderableSphericalGrid", Enabled = false, GridColor = { 0.0, 0.0, 1.0, 0.8}, LineWidth = 2.0, - Radius = 6.2440846E17, GridMatrix = { -0.05487554, 0.4941095, -0.8676661, 0.0, -0.8734371 , -0.4448296, -0.1980764, 0.0, -0.483835 , 0.7469823, 0.4559838, 0.0, @@ -84,9 +122,11 @@ local equatorialLabels = { Color = { 1.0, 1.0, 1.0 }, Transparency = 0.65, LabelFile = speck .. "/radec.label", + DrawLabels = true, TextColor = { 0.5, 0.5, 0.5, 1.0 }, TextSize = 15.3, TextMinSize = 5.0, + TextMaxSize = 18.0, Unit = "pc", TransformationMatrix = { -0.05487554, 0.4941095, -0.8676661, 0.0, @@ -104,11 +144,16 @@ local equatorialLabels = { local galactic = { Identifier = "GalacticSphere", Parent = transforms.SolarSystemBarycenter.Name, + Transform = { + Scale = { + Type = "StaticScale", + Scale = 9.46377307652E18; + } + }, Renderable = { Type = "RenderableSphericalGrid", Enabled = false, LineWidth = 2.0, - Radius = 9.46377307652E18; GridColor = { 0.0, 0.6, 0.6, 0.6} }, GUI = { @@ -126,9 +171,11 @@ local galacticLabels = { Color = { 1.0, 1.0, 1.0 }, Transparency = 0.65, LabelFile = speck .. "/galac.label", + DrawLabels = true, TextColor = { 0.5, 0.5, 0.5, 1.0 }, TextSize = 16.25, TextMinSize = 5.0, + TextMaxSize = 18.0, Unit = "pc" }, GUI = { @@ -150,7 +197,8 @@ local plane100kly = { LabelFile = speck .. "/100kly.label", TextColor = { 0.0, 0.2, 0.5, 1.0 }, TextSize = 18.6, - TextMinSize = 7.0, + TextMinSize = 0.5, + TextMaxSize = 30.0, Unit = "Mpc" }, GUI = { @@ -172,7 +220,8 @@ local plane1Mly = { LabelFile = speck .. "/1Mly.label", TextColor = { 0.0, 0.2, 0.5, 1.0 }, TextSize = 19.6, - TextMinSize = 7.0, + TextMinSize = 0.5, + TextMaxSize = 30.0, Unit = "Mpc" }, GUI = { @@ -194,7 +243,8 @@ local plane10Mly = { LabelFile = speck .. "/10Mly.label", TextColor = { 0.0, 0.2, 0.5, 1.0 }, TextSize = 20.6, - TextMinSize = 7.0, + TextMinSize = 0.5, + TextMaxSize = 30.0, Unit = "Mpc" }, GUI = { @@ -216,7 +266,8 @@ local plane100Mly = { LabelFile = speck .. "/100Mly.label", TextColor = { 0.0, 0.2, 0.5, 1.0 }, TextSize = 21.6, - TextMinSize = 7.0, + TextMinSize = 0.5, + TextMaxSize = 30.0, Unit = "Mpc" }, GUI = { @@ -238,7 +289,8 @@ local plane20Gly = { LabelFile = speck .. "/20Gly.label", TextColor = { 0.0, 0.2, 0.5, 1.0 }, TextSize = 23.6, - TextMinSize = 7.0, + TextMinSize = 0.5, + TextMaxSize = 30.0, Unit = "Mpc" }, GUI = { @@ -248,6 +300,6 @@ local plane20Gly = { } assetHelper.registerSceneGraphNodesAndExport(asset, { - ecliptic, eclipticLabels, equatorial, equatorialLabels, galactic, galacticLabels, - plane100kly, plane1Mly, plane10Mly, plane100Mly, plane20Gly + radio, ecliptic, eclipticLabels, equatorial, equatorialLabels, galactic, + galacticLabels, plane100kly, plane1Mly, plane10Mly, plane100Mly, plane20Gly }) diff --git a/include/openspace/engine/globals.h b/include/openspace/engine/globals.h index b5b82d6c5e..8bb19ff8d6 100644 --- a/include/openspace/engine/globals.h +++ b/include/openspace/engine/globals.h @@ -54,6 +54,7 @@ namespace interaction { struct JoystickInputStates; class KeybindingManager; class NavigationHandler; + class ShortcutManager; } // namespace interaction namespace performance { class PerformanceManager; } namespace properties { class PropertyOwner; } @@ -87,6 +88,7 @@ configuration::Configuration& gConfiguration(); interaction::JoystickInputStates& gJoystickInputStates(); interaction::KeybindingManager& gKeybindingManager(); interaction::NavigationHandler& gNavigationHandler(); +interaction::ShortcutManager& gShortcutManager(); performance::PerformanceManager& gPerformanceManager(); properties::PropertyOwner& gRootPropertyOwner(); properties::PropertyOwner& gScreenSpaceRootPropertyOwner(); @@ -118,6 +120,7 @@ static interaction::JoystickInputStates& joystickInputStates = detail::gJoystickInputStates(); static interaction::KeybindingManager& keybindingManager = detail::gKeybindingManager(); static interaction::NavigationHandler& navigationHandler = detail::gNavigationHandler(); +static interaction::ShortcutManager& shortcutManager = detail::gShortcutManager(); static performance::PerformanceManager& performanceManager = detail::gPerformanceManager(); static properties::PropertyOwner& rootPropertyOwner = detail::gRootPropertyOwner(); diff --git a/include/openspace/interaction/keybindingmanager.h b/include/openspace/interaction/keybindingmanager.h index 7ddcc2312a..ce95c7fd36 100644 --- a/include/openspace/interaction/keybindingmanager.h +++ b/include/openspace/interaction/keybindingmanager.h @@ -41,7 +41,6 @@ namespace openspace::interaction { class KeybindingManager : public DocumentationGenerator { public: - BooleanType(IsLocalBind); BooleanType(IsSynchronized); struct KeyInformation { @@ -69,6 +68,8 @@ public: void keyboardCallback(Key key, KeyModifier modifier, KeyAction action); + const std::multimap& keyBindings() const; + private: std::string generateJson() const override; diff --git a/include/openspace/interaction/shortcutmanager.h b/include/openspace/interaction/shortcutmanager.h new file mode 100644 index 0000000000..caab550807 --- /dev/null +++ b/include/openspace/interaction/shortcutmanager.h @@ -0,0 +1,59 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2018 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#ifndef __OPENSPACE_CORE___SHORTCUTSMANAGER___H__ +#define __OPENSPACE_CORE___SHORTCUTSMANAGER___H__ + +#include +#include +#include + +namespace openspace::scripting { struct LuaLibrary; } + +namespace openspace::interaction { + +class ShortcutManager { +public: + BooleanType(IsSynchronized); + + struct ShortcutInformation { + std::string name; + std::string script; + IsSynchronized synchronization; + std::string documentation; + }; + + void resetShortcuts(); + void addShortcut(ShortcutInformation info); + const std::vector& shortcuts() const; + + static scripting::LuaLibrary luaLibrary(); + +private: + std::vector _shortcuts; +}; + +} // namespace openspace::interaction + +#endif // __OPENSPACE_CORE___SHORTCUTSMANAGER___H__ diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index 63ccb15b59..784567ef6c 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -62,6 +62,13 @@ public: const std::string& comp = ""); }; + /// This struct describes a time that has some intrinsic interesting-ness to this + /// scene. + struct InterestingTime { + std::string name; + std::string time; + }; + // constructors & destructor Scene(std::unique_ptr initializer); ~Scene(); @@ -209,6 +216,24 @@ public: */ void updateInterpolations(); + /** + * Adds the provided \p time as an interesting time to this scene. The same time can + * be added multiple times. + * + * \param The time that should be added + * + * \pre \p time.time must not be empty + * \pre \p time.name must not be empty + */ + void addInterestingTime(InterestingTime time); + + /** + * Returns the list of all interesting times that are defined for this scene. + * + * \return The list of all interesting times that are defined for this scene + */ + const std::vector& interestingTimes() const; + /** * Returns the Lua library that contains all Lua functions available to change the * scene graph. The functions contained are @@ -235,6 +260,8 @@ private: SceneGraphNode _rootDummy; std::unique_ptr _initializer; + std::vector _interestingTimes; + std::vector _licenses; std::mutex _programUpdateLock; diff --git a/modules/base/CMakeLists.txt b/modules/base/CMakeLists.txt index f59393c8c8..ad38bfb017 100644 --- a/modules/base/CMakeLists.txt +++ b/modules/base/CMakeLists.txt @@ -34,6 +34,7 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditempropertyvalue.h ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemsimulationincrement.h ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemspacing.h + ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemvelocity.h ${CMAKE_CURRENT_SOURCE_DIR}/lightsource/cameralightsource.h ${CMAKE_CURRENT_SOURCE_DIR}/lightsource/scenegraphlightsource.h ${CMAKE_CURRENT_SOURCE_DIR}/rendering/modelgeometry.h @@ -59,6 +60,7 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.h ${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.h ${CMAKE_CURRENT_SOURCE_DIR}/scale/staticscale.h + ${CMAKE_CURRENT_SOURCE_DIR}/scale/timedependentscale.h ${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeinterval.h ${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeunion.h ) @@ -74,6 +76,7 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditempropertyvalue.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemsimulationincrement.cpp ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemspacing.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemvelocity.cpp ${CMAKE_CURRENT_SOURCE_DIR}/lightsource/cameralightsource.cpp ${CMAKE_CURRENT_SOURCE_DIR}/lightsource/scenegraphlightsource.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/modelgeometry.cpp @@ -99,6 +102,7 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.cpp ${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.cpp ${CMAKE_CURRENT_SOURCE_DIR}/scale/staticscale.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/scale/timedependentscale.cpp ${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeinterval.cpp ${CMAKE_CURRENT_SOURCE_DIR}/timeframe/timeframeunion.cpp ) diff --git a/modules/base/basemodule.cpp b/modules/base/basemodule.cpp index 2c7e56e187..ca6c8e1baa 100644 --- a/modules/base/basemodule.cpp +++ b/modules/base/basemodule.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -109,6 +111,7 @@ void BaseModule::internalInitialize(const ghoul::Dictionary&) { "DashboardItemSimulationIncrement" ); fDashboard->registerClass("DashboardItemSpacing"); + fDashboard->registerClass("DashboardItemVelocity"); auto fRenderable = FactoryManager::ref().factory(); ghoul_assert(fRenderable, "Renderable factory was not created"); @@ -140,6 +143,7 @@ void BaseModule::internalInitialize(const ghoul::Dictionary&) { fScale->registerClass("LuaScale"); fScale->registerClass("StaticScale"); + fScale->registerClass("TimeDependentScale"); auto fTimeFrame = FactoryManager::ref().factory(); ghoul_assert(fTimeFrame, "Scale factory was not created"); @@ -173,6 +177,7 @@ std::vector BaseModule::documentations() const { DashboardItemParallelConnection::Documentation(), DashboardItemSimulationIncrement::Documentation(), DashboardItemSpacing::Documentation(), + DashboardItemVelocity::Documentation(), RenderableModel::Documentation(), RenderablePlane::Documentation(), @@ -191,6 +196,7 @@ std::vector BaseModule::documentations() const { LuaScale::Documentation(), StaticScale::Documentation(), + TimeDependentScale::Documentation(), LuaTranslation::Documentation(), StaticTranslation::Documentation(), diff --git a/modules/base/dashboard/dashboarditemdistance.cpp b/modules/base/dashboard/dashboarditemdistance.cpp index 3a3b484404..71b83ce7f0 100644 --- a/modules/base/dashboard/dashboarditemdistance.cpp +++ b/modules/base/dashboard/dashboarditemdistance.cpp @@ -53,7 +53,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo FontSizeInfo = { "FontSize", "Font Size", - "This value determines the size of the font that is used to render the date." + "This value determines the size of the font that is used to render the distance." }; constexpr openspace::properties::Property::PropertyInfo SourceTypeInfo = { @@ -87,9 +87,9 @@ namespace { constexpr openspace::properties::Property::PropertyInfo SimplificationInfo = { "Simplification", "Simplification", - "If this value is enabled, the distace is displayed in nuanced units, such as " - "km, AU, light years, parsecs, etc. If this value is disabled, it is always " - "displayed in meters." + "If this value is enabled, the distance is displayed in nuanced units, such as " + "km, AU, light years, parsecs, etc. If this value is disabled, the unit can be " + "explicitly requested." }; constexpr openspace::properties::Property::PropertyInfo RequestedUnitInfo = { diff --git a/modules/base/dashboard/dashboarditemvelocity.cpp b/modules/base/dashboard/dashboarditemvelocity.cpp new file mode 100644 index 0000000000..e6d225b321 --- /dev/null +++ b/modules/base/dashboard/dashboarditemvelocity.cpp @@ -0,0 +1,238 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2018 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + constexpr const char* KeyFontMono = "Mono"; + + constexpr const float DefaultFontSize = 10.f; + + constexpr openspace::properties::Property::PropertyInfo FontNameInfo = { + "FontName", + "Font Name", + "This value is the name of the font that is used. It can either refer to an " + "internal name registered previously, or it can refer to a path that is used." + }; + + constexpr openspace::properties::Property::PropertyInfo FontSizeInfo = { + "FontSize", + "Font Size", + "This value determines the size of the font that is used to render the velocity." + }; + + constexpr openspace::properties::Property::PropertyInfo SimplificationInfo = { + "Simplification", + "Simplification", + "If this value is enabled, the velocity is displayed in nuanced units, such as " + "m/s, AU/s, light years / s etc. If this value is disabled, the unit can be " + "explicitly requested." + }; + + constexpr openspace::properties::Property::PropertyInfo RequestedUnitInfo = { + "RequestedUnit", + "Requested Unit", + "If the simplification is disabled, this distance unit is used for the velocity " + "display." + }; + + std::vector unitList() { + std::vector res(openspace::DistanceUnits.size()); + std::transform( + openspace::DistanceUnits.begin(), + openspace::DistanceUnits.end(), + res.begin(), + [](openspace::DistanceUnit unit) -> std::string { + return nameForDistanceUnit(unit); + } + ); + return res; + } +} // namespace + +namespace openspace { + +documentation::Documentation DashboardItemVelocity::Documentation() { + using namespace documentation; + return { + "DashboardItem Velocity", + "base_dashboarditem_velocity", + { + { + "Type", + new StringEqualVerifier("DashboardItemVelocity"), + Optional::No + }, + { + FontNameInfo.identifier, + new StringVerifier, + Optional::Yes, + FontNameInfo.description + }, + { + FontSizeInfo.identifier, + new IntVerifier, + Optional::Yes, + FontSizeInfo.description + }, + { + SimplificationInfo.identifier, + new BoolVerifier, + Optional::Yes, + SimplificationInfo.description + }, + { + RequestedUnitInfo.identifier, + new StringInListVerifier(unitList()), + Optional::Yes, + RequestedUnitInfo.description + } + } + }; +} + +DashboardItemVelocity::DashboardItemVelocity(const ghoul::Dictionary& dictionary) + : DashboardItem(dictionary) + , _fontName(FontNameInfo, KeyFontMono) + , _fontSize(FontSizeInfo, DefaultFontSize, 6.f, 144.f, 1.f) + , _doSimplification(SimplificationInfo, true) + , _requestedUnit(RequestedUnitInfo, properties::OptionProperty::DisplayType::Dropdown) +{ + documentation::testSpecificationAndThrow( + Documentation(), + dictionary, + "DashboardItemVelocity" + ); + + if (dictionary.hasKey(FontNameInfo.identifier)) { + _fontName = dictionary.value(FontNameInfo.identifier); + } + if (dictionary.hasKey(FontSizeInfo.identifier)) { + _fontSize = static_cast(dictionary.value(FontSizeInfo.identifier)); + } + + _fontName.onChange([this]() { + _font = global::fontManager.font(_fontName, _fontSize); + }); + addProperty(_fontName); + + _fontSize.onChange([this]() { + _font = global::fontManager.font(_fontName, _fontSize); + }); + addProperty(_fontSize); + + if (dictionary.hasKey(SimplificationInfo.identifier)) { + _doSimplification = dictionary.value(SimplificationInfo.identifier); + } + _doSimplification.onChange([this]() { + _requestedUnit.setVisibility( + _doSimplification ? + properties::Property::Visibility::Hidden : + properties::Property::Visibility::User + ); + }); + addProperty(_doSimplification); + + for (DistanceUnit u : DistanceUnits) { + _requestedUnit.addOption(static_cast(u), nameForDistanceUnit(u)); + } + _requestedUnit = static_cast(DistanceUnit::Meter); + if (dictionary.hasKey(RequestedUnitInfo.identifier)) { + const std::string& value = dictionary.value( + RequestedUnitInfo.identifier + ); + DistanceUnit unit = distanceUnitFromString(value.c_str()); + _requestedUnit = static_cast(unit); + } + _requestedUnit.setVisibility(properties::Property::Visibility::Hidden); + addProperty(_requestedUnit); + + _font = global::fontManager.font(_fontName, _fontSize); +} + +void DashboardItemVelocity::render(glm::vec2& penPosition) { + const glm::dvec3 currentPos = global::renderEngine.scene()->camera()->positionVec3(); + const glm::dvec3 dt = currentPos - _prevPosition; + const double speedPerFrame = glm::length(dt); + + const double secondsPerFrame = global::windowDelegate.averageDeltaTime(); + + const double speedPerSecond = speedPerFrame / secondsPerFrame; + + std::pair dist; + if (_doSimplification) { + dist = simplifyDistance(speedPerSecond); + } + else { + const DistanceUnit unit = static_cast(_requestedUnit.value()); + const double convertedD = convertDistance(speedPerSecond, unit); + dist = { convertedD, nameForDistanceUnit(unit, convertedD != 1.0) }; + } + + penPosition.y -= _font->height(); + RenderFont( + *_font, + penPosition, + fmt::format( + "Camera velocity: {} {}/s", dist.first, dist.second + ) + ); + + _prevPosition = currentPos; +} + +glm::vec2 DashboardItemVelocity::size() const { + const double d = glm::length(1e20); + std::pair dist; + if (_doSimplification) { + dist = simplifyDistance(d); + } + else { + DistanceUnit unit = static_cast(_requestedUnit.value()); + double convertedD = convertDistance(d, unit); + dist = { convertedD, nameForDistanceUnit(unit, convertedD != 1.0) }; + } + + return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox( + *_font, + fmt::format("Camera velocity: {} {}/s", dist.first, dist.second) + ).boundingBox; +} + +} // namespace openspace diff --git a/modules/base/dashboard/dashboarditemvelocity.h b/modules/base/dashboard/dashboarditemvelocity.h new file mode 100644 index 0000000000..b36f1a8a69 --- /dev/null +++ b/modules/base/dashboard/dashboarditemvelocity.h @@ -0,0 +1,68 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2018 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMVELOCITY___H__ +#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMVELOCITY___H__ + +#include + +#include +#include +#include +#include +#include + +namespace ghoul::fontrendering { class Font; } + +namespace openspace { + +class SceneGraphNode; + +namespace documentation { struct Documentation; } + +class DashboardItemVelocity : public DashboardItem { +public: + DashboardItemVelocity(const ghoul::Dictionary& dictionary); + virtual ~DashboardItemVelocity() = default; + + void render(glm::vec2& penPosition) override; + + glm::vec2 size() const override; + + static documentation::Documentation Documentation(); + +private: + properties::StringProperty _fontName; + properties::FloatProperty _fontSize; + properties::BoolProperty _doSimplification; + properties::OptionProperty _requestedUnit; + + glm::dvec3 _prevPosition; + + std::shared_ptr _font; +}; + +} // namespace openspace + +#endif // __OPENSPACE_MODULE_BASE___DASHBOARDITEMVELOCITY___H__ diff --git a/modules/base/rendering/renderablesphericalgrid.cpp b/modules/base/rendering/renderablesphericalgrid.cpp index 2394b10feb..b09741e43b 100644 --- a/modules/base/rendering/renderablesphericalgrid.cpp +++ b/modules/base/rendering/renderablesphericalgrid.cpp @@ -62,12 +62,6 @@ namespace { "Line Width", "This value specifies the line width of the spherical grid." }; - - constexpr openspace::properties::Property::PropertyInfo RadiusInfo = { - "Radius", - "Radius", - "This value specifies the radius of the grid." - }; } // namespace namespace openspace { @@ -101,12 +95,6 @@ documentation::Documentation RenderableSphericalGrid::Documentation() { new DoubleVerifier, Optional::Yes, LineWidthInfo.description - }, - { - RadiusInfo.identifier, - new DoubleVerifier, - Optional::Yes, - RadiusInfo.description } } }; @@ -125,7 +113,6 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio ) , _segments(SegmentsInfo, 36, 4, 200) , _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f) - , _radius(RadiusInfo, 1e20f, 1.f, 1e35f) { documentation::testSpecificationAndThrow( Documentation(), @@ -159,14 +146,6 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio ); } addProperty(_lineWidth); - - if (dictionary.hasKey(RadiusInfo.identifier)) { - _radius = static_cast( - dictionary.value(RadiusInfo.identifier) - ); - } - _radius.onChange([&]() { _gridIsDirty = true; }); - addProperty(_radius); } bool RenderableSphericalGrid::isReady() const { @@ -257,7 +236,6 @@ void RenderableSphericalGrid::update(const UpdateData&) { int nr = 0; const float fsegments = static_cast(_segments); - const float r = _radius; for (int nSegment = 0; nSegment <= _segments; ++nSegment) { // define an extra vertex around the y-axis due to texture mapping @@ -271,9 +249,9 @@ void RenderableSphericalGrid::update(const UpdateData&) { // azimuth angle (east to west) const float phi = fj * glm::pi() * 2.0f / fsegments; // 0 -> 2*PI - const float x = r * sin(phi) * sin(theta); // - const float y = r * cos(theta); // up - const float z = r * cos(phi) * sin(theta); // + const float x = sin(phi) * sin(theta); // + const float y = cos(theta); // up + const float z = cos(phi) * sin(theta); // glm::vec3 normal = glm::vec3(x, y, z); if (!(x == 0.f && y == 0.f && z == 0.f)) { diff --git a/modules/base/rendering/renderablesphericalgrid.h b/modules/base/rendering/renderablesphericalgrid.h index ee071031a3..71c0a79ddb 100644 --- a/modules/base/rendering/renderablesphericalgrid.h +++ b/modules/base/rendering/renderablesphericalgrid.h @@ -66,7 +66,6 @@ protected: properties::Vec4Property _gridColor; properties::IntProperty _segments; properties::FloatProperty _lineWidth; - properties::FloatProperty _radius; bool _gridIsDirty = true; diff --git a/modules/base/scale/timedependentscale.cpp b/modules/base/scale/timedependentscale.cpp new file mode 100644 index 0000000000..e2b481160e --- /dev/null +++ b/modules/base/scale/timedependentscale.cpp @@ -0,0 +1,105 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2018 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#include + +#include +#include +#include +#include + +namespace { + constexpr openspace::properties::Property::PropertyInfo ReferenceDateInfo = { + "ReferenceDate", + "Reference Date", + "The date at which this scale will be 0. The current value of the scale is " + "computed by taking the difference between the current time and the reference " + "date and multiplying it by the speed. This field must be formatted as: " + "YYYY-MM-DDThh:mm:ss.uuu where h is a 24h clock and u microseconds." + }; + + constexpr openspace::properties::Property::PropertyInfo SpeedInfo = { + "Speed", + "Speed", + "The speed at which the value grows or shrinks. The units for this are meters " + "per second. The default value is 1 m/s." + }; +} // namespace + +namespace openspace { + +documentation::Documentation TimeDependentScale::Documentation() { + using namespace openspace::documentation; + return { + "Timedependent Scaling", + "base_scale_timedependent", + { + { + ReferenceDateInfo.identifier, + new StringVerifier, + Optional::No, + ReferenceDateInfo.description + }, + { + SpeedInfo.identifier, + new DoubleVerifier, + Optional::Yes, + SpeedInfo.description + } + } + }; +} + +TimeDependentScale::TimeDependentScale(const ghoul::Dictionary& dictionary) + : _referenceDate(ReferenceDateInfo, "") + , _speed(SpeedInfo, 1.0, 0.0, 1e12) +{ + documentation::testSpecificationAndThrow( + Documentation(), + dictionary, + "TimeDependentScale" + ); + + _referenceDate = dictionary.value(ReferenceDateInfo.identifier); + _referenceDate.onChange([this]() { _cachedReferenceDirty = true; }); + addProperty(_referenceDate); + + if (dictionary.value(SpeedInfo.identifier)) { + _speed = dictionary.value(SpeedInfo.identifier); + } + addProperty(_speed); +} + +double TimeDependentScale::scaleValue(const UpdateData& data) const { + if (_cachedReferenceDirty) { + _cachedReference = Time::convertTime(_referenceDate); + _cachedReferenceDirty = false; + } + + const double now = data.time.j2000Seconds(); + const double dt = now - _cachedReference; + return dt * _speed; +} + +} // namespace openspace diff --git a/modules/base/scale/timedependentscale.h b/modules/base/scale/timedependentscale.h new file mode 100644 index 0000000000..f5aa44b945 --- /dev/null +++ b/modules/base/scale/timedependentscale.h @@ -0,0 +1,54 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2018 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#ifndef __OPENSPACE_MODULE_BASE___TIMEDEPENDENTSCALE___H__ +#define __OPENSPACE_MODULE_BASE___TIMEDEPENDENTSCALE___H__ + +#include + +#include +#include + +namespace openspace { + +namespace documentation { struct Documentation; } + +class TimeDependentScale : public Scale { +public: + TimeDependentScale(const ghoul::Dictionary& dictionary); + double scaleValue(const UpdateData& data) const override; + + static documentation::Documentation Documentation(); + +private: + properties::StringProperty _referenceDate; + properties::DoubleProperty _speed; + + mutable bool _cachedReferenceDirty = true; + mutable double _cachedReference = 0.0; // in seconds past the J2000 epoch +}; + +} // namespace openspace + +#endif // __OPENSPACE_MODULE_BASE___TIMEDEPENDENTSCALE___H__ diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp index 9c0a405c01..ca900ec1ca 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp @@ -395,8 +395,8 @@ RenderableBillboardsCloud::RenderableBillboardsCloud(const ghoul::Dictionary& di glm::vec4(1.f) ) , _textSize(TextSizeInfo, 8.0, 0.5, 24.0) - , _textMinSize(LabelMinSizeInfo, 8.0, 0.5, 24.0) - , _textMaxSize(LabelMaxSizeInfo, 500.0, 0.0, 1000.0) + , _textMinSize(LabelMinSizeInfo, 8.f, 0.5f, 24.f) + , _textMaxSize(LabelMaxSizeInfo, 20.f, 0.5f, 100.f) , _drawElements(DrawElementsInfo, true) , _drawLabels(DrawLabelInfo, false) , _pixelSizeControl(PixelSizeControlInfo, false) diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.cpp b/modules/digitaluniverse/rendering/renderabledumeshes.cpp index 3c2987d323..18cefd9ed2 100644 --- a/modules/digitaluniverse/rendering/renderabledumeshes.cpp +++ b/modules/digitaluniverse/rendering/renderabledumeshes.cpp @@ -215,13 +215,13 @@ documentation::Documentation RenderableDUMeshes::Documentation() { }, { LabelMinSizeInfo.identifier, - new IntVerifier, + new DoubleVerifier, Optional::Yes, LabelMinSizeInfo.description }, { LabelMaxSizeInfo.identifier, - new IntVerifier, + new DoubleVerifier, Optional::Yes, LabelMaxSizeInfo.description }, diff --git a/modules/imgui/CMakeLists.txt b/modules/imgui/CMakeLists.txt index 01a5cf9ccf..2e92065fc2 100644 --- a/modules/imgui/CMakeLists.txt +++ b/modules/imgui/CMakeLists.txt @@ -38,6 +38,7 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/guiperformancecomponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/guiparallelcomponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/guipropertycomponent.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/guishortcutscomponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/guispacetimecomponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/guiiswacomponent.h ${CMAKE_CURRENT_SOURCE_DIR}/include/imgui_include.h @@ -57,6 +58,7 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/guiperformancecomponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guiparallelcomponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guipropertycomponent.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/guishortcutscomponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guispacetimecomponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guiiswacomponent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/renderproperties.cpp diff --git a/modules/imgui/include/gui.h b/modules/imgui/include/gui.h index 509bf4facd..6653f16523 100644 --- a/modules/imgui/include/gui.h +++ b/modules/imgui/include/gui.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -61,7 +62,7 @@ namespace openspace::gui { namespace detail { constexpr int nComponents() { - const int nRegularComponents = 14; + const int nRegularComponents = 15; int totalComponents = nRegularComponents; #ifdef GLOBEBROWSING_USE_GDAL ++totalComponents; @@ -118,6 +119,7 @@ public: #ifdef OPENSPACE_MODULE_ISWA_ENABLED GuiIswaComponent _iswa; #endif // OPENSPACE_MODULE_ISWA_ENABLED + GuiShortcutsComponent _shortcuts; GuiJoystickComponent _joystick; GuiParallelComponent _parallel; GuiPropertyComponent _featuredProperties; @@ -149,6 +151,7 @@ private: #endif &_asset, + &_shortcuts, &_joystick, &_filePath, diff --git a/modules/imgui/include/guishortcutscomponent.h b/modules/imgui/include/guishortcutscomponent.h new file mode 100644 index 0000000000..6eb2840819 --- /dev/null +++ b/modules/imgui/include/guishortcutscomponent.h @@ -0,0 +1,41 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2018 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#ifndef __OPENSPACE_MODULE_IMGUI___GUISHORTCUTSCOMPONENT___H__ +#define __OPENSPACE_MODULE_IMGUI___GUISHORTCUTSCOMPONENT___H__ + +#include + +namespace openspace::gui { + +class GuiShortcutsComponent : public GuiComponent { +public: + GuiShortcutsComponent(); + + void render() override; +}; + +} // namespace openspace::gui + +#endif // __OPENSPACE_MODULE_IMGUI___GUISHORTCUTSCOMPONENT___H__ diff --git a/modules/imgui/src/guishortcutscomponent.cpp b/modules/imgui/src/guishortcutscomponent.cpp new file mode 100644 index 0000000000..8b717209f4 --- /dev/null +++ b/modules/imgui/src/guishortcutscomponent.cpp @@ -0,0 +1,109 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2018 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +#include + +namespace openspace::gui { + +GuiShortcutsComponent::GuiShortcutsComponent() + : GuiComponent("Shortcuts", "Shortcuts") +{} + +void GuiShortcutsComponent::render() { + ImGui::SetNextWindowCollapsed(_isCollapsed); + + bool v = _isEnabled; + ImGui::Begin("Shortcuts", &v); + _isEnabled = v; + _isCollapsed = ImGui::IsWindowCollapsed(); + + + + // First the actual shortcuts + CaptionText("Shortcuts"); + const std::vector& shortcuts = + global::shortcutManager.shortcuts(); + + for (size_t i = 0; i < shortcuts.size(); ++i) { + const interaction::ShortcutManager::ShortcutInformation& info = shortcuts[i]; + + if (ImGui::Button(info.name.c_str())) { + global::scriptEngine.queueScript( + info.script, + scripting::ScriptEngine::RemoteScripting(info.synchronization) + ); + } + ImGui::SameLine(); + + // Poor mans table layout + ImGui::SetCursorPosX(125.f); + + ImGui::Text("%s", info.documentation.c_str()); + if (!info.synchronization) { + ImGui::SameLine(); + ImGui::Text("(%s)", "local"); + } + } + + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 25.f); + + + + // Then display all the keybinds as buttons as well, for good measure + CaptionText("Keybindings"); + using K = KeyWithModifier; + using V = interaction::KeybindingManager::KeyInformation; + const std::multimap& binds = global::keybindingManager.keyBindings(); + + for (const std::pair& p : binds) { + if (ImGui::Button(ghoul::to_string(p.first).c_str())) { + global::scriptEngine.queueScript( + p.second.command, + scripting::ScriptEngine::RemoteScripting(p.second.synchronization) + ); + } + ImGui::SameLine(); + + // Poor mans table layout + ImGui::SetCursorPosX(125.f); + + ImGui::Text("%s", p.second.documentation.c_str()); + if (!p.second.synchronization) { + ImGui::SameLine(); + ImGui::Text("(%s)", "local"); + } + + } +} + +} // namespace openspace::gui diff --git a/modules/imgui/src/guispacetimecomponent.cpp b/modules/imgui/src/guispacetimecomponent.cpp index e975dda0a3..84568775f5 100644 --- a/modules/imgui/src/guispacetimecomponent.cpp +++ b/modules/imgui/src/guispacetimecomponent.cpp @@ -177,6 +177,28 @@ void GuiSpaceTimeComponent::render() { CaptionText("Time Controls"); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.f); + const std::vector& interestingTimes = + global::renderEngine.scene()->interestingTimes(); + if (!interestingTimes.empty()) { + ImGui::Text("%s", "Interesting Times"); + + for (size_t i = 0; i < interestingTimes.size(); ++i) { + const Scene::InterestingTime& t = interestingTimes[i]; + if (ImGui::Button(t.name.c_str())) { + global::scriptEngine.queueScript( + "openspace.time.setTime(\"" + t.time + "\")", + scripting::ScriptEngine::RemoteScripting::No + ); + } + + if (i != interestingTimes.size() - 1) { + ImGui::SameLine(); + } + } + } + + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.f); + ImGui::Text("Current Date: %s", global::timeManager.time().UTC().c_str()); constexpr int BufferSize = 256; diff --git a/scripts/core_scripts.lua b/scripts/core_scripts.lua index e07db48ad0..073e7d3c7e 100644 --- a/scripts/core_scripts.lua +++ b/scripts/core_scripts.lua @@ -6,6 +6,12 @@ openspace.documentation = { "as interesting, which will provide shortcut access to focus buttons and " .. "featured properties." }, + { + Name = "markInterestingTimes", + Arguments = "List of { Name = '...', Time = '...' } or { '', '