diff --git a/CMakeLists.txt b/CMakeLists.txt index 485d59b487..a67edff2d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,14 +37,11 @@ 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(${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) begin_header("Configuring OpenSpace project") -message(STATUS "CMake version: ${CMAKE_VERSION}") # Bail out if the user tries to generate a 32 bit project. if (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8) @@ -55,26 +52,28 @@ endif () # Cleanup project # ########################################################################################## set(OPENSPACE_APPS_DIR "${OPENSPACE_BASE_DIR}/apps") -set(OPENSPACE_EXT_DIR "${OPENSPACE_BASE_DIR}/ext") -if (NOT EXISTS ${OPENSPACE_EXT_DIR}/ghoul/CMakeLists.txt) - message(FATAL_ERROR "Git submodules are missing. Please run \n" - "git submodule update --init --recursive \n" - "to download the missing dependencies." +if (NOT EXISTS "${OPENSPACE_BASE_DIR}/ext/ghoul/CMakeLists.txt") + message(FATAL_ERROR "Git submodules are missing. Please run " + "git submodule update --init --recursive to download the missing dependencies." ) endif () -set_property(GLOBAL PROPERTY USE_FOLDERS On) +set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER CMake) 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) + CMAKE_OSX_SYSROOT CMAKE_RELEASE_POSTFIX +) # Set build output directories set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${OPENSPACE_CMAKE_EXT_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OPENSPACE_BASE_DIR}/bin) +# "OpenSpace Helper" is not a valid CMake target name under OLD +cmake_policy(SET CMP0037 NEW) + ########################################################################################## # Main # ########################################################################################## @@ -103,7 +102,7 @@ execute_process( ) if (NOT OPENSPACE_GIT_STATUS_RETURN EQUAL 0) set(OPENSPACE_GIT_STATUS "uncommitted changes") -else() +else () set(OPENSPACE_GIT_STATUS "") endif () @@ -133,62 +132,18 @@ if (MSVC) set(GHOUL_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS ${OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS} CACHE BOOL "" FORCE) endif () +option(OPENSPACE_WITH_ABUFFER_RENDERER "Compile ABuffer Renderer" OFF) + if (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++ -lc++abi") endif () -include(src/CMakeLists.txt) +# Add external dependencies +add_subdirectory(${OPENSPACE_BASE_DIR}/ext) -########################################################################################## -# Add external dependencies # -########################################################################################## -# System libraries -if (APPLE) - 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(openspace-core PUBLIC ${CARBON_LIBRARY} ${COREFOUNDATION_LIBRARY} - ${COCOA_LIBRARY} ${APP_SERVICES_LIBRARY}) - end_dependency() -endif () - -# Ghoul -add_subdirectory(${OPENSPACE_EXT_DIR}/ghoul) -target_link_libraries(openspace-core PUBLIC Ghoul) -set_openspace_compile_settings(Ghoul) -set_folder_location(Lua "External") -set_folder_location(lz4 "External") -set_folder_location(GhoulTest "Unit Tests") -link_directories("${GHOUL_LIBRARY_DIRS}") - -# Spice -begin_dependency("Spice") -add_subdirectory(${OPENSPACE_EXT_DIR}/spice) -target_link_libraries(openspace-core PUBLIC 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(openspace-core SYSTEM PUBLIC ${CURL_ROOT_DIR}/include) - target_link_libraries(openspace-core PUBLIC ${CURL_ROOT_DIR}/lib/libcurl.lib) - target_compile_definitions(openspace-core PUBLIC "OPENSPACE_CURL_ENABLED" "CURL_STATICLIB") -else () - find_package(CURL) - if (CURL_FOUND) - target_include_directories(openspace-core SYSTEM PUBLIC ${CURL_INCLUDE_DIRS}) - target_link_libraries(openspace-core PUBLIC ${CURL_LIBRARIES}) - target_compile_definitions(openspace-core PUBLIC "OPENSPACE_CURL_ENABLED") - endif () -endif () -end_dependency() +# include(src/CMakeLists.txt) +add_subdirectory(src) # Qt # Unfortunately, we have to set this value manually; sigh @@ -202,6 +157,7 @@ if (APPLE) "~/Qt/5.10/clang_64/lib/cmake" "~/Qt/5.11/clang_64/lib/cmake" "~/Qt/5.12/clang_64/lib/cmake" + "~/Qt/5.15.1/clang_64/lib/cmake" ) endif () @@ -217,20 +173,17 @@ if (MSVC) 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}") +add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/modules") end_header("End: Configuring Modules") -message(STATUS "") begin_header("Configuring Applications") -handle_applications() +add_subdirectory("${OPENSPACE_APPS_DIR}") end_header("End: Configuring Applications") -message(STATUS "") option(OPENSPACE_HAVE_TESTS "Activate the OpenSpace unit tests" ON) if (OPENSPACE_HAVE_TESTS) begin_header("Generating OpenSpace unit test") - add_subdirectory("${OPENSPACE_BASE_DIR}/tests") + add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/tests") end_header() endif (OPENSPACE_HAVE_TESTS) @@ -252,29 +205,13 @@ if (OPENSPACE_MODULE_WEBBROWSER AND CEF_ROOT) # find CEF to initialize it properly. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBBROWSER_MODULE_PATH}/cmake") include(webbrowser_helpers) -elseif (OPENSPACE_MODULE_WEBBROWSER) - message(WARNING "Web configured to be included, but no CEF_ROOT was found, please try configuring CMake again.") +elseif () + message(WARNING "Web configured to be included, but no CEF_ROOT was found, please try configuring CMake again") endif () ########################################################################################## # Misc settings # ########################################################################################## -option(OPENSPACE_WITH_ABUFFER_RENDERER "Compile ABuffer Renderer" OFF) -if (OPENSPACE_WITH_ABUFFER_RENDERER) - target_compile_definitions(openspace-core PUBLIC "OPENSPACE_WITH_ABUFFER_RENDERER") -endif () - -option(OPENSPACE_WITH_INSTRUMENTATION "Add instrumentation options" OFF) -if (OPENSPACE_WITH_INSTRUMENTATION) - target_compile_definitions(openspace-core PUBLIC "OPENSPACE_WITH_INSTRUMENTATION") -endif () - - -# Just in case, create the bin directory -add_custom_command( - 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) diff --git a/Jenkinsfile b/Jenkinsfile index cee2734009..f4de007c31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -183,20 +183,18 @@ linux_clang_ninja: { windows_msvc: { if (env.USE_BUILD_OS_WINDOWS == 'true') { node('windows') { - ws("${env.JENKINS_BASE}/O/${env.BRANCH_NAME}/${env.BUILD_ID}") { - stage('windows-msvc/scm') { - deleteDir(); - gitHelper.checkoutGit(url, branch); - } - stage('windows-msvc/build') { - compileHelper.build(compileHelper.VisualStudio(), compileHelper.VisualStudio(), moduleCMakeFlags(), '', 'build-msvc'); - compileHelper.recordCompileIssues(compileHelper.VisualStudio()); - } - stage('windows-msvc/test') { - // Currently, the unit tests are failing on Windows - // testHelper.runUnitTests('bin\\Debug\\OpenSpaceTest') - } - } // node('windows') + stage('windows-msvc/scm') { + deleteDir(); + gitHelper.checkoutGit(url, branch); + } + stage('windows-msvc/build') { + compileHelper.build(compileHelper.VisualStudio(), compileHelper.VisualStudio(), moduleCMakeFlags(), '', 'build-msvc'); + compileHelper.recordCompileIssues(compileHelper.VisualStudio()); + } + stage('windows-msvc/test') { + // Currently, the unit tests are failing on Windows + // testHelper.runUnitTests('bin\\Debug\\OpenSpaceTest') + } cleanWs() } // node('windows') } diff --git a/support/cmake/handle_applications.cmake b/apps/CMakeLists.txt similarity index 52% rename from support/cmake/handle_applications.cmake rename to apps/CMakeLists.txt index 45db49da6b..9e5f74234a 100644 --- a/support/cmake/handle_applications.cmake +++ b/apps/CMakeLists.txt @@ -22,63 +22,51 @@ # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # ########################################################################################## - -function (handle_applications) - # Get a list of all of the application directories - file(GLOB appDirs RELATIVE ${OPENSPACE_APPS_DIR} ${OPENSPACE_APPS_DIR}/*) - # Remove the .DS_Store present on Mac - list(REMOVE_ITEM appDirs ".DS_Store") - - # 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}) - set(app_dir "${OPENSPACE_APPS_DIR}/${app}") - string(TOUPPER ${app} upper_app) - - get_application_attribute_default(${app_dir} is_default_application) - option(OPENSPACE_APPLICATION_${upper_app} "Build ${app} application" ${is_default_application}) - endforeach () - - foreach (app ${appDirs}) - set(app_dir "${OPENSPACE_APPS_DIR}/${app}") - string(TOUPPER ${app} upper_app) - if (OPENSPACE_APPLICATION_${upper_app}) - begin_header("Application: ${app}") - add_subdirectory(${app_dir}) - end_header("End: Application: ${app}") - endif () - endforeach () -endfunction() - - # Returns whether the application located at 'path' is a default application or not function (get_application_attribute_default path result) - set(${result} OFF PARENT_SCOPE) - if (EXISTS "${path}/include.cmake") - unset(DEFAULT_APPLICATION) - include(${path}/include.cmake) - if (DEFINED DEFAULT_APPLICATION) - set(${result} ${DEFAULT_APPLICATION} PARENT_SCOPE) - endif () + set(${result} OFF PARENT_SCOPE) + if (EXISTS "${path}/include.cmake") + unset(DEFAULT_APPLICATION) + include(${path}/include.cmake) + if (DEFINED DEFAULT_APPLICATION) + set(${result} ${DEFAULT_APPLICATION} PARENT_SCOPE) endif () + endif () endfunction() + +# Get a list of all of the application directories +file(GLOB app_dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*) +# Remove the .DS_Store present on Mac +list(REMOVE_ITEM app_dirs ".DS_Store") +list(REMOVE_ITEM app_dirs "CMakeLists.txt") + + + + +message(STATUS "Enabled applications:") +foreach (app ${app_dirs}) + string(TOUPPER ${app} upper_app) + if (OPENSPACE_APPLICATION_${upper_app}) + message(STATUS "\t${app} (${CMAKE_CURRENT_SOURCE_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 ${app_dirs}) + set(app_dir "${CMAKE_CURRENT_SOURCE_DIR}/${app}") + string(TOUPPER ${app} upper_app) + + get_application_attribute_default(${app_dir} is_default_application) + option(OPENSPACE_APPLICATION_${upper_app} "Build ${app} application" ${is_default_application}) +endforeach () + +foreach (app ${app_dirs}) + set(app_dir "${CMAKE_CURRENT_SOURCE_DIR}/${app}") + string(TOUPPER ${app} upper_app) + if (OPENSPACE_APPLICATION_${upper_app}) + begin_header("Application: ${app}") + add_subdirectory(${app_dir}) + end_header("End: Application: ${app}") + endif () +endforeach () diff --git a/apps/OpenSpace/CMakeLists.txt b/apps/OpenSpace/CMakeLists.txt index 6df54e9086..0e7c35c378 100644 --- a/apps/OpenSpace/CMakeLists.txt +++ b/apps/OpenSpace/CMakeLists.txt @@ -27,6 +27,9 @@ 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) +# We are getting all_enabled_modules from the handle_applications.cmake file which gets +# it from the main CMakeLists file + ##### # OpenVR ##### @@ -34,8 +37,6 @@ option(OPENSPACE_OPENVR_SUPPORT "Build OpenSpace application with OpenVR support 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) @@ -43,14 +44,14 @@ if (OPENSPACE_OPENVR_SUPPORT) if (WIN32) find_path(SGCT_OPENVR_INCLUDE_DIRECTORY NAMES SGCTOpenVR.h - PATHS ${OPENSPACE_EXT_DIR}/sgct/additional_includes/openvr NO_DEFAULT_PATH + PATHS ${OPENSPACE_BASE_DIR}/ext/sgct/additional_includes/openvr NO_DEFAULT_PATH REQUIRED ) else () find_path(SGCT_OPENVR_INCLUDE_DIRECTORY NAMES SGCTOpenVR.h PATH_SUFFIXES SGCTOpenVR - PATHS ${OPENSPACE_EXT_DIR}/sgct/additional_includes/openvr + PATHS ${OPENSPACE_BASE_DIR}/ext/sgct/additional_includes/openvr REQUIRED ) endif () @@ -89,10 +90,7 @@ create_new_application(OpenSpace ${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns ) -set_source_files_properties( - ${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns - PROPERTIES MACOSX_PACKAGE_LOCATION "Resources" -) +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") target_include_directories( OpenSpace PRIVATE @@ -101,7 +99,7 @@ target_include_directories( ${SPOUT_INCLUDE_DIRS} ) -target_link_libraries(OpenSpace PUBLIC openspace-core ${OPENVR_LIBRARY} ${SPOUT_LIBRARY}) +target_link_libraries(OpenSpace PRIVATE openspace-core openspace-module-collection ${OPENVR_LIBRARY} ${SPOUT_LIBRARY}) target_compile_definitions(OpenSpace PRIVATE ${SGCT_OPENVR_DEFINITIONS} @@ -115,8 +113,7 @@ set(SGCT_DEP_INCLUDE_FREETYPE OFF CACHE BOOL "" FORCE) set(SGCT_DEP_INCLUDE_FMT OFF CACHE BOOL "" FORCE) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/sgct) -target_include_directories(OpenSpace SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ext/sgct/include) -target_link_libraries(OpenSpace PUBLIC sgct) +target_link_libraries(OpenSpace PRIVATE sgct) set_folder_location(sgct "External") set_folder_location(glfw "External/SGCT") @@ -128,15 +125,14 @@ set_folder_location(vrpn "External/SGCT") set_folder_location(zlibstatic "External/SGCT") if (UNIX AND (NOT APPLE)) - target_link_libraries(OpenSpace PUBLIC Xcursor Xinerama X11) + target_link_libraries(OpenSpace PRIVATE Xcursor Xinerama X11) endif () end_header("Dependency: SGCT") begin_header("Dependency: Profile Editor") add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher) -# target_include_directories(OpenSpace SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher/include) -target_link_libraries(OpenSpace PUBLIC openspace-ui-launcher) +target_link_libraries(OpenSpace PRIVATE openspace-ui-launcher) end_header("Dependency: Profile Editor") @@ -158,17 +154,23 @@ if (OPENSPACE_MODULE_WEBBROWSER AND CEF_ROOT) set_cef_targets("${CEF_ROOT}" OpenSpace) run_cef_platform_config("${CEF_ROOT}" "${CEF_TARGET}" "${WEBBROWSER_MODULE_PATH}") -elseif (OPENSPACE_MODULE_WEBBROWSER) + + # @TODO (abock, 2020-12-12) This should be handled more gracefully. Right now we *have* + # to build OpenSpace or otherwise the necessary files will not be copied over + # Copy binary and resource files to the target output directory. + copy_files("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "$") + copy_files("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "$") +elseif () message(WARNING "Web configured to be included, but no CEF_ROOT was found, please try configuring CMake again.") endif () 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 PUBLIC Dbghelp.lib) + target_link_libraries(OpenSpace PRIVATE Dbghelp.lib) end_header() endif () if (OPENSPACE_NVTOOLS_ENABLED) - target_link_libraries(OpenSpace "${OPENSPACE_NVTOOLS_PATH}/lib/x64/nvToolsExt64_1.lib") + target_link_libraries(OpenSpace PRIVATE "${OPENSPACE_NVTOOLS_PATH}/lib/x64/nvToolsExt64_1.lib") endif () diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index 4a3882d46c..930239ffee 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit 4a3882d46cbcaec9675396e9d61bcb985c055323 +Subproject commit 930239ffee6356ce277ad3949ca406b75b8db088 diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 7a47ddb140..fc36b9fc21 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -43,10 +43,8 @@ #include //#include #include -#ifdef _WIN32 +#ifdef WIN32 #define GLFW_EXPOSE_NATIVE_WIN32 -#else -#define GLFW_INCLUDE_NONE #endif #include #include @@ -1014,7 +1012,7 @@ std::string selectedSgctProfileFromLauncher(LauncherWindow& lw, bool hasCliSGCTC return config; } -int main(int argc, char** argv) { +int main(int argc, char* argv[]) { #ifdef WIN32 SetUnhandledExceptionFilter(generateMiniDump); diff --git a/apps/Sync/CMakeLists.txt b/apps/Sync/CMakeLists.txt index 71bfbf3859..b42b225459 100644 --- a/apps/Sync/CMakeLists.txt +++ b/apps/Sync/CMakeLists.txt @@ -37,7 +37,7 @@ create_new_application(Sync MACOSX_BUNDLE ${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns ) -target_link_libraries(Sync PUBLIC openspace-core) +target_link_libraries(Sync PRIVATE openspace-core openspace-module-collection) # Web Browser and Web gui # Why not put these in the module's path? Because they do not have access to the diff --git a/apps/TaskRunner/CMakeLists.txt b/apps/TaskRunner/CMakeLists.txt index 8fa2b9bbd1..d7265796fc 100644 --- a/apps/TaskRunner/CMakeLists.txt +++ b/apps/TaskRunner/CMakeLists.txt @@ -37,7 +37,7 @@ create_new_application(TaskRunner MACOSX_BUNDLE ${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns ) -target_link_libraries(TaskRunner PUBLIC openspace-core) +target_link_libraries(TaskRunner PRIVATE openspace-core openspace-module-collection) # Web Browser and Web gui # Why not put these in the module's path? Because they do not have access to the diff --git a/apps/Wormhole/CMakeLists.txt b/apps/Wormhole/CMakeLists.txt index a268c81d2c..70f356153b 100644 --- a/apps/Wormhole/CMakeLists.txt +++ b/apps/Wormhole/CMakeLists.txt @@ -38,7 +38,7 @@ create_new_application( ${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns ) -target_link_libraries(Wormhole PUBLIC openspace-core) +target_link_libraries(Wormhole PRIVATE openspace-core openspace-module-collection) # Web Browser and Web gui # Why not put these in the module's path? Because they do not have access to the diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt new file mode 100644 index 0000000000..67b61476fe --- /dev/null +++ b/ext/CMakeLists.txt @@ -0,0 +1,76 @@ +########################################################################################## +# # +# OpenSpace # +# # +# Copyright (c) 2014-2020 # +# # +# 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(${OPENSPACE_CMAKE_EXT_DIR}/set_openspace_compile_settings.cmake) + +# System libraries +if (APPLE) + begin_dependency("Core Libraries") + add_library(external-system-apple INTERFACE) + + target_include_directories(external-system-apple INTERFACE "/Developer/Headers/FlatCarbon") + find_library(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED) + find_library(CARBON_LIBRARY Carbon REQUIRED) + find_library(COCOA_LIBRARY Cocoa REQUIRED) # This was Carbon before + find_library(APP_SERVICES_LIBRARY ApplicationServices REQUIRED) + find_library(APPKIT_LIBRARY AppKit REQUIRED) + mark_as_advanced(COREFOUNDATION_LIBRARY CARBON_LIBRARY COCOA_LIBRARY + APP_SERVICES_LIBRARY APPKIT_LIBRARY + ) + target_link_libraries(external-system-apple INTERFACE # This was PUBLIC before + ${CARBON_LIBRARY} ${COREFOUNDATION_LIBRARY} + ${COCOA_LIBRARY} ${APP_SERVICES_LIBRARY} + ${APPKIT_LIBRARY} + ) + end_dependency() +endif () + +# Ghoul +add_subdirectory(ghoul) +set_folder_location(Lua "External") +set_folder_location(lz4 "External") +set_folder_location(GhoulTest "Unit Tests") + +# Spice +begin_dependency("Spice") +add_subdirectory(spice) +set_folder_location(spice "External") +end_dependency() + +# Curl +begin_dependency("CURL") +add_library(external-curl INTERFACE) +if (WIN32) + target_include_directories(external-curl INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/curl/include") + target_link_libraries(external-curl INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/curl/lib/libcurl.lib") + target_compile_definitions(external-curl INTERFACE "OPENSPACE_CURL_ENABLED" "CURL_STATICLIB") +else () + find_package(CURL) + if (CURL_FOUND) + target_include_directories(external-curl INTERFACE ${CURL_INCLUDE_DIRS}) + target_link_libraries(external-curl INTERFACE ${CURL_LIBRARIES}) + target_compile_definitions(external-curl INTERFACE "OPENSPACE_CURL_ENABLED") + endif () +endif () +end_dependency() diff --git a/ext/ghoul b/ext/ghoul index 4ca4101a7a..c59ca6051e 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 4ca4101a7a12fc029ace1a2b47702733c9cb2a02 +Subproject commit c59ca6051e5dbf749a6b29a9c3ff7f856d60c308 diff --git a/ext/spice b/ext/spice index 63e382ac76..ba40ad2c25 160000 --- a/ext/spice +++ b/ext/spice @@ -1 +1 @@ -Subproject commit 63e382ac76e0ef37d46a8a0ec3d1980e480f3f88 +Subproject commit ba40ad2c25fe81e152a733b4a6afe53868388206 diff --git a/include/openspace/engine/moduleengine.h b/include/openspace/engine/moduleengine.h index d12cf5189f..fb2c14c00b 100644 --- a/include/openspace/engine/moduleengine.h +++ b/include/openspace/engine/moduleengine.h @@ -88,8 +88,7 @@ public: * previously * \pre \p module must not be nullptr */ - void registerModule(std::unique_ptr module, - const ghoul::Dictionary& configuration); + void registerModule(std::unique_ptr module); /** * Returns a list of all registered OpenSpaceModule%s that have been registered with diff --git a/include/openspace/json.h b/include/openspace/json.h index 11faafa5cf..8a3a645ced 100644 --- a/include/openspace/json.h +++ b/include/openspace/json.h @@ -36,7 +36,7 @@ #pragma GCC diagnostic ignored "-Wuseless-cast" #endif // __GNUC__ -#include +#include #if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop diff --git a/include/openspace/network/messagestructures.h b/include/openspace/network/messagestructures.h index 5d19824f83..3fe350ddab 100644 --- a/include/openspace/network/messagestructures.h +++ b/include/openspace/network/messagestructures.h @@ -25,9 +25,9 @@ #ifndef __OPENSPACE_CORE___MESSAGESTRUCTURES___H__ #define __OPENSPACE_CORE___MESSAGESTRUCTURES___H__ +#include #include #include -#include #include #include #include diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index 59b03d02b0..0762e54043 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -202,20 +202,6 @@ private: properties::BoolProperty _applyWarping; properties::BoolProperty _showFrameInformation; -#ifdef OPENSPACE_WITH_INSTRUMENTATION - struct FrameInfo { - uint64_t iFrame; - double deltaTime; - double avgDeltaTime; - }; - - struct { - std::vector frames; - uint64_t lastSavedFrame = 0; - uint16_t saveEveryNthFrame = 2048; - } _frameInfo; - properties::BoolProperty _saveFrameInformation; -#endif // OPENSPACE_WITH_INSTRUMENTATION properties::BoolProperty _disableMasterRendering; properties::FloatProperty _globalBlackOutFactor; diff --git a/include/openspace/rendering/transferfunction.h b/include/openspace/rendering/transferfunction.h index 43edecbd53..a65f746415 100644 --- a/include/openspace/rendering/transferfunction.h +++ b/include/openspace/rendering/transferfunction.h @@ -52,12 +52,9 @@ public: glm::vec4 sample(size_t offset); size_t width(); void setCallback(TfChangedCallback callback); - void setTextureFromTxt(std::shared_ptr ptr); + void setTextureFromTxt(); private: - void setTextureFromTxt() { - setTextureFromTxt(_texture); - } void setTextureFromImage(); void uploadTexture(); diff --git a/include/openspace/util/openspacemodule.h b/include/openspace/util/openspacemodule.h index c1f5a2603e..78918d05b1 100644 --- a/include/openspace/util/openspacemodule.h +++ b/include/openspace/util/openspacemodule.h @@ -66,8 +66,7 @@ public: * is set in the OpenSpaceModule constructor. This method will call the * internalInitialize method for further customization for each subclass. */ - void initialize(const ModuleEngine* moduleEngine, - const ghoul::Dictionary& configuration); + void initialize(const ghoul::Dictionary& configuration); /** * This method calls the internalInitializeGL method for further customization for @@ -168,9 +167,6 @@ protected: * Returns a const pointer to the module engine */ const ModuleEngine* moduleEngine() const; - -private: - const ModuleEngine* _moduleEngine = nullptr; }; } // namespace openspace diff --git a/include/openspace/util/spicemanager.h b/include/openspace/util/spicemanager.h index 916dd64f2b..3c2cada852 100644 --- a/include/openspace/util/spicemanager.h +++ b/include/openspace/util/spicemanager.h @@ -35,9 +35,24 @@ #include #include #include + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wold-style-cast" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wold-style-cast" +#endif + #include "SpiceUsr.h" #include "SpiceZpr.h" +#ifdef __clang__ +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + namespace openspace { namespace scripting { struct LuaLibrary; } diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt new file mode 100644 index 0000000000..3c8e3b2c03 --- /dev/null +++ b/modules/CMakeLists.txt @@ -0,0 +1,389 @@ +########################################################################################## +# # +# OpenSpace # +# # +# Copyright (c) 2014-2020 # +# # +# 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(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake) +include(${GHOUL_BASE_DIR}/support/cmake/message_macros.cmake) + + +# This function takes a list of module paths and returns the list of include paths that +# need to be added to the moduleregistration file. Each module files parent directory is +# considered, but with the internal module path ignored +function (get_unique_include_paths module_paths internal_module_path result) + set(res "") + foreach (p ${all_module_paths}) + get_filename_component(base_dir_parent "${p}/.." ABSOLUTE) + get_filename_component(base_dir_grandparent "${p}/../.." ABSOLUTE) + get_filename_component(int_dir "${internal_module_path}/.." ABSOLUTE) + if (NOT ${base_dir_grandparent} STREQUAL ${int_dir}) + # We need to add both parent and grantparent directory: + # The grandparent has to be added if we have an external module in the path + # x/modules/name and we need to add 'x' to the module search path such that + # people can write #include + # + # The parent needs to be included for modules in subdirectories of the form + # openspace/modules/dir/name such that 'dir' is included in the search path + list(APPEND res ${base_dir_parent}) + list(APPEND res ${base_dir_grandparent}) + endif () + endforeach () + + list(REMOVE_DUPLICATES res) + set(${result} ${res} PARENT_SCOPE) +endfunction () + + +# Returns whether the module located at 'path' is a default module or not +function (get_module_attribute_default path result) + set(${result} OFF PARENT_SCOPE) + if (EXISTS "${path}/include.cmake") + unset(DEFAULT_MODULE) + include(${path}/include.cmake) + if (DEFINED DEFAULT_MODULE) + set(${result} ${DEFAULT_MODULE} PARENT_SCOPE) + endif () + endif () +endfunction() + + +# Returns the list of dependencies of the module located at 'path' +function (get_module_attribute_dependencies path result) + set(${result} "" PARENT_SCOPE) + if (EXISTS "${path}/include.cmake") + unset(OPENSPACE_DEPENDENCIES) + include(${path}/${dir}/include.cmake) + if (DEFINED OPENSPACE_DEPENDENCIES) + set(${result} ${OPENSPACE_DEPENDENCIES} PARENT_SCOPE) + endif () + endif () +endfunction() + +# Returns the state whether the module located at 'path' is supported on this machine +function (get_module_attribute_supported path result) + set(${result} ON PARENT_SCOPE) + if (EXISTS "${path}/include.cmake") + unset(SUPPORTED) + include(${path}/${dir}/include.cmake) + if (DEFINED SUPPORTED) + set(${result} ${SUPPORTED} PARENT_SCOPE) + endif () + endif () +endfunction() + + +# Returns the path for the 'module_name'. If the module has not been seen before by +# get_individual_modules, an empty string is returned +function (find_path_for_module module_name module_names module_paths result) + list(FIND module_names ${module_name} i) + if (i EQUAL -1) + # Did not find the name in the list + set(${result} "" PARENT_SCOPE) + else () + # We found the name in the list, so the path is at the same location + list(GET module_paths ${i} path) + set(${result} ${path} PARENT_SCOPE) + endif () +endfunction () + + +# Gets the names of the dependencies of 'module_name' recursively and returns them in +# 'result'. For a dependency chain of a -> b -> c get_recursive_depdencies(a) will +# return "b,c" +function (get_recursive_dependencies module_name module_path module_names module_paths result) + set(result_aggregate "") + get_module_attribute_dependencies(${module_path} deps) + if (deps) + foreach (name ${deps}) + find_path_for_module(${name} "${module_names}" "${module_paths}" path) + if (path) + get_recursive_dependencies( + ${name} ${path} + "${module_names}" "${module_paths}" + res + ) + # 1. We add "base" to the list of dependencies as we always want it + # 2. We add dependencies in this order such that when we later traverse + # this list, we automatically get them in the correct order (meaning + # that we include a dependency first) + set(result_aggregate ${result_aggregate} "base" ${res} ${name}) + else () + message(FATAL_ERROR "Could not find dependency ${name} for module ${module_name}") + endif () + endforeach () + endif () + set(${result} ${result_aggregate} PARENT_SCOPE) +endfunction() + + +# Returns a list of all modules contained in the folder 'path' +function (get_individual_modules path module_names module_paths) + file(GLOB moduleDirs RELATIVE ${path} ${path}/*) + + set(names "") + set(paths "") + foreach (dir ${moduleDirs}) + if (EXISTS "${path}/${dir}/CMakeLists.txt") + list(APPEND names ${dir}) + list(APPEND paths ${path}/${dir}) + else () + # The CMakeLists.txt does not exist, so it might be a group of subdirectories + get_individual_modules(${path}/${dir} _mod_names _mod_paths) + list(APPEND names ${_mod_names}) + list(APPEND paths ${_mod_paths}) + # message(STATUS "Skipping ${dir} as ${dir}/CMakeLists.txt does not exist") + endif () + endforeach () + + set(${module_names} ${names} PARENT_SCOPE) + set(${module_paths} ${paths} PARENT_SCOPE) +endfunction () + + + + + + +set(OPENSPACE_EXTERNAL_MODULES_PATHS "" CACHE STRING "List of external modules") +set(internal_module_path "${OPENSPACE_BASE_DIR}/modules") +set(all_enabled_modules "") + + +# +# Step 1: Get a list of all modules +# +# First get all the internal module +get_individual_modules(${internal_module_path} all_module_names all_module_paths) + +# Then get all external modules +foreach (path ${OPENSPACE_EXTERNAL_MODULES_PATHS}) + get_individual_modules(${path} names paths) + + foreach (n ${names}) + if (${n} IN_LIST all_module_names) + message(FATAL_ERROR "Module name ${n} is not unique among the external directories") + endif () + endforeach () + + set(all_module_names ${all_module_names} ${names}) + set(all_module_paths ${all_module_paths} ${paths}) +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 +# +set(enabled_module_names "") +set(enabled_module_paths "") +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 ${name} (${path}) as it is not supported on this machine") + continue() + endif () + + get_module_attribute_default(${path} is_default_module) + create_option_name(${name} optionName) + option(${optionName} "Build ${path} Module" ${is_default_module}) + + if (${optionName}) + list(APPEND enabled_module_names ${name}) + list(APPEND enabled_module_paths ${path}) + endif () +endforeach () + + +# +# Step 3: For each module that is default or enabled by the user, get the dependencies +# +set(dependencies "") +list(LENGTH enabled_module_names enabled_module_count) +if (${enabled_module_count} EQUAL 0) + message(STATUS "No modules selected") + return() +endif () +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) + + get_recursive_dependencies( + ${name} ${path} + "${all_module_names}" "${all_module_paths}" + deps +) + + set(dependencies ${dependencies} ${deps}) +endforeach() + +# We can remove the duplicates here. We constructed the list such that nested +# dependencies are order left to right. REMOVE_DUPLICATES will keep the left most +# value in the case of duplicates, so that will still work +list(REMOVE_DUPLICATES dependencies) + + +# +# Step 4: Check each dependency and set it, if necessary +# +foreach (dep ${dependencies}) + create_option_name(${dep} optionName) + if (NOT ${optionName}) + set(${optionName} ON CACHE BOOL "Build ${dep} Module" FORCE) + message(STATUS "Due to dependencies, the '${dep}' was enabled") + + find_path_for_module(${dep} "${all_module_names}" "${all_module_paths}" path) + list(APPEND enabled_module_names ${dep}) + list(APPEND enabled_module_paths ${path}) + endif () +endforeach () + +# 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 () + + +# +# Step 5: Add the subdirectories of all enabled modules +# +add_library(openspace-module-collection INTERFACE) +set(module_class_names "") +set(module_external_libraries "") +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) + list(APPEND all_enabled_modules "${library_name}") + begin_header("Module ${name} (${library_name})") + add_subdirectory(${path}) + end_header("End: Module ${name}") + message(STATUS "") + + target_link_libraries(openspace-module-collection INTERFACE ${library_name}) + + # This is just a hack as a dependency from kameleon->core has been introduced that + # should be removed + if (${library_name} STREQUAL "openspace-module-kameleon") + cmake_policy(SET CMP0079 NEW) + target_link_libraries(openspace-core PRIVATE openspace-module-kameleon) + endif () + + create_define_name(${name} define_name) + target_compile_definitions(openspace-module-collection INTERFACE "${define_name}") + + get_property(class_name GLOBAL PROPERTY CurrentModuleClassName) + list(APPEND module_class_names ${class_name}) + + get_property(ext_lib GLOBAL PROPERTY CurrentModuleExternalLibraries) + list(APPEND module_external_libraries ${ext_lib}) +endforeach () + +list(REMOVE_DUPLICATES module_external_libraries) +add_external_library_dependencies("${module_external_libraries}") + + +# +# Step 6: Create the moduleregistration.h file with the header file paths, class +# names and the external module paths. +# The class list needs to be topologically sorted, based on +# the dependency graph, in order to guarantee that modules are +# initialized after their dependencies. +# + +# We generate a list of the names of the enabled modules taking +# the topologically sorted dependencies and adding the rest of the modules. +# REMOVE_DUPLICATES will keep the left most value in the case of duplicates +set(topologically_sorted ${dependencies} ${enabled_module_names}) +list(REMOVE_DUPLICATES topologically_sorted) + +set(MODULE_HEADERS "") +set(MODULE_CLASSES "") +set(MODULE_PATHS "") + +foreach (key RANGE ${enabled_module_count}) + list(GET topologically_sorted ${key} name) + list(FIND enabled_module_names ${name} val) + + list(GET enabled_module_paths ${val} path) + list(GET module_class_names ${val} class_name) + + string(TOUPPER ${name} module_upper) + string(TOLOWER ${name} module_lower) + + create_module_header_filepath(${name} ${path} header_filepath) + + list(APPEND MODULE_HEADERS "#include <${header_filepath}>\n") + list(APPEND MODULE_CLASSES " new ${class_name},\n") +endforeach () + +get_unique_include_paths( + "${enabled_module_paths}" + "${internal_module_path}" + module_paths +) + +foreach (path ${module_paths}) + list(APPEND MODULE_PATHS " \"${path}\",\n") + # 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(openspace-module-collection PUBLIC ${path}) +endforeach () + +if (NOT "${MODULE_HEADERS}" STREQUAL "") + string(REPLACE ";" "" MODULE_HEADERS ${MODULE_HEADERS}) +endif () + +if (NOT "${MODULE_CLASSES}" STREQUAL "") + string(REPLACE ";" "" MODULE_CLASSES ${MODULE_CLASSES}) +endif () + +if (NOT "${MODULE_PATHS}" STREQUAL "") + string(REPLACE ";" "" MODULE_PATHS ${MODULE_PATHS}) + string(REPLACE "\\" "/" MODULE_PATHS ${MODULE_PATHS}) +endif () + +configure_file( + ${OPENSPACE_CMAKE_EXT_DIR}/module_registration.template + ${CMAKE_BINARY_DIR}/_generated/include/openspace/moduleregistration.h +) + +configure_file( + ${OPENSPACE_CMAKE_EXT_DIR}/module_path.template + ${CMAKE_BINARY_DIR}/_generated/include/openspace/modulepath.h +) + +# Return the list of enabled modules to the caller +set(all_enabled_modules ${all_enabled_modules} PARENT_SCOPE) diff --git a/modules/atmosphere/CMakeLists.txt b/modules/atmosphere/CMakeLists.txt index 68f88ebda5..1c7f7b5d5d 100644 --- a/modules/atmosphere/CMakeLists.txt +++ b/modules/atmosphere/CMakeLists.txt @@ -25,46 +25,46 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/atmospheredeferredcaster.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableatmosphere.h + rendering/atmospheredeferredcaster.h + rendering/renderableatmosphere.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/atmospheredeferredcaster.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableatmosphere.cpp + rendering/atmospheredeferredcaster.cpp + rendering/renderableatmosphere.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/atmosphere_common.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/atmosphere_deferred_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/atmosphere_deferred_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaE_calc_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaE_calc_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaJ_calc_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaJ_calc_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaJ_calc_gs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaS_calc_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaS_calc_gs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaS_calc_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaS_sup_calc_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaS_sup_calc_gs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/deltaS_sup_calc_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/inScattering_calc_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/inScattering_calc_gs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/inScattering_calc_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/inScattering_sup_calc_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/inScattering_sup_calc_gs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/inScattering_sup_calc_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/irradiance_calc_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/irradiance_calc_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/irradiance_final_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/irradiance_final_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/irradiance_sup_calc_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/irradiance_sup_calc_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/transmittance_calc_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/transmittance_calc_fs.glsl + shaders/atmosphere_common.glsl + shaders/atmosphere_deferred_vs.glsl + shaders/atmosphere_deferred_fs.glsl + shaders/deltaE_calc_vs.glsl + shaders/deltaE_calc_fs.glsl + shaders/deltaJ_calc_vs.glsl + shaders/deltaJ_calc_fs.glsl + shaders/deltaJ_calc_gs.glsl + shaders/deltaS_calc_vs.glsl + shaders/deltaS_calc_gs.glsl + shaders/deltaS_calc_fs.glsl + shaders/deltaS_sup_calc_vs.glsl + shaders/deltaS_sup_calc_gs.glsl + shaders/deltaS_sup_calc_fs.glsl + shaders/inScattering_calc_vs.glsl + shaders/inScattering_calc_gs.glsl + shaders/inScattering_calc_fs.glsl + shaders/inScattering_sup_calc_vs.glsl + shaders/inScattering_sup_calc_gs.glsl + shaders/inScattering_sup_calc_fs.glsl + shaders/irradiance_calc_vs.glsl + shaders/irradiance_calc_fs.glsl + shaders/irradiance_final_vs.glsl + shaders/irradiance_final_fs.glsl + shaders/irradiance_sup_calc_vs.glsl + shaders/irradiance_sup_calc_fs.glsl + shaders/transmittance_calc_vs.glsl + shaders/transmittance_calc_fs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/atmosphere/rendering/atmospheredeferredcaster.cpp b/modules/atmosphere/rendering/atmospheredeferredcaster.cpp index 00d9cd476a..c5a86c5172 100644 --- a/modules/atmosphere/rendering/atmospheredeferredcaster.cpp +++ b/modules/atmosphere/rendering/atmospheredeferredcaster.cpp @@ -284,7 +284,7 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData& renderData, _time, lt ); - glm::dvec4 sunPosObj = glm::dvec4(0.0); + glm::dvec4 sunPosObj; // Sun following camera position if (_sunFollowingCameraEnabled) { @@ -340,6 +340,15 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData& renderData, SceneGraphNode* casterNode = global::renderEngine->scene()->sceneGraphNode(caster); + if ((sourceNode == nullptr) || (casterNode == nullptr)) { + LERRORC( + "AtmosphereDeferredcaster", + "Invalid scenegraph node for the shadow's caster or shadow's " + "receiver." + ); + return; + } + const double sourceRadiusScale = std::max( glm::compMax(sourceNode->scale()), 1.0 @@ -350,15 +359,6 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData& renderData, 1.0 ); - if ((sourceNode == nullptr) || (casterNode == nullptr)) { - LERRORC( - "AtmosphereDeferredcaster", - "Invalid scenegraph node for the shadow's caster or shadow's " - "receiver." - ); - return; - } - // First we determine if the caster is shadowing the current planet // (all calculations in World Coordinates): glm::dvec3 planetCasterVec = diff --git a/modules/atmosphere/rendering/renderableatmosphere.cpp b/modules/atmosphere/rendering/renderableatmosphere.cpp index c4de1f58a9..2a0291a97d 100644 --- a/modules/atmosphere/rendering/renderableatmosphere.cpp +++ b/modules/atmosphere/rendering/renderableatmosphere.cpp @@ -275,8 +275,8 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) //================================================================ ghoul::Dictionary shadowDictionary; bool success = dictionary.getValue(KeyShadowGroup, shadowDictionary); - bool disableShadows = false; if (success) { + bool disableShadows = false; std::vector> sourceArray; unsigned int sourceCounter = 1; while (success) { @@ -351,10 +351,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) //================================================================ //========== Reads Atmosphere Entries from mod file ============== //================================================================ - bool errorReadingAtmosphereData = false; ghoul::Dictionary atmosphereDictionary; success = dictionary.getValue(keyAtmosphere, atmosphereDictionary); if (success) { + bool errorReadingAtmosphereData = false; if (!atmosphereDictionary.getValue(keyAtmosphereRadius, _atmosphereRadius)) { errorReadingAtmosphereData = true; LWARNINGC( diff --git a/modules/base/CMakeLists.txt b/modules/base/CMakeLists.txt index 0a2c4b4d53..ed840fdc1e 100644 --- a/modules/base/CMakeLists.txt +++ b/modules/base/CMakeLists.txt @@ -25,129 +25,129 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemangle.h - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdate.h - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdistance.h - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemframerate.h - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemmission.h - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemparallelconnection.h - ${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/dashboarditemtext.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 - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/multimodelgeometry.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/grids/renderableboxgrid.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/grids/renderablegrid.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/grids/renderableradialgrid.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/grids/renderablesphericalgrid.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablecartesianaxes.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablelabels.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodel.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablenodeline.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplane.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimagelocal.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimageonline.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphere.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrail.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailorbit.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailtrajectory.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacedashboard.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.h - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/timelinerotation.h - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/constantrotation.h - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/fixedrotation.h - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.h - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.h - ${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.h - ${CMAKE_CURRENT_SOURCE_DIR}/scale/nonuniformstaticscale.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 - ${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.h - ${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.h - ${CMAKE_CURRENT_SOURCE_DIR}/translation/timelinetranslation.h + dashboard/dashboarditemangle.h + dashboard/dashboarditemdate.h + dashboard/dashboarditemdistance.h + dashboard/dashboarditemframerate.h + dashboard/dashboarditemmission.h + dashboard/dashboarditemparallelconnection.h + dashboard/dashboarditempropertyvalue.h + dashboard/dashboarditemsimulationincrement.h + dashboard/dashboarditemspacing.h + dashboard/dashboarditemtext.h + dashboard/dashboarditemvelocity.h + lightsource/cameralightsource.h + lightsource/scenegraphlightsource.h + rendering/modelgeometry.h + rendering/multimodelgeometry.h + rendering/grids/renderableboxgrid.h + rendering/grids/renderablegrid.h + rendering/grids/renderableradialgrid.h + rendering/grids/renderablesphericalgrid.h + rendering/renderablecartesianaxes.h + rendering/renderablelabels.h + rendering/renderablemodel.h + rendering/renderablenodeline.h + rendering/renderableplane.h + rendering/renderableplaneimagelocal.h + rendering/renderableplaneimageonline.h + rendering/renderablesphere.h + rendering/renderabletrail.h + rendering/renderabletrailorbit.h + rendering/renderabletrailtrajectory.h + rendering/screenspacedashboard.h + rendering/screenspaceframebuffer.h + rendering/screenspaceimagelocal.h + rendering/screenspaceimageonline.h + rotation/timelinerotation.h + rotation/constantrotation.h + rotation/fixedrotation.h + rotation/luarotation.h + rotation/staticrotation.h + scale/luascale.h + scale/nonuniformstaticscale.h + scale/staticscale.h + scale/timedependentscale.h + timeframe/timeframeinterval.h + timeframe/timeframeunion.h + translation/luatranslation.h + translation/statictranslation.h + translation/timelinetranslation.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemangle.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdate.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemdistance.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemframerate.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemmission.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditemparallelconnection.cpp - ${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/dashboarditemtext.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 - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/multimodelgeometry.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/grids/renderableboxgrid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/grids/renderablegrid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/grids/renderableradialgrid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/grids/renderablesphericalgrid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablecartesianaxes.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablelabels.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodel.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablenodeline.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplane.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimagelocal.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneimageonline.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphere.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrail.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailorbit.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailtrajectory.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacedashboard.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/timelinerotation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/constantrotation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/fixedrotation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/scale/nonuniformstaticscale.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 - ${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/translation/timelinetranslation.cpp + dashboard/dashboarditemangle.cpp + dashboard/dashboarditemdate.cpp + dashboard/dashboarditemdistance.cpp + dashboard/dashboarditemframerate.cpp + dashboard/dashboarditemmission.cpp + dashboard/dashboarditemparallelconnection.cpp + dashboard/dashboarditempropertyvalue.cpp + dashboard/dashboarditemsimulationincrement.cpp + dashboard/dashboarditemspacing.cpp + dashboard/dashboarditemtext.cpp + dashboard/dashboarditemvelocity.cpp + lightsource/cameralightsource.cpp + lightsource/scenegraphlightsource.cpp + rendering/modelgeometry.cpp + rendering/multimodelgeometry.cpp + rendering/grids/renderableboxgrid.cpp + rendering/grids/renderablegrid.cpp + rendering/grids/renderableradialgrid.cpp + rendering/grids/renderablesphericalgrid.cpp + rendering/renderablecartesianaxes.cpp + rendering/renderablelabels.cpp + rendering/renderablemodel.cpp + rendering/renderablenodeline.cpp + rendering/renderableplane.cpp + rendering/renderableplaneimagelocal.cpp + rendering/renderableplaneimageonline.cpp + rendering/renderablesphere.cpp + rendering/renderabletrail.cpp + rendering/renderabletrailorbit.cpp + rendering/renderabletrailtrajectory.cpp + rendering/screenspacedashboard.cpp + rendering/screenspaceframebuffer.cpp + rendering/screenspaceimagelocal.cpp + rendering/screenspaceimageonline.cpp + rotation/timelinerotation.cpp + rotation/constantrotation.cpp + rotation/fixedrotation.cpp + rotation/luarotation.cpp + rotation/staticrotation.cpp + scale/luascale.cpp + scale/nonuniformstaticscale.cpp + scale/staticscale.cpp + scale/timedependentscale.cpp + timeframe/timeframeinterval.cpp + timeframe/timeframeunion.cpp + translation/luatranslation.cpp + translation/statictranslation.cpp + translation/timelinetranslation.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/axes_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/axes_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/grid_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/grid_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/imageplane_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/imageplane_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/line_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/line_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderabletrail_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderabletrail_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/screenspace_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/screenspace_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/sphere_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/sphere_vs.glsl + shaders/axes_fs.glsl + shaders/axes_vs.glsl + shaders/grid_vs.glsl + shaders/grid_fs.glsl + shaders/imageplane_fs.glsl + shaders/imageplane_vs.glsl + shaders/line_fs.glsl + shaders/line_vs.glsl + shaders/model_fs.glsl + shaders/model_vs.glsl + shaders/plane_fs.glsl + shaders/plane_vs.glsl + shaders/renderabletrail_fs.glsl + shaders/renderabletrail_vs.glsl + shaders/screenspace_fs.glsl + shaders/screenspace_vs.glsl + shaders/sphere_fs.glsl + shaders/sphere_vs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/base/dashboard/dashboarditemangle.cpp b/modules/base/dashboard/dashboarditemangle.cpp index 103ce82d57..d4457ac5b4 100644 --- a/modules/base/dashboard/dashboarditemangle.cpp +++ b/modules/base/dashboard/dashboarditemangle.cpp @@ -353,7 +353,7 @@ void DashboardItemAngle::render(glm::vec2& penPosition) { const glm::dvec3 a = referenceInfo.first - sourceInfo.first; const glm::dvec3 b = destinationInfo.first - sourceInfo.first; - std::fill(_buffer.begin(), _buffer.end(), 0); + std::fill(_buffer.begin(), _buffer.end(), char(0)); if (glm::length(a) == 0.0 || glm::length(b) == 0) { char* end = fmt::format_to( _buffer.data(), diff --git a/modules/base/dashboard/dashboarditemdistance.cpp b/modules/base/dashboard/dashboarditemdistance.cpp index 38632b97ee..f806f22a90 100644 --- a/modules/base/dashboard/dashboarditemdistance.cpp +++ b/modules/base/dashboard/dashboarditemdistance.cpp @@ -173,6 +173,7 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary : DashboardTextItem(dictionary) , _doSimplification(SimplificationInfo, true) , _requestedUnit(RequestedUnitInfo, properties::OptionProperty::DisplayType::Dropdown) + , _formatString(FormatStringInfo, "Distance from {} to {}: {:f} {}") , _source{ properties::OptionProperty( SourceTypeInfo, @@ -189,7 +190,6 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary properties::StringProperty(DestinationNodeNameInfo), nullptr } - , _formatString(FormatStringInfo, "Distance from {} to {}: {:f} {}") { documentation::testSpecificationAndThrow( Documentation(), @@ -358,7 +358,7 @@ std::pair DashboardItemDistance::positionAndLabel( return { mainComp.node->worldPosition(), mainComp.node->guiName() }; case Type::NodeSurface: { - glm::dvec3 otherPos = glm::dvec3(0.0); + glm::dvec3 otherPos; if (otherComp.type == Type::NodeSurface) { // We are only interested in the direction, and we want to prevent // infinite recursion @@ -414,7 +414,7 @@ void DashboardItemDistance::render(glm::vec2& penPosition) { dist = { convertedD, nameForDistanceUnit(unit, convertedD != 1.0) }; } - std::fill(_buffer.begin(), _buffer.end(), 0); + std::fill(_buffer.begin(), _buffer.end(), char(0)); try { char* end = fmt::format_to( _buffer.data(), diff --git a/modules/base/dashboard/dashboarditemframerate.cpp b/modules/base/dashboard/dashboarditemframerate.cpp index 1f38996ffb..93e20cd280 100644 --- a/modules/base/dashboard/dashboarditemframerate.cpp +++ b/modules/base/dashboard/dashboarditemframerate.cpp @@ -247,7 +247,7 @@ void DashboardItemFramerate::render(glm::vec2& penPosition) { FrametimeType frametimeType = FrametimeType(_frametimeType.value()); - std::fill(_buffer.begin(), _buffer.end(), 0); + std::fill(_buffer.begin(), _buffer.end(), char(0)); char* end = format( _buffer, frametimeType, diff --git a/modules/base/dashboard/dashboarditemparallelconnection.cpp b/modules/base/dashboard/dashboarditemparallelconnection.cpp index 8d2d1e3cad..24bf02adf9 100644 --- a/modules/base/dashboard/dashboarditemparallelconnection.cpp +++ b/modules/base/dashboard/dashboarditemparallelconnection.cpp @@ -75,15 +75,14 @@ void DashboardItemParallelConnection::render(glm::vec2& penPosition) { if (status == ParallelConnection::Status::ClientWithHost || status == ParallelConnection::Status::ClientWithoutHost) { - constexpr const char* Singular = "You and {} more client are tuned in"; - constexpr const char* Plural = "You and {} more clients are tuned in"; - connectionInfo += "\n"; if (nClients > 2) { + constexpr const char* Plural = "You and {} more clients are tuned in"; connectionInfo += fmt::format(Plural, nClients - 1); } else if (nClients == 2) { + constexpr const char* Singular = "You and {} more client are tuned in"; connectionInfo += fmt::format(Singular, nClients - 1); } else if (nClients == 1) { @@ -128,14 +127,13 @@ glm::vec2 DashboardItemParallelConnection::size() const { if (status == ParallelConnection::Status::ClientWithHost || status == ParallelConnection::Status::ClientWithoutHost) { - constexpr const char* Singular = "You and {} more client are tuned in"; - constexpr const char* Plural = "You and {} more clients are tuned in"; - connectionInfo += "\n"; if (nClients > 2) { + constexpr const char* Plural = "You and {} more clients are tuned in"; connectionInfo += fmt::format(Plural, nClients); } else if (nClients == 2) { + constexpr const char* Singular = "You and {} more client are tuned in"; connectionInfo += fmt::format(Singular, nClients - 1); } else if (nClients == 1) { diff --git a/modules/base/rendering/renderablelabels.cpp b/modules/base/rendering/renderablelabels.cpp index efadca6ec9..8cd8f806eb 100644 --- a/modules/base/rendering/renderablelabels.cpp +++ b/modules/base/rendering/renderablelabels.cpp @@ -601,11 +601,6 @@ bool RenderableLabels::isReady() const { void RenderableLabels::initialize() { ZoneScoped - bool success = true;// loadData(); - if (!success) { - throw ghoul::RuntimeError("Error loading objects labels data."); - } - setRenderBin(Renderable::RenderBin::PreDeferredTransparent); } diff --git a/modules/base/rotation/fixedrotation.cpp b/modules/base/rotation/fixedrotation.cpp index 6ebf88d97c..d23501759d 100644 --- a/modules/base/rotation/fixedrotation.cpp +++ b/modules/base/rotation/fixedrotation.cpp @@ -569,7 +569,11 @@ glm::dmat3 FixedRotation::matrix(const UpdateData&) const { { LWARNINGC( "FixedRotation", - fmt::format("Near-collinear vectors detected: x ({}) y ({}) z ({})", x, y, z) + fmt::format( + "Near-collinear vectors detected: " + "x ({}, {}, {}) y ({}, {}, {}) z ({}, {}, {})", + x.x, x.y, x.z, y.x, y.y, y.z, z.x, z.y, z.z + ) ); return glm::dmat3(); } diff --git a/modules/cefwebgui/CMakeLists.txt b/modules/cefwebgui/CMakeLists.txt index 0fcab73536..35c27003c4 100644 --- a/modules/cefwebgui/CMakeLists.txt +++ b/modules/cefwebgui/CMakeLists.txt @@ -41,8 +41,6 @@ set(OPENSPACE_SOURCE_FILES ) source_group("Source Files" FILES ${OPENSPACE_SOURCE_FILES}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - create_new_module( CefWebGui cefwebgui_module diff --git a/modules/cefwebgui/include.cmake b/modules/cefwebgui/include.cmake index 188c9c1068..d904a7eb24 100644 --- a/modules/cefwebgui/include.cmake +++ b/modules/cefwebgui/include.cmake @@ -7,6 +7,4 @@ endif () set(OPENSPACE_DEPENDENCIES webbrowser - webgui - server ) diff --git a/modules/debugging/CMakeLists.txt b/modules/debugging/CMakeLists.txt index 41dfdd2605..5c976e673c 100644 --- a/modules/debugging/CMakeLists.txt +++ b/modules/debugging/CMakeLists.txt @@ -25,20 +25,20 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabledebugplane.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/debugrenderer.h + rendering/renderabledebugplane.h + rendering/debugrenderer.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabledebugplane.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/debugrenderer.cpp + rendering/renderabledebugplane.cpp + rendering/debugrenderer.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/debugshader_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/debugshader_fs.glsl + rendering/debugshader_vs.glsl + rendering/debugshader_fs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/debugging/rendering/debugrenderer.cpp b/modules/debugging/rendering/debugrenderer.cpp index 56058fe9eb..b06854cffc 100644 --- a/modules/debugging/rendering/debugrenderer.cpp +++ b/modules/debugging/rendering/debugrenderer.cpp @@ -225,24 +225,4 @@ void DebugRenderer::renderCameraFrustum(const RenderData& data, const Camera& ot glEnable(GL_CULL_FACE); } -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED -const DebugRenderer::Vertices DebugRenderer::verticesFor( - const globebrowsing::AABB3& screenSpaceAABB) const -{ - Vertices vertices(8); - for (size_t i = 0; i < 8; i++) { - const bool cornerIsRight = i % 2 == 0; - const bool cornerIsUp = i > 3; - const bool cornerIsFar = (i / 2) % 2 == 1; - - const double x = cornerIsRight ? screenSpaceAABB.max.x : screenSpaceAABB.min.x; - const double y = cornerIsUp ? screenSpaceAABB.max.y : screenSpaceAABB.min.y; - const double z = cornerIsFar ? screenSpaceAABB.max.z : screenSpaceAABB.min.z; - - vertices[i] = glm::vec4(x, y, z, 1); - } - return vertices; -} -#endif // OPENSPACE_MODULE_GLOBEBROWSING_ENABLED - } // namespace openspace diff --git a/modules/debugging/rendering/debugrenderer.h b/modules/debugging/rendering/debugrenderer.h index 37729510e7..310f1cdcb7 100644 --- a/modules/debugging/rendering/debugrenderer.h +++ b/modules/debugging/rendering/debugrenderer.h @@ -27,10 +27,6 @@ #include -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED -#include -#endif // OPENSPACE_MODULE_GLOBEBROWSING_ENABLED - #include #include #include @@ -132,15 +128,6 @@ public: void renderCameraFrustum(const RenderData& data, const Camera& otherCamera, const glm::vec4& rgba = { 1.f, 1.f, 1.f, 0.3f }) const; -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED - /** - * Takes a AABB3 in screen space and returns vertices representing the corner points - * of the AABB. The ordering of the corner points is compatible with the box - * rendering methods in this class. - */ - const Vertices verticesFor(const globebrowsing::AABB3& screenSpaceAABB) const; -#endif // OPENSPACE_MODULE_GLOBEBROWSING_ENABLED - protected: std::unique_ptr _programObject; diff --git a/modules/digitaluniverse/CMakeLists.txt b/modules/digitaluniverse/CMakeLists.txt index e2f68ab6fa..070b876aa0 100644 --- a/modules/digitaluniverse/CMakeLists.txt +++ b/modules/digitaluniverse/CMakeLists.txt @@ -25,38 +25,38 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablepoints.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabledumeshes.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablebillboardscloud.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanescloud.h + rendering/renderablepoints.h + rendering/renderabledumeshes.h + rendering/renderablebillboardscloud.h + rendering/renderableplanescloud.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablepoints.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabledumeshes.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablebillboardscloud.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanescloud.cpp + rendering/renderablepoints.cpp + rendering/renderabledumeshes.cpp + rendering/renderablebillboardscloud.cpp + rendering/renderableplanescloud.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/pointssprite_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/pointssprite_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/points_sprite_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/points_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/points_gs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/points_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/billboard_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/billboard_gs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/billboard_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/billboardpolygon_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/billboardpolygon_gs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/billboardpolygon_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/dumesh_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/dumesh_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_fs.glsl + shaders/pointssprite_fs.glsl + shaders/pointssprite_vs.glsl + shaders/points_sprite_fs.glsl + shaders/points_fs.glsl + shaders/points_gs.glsl + shaders/points_vs.glsl + shaders/billboard_fs.glsl + shaders/billboard_gs.glsl + shaders/billboard_vs.glsl + shaders/billboardpolygon_fs.glsl + shaders/billboardpolygon_gs.glsl + shaders/billboardpolygon_vs.glsl + shaders/dumesh_vs.glsl + shaders/dumesh_fs.glsl + shaders/plane_vs.glsl + shaders/plane_fs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp index c4fc3bc78a..61d94610f2 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp @@ -1208,7 +1208,7 @@ void RenderableBillboardsCloud::update(const UpdateData&) { ZoneScopedN("Sprite texture") TracyGpuZone("Sprite texture") - ghoul::opengl::Texture* t = _spriteTexture; + ghoul::opengl::Texture* texture = _spriteTexture; unsigned int hash = ghoul::hashCRC32File(_spriteTexturePath); @@ -1225,7 +1225,7 @@ void RenderableBillboardsCloud::update(const UpdateData&) { } ); - DigitalUniverseModule::TextureManager.release(t); + DigitalUniverseModule::TextureManager.release(texture); _spriteTextureIsDirty = false; } } diff --git a/modules/exoplanets/CMakeLists.txt b/modules/exoplanets/CMakeLists.txt index fff4edca01..e3a77cc7b1 100644 --- a/modules/exoplanets/CMakeLists.txt +++ b/modules/exoplanets/CMakeLists.txt @@ -25,25 +25,25 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/exoplanetshelper.h - ${CMAKE_CURRENT_SOURCE_DIR}/exoplanetsmodule.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableorbitdisc.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/exoplanetsdatapreparationtask.h + exoplanetshelper.h + exoplanetsmodule.h + rendering/renderableorbitdisc.h + tasks/exoplanetsdatapreparationtask.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/exoplanetshelper.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/exoplanetsmodule.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/exoplanetsmodule_lua.inl - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableorbitdisc.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/exoplanetsdatapreparationtask.cpp + exoplanetshelper.cpp + exoplanetsmodule.cpp + exoplanetsmodule_lua.inl + rendering/renderableorbitdisc.cpp + tasks/exoplanetsdatapreparationtask.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/orbitdisc_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/orbitdisc_vs.glsl + shaders/orbitdisc_fs.glsl + shaders/orbitdisc_vs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/exoplanets/exoplanetsmodule_lua.inl b/modules/exoplanets/exoplanetsmodule_lua.inl index 8456c34c36..e2ca007a22 100644 --- a/modules/exoplanets/exoplanetsmodule_lua.inl +++ b/modules/exoplanets/exoplanetsmodule_lua.inl @@ -120,7 +120,7 @@ ExoplanetSystem findExoplanetSystemInData(std::string_view starName) { } system.starName = starName; - return std::move(system); + return system; } void createExoplanetSystem(const std::string& starName) { diff --git a/modules/fieldlines/CMakeLists.txt b/modules/fieldlines/CMakeLists.txt index 9a887da930..c252250bd7 100644 --- a/modules/fieldlines/CMakeLists.txt +++ b/modules/fieldlines/CMakeLists.txt @@ -25,19 +25,19 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefieldlines.h + rendering/renderablefieldlines.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefieldlines.cpp + rendering/renderablefieldlines.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/fieldline_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/fieldline_gs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/fieldline_vs.glsl + shaders/fieldline_fs.glsl + shaders/fieldline_gs.glsl + shaders/fieldline_vs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/fieldlines/include.cmake b/modules/fieldlines/include.cmake deleted file mode 100644 index 947e563af0..0000000000 --- a/modules/fieldlines/include.cmake +++ /dev/null @@ -1,4 +0,0 @@ -set (OPENSPACE_DEPENDENCIES - kameleon - space -) \ No newline at end of file diff --git a/modules/fieldlinessequence/CMakeLists.txt b/modules/fieldlinessequence/CMakeLists.txt index 9af2549997..19e66c8f97 100644 --- a/modules/fieldlinessequence/CMakeLists.txt +++ b/modules/fieldlinessequence/CMakeLists.txt @@ -25,24 +25,24 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefieldlinessequence.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/fieldlinesstate.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/commons.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/kameleonfieldlinehelper.h + rendering/renderablefieldlinessequence.h + util/fieldlinesstate.h + util/commons.h + util/kameleonfieldlinehelper.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefieldlinessequence.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/fieldlinesstate.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/commons.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/kameleonfieldlinehelper.cpp + rendering/renderablefieldlinessequence.cpp + util/fieldlinesstate.cpp + util/commons.cpp + util/kameleonfieldlinehelper.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/fieldlinessequence_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/fieldlinessequence_fs.glsl + shaders/fieldlinessequence_vs.glsl + shaders/fieldlinessequence_fs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/fieldlinessequence/include.cmake b/modules/fieldlinessequence/include.cmake index a746e4569e..f6e8111e4e 100644 --- a/modules/fieldlinessequence/include.cmake +++ b/modules/fieldlinessequence/include.cmake @@ -1,3 +1,3 @@ set (OPENSPACE_DEPENDENCIES - space + kameleon ) diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp index 00b57c7e3d..54e904484a 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp @@ -221,7 +221,7 @@ namespace { Invalid }; - float stringToFloat(const std::string input, const float backupValue = 0.f) { + float stringToFloat(const std::string& input, float backupValue = 0.f) { float tmp; try { tmp = std::stof(input); diff --git a/modules/fitsfilereader/CMakeLists.txt b/modules/fitsfilereader/CMakeLists.txt index a95eebce93..1532a9e1b6 100644 --- a/modules/fitsfilereader/CMakeLists.txt +++ b/modules/fitsfilereader/CMakeLists.txt @@ -26,14 +26,14 @@ 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}/fitsfilereadermodule.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/fitsfilereader.h + fitsfilereadermodule.h + include/fitsfilereader.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/fitsfilereadermodule.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/fitsfilereader.cpp + fitsfilereadermodule.cpp + src/fitsfilereader.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) @@ -62,5 +62,5 @@ set(CCfits_BUILD_SHARED_LIBS OFF) disable_external_warnings(cfitsio) disable_external_warnings(CCfits) -target_include_directories(${MODULE_NAME} SYSTEM PUBLIC ${INCLUDES_FOR_TARGET}) -target_link_libraries(${MODULE_NAME} PRIVATE CCfits) +target_include_directories(openspace-module-fitsfilereader SYSTEM PRIVATE ${INCLUDES_FOR_TARGET}) +target_link_libraries(openspace-module-fitsfilereader PRIVATE cfitsio CCfits) diff --git a/modules/fitsfilereader/src/fitsfilereader.cpp b/modules/fitsfilereader/src/fitsfilereader.cpp index 8d978d718a..0ec6aa60f8 100644 --- a/modules/fitsfilereader/src/fitsfilereader.cpp +++ b/modules/fitsfilereader/src/fitsfilereader.cpp @@ -28,9 +28,22 @@ #include #include #include -#include #include +#ifdef WIN32 +#pragma warning (push) +#pragma warning (disable : 4100) // unreferenced formal parameter +#pragma warning (disable : 4267) // conversion from 'size_t' to 'int' +#pragma warning (disable : 4456) // declaration of 'col' hides previous local declaration +#endif // WIN32 + +#include + +#ifdef WIN32 +#pragma warning (pop) +#endif // WIN32 + + using namespace CCfits; namespace { @@ -616,9 +629,9 @@ std::vector FitsFileReader::readSpeckFile(const std::string& filePath, // RenderableGaiaStars expects kiloParsec (because fits file from Vienna had // in kPc). // Thus we need to convert positions twice atm. - renderValues[0] = readValues[0] / 1000.0; // PosX - renderValues[1] = readValues[1] / 1000.0; // PosY - renderValues[2] = readValues[2] / 1000.0; // PosZ + renderValues[0] = readValues[0] / 1000.f; // PosX + renderValues[1] = readValues[1] / 1000.f; // PosY + renderValues[2] = readValues[2] / 1000.f; // PosZ renderValues[3] = readValues[6]; // AbsMag renderValues[4] = readValues[3]; // color renderValues[5] = readValues[13] * readValues[16]; // Vel X diff --git a/modules/gaia/CMakeLists.txt b/modules/gaia/CMakeLists.txt index 782b9ced23..f1cfcf3843 100644 --- a/modules/gaia/CMakeLists.txt +++ b/modules/gaia/CMakeLists.txt @@ -25,41 +25,41 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/gaiamodule.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablegaiastars.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/octreemanager.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/octreeculler.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/readfilejob.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/readfitstask.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/readspecktask.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/constructoctreetask.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/gaiaoptions.h + gaiamodule.h + rendering/renderablegaiastars.h + rendering/octreemanager.h + rendering/octreeculler.h + tasks/readfilejob.h + tasks/readfitstask.h + tasks/readspecktask.h + tasks/constructoctreetask.h + rendering/gaiaoptions.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/gaiamodule.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablegaiastars.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/octreemanager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/octreeculler.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/readfilejob.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/readfitstask.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/readspecktask.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/constructoctreetask.cpp + gaiamodule.cpp + rendering/renderablegaiastars.cpp + rendering/octreemanager.cpp + rendering/octreeculler.cpp + tasks/readfilejob.cpp + tasks/readfitstask.cpp + tasks/readspecktask.cpp + tasks/constructoctreetask.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gaia_vbo_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gaia_ssbo_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gaia_billboard_nofbo_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gaia_billboard_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gaia_billboard_ge.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gaia_point_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gaia_point_ge.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gaia_tonemapping_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gaia_tonemapping_point_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/gaia_tonemapping_billboard_fs.glsl + shaders/gaia_vbo_vs.glsl + shaders/gaia_ssbo_vs.glsl + shaders/gaia_billboard_nofbo_fs.glsl + shaders/gaia_billboard_fs.glsl + shaders/gaia_billboard_ge.glsl + shaders/gaia_point_fs.glsl + shaders/gaia_point_ge.glsl + shaders/gaia_tonemapping_vs.glsl + shaders/gaia_tonemapping_point_fs.glsl + shaders/gaia_tonemapping_billboard_fs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/gaia/include.cmake b/modules/gaia/include.cmake index 98bffaa6bf..a3db024daf 100644 --- a/modules/gaia/include.cmake +++ b/modules/gaia/include.cmake @@ -2,5 +2,4 @@ set(DEFAULT_MODULE ON) set(OPENSPACE_DEPENDENCIES fitsfilereader - globebrowsing ) diff --git a/modules/gaia/rendering/octreemanager.cpp b/modules/gaia/rendering/octreemanager.cpp index 5b56c62816..6c35ccc461 100644 --- a/modules/gaia/rendering/octreemanager.cpp +++ b/modules/gaia/rendering/octreemanager.cpp @@ -407,7 +407,7 @@ std::map> OctreeManager::traverseData(const glm::dmat4& removedKey != _removedKeysInPrevCall.rend(); ++removedKey) { // Uses a reverse loop to try to decrease the biggest chunk. - if (*removedKey == _biggestChunkIndexInUse - 1) { + if (*removedKey == static_cast(_biggestChunkIndexInUse) - 1) { _biggestChunkIndexInUse = *removedKey; LDEBUG(fmt::format( "Decreased size to: {} Free Spots in VBO: {}", @@ -611,7 +611,7 @@ int OctreeManager::readFromFile(std::ifstream& inFileStream, bool readData, )); // Octree Manager root halfDistance must be updated before any nodes are created! - if (MAX_DIST != oldMaxdist) { + if (static_cast(MAX_DIST) != oldMaxdist) { for (size_t i = 0; i < 8; ++i) { _root->Children[i]->halfDimension = MAX_DIST / 2.f; _root->Children[i]->originX = (i % 2 == 0) ? @@ -963,7 +963,7 @@ bool OctreeManager::insertInNode(OctreeNode& node, const std::vector& sta // Node is a leaf and it's not yet full -> insert star. storeStarData(node, starValues); - if (depth > _totalDepth) { + if (depth > static_cast(_totalDepth)) { _totalDepth = depth; } return true; @@ -1355,7 +1355,7 @@ bool OctreeManager::updateBufferIndex(OctreeNode& node) { if (_freeSpotsInBuffer.empty()) { _biggestChunkIndexInUse++; } - else if (_freeSpotsInBuffer.top() > _biggestChunkIndexInUse) { + else if (_freeSpotsInBuffer.top() > static_cast(_biggestChunkIndexInUse)) { _biggestChunkIndexInUse = _freeSpotsInBuffer.top(); } return true; diff --git a/modules/gaia/tasks/readfilejob.cpp b/modules/gaia/tasks/readfilejob.cpp index bf116931d7..fe102d9629 100644 --- a/modules/gaia/tasks/readfilejob.cpp +++ b/modules/gaia/tasks/readfilejob.cpp @@ -203,9 +203,15 @@ void ReadFileJob::execute() { float radVelZ = 1000.f * radial_vel[i] * rGal.z; // Use Pythagoras theorem for the final Space Velocity [m/s]. - values[idx++] = sqrt(pow(radVelX, 2) + pow(tanVelX, 2)); // Vel X [U] - values[idx++] = sqrt(pow(radVelY, 2) + pow(tanVelY, 2)); // Vel Y [V] - values[idx++] = sqrt(pow(radVelZ, 2) + pow(tanVelZ, 2)); // Vel Z [W] + values[idx++] = static_cast( + std::sqrt(std::pow(radVelX, 2) + std::pow(tanVelX, 2)) // Vel X [U] + ); + values[idx++] = static_cast( + std::sqrt(std::pow(radVelY, 2) + std::pow(tanVelY, 2)) // Vel Y [V] + ); + values[idx++] = static_cast( + std::sqrt(std::pow(radVelZ, 2) + std::pow(tanVelZ, 2)) // Vel Z [W] + ); } // Otherwise use the vector [m/s] we got from proper motion. else { diff --git a/modules/galaxy/CMakeLists.txt b/modules/galaxy/CMakeLists.txt index 065f3971bc..6115cc655b 100644 --- a/modules/galaxy/CMakeLists.txt +++ b/modules/galaxy/CMakeLists.txt @@ -25,33 +25,35 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/galaxymodule.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/galaxyraycaster.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablegalaxy.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/milkywayconversiontask.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/milkywaypointsconversiontask.h + galaxymodule.h + rendering/galaxyraycaster.h + rendering/renderablegalaxy.h + tasks/milkywayconversiontask.h + tasks/milkywaypointsconversiontask.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/galaxymodule.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/galaxyraycaster.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablegalaxy.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/milkywayconversiontask.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/milkywaypointsconversiontask.cpp + galaxymodule.cpp + rendering/galaxyraycaster.cpp + rendering/renderablegalaxy.cpp + tasks/milkywayconversiontask.cpp + tasks/milkywaypointsconversiontask.cpp ) + source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/galaxyraycast.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/billboard_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/billboard_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/billboard_ge.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/points_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/points_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/raycasterbounds_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/raycasterbounds_vs.glsl + shaders/galaxyraycast.glsl + shaders/billboard_vs.glsl + shaders/billboard_fs.glsl + shaders/billboard_ge.glsl + shaders/points_fs.glsl + shaders/points_vs.glsl + shaders/raycasterbounds_fs.glsl + shaders/raycasterbounds_vs.glsl ) + source_group("Shader Files" FILES ${SHADER_FILES}) create_new_module( diff --git a/modules/galaxy/include.cmake b/modules/galaxy/include.cmake index 586a4f7717..ffea0ac430 100644 --- a/modules/galaxy/include.cmake +++ b/modules/galaxy/include.cmake @@ -1,6 +1 @@ set(DEFAULT_MODULE ON) - -set (OPENSPACE_DEPENDENCIES - volume - space -) \ No newline at end of file diff --git a/modules/galaxy/rendering/galaxyraycaster.cpp b/modules/galaxy/rendering/galaxyraycaster.cpp index 3faa00b483..65f5b8c86e 100644 --- a/modules/galaxy/rendering/galaxyraycaster.cpp +++ b/modules/galaxy/rendering/galaxyraycaster.cpp @@ -100,7 +100,6 @@ glm::dmat4 GalaxyRaycaster::modelViewTransform(const RenderData& data) { void GalaxyRaycaster::preRaycast(const RaycastData& data, ghoul::opengl::ProgramObject& program) { - const std::string colorUniformName = "color" + std::to_string(data.id); const std::string stepSizeUniformName = "maxStepSize" + std::to_string(data.id); const std::string galaxyTextureUniformName = "galaxyTexture" + std::to_string(data.id); diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index a609917a01..f42a83bf5b 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -25,86 +25,85 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/globebrowsingmodule.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/asynctiledataprovider.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/basictypes.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/dashboarditemglobelocation.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/ellipsoid.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/gdalwrapper.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/geodeticpatch.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/globelabelscomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/globetranslation.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/gpulayergroup.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/layer.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/layeradjustment.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/layergroup.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/layergroupid.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/layermanager.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/layerrendersettings.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/lrucache.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/lrucache.inl - ${CMAKE_CURRENT_SOURCE_DIR}/src/lruthreadpool.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/lruthreadpool.inl - ${CMAKE_CURRENT_SOURCE_DIR}/src/memoryawaretilecache.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/prioritizingconcurrentjobmanager.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/prioritizingconcurrentjobmanager.inl - ${CMAKE_CURRENT_SOURCE_DIR}/src/rawtile.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/rawtiledatareader.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/renderableglobe.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/ringscomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/shadowcomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/skirtedgrid.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/tileindex.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/tileloadjob.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/tileprovider.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/tiletextureinitdata.h - ${CMAKE_CURRENT_SOURCE_DIR}/src/timequantizer.h + globebrowsingmodule.h + src/asynctiledataprovider.h + src/basictypes.h + src/dashboarditemglobelocation.h + src/ellipsoid.h + src/gdalwrapper.h + src/geodeticpatch.h + src/globelabelscomponent.h + src/globetranslation.h + src/gpulayergroup.h + src/layer.h + src/layeradjustment.h + src/layergroup.h + src/layergroupid.h + src/layermanager.h + src/layerrendersettings.h + src/lrucache.h + src/lrucache.inl + src/lruthreadpool.h + src/lruthreadpool.inl + src/memoryawaretilecache.h + src/prioritizingconcurrentjobmanager.h + src/prioritizingconcurrentjobmanager.inl + src/rawtile.h + src/rawtiledatareader.h + src/renderableglobe.h + src/ringscomponent.h + src/shadowcomponent.h + src/skirtedgrid.h + src/tileindex.h + src/tileloadjob.h + src/tileprovider.h + src/tiletextureinitdata.h + src/timequantizer.h ) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/globebrowsingmodule.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/globebrowsingmodule_lua.inl - ${CMAKE_CURRENT_SOURCE_DIR}/src/asynctiledataprovider.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/dashboarditemglobelocation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ellipsoid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/gdalwrapper.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/geodeticpatch.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/globelabelscomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/globetranslation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/gpulayergroup.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/layer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/layeradjustment.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/layergroup.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/layermanager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/layerrendersettings.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/memoryawaretilecache.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/rawtile.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/rawtiledatareader.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/renderableglobe.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/ringscomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/shadowcomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/skirtedgrid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/tileindex.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/tileloadjob.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/tileprovider.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/tiletextureinitdata.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/timequantizer.cpp + globebrowsingmodule.cpp + globebrowsingmodule_lua.inl + src/asynctiledataprovider.cpp + src/dashboarditemglobelocation.cpp + src/ellipsoid.cpp + src/gdalwrapper.cpp + src/geodeticpatch.cpp + src/globelabelscomponent.cpp + src/globetranslation.cpp + src/gpulayergroup.cpp + src/layer.cpp + src/layeradjustment.cpp + src/layergroup.cpp + src/layermanager.cpp + src/layerrendersettings.cpp + src/memoryawaretilecache.cpp + src/rawtiledatareader.cpp + src/renderableglobe.cpp + src/ringscomponent.cpp + src/shadowcomponent.cpp + src/skirtedgrid.cpp + src/tileindex.cpp + src/tileloadjob.cpp + src/tileprovider.cpp + src/tiletextureinitdata.cpp + src/timequantizer.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/blending.hglsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/globalrenderer_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/localrenderer_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderer_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_geom_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_geom_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/texturetilemapping.hglsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/tile.hglsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/tileheight.hglsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/tilevertexskirt.hglsl + shaders/blending.hglsl + shaders/globalrenderer_vs.glsl + shaders/localrenderer_vs.glsl + shaders/renderer_fs.glsl + shaders/rings_vs.glsl + shaders/rings_fs.glsl + shaders/rings_geom_vs.glsl + shaders/rings_geom_fs.glsl + shaders/texturetilemapping.hglsl + shaders/tile.hglsl + shaders/tileheight.hglsl + shaders/tilevertexskirt.hglsl ) source_group("Shader Files" FILES ${SHADER_FILES}) @@ -119,28 +118,13 @@ create_new_module( install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gdal_data DESTINATION modules/globebrowsing) if (WIN32) - target_include_directories( - openspace-module-globebrowsing - SYSTEM PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/include - ) - - target_link_libraries( - openspace-module-globebrowsing - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal_i.lib - ) + target_include_directories(openspace-module-globebrowsing SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/include) + target_link_libraries(openspace-module-globebrowsing PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal_i.lib) register_external_libraries("${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal241.dll") else (WIN32) find_package(GDAL REQUIRED) - target_include_directories( - openspace-module-globebrowsing - SYSTEM PUBLIC - ${GDAL_INCLUDE_DIR} - ) - + target_include_directories(openspace-module-globebrowsing SYSTEM PRIVATE ${GDAL_INCLUDE_DIR}) target_link_libraries(openspace-module-globebrowsing PRIVATE ${GDAL_LIBRARY}) - mark_as_advanced(GDAL_CONFIG GDAL_INCLUDE_DIR GDAL_LIBRARY) endif () # WIN32 diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index 1c49f7ae5e..b37cc025e9 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -121,12 +121,13 @@ namespace { Layer currentLayer; for (int i = 0; i < nSubdatasets; ++i) { int iDataset = -1; - static char IdentifierBuffer[64]; + std::array IdentifierBuffer; + std::fill(IdentifierBuffer.begin(), IdentifierBuffer.end(), '\0'); sscanf( subDatasets[i], - "SUBDATASET_%i_%[^=]", + "SUBDATASET_%i_%256[^=]", &iDataset, - IdentifierBuffer + IdentifierBuffer.data() ); @@ -137,7 +138,7 @@ namespace { currentLayerNumber = iDataset; } - const std::string identifier = std::string(IdentifierBuffer); + const std::string identifier = std::string(IdentifierBuffer.data()); const std::string ds(subDatasets[i]); const std::string value = ds.substr(ds.find_first_of('=') + 1); diff --git a/modules/globebrowsing/include.cmake b/modules/globebrowsing/include.cmake index 7f45a2d151..5667e647fb 100644 --- a/modules/globebrowsing/include.cmake +++ b/modules/globebrowsing/include.cmake @@ -1,6 +1,5 @@ -set (DEFAULT_MODULE ON) - set (OPENSPACE_DEPENDENCIES debugging - space -) \ No newline at end of file +) + +set (DEFAULT_MODULE ON) diff --git a/modules/globebrowsing/src/asynctiledataprovider.cpp b/modules/globebrowsing/src/asynctiledataprovider.cpp index 98f0e35161..654f6de1ce 100644 --- a/modules/globebrowsing/src/asynctiledataprovider.cpp +++ b/modules/globebrowsing/src/asynctiledataprovider.cpp @@ -24,7 +24,6 @@ #include -#include #include #include #include @@ -48,7 +47,6 @@ AsyncTileDataProvider::AsyncTileDataProvider(std::string name, { ZoneScoped - _globeBrowsingModule = global::moduleEngine->module(); performReset(ResetRawTileDataReader::No); } diff --git a/modules/globebrowsing/src/asynctiledataprovider.h b/modules/globebrowsing/src/asynctiledataprovider.h index 00d8230749..c29b12874d 100644 --- a/modules/globebrowsing/src/asynctiledataprovider.h +++ b/modules/globebrowsing/src/asynctiledataprovider.h @@ -33,8 +33,6 @@ #include #include -namespace openspace { class GlobeBrowsingModule; } - namespace openspace::globebrowsing { struct RawTile; @@ -103,7 +101,6 @@ protected: private: const std::string _name; - GlobeBrowsingModule* _globeBrowsingModule; /// The reader used for asynchronous reading std::unique_ptr _rawTileDataReader; diff --git a/modules/globebrowsing/src/dashboarditemglobelocation.cpp b/modules/globebrowsing/src/dashboarditemglobelocation.cpp index cd19cfb440..1d2b460dee 100644 --- a/modules/globebrowsing/src/dashboarditemglobelocation.cpp +++ b/modules/globebrowsing/src/dashboarditemglobelocation.cpp @@ -199,7 +199,7 @@ void DashboardItemGlobeLocation::render(glm::vec2& penPosition) { std::pair dist = simplifyDistance(altitude); - std::fill(_buffer.begin(), _buffer.end(), 0); + std::fill(_buffer.begin(), _buffer.end(), char(0)); char* end = fmt::format_to( _buffer.data(), _formatString.c_str(), diff --git a/modules/globebrowsing/src/gdalwrapper.cpp b/modules/globebrowsing/src/gdalwrapper.cpp index 054f3786fe..4f9399c81b 100644 --- a/modules/globebrowsing/src/gdalwrapper.cpp +++ b/modules/globebrowsing/src/gdalwrapper.cpp @@ -84,14 +84,6 @@ GdalWrapper& GdalWrapper::ref() { return *_singleton; } -int64_t GDALCacheUsed() { - return GDALGetCacheUsed64(); -} - -int64_t GDALMaximumCacheSize() { - return GDALGetCacheMax64(); -} - bool GdalWrapper::logGdalErrors() const { return _logGdalErrors; } diff --git a/modules/globebrowsing/src/gdalwrapper.h b/modules/globebrowsing/src/gdalwrapper.h index afbbe2d211..3da23381c5 100644 --- a/modules/globebrowsing/src/gdalwrapper.h +++ b/modules/globebrowsing/src/gdalwrapper.h @@ -51,18 +51,6 @@ public: static GdalWrapper& ref(); - /** - * Get the current size of the GDAL in memory cache. - * \returns the number of bytes currently in the GDAL memory cache. - */ - static int64_t GDALCacheUsed(); - - /** - * Get the maximum GDAL in memory cache size. - * \returns the maximum number of bytes allowed for the GDAL cache. - */ - static int64_t GDALMaximumCacheSize(); - bool logGdalErrors() const; private: diff --git a/modules/globebrowsing/src/globelabelscomponent.cpp b/modules/globebrowsing/src/globelabelscomponent.cpp index 08e3c19a05..779dbd9947 100644 --- a/modules/globebrowsing/src/globelabelscomponent.cpp +++ b/modules/globebrowsing/src/globelabelscomponent.cpp @@ -524,9 +524,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::string& file) { strncpy(lEntry.feature, token.c_str(), 256); int tokenChar = 0; while (tokenChar < 256) { - if ((lEntry.feature[tokenChar] < 0 || lEntry.feature[tokenChar] > 127) && - lEntry.feature[tokenChar] != '\0') - { + if (lEntry.feature[tokenChar] < 0 && lEntry.feature[tokenChar] != '\0') { lEntry.feature[tokenChar] = '*'; } else if (lEntry.feature[tokenChar] == '\"') { diff --git a/modules/globebrowsing/src/rawtile.cpp b/modules/globebrowsing/src/rawtile.cpp deleted file mode 100644 index 9e626a2d61..0000000000 --- a/modules/globebrowsing/src/rawtile.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2020 * - * * - * 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 - -namespace openspace::globebrowsing { - -RawTile createDefaultTile(TileTextureInitData initData) { - RawTile defaultRes; - std::byte* data = new std::byte[initData.totalNumBytes]; - defaultRes.imageData = std::unique_ptr(data); - std::fill_n(defaultRes.imageData.get(), initData.totalNumBytes, std::byte(0)); - defaultRes.textureInitData = std::move(initData); - return defaultRes; -} - -} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/src/rawtile.h b/modules/globebrowsing/src/rawtile.h index d992466ff6..8360a582b6 100644 --- a/modules/globebrowsing/src/rawtile.h +++ b/modules/globebrowsing/src/rawtile.h @@ -55,8 +55,6 @@ struct RawTile { GLuint pbo = 0; }; -RawTile createDefaultTile(TileTextureInitData initData); - } // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___RAWTILE___H__ diff --git a/modules/globebrowsing/src/rawtiledatareader.cpp b/modules/globebrowsing/src/rawtiledatareader.cpp index 540fbc9795..26e926a963 100644 --- a/modules/globebrowsing/src/rawtiledatareader.cpp +++ b/modules/globebrowsing/src/rawtiledatareader.cpp @@ -946,7 +946,6 @@ TileMetaData RawTileDataReader::tileMetaData(RawTile& rawTile, std::fill(ppData.maxValues.begin(), ppData.maxValues.end(), -FLT_MAX); std::fill(ppData.minValues.begin(), ppData.minValues.end(), FLT_MAX); std::fill(ppData.hasMissingData.begin(), ppData.hasMissingData.end(), false); - std::vector noDataValues(_initData.nRasters, noDataValueAsFloat()); bool allIsMissing = true; for (int y = 0; y < region.numPixels.y; ++y) { diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index d8f8bbbcae..a58b9de396 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -123,12 +123,6 @@ namespace { "" // @TODO Missing documentation }; - constexpr openspace::properties::Property::PropertyInfo ShowChunkAABBInfo = { - "ShowChunkAABB", - "Show chunk AABB", - "" // @TODO Missing documentation - }; - constexpr openspace::properties::Property::PropertyInfo HeightResolutionInfo = { "ShowHeightResolution", "Show height resolution", @@ -524,7 +518,6 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) , _debugProperties({ BoolProperty(ShowChunkEdgeInfo, false), BoolProperty(ShowChunkBoundsInfo, false), - BoolProperty(ShowChunkAABBInfo, false), BoolProperty(HeightResolutionInfo, false), BoolProperty(HeightIntensityInfo, false), BoolProperty(LevelProjectedAreaInfo, true), @@ -1283,13 +1276,12 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, } _localRenderer.program->deactivate(); - if (_debugProperties.showChunkBounds || _debugProperties.showChunkAABB) { + if (_debugProperties.showChunkBounds) { for (int i = 0; i < globalCount; ++i) { debugRenderChunk( *_globalChunkBuffer[i], mvp, - _debugProperties.showChunkBounds, - _debugProperties.showChunkAABB + _debugProperties.showChunkBounds ); } @@ -1297,8 +1289,7 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, debugRenderChunk( *_localChunkBuffer[i], mvp, - _debugProperties.showChunkBounds, - _debugProperties.showChunkAABB + _debugProperties.showChunkBounds ); } } @@ -1560,7 +1551,7 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d } void RenderableGlobe::debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp, - bool renderBounds, bool renderAABB) const + bool renderBounds) const { ZoneScoped @@ -1589,12 +1580,6 @@ void RenderableGlobe::debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp if (renderBounds) { DebugRenderer::ref().renderNiceBox(clippingSpaceCorners, color); } - - if (renderAABB) { - const std::vector& screenSpacePoints = - DebugRenderer::ref().verticesFor(screenSpaceBounds); - DebugRenderer::ref().renderNiceBox(screenSpacePoints, color); - } } ////////////////////////////////////////////////////////////////////////////////////////// @@ -1825,7 +1810,7 @@ void RenderableGlobe::recompileShaders() { shaderDictionary.setValue("nShadowSamples", _generalProperties.nShadowSamples - 1); // Exclise Shadow Samples - int nEclipseShadows = _ellipsoid.shadowConfigurationArray().size(); + int nEclipseShadows = static_cast(_ellipsoid.shadowConfigurationArray().size()); shaderDictionary.setValue("nEclipseShadows", nEclipseShadows - 1); // // Create local shader diff --git a/modules/globebrowsing/src/renderableglobe.h b/modules/globebrowsing/src/renderableglobe.h index 188ec97b5c..27e4a84970 100644 --- a/modules/globebrowsing/src/renderableglobe.h +++ b/modules/globebrowsing/src/renderableglobe.h @@ -124,7 +124,6 @@ private: struct { properties::BoolProperty showChunkEdges; properties::BoolProperty showChunkBounds; - properties::BoolProperty showChunkAABB; properties::BoolProperty showHeightResolution; properties::BoolProperty showHeightIntensities; properties::BoolProperty levelByProjectedAreaElseDistance; @@ -220,7 +219,7 @@ private: ); void debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp, - bool renderBounds, bool renderAABB) const; + bool renderBounds) const; bool isCullableByFrustum(const Chunk& chunk, const RenderData& renderData, const glm::dmat4& mvp) const; diff --git a/modules/globebrowsing/src/tileprovider.cpp b/modules/globebrowsing/src/tileprovider.cpp index a0d6e1b267..7c2f757a52 100644 --- a/modules/globebrowsing/src/tileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider.cpp @@ -460,10 +460,12 @@ std::string consumeTemporalMetaData(TemporalTileProvider& t, const std::string& else { gdalNode = CPLSearchXMLNode(node, "FilePath"); if (gdalNode) { + std::string gdalDescription = std::string(gdalNode->psChild->pszValue); + return gdalDescription; + } + else { return ""; } - std::string gdalDescription = std::string(gdalNode->psChild->pszValue); - return gdalDescription; } } diff --git a/modules/globebrowsing/src/timequantizer.cpp b/modules/globebrowsing/src/timequantizer.cpp index fd03fda9f0..6ef62ea8c8 100644 --- a/modules/globebrowsing/src/timequantizer.cpp +++ b/modules/globebrowsing/src/timequantizer.cpp @@ -477,11 +477,11 @@ bool TimeQuantizer::quantize(Time& t, bool clamp) { // resolutionFraction helps to improve iteration performance constexpr const double ResolutionFraction = 0.7; constexpr const int IterationLimit = 50; - int iterations = 0; - int lastIncr = 0; - int lastDecr = 0; if (_timerange.includes(t)) { + int iterations = 0; + int lastIncr = 0; + int lastDecr = 0; DateTime quantized = DateTime(_timerange.start()); doFirstApproximation(quantized, unquantized, _resolutionValue, _resolutionUnit); double error = unquantized.J2000() - quantized.J2000(); diff --git a/modules/imgui/CMakeLists.txt b/modules/imgui/CMakeLists.txt index 4ea3d8d0d8..5b533161e3 100644 --- a/modules/imgui/CMakeLists.txt +++ b/modules/imgui/CMakeLists.txt @@ -24,47 +24,44 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) -# include(GenerateExportHeader) - set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/include/gui.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/guiassetcomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/guicomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/guifilepathcomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/guigibscomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/guiglobebrowsingcomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/guihelpcomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/guijoystickcomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/guimemorycomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/guimissioncomponent.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 - ${CMAKE_CURRENT_SOURCE_DIR}/include/renderproperties.h + include/gui.h + include/guiassetcomponent.h + include/guicomponent.h + include/guifilepathcomponent.h + include/guigibscomponent.h + include/guiglobebrowsingcomponent.h + include/guihelpcomponent.h + include/guijoystickcomponent.h + include/guimemorycomponent.h + include/guimissioncomponent.h + include/guiparallelcomponent.h + include/guipropertycomponent.h + include/guishortcutscomponent.h + include/guispacetimecomponent.h + include/guiiswacomponent.h + include/imgui_include.h + include/renderproperties.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/src/gui.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guiassetcomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guicomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guifilepathcomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guigibscomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guiglobebrowsingcomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guihelpcomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guijoystickcomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guimemorycomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/guimissioncomponent.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 - + src/gui.cpp + src/guiassetcomponent.cpp + src/guicomponent.cpp + src/guifilepathcomponent.cpp + src/guigibscomponent.cpp + src/guiglobebrowsingcomponent.cpp + src/guihelpcomponent.cpp + src/guijoystickcomponent.cpp + src/guimemorycomponent.cpp + src/guimissioncomponent.cpp + src/guiparallelcomponent.cpp + src/guipropertycomponent.cpp + src/guishortcutscomponent.cpp + src/guispacetimecomponent.cpp + src/guiiswacomponent.cpp + src/renderproperties.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) @@ -74,8 +71,6 @@ set(SHADER_FILES ) source_group("Shader Files" FILES ${SHADER_FILES}) -# set(openspace-module-imgui_LIBRARY_MODE SHARED) - create_new_module( "ImGUI" imgui_module @@ -83,6 +78,4 @@ create_new_module( ${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES} ) -include_external_library(${imgui_module} PRIVATE Imgui ${CMAKE_CURRENT_SOURCE_DIR}/ext/imgui) - -# generate_export_header(${imgui_module} EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/_generated/include/imgui_export.h) +include_external_library(${imgui_module} PRIVATE Imgui ${CMAKE_CURRENT_SOURCE_DIR}/ext/imgui ${CMAKE_CURRENT_SOURCE_DIR}/ext/imgui) diff --git a/modules/imgui/include/imgui_include.h b/modules/imgui/include/imgui_include.h index 3aafc34c8c..6a29f0501a 100644 --- a/modules/imgui/include/imgui_include.h +++ b/modules/imgui/include/imgui_include.h @@ -30,8 +30,9 @@ #pragma clang diagnostic ignored "-Wold-style-cast" #elif (defined __GNUC__) #pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" +#pragma GCC diagnostic ignored "-Wclass-memaccess" #pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" #endif // __clang__ #include diff --git a/modules/imgui/src/guiglobebrowsingcomponent.cpp b/modules/imgui/src/guiglobebrowsingcomponent.cpp index 70a712a4f5..8eb6ef4019 100644 --- a/modules/imgui/src/guiglobebrowsingcomponent.cpp +++ b/modules/imgui/src/guiglobebrowsingcomponent.cpp @@ -188,7 +188,7 @@ void GuiGlobeBrowsingComponent::render() { urlInfo.cbegin(), urlInfo.cend(), std::string(), - [](std::string lhs, const UrlInfo& i) { + [](const std::string& lhs, const UrlInfo& i) { return lhs + i.name + ": (" + i.url + ")" + '\0'; } ); @@ -257,17 +257,11 @@ void GuiGlobeBrowsingComponent::render() { } - if (iServer < 0) { - return; - } - _currentServer = urlInfo[iServer].name; - - - // Can't use urlIt here since it might have been invalidated before - if (urlInfo.empty()) { + if (iServer < 0 || urlInfo.empty()) { // There are no server so we have to bail return; } + _currentServer = urlInfo[iServer].name; ImGui::Separator(); diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp index 96ca7bcd26..a8186b7d89 100644 --- a/modules/imgui/src/guipropertycomponent.cpp +++ b/modules/imgui/src/guipropertycomponent.cpp @@ -83,7 +83,7 @@ namespace { } struct TreeNode { - TreeNode(std::string p) + explicit TreeNode(std::string p) : path(std::move(p)) #ifdef Debugging_ImGui_TreeNode_Indices , index(nextIndex++) diff --git a/modules/iswa/CMakeLists.txt b/modules/iswa/CMakeLists.txt index 1edcd9d964..843884ab1a 100644 --- a/modules/iswa/CMakeLists.txt +++ b/modules/iswa/CMakeLists.txt @@ -25,51 +25,51 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/datacygnet.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/dataplane.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/datasphere.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/kameleonplane.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswabasegroup.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswacygnet.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswadatagroup.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswakameleongroup.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacecygnet.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/texturecygnet.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/textureplane.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/dataprocessor.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/dataprocessorjson.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/dataprocessorkameleon.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/dataprocessortext.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/iswamanager.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/iswamanager_lua.inl + rendering/datacygnet.h + rendering/dataplane.h + rendering/datasphere.h + rendering/kameleonplane.h + rendering/iswabasegroup.h + rendering/iswacygnet.h + rendering/iswadatagroup.h + rendering/iswakameleongroup.h + rendering/screenspacecygnet.h + rendering/texturecygnet.h + rendering/textureplane.h + util/dataprocessor.h + util/dataprocessorjson.h + util/dataprocessorkameleon.h + util/dataprocessortext.h + util/iswamanager.h + util/iswamanager_lua.inl ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/util/dataprocessor.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/dataprocessorjson.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/dataprocessorkameleon.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/dataprocessortext.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/iswamanager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/datacygnet.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/dataplane.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/datasphere.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswabasegroup.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswacygnet.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswadatagroup.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/iswakameleongroup.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/kameleonplane.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacecygnet.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/texturecygnet.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/textureplane.cpp + util/dataprocessor.cpp + util/dataprocessorjson.cpp + util/dataprocessorkameleon.cpp + util/dataprocessortext.cpp + util/iswamanager.cpp + rendering/datacygnet.cpp + rendering/dataplane.cpp + rendering/datasphere.cpp + rendering/iswabasegroup.cpp + rendering/iswacygnet.cpp + rendering/iswadatagroup.cpp + rendering/iswakameleongroup.cpp + rendering/kameleonplane.cpp + rendering/screenspacecygnet.cpp + rendering/texturecygnet.cpp + rendering/textureplane.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/dataplane_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/dataplane_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/textureplane_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/textureplane_vs.glsl + shaders/dataplane_fs.glsl + shaders/dataplane_vs.glsl + shaders/textureplane_fs.glsl + shaders/textureplane_vs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/iswa/include.cmake b/modules/iswa/include.cmake index 9c6bb4a938..f6e8111e4e 100644 --- a/modules/iswa/include.cmake +++ b/modules/iswa/include.cmake @@ -1,5 +1,3 @@ set (OPENSPACE_DEPENDENCIES - base kameleon - space -) \ No newline at end of file +) diff --git a/modules/iswa/util/dataprocessor.cpp b/modules/iswa/util/dataprocessor.cpp index 0bda04e042..673cd6f26b 100644 --- a/modules/iswa/util/dataprocessor.cpp +++ b/modules/iswa/util/dataprocessor.cpp @@ -182,7 +182,9 @@ void DataProcessor::add(const std::vector>& optionValues, values.begin(), values.end(), 0.f, - [mean](float l, float r) { return l + pow(r - mean, 2); } + [mean](float l, float r) { + return l + static_cast(std::pow(r - mean, 2)); + } ); const float standardDeviation = sqrt(variance / numValues); @@ -190,8 +192,9 @@ void DataProcessor::add(const std::vector>& optionValues, const float oldMean = (1.f / _numValues[i]) * _sum[i]; _sum[i] += sum[i]; - _standardDeviation[i] = sqrt(pow(standardDeviation, 2) + - pow(_standardDeviation[i], 2)); + _standardDeviation[i] = static_cast( + std::sqrt(std::pow(standardDeviation, 2) + std::pow(_standardDeviation[i], 2)) + ); _numValues[i] += numValues; const float min = normalizeWithStandardScore( diff --git a/modules/kameleon/CMakeLists.txt b/modules/kameleon/CMakeLists.txt index c82a216b5a..d34b17ae0f 100644 --- a/modules/kameleon/CMakeLists.txt +++ b/modules/kameleon/CMakeLists.txt @@ -25,15 +25,19 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) include(${GHOUL_BASE_DIR}/support/cmake/handle_external_library.cmake) +# Use _ROOT variables +# https://cmake.org/cmake/help/git-stage/policy/CMP0074.html +cmake_policy(SET CMP0074 NEW) + set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/include/kameleonwrapper.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/kameleonhelper.h + include/kameleonwrapper.h + include/kameleonhelper.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/src/kameleonwrapper.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/kameleonhelper.cpp + src/kameleonwrapper.cpp + src/kameleonhelper.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) @@ -60,29 +64,16 @@ target_link_libraries(${kameleon_module} PRIVATE 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") - target_compile_definitions(ccmc PRIVATE "_SCL_SECURE_NO_WARNINGS") - else () - target_compile_options(ccmc PRIVATE "-w") - endif () -endif () +disable_external_warnings(ccmc) set_folder_location(ccmc "External") if (TARGET cdf) - if (GHOUL_DISABLE_EXTERNAL_WARNINGS) - if (MSVC) - target_compile_options(cdf PRIVATE "/W0" "/MP") - target_compile_definitions(cdf PRIVATE "_SCL_SECURE_NO_WARNINGS") - else () - target_compile_options(cdf PRIVATE "-w") - endif () - endif () + disable_external_warnings(cdf) set_folder_location(cdf "External") endif () -# Boost -find_package(Boost REQUIRED) -target_include_directories(openspace-module-kameleon SYSTEM PUBLIC ${Boost_INCLUDE_DIRS}) -#include_external_library(${onscreengui_module} Imgui ${CMAKE_CURRENT_SOURCE_DIR}/ext/kameleon) +if (WIN32) + target_compile_options(ccmc PRIVATE /MP) + if (TARGET cdf) + target_compile_options(cdf PRIVATE /MP) + endif () +endif () diff --git a/modules/kameleon/ext/kameleon b/modules/kameleon/ext/kameleon index 338d482c86..606edb945b 160000 --- a/modules/kameleon/ext/kameleon +++ b/modules/kameleon/ext/kameleon @@ -1 +1 @@ -Subproject commit 338d482c8617bfacda0a5af8f3f6bb23163d436f +Subproject commit 606edb945b62d0151f20270ddb2db4a9f558aaa1 diff --git a/modules/kameleon/include.cmake b/modules/kameleon/include.cmake deleted file mode 100644 index 63c20b8181..0000000000 --- a/modules/kameleon/include.cmake +++ /dev/null @@ -1,3 +0,0 @@ -set (OPENSPACE_DEPENDENCIES - space -) \ No newline at end of file diff --git a/modules/kameleon/include/kameleonwrapper.h b/modules/kameleon/include/kameleonwrapper.h index 6c5e728553..8d00cf000a 100644 --- a/modules/kameleon/include/kameleonwrapper.h +++ b/modules/kameleon/include/kameleonwrapper.h @@ -88,7 +88,7 @@ public: const glm::size3_t& outDimensions) const; float* uniformSliceValues(const std::string& var, const glm::size3_t& outDimensions, - const float& zSlice) const; + float zSlice) const; float* uniformSampledVectorValues(const std::string& xVar, const std::string& yVar, const std::string& zVar, const glm::size3_t& outDimensions) const; @@ -116,7 +116,6 @@ public: std::array gridVariables() const; - Model model() const; GridType gridType() const; std::string parent() const; diff --git a/modules/kameleon/src/kameleonhelper.cpp b/modules/kameleon/src/kameleonhelper.cpp index 53bbf3f08a..b84fff0474 100644 --- a/modules/kameleon/src/kameleonhelper.cpp +++ b/modules/kameleon/src/kameleonhelper.cpp @@ -77,7 +77,6 @@ double getTime(ccmc::Kameleon* kameleon) { // redundant! std::string seqStartStr; - double seqStartDbl; if (kameleon->doesAttributeExist("start_time")){ seqStartStr = kameleon->getGlobalAttribute("start_time").getAttributeString(); @@ -126,13 +125,13 @@ double getTime(ccmc::Kameleon* kameleon) { "No starting time attribute could be found in the .cdf file. Starting " "time is set to 01.JAN.2000 12:00." ); - seqStartDbl = 0.0; } if (seqStartStr.length() == 19) { seqStartStr += ".000Z"; } + double seqStartDbl; if (seqStartStr.length() == 24) { seqStartDbl = Time::convertTime( seqStartStr.substr(0, seqStartStr.length() - 2) diff --git a/modules/kameleon/src/kameleonwrapper.cpp b/modules/kameleon/src/kameleonwrapper.cpp index 6f725b1c2b..a0837bd1b7 100644 --- a/modules/kameleon/src/kameleonwrapper.cpp +++ b/modules/kameleon/src/kameleonwrapper.cpp @@ -81,20 +81,20 @@ std::array gridVariables(ccmc::Model* model) { std::string z = std::move(tokens.at(2)); std::transform( - x.begin(), - x.end(), + x.cbegin(), + x.cend(), x.begin(), [](char c) { return static_cast(tolower(c)); } ); std::transform( - y.begin(), - y.end(), + y.cbegin(), + y.cend(), y.begin(), [](char c) { return static_cast(tolower(c)); } ); std::transform( - z.begin(), - z.end(), + z.cbegin(), + z.cend(), z.begin(), [](char c) { return static_cast(tolower(c)); } ); @@ -331,7 +331,7 @@ float* KameleonWrapper::uniformSampledValues(const std::string& var, // This method returns new'd memory, turn into std::vector instead? float* KameleonWrapper::uniformSliceValues(const std::string& var, const glm::size3_t& outDimensions, - const float& slice) const + float slice) const { ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); LINFO(fmt::format( diff --git a/modules/kameleonvolume/CMakeLists.txt b/modules/kameleonvolume/CMakeLists.txt index 37897ab5e5..cb36ab4563 100644 --- a/modules/kameleonvolume/CMakeLists.txt +++ b/modules/kameleonvolume/CMakeLists.txt @@ -25,20 +25,20 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/kameleonvolumereader.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablekameleonvolume.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/kameleondocumentationtask.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/kameleonmetadatatojsontask.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/kameleonvolumetorawtask.h + kameleonvolumereader.h + rendering/renderablekameleonvolume.h + tasks/kameleondocumentationtask.h + tasks/kameleonmetadatatojsontask.h + tasks/kameleonvolumetorawtask.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/kameleonvolumereader.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablekameleonvolume.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/kameleondocumentationtask.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/kameleonmetadatatojsontask.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/kameleonvolumetorawtask.cpp + kameleonvolumereader.cpp + rendering/renderablekameleonvolume.cpp + tasks/kameleondocumentationtask.cpp + tasks/kameleonmetadatatojsontask.cpp + tasks/kameleonvolumetorawtask.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) diff --git a/modules/kameleonvolume/kameleonvolumemodule.h b/modules/kameleonvolume/kameleonvolumemodule.h index 41c47dbc58..0c3ffa75fd 100644 --- a/modules/kameleonvolume/kameleonvolumemodule.h +++ b/modules/kameleonvolume/kameleonvolumemodule.h @@ -26,6 +26,7 @@ #define __OPENSPACE_MODULE_KAMELEONVOLUME___KAMELEONVOLUMEMODULE___H__ #include + #include namespace openspace { diff --git a/modules/kameleonvolume/kameleonvolumereader.cpp b/modules/kameleonvolume/kameleonvolumereader.cpp index 0df6caca5d..9bba62ea06 100644 --- a/modules/kameleonvolume/kameleonvolumereader.cpp +++ b/modules/kameleonvolume/kameleonvolumereader.cpp @@ -39,6 +39,7 @@ #pragma warning (disable : 4800) // #pragma warning: there is no warning number '4800' #endif // WIN32 +#include #include #include #include @@ -78,7 +79,7 @@ KameleonVolumeReader::KameleonVolumeReader(std::string path) : _path(std::move(p throw ghoul::FileNotFoundError(_path); } - const long status = _kameleon.open(_path); + const long status = _kameleon->open(_path); if (status != ccmc::FileReader::OK) { LERROR(fmt::format("Failed to open file '{}' with Kameleon", _path)); throw ghoul::RuntimeError("Failed to open file: " + _path + " with Kameleon"); @@ -86,10 +87,12 @@ KameleonVolumeReader::KameleonVolumeReader(std::string path) : _path(std::move(p // Possibly use a kameleon interpolator instead of a model interpolator? _interpolator = std::unique_ptr( - _kameleon.model->createNewInterpolator() + _kameleon->model->createNewInterpolator() ); } +KameleonVolumeReader::~KameleonVolumeReader() {} + std::unique_ptr> KameleonVolumeReader::readFloatVolume( const glm::uvec3 & dimensions, const std::string& variable, @@ -145,28 +148,28 @@ std::unique_ptr> KameleonVolumeReader::readFloatVolume( std::vector KameleonVolumeReader::variableNames() const { std::vector variableNames; - const int nVariables = _kameleon.model->getNumberOfVariables(); + const int nVariables = _kameleon->model->getNumberOfVariables(); for (int i = 0; i < nVariables; ++i) { - variableNames.push_back(_kameleon.model->getVariableName(i)); + variableNames.push_back(_kameleon->model->getVariableName(i)); } return variableNames; } std::vector KameleonVolumeReader::variableAttributeNames() const { - return _kameleon.model->getVariableAttributeNames(); + return _kameleon->model->getVariableAttributeNames(); } std::vector KameleonVolumeReader::globalAttributeNames() const { std::vector attributeNames; - const int nAttributes = _kameleon.model->getNumberOfGlobalAttributes(); + const int nAttributes = _kameleon->model->getNumberOfGlobalAttributes(); for (int i = 0; i < nAttributes; ++i) { - attributeNames.push_back(_kameleon.model->getGlobalAttributeName(i)); + attributeNames.push_back(_kameleon->model->getGlobalAttributeName(i)); } return attributeNames; } std::array KameleonVolumeReader::gridVariableNames() const { - return openspace::gridVariables(_kameleon.model); + return openspace::gridVariables(_kameleon->model); } void KameleonVolumeReader::addAttributeToDictionary(ghoul::Dictionary& dictionary, @@ -190,7 +193,7 @@ void KameleonVolumeReader::addAttributeToDictionary(ghoul::Dictionary& dictionar ghoul::Dictionary KameleonVolumeReader::readMetaData() const { ghoul::Dictionary globalAttributesDictionary; for (const std::string& attributeName : globalAttributeNames()) { - ccmc::Attribute attribute = _kameleon.model->getGlobalAttribute(attributeName); + ccmc::Attribute attribute = _kameleon->model->getGlobalAttribute(attributeName); addAttributeToDictionary(globalAttributesDictionary, attributeName, attribute); } @@ -199,7 +202,7 @@ ghoul::Dictionary KameleonVolumeReader::readMetaData() const { for (const std::string& variableName : variableNames()) { ghoul::Dictionary variableAttributesDictionary; for (const std::string& attributeName : varAttrNames) { - ccmc::Attribute attribute = _kameleon.model->getVariableAttribute( + ccmc::Attribute attribute = _kameleon->model->getVariableAttribute( variableName, attributeName ); @@ -220,11 +223,11 @@ ghoul::Dictionary KameleonVolumeReader::readMetaData() const { std::string KameleonVolumeReader::simulationStart() const { std::string startTime; - if (_kameleon.model->doesAttributeExist("start_time")) { - startTime = globalAttribute(*_kameleon.model, "start_time"); + if (_kameleon->model->doesAttributeExist("start_time")) { + startTime = globalAttribute(*_kameleon->model, "start_time"); } - else if (_kameleon.model->doesAttributeExist("tim_rundate_cal")) { - startTime = globalAttribute(*_kameleon.model, "tim_rundate_cal"); + else if (_kameleon->model->doesAttributeExist("tim_rundate_cal")) { + startTime = globalAttribute(*_kameleon->model, "tim_rundate_cal"); size_t numChars = startTime.length(); if (numChars < 19) { // Fall through to add the required characters @@ -249,11 +252,11 @@ std::string KameleonVolumeReader::simulationStart() const { } } } - else if (_kameleon.model->doesAttributeExist("tim_obsdate_cal")) { - startTime = globalAttribute(*_kameleon.model, "tim_obsdate_cal"); + else if (_kameleon->model->doesAttributeExist("tim_obsdate_cal")) { + startTime = globalAttribute(*_kameleon->model, "tim_obsdate_cal"); } - else if (_kameleon.model->doesAttributeExist("tim_crstart_cal")) { - startTime = globalAttribute(*_kameleon.model, "tim_crstart_cal"); + else if (_kameleon->model->doesAttributeExist("tim_crstart_cal")) { + startTime = globalAttribute(*_kameleon->model, "tim_crstart_cal"); } if (startTime.length() == 19) { @@ -264,21 +267,21 @@ std::string KameleonVolumeReader::simulationStart() const { } float KameleonVolumeReader::elapsedTime() const { - if (_kameleon.model->doesAttributeExist("elapsed_time_in_seconds")) { - return globalAttribute(*_kameleon.model, "elapsed_time_in_seconds"); + if (_kameleon->model->doesAttributeExist("elapsed_time_in_seconds")) { + return globalAttribute(*_kameleon->model, "elapsed_time_in_seconds"); } - else if (_kameleon.model->doesAttributeExist("time_physical_time")) { - return globalAttribute(*_kameleon.model, "time_physical_time"); + else if (_kameleon->model->doesAttributeExist("time_physical_time")) { + return globalAttribute(*_kameleon->model, "time_physical_time"); } return 0.f; } std::string KameleonVolumeReader::simulationEnd() const { - return globalAttribute(*_kameleon.model, "end_time"); + return globalAttribute(*_kameleon->model, "end_time"); } std::string KameleonVolumeReader::getVisUnit(const std::string& variable) const { - return _kameleon.model->getNativeUnit(variable); + return _kameleon->model->getNativeUnit(variable); } std::string KameleonVolumeReader::time() const { @@ -290,12 +293,12 @@ std::string KameleonVolumeReader::time() const { } double KameleonVolumeReader::minValue(const std::string & variable) const { - ccmc::Model& m = *_kameleon.model; + ccmc::Model& m = *_kameleon->model; return m.getVariableAttribute(variable, "actual_min").getAttributeFloat(); } double KameleonVolumeReader::maxValue(const std::string & variable) const { - ccmc::Model& m = *_kameleon.model; + ccmc::Model& m = *_kameleon->model; return m.getVariableAttribute(variable, "actual_max").getAttributeFloat(); } diff --git a/modules/kameleonvolume/kameleonvolumereader.h b/modules/kameleonvolume/kameleonvolumereader.h index 47c09cccb4..6f5c3e7605 100644 --- a/modules/kameleonvolume/kameleonvolumereader.h +++ b/modules/kameleonvolume/kameleonvolumereader.h @@ -28,21 +28,13 @@ #include #include #include +#include -#ifdef WIN32 -#pragma warning (push) -#pragma warning (disable : 4619) // #pragma warning: there is no warning number '4619' -#pragma warning (disable : 4675) // #pragma warning: there is no warning number '4675' -#pragma warning (disable : 4800) // #pragma warning: there is no warning number '4800' -#endif // WIN32 - -#include - -#ifdef WIN32 -#pragma warning (pop) -#endif // WIN32 - -namespace ccmc { class Interpolator; } +namespace ccmc { + class Attribute; + class Interpolator; + class Kameleon; +} // namespce ccmc namespace ghoul { class Dictionary; } namespace openspace::volume { template class RawVolume; } @@ -52,6 +44,7 @@ namespace openspace::kameleonvolume { class KameleonVolumeReader { public: KameleonVolumeReader(std::string path); + ~KameleonVolumeReader(); std::unique_ptr> readFloatVolume( const glm::uvec3& dimensions, const std::string& variable, @@ -83,7 +76,7 @@ private: const std::string& key, ccmc::Attribute& attr); std::string _path; - ccmc::Kameleon _kameleon; + std::unique_ptr _kameleon; std::unique_ptr _interpolator; }; diff --git a/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp b/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp index 76af40a5d4..2a97b063ab 100644 --- a/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp +++ b/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp @@ -24,6 +24,10 @@ #include +#include +#include +#include +#include #include #include #include @@ -389,7 +393,7 @@ void RenderableKameleonVolume::loadCdf(const std::string& path) { } if (_autoGridType) { - if (variables[0] == "r" && variables[0] == "theta" && variables[0] == "phi") { + if (variables[0] == "r" && variables[1] == "theta" && variables[2] == "phi") { _gridType.setValue(static_cast(volume::VolumeGridType::Spherical)); } else { diff --git a/modules/kameleonvolume/rendering/renderablekameleonvolume.h b/modules/kameleonvolume/rendering/renderablekameleonvolume.h index 6fb43aeff9..bc03090cc6 100644 --- a/modules/kameleonvolume/rendering/renderablekameleonvolume.h +++ b/modules/kameleonvolume/rendering/renderablekameleonvolume.h @@ -26,10 +26,6 @@ #define __OPENSPACE_MODULE_KAMELEONVOLUME___RENDERABLEKAMELEONVOLUME___H__ #include -#include -#include -#include -#include #include #include @@ -37,7 +33,10 @@ #include #include -namespace openspace { struct RenderData; } +namespace openspace { + struct RenderData; + class TransferFunction; +} // namespace openspace namespace openspace::volume { class BasicVolumeRaycaster; diff --git a/modules/kameleonvolume/tasks/kameleondocumentationtask.cpp b/modules/kameleonvolume/tasks/kameleondocumentationtask.cpp index f4939a794d..e3ea77df4c 100644 --- a/modules/kameleonvolume/tasks/kameleondocumentationtask.cpp +++ b/modules/kameleonvolume/tasks/kameleondocumentationtask.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/modules/kameleonvolume/tasks/kameleonvolumetorawtask.cpp b/modules/kameleonvolume/tasks/kameleonvolumetorawtask.cpp index 8f5f9be5b3..f8cbd48c9a 100644 --- a/modules/kameleonvolume/tasks/kameleonvolumetorawtask.cpp +++ b/modules/kameleonvolume/tasks/kameleonvolumetorawtask.cpp @@ -30,6 +30,7 @@ #include #include #include +#include namespace { constexpr const char* KeyInput = "Input"; diff --git a/modules/multiresvolume/CMakeLists.txt b/modules/multiresvolume/CMakeLists.txt index 18733b9f4f..1f05c51900 100644 --- a/modules/multiresvolume/CMakeLists.txt +++ b/modules/multiresvolume/CMakeLists.txt @@ -25,39 +25,39 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/atlasmanager.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/brickmanager.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/brickselector.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/brickcover.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/brickselection.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/multiresvolumeraycaster.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/shenbrickselector.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/tfbrickselector.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/localtfbrickselector.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/simpletfbrickselector.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemultiresvolume.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/tsp.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/histogrammanager.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/errorhistogrammanager.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/localerrorhistogrammanager.h + rendering/atlasmanager.h + rendering/brickmanager.h + rendering/brickselector.h + rendering/brickcover.h + rendering/brickselection.h + rendering/multiresvolumeraycaster.h + rendering/shenbrickselector.h + rendering/tfbrickselector.h + rendering/localtfbrickselector.h + rendering/simpletfbrickselector.h + rendering/renderablemultiresvolume.h + rendering/tsp.h + rendering/histogrammanager.h + rendering/errorhistogrammanager.h + rendering/localerrorhistogrammanager.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/atlasmanager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/brickcover.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/brickmanager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/brickselection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/multiresvolumeraycaster.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/shenbrickselector.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/tfbrickselector.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/localtfbrickselector.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/simpletfbrickselector.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemultiresvolume.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/tsp.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/histogrammanager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/errorhistogrammanager.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/localerrorhistogrammanager.cpp + rendering/atlasmanager.cpp + rendering/brickcover.cpp + rendering/brickmanager.cpp + rendering/brickselection.cpp + rendering/multiresvolumeraycaster.cpp + rendering/shenbrickselector.cpp + rendering/tfbrickselector.cpp + rendering/localtfbrickselector.cpp + rendering/simpletfbrickselector.cpp + rendering/renderablemultiresvolume.cpp + rendering/tsp.cpp + rendering/histogrammanager.cpp + rendering/errorhistogrammanager.cpp + rendering/localerrorhistogrammanager.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) diff --git a/modules/multiresvolume/include.cmake b/modules/multiresvolume/include.cmake deleted file mode 100644 index 63c20b8181..0000000000 --- a/modules/multiresvolume/include.cmake +++ /dev/null @@ -1,3 +0,0 @@ -set (OPENSPACE_DEPENDENCIES - space -) \ No newline at end of file diff --git a/modules/multiresvolume/rendering/atlasmanager.cpp b/modules/multiresvolume/rendering/atlasmanager.cpp index 2f0642fc4d..fd688043de 100644 --- a/modules/multiresvolume/rendering/atlasmanager.cpp +++ b/modules/multiresvolume/rendering/atlasmanager.cpp @@ -182,7 +182,7 @@ void AtlasManager::addToAtlas(int firstBrickIndex, int lastBrickIndex, unsigned int atlasCoords = _freeAtlasCoords.back(); _freeAtlasCoords.pop_back(); int level = _nOtLevels - static_cast( - floor(log((7.0 * (float(brickIndex % _nOtNodes)) + 1.0))/log(8)) - 1 + floor(log1p((7.0 * (float(brickIndex % _nOtNodes))))/log(8)) - 1 ); ghoul_assert(atlasCoords <= 0x0FFFFFFF, "@MISSING"); unsigned int atlasData = (level << 28) + atlasCoords; diff --git a/modules/multiresvolume/rendering/errorhistogrammanager.cpp b/modules/multiresvolume/rendering/errorhistogrammanager.cpp index 726ea4b21c..652b9fa39c 100644 --- a/modules/multiresvolume/rendering/errorhistogrammanager.cpp +++ b/modules/multiresvolume/rendering/errorhistogrammanager.cpp @@ -301,7 +301,7 @@ int ErrorHistogramManager::parentOffset(int offset, int base) const { return -1; } const int depth = static_cast( - floor(log(((base - 1) * offset + 1.0)) / log(base)) + floor(log1p(((base - 1) * offset)) / log(base)) ); const int firstInLevel = static_cast((pow(base, depth) - 1) / (base - 1)); const int inLevelOffset = offset - firstInLevel; diff --git a/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp b/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp index 39f53d52c1..dc7e000cfc 100644 --- a/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp +++ b/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp @@ -82,8 +82,6 @@ bool LocalErrorHistogramManager::buildHistograms(int numBins) { success &= buildFromOctreeChild(bst, ot); if (!success) { LERROR("Failed in buildFromOctreeChild"); - } - if (!success) { return false; } pb1.print(processedLeaves++); @@ -99,8 +97,6 @@ bool LocalErrorHistogramManager::buildHistograms(int numBins) { success &= buildFromBstChild(bst, ot); if (!success) { LERROR("Failed in buildFromBstChild"); - } - if (!success) { return false; } pb2.print(processedLeaves++); @@ -464,7 +460,7 @@ int LocalErrorHistogramManager::parentOffset(int offset, int base) const { return -1; } const int depth = static_cast( - floor(log(((base - 1) * offset + 1.0)) / log(base)) + floor(log1p(((base - 1) * offset)) / log(base)) ); const int firstInLevel = static_cast((pow(base, depth) - 1) / (base - 1)); const int inLevelOffset = offset - firstInLevel; diff --git a/modules/multiresvolume/rendering/localtfbrickselector.cpp b/modules/multiresvolume/rendering/localtfbrickselector.cpp index b663438232..aa2be187c4 100644 --- a/modules/multiresvolume/rendering/localtfbrickselector.cpp +++ b/modules/multiresvolume/rendering/localtfbrickselector.cpp @@ -345,9 +345,6 @@ bool LocalTfBrickSelector::calculateBrickErrors() { } size_t tfWidth = tf->width(); - if (tfWidth <= 0) { - return false; - } std::vector gradients(tfWidth - 1); for (size_t offset = 0; offset < tfWidth - 1; offset++) { diff --git a/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp b/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp index 50a3ede0dc..cc2c4a7985 100644 --- a/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp +++ b/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp @@ -151,7 +151,9 @@ bool MultiresVolumeRaycaster::isCameraInside(const RenderData& data, float divisor = 1.0; for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) { - if (abs(modelTransform[i][j] > divisor)) divisor = modelTransform[i][j]; + if (abs(modelTransform[i][j]) > divisor) { + divisor = modelTransform[i][j]; + } } glm::mat4 scaledModelTransform = modelTransform / divisor; diff --git a/modules/multiresvolume/rendering/renderablemultiresvolume.cpp b/modules/multiresvolume/rendering/renderablemultiresvolume.cpp index a80e6cfa7d..abf4100fa9 100644 --- a/modules/multiresvolume/rendering/renderablemultiresvolume.cpp +++ b/modules/multiresvolume/rendering/renderablemultiresvolume.cpp @@ -464,7 +464,6 @@ bool RenderableMultiresVolume::initializeSelector() { ghoul::filesystem::CacheManager::Persistent::Yes ); std::ifstream cacheFile(cacheFilename, std::ios::in | std::ios::binary); - std::string errorHistogramsPath = _errorHistogramsPath; if (cacheFile.is_open()) { // Read histograms from cache. cacheFile.close(); diff --git a/modules/multiresvolume/rendering/tsp.cpp b/modules/multiresvolume/rendering/tsp.cpp index bcb194fcea..528c18ce2d 100644 --- a/modules/multiresvolume/rendering/tsp.cpp +++ b/modules/multiresvolume/rendering/tsp.cpp @@ -139,7 +139,7 @@ bool TSP::construct() { unsigned int OTNode = OT * _numOTNodes; // Calculate BST level (first level is level 0) - unsigned int BSTLevel = static_cast(log(OT + 1) / log(2)); + unsigned int BSTLevel = static_cast(log1p(OT) / log(2)); // Traverse OT unsigned int OTChild = 1; @@ -574,18 +574,18 @@ bool TSP::writeCache() { } float TSP::spatialError(unsigned int brickIndex) const { - return reinterpret_cast(_data[brickIndex*NUM_DATA + SPATIAL_ERR]); + return *reinterpret_cast(_data[brickIndex*NUM_DATA + SPATIAL_ERR]); } float TSP::temporalError(unsigned int brickIndex) const { - return reinterpret_cast(_data[brickIndex*NUM_DATA + TEMPORAL_ERR]); + return *reinterpret_cast(_data[brickIndex*NUM_DATA + TEMPORAL_ERR]); } unsigned int TSP::firstOctreeChild(unsigned int brickIndex) const { const unsigned int otNode = brickIndex % _numOTNodes; const unsigned int bstOffset = brickIndex - otNode; - const unsigned int depth = static_cast(log(7 * otNode + 1) / log(8)); + const unsigned int depth = static_cast(log1p(7 * otNode) / log(8)); const unsigned int firstInLevel = static_cast((pow(8, depth) - 1) / 7); const unsigned int levelOffset = otNode - firstInLevel; const unsigned int firstInChildLevel = static_cast( @@ -599,7 +599,7 @@ unsigned int TSP::firstOctreeChild(unsigned int brickIndex) const { unsigned int TSP::bstLeft(unsigned int brickIndex) const { const unsigned int bstNode = brickIndex / _numOTNodes; const unsigned int otOffset = brickIndex % _numOTNodes; - const unsigned int depth = static_cast(log(bstNode + 1) / log(2)); + const unsigned int depth = static_cast(log1p(bstNode) / log(2)); const unsigned int firstInLevel = static_cast(pow(2, depth) - 1); const unsigned int levelOffset = bstNode - firstInLevel; const unsigned int firstInChildLevel = static_cast( @@ -620,7 +620,7 @@ bool TSP::isBstLeaf(unsigned int brickIndex) const { bool TSP::isOctreeLeaf(unsigned int brickIndex) const { const unsigned int otNode = brickIndex % _numOTNodes; - const unsigned int depth = static_cast(log(7 * otNode + 1) / log(8)); + const unsigned int depth = static_cast(log1p(7 * otNode) / log(8)); return depth == _numOTLevels - 1; } diff --git a/modules/space/CMakeLists.txt b/modules/space/CMakeLists.txt index e191a4eff1..e33d971844 100644 --- a/modules/space/CMakeLists.txt +++ b/modules/space/CMakeLists.txt @@ -25,49 +25,49 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/planetgeometry.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableconstellationbounds.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablerings.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableorbitalkepler.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesatellites.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesmallbody.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablestars.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheregeometry.h - ${CMAKE_CURRENT_SOURCE_DIR}/translation/keplertranslation.h - ${CMAKE_CURRENT_SOURCE_DIR}/translation/spicetranslation.h - ${CMAKE_CURRENT_SOURCE_DIR}/translation/tletranslation.h - ${CMAKE_CURRENT_SOURCE_DIR}/translation/horizonstranslation.h - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/spicerotation.h + rendering/planetgeometry.h + rendering/renderableconstellationbounds.h + rendering/renderablerings.h + rendering/renderableorbitalkepler.h + rendering/renderablesatellites.h + rendering/renderablesmallbody.h + rendering/renderablestars.h + rendering/simplespheregeometry.h + translation/keplertranslation.h + translation/spicetranslation.h + translation/tletranslation.h + translation/horizonstranslation.h + rotation/spicerotation.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/planetgeometry.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableconstellationbounds.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablerings.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableorbitalkepler.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesatellites.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesmallbody.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablestars.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheregeometry.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/translation/keplertranslation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/translation/spicetranslation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/translation/tletranslation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/translation/horizonstranslation.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rotation/spicerotation.cpp + rendering/planetgeometry.cpp + rendering/renderableconstellationbounds.cpp + rendering/renderablerings.cpp + rendering/renderableorbitalkepler.cpp + rendering/renderablesatellites.cpp + rendering/renderablesmallbody.cpp + rendering/renderablestars.cpp + rendering/simplespheregeometry.cpp + translation/keplertranslation.cpp + translation/spicetranslation.cpp + translation/tletranslation.cpp + translation/horizonstranslation.cpp + rotation/spicerotation.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/constellationbounds_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/constellationbounds_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/debrisViz_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/debrisViz_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/star_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/star_ge.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/star_vs.glsl + shaders/constellationbounds_fs.glsl + shaders/constellationbounds_vs.glsl + shaders/debrisViz_fs.glsl + shaders/debrisViz_vs.glsl + shaders/rings_vs.glsl + shaders/rings_fs.glsl + shaders/star_fs.glsl + shaders/star_ge.glsl + shaders/star_vs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/space/rendering/renderablesmallbody.cpp b/modules/space/rendering/renderablesmallbody.cpp index 1ce88f70bd..2037e83b93 100644 --- a/modules/space/rendering/renderablesmallbody.cpp +++ b/modules/space/rendering/renderablesmallbody.cpp @@ -185,8 +185,6 @@ void RenderableSmallBody::readDataFile(const std::string& filename) { std::string line; unsigned int csvLine = 0; int fieldCount = 0; - float lineSkipFraction = 1.0; - int lastLineCount = -1; const std::string expectedHeaderLine = "full_name,epoch_cal,e,a,i,om,w,ma,per"; try { @@ -197,6 +195,7 @@ void RenderableSmallBody::readDataFile(const std::string& filename) { } _numObjects = numberOfLines; + float lineSkipFraction = 1.0; if (!_isFileReadinitialized) { _isFileReadinitialized = true; initializeFileReading(); @@ -230,6 +229,7 @@ void RenderableSmallBody::readDataFile(const std::string& filename) { skipSingleLineInFile(file); } bool firstDataLine = true; + int lastLineCount = -1; for (csvLine = _startRenderIdx + 1; csvLine <= endElement + 1; csvLine++, sequentialLineErrors++) @@ -258,8 +258,8 @@ void RenderableSmallBody::readDataFile(const std::string& filename) { fieldCount, csvLine + 1, numberOfLines, filename )); } - catch (std::ios_base::failure& f) { - throw f; + catch (std::ios_base::failure&) { + throw; } if (sequentialLineErrors == 4) { diff --git a/modules/space/rendering/renderablesmallbody.h b/modules/space/rendering/renderablesmallbody.h index 5b47599e7f..21d961d7e1 100644 --- a/modules/space/rendering/renderablesmallbody.h +++ b/modules/space/rendering/renderablesmallbody.h @@ -46,7 +46,7 @@ public: private: void readOrbitalParamsFromThisLine(bool firstDataLine, int& fieldCount, unsigned int& csvLine, std::ifstream& file); - void readDataFile(const std::string& filename); + virtual void readDataFile(const std::string& filename) override; void initializeFileReading(); void skipSingleLineInFile(std::ifstream& file); diff --git a/modules/space/rendering/renderablestars.cpp b/modules/space/rendering/renderablestars.cpp index 2219305f85..075f180901 100644 --- a/modules/space/rendering/renderablestars.cpp +++ b/modules/space/rendering/renderablestars.cpp @@ -73,7 +73,7 @@ namespace { constexpr double PARSEC = 0.308567756E17; - struct CommonDataLayout { + struct ColorVBOLayout { std::array position; float value; float luminance; @@ -81,19 +81,35 @@ namespace { float apparentMagnitude; }; - struct ColorVBOLayout : public CommonDataLayout {}; + struct VelocityVBOLayout { + std::array position; + float value; + float luminance; + float absoluteMagnitude; + float apparentMagnitude; - struct VelocityVBOLayout : public CommonDataLayout { float vx; // v_x float vy; // v_y float vz; // v_z }; - struct SpeedVBOLayout : public CommonDataLayout { + struct SpeedVBOLayout { + std::array position; + float value; + float luminance; + float absoluteMagnitude; + float apparentMagnitude; + float speed; }; - struct OtherDataLayout : public CommonDataLayout {}; + struct OtherDataLayout { + std::array position; + float value; + float luminance; + float absoluteMagnitude; + float apparentMagnitude; + }; constexpr openspace::properties::Property::PropertyInfo SpeckFileInfo = { "SpeckFile", diff --git a/modules/space/translation/horizonstranslation.cpp b/modules/space/translation/horizonstranslation.cpp index 7a794e1e74..6a89bf3768 100644 --- a/modules/space/translation/horizonstranslation.cpp +++ b/modules/space/translation/horizonstranslation.cpp @@ -176,16 +176,9 @@ void HorizonsTranslation::readHorizonsTextFile() { return; } - // The beginning of a Horizons file has a header with a lot of information about the - // query that we do not care about. Ignore everything until data starts, including - // the row marked by $$SOE (i.e. Start Of Ephemerides). - std::string line; - while (line[0] != '$') { - std::getline(fileStream, line); - } - // Read data line by line until $$EOE (i.e. End Of Ephemerides). // Skip the rest of the file. + std::string line; std::getline(fileStream, line); while (line[0] != '$') { std::stringstream str(line); diff --git a/modules/space/translation/keplertranslation.cpp b/modules/space/translation/keplertranslation.cpp index c1dd9beb2d..f31ece809d 100644 --- a/modules/space/translation/keplertranslation.cpp +++ b/modules/space/translation/keplertranslation.cpp @@ -34,11 +34,10 @@ namespace { template T solveIteration(const Func& function, T x0, const T& err = 0.0, int maxIter = 100) { - T x = 0; T x2 = x0; for (int i = 0; i < maxIter; ++i) { - x = x2; + T x = x2; x2 = function(x); if (std::abs(x2 - x) < err) { return x2; diff --git a/modules/spacecraftinstruments/CMakeLists.txt b/modules/spacecraftinstruments/CMakeLists.txt index 45f3282bc8..d56f71adb9 100644 --- a/modules/spacecraftinstruments/CMakeLists.txt +++ b/modules/spacecraftinstruments/CMakeLists.txt @@ -25,63 +25,63 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditeminstruments.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablecrawlingline.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefov.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneprojection.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanetprojection.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableshadowcylinder.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodelprojection.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/decoder.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/hongkangparser.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumenttimesparser.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/image.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/imagesequencer.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumentdecoder.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/labelparser.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/projectioncomponent.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/scannerdecoder.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/sequenceparser.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/targetdecoder.h + dashboard/dashboarditeminstruments.h + rendering/renderablecrawlingline.h + rendering/renderablefov.h + rendering/renderableplaneprojection.h + rendering/renderableplanetprojection.h + rendering/renderableshadowcylinder.h + rendering/renderablemodelprojection.h + util/decoder.h + util/hongkangparser.h + util/instrumenttimesparser.h + util/image.h + util/imagesequencer.h + util/instrumentdecoder.h + util/labelparser.h + util/projectioncomponent.h + util/scannerdecoder.h + util/sequenceparser.h + util/targetdecoder.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/dashboard/dashboarditeminstruments.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablecrawlingline.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefov.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneprojection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanetprojection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableshadowcylinder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodelprojection.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/decoder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/hongkangparser.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumenttimesparser.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/imagesequencer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/instrumentdecoder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/labelparser.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/projectioncomponent.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/scannerdecoder.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/sequenceparser.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/targetdecoder.cpp + dashboard/dashboarditeminstruments.cpp + rendering/renderablecrawlingline.cpp + rendering/renderablefov.cpp + rendering/renderableplaneprojection.cpp + rendering/renderableplanetprojection.cpp + rendering/renderableshadowcylinder.cpp + rendering/renderablemodelprojection.cpp + util/decoder.cpp + util/hongkangparser.cpp + util/instrumenttimesparser.cpp + util/imagesequencer.cpp + util/instrumentdecoder.cpp + util/labelparser.cpp + util/projectioncomponent.cpp + util/scannerdecoder.cpp + util/sequenceparser.cpp + util/targetdecoder.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/crawlingline_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/crawlingline_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/fov_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/fov_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderableModel_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderableModel_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderableModelProjection_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderableModelProjection_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderablePlanet_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderablePlanet_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderablePlanetProjection_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderablePlanetProjection_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/terminatorshadow_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/terminatorshadow_vs.glsl + shaders/crawlingline_fs.glsl + shaders/crawlingline_vs.glsl + shaders/fov_fs.glsl + shaders/fov_vs.glsl + shaders/renderableModel_fs.glsl + shaders/renderableModel_vs.glsl + shaders/renderableModelProjection_fs.glsl + shaders/renderableModelProjection_vs.glsl + shaders/renderablePlanet_fs.glsl + shaders/renderablePlanet_vs.glsl + shaders/renderablePlanetProjection_fs.glsl + shaders/renderablePlanetProjection_vs.glsl + shaders/terminatorshadow_fs.glsl + shaders/terminatorshadow_vs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) diff --git a/modules/spacecraftinstruments/include.cmake b/modules/spacecraftinstruments/include.cmake index 659b975323..ffea0ac430 100644 --- a/modules/spacecraftinstruments/include.cmake +++ b/modules/spacecraftinstruments/include.cmake @@ -1,5 +1 @@ set(DEFAULT_MODULE ON) - -set (OPENSPACE_DEPENDENCIES - space -) diff --git a/modules/spacecraftinstruments/rendering/renderablefov.cpp b/modules/spacecraftinstruments/rendering/renderablefov.cpp index be75dca698..12b7986138 100644 --- a/modules/spacecraftinstruments/rendering/renderablefov.cpp +++ b/modules/spacecraftinstruments/rendering/renderablefov.cpp @@ -767,97 +767,96 @@ void RenderableFov::computeIntercepts(const UpdateData& data, const std::string& } -#ifdef DEBUG_THIS - // At least one point will intersect - for (size_t i = 0; i < _instrument.bounds.size(); ++i) { - // Wrap around the array index to 0 - const size_t j = (i == _instrument.bounds.size() - 1) ? 0 : i + 1; +#if 0 // DEBUG_THIS + // At least one point will intersect + for (size_t i = 0; i < _instrument.bounds.size(); ++i) { + // Wrap around the array index to 0 + const size_t j = (i == _instrument.bounds.size() - 1) ? 0 : i + 1; - const glm::dvec3& iBound = _instrument.bounds[i]; - const glm::dvec3& jBound = _instrument.bounds[j]; + const glm::dvec3& iBound = _instrument.bounds[i]; + const glm::dvec3& jBound = _instrument.bounds[j]; - auto intercepts = [&](const glm::dvec3& probe) -> bool { - return SpiceManager::ref().surfaceIntercept( - target, - _instrument.spacecraft, - _instrument.name, - makeBodyFixedReferenceFrame(_instrument.referenceFrame).first, - _instrument.aberrationCorrection, - data.time, - probe - ).interceptFound; - }; + auto intercepts = [&](const glm::dvec3& probe) -> bool { + return SpiceManager::ref().surfaceIntercept( + target, + _instrument.spacecraft, + _instrument.name, + makeBodyFixedReferenceFrame(_instrument.referenceFrame).first, + _instrument.aberrationCorrection, + data.time, + probe + ).interceptFound; + }; - static const uint8_t NoIntersect = 0b00; - static const uint8_t ThisIntersect = 0b01; - static const uint8_t NextIntersect = 0b10; - static const uint8_t BothIntersect = 0b11; + static const uint8_t NoIntersect = 0b00; + static const uint8_t ThisIntersect = 0b01; + static const uint8_t NextIntersect = 0b10; + static const uint8_t BothIntersect = 0b11; - const uint8_t type = (intersects[i] ? 1 : 0) + (intersects[j] ? 2 : 0); - switch (type) { - case NoIntersect: - { - // If both points don't intercept, the target might still pass between - // them, so we need to check the intermediate point + const uint8_t type = (intersects[i] ? 1 : 0) + (intersects[j] ? 2 : 0); + switch (type) { + case NoIntersect: + { + // If both points don't intercept, the target might still pass between + // them, so we need to check the intermediate point - const glm::dvec3 half = glm::mix(iBound, jBound, 0.5); - if (intercepts(half)) { - // The two outer points do not intersect, but the middle point - // does; so we need to find the intersection points - const double t1 = bisect(half, iBound, intercepts); - const double t2 = 0.5 + bisect(half, jBound, intercepts); + const glm::dvec3 half = glm::mix(iBound, jBound, 0.5); + if (intercepts(half)) { + // The two outer points do not intersect, but the middle point + // does; so we need to find the intersection points + const double t1 = bisect(half, iBound, intercepts); + const double t2 = 0.5 + bisect(half, jBound, intercepts); - // - // The target is sticking out somewhere between i and j, so we - // have three regions here: - // The first (0,t1) and second (t2,1) are not intersecting - // The third between (t1,t2) is intersecting - // - // i p1 p2 j - // ***** - // x-------* *-------x - // 0 t1 t2 1 + // + // The target is sticking out somewhere between i and j, so we + // have three regions here: + // The first (0,t1) and second (t2,1) are not intersecting + // The third between (t1,t2) is intersecting + // + // i p1 p2 j + // ***** + // x-------* *-------x + // 0 t1 t2 1 - // OBS: i and j are in bounds-space, p1, p2 are in - // _orthogonalPlane-space - const size_t p1 = static_cast( - indexForBounds(i) + t1 * InterpolationSteps - ); - const size_t p2 = static_cast( - indexForBounds(i) + t2 * InterpolationSteps - ); + // OBS: i and j are in bounds-space, p1, p2 are in + // _orthogonalPlane-space + const size_t p1 = static_cast( + indexForBounds(i) + t1 * InterpolationSteps + ); + const size_t p2 = static_cast( + indexForBounds(i) + t2 * InterpolationSteps + ); - // We can copy the non-intersecting parts - copyFieldOfViewValues(i, indexForBounds(i), p1); - copyFieldOfViewValues(i, p2, indexForBounds(j)); + // We can copy the non-intersecting parts + copyFieldOfViewValues(i, indexForBounds(i), p1); + copyFieldOfViewValues(i, p2, indexForBounds(j)); - // Are recompute the intersecting ones - for (size_t k = 0; k <= (p2 - p1); ++k) { - const double t = t1 + k * (t2 - t1); - const glm::dvec3 interpolated = glm::mix(iBound, jBound, t); - const glm::vec3 icpt = interceptVector(interpolated); - _orthogonalPlane.data[p1 + k] = { - icpt.x, icpt.y, icpt.z, - RenderInformation::VertexColorTypeSquare - }; - } + // Are recompute the intersecting ones + for (size_t k = 0; k <= (p2 - p1); ++k) { + const double t = t1 + k * (t2 - t1); + const glm::dvec3 interpolated = glm::mix(iBound, jBound, t); + const glm::vec3 icpt = interceptVector(interpolated); + _orthogonalPlane.data[p1 + k] = { + icpt.x, icpt.y, icpt.z, + RenderInformation::VertexColorTypeSquare + }; } - else { - copyFieldOfViewValues( - i, - indexForBounds(i), - indexForBounds(i + 1) - ); - } - break; } - case ThisIntersect: - case NextIntersect: - case BothIntersect: - break; - default: - throw ghoul::MissingCaseException(); + else { + copyFieldOfViewValues( + i, + indexForBounds(i), + indexForBounds(i + 1) + ); + } + break; } + case ThisIntersect: + case NextIntersect: + case BothIntersect: + break; + default: + throw ghoul::MissingCaseException(); } } #endif diff --git a/modules/spacecraftinstruments/util/hongkangparser.cpp b/modules/spacecraftinstruments/util/hongkangparser.cpp index 0d2ae2f198..d665bd7252 100644 --- a/modules/spacecraftinstruments/util/hongkangparser.cpp +++ b/modules/spacecraftinstruments/util/hongkangparser.cpp @@ -163,7 +163,6 @@ bool HongKangParser::create() { double captureStart = -1.0; std::string cameraTarget = "VOID"; - std::string scannerTarget = "VOID"; std::string line; while (!file.eof()) { @@ -236,7 +235,7 @@ bool HongKangParser::create() { met, _metRef ); - scannerTarget = findPlaybookSpecifiedTarget(line); + std::string scannerTarget = findPlaybookSpecifiedTarget(line); TimeRange scanRange = { scanStart, scanStop }; ghoul_assert(scanRange.isDefined(), "Invalid time range!"); diff --git a/modules/spout/CMakeLists.txt b/modules/spout/CMakeLists.txt index 9cc9bd8a01..2b3fd31444 100644 --- a/modules/spout/CMakeLists.txt +++ b/modules/spout/CMakeLists.txt @@ -25,15 +25,15 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/renderableplanespout.h - ${CMAKE_CURRENT_SOURCE_DIR}/screenspacespout.h - ${CMAKE_CURRENT_SOURCE_DIR}/spoutlibrary.h + renderableplanespout.h + screenspacespout.h + spoutlibrary.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/renderableplanespout.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/screenspacespout.cpp + renderableplanespout.cpp + screenspacespout.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) @@ -46,7 +46,7 @@ create_new_module( ${HEADER_FILES} ${SOURCE_FILES} ) -target_include_directories(openspace-module-spout SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ext/spout) +target_include_directories(openspace-module-spout SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ext/spout) target_link_libraries(openspace-module-spout PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ext/spout/SpoutLibrary.lib) register_external_libraries("${CMAKE_CURRENT_SOURCE_DIR}/ext/spout/SpoutLibrary.dll") diff --git a/modules/spout/include.cmake b/modules/spout/include.cmake index 2a359fe308..e52c831cc2 100644 --- a/modules/spout/include.cmake +++ b/modules/spout/include.cmake @@ -1,7 +1,3 @@ -set (OPENSPACE_DEPENDENCIES - base -) - if (WIN32) set(DEFAULT_MODULE ON) endif () diff --git a/modules/sync/CMakeLists.txt b/modules/sync/CMakeLists.txt index 97a6716b7e..ecf74f7c1d 100644 --- a/modules/sync/CMakeLists.txt +++ b/modules/sync/CMakeLists.txt @@ -25,18 +25,18 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/syncmodule.h - ${CMAKE_CURRENT_SOURCE_DIR}/syncs/httpsynchronization.h - ${CMAKE_CURRENT_SOURCE_DIR}/syncs/urlsynchronization.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/syncassettask.h + syncmodule.h + syncs/httpsynchronization.h + syncs/urlsynchronization.h + tasks/syncassettask.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/syncmodule.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/syncs/httpsynchronization.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/syncs/urlsynchronization.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/syncassettask.cpp + syncmodule.cpp + syncs/httpsynchronization.cpp + syncs/urlsynchronization.cpp + tasks/syncassettask.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) diff --git a/modules/touch/CMakeLists.txt b/modules/touch/CMakeLists.txt index 5792eaaecf..ed76ab5ec1 100644 --- a/modules/touch/CMakeLists.txt +++ b/modules/touch/CMakeLists.txt @@ -25,28 +25,28 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/ext/levmarq.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/directinputsolver.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/tuioear.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/touchinteraction.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/touchmarker.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/win32_touch.h + ext/levmarq.h + include/directinputsolver.h + include/tuioear.h + include/touchinteraction.h + include/touchmarker.h + include/win32_touch.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/ext/levmarq.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/directinputsolver.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/tuioear.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/touchinteraction.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/touchmarker.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/win32_touch.cpp + ext/levmarq.cpp + src/directinputsolver.cpp + src/tuioear.cpp + src/touchinteraction.cpp + src/touchmarker.cpp + src/win32_touch.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) set(SHADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/marker_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/marker_vs.glsl + shaders/marker_fs.glsl + shaders/marker_vs.glsl ) source_group("Shader Files" FILES ${SHADER_FILES}) @@ -57,6 +57,5 @@ create_new_module( ${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES} ) -include_external_library(${touch_module} PUBLIC libTUIO11 ${CMAKE_CURRENT_SOURCE_DIR}/ext) - +include_external_library(${touch_module} PRIVATE libTUIO11 ${CMAKE_CURRENT_SOURCE_DIR}/ext ${CMAKE_CURRENT_SOURCE_DIR}/ext) disable_external_warnings_for_file(${CMAKE_CURRENT_SOURCE_DIR}/ext/levmarq.cpp) diff --git a/modules/touch/ext/CMakeLists.txt b/modules/touch/ext/CMakeLists.txt index 9ce2824de9..f1a5d5f26c 100644 --- a/modules/touch/ext/CMakeLists.txt +++ b/modules/touch/ext/CMakeLists.txt @@ -26,58 +26,58 @@ project(libTUIO11) message(STATUS "Generating libTUIO11 project") set(TUIO_SOURCE - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/WebSockSender.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/UdpSender.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/UdpReceiver.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TuioTime.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TuioServer.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TuioPoint.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TuioObject.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TuioManager.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TuioDispatcher.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TuioCursor.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TuioContainer.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TuioClient.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TuioBlob.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TcpSender.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/TcpReceiver.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/OscReceiver.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/OneEuroFilter.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO/FlashSender.cpp - - ${PROJECT_SOURCE_DIR}/libTUIO11/oscpack/ip/IpEndpointName.cpp - - ${PROJECT_SOURCE_DIR}/libTUIO11/oscpack/osc/OscTypes.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/oscpack/osc/OscReceivedElements.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/oscpack/osc/OscPrintReceivedElements.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/oscpack/osc/OscOutboundPacketStream.cpp + libTUIO11/TUIO/WebSockSender.cpp + libTUIO11/TUIO/UdpSender.cpp + libTUIO11/TUIO/UdpReceiver.cpp + libTUIO11/TUIO/TuioTime.cpp + libTUIO11/TUIO/TuioServer.cpp + libTUIO11/TUIO/TuioPoint.cpp + libTUIO11/TUIO/TuioObject.cpp + libTUIO11/TUIO/TuioManager.cpp + libTUIO11/TUIO/TuioDispatcher.cpp + libTUIO11/TUIO/TuioCursor.cpp + libTUIO11/TUIO/TuioContainer.cpp + libTUIO11/TUIO/TuioClient.cpp + libTUIO11/TUIO/TuioBlob.cpp + libTUIO11/TUIO/TcpSender.cpp + libTUIO11/TUIO/TcpReceiver.cpp + libTUIO11/TUIO/OscReceiver.cpp + libTUIO11/TUIO/OneEuroFilter.cpp + libTUIO11/TUIO/FlashSender.cpp + + libTUIO11/oscpack/ip/IpEndpointName.cpp + + libTUIO11/oscpack/osc/OscTypes.cpp + libTUIO11/oscpack/osc/OscReceivedElements.cpp + libTUIO11/oscpack/osc/OscPrintReceivedElements.cpp + libTUIO11/oscpack/osc/OscOutboundPacketStream.cpp ) if (WIN32) - set(TUIO_SOURCE - ${TUIO_SOURCE} - ${PROJECT_SOURCE_DIR}/libTUIO11/oscpack/ip/win32/NetworkingUtils.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/oscpack/ip/win32/UdpSocket.cpp - ) + set(TUIO_SOURCE + ${TUIO_SOURCE} + libTUIO11/oscpack/ip/win32/NetworkingUtils.cpp + libTUIO11/oscpack/ip/win32/UdpSocket.cpp + ) endif () if (UNIX) - set(TUIO_SOURCE - ${TUIO_SOURCE} - ${PROJECT_SOURCE_DIR}/libTUIO11/oscpack/ip/posix/NetworkingUtils.cpp - ${PROJECT_SOURCE_DIR}/libTUIO11/oscpack/ip/posix/UdpSocket.cpp - ) + set(TUIO_SOURCE + ${TUIO_SOURCE} + libTUIO11/oscpack/ip/posix/NetworkingUtils.cpp + libTUIO11/oscpack/ip/posix/UdpSocket.cpp + ) endif () -add_library(libTUIO11 - ${TUIO_SOURCE} +add_library(libTUIO11 ${TUIO_SOURCE}) +target_include_directories(libTUIO11 SYSTEM + PUBLIC + "${PROJECT_SOURCE_DIR}/libTUIO11/TUIO" + "${PROJECT_SOURCE_DIR}/libTUIO11/" + "${PROJECT_SOURCE_DIR}/libTUIO11/oscpack" ) -target_include_directories(libTUIO11 PUBLIC - ${PROJECT_SOURCE_DIR}/libTUIO11/ - ${PROJECT_SOURCE_DIR}/libTUIO11/oscpack - ${PROJECT_SOURCE_DIR}/libTUIO11/TUIO) if (WIN32) - # Tuio dependencies - target_link_libraries(libTUIO11 PRIVATE winmm.lib wininet.lib ws2_32.lib) + # Tuio dependencies + target_link_libraries(libTUIO11 PRIVATE winmm.lib wininet.lib ws2_32.lib) endif () diff --git a/modules/touch/src/touchinteraction.cpp b/modules/touch/src/touchinteraction.cpp index 5de30dcf64..f619cd1f32 100644 --- a/modules/touch/src/touchinteraction.cpp +++ b/modules/touch/src/touchinteraction.cpp @@ -1086,9 +1086,9 @@ void TouchInteraction::step(double dt, bool directTouch) { } else if (currentPosViolatingZoomOutLimit) { #ifdef TOUCH_DEBUG_PROPERTIES - LINFO(fmt::format( + LINFOC("", fmt::format( "{}: You are outside zoom out {} limit, only zoom in allowed", - _loggerCat, _zoomOutLimit.value()); + _loggerCat, _zoomOutLimit.value())); #endif // Only allow zooming in if you are outside the zoom out limit if (newPosDistance < currentPosDistance) { diff --git a/modules/toyvolume/CMakeLists.txt b/modules/toyvolume/CMakeLists.txt index ad4395b781..0436ed5291 100644 --- a/modules/toyvolume/CMakeLists.txt +++ b/modules/toyvolume/CMakeLists.txt @@ -25,14 +25,14 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletoyvolume.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/toyvolumeraycaster.h + rendering/renderabletoyvolume.h + rendering/toyvolumeraycaster.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletoyvolume.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/toyvolumeraycaster.cpp + rendering/renderabletoyvolume.cpp + rendering/toyvolumeraycaster.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) diff --git a/modules/toyvolume/include.cmake b/modules/toyvolume/include.cmake index 659b975323..ffea0ac430 100644 --- a/modules/toyvolume/include.cmake +++ b/modules/toyvolume/include.cmake @@ -1,5 +1 @@ set(DEFAULT_MODULE ON) - -set (OPENSPACE_DEPENDENCIES - space -) diff --git a/modules/vislab/CMakeLists.txt b/modules/vislab/CMakeLists.txt index 1e75a257b2..3c5fd4b9ce 100644 --- a/modules/vislab/CMakeLists.txt +++ b/modules/vislab/CMakeLists.txt @@ -25,17 +25,13 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES -${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabledistancelabel.h + rendering/renderabledistancelabel.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabledistancelabel.cpp + rendering/renderabledistancelabel.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) -create_new_module( - "VisLab" - vislab_module - ${HEADER_FILES} ${SOURCE_FILES} -) +create_new_module("VisLab" vislab_module ${HEADER_FILES} ${SOURCE_FILES}) diff --git a/modules/volume/CMakeLists.txt b/modules/volume/CMakeLists.txt index 3974d1f95f..14aa11f617 100644 --- a/modules/volume/CMakeLists.txt +++ b/modules/volume/CMakeLists.txt @@ -25,51 +25,51 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/envelope.h - ${CMAKE_CURRENT_SOURCE_DIR}/rawvolume.h - ${CMAKE_CURRENT_SOURCE_DIR}/rawvolumemetadata.h - ${CMAKE_CURRENT_SOURCE_DIR}/rawvolumereader.h - ${CMAKE_CURRENT_SOURCE_DIR}/rawvolumewriter.h - ${CMAKE_CURRENT_SOURCE_DIR}/textureslicevolumereader.h - ${CMAKE_CURRENT_SOURCE_DIR}/textureslicevolumereader.inl - ${CMAKE_CURRENT_SOURCE_DIR}/transferfunction.h - ${CMAKE_CURRENT_SOURCE_DIR}/transferfunctionhandler.h - ${CMAKE_CURRENT_SOURCE_DIR}/transferfunctionproperty.h - ${CMAKE_CURRENT_SOURCE_DIR}/rawvolumemetadata.h - ${CMAKE_CURRENT_SOURCE_DIR}/lrucache.h - ${CMAKE_CURRENT_SOURCE_DIR}/lrucache.inl - ${CMAKE_CURRENT_SOURCE_DIR}/linearlrucache.h - ${CMAKE_CURRENT_SOURCE_DIR}/linearlrucache.inl - ${CMAKE_CURRENT_SOURCE_DIR}/volumegridtype.h - ${CMAKE_CURRENT_SOURCE_DIR}/volumesampler.h - ${CMAKE_CURRENT_SOURCE_DIR}/volumesampler.inl - ${CMAKE_CURRENT_SOURCE_DIR}/volumeutils.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletimevaryingvolume.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/basicvolumeraycaster.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/volumeclipplane.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/volumeclipplanes.h - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/generaterawvolumetask.h + envelope.h + rawvolume.h + rawvolumemetadata.h + rawvolumereader.h + rawvolumewriter.h + textureslicevolumereader.h + textureslicevolumereader.inl + transferfunction.h + transferfunctionhandler.h + transferfunctionproperty.h + rawvolumemetadata.h + lrucache.h + lrucache.inl + linearlrucache.h + linearlrucache.inl + volumegridtype.h + volumesampler.h + volumesampler.inl + volumeutils.h + rendering/renderabletimevaryingvolume.h + rendering/basicvolumeraycaster.h + rendering/volumeclipplane.h + rendering/volumeclipplanes.h + tasks/generaterawvolumetask.h ) source_group("Header Files" FILES ${HEADER_FILES}) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/envelope.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rawvolume.inl - ${CMAKE_CURRENT_SOURCE_DIR}/rawvolumemetadata.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rawvolumereader.inl - ${CMAKE_CURRENT_SOURCE_DIR}/rawvolumewriter.inl - ${CMAKE_CURRENT_SOURCE_DIR}/textureslicevolumereader.inl - ${CMAKE_CURRENT_SOURCE_DIR}/transferfunction.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/transferfunctionhandler.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/transferfunctionproperty.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/volumesampler.inl - ${CMAKE_CURRENT_SOURCE_DIR}/volumegridtype.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/volumeutils.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletimevaryingvolume.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/basicvolumeraycaster.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/volumeclipplane.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/volumeclipplanes.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tasks/generaterawvolumetask.cpp + envelope.cpp + rawvolume.inl + rawvolumemetadata.cpp + rawvolumereader.inl + rawvolumewriter.inl + textureslicevolumereader.inl + transferfunction.cpp + transferfunctionhandler.cpp + transferfunctionproperty.cpp + volumesampler.inl + volumegridtype.cpp + volumeutils.cpp + rendering/renderabletimevaryingvolume.cpp + rendering/basicvolumeraycaster.cpp + rendering/volumeclipplane.cpp + rendering/volumeclipplanes.cpp + tasks/generaterawvolumetask.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) diff --git a/modules/volume/envelope.cpp b/modules/volume/envelope.cpp index a3539dc83d..d4e2d4050b 100644 --- a/modules/volume/envelope.cpp +++ b/modules/volume/envelope.cpp @@ -156,11 +156,9 @@ std::string EnvelopePoint::decimalToHexadecimal(int dec) const { return "00"; } - int hex = dec; std::string hexStr; - while (dec > 0) { - hex = dec % 16; + int hex = dec % 16; if (hex < 10) { hexStr = hexStr.insert(0, std::string(1, static_cast(hex + 48))); diff --git a/modules/volume/include.cmake b/modules/volume/include.cmake index 659b975323..ffea0ac430 100644 --- a/modules/volume/include.cmake +++ b/modules/volume/include.cmake @@ -1,5 +1 @@ set(DEFAULT_MODULE ON) - -set (OPENSPACE_DEPENDENCIES - space -) diff --git a/modules/volume/linearlrucache.h b/modules/volume/linearlrucache.h index d2a8c3553f..1bf5ec0f69 100644 --- a/modules/volume/linearlrucache.h +++ b/modules/volume/linearlrucache.h @@ -25,7 +25,6 @@ #ifndef __OPENSPACE_MODULE_VOLUME___LINEARLRUCACHE___H__ #define __OPENSPACE_MODULE_VOLUME___LINEARLRUCACHE___H__ -//#include #include #include #include diff --git a/modules/volume/lrucache.h b/modules/volume/lrucache.h index 2b20ce46b9..fd84de9532 100644 --- a/modules/volume/lrucache.h +++ b/modules/volume/lrucache.h @@ -31,13 +31,12 @@ namespace openspace::volume { -template < +template< typename KeyType, typename ValueType, - template class ContainerType + template class ContainerType > -class LruCache -{ +class LruCache { public: LruCache(size_t capacity); diff --git a/modules/volume/rawvolume.h b/modules/volume/rawvolume.h index 44485f63db..1c30a0db88 100644 --- a/modules/volume/rawvolume.h +++ b/modules/volume/rawvolume.h @@ -33,9 +33,9 @@ namespace openspace::volume { template class RawVolume { +public: using VoxelType = Type; -public: RawVolume(const glm::uvec3& dimensions); glm::uvec3 dimensions() const; diff --git a/modules/volume/rawvolumemetadata.cpp b/modules/volume/rawvolumemetadata.cpp index e7886f57ca..10a956a6f1 100644 --- a/modules/volume/rawvolumemetadata.cpp +++ b/modules/volume/rawvolumemetadata.cpp @@ -25,8 +25,9 @@ #include #include - +#include #include +#include namespace { constexpr const char* KeyDimensions = "Dimensions"; diff --git a/modules/volume/rawvolumemetadata.h b/modules/volume/rawvolumemetadata.h index c3f95f7cd3..87cb5b035d 100644 --- a/modules/volume/rawvolumemetadata.h +++ b/modules/volume/rawvolumemetadata.h @@ -25,10 +25,11 @@ #ifndef __OPENSPACE_MODULE_VOLUME___RAWVOLUMEMETADATA___H__ #define __OPENSPACE_MODULE_VOLUME___RAWVOLUMEMETADATA___H__ -#include #include +#include -#include +namespace openspace::documentation { struct Documentation; } +namespace ghoul { class Dictionary; } namespace openspace::volume { diff --git a/modules/volume/rawvolumereader.h b/modules/volume/rawvolumereader.h index f534f338c7..d90a50c235 100644 --- a/modules/volume/rawvolumereader.h +++ b/modules/volume/rawvolumereader.h @@ -26,7 +26,6 @@ #define __OPENSPACE_MODULE_VOLUME___RAWVOLUMEREADER___H__ #include -#include #include namespace openspace::volume { diff --git a/modules/volume/rendering/basicvolumeraycaster.cpp b/modules/volume/rendering/basicvolumeraycaster.cpp index 0f1cfda6ec..2b0746992e 100644 --- a/modules/volume/rendering/basicvolumeraycaster.cpp +++ b/modules/volume/rendering/basicvolumeraycaster.cpp @@ -24,17 +24,18 @@ #include +#include +#include +#include +#include +#include #include -#include #include -#include +#include #include #include -#include -#include -#include -#include #include +#include namespace { constexpr const char* GlslRaycastPath = "${MODULE_VOLUME}/shaders/raycast.glsl"; diff --git a/modules/volume/rendering/basicvolumeraycaster.h b/modules/volume/rendering/basicvolumeraycaster.h index 66d018cc93..ad04676459 100644 --- a/modules/volume/rendering/basicvolumeraycaster.h +++ b/modules/volume/rendering/basicvolumeraycaster.h @@ -26,12 +26,9 @@ #define __OPENSPACE_MODULE_VOLUME___BASICVOLUMERAYCASTER___H__ #include -#include -#include -#include -#include #include +#include namespace ghoul::opengl { class Texture; @@ -42,6 +39,7 @@ namespace ghoul::opengl { namespace openspace { struct RenderData; struct RaycastData; + class TransferFunction; } // namespace openspace namespace openspace::volume { @@ -78,8 +76,7 @@ public: void setVolumeTexture(std::shared_ptr texture); std::shared_ptr volumeTexture() const; - void setTransferFunction( - std::shared_ptr transferFunction); + void setTransferFunction(std::shared_ptr transferFunction); void setStepSize(float stepSize); float opacity() const; @@ -97,7 +94,7 @@ private: std::shared_ptr _clipPlanes; std::shared_ptr _volumeTexture; - std::shared_ptr _transferFunction; + std::shared_ptr _transferFunction; BoxGeometry _boundingBox; VolumeGridType _gridType; glm::mat4 _modelTransform = glm::mat4(1.f); diff --git a/modules/volume/rendering/renderabletimevaryingvolume.cpp b/modules/volume/rendering/renderabletimevaryingvolume.cpp index 61eac27267..970b755900 100644 --- a/modules/volume/rendering/renderabletimevaryingvolume.cpp +++ b/modules/volume/rendering/renderabletimevaryingvolume.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/modules/volume/rendering/renderabletimevaryingvolume.h b/modules/volume/rendering/renderabletimevaryingvolume.h index b1b22438e8..e1d71275df 100644 --- a/modules/volume/rendering/renderabletimevaryingvolume.h +++ b/modules/volume/rendering/renderabletimevaryingvolume.h @@ -27,20 +27,12 @@ #include +#include #include #include +#include +#include #include -// #include - #include -// #include -// #include - -// #include -// #include -// #include -// #include -// #include -// #include namespace openspace { class Histogram; diff --git a/modules/volume/tasks/generaterawvolumetask.cpp b/modules/volume/tasks/generaterawvolumetask.cpp index e89bece66b..d7ef4401be 100644 --- a/modules/volume/tasks/generaterawvolumetask.cpp +++ b/modules/volume/tasks/generaterawvolumetask.cpp @@ -27,11 +27,9 @@ #include #include #include - #include #include #include - #include #include #include @@ -40,7 +38,6 @@ #include #include - #include namespace { @@ -53,11 +50,9 @@ namespace { constexpr const char* KeyUpperDomainBound = "UpperDomainBound"; } // namespace -namespace openspace { -namespace volume { +namespace openspace::volume { -GenerateRawVolumeTask::GenerateRawVolumeTask(const ghoul::Dictionary& dictionary) -{ +GenerateRawVolumeTask::GenerateRawVolumeTask(const ghoul::Dictionary& dictionary) { openspace::documentation::testSpecificationAndThrow( documentation(), dictionary, @@ -234,5 +229,4 @@ documentation::Documentation GenerateRawVolumeTask::documentation() { }; } -} // namespace volume -} // namespace openspace +} // namespace openspace::volume diff --git a/modules/volume/tasks/generaterawvolumetask.h b/modules/volume/tasks/generaterawvolumetask.h index 9f7ca41732..1fe1611ad6 100644 --- a/modules/volume/tasks/generaterawvolumetask.h +++ b/modules/volume/tasks/generaterawvolumetask.h @@ -28,11 +28,9 @@ #include #include - #include -namespace openspace { -namespace volume { +namespace openspace::volume { class GenerateRawVolumeTask : public Task { public: @@ -53,7 +51,6 @@ private: std::string _valueFunctionLua; }; -} // namespace volume -} // namespace openspace +} // namespace openspace::volume #endif // __OPENSPACE_MODULE_VOLUME___GENERATERAWVOLUMETASK___H__ diff --git a/modules/volume/transferfunction.h b/modules/volume/transferfunction.h index 9581cc6e63..e613be6779 100644 --- a/modules/volume/transferfunction.h +++ b/modules/volume/transferfunction.h @@ -25,8 +25,8 @@ #ifndef __OPENSPACE_MODULE_VOLUME___TRANSFERFUNCTION___H__ #define __OPENSPACE_MODULE_VOLUME___TRANSFERFUNCTION___H__ -#include #include +#include namespace ghoul { class Dictionary; } namespace ghoul::opengl { class Texture; } diff --git a/modules/webbrowser/CMakeLists.txt b/modules/webbrowser/CMakeLists.txt index 55f88c9be4..76b8b972cf 100644 --- a/modules/webbrowser/CMakeLists.txt +++ b/modules/webbrowser/CMakeLists.txt @@ -45,6 +45,10 @@ cmake_minimum_required(VERSION 2.8.12.1) # Use folders in the resulting project files. set_property(GLOBAL PROPERTY OS_FOLDERS ON) +# "OpenSpace Helper" is not a valid CMake target name under OLD +# https://cmake.org/cmake/help/git-stage/policy/CMP0037.html +cmake_policy(SET CMP0037 OLD) + # Use _ROOT variables # https://cmake.org/cmake/help/git-stage/policy/CMP0074.html cmake_policy(SET CMP0074 NEW) @@ -234,4 +238,4 @@ set_folder_location(openspace_web_helper "Helper") # Display CEF configuration settings. PRINT_CEF_CONFIG() -target_include_directories(${webbrowser_module} PUBLIC ${CEF_ROOT}) +target_include_directories(${webbrowser_module} SYSTEM PUBLIC ${CEF_ROOT}) diff --git a/modules/webbrowser/cmake/cef_support.cmake b/modules/webbrowser/cmake/cef_support.cmake index fdecb039d1..8c15677a76 100644 --- a/modules/webbrowser/cmake/cef_support.cmake +++ b/modules/webbrowser/cmake/cef_support.cmake @@ -32,22 +32,22 @@ # platform. function(set_current_cef_build_platform) - if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") + if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") set(CEF_PLATFORM "macosx64" PARENT_SCOPE) - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") - if(CMAKE_SIZEOF_VOID_P MATCHES 8) + elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") + if (CMAKE_SIZEOF_VOID_P MATCHES 8) set(CEF_PLATFORM "linux64" PARENT_SCOPE) - else() + else () set(CEF_PLATFORM "linux32" PARENT_SCOPE) - endif() - elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") - if(CMAKE_SIZEOF_VOID_P MATCHES 8) + endif () + elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") + if (CMAKE_SIZEOF_VOID_P MATCHES 8) set(CEF_PLATFORM "windows64" PARENT_SCOPE) else() set(CEF_PLATFORM "windows32" PARENT_SCOPE) - endif() - endif() -endfunction() + endif () + endif () +endfunction () # Download the CEF binary distribution for |platform| and |version| to # |download_dir|. The |CEF_ROOT| variable will be set in global scope pointing @@ -64,10 +64,10 @@ function(download_cef platform version download_dir) set(CEF_ROOT "${CEF_DOWNLOAD_DIR}/${CEF_DISTRIBUTION}" CACHE INTERNAL "CEF_ROOT") # Download and/or extract the binary distribution if necessary. - if(NOT IS_DIRECTORY "${CEF_ROOT}") + if (NOT IS_DIRECTORY "${CEF_ROOT}") set(CEF_DOWNLOAD_FILENAME "${CEF_DISTRIBUTION}.tar.bz2") set(CEF_DOWNLOAD_PATH "${CEF_DOWNLOAD_DIR}/${CEF_DOWNLOAD_FILENAME}") - if(NOT EXISTS "${CEF_DOWNLOAD_PATH}") + if (NOT EXISTS "${CEF_DOWNLOAD_PATH}") string(REPLACE "+" "%2B" CEF_DOWNLOAD_URL "http://opensource.spotify.com/cefbuilds/${CEF_DOWNLOAD_FILENAME}") # Download the SHA1 hash for the binary distribution. @@ -81,21 +81,21 @@ function(download_cef platform version download_dir) DOWNLOAD "${CEF_DOWNLOAD_URL}" "${CEF_DOWNLOAD_PATH}" EXPECTED_HASH SHA1=${CEF_SHA1} SHOW_PROGRESS - ) - endif() + ) + endif () # Extract the binary distribution. message(STATUS "Extracting CEF: ${CEF_DOWNLOAD_PATH}...") execute_process( COMMAND ${CMAKE_COMMAND} -E tar xzf "${CEF_DOWNLOAD_DIR}/${CEF_DOWNLOAD_FILENAME}" WORKING_DIRECTORY ${CEF_DOWNLOAD_DIR} - ) - endif() -endfunction() + ) + endif () +endfunction () macro(set_openspace_cef_target_out_dir) - if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR - ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") + if (${CMAKE_GENERATOR} STREQUAL "Ninja" OR + ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") # By default Ninja and Make builds don't create a subdirectory named after # the configuration. # set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}") @@ -104,11 +104,11 @@ macro(set_openspace_cef_target_out_dir) # Output binaries (executables, libraries) to the correct directory. # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR}) # set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CEF_TARGET_OUT_DIR}) - else() + else () # set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/$") set(CEF_TARGET_OUT_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$") - endif() -endmacro() + endif () +endmacro () macro(add_windows_cef_manifest target_dir manifest_path target extension) add_custom_command( @@ -119,7 +119,7 @@ macro(add_windows_cef_manifest target_dir manifest_path target extension) -outputresource:"${target_dir}/${target}.${extension}"\;\#1 COMMENT "Adding manifest..." ) -endmacro() +endmacro () # Add a logical target that can be used to link the specified libraries into an @@ -130,5 +130,5 @@ macro(add_cef_logical_target target debug_lib release_lib) IMPORTED_LOCATION "${release_lib}" IMPORTED_LOCATION_DEBUG "${debug_lib}" IMPORTED_LOCATION_RELEASE "${release_lib}" - ) -endmacro() + ) +endmacro () diff --git a/modules/webbrowser/cmake/webbrowser_helpers.cmake b/modules/webbrowser/cmake/webbrowser_helpers.cmake index c9b6242ba8..e35c088166 100644 --- a/modules/webbrowser/cmake/webbrowser_helpers.cmake +++ b/modules/webbrowser/cmake/webbrowser_helpers.cmake @@ -23,122 +23,117 @@ ########################################################################################## function(set_cef_targets cef_root main_target) - # find cef cmake helpers - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${cef_root}/cmake") - include(cef_support) + # find cef cmake helpers + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${cef_root}/cmake") + include(cef_support) - # Use _ROOT variables - # https://cmake.org/cmake/help/git-stage/policy/CMP0074.html - cmake_policy(SET CMP0074 NEW) - find_package(CEF REQUIRED) + # Use _ROOT variables + # https://cmake.org/cmake/help/git-stage/policy/CMP0074.html + cmake_policy(SET CMP0074 NEW) + find_package(CEF REQUIRED) - # ensure out target dir is set - set_openspace_cef_target_out_dir() + # ensure out target dir is set + set_openspace_cef_target_out_dir() - # main CEF executable target - set(CEF_TARGET ${main_target} PARENT_SCOPE) -endfunction() + # main CEF executable target + set(CEF_TARGET ${main_target} PARENT_SCOPE) +endfunction () function(run_cef_platform_config cef_root cef_target module_path) - # find cef cmake helpers - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${cef_root}/cmake") - include(cef_support) + # find cef cmake helpers + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${cef_root}/cmake") + include(cef_support) - # Use _ROOT variables - # https://cmake.org/cmake/help/git-stage/policy/CMP0074.html - cmake_policy(SET CMP0074 NEW) - find_package(CEF REQUIRED) + # Use _ROOT variables + # https://cmake.org/cmake/help/git-stage/policy/CMP0074.html + cmake_policy(SET CMP0074 NEW) + find_package(CEF REQUIRED) - if (OS_MACOSX) - run_cef_macosx_config("${cef_target}" "${module_path}") - endif() - if (OS_WINDOWS) - run_cef_windows_config("${cef_target}" "${cef_root}" "${module_path}") - endif() - if (OS_LINUX) - run_cef_linux_config("${cef_target}") - endif() -endfunction() + if (OS_MACOSX) + run_cef_macosx_config("${cef_target}" "${module_path}") + endif () + if (OS_WINDOWS) + run_cef_windows_config("${cef_target}" "${cef_root}" "${module_path}") + endif () + if (OS_LINUX) + run_cef_linux_config("${cef_target}") + endif () +endfunction () function(run_cef_macosx_config CEF_ROOT module_path) - if (${CMAKE_GENERATOR} STREQUAL "Ninja" OR - ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") - set(CEF_OUTPUT_PREFIX "") - else() - set(CEF_OUTPUT_PREFIX "$/") - endif() + if (${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") + set(CEF_OUTPUT_PREFIX "") + else () + set(CEF_OUTPUT_PREFIX "$/") + endif () - set(CEF_FINAL_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CEF_OUTPUT_PREFIX}${CEF_TARGET}.app") - set(CEF_INTERMEDIATE_HELPER_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CEF_OUTPUT_PREFIX}${CEF_HELPER_TARGET}.app") + set(CEF_FINAL_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CEF_OUTPUT_PREFIX}${CEF_TARGET}.app") + set(CEF_INTERMEDIATE_HELPER_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CEF_OUTPUT_PREFIX}${CEF_HELPER_TARGET}.app") - set(CEF_FINAL_HELPER_APP "${CEF_FINAL_APP}/Contents/Frameworks/${CEF_HELPER_TARGET}.app") - set(CEF_FRAMEWORK_LOCATION "${CEF_BINARY_DIR}/Chromium Embedded Framework.framework") - set(CEF_FRAMEWORK_FINAL_LOCATION "${CEF_FINAL_APP}/Contents/Frameworks/Chromium Embedded Framework.framework") + set(CEF_FINAL_HELPER_APP "${CEF_FINAL_APP}/Contents/Frameworks/${CEF_HELPER_TARGET}.app") + set(CEF_FRAMEWORK_LOCATION "${CEF_BINARY_DIR}/Chromium Embedded Framework.framework") + set(CEF_FRAMEWORK_FINAL_LOCATION "${CEF_FINAL_APP}/Contents/Frameworks/Chromium Embedded Framework.framework") - add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}") + add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}") - # target_link_libraries(${CEF_TARGET} PUBLIC libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) - target_link_libraries(${CEF_TARGET} PUBLIC libcef_dll_wrapper ${CEF_STANDARD_LIBS}) - set_target_properties(${CEF_TARGET} PROPERTIES - RESOURCE "${WEBBROWSER_RESOURCES_SRCS}" - MACOSX_BUNDLE_INFO_PLIST ${module_path}/mac/Info.plist - ) + # target_link_libraries(${CEF_TARGET} PUBLIC libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) + target_link_libraries(${CEF_TARGET} PUBLIC libcef_dll_wrapper ${CEF_STANDARD_LIBS}) + set_target_properties(${CEF_TARGET} PROPERTIES + RESOURCE "${WEBBROWSER_RESOURCES_SRCS}" + MACOSX_BUNDLE_INFO_PLIST ${module_path}/mac/Info.plist + ) - # Copy files into the main app bundle. + # Copy files into the main app bundle. + add_custom_command( + TARGET ${CEF_TARGET} + POST_BUILD + # Copy the helper app bundle into the Frameworks directory. + COMMAND ${CMAKE_COMMAND} -E copy_directory "${CEF_INTERMEDIATE_HELPER_APP}" "${CEF_FINAL_HELPER_APP}" + # Copy the CEF framework into the Frameworks directory. + COMMAND ${CMAKE_COMMAND} -E copy_directory "${CEF_FRAMEWORK_LOCATION}" "${CEF_FRAMEWORK_FINAL_LOCATION}" + VERBATIM + ) + + # copy dynamic libraries to bundle + file(GLOB LIBRARIES_TO_COPY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/*.dylib") + foreach (lib_file ${LIBRARIES_TO_COPY}) + get_filename_component(file_name "${lib_file}" NAME) add_custom_command( - TARGET ${CEF_TARGET} - POST_BUILD - # Copy the helper app bundle into the Frameworks directory. - COMMAND ${CMAKE_COMMAND} -E copy_directory "${CEF_INTERMEDIATE_HELPER_APP}" "${CEF_FINAL_HELPER_APP}" - # Copy the CEF framework into the Frameworks directory. - COMMAND ${CMAKE_COMMAND} -E copy_directory "${CEF_FRAMEWORK_LOCATION}" "${CEF_FRAMEWORK_FINAL_LOCATION}" - VERBATIM + TARGET ${CEF_TARGET} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${lib_file}" + "${CEF_FINAL_APP}/Contents/${file_name}" ) + endforeach () - # copy dynamic libraries to bundle - file(GLOB LIBRARIES_TO_COPY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/*.dylib") - foreach (lib_file ${LIBRARIES_TO_COPY}) - get_filename_component(file_name "${lib_file}" NAME) - add_custom_command( - TARGET ${CEF_TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${lib_file}" - "${CEF_FINAL_APP}/Contents/${file_name}" - ) - endforeach () - - if(NOT ${CMAKE_GENERATOR} STREQUAL "Xcode") - # Manually process and copy over resource files. - # The Xcode generator handles this via the set_target_properties RESOURCE directive. - set(PREFIXES "mac/") # Remove these prefixes from input file paths. - COPY_MACOSX_RESOURCES("${WEBBROWSER_RESOURCES_SOURCES}" "${PREFIXES}" "${CEF_TARGET}" "${module_path}" "${CEF_FINAL_APP}") - endif() -endfunction() + if (NOT ${CMAKE_GENERATOR} STREQUAL "Xcode") + # Manually process and copy over resource files. + # The Xcode generator handles this via the set_target_properties RESOURCE directive. + set(PREFIXES "mac/") # Remove these prefixes from input file paths. + COPY_MACOSX_RESOURCES("${WEBBROWSER_RESOURCES_SOURCES}" "${PREFIXES}" "${CEF_TARGET}" "${module_path}" "${CEF_FINAL_APP}") + endif () +endfunction () function(run_cef_windows_config CEF_TARGET CEF_ROOT MODULE_PATH) - # Executable target. - add_dependencies(${CEF_TARGET} libcef_dll_wrapper) - target_link_libraries(${CEF_TARGET} PUBLIC libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) - include_directories(${CEF_ROOT}) + # Executable target. + add_dependencies(${CEF_TARGET} libcef_dll_wrapper) + target_link_libraries(${CEF_TARGET} PUBLIC libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) + include_directories(${CEF_ROOT}) - add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}") + add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}") - if(USE_SANDBOX) - # Logical target used to link the cef_sandbox library. - message(STATUS "Using CEF in Sandboxed mode.") - ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}") - target_link_libraries(${CEF_TARGET} cef_sandbox_lib ${CEF_SANDBOX_STANDARD_LIBS}) - endif() + if (USE_SANDBOX) + # Logical target used to link the cef_sandbox library. + message(STATUS "Using CEF in Sandboxed mode.") + ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}") + target_link_libraries(${CEF_TARGET} cef_sandbox_lib ${CEF_SANDBOX_STANDARD_LIBS}) + endif () - # Add the custom manifest files to the executable. - set_openspace_cef_target_out_dir() - add_windows_cef_manifest("${CEF_TARGET_OUT_DIR}" "${MODULE_PATH}" "${CEF_TARGET}" "exe") - - # Copy binary and resource files to the target output directory. - copy_files("${CEF_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "$") - copy_files("${CEF_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "$") -endfunction() + # Add the custom manifest files to the executable. + set_openspace_cef_target_out_dir() + add_windows_cef_manifest("${CEF_TARGET_OUT_DIR}" "${MODULE_PATH}" "${CEF_TARGET}" "exe") +endfunction () function(run_cef_linux_config CEF_ROOT) - message(ERROR "Linux is not yet supported for Web Browser Module.") -endfunction() + message(ERROR "Linux is not yet supported for Web Browser Module.") +endfunction () diff --git a/modules/webbrowser/include/webrenderhandler.h b/modules/webbrowser/include/webrenderhandler.h index 8e7a12caac..f5f32ffa61 100644 --- a/modules/webbrowser/include/webrenderhandler.h +++ b/modules/webbrowser/include/webrenderhandler.h @@ -31,12 +31,17 @@ #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4100) +#elif __clang__ +//#pragma clang diagnostic push +//#pragma clang diagnostic ignored "-Wunused-variable" #endif // _MSC_VER #include #ifdef _MSC_VER #pragma warning (pop) +#elif __clang__ +//#pragma clang diagnostic pop #endif // _MSC_VER #include diff --git a/modules/webbrowser/webbrowsermodule.cpp b/modules/webbrowser/webbrowsermodule.cpp index cdcc85faeb..ec43227d68 100644 --- a/modules/webbrowser/webbrowsermodule.cpp +++ b/modules/webbrowser/webbrowsermodule.cpp @@ -25,8 +25,9 @@ #include #include -#include #include +#include +#include #include #include #include @@ -72,6 +73,7 @@ WebBrowserModule::WebBrowserModule() : OpenSpaceModule(WebBrowserModule::Name) , _updateBrowserBetweenRenderables(UpdateBrowserBetweenRenderablesInfo, true) , _browserUpdateInterval(BrowserUpdateIntervalInfo, 1.f, 1.0f, 1000.f) + , _eventHandler(new EventHandler) { global::callback::deinitialize->emplace_back([this]() { ZoneScopedN("WebBrowserModule") @@ -105,7 +107,7 @@ void WebBrowserModule::internalDeinitialize() { return; } - _eventHandler.resetBrowserInstance(); + _eventHandler->resetBrowserInstance(); bool forceBrowserShutdown = true; for (BrowserInstance* browser : _browsers) { @@ -159,7 +161,7 @@ void WebBrowserModule::internalInitialize(const ghoul::Dictionary& dictionary) { ); } - _eventHandler.initialize(); + _eventHandler->initialize(); // register ScreenSpaceBrowser auto fScreenSpaceRenderable = FactoryManager::ref().factory(); @@ -199,17 +201,13 @@ void WebBrowserModule::removeBrowser(BrowserInstance* browser) { void WebBrowserModule::attachEventHandler(BrowserInstance* browserInstance) { if (_enabled) { - _eventHandler.setBrowserInstance(browserInstance); + _eventHandler->setBrowserInstance(browserInstance); } } -EventHandler WebBrowserModule::eventHandler() { - return _eventHandler; -} - void WebBrowserModule::detachEventHandler() { if (_enabled) { - _eventHandler.setBrowserInstance(nullptr); + _eventHandler->setBrowserInstance(nullptr); } } diff --git a/modules/webbrowser/webbrowsermodule.h b/modules/webbrowser/webbrowsermodule.h index bc2c78a2a7..ff5e266ed2 100644 --- a/modules/webbrowser/webbrowsermodule.h +++ b/modules/webbrowser/webbrowsermodule.h @@ -25,7 +25,6 @@ #ifndef __OPENSPACE_MODULE_WEBBROWSER___WEBBROWSERMODULE___H__ #define __OPENSPACE_MODULE_WEBBROWSER___WEBBROWSERMODULE___H__ -#include #include #include #include @@ -33,7 +32,9 @@ namespace openspace { +class BrowserInstance; class CefHost; +class EventHandler; namespace webbrowser { extern std::chrono::microseconds interval; @@ -51,7 +52,6 @@ public: void addBrowser(BrowserInstance*); void removeBrowser(BrowserInstance*); - EventHandler eventHandler(); void attachEventHandler(BrowserInstance* browserInstance); void detachEventHandler(); bool isEnabled() const; @@ -73,7 +73,7 @@ private: properties::FloatProperty _browserUpdateInterval; std::vector _browsers; - EventHandler _eventHandler; + std::unique_ptr _eventHandler; std::unique_ptr _cefHost; std::string _webHelperLocation; bool _enabled = true; diff --git a/modules/webgui/CMakeLists.txt b/modules/webgui/CMakeLists.txt index 3bd341131a..1382cbf61b 100644 --- a/modules/webgui/CMakeLists.txt +++ b/modules/webgui/CMakeLists.txt @@ -35,8 +35,6 @@ set(OPENSPACE_SOURCE_FILES ) source_group("Source Files" FILES ${OPENSPACE_SOURCE_FILES}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # Specify the NodeJs distribution version. diff --git a/modules/webgui/cmake/nodejs_support.cmake b/modules/webgui/cmake/nodejs_support.cmake index c892251c2b..71aeccd89c 100644 --- a/modules/webgui/cmake/nodejs_support.cmake +++ b/modules/webgui/cmake/nodejs_support.cmake @@ -1,47 +1,47 @@ -######################################################################################### -# # -# OpenSpace # -# # -# Copyright (c) 2014-2017 # -# # -# 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. # -######################################################################################### +########################################################################################## +# # +# OpenSpace # +# # +# Copyright (c) 2014-2020 # +# # +# 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. # +########################################################################################## # https://nodejs.org/dist/v8.9.4/win-x64/node.exe # https://nodejs.org/dist/v8.9.4/node-v8.9.4-darwin-x64.tar.gz # https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-x64.tar.xz function(DownloadNodeJs version download_dir) - if(MSVC) + if (MSVC) set(basename "node") set(filename "${basename}.exe") set(path "v${version}/win-x64/${filename}") - endif(MSVC) - if(APPLE) + endif () + if (APPLE) set(basename "node-v${version}-darwin-x64") set(filename "${basename}.tar.gz") set(path "v${version}/${filename}") - endif(APPLE) + endif () if (UNIX AND NOT APPLE) set(basename "node-v${version}-linux-x64") set(filename "${basename}.tar.xz") set(path "v${version}/${filename}") - endif(UNIX AND NOT APPLE) + endif () # Specify the binary distribution type and download directory. set(NODEJS_DOWNLOAD_DIR "${download_dir}") @@ -50,19 +50,16 @@ function(DownloadNodeJs version download_dir) set(NODEJS_ROOT "${NODEJS_DOWNLOAD_DIR}" CACHE INTERNAL "NODEJS_ROOT") # Download and/or extract the binary distribution if necessary. - if(NOT IS_DIRECTORY "${NODEJS_ROOT}") + if (NOT IS_DIRECTORY "${NODEJS_ROOT}") set(NODEJS_DOWNLOAD_SOURCE "v${version}/node-v${version}-${suffix}") set(NODEJS_DOWNLOAD_PATH "${NODEJS_DOWNLOAD_DIR}/${filename}") - if(NOT EXISTS "${NODEJS_DOWNLOAD_PATH}") + if (NOT EXISTS "${NODEJS_DOWNLOAD_PATH}") set(NODEJS_DOWNLOAD_URL "https://nodejs.org/dist/${path}") # Download the binary distribution. message(STATUS "Downloading NodeJs: ${NODEJS_DOWNLOAD_PATH}...") - file( - DOWNLOAD "${NODEJS_DOWNLOAD_URL}" "${NODEJS_DOWNLOAD_PATH}" - SHOW_PROGRESS - ) - endif() + file(DOWNLOAD "${NODEJS_DOWNLOAD_URL}" "${NODEJS_DOWNLOAD_PATH}" SHOW_PROGRESS) + endif () message(STATUS "URL: ${NODEJS_DOWNLOAD_URL}") @@ -74,7 +71,7 @@ function(DownloadNodeJs version download_dir) COMMAND tar xzf ${NODEJS_DOWNLOAD_PATH} WORKING_DIRECTORY ${NODEJS_DOWNLOAD_DIR} ) - endif() + endif () if (UNIX AND NOT APPLE) # Linux uses tar.xz message(STATUS "Extracting NodeJs: ${NODEJS_DOWNLOAD_PATH} in ${NODEJS_DOWNLOAD_DIR}") @@ -82,13 +79,12 @@ function(DownloadNodeJs version download_dir) COMMAND tar xf ${NODEJS_DOWNLOAD_PATH} WORKING_DIRECTORY ${NODEJS_DOWNLOAD_DIR} ) - endif() + endif () if (UNIX) - FILE(COPY ${NODEJS_DOWNLOAD_DIR}/${basename}/bin/node - DESTINATION ${NODEJS_DOWNLOAD_DIR}) + FILE(COPY ${NODEJS_DOWNLOAD_DIR}/${basename}/bin/node DESTINATION ${NODEJS_DOWNLOAD_DIR}) FILE(REMOVE_RECURSE ${NODEJS_DOWNLOAD_DIR}/${basename}) FILE(REMOVE ${NODEJS_DOWNLOAD_PATH}) - endif() - endif() -endfunction() + endif () + endif () +endfunction () diff --git a/modules/webgui/include.cmake b/modules/webgui/include.cmake index 448a857dfd..3ccace7c97 100644 --- a/modules/webgui/include.cmake +++ b/modules/webgui/include.cmake @@ -1,4 +1 @@ set (DEFAULT_MODULE ON) -set (OPENSPACE_DEPENDENCIES - server -) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dd9966703f..b218ba7e4b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -434,17 +434,42 @@ endforeach () # Create OpenSpace target ########################################################################################## 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 use the date library - SYSTEM ${OPENSPACE_BASE_DIR}/ext/date/include - # In order to use the nlohmann JSON library - SYSTEM ${OPENSPACE_BASE_DIR}/ext - # In order to be able to include the module_registration file - ${CMAKE_BINARY_DIR}/_generated/include +target_include_directories(openspace-core SYSTEM + PUBLIC + # In order to use the date library + ${OPENSPACE_BASE_DIR}/ext/date/include + # In order to use the nlohmann JSON library + ${OPENSPACE_BASE_DIR}/ext +) + +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 the module_registration file + ${CMAKE_BINARY_DIR}/_generated/include + + PRIVATE + # In order to be able to include module files. This is a temporary fix as this + # introduces a dependency from the opnspace-core onto the modules + ${OPENSPACE_BASE_DIR} +) + +target_precompile_headers(openspace-core PRIVATE + [["ghoul/fmt.h"]] + [["ghoul/glm.h"]] + [["ghoul/misc/assert.h"]] + [["ghoul/misc/boolean.h"]] + [["ghoul/misc/exception.h"]] + [["ghoul/misc/invariants.h"]] + [["ghoul/misc/profiling.h"]] + + + + + + + ) configure_file( @@ -460,8 +485,18 @@ configure_file( ) if (APPLE) - find_library(APPKIT_LIBRARY AppKit REQUIRED) - target_link_libraries(openspace-core PUBLIC ${APPKIT_LIBRARY}) + target_link_libraries(openspace-core INTERFACE external-system-apple) endif () set_openspace_compile_settings(openspace-core) +target_link_libraries(openspace-core PUBLIC Ghoul spice external-curl) + +if (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 openspace-core + PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} +) diff --git a/src/documentation/documentation.cpp b/src/documentation/documentation.cpp index 4c9f074f6c..b9cd12c220 100644 --- a/src/documentation/documentation.cpp +++ b/src/documentation/documentation.cpp @@ -179,7 +179,8 @@ TestResult testSpecification(const Documentation& documentation, TestResult result; result.success = true; - auto applyVerifier = [dictionary, &result](Verifier& verifier, const std::string& key) + auto applyVerifier = [dictionary, &result](const Verifier& verifier, + const std::string& key) { TestResult res = verifier(dictionary, key); if (!res.success) { diff --git a/src/documentation/verifier.cpp b/src/documentation/verifier.cpp index 63751bdb66..d1d1327ad9 100644 --- a/src/documentation/verifier.cpp +++ b/src/documentation/verifier.cpp @@ -377,7 +377,7 @@ TestResult OrVerifier::operator()(const ghoul::Dictionary& dictionary, const bool success = std::any_of( res.cbegin(), res.cend(), - [](const TestResult& res) { return res.success; } + std::mem_fn(&TestResult::success) ); if (success) { diff --git a/src/engine/globals.cpp b/src/engine/globals.cpp index 2f5785d68e..4ed9888ad7 100644 --- a/src/engine/globals.cpp +++ b/src/engine/globals.cpp @@ -364,7 +364,7 @@ void create() { #ifdef WIN32 profile = new (currentPos) Profile; ghoul_assert(profile, "No profile"); - currentPos += sizeof(Profile); + //currentPos += sizeof(Profile); #else // ^^^ WIN32 / !WIN32 vvv profile = new Profile; #endif // WIN32 diff --git a/src/engine/globalscallbacks.cpp b/src/engine/globalscallbacks.cpp index e2953460eb..78ff2accb5 100644 --- a/src/engine/globalscallbacks.cpp +++ b/src/engine/globalscallbacks.cpp @@ -24,6 +24,7 @@ #include +#include #include #include @@ -203,7 +204,7 @@ void create() { #ifdef WIN32 touchExit = new (currentPos) std::vector>; ghoul_assert(touchExit, "No touchExit"); - currentPos += sizeof(std::vector>); + //currentPos += sizeof(std::vector>); #else // ^^^ WIN32 / !WIN32 vvv touchExit = new std::vector>; #endif // WIN32 diff --git a/src/engine/moduleengine.cpp b/src/engine/moduleengine.cpp index 5cb6c292d6..61b8979085 100644 --- a/src/engine/moduleengine.cpp +++ b/src/engine/moduleengine.cpp @@ -45,14 +45,22 @@ void ModuleEngine::initialize( { ZoneScoped - for (OpenSpaceModule* m : AllModules()) { + std::vector modules = AllModules(); + + for (OpenSpaceModule* m : modules) { + registerModule(std::unique_ptr(m)); + } + + for (OpenSpaceModule* m : modules) { const std::string& identifier = m->identifier(); auto it = moduleConfigurations.find(identifier); ghoul::Dictionary configuration; if (it != moduleConfigurations.end()) { configuration = it->second; } - registerModule(std::unique_ptr(m), configuration); + m->initialize(configuration); + addPropertySubOwner(m); + } } @@ -99,9 +107,7 @@ void ModuleEngine::deinitializeGL() { LDEBUG("Finished deinitializing OpenGL of modules"); } -void ModuleEngine::registerModule(std::unique_ptr mod, - const ghoul::Dictionary& configuration) -{ +void ModuleEngine::registerModule(std::unique_ptr mod) { ZoneScoped ghoul_assert(mod, "Module must not be nullptr"); @@ -121,8 +127,6 @@ void ModuleEngine::registerModule(std::unique_ptr mod, } LDEBUG(fmt::format("Registering module '{}'", mod->identifier())); - mod->initialize(this, configuration); - addPropertySubOwner(mod.get()); LDEBUG(fmt::format("Registered module '{}'", mod->identifier())); _modules.push_back(std::move(mod)); } diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index d51f322e91..ed3a510fff 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -633,7 +633,7 @@ void OpenSpaceEngine::initializeGL() { call.parameters.begin(), call.parameters.end(), std::string("("), - [](std::string a, const std::unique_ptr& v) { + [](const std::string& a, const std::unique_ptr& v) { std::stringstream s; s << v.get(); return a + s.str() + ", "; @@ -793,12 +793,8 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { progressInfo.progress = (*it)->progress(); if ((*it)->nTotalBytesIsKnown()) { - progressInfo.currentSize = static_cast( - (*it)->nSynchronizedBytes() - ); - progressInfo.totalSize = static_cast( - (*it)->nTotalBytes() - ); + progressInfo.currentSize = (*it)->nSynchronizedBytes(); + progressInfo.totalSize = (*it)->nTotalBytes(); } loading = true; diff --git a/src/engine/openspaceengine_lua.inl b/src/engine/openspaceengine_lua.inl index e9e647296c..4b81fa6887 100644 --- a/src/engine/openspaceengine_lua.inl +++ b/src/engine/openspaceengine_lua.inl @@ -277,10 +277,10 @@ int downloadFile(lua_State* L) { DownloadManager::FailOnError::Yes, 5 ); - if (!future || (future && !future->isFinished)) { + if (!future || !future->isFinished) { return ghoul::lua::luaError( L, - future ? "Download failed" : "Download failed: " + future->errorMessage + future ? "Download failed: " + future->errorMessage : "Download failed" ); } diff --git a/src/interaction/keyframenavigator.cpp b/src/interaction/keyframenavigator.cpp index c7de51ac17..7a175778e7 100644 --- a/src/interaction/keyframenavigator.cpp +++ b/src/interaction/keyframenavigator.cpp @@ -97,13 +97,7 @@ bool KeyframeNavigator::updateCamera(Camera& camera, bool ignoreFutureKeyframes) return false; } - return updateCamera( - &camera, - prevKeyframe->data, - nextKeyframe->data, - t, - ignoreFutureKeyframes - ); + return updateCamera(&camera, prevPose, nextPose, t, ignoreFutureKeyframes); } bool KeyframeNavigator::updateCamera(Camera* camera, const CameraPose prevPose, diff --git a/src/interaction/navigationhandler_lua.inl b/src/interaction/navigationhandler_lua.inl index 4e6db5e561..c7e6adc28e 100644 --- a/src/interaction/navigationhandler_lua.inl +++ b/src/interaction/navigationhandler_lua.inl @@ -309,7 +309,7 @@ int joystickButton(lua_State* L) { cmds.begin(), cmds.end(), std::string(), - [](std::string lhs, std::string rhs) { + [](const std::string& lhs, const std::string& rhs) { return lhs + ";" + rhs; } ); diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index 5e35d79081..336a294693 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -703,9 +703,9 @@ void SessionRecording::preSynchronization() { //Handle callback(s) for change in idle/record/playback state if (_state != _lastState) { - using K = const CallbackHandle; + using K = CallbackHandle; using V = StateChangeCallback; - for (const std::pair& it : _stateChangeCallbacks) { + for (const std::pair& it : _stateChangeCallbacks) { it.second(); } } diff --git a/src/network/parallelconnection.cpp b/src/network/parallelconnection.cpp index 514528237e..27fcacb977 100644 --- a/src/network/parallelconnection.cpp +++ b/src/network/parallelconnection.cpp @@ -149,7 +149,7 @@ ParallelConnection::Message ParallelConnection::receiveMessage() { } // Make sure that header matches this version of OpenSpace - if (!(headerBuffer[0] == 'O' && headerBuffer[1] && 'S')) { + if (!(headerBuffer[0] == 'O' && headerBuffer[1] == 'S')) { LERROR("Expected to read message header 'OS' from socket."); throw ConnectionLostError(); } @@ -174,7 +174,7 @@ ParallelConnection::Message ParallelConnection::receiveMessage() { const uint32_t messageSizeIn = *reinterpret_cast(headerBuffer.data() + offset); - offset += sizeof(uint32_t); + //offset += sizeof(uint32_t); const size_t messageSize = messageSizeIn; diff --git a/src/network/parallelpeer.cpp b/src/network/parallelpeer.cpp index 184ac07c1f..b8fa677f61 100644 --- a/src/network/parallelpeer.cpp +++ b/src/network/parallelpeer.cpp @@ -129,10 +129,6 @@ ParallelPeer::~ParallelPeer() { if (_timeJumpCallback != -1) { global::timeManager->removeTimeJumpCallback(_timeJumpCallback); } - if (_timeJumpCallback != -1) { - global::timeManager->removeTimeJumpCallback(_timeJumpCallback); - } - } void ParallelPeer::connect() { diff --git a/src/properties/stringproperty.cpp b/src/properties/stringproperty.cpp index 803d0a3ea7..682731a549 100644 --- a/src/properties/stringproperty.cpp +++ b/src/properties/stringproperty.cpp @@ -58,11 +58,9 @@ std::string fromStringConversion(std::string val, bool& success) { } bool toStringConversion(std::string& outValue, std::string inValue) { - std::string str; nlohmann::json json; nlohmann::to_json(json, inValue); outValue = json.dump(); - return true; } diff --git a/src/rendering/dashboard_lua.inl b/src/rendering/dashboard_lua.inl index 40ac6930f1..09c752dc20 100644 --- a/src/rendering/dashboard_lua.inl +++ b/src/rendering/dashboard_lua.inl @@ -22,7 +22,6 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include #include #include diff --git a/src/rendering/framebufferrenderer.cpp b/src/rendering/framebufferrenderer.cpp index 48aa47acfe..bcfadbfb18 100644 --- a/src/rendering/framebufferrenderer.cpp +++ b/src/rendering/framebufferrenderer.cpp @@ -103,37 +103,6 @@ namespace { GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 }; - - void saveTextureToMemory(GLenum attachment, int width, int height, - std::vector& memory) - { - memory.clear(); - memory.resize(width * height * 3); - - std::vector tempMemory(width * height * 3); - - if (attachment != GL_DEPTH_ATTACHMENT) { - glReadBuffer(attachment); - glReadPixels(0, 0, width, height, GL_RGB, GL_FLOAT, tempMemory.data()); - - } - else { - glReadPixels( - 0, - 0, - width, - height, - GL_DEPTH_COMPONENT, - GL_FLOAT, - tempMemory.data() - ); - } - - for (int i = 0; i < width * height * 3; ++i) { - memory[i] = static_cast(tempMemory[i]); - } - } - } // namespace namespace openspace { @@ -1426,13 +1395,8 @@ void FramebufferRenderer::performDeferredTasks( Deferredcaster* deferredcaster = deferredcasterTask.deferredcaster; - ghoul::opengl::ProgramObject* deferredcastProgram = nullptr; - - if (deferredcastProgram != _deferredcastPrograms[deferredcaster].get() - || deferredcastProgram == nullptr) - { - deferredcastProgram = _deferredcastPrograms[deferredcaster].get(); - } + ghoul::opengl::ProgramObject* deferredcastProgram = + _deferredcastPrograms[deferredcaster].get(); if (deferredcastProgram) { _pingPongIndex = _pingPongIndex == 0 ? 1 : 0; diff --git a/src/rendering/loadingscreen.cpp b/src/rendering/loadingscreen.cpp index 7b1d63f491..c0f78ee138 100644 --- a/src/rendering/loadingscreen.cpp +++ b/src/rendering/loadingscreen.cpp @@ -322,15 +322,10 @@ void LoadingScreen::render() { (item.name + " 100%\n99999999/99999999") ); - // The maximum count is in here since we can't control the amount of - // screen estate and the number of nodes. Rather than looping forever - // we make use with an overlap in the worst case - bool foundSpace = false; - glm::vec2 ll = glm::vec2(0.f); glm::vec2 ur = glm::vec2(0.f); int i = 0; - for (; i < MaxNumberLocationSamples && !foundSpace; ++i) { + for (; i < MaxNumberLocationSamples; ++i) { std::uniform_int_distribution distX( 15, static_cast(res.x - b.x - 15) diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index fb4e01ee31..37c25d05f8 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -139,14 +139,6 @@ namespace { "into the window." }; -#ifdef OPENSPACE_WITH_INSTRUMENTATION - constexpr openspace::properties::Property::PropertyInfo SaveFrameInfo = { - "SaveFrameInformation", - "Save Frame Information", - "Saves the frame information to disk" - }; -#endif // OPENSPACE_WITH_INSTRUMENTATION - constexpr openspace::properties::Property::PropertyInfo DisableMasterInfo = { "DisableMasterRendering", "Disable Master Rendering", @@ -262,9 +254,6 @@ RenderEngine::RenderEngine() , _showCameraInfo(ShowCameraInfo, true) , _applyWarping(ApplyWarpingInfo, false) , _showFrameInformation(ShowFrameNumberInfo, false) -#ifdef OPENSPACE_WITH_INSTRUMENTATION - , _saveFrameInformation(SaveFrameInfo, false) -#endif // OPENSPACE_WITH_INSTRUMENTATION , _disableMasterRendering(DisableMasterInfo, false) , _globalBlackOutFactor(GlobalBlackoutFactorInfo, 1.f, 0.f, 1.f) , _enableFXAA(FXAAInfo, true) @@ -365,14 +354,6 @@ RenderEngine::RenderEngine() addProperty(_horizFieldOfView); addProperty(_showFrameInformation); -#ifdef OPENSPACE_WITH_INSTRUMENTATION - _saveFrameInformation.onChange([&]() { - if (_saveFrameInformation) { - _frameInfo.lastSavedFrame = frameNumber(); - } - }); - addProperty(_saveFrameInformation); -#endif // OPENSPACE_WITH_INSTRUMENTATION addProperty(_framerateLimit); addProperty(_globalRotation); @@ -904,35 +885,6 @@ void RenderEngine::postDraw() { ZoneScoped ++_frameNumber; - -#ifdef OPENSPACE_WITH_INSTRUMENTATION - if (_saveFrameInformation) { - _frameInfo.frames.push_back({ - frameNumber(), - global::windowDelegate.deltaTime(), - global::windowDelegate.averageDeltaTime() - }); - } - - const uint16_t next = _frameInfo.lastSavedFrame + _frameInfo.saveEveryNthFrame; - const bool shouldSave = _saveFrameInformation && frameNumber() >= next; - if (shouldSave) { - std::string filename = fmt::format( - "_inst_renderengine_{}_{}.txt", - _frameInfo.lastSavedFrame, _frameInfo.saveEveryNthFrame - ); - std::ofstream file(absPath("${BIN}/" + filename)); - for (const FrameInfo& i : _frameInfo.frames) { - std::string line = fmt::format( - "{}\t{}\t{}", i.iFrame, i.deltaTime, i.avgDeltaTime - ); - file << line << '\n'; - } - - _frameInfo.frames.clear(); - _frameInfo.lastSavedFrame = frameNumber(); - } -#endif // OPENSPACE_WITH_INSTRUMENTATION } Scene* RenderEngine::scene() { diff --git a/src/rendering/transferfunction.cpp b/src/rendering/transferfunction.cpp index f702b1d347..6079ecefd8 100644 --- a/src/rendering/transferfunction.cpp +++ b/src/rendering/transferfunction.cpp @@ -112,7 +112,7 @@ void TransferFunction::setCallback(TfChangedCallback callback) { _tfChangedCallback = std::move(callback); } -void TransferFunction::setTextureFromTxt(std::shared_ptr ptr) { +void TransferFunction::setTextureFromTxt() { std::ifstream in; in.open(_filepath.c_str()); diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index d364354be3..ae734c2a5d 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -48,6 +48,7 @@ namespace { constexpr const char* KeyIdentifier = "Identifier"; constexpr const char* KeyParent = "Parent"; +#ifdef TRACY_ENABLE constexpr const char* renderBinToString(int renderBin) { // Synced with Renderable::RenderBin if (renderBin == 1) { @@ -69,6 +70,7 @@ namespace { throw ghoul::MissingCaseException(); } } +#endif // TRACY_ENABLE } // namespace namespace openspace { diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index 4e6c766067..b44e1ad2ca 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -150,12 +150,13 @@ bool doesUriContainGroupTag(const std::string& command, std::string& groupName) } } -std::string replaceUriWithGroupName(std::string uri, std::string ownerName) { +std::string replaceUriWithGroupName(const std::string& uri, const std::string& ownerName) +{ size_t pos = uri.find_first_of("."); return ownerName + "." + uri.substr(pos); } -std::string extractUriWithoutGroupName(std::string uri) { +std::string extractUriWithoutGroupName(const std::string& uri) { size_t pos = uri.find_first_of("."); return uri.substr(pos); } diff --git a/src/scripting/scriptengine_lua.inl b/src/scripting/scriptengine_lua.inl index e27ddeb283..220531b537 100644 --- a/src/scripting/scriptengine_lua.inl +++ b/src/scripting/scriptengine_lua.inl @@ -25,7 +25,7 @@ #include #include -#include +#include namespace openspace::luascriptfunctions { diff --git a/src/scripting/systemcapabilitiesbinding.cpp b/src/scripting/systemcapabilitiesbinding.cpp index 79b7676711..c6d3914fe1 100644 --- a/src/scripting/systemcapabilitiesbinding.cpp +++ b/src/scripting/systemcapabilitiesbinding.cpp @@ -175,7 +175,7 @@ int extensions(lua_State* L) { lua_newtable(L); - for (size_t i = 1; i <= extensions.size(); ++i) { + for (size_t i = 1; i < extensions.size(); ++i) { ghoul::lua::push(L, extensions[i]); lua_rawseti(L, -2, i); } diff --git a/src/util/keys.cpp b/src/util/keys.cpp index a01f7316fd..bb7ea212ae 100644 --- a/src/util/keys.cpp +++ b/src/util/keys.cpp @@ -46,7 +46,7 @@ KeyAction operator|(KeyAction lhs, KeyAction rhs) { ); } -KeyAction operator|=(KeyAction& lhs, KeyAction rhs) { +KeyAction operator|=(KeyAction lhs, KeyAction rhs) { return (lhs | rhs); } @@ -62,7 +62,7 @@ KeyModifier operator|(KeyModifier lhs, KeyModifier rhs) { ); } -KeyModifier operator|=(KeyModifier& lhs, KeyModifier rhs) { +KeyModifier operator|=(KeyModifier lhs, KeyModifier rhs) { return (lhs | rhs); } diff --git a/src/util/openspacemodule.cpp b/src/util/openspacemodule.cpp index faba6a17fb..f0ff0289b9 100644 --- a/src/util/openspacemodule.cpp +++ b/src/util/openspacemodule.cpp @@ -47,9 +47,7 @@ OpenSpaceModule::OpenSpaceModule(std::string name) : properties::PropertyOwner({ std::move(name) }) {} -void OpenSpaceModule::initialize(const ModuleEngine* moduleEngine, - const ghoul::Dictionary& configuration) -{ +void OpenSpaceModule::initialize(const ghoul::Dictionary& configuration) { ZoneScoped ZoneName(identifier().c_str(), identifier().size()) @@ -71,7 +69,6 @@ void OpenSpaceModule::initialize(const ModuleEngine* moduleEngine, LDEBUG(fmt::format("Registering module path {}: {}", moduleToken, path)); FileSys.registerPathToken(moduleToken, std::move(path)); - _moduleEngine = moduleEngine; internalInitialize(configuration); } @@ -145,10 +142,6 @@ std::string OpenSpaceModule::modulePath() const { ); } -const ModuleEngine* OpenSpaceModule::moduleEngine() const { - return _moduleEngine; -} - void OpenSpaceModule::internalInitialize(const ghoul::Dictionary&) {} void OpenSpaceModule::internalInitializeGL() {} diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index 6b1c86146b..f5e2d31f92 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -387,9 +387,9 @@ std::vector> SpiceManager::ckCoverage( } else { id *= 1000; - const auto it = _ckIntervals.find(id); - if (it != _ckIntervals.end()) { - return it->second; + const auto it2 = _ckIntervals.find(id); + if (it2 != _ckIntervals.end()) { + return it2->second; } else { std::vector> emptyList; @@ -404,11 +404,9 @@ std::vector> SpiceManager::spiceBodies( std::vector> bodies; constexpr const int Frnmln = 33; - constexpr const int Lnsize = 81; SPICEINT_CELL(idset, 8192); SpiceChar frname[Frnmln]; - SpiceChar outlin[Lnsize]; for (SpiceInt i = 1; i <= 6; i++) { if (i < 6) { @@ -434,7 +432,12 @@ std::vector> SpiceManager::spiceBodies( Frnmln, frname ); - bodies.push_back(std::make_pair(((long)((SpiceInt*)idset.data)[j]), frname)); + bodies.push_back( + std::make_pair( + static_cast(reinterpret_cast(idset.data)[j]), + frname + ) + ); } } return bodies; diff --git a/src/util/time_lua.inl b/src/util/time_lua.inl index b5e0f47b81..183283dd69 100644 --- a/src/util/time_lua.inl +++ b/src/util/time_lua.inl @@ -613,7 +613,7 @@ int time_interpolateTimeRelative(lua_State* L) { return ghoul::lua::luaError(L, fmt::format("bad argument #1 ({})", msg)); } - if (lua_gettop(L) == 1 && isNumber) { + if (lua_gettop(L) == 1) { double delta = lua_tonumber(L, 1); global::timeManager->interpolateTimeRelative( delta, diff --git a/src/util/timemanager.cpp b/src/util/timemanager.cpp index 7cbf5b878f..66c251c61c 100644 --- a/src/util/timemanager.cpp +++ b/src/util/timemanager.cpp @@ -146,9 +146,9 @@ void TimeManager::preSynchronization(double dt) { if (newTime != _lastTime) { ZoneScopedN("newTime != _lastTime") - using K = const CallbackHandle; + using K = CallbackHandle; using V = TimeChangeCallback; - for (const std::pair& it : _timeChangeCallbacks) { + for (const std::pair& it : _timeChangeCallbacks) { ZoneScopedN("tcc") it.second(); } @@ -158,25 +158,25 @@ void TimeManager::preSynchronization(double dt) { _targetDeltaTime != _lastTargetDeltaTime) { ZoneScopedN("delta time changed") - using K = const CallbackHandle; + using K = CallbackHandle; using V = TimeChangeCallback; - for (const std::pair& it : _deltaTimeChangeCallbacks) { + for (const std::pair& it : _deltaTimeChangeCallbacks) { ZoneScopedN("dtcc") it.second(); } } if (_deltaTimeStepsChanged) { - using K = const CallbackHandle; + using K = CallbackHandle; using V = TimeChangeCallback; - for (const std::pair& it : _deltaTimeStepsChangeCallbacks) { + for (const std::pair& it : _deltaTimeStepsChangeCallbacks) { it.second(); } } if (_timelineChanged) { ZoneScopedN("timeline changed") - using K = const CallbackHandle; + using K = CallbackHandle; using V = TimeChangeCallback; - for (const std::pair& it : _timelineChangeCallbacks) { + for (const std::pair& it : _timelineChangeCallbacks) { ZoneScopedN("tlcc") it.second(); } @@ -254,9 +254,9 @@ void TimeManager::progressTime(double dt) { _integrateFromTime.data().setTime(_timeNextFrame.j2000Seconds()); _shouldSetTime = false; - using K = const CallbackHandle; + using K = CallbackHandle; using V = TimeChangeCallback; - for (const std::pair& it : _timeJumpCallbacks) { + for (const std::pair& it : _timeJumpCallbacks) { it.second(); } return; diff --git a/support/cmake/application_definition.cmake b/support/cmake/application_definition.cmake index 1f6180e0db..c539ed00ba 100644 --- a/support/cmake/application_definition.cmake +++ b/support/cmake/application_definition.cmake @@ -25,18 +25,40 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake) function (create_new_application application_name) - add_executable(${application_name} MACOSX_BUNDLE ${ARGN}) - set_openspace_compile_settings(${application_name}) + add_executable(${application_name} MACOSX_BUNDLE ${ARGN}) + set_openspace_compile_settings(${application_name}) - if (WIN32) - get_external_library_dependencies(ext_lib) - ghl_copy_files( - ${application_name} - "${CURL_ROOT_DIR}/lib/libcurl.dll" - "${CURL_ROOT_DIR}/lib/libeay32.dll" - "${CURL_ROOT_DIR}/lib/ssleay32.dll" - ${ext_lib} - ) - ghl_copy_shared_libraries(${application_name} ${OPENSPACE_EXT_DIR}/ghoul) - endif () + # We currently can't reuse the precompiled header because that one has the Kameleon + # definition stuck into it + #target_precompile_headers(${library_name} REUSE_FROM openspace-core) + target_precompile_headers(${application_name} PRIVATE + [["ghoul/fmt.h"]] + [["ghoul/glm.h"]] + [["ghoul/misc/assert.h"]] + [["ghoul/misc/boolean.h"]] + [["ghoul/misc/exception.h"]] + [["ghoul/misc/invariants.h"]] + [["ghoul/misc/profiling.h"]] + + + + + + + + ) + + if (WIN32) + get_external_library_dependencies(ext_lib) + ghl_copy_files( + ${application_name} + "${OPENSPACE_BASE_DIR}/ext/curl/lib/libcurl.dll" + "${OPENSPACE_BASE_DIR}/ext/curl/lib/libeay32.dll" + "${OPENSPACE_BASE_DIR}/ext/curl/lib/ssleay32.dll" + ${ext_lib} + ) + ghl_copy_shared_libraries(${application_name} ${OPENSPACE_BASE_DIR}/ext/ghoul) + endif () + + target_link_libraries(${application_name} PUBLIC openspace-module-base) endfunction () diff --git a/support/cmake/handle_modules.cmake b/support/cmake/handle_modules.cmake deleted file mode 100644 index b6258833f8..0000000000 --- a/support/cmake/handle_modules.cmake +++ /dev/null @@ -1,369 +0,0 @@ -########################################################################################## -# # -# OpenSpace # -# # -# Copyright (c) 2014-2020 # -# # -# 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(${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) - # - # Step 1: Get a list of all modules - # - # First get all the internal module - get_individual_modules(${internal_module_path} all_module_names all_module_paths) - - # Then get all external modules - foreach (path ${external_modules_paths}) - get_individual_modules(${path} names paths) - - foreach (n ${names}) - if (${n} IN_LIST all_module_names) - message(FATAL_ERROR "Module name ${n} is not unique among the external directories") - endif () - endforeach () - - set(all_module_names ${all_module_names} ${names}) - set(all_module_paths ${all_module_paths} ${paths}) - 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 - # - - set(enabled_module_names "") - set(enabled_module_paths "") - 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 ${name} (${path}) as it is not supported on this machine") - continue() - endif () - - get_module_attribute_default(${path} is_default_module) - create_option_name(${name} optionName) - option(${optionName} "Build ${path} Module" ${is_default_module}) - - if (${optionName}) - list(APPEND enabled_module_names ${name}) - list(APPEND enabled_module_paths ${path}) - endif () - endforeach () - - # - # Step 3: For each module that is default or enabled by the user, get the dependencies - # - set(dependencies "") - list(LENGTH enabled_module_names enabled_module_count) - if (${enabled_module_count} EQUAL 0) - message(STATUS "No modules selected") - return() - endif () - 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) - - get_recursive_dependencies( - ${name} ${path} - "${all_module_names}" "${all_module_paths}" - deps - ) - - set(dependencies ${dependencies} ${deps}) - endforeach() - - # We can remove the duplicates here. We constructed the list such that nested - # dependencies are order left to right. REMOVE_DUPLICATES will keep the left most - # value in the case of duplicates, so that will still work - list(REMOVE_DUPLICATES dependencies) - - # - # Step 4: Check each dependency and set it, if necessary - # - foreach (dep ${dependencies}) - create_option_name(${dep} optionName) - if (NOT ${optionName}) - set(${optionName} ON CACHE BOOL "Build ${dep} Module" FORCE) - message(STATUS "Due to dependencies, the '${dep}' was enabled") - - find_path_for_module(${dep} "${all_module_names}" "${all_module_paths}" path) - list(APPEND enabled_module_names ${dep}) - list(APPEND enabled_module_paths ${path}) - endif () - endforeach () - - # 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 () - - # - # Step 5: Add the subdirectories of all enabled modules - # - set(module_class_names "") - set(module_external_libraries "") - 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 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(openspace-core PUBLIC ${library_name}) - endif() - - create_define_name(${name} define_name) - target_compile_definitions(openspace-core PUBLIC "${define_name}") - - get_property(class_name GLOBAL PROPERTY CurrentModuleClassName) - list(APPEND module_class_names ${class_name}) - - get_property(ext_lib GLOBAL PROPERTY CurrentModuleExternalLibraries) - list(APPEND module_external_libraries ${ext_lib}) - endforeach () - - list(REMOVE_DUPLICATES module_external_libraries) - add_external_library_dependencies("${module_external_libraries}") - - # - # Step 6: Create the moduleregistration.h file with the header file paths, class - # names and the external module paths. - # The class list needs to be topologically sorted, based on - # the dependency graph, in order to guarantee that modules are - # initialized after their dependencies. - # - - # We generate a list of the names of the enabled modules taking - # the topologically sorted dependencies and adding the rest of the modules. - # REMOVE_DUPLICATES will keep the left most value in the case of duplicates - set(topologically_sorted ${dependencies} ${enabled_module_names}) - list(REMOVE_DUPLICATES topologically_sorted) - - set(MODULE_HEADERS "") - set(MODULE_CLASSES "") - set(MODULE_PATHS "") - - foreach (key RANGE ${enabled_module_count}) - list(GET topologically_sorted ${key} name) - list(FIND enabled_module_names ${name} val) - - list(GET enabled_module_paths ${val} path) - list(GET module_class_names ${val} class_name) - - string(TOUPPER ${name} module_upper) - string(TOLOWER ${name} module_lower) - - create_module_header_filepath(${name} ${path} header_filepath) - - list(APPEND MODULE_HEADERS "#include <${header_filepath}>\n") - list(APPEND MODULE_CLASSES " new ${class_name},\n") - endforeach () - - get_unique_include_paths( - "${enabled_module_paths}" - "${internal_module_path}" - module_paths - ) - - foreach (path ${module_paths}) - list(APPEND MODULE_PATHS " \"${path}\",\n") - # 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(openspace-core PUBLIC ${path}) - endforeach () - - if (NOT "${MODULE_HEADERS}" STREQUAL "") - string(REPLACE ";" "" MODULE_HEADERS ${MODULE_HEADERS}) - endif () - - if (NOT "${MODULE_CLASSES}" STREQUAL "") - string(REPLACE ";" "" MODULE_CLASSES ${MODULE_CLASSES}) - endif () - - if (NOT "${MODULE_PATHS}" STREQUAL "") - string(REPLACE ";" "" MODULE_PATHS ${MODULE_PATHS}) - string(REPLACE "\\" "/" MODULE_PATHS ${MODULE_PATHS}) - endif () - - configure_file( - ${OPENSPACE_CMAKE_EXT_DIR}/module_registration.template - ${CMAKE_BINARY_DIR}/_generated/include/openspace/moduleregistration.h - ) - - configure_file( - ${OPENSPACE_CMAKE_EXT_DIR}/module_path.template - ${CMAKE_BINARY_DIR}/_generated/include/openspace/modulepath.h - ) -endfunction() - - -# This function takes a list of module paths and returns the list of include paths that -# need to be added to the moduleregistration file. Each module files parent directory is -# considered, but with the internal module path ignored -function (get_unique_include_paths module_paths internal_module_path result) - set(res "") - foreach (p ${all_module_paths}) - get_filename_component(base_dir_parent "${p}/.." ABSOLUTE) - get_filename_component(base_dir_grandparent "${p}/../.." ABSOLUTE) - get_filename_component(int_dir "${internal_module_path}/.." ABSOLUTE) - if (NOT ${base_dir_grandparent} STREQUAL ${int_dir}) - # We need to add both parent and grantparent directory: - # The grandparent has to be added if we have an external module in the path - # x/modules/name and we need to add 'x' to the module search path such that - # people can write #include - # - # The parent needs to be included for modules in subdirectories of the form - # openspace/modules/dir/name such that 'dir' is included in the search path - list(APPEND res ${base_dir_parent}) - list(APPEND res ${base_dir_grandparent}) - endif () - endforeach () - - list(REMOVE_DUPLICATES res) - set(${result} ${res} PARENT_SCOPE) -endfunction () - - -# Returns whether the module located at 'path' is a default module or not -function (get_module_attribute_default path result) - set(${result} OFF PARENT_SCOPE) - if (EXISTS "${path}/include.cmake") - unset(DEFAULT_MODULE) - include(${path}/include.cmake) - if (DEFINED DEFAULT_MODULE) - set(${result} ${DEFAULT_MODULE} PARENT_SCOPE) - endif () - endif () -endfunction() - - -# Returns the list of dependencies of the module located at 'path' -function (get_module_attribute_dependencies path result) - set(${result} "" PARENT_SCOPE) - if (EXISTS "${path}/include.cmake") - unset(OPENSPACE_DEPENDENCIES) - include(${path}/${dir}/include.cmake) - if (DEFINED OPENSPACE_DEPENDENCIES) - set(${result} ${OPENSPACE_DEPENDENCIES} PARENT_SCOPE) - endif () - endif () -endfunction() - -# Returns the state whether the module located at 'path' is supported on this machine -function (get_module_attribute_supported path result) - set(${result} ON PARENT_SCOPE) - if (EXISTS "${path}/include.cmake") - unset(SUPPORTED) - include(${path}/${dir}/include.cmake) - if (DEFINED SUPPORTED) - set(${result} ${SUPPORTED} PARENT_SCOPE) - endif () - endif () -endfunction() - - -# Returns the path for the 'module_name'. If the module has not been seen before by -# get_individual_modules, an empty string is returned -function (find_path_for_module module_name module_names module_paths result) - list(FIND module_names ${module_name} i) - if (i EQUAL -1) - # Did not find the name in the list - set(${result} "" PARENT_SCOPE) - else () - # We found the name in the list, so the path is at the same location - list(GET module_paths ${i} path) - set(${result} ${path} PARENT_SCOPE) - endif () -endfunction () - - -# Gets the names of the dependencies of 'module_name' recursively and returns them in -# 'result'. For a dependency chain of a -> b -> c get_recursive_depdencies(a) will -# return "b,c" -function (get_recursive_dependencies module_name module_path module_names module_paths result) - set(result_aggregate "") - get_module_attribute_dependencies(${module_path} deps) - if (deps) - foreach (name ${deps}) - find_path_for_module(${name} "${module_names}" "${module_paths}" path) - if (path) - get_recursive_dependencies( - ${name} ${path} - "${module_names}" "${module_paths}" - res - ) - # 1. We add "base" to the list of dependencies as we always want it - # 2. We add dependencies in this order such that when we later traverse - # this list, we automatically get them in the correct order (meaning - # that we include a dependency first) - set(result_aggregate ${result_aggregate} "base" ${res} ${name}) - else () - message(FATAL_ERROR "Could not find dependency ${name} for module ${module_name}") - endif () - endforeach () - endif () - set(${result} ${result_aggregate} PARENT_SCOPE) -endfunction() - - -# Returns a list of all modules contained in the folder 'path' -function (get_individual_modules path module_names module_paths) - file(GLOB moduleDirs RELATIVE ${path} ${path}/*) - - set(names "") - set(paths "") - foreach (dir ${moduleDirs}) - if (EXISTS "${path}/${dir}/CMakeLists.txt") - list(APPEND names ${dir}) - list(APPEND paths ${path}/${dir}) - else () - # The CMakeLists.txt does not exist, so it might be a group of subdirectories - get_individual_modules(${path}/${dir} _mod_names _mod_paths) - list(APPEND names ${_mod_names}) - list(APPEND paths ${_mod_paths}) - # message(STATUS "Skipping ${dir} as ${dir}/CMakeLists.txt does not exist") - endif () - endforeach () - - set(${module_names} ${names} PARENT_SCOPE) - set(${module_paths} ${paths} PARENT_SCOPE) -endfunction () diff --git a/support/cmake/module_common.cmake b/support/cmake/module_common.cmake index 7ca5c2f94d..dffd4218d4 100644 --- a/support/cmake/module_common.cmake +++ b/support/cmake/module_common.cmake @@ -23,29 +23,29 @@ ########################################################################################## function (create_library_name module_name library_name) - string(TOLOWER ${module_name} module_name) - set(${library_name} "openspace-module-${module_name}" PARENT_SCOPE) + string(TOLOWER ${module_name} module_name) + set(${library_name} "openspace-module-${module_name}" PARENT_SCOPE) endfunction () function (create_option_name module_name option_name) - string(TOUPPER ${module_name} module_name) - set(${option_name} "OPENSPACE_MODULE_${module_name}" PARENT_SCOPE) + string(TOUPPER ${module_name} module_name) + set(${option_name} "OPENSPACE_MODULE_${module_name}" PARENT_SCOPE) endfunction () function (create_define_name module_name define_name) - string(TOUPPER ${module_name} module_name) - set(${define_name} "OPENSPACE_MODULE_${module_name}_ENABLED" PARENT_SCOPE) + string(TOUPPER ${module_name} module_name) + set(${define_name} "OPENSPACE_MODULE_${module_name}_ENABLED" PARENT_SCOPE) endfunction () function (create_module_header_filepath module_name module_path header_filepath) - string(TOLOWER ${module_name} module_name) - string(REPLACE "${OPENSPACE_BASE_DIR}/" "" module_path ${module_path}) - set(header_filepath "${module_path}/${module_name}module.h" PARENT_SCOPE) + string(TOLOWER ${module_name} module_name) + string(REPLACE "${OPENSPACE_BASE_DIR}/" "" module_path ${module_path}) + set(header_filepath "${module_path}/${module_name}module.h" PARENT_SCOPE) endfunction () function (create_module_class_name module_name module_class_name) - # Capitalize the first character - string(SUBSTRING ${module_name} 0 1 FIRST_LETTER) - string(TOUPPER ${FIRST_LETTER} FIRST_LETTER) - string(REGEX REPLACE "^.(.*)" "${FIRST_LETTER}\\1" module_name "${module_name}") + # Capitalize the first character + string(SUBSTRING ${module_name} 0 1 FIRST_LETTER) + string(TOUPPER ${FIRST_LETTER} FIRST_LETTER) + string(REGEX REPLACE "^.(.*)" "${FIRST_LETTER}\\1" module_name "${module_name}") endfunction () diff --git a/support/cmake/module_definition.cmake b/support/cmake/module_definition.cmake index b2aaffd948..b09ea6c2c2 100644 --- a/support/cmake/module_definition.cmake +++ b/support/cmake/module_definition.cmake @@ -35,65 +35,69 @@ include(GenerateExportHeader) # The 'library_mode' determines whether the module is linked STATIC or SHARED # Dependencies will have to be set in a file called "include.cmake" 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) + # Create a library name of the style: openspace-module-${name} + create_library_name(${module_name} library_name) - # Add the module files to the list of sources - get_module_files(${module_name} module_files) + # Add the module files to the list of sources + get_module_files(${module_name} module_files) - # Create the library - add_library(${library_name} ${library_mode} ${module_files} ${ARGN}) + # Create the library + add_library(${library_name} ${library_mode} ${module_files} ${ARGN}) - # Set compile settings that are common to all modules - set_openspace_compile_settings(${library_name}) + # Set compile settings that are common to all modules + set_openspace_compile_settings(${library_name}) - handle_module_dependencies(${library_name} ${module_name}) + target_include_directories(${library_name} PUBLIC ${OPENSPACE_BASE_DIR}) + create_define_name(${module_name} define_name) + target_compile_definitions(${library_name} PUBLIC "${define_name}") - if ("${library_mode}" STREQUAL "SHARED") - # If it is a shared library, we want to generate the export header - string(TOLOWER ${module_name} lower_module_name) - generate_export_header( - ${library_name} - EXPORT_FILE_NAME - ${CMAKE_BINARY_DIR}/_generated/include/${lower_module_name}_export.h - ) - endif () + handle_module_dependencies(${library_name} ${module_name}) - # This is an ugly hack as we can't inject a variable into a scope two parents above - # would love to: set(${module_class_name} "${module_name}Module" PARENT_PARENT_SCOPE) - # instead - # This value is used in handle_modules.cmake::handle_modules - set_property(GLOBAL PROPERTY CurrentModuleClassName "${module_name}Module") - - set(${output_library_name} ${library_name} PARENT_SCOPE) + if ("${library_mode}" STREQUAL "SHARED") + # If it is a shared library, we want to generate the export header + string(TOLOWER ${module_name} lower_module_name) + generate_export_header( + ${library_name} + EXPORT_FILE_NAME + ${CMAKE_BINARY_DIR}/_generated/include/${lower_module_name}_export.h + ) + endif () + + # This is an ugly hack as we can't inject a variable into a scope two parents above + # would love to: set(${module_class_name} "${module_name}Module" PARENT_PARENT_SCOPE) + # instead + # This value is used in handle_modules.cmake::handle_modules + set_property(GLOBAL PROPERTY CurrentModuleClassName "${module_name}Module") + + set(${output_library_name} ${library_name} PARENT_SCOPE) endfunction () function (register_external_libraries libraries) - # This is an ugly hack as we can't inject a variable into a scope two parents above - # would love to: set(${module_external_librarys} "${libraries}" PARENT_PARENT_SCOPE) - # instead - set(libs "") - foreach (library ${libraries}) - get_filename_component(lib ${library} ABSOLUTE) - list(APPEND libs ${lib}) - endforeach() + # This is an ugly hack as we can't inject a variable into a scope two parents above + # would love to: set(${module_external_librarys} "${libraries}" PARENT_PARENT_SCOPE) + # instead + set(libs "") + foreach (library ${libraries}) + get_filename_component(lib ${library} ABSOLUTE) + list(APPEND libs ${lib}) + endforeach() - set_property(GLOBAL PROPERTY CurrentModuleExternalLibraries ${libs}) + set_property(GLOBAL PROPERTY CurrentModuleExternalLibraries ${libs}) endfunction () # Gets and returns the module.h and module.cpp files and provides them with a # source group function (get_module_files module_name module_files) - string(TOLOWER ${module_name} module_name_lower) - set(module_files - ${CMAKE_CURRENT_SOURCE_DIR}/${module_name_lower}module.h - ${CMAKE_CURRENT_SOURCE_DIR}/${module_name_lower}module.cpp - PARENT_SCOPE - ) - source_group("Module Files" FILES ${module_files}) + string(TOLOWER ${module_name} module_name_lower) + set(module_files + ${CMAKE_CURRENT_SOURCE_DIR}/${module_name_lower}module.h + ${CMAKE_CURRENT_SOURCE_DIR}/${module_name_lower}module.cpp + PARENT_SCOPE + ) + source_group("Module Files" FILES ${module_files}) endfunction () @@ -102,28 +106,48 @@ endfunction () # function takes care that they are added to the project # 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} PRIVATE Ghoul openspace-core) + # We always want to link against Ghoul and the core library + target_link_libraries(${library_name} PRIVATE Ghoul openspace-core) + # We currently can't reuse the precompiled header because that one has the Kameleon + # definition stuck into it + #target_precompile_headers(${library_name} REUSE_FROM openspace-core) + target_precompile_headers(${library_name} PRIVATE + [["ghoul/fmt.h"]] + [["ghoul/glm.h"]] + [["ghoul/misc/assert.h"]] + [["ghoul/misc/boolean.h"]] + [["ghoul/misc/exception.h"]] + [["ghoul/misc/invariants.h"]] + [["ghoul/misc/profiling.h"]] + + + + + + + + ) - if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include.cmake") - include(${CMAKE_CURRENT_SOURCE_DIR}/include.cmake) - # Handle OpenSpace dependencies - foreach (dep ${OPENSPACE_DEPENDENCIES}) - create_library_name(${dep} dep_library) - message(STATUS "Link: ${target_name} <- ${dep_library}") - target_link_libraries(${target_name} PRIVATE ${dep_library}) - endforeach () + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include.cmake") + include(${CMAKE_CURRENT_SOURCE_DIR}/include.cmake) - # Handle external dependencies - foreach (dep ${EXTERNAL_DEPENDENCIES}) - string(TOUPPER ${dep} dep_upper) - find_package(${dep} REQUIRED) - target_include_directories(${target_name} PUBLIC - ${${dep_upper}_INCLUDE_DIR} ${${dep_upper}_INCLUDE_DIRS} - ) - message(STATUS "Link: ${target_name} <- ${${dep_upper}_LIBRARIES}") - target_link_libraries(${target_name} PRIVATE ${${dep_upper}_LIBRARIES}) - endforeach () - endif () + # Handle OpenSpace dependencies + foreach (dep ${OPENSPACE_DEPENDENCIES}) + create_library_name(${dep} dep_library) + message(STATUS "Link: ${target_name} <- ${dep_library}") + target_link_libraries(${target_name} PRIVATE ${dep_library}) + endforeach () + + # Handle external dependencies + foreach (dep ${EXTERNAL_DEPENDENCIES}) + string(TOUPPER ${dep} dep_upper) + find_package(${dep} REQUIRED) + target_include_directories(${target_name} PUBLIC + ${${dep_upper}_INCLUDE_DIR} ${${dep_upper}_INCLUDE_DIRS} + ) + message(STATUS "Link: ${target_name} <- ${${dep_upper}_LIBRARIES}") + target_link_libraries(${target_name} PRIVATE ${${dep_upper}_LIBRARIES}) + endforeach () + endif () endfunction () diff --git a/support/cmake/openspace_header.template b/support/cmake/openspace_header.template index ca8ede21eb..f5a5ac7ce2 100644 --- a/support/cmake/openspace_header.template +++ b/support/cmake/openspace_header.template @@ -31,9 +31,9 @@ namespace openspace { std::string licenseText(); -constexpr int OPENSPACE_VERSION_MAJOR = @OPENSPACE_VERSION_MAJOR@; -constexpr int OPENSPACE_VERSION_MINOR = @OPENSPACE_VERSION_MINOR@; -constexpr int OPENSPACE_VERSION_PATCH = @OPENSPACE_VERSION_PATCH@; +constexpr const int OPENSPACE_VERSION_MAJOR = @OPENSPACE_VERSION_MAJOR@; +constexpr const int OPENSPACE_VERSION_MINOR = @OPENSPACE_VERSION_MINOR@; +constexpr const int OPENSPACE_VERSION_PATCH = @OPENSPACE_VERSION_PATCH@; constexpr const char* OPENSPACE_VERSION_NUMBER = "@OPENSPACE_VERSION_MAJOR@.@OPENSPACE_VERSION_MINOR@.@OPENSPACE_VERSION_PATCH@"; diff --git a/support/cmake/packaging.cmake b/support/cmake/packaging.cmake index 796e5367c2..52cec8a3eb 100644 --- a/support/cmake/packaging.cmake +++ b/support/cmake/packaging.cmake @@ -33,82 +33,82 @@ set(CPACK_PACKAGE_VERSION_MAJOR "${OPENSPACE_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${OPENSPACE_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${OPENSPACE_VERSION_PATCH}") set(OPENSPACE_VERSION_NUMBER - "${OPENSPACE_VERSION_MAJOR}.${OPENSPACE_VERSION_MINOR}.${OPENSPACE_VERSION_PATCH}" + "${OPENSPACE_VERSION_MAJOR}.${OPENSPACE_VERSION_MINOR}.${OPENSPACE_VERSION_PATCH}" ) set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenSpace ${OPENSPACE_VERSION_NUMBER}") set(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME} ${OPENSPACE_VERSION_NUMBER} ${OPENSPACE_VERSION_STRING}" + "${CPACK_PACKAGE_NAME} ${OPENSPACE_VERSION_NUMBER} ${OPENSPACE_VERSION_STRING}" ) set(CPACK_STRIP_FILES 1) install(DIRECTORY - ${OPENSPACE_BASE_DIR}/bin/${CMAKE_BUILD_TYPE}/ - DESTINATION bin - USE_SOURCE_PERMISSIONS + ${OPENSPACE_BASE_DIR}/bin/${CMAKE_BUILD_TYPE}/ + DESTINATION bin + USE_SOURCE_PERMISSIONS ) install(DIRECTORY ${OPENSPACE_BASE_DIR}/config/ DESTINATION config) install(DIRECTORY ${OPENSPACE_BASE_DIR}/data/ DESTINATION data) install(DIRECTORY ${OPENSPACE_BASE_DIR}/modules/ - DESTINATION modules - FILES_MATCHING - PATTERN "*.glsl" - PATTERN "*.hglsl" - PATTERN "*.fs" - PATTERN "*.vs" - PATTERN "*.lua" + DESTINATION modules + FILES_MATCHING + PATTERN "*.glsl" + PATTERN "*.hglsl" + PATTERN "*.fs" + PATTERN "*.vs" + PATTERN "*.lua" ) install(DIRECTORY ${OPENSPACE_BASE_DIR}/scripts/ DESTINATION scripts) install(DIRECTORY ${OPENSPACE_BASE_DIR}/shaders/ DESTINATION shaders) install(FILES - ${OPENSPACE_BASE_DIR}/openspace.cfg - ${OPENSPACE_BASE_DIR}/CREDITS.md - ${OPENSPACE_BASE_DIR}/LICENSE.md - ${OPENSPACE_BASE_DIR}/README.md - DESTINATION . + ${OPENSPACE_BASE_DIR}/openspace.cfg + ${OPENSPACE_BASE_DIR}/CREDITS.md + ${OPENSPACE_BASE_DIR}/LICENSE.md + ${OPENSPACE_BASE_DIR}/README.md + DESTINATION . ) if (WIN32) - set(CPACK_GENERATOR ZIP) - # Need backslash for correct subdirectory paths - set(CPACK_PACKAGE_ICON "${OPENSPACE_BASE_DIR}\\\\apps\\\\OpenSpace\\\\openspace.png") - set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}\\\\${OPENSPACE_VERSION_NUMBER} ${OPENSPACE_VERSION_STRING}") + set(CPACK_GENERATOR ZIP) + # Need backslash for correct subdirectory paths + set(CPACK_PACKAGE_ICON "${OPENSPACE_BASE_DIR}\\\\apps\\\\OpenSpace\\\\openspace.png") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}\\\\${OPENSPACE_VERSION_NUMBER} ${OPENSPACE_VERSION_STRING}") else () - set(CPACK_GENERATOR TGZ) - set(CPACK_PACKAGE_ICON "${OPENSPACE_BASE_DIR}/apps/OpenSpace/openspace.png") - set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}/${OPENSPACE_VERSION_NUMBER} ${OPENSPACE_VERSION_STRING}") + set(CPACK_GENERATOR TGZ) + set(CPACK_PACKAGE_ICON "${OPENSPACE_BASE_DIR}/apps/OpenSpace/openspace.png") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}/${OPENSPACE_VERSION_NUMBER} ${OPENSPACE_VERSION_STRING}") endif () option(OPENSPACE_CREATE_INSTALLER "Create an OpenSpace installer from the package" OFF) if (OPENSPACE_CREATE_INSTALLER) - set(CPACK_PACKAGE_EXECUTABLES "openspace;OpenSpace") - if (WIN32) - set(CPACK_GENERATOR "ZIP;NSIS") - # OpenSpace does NOT seem to handle C:/Program Files/ without crashing - set(CPACK_NSIS_INSTALL_ROOT "C:") - # There is a bug in NSI that does not handle full unix paths properly. Make - # sure there is at least one set of four (4) backlashes. - set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_FILE_NAME}") - # Create the desktop link - set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "CreateShortCut '$DESKTOP\\\\${CPACK_NSIS_DISPLAY_NAME}.lnk' '$INSTDIR\\\\bin\\\\OpenSpace.exe' ") - # Delete the desktop link - set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "Delete '$DESKTOP\\\\${CPACK_NSIS_DISPLAY_NAME}.lnk' ") - # The icon to start the application. - set(CPACK_NSIS_MUI_ICON "${OPENSPACE_BASE_DIR}\\\\apps\\\\OpenSpace\\\\openspace.ico") - # Add a link to the application website in the startup menu. - set(CPACK_NSIS_MENU_LINKS "http://openspaceproject.com/" "OpenSpace Homepage") - # Set the icon for the application in the Add/Remove programs section. - set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\OpenSpace.exe") - # The mail address for the maintainer of the application in the Add/Remove programs section - set(CPACK_NSIS_CONTACT alexander.bock@liu.se) - # The url of the application in the Add/Remove programs section - set(CPACK_NSIS_URL_INFO_ABOUT "http://openspaceproject.com/") - # Help URL - set(CPACK_NSIS_HELP_LINK "http://openspaceproject.com/") - endif () + set(CPACK_PACKAGE_EXECUTABLES "openspace;OpenSpace") + if (WIN32) + set(CPACK_GENERATOR "ZIP;NSIS") + # OpenSpace does NOT seem to handle C:/Program Files/ without crashing + set(CPACK_NSIS_INSTALL_ROOT "C:") + # There is a bug in NSI that does not handle full unix paths properly. Make + # sure there is at least one set of four (4) backlashes. + set(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_FILE_NAME}") + # Create the desktop link + set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "CreateShortCut '$DESKTOP\\\\${CPACK_NSIS_DISPLAY_NAME}.lnk' '$INSTDIR\\\\bin\\\\OpenSpace.exe' ") + # Delete the desktop link + set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "Delete '$DESKTOP\\\\${CPACK_NSIS_DISPLAY_NAME}.lnk' ") + # The icon to start the application. + set(CPACK_NSIS_MUI_ICON "${OPENSPACE_BASE_DIR}\\\\apps\\\\OpenSpace\\\\openspace.ico") + # Add a link to the application website in the startup menu. + set(CPACK_NSIS_MENU_LINKS "http://openspaceproject.com/" "OpenSpace Homepage") + # Set the icon for the application in the Add/Remove programs section. + set(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\OpenSpace.exe") + # The mail address for the maintainer of the application in the Add/Remove programs section + set(CPACK_NSIS_CONTACT alexander.bock@liu.se) + # The url of the application in the Add/Remove programs section + set(CPACK_NSIS_URL_INFO_ABOUT "http://openspaceproject.com/") + # Help URL + set(CPACK_NSIS_HELP_LINK "http://openspaceproject.com/") + endif () endif () include (CPack) diff --git a/support/cmake/set_openspace_compile_settings.cmake b/support/cmake/set_openspace_compile_settings.cmake index 698821579c..7b492bcc48 100644 --- a/support/cmake/set_openspace_compile_settings.cmake +++ b/support/cmake/set_openspace_compile_settings.cmake @@ -22,303 +22,216 @@ # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # ########################################################################################## -function (set_openspace_compile_settings project) - set_property(TARGET ${project} PROPERTY CXX_STANDARD 17) - set_property(TARGET ${project} PROPERTY CXX_STANDARD_REQUIRED ON) +function (set_openspace_compile_settings target) + target_compile_features(${target} PRIVATE cxx_std_17) - if (MSVC) - target_compile_options( - ${project} - PRIVATE - "/MP" # Multi-threading support - "/W4" # Highest warning level - "/w44062" # enumerator 'identifier' in a switch of enum 'enumeration' is not handled - "/wd4127" # conditional expression is constant - "/wd4201" # nonstandard extension used : nameless struct/union - "/w44255" # 'function': no function prototype given: converting '()' to '(void)' - "/w44263" # 'function': member function does not override any base class virtual member function - "/w44264" # 'virtual_function': no override available for virtual member function from base 'class'; function is hidden - "/w44265" # 'class': class has virtual functions, but destructor is not virtual - "/w44266" # 'function': no override available for virtual member function from base 'type'; function is hidden - "/w44289" # nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope - "/w44296" # 'operator': expression is always false - "/w44311" # 'variable' : pointer truncation from 'type' to 'type' - "/w44339" # 'type' : use of undefined type detected in CLR meta-data - use of this type may lead to a runtime exception - "/w44342" # behavior change: 'function' called, but a member operator was called in previous versions - "/w44350" # behavior change: 'member1' called instead of 'member2' - "/w44431" # missing type specifier - int assumed. Note: C no longer supports default-int - "/w44471" # a forward declaration of an unscoped enumeration must have an underlying type (int assumed) - "/wd4505" # unreferenced local function has been removed - "/w44545" # expression before comma evaluates to a function which is missing an argument list - "/w44546" # function call before comma missing argument list - "/w44547" # 'operator': operator before comma has no effect; expected operator with side-effect - "/w44548" # expression before comma has no effect; expected expression with side-effect - "/w44549" # 'operator': operator before comma has no effect; did you intend 'operator'? - "/w44555" # expression has no effect; expected expression with side-effect - # This is disabled until GLM is updated to version 0.9.9 that removes occurrance of this warning - # "/w44574" # 'identifier' is defined to be '0': did you mean to use '#if identifier'? - "/w44608" # 'symbol1' has already been initialized by another union member in the initializer list, 'symbol2' - "/w44619" # #pragma warning: there is no warning number 'number' - "/w44628" # digraphs not supported with -Ze. Character sequence 'digraph' not interpreted as alternate token for 'char' - "/w44640" # 'instance': construction of local static object is not thread-safe - "/w44905" # wide string literal cast to 'LPSTR' - "/w44906" # string literal cast to 'LPWSTR' - "/w44946" # reinterpret_cast used between related classes: 'class1' and 'class2' - "/w44986" # 'symbol': exception specification does not match previous declaration - "/w44988" # 'symbol': variable declared outside class/function scope - "/std:c++latest" - "/permissive-" - "/Zc:twoPhase-" # Used to prevent C:\Program Files (x86)\Windows Kits\8.1\Include\um\combaseapi.h(229): error C2187: syntax error: 'identifier' was unexpected here - # This is a bug in Visual Studio 15.3 and can be removed with the next version: - # https://developercommunity.visualstudio.com/content/problem/94419/vs-2017-153-with-permissive-shows-error-c2187-in-c.html - "/Zc:strictStrings-" # Windows header don't adhere to this - "/Zc:__cplusplus" # Correctly set the __cplusplus macro - ) - if (OPENSPACE_WARNINGS_AS_ERRORS) - target_compile_options(${project} PRIVATE "/WX") - endif () + set(MSVC_WARNINGS + "/MP" # Multi-threading support + "/W4" # Highest warning level + "/w44062" # enumerator 'identifier' in a switch of enum 'enumeration' is not handled + "/wd4127" # conditional expression is constant + "/wd4201" # nonstandard extension used : nameless struct/union + "/w44255" # 'function': no function prototype given: converting '()' to '(void)' + "/w44263" # 'function': member function does not override any base class virtual member function + "/w44264" # 'virtual_function': no override available for virtual member function from base 'class'; function is hidden + "/w44265" # 'class': class has virtual functions, but destructor is not virtual + "/w44266" # 'function': no override available for virtual member function from base 'type'; function is hidden + "/w44289" # nonstandard extension used : 'var' : loop control variable declared in the for-loop is used outside the for-loop scope + "/w44296" # 'operator': expression is always false + "/w44311" # 'variable' : pointer truncation from 'type' to 'type' + "/w44339" # 'type' : use of undefined type detected in CLR meta-data - use of this type may lead to a runtime exception + "/w44342" # behavior change: 'function' called, but a member operator was called in previous versions + "/w44350" # behavior change: 'member1' called instead of 'member2' + "/w44431" # missing type specifier - int assumed. Note: C no longer supports default-int + "/w44471" # a forward declaration of an unscoped enumeration must have an underlying type (int assumed) + "/wd4505" # unreferenced local function has been removed + "/w44545" # expression before comma evaluates to a function which is missing an argument list + "/w44546" # function call before comma missing argument list + "/w44547" # 'operator': operator before comma has no effect; expected operator with side-effect + "/w44548" # expression before comma has no effect; expected expression with side-effect + "/w44549" # 'operator': operator before comma has no effect; did you intend 'operator'? + "/w44555" # expression has no effect; expected expression with side-effect + # This is disabled until GLM is updated to version 0.9.9 that removes occurrance of this warning + # "/w44574" # 'identifier' is defined to be '0': did you mean to use '#if identifier'? + "/w44608" # 'symbol1' has already been initialized by another union member in the initializer list, 'symbol2' + "/w44619" # #pragma warning: there is no warning number 'number' + "/w44628" # digraphs not supported with -Ze. Character sequence 'digraph' not interpreted as alternate token for 'char' + "/w44640" # 'instance': construction of local static object is not thread-safe + "/w44905" # wide string literal cast to 'LPSTR' + "/w44906" # string literal cast to 'LPWSTR' + "/w44946" # reinterpret_cast used between related classes: 'class1' and 'class2' + "/w44986" # 'symbol': exception specification does not match previous declaration + "/w44988" # 'symbol': variable declared outside class/function scope + "/std:c++latest" + "/permissive-" + "/Zc:twoPhase-" # Used to prevent C:\Program Files (x86)\Windows Kits\8.1\Include\um\combaseapi.h(229): error C2187: syntax error: 'identifier' was unexpected here + # This is a bug in Visual Studio 15.3 and can be removed with the next version: + # https://developercommunity.visualstudio.com/content/problem/94419/vs-2017-153-with-permissive-shows-error-c2187-in-c.html + "/Zc:strictStrings-" # Windows header don't adhere to this + "/Zc:__cplusplus" # Correctly set the __cplusplus macro + ) + if (OPENSPACE_WARNINGS_AS_ERRORS) + set(MSVC_WARNINGS ${MSVC_WARNINGS} "/WX") + endif () + if (OPENSPACE_OPTIMIZATION_ENABLE_AVX) + set(MSVC_WARNINGS ${MSVC_WARNINGS} "/arch:AVX") + endif () + if (OPENSPACE_OPTIMIZATION_ENABLE_AVX2) + set(MSVC_WARNINGS ${MSVC_WARNINGS} "/arch:AVX2") + endif () + if (OPENSPACE_OPTIMIZATION_ENABLE_AVX512) + set(MSVC_WARNINGS ${MSVC_WARNINGS} "/arch:AVX512") + endif () + if (OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS) + set(MSVC_WARNINGS ${MSVC_WARNINGS} + "/Oi" # usage of intrinsic functions + "/GL" # Whole program optimization + ) + else () + set(MSVC_WARNINGS ${MSVC_WARNINGS} + "/ZI" # Edit and continue support + ) + endif () - # Boost as of 1.64 still uses unary_function unless we define this - target_compile_definitions(${project} PRIVATE "_HAS_AUTO_PTR_ETC") - target_compile_definitions(${project} PRIVATE "NOMINMAX") + set(CLANG_WARNINGS + "-stdlib=libc++" + "-Wall" + "-Wextra" + "-Wabstract-vbase-init" + "-Warray-bounds-pointer-arithmetic" + "-Wassign-enum" + "-Wauto-import" + "-Wbad-function-cast" + "-Wbitfield-constant-conversion" + "-Wcast-calling-convention" + "-Wcast-qual" + "-Wchar-subscripts" + "-Wcomma" + "-Wcomment" + "-Wcomplex-component-init" + "-Wconditional-uninitialized" + "-Wdate-time" + "-Wdeprecated-implementations" + "-Wdollar-in-identifier-extension" + "-Wduplicate-enum" + "-Wduplicate-method-match" + "-Wempty-body" + "-Wformat-pedantic" + "-Wheader-hygiene" + "-Widiomatic-parentheses" + "-Wimplicit-fallthrough" + "-Wimport-preprocessor-directive-pedantic" + "-Winconsistent-missing-override" + "-Winfinite-recursion" + "-Wkeyword-macro" + "-Wlanguage-extension-token" + "-Wloop-analysis" + "-Wmethod-signatures" + "-Wmicrosoft-end-of-file" + "-Wmicrosoft-enum-forward-reference" + "-Wmicrosoft-fixed-enum" + "-Wmicrosoft-flexible-array" + "-Wmismatched-tags" + "-Wmissing-field-initializers" + "-Wmissing-noreturn" + "-Wnewline-eof" + "-Wnon-virtual-dtor" + "-Wold-style-cast" + "-Woverloaded-virtual" + "-Wpessimizing-move" + "-Wpointer-arith" + "-Wpragmas" + "-Wredundant-move" + "-Wreorder" + "-Wsemicolon-before-method-body" + # "-Wshadow-field" + "-Wshadow-field-in-constructor" + # "-Wshadow-all" Add this again once the Properties don't throw warnings --abock + "-Wshift-sign-overflow" + "-Wshorten-64-to-32" + "-Wsign-compare" + "-Wstring-conversion" + "-Wtautological-compare" + "-Wthread-safety" + "-Wundef" + "-Wundefined-reinterpret-cast" + "-Wuninitialized" + "-Wunneeded-internal-declaration" + "-Wunneeded-member-function" + "-Wunreachable-code-break" + "-Wunreachable-code-loop-increment" + "-Wunreachable-code-return" + "-Wunused-exception-parameter" + "-Wunused-label" + "-Wunused-local-typedef" + "-Wunused-macros" + "-Wunused-parameter" + "-Wunused-private-field" + "-Wunused-result" + "-Wunused-variable" + "-Wused-but-marked-unused" + "-Wvariadic-macros" + "-Wvla" + "-Wzero-length-array" + "-Wno-missing-braces" + ) + if (OPENSPACE_WARNINGS_AS_ERRORS) + set(CLANG_WARNINGS ${CLANG_WARNINGS} "-Werror") + endif () - if (OPENSPACE_OPTIMIZATION_ENABLE_AVX) - target_compile_options(${project} PRIVATE "/arch:AVX") - endif () - if (OPENSPACE_OPTIMIZATION_ENABLE_AVX2) - target_compile_options(${project} PRIVATE "/arch:AVX2") - endif () - if (OPENSPACE_OPTIMIZATION_ENABLE_AVX512) - target_compile_options(${project} PRIVATE "/arch:AVX512") - endif () - if (OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS) - target_compile_options(${project} PRIVATE - "/Oi" # usage of intrinsic functions - "/GL" # Whole program optimization - ) - else () - target_compile_options(${project} PRIVATE - "/ZI" # Edit and continue support - ) - endif () - elseif (NOT LINUX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if (OPENSPACE_WARNINGS_AS_ERRORS) - target_compile_options(${project} PRIVATE "-Werror") - endif () + set(GCC_WARNINGS + "-ggdb" + "-Wall" + "-Wextra" + "-Wpedantic" + "-Wunused-parameter" + "-Wuninitialized" + "-Wsuggest-attribute=const" + "-Wsuggest-final-types" + "-Wsuggest-final-methods" + "-Wsuggest-override" + "-Walloc-zero" + "-Wduplicated-cond" + "-Wshadow" + "-Wundef" + "-Wcast-qual" + "-Wzero-as-null-pointer-constant" + "-Wdate-time" + "-Wuseless-cast" + "-Wlogical-op" + "-Wint-in-bool-context" + "-Wno-deprecated-copy" + "-Wno-write-strings" + "-Wnon-virtual-dtor" + "-Wold-style-cast" + "-Woverloaded-virtual" + "-Wno-long-long" + ) + if (OPENSPACE_WARNINGS_AS_ERRORS) + set(GCC_WARNINGS ${CLANG_WARNINGS} "-Werror") + endif () - target_compile_options( - ${project} - PRIVATE - "-stdlib=libc++" - "-Wall" - "-Wextra" - "-Wabstract-vbase-init" - "-Warray-bounds-pointer-arithmetic" - "-Wassign-enum" - "-Wauto-import" - "-Wbad-function-cast" - "-Wbitfield-constant-conversion" - "-Wcast-calling-convention" - "-Wcast-qual" - "-Wchar-subscripts" - "-Wcomma" - "-Wcomment" - "-Wcomplex-component-init" - "-Wconditional-uninitialized" - "-Wdate-time" - "-Wdeprecated-implementations" - "-Wdollar-in-identifier-extension" - "-Wduplicate-enum" - "-Wduplicate-method-match" - "-Wempty-body" - "-Wformat-pedantic" - "-Wheader-hygiene" - "-Widiomatic-parentheses" - "-Wimplicit-fallthrough" - "-Wimport-preprocessor-directive-pedantic" - "-Winconsistent-missing-override" - "-Winfinite-recursion" - "-Wkeyword-macro" - "-Wlanguage-extension-token" - "-Wloop-analysis" - "-Wmethod-signatures" - "-Wmicrosoft-end-of-file" - "-Wmicrosoft-enum-forward-reference" - "-Wmicrosoft-fixed-enum" - "-Wmicrosoft-flexible-array" - "-Wmismatched-tags" - "-Wmissing-field-initializers" - "-Wmissing-noreturn" - "-Wnewline-eof" - "-Wnon-virtual-dtor" - "-Wold-style-cast" - "-Woverloaded-virtual" - "-Wpessimizing-move" - "-Wpointer-arith" - "-Wpragmas" - "-Wredundant-move" - "-Wreorder" - "-Wsemicolon-before-method-body" - # "-Wshadow-field" - "-Wshadow-field-in-constructor" - # "-Wshadow-all" Add this again once the Properties don't throw warnings --abock - "-Wshift-sign-overflow" - "-Wshorten-64-to-32" - "-Wsign-compare" - "-Wstring-conversion" - "-Wtautological-compare" - "-Wthread-safety" - "-Wundef" - "-Wundefined-reinterpret-cast" - "-Wuninitialized" - "-Wunneeded-internal-declaration" - "-Wunneeded-member-function" - "-Wunreachable-code-break" - "-Wunreachable-code-loop-increment" - "-Wunreachable-code-return" - "-Wunused-exception-parameter" - "-Wunused-label" - "-Wunused-local-typedef" - "-Wunused-macros" - "-Wunused-parameter" - "-Wunused-private-field" - "-Wunused-result" - "-Wunused-variable" - "-Wused-but-marked-unused" - "-Wvariadic-macros" - "-Wvla" - "-Wzero-length-array" - "-Wno-missing-braces" - ) - elseif (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if (OPENSPACE_WARNINGS_AS_ERRORS) - target_compile_options(${project} PRIVATE "-Werror") - endif () + if (MSVC) + target_compile_options(${target} PRIVATE ${MSVC_WARNINGS}) - target_compile_options( - ${project} - PRIVATE - "-stdlib=libc++" - "-std=c++17" - "-Wall" - "-Wextra" - "-Wabstract-vbase-init" - "-Warray-bounds-pointer-arithmetic" - "-Wassign-enum" - "-Wauto-import" - "-Wbad-function-cast" - "-Wbitfield-constant-conversion" - "-Wcast-calling-convention" - "-Wcast-qual" - "-Wchar-subscripts" - "-Wcomma" - "-Wcomment" - "-Wcomplex-component-init" - "-Wconditional-uninitialized" - "-Wdate-time" - "-Wdeprecated-implementations" - "-Wdollar-in-identifier-extension" - "-Wduplicate-enum" - "-Wduplicate-method-match" - "-Wempty-body" - "-Wformat-pedantic" - "-Wheader-hygiene" - "-Widiomatic-parentheses" - "-Wimplicit-fallthrough" - "-Wimport-preprocessor-directive-pedantic" - "-Winconsistent-missing-override" - "-Winfinite-recursion" - "-Wkeyword-macro" - "-Wlanguage-extension-token" - "-Wloop-analysis" - "-Wmethod-signatures" - "-Wmicrosoft-end-of-file" - "-Wmicrosoft-enum-forward-reference" - "-Wmicrosoft-fixed-enum" - "-Wmicrosoft-flexible-array" - "-Wmismatched-tags" - "-Wmissing-field-initializers" - "-Wmissing-noreturn" - "-Wnewline-eof" - "-Wnon-virtual-dtor" - "-Wold-style-cast" - "-Woverloaded-virtual" - "-Wpessimizing-move" - "-Wpointer-arith" - "-Wpragmas" - "-Wredundant-move" - "-Wreorder" - "-Wsemicolon-before-method-body" - # "-Wshadow-field" - "-Wshadow-field-in-constructor" - # "-Wshadow-all" Add this again once the Properties don't throw warnings --abock - "-Wshift-sign-overflow" - "-Wshorten-64-to-32" - "-Wsign-compare" - "-Wstring-conversion" - "-Wtautological-compare" - "-Wthread-safety" - "-Wundef" - "-Wundefined-reinterpret-cast" - "-Wuninitialized" - "-Wunneeded-internal-declaration" - "-Wunneeded-member-function" - "-Wunreachable-code-break" - "-Wunreachable-code-loop-increment" - "-Wunreachable-code-return" - "-Wunused-exception-parameter" - "-Wunused-label" - "-Wunused-local-typedef" - "-Wunused-macros" - "-Wunused-parameter" - "-Wunused-private-field" - "-Wunused-result" - "-Wunused-variable" - "-Wused-but-marked-unused" - "-Wvariadic-macros" - "-Wvla" - "-Wzero-length-array" - "-Wno-missing-braces" - ) - - target_link_libraries(${project} PRIVATE "c++" "c++abi") - - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - target_compile_options( - ${project} - PRIVATE - "-ggdb" - "-Wall" - "-Wextra" - "-Wpedantic" - "-Wunused-parameter" - "-Wuninitialized" - "-Wsuggest-attribute=const" - "-Wsuggest-final-types" - "-Wsuggest-final-methods" - "-Wsuggest-override" - "-Walloc-zero" - "-Wduplicated-cond" - "-Wshadow" - "-Wundef" - "-Wcast-qual" - "-Wzero-as-null-pointer-constant" - "-Wdate-time" - "-Wuseless-cast" - "-Wlogical-op" - "-Wint-in-bool-context" - "-Wno-write-strings" - "-Wnon-virtual-dtor" - "-Wold-style-cast" - "-Woverloaded-virtual" - "-Wno-long-long" - ) - - if (OPENSPACE_WARNINGS_AS_ERRORS) - target_compile_options(${project} PRIVATE "-Werror") - endif () - else () - message("Compiler not handled in set_openspace_compile_settings.cmake") + # Boost as of 1.64 still uses unary_function unless we define this + target_compile_definitions(${target} PRIVATE "_HAS_AUTO_PTR_ETC") + target_compile_definitions(${target} PRIVATE "NOMINMAX") + elseif (NOT LINUX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") + if (OPENSPACE_WARNINGS_AS_ERRORS) + target_compile_options(${target} PRIVATE "-Werror") endif () + # Apple has "deprecated" OpenGL and offers nothing by warnings instead + target_compile_definitions(${target} PRIVATE "GL_SILENCE_DEPRECATION") + + target_compile_options(${target} PRIVATE ${CLANG_WARNINGS}) + elseif (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_options(${target} PRIVATE ${CLANG_WARNINGS} "-std=c++17") + target_link_libraries(${target} PRIVATE "c++" "c++abi") + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + target_compile_options(${target} PRIVATE ${GCC_WARNINGS}) + else () + message("Compiler not handled in set_openspace_compile_settings.cmake") + endif () endfunction () diff --git a/support/cppcheck/suppressions.txt b/support/cppcheck/suppressions.txt index cfe9971764..704af3f655 100644 --- a/support/cppcheck/suppressions.txt +++ b/support/cppcheck/suppressions.txt @@ -1,5 +1,6 @@ -// This is not a memleak because the placement new operator does not -// actually create any memory that could leak -missingInclude -noExplicitConstructor useStlAlgorithm +unreadVariable +unusedFunction + +shadowFunction:modules/globebrowsing/src/tileprovider.cpp +syntaxError:src/scene/profile.cpp:44 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 658348b7ab..f701277149 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -47,12 +47,21 @@ add_executable( set_openspace_compile_settings(OpenSpaceTest) -target_include_directories(OpenSpaceTest PUBLIC +target_include_directories(OpenSpaceTest + PUBLIC "${GHOUL_BASE_DIR}/ext/catch2/single_include" + "${OPENSPACE_BASE_DIR}" ) target_compile_definitions(OpenSpaceTest PUBLIC "GHL_THROW_ON_ASSERT") target_link_libraries(OpenSpaceTest PUBLIC openspace-core) +foreach (library_name ${all_enabled_modules}) + get_target_property(library_type ${library_name} TYPE) + if (NOT ${library_type} STREQUAL "SHARED_LIBRARY") + target_link_libraries(OpenSpaceTest PRIVATE ${library_name}) + endif() +endforeach () + if (OPENSPACE_MODULE_WEBBROWSER AND CEF_ROOT) # Add the CEF binary distribution's cmake/ directory to the module path and # find CEF to initialize it properly. diff --git a/tests/test_concurrentjobmanager.cpp b/tests/test_concurrentjobmanager.cpp index ec91ee5c23..1eb9521b1f 100644 --- a/tests/test_concurrentjobmanager.cpp +++ b/tests/test_concurrentjobmanager.cpp @@ -30,7 +30,7 @@ namespace { struct TestJob : public openspace::Job { - TestJob(int jobExecutingTime) + explicit TestJob(int jobExecutingTime) : _jobExecutingTime(jobExecutingTime) {} @@ -45,12 +45,12 @@ namespace { private: int _jobExecutingTime; - int prod; + int prod = 0; }; struct VerboseProduct { - VerboseProduct(int v) : val(v) {} + explicit VerboseProduct(int v) : val(v) {} ~VerboseProduct() {} @@ -59,7 +59,7 @@ namespace { struct VerboseJob : public openspace::Job { - VerboseJob(int jobExecutingTime) + explicit VerboseJob(int jobExecutingTime) : _jobExecutingTime(jobExecutingTime) , _product(-1) {}