diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e20b7b0ff..215dfa5b16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2019 # +# 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 # @@ -43,7 +43,6 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/handle_modules.cmake) include(${GHOUL_BASE_DIR}/support/cmake/copy_shared_libraries.cmake) include(${GHOUL_BASE_DIR}/support/cmake/handle_external_library.cmake) include(${GHOUL_BASE_DIR}/support/cmake/message_macros.cmake) -include(${GHOUL_BASE_DIR}/support/cmake/include_gtest.cmake) begin_header("Configuring OpenSpace project") message(STATUS "CMake version: ${CMAKE_VERSION}") @@ -208,37 +207,6 @@ if (MSVC) endif () -########################################################################################## -# Tests # -########################################################################################## -option(OPENSPACE_HAVE_TESTS "Activate the OpenSpace unit tests" ON) -if (OPENSPACE_HAVE_TESTS) - include_gtest("${GHOUL_BASE_DIR}/ext/googletest") - - file(GLOB_RECURSE OPENSPACE_TEST_FILES ${OPENSPACE_BASE_DIR}/tests/*.inl) - add_executable(OpenSpaceTest ${OPENSPACE_BASE_DIR}/tests/main.cpp ${OPENSPACE_TEST_FILES}) - - target_include_directories(OpenSpaceTest PUBLIC - "${OPENSPACE_BASE_DIR}/include" - "${OPENSPACE_BASE_DIR}/tests" - "${OPENSPACE_EXT_DIR}/ghoul/ext/googletest/googletest/include" - ) - target_compile_definitions(OpenSpaceTest PUBLIC - "GHL_THROW_ON_ASSERT" "GTEST_HAS_TR1_TUPLE=0" - ) - target_link_libraries(OpenSpaceTest gtest openspace-core) - - set_folder_location(OpenSpaceTest "Unit Tests") - - if (MSVC) - set_target_properties(OpenSpaceTest PROPERTIES LINK_FLAGS - "/NODEFAULTLIB:LIBCMTD.lib /NODEFAULTLIB:LIBCMT.lib" - ) - endif () - set_openspace_compile_settings(OpenSpaceTest) -endif (OPENSPACE_HAVE_TESTS) - - 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}") @@ -250,6 +218,13 @@ handle_applications() 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") + end_header() +endif (OPENSPACE_HAVE_TESTS) + # Web Browser and Web gui # Why not put these in the module's path? Because they do not have access to the @@ -268,11 +243,6 @@ 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) - - if (TARGET OpenSpaceTest) - set_cef_targets("${CEF_ROOT}" OpenSpaceTest) - run_cef_platform_config("${CEF_ROOT}" "${CEF_TARGET}" "${WEBBROWSER_MODULE_PATH}") - endif () elseif (OPENSPACE_MODULE_WEBBROWSER) message(WARNING "Web configured to be included, but no CEF_ROOT was found, please try configuring CMake again.") endif () diff --git a/apps/OpenSpace-MinVR/CMakeLists.txt b/apps/OpenSpace-MinVR/CMakeLists.txt index f58a2a13cc..a13829c550 100644 --- a/apps/OpenSpace-MinVR/CMakeLists.txt +++ b/apps/OpenSpace-MinVR/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2019 # +# 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 # diff --git a/apps/OpenSpace/CMakeLists.txt b/apps/OpenSpace/CMakeLists.txt index ba74ba4315..9eb5283c01 100644 --- a/apps/OpenSpace/CMakeLists.txt +++ b/apps/OpenSpace/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2019 # +# 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 # @@ -72,7 +72,15 @@ if (SGCT_SPOUT_SUPPORT AND NOT OPENSPACE_MODULE_SPOUT) set(OPENSPACE_MODULE_SPOUT ON CACHE BOOL "Build OPENSPACE_MODULE_SPOUTModule" FORCE) endif () -set(MACOSX_BUNDLE_ICON_FILE openspace.icns) + +##### +# macos +##### +if (APPLE) + set(MACOSX_BUNDLE_ICON_FILE openspace.icns) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version" FORCE) + set(CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--deep" CACHE STRING "Other Code Signing Flags" FORCE) +endif() create_new_application(OpenSpace ${SGCT_OPENVR_FILES} diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index 7492a4fdd6..3622605062 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit 7492a4fdd60ccd5ef7ed5200c1aaa26853f97d0d +Subproject commit 3622605062ae61736426e3d8d26e98524ec1fc97 diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index af1aee4d42..ec47265306 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -45,6 +45,8 @@ #include #include #include +#include +#include #ifdef WIN32 #include @@ -249,11 +251,20 @@ std::pair supportedOpenGLVersion() { return { major, minor }; } +// +// Context creation function +// +void mainContextCreationFunc(GLFWwindow* win) { + // @TODO (abock, 2020-02-10) Remove this after updating SGCT to 3.0 + TracyGpuContext +} // // Init function // void mainInitFunc() { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.init, nullptr); @@ -410,6 +421,12 @@ void mainInitFunc() { void mainPreSyncFunc() { + // @TODO (abock, 2020-02-10) Remove this after merging SGCT version 3.0 + FrameMark + + + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.preSync, nullptr); @@ -417,12 +434,20 @@ void mainPreSyncFunc() { #endif // OPENSPACE_HAS_VTUNE LTRACE("main::mainPreSyncFunc(begin)"); - global::openSpaceEngine.preSynchronization(); + try { + global::openSpaceEngine.preSynchronization(); + } + catch (const ghoul::RuntimeError& e) { + LFATALC(e.component, e.message); + sgct::Engine::instance()->terminate(); + } // Query joystick status using namespace interaction; for (int i = GLFW_JOYSTICK_1; i <= GLFW_JOYSTICK_LAST; ++i) { + ZoneScopedN("Joystick state"); + JoystickInputState& state = global::joystickInputStates[i]; int present = glfwJoystickPresent(i); @@ -506,6 +531,8 @@ void mainPreSyncFunc() { void mainPostSyncPreDrawFunc() { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.postSyncPreDraw, nullptr); @@ -540,6 +567,8 @@ void mainPostSyncPreDrawFunc() { void mainRenderFunc() { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.render, nullptr); @@ -588,6 +617,8 @@ void mainRenderFunc() { void mainDraw2DFunc() { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.draw2D, nullptr); @@ -618,6 +649,8 @@ void mainDraw2DFunc() { void mainPostDrawFunc() { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.postDraw, nullptr); @@ -673,6 +706,8 @@ void mainPostDrawFunc() { void mainKeyboardCallback(int key, int, int action, int modifiers) { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.keyboard, nullptr); @@ -696,6 +731,8 @@ void mainKeyboardCallback(int key, int, int action, int modifiers) { void mainMouseButtonCallback(int key, int action, int modifiers) { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.mouseButton, nullptr); @@ -719,6 +756,8 @@ void mainMouseButtonCallback(int key, int action, int modifiers) { void mainMousePosCallback(double x, double y) { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.mousePos, nullptr); @@ -737,6 +776,8 @@ void mainMousePosCallback(double x, double y) { void mainMouseScrollCallback(double posX, double posY) { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.mouseScroll, nullptr); @@ -757,6 +798,8 @@ void mainMouseScrollCallback(double posX, double posY) { void mainCharCallback(unsigned int codepoint, int modifiers) { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.character, nullptr); @@ -776,6 +819,8 @@ void mainCharCallback(unsigned int codepoint, int modifiers) { void mainEncodeFun() { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.encode, nullptr); @@ -798,6 +843,8 @@ void mainEncodeFun() { void mainDecodeFun() { + ZoneScoped + #ifdef OPENSPACE_HAS_VTUNE if (EnableDetailedVtune) { __itt_frame_begin_v3(_vTune.decode, nullptr); @@ -820,6 +867,8 @@ void mainDecodeFun() { void mainLogCallback(const char* msg) { + ZoneScoped + std::string message = msg; if (message.empty() || message == ".") { // We don't want the empty '.' message that SGCT sends while it is waiting for @@ -837,12 +886,18 @@ void setSgctDelegateFunctions() { WindowDelegate& sgctDelegate = global::windowDelegate; sgctDelegate.terminate = []() { sgct::Engine::instance()->terminate(); }; sgctDelegate.setBarrier = [](bool enabled) { + ZoneScoped + sgct::SGCTWindow::setBarrier(enabled); }; sgctDelegate.setSynchronization = [](bool enabled) { + ZoneScoped + sgct_core::ClusterManager::instance()->setUseIgnoreSync(enabled); }; sgctDelegate.clearAllWindows = [](const glm::vec4& clearColor) { + ZoneScoped + size_t n = sgct::Engine::instance()->getNumberOfWindows(); for (size_t i = 0; i < n; ++i) { glClearColor(clearColor.r, clearColor.g, clearColor.b, clearColor.a); @@ -852,27 +907,51 @@ void setSgctDelegateFunctions() { } }; sgctDelegate.windowHasResized = []() { + ZoneScoped + return sgct::Engine::instance()->getCurrentWindowPtr()->isWindowResized(); }; - sgctDelegate.averageDeltaTime = []() { return sgct::Engine::instance()->getAvgDt(); }; + sgctDelegate.averageDeltaTime = []() { + ZoneScoped + + return sgct::Engine::instance()->getAvgDt(); + }; sgctDelegate.deltaTimeStandardDeviation = []() { + ZoneScoped + return sgct::Engine::instance()->getDtStandardDeviation(); }; sgctDelegate.minDeltaTime = []() { + ZoneScoped + return sgct::Engine::instance()->getMinDt(); }; sgctDelegate.maxDeltaTime = []() { + ZoneScoped + return sgct::Engine::instance()->getMaxDt(); }; - sgctDelegate.deltaTime = []() { return sgct::Engine::instance()->getDt(); }; - sgctDelegate.applicationTime = []() { return sgct::Engine::getTime(); }; + sgctDelegate.deltaTime = []() { + ZoneScoped + + return sgct::Engine::instance()->getDt(); + }; + sgctDelegate.applicationTime = []() { + ZoneScoped + + return sgct::Engine::getTime(); + }; sgctDelegate.mousePosition = []() { + ZoneScoped + int id = sgct::Engine::instance()->getCurrentWindowPtr()->getId(); double posX, posY; sgct::Engine::getMousePos(id, &posX, &posY); return glm::vec2(posX, posY); }; sgctDelegate.mouseButtons = [](int maxNumber) { + ZoneScoped + int id = sgct::Engine::instance()->getCurrentWindowPtr()->getId(); uint32_t result = 0; for (int i = 0; i < maxNumber; ++i) { @@ -884,11 +963,15 @@ void setSgctDelegateFunctions() { return result; }; sgctDelegate.currentWindowSize = []() { + ZoneScoped + return glm::ivec2( sgct::Engine::instance()->getCurrentWindowPtr()->getXResolution(), sgct::Engine::instance()->getCurrentWindowPtr()->getYResolution()); }; sgctDelegate.currentSubwindowSize = []() { + ZoneScoped + auto window = sgct::Engine::instance()->getCurrentWindowPtr(); if (sgct::Engine::instance()->getCurrentWindowPtr()->getNumberOfViewports() > 1) { sgct_core::Viewport* viewport = @@ -907,12 +990,16 @@ void setSgctDelegateFunctions() { } }; sgctDelegate.currentWindowResolution = []() { + ZoneScoped + int x, y; auto window = sgct::Engine::instance()->getCurrentWindowPtr(); window->getFinalFBODimensions(x, y); return glm::ivec2(x, y); }; sgctDelegate.currentDrawBufferResolution = []() { + ZoneScoped + sgct_core::Viewport* viewport = sgct::Engine::instance()->getCurrentWindowPtr()->getViewport(0); if (viewport != nullptr) { @@ -936,6 +1023,8 @@ void setSgctDelegateFunctions() { return glm::ivec2(-1, -1); }; sgctDelegate.currentViewportSize = []() { + ZoneScoped + sgct_core::Viewport* viewport = sgct::Engine::instance()->getCurrentWindowPtr()->getViewport(0); if (viewport != nullptr) { @@ -947,15 +1036,21 @@ void setSgctDelegateFunctions() { return glm::ivec2(-1, -1); }; sgctDelegate.dpiScaling = []() { + ZoneScoped + return glm::vec2( sgct::Engine::instance()->getCurrentWindowPtr()->getXScale(), sgct::Engine::instance()->getCurrentWindowPtr()->getYScale() ); }; sgctDelegate.currentNumberOfAaSamples = []() { + ZoneScoped + return sgct::Engine::instance()->getCurrentWindowPtr()->getNumberOfAASamples(); }; sgctDelegate.hasGuiWindow = []() { + ZoneScoped + auto engine = sgct::Engine::instance(); for (size_t i = 0; i < engine->getNumberOfWindows(); ++i) { if (engine->getWindowPtr(i)->checkIfTagExists("GUI")) { @@ -965,88 +1060,121 @@ void setSgctDelegateFunctions() { return false; }; sgctDelegate.isGuiWindow = []() { + ZoneScoped + return sgct::Engine::instance()->getCurrentWindowPtr()->checkIfTagExists("GUI"); }; - sgctDelegate.isMaster = []() { return sgct::Engine::instance()->isMaster(); }; + sgctDelegate.isMaster = []() { + ZoneScoped + + return sgct::Engine::instance()->isMaster(); + }; sgctDelegate.isUsingSwapGroups = []() { + ZoneScoped + return sgct::SGCTWindow::isUsingSwapGroups(); }; sgctDelegate.isSwapGroupMaster = []() { + ZoneScoped + return sgct::SGCTWindow::isSwapGroupMaster(); }; sgctDelegate.viewProjectionMatrix = []() { + ZoneScoped + return sgct::Engine::instance()->getCurrentModelViewProjectionMatrix(); }; sgctDelegate.modelMatrix = []() { + ZoneScoped + return sgct::Engine::instance()->getModelMatrix(); }; sgctDelegate.setNearFarClippingPlane = [](float nearPlane, float farPlane) { + ZoneScoped + sgct::Engine::instance()->setNearAndFarClippingPlanes(nearPlane, farPlane); }; sgctDelegate.setEyeSeparationDistance = [](float distance) { + ZoneScoped + sgct::Engine::instance()->setEyeSeparation(distance); }; sgctDelegate.viewportPixelCoordinates = []() { + ZoneScoped + sgct::SGCTWindow* window = sgct::Engine::instance()->getCurrentWindowPtr(); if (!window || !window->getCurrentViewport()) { - return glm::ivec4(0, 0, 0, 0); + return glm::ivec4(0); } else { const int* data = sgct::Engine::instance()->getCurrentViewportPixelCoords(); return glm::ivec4(data[0], data[2], data[1], data[3]); } }; - sgctDelegate.isExternalControlConnected = []() { - return sgct::Engine::instance()->isExternalControlConnected(); - }; sgctDelegate.sendMessageToExternalControl = [](const std::vector& message) { + ZoneScoped + sgct::Engine::instance()->sendMessageToExternalControl( message.data(), static_cast(message.size()) ); }; - sgctDelegate.isSimpleRendering = []() { - return (sgct::Engine::instance()->getCurrentRenderTarget() != - sgct::Engine::NonLinearBuffer); - }; sgctDelegate.isFisheyeRendering = []() { + ZoneScoped + sgct::SGCTWindow* w = sgct::Engine::instance()->getCurrentWindowPtr(); return dynamic_cast( w->getViewport(0)->getNonLinearProjectionPtr() ) != nullptr; }; sgctDelegate.takeScreenshot = [](bool applyWarping) { + ZoneScoped + sgct::SGCTSettings::instance()->setCaptureFromBackBuffer(applyWarping); sgct::Engine::instance()->takeScreenshot(); return sgct::Engine::instance()->getScreenShotNumber(); }; sgctDelegate.swapBuffer = []() { + ZoneScoped + GLFWwindow* w = glfwGetCurrentContext(); glfwSwapBuffers(w); glfwPollEvents(); }; sgctDelegate.nWindows = []() { + ZoneScoped + return static_cast(sgct::Engine::instance()->getNumberOfWindows()); }; sgctDelegate.currentWindowId = []() { + ZoneScoped + return sgct::Engine::instance()->getCurrentWindowPtr()->getId(); }; sgctDelegate.openGLProcedureAddress = [](const char* func) { + ZoneScoped + return glfwGetProcAddress(func); }; sgctDelegate.getHorizFieldOfView = []() { + ZoneScoped + return static_cast( sgct::Engine::instance()->getWindowPtr(0)->getHorizFieldOfViewDegrees() ); }; sgctDelegate.setHorizFieldOfView = [](float hFovDeg) { + ZoneScoped + sgct::SGCTWindow* w = sgct::Engine::instance()->getWindowPtr(0); w->setHorizFieldOfView(hFovDeg); }; #ifdef WIN32 sgctDelegate.getNativeWindowHandle = [](size_t windowIndex) -> void* { + ZoneScoped + sgct::SGCTWindow* w = sgct::Engine::instance()->getWindowPtr(windowIndex); - if(w) { + if (w) { HWND hWnd = glfwGetWin32Window(w->getWindowHandle()); return reinterpret_cast(hWnd); } @@ -1054,6 +1182,8 @@ void setSgctDelegateFunctions() { }; #endif // WIN32 sgctDelegate.frustumMode = []() { + ZoneScoped + using FM = sgct_core::Frustum::FrustumMode; switch (sgct::Engine::instance()->getCurrentFrustumMode()) { case FM::MonoEye: return WindowDelegate::Frustum::Mono; @@ -1062,6 +1192,8 @@ void setSgctDelegateFunctions() { } }; sgctDelegate.swapGroupFrameNumber = []() { + ZoneScoped + unsigned int fn = 0; sgct::Engine::instance()->getCurrentWindowPtr()->getSwapGroupFrameNumber(fn); return static_cast(fn); @@ -1247,6 +1379,7 @@ int main(int argc, char** argv) { SgctEngine = new sgct::Engine(arguments); // Bind functions + SgctEngine->setContextCreationCallback(mainContextCreationFunc); SgctEngine->setInitOGLFunction(mainInitFunc); SgctEngine->setPreSyncFunction(mainPreSyncFunc); SgctEngine->setPostSyncPreDrawFunction(mainPostSyncPreDrawFunc); diff --git a/apps/Sync/CMakeLists.txt b/apps/Sync/CMakeLists.txt index 25a04ceb01..57b41bce3e 100644 --- a/apps/Sync/CMakeLists.txt +++ b/apps/Sync/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/apps/TaskRunner/CMakeLists.txt b/apps/TaskRunner/CMakeLists.txt index ed1b9e7066..e5eba87469 100644 --- a/apps/TaskRunner/CMakeLists.txt +++ b/apps/TaskRunner/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/apps/TimelineView/CMakeLists.txt b/apps/TimelineView/CMakeLists.txt index 0d38b6412d..38edbf98f5 100644 --- a/apps/TimelineView/CMakeLists.txt +++ b/apps/TimelineView/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/apps/Wormhole/CMakeLists.txt b/apps/Wormhole/CMakeLists.txt index 8887417b8d..fb8a75f2cd 100644 --- a/apps/Wormhole/CMakeLists.txt +++ b/apps/Wormhole/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/apps/Wormhole/main.cpp b/apps/Wormhole/main.cpp index a988789255..12b3764abb 100644 --- a/apps/Wormhole/main.cpp +++ b/apps/Wormhole/main.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/config/single_fisheye_gui.xml b/config/single_fisheye_gui.xml index f6ad4d9dd4..b4a201f4c6 100644 --- a/config/single_fisheye_gui.xml +++ b/config/single_fisheye_gui.xml @@ -34,8 +34,7 @@ - - + diff --git a/data/assets/base_profile.asset b/data/assets/base_profile.asset index 67e5ba0556..f4a9b7b265 100644 --- a/data/assets/base_profile.asset +++ b/data/assets/base_profile.asset @@ -15,7 +15,6 @@ asset.require('util/default_joystick') -- Load web gui asset.require('util/webgui') -asset.request('customization/globebrowsing') asset.onInitialize(function () openspace.setDefaultGuiSorting() diff --git a/data/assets/default.profile b/data/assets/default.profile index b708a2d253..b5614baf84 100644 --- a/data/assets/default.profile +++ b/data/assets/default.profile @@ -3,6 +3,10 @@ #Asset scene/solarsystem/planets/earth/earth required +scene/solarsystem/planets/earth/satellites/satellites required + +#Property +setPropertyValue {earth_satellites}.Renderable.Enabled false #Time relative -1d diff --git a/data/assets/default.scene b/data/assets/default.scene index c6d3e2523c..31a2e83d4f 100644 --- a/data/assets/default.scene +++ b/data/assets/default.scene @@ -1,6 +1,7 @@ asset.require('./base') local earthAsset = asset.require('scene/solarsystem/planets/earth/earth') +asset.require('scene/solarsystem/planets/earth/satellites/satellites.asset') asset.onInitialize(function () local now = openspace.time.currentWallTime() @@ -10,6 +11,8 @@ asset.onInitialize(function () openspace.globebrowsing.goToGeo("Earth", 58.5877, 16.1924, 20000000) openspace.markInterestingNodes({ "Earth", "Mars", "Moon", "Sun" }) + + openspace.setPropertyValue("{earth_satellites}.Renderable.Enabled", false) end) asset.onDeinitialize(function () diff --git a/data/assets/scene/solarsystem/missions/apollo/apollo8.asset b/data/assets/scene/solarsystem/missions/apollo/apollo8.asset index 27e86fd80d..627d264bef 100644 --- a/data/assets/scene/solarsystem/missions/apollo/apollo8.asset +++ b/data/assets/scene/solarsystem/missions/apollo/apollo8.asset @@ -35,7 +35,7 @@ local Apollo8Launch = { Type = "SpiceTranslation", Target = apolloSpiceId, Observer = "EARTH", - Frame = "IAU_EARTH", + Frame = "IAU_EARTH", Kernels = kernels }, }, @@ -59,7 +59,7 @@ local Apollo8 = { Type = "SpiceTranslation", Target = apolloSpiceId, Observer = "EARTH BARYCENTER", - Frame = "GALACTIC", + Frame = "GALACTIC", Kernels = kernels }, Rotation = { @@ -124,7 +124,7 @@ local Apollo8Model = { } } -local PivotOffset = { 0, 2.5, 0} +local PivotOffset = { 0, 2.5, 0 } -- The pivot node is used for navigation inside the spacecraft @@ -153,7 +153,7 @@ local Apollo8LaunchTrail = { Type = "SpiceTranslation", Target = apolloSpiceId, Observer = "EARTH", - Frame = "IAU_EARTH", + Frame = "IAU_EARTH", Kernels = kernels }, Color = { 0.70, 0.50, 0.20 }, @@ -176,7 +176,7 @@ local Apollo8MoonTrail = { Type = "SpiceTranslation", Target = apolloSpiceId, Observer = "MOON", - Frame = "IAU_MOON", + Frame = "IAU_MOON", Kernels = kernels }, Color = { 0.70, 0.50, 0.20 }, @@ -199,15 +199,15 @@ local Apollo8EarthBarycenterTrail = { Translation = { Type = "SpiceTranslation", Target = apolloSpiceId, - Observer = "EARTH BARYCENTER", - Frame = "GALACTIC", + Observer = "EARTH", + Frame = "GALACTIC", Kernels = kernels }, - Color = { 1, 0.0, 0.0 }, + Color = { 0.8, 0.2, 0.2 }, StartTime = "1968 DEC 21", EndTime = "1968 DEC 28", SampleInterval = 30, - Enabled = false, + Enabled = true, }, GUI = { Name = "Apollo 8 Earth Barycenter Trail", @@ -215,10 +215,11 @@ local Apollo8EarthBarycenterTrail = { } } + local exportList = { - Apollo8, + Apollo8, Apollo8Model, - Apollo8Launch, + Apollo8Launch, Apollo8LaunchModel, Apollo8Pivot, diff --git a/data/assets/scene/solarsystem/missions/messenger/mercurymagnetosphere.asset b/data/assets/scene/solarsystem/missions/messenger/mercurymagnetosphere.asset index 9a8713faf6..363af34171 100644 --- a/data/assets/scene/solarsystem/missions/messenger/mercurymagnetosphere.asset +++ b/data/assets/scene/solarsystem/missions/messenger/mercurymagnetosphere.asset @@ -6,7 +6,7 @@ local localFolder = asset.syncedResource({ Name = "Mercury Magnetosphere", Type = "HttpSynchronization", Identifier = "mercury_magnetosphere", - Version = 1 + Version = 2 }) @@ -22,7 +22,7 @@ local Magnetosphere = { SourceDirectory = localFolder, TransferFunction = localFolder .. "/transferfunction.txt", Variable = "rho", - StepSize = "0.003", + StepSize = 0.003, Dimensions = {64, 64, 64}, GridType = "Cartesian", SecondsBefore = 24*60*60*365*100, diff --git a/data/assets/scene/solarsystem/missions/messenger/openspace_mercury.ti b/data/assets/scene/solarsystem/missions/messenger/openspace_mercury.ti deleted file mode 100644 index 218f8c3ec2..0000000000 --- a/data/assets/scene/solarsystem/missions/messenger/openspace_mercury.ti +++ /dev/null @@ -1,33 +0,0 @@ -OpenSpace ecliptic frames: -Mercury-centric Solar Ecliptic (MERCURYSE) frame - -These frames are only defined as helper frames for OpenSpace. - - +X is parallel to the geometric planet-sun position vector. - - -Y axis is the normalized component of the planet's orbital vector - - +Z axis is parallel to the cross product of the frame's +X axis - and the frame's +Y axis. - -\begindata - - FRAME_MERCURYSE = 4600199 - FRAME_4600199_NAME = 'MERCURYSE' - FRAME_4600199_CLASS = 5 - FRAME_4600199_CLASS_ID = 4600199 - FRAME_4600199_CENTER = 199 - FRAME_4600199_RELATIVE = 'J2000' - FRAME_4600199_DEF_STYLE = 'PARAMETERIZED' - FRAME_4600199_FAMILY = 'TWO-VECTOR' - FRAME_4600199_PRI_AXIS = 'X' - FRAME_4600199_PRI_VECTOR_DEF = 'OBSERVER_TARGET_POSITION' - FRAME_4600199_PRI_OBSERVER = 'MERCURY' - FRAME_4600199_PRI_TARGET = 'SUN' - FRAME_4600199_PRI_ABCORR = 'NONE' - FRAME_4600199_SEC_AXIS = 'Y' - FRAME_4600199_SEC_VECTOR_DEF = 'OBSERVER_TARGET_VELOCITY' - FRAME_4600199_SEC_OBSERVER = 'MERCURY' - FRAME_4600199_SEC_TARGET = 'SUN' - FRAME_4600199_SEC_ABCORR = 'NONE' - FRAME_4600199_SEC_FRAME = 'J2000' diff --git a/data/assets/scene/solarsystem/missions/messenger/transferfunction.txt b/data/assets/scene/solarsystem/missions/messenger/transferfunction.txt deleted file mode 100644 index 7174117a1e..0000000000 --- a/data/assets/scene/solarsystem/missions/messenger/transferfunction.txt +++ /dev/null @@ -1,8 +0,0 @@ -width 1024 -lower 0.0 -upper 0.1 -mappingkey 0.0 255 0 0 0 -mappingkey 0.01 255 0 0 0 -mappingkey 0.1 255 255 0 100 - -mappingkey 0.5 255 255 0 255 \ No newline at end of file diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/amateur.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/amateur.asset index 253a9f1fdb..93056ec693 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/amateur.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/amateur.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Amateur Radio", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/experimental.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/experimental.asset index 7a673b695f..62ddde179b 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/experimental.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/experimental.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Experimental", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/geostationary.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/geostationary.asset index 711030e482..5a2b92bbeb 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/geostationary.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/geostationary.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Geostationary", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/globalstar.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/globalstar.asset index 32e8edd57d..187da196dc 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/globalstar.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/globalstar.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "GlobalStar", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/gorizont.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/gorizont.asset index 10390bba26..968c7a0d52 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/gorizont.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/gorizont.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Gorizont", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/intelsat.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/intelsat.asset index a41a34b97d..6c63a7a152 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/intelsat.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/intelsat.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Intelsat", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/iridium.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/iridium.asset index bddcc0de0f..9aef4acfa4 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/iridium.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/iridium.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Iridium", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/iridium_next.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/iridium_next.asset index 4a515ac51d..0acefd60bb 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/iridium_next.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/iridium_next.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Iridium NEXT", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/molniya.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/molniya.asset index 6fb30c28e5..faa5e257cd 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/molniya.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/molniya.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Molniya", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/orbcomm.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/orbcomm.asset index 2014a48a2c..46a00682df 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/orbcomm.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/orbcomm.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Orbcomm", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/other_comm.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/other_comm.asset index fd0cac7602..a389e514db 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/other_comm.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/other_comm.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Other comm", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/raduga.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/raduga.asset index 66c24c8450..61b2511d13 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/raduga.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/raduga.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Raduga", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/communications/ses.asset b/data/assets/scene/solarsystem/planets/earth/satellites/communications/ses.asset index 1866a4a62c..5589bc9f2d 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/communications/ses.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/communications/ses.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "SES", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_asat.asset b/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_asat.asset index c9deee3dc4..0335bc5466 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_asat.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_asat.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../debris_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Indian ASAT test Debris", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_breezem.asset b/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_breezem.asset index d92af9ac09..ca65fa548c 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_breezem.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_breezem.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../debris_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Breeze-M Breakup", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_fengyun.asset b/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_fengyun.asset index df75b229e5..f6ac4c803a 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_fengyun.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_fengyun.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../debris_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Fengyun Debris", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_iridium33.asset b/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_iridium33.asset index 61939fe7b5..4d4ee16f8a 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_iridium33.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_iridium33.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../debris_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Iridium 33 Debris", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_kosmos2251.asset b/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_kosmos2251.asset index b332289cb8..6d84fd8247 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_kosmos2251.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/debris/debris_kosmos2251.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../debris_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Kosmos 2251 Debris", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/debris_shared.asset b/data/assets/scene/solarsystem/planets/earth/satellites/debris_shared.asset deleted file mode 100644 index 1c122b72d5..0000000000 --- a/data/assets/scene/solarsystem/planets/earth/satellites/debris_shared.asset +++ /dev/null @@ -1,74 +0,0 @@ -local transforms = asset.require('scene/solarsystem/planets/earth/transforms') -local assetHelper = asset.require('util/asset_helper') - -local satImageFolder = asset.syncedResource({ - Name = "Satellite Image Files", - Type = "HttpSynchronization", - Identifier = "tle_satellites_images", - Version = 1 -}) - -function downloadTLEFile(sceneAsset, url, name) - local identifier = name - identifier = identifier:gsub(" ", "") - identifier = identifier:gsub("&", "") - identifier = identifier:gsub("-", "") - return sceneAsset.syncedResource({ - Name = "Satellite TLE Data (" .. name .. ")", - Type = "UrlSynchronization", - Identifier = "satellite_tle_data_" .. identifier, - Url = url - }) -end - -local registerSatelliteGroupObjects = function(containingAsset, group, tleFolder, shouldAddDuplicates) - local filename = group.Url:match("([^/]+)$") - local filenameSansExt = filename:gsub(filename:match("(%.%w+)$"), "") - - local path = tleFolder .. "/" .. filename - - function numLinesInFile(filename) - local ctr = 0 - for _ in io.lines(filename) do ctr = ctr + 1 end - return ctr - end - - -- Check format of a set of 3 TLE file lines and return nonzero if there is a format error - function isValidTLEFileFormat(lineArr) - function isEmpty(s) return s == nil or s == '' end - - if isEmpty(lineArr[1]) or isEmpty(lineArr[2]) or isEmpty(lineArr[3]) then - return false - end - if string.sub(lineArr[2], 1, 2) ~= "1 " then - return false - end - if string.sub(lineArr[3], 1, 2) ~= "2 " then - return false - end - return true - end - - function debris(title, file, color) - return { - Identifier = title, - Parent = transforms.EarthInertial.Identifier, - Renderable = { - Type = "RenderableSatellites", - Path = file, - Segments = 160, - Color = color, - Fade = 0.5 - }, - GUI = { - Path = "/Solar System/Planets/Earth/Satellites" - } - } - end - - local Debris = debris(filenameSansExt, path, group.TrailColor) - assetHelper.registerSceneGraphNodesAndExport(containingAsset, { Debris }) -end - -asset.export("downloadTLEFile", downloadTLEFile) -asset.export("registerSatelliteGroupObjects", registerSatelliteGroupObjects) diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/brightest.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/brightest.asset index d34a2b705c..6a74e9e875 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/brightest.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/brightest.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "100 Brightest", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/cubesats.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/cubesats.asset index afa9e7c501..b53e0fa281 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/cubesats.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/cubesats.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "CubeSat", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset new file mode 100644 index 0000000000..4f36cfc683 --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/iss.asset @@ -0,0 +1,119 @@ +local assetHelper = asset.require('util/asset_helper') +local satelliteHelper = asset.require('util/tle_helper') +local transforms = asset.require('scene/solarsystem/planets/earth/transforms') +local sunTransforms = asset.require('scene/solarsystem/sun/transforms') + +local url = "https://celestrak.com/satcat/tle.php?CATNR=25544" +local identifier = "ISS" +local filename = "ISS.txt" +local nodes = {} +local tle = satelliteHelper.downloadTLEFile(asset, url, identifier, filename) + +local modelsLocation = asset.syncedResource({ + Name = "ISS Models", + Type = "HttpSynchronization", + Identifier = "iss_model", + Version = 1 +}) + +local initializeAndAddNodes = function() + + local lineElement = satelliteHelper.makeSingleLineElement(tle, filename) + local period = satelliteHelper.getPeriodFromElement(lineElement) + local path = tle .. "/" .. filename + +-- TLE data is only relevant in EarthInertial frame which means the model +-- will inherit some irrelevant rotations from its parent. To get around that +-- we perform the reverse rotation back to EarthBarycenter frame after applying +-- the TLE translation + local iss = { + Identifier = identifier, + Parent = transforms.EarthInertial.Identifier, + Transform = { + Translation = { + Type = "TLETranslation", + Body = identifier, + Observer = transforms.EarthInertial.Identifier, + File = path, + LineNumber = 1 + }, + Rotation = { + Type = "SpiceRotation", + SourceFrame = "GALACTIC", + DestinationFrame = "J2000", + } + }, + Tag = { "earth_satellite", "ISS" }, + GUI = { + Path = "/Solar System/Planets/Earth/Satellites/ISS", + Hiden = true + } + } + + local issModel = { + Identifier = identifier .. "_model", + Parent = iss.Identifier, + Transform = { + Rotation = { + Type = "FixedRotation", + Attached = "ISS_model", + XAxis = { 1.0, 0.0, 0.0 }, + XAxisOrthogonal = true, + ZAxis = transforms.EarthInertial.Identifier + } + }, + Renderable = { + Type = "RenderableModel", + Geometry = { + Type = "MultiModelGeometry", + GeometryFile = modelsLocation .. "/iss.obj" + }, + ColorTexture = modelsLocation .. "/gray.png", + LightSources = assetHelper.getDefaultLightSources(sunTransforms.SolarSystemBarycenter.Identifier) + }, + Tag = { "earth_satellite", "ISS" }, + GUI = { + Path = "/Solar System/Planets/Earth/Satellites/ISS" + } + } + + local issTrail = { + Identifier = identifier .. "_trail", + Parent = transforms.EarthInertial.Identifier, + Renderable = { + Type = "RenderableTrailOrbit", + Translation = { + Type = "TLETranslation", + Body = identifier, + Observer = transforms.EarthInertial.Identifier, + File = path, + LineNumber = 1 + }, + Color = { 0.9, 0.6715, 0.0 }, + Fade = 1.5, + Period = period, + Resolution = 320 + }, + Tag = { "earth_satellite", "ISS" }, + GUI = { + Path = "/Solar System/Planets/Earth/Satellites/ISS" + } + } + + local myNodes = { iss, issModel, issTrail } + + for _, node in ipairs(myNodes) do + openspace.addSceneGraphNode(node) + end + + return myNodes +end + +asset.onInitialize(function () + nodes = initializeAndAddNodes() +end) + +asset.onDeinitialize(function () + openspace.removeSceneGraphNode(nodes[3].Identifier) -- Removing trail + openspace.removeSceneGraphNode(nodes[1].Identifier) -- Removing ISS and model recursively +end) diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/military.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/military.asset index 9a254fb16f..eba2695caa 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/military.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/military.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Military", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/other.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/other.asset index ef76cbd65e..a389e6510d 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/other.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/other.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Other", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/radar.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/radar.asset index 1ddffbac4f..64204ffd3f 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/radar.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/radar.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Radar Calibration", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/spacestations.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/spacestations.asset index b98789cb94..f9f974a730 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/spacestations.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/spacestations.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "SpaceStations", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/misc/tle-new.asset b/data/assets/scene/solarsystem/planets/earth/satellites/misc/tle-new.asset index d496ba5cba..506dd7bb48 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/misc/tle-new.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/misc/tle-new.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Last 30 Days", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/beidou.asset b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/beidou.asset index b07f53283f..47fe0930be 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/beidou.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/beidou.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Beidou", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/galileo.asset b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/galileo.asset index 6db045c232..f3c2d976f3 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/galileo.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/galileo.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Galileo", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/glosnass.asset b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/glosnass.asset index 5e10daa3cf..b0223450c3 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/glosnass.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/glosnass.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Glosnass", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/gps.asset b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/gps.asset index 8859ecce9f..e08e162862 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/gps.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/gps.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "GPS", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/musson.asset b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/musson.asset index 9d267227a4..efccb05950 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/musson.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/musson.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Russian LEO Navigation", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/nnss.asset b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/nnss.asset index 56478a1dd0..3be4a576ec 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/nnss.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/nnss.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Navy Navigation Satellite System", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/sbas.asset b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/sbas.asset index 2c0356abad..58458638c4 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/navigation/sbas.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/navigation/sbas.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Satellite Based Augmentation System", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/satellites_interesting.asset b/data/assets/scene/solarsystem/planets/earth/satellites/satellites_interesting.asset index 230ded9c65..7d257cfc8b 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/satellites_interesting.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/satellites_interesting.asset @@ -2,4 +2,5 @@ asset.request('./misc/brightest') asset.request('./communications/geostationary') asset.request('./navigation/gps') asset.request('./misc/spacestations') +asset.request('./misc/iss') asset.request('./misc/tle-new') diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/satellites_shared.asset b/data/assets/scene/solarsystem/planets/earth/satellites/satellites_shared.asset deleted file mode 100644 index e5fde6d30c..0000000000 --- a/data/assets/scene/solarsystem/planets/earth/satellites/satellites_shared.asset +++ /dev/null @@ -1,75 +0,0 @@ -local transforms = asset.require('scene/solarsystem/planets/earth/transforms') -local assetHelper = asset.require('util/asset_helper') - -local satImageFolder = asset.syncedResource({ - Name = "Satellite Image Files", - Type = "HttpSynchronization", - Identifier = "tle_satellites_images", - Version = 1 -}) - -function downloadTLEFile(sceneAsset, url, name) - local identifier = name - identifier = identifier:gsub(" ", "") - identifier = identifier:gsub("&", "") - identifier = identifier:gsub("-", "") - return sceneAsset.syncedResource({ - Name = "Satellite TLE Data (" .. name .. ")", - Type = "UrlSynchronization", - Identifier = "satellite_tle_data_" .. identifier, - Url = url - }) -end - -local registerSatelliteGroupObjects = function(containingAsset, group, tleFolder, shouldAddDuplicates) - local filename = group.Url:match("([^/]+)$") - local filenameSansExt = filename:gsub(filename:match("(%.%w+)$"), "") - - local path = tleFolder .. "/" .. filename - - function numLinesInFile(filename) - local ctr = 0 - for _ in io.lines(filename) do ctr = ctr + 1 end - return ctr - end - - -- Check format of a set of 3 TLE file lines and return nonzero if there is a format error - function isValidTLEFileFormat(lineArr) - function isEmpty(s) return s == nil or s == '' end - - if isEmpty(lineArr[1]) or isEmpty(lineArr[2]) or isEmpty(lineArr[3]) then - return false - end - if string.sub(lineArr[2], 1, 2) ~= "1 " then - return false - end - if string.sub(lineArr[3], 1, 2) ~= "2 " then - return false - end - return true - end - - function satellites(title, file, color) - return { - Identifier = title, - Parent = transforms.EarthInertial.Identifier, - Renderable = { - Type = "RenderableSatellites", - Path = file, - Segments = 120, - Color = color, - Fade = 0.5 - }, - --Tag = { "earth_satellite_" .. group, "earth_satellite_" .. group .. "_trail"}, - GUI = { - Path = "/Solar System/Planets/Earth/Satellites" - } - } - end - - local SatelliteBatch = satellites(filenameSansExt, path, group.TrailColor) - assetHelper.registerSceneGraphNodesAndExport(containingAsset, { SatelliteBatch }) -end - -asset.export("downloadTLEFile", downloadTLEFile) -asset.export("registerSatelliteGroupObjects", registerSatelliteGroupObjects) diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/science/education.asset b/data/assets/scene/solarsystem/planets/earth/satellites/science/education.asset index c9ff14f021..d7a42c5fde 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/science/education.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/science/education.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Education", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/science/engineering.asset b/data/assets/scene/solarsystem/planets/earth/satellites/science/engineering.asset index ef74f84ffe..faa6febc16 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/science/engineering.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/science/engineering.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Engineering", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/science/geodetic.asset b/data/assets/scene/solarsystem/planets/earth/satellites/science/geodetic.asset index 982072359e..d2613c699e 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/science/geodetic.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/science/geodetic.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Geodect", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/science/spaceearth.asset b/data/assets/scene/solarsystem/planets/earth/satellites/science/spaceearth.asset index 2d459040b4..e6d3513857 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/science/spaceearth.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/science/spaceearth.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Space & Earth Science", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/weather/argos.asset b/data/assets/scene/solarsystem/planets/earth/satellites/weather/argos.asset index c898dd241b..75d572299e 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/weather/argos.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/weather/argos.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "ARGOS", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/weather/dmc.asset b/data/assets/scene/solarsystem/planets/earth/satellites/weather/dmc.asset index 52b6bd7c97..eb95d7e6e1 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/weather/dmc.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/weather/dmc.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Disaster Monitoring", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/weather/earth_resources.asset b/data/assets/scene/solarsystem/planets/earth/satellites/weather/earth_resources.asset index 5da0f4fd4d..e3ad206277 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/weather/earth_resources.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/weather/earth_resources.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Earth Resources", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/weather/goes.asset b/data/assets/scene/solarsystem/planets/earth/satellites/weather/goes.asset index 9c4728de10..55a2584643 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/weather/goes.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/weather/goes.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "GOES", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/weather/noaa.asset b/data/assets/scene/solarsystem/planets/earth/satellites/weather/noaa.asset index 5c6c5a476b..85c7f97798 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/weather/noaa.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/weather/noaa.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "NOAA", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/weather/planet.asset b/data/assets/scene/solarsystem/planets/earth/satellites/weather/planet.asset index 7c242aed52..bb5f00625b 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/weather/planet.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/weather/planet.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Planet", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/weather/sarsat.asset b/data/assets/scene/solarsystem/planets/earth/satellites/weather/sarsat.asset index ce54caa190..64ef4004e5 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/weather/sarsat.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/weather/sarsat.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Search & Rescue (SARSAT)", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/weather/spire.asset b/data/assets/scene/solarsystem/planets/earth/satellites/weather/spire.asset index 8ee080b890..92c25df702 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/weather/spire.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/weather/spire.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Spire", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/weather/tdrss.asset b/data/assets/scene/solarsystem/planets/earth/satellites/weather/tdrss.asset index e26b31acc5..0ec30cab29 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/weather/tdrss.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/weather/tdrss.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Tracking and Data Relay Satellite System (TDRSS)", diff --git a/data/assets/scene/solarsystem/planets/earth/satellites/weather/weather.asset b/data/assets/scene/solarsystem/planets/earth/satellites/weather/weather.asset index a867a5ecfb..c23e0910b6 100644 --- a/data/assets/scene/solarsystem/planets/earth/satellites/weather/weather.asset +++ b/data/assets/scene/solarsystem/planets/earth/satellites/weather/weather.asset @@ -1,5 +1,5 @@ local assetHelper = asset.require('util/asset_helper') -local shared = asset.require('../satellites_shared') +local shared = asset.require('util/tle_helper') local group = { Title = "Weather", diff --git a/data/assets/util/tle_helper.asset b/data/assets/util/tle_helper.asset new file mode 100644 index 0000000000..92293479c3 --- /dev/null +++ b/data/assets/util/tle_helper.asset @@ -0,0 +1,110 @@ +local transforms = asset.require('scene/solarsystem/planets/earth/transforms') +local assetHelper = asset.require('util/asset_helper') + +function downloadTLEFile(sceneAsset, url, name, filename) + local identifier = name + identifier = identifier:gsub(" ", "") + identifier = identifier:gsub("&", "") + identifier = identifier:gsub("-", "") + + local urlSyncTable = { + Name = "Satellite TLE Data (" .. name .. ")", + Type = "UrlSynchronization", + Identifier = "satellite_tle_data_" .. identifier, + Url = url + } + + if (filename ~= '') then + urlSyncTable.Filename = filename + end + + return sceneAsset.syncedResource(urlSyncTable) +end + +-- Check format of a set of 3 TLE file lines and return nonzero if there is a format error +function isValidTLEFileFormat(lineArr) + function isEmpty(s) return s == nil or s == '' end + + if isEmpty(lineArr[1]) or isEmpty(lineArr[2]) or isEmpty(lineArr[3]) then + return false + end + if string.sub(lineArr[2], 1, 2) ~= "1 " then + return false + end + if string.sub(lineArr[3], 1, 2) ~= "2 " then + return false + end + return true +end + +local makeSingleLineElement = function(tle, filename) + local path = tle .. "/" .. filename + local file = io.open(path, "r") + assert(file, "File not found: " .. path) + + local line = { + file:read('*l'), --title line + file:read('*l'), + file:read('*l') + } + + assert(isValidTLEFileFormat(line), "TLE file syntax error on line " .. 1 .. ": " .. path) + + -- Trim string + line[1] = line[1]:gsub("^%s*(.-)%s*$", "%1") + line[1] = line[1]:gsub("%s+", "_") + line[1] = line[1]:gsub("[%-()]", "") + --local title = line[1] + + return line +end + +function numLinesInFile(filename) + local ctr = 0 + for _ in io.lines(filename) do ctr = ctr + 1 end + return ctr +end + +local getPeriodFromElement = function(element) + -- Get period from correct location of the string + local per = tonumber(string.sub(element[3], 53, 63)) + -- Trail for 2x a single revolution + per = 1.0 / per + + return per +end + +function satellites(title, file, color, group) + return { + Identifier = title, + Parent = transforms.EarthInertial.Identifier, + Renderable = { + Type = "RenderableSatellites", + Path = file, + Segments = 120, + Color = color, + Fade = 1.5 + }, + Tag = { "earth_satellites" }, + GUI = { + Path = "/Solar System/Planets/Earth/Satellites" + } + } +end + +local registerSatelliteGroupObjects = function(containingAsset, group, tleFolder, shouldAddDuplicates) + local filename = group.Url:match("([^/]+)$") + local filenameSansExt = filename:gsub(filename:match("(%.%w+)$"), "") + + local path = tleFolder .. "/" .. filename + + local SatelliteBatch = satellites(filenameSansExt, path, group.TrailColor, group) + assetHelper.registerSceneGraphNodesAndExport(containingAsset, { SatelliteBatch }) +end + +asset.export("downloadTLEFile", downloadTLEFile) +asset.export("isValidTLEFileFormat", isValidTLEFileFormat) +asset.export("numLinesInFile", numLinesInFile) +asset.export("makeSingleLineElement", makeSingleLineElement) +asset.export("getPeriodFromElement", getPeriodFromElement) +asset.export("registerSatelliteGroupObjects", registerSatelliteGroupObjects) diff --git a/ext/ghoul b/ext/ghoul index 48d3b96434..423d026fa4 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 48d3b96434497cc2cdcf266255374fa722ad2d8a +Subproject commit 423d026fa489b0f8b53284be916f3d82bc33d3fd diff --git a/include/openspace/documentation/core_registration.h b/include/openspace/documentation/core_registration.h index a433bfd517..90176260a9 100644 --- a/include/openspace/documentation/core_registration.h +++ b/include/openspace/documentation/core_registration.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/documentation/documentation.h b/include/openspace/documentation/documentation.h index 6dc9432799..f6dac77b15 100644 --- a/include/openspace/documentation/documentation.h +++ b/include/openspace/documentation/documentation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/documentation/documentationengine.h b/include/openspace/documentation/documentationengine.h index 26dd0e14f9..4fc4065f8d 100644 --- a/include/openspace/documentation/documentationengine.h +++ b/include/openspace/documentation/documentationengine.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/documentation/documentationgenerator.h b/include/openspace/documentation/documentationgenerator.h index 43733989c3..41c3f21508 100644 --- a/include/openspace/documentation/documentationgenerator.h +++ b/include/openspace/documentation/documentationgenerator.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/documentation/verifier.h b/include/openspace/documentation/verifier.h index 07b6194d77..a94792e2b0 100644 --- a/include/openspace/documentation/verifier.h +++ b/include/openspace/documentation/verifier.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/documentation/verifier.inl b/include/openspace/documentation/verifier.inl index c0863127b5..6b707ece6f 100644 --- a/include/openspace/documentation/verifier.inl +++ b/include/openspace/documentation/verifier.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/engine/configuration.h b/include/openspace/engine/configuration.h index 46ceb35780..907ccd0e3f 100644 --- a/include/openspace/engine/configuration.h +++ b/include/openspace/engine/configuration.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -87,9 +87,9 @@ struct Configuration { bool usePerSceneCache = false; bool isRenderingOnMasterDisabled = false; - glm::dvec3 globalRotation; - glm::dvec3 screenSpaceRotation; - glm::dvec3 masterRotation; + glm::dvec3 globalRotation = glm::dvec3(0.0); + glm::dvec3 screenSpaceRotation = glm::dvec3(0.0); + glm::dvec3 masterRotation = glm::dvec3(0.0); bool isConsoleDisabled = false; std::map moduleConfigurations; diff --git a/include/openspace/engine/downloadmanager.h b/include/openspace/engine/downloadmanager.h index 8e5e02483e..9769089855 100644 --- a/include/openspace/engine/downloadmanager.h +++ b/include/openspace/engine/downloadmanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/engine/globals.h b/include/openspace/engine/globals.h index 2e1ed8dd77..c7133339bf 100644 --- a/include/openspace/engine/globals.h +++ b/include/openspace/engine/globals.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/engine/globalscallbacks.h b/include/openspace/engine/globalscallbacks.h index 08452a2af1..9131294139 100644 --- a/include/openspace/engine/globalscallbacks.h +++ b/include/openspace/engine/globalscallbacks.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/engine/logfactory.h b/include/openspace/engine/logfactory.h index d596e1d88a..4d023ec9e9 100644 --- a/include/openspace/engine/logfactory.h +++ b/include/openspace/engine/logfactory.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/engine/moduleengine.h b/include/openspace/engine/moduleengine.h index 06ebd45c07..d12cf5189f 100644 --- a/include/openspace/engine/moduleengine.h +++ b/include/openspace/engine/moduleengine.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/engine/moduleengine.inl b/include/openspace/engine/moduleengine.inl index 45b10014d6..7853a64eb1 100644 --- a/include/openspace/engine/moduleengine.inl +++ b/include/openspace/engine/moduleengine.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index b0bf52e2c0..539530cad0 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/engine/syncengine.h b/include/openspace/engine/syncengine.h index 49934315fc..5b5b4f2d89 100644 --- a/include/openspace/engine/syncengine.h +++ b/include/openspace/engine/syncengine.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/engine/virtualpropertymanager.h b/include/openspace/engine/virtualpropertymanager.h index d7479a6ffb..5d0701797f 100644 --- a/include/openspace/engine/virtualpropertymanager.h +++ b/include/openspace/engine/virtualpropertymanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/engine/windowdelegate.h b/include/openspace/engine/windowdelegate.h index 677bed9a3d..1bef12d181 100644 --- a/include/openspace/engine/windowdelegate.h +++ b/include/openspace/engine/windowdelegate.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -96,13 +96,9 @@ struct WindowDelegate { glm::ivec4 (*viewportPixelCoordinates)() = []() { return glm::ivec4(0, 0, 0, 0); }; - bool (*isExternalControlConnected)() = []() { return false; }; - void (*sendMessageToExternalControl)(const std::vector& message) = [](const std::vector&) {}; - bool (*isSimpleRendering)() = []() { return true; }; - bool (*isFisheyeRendering)() = []() { return false; }; unsigned int(*takeScreenshot)(bool applyWarping) = [](bool) { return 0u; }; diff --git a/include/openspace/interaction/camerainteractionstates.h b/include/openspace/interaction/camerainteractionstates.h index e4e21e0ae7..0e6f0f56a4 100644 --- a/include/openspace/interaction/camerainteractionstates.h +++ b/include/openspace/interaction/camerainteractionstates.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -64,12 +64,12 @@ protected: void setFriction(double friction); void setVelocityScaleFactor(double scaleFactor); - glm::dvec2 previousPosition; + glm::dvec2 previousPosition = glm::dvec2(0.0); DelayedVariable velocity; }; - double _sensitivity; + double _sensitivity = 0.0; InteractionState _globalRotationState; InteractionState _localRotationState; diff --git a/include/openspace/interaction/delayedvariable.h b/include/openspace/interaction/delayedvariable.h index 88dbb6938c..fd2a653820 100644 --- a/include/openspace/interaction/delayedvariable.h +++ b/include/openspace/interaction/delayedvariable.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -46,8 +46,8 @@ public: private: ScaleType _scaleFactor; ScaleType _friction; - T _targetValue; - T _currentValue; + T _targetValue = T(0); + T _currentValue = T(0); }; } // namespace openspace::interaction diff --git a/include/openspace/interaction/delayedvariable.inl b/include/openspace/interaction/delayedvariable.inl index cbd32d63da..2d36d5fbfa 100644 --- a/include/openspace/interaction/delayedvariable.inl +++ b/include/openspace/interaction/delayedvariable.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/externinteraction.h b/include/openspace/interaction/externinteraction.h index 6d9c10af36..a0478c86e1 100644 --- a/include/openspace/interaction/externinteraction.h +++ b/include/openspace/interaction/externinteraction.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/inputstate.h b/include/openspace/interaction/inputstate.h index 1ff5b39b8b..443899df35 100644 --- a/include/openspace/interaction/inputstate.h +++ b/include/openspace/interaction/inputstate.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -70,7 +70,7 @@ private: // Input from mouse std::vector _mouseButtonsDown; - glm::dvec2 _mousePosition; + glm::dvec2 _mousePosition = glm::dvec2(0.0); double _mouseScrollDelta; }; diff --git a/include/openspace/interaction/interactionmonitor.h b/include/openspace/interaction/interactionmonitor.h index 59748a00c8..b8c7a8b2b9 100644 --- a/include/openspace/interaction/interactionmonitor.h +++ b/include/openspace/interaction/interactionmonitor.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/interpolator.h b/include/openspace/interaction/interpolator.h index 54750bc1eb..d872e1706d 100644 --- a/include/openspace/interaction/interpolator.h +++ b/include/openspace/interaction/interpolator.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/interpolator.inl b/include/openspace/interaction/interpolator.inl index d17741ea96..d28f07f573 100644 --- a/include/openspace/interaction/interpolator.inl +++ b/include/openspace/interaction/interpolator.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/joystickcamerastates.h b/include/openspace/interaction/joystickcamerastates.h index 965d0e16e6..ade9b9d2c7 100644 --- a/include/openspace/interaction/joystickcamerastates.h +++ b/include/openspace/interaction/joystickcamerastates.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/joystickinputstate.h b/include/openspace/interaction/joystickinputstate.h index 1a1b2a07ad..990cb2cf14 100644 --- a/include/openspace/interaction/joystickinputstate.h +++ b/include/openspace/interaction/joystickinputstate.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/keybindingmanager.h b/include/openspace/interaction/keybindingmanager.h index 08363bcd0d..2c652c7d40 100644 --- a/include/openspace/interaction/keybindingmanager.h +++ b/include/openspace/interaction/keybindingmanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/keyframenavigator.h b/include/openspace/interaction/keyframenavigator.h index a241815c2c..c78db27cd7 100644 --- a/include/openspace/interaction/keyframenavigator.h +++ b/include/openspace/interaction/keyframenavigator.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -49,8 +49,8 @@ public: BooleanType(Inclusive); struct CameraPose { - glm::dvec3 position; - glm::quat rotation; + glm::dvec3 position = glm::dvec3(0.0); + glm::quat rotation = glm::quat(1.f, 0.f, 0.f, 0.f); std::string focusNode; float scale; bool followFocusNodeRotation; diff --git a/include/openspace/interaction/mousecamerastates.h b/include/openspace/interaction/mousecamerastates.h index bd2917dec5..f592dc0ed1 100644 --- a/include/openspace/interaction/mousecamerastates.h +++ b/include/openspace/interaction/mousecamerastates.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/navigationhandler.h b/include/openspace/interaction/navigationhandler.h index dcdd4df76b..ea29dd98ea 100644 --- a/include/openspace/interaction/navigationhandler.h +++ b/include/openspace/interaction/navigationhandler.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -67,7 +67,7 @@ public: std::string anchor; std::string aim; std::string referenceFrame; - glm::dvec3 position; + glm::dvec3 position = glm::dvec3(0.0); std::optional up; double yaw = 0.0; double pitch = 0.0; diff --git a/include/openspace/interaction/orbitalnavigator.h b/include/openspace/interaction/orbitalnavigator.h index 155bfdd1af..c6671c8d6f 100644 --- a/include/openspace/interaction/orbitalnavigator.h +++ b/include/openspace/interaction/orbitalnavigator.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -99,13 +99,13 @@ public: private: struct CameraRotationDecomposition { - glm::dquat localRotation; - glm::dquat globalRotation; + glm::dquat localRotation = glm::dquat(1.0, 0.0, 0.0, 0.0); + glm::dquat globalRotation = glm::dquat(1.0, 0.0, 0.0, 0.0); }; struct CameraPose { - glm::dvec3 position; - glm::dquat rotation; + glm::dvec3 position = glm::dvec3(0.0); + glm::dquat rotation = glm::dquat(1.0, 0.0, 0.0, 0.0); }; using Displacement = std::pair; diff --git a/include/openspace/interaction/scriptcamerastates.h b/include/openspace/interaction/scriptcamerastates.h index 2153dee497..c70814bac4 100644 --- a/include/openspace/interaction/scriptcamerastates.h +++ b/include/openspace/interaction/scriptcamerastates.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -42,11 +42,11 @@ public: void addGlobalRoll(const glm::dvec2& delta); private: - glm::dvec2 _localRotation; - glm::dvec2 _globalRotation; - glm::dvec2 _truckMovement; - glm::dvec2 _localRoll; - glm::dvec2 _globalRoll; + glm::dvec2 _localRotation = glm::dvec2(0.0); + glm::dvec2 _globalRotation = glm::dvec2(0.0); + glm::dvec2 _truckMovement = glm::dvec2(0.0); + glm::dvec2 _localRoll = glm::dvec2(0.0); + glm::dvec2 _globalRoll = glm::dvec2(0.0); }; } // namespace openspace::interaction diff --git a/include/openspace/interaction/sessionrecording.h b/include/openspace/interaction/sessionrecording.h index 26c5f5a094..b3856c5981 100644 --- a/include/openspace/interaction/sessionrecording.h +++ b/include/openspace/interaction/sessionrecording.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/sessionrecording.inl b/include/openspace/interaction/sessionrecording.inl index 0839562306..5c8ce2c9ac 100644 --- a/include/openspace/interaction/sessionrecording.inl +++ b/include/openspace/interaction/sessionrecording.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/shortcutmanager.h b/include/openspace/interaction/shortcutmanager.h index e08f4c708f..4f901f9f42 100644 --- a/include/openspace/interaction/shortcutmanager.h +++ b/include/openspace/interaction/shortcutmanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/websocketcamerastates.h b/include/openspace/interaction/websocketcamerastates.h index ab38160203..0b0bc5c4a9 100644 --- a/include/openspace/interaction/websocketcamerastates.h +++ b/include/openspace/interaction/websocketcamerastates.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/interaction/websocketinputstate.h b/include/openspace/interaction/websocketinputstate.h index a5a722491e..576e0c4c24 100644 --- a/include/openspace/interaction/websocketinputstate.h +++ b/include/openspace/interaction/websocketinputstate.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/json.h b/include/openspace/json.h index 5acf454641..11faafa5cf 100644 --- a/include/openspace/json.h +++ b/include/openspace/json.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/mission/mission.h b/include/openspace/mission/mission.h index 0cd8b73974..3cb5c8caf1 100644 --- a/include/openspace/mission/mission.h +++ b/include/openspace/mission/mission.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/mission/missionmanager.h b/include/openspace/mission/missionmanager.h index 4be9762d74..97522d490d 100644 --- a/include/openspace/mission/missionmanager.h +++ b/include/openspace/mission/missionmanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/network/messagestructures.h b/include/openspace/network/messagestructures.h index d1e60f7bb3..06fe7841ee 100644 --- a/include/openspace/network/messagestructures.h +++ b/include/openspace/network/messagestructures.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -45,8 +45,8 @@ struct CameraKeyframe { deserialize(buffer); } - glm::dvec3 _position; - glm::dquat _rotation; + glm::dvec3 _position = glm::dvec3(0.0); + glm::dquat _rotation = glm::dquat(1.0, 0.0, 0.0, 0.0); bool _followNodeRotation; std::string _focusNode; float _scale; diff --git a/include/openspace/network/parallelconnection.h b/include/openspace/network/parallelconnection.h index bffa3c9626..f70e87ed16 100644 --- a/include/openspace/network/parallelconnection.h +++ b/include/openspace/network/parallelconnection.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/network/parallelpeer.h b/include/openspace/network/parallelpeer.h index b34d4bcea2..293f433794 100644 --- a/include/openspace/network/parallelpeer.h +++ b/include/openspace/network/parallelpeer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/network/parallelserver.h b/include/openspace/network/parallelserver.h index 6cf0b1b1f5..18ce60e573 100644 --- a/include/openspace/network/parallelserver.h +++ b/include/openspace/network/parallelserver.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/performance/performancelayout.h b/include/openspace/performance/performancelayout.h index 7eb6b69f1c..85d325cf45 100644 --- a/include/openspace/performance/performancelayout.h +++ b/include/openspace/performance/performancelayout.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/performance/performancemanager.h b/include/openspace/performance/performancemanager.h index 86ffc9dd92..4c37fd5b81 100644 --- a/include/openspace/performance/performancemanager.h +++ b/include/openspace/performance/performancemanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/performance/performancemeasurement.h b/include/openspace/performance/performancemeasurement.h index 0c762449d1..3222a72479 100644 --- a/include/openspace/performance/performancemeasurement.h +++ b/include/openspace/performance/performancemeasurement.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/dmat2property.h b/include/openspace/properties/matrix/dmat2property.h index 2b11e012dc..030e9b710c 100644 --- a/include/openspace/properties/matrix/dmat2property.h +++ b/include/openspace/properties/matrix/dmat2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/dmat2x3property.h b/include/openspace/properties/matrix/dmat2x3property.h index 9fdeee4f7d..4885a392c0 100644 --- a/include/openspace/properties/matrix/dmat2x3property.h +++ b/include/openspace/properties/matrix/dmat2x3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/dmat2x4property.h b/include/openspace/properties/matrix/dmat2x4property.h index 310234a21d..20eb77fcda 100644 --- a/include/openspace/properties/matrix/dmat2x4property.h +++ b/include/openspace/properties/matrix/dmat2x4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/dmat3property.h b/include/openspace/properties/matrix/dmat3property.h index 1f355bc91f..9c2543d7d2 100644 --- a/include/openspace/properties/matrix/dmat3property.h +++ b/include/openspace/properties/matrix/dmat3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/dmat3x2property.h b/include/openspace/properties/matrix/dmat3x2property.h index 406114d809..5824b869ee 100644 --- a/include/openspace/properties/matrix/dmat3x2property.h +++ b/include/openspace/properties/matrix/dmat3x2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/dmat3x4property.h b/include/openspace/properties/matrix/dmat3x4property.h index 450c075702..39c83f408d 100644 --- a/include/openspace/properties/matrix/dmat3x4property.h +++ b/include/openspace/properties/matrix/dmat3x4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/dmat4property.h b/include/openspace/properties/matrix/dmat4property.h index 9c93bda9e9..cd7b9b3eb1 100644 --- a/include/openspace/properties/matrix/dmat4property.h +++ b/include/openspace/properties/matrix/dmat4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/dmat4x2property.h b/include/openspace/properties/matrix/dmat4x2property.h index ac4a421f5c..a1bea90a79 100644 --- a/include/openspace/properties/matrix/dmat4x2property.h +++ b/include/openspace/properties/matrix/dmat4x2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/dmat4x3property.h b/include/openspace/properties/matrix/dmat4x3property.h index 66cd49f667..8ed951cffb 100644 --- a/include/openspace/properties/matrix/dmat4x3property.h +++ b/include/openspace/properties/matrix/dmat4x3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/mat2property.h b/include/openspace/properties/matrix/mat2property.h index cc8bb9254d..f500659e08 100644 --- a/include/openspace/properties/matrix/mat2property.h +++ b/include/openspace/properties/matrix/mat2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/mat2x3property.h b/include/openspace/properties/matrix/mat2x3property.h index dc51ae3b95..2ba18f51e1 100644 --- a/include/openspace/properties/matrix/mat2x3property.h +++ b/include/openspace/properties/matrix/mat2x3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/mat2x4property.h b/include/openspace/properties/matrix/mat2x4property.h index 79a0ebca3b..98820e069a 100644 --- a/include/openspace/properties/matrix/mat2x4property.h +++ b/include/openspace/properties/matrix/mat2x4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/mat3property.h b/include/openspace/properties/matrix/mat3property.h index 1dfccfcad9..dd2104482e 100644 --- a/include/openspace/properties/matrix/mat3property.h +++ b/include/openspace/properties/matrix/mat3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/mat3x2property.h b/include/openspace/properties/matrix/mat3x2property.h index 63d8f35e97..88c157d3bf 100644 --- a/include/openspace/properties/matrix/mat3x2property.h +++ b/include/openspace/properties/matrix/mat3x2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/mat3x4property.h b/include/openspace/properties/matrix/mat3x4property.h index 0e86c22fcb..294e77b82f 100644 --- a/include/openspace/properties/matrix/mat3x4property.h +++ b/include/openspace/properties/matrix/mat3x4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/mat4property.h b/include/openspace/properties/matrix/mat4property.h index 28467cae7c..abf0e01e61 100644 --- a/include/openspace/properties/matrix/mat4property.h +++ b/include/openspace/properties/matrix/mat4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/mat4x2property.h b/include/openspace/properties/matrix/mat4x2property.h index dda6c83965..a688965a86 100644 --- a/include/openspace/properties/matrix/mat4x2property.h +++ b/include/openspace/properties/matrix/mat4x2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/matrix/mat4x3property.h b/include/openspace/properties/matrix/mat4x3property.h index c624b67c50..231d253c0d 100644 --- a/include/openspace/properties/matrix/mat4x3property.h +++ b/include/openspace/properties/matrix/mat4x3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/numericalproperty.h b/include/openspace/properties/numericalproperty.h index 046658143e..e6fce71478 100644 --- a/include/openspace/properties/numericalproperty.h +++ b/include/openspace/properties/numericalproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -90,13 +90,13 @@ protected: */ std::string luaToJson(std::string luaValue) const; - T _minimumValue; - T _maximumValue; - T _stepping; - float _exponent; + T _minimumValue = T(0); + T _maximumValue = T(0); + T _stepping = T(0); + float _exponent = 0.f; - T _interpolationStart; - T _interpolationEnd; + T _interpolationStart = T(0); + T _interpolationEnd = T(0); }; } // namespace openspace::properties diff --git a/include/openspace/properties/numericalproperty.inl b/include/openspace/properties/numericalproperty.inl index 186b493126..f5badd7e03 100644 --- a/include/openspace/properties/numericalproperty.inl +++ b/include/openspace/properties/numericalproperty.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -23,6 +23,7 @@ ****************************************************************************************/ #include +#include namespace openspace::properties { diff --git a/include/openspace/properties/optionproperty.h b/include/openspace/properties/optionproperty.h index 25c13c77ff..1165337d56 100644 --- a/include/openspace/properties/optionproperty.h +++ b/include/openspace/properties/optionproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/property.h b/include/openspace/properties/property.h index 1b2f9fdbec..6284597f59 100644 --- a/include/openspace/properties/property.h +++ b/include/openspace/properties/property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/propertydelegate.h b/include/openspace/properties/propertydelegate.h index 4af67d8723..cd2c0e7979 100644 --- a/include/openspace/properties/propertydelegate.h +++ b/include/openspace/properties/propertydelegate.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/propertydelegate.inl b/include/openspace/properties/propertydelegate.inl index 11ddd9d8d1..d09a4f615e 100644 --- a/include/openspace/properties/propertydelegate.inl +++ b/include/openspace/properties/propertydelegate.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/propertyowner.h b/include/openspace/properties/propertyowner.h index d7134b9c54..5b4b9bd038 100644 --- a/include/openspace/properties/propertyowner.h +++ b/include/openspace/properties/propertyowner.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/boolproperty.h b/include/openspace/properties/scalar/boolproperty.h index 16428bf95d..e478e3318a 100644 --- a/include/openspace/properties/scalar/boolproperty.h +++ b/include/openspace/properties/scalar/boolproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/charproperty.h b/include/openspace/properties/scalar/charproperty.h index 4bf7e3b6e2..07ab7ad040 100644 --- a/include/openspace/properties/scalar/charproperty.h +++ b/include/openspace/properties/scalar/charproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/doubleproperty.h b/include/openspace/properties/scalar/doubleproperty.h index bbb38258c1..2f11f14277 100644 --- a/include/openspace/properties/scalar/doubleproperty.h +++ b/include/openspace/properties/scalar/doubleproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/floatproperty.h b/include/openspace/properties/scalar/floatproperty.h index 3b06e60d9e..a19df16279 100644 --- a/include/openspace/properties/scalar/floatproperty.h +++ b/include/openspace/properties/scalar/floatproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/intproperty.h b/include/openspace/properties/scalar/intproperty.h index 48e16324fb..ec5c528ac2 100644 --- a/include/openspace/properties/scalar/intproperty.h +++ b/include/openspace/properties/scalar/intproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/longdoubleproperty.h b/include/openspace/properties/scalar/longdoubleproperty.h index c842da0da9..768bba53f1 100644 --- a/include/openspace/properties/scalar/longdoubleproperty.h +++ b/include/openspace/properties/scalar/longdoubleproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/longlongproperty.h b/include/openspace/properties/scalar/longlongproperty.h index 5853792f30..eedcff1a82 100644 --- a/include/openspace/properties/scalar/longlongproperty.h +++ b/include/openspace/properties/scalar/longlongproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/longproperty.h b/include/openspace/properties/scalar/longproperty.h index f328f8a6eb..ed23a04a6f 100644 --- a/include/openspace/properties/scalar/longproperty.h +++ b/include/openspace/properties/scalar/longproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/shortproperty.h b/include/openspace/properties/scalar/shortproperty.h index 1d332900d2..a8cf97126e 100644 --- a/include/openspace/properties/scalar/shortproperty.h +++ b/include/openspace/properties/scalar/shortproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/signedcharproperty.h b/include/openspace/properties/scalar/signedcharproperty.h index 667ba9bf62..9419e9a7e2 100644 --- a/include/openspace/properties/scalar/signedcharproperty.h +++ b/include/openspace/properties/scalar/signedcharproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/ucharproperty.h b/include/openspace/properties/scalar/ucharproperty.h index 5cdcd1f2d5..4439157256 100644 --- a/include/openspace/properties/scalar/ucharproperty.h +++ b/include/openspace/properties/scalar/ucharproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/uintproperty.h b/include/openspace/properties/scalar/uintproperty.h index bc6865ab4f..12b40502fa 100644 --- a/include/openspace/properties/scalar/uintproperty.h +++ b/include/openspace/properties/scalar/uintproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/ulonglongproperty.h b/include/openspace/properties/scalar/ulonglongproperty.h index dcb638550a..c852b42554 100644 --- a/include/openspace/properties/scalar/ulonglongproperty.h +++ b/include/openspace/properties/scalar/ulonglongproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/ulongproperty.h b/include/openspace/properties/scalar/ulongproperty.h index e9667ce0f7..fdb283b2aa 100644 --- a/include/openspace/properties/scalar/ulongproperty.h +++ b/include/openspace/properties/scalar/ulongproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/ushortproperty.h b/include/openspace/properties/scalar/ushortproperty.h index 861e855dc2..d58c9e12f7 100644 --- a/include/openspace/properties/scalar/ushortproperty.h +++ b/include/openspace/properties/scalar/ushortproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/scalar/wcharproperty.h b/include/openspace/properties/scalar/wcharproperty.h index 07bc68ef76..9ede24d24c 100644 --- a/include/openspace/properties/scalar/wcharproperty.h +++ b/include/openspace/properties/scalar/wcharproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/selectionproperty.h b/include/openspace/properties/selectionproperty.h index f0ea9f0eaf..871faf1c7e 100644 --- a/include/openspace/properties/selectionproperty.h +++ b/include/openspace/properties/selectionproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/stringlistproperty.h b/include/openspace/properties/stringlistproperty.h index 98a38e0617..7078bdaecb 100644 --- a/include/openspace/properties/stringlistproperty.h +++ b/include/openspace/properties/stringlistproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/stringproperty.h b/include/openspace/properties/stringproperty.h index d3e12051b5..2ad56eb387 100644 --- a/include/openspace/properties/stringproperty.h +++ b/include/openspace/properties/stringproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/templateproperty.h b/include/openspace/properties/templateproperty.h index f04af496d3..2693b48eed 100644 --- a/include/openspace/properties/templateproperty.h +++ b/include/openspace/properties/templateproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/templateproperty.inl b/include/openspace/properties/templateproperty.inl index 72d92843b2..444270d07d 100644 --- a/include/openspace/properties/templateproperty.inl +++ b/include/openspace/properties/templateproperty.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/triggerproperty.h b/include/openspace/properties/triggerproperty.h index 485564e9aa..fdb6b030c2 100644 --- a/include/openspace/properties/triggerproperty.h +++ b/include/openspace/properties/triggerproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/bvec2property.h b/include/openspace/properties/vector/bvec2property.h index bdc158a4fc..76e81000fc 100644 --- a/include/openspace/properties/vector/bvec2property.h +++ b/include/openspace/properties/vector/bvec2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/bvec3property.h b/include/openspace/properties/vector/bvec3property.h index 724bf1cce4..65aeb2ffc7 100644 --- a/include/openspace/properties/vector/bvec3property.h +++ b/include/openspace/properties/vector/bvec3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/bvec4property.h b/include/openspace/properties/vector/bvec4property.h index 4958f4889e..b551d624ef 100644 --- a/include/openspace/properties/vector/bvec4property.h +++ b/include/openspace/properties/vector/bvec4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/dvec2property.h b/include/openspace/properties/vector/dvec2property.h index 20385dda18..66985a611f 100644 --- a/include/openspace/properties/vector/dvec2property.h +++ b/include/openspace/properties/vector/dvec2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/dvec3property.h b/include/openspace/properties/vector/dvec3property.h index 7adff33d3e..974d4133e8 100644 --- a/include/openspace/properties/vector/dvec3property.h +++ b/include/openspace/properties/vector/dvec3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/dvec4property.h b/include/openspace/properties/vector/dvec4property.h index 2784a3899f..13b6ffa47d 100644 --- a/include/openspace/properties/vector/dvec4property.h +++ b/include/openspace/properties/vector/dvec4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/ivec2property.h b/include/openspace/properties/vector/ivec2property.h index 2a02500f04..59b4bc89f4 100644 --- a/include/openspace/properties/vector/ivec2property.h +++ b/include/openspace/properties/vector/ivec2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/ivec3property.h b/include/openspace/properties/vector/ivec3property.h index b652fe8f68..d24f44e85d 100644 --- a/include/openspace/properties/vector/ivec3property.h +++ b/include/openspace/properties/vector/ivec3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/ivec4property.h b/include/openspace/properties/vector/ivec4property.h index cca0031147..597516ba0e 100644 --- a/include/openspace/properties/vector/ivec4property.h +++ b/include/openspace/properties/vector/ivec4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/uvec2property.h b/include/openspace/properties/vector/uvec2property.h index 3acaeb9df7..ff647091c8 100644 --- a/include/openspace/properties/vector/uvec2property.h +++ b/include/openspace/properties/vector/uvec2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/uvec3property.h b/include/openspace/properties/vector/uvec3property.h index 724b1f2723..cff5d16233 100644 --- a/include/openspace/properties/vector/uvec3property.h +++ b/include/openspace/properties/vector/uvec3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/uvec4property.h b/include/openspace/properties/vector/uvec4property.h index 4b7ff01146..ccd4a97fbc 100644 --- a/include/openspace/properties/vector/uvec4property.h +++ b/include/openspace/properties/vector/uvec4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/vec2property.h b/include/openspace/properties/vector/vec2property.h index c58f47d36c..1a9709a728 100644 --- a/include/openspace/properties/vector/vec2property.h +++ b/include/openspace/properties/vector/vec2property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/vec3property.h b/include/openspace/properties/vector/vec3property.h index b36779c70a..1795c705a0 100644 --- a/include/openspace/properties/vector/vec3property.h +++ b/include/openspace/properties/vector/vec3property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/properties/vector/vec4property.h b/include/openspace/properties/vector/vec4property.h index 09e429483c..bc66aafab8 100644 --- a/include/openspace/properties/vector/vec4property.h +++ b/include/openspace/properties/vector/vec4property.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/query/query.h b/include/openspace/query/query.h index a9584485af..18253a75d0 100644 --- a/include/openspace/query/query.h +++ b/include/openspace/query/query.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/abufferrenderer.h b/include/openspace/rendering/abufferrenderer.h index aa99d10ad1..275d41c897 100644 --- a/include/openspace/rendering/abufferrenderer.h +++ b/include/openspace/rendering/abufferrenderer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -112,7 +112,7 @@ private: void saveTextureToMemory(GLenum color_buffer_attachment, int width, int height, std::vector & memory) const; - glm::ivec2 _resolution = glm::ivec2(0, 0); + glm::ivec2 _resolution = glm::ivec2(0); bool _dirtyResolution = true; bool _dirtyRendererData = true; diff --git a/include/openspace/rendering/dashboard.h b/include/openspace/rendering/dashboard.h index 12f10b5a98..019b086773 100644 --- a/include/openspace/rendering/dashboard.h +++ b/include/openspace/rendering/dashboard.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/dashboarditem.h b/include/openspace/rendering/dashboarditem.h index 8814ae712b..e33467a555 100644 --- a/include/openspace/rendering/dashboarditem.h +++ b/include/openspace/rendering/dashboarditem.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/deferredcaster.h b/include/openspace/rendering/deferredcaster.h index 7a1dfc5c18..32e8592f4e 100644 --- a/include/openspace/rendering/deferredcaster.h +++ b/include/openspace/rendering/deferredcaster.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/deferredcasterlistener.h b/include/openspace/rendering/deferredcasterlistener.h index 37cfb3e9ca..067ec2afb6 100644 --- a/include/openspace/rendering/deferredcasterlistener.h +++ b/include/openspace/rendering/deferredcasterlistener.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/deferredcastermanager.h b/include/openspace/rendering/deferredcastermanager.h index 4348f04456..0d6623e066 100644 --- a/include/openspace/rendering/deferredcastermanager.h +++ b/include/openspace/rendering/deferredcastermanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/framebufferrenderer.h b/include/openspace/rendering/framebufferrenderer.h index 7dd048052f..70330f2243 100644 --- a/include/openspace/rendering/framebufferrenderer.h +++ b/include/openspace/rendering/framebufferrenderer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/helper.h b/include/openspace/rendering/helper.h index 834f26ff05..dbe6bfef42 100644 --- a/include/openspace/rendering/helper.h +++ b/include/openspace/rendering/helper.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/loadingscreen.h b/include/openspace/rendering/loadingscreen.h index 0c4a300776..5e3900e8eb 100644 --- a/include/openspace/rendering/loadingscreen.h +++ b/include/openspace/rendering/loadingscreen.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -120,8 +120,8 @@ private: ProgressInfo progress; bool hasLocation; - glm::vec2 ll; - glm::vec2 ur; + glm::vec2 ll = glm::vec2(0.f); + glm::vec2 ur = glm::vec2(0.f); std::chrono::system_clock::time_point finishedTime; }; diff --git a/include/openspace/rendering/luaconsole.h b/include/openspace/rendering/luaconsole.h index e4c02ee9c3..2c4e0e21a9 100644 --- a/include/openspace/rendering/luaconsole.h +++ b/include/openspace/rendering/luaconsole.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/raycasterlistener.h b/include/openspace/rendering/raycasterlistener.h index 382e9553ed..5a0af12e7d 100644 --- a/include/openspace/rendering/raycasterlistener.h +++ b/include/openspace/rendering/raycasterlistener.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/raycastermanager.h b/include/openspace/rendering/raycastermanager.h index 683dbe236b..8aa36ab6d1 100644 --- a/include/openspace/rendering/raycastermanager.h +++ b/include/openspace/rendering/raycastermanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/renderable.h b/include/openspace/rendering/renderable.h index d72a6e1b8c..d43b8f9bb7 100644 --- a/include/openspace/rendering/renderable.h +++ b/include/openspace/rendering/renderable.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index 943c8a0ae0..5216060d6d 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -239,9 +239,9 @@ private: std::shared_ptr _fontLog; struct { - glm::ivec4 rotation; - glm::ivec4 zoom; - glm::ivec4 roll; + glm::ivec4 rotation = glm::ivec4(0); + glm::ivec4 zoom = glm::ivec4(0); + glm::ivec4 roll = glm::ivec4(0); } _cameraButtonLocations; }; diff --git a/include/openspace/rendering/renderer.h b/include/openspace/rendering/renderer.h index d8b38f0450..b587e640f6 100644 --- a/include/openspace/rendering/renderer.h +++ b/include/openspace/rendering/renderer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/screenspacerenderable.h b/include/openspace/rendering/screenspacerenderable.h index abb4a498c9..24d887e1a7 100644 --- a/include/openspace/rendering/screenspacerenderable.h +++ b/include/openspace/rendering/screenspacerenderable.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -107,7 +107,7 @@ protected: properties::FloatProperty _alpha; properties::TriggerProperty _delete; - glm::ivec2 _objectSize; + glm::ivec2 _objectSize = glm::ivec2(0); UniformCache(alpha, modelTransform, viewProj, texture) _uniformCache; std::unique_ptr _shader; }; diff --git a/include/openspace/rendering/transferfunction.h b/include/openspace/rendering/transferfunction.h index b0f02acf21..43edecbd53 100644 --- a/include/openspace/rendering/transferfunction.h +++ b/include/openspace/rendering/transferfunction.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -70,11 +70,11 @@ private: struct MappingKey { MappingKey(float p, const glm::vec4& c): position(p), color(c) {}; - MappingKey(float p): position(p), color(glm::vec4(0.0f)) {}; + MappingKey(float p): position(p), color(glm::vec4(0.f)) {}; bool operator<(const MappingKey& rhs) {return position < rhs.position;}; float position = 0.f; - glm::vec4 color = glm::vec4(0.f, 0.f, 0.f, 0.f); + glm::vec4 color = glm::vec4(0.f); }; } // namespace openspace diff --git a/include/openspace/rendering/volume.h b/include/openspace/rendering/volume.h index 4be0a807c1..c3d40bcaf7 100644 --- a/include/openspace/rendering/volume.h +++ b/include/openspace/rendering/volume.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/rendering/volumeraycaster.h b/include/openspace/rendering/volumeraycaster.h index aa1133606e..29c159f442 100644 --- a/include/openspace/rendering/volumeraycaster.h +++ b/include/openspace/rendering/volumeraycaster.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scene/asset.h b/include/openspace/scene/asset.h index edc6eda3fc..13b7fe650f 100644 --- a/include/openspace/scene/asset.h +++ b/include/openspace/scene/asset.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -61,8 +61,6 @@ public: */ Asset(AssetLoader* loader, SynchronizationWatcher* watcher, std::string assetPath); - ~Asset() = default; - std::string id() const; const std::string& assetFilePath() const; bool hasAssetFile() const; diff --git a/include/openspace/scene/assetlistener.h b/include/openspace/scene/assetlistener.h index d864717b44..60061fd263 100644 --- a/include/openspace/scene/assetlistener.h +++ b/include/openspace/scene/assetlistener.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scene/assetloader.h b/include/openspace/scene/assetloader.h index 49fda6ac13..ea32931835 100644 --- a/include/openspace/scene/assetloader.h +++ b/include/openspace/scene/assetloader.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -61,7 +61,7 @@ class AssetListener; class AssetLoader { public: - AssetLoader(ghoul::lua::LuaState& luaState, SynchronizationWatcher* syncWatcher, + AssetLoader(ghoul::lua::LuaState* luaState, SynchronizationWatcher* syncWatcher, std::string assetRootDirectory); ~AssetLoader(); diff --git a/include/openspace/scene/assetmanager.h b/include/openspace/scene/assetmanager.h index c29b4a9ec1..d279219463 100644 --- a/include/openspace/scene/assetmanager.h +++ b/include/openspace/scene/assetmanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scene/lightsource.h b/include/openspace/scene/lightsource.h index dc06f5552f..ff754e6efb 100644 --- a/include/openspace/scene/lightsource.h +++ b/include/openspace/scene/lightsource.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scene/rotation.h b/include/openspace/scene/rotation.h index 78843a80ee..995543935f 100644 --- a/include/openspace/scene/rotation.h +++ b/include/openspace/scene/rotation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -61,7 +61,7 @@ protected: private: bool _needsUpdate = true; double _cachedTime = -std::numeric_limits::max(); - glm::dmat3 _cachedMatrix; + glm::dmat3 _cachedMatrix = glm::dmat3(1.0); }; } // namespace openspace diff --git a/include/openspace/scene/scale.h b/include/openspace/scene/scale.h index b1481b2aec..ee4a113b20 100644 --- a/include/openspace/scene/scale.h +++ b/include/openspace/scene/scale.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index cfaae6e160..f9bfbf4e4e 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scene/scenegraphnode.h b/include/openspace/scene/scenegraphnode.h index eab4fd6ee6..86bffe0658 100644 --- a/include/openspace/scene/scenegraphnode.h +++ b/include/openspace/scene/scenegraphnode.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -183,14 +183,14 @@ private: std::unique_ptr _timeFrame; // Cached transform data - glm::dvec3 _worldPositionCached; - glm::dmat3 _worldRotationCached; + glm::dvec3 _worldPositionCached = glm::dvec3(0.0); + glm::dmat3 _worldRotationCached = glm::dmat3(1.0); double _worldScaleCached = 1.0; float _fixedBoundingSphere = 0.f; - glm::dmat4 _modelTransformCached; - glm::dmat4 _inverseModelTransformCached; + glm::dmat4 _modelTransformCached = glm::dmat4(1.0); + glm::dmat4 _inverseModelTransformCached = glm::dmat4(1.0); properties::BoolProperty _computeScreenSpaceValues; properties::IVec2Property _screenSpacePosition; diff --git a/include/openspace/scene/sceneinitializer.h b/include/openspace/scene/sceneinitializer.h index 2dd30fc6a3..eb1a4e4c6b 100644 --- a/include/openspace/scene/sceneinitializer.h +++ b/include/openspace/scene/sceneinitializer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scene/scenelicense.h b/include/openspace/scene/scenelicense.h index d2a6e9a822..297ee415a8 100644 --- a/include/openspace/scene/scenelicense.h +++ b/include/openspace/scene/scenelicense.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scene/scenelicensewriter.h b/include/openspace/scene/scenelicensewriter.h index 59270476ab..00a056f85a 100644 --- a/include/openspace/scene/scenelicensewriter.h +++ b/include/openspace/scene/scenelicensewriter.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scene/timeframe.h b/include/openspace/scene/timeframe.h index 41044f63b8..95d5aff38c 100644 --- a/include/openspace/scene/timeframe.h +++ b/include/openspace/scene/timeframe.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scene/translation.h b/include/openspace/scene/translation.h index da506d0f56..9a027f1e07 100644 --- a/include/openspace/scene/translation.h +++ b/include/openspace/scene/translation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scripting/lualibrary.h b/include/openspace/scripting/lualibrary.h index 4c2ff7c663..275d485adc 100644 --- a/include/openspace/scripting/lualibrary.h +++ b/include/openspace/scripting/lualibrary.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scripting/scriptengine.h b/include/openspace/scripting/scriptengine.h index 0ca40db7f0..8914527778 100644 --- a/include/openspace/scripting/scriptengine.h +++ b/include/openspace/scripting/scriptengine.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -50,7 +50,7 @@ namespace openspace::scripting { */ class ScriptEngine : public Syncable, public DocumentationGenerator { public: - using ScriptCallback = std::optional>; + using ScriptCallback = std::function; BooleanType(RemoteScripting); struct QueueItem { diff --git a/include/openspace/scripting/scriptscheduler.h b/include/openspace/scripting/scriptscheduler.h index 9a93cc986c..98327cf41e 100644 --- a/include/openspace/scripting/scriptscheduler.h +++ b/include/openspace/scripting/scriptscheduler.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/scripting/systemcapabilitiesbinding.h b/include/openspace/scripting/systemcapabilitiesbinding.h index a81c7281f9..af4e524fe9 100644 --- a/include/openspace/scripting/systemcapabilitiesbinding.h +++ b/include/openspace/scripting/systemcapabilitiesbinding.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/blockplaneintersectiongeometry.h b/include/openspace/util/blockplaneintersectiongeometry.h index 9f3d787d05..e4f4703f8b 100644 --- a/include/openspace/util/blockplaneintersectiongeometry.h +++ b/include/openspace/util/blockplaneintersectiongeometry.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -47,12 +47,11 @@ public: private: void updateVertices(); std::vector _vertices; - // bool _isInitialized; GLuint _vaoId = 0; GLuint _vBufferId = 0; - glm::vec3 _size; - glm::vec3 _normal; - float _planeDistance; + glm::vec3 _size = glm::vec3(0.f); + glm::vec3 _normal = glm::vec3(0.f); + float _planeDistance = 0.f; }; } // namespace openspace diff --git a/include/openspace/util/boxgeometry.h b/include/openspace/util/boxgeometry.h index 6f694cae2b..9d42e83d1f 100644 --- a/include/openspace/util/boxgeometry.h +++ b/include/openspace/util/boxgeometry.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,7 +41,7 @@ public: GLuint _vaoId = 0; GLuint _vBufferId = 0; - glm::vec3 _size; + glm::vec3 _size = glm::vec3(0.f); }; } // namespace openspace diff --git a/include/openspace/util/camera.h b/include/openspace/util/camera.h index f71564dd82..0ea6ca7285 100644 --- a/include/openspace/util/camera.h +++ b/include/openspace/util/camera.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -58,9 +58,8 @@ public: */ template struct Cached { - Cached() { isDirty = true; } - T datum; - bool isDirty; + T datum = T(0); + bool isDirty = true; }; Camera() = default; @@ -125,9 +124,9 @@ public: SgctInternal() = default; SgctInternal(const SgctInternal& o); - glm::mat4 _sceneMatrix; - glm::mat4 _viewMatrix; - glm::mat4 _projectionMatrix; + glm::mat4 _sceneMatrix = glm::mat4(1.f); + glm::mat4 _viewMatrix = glm::mat4(1.f); + glm::mat4 _projectionMatrix = glm::mat4(1.f); mutable Cached _cachedViewProjectionMatrix; mutable std::mutex _mutex; @@ -155,7 +154,7 @@ private: SceneGraphNode* _parent = nullptr; // _focusPosition to be removed - glm::dvec3 _focusPosition; + glm::dvec3 _focusPosition = glm::dvec3(0.0); float _maxFov = 0.f; // Cached data diff --git a/include/openspace/util/concurrentjobmanager.h b/include/openspace/util/concurrentjobmanager.h index effd5497a2..ddb4331294 100644 --- a/include/openspace/util/concurrentjobmanager.h +++ b/include/openspace/util/concurrentjobmanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/concurrentjobmanager.inl b/include/openspace/util/concurrentjobmanager.inl index 14588f215c..f53897d514 100644 --- a/include/openspace/util/concurrentjobmanager.inl +++ b/include/openspace/util/concurrentjobmanager.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/concurrentqueue.h b/include/openspace/util/concurrentqueue.h index dedaad7c5c..83d7a1aa62 100644 --- a/include/openspace/util/concurrentqueue.h +++ b/include/openspace/util/concurrentqueue.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/concurrentqueue.inl b/include/openspace/util/concurrentqueue.inl index 3392bd7cac..4f150dda2c 100644 --- a/include/openspace/util/concurrentqueue.inl +++ b/include/openspace/util/concurrentqueue.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/distanceconstants.h b/include/openspace/util/distanceconstants.h index 104f14c97e..8bb599cc04 100644 --- a/include/openspace/util/distanceconstants.h +++ b/include/openspace/util/distanceconstants.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/distanceconversion.h b/include/openspace/util/distanceconversion.h index 7a2e2e7ceb..fb37657915 100644 --- a/include/openspace/util/distanceconversion.h +++ b/include/openspace/util/distanceconversion.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/factorymanager.h b/include/openspace/util/factorymanager.h index d68299190f..3edc713b5f 100644 --- a/include/openspace/util/factorymanager.h +++ b/include/openspace/util/factorymanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/factorymanager.inl b/include/openspace/util/factorymanager.inl index bdb85d82c3..0718c3be15 100644 --- a/include/openspace/util/factorymanager.inl +++ b/include/openspace/util/factorymanager.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/histogram.h b/include/openspace/util/histogram.h index 268ad86f4a..92e21898a0 100644 --- a/include/openspace/util/histogram.h +++ b/include/openspace/util/histogram.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/httprequest.h b/include/openspace/util/httprequest.h index 399a4ab0cb..fa08dd4c65 100644 --- a/include/openspace/util/httprequest.h +++ b/include/openspace/util/httprequest.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/job.h b/include/openspace/util/job.h index f7946eaf4a..bce9134c69 100644 --- a/include/openspace/util/job.h +++ b/include/openspace/util/job.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/keys.h b/include/openspace/util/keys.h index 8b6057c6f6..4bcb0b8e23 100644 --- a/include/openspace/util/keys.h +++ b/include/openspace/util/keys.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/mouse.h b/include/openspace/util/mouse.h index 8e9803afc5..a215afa244 100644 --- a/include/openspace/util/mouse.h +++ b/include/openspace/util/mouse.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/openspacemodule.h b/include/openspace/util/openspacemodule.h index 8de0407c82..c1f5a2603e 100644 --- a/include/openspace/util/openspacemodule.h +++ b/include/openspace/util/openspacemodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/progressbar.h b/include/openspace/util/progressbar.h index 293401e83c..8667500c9e 100644 --- a/include/openspace/util/progressbar.h +++ b/include/openspace/util/progressbar.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/resourcesynchronization.h b/include/openspace/util/resourcesynchronization.h index a7e4bcf367..605f049dc1 100644 --- a/include/openspace/util/resourcesynchronization.h +++ b/include/openspace/util/resourcesynchronization.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/screenlog.h b/include/openspace/util/screenlog.h index 29d4890872..c6ded67ff1 100644 --- a/include/openspace/util/screenlog.h +++ b/include/openspace/util/screenlog.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/sphere.h b/include/openspace/util/sphere.h index 47ff24e061..a0e1557b63 100644 --- a/include/openspace/util/sphere.h +++ b/include/openspace/util/sphere.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/spicemanager.h b/include/openspace/util/spicemanager.h index 634a836571..e7afb7aaab 100644 --- a/include/openspace/util/spicemanager.h +++ b/include/openspace/util/spicemanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -566,23 +566,23 @@ public: * The closest surface intercept point on the target body in Cartesian Coordinates * relative to the reference frame. */ - glm::dvec3 surfaceIntercept; + glm::dvec3 surfaceIntercept = glm::dvec3(0.0); /** * If the aberration correction is not AberrationCorrection::Type::None, this * value contains the time for which the intercept was computed. Otherwise it is * the same as the ephemerisTime. */ - double interceptEpoch; + double interceptEpoch = 0.0; /** * The vector from the observer's position to the \p surfaceIntercept position in * the provided reference frame. */ - glm::dvec3 surfaceVector; + glm::dvec3 surfaceVector = glm::dvec3(0.0); /// true if the ray intersects the body, false otherwise - bool interceptFound; + bool interceptFound = false; }; /** @@ -655,14 +655,14 @@ public: /// Struct that is used as the return value from the #targetState method struct TargetStateResult { /// The target position - glm::dvec3 position; + glm::dvec3 position = glm::dvec3(0.0); /// The target velocity - glm::dvec3 velocity; + glm::dvec3 velocity = glm::dvec3(0.0); /// One-way light time between target and observer if /// the aberration correction is enabled - double lightTime; + double lightTime = 0.0; }; /** @@ -780,7 +780,7 @@ public: std::string frameName; /// The direction towards the center of the field of view - glm::dvec3 boresightVector; + glm::dvec3 boresightVector = glm::dvec3(0.0); /// The corners of the field of view's bounding box, not necessarily unit vectors std::vector bounds; @@ -822,14 +822,14 @@ public: struct TerminatorEllipseResult { /// The vector from the target body at #targetEphemerisTime to the observer at /// the original time - glm::dvec3 observerPosition; + glm::dvec3 observerPosition = glm::dvec3(0.0); /// The full list of terminator points specified in the original reference frame std::vector terminatorPoints; /// The local ephemeris time at the target, determined by the original /// aberrationCorrection factor - double targetEphemerisTime; + double targetEphemerisTime = 0.0; }; /** diff --git a/include/openspace/util/syncable.h b/include/openspace/util/syncable.h index 762546fdcb..f3c19e7afd 100644 --- a/include/openspace/util/syncable.h +++ b/include/openspace/util/syncable.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/syncbuffer.h b/include/openspace/util/syncbuffer.h index 8d8f5bb7e7..4f2a7ed370 100644 --- a/include/openspace/util/syncbuffer.h +++ b/include/openspace/util/syncbuffer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/syncbuffer.inl b/include/openspace/util/syncbuffer.inl index 99860e7bdc..fcac31e1e5 100644 --- a/include/openspace/util/syncbuffer.inl +++ b/include/openspace/util/syncbuffer.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/syncdata.h b/include/openspace/util/syncdata.h index 1e2022d2fb..7f3552c5a5 100644 --- a/include/openspace/util/syncdata.h +++ b/include/openspace/util/syncdata.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/syncdata.inl b/include/openspace/util/syncdata.inl index 9352b56334..b0a39e4ae0 100644 --- a/include/openspace/util/syncdata.inl +++ b/include/openspace/util/syncdata.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/synchronizationwatcher.h b/include/openspace/util/synchronizationwatcher.h index 46cc9c2b23..fe8bac8e40 100644 --- a/include/openspace/util/synchronizationwatcher.h +++ b/include/openspace/util/synchronizationwatcher.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/task.h b/include/openspace/util/task.h index 97cbd32b7d..ef7e280dcd 100644 --- a/include/openspace/util/task.h +++ b/include/openspace/util/task.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/taskloader.h b/include/openspace/util/taskloader.h index e484aa65d1..6a598df9e5 100644 --- a/include/openspace/util/taskloader.h +++ b/include/openspace/util/taskloader.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/threadpool.h b/include/openspace/util/threadpool.h index de91dd9863..ba596fc732 100644 --- a/include/openspace/util/threadpool.h +++ b/include/openspace/util/threadpool.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/time.h b/include/openspace/util/time.h index d784ac2426..d98cd896cb 100644 --- a/include/openspace/util/time.h +++ b/include/openspace/util/time.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/timeconversion.h b/include/openspace/util/timeconversion.h index 19f5f1e984..0ec2feca49 100644 --- a/include/openspace/util/timeconversion.h +++ b/include/openspace/util/timeconversion.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/timeline.h b/include/openspace/util/timeline.h index 81f2a9687b..ea2b31f135 100644 --- a/include/openspace/util/timeline.h +++ b/include/openspace/util/timeline.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/timeline.inl b/include/openspace/util/timeline.inl index d2811a6aee..5ceae3d875 100644 --- a/include/openspace/util/timeline.inl +++ b/include/openspace/util/timeline.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/timemanager.h b/include/openspace/util/timemanager.h index 523ec5da5b..6a29f82faa 100644 --- a/include/openspace/util/timemanager.h +++ b/include/openspace/util/timemanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/timerange.h b/include/openspace/util/timerange.h index 47e40ccbb9..8b56bfb996 100644 --- a/include/openspace/util/timerange.h +++ b/include/openspace/util/timerange.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/touch.h b/include/openspace/util/touch.h index 5871094fb6..cb9a6e71da 100644 --- a/include/openspace/util/touch.h +++ b/include/openspace/util/touch.h @@ -25,7 +25,7 @@ #ifndef __OPENSPACE_CORE___TOUCH___H__ #define __OPENSPACE_CORE___TOUCH___H__ -#include +#include #include #include diff --git a/include/openspace/util/transformationmanager.h b/include/openspace/util/transformationmanager.h index 50066f601e..abd1361351 100644 --- a/include/openspace/util/transformationmanager.h +++ b/include/openspace/util/transformationmanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/include/openspace/util/updatestructures.h b/include/openspace/util/updatestructures.h index 406181eebc..0e5281554f 100644 --- a/include/openspace/util/updatestructures.h +++ b/include/openspace/util/updatestructures.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -36,9 +36,9 @@ class VolumeRaycaster; struct InitializeData {}; struct TransformData { - glm::dvec3 translation; - glm::dmat3 rotation; - double scale; + glm::dvec3 translation = glm::dvec3(0.0); + glm::dmat3 rotation = glm::dmat3(1.0); + double scale = 0.0; }; struct UpdateData { @@ -51,8 +51,8 @@ struct UpdateData { struct RenderData { const Camera& camera; const Time time; - bool doPerformanceMeasurement; - int renderBinMask; + bool doPerformanceMeasurement = false; + int renderBinMask = -1; TransformData modelTransform; }; @@ -72,12 +72,12 @@ struct RendererTasks { }; struct RaycastData { - int id; + int id = -1; std::string namespaceName; }; struct DeferredcastData { - int id; + int id = -1; std::string namespaceName; }; @@ -87,13 +87,13 @@ struct DeferredcastData { */ struct SurfacePositionHandle { /// Vector from the center of the object to the reference surface of the object - glm::dvec3 centerToReferenceSurface; + glm::dvec3 centerToReferenceSurface = glm::dvec3(0.0); /// Direction out from the reference. Can conincide with the surface normal but does /// not have to. - glm::dvec3 referenceSurfaceOutDirection; + glm::dvec3 referenceSurfaceOutDirection = glm::dvec3(0.0); /// Height from the reference surface out to the actual surface in the direction of /// the surface normal. Can be positive or negative. - double heightToSurface; + double heightToSurface = 0.0; }; } // namespace openspace diff --git a/include/openspace/util/versionchecker.h b/include/openspace/util/versionchecker.h index 4d3776dd46..fb4c513e45 100644 --- a/include/openspace/util/versionchecker.h +++ b/include/openspace/util/versionchecker.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/CMakeLists.txt b/modules/atmosphere/CMakeLists.txt index 4cb7e5ebbe..68f88ebda5 100644 --- a/modules/atmosphere/CMakeLists.txt +++ b/modules/atmosphere/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/atmosphere/atmospheremodule.cpp b/modules/atmosphere/atmospheremodule.cpp index 2d56790860..94fb594ef0 100644 --- a/modules/atmosphere/atmospheremodule.cpp +++ b/modules/atmosphere/atmospheremodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/atmospheremodule.h b/modules/atmosphere/atmospheremodule.h index f7100dd181..6b89bc761f 100644 --- a/modules/atmosphere/atmospheremodule.h +++ b/modules/atmosphere/atmospheremodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/rendering/atmospheredeferredcaster.cpp b/modules/atmosphere/rendering/atmospheredeferredcaster.cpp index 3cb7b040ff..81a6d0bfaf 100644 --- a/modules/atmosphere/rendering/atmospheredeferredcaster.cpp +++ b/modules/atmosphere/rendering/atmospheredeferredcaster.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -115,58 +115,6 @@ namespace { namespace openspace { -AtmosphereDeferredcaster::AtmosphereDeferredcaster() - : _transmittanceProgramObject(nullptr) - , _irradianceProgramObject(nullptr) - , _irradianceSupTermsProgramObject(nullptr) - , _irradianceFinalProgramObject(nullptr) - , _inScatteringProgramObject(nullptr) - , _inScatteringSupTermsProgramObject(nullptr) - , _deltaEProgramObject(nullptr) - , _deltaSProgramObject(nullptr) - , _deltaSSupTermsProgramObject(nullptr) - , _deltaJProgramObject(nullptr) - , _atmosphereProgramObject(nullptr) - , _transmittanceTableTexture(0) - , _irradianceTableTexture(0) - , _inScatteringTableTexture(0) - , _deltaETableTexture(0) - , _deltaSRayleighTableTexture(0) - , _deltaSMieTableTexture(0) - , _deltaJTableTexture(0) - , _atmosphereTexture(0) - , _atmosphereCalculated(false) - , _ozoneEnabled(false) - , _sunFollowingCameraEnabled(false) - , _atmosphereRadius(0.f) - , _atmospherePlanetRadius(0.f) - , _planetAverageGroundReflectance(0.f) - , _planetGroundRadianceEmittion(0.f) - , _rayleighHeightScale(0.f) - , _ozoneHeightScale(0.f) - , _mieHeightScale(0.f) - , _miePhaseConstant(0.f) - , _sunRadianceIntensity(5.f) - , _rayleighScatteringCoeff(glm::vec3(0.f)) - , _ozoneExtinctionCoeff(glm::vec3(0.f)) - , _mieScatteringCoeff(glm::vec3(0.f)) - , _mieExtinctionCoeff(glm::vec3(0.f)) - , _ellipsoidRadii(glm::dvec3(0.0)) - , _transmittance_table_width(256) - , _transmittance_table_height(64) - , _irradiance_table_width(64) - , _irradiance_table_height(16) - , _delta_e_table_width(64) - , _delta_e_table_height(16) - , _r_samples(32) - , _mu_samples(128) - , _mu_s_samples(32) - , _nu_samples(8) - , _hardShadowsEnabled(false) - , _calculationTextureScale(1.0) - , _saveCalculationTextures(false) -{} - void AtmosphereDeferredcaster::initialize() { if (!_atmosphereCalculated) { preCalculateAtmosphereParam(); diff --git a/modules/atmosphere/rendering/atmospheredeferredcaster.h b/modules/atmosphere/rendering/atmospheredeferredcaster.h index 6c0af90d37..80da5a2a6c 100644 --- a/modules/atmosphere/rendering/atmospheredeferredcaster.h +++ b/modules/atmosphere/rendering/atmospheredeferredcaster.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -47,7 +47,6 @@ struct ShadowConfiguration; class AtmosphereDeferredcaster : public Deferredcaster { public: - AtmosphereDeferredcaster(); virtual ~AtmosphereDeferredcaster() = default; void initialize(); @@ -140,61 +139,61 @@ private: hardShadows, transmittanceTexture, irradianceTexture, inscatterTexture) _uniformCache2; - GLuint _transmittanceTableTexture; - GLuint _irradianceTableTexture; - GLuint _inScatteringTableTexture; - GLuint _deltaETableTexture; - GLuint _deltaSRayleighTableTexture; - GLuint _deltaSMieTableTexture; - GLuint _deltaJTableTexture; - GLuint _atmosphereTexture; + GLuint _transmittanceTableTexture = 0; + GLuint _irradianceTableTexture = 0; + GLuint _inScatteringTableTexture = 0; + GLuint _deltaETableTexture = 0; + GLuint _deltaSRayleighTableTexture = 0; + GLuint _deltaSMieTableTexture = 0; + GLuint _deltaJTableTexture = 0; + GLuint _atmosphereTexture = 0; ghoul::opengl::TextureUnit _transmittanceTableTextureUnit; ghoul::opengl::TextureUnit _irradianceTableTextureUnit; ghoul::opengl::TextureUnit _inScatteringTableTextureUnit; // Atmosphere Data - bool _atmosphereCalculated; - bool _ozoneEnabled; - bool _sunFollowingCameraEnabled; - float _atmosphereRadius; - float _atmospherePlanetRadius; - float _planetAverageGroundReflectance; - float _planetGroundRadianceEmittion; - float _rayleighHeightScale; - float _ozoneHeightScale; - float _mieHeightScale; - float _miePhaseConstant; - float _sunRadianceIntensity; + bool _atmosphereCalculated = false; + bool _ozoneEnabled = false; + bool _sunFollowingCameraEnabled = false; + float _atmosphereRadius = 0.f; + float _atmospherePlanetRadius = 0.f; + float _planetAverageGroundReflectance = 0.f; + float _planetGroundRadianceEmittion = 0.f; + float _rayleighHeightScale = 0.f; + float _ozoneHeightScale = 0.f; + float _mieHeightScale = 0.f; + float _miePhaseConstant = 0.f; + float _sunRadianceIntensity = 5.f; - glm::vec3 _rayleighScatteringCoeff; - glm::vec3 _ozoneExtinctionCoeff; - glm::vec3 _mieScatteringCoeff; - glm::vec3 _mieExtinctionCoeff; - glm::dvec3 _ellipsoidRadii; + glm::vec3 _rayleighScatteringCoeff = glm::vec3(0.f); + glm::vec3 _ozoneExtinctionCoeff = glm::vec3(0.f); + glm::vec3 _mieScatteringCoeff = glm::vec3(0.f); + glm::vec3 _mieExtinctionCoeff = glm::vec3(0.f); + glm::dvec3 _ellipsoidRadii = glm::vec3(0.f); // Atmosphere Textures Dimmensions - int _transmittance_table_width; - int _transmittance_table_height; - int _irradiance_table_width; - int _irradiance_table_height; - int _delta_e_table_width; - int _delta_e_table_height; - int _r_samples; - int _mu_samples; - int _mu_s_samples; - int _nu_samples; + int _transmittance_table_width = 256; + int _transmittance_table_height = 64; + int _irradiance_table_width = 64; + int _irradiance_table_height = 16; + int _delta_e_table_width = 64; + int _delta_e_table_height = 16; + int _r_samples = 32; + int _mu_samples = 128; + int _mu_s_samples = 32; + int _nu_samples = 8; glm::dmat4 _modelTransform; double _time = 0.0; // Eclipse Shadows std::vector _shadowConfArray; - bool _hardShadowsEnabled; + bool _hardShadowsEnabled = false; // Atmosphere Debugging - float _calculationTextureScale; - bool _saveCalculationTextures; + float _calculationTextureScale = 1.f; + bool _saveCalculationTextures = false; }; } // openspace diff --git a/modules/atmosphere/rendering/renderableatmosphere.cpp b/modules/atmosphere/rendering/renderableatmosphere.cpp index fd931c251f..671cc2c3c9 100644 --- a/modules/atmosphere/rendering/renderableatmosphere.cpp +++ b/modules/atmosphere/rendering/renderableatmosphere.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -254,27 +254,6 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) , _sunIntensityP(SunIntensityInfo, 50.0f, 0.1f, 1000.0f) , _sunFollowingCameraEnabledP(EnableSunOnCameraPositionInfo, false) , _hardShadowsEnabledP(EclipseHardShadowsInfo, false) - , _atmosphereEnabled(false) - , _ozoneLayerEnabled(false) - , _sunFollowingCameraEnabled(false) - , _atmosphereRadius(0.f) - , _atmospherePlanetRadius(0.f) - , _planetAverageGroundReflectance(0.f) - , _planetGroundRadianceEmittion(0.f) - , _rayleighHeightScale(0.f) - , _ozoneHeightScale(0.f) - , _mieHeightScale(0.f) - , _miePhaseConstant(0.f) - , _sunRadianceIntensity(5.f) - , _mieScattExtPropCoefProp(1.f) - , _mieExtinctionCoeff(glm::vec3(0.f)) - , _rayleighScatteringCoeff(glm::vec3(0.f)) - , _ozoneExtinctionCoeff(glm::vec3(0.f)) - , _mieScatteringCoeff(glm::vec3(0.f)) - , _saveCalculationsToTexture(false) - , _preCalculatedTexturesScale(1.0) - , _shadowEnabled(false) - , _hardShadows(false) { ghoul_precondition( dictionary.hasKeyAndValue(SceneGraphNode::KeyIdentifier), @@ -433,7 +412,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) if (success) { // Not using right now. - glm::vec3 rayleighWavelengths; + glm::vec3 rayleighWavelengths = glm::vec3(0.f); rayleighDictionary.getValue( "Coefficients.Wavelengths", rayleighWavelengths @@ -452,8 +431,9 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) } if (!rayleighDictionary.getValue( - keyRayleighHeightScale, - _rayleighHeightScale)) + keyRayleighHeightScale, + _rayleighHeightScale) + ) { errorReadingAtmosphereData = true; LWARNINGC( diff --git a/modules/atmosphere/rendering/renderableatmosphere.h b/modules/atmosphere/rendering/renderableatmosphere.h index 202933b593..a2cfa7f158 100644 --- a/modules/atmosphere/rendering/renderableatmosphere.h +++ b/modules/atmosphere/rendering/renderableatmosphere.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -59,13 +59,13 @@ struct ShadowConfiguration { }; struct ShadowRenderingStruct { - double xu; - double xp; - double rs; - double rc; - glm::dvec3 sourceCasterVec; - glm::dvec3 casterPositionVec; - bool isShadowing; + double xu = 0.0; + double xp = 0.0; + double rs = 0.0; + double rc = 0.0; + glm::dvec3 sourceCasterVec = glm::dvec3(0.0); + glm::dvec3 casterPositionVec = glm::dvec3(0.0); + bool isShadowing = false; }; namespace documentation { struct Documentation; } @@ -110,35 +110,35 @@ private: properties::BoolProperty _sunFollowingCameraEnabledP; properties::BoolProperty _hardShadowsEnabledP; - bool _atmosphereEnabled; - bool _ozoneLayerEnabled; - bool _sunFollowingCameraEnabled; - float _atmosphereRadius; - float _atmospherePlanetRadius; - float _planetAverageGroundReflectance; - float _planetGroundRadianceEmittion; - float _rayleighHeightScale; - float _ozoneHeightScale; - float _mieHeightScale; - float _miePhaseConstant; - float _sunRadianceIntensity; - float _mieScattExtPropCoefProp; + bool _atmosphereEnabled = false; + bool _ozoneLayerEnabled = false; + bool _sunFollowingCameraEnabled = false; + float _atmosphereRadius = 0.f; + float _atmospherePlanetRadius = 0.f; + float _planetAverageGroundReflectance = 0.f; + float _planetGroundRadianceEmittion = 0.f; + float _rayleighHeightScale = 0.f; + float _ozoneHeightScale = 0.f; + float _mieHeightScale = 0.f; + float _miePhaseConstant = 0.f; + float _sunRadianceIntensity = 5.f; + float _mieScattExtPropCoefProp = 1.f; - glm::vec3 _mieExtinctionCoeff; - glm::vec3 _rayleighScatteringCoeff; - glm::vec3 _ozoneExtinctionCoeff; - glm::vec3 _mieScatteringCoeff; + glm::vec3 _mieExtinctionCoeff = glm::vec3(0.f); + glm::vec3 _rayleighScatteringCoeff = glm::vec3(0.f); + glm::vec3 _ozoneExtinctionCoeff = glm::vec3(0.f); + glm::vec3 _mieScatteringCoeff = glm::dvec3(0.f); // Atmosphere Debug - bool _saveCalculationsToTexture; - float _preCalculatedTexturesScale; + bool _saveCalculationsToTexture = false; + float _preCalculatedTexturesScale = 1.f; std::unique_ptr _deferredcaster; - bool _shadowEnabled; - bool _hardShadows; + bool _shadowEnabled = false; + bool _hardShadows = false; - glm::dmat3 _stateMatrix; + glm::dmat3 _stateMatrix = glm::dmat3(1.0); std::vector _shadowConfArray; }; diff --git a/modules/atmosphere/shaders/atmosphere_common.glsl b/modules/atmosphere/shaders/atmosphere_common.glsl index 8be26b6e53..07887b12a9 100644 --- a/modules/atmosphere/shaders/atmosphere_common.glsl +++ b/modules/atmosphere/shaders/atmosphere_common.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/atmosphere_deferred_fs.glsl b/modules/atmosphere/shaders/atmosphere_deferred_fs.glsl index d7a788322a..54a356dcc4 100644 --- a/modules/atmosphere/shaders/atmosphere_deferred_fs.glsl +++ b/modules/atmosphere/shaders/atmosphere_deferred_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -414,11 +414,10 @@ vec3 inscatterRadiance(inout vec3 x, inout float t, inout float irradianceFactor return finalScatteringRadiance; } else { //return ((r-Rg) * invRtMinusRg)*spaceColor.rgb + finalScatteringRadiance; - return attenuation * spaceColor.rgb + finalScatteringRadiance; + return spaceColor.rgb + finalScatteringRadiance; // return attenuation * spaceColor.rgb + // (vec3(1.0) - attenuation) * finalScatteringRadiance; - } - + } } /* diff --git a/modules/atmosphere/shaders/atmosphere_deferred_vs.glsl b/modules/atmosphere/shaders/atmosphere_deferred_vs.glsl index 33f0eb1651..f211ee9b42 100644 --- a/modules/atmosphere/shaders/atmosphere_deferred_vs.glsl +++ b/modules/atmosphere/shaders/atmosphere_deferred_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaE_calc_fs.glsl b/modules/atmosphere/shaders/deltaE_calc_fs.glsl index b845c2ae67..6ce7053b56 100644 --- a/modules/atmosphere/shaders/deltaE_calc_fs.glsl +++ b/modules/atmosphere/shaders/deltaE_calc_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaE_calc_vs.glsl b/modules/atmosphere/shaders/deltaE_calc_vs.glsl index a85594b7d2..fad2402e2a 100644 --- a/modules/atmosphere/shaders/deltaE_calc_vs.glsl +++ b/modules/atmosphere/shaders/deltaE_calc_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaJ_calc_fs.glsl b/modules/atmosphere/shaders/deltaJ_calc_fs.glsl index 56114090c8..088267c6f0 100644 --- a/modules/atmosphere/shaders/deltaJ_calc_fs.glsl +++ b/modules/atmosphere/shaders/deltaJ_calc_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaJ_calc_gs.glsl b/modules/atmosphere/shaders/deltaJ_calc_gs.glsl index bc9987eab3..2756507b85 100644 --- a/modules/atmosphere/shaders/deltaJ_calc_gs.glsl +++ b/modules/atmosphere/shaders/deltaJ_calc_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaJ_calc_vs.glsl b/modules/atmosphere/shaders/deltaJ_calc_vs.glsl index a85594b7d2..fad2402e2a 100644 --- a/modules/atmosphere/shaders/deltaJ_calc_vs.glsl +++ b/modules/atmosphere/shaders/deltaJ_calc_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaS_calc_fs.glsl b/modules/atmosphere/shaders/deltaS_calc_fs.glsl index ea2151793b..055888f2d5 100644 --- a/modules/atmosphere/shaders/deltaS_calc_fs.glsl +++ b/modules/atmosphere/shaders/deltaS_calc_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaS_calc_gs.glsl b/modules/atmosphere/shaders/deltaS_calc_gs.glsl index bc9987eab3..2756507b85 100644 --- a/modules/atmosphere/shaders/deltaS_calc_gs.glsl +++ b/modules/atmosphere/shaders/deltaS_calc_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaS_calc_vs.glsl b/modules/atmosphere/shaders/deltaS_calc_vs.glsl index a85594b7d2..fad2402e2a 100644 --- a/modules/atmosphere/shaders/deltaS_calc_vs.glsl +++ b/modules/atmosphere/shaders/deltaS_calc_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaS_sup_calc_fs.glsl b/modules/atmosphere/shaders/deltaS_sup_calc_fs.glsl index 9625840f45..bc32a189e5 100644 --- a/modules/atmosphere/shaders/deltaS_sup_calc_fs.glsl +++ b/modules/atmosphere/shaders/deltaS_sup_calc_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaS_sup_calc_gs.glsl b/modules/atmosphere/shaders/deltaS_sup_calc_gs.glsl index c9ca35e88c..61f1cd1805 100644 --- a/modules/atmosphere/shaders/deltaS_sup_calc_gs.glsl +++ b/modules/atmosphere/shaders/deltaS_sup_calc_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/deltaS_sup_calc_vs.glsl b/modules/atmosphere/shaders/deltaS_sup_calc_vs.glsl index 3988002d04..74c77c3837 100644 --- a/modules/atmosphere/shaders/deltaS_sup_calc_vs.glsl +++ b/modules/atmosphere/shaders/deltaS_sup_calc_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/inScattering_calc_fs.glsl b/modules/atmosphere/shaders/inScattering_calc_fs.glsl index 87fe562553..fc8adbda28 100644 --- a/modules/atmosphere/shaders/inScattering_calc_fs.glsl +++ b/modules/atmosphere/shaders/inScattering_calc_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/inScattering_calc_gs.glsl b/modules/atmosphere/shaders/inScattering_calc_gs.glsl index c3bcf0c6fe..5bdbacc9d9 100644 --- a/modules/atmosphere/shaders/inScattering_calc_gs.glsl +++ b/modules/atmosphere/shaders/inScattering_calc_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/inScattering_calc_vs.glsl b/modules/atmosphere/shaders/inScattering_calc_vs.glsl index a85594b7d2..fad2402e2a 100644 --- a/modules/atmosphere/shaders/inScattering_calc_vs.glsl +++ b/modules/atmosphere/shaders/inScattering_calc_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/inScattering_sup_calc_fs.glsl b/modules/atmosphere/shaders/inScattering_sup_calc_fs.glsl index 0cb4290902..8bb50ef4bf 100644 --- a/modules/atmosphere/shaders/inScattering_sup_calc_fs.glsl +++ b/modules/atmosphere/shaders/inScattering_sup_calc_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/inScattering_sup_calc_gs.glsl b/modules/atmosphere/shaders/inScattering_sup_calc_gs.glsl index c9ca35e88c..61f1cd1805 100644 --- a/modules/atmosphere/shaders/inScattering_sup_calc_gs.glsl +++ b/modules/atmosphere/shaders/inScattering_sup_calc_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/inScattering_sup_calc_vs.glsl b/modules/atmosphere/shaders/inScattering_sup_calc_vs.glsl index 3988002d04..74c77c3837 100644 --- a/modules/atmosphere/shaders/inScattering_sup_calc_vs.glsl +++ b/modules/atmosphere/shaders/inScattering_sup_calc_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/irradiance_calc_fs.glsl b/modules/atmosphere/shaders/irradiance_calc_fs.glsl index fe14612948..4891fce05b 100644 --- a/modules/atmosphere/shaders/irradiance_calc_fs.glsl +++ b/modules/atmosphere/shaders/irradiance_calc_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/irradiance_calc_vs.glsl b/modules/atmosphere/shaders/irradiance_calc_vs.glsl index a85594b7d2..fad2402e2a 100644 --- a/modules/atmosphere/shaders/irradiance_calc_vs.glsl +++ b/modules/atmosphere/shaders/irradiance_calc_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/irradiance_final_fs.glsl b/modules/atmosphere/shaders/irradiance_final_fs.glsl index 33b17b126f..64b0a547e5 100644 --- a/modules/atmosphere/shaders/irradiance_final_fs.glsl +++ b/modules/atmosphere/shaders/irradiance_final_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/irradiance_final_vs.glsl b/modules/atmosphere/shaders/irradiance_final_vs.glsl index 84a3c2750e..fd0c83d4cb 100644 --- a/modules/atmosphere/shaders/irradiance_final_vs.glsl +++ b/modules/atmosphere/shaders/irradiance_final_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/irradiance_sup_calc_fs.glsl b/modules/atmosphere/shaders/irradiance_sup_calc_fs.glsl index e381d2e6f2..72e2f58a04 100644 --- a/modules/atmosphere/shaders/irradiance_sup_calc_fs.glsl +++ b/modules/atmosphere/shaders/irradiance_sup_calc_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/irradiance_sup_calc_vs.glsl b/modules/atmosphere/shaders/irradiance_sup_calc_vs.glsl index a85594b7d2..fad2402e2a 100644 --- a/modules/atmosphere/shaders/irradiance_sup_calc_vs.glsl +++ b/modules/atmosphere/shaders/irradiance_sup_calc_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/transmittance_calc_fs.glsl b/modules/atmosphere/shaders/transmittance_calc_fs.glsl index 2eebbfa582..479a729b00 100644 --- a/modules/atmosphere/shaders/transmittance_calc_fs.glsl +++ b/modules/atmosphere/shaders/transmittance_calc_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/atmosphere/shaders/transmittance_calc_vs.glsl b/modules/atmosphere/shaders/transmittance_calc_vs.glsl index 9927f4b026..0f972cb4e3 100644 --- a/modules/atmosphere/shaders/transmittance_calc_vs.glsl +++ b/modules/atmosphere/shaders/transmittance_calc_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/CMakeLists.txt b/modules/base/CMakeLists.txt index 18a9c74159..472ed85e74 100644 --- a/modules/base/CMakeLists.txt +++ b/modules/base/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/base/basemodule.cpp b/modules/base/basemodule.cpp index 1b6f3d8398..cf79f7b00c 100644 --- a/modules/base/basemodule.cpp +++ b/modules/base/basemodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/basemodule.h b/modules/base/basemodule.h index ceeca7da28..be3e54889c 100644 --- a/modules/base/basemodule.h +++ b/modules/base/basemodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemangle.cpp b/modules/base/dashboard/dashboarditemangle.cpp index 3c2bd88682..aaeb8cb6e1 100644 --- a/modules/base/dashboard/dashboarditemangle.cpp +++ b/modules/base/dashboard/dashboarditemangle.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemangle.h b/modules/base/dashboard/dashboarditemangle.h index 40f39a0fcb..21791cc63b 100644 --- a/modules/base/dashboard/dashboarditemangle.h +++ b/modules/base/dashboard/dashboarditemangle.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemdate.cpp b/modules/base/dashboard/dashboarditemdate.cpp index 0f6815e7be..f0e5f21d0e 100644 --- a/modules/base/dashboard/dashboarditemdate.cpp +++ b/modules/base/dashboard/dashboarditemdate.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemdate.h b/modules/base/dashboard/dashboarditemdate.h index 560b59f730..139b03477a 100644 --- a/modules/base/dashboard/dashboarditemdate.h +++ b/modules/base/dashboard/dashboarditemdate.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemdistance.cpp b/modules/base/dashboard/dashboarditemdistance.cpp index 7cb68aac93..1f986c4595 100644 --- a/modules/base/dashboard/dashboarditemdistance.cpp +++ b/modules/base/dashboard/dashboarditemdistance.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -385,7 +385,7 @@ std::pair DashboardItemDistance::positionAndLabel( return { mainComp.node->worldPosition(), mainComp.node->guiName() }; case Type::NodeSurface: { - glm::dvec3 otherPos; + glm::dvec3 otherPos = glm::dvec3(0.0); if (otherComp.type == Type::NodeSurface) { // We are only interested in the direction, and we want to prevent // infinite recursion diff --git a/modules/base/dashboard/dashboarditemdistance.h b/modules/base/dashboard/dashboarditemdistance.h index 480f500f6d..aab5098bfb 100644 --- a/modules/base/dashboard/dashboarditemdistance.h +++ b/modules/base/dashboard/dashboarditemdistance.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemframerate.cpp b/modules/base/dashboard/dashboarditemframerate.cpp index bdc10a49a0..7e7c31f59b 100644 --- a/modules/base/dashboard/dashboarditemframerate.cpp +++ b/modules/base/dashboard/dashboarditemframerate.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemframerate.h b/modules/base/dashboard/dashboarditemframerate.h index 1a3b22bb00..2b1b8c2de9 100644 --- a/modules/base/dashboard/dashboarditemframerate.h +++ b/modules/base/dashboard/dashboarditemframerate.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemmission.cpp b/modules/base/dashboard/dashboarditemmission.cpp index 19b3c6c7cb..8fc99bb908 100644 --- a/modules/base/dashboard/dashboarditemmission.cpp +++ b/modules/base/dashboard/dashboarditemmission.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemmission.h b/modules/base/dashboard/dashboarditemmission.h index 91e27bb107..bce6364865 100644 --- a/modules/base/dashboard/dashboarditemmission.h +++ b/modules/base/dashboard/dashboarditemmission.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemparallelconnection.cpp b/modules/base/dashboard/dashboarditemparallelconnection.cpp index d012d18c97..c894446637 100644 --- a/modules/base/dashboard/dashboarditemparallelconnection.cpp +++ b/modules/base/dashboard/dashboarditemparallelconnection.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemparallelconnection.h b/modules/base/dashboard/dashboarditemparallelconnection.h index 2e1976066e..5c0bb7f1f5 100644 --- a/modules/base/dashboard/dashboarditemparallelconnection.h +++ b/modules/base/dashboard/dashboarditemparallelconnection.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditempropertyvalue.cpp b/modules/base/dashboard/dashboarditempropertyvalue.cpp index 4a60c7415a..77f9c5fa7c 100644 --- a/modules/base/dashboard/dashboarditempropertyvalue.cpp +++ b/modules/base/dashboard/dashboarditempropertyvalue.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditempropertyvalue.h b/modules/base/dashboard/dashboarditempropertyvalue.h index 8266769cad..0f5a475e02 100644 --- a/modules/base/dashboard/dashboarditempropertyvalue.h +++ b/modules/base/dashboard/dashboarditempropertyvalue.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemsimulationincrement.cpp b/modules/base/dashboard/dashboarditemsimulationincrement.cpp index 7dec612f45..e0aa1da825 100644 --- a/modules/base/dashboard/dashboarditemsimulationincrement.cpp +++ b/modules/base/dashboard/dashboarditemsimulationincrement.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemsimulationincrement.h b/modules/base/dashboard/dashboarditemsimulationincrement.h index 35134dc4db..389778f0c2 100644 --- a/modules/base/dashboard/dashboarditemsimulationincrement.h +++ b/modules/base/dashboard/dashboarditemsimulationincrement.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemspacing.cpp b/modules/base/dashboard/dashboarditemspacing.cpp index 3124cea06a..7b9f98977f 100644 --- a/modules/base/dashboard/dashboarditemspacing.cpp +++ b/modules/base/dashboard/dashboarditemspacing.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemspacing.h b/modules/base/dashboard/dashboarditemspacing.h index 5eb23c9751..d3b48199a8 100644 --- a/modules/base/dashboard/dashboarditemspacing.h +++ b/modules/base/dashboard/dashboarditemspacing.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemvelocity.cpp b/modules/base/dashboard/dashboarditemvelocity.cpp index a6cf5f03f4..aa0d42f394 100644 --- a/modules/base/dashboard/dashboarditemvelocity.cpp +++ b/modules/base/dashboard/dashboarditemvelocity.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/dashboard/dashboarditemvelocity.h b/modules/base/dashboard/dashboarditemvelocity.h index 6a7d5ae5a1..2fcfa4ef16 100644 --- a/modules/base/dashboard/dashboarditemvelocity.h +++ b/modules/base/dashboard/dashboarditemvelocity.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -58,7 +58,7 @@ private: properties::BoolProperty _doSimplification; properties::OptionProperty _requestedUnit; - glm::dvec3 _prevPosition; + glm::dvec3 _prevPosition = glm::dvec3(0.0); std::shared_ptr _font; }; diff --git a/modules/base/lightsource/cameralightsource.cpp b/modules/base/lightsource/cameralightsource.cpp index be7d6974a8..ade1fce643 100644 --- a/modules/base/lightsource/cameralightsource.cpp +++ b/modules/base/lightsource/cameralightsource.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/lightsource/cameralightsource.h b/modules/base/lightsource/cameralightsource.h index 312d23b201..fea98d94a3 100644 --- a/modules/base/lightsource/cameralightsource.h +++ b/modules/base/lightsource/cameralightsource.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/lightsource/scenegraphlightsource.cpp b/modules/base/lightsource/scenegraphlightsource.cpp index 905524ca17..628b8586bd 100644 --- a/modules/base/lightsource/scenegraphlightsource.cpp +++ b/modules/base/lightsource/scenegraphlightsource.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/lightsource/scenegraphlightsource.h b/modules/base/lightsource/scenegraphlightsource.h index e4d6b7a602..f1d4ed7b52 100644 --- a/modules/base/lightsource/scenegraphlightsource.h +++ b/modules/base/lightsource/scenegraphlightsource.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/modelgeometry.cpp b/modules/base/rendering/modelgeometry.cpp index bbd4a1873b..1fee2ed0cd 100644 --- a/modules/base/rendering/modelgeometry.cpp +++ b/modules/base/rendering/modelgeometry.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/modelgeometry.h b/modules/base/rendering/modelgeometry.h index 0535052703..8251fd4be3 100644 --- a/modules/base/rendering/modelgeometry.h +++ b/modules/base/rendering/modelgeometry.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/multimodelgeometry.cpp b/modules/base/rendering/multimodelgeometry.cpp index c59a815ea5..96bed213a3 100644 --- a/modules/base/rendering/multimodelgeometry.cpp +++ b/modules/base/rendering/multimodelgeometry.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/multimodelgeometry.h b/modules/base/rendering/multimodelgeometry.h index 2b26169ccd..c8d2c116a9 100644 --- a/modules/base/rendering/multimodelgeometry.h +++ b/modules/base/rendering/multimodelgeometry.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderableboxgrid.cpp b/modules/base/rendering/renderableboxgrid.cpp index 0ea998333f..c224cec84b 100644 --- a/modules/base/rendering/renderableboxgrid.cpp +++ b/modules/base/rendering/renderableboxgrid.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -265,14 +265,14 @@ void RenderableBoxGrid::update(const UpdateData&) { // 0 -> 1 -> 2 -> 3 -> 0 -> 4 -> 5 -> 6 -> 7 -> 4 -> 5(d) -> 1 -> 2(d) -> 6 // -> 7(d) -> 3 - const glm::vec3 v0 = { llf.x, llf.y, llf.z }; - const glm::vec3 v1 = { urb.x, llf.y, llf.z }; - const glm::vec3 v2 = { urb.x, urb.y, llf.z }; - const glm::vec3 v3 = { llf.x, urb.y, llf.z }; - const glm::vec3 v4 = { llf.x, llf.y, urb.z }; - const glm::vec3 v5 = { urb.x, llf.y, urb.z }; - const glm::vec3 v6 = { urb.x, urb.y, urb.z }; - const glm::vec3 v7 = { llf.x, urb.y, urb.z }; + const glm::vec3 v0 = glm::vec3(llf.x, llf.y, llf.z); + const glm::vec3 v1 = glm::vec3(urb.x, llf.y, llf.z); + const glm::vec3 v2 = glm::vec3(urb.x, urb.y, llf.z); + const glm::vec3 v3 = glm::vec3(llf.x, urb.y, llf.z); + const glm::vec3 v4 = glm::vec3(llf.x, llf.y, urb.z); + const glm::vec3 v5 = glm::vec3(urb.x, llf.y, urb.z); + const glm::vec3 v6 = glm::vec3(urb.x, urb.y, urb.z); + const glm::vec3 v7 = glm::vec3(llf.x, urb.y, urb.z); // First add the bounds _varray.push_back({ v0.x, v0.y, v0.z }); diff --git a/modules/base/rendering/renderableboxgrid.h b/modules/base/rendering/renderableboxgrid.h index e74f82e1fd..937d22dc82 100644 --- a/modules/base/rendering/renderableboxgrid.h +++ b/modules/base/rendering/renderableboxgrid.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablecartesianaxes.cpp b/modules/base/rendering/renderablecartesianaxes.cpp index 841923c5ba..ced04ad50e 100644 --- a/modules/base/rendering/renderablecartesianaxes.cpp +++ b/modules/base/rendering/renderablecartesianaxes.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablecartesianaxes.h b/modules/base/rendering/renderablecartesianaxes.h index bd090c1055..600770100b 100644 --- a/modules/base/rendering/renderablecartesianaxes.h +++ b/modules/base/rendering/renderablecartesianaxes.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablelabels.cpp b/modules/base/rendering/renderablelabels.cpp index afcad28180..e661982bc0 100644 --- a/modules/base/rendering/renderablelabels.cpp +++ b/modules/base/rendering/renderablelabels.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablelabels.h b/modules/base/rendering/renderablelabels.h index df69d50544..7be35abaef 100644 --- a/modules/base/rendering/renderablelabels.h +++ b/modules/base/rendering/renderablelabels.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index 05ce3e39ce..cec22961fc 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablemodel.h b/modules/base/rendering/renderablemodel.h index 6feb61bf71..317b62d7d2 100644 --- a/modules/base/rendering/renderablemodel.h +++ b/modules/base/rendering/renderablemodel.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablenodeline.cpp b/modules/base/rendering/renderablenodeline.cpp index 7725b8e4ab..4dc4291a55 100644 --- a/modules/base/rendering/renderablenodeline.cpp +++ b/modules/base/rendering/renderablenodeline.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -123,7 +123,7 @@ documentation::Documentation RenderableNodeLine::Documentation() { RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary) : Renderable(dictionary) - , _lineColor(LineColorInfo, glm::vec3(1.f, 1.f, 1.f), glm::vec3(0.f), glm::vec3(1.f)) + , _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f)) , _lineWidth(LineWidthInfo, 2.f, 1.f, 20.f) , _start(StartNodeInfo, Root) , _end(EndNodeInfo, Root) diff --git a/modules/base/rendering/renderablenodeline.h b/modules/base/rendering/renderablenodeline.h index 5c7f4f6a88..075f59eea0 100644 --- a/modules/base/rendering/renderablenodeline.h +++ b/modules/base/rendering/renderablenodeline.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -76,8 +76,8 @@ private: GLuint _vBufferId = 0; std::vector _vertexArray; - glm::dvec3 _startPos; - glm::dvec3 _endPos; + glm::dvec3 _startPos = glm::dvec3(0.0); + glm::dvec3 _endPos = glm::dvec3(0.0); properties::StringProperty _start; properties::StringProperty _end; diff --git a/modules/base/rendering/renderableplane.cpp b/modules/base/rendering/renderableplane.cpp index 922e040a7f..cebce3931c 100644 --- a/modules/base/rendering/renderableplane.cpp +++ b/modules/base/rendering/renderableplane.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -215,7 +215,7 @@ void RenderablePlane::render(const RenderData& data, RendererTasks&) { ); glm::dvec3 newUp = glm::cross(normal, newRight); - glm::dmat4 cameraOrientedRotation; + glm::dmat4 cameraOrientedRotation = glm::dmat4(1.0); cameraOrientedRotation[0] = glm::dvec4(newRight, 0.0); cameraOrientedRotation[1] = glm::dvec4(newUp, 0.0); cameraOrientedRotation[2] = glm::dvec4(normal, 0.0); diff --git a/modules/base/rendering/renderableplane.h b/modules/base/rendering/renderableplane.h index a8be7ebe90..4f29066be1 100644 --- a/modules/base/rendering/renderableplane.h +++ b/modules/base/rendering/renderableplane.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderableplaneimagelocal.cpp b/modules/base/rendering/renderableplaneimagelocal.cpp index a7ea7baf1d..a83340ca9f 100644 --- a/modules/base/rendering/renderableplaneimagelocal.cpp +++ b/modules/base/rendering/renderableplaneimagelocal.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderableplaneimagelocal.h b/modules/base/rendering/renderableplaneimagelocal.h index f207bdba7c..4b2f795e6d 100644 --- a/modules/base/rendering/renderableplaneimagelocal.h +++ b/modules/base/rendering/renderableplaneimagelocal.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderableplaneimageonline.cpp b/modules/base/rendering/renderableplaneimageonline.cpp index 6b33c315d1..9e89e49525 100644 --- a/modules/base/rendering/renderableplaneimageonline.cpp +++ b/modules/base/rendering/renderableplaneimageonline.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderableplaneimageonline.h b/modules/base/rendering/renderableplaneimageonline.h index 616fb526c3..10060d8cfb 100644 --- a/modules/base/rendering/renderableplaneimageonline.h +++ b/modules/base/rendering/renderableplaneimageonline.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablesphere.cpp b/modules/base/rendering/renderablesphere.cpp index c3ffa2dc70..f512eefe8e 100644 --- a/modules/base/rendering/renderablesphere.cpp +++ b/modules/base/rendering/renderablesphere.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablesphere.h b/modules/base/rendering/renderablesphere.h index e8e195eb71..8369aca051 100644 --- a/modules/base/rendering/renderablesphere.h +++ b/modules/base/rendering/renderablesphere.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablesphericalgrid.cpp b/modules/base/rendering/renderablesphericalgrid.cpp index 054c83fa6c..f551902794 100644 --- a/modules/base/rendering/renderablesphericalgrid.cpp +++ b/modules/base/rendering/renderablesphericalgrid.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderablesphericalgrid.h b/modules/base/rendering/renderablesphericalgrid.h index 47b6b1f203..84400e2547 100644 --- a/modules/base/rendering/renderablesphericalgrid.h +++ b/modules/base/rendering/renderablesphericalgrid.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderabletrail.cpp b/modules/base/rendering/renderabletrail.cpp index 51aee515ff..b6fa66ff23 100644 --- a/modules/base/rendering/renderabletrail.cpp +++ b/modules/base/rendering/renderabletrail.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -175,7 +175,7 @@ documentation::Documentation RenderableTrail::Documentation() { RenderableTrail::Appearance::Appearance() : properties::PropertyOwner(AppearanceInfo) - , lineColor(LineColorInfo, glm::vec3(1.0f, 1.0f, 0.f), glm::vec3(0.f), glm::vec3(1.f)) + , lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f)) , useLineFade(EnableFadeInfo, true) , lineFade(FadeInfo, 1.f, 0.f, 30.f) , lineWidth(LineWidthInfo, 10.f, 1.f, 20.f) @@ -249,6 +249,18 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary) } void RenderableTrail::initializeGL() { +#ifdef __APPLE__ + _programObject = BaseModule::ProgramObjectManager.request( + ProgramName, + []() -> std::unique_ptr { + return global::renderEngine.buildRenderProgram( + ProgramName, + absPath("${MODULE_BASE}/shaders/renderabletrail_apple_vs.glsl"), + absPath("${MODULE_BASE}/shaders/renderabletrail_apple_fs.glsl") + ); + } + ); +#else _programObject = BaseModule::ProgramObjectManager.request( ProgramName, []() -> std::unique_ptr { @@ -259,6 +271,7 @@ void RenderableTrail::initializeGL() { ); } ); +#endif ghoul::opengl::updateUniformLocations(*_programObject, _uniformCache, UniformNames); } @@ -320,7 +333,11 @@ void RenderableTrail::render(const RenderData& data, RendererTasks&) { (_appearance.renderingModes == RenderingModeLinesPoints); if (renderLines) { +#ifdef __APPLE__ + glLineWidth(1.f); +#else glLineWidth(ceil((2.f * 1.f + _appearance.lineWidth) * std::sqrt(2.f))); +#endif } if (renderPoints) { glEnable(GL_PROGRAM_POINT_SIZE); @@ -349,10 +366,13 @@ void RenderableTrail::render(const RenderData& data, RendererTasks&) { p->setUniform(c.nVertices, nVertices); - glm::ivec2 resolution = global::renderEngine.renderingResolution(); - p->setUniform(c.resolution, resolution); - p->setUniform(c.lineWidth, ceil((2.f * 1.f + lw) * std::sqrt(2.f))); + #ifndef __APPLE__ + glm::ivec2 resolution = global::renderEngine.renderingResolution(); + p->setUniform(c.resolution, resolution); + + p->setUniform(c.lineWidth, ceil((2.f * 1.f + lw) * std::sqrt(2.f))); + #endif if (renderPoints) { // The stride parameter determines the distance between larger points and diff --git a/modules/base/rendering/renderabletrail.h b/modules/base/rendering/renderabletrail.h index a7d0873c29..e2a0eb088d 100644 --- a/modules/base/rendering/renderabletrail.h +++ b/modules/base/rendering/renderabletrail.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderabletrailorbit.cpp b/modules/base/rendering/renderabletrailorbit.cpp index 4a06aaf182..db57d56381 100644 --- a/modules/base/rendering/renderabletrailorbit.cpp +++ b/modules/base/rendering/renderabletrailorbit.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderabletrailorbit.h b/modules/base/rendering/renderabletrailorbit.h index 62228454d7..49c2257e5f 100644 --- a/modules/base/rendering/renderabletrailorbit.h +++ b/modules/base/rendering/renderabletrailorbit.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderabletrailtrajectory.cpp b/modules/base/rendering/renderabletrailtrajectory.cpp index 476e064e43..e8dae4adc8 100644 --- a/modules/base/rendering/renderabletrailtrajectory.cpp +++ b/modules/base/rendering/renderabletrailtrajectory.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/renderabletrailtrajectory.h b/modules/base/rendering/renderabletrailtrajectory.h index 3f2311bc35..82a97bb968 100644 --- a/modules/base/rendering/renderabletrailtrajectory.h +++ b/modules/base/rendering/renderabletrailtrajectory.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/screenspacedashboard.cpp b/modules/base/rendering/screenspacedashboard.cpp index e252807e1f..a6dfd3a214 100644 --- a/modules/base/rendering/screenspacedashboard.cpp +++ b/modules/base/rendering/screenspacedashboard.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/screenspacedashboard.h b/modules/base/rendering/screenspacedashboard.h index ad7763cd27..49b2a8fbed 100644 --- a/modules/base/rendering/screenspacedashboard.h +++ b/modules/base/rendering/screenspacedashboard.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/screenspaceframebuffer.cpp b/modules/base/rendering/screenspaceframebuffer.cpp index 035e38b618..dab0c44e2b 100644 --- a/modules/base/rendering/screenspaceframebuffer.cpp +++ b/modules/base/rendering/screenspaceframebuffer.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/screenspaceframebuffer.h b/modules/base/rendering/screenspaceframebuffer.h index e1919e0f5f..e824179bb6 100644 --- a/modules/base/rendering/screenspaceframebuffer.h +++ b/modules/base/rendering/screenspaceframebuffer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/screenspaceimagelocal.cpp b/modules/base/rendering/screenspaceimagelocal.cpp index 6e0896ab21..7901089979 100644 --- a/modules/base/rendering/screenspaceimagelocal.cpp +++ b/modules/base/rendering/screenspaceimagelocal.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/screenspaceimagelocal.h b/modules/base/rendering/screenspaceimagelocal.h index e5a1ce8ec9..0c1fbc711e 100644 --- a/modules/base/rendering/screenspaceimagelocal.h +++ b/modules/base/rendering/screenspaceimagelocal.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/screenspaceimageonline.cpp b/modules/base/rendering/screenspaceimageonline.cpp index b3df9654b4..e9f41f952f 100644 --- a/modules/base/rendering/screenspaceimageonline.cpp +++ b/modules/base/rendering/screenspaceimageonline.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rendering/screenspaceimageonline.h b/modules/base/rendering/screenspaceimageonline.h index 1b23306692..428bee0c3d 100644 --- a/modules/base/rendering/screenspaceimageonline.h +++ b/modules/base/rendering/screenspaceimageonline.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rotation/constantrotation.cpp b/modules/base/rotation/constantrotation.cpp index d79577c5d9..3696f09910 100644 --- a/modules/base/rotation/constantrotation.cpp +++ b/modules/base/rotation/constantrotation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rotation/constantrotation.h b/modules/base/rotation/constantrotation.h index bf887fea4c..91faf7c80f 100644 --- a/modules/base/rotation/constantrotation.h +++ b/modules/base/rotation/constantrotation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rotation/fixedrotation.cpp b/modules/base/rotation/fixedrotation.cpp index 7015ae14f4..5a9a07e5fd 100644 --- a/modules/base/rotation/fixedrotation.cpp +++ b/modules/base/rotation/fixedrotation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rotation/fixedrotation.h b/modules/base/rotation/fixedrotation.h index 0c93d1434b..6c59047c90 100644 --- a/modules/base/rotation/fixedrotation.h +++ b/modules/base/rotation/fixedrotation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rotation/luarotation.cpp b/modules/base/rotation/luarotation.cpp index 77035c21fb..7fa81592d1 100644 --- a/modules/base/rotation/luarotation.cpp +++ b/modules/base/rotation/luarotation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rotation/luarotation.h b/modules/base/rotation/luarotation.h index 032ee20c33..74248480ac 100644 --- a/modules/base/rotation/luarotation.h +++ b/modules/base/rotation/luarotation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rotation/staticrotation.cpp b/modules/base/rotation/staticrotation.cpp index 6b4dca540a..26333b4902 100644 --- a/modules/base/rotation/staticrotation.cpp +++ b/modules/base/rotation/staticrotation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -35,25 +35,25 @@ namespace { "graph node that this transformation is attached to relative to its parent." }; - // Conversion from rotation matrix to euler angles, - // given that the rotation is a pure rotation matrix. - // Inspired by: - // https://www.learnopencv.com/rotation-matrix-to-euler-angles/ + // Conversion from rotation matrix to euler angles, given that the rotation is a pure + // rotation matrix. + // Inspired by: https://www.learnopencv.com/rotation-matrix-to-euler-angles/ glm::dvec3 rotationMatrixToEulerAngles(glm::dmat4 mat) { - double sy = glm::sqrt(mat[0][0] * mat[0][0] + mat[0][1] * mat[0][1]); + const double sy = glm::sqrt(mat[0][0] * mat[0][0] + mat[0][1] * mat[0][1]); bool singular = sy < 1e-6; - double x, y, z; + glm::dvec3 res; if (singular) { - x = glm::atan(-mat[2][1], mat[1][1]); - y = glm::atan(-mat[0][2], sy); - z = 0; - } else { - x = glm::atan(mat[1][2], mat[2][2]); - y = glm::atan(-mat[0][2], sy); - z = glm::atan(mat[0][1], mat[0][0]); + res.x = glm::atan(-mat[2][1], mat[1][1]); + res.y = glm::atan(-mat[0][2], sy); + res.z = 0; } - return glm::dvec3(x, y, z); + else { + res.x = glm::atan(mat[1][2], mat[2][2]); + res.y = glm::atan(-mat[0][2], sy); + res.z = glm::atan(mat[0][1], mat[0][0]); + } + return res; } } // namespace diff --git a/modules/base/rotation/staticrotation.h b/modules/base/rotation/staticrotation.h index a4e43ecee9..c9a647bdec 100644 --- a/modules/base/rotation/staticrotation.h +++ b/modules/base/rotation/staticrotation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -44,7 +44,7 @@ public: private: properties::Vec3Property _eulerRotation; - mutable glm::dmat3 _cachedMatrix; + mutable glm::dmat3 _cachedMatrix = glm::dmat3(1.0); mutable bool _matrixIsDirty = true; }; diff --git a/modules/base/rotation/timelinerotation.cpp b/modules/base/rotation/timelinerotation.cpp index b55389aa6d..533fd21e47 100644 --- a/modules/base/rotation/timelinerotation.cpp +++ b/modules/base/rotation/timelinerotation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/rotation/timelinerotation.h b/modules/base/rotation/timelinerotation.h index a969341a89..a5f6a3b41a 100644 --- a/modules/base/rotation/timelinerotation.h +++ b/modules/base/rotation/timelinerotation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/scale/luascale.cpp b/modules/base/scale/luascale.cpp index 8ed69aac29..cfd19f9aca 100644 --- a/modules/base/scale/luascale.cpp +++ b/modules/base/scale/luascale.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/scale/luascale.h b/modules/base/scale/luascale.h index e24f6d0a14..ce8a1fa061 100644 --- a/modules/base/scale/luascale.h +++ b/modules/base/scale/luascale.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/scale/staticscale.cpp b/modules/base/scale/staticscale.cpp index 91f2602f1c..bb282dfb9e 100644 --- a/modules/base/scale/staticscale.cpp +++ b/modules/base/scale/staticscale.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -58,7 +58,7 @@ double StaticScale::scaleValue(const UpdateData&) const { return _scaleValue; } -StaticScale::StaticScale() : _scaleValue(ScaleInfo, 1.0, 0.1, 100) { +StaticScale::StaticScale() : _scaleValue(ScaleInfo, 1.f, 0.1f, 100.f) { addProperty(_scaleValue); _scaleValue.onChange([this]() { diff --git a/modules/base/scale/staticscale.h b/modules/base/scale/staticscale.h index 5557bbaca2..21e5bb6cde 100644 --- a/modules/base/scale/staticscale.h +++ b/modules/base/scale/staticscale.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/scale/timedependentscale.cpp b/modules/base/scale/timedependentscale.cpp index 4c0ed6812a..0fba563a0c 100644 --- a/modules/base/scale/timedependentscale.cpp +++ b/modules/base/scale/timedependentscale.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/scale/timedependentscale.h b/modules/base/scale/timedependentscale.h index ef0d782a51..e2d219bf6e 100644 --- a/modules/base/scale/timedependentscale.h +++ b/modules/base/scale/timedependentscale.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/axes_fs.glsl b/modules/base/shaders/axes_fs.glsl index 7435730021..0b1513ac46 100644 --- a/modules/base/shaders/axes_fs.glsl +++ b/modules/base/shaders/axes_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/axes_vs.glsl b/modules/base/shaders/axes_vs.glsl index 60a723f819..6ae73a55eb 100644 --- a/modules/base/shaders/axes_vs.glsl +++ b/modules/base/shaders/axes_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/grid_fs.glsl b/modules/base/shaders/grid_fs.glsl index ee5466bc80..3f1e1e13f1 100644 --- a/modules/base/shaders/grid_fs.glsl +++ b/modules/base/shaders/grid_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/grid_vs.glsl b/modules/base/shaders/grid_vs.glsl index 5153c1f2c4..d5b710ad4e 100644 --- a/modules/base/shaders/grid_vs.glsl +++ b/modules/base/shaders/grid_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/imageplane_fs.glsl b/modules/base/shaders/imageplane_fs.glsl index a8e81ab9a8..2ebb17f323 100644 --- a/modules/base/shaders/imageplane_fs.glsl +++ b/modules/base/shaders/imageplane_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/imageplane_vs.glsl b/modules/base/shaders/imageplane_vs.glsl index 995c35950c..585154a73f 100644 --- a/modules/base/shaders/imageplane_vs.glsl +++ b/modules/base/shaders/imageplane_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/line_fs.glsl b/modules/base/shaders/line_fs.glsl index 9479a98897..0b8309c319 100644 --- a/modules/base/shaders/line_fs.glsl +++ b/modules/base/shaders/line_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/line_vs.glsl b/modules/base/shaders/line_vs.glsl index 2e68d502c6..af629e75a2 100644 --- a/modules/base/shaders/line_vs.glsl +++ b/modules/base/shaders/line_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/model_fs.glsl b/modules/base/shaders/model_fs.glsl index b4bd1fd9ec..628c87b2d4 100644 --- a/modules/base/shaders/model_fs.glsl +++ b/modules/base/shaders/model_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/model_vs.glsl b/modules/base/shaders/model_vs.glsl index 86c93858fa..1d951f8ef5 100644 --- a/modules/base/shaders/model_vs.glsl +++ b/modules/base/shaders/model_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/plane_fs.glsl b/modules/base/shaders/plane_fs.glsl index fe5a75d45a..a3a84d9ab7 100644 --- a/modules/base/shaders/plane_fs.glsl +++ b/modules/base/shaders/plane_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/plane_vs.glsl b/modules/base/shaders/plane_vs.glsl index a341672fa4..a702df7eee 100644 --- a/modules/base/shaders/plane_vs.glsl +++ b/modules/base/shaders/plane_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/tests/test_gdalwms.inl b/modules/base/shaders/renderabletrail_apple_fs.glsl similarity index 62% rename from tests/test_gdalwms.inl rename to modules/base/shaders/renderabletrail_apple_fs.glsl index 50b7dec7ec..f0f83b0285 100644 --- a/tests/test_gdalwms.inl +++ b/modules/base/shaders/renderabletrail_apple_fs.glsl @@ -22,37 +22,47 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "gdal.h" -#include "gdal_priv.h" +#include "fragment.glsl" -#include +in float vs_positionDepth; +in vec4 vs_gPosition; +in float fade; + +uniform vec3 color; +uniform int renderPhase; +uniform float opacity = 1.0; + +// Fragile! Keep in sync with RenderableTrail::render::RenderPhase +#define RenderPhaseLines 0 +#define RenderPhasePoints 1 + +#define Delta 0.25 -#include "cpl_conv.h" -#include "cpl_string.h" +Fragment getFragment() { + Fragment frag; + frag.color = vec4(color * fade, fade * opacity); + frag.depth = vs_positionDepth; + frag.blend = BLEND_MODE_ADDITIVE; -// Error: cannot open source file "wms/wmsdriver.h" -//#include "wms/wmsdriver.h" + if (renderPhase == RenderPhasePoints) { + // Use the length of the vector (dot(circCoord, circCoord)) as factor in the + // smoothstep to gradually decrease the alpha on the edges of the point + vec2 circCoord = 2.0 * gl_PointCoord - 1.0; + //float circleClipping = 1.0 - smoothstep(1.0 - Delta, 1.0, dot(circCoord, circCoord)); + float circleClipping = smoothstep(1.0, 1.0 - Delta, dot(circCoord, circCoord)); + float transparencyCorrection = frag.color.a * circleClipping; + if (transparencyCorrection < 0.9) { + discard; + } -// Error: cannot open source file "wms/wmsmetadataset.h" -//#include "wms/wmsmetadataset.h" + frag.color.a = transparencyCorrection; + } + frag.gPosition = vs_gPosition; -class GdalWmsTest : public testing::Test {}; + // There is no normal here + frag.gNormal = vec4(0.0, 0.0, -1.0, 1.0); -TEST_F(GdalWmsTest, Simple) { - //GDALDatasetH poDataset; - //GDALAllRegister(); - - // - //std::string res = GDALVersionInfo("format"); - // - //std::cout << res << std::endl; - - //std::string testFile = absPath("${TESTDIR}/gdal/TERRA_CR_B143_2016-04-12.wms"); - - //poDataset = GDALOpen(testFile.c_str(), GA_ReadOnly); - - // This assertion fails - //ASSERT_NE(poDataset, nullptr) << "Failed to load testFile"; + return frag; } diff --git a/tests/test_screenspaceimage.inl b/modules/base/shaders/renderabletrail_apple_vs.glsl similarity index 57% rename from tests/test_screenspaceimage.inl rename to modules/base/shaders/renderabletrail_apple_vs.glsl index e2bdb5cb37..4c4db42aac 100644 --- a/tests/test_screenspaceimage.inl +++ b/modules/base/shaders/renderabletrail_apple_vs.glsl @@ -21,49 +21,63 @@ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ - -// #define private public -// #include -// #define private private -// /* -// * For each test the following is run: -// * Constructor() -> setUp() -> test -> tearDown() -> Deconstructor() -// */ +#version __CONTEXT__ -// namespace openspace { +#include "PowerScaling/powerScaling_vs.hglsl" -// class ScreenSpaceRenderableTest : public testing::Test{ -// protected: +layout(location = 0) in vec3 in_point_position; -// ScreenSpaceRenderableTest() -// // _ssr(texturePath) -// { -// // _sharedSsr = std::make_shared("${DATA}/test3.jpg"); -// } +out float vs_positionDepth; +out vec4 vs_gPosition; +out float fade; -// ~ScreenSpaceRenderableTest(){} +uniform dmat4 modelViewTransform; +uniform mat4 projectionTransform; +uniform int idOffset; +uniform int nVertices; +uniform bool useLineFade; +uniform float lineFade; +uniform int vertexSortingMethod; +uniform int pointSize; +uniform int stride; + +uniform ivec2 resolution; + +// Fragile! Keep in sync with RenderableTrail::render +#define VERTEX_SORTING_NEWESTFIRST 0 +#define VERTEX_SORTING_OLDESTFIRST 1 +#define VERTEX_SORTING_NOSORTING 2 -// void reset() {} +void main() { + int modId = gl_VertexID; -// // These variables are shared by all tests -// std::string texturePath = "${DATA}/test2.jpg"; -// ScreenSpaceImage _ssr; -// std::shared_ptr _sharedSsr; -// }; + if ((vertexSortingMethod != VERTEX_SORTING_NOSORTING) && useLineFade) { + // Account for a potential rolling buffer + modId = gl_VertexID - idOffset; + if (modId < 0) { + modId += nVertices; + } + // Convert the index to a [0,1] ranger + float id = float(modId) / float(nVertices); -// TEST_F(ScreenSpaceRenderableTest, initialize){ -// bool isReady = _ssr.isReady(); -// ASSERT_TRUE(!isReady) << "ScreenSpaceImage is ready before initialize"; + if (vertexSortingMethod == VERTEX_SORTING_NEWESTFIRST) { + id = 1.0 - id; + } -// // cannot test initialize, crashes at createplane becasue of opengl functions. needs mocking -// //_ssr.initialize(); -// //isReady = _ssr.isReady(); -// //ASSERT_TRUE(!isReady) << "ScreenSpaceImage is not ready after initialize"; -// //_ssr.deinitialize(); -// //isReady = _ssr.isReady(); -// //ASSERT_TRUE(!isReady) << "ScreenSpaceImage is still ready after deinitialize"; -// } -// }//namespace openspace + fade = clamp(id * lineFade, 0.0, 1.0); + } + else { + fade = 1.0; + } + + vs_gPosition = vec4(modelViewTransform * dvec4(in_point_position, 1)); + vec4 vs_positionClipSpace = projectionTransform * vs_gPosition; + vs_positionDepth = vs_positionClipSpace.w; + + gl_PointSize = (stride == 1 || int(modId) % stride == 0) ? + float(pointSize) : float(pointSize) / 2; + gl_Position = z_normalization(vs_positionClipSpace); +} diff --git a/modules/base/shaders/renderabletrail_fs.glsl b/modules/base/shaders/renderabletrail_fs.glsl index d5499dd1bf..a5d9ce25d1 100644 --- a/modules/base/shaders/renderabletrail_fs.glsl +++ b/modules/base/shaders/renderabletrail_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/renderabletrail_vs.glsl b/modules/base/shaders/renderabletrail_vs.glsl index d0b3ece155..f7f0804fd8 100644 --- a/modules/base/shaders/renderabletrail_vs.glsl +++ b/modules/base/shaders/renderabletrail_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/screenspace_fs.glsl b/modules/base/shaders/screenspace_fs.glsl index 9dc5fd70ad..dc7d73b601 100644 --- a/modules/base/shaders/screenspace_fs.glsl +++ b/modules/base/shaders/screenspace_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/screenspace_vs.glsl b/modules/base/shaders/screenspace_vs.glsl index 075110baf2..f5c345f7e2 100644 --- a/modules/base/shaders/screenspace_vs.glsl +++ b/modules/base/shaders/screenspace_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/sphere_fs.glsl b/modules/base/shaders/sphere_fs.glsl index 5a82d91e6e..3aecbe4355 100644 --- a/modules/base/shaders/sphere_fs.glsl +++ b/modules/base/shaders/sphere_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/shaders/sphere_vs.glsl b/modules/base/shaders/sphere_vs.glsl index 38b19f23f0..cf747e4a51 100644 --- a/modules/base/shaders/sphere_vs.glsl +++ b/modules/base/shaders/sphere_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/timeframe/timeframeinterval.cpp b/modules/base/timeframe/timeframeinterval.cpp index f24268f3fd..84d6dc28bf 100644 --- a/modules/base/timeframe/timeframeinterval.cpp +++ b/modules/base/timeframe/timeframeinterval.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/timeframe/timeframeinterval.h b/modules/base/timeframe/timeframeinterval.h index e386063141..04b5f54cfc 100644 --- a/modules/base/timeframe/timeframeinterval.h +++ b/modules/base/timeframe/timeframeinterval.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/timeframe/timeframeunion.cpp b/modules/base/timeframe/timeframeunion.cpp index 4a01054c5b..2a2af962fe 100644 --- a/modules/base/timeframe/timeframeunion.cpp +++ b/modules/base/timeframe/timeframeunion.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/timeframe/timeframeunion.h b/modules/base/timeframe/timeframeunion.h index 679835c7f4..0b3c761859 100644 --- a/modules/base/timeframe/timeframeunion.h +++ b/modules/base/timeframe/timeframeunion.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/translation/luatranslation.cpp b/modules/base/translation/luatranslation.cpp index e16f486b70..1c3d1610b2 100644 --- a/modules/base/translation/luatranslation.cpp +++ b/modules/base/translation/luatranslation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/translation/luatranslation.h b/modules/base/translation/luatranslation.h index 14f1836afa..2951c7e45d 100644 --- a/modules/base/translation/luatranslation.h +++ b/modules/base/translation/luatranslation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/translation/statictranslation.cpp b/modules/base/translation/statictranslation.cpp index a52abb34a7..00efb611b4 100644 --- a/modules/base/translation/statictranslation.cpp +++ b/modules/base/translation/statictranslation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/translation/statictranslation.h b/modules/base/translation/statictranslation.h index 4b832d618c..a786bddfd6 100644 --- a/modules/base/translation/statictranslation.h +++ b/modules/base/translation/statictranslation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/translation/timelinetranslation.cpp b/modules/base/translation/timelinetranslation.cpp index 0dafe620b6..396e39e27f 100644 --- a/modules/base/translation/timelinetranslation.cpp +++ b/modules/base/translation/timelinetranslation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/base/translation/timelinetranslation.h b/modules/base/translation/timelinetranslation.h index 0d528d36a6..86ef39af60 100644 --- a/modules/base/translation/timelinetranslation.h +++ b/modules/base/translation/timelinetranslation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/cefwebgui/CMakeLists.txt b/modules/cefwebgui/CMakeLists.txt index cd728ae7b2..0fcab73536 100644 --- a/modules/cefwebgui/CMakeLists.txt +++ b/modules/cefwebgui/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/cefwebgui/cefwebguimodule.cpp b/modules/cefwebgui/cefwebguimodule.cpp index 8a6951f8de..478b5847b5 100644 --- a/modules/cefwebgui/cefwebguimodule.cpp +++ b/modules/cefwebgui/cefwebguimodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -35,6 +35,7 @@ #include #include #include +#include namespace { constexpr openspace::properties::Property::PropertyInfo EnabledInfo = { @@ -86,6 +87,8 @@ CefWebGuiModule::CefWebGuiModule() } void CefWebGuiModule::startOrStopGui() { + ZoneScoped + WebBrowserModule* webBrowserModule = global::moduleEngine.module(); const bool isGuiWindow = @@ -127,6 +130,8 @@ void CefWebGuiModule::startOrStopGui() { } void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration) { + ZoneScoped + WebBrowserModule* webBrowserModule = global::moduleEngine.module(); @@ -137,28 +142,38 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration) } _enabled.onChange([this]() { + ZoneScopedN("CefWebGuiModule::enabled") + startOrStopGui(); }); _url.onChange([this]() { + ZoneScopedN("CefWebGuiModule::url") + if (_instance) { _instance->loadUrl(_url); } }); _reload.onChange([this]() { + ZoneScopedN("CefWebGuiModule::reload") + if (_instance) { _instance->reloadBrowser(); } }); _guiScale.onChange([this]() { + ZoneScopedN("CefWebGuiModule::guiScale") + if (_instance) { _instance->setZoom(_guiScale); } }); _visible.onChange([this, webBrowserModule]() { + ZoneScopedN("CefWebGuiModule::visible") + if (_visible && _instance) { webBrowserModule->attachEventHandler(_instance.get()); } else { @@ -176,6 +191,7 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration) _endpointCallback = webGuiModule->addEndpointChangeCallback( [this](const std::string& endpoint, bool exists) { + ZoneScopedN("CefWebGuiModule::endpointCallback") if (exists && endpoint == "frontend" && _instance) { _instance->reloadBrowser(); } @@ -197,6 +213,8 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration) }); global::callback::draw2D.emplace_back([this](){ + ZoneScopedN("CefWebGuiModule") + const bool isGuiWindow = global::windowDelegate.hasGuiWindow() ? global::windowDelegate.isGuiWindow() : @@ -218,6 +236,8 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration) }); global::callback::deinitializeGL.emplace_back([this]() { + ZoneScopedN("CefWebGuiModule") + if (_endpointCallback != -1) { WebGuiModule* webGuiModule = global::moduleEngine.module(); webGuiModule->removeEndpointChangeCallback(_endpointCallback); diff --git a/modules/cefwebgui/cefwebguimodule.h b/modules/cefwebgui/cefwebguimodule.h index d822b838a5..2d42ed3c66 100644 --- a/modules/cefwebgui/cefwebguimodule.h +++ b/modules/cefwebgui/cefwebguimodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/cefwebgui/include/guikeyboardhandler.h b/modules/cefwebgui/include/guikeyboardhandler.h index ecd2f05d19..2a74407adc 100644 --- a/modules/cefwebgui/include/guikeyboardhandler.h +++ b/modules/cefwebgui/include/guikeyboardhandler.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/cefwebgui/include/guirenderhandler.h b/modules/cefwebgui/include/guirenderhandler.h index b28a1875f5..e03c5cfe1c 100644 --- a/modules/cefwebgui/include/guirenderhandler.h +++ b/modules/cefwebgui/include/guirenderhandler.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/cefwebgui/src/guikeyboardhandler.cpp b/modules/cefwebgui/src/guikeyboardhandler.cpp index 4c562bfec7..ef534d0095 100644 --- a/modules/cefwebgui/src/guikeyboardhandler.cpp +++ b/modules/cefwebgui/src/guikeyboardhandler.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/cefwebgui/src/guirenderhandler.cpp b/modules/cefwebgui/src/guirenderhandler.cpp index bf2099d697..325210abb8 100644 --- a/modules/cefwebgui/src/guirenderhandler.cpp +++ b/modules/cefwebgui/src/guirenderhandler.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/debugging/CMakeLists.txt b/modules/debugging/CMakeLists.txt index 382ea0b1dc..41dfdd2605 100644 --- a/modules/debugging/CMakeLists.txt +++ b/modules/debugging/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/debugging/debuggingmodule.cpp b/modules/debugging/debuggingmodule.cpp index 99e76a18f1..6e00c47158 100644 --- a/modules/debugging/debuggingmodule.cpp +++ b/modules/debugging/debuggingmodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/debugging/debuggingmodule.h b/modules/debugging/debuggingmodule.h index 27b26d8d18..2d30ebcdc9 100644 --- a/modules/debugging/debuggingmodule.h +++ b/modules/debugging/debuggingmodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/debugging/rendering/debugrenderer.cpp b/modules/debugging/rendering/debugrenderer.cpp index 6ffad6fd57..362bfe6580 100644 --- a/modules/debugging/rendering/debugrenderer.cpp +++ b/modules/debugging/rendering/debugrenderer.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/debugging/rendering/debugrenderer.h b/modules/debugging/rendering/debugrenderer.h index cfdd1ea48b..37729510e7 100644 --- a/modules/debugging/rendering/debugrenderer.h +++ b/modules/debugging/rendering/debugrenderer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/debugging/rendering/debugshader_fs.glsl b/modules/debugging/rendering/debugshader_fs.glsl index 17a6ba023c..0baca40150 100644 --- a/modules/debugging/rendering/debugshader_fs.glsl +++ b/modules/debugging/rendering/debugshader_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/debugging/rendering/debugshader_vs.glsl b/modules/debugging/rendering/debugshader_vs.glsl index 6302b41b06..359cb7cbc6 100644 --- a/modules/debugging/rendering/debugshader_vs.glsl +++ b/modules/debugging/rendering/debugshader_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/debugging/rendering/renderabledebugplane.cpp b/modules/debugging/rendering/renderabledebugplane.cpp index 1ba47a690c..770211d15a 100644 --- a/modules/debugging/rendering/renderabledebugplane.cpp +++ b/modules/debugging/rendering/renderabledebugplane.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -208,7 +208,7 @@ void RenderableDebugPlane::deinitializeGL() { } void RenderableDebugPlane::render(const RenderData& data, RendererTasks&) { - glm::mat4 transform = glm::mat4(1.0); + glm::mat4 transform = glm::mat4(1.f); if (_billboard) { transform = glm::inverse(glm::mat4(data.camera.viewRotationMatrix())); } diff --git a/modules/debugging/rendering/renderabledebugplane.h b/modules/debugging/rendering/renderabledebugplane.h index 971df23bcd..95d003d435 100644 --- a/modules/debugging/rendering/renderabledebugplane.h +++ b/modules/debugging/rendering/renderabledebugplane.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/CMakeLists.txt b/modules/digitaluniverse/CMakeLists.txt index d5f5d119b0..e2f68ab6fa 100644 --- a/modules/digitaluniverse/CMakeLists.txt +++ b/modules/digitaluniverse/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/digitaluniverse/digitaluniversemodule.cpp b/modules/digitaluniverse/digitaluniversemodule.cpp index 7cebee2399..a49031dbd4 100644 --- a/modules/digitaluniverse/digitaluniversemodule.cpp +++ b/modules/digitaluniverse/digitaluniversemodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/digitaluniversemodule.h b/modules/digitaluniverse/digitaluniversemodule.h index dffa1914b9..9f1b46c7f8 100644 --- a/modules/digitaluniverse/digitaluniversemodule.h +++ b/modules/digitaluniverse/digitaluniversemodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp index 9ef2a3a9a9..e7df8224e0 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -1474,8 +1474,8 @@ bool RenderableBillboardsCloud::readLabelFile() { std::stringstream str(line); - glm::vec3 position; - for (auto j = 0; j < 3; ++j) { + glm::vec3 position = glm::vec3(0.f); + for (int j = 0; j < 3; ++j) { str >> position[j]; } @@ -1693,7 +1693,7 @@ void RenderableBillboardsCloud::createDataSlice() { addPosition(position); } } - _fadeInDistance.setMaxValue(glm::vec2(10.0f * biggestCoord)); + _fadeInDistance.setMaxValue(glm::vec2(10.f * biggestCoord)); } void RenderableBillboardsCloud::createPolygonTexture() { diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.h b/modules/digitaluniverse/rendering/renderablebillboardscloud.h index aea5818783..15d4d241e6 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.h +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.cpp b/modules/digitaluniverse/rendering/renderabledumeshes.cpp index f0e96c1bba..8a1d259747 100644 --- a/modules/digitaluniverse/rendering/renderabledumeshes.cpp +++ b/modules/digitaluniverse/rendering/renderabledumeshes.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -236,12 +236,7 @@ RenderableDUMeshes::RenderableDUMeshes(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _alphaValue(TransparencyInfo, 1.f, 0.f, 1.f) //, _scaleFactor(ScaleFactorInfo, 1.f, 0.f, 64.f) - , _textColor( - TextColorInfo, - glm::vec4(1.0f, 1.0, 1.0f, 1.f), - glm::vec4(0.f), - glm::vec4(1.f) - ) + , _textColor(TextColorInfo, glm::vec4(1.f), glm::vec4(0.f), glm::vec4(1.f)) , _textSize(TextSizeInfo, 8.f, 0.5f, 24.f) , _drawElements(DrawElementsInfo, true) , _drawLabels(DrawLabelInfo, false) @@ -866,7 +861,7 @@ bool RenderableDUMeshes::readLabelFile() { std::stringstream str(line); - glm::vec3 position; + glm::vec3 position = glm::vec3(0.f); for (int j = 0; j < 3; ++j) { str >> position[j]; } diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.h b/modules/digitaluniverse/rendering/renderabledumeshes.h index 570d0c29b0..418f45eafe 100644 --- a/modules/digitaluniverse/rendering/renderabledumeshes.h +++ b/modules/digitaluniverse/rendering/renderabledumeshes.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -146,7 +146,7 @@ private: std::vector> _labelData; int _nValuesPerAstronomicalObject = 0; - glm::dmat4 _transformationMatrix; + glm::dmat4 _transformationMatrix = glm::dmat4(1.0); std::unordered_map _meshColorMap; std::unordered_map _renderingMeshesMap; diff --git a/modules/digitaluniverse/rendering/renderableplanescloud.cpp b/modules/digitaluniverse/rendering/renderableplanescloud.cpp index a86eac1e72..e25c8c9eb9 100644 --- a/modules/digitaluniverse/rendering/renderableplanescloud.cpp +++ b/modules/digitaluniverse/rendering/renderableplanescloud.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -1118,7 +1118,7 @@ bool RenderablePlanesCloud::readLabelFile() { std::stringstream str(line); - glm::vec3 position; + glm::vec3 position = glm::vec3(0.f); for (int j = 0; j < 3; ++j) { str >> position[j]; } diff --git a/modules/digitaluniverse/rendering/renderableplanescloud.h b/modules/digitaluniverse/rendering/renderableplanescloud.h index ddde9e6023..bf7cced594 100644 --- a/modules/digitaluniverse/rendering/renderableplanescloud.h +++ b/modules/digitaluniverse/rendering/renderableplanescloud.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/rendering/renderablepoints.cpp b/modules/digitaluniverse/rendering/renderablepoints.cpp index befe656857..22054c2734 100644 --- a/modules/digitaluniverse/rendering/renderablepoints.cpp +++ b/modules/digitaluniverse/rendering/renderablepoints.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/rendering/renderablepoints.h b/modules/digitaluniverse/rendering/renderablepoints.h index f4d2711c97..58731d3c56 100644 --- a/modules/digitaluniverse/rendering/renderablepoints.h +++ b/modules/digitaluniverse/rendering/renderablepoints.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/billboard_fs.glsl b/modules/digitaluniverse/shaders/billboard_fs.glsl index cccfbeb58e..d0fd92a9d2 100644 --- a/modules/digitaluniverse/shaders/billboard_fs.glsl +++ b/modules/digitaluniverse/shaders/billboard_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/billboard_gs.glsl b/modules/digitaluniverse/shaders/billboard_gs.glsl index 644be37dd3..23e4f88912 100644 --- a/modules/digitaluniverse/shaders/billboard_gs.glsl +++ b/modules/digitaluniverse/shaders/billboard_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/billboard_vs.glsl b/modules/digitaluniverse/shaders/billboard_vs.glsl index 66e03e2a3c..2a8a25f8ba 100644 --- a/modules/digitaluniverse/shaders/billboard_vs.glsl +++ b/modules/digitaluniverse/shaders/billboard_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/billboardpolygon_fs.glsl b/modules/digitaluniverse/shaders/billboardpolygon_fs.glsl index 7c76866961..44b6b55b04 100644 --- a/modules/digitaluniverse/shaders/billboardpolygon_fs.glsl +++ b/modules/digitaluniverse/shaders/billboardpolygon_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/billboardpolygon_gs.glsl b/modules/digitaluniverse/shaders/billboardpolygon_gs.glsl index 9d7243239e..7592e9d685 100644 --- a/modules/digitaluniverse/shaders/billboardpolygon_gs.glsl +++ b/modules/digitaluniverse/shaders/billboardpolygon_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/billboardpolygon_vs.glsl b/modules/digitaluniverse/shaders/billboardpolygon_vs.glsl index 9927f4b026..0f972cb4e3 100644 --- a/modules/digitaluniverse/shaders/billboardpolygon_vs.glsl +++ b/modules/digitaluniverse/shaders/billboardpolygon_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/dumesh_fs.glsl b/modules/digitaluniverse/shaders/dumesh_fs.glsl index f6192f68ff..6997b13fc1 100644 --- a/modules/digitaluniverse/shaders/dumesh_fs.glsl +++ b/modules/digitaluniverse/shaders/dumesh_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/dumesh_vs.glsl b/modules/digitaluniverse/shaders/dumesh_vs.glsl index 3e2bed3fcf..ebbdf31643 100644 --- a/modules/digitaluniverse/shaders/dumesh_vs.glsl +++ b/modules/digitaluniverse/shaders/dumesh_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/plane_fs.glsl b/modules/digitaluniverse/shaders/plane_fs.glsl index 41bf693217..51b0a869fe 100644 --- a/modules/digitaluniverse/shaders/plane_fs.glsl +++ b/modules/digitaluniverse/shaders/plane_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/plane_vs.glsl b/modules/digitaluniverse/shaders/plane_vs.glsl index 7a25575a0b..e4e2dd04f6 100644 --- a/modules/digitaluniverse/shaders/plane_vs.glsl +++ b/modules/digitaluniverse/shaders/plane_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/points_fs.glsl b/modules/digitaluniverse/shaders/points_fs.glsl index 97dbfe371d..35bf38a6db 100644 --- a/modules/digitaluniverse/shaders/points_fs.glsl +++ b/modules/digitaluniverse/shaders/points_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/points_gs.glsl b/modules/digitaluniverse/shaders/points_gs.glsl index 612161fd76..e2b63ded8d 100644 --- a/modules/digitaluniverse/shaders/points_gs.glsl +++ b/modules/digitaluniverse/shaders/points_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/points_sprite_fs.glsl b/modules/digitaluniverse/shaders/points_sprite_fs.glsl index c2f6c9952d..f47d8beba2 100644 --- a/modules/digitaluniverse/shaders/points_sprite_fs.glsl +++ b/modules/digitaluniverse/shaders/points_sprite_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/points_vs.glsl b/modules/digitaluniverse/shaders/points_vs.glsl index e765942f17..63d4aa0992 100644 --- a/modules/digitaluniverse/shaders/points_vs.glsl +++ b/modules/digitaluniverse/shaders/points_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/pointssprite_fs.glsl b/modules/digitaluniverse/shaders/pointssprite_fs.glsl index ff54c1253e..6dbf377174 100644 --- a/modules/digitaluniverse/shaders/pointssprite_fs.glsl +++ b/modules/digitaluniverse/shaders/pointssprite_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/digitaluniverse/shaders/pointssprite_vs.glsl b/modules/digitaluniverse/shaders/pointssprite_vs.glsl index 7d6318a258..a6627b5ad1 100644 --- a/modules/digitaluniverse/shaders/pointssprite_vs.glsl +++ b/modules/digitaluniverse/shaders/pointssprite_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlines/CMakeLists.txt b/modules/fieldlines/CMakeLists.txt index 7bfcaf2c08..9a887da930 100644 --- a/modules/fieldlines/CMakeLists.txt +++ b/modules/fieldlines/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/fieldlines/fieldlinesmodule.cpp b/modules/fieldlines/fieldlinesmodule.cpp index 5ddcbed1bf..52aeab21f3 100644 --- a/modules/fieldlines/fieldlinesmodule.cpp +++ b/modules/fieldlines/fieldlinesmodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlines/fieldlinesmodule.h b/modules/fieldlines/fieldlinesmodule.h index b9ffe0e845..e9652bd508 100644 --- a/modules/fieldlines/fieldlinesmodule.h +++ b/modules/fieldlines/fieldlinesmodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlines/rendering/renderablefieldlines.cpp b/modules/fieldlines/rendering/renderablefieldlines.cpp index 8caf8d0408..b8970efb3b 100644 --- a/modules/fieldlines/rendering/renderablefieldlines.cpp +++ b/modules/fieldlines/rendering/renderablefieldlines.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -371,8 +371,8 @@ void RenderableFieldlines::loadSeedPointsFromTable() { LINFO("Loading provided list of seed points"); ghoul::Dictionary seedpointsDictionary; _seedPointsInfo.getValue(KeySeedPointsTable, seedpointsDictionary); - glm::vec3 seedPos; for (const std::string& index : seedpointsDictionary.keys()) { + glm::vec3 seedPos = glm::vec3(0.f); _fieldlineInfo.getValue(std::string(KeySeedPointsTable) + "." + index, seedPos); _seedPoints.push_back(seedPos); } diff --git a/modules/fieldlines/rendering/renderablefieldlines.h b/modules/fieldlines/rendering/renderablefieldlines.h index 690e50343e..cc73bd60cf 100644 --- a/modules/fieldlines/rendering/renderablefieldlines.h +++ b/modules/fieldlines/rendering/renderablefieldlines.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlines/shaders/fieldline_fs.glsl b/modules/fieldlines/shaders/fieldline_fs.glsl index c76f07490c..71b7525467 100644 --- a/modules/fieldlines/shaders/fieldline_fs.glsl +++ b/modules/fieldlines/shaders/fieldline_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlines/shaders/fieldline_gs.glsl b/modules/fieldlines/shaders/fieldline_gs.glsl index cb55a36d0f..16310196d6 100644 --- a/modules/fieldlines/shaders/fieldline_gs.glsl +++ b/modules/fieldlines/shaders/fieldline_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlines/shaders/fieldline_vs.glsl b/modules/fieldlines/shaders/fieldline_vs.glsl index 8c566324ec..ceba91ab1f 100644 --- a/modules/fieldlines/shaders/fieldline_vs.glsl +++ b/modules/fieldlines/shaders/fieldline_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/CMakeLists.txt b/modules/fieldlinessequence/CMakeLists.txt index 773a428c3f..9af2549997 100644 --- a/modules/fieldlinessequence/CMakeLists.txt +++ b/modules/fieldlinessequence/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/fieldlinessequence/fieldlinessequencemodule.cpp b/modules/fieldlinessequence/fieldlinessequencemodule.cpp index fc9e763ee0..6fd64755c1 100644 --- a/modules/fieldlinessequence/fieldlinessequencemodule.cpp +++ b/modules/fieldlinessequence/fieldlinessequencemodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/fieldlinessequencemodule.h b/modules/fieldlinessequence/fieldlinessequencemodule.h index 6143273a86..c88ba9f5d5 100644 --- a/modules/fieldlinessequence/fieldlinessequencemodule.h +++ b/modules/fieldlinessequence/fieldlinessequencemodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp index 0e108d525f..c560fca43e 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -250,7 +250,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence( , _pColorTablePath(ColorTablePathInfo) , _pColorUniform( ColorUniformInfo, - glm::vec4(0.75f, 0.5f, 0.0f, 0.5f), + glm::vec4(0.75f, 0.5f, 0.f, 0.5f), glm::vec4(0.f), glm::vec4(1.f) ) @@ -263,7 +263,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence( , _pDomainR(DomainRInfo) , _pFlowColor( FlowColorInfo, - glm::vec4(0.8f, 0.7f, 0.0f, 0.6f), + glm::vec4(0.8f, 0.7f, 0.f, 0.6f), glm::vec4(0.f), glm::vec4(1.f) ) diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.h b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.h index 77a2263045..786ec3a861 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.h +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/shaders/fieldlinessequence_fs.glsl b/modules/fieldlinessequence/shaders/fieldlinessequence_fs.glsl index 4ffe5a3679..fc3d4c47c3 100644 --- a/modules/fieldlinessequence/shaders/fieldlinessequence_fs.glsl +++ b/modules/fieldlinessequence/shaders/fieldlinessequence_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/shaders/fieldlinessequence_vs.glsl b/modules/fieldlinessequence/shaders/fieldlinessequence_vs.glsl index 822c401516..6b0405fd9f 100644 --- a/modules/fieldlinessequence/shaders/fieldlinessequence_vs.glsl +++ b/modules/fieldlinessequence/shaders/fieldlinessequence_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/util/commons.cpp b/modules/fieldlinessequence/util/commons.cpp index 032be6107d..b3aef7b491 100644 --- a/modules/fieldlinessequence/util/commons.cpp +++ b/modules/fieldlinessequence/util/commons.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/util/commons.h b/modules/fieldlinessequence/util/commons.h index 095dcdfc30..7e0d125985 100644 --- a/modules/fieldlinessequence/util/commons.h +++ b/modules/fieldlinessequence/util/commons.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/util/fieldlinesstate.cpp b/modules/fieldlinessequence/util/fieldlinesstate.cpp index 117c60124e..bd717431ad 100644 --- a/modules/fieldlinessequence/util/fieldlinesstate.cpp +++ b/modules/fieldlinessequence/util/fieldlinesstate.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/util/fieldlinesstate.h b/modules/fieldlinessequence/util/fieldlinesstate.h index 7011c0547e..656403b33b 100644 --- a/modules/fieldlinessequence/util/fieldlinesstate.h +++ b/modules/fieldlinessequence/util/fieldlinesstate.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp b/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp index 7bacdebb00..63b0f6f85d 100644 --- a/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp +++ b/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fieldlinessequence/util/kameleonfieldlinehelper.h b/modules/fieldlinessequence/util/kameleonfieldlinehelper.h index 2c53f524b9..39fa5d7212 100644 --- a/modules/fieldlinessequence/util/kameleonfieldlinehelper.h +++ b/modules/fieldlinessequence/util/kameleonfieldlinehelper.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fitsfilereader/CMakeLists.txt b/modules/fitsfilereader/CMakeLists.txt index 46e0c43125..4e07757fa7 100644 --- a/modules/fitsfilereader/CMakeLists.txt +++ b/modules/fitsfilereader/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # @@ -57,5 +57,10 @@ set_folder_location(cfitsio "External") add_subdirectory(${CCFITS_ROOT_DIR}) set_folder_location(CCfits "External") +if (GHOUL_DISABLE_EXTERNAL_WARNINGS) + disable_external_warnings(cfitsio) + disable_external_warnings(CCfits) +endif () + target_include_directories(${MODULE_NAME} SYSTEM PUBLIC ${INCLUDES_FOR_TARGET}) target_link_libraries(${MODULE_NAME} PRIVATE CCfits) diff --git a/modules/fitsfilereader/fitsfilereadermodule.cpp b/modules/fitsfilereader/fitsfilereadermodule.cpp index 3aeb83f509..e0c66c7882 100644 --- a/modules/fitsfilereader/fitsfilereadermodule.cpp +++ b/modules/fitsfilereader/fitsfilereadermodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fitsfilereader/fitsfilereadermodule.h b/modules/fitsfilereader/fitsfilereadermodule.h index 7eb7467ceb..a16cfaba75 100644 --- a/modules/fitsfilereader/fitsfilereadermodule.h +++ b/modules/fitsfilereader/fitsfilereadermodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fitsfilereader/include/fitsfilereader.h b/modules/fitsfilereader/include/fitsfilereader.h index 3ec05c1c3c..5c7bbd77be 100644 --- a/modules/fitsfilereader/include/fitsfilereader.h +++ b/modules/fitsfilereader/include/fitsfilereader.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/fitsfilereader/src/fitsfilereader.cpp b/modules/fitsfilereader/src/fitsfilereader.cpp index e31f001da1..f35a51aa9f 100644 --- a/modules/fitsfilereader/src/fitsfilereader.cpp +++ b/modules/fitsfilereader/src/fitsfilereader.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/CMakeLists.txt b/modules/gaia/CMakeLists.txt index fdef0ffbf5..782b9ced23 100644 --- a/modules/gaia/CMakeLists.txt +++ b/modules/gaia/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/gaia/gaiamodule.cpp b/modules/gaia/gaiamodule.cpp index 0c2f233199..7174ca6705 100644 --- a/modules/gaia/gaiamodule.cpp +++ b/modules/gaia/gaiamodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/gaiamodule.h b/modules/gaia/gaiamodule.h index 1a5befc41c..657ac52f04 100644 --- a/modules/gaia/gaiamodule.h +++ b/modules/gaia/gaiamodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/rendering/gaiaoptions.h b/modules/gaia/rendering/gaiaoptions.h index 219d8b2104..b1740b7cb5 100644 --- a/modules/gaia/rendering/gaiaoptions.h +++ b/modules/gaia/rendering/gaiaoptions.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/rendering/octreeculler.cpp b/modules/gaia/rendering/octreeculler.cpp index 8a1bb32f05..0ffef8d717 100644 --- a/modules/gaia/rendering/octreeculler.cpp +++ b/modules/gaia/rendering/octreeculler.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/rendering/octreeculler.h b/modules/gaia/rendering/octreeculler.h index 46025a0aab..c8a2e2362f 100644 --- a/modules/gaia/rendering/octreeculler.h +++ b/modules/gaia/rendering/octreeculler.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/rendering/octreemanager.cpp b/modules/gaia/rendering/octreemanager.cpp index 63efa73a43..5b56c62816 100644 --- a/modules/gaia/rendering/octreemanager.cpp +++ b/modules/gaia/rendering/octreemanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -51,7 +51,7 @@ void OctreeManager::initOctree(long long cpuRamBudget, int maxDist, int maxStars // Initialize the culler. The NDC.z of the comparing corners are always -1 or 1. globebrowsing::AABB3 box; box.min = glm::vec3(-1.f, -1.f, 0.f); - box.max = glm::vec3(1.f, 1.f, 1e2); + box.max = glm::vec3(1.f, 1.f, 100.f); _culler = std::make_unique(box); _removedKeysInPrevCall = std::set(); _leastRecentlyFetchedNodes = std::queue(); diff --git a/modules/gaia/rendering/octreemanager.h b/modules/gaia/rendering/octreemanager.h index aa584f424f..031e9e3630 100644 --- a/modules/gaia/rendering/octreemanager.h +++ b/modules/gaia/rendering/octreemanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/rendering/renderablegaiastars.cpp b/modules/gaia/rendering/renderablegaiastars.cpp index cb7522f99d..a67a1d17c2 100644 --- a/modules/gaia/rendering/renderablegaiastars.cpp +++ b/modules/gaia/rendering/renderablegaiastars.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -2325,7 +2325,7 @@ void RenderableGaiaStars::update(const UpdateData&) { // Update FBO texture resolution if we haven't already. glm::vec2 screenSize = glm::vec2(global::renderEngine.renderingResolution()); const bool hasChanged = glm::any( - glm::notEqual(_fboTexture->dimensions(), glm::uvec3(screenSize, 1.0)) + glm::notEqual(_fboTexture->dimensions(), glm::uvec3(screenSize, 1)) ); if (hasChanged) { diff --git a/modules/gaia/rendering/renderablegaiastars.h b/modules/gaia/rendering/renderablegaiastars.h index 2583b80a52..dfde5abc04 100644 --- a/modules/gaia/rendering/renderablegaiastars.h +++ b/modules/gaia/rendering/renderablegaiastars.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -191,7 +191,7 @@ private: size_t _nRenderValuesPerStar = 0; int _nStarsToRender = 0; bool _firstDrawCalls = true; - glm::dquat _previousCameraRotation; + glm::dquat _previousCameraRotation = glm::dquat(1.0, 0.0, 0.0, 0.0); bool _useVBO = false; long long _cpuRamBudgetInBytes = 0; long long _totalDatasetSizeInBytes = 0; diff --git a/modules/gaia/shaders/gaia_billboard_fs.glsl b/modules/gaia/shaders/gaia_billboard_fs.glsl index cf19477232..d9b9ebbbd5 100644 --- a/modules/gaia/shaders/gaia_billboard_fs.glsl +++ b/modules/gaia/shaders/gaia_billboard_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/shaders/gaia_billboard_ge.glsl b/modules/gaia/shaders/gaia_billboard_ge.glsl index 498df41df8..6ff847259d 100644 --- a/modules/gaia/shaders/gaia_billboard_ge.glsl +++ b/modules/gaia/shaders/gaia_billboard_ge.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/shaders/gaia_billboard_nofbo_fs.glsl b/modules/gaia/shaders/gaia_billboard_nofbo_fs.glsl index 477a24a3ea..2e67386300 100644 --- a/modules/gaia/shaders/gaia_billboard_nofbo_fs.glsl +++ b/modules/gaia/shaders/gaia_billboard_nofbo_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/shaders/gaia_point_fs.glsl b/modules/gaia/shaders/gaia_point_fs.glsl index 35e77c28fc..22fa3fafb9 100644 --- a/modules/gaia/shaders/gaia_point_fs.glsl +++ b/modules/gaia/shaders/gaia_point_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/shaders/gaia_point_ge.glsl b/modules/gaia/shaders/gaia_point_ge.glsl index da23cf0cff..e8eeecb2aa 100644 --- a/modules/gaia/shaders/gaia_point_ge.glsl +++ b/modules/gaia/shaders/gaia_point_ge.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/shaders/gaia_ssbo_vs.glsl b/modules/gaia/shaders/gaia_ssbo_vs.glsl index 95fa3d99dd..08aee91a65 100644 --- a/modules/gaia/shaders/gaia_ssbo_vs.glsl +++ b/modules/gaia/shaders/gaia_ssbo_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/shaders/gaia_tonemapping_billboard_fs.glsl b/modules/gaia/shaders/gaia_tonemapping_billboard_fs.glsl index 1643a261ea..3cf794162f 100644 --- a/modules/gaia/shaders/gaia_tonemapping_billboard_fs.glsl +++ b/modules/gaia/shaders/gaia_tonemapping_billboard_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/shaders/gaia_tonemapping_point_fs.glsl b/modules/gaia/shaders/gaia_tonemapping_point_fs.glsl index 965f735b49..6b91cc0ef0 100644 --- a/modules/gaia/shaders/gaia_tonemapping_point_fs.glsl +++ b/modules/gaia/shaders/gaia_tonemapping_point_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/shaders/gaia_tonemapping_vs.glsl b/modules/gaia/shaders/gaia_tonemapping_vs.glsl index 89f1175b56..2f9122836d 100644 --- a/modules/gaia/shaders/gaia_tonemapping_vs.glsl +++ b/modules/gaia/shaders/gaia_tonemapping_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/shaders/gaia_vbo_vs.glsl b/modules/gaia/shaders/gaia_vbo_vs.glsl index 25bc51f9c0..a87aacf2d1 100644 --- a/modules/gaia/shaders/gaia_vbo_vs.glsl +++ b/modules/gaia/shaders/gaia_vbo_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/tasks/constructoctreetask.cpp b/modules/gaia/tasks/constructoctreetask.cpp index 7af1fc746e..725d86963c 100644 --- a/modules/gaia/tasks/constructoctreetask.cpp +++ b/modules/gaia/tasks/constructoctreetask.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/tasks/constructoctreetask.h b/modules/gaia/tasks/constructoctreetask.h index 2954aea07c..824521e340 100644 --- a/modules/gaia/tasks/constructoctreetask.h +++ b/modules/gaia/tasks/constructoctreetask.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/tasks/readfilejob.cpp b/modules/gaia/tasks/readfilejob.cpp index c3357ad362..ac15d85d87 100644 --- a/modules/gaia/tasks/readfilejob.cpp +++ b/modules/gaia/tasks/readfilejob.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/tasks/readfilejob.h b/modules/gaia/tasks/readfilejob.h index f615e80ff2..13f3cfc38b 100644 --- a/modules/gaia/tasks/readfilejob.h +++ b/modules/gaia/tasks/readfilejob.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/tasks/readfitstask.cpp b/modules/gaia/tasks/readfitstask.cpp index 8572f64078..5cbe1cf384 100644 --- a/modules/gaia/tasks/readfitstask.cpp +++ b/modules/gaia/tasks/readfitstask.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/tasks/readfitstask.h b/modules/gaia/tasks/readfitstask.h index bd97e3d0be..ba3981fa0b 100644 --- a/modules/gaia/tasks/readfitstask.h +++ b/modules/gaia/tasks/readfitstask.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/tasks/readspecktask.cpp b/modules/gaia/tasks/readspecktask.cpp index 1665ef0963..d30d39d058 100644 --- a/modules/gaia/tasks/readspecktask.cpp +++ b/modules/gaia/tasks/readspecktask.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/gaia/tasks/readspecktask.h b/modules/gaia/tasks/readspecktask.h index 3a5cd097ff..e9c6517dfb 100644 --- a/modules/gaia/tasks/readspecktask.h +++ b/modules/gaia/tasks/readspecktask.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/CMakeLists.txt b/modules/galaxy/CMakeLists.txt index 48b3d68d12..065f3971bc 100644 --- a/modules/galaxy/CMakeLists.txt +++ b/modules/galaxy/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/galaxy/galaxymodule.cpp b/modules/galaxy/galaxymodule.cpp index 63695821bd..504c807102 100644 --- a/modules/galaxy/galaxymodule.cpp +++ b/modules/galaxy/galaxymodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/galaxymodule.h b/modules/galaxy/galaxymodule.h index 1a7e6a3e1a..bc72bcf948 100644 --- a/modules/galaxy/galaxymodule.h +++ b/modules/galaxy/galaxymodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/rendering/galaxyraycaster.cpp b/modules/galaxy/rendering/galaxyraycaster.cpp index 7a38a44733..076662d73c 100644 --- a/modules/galaxy/rendering/galaxyraycaster.cpp +++ b/modules/galaxy/rendering/galaxyraycaster.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/rendering/galaxyraycaster.h b/modules/galaxy/rendering/galaxyraycaster.h index 4bf4e98f19..cb8cf6de12 100644 --- a/modules/galaxy/rendering/galaxyraycaster.h +++ b/modules/galaxy/rendering/galaxyraycaster.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -78,13 +78,13 @@ private: glm::dmat4 modelViewTransform(const RenderData& data); BoxGeometry _boundingBox; - float _stepSize; - glm::mat4 _modelTransform; - glm::vec3 _aspect; - double _time; - float _opacityCoefficient; - float _absorptionMultiply; - float _emissionMultiply; + float _stepSize = 0.f; + glm::mat4 _modelTransform = glm::mat4(1.f); + glm::vec3 _aspect = glm::vec3(0.f); + double _time = 0.0; + float _opacityCoefficient = 0.f; + float _absorptionMultiply = 0.f; + float _emissionMultiply = 0.f; ghoul::opengl::Texture& _texture; std::unique_ptr _textureUnit; diff --git a/modules/galaxy/rendering/renderablegalaxy.cpp b/modules/galaxy/rendering/renderablegalaxy.cpp index ecdd0c276f..9023fe154d 100644 --- a/modules/galaxy/rendering/renderablegalaxy.cpp +++ b/modules/galaxy/rendering/renderablegalaxy.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -183,7 +183,12 @@ RenderableGalaxy::RenderableGalaxy(const ghoul::Dictionary& dictionary) ) , _enabledPointsRatio(EnabledPointsRatioInfo, 0.5f, 0.01f, 1.0f) , _translation(TranslationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(1.f)) - , _rotation(RotationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(6.28f)) + , _rotation( + RotationInfo, + glm::vec3(0.f), + glm::vec3(0.f), + glm::vec3(glm::two_pi()) + ) , _downScaleVolumeRendering(DownscaleVolumeRenderingInfo, 1.f, 0.1f, 1.f) , _numberOfRayCastingSteps(NumberOfRayCastingStepsInfo, 1000.f, 1.f, 1000.f) { @@ -260,14 +265,14 @@ RenderableGalaxy::RenderableGalaxy(const ghoul::Dictionary& dictionary) else { LERROR("No volume filename specified."); } - glm::vec3 volumeDimensions; + glm::vec3 volumeDimensions = glm::vec3(0.f); if (volumeDictionary.getValue("Dimensions", volumeDimensions)) { _volumeDimensions = static_cast(volumeDimensions); } else { LERROR("No volume dimensions specified."); } - glm::vec3 volumeSize; + glm::vec3 volumeSize = glm::vec3(0.f); if (volumeDictionary.getValue("Size", volumeSize)) { _volumeSize = volumeSize; } @@ -534,18 +539,18 @@ void RenderableGalaxy::update(const UpdateData& data) { //glm::mat4 transform = glm::translate(, static_cast(_translation)); const glm::vec3 eulerRotation = static_cast(_rotation); glm::mat4 transform = glm::rotate( - glm::mat4(1.0), + glm::mat4(1.f), eulerRotation.x, - glm::vec3(1, 0, 0) + glm::vec3(1.f, 0.f, 0.f) ); - transform = glm::rotate(transform, eulerRotation.y, glm::vec3(0, 1, 0)); - transform = glm::rotate(transform, eulerRotation.z, glm::vec3(0, 0, 1)); + transform = glm::rotate(transform, eulerRotation.y, glm::vec3(0.f, 1.f, 0.f)); + transform = glm::rotate(transform, eulerRotation.z, glm::vec3(0.f, 0.f, 1.f)); glm::mat4 volumeTransform = glm::scale(transform, _volumeSize); _pointTransform = transform; //_pointTransform = glm::scale(transform, _pointScaling); - const glm::vec4 translation = glm::vec4(_translation.value()*_volumeSize, 0.0); + const glm::vec4 translation = glm::vec4(_translation.value()*_volumeSize, 0.f); // Todo: handle floating point overflow, to actually support translation. diff --git a/modules/galaxy/rendering/renderablegalaxy.h b/modules/galaxy/rendering/renderablegalaxy.h index 2f8c4ff570..d48ac6d2ab 100644 --- a/modules/galaxy/rendering/renderablegalaxy.h +++ b/modules/galaxy/rendering/renderablegalaxy.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -66,8 +66,8 @@ private: Result loadPointFile(const std::string& file); Result loadCachedFile(const std::string& file); - glm::vec3 _volumeSize; - glm::vec3 _pointScaling; + glm::vec3 _volumeSize = glm::vec3(0.f); + glm::vec3 _pointScaling = glm::vec3(0.f); properties::BoolProperty _volumeRenderingEnabled; properties::BoolProperty _starRenderingEnabled; properties::FloatProperty _stepSize; @@ -84,16 +84,16 @@ private: std::unique_ptr _pointSpreadFunctionFile; std::string _volumeFilename; - glm::ivec3 _volumeDimensions; + glm::ivec3 _volumeDimensions = glm::ivec3(0); std::string _pointsFilename; std::string _pointSpreadFunctionTexturePath; std::unique_ptr _raycaster; std::unique_ptr>> _volume; std::unique_ptr _texture; - glm::mat4 _pointTransform; - glm::vec3 _aspect; - float _opacityCoefficient; + glm::mat4 _pointTransform = glm::mat4(1.f); + glm::vec3 _aspect = glm::vec3(0.f); + float _opacityCoefficient = 0.f; std::unique_ptr _pointsProgram; std::unique_ptr _billboardsProgram; @@ -106,10 +106,10 @@ private: cameraUp, eyePosition, psfTexture ) _uniformCacheBillboards; std::vector _pointsData; - size_t _nPoints; - GLuint _pointsVao; - GLuint _positionVbo; - GLuint _colorVbo; + size_t _nPoints = 0; + GLuint _pointsVao = 0; + GLuint _positionVbo = 0; + GLuint _colorVbo = 0; }; } // namespace openspace diff --git a/modules/galaxy/shaders/billboard_fs.glsl b/modules/galaxy/shaders/billboard_fs.glsl index cf758b3cab..8d6bb8086d 100644 --- a/modules/galaxy/shaders/billboard_fs.glsl +++ b/modules/galaxy/shaders/billboard_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/shaders/billboard_ge.glsl b/modules/galaxy/shaders/billboard_ge.glsl index d57daee59a..f6d1514312 100644 --- a/modules/galaxy/shaders/billboard_ge.glsl +++ b/modules/galaxy/shaders/billboard_ge.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/shaders/billboard_vs.glsl b/modules/galaxy/shaders/billboard_vs.glsl index 2893bccdd7..ee5fff53fb 100644 --- a/modules/galaxy/shaders/billboard_vs.glsl +++ b/modules/galaxy/shaders/billboard_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/shaders/points_fs.glsl b/modules/galaxy/shaders/points_fs.glsl index 42a13db7b8..702046e45a 100644 --- a/modules/galaxy/shaders/points_fs.glsl +++ b/modules/galaxy/shaders/points_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/shaders/points_vs.glsl b/modules/galaxy/shaders/points_vs.glsl index 456d12923b..c8be748996 100644 --- a/modules/galaxy/shaders/points_vs.glsl +++ b/modules/galaxy/shaders/points_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/shaders/raycasterbounds_fs.glsl b/modules/galaxy/shaders/raycasterbounds_fs.glsl index 7b54a237a2..993bc884e1 100644 --- a/modules/galaxy/shaders/raycasterbounds_fs.glsl +++ b/modules/galaxy/shaders/raycasterbounds_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/shaders/raycasterbounds_vs.glsl b/modules/galaxy/shaders/raycasterbounds_vs.glsl index 0334e47569..5e1ddaed80 100644 --- a/modules/galaxy/shaders/raycasterbounds_vs.glsl +++ b/modules/galaxy/shaders/raycasterbounds_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/tasks/milkywayconversiontask.cpp b/modules/galaxy/tasks/milkywayconversiontask.cpp index cedc01fb2e..ec985ad917 100644 --- a/modules/galaxy/tasks/milkywayconversiontask.cpp +++ b/modules/galaxy/tasks/milkywayconversiontask.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -86,8 +86,8 @@ void MilkywayConversionTask::perform(const Task::ProgressCallback& onProgress) { ); std::function(glm::ivec3)> sampleFunction = [&](glm::ivec3 outCoord) { - const glm::vec3 inCoord = ((glm::vec3(outCoord) + glm::vec3(0.5)) * - resolutionRatio) - glm::vec3(0.5); + const glm::vec3 inCoord = ((glm::vec3(outCoord) + glm::vec3(0.5f)) * + resolutionRatio) - glm::vec3(0.5f); const glm::tvec4 value = sampler.sample(inCoord); return value; }; diff --git a/modules/galaxy/tasks/milkywayconversiontask.h b/modules/galaxy/tasks/milkywayconversiontask.h index 0fefa0eb2b..47ff0707aa 100644 --- a/modules/galaxy/tasks/milkywayconversiontask.h +++ b/modules/galaxy/tasks/milkywayconversiontask.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -50,10 +50,10 @@ public: private: std::string _inFilenamePrefix; std::string _inFilenameSuffix; - size_t _inFirstIndex; - size_t _inNSlices; + size_t _inFirstIndex = 0; + size_t _inNSlices = 0; std::string _outFilename; - glm::ivec3 _outDimensions; + glm::ivec3 _outDimensions = glm::ivec3(0); }; } // namespace openspace diff --git a/modules/galaxy/tasks/milkywaypointsconversiontask.cpp b/modules/galaxy/tasks/milkywaypointsconversiontask.cpp index 53f487bf23..a79de9153e 100644 --- a/modules/galaxy/tasks/milkywaypointsconversiontask.cpp +++ b/modules/galaxy/tasks/milkywaypointsconversiontask.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/galaxy/tasks/milkywaypointsconversiontask.h b/modules/galaxy/tasks/milkywaypointsconversiontask.h index 7b54632167..e2a1be4a4f 100644 --- a/modules/galaxy/tasks/milkywaypointsconversiontask.h +++ b/modules/galaxy/tasks/milkywaypointsconversiontask.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index 7f8550c9e7..ec5c7f389c 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index df7dd2dbc2..4eb99dd7da 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -43,8 +43,9 @@ #include #include #include -#include #include +#include +#include #include #include @@ -236,6 +237,8 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { // Initialize global::callback::initializeGL.emplace_back([&]() { + ZoneScopedN("GlobeBrowsingModule") + _tileCache = std::make_unique( _tileCacheSizeMB ); @@ -252,16 +255,24 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { }); global::callback::deinitializeGL.emplace_back([]() { + ZoneScopedN("GlobeBrowsingModule") + tileprovider::deinitializeDefaultTile(); }); // Render - global::callback::render.emplace_back([&]() { _tileCache->update(); }); + global::callback::render.emplace_back([&]() { + ZoneScopedN("GlobeBrowsingModule") + + _tileCache->update(); + }); // Postdraw #ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION global::callback::postDraw.emplace_back([&]() { + ZoneScopedN("GlobeBrowsingModule") + // >= as we might have multiple frames per postDraw call (stereo rendering, // fisheye, etc) const uint16_t next = _frameInfo.lastSavedFrame + _frameInfo.saveEveryNthFrame; @@ -297,7 +308,11 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { #endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION // Deinitialize - global::callback::deinitialize.emplace_back([&]() { GdalWrapper::destroy(); }); + global::callback::deinitialize.emplace_back([&]() { + ZoneScopedN("GlobeBrowsingModule") + + GdalWrapper::destroy(); + }); auto fRenderable = FactoryManager::ref().factory(); ghoul_assert(fRenderable, "Renderable factory was not created"); diff --git a/modules/globebrowsing/globebrowsingmodule.h b/modules/globebrowsing/globebrowsingmodule.h index 8f9367a0fd..e6af83d999 100644 --- a/modules/globebrowsing/globebrowsingmodule.h +++ b/modules/globebrowsing/globebrowsingmodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl index 82f7690d65..86d474d64c 100644 --- a/modules/globebrowsing/globebrowsingmodule_lua.inl +++ b/modules/globebrowsing/globebrowsingmodule_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/shaders/blending.hglsl b/modules/globebrowsing/shaders/blending.hglsl index ed63e61461..2157a1314c 100644 --- a/modules/globebrowsing/shaders/blending.hglsl +++ b/modules/globebrowsing/shaders/blending.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/shaders/globalrenderer_vs.glsl b/modules/globebrowsing/shaders/globalrenderer_vs.glsl index 84c0edbc7f..a72d20dc96 100644 --- a/modules/globebrowsing/shaders/globalrenderer_vs.glsl +++ b/modules/globebrowsing/shaders/globalrenderer_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/shaders/localrenderer_vs.glsl b/modules/globebrowsing/shaders/localrenderer_vs.glsl index cdafdef007..22a8930f8d 100644 --- a/modules/globebrowsing/shaders/localrenderer_vs.glsl +++ b/modules/globebrowsing/shaders/localrenderer_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/shaders/renderer_fs.glsl b/modules/globebrowsing/shaders/renderer_fs.glsl index c08f078622..ff1bf76f0f 100644 --- a/modules/globebrowsing/shaders/renderer_fs.glsl +++ b/modules/globebrowsing/shaders/renderer_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -60,9 +60,12 @@ uniform float orenNayarRoughness; #endif #if SHADOW_MAPPING_ENABLED + +#define NSSamplesMinusOne #{nShadowSamples} +#define NSSamples (NSSamplesMinusOne + 1) + in vec4 shadowCoords; uniform sampler2DShadow shadowMapTexture; -uniform int nShadowSamples; uniform float zFightingPercentage; #endif @@ -273,19 +276,19 @@ Fragment getFragment() { normalizedShadowCoords.xy = normalizedShadowCoords.xy / normalizedShadowCoords.w; normalizedShadowCoords.w = 1.0; - float sum = 0; - for (int i = 0; i < nShadowSamples; ++i) { - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, 0)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, nShadowSamples - i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , nShadowSamples - i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, 0)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, nShadowSamples - i)); - } + float sum = 0; + #for i in 0..#{nShadowSamples} + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, 0)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, NSSamples - #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , NSSamples - #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, 0)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, NSSamples - #{i})); + #endfor sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(0, 0)); - shadow = sum / (8.0 * nShadowSamples + 1.f); + shadow = sum / (8.0 * NSSamples + 1.f); } frag.color.xyz *= shadow < 0.99 ? clamp(shadow + 0.3, 0.0, 1.0) : shadow; #endif diff --git a/modules/globebrowsing/shaders/rings_fs.glsl b/modules/globebrowsing/shaders/rings_fs.glsl index bae6535326..b18d5d71a8 100644 --- a/modules/globebrowsing/shaders/rings_fs.glsl +++ b/modules/globebrowsing/shaders/rings_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -25,6 +25,9 @@ #include "PowerScaling/powerScaling_fs.hglsl" #include "fragment.glsl" +#define NSSamplesMinusOne #{nShadowSamples} +#define NSSamples (NSSamplesMinusOne + 1) + in vec2 vs_st; in float vs_screenSpaceDepth; in vec4 shadowCoords; @@ -36,12 +39,12 @@ uniform float transparency; uniform vec3 sunPosition; uniform float _nightFactor; -uniform int nShadowSamples; uniform float zFightingPercentage; // temp in vec4 fragPosInLightSpace; + Fragment getFragment() { // Moving the origin to the center vec2 st = (vs_st - vec2(0.5)) * 2.0; @@ -83,20 +86,20 @@ Fragment getFragment() { normalizedShadowCoords.w = 1.0; float sum = 0; - for (int i = 0; i < nShadowSamples; ++i) { - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, 0)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-nShadowSamples + i, nShadowSamples - i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , nShadowSamples - i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, -nShadowSamples + i)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, 0)); - sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( nShadowSamples - i, nShadowSamples - i)); - } + #for i in 0..#{nShadowSamples} + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, 0)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(-NSSamples + #{i}, NSSamples - #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( 0 , NSSamples - #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, -NSSamples + #{i})); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, 0)); + sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2( NSSamples - #{i}, NSSamples - #{i})); + #endfor sum += textureProjOffset(shadowMapTexture, normalizedShadowCoords, ivec2(0, 0)); - shadow = sum / (8.0 * nShadowSamples + 1.f); + shadow = clamp(sum / (8.0 * NSSamples + 1.f), 0.35, 1.0); } - + // The normal for the one plane depends on whether we are dealing // with a front facing or back facing fragment vec3 normal; @@ -117,7 +120,7 @@ Fragment getFragment() { Fragment frag; - frag.color = (0.65 * diffuse * shadow) + diffuse * 0.35; + frag.color = diffuse * shadow; frag.depth = vs_screenSpaceDepth; frag.gPosition = vec4(1e30, 1e30, 1e30, 1.0); frag.gNormal = vec4(normal, 1.0); diff --git a/modules/globebrowsing/shaders/rings_geom_fs.glsl b/modules/globebrowsing/shaders/rings_geom_fs.glsl index d7ec721368..48b1174baa 100644 --- a/modules/globebrowsing/shaders/rings_geom_fs.glsl +++ b/modules/globebrowsing/shaders/rings_geom_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/shaders/rings_geom_vs.glsl b/modules/globebrowsing/shaders/rings_geom_vs.glsl index f803cd15bc..63f7eda7a8 100644 --- a/modules/globebrowsing/shaders/rings_geom_vs.glsl +++ b/modules/globebrowsing/shaders/rings_geom_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/shaders/rings_vs.glsl b/modules/globebrowsing/shaders/rings_vs.glsl index 83c4d4510e..64b7b474dd 100644 --- a/modules/globebrowsing/shaders/rings_vs.glsl +++ b/modules/globebrowsing/shaders/rings_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/shaders/texturetilemapping.hglsl b/modules/globebrowsing/shaders/texturetilemapping.hglsl index cf94053125..ff4b09eb42 100644 --- a/modules/globebrowsing/shaders/texturetilemapping.hglsl +++ b/modules/globebrowsing/shaders/texturetilemapping.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/shaders/tile.hglsl b/modules/globebrowsing/shaders/tile.hglsl index ceb779fe46..25db3772e8 100644 --- a/modules/globebrowsing/shaders/tile.hglsl +++ b/modules/globebrowsing/shaders/tile.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/shaders/tileheight.hglsl b/modules/globebrowsing/shaders/tileheight.hglsl index 1d7c275997..ef08825538 100644 --- a/modules/globebrowsing/shaders/tileheight.hglsl +++ b/modules/globebrowsing/shaders/tileheight.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/shaders/tilevertexskirt.hglsl b/modules/globebrowsing/shaders/tilevertexskirt.hglsl index a2ae1f5163..3545797091 100644 --- a/modules/globebrowsing/shaders/tilevertexskirt.hglsl +++ b/modules/globebrowsing/shaders/tilevertexskirt.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/asynctiledataprovider.cpp b/modules/globebrowsing/src/asynctiledataprovider.cpp index 86ff2ab39f..45e4fbe84b 100644 --- a/modules/globebrowsing/src/asynctiledataprovider.cpp +++ b/modules/globebrowsing/src/asynctiledataprovider.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/asynctiledataprovider.h b/modules/globebrowsing/src/asynctiledataprovider.h index 1d6fe46e80..00d8230749 100644 --- a/modules/globebrowsing/src/asynctiledataprovider.h +++ b/modules/globebrowsing/src/asynctiledataprovider.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/basictypes.h b/modules/globebrowsing/src/basictypes.h index e4fce70c48..e26d439bf8 100644 --- a/modules/globebrowsing/src/basictypes.h +++ b/modules/globebrowsing/src/basictypes.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -147,8 +147,8 @@ public: struct TileUvTransform { - glm::vec2 uvOffset; - glm::vec2 uvScale; + glm::vec2 uvOffset = glm::vec2(0.f); + glm::vec2 uvScale = glm::vec2(0.f); }; diff --git a/modules/globebrowsing/src/dashboarditemglobelocation.cpp b/modules/globebrowsing/src/dashboarditemglobelocation.cpp index 3b6dcbf462..6fee2ccdc5 100644 --- a/modules/globebrowsing/src/dashboarditemglobelocation.cpp +++ b/modules/globebrowsing/src/dashboarditemglobelocation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/dashboarditemglobelocation.h b/modules/globebrowsing/src/dashboarditemglobelocation.h index a4528a81d3..12c6f6fc84 100644 --- a/modules/globebrowsing/src/dashboarditemglobelocation.h +++ b/modules/globebrowsing/src/dashboarditemglobelocation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/ellipsoid.cpp b/modules/globebrowsing/src/ellipsoid.cpp index 7cb68b4c05..8045bfb63a 100644 --- a/modules/globebrowsing/src/ellipsoid.cpp +++ b/modules/globebrowsing/src/ellipsoid.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -62,7 +62,7 @@ glm::dvec3 Ellipsoid::geodeticSurfaceProjection(const glm::dvec3& p) const { double alpha = (1.0 - beta) * (glm::length(p) / n); const glm::dvec3 p2 = p * p; - glm::dvec3 d; + glm::dvec3 d = glm::dvec3(0.0); double s = 0.0; double dSdA = 1.0; diff --git a/modules/globebrowsing/src/ellipsoid.h b/modules/globebrowsing/src/ellipsoid.h index 20eb0b29ae..44376ceda0 100644 --- a/modules/globebrowsing/src/ellipsoid.h +++ b/modules/globebrowsing/src/ellipsoid.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -54,7 +54,7 @@ public: /** * \param radii defines three radii for the Ellipsoid */ - Ellipsoid(glm::dvec3 radii = glm::dvec3(1.0, 1.0, 1.0)); + Ellipsoid(glm::dvec3 radii = glm::dvec3(1.0)); /** * Scales a point along the geocentric normal and places it on the surface of the @@ -95,16 +95,16 @@ public: private: struct EllipsoidCache { - glm::dvec3 radiiSquared; - glm::dvec3 oneOverRadiiSquared; - glm::dvec3 radiiToTheFourth; - double minimumRadius; - double maximumRadius; + glm::dvec3 radiiSquared = glm::dvec3(0.0); + glm::dvec3 oneOverRadiiSquared = glm::dvec3(0.0); + glm::dvec3 radiiToTheFourth = glm::dvec3(0.0); + double minimumRadius = 0.0; + double maximumRadius = 0.0; } _cached; void updateInternalCache(); - glm::dvec3 _radii; + glm::dvec3 _radii = glm::dvec3(0.0); // Eclipse shadows conf std::vector _shadowConfArray; diff --git a/modules/globebrowsing/src/gdalwrapper.cpp b/modules/globebrowsing/src/gdalwrapper.cpp index b70fb514e9..976fa193e8 100644 --- a/modules/globebrowsing/src/gdalwrapper.cpp +++ b/modules/globebrowsing/src/gdalwrapper.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -75,7 +75,6 @@ void GdalWrapper::create(size_t maximumCacheSize, size_t maximumMaximumCacheSize } void GdalWrapper::destroy() { - ghoul_assert(_singleton, "Cannot delete null"); delete _singleton; } diff --git a/modules/globebrowsing/src/gdalwrapper.h b/modules/globebrowsing/src/gdalwrapper.h index 24ffd4431c..afbbe2d211 100644 --- a/modules/globebrowsing/src/gdalwrapper.h +++ b/modules/globebrowsing/src/gdalwrapper.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/geodeticpatch.cpp b/modules/globebrowsing/src/geodeticpatch.cpp index 5caf972989..5dc5725426 100644 --- a/modules/globebrowsing/src/geodeticpatch.cpp +++ b/modules/globebrowsing/src/geodeticpatch.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/geodeticpatch.h b/modules/globebrowsing/src/geodeticpatch.h index c4c9f1f257..7ade7987ac 100644 --- a/modules/globebrowsing/src/geodeticpatch.h +++ b/modules/globebrowsing/src/geodeticpatch.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/globelabelscomponent.cpp b/modules/globebrowsing/src/globelabelscomponent.cpp index 9cea901ce7..2e678a03c6 100644 --- a/modules/globebrowsing/src/globelabelscomponent.cpp +++ b/modules/globebrowsing/src/globelabelscomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/globelabelscomponent.h b/modules/globebrowsing/src/globelabelscomponent.h index ed6727edcd..98371f39e6 100644 --- a/modules/globebrowsing/src/globelabelscomponent.h +++ b/modules/globebrowsing/src/globelabelscomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -72,10 +72,10 @@ private: // Labels Structures struct LabelEntry { char feature[256]; - float diameter; - float latitude; - float longitude; - glm::vec3 geoPosition; + float diameter = 0.f; + float latitude = 0.f; + float longitude = 0.f; + glm::vec3 geoPosition = glm::vec3(0.f); }; struct Labels { diff --git a/modules/globebrowsing/src/globetranslation.cpp b/modules/globebrowsing/src/globetranslation.cpp index 560994bed4..708f3ed0b1 100644 --- a/modules/globebrowsing/src/globetranslation.cpp +++ b/modules/globebrowsing/src/globetranslation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/globetranslation.h b/modules/globebrowsing/src/globetranslation.h index 91c0bdf61b..9d5c130537 100644 --- a/modules/globebrowsing/src/globetranslation.h +++ b/modules/globebrowsing/src/globetranslation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -55,7 +55,7 @@ private: RenderableGlobe* _attachedNode = nullptr; mutable bool _positionIsDirty = true; - mutable glm::dvec3 _position; + mutable glm::dvec3 _position = glm::dvec3(0.0); }; } // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/src/gpulayergroup.cpp b/modules/globebrowsing/src/gpulayergroup.cpp index ab581bbd70..5f7797bf1e 100644 --- a/modules/globebrowsing/src/gpulayergroup.cpp +++ b/modules/globebrowsing/src/gpulayergroup.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/gpulayergroup.h b/modules/globebrowsing/src/gpulayergroup.h index 471a9080e8..796cbb46fb 100644 --- a/modules/globebrowsing/src/gpulayergroup.h +++ b/modules/globebrowsing/src/gpulayergroup.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/layer.cpp b/modules/globebrowsing/src/layer.cpp index b176825333..a94c7cae76 100644 --- a/modules/globebrowsing/src/layer.cpp +++ b/modules/globebrowsing/src/layer.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -31,6 +31,7 @@ #include #include #include +#include namespace openspace::globebrowsing { @@ -454,6 +455,8 @@ void Layer::onChange(std::function callback) { } int Layer::update() { + ZoneScoped + if (_tileProvider) { return tileprovider::update(*_tileProvider); } diff --git a/modules/globebrowsing/src/layer.h b/modules/globebrowsing/src/layer.h index fb8f30dfd4..1b7b50dd39 100644 --- a/modules/globebrowsing/src/layer.h +++ b/modules/globebrowsing/src/layer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -94,8 +94,8 @@ private: LayerRenderSettings _renderSettings; LayerAdjustment _layerAdjustment; - glm::ivec2 _padTilePixelStartOffset; - glm::ivec2 _padTilePixelSizeDifference; + glm::ivec2 _padTilePixelStartOffset = glm::ivec2(0); + glm::ivec2 _padTilePixelSizeDifference = glm::ivec2(0); const layergroupid::GroupID _layerGroupId; diff --git a/modules/globebrowsing/src/layeradjustment.cpp b/modules/globebrowsing/src/layeradjustment.cpp index 3317133bb0..2497b4ac2c 100644 --- a/modules/globebrowsing/src/layeradjustment.cpp +++ b/modules/globebrowsing/src/layeradjustment.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/layeradjustment.h b/modules/globebrowsing/src/layeradjustment.h index 07c7c9460c..5993366d77 100644 --- a/modules/globebrowsing/src/layeradjustment.h +++ b/modules/globebrowsing/src/layeradjustment.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/layergroup.cpp b/modules/globebrowsing/src/layergroup.cpp index 909eb3dae4..260594489f 100644 --- a/modules/globebrowsing/src/layergroup.cpp +++ b/modules/globebrowsing/src/layergroup.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -27,6 +27,7 @@ #include #include #include +#include namespace { constexpr const char* _loggerCat = "LayerGroup"; @@ -81,18 +82,24 @@ void LayerGroup::setLayersFromDict(const ghoul::Dictionary& dict) { } void LayerGroup::initialize() { + ZoneScoped + for (const std::unique_ptr& l : _layers) { l->initialize(); } } void LayerGroup::deinitialize() { + ZoneScoped + for (const std::unique_ptr& l : _layers) { l->deinitialize(); } } int LayerGroup::update() { + ZoneScoped + int res = 0; _activeLayers.clear(); diff --git a/modules/globebrowsing/src/layergroup.h b/modules/globebrowsing/src/layergroup.h index f02fd0d80a..3f69e4705e 100644 --- a/modules/globebrowsing/src/layergroup.h +++ b/modules/globebrowsing/src/layergroup.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/layergroupid.cpp b/modules/globebrowsing/src/layergroupid.cpp index 69f8163939..bf1ff8f0fc 100644 --- a/modules/globebrowsing/src/layergroupid.cpp +++ b/modules/globebrowsing/src/layergroupid.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/layergroupid.h b/modules/globebrowsing/src/layergroupid.h index ea363420a4..16c0c92c11 100644 --- a/modules/globebrowsing/src/layergroupid.h +++ b/modules/globebrowsing/src/layergroupid.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/layermanager.cpp b/modules/globebrowsing/src/layermanager.cpp index 18b91da259..76178af1ea 100644 --- a/modules/globebrowsing/src/layermanager.cpp +++ b/modules/globebrowsing/src/layermanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -31,6 +31,7 @@ #include #include #include +#include namespace openspace::globebrowsing { @@ -53,6 +54,8 @@ documentation::Documentation LayerManager::Documentation() { LayerManager::LayerManager() : properties::PropertyOwner({ "Layers" }) {} void LayerManager::initialize(const ghoul::Dictionary& layerGroupsDict) { + ZoneScoped + // First create empty layer groups in case not all are specified for (size_t i = 0; i < _layerGroups.size(); ++i) { _layerGroups[i] = std::make_unique(layergroupid::GroupID(i)); @@ -91,6 +94,8 @@ void LayerManager::deinitialize() { Layer* LayerManager::addLayer(layergroupid::GroupID groupId, const ghoul::Dictionary& layerDict) { + ZoneScoped + ghoul_assert(groupId != layergroupid::Unknown, "Layer group ID must be known"); try { return _layerGroups[groupId]->addLayer(layerDict); @@ -102,6 +107,8 @@ Layer* LayerManager::addLayer(layergroupid::GroupID groupId, } void LayerManager::deleteLayer(layergroupid::GroupID id, const std::string& layerName) { + ZoneScoped + ghoul_assert(id != layergroupid::Unknown, "Layer group ID must be known"); _layerGroups[id]->deleteLayer(layerName); } @@ -115,6 +122,8 @@ const LayerGroup& LayerManager::layerGroup(layergroupid::GroupID groupId) const } bool LayerManager::hasAnyBlendingLayersEnabled() const { + ZoneScoped + return std::any_of( _layerGroups.begin(), _layerGroups.end(), @@ -124,8 +133,9 @@ bool LayerManager::hasAnyBlendingLayersEnabled() const { ); } -std::array LayerManager::layerGroups() const -{ +std::array LayerManager::layerGroups() const { + ZoneScoped + std::array res = {}; for (int i = 0; i < NumLayerGroups; ++i) { res[i] = _layerGroups[i].get(); @@ -134,6 +144,8 @@ std::array LayerManager::layerGroups( } int LayerManager::update() { + ZoneScoped + int res = 0; for (std::unique_ptr& layerGroup : _layerGroups) { res += layerGroup->update(); @@ -142,6 +154,8 @@ int LayerManager::update() { } void LayerManager::reset(bool includeDisabled) { + ZoneScoped + for (std::unique_ptr& layerGroup : _layerGroups) { for (Layer* layer : layerGroup->layers()) { if (layer->enabled() || includeDisabled) { @@ -152,6 +166,8 @@ void LayerManager::reset(bool includeDisabled) { } void LayerManager::onChange(std::function callback) { + ZoneScoped + for (std::unique_ptr& layerGroup : _layerGroups) { layerGroup->onChange(callback); } diff --git a/modules/globebrowsing/src/layermanager.h b/modules/globebrowsing/src/layermanager.h index 3052f8f4ee..1d9889069e 100644 --- a/modules/globebrowsing/src/layermanager.h +++ b/modules/globebrowsing/src/layermanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/layerrendersettings.cpp b/modules/globebrowsing/src/layerrendersettings.cpp index b876a52c4a..79c27dcbd4 100644 --- a/modules/globebrowsing/src/layerrendersettings.cpp +++ b/modules/globebrowsing/src/layerrendersettings.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/layerrendersettings.h b/modules/globebrowsing/src/layerrendersettings.h index 99c688683a..5577fa965f 100644 --- a/modules/globebrowsing/src/layerrendersettings.h +++ b/modules/globebrowsing/src/layerrendersettings.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/lrucache.h b/modules/globebrowsing/src/lrucache.h index 382534e418..7753737248 100644 --- a/modules/globebrowsing/src/lrucache.h +++ b/modules/globebrowsing/src/lrucache.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/lrucache.inl b/modules/globebrowsing/src/lrucache.inl index 188cd7d0d5..2d3dd0b140 100644 --- a/modules/globebrowsing/src/lrucache.inl +++ b/modules/globebrowsing/src/lrucache.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/lruthreadpool.h b/modules/globebrowsing/src/lruthreadpool.h index e2ee9da954..943781bdea 100644 --- a/modules/globebrowsing/src/lruthreadpool.h +++ b/modules/globebrowsing/src/lruthreadpool.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/lruthreadpool.inl b/modules/globebrowsing/src/lruthreadpool.inl index 1690ddb88a..8522ce9cb2 100644 --- a/modules/globebrowsing/src/lruthreadpool.inl +++ b/modules/globebrowsing/src/lruthreadpool.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/memoryawaretilecache.cpp b/modules/globebrowsing/src/memoryawaretilecache.cpp index dffc14c047..efc0175e56 100644 --- a/modules/globebrowsing/src/memoryawaretilecache.cpp +++ b/modules/globebrowsing/src/memoryawaretilecache.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/memoryawaretilecache.h b/modules/globebrowsing/src/memoryawaretilecache.h index 872d016e96..209e0e9aa5 100644 --- a/modules/globebrowsing/src/memoryawaretilecache.h +++ b/modules/globebrowsing/src/memoryawaretilecache.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/prioritizingconcurrentjobmanager.h b/modules/globebrowsing/src/prioritizingconcurrentjobmanager.h index fc8fb5fd56..ec90b4139c 100644 --- a/modules/globebrowsing/src/prioritizingconcurrentjobmanager.h +++ b/modules/globebrowsing/src/prioritizingconcurrentjobmanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/prioritizingconcurrentjobmanager.inl b/modules/globebrowsing/src/prioritizingconcurrentjobmanager.inl index 9fcc65ba3d..3c7668823b 100644 --- a/modules/globebrowsing/src/prioritizingconcurrentjobmanager.inl +++ b/modules/globebrowsing/src/prioritizingconcurrentjobmanager.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/rawtile.cpp b/modules/globebrowsing/src/rawtile.cpp index 9ac964de28..9e626a2d61 100644 --- a/modules/globebrowsing/src/rawtile.cpp +++ b/modules/globebrowsing/src/rawtile.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/rawtile.h b/modules/globebrowsing/src/rawtile.h index 2e2142d721..d992466ff6 100644 --- a/modules/globebrowsing/src/rawtile.h +++ b/modules/globebrowsing/src/rawtile.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/rawtiledatareader.cpp b/modules/globebrowsing/src/rawtiledatareader.cpp index 4c477da259..6cc980e36d 100644 --- a/modules/globebrowsing/src/rawtiledatareader.cpp +++ b/modules/globebrowsing/src/rawtiledatareader.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/rawtiledatareader.h b/modules/globebrowsing/src/rawtiledatareader.h index 12a51a3fc3..94f437199c 100644 --- a/modules/globebrowsing/src/rawtiledatareader.h +++ b/modules/globebrowsing/src/rawtiledatareader.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index 988f6f0caa..257ebd550f 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -64,13 +65,13 @@ namespace { // Shadow structure struct ShadowRenderingStruct { - double xu; - double xp; - double rs; - double rc; - glm::dvec3 sourceCasterVec; - glm::dvec3 casterPositionVec; - bool isShadowing; + double xu = 0.0; + double xp = 0.0; + double rs = 0.0; + double rc = 0.0; + glm::dvec3 sourceCasterVec = glm::dvec3(0.0); + glm::dvec3 casterPositionVec = glm::dvec3(0.0); + bool isShadowing = false; }; constexpr const char* KeyRadii = "Radii"; @@ -303,7 +304,7 @@ BoundingHeights boundingHeightsForChunk(const Chunk& chunk, const LayerManager& const bool hasTileMetaData = chunkTile.tile.metaData.has_value(); if (goodTile && hasTileMetaData) { - const TileMetaData& tileMetaData = chunkTile.tile.metaData.value(); + const TileMetaData& tileMetaData = *chunkTile.tile.metaData; const float minValue = settings->performLayerSettings( tileMetaData.minValues[HeightChannel] @@ -517,14 +518,14 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) BoolProperty(EclipseHardShadowsInfo, false), BoolProperty(ShadowMappingInfo, false), FloatProperty(ZFightingPercentageInfo, 0.995f, 0.000001f, 1.f), - IntProperty(NumberShadowSamplesInfo, 5, 1, 20), + IntProperty(NumberShadowSamplesInfo, 5, 1, 7), FloatProperty(TargetLodScaleFactorInfo, 15.f, 1.f, 50.f), FloatProperty(CurrentLodScaleFactorInfo, 15.f, 1.f, 50.f), FloatProperty(CameraMinHeightInfo, 100.f, 0.f, 1000.f), FloatProperty(OrenNayarRoughnessInfo, 0.f, 0.f, 1.f), IntProperty(NActiveLayersInfo, 0, 0, OpenGLCap.maxTextureUnits() / 3) }) - , _shadowMappingPropertyOwner({ "Shadow Mapping" }) + , _shadowMappingPropertyOwner({ "ShadowMapping" }) , _debugPropertyOwner({ "Debug" }) , _grid(DefaultSkirtedGridSegments, DefaultSkirtedGridSegments) , _leftRoot(Chunk(LeftHemisphereIndex)) @@ -565,6 +566,9 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) _shadowMappingPropertyOwner.addProperty(_generalProperties.shadowMapping); _shadowMappingPropertyOwner.addProperty(_generalProperties.zFightingPercentage); _shadowMappingPropertyOwner.addProperty(_generalProperties.nShadowSamples); + _generalProperties.nShadowSamples.onChange([&]() { + _shadersNeedRecompilation = true; + }); addPropertySubOwner(_shadowMappingPropertyOwner); _generalProperties.targetLodScaleFactor.onChange([this]() { @@ -968,6 +972,8 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, const ShadowComponent::ShadowMapData& shadowData, bool renderGeomOnly) { + ZoneScoped + if (_shadersNeedRecompilation) { recompileShaders(); } @@ -1165,6 +1171,8 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, auto traversal = [&global, &globalCount, &local, &localCount, cutoff = _debugProperties.modelSpaceRenderingCutoffLevel](const Chunk& node) { + ZoneScopedN("traversal") + std::vector Q; Q.reserve(256); @@ -1269,6 +1277,9 @@ void RenderableGlobe::renderChunkGlobally(const Chunk& chunk, const RenderData& const ShadowComponent::ShadowMapData& shadowData, bool renderGeomOnly) { + ZoneScoped + TracyGpuZone("renderChunkGlobally") + //PerfMeasure("globally"); const TileIndex& tileIndex = chunk.tileIndex; ghoul::opengl::ProgramObject& program = *_globalRenderer.program; @@ -1330,7 +1341,6 @@ void RenderableGlobe::renderChunkGlobally(const Chunk& chunk, const RenderData& glBindTexture(GL_TEXTURE_2D, shadowData.shadowDepthTexture); program.setUniform("shadowMapTexture", shadowMapUnit); - program.setUniform("nShadowSamples", _generalProperties.nShadowSamples); program.setUniform("zFightingPercentage", _generalProperties.zFightingPercentage); } @@ -1352,6 +1362,9 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d const ShadowComponent::ShadowMapData& shadowData, bool renderGeomOnly) { + ZoneScoped + TracyGpuZone("renderChunkLocally") + //PerfMeasure("locally"); const TileIndex& tileIndex = chunk.tileIndex; ghoul::opengl::ProgramObject& program = *_localRenderer.program; @@ -1458,7 +1471,6 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d glBindTexture(GL_TEXTURE_2D, shadowData.shadowDepthTexture); program.setUniform("shadowMapTexture", shadowMapUnit); - program.setUniform("nShadowSamples", _generalProperties.nShadowSamples); program.setUniform("zFightingPercentage", _generalProperties.zFightingPercentage); } @@ -1476,7 +1488,10 @@ 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, bool renderAABB) const +{ + ZoneScoped + const std::array& modelSpaceCorners = chunk.corners; std::vector clippingSpaceCorners(8); @@ -1515,8 +1530,10 @@ void RenderableGlobe::debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp ////////////////////////////////////////////////////////////////////////////////////////// void RenderableGlobe::setCommonUniforms(ghoul::opengl::ProgramObject& programObject, - const Chunk& chunk, const RenderData& data) + const Chunk& chunk, const RenderData& data) { + ZoneScoped + if (_generalProperties.useAccurateNormals && !_layerManager.layerGroup(layergroupid::HeightLayers).activeLayers().empty()) { @@ -1563,6 +1580,8 @@ void RenderableGlobe::setCommonUniforms(ghoul::opengl::ProgramObject& programObj } void RenderableGlobe::recompileShaders() { + ZoneScoped + struct LayerShaderPreprocessingData { struct LayerGroupPreprocessingData { int lastLayerIdx; @@ -1726,6 +1745,9 @@ void RenderableGlobe::recompileShaders() { shaderDictionary.setValue(p.first, p.second); } + // Shadow Mapping Samples + shaderDictionary.setValue("nShadowSamples", _generalProperties.nShadowSamples - 1); + // // Create local shader // @@ -1794,6 +1816,8 @@ void RenderableGlobe::recompileShaders() { SurfacePositionHandle RenderableGlobe::calculateSurfacePositionHandle( const glm::dvec3& targetModelSpace) const { + ZoneScoped + glm::dvec3 centerToEllipsoidSurface = _ellipsoid.geodeticSurfaceProjection(targetModelSpace); glm::dvec3 ellipsoidSurfaceToTarget = targetModelSpace - centerToEllipsoidSurface; @@ -1824,6 +1848,8 @@ bool RenderableGlobe::testIfCullable(const Chunk& chunk, const RenderData& renderData, const BoundingHeights& heights) const { + ZoneScoped + return (PreformHorizonCulling && isCullableByHorizon(chunk, renderData, heights)) || (PerformFrustumCulling && isCullableByFrustum(chunk, renderData)); } @@ -1831,6 +1857,8 @@ bool RenderableGlobe::testIfCullable(const Chunk& chunk, int RenderableGlobe::desiredLevel(const Chunk& chunk, const RenderData& renderData, const BoundingHeights& heights) const { + ZoneScoped + const int desiredLevel = _debugProperties.levelByProjectedAreaElseDistance ? desiredLevelByProjectedArea(chunk, renderData, heights) : desiredLevelByDistance(chunk, renderData, heights); @@ -1846,6 +1874,8 @@ int RenderableGlobe::desiredLevel(const Chunk& chunk, const RenderData& renderDa } float RenderableGlobe::getHeight(const glm::dvec3& position) const { + ZoneScoped + float height = 0; // Get the uv coordinates to sample from @@ -1997,6 +2027,8 @@ float RenderableGlobe::getHeight(const glm::dvec3& position) const { void RenderableGlobe::calculateEclipseShadows(ghoul::opengl::ProgramObject& programObject, const RenderData& data, ShadowCompType stype) { + ZoneScoped + constexpr const double KM_TO_M = 1000.0; ghoul_assert( @@ -2137,6 +2169,8 @@ int RenderableGlobe::desiredLevelByDistance(const Chunk& chunk, const RenderData& data, const BoundingHeights& heights) const { + ZoneScoped + // Calculations are done in the reference frame of the globe // (model space). Hence, the camera position needs to be transformed // with the inverse model matrix @@ -2171,6 +2205,8 @@ int RenderableGlobe::desiredLevelByProjectedArea(const Chunk& chunk, const RenderData& data, const BoundingHeights& heights) const { + ZoneScoped + // Calculations are done in the reference frame of the globe // (model space). Hence, the camera position needs to be transformed // with the inverse model matrix @@ -2251,6 +2287,8 @@ int RenderableGlobe::desiredLevelByProjectedArea(const Chunk& chunk, } int RenderableGlobe::desiredLevelByAvailableTileData(const Chunk& chunk) const { + ZoneScoped + const int currLevel = chunk.tileIndex.level; for (size_t i = 0; i < layergroupid::NUM_LAYER_GROUPS; ++i) { @@ -2274,6 +2312,8 @@ int RenderableGlobe::desiredLevelByAvailableTileData(const Chunk& chunk) const { bool RenderableGlobe::isCullableByFrustum(const Chunk& chunk, const RenderData& renderData) const { + ZoneScoped + // Calculate the MVP matrix const glm::dmat4 viewTransform = glm::dmat4(renderData.camera.combinedViewMatrix()); const glm::dmat4 modelViewProjectionTransform = glm::dmat4( @@ -2299,6 +2339,8 @@ bool RenderableGlobe::isCullableByHorizon(const Chunk& chunk, const RenderData& renderData, const BoundingHeights& heights) const { + ZoneScoped + // Calculations are done in the reference frame of the globe. Hence, the camera // position needs to be transformed with the inverse model matrix const GeodeticPatch& patch = chunk.surfacePatch; @@ -2368,6 +2410,8 @@ bool RenderableGlobe::isCullableByHorizon(const Chunk& chunk, ////////////////////////////////////////////////////////////////////////////////////////// void RenderableGlobe::splitChunkNode(Chunk& cn, int depth) { + ZoneScoped + if (depth > 0 && isLeaf(cn)) { std::vector memory = _chunkPool.allocate( static_cast(cn.children.size()) @@ -2396,6 +2440,8 @@ void RenderableGlobe::splitChunkNode(Chunk& cn, int depth) { } void RenderableGlobe::freeChunkNode(Chunk* n) { + ZoneScoped + _chunkPool.free(n); for (Chunk* c : n->children) { if (c) { @@ -2406,6 +2452,8 @@ void RenderableGlobe::freeChunkNode(Chunk* n) { } void RenderableGlobe::mergeChunkNode(Chunk& cn) { + ZoneScoped + for (Chunk* child : cn.children) { if (child) { mergeChunkNode(*child); @@ -2416,6 +2464,8 @@ void RenderableGlobe::mergeChunkNode(Chunk& cn) { } bool RenderableGlobe::updateChunkTree(Chunk& cn, const RenderData& data) { + ZoneScoped + // abock: I tried turning this into a queue and use iteration, rather than recursion // but that made the code harder to understand as the breadth-first traversal // requires parents to be passed through the pipe twice (first to add the diff --git a/modules/globebrowsing/src/renderableglobe.h b/modules/globebrowsing/src/renderableglobe.h index 8670263749..48f77d3042 100644 --- a/modules/globebrowsing/src/renderableglobe.h +++ b/modules/globebrowsing/src/renderableglobe.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -253,8 +253,8 @@ private: SkirtedGrid _grid; LayerManager _layerManager; - glm::dmat4 _cachedModelTransform; - glm::dmat4 _cachedInverseModelTransform; + glm::dmat4 _cachedModelTransform = glm::dmat4(1.0); + glm::dmat4 _cachedInverseModelTransform = glm::dmat4(1.0); ghoul::ReusableTypedMemoryPool _chunkPool; diff --git a/modules/globebrowsing/src/ringscomponent.cpp b/modules/globebrowsing/src/ringscomponent.cpp index ae65411e93..688b2306a9 100644 --- a/modules/globebrowsing/src/ringscomponent.cpp +++ b/modules/globebrowsing/src/ringscomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -49,10 +49,12 @@ #include namespace { - constexpr const std::array UniformNames = { + constexpr const char* _loggerCat = "RingsComponent"; + + constexpr const std::array UniformNames = { "modelViewProjectionMatrix", "textureOffset", "transparency", "_nightFactor", "sunPosition", "ringTexture", "shadowMatrix", "shadowMapTexture", - "nShadowSamples", "zFightingPercentage" + "zFightingPercentage" }; constexpr const std::array GeomUniformNames = { @@ -174,7 +176,7 @@ RingsComponent::RingsComponent(const ghoul::Dictionary& dictionary) , _transparency(TransparencyInfo, 0.15f, 0.f, 1.f) , _enabled({ "Enabled", "Enabled", "Enable/Disable Rings" }, true) , _zFightingPercentage(ZFightingPercentageInfo, 0.995f, 0.000001f, 1.f) - , _nShadowSamples(NumberShadowSamplesInfo, 2, 1, 20) + , _nShadowSamples(NumberShadowSamplesInfo, 2, 1, 7) , _ringsDictionary(dictionary) { using ghoul::filesystem::File; @@ -243,6 +245,7 @@ void RingsComponent::initialize() { if (_ringsDictionary.hasKey(NumberShadowSamplesInfo.identifier)) { _nShadowSamples = _ringsDictionary.value(NumberShadowSamplesInfo.identifier); } + _nShadowSamples.onChange([this]() { compileShadowShader(); }); addProperty(_nShadowSamples); addProperty(_transparency); @@ -253,11 +256,7 @@ bool RingsComponent::isReady() const { } void RingsComponent::initializeGL() { - _shader = global::renderEngine.buildRenderProgram( - "RingsProgram", - absPath("${MODULE_GLOBEBROWSING}/shaders/rings_vs.glsl"), - absPath("${MODULE_GLOBEBROWSING}/shaders/rings_fs.glsl") - ); + compileShadowShader(); _geometryOnlyShader = global::renderEngine.buildRenderProgram( "RingsGeomOnlyProgram", @@ -326,7 +325,6 @@ void RingsComponent::draw(const RenderData& data, _shader->setUniform(_uniformCache.transparency, _transparency); _shader->setUniform(_uniformCache.nightFactor, _nightFactor); _shader->setUniform(_uniformCache.sunPosition, _sunPosition); - _shader->setUniform(_uniformCache.nShadowSamples, _nShadowSamples); _shader->setUniform(_uniformCache.zFightingPercentage, _zFightingPercentage); ringTextureUnit.activate(); @@ -377,8 +375,7 @@ void RingsComponent::draw(const RenderData& data, void RingsComponent::update(const UpdateData& data) { if (_shader->isDirty()) { - _shader->rebuildFromFile(); - ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames); + compileShadowShader(); } if (_geometryOnlyShader->isDirty()) { @@ -474,6 +471,25 @@ void RingsComponent::createPlane() { ); } +void RingsComponent::compileShadowShader() { + ghoul::Dictionary dict; + dict.setValue("nShadowSamples", std::to_string(_nShadowSamples - 1)); + + try { + global::renderEngine.removeRenderProgram(_shader.get()); + _shader = global::renderEngine.buildRenderProgram( + "RingsProgram", + absPath("${MODULE_GLOBEBROWSING}/shaders/rings_vs.glsl"), + absPath("${MODULE_GLOBEBROWSING}/shaders/rings_fs.glsl"), + dict + ); + } + catch (const ghoul::RuntimeError& e) { + LERROR(e.message); + } + ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames); +} + bool RingsComponent::isEnabled() const { return _enabled; } diff --git a/modules/globebrowsing/src/ringscomponent.h b/modules/globebrowsing/src/ringscomponent.h index b42313e692..c501c4a9de 100644 --- a/modules/globebrowsing/src/ringscomponent.h +++ b/modules/globebrowsing/src/ringscomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -77,6 +77,7 @@ public: private: void loadTexture(); void createPlane(); + void compileShadowShader(); properties::StringProperty _texturePath; properties::FloatProperty _size; @@ -90,8 +91,7 @@ private: std::unique_ptr _shader; std::unique_ptr _geometryOnlyShader; UniformCache(modelViewProjectionMatrix, textureOffset, transparency, nightFactor, - sunPosition, ringTexture, shadowMatrix, shadowMapTexture, nShadowSamples, - zFightingPercentage + sunPosition, ringTexture, shadowMatrix, shadowMapTexture, zFightingPercentage ) _uniformCache; UniformCache(modelViewProjectionMatrix, textureOffset, ringTexture) _geomUniformCache; @@ -104,7 +104,7 @@ private: GLuint _vertexPositionBuffer = 0; bool _planeIsDirty = false; - glm::vec3 _sunPosition; + glm::vec3 _sunPosition = glm::vec3(0.f); }; } // namespace openspace diff --git a/modules/globebrowsing/src/shadowcomponent.cpp b/modules/globebrowsing/src/shadowcomponent.cpp index 2a2e5a9c7b..3d59598e7b 100644 --- a/modules/globebrowsing/src/shadowcomponent.cpp +++ b/modules/globebrowsing/src/shadowcomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -166,7 +166,7 @@ documentation::Documentation ShadowComponent::Documentation() { } ShadowComponent::ShadowComponent(const ghoul::Dictionary& dictionary) - : properties::PropertyOwner({ "Shadows Component" }) + : properties::PropertyOwner({ "ShadowsComponent" }) , _saveDepthTexture(SaveDepthTextureInfo) , _distanceFraction(DistanceFractionInfo, 20, 1, 10000) , _enabled({ "Enabled", "Enabled", "Enable/Disable Shadows" }, true) diff --git a/modules/globebrowsing/src/shadowcomponent.h b/modules/globebrowsing/src/shadowcomponent.h index 6be4766419..180b9aeccd 100644 --- a/modules/globebrowsing/src/shadowcomponent.h +++ b/modules/globebrowsing/src/shadowcomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -108,13 +108,10 @@ private: int _shadowDepthTextureWidth = 4096; bool _dynamicDepthTextureRes = true; - // All of these initializations should probably be 0 since they are GLuints? - GLuint _shadowDepthTexture = -1; - GLuint _positionInLightSpaceTexture = -1; - GLuint _shadowFBO = -1; - GLuint _firstPassSubroutine = -1; - GLuint _secondPassSubroutine = 1; - GLint _defaultFBO = -1; + GLuint _shadowDepthTexture = 0; + GLuint _positionInLightSpaceTexture = 0; + GLuint _shadowFBO = 0; + GLint _defaultFBO = 0; GLint _mViewport[4]; GLboolean _faceCulling; @@ -130,13 +127,13 @@ private: GLfloat _colorClearValue[4]; GLfloat _depthClearValue; - glm::vec3 _sunPosition; + glm::vec3 _sunPosition = glm::vec3(0.f); glm::dmat4 _shadowMatrix = glm::dmat4(1.0); glm::dvec3 _cameraPos = glm::dvec3(0.0); - glm::dvec3 _cameraFocus; - glm::dquat _cameraRotation; + glm::dvec3 _cameraFocus = glm::dvec3(0.0); + glm::dquat _cameraRotation = glm::dquat(1.0, 0.0, 0.0, 0.0); std::stringstream _serializedCamera; diff --git a/modules/globebrowsing/src/skirtedgrid.cpp b/modules/globebrowsing/src/skirtedgrid.cpp index eaa50fc279..4d897c9920 100644 --- a/modules/globebrowsing/src/skirtedgrid.cpp +++ b/modules/globebrowsing/src/skirtedgrid.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/skirtedgrid.h b/modules/globebrowsing/src/skirtedgrid.h index c07419ea52..5bcbf4e710 100644 --- a/modules/globebrowsing/src/skirtedgrid.h +++ b/modules/globebrowsing/src/skirtedgrid.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/tileindex.cpp b/modules/globebrowsing/src/tileindex.cpp index 2999b95616..e79acff1a4 100644 --- a/modules/globebrowsing/src/tileindex.cpp +++ b/modules/globebrowsing/src/tileindex.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/tileindex.h b/modules/globebrowsing/src/tileindex.h index 841b0e57cc..c29a4a4157 100644 --- a/modules/globebrowsing/src/tileindex.h +++ b/modules/globebrowsing/src/tileindex.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/tileloadjob.cpp b/modules/globebrowsing/src/tileloadjob.cpp index d45868ffd7..a9bdb36700 100644 --- a/modules/globebrowsing/src/tileloadjob.cpp +++ b/modules/globebrowsing/src/tileloadjob.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/tileloadjob.h b/modules/globebrowsing/src/tileloadjob.h index 35b22ad03c..df0486aad1 100644 --- a/modules/globebrowsing/src/tileloadjob.h +++ b/modules/globebrowsing/src/tileloadjob.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/tileprovider.cpp b/modules/globebrowsing/src/tileprovider.cpp index d07c44cbb8..d79aaca8a4 100644 --- a/modules/globebrowsing/src/tileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -40,6 +40,7 @@ #include #include #include +#include #include #include "cpl_minixml.h" @@ -152,6 +153,8 @@ namespace temporal { // void initAsyncTileDataReader(DefaultTileProvider& t, TileTextureInitData initData) { + ZoneScoped + t.asyncTextureDataProvider = std::make_unique( t.name, std::make_unique( @@ -163,12 +166,14 @@ void initAsyncTileDataReader(DefaultTileProvider& t, TileTextureInitData initDat } bool initTexturesFromLoadedData(DefaultTileProvider& t) { + ZoneScoped + if (t.asyncTextureDataProvider) { std::optional tile = t.asyncTextureDataProvider->popFinishedRawTile(); if (tile) { const cache::ProviderTileKey key = { tile->tileIndex, t.uniqueIdentifier }; ghoul_assert(!t.tileCache->exist(key), "Tile must not be existing in cache"); - t.tileCache->createTileAndPut(key, std::move(tile.value())); + t.tileCache->createTileAndPut(key, std::move(*tile)); return true; } } @@ -181,6 +186,8 @@ bool initTexturesFromLoadedData(DefaultTileProvider& t) { // void initialize(TextTileProvider& t) { + ZoneScoped + t.font = global::fontManager.font("Mono", static_cast(t.fontSize)); t.fontRenderer = ghoul::fontrendering::FontRenderer::createDefault(); t.fontRenderer->setFramebufferSize(glm::vec2(t.initData.dimensions)); @@ -192,6 +199,9 @@ void deinitialize(TextTileProvider& t) { } Tile tile(TextTileProvider& t, const TileIndex& tileIndex) { + ZoneScoped + TracyGpuZone("tile") + cache::ProviderTileKey key = { tileIndex, t.uniqueIdentifier }; Tile tile = t.tileCache->get(key); if (!tile.texture) { @@ -231,6 +241,8 @@ Tile tile(TextTileProvider& t, const TileIndex& tileIndex) { } void reset(TextTileProvider& t) { + ZoneScoped + t.tileCache->clear(); } @@ -240,6 +252,8 @@ void reset(TextTileProvider& t) { // TileProvider* levelProvider(TileProviderByLevel& t, int level) { + ZoneScoped + if (!t.levelTileProviders.empty()) { int clampedLevel = glm::clamp( level, @@ -296,6 +310,8 @@ std::string timeStringify(TemporalTileProvider::TimeFormatType type, const Time& std::unique_ptr initTileProvider(TemporalTileProvider& t, const TemporalTileProvider::TimeKey& timekey) { + ZoneScoped + static const std::vector IgnoredTokens = { // From: http://www.gdal.org/frmt_wms.html "${x}", @@ -324,6 +340,8 @@ std::unique_ptr initTileProvider(TemporalTileProvider& t, TileProvider* getTileProvider(TemporalTileProvider& t, const TemporalTileProvider::TimeKey& timekey) { + ZoneScoped + const auto it = t.tileProviderMap.find(timekey); if (it != t.tileProviderMap.end()) { return it->second.get(); @@ -339,6 +357,8 @@ TileProvider* getTileProvider(TemporalTileProvider& t, } TileProvider* getTileProvider(TemporalTileProvider& t, const Time& time) { + ZoneScoped + Time tCopy(time); if (t.timeQuantizer.quantize(tCopy, true)) { TemporalTileProvider::TimeKey timeKey = timeStringify(t.timeFormat, tCopy); @@ -354,6 +374,8 @@ TileProvider* getTileProvider(TemporalTileProvider& t, const Time& time) { } void ensureUpdated(TemporalTileProvider& t) { + ZoneScoped + if (!t.currentTileProvider) { update(t); } @@ -374,6 +396,8 @@ std::string xmlValue(TemporalTileProvider& t, CPLXMLNode* node, const std::strin } std::string consumeTemporalMetaData(TemporalTileProvider& t, const std::string& xml) { + ZoneScoped + CPLXMLNode* node = CPLParseXMLString(xml.c_str()); std::string timeStart = xmlValue(t, node, temporal::TimeStart, "2000 Jan 1"); @@ -421,6 +445,8 @@ std::string consumeTemporalMetaData(TemporalTileProvider& t, const std::string& } bool readFilePath(TemporalTileProvider& t) { + ZoneScoped + std::ifstream in(t.filePath.value().c_str()); std::string xml; if (in.is_open()) { @@ -454,6 +480,8 @@ unsigned int TileProvider::NumTileProviders = 0; // General functions // void initializeDefaultTile() { + ZoneScoped + ghoul_assert(!DefaultTile.texture, "Default tile should not have been created"); using namespace ghoul::opengl; @@ -487,6 +515,8 @@ void deinitializeDefaultTile() { std::unique_ptr createFromDictionary(layergroupid::TypeID layerTypeID, const ghoul::Dictionary& dictionary) { + ZoneScoped + const char* type = layergroupid::LAYER_TYPE_NAMES[static_cast(layerTypeID)]; auto factory = FactoryManager::ref().factory(); std::unique_ptr result = factory->create(type, dictionary); @@ -499,6 +529,8 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary) : filePath(defaultprovider::FilePathInfo, "") , tilePixelSize(defaultprovider::TilePixelSizeInfo, 32, 32, 2048) { + ZoneScoped + type = Type::DefaultTileProvider; tileCache = global::moduleEngine.module()->tileCache(); @@ -560,6 +592,8 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary) SingleImageProvider::SingleImageProvider(const ghoul::Dictionary& dictionary) : filePath(singleimageprovider::FilePathInfo) { + ZoneScoped + type = Type::SingleImageTileProvider; filePath = dictionary.value(KeyFilePath); @@ -576,6 +610,8 @@ TextTileProvider::TextTileProvider(TileTextureInitData initData, size_t fontSize : initData(std::move(initData)) , fontSize(fontSize) { + ZoneScoped + tileCache = global::moduleEngine.module()->tileCache(); } @@ -586,6 +622,8 @@ TextTileProvider::TextTileProvider(TileTextureInitData initData, size_t fontSize SizeReferenceTileProvider::SizeReferenceTileProvider(const ghoul::Dictionary& dictionary) : TextTileProvider(tileTextureInitData(layergroupid::GroupID::ColorLayers, false)) { + ZoneScoped + type = Type::SizeReferenceTileProvider; font = global::fontManager.font("Mono", static_cast(fontSize)); @@ -602,6 +640,8 @@ SizeReferenceTileProvider::SizeReferenceTileProvider(const ghoul::Dictionary& di TileIndexTileProvider::TileIndexTileProvider(const ghoul::Dictionary&) : TextTileProvider(tileTextureInitData(layergroupid::GroupID::ColorLayers, false)) { + ZoneScoped + type = Type::TileIndexTileProvider; } @@ -610,6 +650,8 @@ TileIndexTileProvider::TileIndexTileProvider(const ghoul::Dictionary&) TileProviderByIndex::TileProviderByIndex(const ghoul::Dictionary& dictionary) { + ZoneScoped + type = Type::ByIndexTileProvider; const ghoul::Dictionary& defaultProviderDict = dictionary.value( @@ -678,6 +720,8 @@ TileProviderByIndex::TileProviderByIndex(const ghoul::Dictionary& dictionary) { TileProviderByLevel::TileProviderByLevel(const ghoul::Dictionary& dictionary) { + ZoneScoped + type = Type::ByLevelTileProvider; layergroupid::GroupID layerGroupID = dictionary.value( @@ -754,6 +798,8 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary) : initDict(dictionary) , filePath(temporal::FilePathInfo) { + ZoneScoped + type = Type::TemporalTileProvider; filePath = dictionary.value(KeyFilePath); @@ -772,6 +818,8 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary) bool initialize(TileProvider& tp) { + ZoneScoped + ghoul_assert(!tp.isInitialized, "TileProvider can only be initialized once."); tp.uniqueIdentifier = TileProvider::NumTileProviders++; @@ -822,6 +870,8 @@ bool initialize(TileProvider& tp) { bool deinitialize(TileProvider& tp) { + ZoneScoped + switch (tp.type) { case Type::DefaultTileProvider: break; @@ -861,6 +911,8 @@ bool deinitialize(TileProvider& tp) { Tile tile(TileProvider& tp, const TileIndex& tileIndex) { + ZoneScoped + switch (tp.type) { case Type::DefaultTileProvider: { DefaultTileProvider& t = static_cast(tp); @@ -974,6 +1026,8 @@ Tile tile(TileProvider& tp, const TileIndex& tileIndex) { Tile::Status tileStatus(TileProvider& tp, const TileIndex& index) { + ZoneScoped + switch (tp.type) { case Type::DefaultTileProvider: { DefaultTileProvider& t = static_cast(tp); @@ -1034,6 +1088,8 @@ Tile::Status tileStatus(TileProvider& tp, const TileIndex& index) { TileDepthTransform depthTransform(TileProvider& tp) { + ZoneScoped + switch (tp.type) { case Type::DefaultTileProvider: { DefaultTileProvider& t = static_cast(tp); @@ -1077,6 +1133,8 @@ TileDepthTransform depthTransform(TileProvider& tp) { int update(TileProvider& tp) { + ZoneScoped + switch (tp.type) { case Type::DefaultTileProvider: { DefaultTileProvider& t = static_cast(tp); @@ -1147,6 +1205,8 @@ int update(TileProvider& tp) { void reset(TileProvider& tp) { + ZoneScoped + switch (tp.type) { case Type::DefaultTileProvider: { DefaultTileProvider& t = static_cast(tp); @@ -1233,6 +1293,8 @@ void reset(TileProvider& tp) { int maxLevel(TileProvider& tp) { + ZoneScoped + switch (tp.type) { case Type::DefaultTileProvider: { DefaultTileProvider& t = static_cast(tp); @@ -1278,6 +1340,8 @@ int maxLevel(TileProvider& tp) { float noDataValueAsFloat(TileProvider& tp) { + ZoneScoped + ghoul_assert(tp.isInitialized, "TileProvider was not initialized."); switch (tp.type) { case Type::DefaultTileProvider: { @@ -1308,6 +1372,8 @@ float noDataValueAsFloat(TileProvider& tp) { ChunkTile chunkTile(TileProvider& tp, TileIndex tileIndex, int parents, int maxParents) { + ZoneScoped + ghoul_assert(tp.isInitialized, "TileProvider was not initialized."); auto ascendToParent = [](TileIndex& tileIndex, TileUvTransform& uv) { @@ -1364,6 +1430,8 @@ ChunkTile chunkTile(TileProvider& tp, TileIndex tileIndex, int parents, int maxP ChunkTilePile chunkTilePile(TileProvider& tp, TileIndex tileIndex, int pileSize) { + ZoneScoped + ghoul_assert(tp.isInitialized, "TileProvider was not initialized."); ghoul_assert(pileSize >= 0, "pileSize must be positive"); diff --git a/modules/globebrowsing/src/tileprovider.h b/modules/globebrowsing/src/tileprovider.h index c7e3cd5196..8f6bcd4772 100644 --- a/modules/globebrowsing/src/tileprovider.h +++ b/modules/globebrowsing/src/tileprovider.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -110,11 +110,11 @@ struct TextTileProvider : public TileProvider { std::unique_ptr fontRenderer; std::shared_ptr font; - size_t fontSize; + size_t fontSize = 0; std::string text; - glm::vec2 textPosition; - glm::vec4 textColor; + glm::vec2 textPosition = glm::vec2(0.f); + glm::vec4 textColor = glm::vec4(0.f); GLuint fbo = 0; diff --git a/modules/globebrowsing/src/tiletextureinitdata.cpp b/modules/globebrowsing/src/tiletextureinitdata.cpp index 0791c282a7..a77e92bcc3 100644 --- a/modules/globebrowsing/src/tiletextureinitdata.cpp +++ b/modules/globebrowsing/src/tiletextureinitdata.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/tiletextureinitdata.h b/modules/globebrowsing/src/tiletextureinitdata.h index 6eee193c17..6a0984f4cf 100644 --- a/modules/globebrowsing/src/tiletextureinitdata.h +++ b/modules/globebrowsing/src/tiletextureinitdata.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,9 +33,8 @@ namespace openspace::globebrowsing { -/** - * All information needed to create a texture used for a Tile. - */ + +/// All information needed to create a texture used for a Tile. class TileTextureInitData { public: using HashKey = uint64_t; diff --git a/modules/globebrowsing/src/timequantizer.cpp b/modules/globebrowsing/src/timequantizer.cpp index 2a48f96199..3bb5898fe6 100644 --- a/modules/globebrowsing/src/timequantizer.cpp +++ b/modules/globebrowsing/src/timequantizer.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/globebrowsing/src/timequantizer.h b/modules/globebrowsing/src/timequantizer.h index 14fb6aa6d9..c76634be77 100644 --- a/modules/globebrowsing/src/timequantizer.h +++ b/modules/globebrowsing/src/timequantizer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/CMakeLists.txt b/modules/imgui/CMakeLists.txt index 2ac5d9318f..0e043a9479 100644 --- a/modules/imgui/CMakeLists.txt +++ b/modules/imgui/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/imgui/ext/imgui/CMakeLists.txt b/modules/imgui/ext/imgui/CMakeLists.txt index 78e669313a..a800bb0548 100644 --- a/modules/imgui/ext/imgui/CMakeLists.txt +++ b/modules/imgui/ext/imgui/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/imgui/imguimodule.cpp b/modules/imgui/imguimodule.cpp index 7ee1293e2d..1b8d63ace9 100644 --- a/modules/imgui/imguimodule.cpp +++ b/modules/imgui/imguimodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -37,6 +37,7 @@ #include #include #include +#include namespace openspace { @@ -130,21 +131,29 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) { }); global::callback::deinitialize.emplace_back([&]() { + ZoneScopedN("ImGUI") + LDEBUGC("ImGui", "Deinitialize GUI"); gui.deinitialize(); }); global::callback::initializeGL.emplace_back([&]() { + ZoneScopedN("ImGUI") + LDEBUGC("ImGui", "Initializing GUI OpenGL"); gui.initializeGL(); }); global::callback::deinitializeGL.emplace_back([&]() { + ZoneScopedN("ImGUI") + LDEBUGC("ImGui", "Deinitialize GUI OpenGL"); gui.deinitializeGL(); }); global::callback::draw2D.emplace_back([&]() { + ZoneScopedN("ImGUI") + // TODO emiax: Make sure this is only called for one of the eyes, in the case // of side-by-side / top-bottom stereo. @@ -182,6 +191,8 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) { global::callback::keyboard.emplace_back( [&](Key key, KeyModifier mod, KeyAction action) -> bool { + ZoneScopedN("ImGUI") + // A list of all the windows that can show up by themselves if (gui.isEnabled() || gui._performance.isEnabled() || gui._sceneProperty.isEnabled()) @@ -196,6 +207,8 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) { global::callback::character.emplace_back( [&](unsigned int codepoint, KeyModifier modifier) -> bool { + ZoneScopedN("ImGUI") + // A list of all the windows that can show up by themselves if (gui.isEnabled() || gui._performance.isEnabled() || gui._sceneProperty.isEnabled()) @@ -210,6 +223,8 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) { global::callback::mouseButton.emplace_back( [&](MouseButton button, MouseAction action, KeyModifier) -> bool { + ZoneScopedN("ImGUI") + // A list of all the windows that can show up by themselves if (gui.isEnabled() || gui._performance.isEnabled() || gui._sceneProperty.isEnabled()) @@ -224,6 +239,8 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) { global::callback::mouseScrollWheel.emplace_back( [&](double, double posY) -> bool { + ZoneScopedN("ImGUI") + // A list of all the windows that can show up by themselves if (gui.isEnabled() || gui._performance.isEnabled() || gui._sceneProperty.isEnabled()) diff --git a/modules/imgui/imguimodule.h b/modules/imgui/imguimodule.h index 1210d5ccab..73f037b5f2 100644 --- a/modules/imgui/imguimodule.h +++ b/modules/imgui/imguimodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -34,8 +34,8 @@ namespace openspace { // This should be moved into the touch module ---abock struct Touch { bool active; - glm::vec2 pos; - uint32_t action; + glm::vec2 pos = glm::vec2(0.f); + uint32_t action = 0; }; class ImGUIModule : public OpenSpaceModule { diff --git a/modules/imgui/include/gui.h b/modules/imgui/include/gui.h index 60b6851062..17378491d0 100644 --- a/modules/imgui/include/gui.h +++ b/modules/imgui/include/gui.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guiassetcomponent.h b/modules/imgui/include/guiassetcomponent.h index 349d4d44be..ff22b7b7f2 100644 --- a/modules/imgui/include/guiassetcomponent.h +++ b/modules/imgui/include/guiassetcomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guicomponent.h b/modules/imgui/include/guicomponent.h index eaefc95196..cde49685cd 100644 --- a/modules/imgui/include/guicomponent.h +++ b/modules/imgui/include/guicomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guifilepathcomponent.h b/modules/imgui/include/guifilepathcomponent.h index 9de1b1a421..05d678edc7 100644 --- a/modules/imgui/include/guifilepathcomponent.h +++ b/modules/imgui/include/guifilepathcomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guiglobebrowsingcomponent.h b/modules/imgui/include/guiglobebrowsingcomponent.h index a9ebde2fb7..3e0a5f1b6c 100644 --- a/modules/imgui/include/guiglobebrowsingcomponent.h +++ b/modules/imgui/include/guiglobebrowsingcomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guihelpcomponent.h b/modules/imgui/include/guihelpcomponent.h index 389dd4990e..ba3ed2af5e 100644 --- a/modules/imgui/include/guihelpcomponent.h +++ b/modules/imgui/include/guihelpcomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guiiswacomponent.h b/modules/imgui/include/guiiswacomponent.h index 2218df3e7d..468d1b0cc7 100644 --- a/modules/imgui/include/guiiswacomponent.h +++ b/modules/imgui/include/guiiswacomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guijoystickcomponent.h b/modules/imgui/include/guijoystickcomponent.h index 3c441f8e69..3ed79a2523 100644 --- a/modules/imgui/include/guijoystickcomponent.h +++ b/modules/imgui/include/guijoystickcomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guimissioncomponent.h b/modules/imgui/include/guimissioncomponent.h index 74da16a211..3b10530dcc 100644 --- a/modules/imgui/include/guimissioncomponent.h +++ b/modules/imgui/include/guimissioncomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guiparallelcomponent.h b/modules/imgui/include/guiparallelcomponent.h index bd3430070e..982c18bf18 100644 --- a/modules/imgui/include/guiparallelcomponent.h +++ b/modules/imgui/include/guiparallelcomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guiperformancecomponent.h b/modules/imgui/include/guiperformancecomponent.h index 21e122463e..36bbd7c146 100644 --- a/modules/imgui/include/guiperformancecomponent.h +++ b/modules/imgui/include/guiperformancecomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guipropertycomponent.h b/modules/imgui/include/guipropertycomponent.h index fc027ee6a0..b226cbbf30 100644 --- a/modules/imgui/include/guipropertycomponent.h +++ b/modules/imgui/include/guipropertycomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guishortcutscomponent.h b/modules/imgui/include/guishortcutscomponent.h index 47b4981378..c6e95205a1 100644 --- a/modules/imgui/include/guishortcutscomponent.h +++ b/modules/imgui/include/guishortcutscomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/guispacetimecomponent.h b/modules/imgui/include/guispacetimecomponent.h index 1106527e08..34f576d0d3 100644 --- a/modules/imgui/include/guispacetimecomponent.h +++ b/modules/imgui/include/guispacetimecomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/imgui_include.h b/modules/imgui/include/imgui_include.h index 6f56cd6d9f..3aafc34c8c 100644 --- a/modules/imgui/include/imgui_include.h +++ b/modules/imgui/include/imgui_include.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/include/renderproperties.h b/modules/imgui/include/renderproperties.h index dc4250447b..566931b87d 100644 --- a/modules/imgui/include/renderproperties.h +++ b/modules/imgui/include/renderproperties.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/shaders/gui_fs.glsl b/modules/imgui/shaders/gui_fs.glsl index fb94e65bea..f75b2cee35 100644 --- a/modules/imgui/shaders/gui_fs.glsl +++ b/modules/imgui/shaders/gui_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/shaders/gui_vs.glsl b/modules/imgui/shaders/gui_vs.glsl index 6f80ed5e57..f6d606f9bb 100644 --- a/modules/imgui/shaders/gui_vs.glsl +++ b/modules/imgui/shaders/gui_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/gui.cpp b/modules/imgui/src/gui.cpp index 0767a812a4..f9389ce043 100644 --- a/modules/imgui/src/gui.cpp +++ b/modules/imgui/src/gui.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -338,7 +338,7 @@ void GUI::initializeGL() { { unsigned char* texData; - glm::ivec2 texSize; + glm::ivec2 texSize = glm::ivec2(0); for (int i = 0; i < nWindows; ++i) { //_contexts[i] = ImGui::CreateContext(); ImGui::SetCurrentContext(_contexts[i]); diff --git a/modules/imgui/src/guiassetcomponent.cpp b/modules/imgui/src/guiassetcomponent.cpp index ffdcd71391..bff854cdd3 100644 --- a/modules/imgui/src/guiassetcomponent.cpp +++ b/modules/imgui/src/guiassetcomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guicomponent.cpp b/modules/imgui/src/guicomponent.cpp index d21bc821d1..dfebb0b162 100644 --- a/modules/imgui/src/guicomponent.cpp +++ b/modules/imgui/src/guicomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guifilepathcomponent.cpp b/modules/imgui/src/guifilepathcomponent.cpp index 10471ed4da..fe4c7cdb0e 100644 --- a/modules/imgui/src/guifilepathcomponent.cpp +++ b/modules/imgui/src/guifilepathcomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guiglobebrowsingcomponent.cpp b/modules/imgui/src/guiglobebrowsingcomponent.cpp index d31577486e..5f77d49496 100644 --- a/modules/imgui/src/guiglobebrowsingcomponent.cpp +++ b/modules/imgui/src/guiglobebrowsingcomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guihelpcomponent.cpp b/modules/imgui/src/guihelpcomponent.cpp index ed41f57160..6da9e9b35b 100644 --- a/modules/imgui/src/guihelpcomponent.cpp +++ b/modules/imgui/src/guihelpcomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guiiswacomponent.cpp b/modules/imgui/src/guiiswacomponent.cpp index 83fe276dfa..0b0824ca11 100644 --- a/modules/imgui/src/guiiswacomponent.cpp +++ b/modules/imgui/src/guiiswacomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guijoystickcomponent.cpp b/modules/imgui/src/guijoystickcomponent.cpp index 0db1b8f501..1eb350bd22 100644 --- a/modules/imgui/src/guijoystickcomponent.cpp +++ b/modules/imgui/src/guijoystickcomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guimissioncomponent.cpp b/modules/imgui/src/guimissioncomponent.cpp index 0bbc912af8..12886f8821 100644 --- a/modules/imgui/src/guimissioncomponent.cpp +++ b/modules/imgui/src/guimissioncomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guiparallelcomponent.cpp b/modules/imgui/src/guiparallelcomponent.cpp index 6e2b9b8343..b108911774 100644 --- a/modules/imgui/src/guiparallelcomponent.cpp +++ b/modules/imgui/src/guiparallelcomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guiperformancecomponent.cpp b/modules/imgui/src/guiperformancecomponent.cpp index 9f900daf20..7a7a495e3d 100644 --- a/modules/imgui/src/guiperformancecomponent.cpp +++ b/modules/imgui/src/guiperformancecomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp index f616616e19..96ca7bcd26 100644 --- a/modules/imgui/src/guipropertycomponent.cpp +++ b/modules/imgui/src/guipropertycomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guishortcutscomponent.cpp b/modules/imgui/src/guishortcutscomponent.cpp index 901c85e546..7379408e3b 100644 --- a/modules/imgui/src/guishortcutscomponent.cpp +++ b/modules/imgui/src/guishortcutscomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/guispacetimecomponent.cpp b/modules/imgui/src/guispacetimecomponent.cpp index 59a3b914d0..f9acbb05ab 100644 --- a/modules/imgui/src/guispacetimecomponent.cpp +++ b/modules/imgui/src/guispacetimecomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/imgui/src/renderproperties.cpp b/modules/imgui/src/renderproperties.cpp index c82b82d6b1..6621461ad7 100644 --- a/modules/imgui/src/renderproperties.cpp +++ b/modules/imgui/src/renderproperties.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/CMakeLists.txt b/modules/iswa/CMakeLists.txt index 50d8aa82b4..1edcd9d964 100644 --- a/modules/iswa/CMakeLists.txt +++ b/modules/iswa/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/iswa/iswamodule.cpp b/modules/iswa/iswamodule.cpp index 8c51807954..fa2869a174 100644 --- a/modules/iswa/iswamodule.cpp +++ b/modules/iswa/iswamodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -24,33 +24,33 @@ #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include - -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include - -#include #include +#include +#include +#include +#include namespace openspace { IswaModule::IswaModule() : OpenSpaceModule(Name) { - global::callback::initialize.push_back([]() { IswaManager::initialize(); }); + global::callback::initialize.push_back([]() { + ZoneScopedN("IswaModule") + IswaManager::initialize(); + }); } void IswaModule::internalInitialize(const ghoul::Dictionary&) { + auto fRenderable = FactoryManager::ref().factory(); ghoul_assert(fRenderable, "No renderable factory existed"); diff --git a/modules/iswa/iswamodule.h b/modules/iswa/iswamodule.h index 1348d46c79..365d24a0b4 100644 --- a/modules/iswa/iswamodule.h +++ b/modules/iswa/iswamodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/datacygnet.cpp b/modules/iswa/rendering/datacygnet.cpp index 9f4d7d3f73..6b556a073a 100644 --- a/modules/iswa/rendering/datacygnet.cpp +++ b/modules/iswa/rendering/datacygnet.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/datacygnet.h b/modules/iswa/rendering/datacygnet.h index 5a92ad3f62..f568d47e35 100644 --- a/modules/iswa/rendering/datacygnet.h +++ b/modules/iswa/rendering/datacygnet.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -91,7 +91,7 @@ protected: std::shared_ptr _dataProcessor; std::string _dataBuffer; - glm::size3_t _textureDimensions; + glm::size3_t _textureDimensions = glm::size3_t(0); private: bool readyToRender() const override; diff --git a/modules/iswa/rendering/dataplane.cpp b/modules/iswa/rendering/dataplane.cpp index f7d073b9f6..4e51556b0d 100644 --- a/modules/iswa/rendering/dataplane.cpp +++ b/modules/iswa/rendering/dataplane.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/dataplane.h b/modules/iswa/rendering/dataplane.h index 48976eae00..38c808957f 100644 --- a/modules/iswa/rendering/dataplane.h +++ b/modules/iswa/rendering/dataplane.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/datasphere.cpp b/modules/iswa/rendering/datasphere.cpp index cb68d437c7..868ee0de16 100644 --- a/modules/iswa/rendering/datasphere.cpp +++ b/modules/iswa/rendering/datasphere.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/datasphere.h b/modules/iswa/rendering/datasphere.h index 66b5948a93..33a40bb562 100644 --- a/modules/iswa/rendering/datasphere.h +++ b/modules/iswa/rendering/datasphere.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/iswabasegroup.cpp b/modules/iswa/rendering/iswabasegroup.cpp index 69a9b5da4a..43963773c5 100644 --- a/modules/iswa/rendering/iswabasegroup.cpp +++ b/modules/iswa/rendering/iswabasegroup.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/iswabasegroup.h b/modules/iswa/rendering/iswabasegroup.h index d937bed105..f78dbca28e 100644 --- a/modules/iswa/rendering/iswabasegroup.h +++ b/modules/iswa/rendering/iswabasegroup.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/iswacygnet.cpp b/modules/iswa/rendering/iswacygnet.cpp index 967613f9bf..e4d0b91906 100644 --- a/modules/iswa/rendering/iswacygnet.cpp +++ b/modules/iswa/rendering/iswacygnet.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -70,15 +70,15 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary) dictionary.getValue("Id", renderableId); float updateTime; dictionary.getValue("UpdateTime", updateTime); - glm::vec4 spatialScale; + glm::vec4 spatialScale = glm::vec4(0.f); dictionary.getValue("SpatialScale", spatialScale); - glm::vec3 min; + glm::vec3 min = glm::vec3(0.f); dictionary.getValue("GridMin", min); - glm::vec3 max; + glm::vec3 max = glm::vec3(0.f); dictionary.getValue("GridMax", max); dictionary.getValue("Frame",_data.frame); dictionary.getValue("CoordinateType", _data.coordinateType); - float xOffset; + float xOffset = 0.f; dictionary.getValue("XOffset", xOffset); dictionary.getValue("Group", _data.groupName); @@ -148,7 +148,7 @@ void IswaCygnet::render(const RenderData& data, RendererTasks&) { return; } - glm::mat4 transform = glm::mat4(1.0); + glm::mat4 transform = glm::mat4(1.f); for (int i = 0; i < 3; i++){ for (int j = 0; j < 3; j++){ transform[i][j] = static_cast(_stateMatrix[i][j]); diff --git a/modules/iswa/rendering/iswacygnet.h b/modules/iswa/rendering/iswacygnet.h index cf557fb91d..c8b93701c4 100644 --- a/modules/iswa/rendering/iswacygnet.h +++ b/modules/iswa/rendering/iswacygnet.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -55,17 +55,17 @@ public: protected: struct Metadata { - int id; - int updateTime; + int id = -1; + int updateTime = -1; std::string groupName; std::string path; std::string parent; std::string frame; - glm::vec3 gridMin; - glm::vec3 gridMax; - glm::vec3 offset; - glm::vec3 scale; - glm::vec4 spatialScale; + glm::vec3 gridMin = glm::vec3(0.f); + glm::vec3 gridMax = glm::vec3(0.f); + glm::vec3 offset = glm::vec3(0.f); + glm::vec3 scale = glm::vec3(0.f); + glm::vec4 spatialScale = glm::vec4(0.f); std::string scaleVariable; std::string coordinateType; }; @@ -134,10 +134,10 @@ protected: glm::mat4 _rotation = glm::mat4(1.f); private: - glm::dmat3 _stateMatrix; + glm::dmat3 _stateMatrix = glm::dmat3(1.0); - double _openSpaceTime; - double _lastUpdateOpenSpaceTime; + double _openSpaceTime = 0.0; + double _lastUpdateOpenSpaceTime = 0.0; std::chrono::milliseconds _realTime; std::chrono::milliseconds _lastUpdateRealTime; diff --git a/modules/iswa/rendering/iswadatagroup.cpp b/modules/iswa/rendering/iswadatagroup.cpp index 72946899a3..89f563871a 100644 --- a/modules/iswa/rendering/iswadatagroup.cpp +++ b/modules/iswa/rendering/iswadatagroup.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/iswadatagroup.h b/modules/iswa/rendering/iswadatagroup.h index 49d6cf1e06..b9c437c9c5 100644 --- a/modules/iswa/rendering/iswadatagroup.h +++ b/modules/iswa/rendering/iswadatagroup.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/iswakameleongroup.cpp b/modules/iswa/rendering/iswakameleongroup.cpp index f490655786..ffff28ada9 100644 --- a/modules/iswa/rendering/iswakameleongroup.cpp +++ b/modules/iswa/rendering/iswakameleongroup.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/iswakameleongroup.h b/modules/iswa/rendering/iswakameleongroup.h index 8c3718ec37..9194b528f9 100644 --- a/modules/iswa/rendering/iswakameleongroup.h +++ b/modules/iswa/rendering/iswakameleongroup.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/kameleonplane.cpp b/modules/iswa/rendering/kameleonplane.cpp index 7261cd4f3b..18ee019d18 100644 --- a/modules/iswa/rendering/kameleonplane.cpp +++ b/modules/iswa/rendering/kameleonplane.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/kameleonplane.h b/modules/iswa/rendering/kameleonplane.h index fa358c8cc7..3bc453fe76 100644 --- a/modules/iswa/rendering/kameleonplane.h +++ b/modules/iswa/rendering/kameleonplane.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -84,12 +84,12 @@ private: std::string _kwPath; - glm::size3_t _dimensions; - float* _dataSlice; + glm::size3_t _dimensions = glm::size3_t(0); + float* _dataSlice = nullptr; std::string _var; - float _scale; + float _scale = 0.f; - glm::vec3 _origOffset; + glm::vec3 _origOffset = glm::vec3(0.f); /** * _fieldlineState maps the checkbox value of each fieldline seedpoint file to a tuple @@ -108,8 +108,8 @@ private: }; Cut _cut; - GLuint _quad; - GLuint _vertexPositionBuffer; + GLuint _quad = 0; + GLuint _vertexPositionBuffer = 0; }; } // namespace openspace diff --git a/modules/iswa/rendering/screenspacecygnet.cpp b/modules/iswa/rendering/screenspacecygnet.cpp index 588aaa2cfc..4148ad3fc7 100644 --- a/modules/iswa/rendering/screenspacecygnet.cpp +++ b/modules/iswa/rendering/screenspacecygnet.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/screenspacecygnet.h b/modules/iswa/rendering/screenspacecygnet.h index d01fc0f322..8f29c0098b 100644 --- a/modules/iswa/rendering/screenspacecygnet.h +++ b/modules/iswa/rendering/screenspacecygnet.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/texturecygnet.cpp b/modules/iswa/rendering/texturecygnet.cpp index d99ff5748c..7d9823bcd4 100644 --- a/modules/iswa/rendering/texturecygnet.cpp +++ b/modules/iswa/rendering/texturecygnet.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/texturecygnet.h b/modules/iswa/rendering/texturecygnet.h index 2828b9368d..56237965c6 100644 --- a/modules/iswa/rendering/texturecygnet.h +++ b/modules/iswa/rendering/texturecygnet.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/textureplane.cpp b/modules/iswa/rendering/textureplane.cpp index d69ad983ba..7dfc0bf0c4 100644 --- a/modules/iswa/rendering/textureplane.cpp +++ b/modules/iswa/rendering/textureplane.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/rendering/textureplane.h b/modules/iswa/rendering/textureplane.h index 1c9eb0020b..9495f18c52 100644 --- a/modules/iswa/rendering/textureplane.h +++ b/modules/iswa/rendering/textureplane.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/shaders/dataplane_fs.glsl b/modules/iswa/shaders/dataplane_fs.glsl index a8686eb91d..893fb2e313 100644 --- a/modules/iswa/shaders/dataplane_fs.glsl +++ b/modules/iswa/shaders/dataplane_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/shaders/dataplane_vs.glsl b/modules/iswa/shaders/dataplane_vs.glsl index a46e392573..24404321c0 100644 --- a/modules/iswa/shaders/dataplane_vs.glsl +++ b/modules/iswa/shaders/dataplane_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/shaders/textureplane_fs.glsl b/modules/iswa/shaders/textureplane_fs.glsl index 1fa664e9b1..5835f23da9 100644 --- a/modules/iswa/shaders/textureplane_fs.glsl +++ b/modules/iswa/shaders/textureplane_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/shaders/textureplane_vs.glsl b/modules/iswa/shaders/textureplane_vs.glsl index 78b1a70fb8..cfab2d9c0d 100644 --- a/modules/iswa/shaders/textureplane_vs.glsl +++ b/modules/iswa/shaders/textureplane_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/util/dataprocessor.cpp b/modules/iswa/util/dataprocessor.cpp index 5a13372f3a..7c8e82603b 100644 --- a/modules/iswa/util/dataprocessor.cpp +++ b/modules/iswa/util/dataprocessor.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/util/dataprocessor.h b/modules/iswa/util/dataprocessor.h index db64deb316..b3f083dde8 100644 --- a/modules/iswa/util/dataprocessor.h +++ b/modules/iswa/util/dataprocessor.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -76,7 +76,7 @@ protected: void add(const std::vector>& optionValues, const std::vector& sum); - glm::size3_t _dimensions; + glm::size3_t _dimensions = glm::size3_t(0); bool _useLog = false; bool _useHistogram = false; glm::vec2 _normValues = glm::vec2(1.f); @@ -90,7 +90,7 @@ protected: std::vector> _histograms; std::set _coordinateVariables = { "x", "y", "z", "phi", "theta" }; - glm::vec2 _histNormValues = glm::vec2(10.f, 10.f); + glm::vec2 _histNormValues = glm::vec2(10.f); }; } // namespace openspace diff --git a/modules/iswa/util/dataprocessorjson.cpp b/modules/iswa/util/dataprocessorjson.cpp index c37bc852bb..70cc3af559 100644 --- a/modules/iswa/util/dataprocessorjson.cpp +++ b/modules/iswa/util/dataprocessorjson.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/util/dataprocessorjson.h b/modules/iswa/util/dataprocessorjson.h index d4f111fe5f..5c6ca80db7 100644 --- a/modules/iswa/util/dataprocessorjson.h +++ b/modules/iswa/util/dataprocessorjson.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/util/dataprocessorkameleon.cpp b/modules/iswa/util/dataprocessorkameleon.cpp index 84971479c1..6028d535cc 100644 --- a/modules/iswa/util/dataprocessorkameleon.cpp +++ b/modules/iswa/util/dataprocessorkameleon.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/util/dataprocessorkameleon.h b/modules/iswa/util/dataprocessorkameleon.h index 9e8d20ca72..f0f03a4a65 100644 --- a/modules/iswa/util/dataprocessorkameleon.h +++ b/modules/iswa/util/dataprocessorkameleon.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/util/dataprocessortext.cpp b/modules/iswa/util/dataprocessortext.cpp index 4f93a580b0..2d5b0942c5 100644 --- a/modules/iswa/util/dataprocessortext.cpp +++ b/modules/iswa/util/dataprocessortext.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/util/dataprocessortext.h b/modules/iswa/util/dataprocessortext.h index 9e03e59569..c08167461f 100644 --- a/modules/iswa/util/dataprocessortext.h +++ b/modules/iswa/util/dataprocessortext.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/util/iswamanager.cpp b/modules/iswa/util/iswamanager.cpp index 9f3c06a697..0be92828ef 100644 --- a/modules/iswa/util/iswamanager.cpp +++ b/modules/iswa/util/iswamanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -408,15 +408,15 @@ std::string IswaManager::parseKWToLuaTable(const CdfInfo& info, const std::strin if (extension == "cdf") { KameleonWrapper kw = KameleonWrapper(absPath(info.path)); - std::string parent = kw.parent(); - std::string frame = kw.frame(); - glm::vec3 min = kw.gridMin(); - glm::vec3 max = kw.gridMax(); + std::string parent = kw.parent(); + std::string frame = kw.frame(); + glm::vec3 min = kw.gridMin(); + glm::vec3 max = kw.gridMax(); std::array gridUnits = kw.gridUnits(); - glm::vec4 spatialScale; + glm::vec4 spatialScale = glm::vec4(0.f); std::string coordinateType; if (gridUnits[0] == "R" && gridUnits[1] == "R" && gridUnits[2] == "R") { spatialScale.x = 6.371f; diff --git a/modules/iswa/util/iswamanager.h b/modules/iswa/util/iswamanager.h index a8f90e8a7e..66da61f1c3 100644 --- a/modules/iswa/util/iswamanager.h +++ b/modules/iswa/util/iswamanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/iswa/util/iswamanager_lua.inl b/modules/iswa/util/iswamanager_lua.inl index f54cfb0dbf..fc93fd30db 100644 --- a/modules/iswa/util/iswamanager_lua.inl +++ b/modules/iswa/util/iswamanager_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleon/CMakeLists.txt b/modules/kameleon/CMakeLists.txt index a5b77fc8d9..c82a216b5a 100644 --- a/modules/kameleon/CMakeLists.txt +++ b/modules/kameleon/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/kameleon/ext/kameleon b/modules/kameleon/ext/kameleon index 338d482c86..1b4549edc7 160000 --- a/modules/kameleon/ext/kameleon +++ b/modules/kameleon/ext/kameleon @@ -1 +1 @@ -Subproject commit 338d482c8617bfacda0a5af8f3f6bb23163d436f +Subproject commit 1b4549edc74ef371730ef9d39c1ffa0efe90a985 diff --git a/modules/kameleon/include/kameleonhelper.h b/modules/kameleon/include/kameleonhelper.h index 490d0e0180..4f4a75e726 100644 --- a/modules/kameleon/include/kameleonhelper.h +++ b/modules/kameleon/include/kameleonhelper.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleon/include/kameleonwrapper.h b/modules/kameleon/include/kameleonwrapper.h index 1965a3cae5..6c5e728553 100644 --- a/modules/kameleon/include/kameleonwrapper.h +++ b/modules/kameleon/include/kameleonwrapper.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -40,8 +40,8 @@ namespace ccmc { namespace openspace { struct LinePoint { - glm::vec3 position; - glm::vec4 color; + glm::vec3 position = glm::vec3(0.f); + glm::vec4 color = glm::vec4(0.f); }; std::array gridVariables(ccmc::Model* model); @@ -51,7 +51,7 @@ public: enum class Model { OpenGGCM, BATSRUS, // Magnetosphere - ENLIL, // Heliosphere + ENLIL, // Heliosphere MAS, Adapt3D, SWMF, @@ -145,10 +145,10 @@ private: ccmc::Interpolator* _interpolator = nullptr; // Model parameters - glm::vec3 _min; - glm::vec3 _max; - glm::vec3 _validMin; - glm::vec3 _validMax; + glm::vec3 _min = glm::vec3(0.f); + glm::vec3 _max = glm::vec3(0.f); + glm::vec3 _validMin = glm::vec3(0.f); + glm::vec3 _validMax = glm::vec3(0.f); std::string _xCoordVar; std::string _yCoordVar; std::string _zCoordVar; diff --git a/modules/kameleon/kameleonmodule.cpp b/modules/kameleon/kameleonmodule.cpp index fcaaaa10d3..267885a71b 100644 --- a/modules/kameleon/kameleonmodule.cpp +++ b/modules/kameleon/kameleonmodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleon/kameleonmodule.h b/modules/kameleon/kameleonmodule.h index 2260a12dfd..616c4aba2b 100644 --- a/modules/kameleon/kameleonmodule.h +++ b/modules/kameleon/kameleonmodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleon/src/kameleonhelper.cpp b/modules/kameleon/src/kameleonhelper.cpp index 03a9148759..67d7983af2 100644 --- a/modules/kameleon/src/kameleonhelper.cpp +++ b/modules/kameleon/src/kameleonhelper.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleon/src/kameleonwrapper.cpp b/modules/kameleon/src/kameleonwrapper.cpp index 5baced7e1b..c3fdbbdc05 100644 --- a/modules/kameleon/src/kameleonwrapper.cpp +++ b/modules/kameleon/src/kameleonwrapper.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/CMakeLists.txt b/modules/kameleonvolume/CMakeLists.txt index a9ae620f08..37897ab5e5 100644 --- a/modules/kameleonvolume/CMakeLists.txt +++ b/modules/kameleonvolume/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/kameleonvolume/kameleonvolumemodule.cpp b/modules/kameleonvolume/kameleonvolumemodule.cpp index 7e6c7404a6..2cdbb125c3 100644 --- a/modules/kameleonvolume/kameleonvolumemodule.cpp +++ b/modules/kameleonvolume/kameleonvolumemodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/kameleonvolumemodule.h b/modules/kameleonvolume/kameleonvolumemodule.h index 72911e9d1d..41c47dbc58 100644 --- a/modules/kameleonvolume/kameleonvolumemodule.h +++ b/modules/kameleonvolume/kameleonvolumemodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/kameleonvolumereader.cpp b/modules/kameleonvolume/kameleonvolumereader.cpp index e63ddc9f46..bd692888ef 100644 --- a/modules/kameleonvolume/kameleonvolumereader.cpp +++ b/modules/kameleonvolume/kameleonvolumereader.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/kameleonvolumereader.h b/modules/kameleonvolume/kameleonvolumereader.h index c514f4178b..47c09cccb4 100644 --- a/modules/kameleonvolume/kameleonvolumereader.h +++ b/modules/kameleonvolume/kameleonvolumereader.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp b/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp index 7055a10fe9..e221255fd1 100644 --- a/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp +++ b/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -155,7 +155,7 @@ RenderableKameleonVolume::RenderableKameleonVolume(const ghoul::Dictionary& dict } else { LWARNING("No dimensions specified for volumetric data, falling back to 32^3"); - _dimensions = glm::uvec3(32, 32, 32); + _dimensions = glm::uvec3(32); } _stepSize = dictionary.value(KeyStepSize); @@ -302,7 +302,7 @@ void RenderableKameleonVolume::updateRaycasterModelTransform() { const glm::vec3 translation = (lBBoxBound + uBBoxBound) * 0.5f; const glm::mat4 modelTransform = glm::scale( - glm::translate(glm::mat4(1.0), translation), + glm::translate(glm::mat4(1.f), translation), scale ); _raycaster->setModelTransform(modelTransform); diff --git a/modules/kameleonvolume/rendering/renderablekameleonvolume.h b/modules/kameleonvolume/rendering/renderablekameleonvolume.h index a626758151..6fb43aeff9 100644 --- a/modules/kameleonvolume/rendering/renderablekameleonvolume.h +++ b/modules/kameleonvolume/rendering/renderablekameleonvolume.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/tasks/kameleondocumentationtask.cpp b/modules/kameleonvolume/tasks/kameleondocumentationtask.cpp index 2515549927..0e70a6d23d 100644 --- a/modules/kameleonvolume/tasks/kameleondocumentationtask.cpp +++ b/modules/kameleonvolume/tasks/kameleondocumentationtask.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/tasks/kameleondocumentationtask.h b/modules/kameleonvolume/tasks/kameleondocumentationtask.h index d3ae0119e1..a6cd323800 100644 --- a/modules/kameleonvolume/tasks/kameleondocumentationtask.h +++ b/modules/kameleonvolume/tasks/kameleondocumentationtask.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/tasks/kameleonmetadatatojsontask.cpp b/modules/kameleonvolume/tasks/kameleonmetadatatojsontask.cpp index dae730be44..03fff1122b 100644 --- a/modules/kameleonvolume/tasks/kameleonmetadatatojsontask.cpp +++ b/modules/kameleonvolume/tasks/kameleonmetadatatojsontask.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/tasks/kameleonmetadatatojsontask.h b/modules/kameleonvolume/tasks/kameleonmetadatatojsontask.h index b7aeb1ac2e..1daadcb3f9 100644 --- a/modules/kameleonvolume/tasks/kameleonmetadatatojsontask.h +++ b/modules/kameleonvolume/tasks/kameleonmetadatatojsontask.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/tasks/kameleonvolumetorawtask.cpp b/modules/kameleonvolume/tasks/kameleonvolumetorawtask.cpp index 01d007394c..4446270a76 100644 --- a/modules/kameleonvolume/tasks/kameleonvolumetorawtask.cpp +++ b/modules/kameleonvolume/tasks/kameleonvolumetorawtask.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/kameleonvolume/tasks/kameleonvolumetorawtask.h b/modules/kameleonvolume/tasks/kameleonvolumetorawtask.h index f2bc3095d0..c8524db19e 100644 --- a/modules/kameleonvolume/tasks/kameleonvolumetorawtask.h +++ b/modules/kameleonvolume/tasks/kameleonvolumetorawtask.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -48,10 +48,10 @@ private: std::string _variable; std::string _units; - glm::uvec3 _dimensions; + glm::uvec3 _dimensions = glm::uvec3(0); bool _autoDomainBounds = false; - glm::vec3 _lowerDomainBound; - glm::vec3 _upperDomainBound; + glm::vec3 _lowerDomainBound = glm::vec3(0.f); + glm::vec3 _upperDomainBound = glm::vec3(0.f); }; } // namespace openspace::kameleon diff --git a/modules/multiresvolume/CMakeLists.txt b/modules/multiresvolume/CMakeLists.txt index 75fdbe029d..18733b9f4f 100644 --- a/modules/multiresvolume/CMakeLists.txt +++ b/modules/multiresvolume/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/multiresvolume/multiresvolumemodule.cpp b/modules/multiresvolume/multiresvolumemodule.cpp index c31fa2f8d0..1836ad2eda 100644 --- a/modules/multiresvolume/multiresvolumemodule.cpp +++ b/modules/multiresvolume/multiresvolumemodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/multiresvolumemodule.h b/modules/multiresvolume/multiresvolumemodule.h index 09c0af042b..71f8aceff0 100644 --- a/modules/multiresvolume/multiresvolumemodule.h +++ b/modules/multiresvolume/multiresvolumemodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/atlasmanager.cpp b/modules/multiresvolume/rendering/atlasmanager.cpp index be6efac18e..2f0642fc4d 100644 --- a/modules/multiresvolume/rendering/atlasmanager.cpp +++ b/modules/multiresvolume/rendering/atlasmanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/atlasmanager.h b/modules/multiresvolume/rendering/atlasmanager.h index 8a01dcad96..190205fd97 100644 --- a/modules/multiresvolume/rendering/atlasmanager.h +++ b/modules/multiresvolume/rendering/atlasmanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/brickcover.cpp b/modules/multiresvolume/rendering/brickcover.cpp index eeae57c526..045057eb65 100644 --- a/modules/multiresvolume/rendering/brickcover.cpp +++ b/modules/multiresvolume/rendering/brickcover.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/brickcover.h b/modules/multiresvolume/rendering/brickcover.h index c2b6f95640..47912052e8 100644 --- a/modules/multiresvolume/rendering/brickcover.h +++ b/modules/multiresvolume/rendering/brickcover.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/brickmanager.cpp b/modules/multiresvolume/rendering/brickmanager.cpp index 4e1e690073..998ec1e599 100644 --- a/modules/multiresvolume/rendering/brickmanager.cpp +++ b/modules/multiresvolume/rendering/brickmanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/brickmanager.h b/modules/multiresvolume/rendering/brickmanager.h index 2a1145af27..521861886f 100644 --- a/modules/multiresvolume/rendering/brickmanager.h +++ b/modules/multiresvolume/rendering/brickmanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/brickselection.cpp b/modules/multiresvolume/rendering/brickselection.cpp index 6c432d5654..3a6c844635 100644 --- a/modules/multiresvolume/rendering/brickselection.cpp +++ b/modules/multiresvolume/rendering/brickselection.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/brickselection.h b/modules/multiresvolume/rendering/brickselection.h index f858d08faf..c74b3de86d 100644 --- a/modules/multiresvolume/rendering/brickselection.h +++ b/modules/multiresvolume/rendering/brickselection.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/brickselector.h b/modules/multiresvolume/rendering/brickselector.h index ba3a26aec2..498d0d8177 100644 --- a/modules/multiresvolume/rendering/brickselector.h +++ b/modules/multiresvolume/rendering/brickselector.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/errorhistogrammanager.cpp b/modules/multiresvolume/rendering/errorhistogrammanager.cpp index f60a5f7806..7fbef2d659 100644 --- a/modules/multiresvolume/rendering/errorhistogrammanager.cpp +++ b/modules/multiresvolume/rendering/errorhistogrammanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/errorhistogrammanager.h b/modules/multiresvolume/rendering/errorhistogrammanager.h index 587fc528c4..8a116351df 100644 --- a/modules/multiresvolume/rendering/errorhistogrammanager.h +++ b/modules/multiresvolume/rendering/errorhistogrammanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/histogrammanager.cpp b/modules/multiresvolume/rendering/histogrammanager.cpp index 19570cf602..83711cafd2 100644 --- a/modules/multiresvolume/rendering/histogrammanager.cpp +++ b/modules/multiresvolume/rendering/histogrammanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/histogrammanager.h b/modules/multiresvolume/rendering/histogrammanager.h index 483db4843b..5215a2a0e2 100644 --- a/modules/multiresvolume/rendering/histogrammanager.h +++ b/modules/multiresvolume/rendering/histogrammanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp b/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp index 1e00fde6b9..5a9f7ca421 100644 --- a/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp +++ b/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/localerrorhistogrammanager.h b/modules/multiresvolume/rendering/localerrorhistogrammanager.h index ee30754386..cac8bbbc68 100644 --- a/modules/multiresvolume/rendering/localerrorhistogrammanager.h +++ b/modules/multiresvolume/rendering/localerrorhistogrammanager.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/localtfbrickselector.cpp b/modules/multiresvolume/rendering/localtfbrickselector.cpp index 0ed51a881b..837ddf1928 100644 --- a/modules/multiresvolume/rendering/localtfbrickselector.cpp +++ b/modules/multiresvolume/rendering/localtfbrickselector.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -340,7 +340,7 @@ bool LocalTfBrickSelector::calculateBrickErrors() { std::vector gradients(tfWidth - 1); for (size_t offset = 0; offset < tfWidth - 1; offset++) { const glm::vec4 prevRgba = tf->sample(offset); - const glm::vec4 nextRgba = tf->sample(offset + 1); + const glm::vec4 nextRgba = tf->sample(offset + 1); const float colorDifference = glm::distance(prevRgba, nextRgba); const float alpha = (prevRgba.w + nextRgba.w) * 0.5f; diff --git a/modules/multiresvolume/rendering/localtfbrickselector.h b/modules/multiresvolume/rendering/localtfbrickselector.h index 1f31fc9161..7ed6695797 100644 --- a/modules/multiresvolume/rendering/localtfbrickselector.h +++ b/modules/multiresvolume/rendering/localtfbrickselector.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp b/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp index 2c86df53e2..50a3ede0dc 100644 --- a/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp +++ b/modules/multiresvolume/rendering/multiresvolumeraycaster.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -159,7 +159,7 @@ bool MultiresVolumeRaycaster::isCameraInside(const RenderData& data, glm::vec4 modelPos = (glm::inverse(scaledModelTransform) / divisor) * camWorldPos; - localPosition = (glm::vec3(modelPos) + glm::vec3(0.5)); + localPosition = (glm::vec3(modelPos) + glm::vec3(0.5f)); return (localPosition.x > 0 && localPosition.y > 0 && localPosition.z > 0 && localPosition.x < 1 && localPosition.y < 1 && localPosition.z < 1); } diff --git a/modules/multiresvolume/rendering/multiresvolumeraycaster.h b/modules/multiresvolume/rendering/multiresvolumeraycaster.h index 9d7c78f512..e6ca7a8a43 100644 --- a/modules/multiresvolume/rendering/multiresvolumeraycaster.h +++ b/modules/multiresvolume/rendering/multiresvolumeraycaster.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -77,8 +77,8 @@ public: private: BoxGeometry _boundingBox; - glm::mat4 _modelTransform; - float _stepSizeCoefficient; + glm::mat4 _modelTransform = glm::mat4(1.f); + float _stepSizeCoefficient = 0.f; std::shared_ptr _tsp; std::shared_ptr _atlasManager; diff --git a/modules/multiresvolume/rendering/renderablemultiresvolume.cpp b/modules/multiresvolume/rendering/renderablemultiresvolume.cpp index 3fad696506..e07c447b6a 100644 --- a/modules/multiresvolume/rendering/renderablemultiresvolume.cpp +++ b/modules/multiresvolume/rendering/renderablemultiresvolume.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -169,7 +169,12 @@ RenderableMultiresVolume::RenderableMultiresVolume(const ghoul::Dictionary& dict , _statsToFileName(StatsToFileNameInfo) , _scalingExponent(ScalingExponentInfo, 1, -10, 20) , _translation(TranslationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(10.f)) - , _rotation(RotationInfo, glm::vec3(0.f, 0.f, 0.f), glm::vec3(0.f), glm::vec3(6.28f)) + , _rotation( + RotationInfo, + glm::vec3(0.f), + glm::vec3(0.f), + glm::vec3(glm::two_pi()) + ) , _scaling(ScalingInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(10.f)) { if (dictionary.hasKeyAndValue(KeyDataSource)) { @@ -714,7 +719,7 @@ void RenderableMultiresVolume::update(const UpdateData& data) { if (_raycaster) { glm::mat4 transform = glm::translate( - glm::mat4(1.0), + glm::mat4(1.f), static_cast(_translation) * std::pow(10.f, static_cast(_scalingExponent)) ); diff --git a/modules/multiresvolume/rendering/renderablemultiresvolume.h b/modules/multiresvolume/rendering/renderablemultiresvolume.h index d3504820fc..d09eedaa7d 100644 --- a/modules/multiresvolume/rendering/renderablemultiresvolume.h +++ b/modules/multiresvolume/rendering/renderablemultiresvolume.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/shenbrickselector.cpp b/modules/multiresvolume/rendering/shenbrickselector.cpp index cfd99802ce..d10de2ef22 100644 --- a/modules/multiresvolume/rendering/shenbrickselector.cpp +++ b/modules/multiresvolume/rendering/shenbrickselector.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/shenbrickselector.h b/modules/multiresvolume/rendering/shenbrickselector.h index 09c098c2d8..8abcc760ad 100644 --- a/modules/multiresvolume/rendering/shenbrickselector.h +++ b/modules/multiresvolume/rendering/shenbrickselector.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/simpletfbrickselector.cpp b/modules/multiresvolume/rendering/simpletfbrickselector.cpp index e7b8013842..d69f557a36 100644 --- a/modules/multiresvolume/rendering/simpletfbrickselector.cpp +++ b/modules/multiresvolume/rendering/simpletfbrickselector.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/simpletfbrickselector.h b/modules/multiresvolume/rendering/simpletfbrickselector.h index fadce37ea2..89a25509c2 100644 --- a/modules/multiresvolume/rendering/simpletfbrickselector.h +++ b/modules/multiresvolume/rendering/simpletfbrickselector.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/tfbrickselector.cpp b/modules/multiresvolume/rendering/tfbrickselector.cpp index b3700341e2..810c792b92 100644 --- a/modules/multiresvolume/rendering/tfbrickselector.cpp +++ b/modules/multiresvolume/rendering/tfbrickselector.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/tfbrickselector.h b/modules/multiresvolume/rendering/tfbrickselector.h index c7d19fb3dc..d63dc1e3d9 100644 --- a/modules/multiresvolume/rendering/tfbrickselector.h +++ b/modules/multiresvolume/rendering/tfbrickselector.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/tsp.cpp b/modules/multiresvolume/rendering/tsp.cpp index ce5286cbe2..e18c62adc6 100644 --- a/modules/multiresvolume/rendering/tsp.cpp +++ b/modules/multiresvolume/rendering/tsp.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/multiresvolume/rendering/tsp.h b/modules/multiresvolume/rendering/tsp.h index 3194acfbd3..7ff93f23ff 100644 --- a/modules/multiresvolume/rendering/tsp.h +++ b/modules/multiresvolume/rendering/tsp.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/CMakeLists.txt b/modules/server/CMakeLists.txt index fd674170ba..c39537163d 100644 --- a/modules/server/CMakeLists.txt +++ b/modules/server/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/server/include/connection.h b/modules/server/include/connection.h index a2587ebbf2..ddbed4f249 100644 --- a/modules/server/include/connection.h +++ b/modules/server/include/connection.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/connectionpool.h b/modules/server/include/connectionpool.h index 9eac2d5bbf..020f6f1369 100644 --- a/modules/server/include/connectionpool.h +++ b/modules/server/include/connectionpool.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/jsonconverters.h b/modules/server/include/jsonconverters.h index 75286a3d35..06558404f4 100644 --- a/modules/server/include/jsonconverters.h +++ b/modules/server/include/jsonconverters.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/serverinterface.h b/modules/server/include/serverinterface.h index 0359d6b887..1b0e47364b 100644 --- a/modules/server/include/serverinterface.h +++ b/modules/server/include/serverinterface.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/authorizationtopic.h b/modules/server/include/topics/authorizationtopic.h index 1bbdaab625..8b64680d73 100644 --- a/modules/server/include/topics/authorizationtopic.h +++ b/modules/server/include/topics/authorizationtopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/bouncetopic.h b/modules/server/include/topics/bouncetopic.h index 517fc4957d..f8a7c37949 100644 --- a/modules/server/include/topics/bouncetopic.h +++ b/modules/server/include/topics/bouncetopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/documentationtopic.h b/modules/server/include/topics/documentationtopic.h index 0733cad4eb..63d2b77603 100644 --- a/modules/server/include/topics/documentationtopic.h +++ b/modules/server/include/topics/documentationtopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/flightcontrollertopic.h b/modules/server/include/topics/flightcontrollertopic.h index ffbf562e95..ff111da0dc 100644 --- a/modules/server/include/topics/flightcontrollertopic.h +++ b/modules/server/include/topics/flightcontrollertopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/getpropertytopic.h b/modules/server/include/topics/getpropertytopic.h index 3a51329897..b6ec3c4d2f 100644 --- a/modules/server/include/topics/getpropertytopic.h +++ b/modules/server/include/topics/getpropertytopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/luascripttopic.h b/modules/server/include/topics/luascripttopic.h index 6ae0f8f039..e3bce3be55 100644 --- a/modules/server/include/topics/luascripttopic.h +++ b/modules/server/include/topics/luascripttopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/sessionrecordingtopic.h b/modules/server/include/topics/sessionrecordingtopic.h index ffd5ff9bf1..242e4a5374 100644 --- a/modules/server/include/topics/sessionrecordingtopic.h +++ b/modules/server/include/topics/sessionrecordingtopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/setpropertytopic.h b/modules/server/include/topics/setpropertytopic.h index a6bd37a400..8ad9aacf3a 100644 --- a/modules/server/include/topics/setpropertytopic.h +++ b/modules/server/include/topics/setpropertytopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/shortcuttopic.h b/modules/server/include/topics/shortcuttopic.h index 65aecdeb6f..1a2c9d3364 100644 --- a/modules/server/include/topics/shortcuttopic.h +++ b/modules/server/include/topics/shortcuttopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/subscriptiontopic.h b/modules/server/include/topics/subscriptiontopic.h index 69174e6fab..7dbceb5dce 100644 --- a/modules/server/include/topics/subscriptiontopic.h +++ b/modules/server/include/topics/subscriptiontopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/timetopic.h b/modules/server/include/topics/timetopic.h index 7fa7b36465..23b6c486c4 100644 --- a/modules/server/include/topics/timetopic.h +++ b/modules/server/include/topics/timetopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/topic.h b/modules/server/include/topics/topic.h index 79ffa63a96..1ce3d11004 100644 --- a/modules/server/include/topics/topic.h +++ b/modules/server/include/topics/topic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/triggerpropertytopic.h b/modules/server/include/topics/triggerpropertytopic.h index be1146a95d..67228746f5 100644 --- a/modules/server/include/topics/triggerpropertytopic.h +++ b/modules/server/include/topics/triggerpropertytopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/include/topics/versiontopic.h b/modules/server/include/topics/versiontopic.h index 0cf3e39bd8..4eed163361 100644 --- a/modules/server/include/topics/versiontopic.h +++ b/modules/server/include/topics/versiontopic.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/servermodule.cpp b/modules/server/servermodule.cpp index 9ae7399603..95abd7c4ab 100644 --- a/modules/server/servermodule.cpp +++ b/modules/server/servermodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -36,6 +36,7 @@ #include #include #include +#include #include namespace { @@ -72,7 +73,11 @@ ServerInterface* ServerModule::serverInterfaceByIdentifier(const std::string& id } void ServerModule::internalInitialize(const ghoul::Dictionary& configuration) { - global::callback::preSync.emplace_back([this]() { preSync(); }); + global::callback::preSync.emplace_back([this]() { + ZoneScopedN("ServerModule") + + preSync(); + }); if (!configuration.hasValue(KeyInterfaces)) { return; @@ -156,6 +161,8 @@ void ServerModule::preSync() { } void ServerModule::cleanUpFinishedThreads() { + ZoneScoped + for (ConnectionData& connectionData : _connections) { Connection& connection = *connectionData.connection; if (!connection.socket() || !connection.socket()->isConnected()) { @@ -175,6 +182,8 @@ void ServerModule::cleanUpFinishedThreads() { } void ServerModule::disconnectAll() { + ZoneScoped + for (std::unique_ptr& serverInterface : _interfaces) { if (global::windowDelegate.isMaster()) { serverInterface->deinitialize(); @@ -192,6 +201,8 @@ void ServerModule::disconnectAll() { } void ServerModule::handleConnection(std::shared_ptr connection) { + ZoneScoped + std::string messageString; while (connection->socket()->getMessage(messageString)) { std::lock_guard lock(_messageQueueMutex); @@ -200,6 +211,8 @@ void ServerModule::handleConnection(std::shared_ptr connection) { } void ServerModule::consumeMessages() { + ZoneScoped + std::lock_guard lock(_messageQueueMutex); while (!_messageQueue.empty()) { const Message& m = _messageQueue.front(); diff --git a/modules/server/servermodule.h b/modules/server/servermodule.h index 4af9746928..3fbdb48d72 100644 --- a/modules/server/servermodule.h +++ b/modules/server/servermodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/connection.cpp b/modules/server/src/connection.cpp index b40bf007ad..96a5a36623 100644 --- a/modules/server/src/connection.cpp +++ b/modules/server/src/connection.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -44,6 +44,7 @@ #include #include #include +#include #include namespace { @@ -102,6 +103,8 @@ Connection::Connection(std::unique_ptr s, } void Connection::handleMessage(const std::string& message) { + ZoneScoped + try { nlohmann::json j = nlohmann::json::parse(message.c_str()); try { @@ -138,6 +141,8 @@ void Connection::handleMessage(const std::string& message) { } void Connection::handleJson(const nlohmann::json& json) { + ZoneScoped + auto topicJson = json.find(MessageKeyTopic); auto payloadJson = json.find(MessageKeyPayload); diff --git a/modules/server/src/connectionpool.cpp b/modules/server/src/connectionpool.cpp index 59229f869d..30944cdade 100644 --- a/modules/server/src/connectionpool.cpp +++ b/modules/server/src/connectionpool.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/jsonconverters.cpp b/modules/server/src/jsonconverters.cpp index 5f17620885..84ede19de5 100644 --- a/modules/server/src/jsonconverters.cpp +++ b/modules/server/src/jsonconverters.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/serverinterface.cpp b/modules/server/src/serverinterface.cpp index 81e4498fa4..639535edd2 100644 --- a/modules/server/src/serverinterface.cpp +++ b/modules/server/src/serverinterface.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/authorizationtopic.cpp b/modules/server/src/topics/authorizationtopic.cpp index 5ed4f2e8ec..e3c7394ff8 100644 --- a/modules/server/src/topics/authorizationtopic.cpp +++ b/modules/server/src/topics/authorizationtopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/bouncetopic.cpp b/modules/server/src/topics/bouncetopic.cpp index 07e4b1c24f..d43718e266 100644 --- a/modules/server/src/topics/bouncetopic.cpp +++ b/modules/server/src/topics/bouncetopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/documentationtopic.cpp b/modules/server/src/topics/documentationtopic.cpp index 4a30db5528..b3f4e2573b 100644 --- a/modules/server/src/topics/documentationtopic.cpp +++ b/modules/server/src/topics/documentationtopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/flightcontrollertopic.cpp b/modules/server/src/topics/flightcontrollertopic.cpp index e9a7efbc32..aedb5f3367 100644 --- a/modules/server/src/topics/flightcontrollertopic.cpp +++ b/modules/server/src/topics/flightcontrollertopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/getpropertytopic.cpp b/modules/server/src/topics/getpropertytopic.cpp index 74b19cda92..d2669cc143 100644 --- a/modules/server/src/topics/getpropertytopic.cpp +++ b/modules/server/src/topics/getpropertytopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/luascripttopic.cpp b/modules/server/src/topics/luascripttopic.cpp index 018159f0ba..e340ccbbea 100644 --- a/modules/server/src/topics/luascripttopic.cpp +++ b/modules/server/src/topics/luascripttopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/sessionrecordingtopic.cpp b/modules/server/src/topics/sessionrecordingtopic.cpp index 4b5287bf93..eeb6e32b79 100644 --- a/modules/server/src/topics/sessionrecordingtopic.cpp +++ b/modules/server/src/topics/sessionrecordingtopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/setpropertytopic.cpp b/modules/server/src/topics/setpropertytopic.cpp index 2e40e4d99d..dc25536b53 100644 --- a/modules/server/src/topics/setpropertytopic.cpp +++ b/modules/server/src/topics/setpropertytopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/shortcuttopic.cpp b/modules/server/src/topics/shortcuttopic.cpp index c86f48081a..396ae2c283 100644 --- a/modules/server/src/topics/shortcuttopic.cpp +++ b/modules/server/src/topics/shortcuttopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/subscriptiontopic.cpp b/modules/server/src/topics/subscriptiontopic.cpp index 20933fa4e1..bbdd6dea93 100644 --- a/modules/server/src/topics/subscriptiontopic.cpp +++ b/modules/server/src/topics/subscriptiontopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/timetopic.cpp b/modules/server/src/topics/timetopic.cpp index 60512f4516..789b9da924 100644 --- a/modules/server/src/topics/timetopic.cpp +++ b/modules/server/src/topics/timetopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/topic.cpp b/modules/server/src/topics/topic.cpp index 10be414a58..440252caab 100644 --- a/modules/server/src/topics/topic.cpp +++ b/modules/server/src/topics/topic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/triggerpropertytopic.cpp b/modules/server/src/topics/triggerpropertytopic.cpp index 3fefa62ef5..8310e9346b 100644 --- a/modules/server/src/topics/triggerpropertytopic.cpp +++ b/modules/server/src/topics/triggerpropertytopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/server/src/topics/versiontopic.cpp b/modules/server/src/topics/versiontopic.cpp index 4ee1def9d4..033de54683 100644 --- a/modules/server/src/topics/versiontopic.cpp +++ b/modules/server/src/topics/versiontopic.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/CMakeLists.txt b/modules/space/CMakeLists.txt index a2cf29a899..683e15c1fd 100644 --- a/modules/space/CMakeLists.txt +++ b/modules/space/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/space/rendering/planetgeometry.cpp b/modules/space/rendering/planetgeometry.cpp index 0f0c7cbef5..5a5a782015 100644 --- a/modules/space/rendering/planetgeometry.cpp +++ b/modules/space/rendering/planetgeometry.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/rendering/planetgeometry.h b/modules/space/rendering/planetgeometry.h index 9ba1259302..6be4505134 100644 --- a/modules/space/rendering/planetgeometry.h +++ b/modules/space/rendering/planetgeometry.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/rendering/renderableconstellationbounds.cpp b/modules/space/rendering/renderableconstellationbounds.cpp index 95183268e7..1f9fca6839 100644 --- a/modules/space/rendering/renderableconstellationbounds.cpp +++ b/modules/space/rendering/renderableconstellationbounds.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/rendering/renderableconstellationbounds.h b/modules/space/rendering/renderableconstellationbounds.h index 67c8e73080..2f86cc1d79 100644 --- a/modules/space/rendering/renderableconstellationbounds.h +++ b/modules/space/rendering/renderableconstellationbounds.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/rendering/renderablerings.cpp b/modules/space/rendering/renderablerings.cpp index c360ca597d..1a30124232 100644 --- a/modules/space/rendering/renderablerings.cpp +++ b/modules/space/rendering/renderablerings.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/rendering/renderablerings.h b/modules/space/rendering/renderablerings.h index ef0120fa12..d850670051 100644 --- a/modules/space/rendering/renderablerings.h +++ b/modules/space/rendering/renderablerings.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -79,7 +79,7 @@ private: GLuint _vertexPositionBuffer = 0; bool _planeIsDirty = false; - glm::vec3 _sunPosition; + glm::vec3 _sunPosition = glm::vec3(0.f); }; } // namespace openspace diff --git a/modules/space/rendering/renderablesatellites.cpp b/modules/space/rendering/renderablesatellites.cpp index 9998db6b2c..5c83022695 100644 --- a/modules/space/rendering/renderablesatellites.cpp +++ b/modules/space/rendering/renderablesatellites.cpp @@ -71,6 +71,11 @@ namespace { "Color", "This value determines the RGB main color for the lines and points of the trail." }; + constexpr openspace::properties::Property::PropertyInfo TrailFadeInfo = { + "TrailFade", + "Trail Fade", + "This value determines how fast the trail fades and is an appearance property. " + }; constexpr const char* KeyFile = "Path"; constexpr const char* KeyLineNum = "LineNumber"; @@ -321,15 +326,24 @@ RenderableSatellites::RenderableSatellites(const ghoul::Dictionary& dictionary) if (dictionary.hasKeyAndValue(LineColorInfo.identifier)) { _appearance.lineColor = dictionary.value(LineColorInfo.identifier); } - if (dictionary.hasKeyAndValue("FadeInfo")) { + if (dictionary.hasKeyAndValue(TrailFadeInfo.identifier)) { _appearance.lineFade = static_cast( - dictionary.value("FadeInfo") + dictionary.value(TrailFadeInfo.identifier) ); } else { _appearance.lineFade = 20; } + if (dictionary.hasKeyAndValue(LineWidthInfo.identifier)) { + _appearance.lineWidth = static_cast( + dictionary.value(LineWidthInfo.identifier) + ); + } + else { + _appearance.lineWidth = 2.0; + } + auto reinitializeTrailBuffers = [this]() { initializeGL(); }; diff --git a/modules/space/rendering/renderablesatellites.h b/modules/space/rendering/renderablesatellites.h index 8f58d936d8..1c3a4a6448 100644 --- a/modules/space/rendering/renderablesatellites.h +++ b/modules/space/rendering/renderablesatellites.h @@ -64,9 +64,9 @@ public: private: struct Vertex { - glm::vec3 position; - glm::vec3 color; - glm::vec2 texcoord; + glm::vec3 position = glm::vec3(0.f); + glm::vec3 color = glm::vec3(0.f); + glm::vec2 texcoord = glm::vec2(0.f); }; struct KeplerParameters { @@ -83,8 +83,12 @@ private: /// The layout of the VBOs struct TrailVBOLayout { - float x, y, z, time; - double epoch, period; + float x = 0.f; + float y = 0.f; + float z = 0.f; + float time = 0.f; + double epoch = 0.0; + double period = 0.0; }; KeplerTranslation _keplerTranslator; @@ -111,7 +115,7 @@ private: RenderableTrail::Appearance _appearance; - glm::vec3 _position; + glm::vec3 _position = glm::vec3(0.f); UniformCache(modelView, projection, lineFade, inGameTime, color, opacity, numberOfSegments) _uniformCache; diff --git a/modules/space/rendering/renderablestars.cpp b/modules/space/rendering/renderablestars.cpp index 56fbc1c0c7..6e3bf3d918 100644 --- a/modules/space/rendering/renderablestars.cpp +++ b/modules/space/rendering/renderablestars.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/rendering/renderablestars.h b/modules/space/rendering/renderablestars.h index a84e7632c7..2645900ad6 100644 --- a/modules/space/rendering/renderablestars.h +++ b/modules/space/rendering/renderablestars.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/rendering/simplespheregeometry.cpp b/modules/space/rendering/simplespheregeometry.cpp index 4b8fcdd514..36a15ab76e 100644 --- a/modules/space/rendering/simplespheregeometry.cpp +++ b/modules/space/rendering/simplespheregeometry.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/rendering/simplespheregeometry.h b/modules/space/rendering/simplespheregeometry.h index abed585ab9..3cd796b6da 100644 --- a/modules/space/rendering/simplespheregeometry.h +++ b/modules/space/rendering/simplespheregeometry.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/rotation/spicerotation.cpp b/modules/space/rotation/spicerotation.cpp index b2b8666914..07004cbf7e 100644 --- a/modules/space/rotation/spicerotation.cpp +++ b/modules/space/rotation/spicerotation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/rotation/spicerotation.h b/modules/space/rotation/spicerotation.h index 34a1d412a9..b1c0cb3ec5 100644 --- a/modules/space/rotation/spicerotation.h +++ b/modules/space/rotation/spicerotation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/shaders/constellationbounds_fs.glsl b/modules/space/shaders/constellationbounds_fs.glsl index 2e9e0e0eb0..b193abdd68 100644 --- a/modules/space/shaders/constellationbounds_fs.glsl +++ b/modules/space/shaders/constellationbounds_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/shaders/constellationbounds_vs.glsl b/modules/space/shaders/constellationbounds_vs.glsl index ddeea42820..fbc3537f7a 100644 --- a/modules/space/shaders/constellationbounds_vs.glsl +++ b/modules/space/shaders/constellationbounds_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/shaders/rings_fs.glsl b/modules/space/shaders/rings_fs.glsl index f7d6bf02dd..b9d4e484c8 100644 --- a/modules/space/shaders/rings_fs.glsl +++ b/modules/space/shaders/rings_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/shaders/rings_vs.glsl b/modules/space/shaders/rings_vs.glsl index 48d1c077ea..c6f5d007ee 100644 --- a/modules/space/shaders/rings_vs.glsl +++ b/modules/space/shaders/rings_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/shaders/star_fs.glsl b/modules/space/shaders/star_fs.glsl index 63479d5f64..8d6096e21d 100644 --- a/modules/space/shaders/star_fs.glsl +++ b/modules/space/shaders/star_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/shaders/star_ge.glsl b/modules/space/shaders/star_ge.glsl index 80ba2dd4f1..744b89006f 100644 --- a/modules/space/shaders/star_ge.glsl +++ b/modules/space/shaders/star_ge.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/shaders/star_vs.glsl b/modules/space/shaders/star_vs.glsl index c02770e5eb..094b5657ba 100644 --- a/modules/space/shaders/star_vs.glsl +++ b/modules/space/shaders/star_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/spacemodule.cpp b/modules/space/spacemodule.cpp index e52e2fc8ca..624ccc37c3 100644 --- a/modules/space/spacemodule.cpp +++ b/modules/space/spacemodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/spacemodule.h b/modules/space/spacemodule.h index bd5aedff70..527bce6a71 100644 --- a/modules/space/spacemodule.h +++ b/modules/space/spacemodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/translation/horizonstranslation.cpp b/modules/space/translation/horizonstranslation.cpp index 80dca66afe..e8cf08330f 100644 --- a/modules/space/translation/horizonstranslation.cpp +++ b/modules/space/translation/horizonstranslation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/translation/horizonstranslation.h b/modules/space/translation/horizonstranslation.h index 6bd1a21860..a0c2a9fea8 100644 --- a/modules/space/translation/horizonstranslation.h +++ b/modules/space/translation/horizonstranslation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/translation/keplertranslation.cpp b/modules/space/translation/keplertranslation.cpp index 1e1dddd7b9..c1dd9beb2d 100644 --- a/modules/space/translation/keplertranslation.cpp +++ b/modules/space/translation/keplertranslation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/translation/keplertranslation.h b/modules/space/translation/keplertranslation.h index 20eabc3cea..83c8fd6233 100644 --- a/modules/space/translation/keplertranslation.h +++ b/modules/space/translation/keplertranslation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -127,12 +127,7 @@ public: /// Recombutes the rotation matrix used in the update method void computeOrbitPlane() const; -protected: - - private: - - /** * This method computes the eccentric anomaly (location of the space craft taking the * eccentricity into acount) based on the mean anomaly (location of the space craft @@ -165,10 +160,10 @@ private: /// Dirty flag for the _orbitPlaneRotation parameters mutable bool _orbitPlaneDirty = true; /// The rotation matrix that defines the plane of the orbit - mutable glm::dmat3 _orbitPlaneRotation; + mutable glm::dmat3 _orbitPlaneRotation = glm::dmat3(1.0); /// The cached position for the last time with which the update method was called - glm::dvec3 _position; + glm::dvec3 _position = glm::dvec3(0.0); }; } // namespace openspace diff --git a/modules/space/translation/spicetranslation.cpp b/modules/space/translation/spicetranslation.cpp index 90bf8d3afe..1e1dcd6de2 100644 --- a/modules/space/translation/spicetranslation.cpp +++ b/modules/space/translation/spicetranslation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/translation/spicetranslation.h b/modules/space/translation/spicetranslation.h index 031faa57a6..e2136952e0 100644 --- a/modules/space/translation/spicetranslation.h +++ b/modules/space/translation/spicetranslation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -44,7 +44,7 @@ private: properties::StringProperty _observer; properties::StringProperty _frame; - glm::dvec3 _position; + glm::dvec3 _position = glm::dvec3(0.0); }; } // namespace openspace diff --git a/modules/space/translation/tletranslation.cpp b/modules/space/translation/tletranslation.cpp index 47403bf5cf..7d41878a33 100644 --- a/modules/space/translation/tletranslation.cpp +++ b/modules/space/translation/tletranslation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/space/translation/tletranslation.h b/modules/space/translation/tletranslation.h index 6d2dadfca6..aff26bc12a 100644 --- a/modules/space/translation/tletranslation.h +++ b/modules/space/translation/tletranslation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/CMakeLists.txt b/modules/spacecraftinstruments/CMakeLists.txt index 849f02fb6c..45f3282bc8 100644 --- a/modules/spacecraftinstruments/CMakeLists.txt +++ b/modules/spacecraftinstruments/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp b/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp index 034a152c16..3b8f594346 100644 --- a/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp +++ b/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -310,12 +310,12 @@ void DashboardItemInstruments::render(glm::vec2& penPosition) { } glm::vec2 DashboardItemInstruments::size() const { - glm::vec2 size = { 0.f, 0.f }; + glm::vec2 size = glm::vec2(0.f); //return ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox( double currentTime = global::timeManager.time().j2000Seconds(); if (!ImageSequencer::ref().isReady()) { - return { 0.f, 0.f }; + return glm::vec2(0.f); } ImageSequencer& sequencer = ImageSequencer::ref(); diff --git a/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.h b/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.h index c5d896ec14..1d787cf0f4 100644 --- a/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.h +++ b/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/rendering/renderablecrawlingline.cpp b/modules/spacecraftinstruments/rendering/renderablecrawlingline.cpp index 041350091d..d3dd6614b3 100644 --- a/modules/spacecraftinstruments/rendering/renderablecrawlingline.cpp +++ b/modules/spacecraftinstruments/rendering/renderablecrawlingline.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/rendering/renderablecrawlingline.h b/modules/spacecraftinstruments/rendering/renderablecrawlingline.h index 7f554345d1..e80107a5b6 100644 --- a/modules/spacecraftinstruments/rendering/renderablecrawlingline.h +++ b/modules/spacecraftinstruments/rendering/renderablecrawlingline.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -56,8 +56,8 @@ private: std::string _target; std::string _referenceFrame; - glm::vec4 _lineColorBegin; - glm::vec4 _lineColorEnd; + glm::vec4 _lineColorBegin = glm::vec4(0.f); + glm::vec4 _lineColorEnd = glm::vec4(0.f); int _frameCounter = 0; diff --git a/modules/spacecraftinstruments/rendering/renderablefov.cpp b/modules/spacecraftinstruments/rendering/renderablefov.cpp index d4396b270e..12e2d4de1d 100644 --- a/modules/spacecraftinstruments/rendering/renderablefov.cpp +++ b/modules/spacecraftinstruments/rendering/renderablefov.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/rendering/renderablefov.h b/modules/spacecraftinstruments/rendering/renderablefov.h index 0c0c8fe725..dca23e19d3 100644 --- a/modules/spacecraftinstruments/rendering/renderablefov.h +++ b/modules/spacecraftinstruments/rendering/renderablefov.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -116,7 +116,7 @@ private: SpiceManager::AberrationCorrection aberrationCorrection; std::vector bounds; - glm::dvec3 boresight; + glm::dvec3 boresight = glm::dvec3(0.0); std::vector potentialTargets; } _instrument; diff --git a/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp b/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp index 556c946e1f..9429362249 100644 --- a/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/rendering/renderablemodelprojection.h b/modules/spacecraftinstruments/rendering/renderablemodelprojection.h index f311ae065f..9c943c2388 100644 --- a/modules/spacecraftinstruments/rendering/renderablemodelprojection.h +++ b/modules/spacecraftinstruments/rendering/renderablemodelprojection.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -90,20 +90,20 @@ private: std::unique_ptr _geometry; - glm::dmat3 _instrumentMatrix; + glm::dmat3 _instrumentMatrix = glm::dmat3(1.0); // uniforms - glm::vec3 _up; - glm::mat4 _transform; - glm::mat4 _projectorMatrix; - glm::vec3 _boresight; + glm::vec3 _up = glm::vec3(0.f); + glm::mat4 _transform = glm::mat4(1.f); + glm::mat4 _projectorMatrix = glm::mat4(1.f); + glm::vec3 _boresight = glm::vec3(0.f); std::vector _imageTimes; double _time = -std::numeric_limits::max(); bool _shouldCapture = false; - glm::vec3 _sunPosition; + glm::vec3 _sunPosition = glm::vec3(0.f); properties::BoolProperty _performShading; }; diff --git a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp index 64b7864e70..45882270f9 100644 --- a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -203,7 +203,7 @@ void RenderablePlaneProjection::updatePlane(const Image& img, double currentTime std::string frame; std::vector bounds; - glm::dvec3 boresight; + glm::dvec3 boresight = glm::dvec3(0.0); try { SpiceManager::FieldOfViewResult r = SpiceManager::ref().fieldOfView(_instrument); @@ -230,6 +230,7 @@ void RenderablePlaneProjection::updatePlane(const Image& img, double currentTime // The apparent position, CN+S, makes image align best with target glm::dvec3 projection[4]; + std::fill(std::begin(projection), std::end(projection), glm::dvec3(0.0)); for (size_t j = 0; j < bounds.size(); ++j) { bounds[j] = SpiceManager::ref().frameTransformationMatrix( frame, diff --git a/modules/spacecraftinstruments/rendering/renderableplaneprojection.h b/modules/spacecraftinstruments/rendering/renderableplaneprojection.h index c68dfc18e9..d86b00d030 100644 --- a/modules/spacecraftinstruments/rendering/renderableplaneprojection.h +++ b/modules/spacecraftinstruments/rendering/renderableplaneprojection.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -65,7 +65,7 @@ private: bool _planeIsDirty = false; - glm::dmat3 _stateMatrix; + glm::dmat3 _stateMatrix = glm::dmat3(1.0); std::string _frame; std::unique_ptr _shader; diff --git a/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp b/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp index f73ba033d8..d65b9f929a 100644 --- a/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -514,7 +514,7 @@ void RenderablePlanetProjection::attitudeParameters(double time) { _transform = glm::mat4(_stateMatrix); - glm::dvec3 bs; + glm::dvec3 bs = glm::dvec3(0.0); try { SpiceManager::FieldOfViewResult res = SpiceManager::ref().fieldOfView( _projectionComponent.instrumentId() @@ -536,8 +536,8 @@ void RenderablePlanetProjection::attitudeParameters(double time) { lightTime ) * 1000.0; - float distance = glm::length(p); - float radius = boundingSphere(); + const double distance = glm::length(p); + const double radius = boundingSphere(); _projectorMatrix = _projectionComponent.computeProjectorMatrix( p, bs, @@ -545,8 +545,8 @@ void RenderablePlanetProjection::attitudeParameters(double time) { _instrumentMatrix, _projectionComponent.fieldOfViewY(), _projectionComponent.aspectRatio(), - distance - radius, - distance + radius, + static_cast(distance - radius), + static_cast(distance + radius), _boresight ); } diff --git a/modules/spacecraftinstruments/rendering/renderableplanetprojection.h b/modules/spacecraftinstruments/rendering/renderableplanetprojection.h index c8c1f133c8..8be5b83b66 100644 --- a/modules/spacecraftinstruments/rendering/renderableplanetprojection.h +++ b/modules/spacecraftinstruments/rendering/renderableplanetprojection.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -100,14 +100,14 @@ private: std::unique_ptr _geometry; - glm::vec2 _camScaling; - glm::vec3 _up; - glm::mat4 _transform; - glm::mat4 _projectorMatrix; + glm::vec2 _camScaling = glm::vec2(0.f); + glm::vec3 _up = glm::vec3(0.f); + glm::mat4 _transform = glm::mat4(1.f); + glm::mat4 _projectorMatrix = glm::mat4(1.f); - glm::dmat3 _stateMatrix; - glm::dmat3 _instrumentMatrix; - glm::vec3 _boresight; + glm::dmat3 _stateMatrix = glm::dmat3(1.0); + glm::dmat3 _instrumentMatrix = glm::dmat3(1.0); + glm::vec3 _boresight = glm::vec3(0.f); std::vector _imageTimes; diff --git a/modules/spacecraftinstruments/rendering/renderableshadowcylinder.cpp b/modules/spacecraftinstruments/rendering/renderableshadowcylinder.cpp index d521c7bc5a..3bef08edd9 100644 --- a/modules/spacecraftinstruments/rendering/renderableshadowcylinder.cpp +++ b/modules/spacecraftinstruments/rendering/renderableshadowcylinder.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/rendering/renderableshadowcylinder.h b/modules/spacecraftinstruments/rendering/renderableshadowcylinder.h index f63646c719..85be7ab556 100644 --- a/modules/spacecraftinstruments/rendering/renderableshadowcylinder.h +++ b/modules/spacecraftinstruments/rendering/renderableshadowcylinder.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -60,10 +60,10 @@ public: private: struct CylinderVBOLayout { - float x; - float y; - float z; - float e; + float x = 0.f; + float y = 0.f; + float z = 0.f; + float e = 0.f; }; void createCylinder(double time); @@ -81,7 +81,7 @@ private: ghoul::opengl::ProgramObject* _shader = nullptr; UniformCache(modelViewProjectionTransform, shadowColor) _uniformCache; - glm::dmat3 _stateMatrix; + glm::dmat3 _stateMatrix = glm::dmat3(1.0); GLuint _vao = 0; GLuint _vbo = 0; diff --git a/modules/spacecraftinstruments/shaders/crawlingline_fs.glsl b/modules/spacecraftinstruments/shaders/crawlingline_fs.glsl index 3dda8a23ff..fb5f9c6a62 100644 --- a/modules/spacecraftinstruments/shaders/crawlingline_fs.glsl +++ b/modules/spacecraftinstruments/shaders/crawlingline_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/crawlingline_vs.glsl b/modules/spacecraftinstruments/shaders/crawlingline_vs.glsl index 3a07e8ff7c..9d75648529 100644 --- a/modules/spacecraftinstruments/shaders/crawlingline_vs.glsl +++ b/modules/spacecraftinstruments/shaders/crawlingline_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/fov_fs.glsl b/modules/spacecraftinstruments/shaders/fov_fs.glsl index 8320989fb6..089ba1e8b3 100644 --- a/modules/spacecraftinstruments/shaders/fov_fs.glsl +++ b/modules/spacecraftinstruments/shaders/fov_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/fov_vs.glsl b/modules/spacecraftinstruments/shaders/fov_vs.glsl index 633fcf53bf..489f38ec48 100644 --- a/modules/spacecraftinstruments/shaders/fov_vs.glsl +++ b/modules/spacecraftinstruments/shaders/fov_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/renderableModelProjection_fs.glsl b/modules/spacecraftinstruments/shaders/renderableModelProjection_fs.glsl index de9dfd610c..886a05c843 100644 --- a/modules/spacecraftinstruments/shaders/renderableModelProjection_fs.glsl +++ b/modules/spacecraftinstruments/shaders/renderableModelProjection_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/renderableModelProjection_vs.glsl b/modules/spacecraftinstruments/shaders/renderableModelProjection_vs.glsl index efb7869f6e..63448d4d22 100644 --- a/modules/spacecraftinstruments/shaders/renderableModelProjection_vs.glsl +++ b/modules/spacecraftinstruments/shaders/renderableModelProjection_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/renderableModel_fs.glsl b/modules/spacecraftinstruments/shaders/renderableModel_fs.glsl index 2d688f003b..b1ee517e61 100644 --- a/modules/spacecraftinstruments/shaders/renderableModel_fs.glsl +++ b/modules/spacecraftinstruments/shaders/renderableModel_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/renderableModel_vs.glsl b/modules/spacecraftinstruments/shaders/renderableModel_vs.glsl index fd106e5457..bfc2456bf7 100644 --- a/modules/spacecraftinstruments/shaders/renderableModel_vs.glsl +++ b/modules/spacecraftinstruments/shaders/renderableModel_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/renderablePlanetProjection_fs.glsl b/modules/spacecraftinstruments/shaders/renderablePlanetProjection_fs.glsl index 311e4f52c1..a78f09d07e 100644 --- a/modules/spacecraftinstruments/shaders/renderablePlanetProjection_fs.glsl +++ b/modules/spacecraftinstruments/shaders/renderablePlanetProjection_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/renderablePlanetProjection_vs.glsl b/modules/spacecraftinstruments/shaders/renderablePlanetProjection_vs.glsl index 9f38a64d1d..9007efff34 100644 --- a/modules/spacecraftinstruments/shaders/renderablePlanetProjection_vs.glsl +++ b/modules/spacecraftinstruments/shaders/renderablePlanetProjection_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/renderablePlanet_fs.glsl b/modules/spacecraftinstruments/shaders/renderablePlanet_fs.glsl index fbfb89f52f..01373460e8 100644 --- a/modules/spacecraftinstruments/shaders/renderablePlanet_fs.glsl +++ b/modules/spacecraftinstruments/shaders/renderablePlanet_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/renderablePlanet_vs.glsl b/modules/spacecraftinstruments/shaders/renderablePlanet_vs.glsl index da05c6e9fa..fa1568f5fe 100644 --- a/modules/spacecraftinstruments/shaders/renderablePlanet_vs.glsl +++ b/modules/spacecraftinstruments/shaders/renderablePlanet_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/terminatorshadow_fs.glsl b/modules/spacecraftinstruments/shaders/terminatorshadow_fs.glsl index ca7c77ff31..1fafbc02a2 100644 --- a/modules/spacecraftinstruments/shaders/terminatorshadow_fs.glsl +++ b/modules/spacecraftinstruments/shaders/terminatorshadow_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/shaders/terminatorshadow_vs.glsl b/modules/spacecraftinstruments/shaders/terminatorshadow_vs.glsl index 685a9c8270..3e5ab5cfbd 100644 --- a/modules/spacecraftinstruments/shaders/terminatorshadow_vs.glsl +++ b/modules/spacecraftinstruments/shaders/terminatorshadow_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/spacecraftinstrumentsmodule.cpp b/modules/spacecraftinstruments/spacecraftinstrumentsmodule.cpp index 460418b055..1ea6a2d698 100644 --- a/modules/spacecraftinstruments/spacecraftinstrumentsmodule.cpp +++ b/modules/spacecraftinstruments/spacecraftinstrumentsmodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -39,6 +39,7 @@ #include #include #include +#include #include namespace openspace { @@ -48,6 +49,8 @@ ghoul::opengl::ProgramObjectManager SpacecraftInstrumentsModule::ProgramObjectMa SpacecraftInstrumentsModule::SpacecraftInstrumentsModule() : OpenSpaceModule(Name) {} void SpacecraftInstrumentsModule::internalInitialize(const ghoul::Dictionary&) { + ZoneScoped + ImageSequencer::initialize(); FactoryManager::ref().addFactory( diff --git a/modules/spacecraftinstruments/spacecraftinstrumentsmodule.h b/modules/spacecraftinstruments/spacecraftinstrumentsmodule.h index fc37bd53bb..53f55a4a02 100644 --- a/modules/spacecraftinstruments/spacecraftinstrumentsmodule.h +++ b/modules/spacecraftinstruments/spacecraftinstrumentsmodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/decoder.cpp b/modules/spacecraftinstruments/util/decoder.cpp index 5cb019ee9e..1006d856d4 100644 --- a/modules/spacecraftinstruments/util/decoder.cpp +++ b/modules/spacecraftinstruments/util/decoder.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/decoder.h b/modules/spacecraftinstruments/util/decoder.h index a6633b281c..878f1cd742 100644 --- a/modules/spacecraftinstruments/util/decoder.h +++ b/modules/spacecraftinstruments/util/decoder.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/hongkangparser.cpp b/modules/spacecraftinstruments/util/hongkangparser.cpp index d5dbcd7890..db387a547d 100644 --- a/modules/spacecraftinstruments/util/hongkangparser.cpp +++ b/modules/spacecraftinstruments/util/hongkangparser.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/hongkangparser.h b/modules/spacecraftinstruments/util/hongkangparser.h index 37696d3e73..7232afeb15 100644 --- a/modules/spacecraftinstruments/util/hongkangparser.h +++ b/modules/spacecraftinstruments/util/hongkangparser.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/image.h b/modules/spacecraftinstruments/util/image.h index c94747fe26..642765d142 100644 --- a/modules/spacecraftinstruments/util/image.h +++ b/modules/spacecraftinstruments/util/image.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/imagesequencer.cpp b/modules/spacecraftinstruments/util/imagesequencer.cpp index 15465a5aa3..5e51a43aff 100644 --- a/modules/spacecraftinstruments/util/imagesequencer.cpp +++ b/modules/spacecraftinstruments/util/imagesequencer.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -416,6 +416,8 @@ void ImageSequencer::runSequenceParser(SequenceParser& parser) { source.begin(), source.end() ); + + _subsetMap[key]._range.include(it.second._range); } _instrumentTimes.insert( diff --git a/modules/spacecraftinstruments/util/imagesequencer.h b/modules/spacecraftinstruments/util/imagesequencer.h index fb792e6d91..3f01f2712a 100644 --- a/modules/spacecraftinstruments/util/imagesequencer.h +++ b/modules/spacecraftinstruments/util/imagesequencer.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/instrumentdecoder.cpp b/modules/spacecraftinstruments/util/instrumentdecoder.cpp index a2685894e1..4ef3eeed44 100644 --- a/modules/spacecraftinstruments/util/instrumentdecoder.cpp +++ b/modules/spacecraftinstruments/util/instrumentdecoder.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/instrumentdecoder.h b/modules/spacecraftinstruments/util/instrumentdecoder.h index de4dd7c862..2537b45870 100644 --- a/modules/spacecraftinstruments/util/instrumentdecoder.h +++ b/modules/spacecraftinstruments/util/instrumentdecoder.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/instrumenttimesparser.cpp b/modules/spacecraftinstruments/util/instrumenttimesparser.cpp index da373f9d30..0aad439d9d 100644 --- a/modules/spacecraftinstruments/util/instrumenttimesparser.cpp +++ b/modules/spacecraftinstruments/util/instrumenttimesparser.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/instrumenttimesparser.h b/modules/spacecraftinstruments/util/instrumenttimesparser.h index f8326f086e..6e8947d12f 100644 --- a/modules/spacecraftinstruments/util/instrumenttimesparser.h +++ b/modules/spacecraftinstruments/util/instrumenttimesparser.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/labelparser.cpp b/modules/spacecraftinstruments/util/labelparser.cpp index d450b767f0..27159934e0 100644 --- a/modules/spacecraftinstruments/util/labelparser.cpp +++ b/modules/spacecraftinstruments/util/labelparser.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/labelparser.h b/modules/spacecraftinstruments/util/labelparser.h index 017fdc2444..d7f5496c13 100644 --- a/modules/spacecraftinstruments/util/labelparser.h +++ b/modules/spacecraftinstruments/util/labelparser.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/projectioncomponent.cpp b/modules/spacecraftinstruments/util/projectioncomponent.cpp index 990af24184..704b361b6b 100644 --- a/modules/spacecraftinstruments/util/projectioncomponent.cpp +++ b/modules/spacecraftinstruments/util/projectioncomponent.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -51,12 +51,14 @@ namespace { constexpr const char* keyInstrumentAspect = "Instrument.Aspect"; constexpr const char* keyTranslation = "DataInputTranslation"; + constexpr const char* keyTimesTranslation = "TimesDataInputTranslation"; constexpr const char* keyProjObserver = "Observer"; constexpr const char* keyProjTarget = "Target"; constexpr const char* keyProjAberration = "Aberration"; constexpr const char* keySequenceDir = "Sequence"; + constexpr const char* keyTimesSequenceDir = "TimesSequence"; constexpr const char* keySequenceType = "SequenceType"; constexpr const char* keyNeedsTextureMapDilation = "TextureMap"; @@ -67,6 +69,7 @@ namespace { constexpr const char* sequenceTypePlaybook = "playbook"; constexpr const char* sequenceTypeHybrid = "hybrid"; constexpr const char* sequenceTypeInstrumentTimes = "instrument-times"; + constexpr const char* sequenceTypeImageAndInstrumentTimes = "image-and-instrument-times"; constexpr const char* placeholderFile = "${DATA}/placeholder.png"; @@ -149,7 +152,7 @@ documentation::Documentation ProjectionComponent::Documentation() { keySequenceType, new StringInListVerifier( { sequenceTypeImage, sequenceTypePlaybook, sequenceTypeHybrid, - sequenceTypeInstrumentTimes } + sequenceTypeInstrumentTimes, sequenceTypeImageAndInstrumentTimes } ), Optional::Yes, "This value determines which type of sequencer is used for generating " @@ -369,6 +372,27 @@ void ProjectionComponent::initialize(const std::string& identifier, ) ); } + else if (sequenceType == sequenceTypeImageAndInstrumentTimes) { + parsers.push_back( + std::make_unique( + identifier, + std::move(sequenceSource), + translationDictionary + ) + ); + + std::string timesSequenceSource = absPath(dictionary.value(keyTimesSequenceDir)); + ghoul::Dictionary timesTranslationDictionary; + dictionary.getValue(keyTimesTranslation, timesTranslationDictionary); + + parsers.push_back( + std::make_unique( + identifier, + std::move(timesSequenceSource), + timesTranslationDictionary + ) + ); + } } for (std::unique_ptr& parser : parsers) { diff --git a/modules/spacecraftinstruments/util/projectioncomponent.h b/modules/spacecraftinstruments/util/projectioncomponent.h index 19f9d927af..931b47d07b 100644 --- a/modules/spacecraftinstruments/util/projectioncomponent.h +++ b/modules/spacecraftinstruments/util/projectioncomponent.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/scannerdecoder.cpp b/modules/spacecraftinstruments/util/scannerdecoder.cpp index 7d4b748845..cfeb7d993a 100644 --- a/modules/spacecraftinstruments/util/scannerdecoder.cpp +++ b/modules/spacecraftinstruments/util/scannerdecoder.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/scannerdecoder.h b/modules/spacecraftinstruments/util/scannerdecoder.h index 6e15ef4982..4efba03bd3 100644 --- a/modules/spacecraftinstruments/util/scannerdecoder.h +++ b/modules/spacecraftinstruments/util/scannerdecoder.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/sequenceparser.cpp b/modules/spacecraftinstruments/util/sequenceparser.cpp index 2cf6d98ed5..ad41246ff5 100644 --- a/modules/spacecraftinstruments/util/sequenceparser.cpp +++ b/modules/spacecraftinstruments/util/sequenceparser.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/sequenceparser.h b/modules/spacecraftinstruments/util/sequenceparser.h index d3881f9468..ffda80131b 100644 --- a/modules/spacecraftinstruments/util/sequenceparser.h +++ b/modules/spacecraftinstruments/util/sequenceparser.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/targetdecoder.cpp b/modules/spacecraftinstruments/util/targetdecoder.cpp index 9d7f7cb752..6787d2f75d 100644 --- a/modules/spacecraftinstruments/util/targetdecoder.cpp +++ b/modules/spacecraftinstruments/util/targetdecoder.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spacecraftinstruments/util/targetdecoder.h b/modules/spacecraftinstruments/util/targetdecoder.h index b617577f65..477cd8bcce 100644 --- a/modules/spacecraftinstruments/util/targetdecoder.h +++ b/modules/spacecraftinstruments/util/targetdecoder.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spout/CMakeLists.txt b/modules/spout/CMakeLists.txt index 8a9c7c3722..9cc9bd8a01 100644 --- a/modules/spout/CMakeLists.txt +++ b/modules/spout/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/spout/renderableplanespout.cpp b/modules/spout/renderableplanespout.cpp index c398898adc..68a3a81a1c 100644 --- a/modules/spout/renderableplanespout.cpp +++ b/modules/spout/renderableplanespout.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spout/renderableplanespout.h b/modules/spout/renderableplanespout.h index 0df8dda2fc..99e0bd639c 100644 --- a/modules/spout/renderableplanespout.h +++ b/modules/spout/renderableplanespout.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spout/screenspacespout.cpp b/modules/spout/screenspacespout.cpp index b3204f0135..db1cec61b1 100644 --- a/modules/spout/screenspacespout.cpp +++ b/modules/spout/screenspacespout.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spout/screenspacespout.h b/modules/spout/screenspacespout.h index 4c8e06b529..0cfa61ec3c 100644 --- a/modules/spout/screenspacespout.h +++ b/modules/spout/screenspacespout.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spout/spoutlibrary.h b/modules/spout/spoutlibrary.h index 22cae4105f..bb3bbaac84 100644 --- a/modules/spout/spoutlibrary.h +++ b/modules/spout/spoutlibrary.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spout/spoutmodule.cpp b/modules/spout/spoutmodule.cpp index b6853726b7..01cb0800be 100644 --- a/modules/spout/spoutmodule.cpp +++ b/modules/spout/spoutmodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/spout/spoutmodule.h b/modules/spout/spoutmodule.h index b2b9c95cdb..08fae170a0 100644 --- a/modules/spout/spoutmodule.h +++ b/modules/spout/spoutmodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/sync/CMakeLists.txt b/modules/sync/CMakeLists.txt index a263e5498f..97a6716b7e 100644 --- a/modules/sync/CMakeLists.txt +++ b/modules/sync/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/sync/syncmodule.cpp b/modules/sync/syncmodule.cpp index 6f920b85d4..53a7151789 100644 --- a/modules/sync/syncmodule.cpp +++ b/modules/sync/syncmodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/sync/syncmodule.h b/modules/sync/syncmodule.h index 64cb7e412d..5e24d4cdfc 100644 --- a/modules/sync/syncmodule.h +++ b/modules/sync/syncmodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/sync/syncs/httpsynchronization.cpp b/modules/sync/syncs/httpsynchronization.cpp index a924f1e053..030c168c04 100644 --- a/modules/sync/syncs/httpsynchronization.cpp +++ b/modules/sync/syncs/httpsynchronization.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/sync/syncs/httpsynchronization.h b/modules/sync/syncs/httpsynchronization.h index d5474698e6..db768761a0 100644 --- a/modules/sync/syncs/httpsynchronization.h +++ b/modules/sync/syncs/httpsynchronization.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/sync/syncs/urlsynchronization.cpp b/modules/sync/syncs/urlsynchronization.cpp index ecb2e71f5b..374c6c93f9 100644 --- a/modules/sync/syncs/urlsynchronization.cpp +++ b/modules/sync/syncs/urlsynchronization.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -43,8 +43,10 @@ namespace { constexpr const char* KeyIdentifier = "Identifier"; constexpr const char* KeyOverride = "Override"; constexpr const char* KeyUseHash = "UseHash"; + constexpr const char* KeyFilename = "Filename"; constexpr const char* TempSuffix = ".tmp"; + constexpr const char* FileSuffix = ".txt"; } // namespace namespace openspace { @@ -90,6 +92,13 @@ documentation::Documentation UrlSynchronization::Documentation() { "circumstances. If this is not desired, the URLSynchronization use the " "bare directory name alone if this value is 'false'. If this value is " "'false', the identifier has to be specified." + }, + { + KeyFilename, + new StringVerifier, + Optional::Yes, + "Optional to provide filename to override the one which is otherwise " + "automatically created from the url. " } } }; @@ -117,6 +126,14 @@ UrlSynchronization::UrlSynchronization(const ghoul::Dictionary& dict, } } + if (dict.hasValue(KeyFilename)) { + _filename = dict.value(KeyFilename); + std::size_t foundExt = _filename.find(FileSuffix); + if (foundExt == std::string::npos) { + _filename += FileSuffix; + } + } + bool useHash = true; if (dict.hasValue(KeyUseHash)) { useHash = dict.value(KeyUseHash); @@ -181,11 +198,22 @@ void UrlSynchronization::start() { std::vector> downloads; for (const std::string& url : _urls) { - const size_t lastSlash = url.find_last_of('/'); - const std::string filename = url.substr(lastSlash + 1); + if (_filename.empty()) { + const size_t lastSlash = url.find_last_of('/'); + std::string lastPartOfUrl = url.substr(lastSlash + 1); + + // We can not create filenames with questionmarks + lastPartOfUrl.erase(std::remove(lastPartOfUrl.begin(), lastPartOfUrl.end(), '?'), lastPartOfUrl.end()); + + std::size_t foundExt = lastPartOfUrl.find(FileSuffix); + if (foundExt == std::string::npos) { + lastPartOfUrl += FileSuffix; + } + _filename = lastPartOfUrl; + } std::string fileDestination = directory() + - ghoul::filesystem::FileSystem::PathSeparator + filename + TempSuffix; + ghoul::filesystem::FileSystem::PathSeparator + _filename + TempSuffix; std::unique_ptr download = std::make_unique( diff --git a/modules/sync/syncs/urlsynchronization.h b/modules/sync/syncs/urlsynchronization.h index b3e6ce4a98..d0e6047737 100644 --- a/modules/sync/syncs/urlsynchronization.h +++ b/modules/sync/syncs/urlsynchronization.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -58,6 +58,7 @@ private: bool _forceOverride = false; std::string _synchronizationRoot; std::string _identifier; + std::string _filename; std::atomic_bool _nTotalBytesKnown = false; std::atomic_size_t _nTotalBytes = 0; diff --git a/modules/sync/tasks/syncassettask.cpp b/modules/sync/tasks/syncassettask.cpp index 24e54289f5..d6792ffbe0 100644 --- a/modules/sync/tasks/syncassettask.cpp +++ b/modules/sync/tasks/syncassettask.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -123,7 +123,7 @@ void SyncAssetTask::perform(const Task::ProgressCallback& progressCallback) { ghoul::lua::LuaState luaState; scriptEngine.initializeLuaState(luaState); - AssetLoader loader(luaState, &watcher, "${ASSETS}"); + AssetLoader loader(&luaState, &watcher, "${ASSETS}"); RequestListener listener; loader.addAssetListener(&listener); diff --git a/modules/sync/tasks/syncassettask.h b/modules/sync/tasks/syncassettask.h index aa5236e480..168bb7006d 100644 --- a/modules/sync/tasks/syncassettask.h +++ b/modules/sync/tasks/syncassettask.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/CMakeLists.txt b/modules/touch/CMakeLists.txt index d0b7ec5289..5792eaaecf 100644 --- a/modules/touch/CMakeLists.txt +++ b/modules/touch/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/touch/ext/CMakeLists.txt b/modules/touch/ext/CMakeLists.txt index 44dd7cc798..19a1dca056 100644 --- a/modules/touch/ext/CMakeLists.txt +++ b/modules/touch/ext/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/touch/include/directinputsolver.h b/modules/touch/include/directinputsolver.h index bc866ba2dd..c65ca76782 100644 --- a/modules/touch/include/directinputsolver.h +++ b/modules/touch/include/directinputsolver.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -44,9 +44,9 @@ public: // Stores the selected node, the cursor ID as well as the surface coordinates the // cursor touched struct SelectedBody { - size_t id; - SceneGraphNode* node; - glm::dvec3 coordinates; + size_t id = 0; + SceneGraphNode* node = nullptr; + glm::dvec3 coordinates = glm::dvec3(0.0); }; DirectInputSolver(); diff --git a/modules/touch/include/touchinteraction.h b/modules/touch/include/touchinteraction.h index a0f025d90b..8faed8bbfb 100644 --- a/modules/touch/include/touchinteraction.h +++ b/modules/touch/include/touchinteraction.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -71,10 +71,10 @@ public: // Stores the velocity in all 6DOF struct VelocityStates { - glm::dvec2 orbit; - double zoom; - double roll; - glm::dvec2 pan; + glm::dvec2 orbit = glm::dvec2(0.0); + double zoom = 0.0; + double roll = 0.0; + glm::dvec2 pan = glm::dvec2(0.0); }; /* Main function call @@ -225,7 +225,7 @@ private: SceneGraphNode* _pickingSelected = nullptr; DirectInputSolver _solver; - glm::dquat _toSlerp; + glm::dquat _toSlerp = glm::dquat(1.0, 0.0, 0.0, 0.0); glm::vec2 _centroid = glm::vec2(0.f); FrameTimeAverage _frameTimeAvg; diff --git a/modules/touch/include/touchmarker.h b/modules/touch/include/touchmarker.h index c11ea7f65d..43d2d7be94 100644 --- a/modules/touch/include/touchmarker.h +++ b/modules/touch/include/touchmarker.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/include/tuioear.h b/modules/touch/include/tuioear.h index 25c98edbf8..cbbd8bb8dc 100644 --- a/modules/touch/include/tuioear.h +++ b/modules/touch/include/tuioear.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/include/win32_touch.h b/modules/touch/include/win32_touch.h index 21a39fbc03..1741febd7d 100644 --- a/modules/touch/include/win32_touch.h +++ b/modules/touch/include/win32_touch.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/shaders/marker_fs.glsl b/modules/touch/shaders/marker_fs.glsl index bb19807bc2..9d04a92a38 100644 --- a/modules/touch/shaders/marker_fs.glsl +++ b/modules/touch/shaders/marker_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/shaders/marker_vs.glsl b/modules/touch/shaders/marker_vs.glsl index b1af43080a..5b40a6b65b 100644 --- a/modules/touch/shaders/marker_vs.glsl +++ b/modules/touch/shaders/marker_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/src/directinputsolver.cpp b/modules/touch/src/directinputsolver.cpp index 46701af1da..419d08e149 100644 --- a/modules/touch/src/directinputsolver.cpp +++ b/modules/touch/src/directinputsolver.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/src/touchinteraction.cpp b/modules/touch/src/touchinteraction.cpp index 367fef5668..b12795b9e6 100644 --- a/modules/touch/src/touchinteraction.cpp +++ b/modules/touch/src/touchinteraction.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -404,10 +404,10 @@ void TouchInteraction::updateStateFromInput(const std::vector& if (!isGuiMode(pos, numFingers)) { bool isTransitionBetweenModes = (_wasPrevModeDirectTouch != _directTouchMode); if (isTransitionBetweenModes) { - _vel.orbit = glm::dvec2(0.0, 0.0); + _vel.orbit = glm::dvec2(0.0); _vel.zoom = 0.0; _vel.roll = 0.0; - _vel.pan = glm::dvec2(0.0, 0.0); + _vel.pan = glm::dvec2(0.0); resetAfterInput(); } @@ -468,10 +468,10 @@ bool TouchInteraction::isGuiMode(glm::dvec2 screenPosition, size_t numFingers) { void TouchInteraction::directControl(const std::vector& list) { // Reset old velocities upon new interaction - _vel.orbit = glm::dvec2(0.0, 0.0); + _vel.orbit = glm::dvec2(0.0); _vel.zoom = 0.0; _vel.roll = 0.0; - _vel.pan = glm::dvec2(0.0, 0.0); + _vel.pan = glm::dvec2(0.0); #ifdef TOUCH_DEBUG_PROPERTIES LINFO("DirectControl"); #endif @@ -498,17 +498,17 @@ void TouchInteraction::directControl(const std::vector& list) // Reset velocities after setting new camera state _lastVel = _vel; - _vel.orbit = glm::dvec2(0.0, 0.0); + _vel.orbit = glm::dvec2(0.0); _vel.zoom = 0.0; _vel.roll = 0.0; - _vel.pan = glm::dvec2(0.0, 0.0); + _vel.pan = glm::dvec2(0.0); } else { // prevents touch to infinitely be active (due to windows bridge case where event // doesnt get consumed sometimes when LMA fails to converge) Touch touch; touch.active = true; - touch.pos = glm::dvec2(0.0, 0.0); + touch.pos = glm::dvec2(0.0); touch.action = 1; global::moduleEngine.module()->touchInput = touch; resetAfterInput(); @@ -1224,10 +1224,10 @@ void TouchInteraction::resetAfterInput() { _guiON = module.gui.isEnabled(); // Reset variables - _lastVel.orbit = glm::dvec2(0.0, 0.0); + _lastVel.orbit = glm::dvec2(0.0); _lastVel.zoom = 0.0; _lastVel.roll = 0.0; - _lastVel.pan = glm::dvec2(0.0, 0.0); + _lastVel.pan = glm::dvec2(0.0); _selected.clear(); _pickingSelected = nullptr; } diff --git a/modules/touch/src/touchmarker.cpp b/modules/touch/src/touchmarker.cpp index 7757286dab..386007074c 100644 --- a/modules/touch/src/touchmarker.cpp +++ b/modules/touch/src/touchmarker.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/src/tuioear.cpp b/modules/touch/src/tuioear.cpp index 885f069969..ac9c91fffe 100644 --- a/modules/touch/src/tuioear.cpp +++ b/modules/touch/src/tuioear.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/src/win32_touch.cpp b/modules/touch/src/win32_touch.cpp index 5c1db8381d..725c005c23 100644 --- a/modules/touch/src/win32_touch.cpp +++ b/modules/touch/src/win32_touch.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/touchmodule.cpp b/modules/touch/touchmodule.cpp index 721d2280ac..73a12cbbfc 100644 --- a/modules/touch/touchmodule.cpp +++ b/modules/touch/touchmodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/touch/touchmodule.h b/modules/touch/touchmodule.h index 9ce8b73f92..919f888f7a 100644 --- a/modules/touch/touchmodule.h +++ b/modules/touch/touchmodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -66,7 +66,7 @@ private: properties::BoolProperty _touchActive; // contains an id and the Point that was processed last frame - glm::ivec2 _webPositionCallback = glm::ivec2(0,0); + glm::ivec2 _webPositionCallback = glm::ivec2(0); #ifdef WIN32 std::unique_ptr _win32TouchHook; #endif //WIN32 diff --git a/modules/toyvolume/CMakeLists.txt b/modules/toyvolume/CMakeLists.txt index 12dbf7d302..ad4395b781 100644 --- a/modules/toyvolume/CMakeLists.txt +++ b/modules/toyvolume/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/toyvolume/rendering/renderabletoyvolume.cpp b/modules/toyvolume/rendering/renderabletoyvolume.cpp index a5c37bf4e2..ab642b0a13 100644 --- a/modules/toyvolume/rendering/renderabletoyvolume.cpp +++ b/modules/toyvolume/rendering/renderabletoyvolume.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -85,7 +85,12 @@ RenderableToyVolume::RenderableToyVolume(const ghoul::Dictionary& dictionary) , _scalingExponent(ScalingExponentInfo, 1, -10, 20) , _stepSize(StepSizeInfo, 0.02f, 0.01f, 1.f ) , _translation(TranslationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(10.f)) - , _rotation(RotationInfo, glm::vec3(0.f, 0.f, 0.f), glm::vec3(0), glm::vec3(6.28f)) + , _rotation( + RotationInfo, + glm::vec3(0.f), + glm::vec3(0.f), + glm::vec3(glm::two_pi()) + ) , _color(ColorInfo, glm::vec4(1.f, 0.f, 0.f, 0.1f), glm::vec4(0.f), glm::vec4(1.f)) , _downScaleVolumeRendering(DownscaleVolumeRenderingInfo, 1.f, 0.1f, 1.f) { @@ -175,19 +180,19 @@ bool RenderableToyVolume::isReady() const { void RenderableToyVolume::update(const UpdateData& data) { if (_raycaster) { glm::mat4 transform = glm::translate( - glm::mat4(1.0), + glm::mat4(1.f), static_cast(_translation) * - std::pow(10.0f, static_cast(_scalingExponent)) + std::pow(10.f, static_cast(_scalingExponent)) ); glm::vec3 eulerRotation = static_cast(_rotation); - transform = glm::rotate(transform, eulerRotation.x, glm::vec3(1, 0, 0)); - transform = glm::rotate(transform, eulerRotation.y, glm::vec3(0, 1, 0)); - transform = glm::rotate(transform, eulerRotation.z, glm::vec3(0, 0, 1)); + transform = glm::rotate(transform, eulerRotation.x, glm::vec3(1.f, 0.f, 0.f)); + transform = glm::rotate(transform, eulerRotation.y, glm::vec3(0.f, 1.f, 0.f)); + transform = glm::rotate(transform, eulerRotation.z, glm::vec3(0.f, 0.f, 1.f)); transform = glm::scale( transform, static_cast(_size) * - std::pow(10.0f, static_cast(_scalingExponent)) + std::pow(10.f, static_cast(_scalingExponent)) ); _raycaster->setColor(_color); diff --git a/modules/toyvolume/rendering/renderabletoyvolume.h b/modules/toyvolume/rendering/renderabletoyvolume.h index d946bd21f9..4f4692534b 100644 --- a/modules/toyvolume/rendering/renderabletoyvolume.h +++ b/modules/toyvolume/rendering/renderabletoyvolume.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/toyvolume/rendering/toyvolumeraycaster.cpp b/modules/toyvolume/rendering/toyvolumeraycaster.cpp index 97d71c05bf..87a6b2c173 100644 --- a/modules/toyvolume/rendering/toyvolumeraycaster.cpp +++ b/modules/toyvolume/rendering/toyvolumeraycaster.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -48,7 +48,7 @@ namespace { namespace openspace { ToyVolumeRaycaster::ToyVolumeRaycaster(glm::vec4 color) - : _boundingBox(glm::vec3(1.0)) + : _boundingBox(glm::vec3(1.f)) , _color(std::move(color)) {} @@ -118,7 +118,7 @@ bool ToyVolumeRaycaster::isCameraInside(const RenderData& data, glm::vec3& local glm::vec4 modelPos = glm::inverse(modelViewTransform(data)) * glm::vec4(0.f, 0.f, 0.f, 1.f); - localPosition = (glm::vec3(modelPos) + glm::vec3(0.5)); + localPosition = (glm::vec3(modelPos) + glm::vec3(0.5f)); return (localPosition.x > 0 && localPosition.x < 1 && localPosition.y > 0 && localPosition.y < 1 && diff --git a/modules/toyvolume/rendering/toyvolumeraycaster.h b/modules/toyvolume/rendering/toyvolumeraycaster.h index 69ea90a422..b5672c5e60 100644 --- a/modules/toyvolume/rendering/toyvolumeraycaster.h +++ b/modules/toyvolume/rendering/toyvolumeraycaster.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -72,10 +72,10 @@ private: glm::dmat4 modelViewTransform(const RenderData& data); BoxGeometry _boundingBox; - glm::vec4 _color; - glm::mat4 _modelTransform; - float _stepSize; - double _time; + glm::vec4 _color = glm::vec4(0.f); + glm::mat4 _modelTransform = glm::mat4(1.f); + float _stepSize = 0.f; + double _time = 0.0; }; // ToyVolumeRaycaster } // openspace diff --git a/modules/toyvolume/toyvolumemodule.cpp b/modules/toyvolume/toyvolumemodule.cpp index 9198ffb599..2626a877fe 100644 --- a/modules/toyvolume/toyvolumemodule.cpp +++ b/modules/toyvolume/toyvolumemodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/toyvolume/toyvolumemodule.h b/modules/toyvolume/toyvolumemodule.h index a134415a49..cfecede06f 100644 --- a/modules/toyvolume/toyvolumemodule.h +++ b/modules/toyvolume/toyvolumemodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/CMakeLists.txt b/modules/volume/CMakeLists.txt index fc090bd969..3974d1f95f 100644 --- a/modules/volume/CMakeLists.txt +++ b/modules/volume/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/volume/envelope.cpp b/modules/volume/envelope.cpp index ab20149807..8ce6f6ed3a 100644 --- a/modules/volume/envelope.cpp +++ b/modules/volume/envelope.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/envelope.h b/modules/volume/envelope.h index 7cff391236..b7f3d07698 100644 --- a/modules/volume/envelope.h +++ b/modules/volume/envelope.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -42,7 +42,7 @@ public: glm::vec3 hexadecimalToRGBConversion(const std::string& hex) const; std::string hexadecimalFromVec3(const glm::vec3& vec) const; - glm::vec3 color; + glm::vec3 color = glm::vec3(0.f); std::string colorHex; std::pair position; }; diff --git a/modules/volume/linearlrucache.h b/modules/volume/linearlrucache.h index eda2318b7f..d2a8c3553f 100644 --- a/modules/volume/linearlrucache.h +++ b/modules/volume/linearlrucache.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/linearlrucache.inl b/modules/volume/linearlrucache.inl index 3548a15216..0353fb2044 100644 --- a/modules/volume/linearlrucache.inl +++ b/modules/volume/linearlrucache.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/lrucache.h b/modules/volume/lrucache.h index 10270e7dfa..2b20ce46b9 100644 --- a/modules/volume/lrucache.h +++ b/modules/volume/lrucache.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/lrucache.inl b/modules/volume/lrucache.inl index 7ff175caba..004acc100e 100644 --- a/modules/volume/lrucache.inl +++ b/modules/volume/lrucache.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/rawvolume.h b/modules/volume/rawvolume.h index b759b59af9..44485f63db 100644 --- a/modules/volume/rawvolume.h +++ b/modules/volume/rawvolume.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -52,7 +52,7 @@ public: VoxelType* data(); private: - glm::uvec3 _dimensions; + glm::uvec3 _dimensions = glm::uvec3(0); std::vector _data; }; diff --git a/modules/volume/rawvolume.inl b/modules/volume/rawvolume.inl index f6001ed741..5f95eee40f 100644 --- a/modules/volume/rawvolume.inl +++ b/modules/volume/rawvolume.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/rawvolumemetadata.cpp b/modules/volume/rawvolumemetadata.cpp index 62d2d7ad52..83b24616ef 100644 --- a/modules/volume/rawvolumemetadata.cpp +++ b/modules/volume/rawvolumemetadata.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/rawvolumemetadata.h b/modules/volume/rawvolumemetadata.h index 7e01ad1fa6..c3f95f7cd3 100644 --- a/modules/volume/rawvolumemetadata.h +++ b/modules/volume/rawvolumemetadata.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -38,22 +38,22 @@ struct RawVolumeMetadata { ghoul::Dictionary dictionary(); - glm::uvec3 dimensions; + glm::uvec3 dimensions = glm::uvec3(0); VolumeGridType gridType; - bool hasTime; - double time; + bool hasTime = false; + double time = 0.0; - bool hasValueRange; - float minValue; - float maxValue; - bool hasValueUnit; + bool hasValueRange = false; + float minValue = 0.f; + float maxValue = 0.f; + bool hasValueUnit = false; std::string valueUnit; - bool hasDomainBounds; - glm::vec3 lowerDomainBound; - glm::vec3 upperDomainBound; - bool hasDomainUnit; + bool hasDomainBounds = false; + glm::vec3 lowerDomainBound = glm::vec3(0.f); + glm::vec3 upperDomainBound = glm::vec3(0.f); + bool hasDomainUnit = false; std::string domainUnit; }; diff --git a/modules/volume/rawvolumereader.h b/modules/volume/rawvolumereader.h index c8d0bd0b94..f534f338c7 100644 --- a/modules/volume/rawvolumereader.h +++ b/modules/volume/rawvolumereader.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/rawvolumereader.inl b/modules/volume/rawvolumereader.inl index 836e9c7e5b..59b67b6122 100644 --- a/modules/volume/rawvolumereader.inl +++ b/modules/volume/rawvolumereader.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,6 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include #include namespace openspace::volume { diff --git a/modules/volume/rawvolumewriter.h b/modules/volume/rawvolumewriter.h index 55b0221a81..a8a9278a5d 100644 --- a/modules/volume/rawvolumewriter.h +++ b/modules/volume/rawvolumewriter.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -48,9 +48,9 @@ public: glm::ivec3 indexToCoords(size_t linear) const; private: - glm::ivec3 _dimensions; + glm::ivec3 _dimensions = glm::ivec3(0); std::string _path; - size_t _bufferSize; + size_t _bufferSize = 0; }; } // namespace openspace::volume diff --git a/modules/volume/rawvolumewriter.inl b/modules/volume/rawvolumewriter.inl index b8a3188e2a..22e86056f8 100644 --- a/modules/volume/rawvolumewriter.inl +++ b/modules/volume/rawvolumewriter.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/rendering/basicvolumeraycaster.cpp b/modules/volume/rendering/basicvolumeraycaster.cpp index b404d97bb3..0f1cfda6ec 100644 --- a/modules/volume/rendering/basicvolumeraycaster.cpp +++ b/modules/volume/rendering/basicvolumeraycaster.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -153,7 +153,7 @@ bool BasicVolumeRaycaster::isCameraInside(const RenderData& data, glm::vec4 modelPos = glm::inverse(modelViewTransform(data)) * glm::vec4(0.f, 0.f, 0.f, 1.f); - localPosition = (glm::vec3(modelPos) + glm::vec3(0.5)); + localPosition = (glm::vec3(modelPos) + glm::vec3(0.5f)); return (localPosition.x > 0 && localPosition.x < 1 && localPosition.y > 0 && localPosition.y < 1 && diff --git a/modules/volume/rendering/basicvolumeraycaster.h b/modules/volume/rendering/basicvolumeraycaster.h index 1ab5c1ffaa..66d018cc93 100644 --- a/modules/volume/rendering/basicvolumeraycaster.h +++ b/modules/volume/rendering/basicvolumeraycaster.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -100,14 +100,14 @@ private: std::shared_ptr _transferFunction; BoxGeometry _boundingBox; VolumeGridType _gridType; - glm::mat4 _modelTransform; + glm::mat4 _modelTransform = glm::mat4(1.f); float _opacity = 20.f; float _rNormalization = 0.f; float _rUpperBound = 1.f; std::unique_ptr _tfUnit; std::unique_ptr _textureUnit; - float _stepSize; + float _stepSize = 0.f; }; } // namespace openspace::volume diff --git a/modules/volume/rendering/renderabletimevaryingvolume.cpp b/modules/volume/rendering/renderabletimevaryingvolume.cpp index d6a0ae9963..d689713104 100644 --- a/modules/volume/rendering/renderabletimevaryingvolume.cpp +++ b/modules/volume/rendering/renderabletimevaryingvolume.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -71,7 +71,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo GridTypeInfo = { "gridType", "Grid Type", - "" // @TODO Missing documentation + "", // @TODO Missing documentation + openspace::properties::Property::Visibility::Developer }; constexpr openspace::properties::Property::PropertyInfo SecondsBeforeInfo = { diff --git a/modules/volume/rendering/renderabletimevaryingvolume.h b/modules/volume/rendering/renderabletimevaryingvolume.h index 3451110de6..b1b22438e8 100644 --- a/modules/volume/rendering/renderabletimevaryingvolume.h +++ b/modules/volume/rendering/renderabletimevaryingvolume.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/rendering/volumeclipplane.cpp b/modules/volume/rendering/volumeclipplane.cpp index ec147ce590..11f5f613fc 100644 --- a/modules/volume/rendering/volumeclipplane.cpp +++ b/modules/volume/rendering/volumeclipplane.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/rendering/volumeclipplane.h b/modules/volume/rendering/volumeclipplane.h index a20139fbd7..b8bb1f5b0b 100644 --- a/modules/volume/rendering/volumeclipplane.h +++ b/modules/volume/rendering/volumeclipplane.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/rendering/volumeclipplanes.cpp b/modules/volume/rendering/volumeclipplanes.cpp index d5a162820f..89fb6eea6c 100644 --- a/modules/volume/rendering/volumeclipplanes.cpp +++ b/modules/volume/rendering/volumeclipplanes.cpp @@ -3,7 +3,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/rendering/volumeclipplanes.h b/modules/volume/rendering/volumeclipplanes.h index ef0d8624fd..2deb6fd254 100644 --- a/modules/volume/rendering/volumeclipplanes.h +++ b/modules/volume/rendering/volumeclipplanes.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/tasks/generaterawvolumetask.cpp b/modules/volume/tasks/generaterawvolumetask.cpp index a6d97238ce..2a975f6c68 100644 --- a/modules/volume/tasks/generaterawvolumetask.cpp +++ b/modules/volume/tasks/generaterawvolumetask.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/tasks/generaterawvolumetask.h b/modules/volume/tasks/generaterawvolumetask.h index f41b5d0fc6..9f7ca41732 100644 --- a/modules/volume/tasks/generaterawvolumetask.h +++ b/modules/volume/tasks/generaterawvolumetask.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -46,9 +46,9 @@ private: std::string _dictionaryOutputPath; std::string _time; - glm::uvec3 _dimensions; - glm::vec3 _lowerDomainBound; - glm::vec3 _upperDomainBound; + glm::uvec3 _dimensions = glm::uvec3(0); + glm::vec3 _lowerDomainBound = glm::vec3(0.f); + glm::vec3 _upperDomainBound = glm::vec3(0.f); std::string _valueFunctionLua; }; diff --git a/modules/volume/textureslicevolumereader.h b/modules/volume/textureslicevolumereader.h index 452fa93f71..834c7447d1 100644 --- a/modules/volume/textureslicevolumereader.h +++ b/modules/volume/textureslicevolumereader.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -53,7 +53,7 @@ private: ghoul::opengl::Texture& getSlice(int sliceIndex) const; std::vector _paths; mutable LinearLruCache> _cache; - glm::ivec2 _sliceDimensions; + glm::ivec2 _sliceDimensions = glm::ivec2(0); bool _isInitialized = false; }; diff --git a/modules/volume/textureslicevolumereader.inl b/modules/volume/textureslicevolumereader.inl index 641edd8f6f..d63d1de6a8 100644 --- a/modules/volume/textureslicevolumereader.inl +++ b/modules/volume/textureslicevolumereader.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/transferfunction.cpp b/modules/volume/transferfunction.cpp index 878287cbc0..b0fbc5386b 100644 --- a/modules/volume/transferfunction.cpp +++ b/modules/volume/transferfunction.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -197,7 +197,7 @@ bool TransferFunction::createTexture(ghoul::opengl::Texture& ptr) { for (int i = 0; i < _width ; ++i) { const float position = static_cast(i) / static_cast(_width); int count = 0; - glm::vec4 rgbFromEnvelopes(0.f, 0.f, 0.f, 0.f); + glm::vec4 rgbFromEnvelopes(0.f); float alpha = 0.f; for (const Envelope& env : _envelopes) { if (env.isValueInEnvelope(position) && env.isEnvelopeValid()) { diff --git a/modules/volume/transferfunction.h b/modules/volume/transferfunction.h index d273304139..9581cc6e63 100644 --- a/modules/volume/transferfunction.h +++ b/modules/volume/transferfunction.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/transferfunctionhandler.cpp b/modules/volume/transferfunctionhandler.cpp index e3d01f1e8d..991fddf851 100644 --- a/modules/volume/transferfunctionhandler.cpp +++ b/modules/volume/transferfunctionhandler.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/transferfunctionhandler.h b/modules/volume/transferfunctionhandler.h index 73b17f63d2..35e112123a 100644 --- a/modules/volume/transferfunctionhandler.h +++ b/modules/volume/transferfunctionhandler.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/transferfunctionproperty.cpp b/modules/volume/transferfunctionproperty.cpp index 4089b32eca..18be5eee77 100644 --- a/modules/volume/transferfunctionproperty.cpp +++ b/modules/volume/transferfunctionproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/transferfunctionproperty.h b/modules/volume/transferfunctionproperty.h index bc401a9014..14fb8aac46 100644 --- a/modules/volume/transferfunctionproperty.h +++ b/modules/volume/transferfunctionproperty.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/volumegridtype.cpp b/modules/volume/volumegridtype.cpp index 13a69d285c..a261fd2463 100644 --- a/modules/volume/volumegridtype.cpp +++ b/modules/volume/volumegridtype.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/volumegridtype.h b/modules/volume/volumegridtype.h index d984a52418..ca3064d387 100644 --- a/modules/volume/volumegridtype.h +++ b/modules/volume/volumegridtype.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/volumemodule.cpp b/modules/volume/volumemodule.cpp index efb010b329..f2eb2b10f9 100644 --- a/modules/volume/volumemodule.cpp +++ b/modules/volume/volumemodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/volumemodule.h b/modules/volume/volumemodule.h index 58876a6a88..f12747978e 100644 --- a/modules/volume/volumemodule.h +++ b/modules/volume/volumemodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/volumesampler.h b/modules/volume/volumesampler.h index 6bbb65e173..836c1e0712 100644 --- a/modules/volume/volumesampler.h +++ b/modules/volume/volumesampler.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -38,7 +38,7 @@ public: typename VolumeType::VoxelType sample(const glm::vec3& position) const; private: - glm::ivec3 _filterSize; + glm::ivec3 _filterSize = glm::ivec3(0); const VolumeType* _volume; }; diff --git a/modules/volume/volumesampler.inl b/modules/volume/volumesampler.inl index d3a8d22b90..8fba419183 100644 --- a/modules/volume/volumesampler.inl +++ b/modules/volume/volumesampler.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/volumeutils.cpp b/modules/volume/volumeutils.cpp index 1353f8f0cb..864715494e 100644 --- a/modules/volume/volumeutils.cpp +++ b/modules/volume/volumeutils.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/volume/volumeutils.h b/modules/volume/volumeutils.h index 3c1a2c3d27..91088ffc23 100644 --- a/modules/volume/volumeutils.h +++ b/modules/volume/volumeutils.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/CMakeLists.txt b/modules/webbrowser/CMakeLists.txt index d02bb10665..e838953772 100644 --- a/modules/webbrowser/CMakeLists.txt +++ b/modules/webbrowser/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2019 # +# 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 # @@ -183,6 +183,7 @@ if (OS_WINDOWS) add_windows_cef_manifest("${CEF_TARGET_OUT_DIR}" "${WEBBROWSER_MODULE_PATH}" "${CEF_HELPER_TARGET}" "exe") endif (OS_WINDOWS) +set_property(TARGET ${CEF_HELPER_TARGET} PROPERTY FOLDER "Helper") ########################################################################################## # Create OpenSpace module. diff --git a/modules/webbrowser/cmake/cef_support.cmake b/modules/webbrowser/cmake/cef_support.cmake index 8bfad1aac0..fdecb039d1 100644 --- a/modules/webbrowser/cmake/cef_support.cmake +++ b/modules/webbrowser/cmake/cef_support.cmake @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/webbrowser/cmake/webbrowser_helpers.cmake b/modules/webbrowser/cmake/webbrowser_helpers.cmake index fdf33a6d40..fe8cf69023 100644 --- a/modules/webbrowser/cmake/webbrowser_helpers.cmake +++ b/modules/webbrowser/cmake/webbrowser_helpers.cmake @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # @@ -22,7 +22,6 @@ # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # ########################################################################################## - function(set_cef_targets cef_root main_target) # find cef cmake helpers set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${cef_root}/cmake") diff --git a/modules/webbrowser/include/browserclient.h b/modules/webbrowser/include/browserclient.h index 0764f0f6d9..26a61cc9b2 100644 --- a/modules/webbrowser/include/browserclient.h +++ b/modules/webbrowser/include/browserclient.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/include/browserinstance.h b/modules/webbrowser/include/browserinstance.h index 688949963d..b96e701da8 100644 --- a/modules/webbrowser/include/browserinstance.h +++ b/modules/webbrowser/include/browserinstance.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/include/cefhost.h b/modules/webbrowser/include/cefhost.h index 1665ebf893..be15a79f50 100644 --- a/modules/webbrowser/include/cefhost.h +++ b/modules/webbrowser/include/cefhost.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/include/defaultbrowserlauncher.h b/modules/webbrowser/include/defaultbrowserlauncher.h index 39aa93c171..5de76a4aab 100644 --- a/modules/webbrowser/include/defaultbrowserlauncher.h +++ b/modules/webbrowser/include/defaultbrowserlauncher.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/include/eventhandler.h b/modules/webbrowser/include/eventhandler.h index 22cc3bbe7d..406b27813d 100644 --- a/modules/webbrowser/include/eventhandler.h +++ b/modules/webbrowser/include/eventhandler.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -93,11 +93,11 @@ private: cef_key_event_type_t keyEventType(KeyAction action); BrowserInstance* _browserInstance = nullptr; - glm::vec2 _mousePosition = { 0.f, 0.f }; + glm::vec2 _mousePosition = glm::vec2(0.f); struct MouseButtonState { bool down = false; - glm::vec2 lastClickPosition = { 0.f, 0.f }; + glm::vec2 lastClickPosition = glm::vec2(0.f); std::chrono::high_resolution_clock::time_point lastClickTime; }; diff --git a/modules/webbrowser/include/screenspacebrowser.h b/modules/webbrowser/include/screenspacebrowser.h index be83f58c71..f7ccd60a6a 100644 --- a/modules/webbrowser/include/screenspacebrowser.h +++ b/modules/webbrowser/include/screenspacebrowser.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/include/webbrowserapp.h b/modules/webbrowser/include/webbrowserapp.h index b334a05788..bd8de22e13 100644 --- a/modules/webbrowser/include/webbrowserapp.h +++ b/modules/webbrowser/include/webbrowserapp.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/include/webkeyboardhandler.h b/modules/webbrowser/include/webkeyboardhandler.h index b11785ea0a..38bbe841e3 100644 --- a/modules/webbrowser/include/webkeyboardhandler.h +++ b/modules/webbrowser/include/webkeyboardhandler.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/include/webrenderhandler.h b/modules/webbrowser/include/webrenderhandler.h index 2e85dcacbf..8e7a12caac 100644 --- a/modules/webbrowser/include/webrenderhandler.h +++ b/modules/webbrowser/include/webrenderhandler.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -61,11 +61,11 @@ public: void updateTexture(); protected: - GLuint _texture; + GLuint _texture = 0; private: - glm::ivec2 _windowSize; - glm::ivec2 _browserBufferSize; + glm::ivec2 _windowSize = glm::ivec2(0); + glm::ivec2 _browserBufferSize = glm::ivec2(0); /** * RGBA buffer from browser @@ -74,8 +74,8 @@ private: bool _needsRepaint = true; bool _textureSizeIsDirty = true; bool _textureIsDirty = true; - glm::ivec2 _lowerDirtyRectBound; - glm::ivec2 _upperDirtyRectBound; + glm::ivec2 _lowerDirtyRectBound = glm::ivec2(0); + glm::ivec2 _upperDirtyRectBound = glm::ivec2(0); IMPLEMENT_REFCOUNTING(WebRenderHandler); }; diff --git a/modules/webbrowser/src/browserclient.cpp b/modules/webbrowser/src/browserclient.cpp index d48363b9e6..b69cb406cd 100644 --- a/modules/webbrowser/src/browserclient.cpp +++ b/modules/webbrowser/src/browserclient.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/src/browserinstance.cpp b/modules/webbrowser/src/browserinstance.cpp index f641502079..52016fe15f 100644 --- a/modules/webbrowser/src/browserinstance.cpp +++ b/modules/webbrowser/src/browserinstance.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -34,6 +34,7 @@ #include #include #include +#include namespace { constexpr const char* _loggerCat = "CEF BrowserInstance"; @@ -105,11 +106,15 @@ bool BrowserInstance::loadLocalPath(std::string path) { } void BrowserInstance::reshape(const glm::ivec2& windowSize) { + ZoneScoped + _renderHandler->reshape(windowSize.x, windowSize.y); _browser->GetHost()->WasResized(); } void BrowserInstance::draw() { + ZoneScoped + if (_zoomLevel != _browser->GetHost()->GetZoomLevel()) { _browser->GetHost()->SetZoomLevel(_zoomLevel); } diff --git a/modules/webbrowser/src/cefhost.cpp b/modules/webbrowser/src/cefhost.cpp index 77d8db0aae..21cb448e98 100644 --- a/modules/webbrowser/src/cefhost.cpp +++ b/modules/webbrowser/src/cefhost.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -91,6 +92,8 @@ void CefHost::attachDebugSettings(CefSettings &settings) { } void CefHost::doMessageLoopWork() { + ZoneScoped + CefDoMessageLoopWork(); } diff --git a/modules/webbrowser/src/defaultbrowserlauncher.cpp b/modules/webbrowser/src/defaultbrowserlauncher.cpp index 93376b2a87..e5ad4223ed 100644 --- a/modules/webbrowser/src/defaultbrowserlauncher.cpp +++ b/modules/webbrowser/src/defaultbrowserlauncher.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/src/eventhandler.cpp b/modules/webbrowser/src/eventhandler.cpp index ef68227e2f..0ee3e8f7a3 100644 --- a/modules/webbrowser/src/eventhandler.cpp +++ b/modules/webbrowser/src/eventhandler.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/src/processhelperwindows.cpp b/modules/webbrowser/src/processhelperwindows.cpp index 4b925519c7..f907fa6e32 100644 --- a/modules/webbrowser/src/processhelperwindows.cpp +++ b/modules/webbrowser/src/processhelperwindows.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/src/screenspacebrowser.cpp b/modules/webbrowser/src/screenspacebrowser.cpp index 72621a96cc..84ff5ce0cb 100644 --- a/modules/webbrowser/src/screenspacebrowser.cpp +++ b/modules/webbrowser/src/screenspacebrowser.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/src/webbrowserapp.cpp b/modules/webbrowser/src/webbrowserapp.cpp index f5f1aa05ac..6412b4fd66 100644 --- a/modules/webbrowser/src/webbrowserapp.cpp +++ b/modules/webbrowser/src/webbrowserapp.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/src/webkeyboardhandler.cpp b/modules/webbrowser/src/webkeyboardhandler.cpp index 3f2adb9aa3..aab923c07d 100644 --- a/modules/webbrowser/src/webkeyboardhandler.cpp +++ b/modules/webbrowser/src/webkeyboardhandler.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/src/webrenderhandler.cpp b/modules/webbrowser/src/webrenderhandler.cpp index 204dea11c5..9c01a4e668 100644 --- a/modules/webbrowser/src/webrenderhandler.cpp +++ b/modules/webbrowser/src/webrenderhandler.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webbrowser/webbrowsermodule.cpp b/modules/webbrowser/webbrowsermodule.cpp index eb86fe070b..4417787c7d 100644 --- a/modules/webbrowser/webbrowsermodule.cpp +++ b/modules/webbrowser/webbrowsermodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -35,6 +35,7 @@ #include #include #include +#include namespace { constexpr const char* _loggerCat = "WebBrowser"; @@ -72,7 +73,11 @@ WebBrowserModule::WebBrowserModule() , _updateBrowserBetweenRenderables(UpdateBrowserBetweenRenderablesInfo, true) , _browserUpdateInterval(BrowserUpdateIntervalInfo, 1.f, 1.0f, 1000.f) { - global::callback::deinitialize.emplace_back([this]() { deinitialize(); }); + global::callback::deinitialize.emplace_back([this]() { + ZoneScopedN("WebBrowserModule") + + deinitialize(); + }); _browserUpdateInterval.onChange([this]() { webbrowser::interval = std::chrono::microseconds( @@ -94,6 +99,8 @@ WebBrowserModule::WebBrowserModule() } void WebBrowserModule::internalDeinitialize() { + ZoneScoped + if (!_enabled) { return; } @@ -118,6 +125,8 @@ std::string WebBrowserModule::findHelperExecutable() { } void WebBrowserModule::internalInitialize(const ghoul::Dictionary& dictionary) { + ZoneScoped + if (dictionary.hasKeyAndValue("WebHelperLocation")) { _webHelperLocation = absPath(dictionary.value("WebHelperLocation")); } else { @@ -162,6 +171,8 @@ void WebBrowserModule::internalInitialize(const ghoul::Dictionary& dictionary) { } void WebBrowserModule::addBrowser(BrowserInstance* browser) { + ZoneScoped + if (_enabled) { _browsers.push_back(browser); if (_updateBrowserBetweenRenderables) { diff --git a/modules/webbrowser/webbrowsermodule.h b/modules/webbrowser/webbrowsermodule.h index b42e968396..bc2c78a2a7 100644 --- a/modules/webbrowser/webbrowsermodule.h +++ b/modules/webbrowser/webbrowsermodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/modules/webgui/CMakeLists.txt b/modules/webgui/CMakeLists.txt index 1c68572560..3bd341131a 100644 --- a/modules/webgui/CMakeLists.txt +++ b/modules/webgui/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/modules/webgui/webguimodule.cpp b/modules/webgui/webguimodule.cpp index 86d86666d3..8f3b83ddb0 100644 --- a/modules/webgui/webguimodule.cpp +++ b/modules/webgui/webguimodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -32,6 +32,7 @@ #include #include #include +#include namespace { constexpr const char* _loggerCat = "WebGuiModule"; @@ -225,6 +226,8 @@ void WebGuiModule::notifyEndpointListeners(const std::string& endpoint, bool exi } void WebGuiModule::startProcess() { + ZoneScoped + _endpoints.clear(); ServerModule* serverModule = global::moduleEngine.module(); diff --git a/modules/webgui/webguimodule.h b/modules/webgui/webguimodule.h index f4793c2f22..3286b6d927 100644 --- a/modules/webgui/webguimodule.h +++ b/modules/webgui/webguimodule.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/openspace.cfg b/openspace.cfg index 058d110b52..c73d8154f3 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -140,7 +140,7 @@ ModuleConfigurations = { WebSocketInterface = "DefaultWebSocketInterface" }, CefWebGui = { - GuiScale = 2.1, + -- GuiScale = 2.0, Enabled = true, Visible = true } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 836e42e3cc..dde2ceb7e2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/src/documentation/core_registration.cpp b/src/documentation/core_registration.cpp index 1d8de7effb..974c386296 100644 --- a/src/documentation/core_registration.cpp +++ b/src/documentation/core_registration.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/documentation/documentation.cpp b/src/documentation/documentation.cpp index 9f42f6d3c8..4c9f074f6c 100644 --- a/src/documentation/documentation.cpp +++ b/src/documentation/documentation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/documentation/documentationengine.cpp b/src/documentation/documentationengine.cpp index 4192a0c243..dd65a56231 100644 --- a/src/documentation/documentationengine.cpp +++ b/src/documentation/documentationengine.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/documentation/documentationgenerator.cpp b/src/documentation/documentationgenerator.cpp index 92ab7a60d9..384c46ab96 100644 --- a/src/documentation/documentationgenerator.cpp +++ b/src/documentation/documentationgenerator.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/documentation/verifier.cpp b/src/documentation/verifier.cpp index 801aedc9a8..e1809f3bab 100644 --- a/src/documentation/verifier.cpp +++ b/src/documentation/verifier.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/engine/configuration.cpp b/src/engine/configuration.cpp index 0bb27b3a89..c226d65a42 100644 --- a/src/engine/configuration.cpp +++ b/src/engine/configuration.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/engine/configuration_doc.inl b/src/engine/configuration_doc.inl index 747fffdb87..0e7059fc02 100644 --- a/src/engine/configuration_doc.inl +++ b/src/engine/configuration_doc.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/engine/downloadmanager.cpp b/src/engine/downloadmanager.cpp index fb3581e34d..f8e256f768 100644 --- a/src/engine/downloadmanager.cpp +++ b/src/engine/downloadmanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/engine/globals.cpp b/src/engine/globals.cpp index 6e0bb08628..a2e3c6b5a2 100644 --- a/src/engine/globals.cpp +++ b/src/engine/globals.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -215,6 +216,8 @@ scripting::ScriptScheduler& gScriptScheduler() { } // namespace detail void initialize() { + ZoneScoped + global::rootPropertyOwner.addPropertySubOwner(global::moduleEngine); global::navigationHandler.setPropertyOwner(&global::rootPropertyOwner); @@ -235,10 +238,13 @@ void initialize() { } void initializeGL() { + ZoneScoped } void deinitialize() { + ZoneScoped + for (std::unique_ptr& ssr : global::screenSpaceRenderables) { ssr->deinitialize(); } @@ -252,6 +258,8 @@ void deinitialize() { } void deinitializeGL() { + ZoneScoped + for (std::unique_ptr& ssr : global::screenSpaceRenderables) { ssr->deinitializeGL(); } diff --git a/src/engine/globalscallbacks.cpp b/src/engine/globalscallbacks.cpp index 2bba9d4560..a6dba4bc19 100644 --- a/src/engine/globalscallbacks.cpp +++ b/src/engine/globalscallbacks.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/engine/logfactory.cpp b/src/engine/logfactory.cpp index ea78160cd5..4a57a6944d 100644 --- a/src/engine/logfactory.cpp +++ b/src/engine/logfactory.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/engine/moduleengine.cpp b/src/engine/moduleengine.cpp index 8ab8bf14d5..5cb6c292d6 100644 --- a/src/engine/moduleengine.cpp +++ b/src/engine/moduleengine.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -28,6 +28,7 @@ #include #include #include +#include #include "moduleengine_lua.inl" @@ -42,6 +43,8 @@ ModuleEngine::ModuleEngine() : properties::PropertyOwner({ "Modules" }) {} void ModuleEngine::initialize( const std::map& moduleConfigurations) { + ZoneScoped + for (OpenSpaceModule* m : AllModules()) { const std::string& identifier = m->identifier(); auto it = moduleConfigurations.find(identifier); @@ -54,6 +57,8 @@ void ModuleEngine::initialize( } void ModuleEngine::initializeGL() { + ZoneScoped + LDEBUG("Initializing OpenGL of modules"); for (std::unique_ptr& m : _modules) { LDEBUG(fmt::format("Initializing OpenGL of module '{}'", m->identifier())); @@ -63,6 +68,8 @@ void ModuleEngine::initializeGL() { } void ModuleEngine::deinitialize() { + ZoneScoped + LDEBUG("Deinitializing modules"); for (std::unique_ptr& m : _modules) { LDEBUG(fmt::format("Deinitializing module '{}'", m->identifier())); @@ -81,6 +88,8 @@ void ModuleEngine::deinitialize() { } void ModuleEngine::deinitializeGL() { + ZoneScoped + LDEBUG("Deinitializing OpenGL of modules"); for (std::unique_ptr& m : _modules) { LDEBUG(fmt::format("Deinitializing OpenGL of module '{}'", m->identifier())); @@ -93,6 +102,8 @@ void ModuleEngine::deinitializeGL() { void ModuleEngine::registerModule(std::unique_ptr mod, const ghoul::Dictionary& configuration) { + ZoneScoped + ghoul_assert(mod, "Module must not be nullptr"); auto it = std::find_if( diff --git a/src/engine/moduleengine_lua.inl b/src/engine/moduleengine_lua.inl index 067e9ef92f..230ca92243 100644 --- a/src/engine/moduleengine_lua.inl +++ b/src/engine/moduleengine_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 9716e99a3c..3390914c42 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -25,7 +25,6 @@ #include #include - #include #include #include @@ -75,6 +74,7 @@ #include #include #include +#include #include #include #include @@ -183,6 +183,8 @@ void OpenSpaceEngine::registerPathTokens() { } void OpenSpaceEngine::initialize() { + ZoneScoped + LTRACE("OpenSpaceEngine::initialize(begin)"); global::initialize(); @@ -345,7 +347,7 @@ void OpenSpaceEngine::initialize() { global::openSpaceEngine._assetManager = std::make_unique( std::make_unique( - *global::scriptEngine.luaState(), + global::scriptEngine.luaState(), rawWatcher, FileSys.absPath("${ASSETS}") ), @@ -377,6 +379,8 @@ void OpenSpaceEngine::initialize() { global::renderEngine.initialize(); for (const std::function& func : global::callback::initialize) { + ZoneScopedN("[Module] initialize") + func(); } @@ -407,6 +411,8 @@ std::string OpenSpaceEngine::generateFilePath(std::string openspaceRelativePath) } void OpenSpaceEngine::initializeGL() { + ZoneScoped + LTRACE("OpenSpaceEngine::initializeGL(begin)"); glbinding::Binding::initialize(global::windowDelegate.openGLProcedureAddress); @@ -668,6 +674,8 @@ void OpenSpaceEngine::initializeGL() { global::moduleEngine.initializeGL(); for (const std::function& func : global::callback::initializeGL) { + ZoneScopedN("[Module] initializeGL") + func(); } @@ -682,6 +690,8 @@ void OpenSpaceEngine::scheduleLoadSingleAsset(std::string assetPath) { } void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { + ZoneScoped + LTRACE("OpenSpaceEngine::loadSingleAsset(begin)"); global::windowDelegate.setBarrier(false); @@ -695,6 +705,8 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { return; } if (_scene) { + ZoneScopedN("Reset scene") + global::syncEngine.removeSyncables(global::timeManager.getSyncables()); if (_scene && _scene->camera()) { global::syncEngine.removeSyncables(_scene->camera()->getSyncables()); @@ -754,6 +766,8 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { a->ownSynchronizations(); for (const std::shared_ptr& s : syncs) { + ZoneScopedN("Update resource synchronization") + if (s->state() == ResourceSynchronization::State::Syncing) { LoadingScreen::ProgressInfo progressInfo; progressInfo.progress = s->progress(); @@ -854,6 +868,8 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { } void OpenSpaceEngine::deinitialize() { + ZoneScoped + LTRACE("OpenSpaceEngine::deinitialize(begin)"); for (const std::function& func : global::callback::deinitialize) { @@ -874,6 +890,8 @@ void OpenSpaceEngine::deinitialize() { global::sessionRecording.deinitialize(); global::versionChecker.cancel(); + _assetManager = nullptr; + global::deinitialize(); FactoryManager::deinitialize(); @@ -891,6 +909,8 @@ void OpenSpaceEngine::deinitialize() { } void OpenSpaceEngine::deinitializeGL() { + ZoneScoped + LTRACE("OpenSpaceEngine::deinitializeGL(begin)"); // We want to render an image informing the user that we are shutting down @@ -905,6 +925,8 @@ void OpenSpaceEngine::deinitializeGL() { func(); } + _loadingScreen = nullptr; + global::deinitializeGL(); rendering::helper::deinitialize(); @@ -938,6 +960,8 @@ void OpenSpaceEngine::writeStaticDocumentation() { } void OpenSpaceEngine::runGlobalCustomizationScripts() { + ZoneScoped + LINFO("Running Global initialization scripts"); ghoul::lua::LuaState state; global::scriptEngine.initializeLuaState(state); @@ -993,6 +1017,8 @@ void OpenSpaceEngine::loadFonts() { } void OpenSpaceEngine::writeSceneDocumentation() { + ZoneScoped + // Write documentation to json files if config file supplies path for doc files std::string path = global::configuration.documentation.path; @@ -1037,6 +1063,8 @@ void OpenSpaceEngine::writeSceneDocumentation() { } void OpenSpaceEngine::preSynchronization() { + ZoneScoped + LTRACE("OpenSpaceEngine::preSynchronization(begin)"); //std::this_thread::sleep_for(std::chrono::milliseconds(10)); @@ -1065,7 +1093,6 @@ void OpenSpaceEngine::preSynchronization() { global::syncEngine.preSynchronization(SyncEngine::IsMaster(master)); if (master) { - double dt = global::windowDelegate.deltaTime(); if (global::sessionRecording.isSavingFramesDuringPlayback()) { @@ -1100,12 +1127,16 @@ void OpenSpaceEngine::preSynchronization() { } for (const std::function& func : global::callback::preSync) { + ZoneScopedN("[Module] preSync") + func(); } LTRACE("OpenSpaceEngine::preSynchronization(end)"); } void OpenSpaceEngine::postSynchronizationPreDraw() { + ZoneScoped + LTRACE("OpenSpaceEngine::postSynchronizationPreDraw(begin)"); std::unique_ptr perf; @@ -1151,6 +1182,8 @@ void OpenSpaceEngine::postSynchronizationPreDraw() { } for (const std::function& func : global::callback::postSyncPreDraw) { + ZoneScopedN("[Module] postSyncPreDraw") + func(); } @@ -1179,6 +1212,8 @@ void OpenSpaceEngine::postSynchronizationPreDraw() { void OpenSpaceEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix, const glm::mat4& projectionMatrix) { + ZoneScoped + LTRACE("OpenSpaceEngine::render(begin)"); std::unique_ptr perf; @@ -1200,6 +1235,8 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& view global::renderEngine.render(sceneMatrix, viewMatrix, projectionMatrix); for (const std::function& func : global::callback::render) { + ZoneScopedN("[Module] render") + func(); } @@ -1207,6 +1244,8 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& view } void OpenSpaceEngine::drawOverlays() { + ZoneScoped + LTRACE("OpenSpaceEngine::drawOverlays(begin)"); std::unique_ptr perf; @@ -1227,6 +1266,8 @@ void OpenSpaceEngine::drawOverlays() { } for (const std::function& func : global::callback::draw2D) { + ZoneScopedN("[Module] draw2D") + func(); } @@ -1234,6 +1275,8 @@ void OpenSpaceEngine::drawOverlays() { } void OpenSpaceEngine::postDraw() { + ZoneScoped + LTRACE("OpenSpaceEngine::postDraw(begin)"); std::unique_ptr perf; @@ -1246,6 +1289,8 @@ void OpenSpaceEngine::postDraw() { global::renderEngine.postDraw(); for (const std::function& func : global::callback::postDraw) { + ZoneScopedN("[Module] postDraw") + func(); } @@ -1258,6 +1303,8 @@ void OpenSpaceEngine::postDraw() { } void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction action) { + ZoneScoped + if (_loadingScreen) { // If the loading screen object exists, we are currently loading and want key // presses to behave differently @@ -1289,6 +1336,8 @@ void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction actio } void OpenSpaceEngine::charCallback(unsigned int codepoint, KeyModifier modifier) { + ZoneScoped + using F = std::function; for (const F& func : global::callback::character) { bool isConsumed = func(codepoint, modifier); @@ -1305,6 +1354,8 @@ void OpenSpaceEngine::mouseButtonCallback(MouseButton button, MouseAction action, KeyModifier mods) { + ZoneScoped + using F = std::function; for (const F& func : global::callback::mouseButton) { bool isConsumed = func(button, action, mods); @@ -1338,6 +1389,8 @@ void OpenSpaceEngine::mouseButtonCallback(MouseButton button, } void OpenSpaceEngine::mousePositionCallback(double x, double y) { + ZoneScoped + using F = std::function; for (const F& func : global::callback::mousePosition) { func(x, y); @@ -1348,6 +1401,8 @@ void OpenSpaceEngine::mousePositionCallback(double x, double y) { } void OpenSpaceEngine::mouseScrollWheelCallback(double posX, double posY) { + ZoneScoped + using F = std::function; for (const F& func : global::callback::mouseScrollWheel) { bool isConsumed = func(posX, posY); @@ -1361,6 +1416,8 @@ void OpenSpaceEngine::mouseScrollWheelCallback(double posX, double posY) { } void OpenSpaceEngine::touchDetectionCallback(TouchInput input) { + ZoneScoped + using F = std::function; for (const F& func : global::callback::touchDetected) { bool isConsumed = func(input); @@ -1371,6 +1428,8 @@ void OpenSpaceEngine::touchDetectionCallback(TouchInput input) { } void OpenSpaceEngine::touchUpdateCallback(TouchInput input) { + ZoneScoped + using F = std::function; for (const F& func : global::callback::touchUpdated) { bool isConsumed = func(input); @@ -1381,6 +1440,8 @@ void OpenSpaceEngine::touchUpdateCallback(TouchInput input) { } void OpenSpaceEngine::touchExitCallback(TouchInput input) { + ZoneScoped + using F = std::function; for (const F& func : global::callback::touchExit) { func(input); @@ -1389,11 +1450,15 @@ void OpenSpaceEngine::touchExitCallback(TouchInput input) { std::vector OpenSpaceEngine::encode() { + ZoneScoped + std::vector buffer = global::syncEngine.encodeSyncables(); return buffer; } void OpenSpaceEngine::decode(std::vector data) { + ZoneScoped + global::syncEngine.decodeSyncables(std::move(data)); } diff --git a/src/engine/openspaceengine_lua.inl b/src/engine/openspaceengine_lua.inl index 95d6f500cd..8980499883 100644 --- a/src/engine/openspaceengine_lua.inl +++ b/src/engine/openspaceengine_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/engine/syncengine.cpp b/src/engine/syncengine.cpp index 65e470ac82..f3f341ce74 100644 --- a/src/engine/syncengine.cpp +++ b/src/engine/syncengine.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -26,6 +26,7 @@ #include #include +#include #include namespace openspace { @@ -58,12 +59,16 @@ void SyncEngine::decodeSyncables(std::vector data) { } void SyncEngine::preSynchronization(IsMaster isMaster) { + ZoneScoped + for (Syncable* syncable : _syncables) { syncable->preSync(isMaster); } } void SyncEngine::postSynchronization(IsMaster isMaster) { + ZoneScoped + for (Syncable* syncable : _syncables) { syncable->postSync(isMaster); } diff --git a/src/engine/virtualpropertymanager.cpp b/src/engine/virtualpropertymanager.cpp index 3c76900b45..4236d24bcc 100644 --- a/src/engine/virtualpropertymanager.cpp +++ b/src/engine/virtualpropertymanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/camerainteractionstates.cpp b/src/interaction/camerainteractionstates.cpp index c451ab954a..dee066c314 100644 --- a/src/interaction/camerainteractionstates.cpp +++ b/src/interaction/camerainteractionstates.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/externinteraction.cpp b/src/interaction/externinteraction.cpp index ab383a67ff..7f40dae10e 100644 --- a/src/interaction/externinteraction.cpp +++ b/src/interaction/externinteraction.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/inputstate.cpp b/src/interaction/inputstate.cpp index 69a7bd17de..3eea2e6716 100644 --- a/src/interaction/inputstate.cpp +++ b/src/interaction/inputstate.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/interactionmonitor.cpp b/src/interaction/interactionmonitor.cpp index 8c6afe7617..78333fe620 100644 --- a/src/interaction/interactionmonitor.cpp +++ b/src/interaction/interactionmonitor.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/joystickcamerastates.cpp b/src/interaction/joystickcamerastates.cpp index fdbcfea7ad..072de2d672 100644 --- a/src/interaction/joystickcamerastates.cpp +++ b/src/interaction/joystickcamerastates.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/joystickinputstate.cpp b/src/interaction/joystickinputstate.cpp index 3e02ae7fb8..5e58b92aca 100644 --- a/src/interaction/joystickinputstate.cpp +++ b/src/interaction/joystickinputstate.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/keybindingmanager.cpp b/src/interaction/keybindingmanager.cpp index 595967a244..e34aa0e6ed 100644 --- a/src/interaction/keybindingmanager.cpp +++ b/src/interaction/keybindingmanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -64,13 +64,28 @@ void KeybindingManager::resetKeyBindings() { _keyLua.clear(); } -void KeybindingManager::bindKeyLocal(Key key, - KeyModifier modifier, - std::string luaCommand, - std::string documentation, - std::string name, - std::string guiPath) +void KeybindingManager::bindKeyLocal(Key key, KeyModifier modifier, + std::string luaCommand, std::string documentation, + std::string name, std::string guiPath) { +#ifdef WIN32 + const bool isShift = hasKeyModifier(modifier, KeyModifier::Shift); + const bool isKeypad = key == Key::Keypad0 || key == Key::Keypad1 || + key == Key::Keypad2 || key == Key::Keypad3 || key == Key::Keypad4 || + key == Key::Keypad5 || key == Key::Keypad6 || key == Key::Keypad7 || + key == Key::Keypad8 || key == Key::Keypad9 || key == Key::KeypadEnter || + key == Key::KeypadAdd || key == Key::KeypadSubtract || + key == Key::KeypadMultiply || key == Key::KeypadDivide; + + if (isShift && isKeypad) { + LWARNINGC( + "bindKey", + "Windows does not support binding keys to Shift + Keyboard as it will " + "internally convert these into Home, End, etc, keys." + ); + } +#endif // WIN32 + _keyLua.insert({ { key, modifier }, { @@ -83,13 +98,28 @@ void KeybindingManager::bindKeyLocal(Key key, }); } -void KeybindingManager::bindKey(Key key, - KeyModifier modifier, - std::string luaCommand, - std::string documentation, - std::string name, +void KeybindingManager::bindKey(Key key, KeyModifier modifier, std::string luaCommand, + std::string documentation, std::string name, std::string guiPath) { +#ifdef WIN32 + const bool isShift = hasKeyModifier(modifier, KeyModifier::Shift); + const bool isKeypad = key == Key::Keypad0 || key == Key::Keypad1 || + key == Key::Keypad2 || key == Key::Keypad3 || key == Key::Keypad4 || + key == Key::Keypad5 || key == Key::Keypad6 || key == Key::Keypad7 || + key == Key::Keypad8 || key == Key::Keypad9 || key == Key::KeypadEnter || + key == Key::KeypadAdd || key == Key::KeypadSubtract || + key == Key::KeypadMultiply || key == Key::KeypadDivide; + + if (isShift && isKeypad) { + LWARNINGC( + "bindKey", + "Windows does not support binding keys to Shift + Keyboard as it will " + "internally convert these into Home, End, etc, keys." + ); + } +#endif // WIN32 + _keyLua.insert({ { key, modifier }, { diff --git a/src/interaction/keybindingmanager_lua.inl b/src/interaction/keybindingmanager_lua.inl index 58b30e26d7..8f01b04d58 100644 --- a/src/interaction/keybindingmanager_lua.inl +++ b/src/interaction/keybindingmanager_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/keyframenavigator.cpp b/src/interaction/keyframenavigator.cpp index 511c091a72..cbddded6e5 100644 --- a/src/interaction/keyframenavigator.cpp +++ b/src/interaction/keyframenavigator.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/mousecamerastates.cpp b/src/interaction/mousecamerastates.cpp index 394f95e42a..ba897bd1d3 100644 --- a/src/interaction/mousecamerastates.cpp +++ b/src/interaction/mousecamerastates.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/navigationhandler.cpp b/src/interaction/navigationhandler.cpp index 9c85dbbd3a..8b2afb793c 100644 --- a/src/interaction/navigationhandler.cpp +++ b/src/interaction/navigationhandler.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -77,7 +78,7 @@ ghoul::Dictionary NavigationHandler::NavigationState::dictionary() const { cameraDict.setValue(KeyAim, aim); } if (up.has_value()) { - cameraDict.setValue(KeyUp, up.value()); + cameraDict.setValue(KeyUp, *up); if (std::abs(yaw) > Epsilon) { cameraDict.setValue(KeyYaw, yaw); @@ -151,6 +152,8 @@ NavigationHandler::NavigationHandler() NavigationHandler::~NavigationHandler() {} // NOLINT void NavigationHandler::initialize() { + ZoneScoped + global::parallelPeer.connectionEvent().subscribe( "NavigationHandler", "statusChanged", @@ -162,6 +165,8 @@ void NavigationHandler::initialize() { } void NavigationHandler::deinitialize() { + ZoneScoped + global::parallelPeer.connectionEvent().unsubscribe("NavigationHandler"); } @@ -213,7 +218,7 @@ void NavigationHandler::updateCamera(double deltaTime) { ghoul_assert(_camera != nullptr, "Camera must not be nullptr"); if (_pendingNavigationState.has_value()) { - applyNavigationState(_pendingNavigationState.value()); + applyNavigationState(*_pendingNavigationState); _orbitalNavigator.resetVelocities(); _pendingNavigationState.reset(); } @@ -269,7 +274,7 @@ void NavigationHandler::applyNavigationState(const NavigationHandler::Navigation glm::dvec3(referenceFrameTransform * glm::dvec4(ns.position, 1.0)); glm::dvec3 up = ns.up.has_value() ? - glm::normalize(referenceFrameTransform * ns.up.value()) : + glm::normalize(referenceFrameTransform * *ns.up) : glm::dvec3(0.0, 1.0, 0.0); // Construct vectors of a "neutral" view, i.e. when the aim is centered in view. @@ -282,8 +287,8 @@ void NavigationHandler::applyNavigationState(const NavigationHandler::Navigation up ))); - glm::dquat pitchRotation = glm::angleAxis(ns.pitch, glm::dvec3(1.f, 0.f, 0.f)); - glm::dquat yawRotation = glm::angleAxis(ns.yaw, glm::dvec3(0.f, -1.f, 0.f)); + glm::dquat pitchRotation = glm::angleAxis(ns.pitch, glm::dvec3(1.0, 0.0, 0.0)); + glm::dquat yawRotation = glm::angleAxis(ns.yaw, glm::dvec3(0.0, -1.0, 0.0)); _camera->setPositionVec3(cameraPositionWorld); _camera->setRotation(neutralCameraRotation * yawRotation * pitchRotation); @@ -360,7 +365,7 @@ NavigationHandler::NavigationState NavigationHandler::navigationState( } const glm::dquat invNeutralRotation = glm::quat_cast(glm::lookAt( - glm::dvec3(0.0, 0.0, 0.0), + glm::dvec3(0.0), aim->worldPosition() - _camera->positionVec3(), glm::normalize(_camera->lookUpVectorWorldSpace()) )); @@ -372,7 +377,7 @@ NavigationHandler::NavigationState NavigationHandler::navigationState( const double yaw = -eulerAngles.y; // Need to compensate by redisual roll left in local rotation: - const glm::dquat unroll = glm::angleAxis(eulerAngles.z, glm::dvec3(0, 0, 1)); + const glm::dquat unroll = glm::angleAxis(eulerAngles.z, glm::dvec3(0.0, 0.0, 1.0)); const glm::dvec3 neutralUp = glm::inverse(invNeutralRotation) * unroll * _camera->lookUpVectorCameraSpace(); diff --git a/src/interaction/navigationhandler_lua.inl b/src/interaction/navigationhandler_lua.inl index c7fe94143d..f29fdb7a11 100644 --- a/src/interaction/navigationhandler_lua.inl +++ b/src/interaction/navigationhandler_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -101,7 +101,7 @@ int getNavigationState(lua_State* L) { if (state.up.has_value()) { ghoul::lua::push(L, "Up"); - pushVector(L, state.up.value()); + pushVector(L, *state.up); lua_rawset(L, -3); } if (state.yaw != 0) { diff --git a/src/interaction/orbitalnavigator.cpp b/src/interaction/orbitalnavigator.cpp index 29a0e2d844..773aca85ea 100644 --- a/src/interaction/orbitalnavigator.cpp +++ b/src/interaction/orbitalnavigator.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -424,7 +424,7 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) { const glm::dvec3 prevCameraPosition = _camera->positionVec3(); const glm::dvec3 anchorDisplacement = _previousAnchorNodePosition.has_value() ? - (anchorPos - _previousAnchorNodePosition.value()) : + (anchorPos - *_previousAnchorNodePosition) : glm::dvec3(0.0); CameraPose pose = { @@ -464,10 +464,10 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) { if (_aimNode && _aimNode != _anchorNode && hasPreviousPositions) { const glm::dvec3 aimPos = _aimNode->worldPosition(); const glm::dvec3 cameraToAnchor = - _previousAnchorNodePosition.value() - prevCameraPosition; + *_previousAnchorNodePosition - prevCameraPosition; Displacement anchorToAim = { - _previousAimNodePosition.value() - _previousAnchorNodePosition.value(), + *_previousAimNodePosition - *_previousAnchorNodePosition, aimPos - anchorPos }; @@ -502,8 +502,8 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) { glm::quat_cast(_anchorNode->worldRotationMatrix()); glm::dquat anchorNodeRotationDiff = _previousAnchorNodeRotation.has_value() ? - _previousAnchorNodeRotation.value() * glm::inverse(anchorRotation) : - glm::dquat(); + *_previousAnchorNodeRotation * glm::inverse(anchorRotation) : + glm::dquat(1.0, 0.0, 0.0, 0.0); _previousAnchorNodeRotation = anchorRotation; @@ -834,7 +834,7 @@ OrbitalNavigator::CameraRotationDecomposition // To avoid problem with lookup in up direction we adjust is with the view direction const glm::dmat4 lookAtMat = glm::lookAt( - glm::dvec3(0.0, 0.0, 0.0), + glm::dvec3(0.0), -directionFromSurfaceToCamera, normalize(cameraViewDirection + cameraUp) ); @@ -858,7 +858,7 @@ OrbitalNavigator::CameraRotationDecomposition // To avoid problem with lookup in up direction we adjust is with the view direction const glm::dmat4 lookAtMat = glm::lookAt( - glm::dvec3(0.0, 0.0, 0.0), + glm::dvec3(0.0), reference - cameraPose.position, normalize(cameraViewDirection + cameraUp) ); @@ -1040,7 +1040,7 @@ glm::dquat OrbitalNavigator::interpolateLocalRotation(double deltaTime, localCameraRotation * Camera::UpDirectionCameraSpace; const glm::dmat4 lookAtMat = glm::lookAt( - glm::dvec3(0.0, 0.0, 0.0), + glm::dvec3(0.0), Camera::ViewDirectionCameraSpace, normalize(localUp) ); diff --git a/src/interaction/scriptcamerastates.cpp b/src/interaction/scriptcamerastates.cpp index ef018796d1..c68212177e 100644 --- a/src/interaction/scriptcamerastates.cpp +++ b/src/interaction/scriptcamerastates.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index c0c7a22674..db8496e106 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -40,6 +40,7 @@ #include #include #include +#include #include namespace { @@ -587,6 +588,8 @@ void SessionRecording::saveScriptKeyframe(std::string scriptToSave) { } void SessionRecording::preSynchronization() { + ZoneScoped + if (_state == SessionState::Recording) { saveCameraKeyframe(); if (UsingTimeKeyframes) { diff --git a/src/interaction/sessionrecording_lua.inl b/src/interaction/sessionrecording_lua.inl index a7ceb559eb..5d138b84d6 100644 --- a/src/interaction/sessionrecording_lua.inl +++ b/src/interaction/sessionrecording_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/shortcutmanager.cpp b/src/interaction/shortcutmanager.cpp index 50df7febf2..6ce77e835b 100644 --- a/src/interaction/shortcutmanager.cpp +++ b/src/interaction/shortcutmanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/shortcutmanager_lua.inl b/src/interaction/shortcutmanager_lua.inl index 7a99227a46..106bb0321f 100644 --- a/src/interaction/shortcutmanager_lua.inl +++ b/src/interaction/shortcutmanager_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/websocketcamerastates.cpp b/src/interaction/websocketcamerastates.cpp index 9c6b27a223..d3769213bc 100644 --- a/src/interaction/websocketcamerastates.cpp +++ b/src/interaction/websocketcamerastates.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/interaction/websocketinputstate.cpp b/src/interaction/websocketinputstate.cpp index 4a531c83bf..3f6851d33a 100644 --- a/src/interaction/websocketinputstate.cpp +++ b/src/interaction/websocketinputstate.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/mission/mission.cpp b/src/mission/mission.cpp index e7c7bf0b9f..e4d5d70f2a 100644 --- a/src/mission/mission.cpp +++ b/src/mission/mission.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/mission/missionmanager.cpp b/src/mission/missionmanager.cpp index 4f28426bcc..892ceae501 100644 --- a/src/mission/missionmanager.cpp +++ b/src/mission/missionmanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/mission/missionmanager_lua.inl b/src/mission/missionmanager_lua.inl index da954fa57a..ca3269fcca 100644 --- a/src/mission/missionmanager_lua.inl +++ b/src/mission/missionmanager_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/network/parallelconnection.cpp b/src/network/parallelconnection.cpp index a04759fc75..514528237e 100644 --- a/src/network/parallelconnection.cpp +++ b/src/network/parallelconnection.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/network/parallelpeer.cpp b/src/network/parallelpeer.cpp index 793a80c29c..ec68ee23cb 100644 --- a/src/network/parallelpeer.cpp +++ b/src/network/parallelpeer.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -36,6 +36,7 @@ #include #include #include +#include #include "parallelpeer_lua.inl" @@ -503,6 +504,8 @@ void ParallelPeer::resetTimeOffset() { } void ParallelPeer::preSynchronization() { + ZoneScoped + std::unique_lock unqlock(_receiveBufferMutex); while (!_receiveBuffer.empty()) { ParallelConnection::Message& message = _receiveBuffer.front(); diff --git a/src/network/parallelpeer_lua.inl b/src/network/parallelpeer_lua.inl index 0e7b833905..583e3eea07 100644 --- a/src/network/parallelpeer_lua.inl +++ b/src/network/parallelpeer_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/network/parallelserver.cpp b/src/network/parallelserver.cpp index fcdc357f0c..b4f775cf48 100644 --- a/src/network/parallelserver.cpp +++ b/src/network/parallelserver.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/openspace.cpp b/src/openspace.cpp index 343b49c480..48c80e5071 100644 --- a/src/openspace.cpp +++ b/src/openspace.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/performance/performancelayout.cpp b/src/performance/performancelayout.cpp index 3712f6cd74..0fbbb12788 100644 --- a/src/performance/performancelayout.cpp +++ b/src/performance/performancelayout.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/performance/performancemanager.cpp b/src/performance/performancemanager.cpp index d752c049f1..bd4b60096c 100644 --- a/src/performance/performancemanager.cpp +++ b/src/performance/performancemanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/performance/performancemeasurement.cpp b/src/performance/performancemeasurement.cpp index b1bc8aac37..a529f70ea9 100644 --- a/src/performance/performancemeasurement.cpp +++ b/src/performance/performancemeasurement.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/matrix/dmat2property.cpp b/src/properties/matrix/dmat2property.cpp index 4bac77e8e3..a6372c3926 100644 --- a/src/properties/matrix/dmat2property.cpp +++ b/src/properties/matrix/dmat2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,11 +41,11 @@ glm::dmat2x2 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dmat2x2(0); + return glm::dmat2x2(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dmat2x2(0); + return glm::dmat2x2(0.0); } else { result[i][j] = lua_tonumber(state, -1); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::dmat2x2 value) { } glm::dmat2x2 fromStringConversion(const std::string& val, bool& success) { - glm::dmat2x2 result; + glm::dmat2x2 result = glm::dmat2x2(1.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( DMat2Property, glm::dmat2x2, - glm::dmat2x2(0), + glm::dmat2x2(0.0), glm::dmat2x2(nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest()), glm::dmat2x2(nl::max(), nl::max(), nl::max(), nl::max()), glm::dmat2x2(0.01, 0.01, 0.01, 0.01), diff --git a/src/properties/matrix/dmat2x3property.cpp b/src/properties/matrix/dmat2x3property.cpp index 909cf2e73e..3ad6111e41 100644 --- a/src/properties/matrix/dmat2x3property.cpp +++ b/src/properties/matrix/dmat2x3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,11 +41,11 @@ glm::dmat2x3 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dmat2x3(0); + return glm::dmat2x3(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dmat2x3(0); + return glm::dmat2x3(0.0); } else { result[i][j] = lua_tonumber(state, -1); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::dmat2x3 value) { } glm::dmat2x3 fromStringConversion(const std::string& val, bool& success) { - glm::dmat2x3 result; + glm::dmat2x3 result = glm::dmat2x3(1.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( DMat2x3Property, glm::dmat2x3, - glm::dmat2x3(0), + glm::dmat2x3(0.0), glm::dmat2x3( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/dmat2x4property.cpp b/src/properties/matrix/dmat2x4property.cpp index df7faa9cb2..5c4fabf4f9 100644 --- a/src/properties/matrix/dmat2x4property.cpp +++ b/src/properties/matrix/dmat2x4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,11 +41,11 @@ glm::dmat2x4 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dmat2x4(0); + return glm::dmat2x4(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dmat2x4(0); + return glm::dmat2x4(0.0); } else { result[i][j] = lua_tonumber(state, -1); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::dmat2x4 value) { } glm::dmat2x4 fromStringConversion(const std::string& val, bool& success) { - glm::dmat2x4 result; + glm::dmat2x4 result = glm::dmat2x4(1.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( DMat2x4Property, glm::dmat2x4, - glm::dmat2x4(0), + glm::dmat2x4(0.0), glm::dmat2x4( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/dmat3property.cpp b/src/properties/matrix/dmat3property.cpp index 30c261d0d8..de1d758fa0 100644 --- a/src/properties/matrix/dmat3property.cpp +++ b/src/properties/matrix/dmat3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,11 +41,11 @@ glm::dmat3x3 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dmat3x3(0); + return glm::dmat3x3(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dmat3x3(0); + return glm::dmat3x3(0.0); } else { result[i][j] = lua_tonumber(state, -1); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::dmat3x3 value) { } glm::dmat3x3 fromStringConversion(const std::string& val, bool& success) { - glm::dmat3x3 result; + glm::dmat3x3 result = glm::dmat3x3(1.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -124,7 +124,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( DMat3Property, glm::dmat3x3, - glm::dmat3x3(0), + glm::dmat3x3(0.0), glm::dmat3x3( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/dmat3x2property.cpp b/src/properties/matrix/dmat3x2property.cpp index e2a8cc7d80..7a47ba70bd 100644 --- a/src/properties/matrix/dmat3x2property.cpp +++ b/src/properties/matrix/dmat3x2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,11 +41,11 @@ glm::dmat3x2 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dmat3x2(0); + return glm::dmat3x2(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dmat3x2(0); + return glm::dmat3x2(0.0); } else { result[i][j] = lua_tonumber(state, -1); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::dmat3x2 value) { } glm::dmat3x2 fromStringConversion(const std::string& val, bool& success) { - glm::dmat3x2 result; + glm::dmat3x2 result = glm::dmat3x2(1.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( DMat3x2Property, glm::dmat3x2, - glm::dmat3x2(0), + glm::dmat3x2(0.0), glm::dmat3x2( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest() diff --git a/src/properties/matrix/dmat3x4property.cpp b/src/properties/matrix/dmat3x4property.cpp index ccbe404c64..0edadd3f63 100644 --- a/src/properties/matrix/dmat3x4property.cpp +++ b/src/properties/matrix/dmat3x4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,11 +41,11 @@ glm::dmat3x4 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dmat3x4(0); + return glm::dmat3x4(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dmat3x4(0); + return glm::dmat3x4(0.0); } else { result[i][j] = lua_tonumber(state, -1); @@ -75,7 +75,7 @@ bool toLuaConversion(lua_State* state, glm::dmat3x4 value) { glm::dmat3x4 fromStringConversion(const std::string& val, bool& success) { - glm::dmat3x4 result; + glm::dmat3x4 result = glm::dmat3x4(1.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -124,7 +124,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( DMat3x4Property, glm::dmat3x4, - glm::dmat3x4(0), + glm::dmat3x4(0.0), glm::dmat3x4( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/dmat4property.cpp b/src/properties/matrix/dmat4property.cpp index d8d499dcf3..baa232b191 100644 --- a/src/properties/matrix/dmat4property.cpp +++ b/src/properties/matrix/dmat4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,11 +41,11 @@ glm::dmat4x4 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dmat4x4(0); + return glm::dmat4x4(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dmat4x4(0); + return glm::dmat4x4(0.0); } else { result[i][j] = lua_tonumber(state, -1); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::dmat4x4 value) { } glm::dmat4x4 fromStringConversion(const std::string& val, bool& success) { - glm::dmat4x4 result; + glm::dmat4x4 result = glm::dmat4x4(1.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( DMat4Property, glm::dmat4x4, - glm::dmat4x4(0), + glm::dmat4x4(0.0), glm::dmat4x4( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/dmat4x2property.cpp b/src/properties/matrix/dmat4x2property.cpp index 2553b6c7a6..49707fc77e 100644 --- a/src/properties/matrix/dmat4x2property.cpp +++ b/src/properties/matrix/dmat4x2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,11 +41,11 @@ glm::dmat4x2 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dmat4x2(0); + return glm::dmat4x2(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dmat4x2(0); + return glm::dmat4x2(0.0); } else { result[i][j] = lua_tonumber(state, -1); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::dmat4x2 value) { } glm::dmat4x2 fromStringConversion(const std::string& val, bool& success) { - glm::dmat4x2 result; + glm::dmat4x2 result = glm::dmat4x2(1.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( DMat4x2Property, glm::dmat4x2, - glm::dmat4x2(0), + glm::dmat4x2(0.0), glm::dmat4x2( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest() diff --git a/src/properties/matrix/dmat4x3property.cpp b/src/properties/matrix/dmat4x3property.cpp index 13dcb05d69..29153cfedc 100644 --- a/src/properties/matrix/dmat4x3property.cpp +++ b/src/properties/matrix/dmat4x3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,11 +41,11 @@ glm::dmat4x3 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dmat4x3(0); + return glm::dmat4x3(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dmat4x3(0); + return glm::dmat4x3(0.0); } else { result[i][j] = lua_tonumber(state, -1); lua_pop(state, 1); @@ -73,7 +73,7 @@ bool toLuaConversion(lua_State* state, glm::dmat4x3 value) { } glm::dmat4x3 fromStringConversion(const std::string& val, bool& success) { - glm::dmat4x3 result; + glm::dmat4x3 result = glm::dmat4x3(1.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -122,7 +122,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( DMat4x3Property, glm::dmat4x3, - glm::dmat4x3(0), + glm::dmat4x3(0.0), glm::dmat4x3( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/mat2property.cpp b/src/properties/matrix/mat2property.cpp index 9cbecd01f3..e9bde9a9a9 100644 --- a/src/properties/matrix/mat2property.cpp +++ b/src/properties/matrix/mat2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::mat2x2 fromLuaConversion(lua_State* state, bool& success) { - glm::mat2x2 result; + glm::mat2x2 result = glm::mat2x2(1.f); lua_pushnil(state); int number = 1; for (glm::length_t i = 0; i < ghoul::glm_cols::value; ++i) { @@ -41,11 +41,11 @@ glm::mat2x2 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::mat2x2(0); + return glm::mat2x2(1.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::mat2x2(0); + return glm::mat2x2(1.f); } else { result[i][j] = static_cast( lua_tonumber(state, -1) @@ -75,7 +75,7 @@ bool toLuaConversion(lua_State* state, glm::mat2x2 value) { } glm::mat2x2 fromStringConversion(const std::string& val, bool& success) { - glm::mat2x2 result; + glm::mat2x2 result = glm::mat2x2(1.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -124,7 +124,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( Mat2Property, glm::mat2x2, - glm::mat2x2(0), + glm::mat2x2(1.f), glm::mat2x2( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest() diff --git a/src/properties/matrix/mat2x3property.cpp b/src/properties/matrix/mat2x3property.cpp index f9a55811d2..bc0512ae73 100644 --- a/src/properties/matrix/mat2x3property.cpp +++ b/src/properties/matrix/mat2x3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -35,7 +35,7 @@ using std::numeric_limits; namespace { glm::mat2x3 fromLuaConversion(lua_State* state, bool& success) { - glm::mat2x3 result; + glm::mat2x3 result = glm::mat2x3(1.f); lua_pushnil(state); int number = 1; for (glm::length_t i = 0; i < ghoul::glm_cols::value; ++i) { @@ -43,11 +43,11 @@ glm::mat2x3 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::mat2x3(0); + return glm::mat2x3(1.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::mat2x3(0); + return glm::mat2x3(1.f); } else { result[i][j] @@ -77,7 +77,7 @@ bool toLuaConversion(lua_State* state, glm::mat2x3 value) { } glm::mat2x3 fromStringConversion(const std::string& val, bool& success) { - glm::mat2x3 result; + glm::mat2x3 result = glm::mat2x3(1.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -126,7 +126,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( Mat2x3Property, glm::mat2x3, - glm::mat2x3(0), + glm::mat2x3(1.f), glm::mat2x3( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/mat2x4property.cpp b/src/properties/matrix/mat2x4property.cpp index 147999982c..25424f2ed6 100644 --- a/src/properties/matrix/mat2x4property.cpp +++ b/src/properties/matrix/mat2x4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::mat2x4 fromLuaConversion(lua_State* state, bool& success) { - glm::mat2x4 result; + glm::mat2x4 result = glm::mat2x4(1.f); lua_pushnil(state); int number = 1; for (glm::length_t i = 0; i < ghoul::glm_cols::value; ++i) { @@ -41,11 +41,11 @@ glm::mat2x4 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::mat2x4(0); + return glm::mat2x4(1.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::mat2x4(0); + return glm::mat2x4(1.f); } else { result[i][j] @@ -75,7 +75,7 @@ bool toLuaConversion(lua_State* state, glm::mat2x4 value) { } glm::mat2x4 fromStringConversion(const std::string& val, bool& success) { - glm::mat2x4 result; + glm::mat2x4 result = glm::mat2x4(1.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -124,7 +124,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( Mat2x4Property, glm::mat2x4, - glm::mat2x4(0), + glm::mat2x4(1.f), glm::mat2x4( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/mat3property.cpp b/src/properties/matrix/mat3property.cpp index 6706515643..edd2cc0438 100644 --- a/src/properties/matrix/mat3property.cpp +++ b/src/properties/matrix/mat3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::mat3x3 fromLuaConversion(lua_State* state, bool& success) { - glm::mat3x3 result; + glm::mat3x3 result = glm::mat3x3(1.f); lua_pushnil(state); int number = 1; for (glm::length_t i = 0; i < ghoul::glm_cols::value; ++i) { @@ -41,11 +41,11 @@ glm::mat3x3 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::mat3x3(0); + return glm::mat3x3(1.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::mat3x3(0); + return glm::mat3x3(1.f); } else { result[i][j] = static_cast(lua_tonumber(state, -1)); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::mat3x3 value) { } glm::mat3x3 fromStringConversion(const std::string& val, bool& success) { - glm::mat3x3 result; + glm::mat3x3 result = glm::mat3x3(1.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( Mat3Property, glm::mat3x3, - glm::mat3x3(0), + glm::mat3x3(1.f), glm::mat3x3( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/mat3x2property.cpp b/src/properties/matrix/mat3x2property.cpp index 867e699293..7177f076b2 100644 --- a/src/properties/matrix/mat3x2property.cpp +++ b/src/properties/matrix/mat3x2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::mat3x2 fromLuaConversion(lua_State* state, bool& success) { - glm::mat3x2 result; + glm::mat3x2 result = glm::mat3x2(1.f); lua_pushnil(state); int number = 1; for (glm::length_t i = 0; i < ghoul::glm_cols::value; ++i) { @@ -41,11 +41,11 @@ glm::mat3x2 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::mat3x2(0); + return glm::mat3x2(0.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::mat3x2(0); + return glm::mat3x2(0.f); } else { result[i][j] = static_cast(lua_tonumber(state, -1)); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::mat3x2 value) { } glm::mat3x2 fromStringConversion(const std::string& val, bool& success) { - glm::mat3x2 result; + glm::mat3x2 result = glm::mat3x2(1.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( Mat3x2Property, glm::mat3x2, - glm::mat3x2(0), + glm::mat3x2(1.f), glm::mat3x2( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest() diff --git a/src/properties/matrix/mat3x4property.cpp b/src/properties/matrix/mat3x4property.cpp index ac163f14e2..82b81626ec 100644 --- a/src/properties/matrix/mat3x4property.cpp +++ b/src/properties/matrix/mat3x4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::mat3x4 fromLuaConversion(lua_State* state, bool& success) { - glm::mat3x4 result; + glm::mat3x4 result = glm::mat3x4(1.f); lua_pushnil(state); int number = 1; for (glm::length_t i = 0; i < ghoul::glm_cols::value; ++i) { @@ -41,11 +41,11 @@ glm::mat3x4 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::mat3x4(0); + return glm::mat3x4(1.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::mat3x4(0); + return glm::mat3x4(1.f); } else { result[i][j] = static_cast(lua_tonumber(state, -1)); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::mat3x4 value) { } glm::mat3x4 fromStringConversion(const std::string& val, bool& success) { - glm::mat3x4 result; + glm::mat3x4 result = glm::mat3x4(1.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( Mat3x4Property, glm::mat3x4, - glm::mat3x4(0), + glm::mat3x4(1.f), glm::mat3x4( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/mat4property.cpp b/src/properties/matrix/mat4property.cpp index 16b4916201..6141c71918 100644 --- a/src/properties/matrix/mat4property.cpp +++ b/src/properties/matrix/mat4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -35,7 +35,7 @@ using std::numeric_limits; namespace { glm::mat4x4 fromLuaConversion(lua_State* state, bool& success) { - glm::mat4x4 result; + glm::mat4x4 result = glm::mat4x4(1.f); lua_pushnil(state); int number = 1; for (glm::length_t i = 0; i < ghoul::glm_cols::value; ++i) { @@ -43,11 +43,11 @@ glm::mat4x4 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::mat4x4(0); + return glm::mat4x4(1.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::mat4x4(0); + return glm::mat4x4(1.f); } else { result[i][j] = static_cast(lua_tonumber(state, -1)); @@ -76,7 +76,7 @@ bool toLuaConversion(lua_State* state, glm::mat4x4 value) { } glm::mat4x4 fromStringConversion(const std::string& val, bool& success) { - glm::mat4x4 result; + glm::mat4x4 result = glm::mat4x4(1.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -125,7 +125,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( Mat4Property, glm::mat4x4, - glm::mat4x4(0), + glm::mat4x4(1.f), glm::mat4x4( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/matrix/mat4x2property.cpp b/src/properties/matrix/mat4x2property.cpp index 4a6e648631..a25b68c9be 100644 --- a/src/properties/matrix/mat4x2property.cpp +++ b/src/properties/matrix/mat4x2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::mat4x2 fromLuaConversion(lua_State* state, bool& success) { - glm::mat4x2 result; + glm::mat4x2 result = glm::mat4x2(1.f); lua_pushnil(state); int number = 1; for (glm::length_t i = 0; i < ghoul::glm_cols::value; ++i) { @@ -41,11 +41,11 @@ glm::mat4x2 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::mat4x2(0); + return glm::mat4x2(1.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::mat4x2(0); + return glm::mat4x2(1.f); } else { result[i][j] = static_cast(lua_tonumber(state, -1)); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::mat4x2 value) { } glm::mat4x2 fromStringConversion(const std::string& val, bool& success) { - glm::mat4x2 result; + glm::mat4x2 result = glm::mat4x2(1.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( Mat4x2Property, glm::mat4x2, - glm::mat4x2(0), + glm::mat4x2(1.f), glm::mat4x2( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest() diff --git a/src/properties/matrix/mat4x3property.cpp b/src/properties/matrix/mat4x3property.cpp index 31e62c9e8c..33ac21d96d 100644 --- a/src/properties/matrix/mat4x3property.cpp +++ b/src/properties/matrix/mat4x3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::mat4x3 fromLuaConversion(lua_State* state, bool& success) { - glm::mat4x3 result; + glm::mat4x3 result = glm::mat4x3(1.f); lua_pushnil(state); int number = 1; for (glm::length_t i = 0; i < ghoul::glm_cols::value; ++i) { @@ -41,11 +41,11 @@ glm::mat4x3 fromLuaConversion(lua_State* state, bool& success) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::mat4x3(0); + return glm::mat4x3(1.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::mat4x3(0); + return glm::mat4x3(1.f); } else { result[i][j] = static_cast(lua_tonumber(state, -1)); @@ -74,7 +74,7 @@ bool toLuaConversion(lua_State* state, glm::mat4x3 value) { } glm::mat4x3 fromStringConversion(const std::string& val, bool& success) { - glm::mat4x3 result; + glm::mat4x3 result = glm::mat4x3(1.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != (ghoul::glm_rows::value * ghoul::glm_cols::value)) @@ -123,7 +123,7 @@ using nl = std::numeric_limits; REGISTER_NUMERICALPROPERTY_SOURCE( Mat4x3Property, glm::mat4x3, - glm::mat4x3(0), + glm::mat4x3(1.f), glm::mat4x3( nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), nl::lowest(), diff --git a/src/properties/optionproperty.cpp b/src/properties/optionproperty.cpp index e30bfd1acf..d0cd5cba40 100644 --- a/src/properties/optionproperty.cpp +++ b/src/properties/optionproperty.cpp @@ -3,7 +3,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/property.cpp b/src/properties/property.cpp index 863ddc3515..d5cef6266f 100644 --- a/src/properties/property.cpp +++ b/src/properties/property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/propertyowner.cpp b/src/properties/propertyowner.cpp index e6baba0187..0bd235c565 100644 --- a/src/properties/propertyowner.cpp +++ b/src/properties/propertyowner.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/boolproperty.cpp b/src/properties/scalar/boolproperty.cpp index d2b56ee07c..234f707e2b 100644 --- a/src/properties/scalar/boolproperty.cpp +++ b/src/properties/scalar/boolproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/charproperty.cpp b/src/properties/scalar/charproperty.cpp index fe6ffb5604..4fc29b0f77 100644 --- a/src/properties/scalar/charproperty.cpp +++ b/src/properties/scalar/charproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/doubleproperty.cpp b/src/properties/scalar/doubleproperty.cpp index a6e20ae962..7fbde3a65f 100644 --- a/src/properties/scalar/doubleproperty.cpp +++ b/src/properties/scalar/doubleproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/floatproperty.cpp b/src/properties/scalar/floatproperty.cpp index cb9ee16f84..ed67553f63 100644 --- a/src/properties/scalar/floatproperty.cpp +++ b/src/properties/scalar/floatproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/intproperty.cpp b/src/properties/scalar/intproperty.cpp index 0c8d6b5821..b1ac4a1e5c 100644 --- a/src/properties/scalar/intproperty.cpp +++ b/src/properties/scalar/intproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/longdoubleproperty.cpp b/src/properties/scalar/longdoubleproperty.cpp index 8d1ea87d1f..440e38a5fd 100644 --- a/src/properties/scalar/longdoubleproperty.cpp +++ b/src/properties/scalar/longdoubleproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/longlongproperty.cpp b/src/properties/scalar/longlongproperty.cpp index f43448798d..57b9b2091b 100644 --- a/src/properties/scalar/longlongproperty.cpp +++ b/src/properties/scalar/longlongproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/longproperty.cpp b/src/properties/scalar/longproperty.cpp index 711f02f8cb..c1363c8c73 100644 --- a/src/properties/scalar/longproperty.cpp +++ b/src/properties/scalar/longproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/shortproperty.cpp b/src/properties/scalar/shortproperty.cpp index 67e06c9b7a..b212d7a55a 100644 --- a/src/properties/scalar/shortproperty.cpp +++ b/src/properties/scalar/shortproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/signedcharproperty.cpp b/src/properties/scalar/signedcharproperty.cpp index de71c395fa..f98916396c 100644 --- a/src/properties/scalar/signedcharproperty.cpp +++ b/src/properties/scalar/signedcharproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/ucharproperty.cpp b/src/properties/scalar/ucharproperty.cpp index a5da792342..8b1f920a57 100644 --- a/src/properties/scalar/ucharproperty.cpp +++ b/src/properties/scalar/ucharproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/uintproperty.cpp b/src/properties/scalar/uintproperty.cpp index cbf6866427..919f55206f 100644 --- a/src/properties/scalar/uintproperty.cpp +++ b/src/properties/scalar/uintproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/ulonglongproperty.cpp b/src/properties/scalar/ulonglongproperty.cpp index baf2b5cbfe..5cba1a18fb 100644 --- a/src/properties/scalar/ulonglongproperty.cpp +++ b/src/properties/scalar/ulonglongproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/ulongproperty.cpp b/src/properties/scalar/ulongproperty.cpp index 81143dcbae..fa80ac91f1 100644 --- a/src/properties/scalar/ulongproperty.cpp +++ b/src/properties/scalar/ulongproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/ushortproperty.cpp b/src/properties/scalar/ushortproperty.cpp index 0cfa25dc8d..de5f7990b1 100644 --- a/src/properties/scalar/ushortproperty.cpp +++ b/src/properties/scalar/ushortproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/scalar/wcharproperty.cpp b/src/properties/scalar/wcharproperty.cpp index f96f49d79c..98eb6beb90 100644 --- a/src/properties/scalar/wcharproperty.cpp +++ b/src/properties/scalar/wcharproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/selectionproperty.cpp b/src/properties/selectionproperty.cpp index e305d110bd..3cd8214122 100644 --- a/src/properties/selectionproperty.cpp +++ b/src/properties/selectionproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/stringlistproperty.cpp b/src/properties/stringlistproperty.cpp index 2d42973cab..ac547e4bac 100644 --- a/src/properties/stringlistproperty.cpp +++ b/src/properties/stringlistproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/stringproperty.cpp b/src/properties/stringproperty.cpp index f7ff265942..803d0a3ea7 100644 --- a/src/properties/stringproperty.cpp +++ b/src/properties/stringproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/triggerproperty.cpp b/src/properties/triggerproperty.cpp index ef6adfbe8e..7b3fe235a9 100644 --- a/src/properties/triggerproperty.cpp +++ b/src/properties/triggerproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/properties/vector/bvec2property.cpp b/src/properties/vector/bvec2property.cpp index 13895c5562..65d55b37c7 100644 --- a/src/properties/vector/bvec2property.cpp +++ b/src/properties/vector/bvec2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::bvec2 fromLuaConversion(lua_State* state, bool& success) { - glm::bvec2 result; + glm::bvec2 result = glm::bvec2(false); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::bvec2 val) { } glm::bvec2 fromStringConversion(const std::string& val, bool& success) { - glm::bvec2 result; + glm::bvec2 result = glm::bvec2(false); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; diff --git a/src/properties/vector/bvec3property.cpp b/src/properties/vector/bvec3property.cpp index 5e20d06299..7323a9e6f9 100644 --- a/src/properties/vector/bvec3property.cpp +++ b/src/properties/vector/bvec3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::bvec3 fromLuaConversion(lua_State* state, bool& success) { - glm::bvec3 result; + glm::bvec3 result = glm::bvec3(false); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::bvec3 val) { } glm::bvec3 fromStringConversion(const std::string& val, bool& success) { - glm::bvec3 result; + glm::bvec3 result = glm::bvec3(false); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; diff --git a/src/properties/vector/bvec4property.cpp b/src/properties/vector/bvec4property.cpp index d9c33cbdf8..64388fa7a6 100644 --- a/src/properties/vector/bvec4property.cpp +++ b/src/properties/vector/bvec4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::bvec4 fromLuaConversion(lua_State* state, bool& success) { - glm::bvec4 result; + glm::bvec4 result = glm::bvec4(false); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::bvec4 val) { } glm::bvec4 fromStringConversion(const std::string& val, bool& success) { - glm::bvec4 result; + glm::bvec4 result = glm::bvec4(false); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; diff --git a/src/properties/vector/dvec2property.cpp b/src/properties/vector/dvec2property.cpp index fbf8ee3559..c23a4ec493 100644 --- a/src/properties/vector/dvec2property.cpp +++ b/src/properties/vector/dvec2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,17 +33,17 @@ namespace { glm::dvec2 fromLuaConversion(lua_State* state, bool& success) { - glm::dvec2 result; + glm::dvec2 result = glm::dvec2(0.0); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dvec2(0); + return glm::dvec2(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dvec2(0); + return glm::dvec2(0.0); } else { result[i] = lua_tonumber(state, -1); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::dvec2 value) { } glm::dvec2 fromStringConversion(const std::string& val, bool& success) { - glm::dvec2 result; + glm::dvec2 result = glm::dvec2(0.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; @@ -108,7 +108,7 @@ namespace openspace::properties { REGISTER_NUMERICALPROPERTY_SOURCE( DVec2Property, glm::dvec2, - glm::dvec2(0), + glm::dvec2(0.0), glm::dvec2(std::numeric_limits::lowest()), glm::dvec2(std::numeric_limits::max()), glm::dvec2(0.01), diff --git a/src/properties/vector/dvec3property.cpp b/src/properties/vector/dvec3property.cpp index fa8c0abc99..de124eb25b 100644 --- a/src/properties/vector/dvec3property.cpp +++ b/src/properties/vector/dvec3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,17 +33,17 @@ namespace { glm::dvec3 fromLuaConversion(lua_State* state, bool& success) { - glm::dvec3 result; + glm::dvec3 result = glm::dvec3(0.0); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dvec3(0); + return glm::dvec3(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dvec3(0); + return glm::dvec3(0.0); } else { result[i] = lua_tonumber(state, -1); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::dvec3 value) { } glm::dvec3 fromStringConversion(const std::string& val, bool& success) { - glm::dvec3 result; + glm::dvec3 result = glm::dvec3(0.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; @@ -108,7 +108,7 @@ namespace openspace::properties { REGISTER_NUMERICALPROPERTY_SOURCE( DVec3Property, glm::dvec3, - glm::dvec3(0), + glm::dvec3(0.0), glm::dvec3(std::numeric_limits::lowest()), glm::dvec3(std::numeric_limits::max()), glm::dvec3(0.01), diff --git a/src/properties/vector/dvec4property.cpp b/src/properties/vector/dvec4property.cpp index a28b64e84a..726048ed90 100644 --- a/src/properties/vector/dvec4property.cpp +++ b/src/properties/vector/dvec4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,17 +33,17 @@ namespace { glm::dvec4 fromLuaConversion(lua_State* state, bool& success) { - glm::dvec4 result; + glm::dvec4 result = glm::dvec4(0.0); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::dvec4(0); + return glm::dvec4(0.0); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::dvec4(0); + return glm::dvec4(0.0); } else { result[i] = lua_tonumber(state, -1); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::dvec4 value) { } glm::dvec4 fromStringConversion(const std::string& val, bool& success) { - glm::dvec4 result; + glm::dvec4 result = glm::dvec4(0.0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; @@ -108,7 +108,7 @@ namespace openspace::properties { REGISTER_NUMERICALPROPERTY_SOURCE( DVec4Property, glm::dvec4, - glm::dvec4(0), + glm::dvec4(0.0), glm::dvec4(std::numeric_limits::lowest()), glm::dvec4(std::numeric_limits::max()), glm::dvec4(0.01), diff --git a/src/properties/vector/ivec2property.cpp b/src/properties/vector/ivec2property.cpp index cb2b82073c..fd5dd2a3a9 100644 --- a/src/properties/vector/ivec2property.cpp +++ b/src/properties/vector/ivec2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::ivec2 fromLuaConversion(lua_State* state, bool& success) { - glm::ivec2 result; + glm::ivec2 result = glm::ivec2(0); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::ivec2 value) { } glm::ivec2 fromStringConversion(const std::string& val, bool& success) { - glm::ivec2 result; + glm::ivec2 result = glm::ivec2(0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; diff --git a/src/properties/vector/ivec3property.cpp b/src/properties/vector/ivec3property.cpp index 1f5f0bac9e..6ef0c002a4 100644 --- a/src/properties/vector/ivec3property.cpp +++ b/src/properties/vector/ivec3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::ivec3 fromLuaConversion(lua_State* state, bool& success) { - glm::ivec3 result; + glm::ivec3 result = glm::ivec3(0); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::ivec3 value) { } glm::ivec3 fromStringConversion(const std::string& val, bool& success) { - glm::ivec3 result; + glm::ivec3 result = glm::ivec3(0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; diff --git a/src/properties/vector/ivec4property.cpp b/src/properties/vector/ivec4property.cpp index 123278ffac..9d468e96ea 100644 --- a/src/properties/vector/ivec4property.cpp +++ b/src/properties/vector/ivec4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::ivec4 fromLuaConversion(lua_State* state, bool& success) { - glm::ivec4 result; + glm::ivec4 result = glm::ivec4(0); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::ivec4 value) { } glm::ivec4 fromStringConversion(const std::string& val, bool& success) { - glm::ivec4 result; + glm::ivec4 result = glm::ivec4(0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; diff --git a/src/properties/vector/uvec2property.cpp b/src/properties/vector/uvec2property.cpp index 0e681a7dfa..d337c4144e 100644 --- a/src/properties/vector/uvec2property.cpp +++ b/src/properties/vector/uvec2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::uvec2 fromLuaConversion(lua_State* state, bool& success) { - glm::uvec2 result; + glm::uvec2 result = glm::uvec2(0); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::uvec2 value) { } glm::uvec2 fromStringConversion(const std::string& val, bool& success) { - glm::uvec2 result; + glm::uvec2 result = glm::uvec2(0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; diff --git a/src/properties/vector/uvec3property.cpp b/src/properties/vector/uvec3property.cpp index ce921c1e92..c838b1cd7c 100644 --- a/src/properties/vector/uvec3property.cpp +++ b/src/properties/vector/uvec3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::uvec3 fromLuaConversion(lua_State* state, bool& success) { - glm::uvec3 result; + glm::uvec3 result = glm::uvec3(0); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::uvec3 value) { } glm::uvec3 fromStringConversion(const std::string& val, bool& success) { - glm::uvec3 result; + glm::uvec3 result = glm::uvec3(0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; diff --git a/src/properties/vector/uvec4property.cpp b/src/properties/vector/uvec4property.cpp index b7e2efbb75..c1abcc5f3e 100644 --- a/src/properties/vector/uvec4property.cpp +++ b/src/properties/vector/uvec4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,7 +33,7 @@ namespace { glm::uvec4 fromLuaConversion(lua_State* state, bool& success) { - glm::uvec4 result; + glm::uvec4 result = glm::uvec4(0); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::uvec4 value) { } glm::uvec4 fromStringConversion(const std::string& val, bool& success) { - glm::uvec4 result; + glm::uvec4 result = glm::uvec4(0); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; diff --git a/src/properties/vector/vec2property.cpp b/src/properties/vector/vec2property.cpp index cb442bdd61..5074d33525 100644 --- a/src/properties/vector/vec2property.cpp +++ b/src/properties/vector/vec2property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,17 +33,17 @@ namespace { glm::vec2 fromLuaConversion(lua_State* state, bool& success) { - glm::vec2 result; + glm::vec2 result = glm::vec2(0.f); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::vec2(0); + return glm::vec2(0.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::vec2(0); + return glm::vec2(0.f); } else { result[i] = static_cast(lua_tonumber(state, -1)); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::vec2 value) { } glm::vec2 fromStringConversion(const std::string& val, bool& success) { - glm::vec2 result; + glm::vec2 result = glm::vec2(0.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; @@ -108,7 +108,7 @@ namespace openspace::properties { REGISTER_NUMERICALPROPERTY_SOURCE( Vec2Property, glm::vec2, - glm::vec2(0), + glm::vec2(0.f), glm::vec2(std::numeric_limits::lowest()), glm::vec2(std::numeric_limits::max()), glm::vec2(0.01f), diff --git a/src/properties/vector/vec3property.cpp b/src/properties/vector/vec3property.cpp index 157c5209cd..f663b4d1fa 100644 --- a/src/properties/vector/vec3property.cpp +++ b/src/properties/vector/vec3property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,17 +33,17 @@ namespace { glm::vec3 fromLuaConversion(lua_State* state, bool& success) { - glm::vec3 result; + glm::vec3 result = glm::vec3(0.f); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::vec3(0); + return glm::vec3(0.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::vec3(0); + return glm::vec3(0.f); } else { result[i] = static_cast(lua_tonumber(state, -1)); @@ -68,7 +68,7 @@ bool toLuaConversion(lua_State* state, glm::vec3 value) { } glm::vec3 fromStringConversion(const std::string& val, bool& success) { - glm::vec3 result; + glm::vec3 result = glm::vec3(0.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; @@ -107,7 +107,7 @@ namespace openspace::properties { REGISTER_NUMERICALPROPERTY_SOURCE( Vec3Property, glm::vec3, - glm::vec3(0), + glm::vec3(0.f), glm::vec3(std::numeric_limits::lowest()), glm::vec3(std::numeric_limits::max()), glm::vec3(0.01f), diff --git a/src/properties/vector/vec4property.cpp b/src/properties/vector/vec4property.cpp index 7de76627cf..38580017b0 100644 --- a/src/properties/vector/vec4property.cpp +++ b/src/properties/vector/vec4property.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -33,17 +33,17 @@ namespace { glm::vec4 fromLuaConversion(lua_State* state, bool& success) { - glm::vec4 result; + glm::vec4 result = glm::vec4(0.f); lua_pushnil(state); for (glm::length_t i = 0; i < ghoul::glm_components::value; ++i) { int hasNext = lua_next(state, -2); if (hasNext != 1) { success = false; - return glm::vec4(0); + return glm::vec4(0.f); } if (lua_isnumber(state, -1) != 1) { success = false; - return glm::vec4(0); + return glm::vec4(0.f); } else { result[i] = static_cast(lua_tonumber(state, -1)); @@ -69,7 +69,7 @@ bool toLuaConversion(lua_State* state, glm::vec4 value) { } glm::vec4 fromStringConversion(const std::string& val, bool& success) { - glm::vec4 result; + glm::vec4 result = glm::vec4(0.f); std::vector tokens = ghoul::tokenizeString(val, ','); if (tokens.size() != static_cast(result.length())) { success = false; @@ -108,7 +108,7 @@ namespace openspace::properties { REGISTER_NUMERICALPROPERTY_SOURCE( Vec4Property, glm::vec4, - glm::vec4(0), + glm::vec4(0.f), glm::vec4(std::numeric_limits::lowest()), glm::vec4(std::numeric_limits::max()), glm::vec4(0.01f), diff --git a/src/query/query.cpp b/src/query/query.cpp index cb929f3892..b4a0fc490a 100644 --- a/src/query/query.cpp +++ b/src/query/query.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/rendering/abufferrenderer.cpp b/src/rendering/abufferrenderer.cpp index e504658408..fb9be4e8a7 100644 --- a/src/rendering/abufferrenderer.cpp +++ b/src/rendering/abufferrenderer.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -544,6 +545,8 @@ void ABufferRenderer::updateMSAASamplingPattern() { } void ABufferRenderer::render(Scene* scene, Camera* camera, float blackoutFactor) { + ZoneScoped + const bool doPerformanceMeasurements = global::performanceManager.isEnabled(); PerfMeasure("ABufferRenderer::render"); diff --git a/src/rendering/dashboard.cpp b/src/rendering/dashboard.cpp index f56ceeee88..77bc5162eb 100644 --- a/src/rendering/dashboard.cpp +++ b/src/rendering/dashboard.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/rendering/dashboard_lua.inl b/src/rendering/dashboard_lua.inl index 3157fa3d01..7b61ff47ab 100644 --- a/src/rendering/dashboard_lua.inl +++ b/src/rendering/dashboard_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/rendering/dashboarditem.cpp b/src/rendering/dashboarditem.cpp index 42fef0b961..6b807b909f 100644 --- a/src/rendering/dashboarditem.cpp +++ b/src/rendering/dashboarditem.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/rendering/deferredcastermanager.cpp b/src/rendering/deferredcastermanager.cpp index 1af53f4f6d..6978824675 100644 --- a/src/rendering/deferredcastermanager.cpp +++ b/src/rendering/deferredcastermanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/rendering/framebufferrenderer.cpp b/src/rendering/framebufferrenderer.cpp index 579319a6cb..d260facb32 100644 --- a/src/rendering/framebufferrenderer.cpp +++ b/src/rendering/framebufferrenderer.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -1039,16 +1040,21 @@ void FramebufferRenderer::updateDownscaledVolume() { } void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFactor) { - // Set OpenGL default rendering state - glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO); - glEnablei(GL_BLEND, 0); - glDisablei(GL_BLEND, 1); - glDisablei(GL_BLEND, 2); - - glClampColor(GL_CLAMP_READ_COLOR, GL_FALSE); + ZoneScoped - glEnable(GL_DEPTH_TEST); + { + // Set OpenGL default rendering state + ZoneScopedN("Setting OpenGL state") + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO); + glEnablei(GL_BLEND, 0); + glDisablei(GL_BLEND, 1); + glDisablei(GL_BLEND, 2); + + glClampColor(GL_CLAMP_READ_COLOR, GL_FALSE); + + glEnable(GL_DEPTH_TEST); + } _pingPongIndex = 0; // Measurements cache variable @@ -1065,11 +1071,15 @@ void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFac return; } - // deferred g-buffer - glBindFramebuffer(GL_FRAMEBUFFER, _gBuffers.framebuffer); - glDrawBuffers(3, ColorAttachment012Array); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - + { + // deferred g-buffer + ZoneScopedN("Deferred G-Buffer") + TracyGpuZone("Deferred G-Buffer") + + glBindFramebuffer(GL_FRAMEBUFFER, _gBuffers.framebuffer); + glDrawBuffers(3, ColorAttachment012Array); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + } Time time = global::timeManager.time(); RenderData data = { @@ -1148,6 +1158,8 @@ void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFac } void FramebufferRenderer::performRaycasterTasks(const std::vector& tasks) { + ZoneScoped + for (const RaycasterTask& raycasterTask : tasks) { VolumeRaycaster* raycaster = raycasterTask.raycaster; @@ -1177,7 +1189,7 @@ void FramebufferRenderer::performRaycasterTasks(const std::vector glBindFramebuffer(GL_FRAMEBUFFER, _gBuffers.framebuffer); } - glm::vec3 cameraPosition; + glm::vec3 cameraPosition = glm::vec3(0.f); bool isCameraInside = raycaster->isCameraInside( raycasterTask.renderData, cameraPosition @@ -1268,7 +1280,9 @@ void FramebufferRenderer::performRaycasterTasks(const std::vector void FramebufferRenderer::performDeferredTasks( const std::vector& tasks) -{ +{ + ZoneScoped + for (const DeferredcasterTask& deferredcasterTask : tasks) { Deferredcaster* deferredcaster = deferredcasterTask.deferredcaster; diff --git a/src/rendering/helper.cpp b/src/rendering/helper.cpp index fe4a2e5eb1..aa0a61e25c 100644 --- a/src/rendering/helper.cpp +++ b/src/rendering/helper.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -133,6 +134,9 @@ VertexObjects& gVertexObjectsConstructor() { } // namespace detail void initialize() { + ZoneScoped + TracyGpuZone("helper::initialize") + ghoul_assert(!isInitialized, "Rendering Helper initialized twice"); // diff --git a/src/rendering/loadingscreen.cpp b/src/rendering/loadingscreen.cpp index 6ef24cdb46..9694115f51 100644 --- a/src/rendering/loadingscreen.cpp +++ b/src/rendering/loadingscreen.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -46,23 +47,27 @@ namespace { constexpr const float MessageFontSize = 22.f; constexpr const float ItemFontSize = 10.f; - const glm::vec2 LogoCenter = { 0.f, 0.525f }; // in NDC - const glm::vec2 LogoSize = { 0.275f, 0.275 }; // in NDC + constexpr const glm::vec2 LogoCenter = glm::vec2(0.f, 0.525f); // in NDC + constexpr const glm::vec2 LogoSize = glm::vec2(0.275f, 0.275); // in NDC - const glm::vec2 ProgressbarCenter = { 0.f, -0.75f }; // in NDC - const glm::vec2 ProgressbarSize = { 0.7f, 0.0075f }; // in NDC + constexpr const glm::vec2 ProgressbarCenter = glm::vec2(0.f, -0.75f); // in NDC + constexpr const glm::vec2 ProgressbarSize = glm::vec2(0.7f, 0.0075f); // in NDC constexpr const float ProgressbarLineWidth = 0.0025f; // in NDC - const glm::vec4 ProgressbarOutlineColor = { 0.9f, 0.9f, 0.9f, 1.f }; + constexpr const glm::vec4 ProgressbarOutlineColor = + glm::vec4(0.9f, 0.9f, 0.9f, 1.f); - const glm::vec4 PhaseColorConstruction = { 0.7f, 0.7f, 0.f, 1.f }; - const glm::vec4 PhaseColorSynchronization = { 0.9f, 0.9f, 0.9f, 1.f }; - const glm::vec4 PhaseColorInitialization = { 0.1f, 0.75f, 0.1f, 1.f }; + constexpr const glm::vec4 PhaseColorConstruction = glm::vec4(0.7f, 0.7f, 0.f, 1.f); + constexpr const glm::vec4 PhaseColorSynchronization = + glm::vec4(0.9f, 0.9f, 0.9f, 1.f); + constexpr const glm::vec4 PhaseColorInitialization = + glm::vec4(0.1f, 0.75f, 0.1f, 1.f); - const glm::vec4 ItemStatusColorStarted = { 0.5f, 0.5f, 0.5f, 1.f }; - const glm::vec4 ItemStatusColorInitializing = { 0.7f, 0.7f, 0.f, 1.f }; - const glm::vec4 ItemStatusColorFinished = { 0.1f, 0.75f, 0.1f, 1.f }; - const glm::vec4 ItemStatusColorFailed = { 0.8f, 0.1f, 0.1f, 1.f }; + constexpr const glm::vec4 ItemStatusColorStarted = glm::vec4(0.5f, 0.5f, 0.5f, 1.f); + constexpr const glm::vec4 ItemStatusColorInitializing = + glm::vec4(0.7f, 0.7f, 0.f, 1.f); + constexpr const glm::vec4 ItemStatusColorFinished = glm::vec4(0.1f, 0.75f, 0.1f, 1.f); + constexpr const glm::vec4 ItemStatusColorFailed = glm::vec4(0.8f, 0.1f, 0.1f, 1.f); constexpr const float ItemStandoffDistance = 5.f; // in pixels @@ -150,6 +155,9 @@ LoadingScreen::~LoadingScreen() { } void LoadingScreen::render() { + ZoneScoped + FrameMarkStart("Loading") + if (_phase == Phase::PreStart) { return; } @@ -159,7 +167,7 @@ void LoadingScreen::render() { const glm::vec2 dpiScaling = global::windowDelegate.dpiScaling(); const glm::ivec2 res = - glm::vec2(global::windowDelegate.currentSubwindowSize()) / dpiScaling; + glm::vec2(global::windowDelegate.currentSubwindowSize()) * dpiScaling; float screenAspectRatio = static_cast(res.x) / static_cast(res.y); @@ -224,7 +232,7 @@ void LoadingScreen::render() { rendering::helper::Anchor::Center ); - glm::vec4 color; + glm::vec4 color = glm::vec4(0.f); switch (_phase) { case Phase::PreStart: break; @@ -273,8 +281,8 @@ void LoadingScreen::render() { renderer.render(*_loadingFont, loadingLl, headline); - glm::vec2 messageLl; - glm::vec2 messageUr; + glm::vec2 messageLl = glm::vec2(0.f); + glm::vec2 messageUr = glm::vec2(0.f); if (_showMessage) { std::lock_guard guard(_messageMutex); @@ -310,7 +318,6 @@ void LoadingScreen::render() { ProgressbarCenter.y + progressbarSize.y }; - for (Item& item : _items) { if (!item.hasLocation) { // Compute a new location @@ -325,8 +332,8 @@ void LoadingScreen::render() { // we make use with an overlap in the worst case bool foundSpace = false; - glm::vec2 ll; - glm::vec2 ur; + glm::vec2 ll = glm::vec2(0.f); + glm::vec2 ur = glm::vec2(0.f); int i = 0; for (; i < MaxNumberLocationSamples && !foundSpace; ++i) { std::uniform_int_distribution distX( @@ -484,6 +491,7 @@ void LoadingScreen::render() { std::this_thread::sleep_for(RefreshRate); global::windowDelegate.swapBuffer(); + FrameMarkEnd("Loading") } void LoadingScreen::postMessage(std::string message) { diff --git a/src/rendering/luaconsole.cpp b/src/rendering/luaconsole.cpp index d32a1ace4c..022c144dbb 100644 --- a/src/rendering/luaconsole.cpp +++ b/src/rendering/luaconsole.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -142,7 +143,7 @@ LuaConsole::LuaConsole() ) , _historyTextColor( HistoryTextColorInfo, - glm::vec4(1.0f, 1.0f, 1.0f, 0.65f), + glm::vec4(1.f, 1.f, 1.f, 0.65f), glm::vec4(0.f), glm::vec4(1.f) ) @@ -166,6 +167,8 @@ LuaConsole::LuaConsole() LuaConsole::~LuaConsole() {} // NOLINT void LuaConsole::initialize() { + ZoneScoped + const std::string filename = FileSys.cacheManager()->cachedFilename( HistoryFile, "", @@ -229,6 +232,8 @@ void LuaConsole::initialize() { } void LuaConsole::deinitialize() { + ZoneScoped + const std::string filename = FileSys.cacheManager()->cachedFilename( HistoryFile, "", @@ -589,6 +594,8 @@ void LuaConsole::charCallback(unsigned int codepoint, } void LuaConsole::update() { + ZoneScoped + // Compute the height by simulating _historyFont number of lines and checking // what the bounding box for that text would be. using namespace ghoul::fontrendering; @@ -627,6 +634,8 @@ void LuaConsole::update() { } void LuaConsole::render() { + ZoneScoped + using namespace ghoul::fontrendering; // Don't render the console if it's collapsed. @@ -646,7 +655,7 @@ void LuaConsole::render() { glDisable(GL_DEPTH_TEST); rendering::helper::renderBox( - glm::vec2(0.f, 0.f), + glm::vec2(0.f), glm::vec2(1.f, _currentHeight / res.y), _backgroundColor ); @@ -793,7 +802,7 @@ void LuaConsole::render() { }; if (_remoteScripting) { - const glm::vec4 Red(1, 0, 0, 1); + const glm::vec4 Red(1.f, 0.f, 0.f, 1.f); ParallelConnection::Status status = global::parallelPeer.status(); const int nClients = @@ -809,7 +818,7 @@ void LuaConsole::render() { const glm::vec2 loc = locationForRightJustifiedText(nClientsText); RenderFont(*_font, loc, nClientsText, Red); } else if (global::parallelPeer.isHost()) { - const glm::vec4 LightBlue(0.4, 0.4, 1, 1); + const glm::vec4 LightBlue(0.4f, 0.4f, 1.f, 1.f); const std::string localExecutionText = "Local script execution"; const glm::vec2 loc = locationForRightJustifiedText(localExecutionText); diff --git a/src/rendering/raycastermanager.cpp b/src/rendering/raycastermanager.cpp index aec3271629..9d7fecd95c 100644 --- a/src/rendering/raycastermanager.cpp +++ b/src/rendering/raycastermanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/rendering/renderable.cpp b/src/rendering/renderable.cpp index 3ec1221272..908cd3d200 100644 --- a/src/rendering/renderable.cpp +++ b/src/rendering/renderable.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -29,6 +29,7 @@ #include #include #include +#include #include namespace { @@ -117,6 +118,8 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary) , _renderableType(RenderableTypeInfo, "Renderable") , _boundingSphere(BoundingSphereInfo, 0.f, 0.f, 3e10f) { + ZoneScoped + // I can't come up with a good reason not to do this for all renderables registerUpdateRenderBinFromOpacity(); @@ -178,12 +181,11 @@ void Renderable::update(const UpdateData&) {} void Renderable::render(const RenderData&, RendererTasks&) {} void Renderable::setBoundingSphere(float boundingSphere) { - - _boundingSphere.setValue(boundingSphere); + _boundingSphere = boundingSphere; } float Renderable::boundingSphere() const { - return _boundingSphere.value(); + return _boundingSphere; } SurfacePositionHandle Renderable::calculateSurfacePositionHandle( diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 5fde95806a..99d6637790 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -408,6 +409,8 @@ void RenderEngine::setRendererFromString(const std::string& renderingMethod) { } void RenderEngine::initialize() { + ZoneScoped + // We have to perform these initializations here as the OsEng has not been initialized // in our constructor _globalRotation = static_cast(global::configuration.globalRotation); @@ -446,6 +449,8 @@ void RenderEngine::initialize() { } void RenderEngine::initializeGL() { + ZoneScoped + LTRACE("RenderEngine::initializeGL(begin)"); std::string renderingMethod = global::configuration.renderingMethod; @@ -495,10 +500,14 @@ void RenderEngine::initializeGL() { } void RenderEngine::deinitializeGL() { + ZoneScoped + _renderer = nullptr; } void RenderEngine::updateScene() { + ZoneScoped + if (!_scene) { return; } @@ -519,6 +528,8 @@ void RenderEngine::updateScene() { } void RenderEngine::updateShaderPrograms() { + ZoneScoped + for (ghoul::opengl::ProgramObject* program : _programs) { try { if (program->isDirty()) { @@ -532,6 +543,8 @@ void RenderEngine::updateShaderPrograms() { } void RenderEngine::updateRenderer() { + ZoneScoped + const bool windowResized = global::windowDelegate.windowHasResized(); if (windowResized) { @@ -549,6 +562,8 @@ void RenderEngine::updateRenderer() { } void RenderEngine::updateScreenSpaceRenderables() { + ZoneScoped + for (std::unique_ptr& ssr : global::screenSpaceRenderables) { ssr->update(); } @@ -608,6 +623,8 @@ uint64_t RenderEngine::frameNumber() const { void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix, const glm::mat4& projectionMatrix) { + ZoneScoped + LTRACE("RenderEngine::render(begin)"); const WindowDelegate& delegate = global::windowDelegate; @@ -635,6 +652,8 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat } if (_showFrameInformation) { + ZoneScopedN("Show Frame Information") + glm::vec2 penPosition = glm::vec2( fontResolution().x / 2 - 50, fontResolution().y / 3 @@ -647,6 +666,7 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat case WindowDelegate::Frustum::Mono: return ""; case WindowDelegate::Frustum::LeftEye: return "(left)"; case WindowDelegate::Frustum::RightEye: return "(right)"; + default: throw std::logic_error("Unhandled case label"); } }(frustum); @@ -661,6 +681,8 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat } if (masterEnabled && !delegate.isGuiWindow() && _globalBlackOutFactor > 0.f) { + ZoneScopedN("Render Screenspace Renderable") + std::vector ssrs; ssrs.reserve(global::screenSpaceRenderables.size()); for (const std::unique_ptr& ssr : @@ -739,6 +761,8 @@ bool RenderEngine::mouseActivationCallback(const glm::dvec2& mousePosition) cons } void RenderEngine::renderOverlays(const ShutdownInformation& shutdownInfo) { + ZoneScoped + const bool isMaster = global::windowDelegate.isMaster(); if (isMaster || _showOverlayOnSlaves) { renderScreenLog(); @@ -761,8 +785,8 @@ void RenderEngine::renderEndscreen() { glEnable(GL_BLEND); rendering::helper::renderBox( - glm::vec2(0.f, 0.f), - glm::vec2(1.f, 1.f), + glm::vec2(0.f), + glm::vec2(1.f), glm::vec4(0.f, 0.f, 0.f, 0.5f) ); @@ -785,6 +809,8 @@ void RenderEngine::renderEndscreen() { } void RenderEngine::renderShutdownInformation(float timer, float fullTime) { + ZoneScoped + timer = std::max(timer, 0.f); using BBox = ghoul::fontrendering::FontRenderer::BoundingBoxInformation; @@ -816,6 +842,8 @@ void RenderEngine::renderShutdownInformation(float timer, float fullTime) { } void RenderEngine::renderDashboard() { + ZoneScoped + std::unique_ptr perf; if (global::performanceManager.isEnabled()) { perf = std::make_unique( @@ -848,6 +876,8 @@ void RenderEngine::renderDashboard() { } void RenderEngine::postDraw() { + ZoneScoped + ++_frameNumber; if (global::performanceManager.isEnabled()) { @@ -1221,6 +1251,8 @@ RenderEngine::RendererImplementation RenderEngine::rendererFromString( } void RenderEngine::renderCameraInformation() { + ZoneScoped + if (!_showCameraInfo) { return; } @@ -1295,6 +1327,8 @@ void RenderEngine::renderCameraInformation() { } void RenderEngine::renderVersionInformation() { + ZoneScoped + if (!_showVersionInfo) { return; } @@ -1358,6 +1392,8 @@ void RenderEngine::renderVersionInformation() { } void RenderEngine::renderScreenLog() { + ZoneScoped + if (!_showLog) { return; } @@ -1414,7 +1450,7 @@ void RenderEngine::renderScreenLog() { white ); - glm::vec4 color(glm::uninitialize); + glm::vec4 color = glm::vec4(0.f); switch (e->level) { case ghoul::logging::LogLevel::Debug: color = glm::vec4(0.f, 1.f, 0.f, alpha); diff --git a/src/rendering/renderengine_lua.inl b/src/rendering/renderengine_lua.inl index 932e861a50..8a5e933f43 100644 --- a/src/rendering/renderengine_lua.inl +++ b/src/rendering/renderengine_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/rendering/screenspacerenderable.cpp b/src/rendering/screenspacerenderable.cpp index ce8ea4511c..a153149ed1 100644 --- a/src/rendering/screenspacerenderable.cpp +++ b/src/rendering/screenspacerenderable.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -132,7 +133,7 @@ namespace { float phi = spherical.z; // Sanitize coordinates. - float theta = wrap(spherical.y, 0.0, glm::two_pi()); + float theta = wrap(spherical.y, 0.f, glm::two_pi()); if (theta > glm::pi()) { theta = glm::two_pi() - theta; phi += glm::pi(); @@ -488,6 +489,8 @@ bool ScreenSpaceRenderable::deinitializeGL() { } void ScreenSpaceRenderable::render() { + ZoneScoped + draw( globalRotationMatrix() * translationMatrix() * diff --git a/src/rendering/transferfunction.cpp b/src/rendering/transferfunction.cpp index c201a392dc..f2abf5fc9e 100644 --- a/src/rendering/transferfunction.cpp +++ b/src/rendering/transferfunction.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -141,7 +141,7 @@ void TransferFunction::setTextureFromTxt(std::shared_ptr upper = glm::clamp(upper, lower, 1.f); } else if (key == "mappingkey") { float intensity; - glm::vec4 rgba = glm::vec4(0.0f); + glm::vec4 rgba = glm::vec4(0.f); iss >> intensity; for(int i = 0; i < 4; ++i) { iss >> rgba[i]; diff --git a/src/rendering/volumeraycaster.cpp b/src/rendering/volumeraycaster.cpp index 954bda7ac7..843a157ca2 100644 --- a/src/rendering/volumeraycaster.cpp +++ b/src/rendering/volumeraycaster.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index c4c5f98e5c..5cbd502e03 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -49,7 +49,8 @@ namespace { if (sync->nTotalBytesIsKnown()) { nTotalBytes += sync->nTotalBytes(); nSyncedBytes += sync->nSynchronizedBytes(); - } else if (sync->isSyncing()) { + } + else if (sync->isSyncing()) { // A resource is still synchronizing but its size is unknown. // Impossible to know the global progress. return 0; @@ -144,20 +145,22 @@ void Asset::requiredAssetChangedState(Asset::State childState) { if (isSyncResolveReady()) { setState(State::SyncResolved); } - } else if (childState == State::SyncRejected) { + } + else if (childState == State::SyncRejected) { setState(State::SyncRejected); } } -void Asset::requestedAssetChangedState(Asset* child, Asset::State childState) -{ +void Asset::requestedAssetChangedState(Asset* child, Asset::State childState) { if (child->hasInitializedParent()) { if (childState == State::Loaded && - child->state() == State::Loaded) { + child->state() == State::Loaded) + { child->startSynchronizations(); } if (childState == State::SyncResolved && - child->state() == State::SyncResolved) { + child->state() == State::SyncResolved) + { child->initialize(); } } @@ -195,7 +198,8 @@ void Asset::syncStateChanged(ResourceSynchronization* sync, if (!isSynchronized() && isSyncResolveReady()) { setState(State::SyncResolved); } - } else if (state == ResourceSynchronization::State::Rejected) { + } + else if (state == ResourceSynchronization::State::Rejected) { LERROR(fmt::format( "Failed to synchronize resource '{}'' in asset '{}'", sync->name(), id() )); @@ -221,7 +225,7 @@ bool Asset::isSyncResolveReady() { } const std::vector>& syncs = - this->ownSynchronizations(); + ownSynchronizations(); auto unresolvedOwnSynchronization = std::find_if( syncs.begin(), @@ -244,6 +248,12 @@ Asset::ownSynchronizations() const std::vector> Asset::subTreeAssets() const { std::unordered_set> assets({ shared_from_this() }); for (const std::shared_ptr& c : childAssets()) { + if (c.get() == this) { + throw ghoul::RuntimeError(fmt::format( + "Detected cycle in asset inclusion for {} at {}", _assetName, _assetPath + )); + } + const std::vector>& subTree = c->subTreeAssets(); std::copy(subTree.begin(), subTree.end(), std::inserter(assets, assets.end())); } @@ -521,7 +531,8 @@ bool Asset::initialize() { // 3. Call lua onInitialize try { loader()->callOnInitialize(this); - } catch (const ghoul::lua::LuaRuntimeException& e) { + } + catch (const ghoul::lua::LuaRuntimeException& e) { LERROR(fmt::format( "Failed to initialize asset {}; {}: {}", id(), e.component, e.message )); @@ -537,7 +548,8 @@ bool Asset::initialize() { for (const std::shared_ptr& child : _requiredAssets) { try { loader()->callOnDependencyInitialize(child.get(), this); - } catch (const ghoul::lua::LuaRuntimeException& e) { + } + catch (const ghoul::lua::LuaRuntimeException& e) { LERROR(fmt::format( "Failed to initialize required asset {} of {}; {}: {}", child->id(), @@ -556,7 +568,8 @@ bool Asset::initialize() { if (child->isInitialized()) { try { loader()->callOnDependencyInitialize(child.get(), this); - } catch (const ghoul::lua::LuaRuntimeException& e) { + } + catch (const ghoul::lua::LuaRuntimeException& e) { LERROR(fmt::format( "Failed to initialize requested asset {} of {}; {}: {}", child->id(), @@ -575,7 +588,8 @@ bool Asset::initialize() { if (p && p->isInitialized()) { try { loader()->callOnDependencyInitialize(this, p.get()); - } catch (const ghoul::lua::LuaRuntimeException& e) { + } + catch (const ghoul::lua::LuaRuntimeException& e) { LERROR(fmt::format( "Failed to initialize required asset {} of {}; {}: {}", id(), diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index 300a2348b7..15ce77bb86 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -89,13 +89,13 @@ namespace { namespace openspace { -AssetLoader::AssetLoader(ghoul::lua::LuaState& luaState, +AssetLoader::AssetLoader(ghoul::lua::LuaState* luaState, SynchronizationWatcher* syncWatcher, std::string assetRootDirectory) : _rootAsset(std::make_shared(this, syncWatcher)) , _synchronizationWatcher(syncWatcher) , _assetRootDirectory(std::move(assetRootDirectory)) - , _luaState(&luaState) + , _luaState(luaState) { setCurrentAsset(_rootAsset); diff --git a/src/scene/assetloader_lua.inl b/src/scene/assetloader_lua.inl index 6a34477fd2..347b7c98cd 100644 --- a/src/scene/assetloader_lua.inl +++ b/src/scene/assetloader_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/assetmanager.cpp b/src/scene/assetmanager.cpp index 1f98f7bcb5..e64409fadd 100644 --- a/src/scene/assetmanager.cpp +++ b/src/scene/assetmanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -30,6 +30,7 @@ #include #include #include +#include #include "assetmanager_lua.inl" @@ -55,6 +56,8 @@ void AssetManager::deinitialize() { } bool AssetManager::update() { + ZoneScoped + // Add assets for (const std::pair& c : _pendingStateChangeCommands) { const std::string& path = c.first; @@ -103,6 +106,8 @@ void AssetManager::remove(const std::string& path) { } void AssetManager::removeAll() { + ZoneScoped + _pendingStateChangeCommands.clear(); std::vector> allAssets = _assetLoader->rootAsset()->requestedAssets(); diff --git a/src/scene/assetmanager_lua.inl b/src/scene/assetmanager_lua.inl index 138d60e0c2..6458165b58 100644 --- a/src/scene/assetmanager_lua.inl +++ b/src/scene/assetmanager_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/lightsource.cpp b/src/scene/lightsource.cpp index 95881efa2e..cee754cfec 100644 --- a/src/scene/lightsource.cpp +++ b/src/scene/lightsource.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/rotation.cpp b/src/scene/rotation.cpp index 9173fd5097..9f0233ece7 100644 --- a/src/scene/rotation.cpp +++ b/src/scene/rotation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/scale.cpp b/src/scene/scale.cpp index b9475b6fa3..dff7b83fe6 100644 --- a/src/scene/scale.cpp +++ b/src/scene/scale.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 6b8041ccca..f8c9ef6e8a 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -36,7 +36,7 @@ #include #include #include - +#include #include #include @@ -46,6 +46,25 @@ namespace { constexpr const char* _loggerCat = "Scene"; constexpr const char* KeyIdentifier = "Identifier"; constexpr const char* KeyParent = "Parent"; + + constexpr const char* renderBinToString(int renderBin) { + // Synced with Renderable::RenderBin + if (renderBin == 1) { + return "Background"; + } + else if (renderBin == 2) { + return "Opaque"; + } + else if (renderBin == 4) { + return "Transparent"; + } + else if (renderBin == 8) { + return "Overlay"; + } + else { + throw ghoul::MissingCaseException(); + } + } } // namespace namespace openspace { @@ -120,6 +139,8 @@ void Scene::markNodeRegistryDirty() { } void Scene::updateNodeRegistry() { + ZoneScoped + sortTopologically(); _dirtyNodeRegistry = false; } @@ -279,6 +300,8 @@ void Scene::initializeGL() { */ void Scene::update(const UpdateData& data) { + ZoneScoped + std::vector initializedNodes = _initializer->takeInitializedNodes(); for (SceneGraphNode* node : initializedNodes) { @@ -304,6 +327,12 @@ void Scene::update(const UpdateData& data) { } void Scene::render(const RenderData& data, RendererTasks& tasks) { + ZoneScoped + ZoneName( + renderBinToString(data.renderBinMask), + strlen(renderBinToString(data.renderBinMask)) + ) + for (SceneGraphNode* node : _topologicallySortedNodes) { try { LTRACE("Scene::render(begin '" + node->identifier() + "')"); @@ -316,15 +345,20 @@ void Scene::render(const RenderData& data, RendererTasks& tasks) { if (global::callback::webBrowserPerformanceHotfix) { (*global::callback::webBrowserPerformanceHotfix)(); } + + { + ZoneScopedN("Get Error Hack") - // @TODO(abock 2019-08-19) This glGetError call is a hack to prevent the GPU - // thread and the CPU thread from diverging too much, particularly the uploading - // of a lot of textures for the globebrowsing planets can cause a hard stuttering - // effect. Asking for a glGetError after every rendering call will force the - // threads to implicitly synchronize and thus prevent the stuttering. The better - // solution would be to reduce the number of uploads per frame, use a staggered - // buffer, or something else like that preventing a large spike in uploads - glGetError(); + // @TODO(abock 2019-08-19) This glGetError call is a hack to prevent the GPU + // thread and the CPU thread from diverging too much, particularly the + // uploading of a lot of textures for the globebrowsing planets can cause a + // hard stuttering effect. Asking for a glGetError after every rendering call + // will force the threads to implicitly synchronize and thus prevent the + // stuttering. The better solution would be to reduce the number of uploads + // per frame, use a staggered buffer, or something else like that preventing a + // large spike in uploads + glGetError(); + } } } @@ -509,6 +543,8 @@ void Scene::removePropertyInterpolation(properties::Property* prop) { } void Scene::updateInterpolations() { + ZoneScoped + using namespace std::chrono; auto now = steady_clock::now(); diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index f56d29b136..4fdabb91e7 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -34,6 +34,7 @@ #include #include #include +#include #include #include "scenegraphnode_doc.inl" @@ -311,6 +312,9 @@ SceneGraphNode::SceneGraphNode() SceneGraphNode::~SceneGraphNode() {} // NOLINT void SceneGraphNode::initialize() { + ZoneScoped + ZoneName(identifier().c_str(), identifier().size()) + LDEBUG(fmt::format("Initializing: {}", identifier())); if (_renderable) { @@ -332,6 +336,9 @@ void SceneGraphNode::initialize() { } void SceneGraphNode::initializeGL() { + ZoneScoped + ZoneName(identifier().c_str(), identifier().size()) + LDEBUG(fmt::format("Initializing GL: {}", identifier())); if (_renderable) { @@ -343,6 +350,9 @@ void SceneGraphNode::initializeGL() { } void SceneGraphNode::deinitialize() { + ZoneScoped + ZoneName(identifier().c_str(), identifier().size()) + LDEBUG(fmt::format("Deinitializing: {}", identifier())); setScene(nullptr); @@ -357,6 +367,9 @@ void SceneGraphNode::deinitialize() { } void SceneGraphNode::deinitializeGL() { + ZoneScoped + ZoneName(identifier().c_str(), identifier().size()) + LDEBUG(fmt::format("Deinitializing GL: {}", identifier())); if (_renderable) { @@ -381,6 +394,9 @@ void SceneGraphNode::traversePostOrder(const std::functionrender(newData, tasks); if (_computeScreenSpaceValues) { computeScreenSpaceData(newData); @@ -746,11 +767,7 @@ SurfacePositionHandle SceneGraphNode::calculateSurfacePositionHandle( return _renderable->calculateSurfacePositionHandle(targetModelSpace); } else { - return { - glm::dvec3(0.0, 0.0, 0.0), - glm::normalize(targetModelSpace), - 0.0 - }; + return { glm::dvec3(0.0), glm::normalize(targetModelSpace), 0.0 }; } } @@ -860,6 +877,8 @@ Scene* SceneGraphNode::scene() { } void SceneGraphNode::setScene(Scene* scene) { + ZoneScoped + // Unregister from previous scene, bottom up traversePostOrder([](SceneGraphNode* node) { if (node->_scene) { diff --git a/src/scene/scenegraphnode_doc.inl b/src/scene/scenegraphnode_doc.inl index 9850908d07..7a8298b573 100644 --- a/src/scene/scenegraphnode_doc.inl +++ b/src/scene/scenegraphnode_doc.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/sceneinitializer.cpp b/src/scene/sceneinitializer.cpp index 9b22f1c714..06d166d7ff 100644 --- a/src/scene/sceneinitializer.cpp +++ b/src/scene/sceneinitializer.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/scenelicense.cpp b/src/scene/scenelicense.cpp index 4c476ef046..3be1824641 100644 --- a/src/scene/scenelicense.cpp +++ b/src/scene/scenelicense.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/scenelicensewriter.cpp b/src/scene/scenelicensewriter.cpp index fed31fb4b6..84832573ba 100644 --- a/src/scene/scenelicensewriter.cpp +++ b/src/scene/scenelicensewriter.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/timeframe.cpp b/src/scene/timeframe.cpp index 78fd729e96..5ac45d5d65 100644 --- a/src/scene/timeframe.cpp +++ b/src/scene/timeframe.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scene/translation.cpp b/src/scene/translation.cpp index 925935b22c..3e95735a8b 100644 --- a/src/scene/translation.cpp +++ b/src/scene/translation.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scripting/lualibrary.cpp b/src/scripting/lualibrary.cpp index 37feeaa931..d11250322a 100644 --- a/src/scripting/lualibrary.cpp +++ b/src/scripting/lualibrary.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scripting/scriptengine.cpp b/src/scripting/scriptengine.cpp index 8728f0d0a4..3beb182fc4 100644 --- a/src/scripting/scriptengine.cpp +++ b/src/scripting/scriptengine.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "scriptengine_lua.inl" @@ -52,9 +53,13 @@ ScriptEngine::ScriptEngine() { "scriptingTemplate","${WEB}/documentation/scripting.hbs" }, } ) -{} +{ + tracy::LuaRegister(_state); +} void ScriptEngine::initialize() { + ZoneScoped + LDEBUG("Adding base library"); addBaseLibrary(); @@ -63,10 +68,14 @@ void ScriptEngine::initialize() { } void ScriptEngine::deinitialize() { + ZoneScoped + _registeredLibraries.clear(); } void ScriptEngine::initializeLuaState(lua_State* state) { + ZoneScoped + LDEBUG("Create openspace base library"); const int top = lua_gettop(state); @@ -86,6 +95,8 @@ ghoul::lua::LuaState* ScriptEngine::luaState() { } void ScriptEngine::addLibrary(LuaLibrary library) { + ZoneScoped + auto sortFunc = [](const LuaLibrary::Function& lhs, const LuaLibrary::Function& rhs) { return lhs.name < rhs.name; @@ -154,6 +165,8 @@ bool ScriptEngine::hasLibrary(const std::string& name) { } bool ScriptEngine::runScript(const std::string& script, ScriptCallback callback) { + ZoneScoped + if (script.empty()) { LWARNING("Script was empty"); return false; @@ -168,7 +181,7 @@ bool ScriptEngine::runScript(const std::string& script, ScriptCallback callback) if (callback) { ghoul::Dictionary returnValue = ghoul::lua::loadArrayDictionaryFromString(script, _state); - callback.value()(returnValue); + callback(returnValue); } else { ghoul::lua::runScript(_state, script); } @@ -190,6 +203,8 @@ bool ScriptEngine::runScript(const std::string& script, ScriptCallback callback) } bool ScriptEngine::runScriptFile(const std::string& filename) { + ZoneScoped + if (filename.empty()) { LWARNING("Filename was empty"); return false; @@ -270,6 +285,8 @@ bool ScriptEngine::isLibraryNameAllowed(lua_State* state, const std::string& nam void ScriptEngine::addLibraryFunctions(lua_State* state, LuaLibrary& library, Replace replace) { + ZoneScoped + ghoul_assert(state, "State must not be nullptr"); for (const LuaLibrary::Function& p : library.functions) { if (!replace) { @@ -330,6 +347,8 @@ void ScriptEngine::addLibraryFunctions(lua_State* state, LuaLibrary& library, } void ScriptEngine::addBaseLibrary() { + ZoneScoped + LuaLibrary lib = { "", { @@ -489,6 +508,8 @@ void ScriptEngine::remapPrintFunction() { } bool ScriptEngine::registerLuaLibrary(lua_State* state, LuaLibrary& library) { + ZoneScoped + ghoul_assert(state, "State must not be nullptr"); const int top = lua_gettop(state); @@ -528,6 +549,8 @@ bool ScriptEngine::registerLuaLibrary(lua_State* state, LuaLibrary& library) { } std::vector ScriptEngine::allLuaFunctions() const { + ZoneScoped + std::vector result; for (const LuaLibrary& library : _registeredLibraries) { @@ -554,6 +577,8 @@ std::vector ScriptEngine::allLuaFunctions() const { } std::string ScriptEngine::generateJson() const { + ZoneScoped + // Create JSON std::stringstream json; json << "["; @@ -603,6 +628,8 @@ std::string ScriptEngine::generateJson() const { } bool ScriptEngine::writeLog(const std::string& script) { + ZoneScoped + // Check that logging is enabled and initialize if necessary if (!_logFileExists) { // If a ScriptLogFile was specified, generate it now @@ -644,6 +671,8 @@ bool ScriptEngine::writeLog(const std::string& script) { } void ScriptEngine::preSync(bool isMaster) { + ZoneScoped + if (!isMaster) { return; } @@ -669,6 +698,8 @@ void ScriptEngine::preSync(bool isMaster) { } void ScriptEngine::encode(SyncBuffer* syncBuffer) { + ZoneScoped + size_t nScripts = _scriptsToSync.size(); syncBuffer->encode(nScripts); for (const std::string& s : _scriptsToSync) { @@ -678,6 +709,8 @@ void ScriptEngine::encode(SyncBuffer* syncBuffer) { } void ScriptEngine::decode(SyncBuffer* syncBuffer) { + ZoneScoped + std::lock_guard guard(_slaveScriptsMutex); size_t nScripts; syncBuffer->decode(nScripts); @@ -690,6 +723,8 @@ void ScriptEngine::decode(SyncBuffer* syncBuffer) { } void ScriptEngine::postSync(bool isMaster) { + ZoneScoped + if (isMaster) { while (!_masterScriptQueue.empty()) { std::string script = std::move(_masterScriptQueue.front().script); @@ -721,6 +756,8 @@ void ScriptEngine::queueScript(const std::string& script, ScriptEngine::RemoteScripting remoteScripting, ScriptCallback callback) { + ZoneScoped + if (!script.empty()) { _incomingScripts.push({ script, remoteScripting, callback }); } diff --git a/src/scripting/scriptengine_lua.inl b/src/scripting/scriptengine_lua.inl index ddc3bea55e..0b9a076ece 100644 --- a/src/scripting/scriptengine_lua.inl +++ b/src/scripting/scriptengine_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scripting/scriptscheduler.cpp b/src/scripting/scriptscheduler.cpp index 1731f9a9e6..2606a7431e 100644 --- a/src/scripting/scriptscheduler.cpp +++ b/src/scripting/scriptscheduler.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scripting/scriptscheduler_lua.inl b/src/scripting/scriptscheduler_lua.inl index ebf517ce47..699e2c2f0d 100644 --- a/src/scripting/scriptscheduler_lua.inl +++ b/src/scripting/scriptscheduler_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/scripting/systemcapabilitiesbinding.cpp b/src/scripting/systemcapabilitiesbinding.cpp index ce773010a4..79b7676711 100644 --- a/src/scripting/systemcapabilitiesbinding.cpp +++ b/src/scripting/systemcapabilitiesbinding.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/blockplaneintersectiongeometry.cpp b/src/util/blockplaneintersectiongeometry.cpp index 835c893dac..b2e6dd4d0c 100644 --- a/src/util/blockplaneintersectiongeometry.cpp +++ b/src/util/blockplaneintersectiongeometry.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -79,6 +79,7 @@ void BlockPlaneIntersectionGeometry::updateVertices() { const glm::vec3 halfSize = _size * 0.5f; glm::vec3 intersections[12]; + std::fill(std::begin(intersections), std::end(intersections), glm::vec3(0.f)); int nIntersections = 0; for (int i = 0; i < 12; i++) { @@ -120,7 +121,7 @@ void BlockPlaneIntersectionGeometry::updateVertices() { glm::vec3 vectorI = glm::normalize(intersections[i] - intersections[0]); float sinA = glm::dot(glm::cross(vector1, vectorI), _normal); float cosA = glm::dot(vector1, vectorI); - angles[i - 1] = { i, static_cast(glm::sign(sinA) * (1.0 - cosA)) }; + angles[i - 1] = { i, glm::sign(sinA) * (1.f - cosA) }; } // Sort the vectors by angle in the plane diff --git a/src/util/boxgeometry.cpp b/src/util/boxgeometry.cpp index 4cf098fd82..34c9189d8d 100644 --- a/src/util/boxgeometry.cpp +++ b/src/util/boxgeometry.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/camera.cpp b/src/util/camera.cpp index 41cbc3500a..82d912c52c 100644 --- a/src/util/camera.cpp +++ b/src/util/camera.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -210,8 +210,8 @@ void Camera::serialize(std::ostream& os) const { void Camera::deserialize(std::istream& is) { glm::dvec3 p; - glm::dquat q; is >> p.x >> p.y >> p.z; + glm::dquat q; is >> q.x >> q.y >> q.z >> q.w; setPositionVec3(p); setRotation(q); diff --git a/src/util/distanceconversion.cpp b/src/util/distanceconversion.cpp index d654253fd5..905b07a400 100644 --- a/src/util/distanceconversion.cpp +++ b/src/util/distanceconversion.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/factorymanager.cpp b/src/util/factorymanager.cpp index 727dcdaf0f..3796976382 100644 --- a/src/util/factorymanager.cpp +++ b/src/util/factorymanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/histogram.cpp b/src/util/histogram.cpp index 2af9cfb75f..15345b873b 100644 --- a/src/util/histogram.cpp +++ b/src/util/histogram.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/httprequest.cpp b/src/util/httprequest.cpp index d5c8433884..4d9262a505 100644 --- a/src/util/httprequest.cpp +++ b/src/util/httprequest.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -248,7 +248,12 @@ void AsyncHttpDownload::start(HttpRequest::RequestOptions opt) { } markAsStarted(); _downloadThread = std::thread([this, opt] { - download(opt); + try { + download(opt); + } + catch (const ghoul::filesystem::FileSystem::FileSystemException& e) { + LERRORC(e.component, e.message); + } }); } diff --git a/src/util/keys.cpp b/src/util/keys.cpp index e69dd4f7b0..9450a483e7 100644 --- a/src/util/keys.cpp +++ b/src/util/keys.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/openspacemodule.cpp b/src/util/openspacemodule.cpp index 9d1fba9a37..faba6a17fb 100644 --- a/src/util/openspacemodule.cpp +++ b/src/util/openspacemodule.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -49,6 +50,9 @@ OpenSpaceModule::OpenSpaceModule(std::string name) void OpenSpaceModule::initialize(const ModuleEngine* moduleEngine, const ghoul::Dictionary& configuration) { + ZoneScoped + ZoneName(identifier().c_str(), identifier().size()) + std::string upperIdentifier = identifier(); std::transform( upperIdentifier.begin(), @@ -72,14 +76,23 @@ void OpenSpaceModule::initialize(const ModuleEngine* moduleEngine, } void OpenSpaceModule::initializeGL() { + ZoneScoped + ZoneName(identifier().c_str(), identifier().size()) + internalInitializeGL(); } void OpenSpaceModule::deinitialize() { + ZoneScoped + ZoneName(identifier().c_str(), identifier().size()) + internalDeinitialize(); } void OpenSpaceModule::deinitializeGL() { + ZoneScoped + ZoneName(identifier().c_str(), identifier().size()) + internalDeinitializeGL(); } diff --git a/src/util/progressbar.cpp b/src/util/progressbar.cpp index f8ebcd053a..7ff4913801 100644 --- a/src/util/progressbar.cpp +++ b/src/util/progressbar.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/resourcesynchronization.cpp b/src/util/resourcesynchronization.cpp index 25c743d0db..2fb379ce09 100644 --- a/src/util/resourcesynchronization.cpp +++ b/src/util/resourcesynchronization.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/screenlog.cpp b/src/util/screenlog.cpp index aaf3440046..c5ff3f67e2 100644 --- a/src/util/screenlog.cpp +++ b/src/util/screenlog.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/sphere.cpp b/src/util/sphere.cpp index cbd3cfc4dc..7c34be9a58 100644 --- a/src/util/sphere.cpp +++ b/src/util/sphere.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -71,7 +71,7 @@ Sphere::Sphere(glm::vec3 radius, int segments) glm::vec3 normal = glm::vec3(x, y, z); if (!(x == 0.f && y == 0.f && z == 0.f)) { - normal = glm::normalize(normal); + normal = glm::vec3(glm::normalize(glm::dvec3(normal))); } _varray[nr].normal[0] = normal[0]; diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index bd65b59db5..618f432e03 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -525,7 +525,7 @@ glm::dvec3 SpiceManager::targetPosition(const std::string& target, } } else if (targetHasCoverage && observerHasCoverage) { - glm::dvec3 position; + glm::dvec3 position = glm::dvec3(0.0); spkpos_c( target.c_str(), ephemerisTime, @@ -1027,7 +1027,7 @@ glm::dvec3 SpiceManager::getEstimatedPosition(const std::string& target, const std::set& coveredTimes = _spkCoverageTimes.find(targetId)->second; - glm::dvec3 pos; + glm::dvec3 pos = glm::dvec3(0.0); if (coveredTimes.lower_bound(ephemerisTime) == coveredTimes.begin()) { // coverage later, fetch first position spkpos_c( @@ -1062,7 +1062,7 @@ glm::dvec3 SpiceManager::getEstimatedPosition(const std::string& target, } else { // coverage both earlier and later, interpolate these positions - glm::dvec3 posEarlier; + glm::dvec3 posEarlier = glm::dvec3(0.0); double ltEarlier; double timeEarlier = *std::prev((coveredTimes.lower_bound(ephemerisTime))); spkpos_c( @@ -1075,7 +1075,7 @@ glm::dvec3 SpiceManager::getEstimatedPosition(const std::string& target, <Earlier ); - glm::dvec3 posLater; + glm::dvec3 posLater = glm::dvec3(0.0); double ltLater; double timeLater = *(coveredTimes.upper_bound(ephemerisTime)); spkpos_c( @@ -1106,7 +1106,7 @@ glm::dmat3 SpiceManager::getEstimatedTransformMatrix(const std::string& fromFram const std::string& toFrame, double time) const { - glm::dmat3 result; + glm::dmat3 result = glm::dmat3(1.0); const int idFrame = frameId(fromFrame); if (_ckCoverageTimes.find(idFrame) == _ckCoverageTimes.end()) { @@ -1118,7 +1118,7 @@ glm::dmat3 SpiceManager::getEstimatedTransformMatrix(const std::string& fromFram )); } else { - return glm::dmat3(); + return glm::dmat3(1.0); } } @@ -1155,7 +1155,7 @@ glm::dmat3 SpiceManager::getEstimatedTransformMatrix(const std::string& fromFram double earlier = *std::prev((coveredTimes.lower_bound(time))); double later = *(coveredTimes.upper_bound(time)); - glm::dmat3 earlierTransform; + glm::dmat3 earlierTransform = glm::dmat3(1.0); pxform_c( fromFrame.c_str(), toFrame.c_str(), @@ -1167,7 +1167,7 @@ glm::dmat3 SpiceManager::getEstimatedTransformMatrix(const std::string& fromFram fromFrame, toFrame, time )); - glm::dmat3 laterTransform; + glm::dmat3 laterTransform = glm::dmat3(1.0); pxform_c( fromFrame.c_str(), toFrame.c_str(), diff --git a/src/util/spicemanager_lua.inl b/src/util/spicemanager_lua.inl index 3cdc589ec5..57e112ecd4 100644 --- a/src/util/spicemanager_lua.inl +++ b/src/util/spicemanager_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/syncbuffer.cpp b/src/util/syncbuffer.cpp index b74446c3d0..f52cfa42dc 100644 --- a/src/util/syncbuffer.cpp +++ b/src/util/syncbuffer.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -24,6 +24,8 @@ #include +#include + namespace openspace { SyncBuffer::SyncBuffer(size_t n) @@ -35,6 +37,8 @@ SyncBuffer::SyncBuffer(size_t n) SyncBuffer::~SyncBuffer() {} // NOLINT void SyncBuffer::encode(const std::string& s) { + ZoneScoped + int32_t anticpatedBufferSize = _encodeOffset + (sizeof(char) * s.size()) + sizeof(int32_t); if (anticpatedBufferSize >= _n) { @@ -53,6 +57,8 @@ void SyncBuffer::encode(const std::string& s) { } std::string SyncBuffer::decode() { + ZoneScoped + int32_t length; memcpy( reinterpret_cast(&length), diff --git a/src/util/synchronizationwatcher.cpp b/src/util/synchronizationwatcher.cpp index 4f8675f6cc..1cf518f3ad 100644 --- a/src/util/synchronizationwatcher.cpp +++ b/src/util/synchronizationwatcher.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/task.cpp b/src/util/task.cpp index 363c920c52..81a3bce488 100644 --- a/src/util/task.cpp +++ b/src/util/task.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/taskloader.cpp b/src/util/taskloader.cpp index 84e664f2bb..2ef22f1b3a 100644 --- a/src/util/taskloader.cpp +++ b/src/util/taskloader.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/threadpool.cpp b/src/util/threadpool.cpp index 235d5fb52f..0092daa7e5 100644 --- a/src/util/threadpool.cpp +++ b/src/util/threadpool.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/time.cpp b/src/util/time.cpp index f84e69482e..9773a6f43d 100644 --- a/src/util/time.cpp +++ b/src/util/time.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/time_lua.inl b/src/util/time_lua.inl index ac0115367e..613b942839 100644 --- a/src/util/time_lua.inl +++ b/src/util/time_lua.inl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/timeconversion.cpp b/src/util/timeconversion.cpp index 5fd120d889..79dc4dd218 100644 --- a/src/util/timeconversion.cpp +++ b/src/util/timeconversion.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/timeline.cpp b/src/util/timeline.cpp index 4af59c0248..b15bd2b10f 100644 --- a/src/util/timeline.cpp +++ b/src/util/timeline.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/timemanager.cpp b/src/util/timemanager.cpp index d8e920d2a7..cc17806280 100644 --- a/src/util/timemanager.cpp +++ b/src/util/timemanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -29,6 +29,7 @@ #include #include #include +#include namespace { // Properties for time interpolation @@ -129,6 +130,8 @@ void TimeManager::interpolateTimeRelative(double delta, double durationSeconds) } void TimeManager::preSynchronization(double dt) { + ZoneScoped + removeKeyframesBefore(_latestConsumedTimestamp); progressTime(dt); diff --git a/src/util/timerange.cpp b/src/util/timerange.cpp index d60e3c21c9..537181a19f 100644 --- a/src/util/timerange.cpp +++ b/src/util/timerange.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * diff --git a/src/util/transformationmanager.cpp b/src/util/transformationmanager.cpp index 584fdc9c11..663f06b605 100644 --- a/src/util/transformationmanager.cpp +++ b/src/util/transformationmanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -106,9 +106,9 @@ glm::dmat3 TransformationManager::kameleonTransformationMatrix( _kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in2, &out2); return glm::dmat3( - out0.c0 , out0.c1 , out0.c2, - out1.c0 , out1.c1 , out1.c2, - out2.c0 , out2.c1 , out2.c2 + out0.c0, out0.c1, out0.c2, + out1.c0, out1.c1, out1.c2, + out2.c0, out2.c1, out2.c2 ); #else return glm::dmat3(0.0); diff --git a/src/util/versionchecker.cpp b/src/util/versionchecker.cpp index 6ab9ffad73..7f4b077bc0 100644 --- a/src/util/versionchecker.cpp +++ b/src/util/versionchecker.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -132,7 +132,7 @@ void VersionChecker::cancel() { } VersionChecker::SemanticVersion VersionChecker::latestVersion() { - return _latestVersion.value(); + return *_latestVersion; } bool operator<(const VersionChecker::SemanticVersion a, diff --git a/support/cmake/application_definition.cmake b/support/cmake/application_definition.cmake index 71be2cf006..1f6180e0db 100644 --- a/support/cmake/application_definition.cmake +++ b/support/cmake/application_definition.cmake @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/support/cmake/global_variables.cmake b/support/cmake/global_variables.cmake index 7b9d252de7..a5bb7fc463 100644 --- a/support/cmake/global_variables.cmake +++ b/support/cmake/global_variables.cmake @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/support/cmake/handle_applications.cmake b/support/cmake/handle_applications.cmake index 1f3110dbac..45db49da6b 100644 --- a/support/cmake/handle_applications.cmake +++ b/support/cmake/handle_applications.cmake @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/support/cmake/handle_modules.cmake b/support/cmake/handle_modules.cmake index 323d891621..6b5edc7fe1 100644 --- a/support/cmake/handle_modules.cmake +++ b/support/cmake/handle_modules.cmake @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/support/cmake/module_common.cmake b/support/cmake/module_common.cmake index a6db81af60..7ca5c2f94d 100644 --- a/support/cmake/module_common.cmake +++ b/support/cmake/module_common.cmake @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/support/cmake/module_definition.cmake b/support/cmake/module_definition.cmake index 98e66ca1dd..b2aaffd948 100644 --- a/support/cmake/module_definition.cmake +++ b/support/cmake/module_definition.cmake @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/support/cmake/packaging.cmake b/support/cmake/packaging.cmake index 716ccde45a..796e5367c2 100644 --- a/support/cmake/packaging.cmake +++ b/support/cmake/packaging.cmake @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/support/cmake/set_openspace_compile_settings.cmake b/support/cmake/set_openspace_compile_settings.cmake index 9d39c97809..70abc0f055 100644 --- a/support/cmake/set_openspace_compile_settings.cmake +++ b/support/cmake/set_openspace_compile_settings.cmake @@ -2,7 +2,7 @@ # # # OpenSpace # # # -# Copyright (c) 2014-2018 # +# 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 # diff --git a/tests/AssetLoaderTest/dependencyfunctionsexist.asset b/tests/AssetLoaderTest/dependencyfunctionsexist.asset deleted file mode 100644 index 66f96d70c4..0000000000 --- a/tests/AssetLoaderTest/dependencyfunctionsexist.asset +++ /dev/null @@ -1,6 +0,0 @@ -local imports, dep = asset.require('export') - -assert(type(dep.localResource) == "function", "localResource should be function") -assert(type(dep.syncedResource) == "function", "syncedResource should be function") -assert(type(dep.onInitialize) == "function", "onInitialize should be function") -assert(type(dep.onDeinitialize) == "function", "onDeinitialize should be function") \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000000..74b2691cf4 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,65 @@ +########################################################################################## +# # +# 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. # +########################################################################################## + +add_executable( + OpenSpaceTest + main.cpp + test_assetloader.cpp + test_concurrentjobmanager.cpp + test_concurrentqueue.cpp + test_documentation.cpp + test_iswamanager.cpp + test_latlonpatch.cpp + test_lrucache.cpp + test_luaconversions.cpp + test_optionproperty.cpp + test_rawvolumeio.cpp + test_scriptscheduler.cpp + test_spicemanager.cpp + test_temporaltileprovider.cpp + test_timequantizer.cpp + test_timeline.cpp + + regression/517.cpp +) + +set_openspace_compile_settings(OpenSpaceTest) + +target_include_directories(OpenSpaceTest PUBLIC +"${GHOUL_BASE_DIR}/ext/catch2/single_include" +) +target_compile_definitions(OpenSpaceTest PUBLIC "GHL_THROW_ON_ASSERT") +target_link_libraries(OpenSpaceTest openspace-core) + +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. + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBBROWSER_MODULE_PATH}/cmake") + include(webbrowser_helpers) + + set_cef_targets("${CEF_ROOT}" OpenSpaceTest) + run_cef_platform_config("${CEF_ROOT}" "${CEF_TARGET}" "${WEBBROWSER_MODULE_PATH}") +endif () + +set_folder_location(OpenSpaceTest "Unit Tests") diff --git a/tests/basicvolume.rawvolume b/tests/basicvolume.rawvolume new file mode 100644 index 0000000000..2ee491bde0 Binary files /dev/null and b/tests/basicvolume.rawvolume differ diff --git a/tests/main.cpp b/tests/main.cpp index 79b203b95e..69319043d3 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,144 +22,50 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#if defined(WIN32) -#pragma warning (push) -#pragma warning (disable : 4619) // #pragma warning: there is no warning number '4800' -#elif defined(__clang__) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wundef" -#pragma clang diagnostic ignored "-Wmissing-noreturn" -#pragma clang diagnostic ignored "-Wshift-sign-overflow" -#pragma clang diagnostic ignored "-Wsign-compare" -#pragma clang diagnostic ignored "-Wused-but-marked-unused" -#elif defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wundef" -#pragma GCC diagnostic ignored "-Wmissing-noreturn" -#pragma GCC diagnostic ignored "-Wsign-compare" -#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" -#pragma GCC diagnostic ignored "-Wsuggest-override" -#endif // __GNUC__ - -#include "gtest/gtest.h" - -// When running the unit tests we don't want to be asked what to do in the case of an -// assertion -#ifndef GHL_THROW_ON_ASSERT -#define GHL_THROW_ON_ASSERT -#endif // GHL_THROW_ON_ASSERTGHL_THROW_ON_ASSERT +#define CATCH_CONFIG_RUNNER +#include "catch2/catch.hpp" #include +#include #include #include #include #include #include +#include +#include #include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED -#include -#include -#include -#include -#include -#include -#endif - -#ifdef OPENSPACE_MODULE_ISWA_ENABLED -#include -#endif - -#ifdef OPENSPACE_MODULE_VOLUME_ENABLED -#include -#endif - -// Regression tests -#include - - - - -using namespace ghoul::filesystem; -using namespace ghoul::logging; - -//#define PRINT_OUTPUT - -namespace { - std::string _loggerCat = "OpenSpaceTest"; -} - int main(int argc, char** argv) { - std::vector args; + using namespace openspace; + ghoul::initialize(); - // Workaround for Visual Studio Google Test Adapter: - // Do not try to initialize osengine if gtest is just listing tests - std::vector gtestArgs(argv, argv + argc); - if (std::find(gtestArgs.begin(), gtestArgs.end(), "--gtest_list_tests") != gtestArgs.end()) { - using namespace openspace; - ghoul::initialize(); + // Register the path of the executable, + // to make it possible to find other files in the same directory. + FileSys.registerPathToken( + "${BIN}", + ghoul::filesystem::File(absPath(argv[0])).directoryName(), + ghoul::filesystem::FileSystem::Override::Yes + ); - std::string configFile = configuration::findConfiguration(); - global::configuration = configuration::loadConfigurationFromFile(configFile); - global::openSpaceEngine.initialize(); + std::string configFile = configuration::findConfiguration(); + global::configuration = configuration::loadConfigurationFromFile(configFile); + global::openSpaceEngine.registerPathTokens(); + global::openSpaceEngine.initialize(); - FileSys.registerPathToken("${TESTDIR}", "${BASE}/tests"); + FileSys.registerPathToken("${TESTDIR}", "${BASE}/tests"); - // All of the relevant tests initialize the SpiceManager - openspace::SpiceManager::deinitialize(); - } + // All of the relevant tests initialize the SpiceManager + openspace::SpiceManager::deinitialize(); - testing::InitGoogleTest(&argc, argv); + int result = Catch::Session().run(argc, argv); -#ifdef PRINT_OUTPUT - testing::internal::CaptureStdout(); - testing::internal::CaptureStderr(); -#endif - -#ifdef PRINT_OUTPUT - - // Stop capturing std out - std::string output = testing::internal::GetCapturedStdout(); - std::string error = testing::internal::GetCapturedStderr(); - - //std::cout << output; - //std::cerr << error; -#endif - - //openspace::SpiceManager::deinitialize(); - - bool b = RUN_ALL_TESTS(); - -#ifdef PRINT_OUTPUT - std::string output = testing::internal::GetCapturedStdout(); - std::string error = testing::internal::GetCapturedStderr(); - - std::ofstream o("output.txt"); - o << output; - - std::ofstream e("error.txt"); - e << error; -#endif - return b; + // And the deinitialization needs the SpiceManager to be initialized + openspace::SpiceManager::initialize(); + global::openSpaceEngine.deinitialize(); + return result; } - -#ifdef WIN32 -#pragma warning (pop) -#elif defined(__clang__) -#pragma clang diagnostic pop -#elif defined(__GNUC__) -#pragma GCC diagnostic pop -#endif // __GNUC__ diff --git a/tests/regression/517.inl b/tests/regression/517.cpp similarity index 91% rename from tests/regression/517.inl rename to tests/regression/517.cpp index 8ffeea5e4f..d1b8e6c079 100644 --- a/tests/regression/517.inl +++ b/tests/regression/517.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,20 +22,20 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include "catch2/catch.hpp" + #include -class Issue527 : public testing::Test {}; - -TEST_F(Issue527, Regression) { +TEST_CASE("Regression: 527", "[regression]") { // Error in OptionProperty if values not starting at 0 are used - openspace::properties::OptionProperty p({ "id", "gui", "desc"}); + openspace::properties::OptionProperty p({ "id", "gui", "desc" }); p.addOptions({ { -1, "a" }, { -2, "b" } - }); + }); p = -1; - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().description == "a"); } diff --git a/tests/test_angle.inl b/tests/test_angle.inl deleted file mode 100644 index be4dcf5e1e..0000000000 --- a/tests/test_angle.inl +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2019 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -//#include -//#include -// -//#include -//#include -// -//class AngleTest : public testing::Test {}; -// -//TEST_F(AngleTest, DoubleConversions) { -// using namespace openspace::globebrowsing; -// -// ASSERT_EQ(dAngle::fromRadians(0).asDegrees(), 0) << "from radians to degrees"; -// ASSERT_EQ(dAngle::HALF.asDegrees(), 180) << "from radians to degrees"; -// ASSERT_EQ(dAngle::fromDegrees(180).asRadians(), glm::pi()) << "from degrees to radians"; -// -//} -// -//TEST_F(AngleTest, FloatConversions) { -// using namespace openspace::globebrowsing; -// -// ASSERT_EQ(fAngle::ZERO.asDegrees(), 0.0) << "from radians to degrees"; -// ASSERT_EQ(fAngle::HALF.asDegrees(), 180.0) << "from radians to degrees"; -// ASSERT_EQ(fAngle::fromDegrees(180).asRadians(), glm::pi()) << "from degrees to radians"; -// -//} -// -// -//TEST_F(AngleTest, Normalize) { -// using namespace openspace::globebrowsing; -// -// ASSERT_NEAR( -// dAngle::fromDegrees(390).normalize().asDegrees(), -// 30.0, -// dAngle::EPSILON -// ) << "normalize to [0, 360]"; -// -// -// dAngle a = dAngle::fromDegrees(190); -// a.normalizeAround(dAngle::ZERO); -// ASSERT_NEAR( -// a.asDegrees(), -// -170, -// dAngle::EPSILON -// ) << "normalize to [-180,180]"; -// -// -// dAngle b = dAngle::fromDegrees(190); -// b.normalizeAround(dAngle::fromDegrees(90)); -// ASSERT_NEAR( -// b.asDegrees(), -// 190, -// dAngle::EPSILON -// ) << "normalize to [-90,270]"; -// -// -// dAngle c = dAngle::fromDegrees(360); -// c.normalizeAround(dAngle::fromDegrees(1083.2)); -// ASSERT_NEAR( -// c.asDegrees(), -// 1080, -// dAngle::EPSILON -// ) << "normalize to [903.2, 1263.2]"; -//} -// -// -//TEST_F(AngleTest, Clamp) { -// using namespace openspace::globebrowsing; -// -// ASSERT_EQ( -// dAngle::fromDegrees(390).clamp(dAngle::ZERO, dAngle::HALF).asDegrees(), -// 180 -// ) << "clamp [0, 180]"; -// -// ASSERT_EQ( -// dAngle::fromDegrees(390).clamp(dAngle::ZERO, dAngle::FULL).asDegrees(), -// 360 -// ) << "clamp [0, 360]"; -//} -// -// -//TEST_F(AngleTest, ConstClamp) { -// using namespace openspace::globebrowsing; -// -// const dAngle a = dAngle::fromDegrees(390); -// ASSERT_EQ( -// a.getClamped(dAngle::ZERO, dAngle::HALF).asDegrees(), -// 180 -// ) << "clamp [0, 180]"; -// -// const dAngle b = dAngle::fromDegrees(390); -// ASSERT_EQ( -// b.getClamped(dAngle::ZERO, dAngle::FULL).asDegrees(), -// 360 -// ) << "clamp [0, 360]"; -//} diff --git a/tests/test_assetloader.inl b/tests/test_assetloader.cpp similarity index 50% rename from tests/test_assetloader.inl rename to tests/test_assetloader.cpp index 545c7aae9a..59aa57da43 100644 --- a/tests/test_assetloader.inl +++ b/tests/test_assetloader.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,127 +22,90 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "gtest/gtest.h" +#include "catch2/catch.hpp" + +#include +#include +#include #include #include - #include #include #include #include #include -#include - -#include - -#include -#include - -#include #include - +#include +#include #include #include -#include -//#include -#include - class AssetLoaderTest; namespace { -int passTest(lua_State* state); + int passTest(lua_State* state) { + bool* test = reinterpret_cast(lua_touserdata(state, lua_upvalueindex(1))); + *test = true; + return 0; + } +} // namespace + +TEST_CASE("AssetLoader: Assertion", "[assetloader]") { + openspace::Scene scene(std::make_unique()); + ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState(); + openspace::SynchronizationWatcher syncWatcher; + openspace::AssetLoader assetLoader( + state, + &syncWatcher, + FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/") + ); + + REQUIRE_NOTHROW(assetLoader.add("passassertion")); + REQUIRE_NOTHROW(assetLoader.add("failassertion")); } -class AssetLoaderTest : public ::testing::Test { -public: - void pass() { - _passedTest = true; - } +TEST_CASE("AssetLoader: Basic Export Import", "[assetloader]") { + openspace::Scene scene(std::make_unique()); + ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState(); + openspace::SynchronizationWatcher syncWatcher; + openspace::AssetLoader assetLoader( + state, + &syncWatcher, + FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/") + ); - bool passed() { - return _passedTest; - } - -protected: - virtual void SetUp() { - _scene = std::make_unique( - std::make_unique() - ); - ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState(); - openspace::global::scriptEngine.initialize(); - _syncWatcher = std::make_unique(); - _assetLoader = std::make_unique( - *state, - _syncWatcher.get(), - FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/") - ); - - _passedTest = false; - lua_pushlightuserdata(*state, this); - lua_pushcclosure(*state, &passTest, 1); - lua_setglobal(*state, "passTest"); - } - - virtual void TearDown() { - openspace::global::scriptEngine.deinitialize(); - } - - std::unique_ptr _scene; - std::unique_ptr _assetLoader; - std::unique_ptr _syncWatcher; - bool _passedTest; -}; - -namespace { -int passTest(lua_State* state) { - AssetLoaderTest *test = - reinterpret_cast(lua_touserdata(state, lua_upvalueindex(1))); - test->pass(); - return 0; -} + REQUIRE_NOTHROW(assetLoader.add("require")); } -TEST_F(AssetLoaderTest, Assertions) { - EXPECT_NO_THROW(_assetLoader->add("passassertion")); - EXPECT_NO_THROW(_assetLoader->add("failassertion")); +TEST_CASE("AssetLoader: Asset Functions", "[assetloader]") { + openspace::Scene scene(std::make_unique()); + ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState(); + openspace::SynchronizationWatcher syncWatcher; + openspace::AssetLoader assetLoader( + state, + &syncWatcher, + FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/") + ); + + REQUIRE_NOTHROW(assetLoader.add("assetfunctionsexist")); } -TEST_F(AssetLoaderTest, BasicExportImport) { - try { - _assetLoader->add("require"); - } - catch (const std::exception& e) { - EXPECT_TRUE(false) << e.what(); - } +TEST_CASE("AssetLoader: Asset Initialization", "[assetloader]") { + openspace::Scene scene(std::make_unique()); + ghoul::lua::LuaState* state = openspace::global::scriptEngine.luaState(); + openspace::SynchronizationWatcher syncWatcher; + openspace::AssetLoader assetLoader( + state, + &syncWatcher, + FileSys.absolutePath("${TESTDIR}/AssetLoaderTest/") + ); + + bool passed; + lua_pushlightuserdata(*state, &passed); + lua_pushcclosure(*state, &passTest, 1); + lua_setglobal(*state, "passTest"); + + std::shared_ptr asset = assetLoader.add("initialization"); + REQUIRE_NOTHROW(asset->initialize()); + REQUIRE(passed); } - -TEST_F(AssetLoaderTest, AssetFunctions) { - try { - _assetLoader->add("assetfunctionsexist"); - } catch (const std::exception& e) { - EXPECT_TRUE(false) << e.what(); - } -} - -TEST_F(AssetLoaderTest, DependencyFunctions) { - try { - _assetLoader->add("dependencyfunctionsexist"); - } - catch (const std::exception& e) { - EXPECT_TRUE(false) << e.what(); - } -} - -TEST_F(AssetLoaderTest, AssetInitialization) { - try { - std::shared_ptr asset = _assetLoader->add("initialization"); - asset->initialize(); - EXPECT_TRUE(passed()); - } - catch (const std::exception& e) { - EXPECT_TRUE(false) << e.what(); - } -} - - diff --git a/tests/test_chunknode.inl b/tests/test_chunknode.inl deleted file mode 100644 index 114f256a82..0000000000 --- a/tests/test_chunknode.inl +++ /dev/null @@ -1,83 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2019 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include -#include -#include - -#include -#include - -using namespace openspace; - -class ChunkNodeTest : public testing::Test {}; - -/* -TEST_F(ChunkNodeTest, Split) { - - ghoul::Dictionary dict; - ChunkLodGlobe chunkLodNode(dict); - chunkLodNode.initialize(); - - BoundingRect bounds(Vec2(2, 2), Vec2(2, 2)); - ChunkNode cn(chunkLodNode,bounds); - ASSERT_TRUE(cn.isRoot()) << "Chunk node is root"; - ASSERT_TRUE(cn.isLeaf()) << "Chunk node is leaf"; - - cn.split(); - ASSERT_TRUE(cn.isRoot()) << "Chunk node is root"; - ASSERT_FALSE(cn.isLeaf()) << "Chunk node is not leaf"; - - ASSERT_EQ(cn.bounds.center.x, cn.child(Quad::NORTH_WEST).bounds.center.x * 2); - ASSERT_EQ(cn.bounds.center.x, cn.child(Quad::NORTH_EAST).bounds.center.x * 2/3); - - ASSERT_EQ(cn.bounds.halfSize.x, cn.child(Quad::NORTH_WEST).bounds.halfSize.x * 2); - ASSERT_EQ(cn.bounds.halfSize.y, cn.child(Quad::NORTH_WEST).bounds.halfSize.y * 2); - - chunkLodNode.deinitialize(); -} - -TEST_F(ChunkNodeTest, Merge) { - ghoul::Dictionary dict; - ChunkLodGlobe chunkLodNode(dict); - chunkLodNode.initialize(); - - - BoundingRect bounds(Vec2(2, 2), Vec2(2, 2)); - ChunkNode cn(chunkLodNode,bounds); - ASSERT_TRUE(cn.isRoot()) << "Chunk node is root"; - ASSERT_TRUE(cn.isLeaf()) << "Chunk node is leaf"; - - cn.split(); - ASSERT_TRUE(cn.isRoot()) << "Chunk node is root"; - ASSERT_FALSE(cn.isLeaf()) << "Chunk node is not leaf"; - - cn.merge(); - ASSERT_TRUE(cn.isRoot()) << "Chunk node is root"; - ASSERT_TRUE(cn.isLeaf()) << "Chunk node is leaf"; - - chunkLodNode.deinitialize(); - -} -*/ \ No newline at end of file diff --git a/tests/test_common.inl b/tests/test_common.inl deleted file mode 100644 index 62dd62ba43..0000000000 --- a/tests/test_common.inl +++ /dev/null @@ -1,110 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2019 * - * * - * 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. * - ****************************************************************************************/ - -#ifdef GHL_TIMING_TESTS - -#ifdef WIN32 -#define START_TIMER(__name__, __stream__, __num__) \ - __stream__ << #__name__; \ - double __name__##Total = 0.0; \ - unsigned int __name__##Num = 0; \ - for (__name__##Num = 0; __name__##Num < __num__; ++__name__##Num) { \ - reset(); \ - LARGE_INTEGER __name__##Start; \ - LARGE_INTEGER __name__##End; \ - QueryPerformanceCounter(&__name__##Start) - -#define START_TIMER_NO_RESET(__name__, __stream__, __num__) \ - __stream__ << #__name__; \ - double __name__##Total = 0.0; \ - unsigned int __name__##Num = 0; \ - for (__name__##Num = 0; __name__##Num < __num__; ++__name__##Num) { \ - LARGE_INTEGER __name__##Start; \ - LARGE_INTEGER __name__##End; \ - QueryPerformanceCounter(&__name__##Start) - -#define START_TIMER_PREPARE(__name__, __stream__, __num__, __prepare__) \ - __stream__ << #__name__; \ - double __name__##Total = 0.0; \ - unsigned int __name__##Num = 0; \ - for (__name__##Num = 0; __name__##Num < __num__; ++__name__##Num) { \ - reset(); \ - __prepare__; \ - LARGE_INTEGER __name__##Start; \ - LARGE_INTEGER __name__##End; \ - QueryPerformanceCounter(&__name__##Start) - -#define FINISH_TIMER(__name__, __stream__) \ - QueryPerformanceCounter(&__name__##End); \ - LARGE_INTEGER freq; \ - QueryPerformanceFrequency(&freq); \ - const double freqD = double(freq.QuadPart) / 1000000.0; \ - const double res = ((__name__##End.QuadPart - __name__##Start.QuadPart) / freqD);\ - __name__##Total += res; \ - } \ - __stream__ << '\t' << __name__##Total / __name__##Num << "us\n"; - -#else - -#include - -#define START_TIMER(__name__, __stream__, __num__) \ - __stream__ << #__name__; \ - std::chrono::nanoseconds __name__##Total = std::chrono::nanoseconds(0); \ - unsigned int __name__##Num = 0; \ - for (__name__##Num = 0; __name__##Num < __num__; ++__name__##Num) { \ - reset(); \ - std::chrono::high_resolution_clock::time_point __name__##End; \ - std::chrono::high_resolution_clock::time_point __name__##Start = \ - std::chrono::high_resolution_clock::now() - -#define START_TIMER_NO_RESET(__name__, __stream__, __num__) \ - __stream__ << #__name__; \ - std::chrono::nanoseconds __name__##Total = std::chrono::nanoseconds(0); \ - unsigned int __name__##Num = 0; \ - for (__name__##Num = 0; __name__##Num < __num__; ++__name__##Num) { \ - std::chrono::high_resolution_clock::time_point __name__##End; \ - std::chrono::high_resolution_clock::time_point __name__##Start = \ - std::chrono::high_resolution_clock::now() - -#define START_TIMER_PREPARE(__name__, __stream__, __num__, __prepare__) \ - __stream__ << #__name__; \ - std::chrono::nanoseconds __name__##Total = std::chrono::nanoseconds(0); \ - unsigned int __name__##Num = 0; \ - for (__name__##Num = 0; __name__##Num < __num__; ++__name__##Num) { \ - reset(); \ - __prepare__; \ - std::chrono::high_resolution_clock::time_point __name__##End; \ - std::chrono::high_resolution_clock::time_point __name__##Start = \ - std::chrono::high_resolution_clock::now() - -#define FINISH_TIMER(__name__, __stream__) \ - __name__##End = std::chrono::high_resolution_clock::now(); \ - const std::chrono::nanoseconds d = __name__##End - __name__##Start; \ - __name__##Total += d; \ - } \ - __stream__ << #__name__ << '\t' << __name__##Total.count() / 1000.0 << "us" << '\n'; -#endif - -#endif // GHL_TIMING_TESTS diff --git a/tests/test_concurrentjobmanager.inl b/tests/test_concurrentjobmanager.cpp similarity index 58% rename from tests/test_concurrentjobmanager.inl rename to tests/test_concurrentjobmanager.cpp index 901e8c7efd..ec91ee5c23 100644 --- a/tests/test_concurrentjobmanager.inl +++ b/tests/test_concurrentjobmanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,44 +22,64 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ - -#include "gtest/gtest.h" +#include "catch2/catch.hpp" #include - #include - -#define _USE_MATH_DEFINES -#include #include -class ConcurrentJobManagerTest : public testing::Test {}; +namespace { + struct TestJob : public openspace::Job { + TestJob(int jobExecutingTime) + : _jobExecutingTime(jobExecutingTime) + {} -struct TestJob : public openspace::Job { - TestJob(int jobExecutingTime) - : _jobExecutingTime(jobExecutingTime) - {} + virtual void execute() { + std::this_thread::sleep_for(std::chrono::milliseconds(_jobExecutingTime)); + prod = 1337; + } - virtual void execute() { - std::cout << "Executing job ... " << std::endl; - std::this_thread::sleep_for(std::chrono::milliseconds(_jobExecutingTime)); - - prod = 1337; - std::cout << "Finished job" << std::endl; - } + virtual int product() { + return int(prod); + } - virtual int product() { - return int(prod); - } - -private: - int _jobExecutingTime; - int prod; -}; + private: + int _jobExecutingTime; + int prod; + }; + struct VerboseProduct { + VerboseProduct(int v) : val(v) {} -TEST_F(ConcurrentJobManagerTest, Basic) { + ~VerboseProduct() {} + + int val; + }; + + + struct VerboseJob : public openspace::Job { + VerboseJob(int jobExecutingTime) + : _jobExecutingTime(jobExecutingTime) + , _product(-1) + {} + + virtual void execute() { + std::this_thread::sleep_for(std::chrono::milliseconds(_jobExecutingTime)); + _product = VerboseProduct(1337); + } + + virtual VerboseProduct product() { + return _product; + } + + int _jobExecutingTime; + VerboseProduct _product; + }; + +} // namespace + +TEST_CASE("ConcurrentJobmanager: Basic", "[concurrentjobmanager]") { using namespace openspace; ConcurrentJobManager jobManager(ThreadPool(1)); @@ -71,82 +91,36 @@ TEST_F(ConcurrentJobManagerTest, Basic) { jobManager.enqueueJob(testJob2); std::this_thread::sleep_for(std::chrono::milliseconds(10)); - EXPECT_EQ(jobManager.numFinishedJobs(), 0) << "A 20ms job should not be done after 10ms"; + REQUIRE(jobManager.numFinishedJobs() == 0); std::this_thread::sleep_for(std::chrono::milliseconds(20)); - - EXPECT_EQ(jobManager.numFinishedJobs(), 1) << "A 20ms job should be done after 10+20 ms"; + + REQUIRE(jobManager.numFinishedJobs() == 1); std::this_thread::sleep_for(std::chrono::milliseconds(20)); - EXPECT_EQ(jobManager.numFinishedJobs(), 2) << "A 20ms job and a 20ms job should be done after 10+20+20 ms"; - + REQUIRE(jobManager.numFinishedJobs() == 2); auto finishedJob = jobManager.popFinishedJob(); int product = finishedJob->product(); - EXPECT_EQ(product, 1337) << "Expecting product to be 1337"; + REQUIRE(product == 1337); } -struct VerboseProduct { - VerboseProduct(int v) - : val(v) { - std::cout << "VerboseProduct constructor" << std::endl; - } - - ~VerboseProduct() { - std::cout << "VerboseProduct destructor" << std::endl; - } - - int val; -}; - - -struct VerboseJob : public openspace::Job { - VerboseJob(int jobExecutingTime) - : _jobExecutingTime(jobExecutingTime) - , _product(-1) - { - std::cout << "VerboseTestJob constructor" << std::endl; - } - - ~VerboseJob() { - std::cout << "VerboseTestJob destructor" << std::endl; - } - - virtual void execute() { - std::cout << " ** Executing job ... " << std::endl; - std::this_thread::sleep_for(std::chrono::milliseconds(_jobExecutingTime)); - _product = VerboseProduct(1337); - std::cout << " ** Finished job" << std::endl; - } - - virtual VerboseProduct product() { - return _product; - } - - int _jobExecutingTime; - VerboseProduct _product; - -}; - -TEST_F(ConcurrentJobManagerTest, JobCreation) { +TEST_CASE("ConcurrentJobmanager: Job Creation", "[concurrentjobmanager]") { using namespace openspace; - + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); ConcurrentJobManager jobManager(ThreadPool(1)); - auto testJob1 = std::shared_ptr(new VerboseJob(20)); jobManager.enqueueJob(testJob1); std::this_thread::sleep_for(std::chrono::milliseconds(10)); - EXPECT_EQ(jobManager.numFinishedJobs(), 0) << "A 20ms job should not be done after 10ms"; + REQUIRE(jobManager.numFinishedJobs() == 0); std::this_thread::sleep_for(std::chrono::milliseconds(20)); - - EXPECT_EQ(jobManager.numFinishedJobs(), 1) << "A 20ms job should be done after 10+20 ms"; - + REQUIRE(jobManager.numFinishedJobs() == 1); auto finishedJob = jobManager.popFinishedJob(); { diff --git a/tests/test_concurrentqueue.inl b/tests/test_concurrentqueue.cpp similarity index 80% rename from tests/test_concurrentqueue.inl rename to tests/test_concurrentqueue.cpp index cab11de5a2..b9d66981e0 100644 --- a/tests/test_concurrentqueue.inl +++ b/tests/test_concurrentqueue.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,32 +22,15 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "gtest/gtest.h" +#include "catch2/catch.hpp" #include -#define _USE_MATH_DEFINES -#include -#include - -class ConcurrentQueueTest : public testing::Test {}; - -TEST_F(ConcurrentQueueTest, Basic) { +TEST_CASE("ConcurrentQueue: Basic", "[concurrentqueue]") { using namespace openspace; ConcurrentQueue q1; q1.push(4); int val = q1.pop(); - std::cout << val << std::endl; + REQUIRE(val == 4); } - -/* -TEST_F(ConcurrentQueueTest, SharedPtr) { - ConcurrentQueue> q1; - std::shared_ptr i1 = std::shared_ptr(new int(1337)); - - q1.push(i1); - auto val = q1.pop(); - std::cout << *val << std::endl; -} -*/ diff --git a/tests/test_configurationmanager.inl b/tests/test_configurationmanager.inl deleted file mode 100644 index 419296f7e5..0000000000 --- a/tests/test_configurationmanager.inl +++ /dev/null @@ -1,1116 +0,0 @@ -/***************************************************************************************** - * * - * GHOUL * - * General Helpful Open Utility Library * - * * - * Copyright (c) 2012-2018 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include -#include -#include -#include -#include - -namespace { - // A non-existing configuration file - const std::string _configuration0 = "${TEST_DIR}/configurationmanager/test0.cfg"; - - // The configuration1 test configuration has one key "t" = 1 - const std::string _configuration1 = "${TEST_DIR}/configurationmanager/test1.cfg"; - - // The configuration1 test configuration has two keys "t" and "s" - const std::string _configuration2 = "${TEST_DIR}/configurationmanager/test2.cfg"; - - // More complicated configuration file with nested tables - const std::string _configuration3 = "${TEST_DIR}/configurationmanager/test3.cfg"; - - // Deeply nested configuration file with 12 level - const std::string _configuration4 = "${TEST_DIR}/configurationmanager/test4.cfg"; - - // Testfile with glm::vecX, glm::matX - const std::string _configuration5 = "${TEST_DIR}/configurationmanager/test5.cfg"; -} - -/* -Test checklist: ---- loadConfiguration: existing file ---- loadConfiguration: non-existing file ---- getValue: key does not exist ---- getValue: subtable does not exist ---- getValue: overriding previous configuration ---- getValue: function does not change passed value on error ---- getValue: nested keys ---- getValue: deep nesting of keys ---- getValue: correct values returned for each type ---- getValue: are all basic types implemented ---- getValue: glm::vec2, glm::vec3, glm::vec4 implemented ---- getValue: glm::matXxY implemented ---- getValue: valid conversions ---- setValue: all types implemented ---- setValue: create subtables on the way ---- setValue: value gets set correctly for each type ---- setValue: value overwrites setting in configuration file ---- setValue: deep nesting of keys ---- setValue: nested keys ---- setValue: glm::vec2, glm::vec3, glm::vec4, glm::mat3, glm::mat4 implemented ---- hasKeys: deep nesting of keys ---- hasKeys: subtables on the way do not exist ---- hasKeys: correct values for all types ---- hasKeys: nestedKeys ---- timing -*/ - -class ConfigurationManagerTest : public testing::Test { -protected: - ConfigurationManagerTest() { - _m = new ghoul::ConfigurationManager; - } - - ~ConfigurationManagerTest() { - if (_m) { - delete _m; - _m = nullptr; - } - } - - void reset() { - _m->clear(); - } - - ghoul::ConfigurationManager* _m; -}; - -#ifdef GHL_TIMING_TESTS - -TEST_F(ConfigurationManagerTest, TimingTest) { - std::ofstream logFile("ConfigurationManagerTest.timing"); - - START_TIMER(loadConfiguration1, logFile, 25); - _m->loadConfiguration(_configuration1); - FINISH_TIMER(loadConfiguration1, logFile); - - START_TIMER(loadConfiguration2, logFile, 25); - _m->loadConfiguration(_configuration2); - FINISH_TIMER(loadConfiguration2, logFile); - - START_TIMER(loadConfiguration3, logFile, 25); - _m->loadConfiguration(_configuration3); - FINISH_TIMER(loadConfiguration3, logFile); - - START_TIMER(loadConfiguration4, logFile, 25); - _m->loadConfiguration(_configuration4); - FINISH_TIMER(loadConfiguration4, logFile); - - START_TIMER(loadConfiguration5, logFile, 25); - _m->loadConfiguration(_configuration5); - FINISH_TIMER(loadConfiguration5, logFile); - - START_TIMER(loadConfiguration12, logFile, 25); - _m->loadConfiguration(_configuration1); - _m->loadConfiguration(_configuration2); - FINISH_TIMER(loadConfiguration12, logFile); - - START_TIMER(loadConfiguration123, logFile, 25); - _m->loadConfiguration(_configuration1); - _m->loadConfiguration(_configuration2); - _m->loadConfiguration(_configuration3); - FINISH_TIMER(loadConfiguration123, logFile); - - START_TIMER(loadConfiguration1234, logFile, 25); - _m->loadConfiguration(_configuration1); - _m->loadConfiguration(_configuration2); - _m->loadConfiguration(_configuration3); - _m->loadConfiguration(_configuration4); - FINISH_TIMER(loadConfiguration1234, logFile); - - START_TIMER(loadConfiguration12345, logFile, 25); - _m->loadConfiguration(_configuration1); - _m->loadConfiguration(_configuration2); - _m->loadConfiguration(_configuration3); - _m->loadConfiguration(_configuration4); - _m->loadConfiguration(_configuration5); - FINISH_TIMER(loadConfiguration12345, logFile); - - START_TIMER(setValueLevel0Int, logFile, 25); - _m->setValue("t", 1); - FINISH_TIMER(setValueLevel0Int, logFile); - - START_TIMER(setValueLevel1Int, logFile, 25); - _m->setValue("t.t", 1); - FINISH_TIMER(setValueLevel1Int, logFile); - - START_TIMER(setValueLevel10Int, logFile, 25); - _m->setValue("t.t.t.t.t.t.t.t.t.t", 1); - FINISH_TIMER(setValueLevel10Int, logFile); - - START_TIMER(setValueLevel0dvec4, logFile, 25); - _m->setValue("t", glm::dvec4(1.0)); - FINISH_TIMER(setValueLevel0dvec4, logFile); - - START_TIMER(setValueLevel0dmat4, logFile, 25); - _m->setValue("t", glm::dmat4(1.0)); - FINISH_TIMER(setValueLevel0dmat4, logFile); - - { - int i; - START_TIMER_PREPARE(getValueLevel0Int, logFile, 25, {_m->setValue("t", 1);}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel0Int, logFile); - - START_TIMER(getValueLevel0IntEmpty, logFile, 25); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel0IntEmpty, logFile); - - START_TIMER_PREPARE(getValueLevel1Int, logFile, 25, {_m->setValue("t.t", 1);}); - _m->getValue("t.t", i); - FINISH_TIMER(getValueLevel1Int, logFile); - - START_TIMER_PREPARE(getValueLevel10Int, logFile, 25, - {_m->setValue("t.t.t.t.t.t.t.t.t.t", 1);}); - _m->getValue("t.t.t.t.t.t.t.t.t.t", i); - FINISH_TIMER(getValueLevel10Int, logFile); - - START_TIMER(getValueLevel10IntEmpty, logFile, 25); - _m->getValue("t.t.t.t.t.t.t.t.t.t", i); - FINISH_TIMER(getValueLevel10IntEmpty, logFile); - } - - { - START_TIMER(setValueLevel1vec2, logFile, 25); - _m->setValue("t", glm::vec2(1.0)); - FINISH_TIMER(setValueLevel1vec2, logFile); - } - { - START_TIMER(setValueLevel1vec3, logFile, 25); - _m->setValue("t", glm::vec3(1.0)); - FINISH_TIMER(setValueLevel1vec3, logFile); - } - { - START_TIMER(setValueLevel1vec4, logFile, 25); - _m->setValue("t", glm::vec4(1.0)); - FINISH_TIMER(setValueLevel1vec4, logFile); - } - { - START_TIMER(setValueLevel1dvec2, logFile, 25); - _m->setValue("t", glm::dvec2(1.0)); - FINISH_TIMER(setValueLevel1dvec2, logFile); - } - { - START_TIMER(setValueLevel1dvec3, logFile, 25); - _m->setValue("t", glm::dvec3(1.0)); - FINISH_TIMER(setValueLevel1dvec3, logFile); - } - { - START_TIMER(setValueLevel1dvec4, logFile, 25); - _m->setValue("t", glm::dvec4(1.0)); - FINISH_TIMER(setValueLevel1dvec4, logFile); - } - { - START_TIMER(setValueLevel1ivec2, logFile, 25); - _m->setValue("t", glm::ivec2(1.0)); - FINISH_TIMER(setValueLevel1ivec2, logFile); - } - { - START_TIMER(setValueLevel1ivec3, logFile, 25); - _m->setValue("t", glm::ivec3(1.0)); - FINISH_TIMER(setValueLevel1ivec3, logFile); - } - { - START_TIMER(setValueLevel1ivec4, logFile, 25); - _m->setValue("t", glm::ivec4(1.0)); - FINISH_TIMER(setValueLevel1ivec4, logFile); - } - { - START_TIMER(setValueLevel1bvec2, logFile, 25); - _m->setValue("t", glm::bvec2(true)); - FINISH_TIMER(setValueLevel1bvec2, logFile); - } - { - START_TIMER(setValueLevel1bvec3, logFile, 25); - _m->setValue("t", glm::bvec3(true)); - FINISH_TIMER(setValueLevel1bvec3, logFile); - } - { - START_TIMER(setValueLevel1bvec4, logFile, 25); - _m->setValue("t", glm::bvec4(true)); - FINISH_TIMER(setValueLevel1bvec4, logFile); - } - { - START_TIMER(setValueLevel1uvec2, logFile, 25); - _m->setValue("t", glm::uvec2(1.0)); - FINISH_TIMER(setValueLevel1uvec2, logFile); - } - { - START_TIMER(setValueLevel1uvec3, logFile, 25); - _m->setValue("t", glm::uvec3(1.0)); - FINISH_TIMER(setValueLevel1uvec3, logFile); - } - { - START_TIMER(setValueLevel1uvec4, logFile, 25); - _m->setValue("t", glm::uvec4(1.0)); - FINISH_TIMER(setValueLevel1uvec4, logFile); - } - { - START_TIMER(setValueLevel1dmat2x4, logFile, 25); - _m->setValue("t", glm::dmat2x4(1.0)); - FINISH_TIMER(setValueLevel1dmat2x4, logFile); - } - { - START_TIMER(setValueLevel1dmat2x3, logFile, 25); - _m->setValue("t", glm::dmat2x3(1.0)); - FINISH_TIMER(setValueLevel1dmat2x3, logFile); - } - { - START_TIMER(setValueLevel1dmat2, logFile, 25); - _m->setValue("t", glm::dmat2(1.0)); - FINISH_TIMER(setValueLevel1dmat2, logFile); - } - { - START_TIMER(setValueLevel1dmat3x2, logFile, 25); - _m->setValue("t", glm::dmat3x2(1.0)); - FINISH_TIMER(setValueLevel1dmat3x2, logFile); - } - { - START_TIMER(setValueLevel1dmat3x4, logFile, 25); - _m->setValue("t", glm::dmat3x4(1.0)); - FINISH_TIMER(setValueLevel1dmat3x4, logFile); - } - { - START_TIMER(setValueLevel1dmat3, logFile, 25); - _m->setValue("t", glm::dmat3(1.0)); - FINISH_TIMER(setValueLevel1dmat3, logFile); - } - { - START_TIMER(setValueLevel1dmat4x2, logFile, 25); - _m->setValue("t", glm::dmat4x3(1.0)); - FINISH_TIMER(setValueLevel1dmat4x2, logFile); - } - { - START_TIMER(setValueLevel1dmat4x3, logFile, 25); - _m->setValue("t", glm::dmat4x3(1.0)); - FINISH_TIMER(setValueLevel1dmat4x3, logFile); - } - { - START_TIMER(setValueLevel1dmat4, logFile, 25); - _m->setValue("t", glm::dmat4(1.0)); - FINISH_TIMER(setValueLevel1dmat4, logFile); - } - - { - glm::vec2 i; - START_TIMER_PREPARE(getValueLevel1vec2, logFile, 25, - {_m->setValue("t", glm::vec2(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1vec2, logFile); - } - { - glm::vec3 i; - START_TIMER_PREPARE(getValueLevel1vec3, logFile, 25, - {_m->setValue("t", glm::vec3(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1vec3, logFile); - } - { - glm::vec4 i; - START_TIMER_PREPARE(getValueLevel1vec4, logFile, 25, - {_m->setValue("t", glm::vec4(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1vec4, logFile); - } - { - glm::dvec2 i; - START_TIMER_PREPARE(getValueLevel1dvec2, logFile, 25, - {_m->setValue("t", glm::dvec2(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dvec2, logFile); - } - { - glm::dvec3 i; - START_TIMER_PREPARE(getValueLevel1dvec3, logFile, 25, - {_m->setValue("t", glm::dvec3(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dvec3, logFile); - } - { - glm::dvec4 i; - START_TIMER_PREPARE(getValueLevel1dvec4, logFile, 25, - {_m->setValue("t", glm::dvec4(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dvec4, logFile); - } - { - glm::ivec2 i; - START_TIMER_PREPARE(getValueLevel1ivec2, logFile, 25, - {_m->setValue("t", glm::ivec2(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1ivec2, logFile); - } - { - glm::ivec3 i; - START_TIMER_PREPARE(getValueLevel1ivec3, logFile, 25, - {_m->setValue("t", glm::ivec3(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1ivec3, logFile); - } - { - glm::ivec4 i; - START_TIMER_PREPARE(getValueLevel1ivec4, logFile, 25, - {_m->setValue("t", glm::ivec4(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1ivec4, logFile); - } - { - glm::bvec2 i; - START_TIMER_PREPARE(getValueLevel1bvec2, logFile, 25, - {_m->setValue("t", glm::bvec2(true));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1bvec2, logFile); - } - { - glm::bvec3 i; - START_TIMER_PREPARE(getValueLevel1bvec3, logFile, 25, - {_m->setValue("t", glm::bvec3(true));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1bvec3, logFile); - } - { - glm::bvec4 i; - START_TIMER_PREPARE(getValueLevel1bvec4, logFile, 25, - {_m->setValue("t", glm::bvec4(true));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1bvec4, logFile); - } - { - glm::uvec2 i; - START_TIMER_PREPARE(getValueLevel1uvec2, logFile, 25, - {_m->setValue("t", glm::uvec2(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1uvec2, logFile); - } - { - glm::uvec3 i; - START_TIMER_PREPARE(getValueLevel1uvec3, logFile, 25, - {_m->setValue("t", glm::uvec3(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1uvec3, logFile); - } - { - glm::uvec4 i; - START_TIMER_PREPARE(getValueLevel1uvec4, logFile, 25, - {_m->setValue("t", glm::uvec4(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1uvec4, logFile); - } - { - glm::dmat2x4 i; - START_TIMER_PREPARE(getValueLevel1dmat2x4, logFile, 25, - {_m->setValue("t", glm::dmat2x4(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dmat2x4, logFile); - } - { - glm::dmat2x3 i; - START_TIMER_PREPARE(getValueLevel1dmat2x3, logFile, 25, - {_m->setValue("t", glm::dmat2x3(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dmat2x3, logFile); - } - { - glm::dmat2 i; - START_TIMER_PREPARE(getValueLevel1dmat2, logFile, 25, - {_m->setValue("t", glm::dmat2(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dmat2, logFile); - } - { - glm::dmat3x2 i; - START_TIMER_PREPARE(getValueLevel1dmat3x2, logFile, 25, - {_m->setValue("t", glm::dmat3x2(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dmat3x2, logFile); - } - { - glm::dmat3x4 i; - START_TIMER_PREPARE(getValueLevel1dmat3x4, logFile, 25, - {_m->setValue("t", glm::dmat3x4(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dmat3x4, logFile); - } - { - glm::dmat3 i; - START_TIMER_PREPARE(getValueLevel1dmat3, logFile, 25, - {_m->setValue("t", glm::dmat3(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dmat3, logFile); - } - { - glm::dmat4x2 i; - START_TIMER_PREPARE(getValueLevel1dmat4x2, logFile, 25, - {_m->setValue("t", glm::dmat4x2(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dmat4x2, logFile); - } - { - glm::dmat4x3 i; - START_TIMER_PREPARE(getValueLevel1dmat4x3, logFile, 25, - {_m->setValue("t", glm::dmat4x3(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dmat4x3, logFile); - } - { - glm::dmat4 i; - START_TIMER_PREPARE(getValueLevel1dmat4, logFile, 25, - {_m->setValue("t", glm::dmat4(1.0));}); - _m->getValue("t", i); - FINISH_TIMER(getValueLevel1dmat4, logFile); - } - - START_TIMER(hasKeyLevel0Empty, logFile, 25); - _m->hasKey("t"); - FINISH_TIMER(hasKeyLevel0Empty, logFile); - - START_TIMER(hasKeyLevel10Empty, logFile, 25); - _m->hasKey("t.t.t.t.t.t.t.t.t.t"); - FINISH_TIMER(hasKeyLevel10Empty, logFile); - - START_TIMER_PREPARE(hasKeyLevel0, logFile, 25, {_m->setValue("t", 1);}); - _m->hasKey("t"); - FINISH_TIMER(hasKeyLevel0, logFile); - - START_TIMER_PREPARE(hasKeyLevel10, logFile, 25, - {_m->setValue("t.t.t.t.t.t.t.t.t.t", 1);}); - _m->hasKey("t.t.t.t.t.t.t.t.t.t"); - FINISH_TIMER(hasKeyLevel10, logFile); -} - -#endif // GHL_TIMING_TESTS - -TEST_F(ConfigurationManagerTest, ReinitTest) { - _m->setValue("t", int(2)); - _m->clear(); - const bool success = _m->hasKey("t"); - EXPECT_EQ(false, success); -} - -TEST_F(ConfigurationManagerTest, LoadConfigurationTest) { - const bool success0 = _m->loadConfiguration(_configuration0); - ASSERT_EQ(false, success0) << "Loading a non-existing file should fail gracefully"; - const bool success1 = _m->loadConfiguration(_configuration1); - ASSERT_EQ(true, success1) << "Loading of configuration file 'test1.cfg'"; - const bool success2 = _m->loadConfiguration(_configuration2); - ASSERT_EQ(true, success2) << "Loading of configuration file 'test2.cfg'"; - const bool success3 = _m->loadConfiguration(_configuration3); - ASSERT_EQ(true, success3) << "Loading of configuration file 'test3.cfg'"; - const bool success4 = _m->loadConfiguration(_configuration4); - ASSERT_EQ(true, success4) << "Loading of configuration file 'test4.cfg'"; -} - -TEST_F(ConfigurationManagerTest, KeysFunction) { - // The empty configuration should not have any keys - size_t nKeys = _m->keys().size(); - EXPECT_EQ(0, nKeys) << "The empty configuration should not have any keys"; - - _m->loadConfiguration(_configuration1); - nKeys = _m->keys().size(); - EXPECT_EQ(1, nKeys) << "test1"; - - _m->loadConfiguration(_configuration3); - nKeys = _m->keys().size(); - EXPECT_EQ(3, nKeys) << "base: test1 + test3"; - - nKeys = _m->keys("s").size(); - EXPECT_EQ(3, nKeys) << "s: test1 + test3"; - - nKeys = _m->keys("s.3").size(); - EXPECT_EQ(2, nKeys) << "s.3: test1 + test3"; - - _m->loadConfiguration(_configuration4); - - const char* keys[] = { - "a", "a.a", "a.a.a", "a.a.a.a", "a.a.a.a.a", "a.a.a.a.a.a", "a.a.a.a.a.a.a", - "a.a.a.a.a.a.a.a", "a.a.a.a.a.a.a.a.a", "a.a.a.a.a.a.a.a.a.a", - "a.a.a.a.a.a.a.a.a.a.a", "a.a.a.a.a.a.a.a.a.a.a.a" - }; - - for (int i = 0; i < 12; ++i) { - nKeys = _m->keys(keys[i]).size(); - EXPECT_EQ(2, nKeys) << keys[i] <<": test1 + test3"; - } - - for (int i = 0; i < 12; ++i) { - const bool hasKey = _m->hasKey(keys[i]); - EXPECT_EQ(true, hasKey) << keys[i] <<": test1 + test3"; - } - - - const char* keysB[] = { - "b", "b.b", "b.b.b", "b.b.b.b", "b.b.b.b.b", "b.b.b.b.b.b", "b.b.b.b.b.b.b", - "b.b.b.b.b.b.b.b", "b.b.b.b.b.b.b.b.b", "b.b.b.b.b.b.b.b.b.b", - "b.b.b.b.b.b.b.b.b.b.b", "b.b.b.b.b.b.b.b.b.b.b.b" - }; - _m->setValue(keysB[11], int(0), true); - for (int i = 0; i < 12; ++i) - EXPECT_EQ(true, _m->hasKey(keysB[i])) << keysB[i] <<": test1 + test3"; -} - -TEST_F(ConfigurationManagerTest, HasKeySubtable) { - _m->loadConfiguration(_configuration1); - const bool tSuccess = _m->hasKey("t"); - ASSERT_EQ(true, tSuccess) << "t"; - - const bool tsSuccess = _m->hasKey("t.s"); - EXPECT_EQ(false, tsSuccess) << "t.s"; - - const bool sSuccess = _m->hasKey("s"); - EXPECT_EQ(false, sSuccess) << "s"; - - const bool sxSuccess = _m->hasKey("s.x"); - EXPECT_EQ(false, sxSuccess) << "s.x"; -} - -TEST_F(ConfigurationManagerTest, HasKeyTypes) { - _m->setValue("t", ghoul::Dictionary()); - _m->setValue("t.bool", bool(1)); - _m->setValue("t.char", char(1)); - _m->setValue("t.unsignedchar", (unsigned char)(1)); - _m->setValue("t.signedchar", (signed char)(1)); - _m->setValue("t.wchar", wchar_t(1)); - _m->setValue("t.short", short(1)); - _m->setValue("t.unsignedshort", (unsigned short)(1)); - _m->setValue("t.int", int(1)); - _m->setValue("t.unsignedint", (unsigned int)(1)); - _m->setValue("t.long", long(1)); - _m->setValue("t.unsignedlong", (unsigned long)(1)); - _m->setValue("t.longlong", (long long)(1)); - _m->setValue("t.unsignedlonglong", (unsigned long long)(1)); - _m->setValue("t.float", float(1)); - _m->setValue("t.double", double(1)); - _m->setValue("t.longdouble", (long double)(1)); - _m->setValue("t.string", "1"); - - bool success = _m->hasKey("t.bool"); - EXPECT_EQ(true, success) << "t.bool"; - success = _m->hasKey("t.char"); - EXPECT_EQ(true, success) << "t.char"; - success = _m->hasKey("t.unsignedchar"); - EXPECT_EQ(true, success) << "t.unsignedchar"; - success = _m->hasKey("t.signedchar"); - EXPECT_EQ(true, success) << "t.signedchar"; - success = _m->hasKey("t.wchar"); - EXPECT_EQ(true, success) << "t.wchar"; - success = _m->hasKey("t.short"); - EXPECT_EQ(true, success) << "t.short"; - success = _m->hasKey("t.unsignedshort"); - EXPECT_EQ(true, success) << "t.unsignedshort"; - success = _m->hasKey("t.int"); - EXPECT_EQ(true, success) << "t.int"; - success = _m->hasKey("t.unsignedint"); - EXPECT_EQ(true, success) << "t.unsignedint"; - success = _m->hasKey("t.long"); - EXPECT_EQ(true, success) << "t.long"; - success = _m->hasKey("t.unsignedlong"); - EXPECT_EQ(true, success) << "t.unsignedlong"; - success = _m->hasKey("t.longlong"); - EXPECT_EQ(true, success) << "t.longlong"; - success = _m->hasKey("t.unsignedlonglong"); - EXPECT_EQ(true, success) << "t.unsignedlonglong"; - success = _m->hasKey("t.float"); - EXPECT_EQ(true, success) << "t.float"; - success = _m->hasKey("t.double"); - EXPECT_EQ(true, success) << "t.double"; - success = _m->hasKey("t.longdouble"); - EXPECT_EQ(true, success) << "t.longdouble"; - success = _m->hasKey("t.string"); - EXPECT_EQ(true, success) << "t.string"; -} - -TEST_F(ConfigurationManagerTest, GetValueFunction) { - std::string test; - bool success = _m->getValue("key", test); - EXPECT_EQ(false, success) << "Empty configuration"; - - success = _m->getValue("key.key", test); - EXPECT_EQ(false, success) << "Empty configuration recursive"; - - _m->loadConfiguration(_configuration1); - _m->loadConfiguration(_configuration3); - int testInt; - success = _m->getValue("t", testInt); - EXPECT_EQ(true, success) << "test1+test3 (t)"; - EXPECT_EQ(1, testInt) << "test1+test3 (t)"; - - success = _m->getValue("s.a", test); - EXPECT_EQ(false, success) << "test1+test3 (s.a)"; - - success = _m->getValue("s.1", test); - EXPECT_EQ(true, success) << "test1+test3 (s.1)"; - - success = _m->getValue("s.1.a", test); - EXPECT_EQ(false, success) << "test1+test3 (s.1.a)"; - - success = _m->getValue("s.3.a", test); - EXPECT_EQ(true, success) << "test1+test3 (s.3.a)"; - - std::vector testVec; - success = _m->getValue("key", testVec); - EXPECT_EQ(false, success) << "test1+test3: Vector access"; -} - -template -void correctnessHelperGetValue(ghoul::ConfigurationManager* m, const std::string& key) { - T value = T(0); - const bool success = m->getValue(key, value); - EXPECT_EQ(true, success) << "Type: " << typeid(T).name(); - EXPECT_EQ(T(1), value) << "Type: " << typeid(T).name(); -} - -TEST_F(ConfigurationManagerTest, GetValueCorrectness) { - _m->loadConfiguration(_configuration1); - - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - correctnessHelperGetValue(_m, "t"); - - std::string value; - const bool success = _m->getValue("t", value); - EXPECT_EQ(true, success) << "Type: " << typeid(std::string).name(); - EXPECT_STREQ("1", value.c_str()) << "Type: " << typeid(std::string).name(); -} - -TEST_F(ConfigurationManagerTest, SetValueRecursive) { - _m->setValue("t.a.b.c", 1); - EXPECT_EQ(true, _m->hasKey("t")); - EXPECT_EQ(true, _m->hasKey("t.a")); - EXPECT_EQ(true, _m->hasKey("t.a.b")); - EXPECT_EQ(true, _m->hasKey("t.a.b.c")); -} - -TEST_F(ConfigurationManagerTest, SetValueCorrectness) { - _m->setValue("t.bool", bool(1)); - _m->setValue("t.char", char(1)); - _m->setValue("t.unsignedchar", (unsigned char)(1)); - _m->setValue("t.signedchar", (signed char)(1)); - _m->setValue("t.wchar", wchar_t(1)); - _m->setValue("t.short", short(1)); - _m->setValue("t.unsignedshort", (unsigned short)(1)); - _m->setValue("t.int", int(1)); - _m->setValue("t.unsignedint", (unsigned int)(1)); - _m->setValue("t.long", long(1)); - _m->setValue("t.unsignedlong", (unsigned long)(1)); - _m->setValue("t.longlong", (long long)(1)); - _m->setValue("t.unsignedlonglong", (unsigned long long)(1)); - _m->setValue("t.float", float(1)); - _m->setValue("t.double", double(1)); - _m->setValue("t.longdouble", (long double)(1)); - _m->setValue("t.string", "1"); - - correctnessHelperGetValue(_m, "t.bool"); - correctnessHelperGetValue(_m, "t.char"); - correctnessHelperGetValue(_m, "t.unsignedchar"); - correctnessHelperGetValue(_m, "t.signedchar"); - correctnessHelperGetValue(_m, "t.wchar"); - correctnessHelperGetValue(_m, "t.short"); - correctnessHelperGetValue(_m, "t.unsignedshort"); - correctnessHelperGetValue(_m, "t.int"); - correctnessHelperGetValue(_m, "t.unsignedint"); - correctnessHelperGetValue(_m, "t.long"); - correctnessHelperGetValue(_m, "t.unsignedlong"); - correctnessHelperGetValue(_m, "t.longlong"); - correctnessHelperGetValue(_m, "t.unsignedlonglong"); - correctnessHelperGetValue(_m, "t.float"); - correctnessHelperGetValue(_m, "t.double"); - correctnessHelperGetValue(_m, "t.longdouble"); - - std::string value; - const bool success = _m->getValue("t.string", value); - EXPECT_EQ(true, success) << "Type: " << typeid(std::string).name(); - EXPECT_STREQ("1", value.c_str()) << "Type: " << typeid(std::string).name(); -} - -TEST_F(ConfigurationManagerTest, SetValueOverridesConfiguration) { - _m->loadConfiguration(_configuration1); - int v = 0; - bool success = _m->getValue("t", v); - ASSERT_EQ(true, success) << "t"; - ASSERT_EQ(1, v) << "t"; - - _m->setValue("t", int(2)); - success = _m->getValue("t", v); - ASSERT_EQ(true, success) << "t"; - ASSERT_EQ(2, v) << "t"; -} - -TEST_F(ConfigurationManagerTest, GetValueConversions) { - // converting from 1 -> all types is done in GetValueCorrectness - _m->loadConfiguration(_configuration2); - - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - correctnessHelperGetValue(_m, "s.a1"); - - std::string value; - const bool success = _m->getValue("s.a1", value); - EXPECT_EQ(true, success) << "Type: " << typeid(std::string).name(); - EXPECT_STREQ("1", value.c_str()) << "Type: " << typeid(std::string).name(); -} - -TEST_F(ConfigurationManagerTest, StringKeyVsIntKey) { - _m->loadConfiguration(_configuration3); - - int v = 0; - bool success = _m->getValue("tt[\"1\"]", v); - ASSERT_EQ(true, success) << "tt.1"; - EXPECT_EQ(2, v) << "tt.1"; - - success = _m->getValue("tt[1]", v); - ASSERT_EQ(true, success) << "tt[1]"; - EXPECT_EQ(1, v) << "tt[1]"; -} - -TEST_F(ConfigurationManagerTest, InvalidKeyAccessInvariant) { - // Accessing an invalid key should not change the tested argument - std::mt19937 rd; - { - std::uniform_int_distribution dist; - for (int i = 0; i < 10; ++i) { - const int testValue = dist(rd); - int test = testValue; - _m->getValue("key", test); - ASSERT_EQ(testValue, test) << "invariant int"; - } - } - - { - std::uniform_real_distribution dist; - for (int i = 0; i < 10; ++i) { - const float testValue = dist(rd); - float test = testValue; - _m->getValue("key", test); - ASSERT_EQ(testValue, test) << "invariant float"; - } - } -} - -TEST_F(ConfigurationManagerTest, HasKeyFunction) { - bool success = _m->hasKey("key"); - EXPECT_EQ(false, success) << "empty configuration"; - - _m->loadConfiguration(_configuration1); - success = _m->hasKey("t"); - EXPECT_EQ(true, success) << "test1 (t)"; - - success = _m->hasKey("s"); - EXPECT_EQ(false, success) << "test1 (s)"; - - _m->loadConfiguration(_configuration2); - success = _m->hasKey("s.a"); - EXPECT_EQ(true, success) << "test1+test2 (s.a)"; - - success = _m->hasKey("s.c"); - EXPECT_EQ(false, success) << "test1+test2 (s.c)"; -} - - -TEST_F(ConfigurationManagerTest, MultipleKeyLoadOverwrite) { - _m->loadConfiguration(_configuration1); - int value; - _m->getValue("t", value); - EXPECT_EQ(1, value); - - _m->loadConfiguration(_configuration2); - - // configuration2 should overwrite the value t in configuration1 - _m->getValue("t", value); - EXPECT_EQ(2, value); -} - -template -void vectorClassHelper(ghoul::ConfigurationManager* m, const std::string& key) { - T value = T(0); - const bool success = m->getValue(key, value); - EXPECT_EQ(true, success) << "Type: " << typeid(T).name() << " | Key: " << key; - EXPECT_EQ(T(glm::vec4(5, 6, 7, 8)), value) << "Type: " << typeid(T).name() << - " | Key: " << key; -} - -template <> -void vectorClassHelper(ghoul::ConfigurationManager* m, const std::string& key) { - glm::bvec2 value = glm::bvec2(false); - const bool success = m->getValue(key, value); - EXPECT_EQ(true, success) << "Type: bvec2 | Key: " << key; - EXPECT_EQ(true, value.x) << "Type: bvec2 | Key: " << key; - EXPECT_EQ(true, value.y) << "Type: bvec2 | Key: " << key; -} - -template <> -void vectorClassHelper(ghoul::ConfigurationManager* m, const std::string& key) { - glm::bvec3 value = glm::bvec3(false); - const bool success = m->getValue(key, value); - EXPECT_EQ(true, success) << "Type: bvec3 | Key: " << key; - EXPECT_EQ(true, value.x) << "Type: bvec3 | Key: " << key; - EXPECT_EQ(true, value.y) << "Type: bvec3 | Key: " << key; - EXPECT_EQ(true, value.z) << "Type: bvec3 | Key: " << key; -} - -template <> -void vectorClassHelper(ghoul::ConfigurationManager* m, const std::string& key) { - glm::bvec4 value = glm::bvec4(false); - const bool success = m->getValue(key, value); - EXPECT_EQ(true, success) << "Type: bvec4 | Key: " << key; - EXPECT_EQ(true, value.x) << "Type: bvec4 | Key: " << key; - EXPECT_EQ(true, value.y) << "Type: bvec4 | Key: " << key; - EXPECT_EQ(true, value.z) << "Type: bvec4 | Key: " << key; - EXPECT_EQ(true, value.w) << "Type: bvec4 | Key: " << key; -} - -TEST_F(ConfigurationManagerTest, VectorClassesGet) { - _m->loadConfiguration(_configuration5); - vectorClassHelper(_m, "n2"); - vectorClassHelper(_m, "num2"); - vectorClassHelper(_m, "xy"); - vectorClassHelper(_m, "rg"); - vectorClassHelper(_m, "st"); - vectorClassHelper(_m, "n2"); - vectorClassHelper(_m, "num2"); - vectorClassHelper(_m, "xy"); - vectorClassHelper(_m, "rg"); - vectorClassHelper(_m, "st"); - vectorClassHelper(_m, "n2"); - vectorClassHelper(_m, "num2"); - vectorClassHelper(_m, "xy"); - vectorClassHelper(_m, "rg"); - vectorClassHelper(_m, "st"); - vectorClassHelper(_m, "n2"); - vectorClassHelper(_m, "num2"); - vectorClassHelper(_m, "xy"); - vectorClassHelper(_m, "rg"); - vectorClassHelper(_m, "st"); - vectorClassHelper(_m, "n2"); - vectorClassHelper(_m, "num2"); - vectorClassHelper(_m, "xy"); - vectorClassHelper(_m, "rg"); - vectorClassHelper(_m, "st"); - - vectorClassHelper(_m, "n3"); - vectorClassHelper(_m, "num3"); - vectorClassHelper(_m, "xyz"); - vectorClassHelper(_m, "rgb"); - vectorClassHelper(_m, "stp"); - vectorClassHelper(_m, "n3"); - vectorClassHelper(_m, "num3"); - vectorClassHelper(_m, "xyz"); - vectorClassHelper(_m, "rgb"); - vectorClassHelper(_m, "stp"); - vectorClassHelper(_m, "n3"); - vectorClassHelper(_m, "num3"); - vectorClassHelper(_m, "xyz"); - vectorClassHelper(_m, "rgb"); - vectorClassHelper(_m, "stp"); - vectorClassHelper(_m, "n3"); - vectorClassHelper(_m, "num3"); - vectorClassHelper(_m, "xyz"); - vectorClassHelper(_m, "rgb"); - vectorClassHelper(_m, "stp"); - vectorClassHelper(_m, "n3"); - vectorClassHelper(_m, "num3"); - vectorClassHelper(_m, "xyz"); - vectorClassHelper(_m, "rgb"); - vectorClassHelper(_m, "stp"); - - vectorClassHelper(_m, "n4"); - vectorClassHelper(_m, "num4"); - vectorClassHelper(_m, "xyzw"); - vectorClassHelper(_m, "rgba"); - vectorClassHelper(_m, "stpq"); - vectorClassHelper(_m, "n4"); - vectorClassHelper(_m, "num4"); - vectorClassHelper(_m, "xyzw"); - vectorClassHelper(_m, "rgba"); - vectorClassHelper(_m, "stpq"); - vectorClassHelper(_m, "num4"); - vectorClassHelper(_m, "n4"); - vectorClassHelper(_m, "xyzw"); - vectorClassHelper(_m, "rgba"); - vectorClassHelper(_m, "stpq"); - vectorClassHelper(_m, "num4"); - vectorClassHelper(_m, "n4"); - vectorClassHelper(_m, "xyzw"); - vectorClassHelper(_m, "rgba"); - vectorClassHelper(_m, "stpq"); - vectorClassHelper(_m, "num4"); - vectorClassHelper(_m, "n4"); - vectorClassHelper(_m, "xyzw"); - vectorClassHelper(_m, "rgba"); - vectorClassHelper(_m, "stpq"); - - glm::vec3 value = glm::vec3(0.f); - const bool success = _m->getValue("mix", value); - EXPECT_EQ(false, success) << "Type: mixed"; - EXPECT_EQ(glm::vec3(0.f), value) << "Type: mixed"; -} - -TEST_F(ConfigurationManagerTest, VectorClassesSet) { - _m->setValue("t.vec2", glm::vec2(5,6)); - _m->setValue("t.vec3", glm::vec3(5,6,7)); - _m->setValue("t.vec4", glm::vec4(5,6,7,8)); - _m->setValue("t.dvec2", glm::dvec2(5,6)); - _m->setValue("t.dvec3", glm::dvec3(5,6,7)); - _m->setValue("t.dvec4", glm::dvec4(5,6,7,8)); - _m->setValue("t.ivec2", glm::ivec2(5,6)); - _m->setValue("t.ivec3", glm::ivec3(5,6,7)); - _m->setValue("t.ivec4", glm::ivec4(5,6,7,8)); - _m->setValue("t.uvec2", glm::uvec2(5,6)); - _m->setValue("t.uvec3", glm::uvec3(5,6,7)); - _m->setValue("t.uvec4", glm::uvec4(5,6,7,8)); - _m->setValue("t.bvec2", glm::bvec2(true)); - _m->setValue("t.bvec3", glm::bvec3(true)); - _m->setValue("t.bvec4", glm::bvec4(true)); - - vectorClassHelper(_m, "t.vec2"); - vectorClassHelper(_m, "t.vec3"); - vectorClassHelper(_m, "t.vec4"); - vectorClassHelper(_m, "t.dvec2"); - vectorClassHelper(_m, "t.dvec3"); - vectorClassHelper(_m, "t.dvec4"); - vectorClassHelper(_m, "t.ivec2"); - vectorClassHelper(_m, "t.ivec3"); - vectorClassHelper(_m, "t.ivec4"); - vectorClassHelper(_m, "t.uvec2"); - vectorClassHelper(_m, "t.uvec3"); - vectorClassHelper(_m, "t.uvec4"); - vectorClassHelper(_m, "t.bvec2"); - vectorClassHelper(_m, "t.bvec3"); - vectorClassHelper(_m, "t.bvec4"); -} - -template -void matrixClassHelper(ghoul::ConfigurationManager* m, const std::string& key) { - T value = T(0); - const bool success = m->getValue(key, value); - EXPECT_EQ(success, true) << "Type: " << typeid(T).name(); - - const glm::detail::tmat4x4 res4 = glm::detail::tmat4x4( - 5.0, 6.0, 7.0, 8.0, - 9.0, 10.0,11.0,12.0, - 13.0,14.0,15.0,16.0, - 17.0,18.0,19.0,20.0 - ); - - const T res = T(res4); - - EXPECT_EQ(res, value) << "Type: " << typeid(T).name(); -} - -TEST_F(ConfigurationManagerTest, MatrixClassesGet) { - _m->loadConfiguration(_configuration5); - matrixClassHelper(_m, "m2x2"); - matrixClassHelper(_m, "m2x3"); - matrixClassHelper(_m, "m2x4"); - matrixClassHelper(_m, "m3x2"); - matrixClassHelper(_m, "m3x3"); - matrixClassHelper(_m, "m3x4"); - matrixClassHelper(_m, "m4x2"); - matrixClassHelper(_m, "m4x3"); - matrixClassHelper(_m, "m4x4"); - - matrixClassHelper(_m, "m2x2"); - matrixClassHelper(_m, "m2x3"); - matrixClassHelper(_m, "m2x4"); - matrixClassHelper(_m, "m3x2"); - matrixClassHelper(_m, "m3x3"); - matrixClassHelper(_m, "m3x4"); - matrixClassHelper(_m, "m4x2"); - matrixClassHelper(_m, "m4x3"); - matrixClassHelper(_m, "m4x4"); -} - -TEST_F(ConfigurationManagerTest, MatrixClassSet) { - _m->setValue("f.m2x2", glm::mat2x2(5, 6, 9, 10)); - _m->setValue("f.m2x3", glm::mat2x3(5, 6, 7, 9, 10, 11)); - _m->setValue("f.m2x4", glm::mat2x4(5, 6, 7, 8, 9, 10, 11, 12)); - _m->setValue("f.m3x2", glm::mat3x2(5, 6, 9, 10, 13, 14)); - _m->setValue("f.m3x3", glm::mat3x3(5, 6, 7, 9, 10, 11, 13, 14, 15)); - _m->setValue("f.m3x4", glm::mat3x4(5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); - _m->setValue("f.m4x2", glm::mat4x2(5, 6, 9, 10, 13, 14, 17, 18)); - _m->setValue("f.m4x3", glm::mat4x3(5, 6, 7, 9, 10, 11, 13, 14, 15, 17, 18, 19)); - _m->setValue("f.m4x4", glm::mat4x4(5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)); - - matrixClassHelper(_m, "f.m2x2"); - matrixClassHelper(_m, "f.m2x3"); - matrixClassHelper(_m, "f.m2x4"); - matrixClassHelper(_m, "f.m3x2"); - matrixClassHelper(_m, "f.m3x3"); - matrixClassHelper(_m, "f.m3x4"); - matrixClassHelper(_m, "f.m4x2"); - matrixClassHelper(_m, "f.m4x3"); - matrixClassHelper(_m, "f.m4x4"); - - _m->setValue("d.m2x2", glm::dmat2x2(5, 6, 9, 10)); - _m->setValue("d.m2x3", glm::dmat2x3(5, 6, 7, 9, 10, 11)); - _m->setValue("d.m2x4", glm::dmat2x4(5, 6, 7, 8, 9, 10, 11, 12)); - _m->setValue("d.m3x2", glm::dmat3x2(5, 6, 9, 10, 13, 14)); - _m->setValue("d.m3x3", glm::dmat3x3(5, 6, 7, 9, 10, 11, 13, 14, 15)); - _m->setValue("d.m3x4", glm::dmat3x4(5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); - _m->setValue("d.m4x2", glm::dmat4x2(5, 6, 9, 10, 13, 14, 17, 18)); - _m->setValue("d.m4x3", glm::dmat4x3(5, 6, 7, 9, 10, 11, 13, 14, 15, 17, 18, 19)); - _m->setValue("d.m4x4", glm::dmat4x4( - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16, - 17, 18, 19, 20)); - - - matrixClassHelper(_m, "d.m2x2"); - matrixClassHelper(_m, "d.m2x3"); - matrixClassHelper(_m, "d.m2x4"); - matrixClassHelper(_m, "d.m3x2"); - matrixClassHelper(_m, "d.m3x3"); - matrixClassHelper(_m, "d.m3x4"); - matrixClassHelper(_m, "d.m4x2"); - matrixClassHelper(_m, "d.m4x3"); - matrixClassHelper(_m, "d.m4x4"); -} diff --git a/tests/test_documentation.cpp b/tests/test_documentation.cpp new file mode 100644 index 0000000000..9961d13cdc --- /dev/null +++ b/tests/test_documentation.cpp @@ -0,0 +1,3079 @@ +/***************************************************************************************** + * * + * 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 "catch2/catch.hpp" + +#include +#include +#include +#include +#include + +TEST_CASE("Documentation: Constructor", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc; + + // Basic Verifiers + doc.entries.emplace_back( + "BoolVerifier", + new BoolVerifier, + Optional::No + ); + doc.entries.emplace_back( + "DoubleVerifier", + new DoubleVerifier, + Optional::No + ); + doc.entries.emplace_back( + "IntVerifier", + new IntVerifier, + Optional::No + ); + doc.entries.emplace_back( + "StringVerifier", + new StringVerifier, + Optional::No + ); + doc.entries.emplace_back( + "TableVerifier", + new TableVerifier, + Optional::No + ); + + // Operator Verifiers + doc.entries.emplace_back( + "LessDouble", + new DoubleLessVerifier(0.0), + Optional::No + ); + doc.entries.emplace_back( + "LessInt", + new IntLessVerifier(0), + Optional::No + ); + doc.entries.emplace_back( + "LessEqualDouble", + new DoubleLessEqualVerifier(0.0), + Optional::No + ); + doc.entries.emplace_back( + "LessEqualInt", + new IntLessEqualVerifier(0), + Optional::No + ); + + doc.entries.emplace_back( + "GreaterDouble", + new DoubleGreaterVerifier(0.0), + Optional::No + ); + doc.entries.emplace_back( + "GreaterInt", + new IntGreaterVerifier(0), + Optional::No + ); + + doc.entries.emplace_back( + "GreaterEqualDouble", + new DoubleGreaterEqualVerifier(0.0), + Optional::No + ); + doc.entries.emplace_back( + "GreaterEqualInt", + new IntGreaterEqualVerifier(0), + Optional::No + ); + + doc.entries.emplace_back( + "EqualBool", + new BoolEqualVerifier(false), + Optional::No + ); + doc.entries.emplace_back( + "EqualDouble", + new DoubleEqualVerifier(0.0), + Optional::No + ); + doc.entries.emplace_back( + "EqualInt", + new IntEqualVerifier(0), + Optional::No + ); + doc.entries.emplace_back( + "EqualString", + new StringEqualVerifier(""), + Optional::No + ); + + doc.entries.emplace_back( + "UnequalBool", + new BoolUnequalVerifier(false), + Optional::No + ); + doc.entries.emplace_back( + "UnequalDouble", + new DoubleUnequalVerifier(0.0), + Optional::No + ); + doc.entries.emplace_back( + "UnequalInt", + new IntUnequalVerifier(0), + Optional::No + ); + doc.entries.emplace_back( + "UnequalString", + new StringUnequalVerifier(""), + Optional::No + ); + + // List Verifiers + doc.entries.emplace_back( + "InListBool", + new BoolInListVerifier({ true, false }), + Optional::No + ); + doc.entries.emplace_back( + "InListDouble", + new DoubleInListVerifier({ 0.0, 1.0}), + Optional::No + ); + doc.entries.emplace_back( + "InListInt", + new IntInListVerifier({ 0, 1 }), + Optional::No + ); + doc.entries.emplace_back( + "InListString", + new StringInListVerifier({ "", "a" }), + Optional::No + ); + + doc.entries.emplace_back( + "NotInListBool", + new BoolNotInListVerifier({ true, false }), + Optional::No + ); + doc.entries.emplace_back( + "NotInListDouble", + new DoubleNotInListVerifier({ 0.0, 1.0 }), + Optional::No + ); + doc.entries.emplace_back( + "NotInListInt", + new IntNotInListVerifier({ 0, 1 }), + Optional::No + ); + doc.entries.emplace_back( + "NotInListString", + new StringNotInListVerifier({ "", "a" }), + Optional::No + ); + + doc.entries.emplace_back( + "StringListVerifier", + new StringListVerifier, + Optional::No + ); + doc.entries.emplace_back( + "IntListVerifier", + new IntListVerifier, + Optional::No + ); + + // Range Verifiers + doc.entries.emplace_back( + "InListDouble", + new DoubleInRangeVerifier({ 0.0, 1.0 }), + Optional::No + ); + doc.entries.emplace_back( + "InListInt", + new IntInRangeVerifier({ 0, 1 }), + Optional::No + ); + + doc.entries.emplace_back( + "NotInListDouble", + new DoubleNotInRangeVerifier({ 0.0, 1.0 }), + Optional::No + ); + doc.entries.emplace_back( + "NotInListInt", + new IntNotInRangeVerifier({ 0, 1 }), + Optional::No + ); + + // Misc Verifiers + doc.entries.emplace_back( + "AnnotationBool", + new BoolAnnotationVerifier("Bool"), + Optional::No + ); + doc.entries.emplace_back( + "AnnotationDouble", + new DoubleAnnotationVerifier("Double"), + Optional::No + ); + doc.entries.emplace_back( + "AnnotationInt", + new IntAnnotationVerifier("Int"), + Optional::No + ); + doc.entries.emplace_back( + "AnnotationString", + new StringAnnotationVerifier("String"), + Optional::No + ); + doc.entries.emplace_back( + "AnnotationTable", + new TableAnnotationVerifier("Table"), + Optional::No + ); +} + +TEST_CASE("Documentation: Initializer Constructor", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { + // Basic Verifiers + {"BoolVerifier", new BoolVerifier, Optional::No }, + {"DoubleVerifier", new DoubleVerifier, Optional::No }, + {"IntVerifier", new IntVerifier, Optional::No }, + {"StringVerifier", new StringVerifier, Optional::No }, + {"TableVerifier", new TableVerifier, Optional::No }, + + // Operator Verifiers + { "LessDouble", new DoubleLessVerifier(0.0), Optional::No }, + { "LessInt", new IntLessVerifier(0), Optional::No }, + + {"LessEqualDouble", new DoubleLessEqualVerifier(0.0), Optional::No }, + {"LessEqualInt", new IntLessEqualVerifier(0), Optional::No }, + + {"GreaterDouble", new DoubleGreaterVerifier(0.0), Optional::No }, + {"GreaterInt", new IntGreaterVerifier(0), Optional::No }, + + {"GreaterEqualDouble", new DoubleGreaterEqualVerifier(0.0), Optional::No }, + {"GreaterEqualInt", new IntGreaterEqualVerifier(0), Optional::No }, + + {"EqualBool", new BoolEqualVerifier(false), Optional::No }, + {"EqualDouble", new DoubleEqualVerifier(0.0), Optional::No }, + {"EqualInt", new IntEqualVerifier(0), Optional::No }, + {"EqualString", new StringEqualVerifier(""), Optional::No }, + + {"UnequalBool", new BoolUnequalVerifier(false), Optional::No }, + {"UnequalDouble", new DoubleUnequalVerifier(0.0), Optional::No }, + {"UnequalInt", new IntUnequalVerifier(0), Optional::No }, + {"UnequalString", new StringUnequalVerifier(""), Optional::No }, + + // List Verifiers + {"InListBool", new BoolInListVerifier({ true, false }), Optional::No }, + {"InListDouble", new DoubleInListVerifier({ 0.0, 1.0 }), Optional::No }, + {"InListInt", new IntInListVerifier({ 0, 1 }), Optional::No }, + {"InListString", new StringInListVerifier({ "", "a" }), Optional::No }, + + {"NotInListBool", new BoolNotInListVerifier({ true, false }), Optional::No }, + {"NotInListDouble", new DoubleNotInListVerifier({ 0.0, 1.0 }), Optional::No }, + {"NotInListInt", new IntNotInListVerifier({ 0, 1 }), Optional::No }, + {"NotInListString", new StringNotInListVerifier({ "", "a" }), Optional::No }, + + // Range Verifiers + {"InRangeDouble", new DoubleInRangeVerifier(0.0, 1.0), Optional::No }, + {"InRangeInt", new IntInRangeVerifier(0, 1), Optional::No }, + + {"InRangeDouble", new DoubleNotInRangeVerifier(0.0, 1.0), Optional::No }, + {"InRangeInt", new IntNotInRangeVerifier(0, 1), Optional::No }, + + // Misc Verifiers + {"AnnotationBool", new BoolAnnotationVerifier("Bool"), Optional::No }, + {"AnnotationDouble", new DoubleAnnotationVerifier("Double"), Optional::No }, + {"AnnotationInt", new IntAnnotationVerifier("Int"), Optional::No }, + {"AnnotationString", new StringAnnotationVerifier("String"), Optional::No }, + {"AnnotationTable", new TableAnnotationVerifier("Table"), Optional::No } + } + }; +} + +TEST_CASE("Documentation: BoolVerifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Bool", new BoolVerifier, Optional::No }} + }; + + ghoul::Dictionary positive { + { "Bool", true } + }; + + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Bool", 0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Bool"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeExist { + { "Bool2", 0 } + }; + negativeRes = testSpecification(doc, negativeExist); + + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Bool"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: DoubleVerifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double", new DoubleVerifier, Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", 0.0 } + }; + + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 0 } + }; + + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeExist{ + { "Double2" , 0.0 } + }; + negativeRes = testSpecification(doc, negativeExist); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: IntVerifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new IntVerifier, Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", 0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "Int", 0.0 } + }; + positiveRes = testSpecification(doc, positive2); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 0.1 } + }; + + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeExist { + { "Int2", 0 } + }; + negativeRes = testSpecification(doc, negativeExist); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: StringVerifier", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + {{ "String", new StringVerifier, Optional::No }} + }; + + ghoul::Dictionary positive { + { "String", ""s } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "String", 0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "String"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeExist { + { "String2", ""s } + }; + negativeRes = testSpecification(doc, negativeExist); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "String"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: TableVerifierType", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Table", new TableVerifier, Optional::No }} + }; + + ghoul::Dictionary positive { + { "Table", ghoul::Dictionary{} } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Table", 0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Table"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeExist { + { "Table2", ghoul::Dictionary{} } + }; + negativeRes = testSpecification(doc, negativeExist); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Table"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: StringListVerifierType", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + { { "StringList", new StringListVerifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { + "StringList", + ghoul::Dictionary { + { "1", "a"s }, + { "2", "b"s }, + { "3", "c"s } + } + } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "StringList", 0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "StringList"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { + "StringList", + ghoul::Dictionary { + { "1", "a"s }, + { "2", "b"s }, + { "3", 2.0 } + } + } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "StringList.3"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeExist { + { "StringList2", ghoul::Dictionary{} } + }; + negativeRes = testSpecification(doc, negativeExist); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "StringList"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: IntListVerifierType", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + { { "IntList", new IntListVerifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { + "IntList", + ghoul::Dictionary{ + { "1", 1 }, + { "2", 2 }, + { "3", 3 } + } + } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative{ + { "IntList", 0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "IntList"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { + "IntList", + ghoul::Dictionary{ + { "1", "a"s }, + { "2", 1 }, + { "3", 2 } + } + } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "IntList.1"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeExist { + { "IntList2", ghoul::Dictionary{} } + }; + negativeRes = testSpecification(doc, negativeExist); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "IntList"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: MixedVerifiers", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + { + { "Bool", new BoolVerifier, Optional::No }, + { "Double", new DoubleVerifier, Optional::No }, + { "Int", new IntVerifier, Optional::No }, + { "String", new StringVerifier, Optional::No }, + { "Table", new TableVerifier, Optional::No } + } + }; + + ghoul::Dictionary positive { + { "Bool", true }, + { "Double", 0.0 }, + { "Int", 0 }, + { "String", ""s }, + { "Table", ghoul::Dictionary{} } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative1 { + { "Bool", true }, + { "Double", 1 }, + { "Int", 0 }, + { "String", ""s }, + { "Table", ghoul::Dictionary{} } + }; + TestResult negativeRes = testSpecification(doc, negative1); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "Bool", true }, + { "Double", 0.0 }, + { "Int", ""s }, + { "String", 1 }, + { "Table", ghoul::Dictionary{} } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 2); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[1].offender == "String"); + REQUIRE(negativeRes.offenses[1].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: NestedTables", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + { + { "Outer_Int", new IntVerifier, Optional::No }, + { "Outer_Table", new TableVerifier({ + { "Inner_Double", new DoubleVerifier, Optional::No }, + { "Inner_String", new StringVerifier, Optional::No } + }), Optional::No }, + { "Outer_Double", new DoubleVerifier, Optional::No }, + { "Outer_Table2" , new TableVerifier({ + { "Inner_Double2", new DoubleVerifier, Optional::No }, + { "Inner_String2", new StringVerifier, Optional::No }, + { "Inner_Table" , new TableVerifier({ + { "Inner_Inner_Int", new IntVerifier, Optional::No } + }), Optional::No } + }), Optional::No} + } + }; + + ghoul::Dictionary positive { + { "Outer_Int", 1 }, + { "Outer_Table", ghoul::Dictionary { + { "Inner_Double", 0.0 }, + { "Inner_String", ""s } + }}, + { "Outer_Double", 0.0 }, + { "Outer_Table2", ghoul::Dictionary { + { "Inner_Double2", 0.0 }, + { "Inner_String2", ""s }, + { "Inner_Table", ghoul::Dictionary { + { "Inner_Inner_Int", 0 } + }} + }} + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negativeSimple { + { "Outer_Int", 1 }, + { "Outer_Table", 0}, + { "Outer_Double", 0.0 }, + { "Outer_Table2", ghoul::Dictionary { + { "Inner_Double2", 0.0 }, + { "Inner_String2", ""s }, + { "Inner_Table", ghoul::Dictionary { + { "Inner_Inner_Int", 0 } + }} + }} + }; + TestResult negativeRes = testSpecification(doc, negativeSimple); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Outer_Table"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeInner { + { "Outer_Int", 1 }, + { "Outer_Table", ghoul::Dictionary { + { "Inner_Double", ""s }, + { "Inner_String", ""s } + }}, + { "Outer_Double", 0.0 }, + { "Outer_Table2", ghoul::Dictionary { + { "Inner_Double2", 0.0 }, + { "Inner_String2", ""s }, + { "Inner_Table", ghoul::Dictionary { + { "Inner_Inner_Int", 0 } + }} + }} + }; + negativeRes = testSpecification(doc, negativeInner); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Outer_Table.Inner_Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeInner2 { + { "Outer_Int", 1 }, + { "Outer_Table", ghoul::Dictionary { + { "Inner_Double", ""s }, + { "Inner_String", 0.0 } + }}, + { "Outer_Double", 0.0 }, + { "Outer_Table2", ghoul::Dictionary { + { "Inner_Double2", 0.0 }, + { "Inner_String2", ""s }, + { "Inner_Table", ghoul::Dictionary { + { "Inner_Inner_Int", 0 } + }} + }} + }; + negativeRes = testSpecification(doc, negativeInner2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 2); + REQUIRE(negativeRes.offenses[0].offender == "Outer_Table.Inner_Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[1].offender == "Outer_Table.Inner_String"); + REQUIRE(negativeRes.offenses[1].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeInnerSeparate { + { "Outer_Int", 1 }, + { "Outer_Table", ghoul::Dictionary { + { "Inner_Double", ""s }, + { "Inner_String", ""s } + } }, + { "Outer_Double", 0.0 }, + { "Outer_Table2", ghoul::Dictionary { + { "Inner_Double2", ""s }, + { "Inner_String2", ""s }, + { "Inner_Table", ghoul::Dictionary { + { "Inner_Inner_Int", 0 } + }} + }} + }; + negativeRes = testSpecification(doc, negativeInnerSeparate); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 2); + REQUIRE(negativeRes.offenses[0].offender == "Outer_Table.Inner_Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[1].offender == "Outer_Table2.Inner_Double2"); + REQUIRE(negativeRes.offenses[1].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeInnerFull { + { "Outer_Int", 1 }, + { "Outer_Table", ghoul::Dictionary { + { "Inner_Double", ""s }, + { "Inner_String", ""s } + } }, + { "Outer_Double", 0.0 }, + { "Outer_Table2", ghoul::Dictionary { + { "Inner_Double2", ""s }, + { "Inner_String2", ""s }, + { "Inner_Table", ghoul::Dictionary { + { "Inner_Inner_Int", ""s } + }} + }} + }; + negativeRes = testSpecification(doc, negativeInnerFull); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 3); + REQUIRE(negativeRes.offenses[0].offender == "Outer_Table.Inner_Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[1].offender == "Outer_Table2.Inner_Double2"); + REQUIRE(negativeRes.offenses[1].reason == TestResult::Offense::Reason::WrongType); + REQUIRE( + negativeRes.offenses[2].offender == "Outer_Table2.Inner_Table.Inner_Inner_Int" + ); + REQUIRE(negativeRes.offenses[2].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: Optional", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { + { "Bool_Force", new BoolVerifier, Optional::No }, + { "Bool_Optional", new BoolVerifier, Optional::Yes } + } + }; + + ghoul::Dictionary positive { + { "Bool_Force", true } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "Bool_Force", true }, + { "Bool_Optional", true } + }; + positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Bool_Force"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); + + ghoul::Dictionary negative2 { + { "Bool_Optional", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Bool_Force"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); + + ghoul::Dictionary negative3 { + { "Bool_Force", true }, + { "Bool_Optional", 1 } + }; + negativeRes = testSpecification(doc, negative3); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Bool_Optional"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: Required In Optional", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ + "a", + new TableVerifier({ + { + "b", + new IntVerifier, + Optional::No + }, + { + "c", + new IntVerifier, + Optional::Yes + } + }), + Optional::Yes + }} + }; + + ghoul::Dictionary positive { + { + "a", ghoul::Dictionary{ + { "b", 1 } + } + } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { + "a", ghoul::Dictionary{ + { "b", 1 }, + { "c", 2 } + } + } + }; + positiveRes = testSpecification(doc, positive2); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive3 {}; + positiveRes = testSpecification(doc, positive3); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "c", 2 }}} + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a.b"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: Exhaustive", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new IntVerifier, Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int" , 1 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "False_Int", 1 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); + + ghoul::Dictionary negative2 { + { "Double", 2.0 } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: Nested Exhaustive", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Table", new TableVerifier( + { { "a", new IntVerifier, Optional::No } } + ), Optional::No + }} + }; + + ghoul::Dictionary positive { + { "Table", ghoul::Dictionary{{ "a", 1 }}} + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Table", ghoul::Dictionary{{ "b", 2.0 }}} + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Table.a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: Empty Entries Non Exhaustive", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc; + + ghoul::Dictionary positive {}; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "a", 1 } + }; + positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); +} + +TEST_CASE("Documentation: Empty Nested Exhaustive", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ + "Table", + new TableVerifier(), + Optional::No, + }} + }; + + ghoul::Dictionary positive { + { "Table", ghoul::Dictionary() } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Table", ghoul::Dictionary{ { "a", 1 }}} + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE(negativeRes.success); + REQUIRE(negativeRes.offenses.empty()); +} + +TEST_CASE("Documentation: Less Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new IntLessVerifier(5), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", 0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 10 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Less Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double", new DoubleLessVerifier(5.0), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", 0.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 10.0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: LessEqual Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new IntLessEqualVerifier(5), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", 0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positiveEqual { + { "Int", 5 } + }; + positiveRes = testSpecification(doc, positiveEqual); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 10 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: LessEqual Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double", new DoubleLessEqualVerifier(5.0), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", 0.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positiveEqual { + { "Double", 5.0 } + }; + positiveRes = testSpecification(doc, positiveEqual); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 10.0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Greater Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new IntGreaterVerifier(5), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", 10 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Greater Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double", new DoubleGreaterVerifier(5.0), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", 10.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 0.0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: GreaterEqual Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new IntGreaterEqualVerifier(5), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", 10 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positiveEqual { + { "Int", 5 } + }; + positiveRes = testSpecification(doc, positiveEqual); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: GreaterEqual Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double", new DoubleGreaterEqualVerifier(5.0), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", 10.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positiveEqual { + { "Double", 5.0 } + }; + positiveRes = testSpecification(doc, positiveEqual); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 0.0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Equal Bool", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Bool", new BoolEqualVerifier(true), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Bool", true} + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Bool", false } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Bool"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Equal Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new IntEqualVerifier(1), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", 1} + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Equal Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double", new DoubleEqualVerifier(1.0), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", 1.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 0.0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Equal String", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + {{ "String", new StringEqualVerifier("string"s), Optional::No }} + }; + + ghoul::Dictionary positive { + { "String", "string"s } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "String", "no_string"s } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "String"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Unequal Bool", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Bool", new BoolUnequalVerifier(true), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Bool", false } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Bool", true } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Bool"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Unequal Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new IntUnequalVerifier(1), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", 0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 1 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Unequal Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double", new DoubleUnequalVerifier(1.0), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", 0.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 1.0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Unequal String", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + {{ "String", new StringUnequalVerifier("string"s), Optional::No }} + }; + + ghoul::Dictionary positive { + { "String", "no_string"s } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "String", "string"s } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "String"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: List Bool", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Bool" , new BoolInListVerifier({ true }), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Bool", true } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Bool", false } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Bool"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: List Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int" , new IntInListVerifier({ 0, 1, 2 }), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", 1 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "Int", 2 } + }; + positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 5 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: List Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double" , new DoubleInListVerifier({ 0.0, 1.0, 2.0 }), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", 1.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "Double", 2.0 } + }; + positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 5.0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: List String", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + {{ "String" , new StringInListVerifier({ "0"s, "1"s, "2"s }), Optional::No }} + }; + + ghoul::Dictionary positive { + { "String", "1"s } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "String", "2"s } + }; + positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "String", "5"s } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "String"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: NotList Bool", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Bool" , new BoolNotInListVerifier({ true }), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Bool", false } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Bool", true } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Bool"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: NotList Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int" , new IntNotInListVerifier({ 0, 1, 2 }), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", -1 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "Int", 3 } + }; + positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 2 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: NotList Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double" , new DoubleNotInListVerifier({ 0.0, 1.0, 2.0 }), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", -1.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "Double", 3.0 } + }; + positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 1.0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: NotList String", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + {{ "String" , new StringNotInListVerifier({ "0"s, "1"s, "2"s }), Optional::No }} + }; + + ghoul::Dictionary positive { + { "String", "string"s } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "String", "foo_string"s } + }; + positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "String", "1"s } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "String"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Annotation Bool", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Bool", new BoolAnnotationVerifier("Bool"), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Bool", true } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Bool", 0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Bool"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: Annotation Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new IntAnnotationVerifier("Int"), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", 1 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 1.1 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: Annotation Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double", new DoubleAnnotationVerifier("Double"), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", 0.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", true } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: Annotation String", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + {{ "String", new StringAnnotationVerifier("String"), Optional::No }} + }; + + ghoul::Dictionary positive { + { "String", ""s } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "String", 1 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "String"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: Annotation Table", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Table", new TableAnnotationVerifier("Table"), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Table", ghoul::Dictionary{} } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Table", 1 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Table"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: InRange Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new InRangeVerifier(0, 5), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", 2 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "Int", 0 } + }; + positiveRes = testSpecification(doc, positive2); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive3 { + { "Int", 5 } + }; + positiveRes = testSpecification(doc, positive3); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 10 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: InRange Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double", new InRangeVerifier(0.0, 5.0), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", 2.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "Double", 0.0 } + }; + positiveRes = testSpecification(doc, positive2); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive3 { + { "Double", 5.0 } + }; + positiveRes = testSpecification(doc, positive3); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive4 { + { "Double", 1.5 } + }; + positiveRes = testSpecification(doc, positive4); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 10.0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: NotInRange Int", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Int", new NotInRangeVerifier(0, 5), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Int", -1 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "Int", 6 } + }; + positiveRes = testSpecification(doc, positive2); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Int", 2 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); + + ghoul::Dictionary negative2 { + { "Int", 0 } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); + + ghoul::Dictionary negative3 { + { "Int", 5 } + }; + negativeRes = testSpecification(doc, negative3); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Int"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: NotInRange Double", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "Double", new NotInRangeVerifier(0.0, 5.0), Optional::No }} + }; + + ghoul::Dictionary positive { + { "Double", -1.0 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "Double", 6.0 } + }; + positiveRes = testSpecification(doc, positive2); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Double", 0.0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); + + ghoul::Dictionary negative2 { + { "Double", 5.0 } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); + + ghoul::Dictionary negative3 { + { "Double", 2.5 } + }; + negativeRes = testSpecification(doc, negative3); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Double"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: Wildcard", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ DocumentationEntry::Wildcard, new IntVerifier, Optional::No }} + }; + + ghoul::Dictionary positive { + { "a", 1 }, + { "b", 2 }, + { "c", 3 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", false }, + { "b", 2 }, + { "c", 3 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", false }, + { "b", false }, + { "c", 3 } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 2); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[1].offender == "b"); + REQUIRE(negativeRes.offenses[1].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative3 { + { "a", false }, + { "b", false }, + { "c", false } + }; + negativeRes = testSpecification(doc, negative3); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 3); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[1].offender == "b"); + REQUIRE(negativeRes.offenses[1].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[2].offender == "c"); + REQUIRE(negativeRes.offenses[2].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: Wildcard Mixed", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { + { DocumentationEntry::Wildcard, new IntVerifier , Optional::No}, + { "b", new IntGreaterVerifier(5), Optional::No } + } + }; + + ghoul::Dictionary positive { + { "a", 1 }, + { "b", 8 }, + { "c", 3 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", false }, + { "b", 2 }, + { "c", 3 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 2); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[1].offender == "b"); + REQUIRE(negativeRes.offenses[1].reason == TestResult::Offense::Reason::Verification); + + ghoul::Dictionary negative2 { + { "a", false }, + { "b", false }, + { "c", 3 } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 2); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[1].offender == "b"); + REQUIRE(negativeRes.offenses[1].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative3 { + { "a", false }, + { "b", 1 }, + { "c", false } + }; + negativeRes = testSpecification(doc, negative3); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 3); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[1].offender == "b"); + REQUIRE(negativeRes.offenses[1].reason == TestResult::Offense::Reason::Verification); + REQUIRE(negativeRes.offenses[2].offender == "c"); + REQUIRE(negativeRes.offenses[2].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative4 { + { "a", false }, + { "b", 10 }, + { "c", false } + }; + negativeRes = testSpecification(doc, negative4); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 2); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + REQUIRE(negativeRes.offenses[1].offender == "c"); + REQUIRE(negativeRes.offenses[1].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: Referencing", "[documentation]") { + using namespace openspace::documentation; + + Documentation referenced { + "Referenced Name", + "referenced_id", + { + { "a", new IntVerifier, Optional::No }, + { "b", new DoubleVerifier, Optional::No } + }, + }; + DocEng.addDocumentation(referenced); + + Documentation doc {{ + { "Table", new ReferencingVerifier("referenced_id"), Optional::No } + }}; + + ghoul::Dictionary positive { + { "Table", ghoul::Dictionary{ { "a", 1 }, { "b", 2.0 } }} + }; + + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "Table", 1 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Table"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "Table", ghoul::Dictionary{ { "a", 1 }, { "b", true }}} + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Table.b"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + + Documentation wrongDoc {{ + { "Table", new ReferencingVerifier("WRONG"), Optional::No } + } }; + ghoul::Dictionary wrongNegative { + { "Table", ghoul::Dictionary{ { "a", 1 },{ "b", 2.0 } } } + }; + negativeRes = testSpecification(wrongDoc, wrongNegative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "Table"); + REQUIRE( + negativeRes.offenses[0].reason == TestResult::Offense::Reason::UnknownIdentifier + ); +} + +TEST_CASE("Documentation: AndOperator", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { + { + "a", + new AndVerifier({ + new IntGreaterEqualVerifier(2), new IntLessEqualVerifier(5) + }), + Optional::No + } + } + }; + + ghoul::Dictionary positive { + { "a", 4 } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", 0 } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); + + ghoul::Dictionary negative2 { + { "a", 8 } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: OrOperator", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + {{ "a", new OrVerifier({ new StringVerifier, new IntVerifier }), Optional::No }} + }; + + ghoul::Dictionary positive { + { "a", ""s } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary positive2 { + { "a", 1 } + }; + positiveRes = testSpecification(doc, positive2); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", false } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); +} + +TEST_CASE("Documentation: BoolVector2Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + {{ "a", new BoolVector2Verifier, Optional::No }} + }; + + ghoul::Dictionary positive { + { "a", glm::bvec2(true) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true }, { "2", 1.0 } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: IntVector2Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new IntVector2Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::ivec2(2) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1 } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleVector2Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleVector2Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dvec2(2.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true }, { "2", 1.0 } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: BoolVector3Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new BoolVector3Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::bvec3(true) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 }, { "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: IntVector3Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new IntVector3Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::ivec3(2) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1 }, { "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleVector3Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleVector3Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dvec3(2.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 }, { "3", "s"} } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: BoolVector4Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new BoolVector4Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::bvec4(true) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 }, { "3", "s" }, { "4", 1 }}} + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: IntVector4Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new IntVector4Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::ivec4(2) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1 },{ "3", "s" }, { "4", 1 } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2{ + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleVector4Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleVector4Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dvec4(2.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" }, { "4", 1 } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleMatrix2x2Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleMatrix2x2Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dmat2x2(1.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary { { "1", true },{ "2", 1.0 },{ "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleMatrix2x3Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleMatrix2x3Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dmat2x3(1.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleMatrix2x4Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleMatrix2x4Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dmat2x4(1.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleMatrix3x2Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleMatrix3x2Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dmat3x2(1.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleMatrix3x3Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleMatrix3x3Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dmat3x3(1.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleMatrix3x4Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleMatrix3x4Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dmat3x4(1.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleMatrix4x2Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleMatrix4x2Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dmat4x2(1.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleMatrix4x3Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleMatrix4x3Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dmat4x3(1.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DoubleMatrix4x4Verifier", "[documentation]") { + using namespace openspace::documentation; + + Documentation doc { + { { "a", new DoubleMatrix4x4Verifier, Optional::No } } + }; + + ghoul::Dictionary positive { + { "a", glm::dmat4x4(1.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + + ghoul::Dictionary negative { + { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } + }; + TestResult negativeRes = testSpecification(doc, negative); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negative2 { + { "a", true } + }; + negativeRes = testSpecification(doc, negative2); + REQUIRE_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + REQUIRE(negativeRes.offenses[0].offender == "a"); + REQUIRE(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); +} + +TEST_CASE("Documentation: DeprecatedVerifier", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { { + { "bool", new BoolDeprecatedVerifier, Optional::No }, + { "int" , new IntDeprecatedVerifier, Optional::No }, + { "double", new DoubleDeprecatedVerifier, Optional::No }, + { "string" , new StringDeprecatedVerifier, Optional::No }, + { "boolvec2", new DeprecatedVerifier, Optional::No }, + { "intvec2", new DeprecatedVerifier, Optional::No }, + { "doublevec2", new DeprecatedVerifier, Optional::No }, + { "boolvec3", new DeprecatedVerifier, Optional::No }, + { "intvec3", new DeprecatedVerifier, Optional::No }, + { "doublevec3", new DeprecatedVerifier, Optional::No }, + { "boolvec4", new DeprecatedVerifier, Optional::No }, + { "intvec4", new DeprecatedVerifier, Optional::No }, + { "doublevec4", new DeprecatedVerifier, Optional::No } + }}; + + ghoul::Dictionary positive { + { "bool", true }, + { "int", 1 }, + { "double", 2.0 }, + { "string" , ""s }, + { "boolvec2", glm::bvec2(false) }, + { "intvec2", glm::ivec2(0) }, + { "doublevec2", glm::dvec2(0.0) }, + { "boolvec3", glm::bvec3(false) }, + { "intvec3", glm::ivec3(0) }, + { "doublevec3", glm::dvec3(0.0) }, + { "boolvec4", glm::bvec4(false) }, + { "intvec4", glm::ivec4(0) }, + { "doublevec4", glm::dvec4(0.0) } + }; + TestResult positiveRes = testSpecification(doc, positive); + REQUIRE(positiveRes.success); + REQUIRE(positiveRes.offenses.empty()); + REQUIRE(positiveRes.warnings.size() == 13); + REQUIRE(positiveRes.warnings[0].offender == "bool"); + REQUIRE(positiveRes.warnings[0].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[1].offender == "boolvec2"); + REQUIRE(positiveRes.warnings[1].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[2].offender == "boolvec3"); + REQUIRE(positiveRes.warnings[2].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[3].offender == "boolvec4"); + REQUIRE(positiveRes.warnings[3].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[4].offender == "double"); + REQUIRE(positiveRes.warnings[4].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[5].offender == "doublevec2"); + REQUIRE(positiveRes.warnings[5].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[6].offender == "doublevec3"); + REQUIRE(positiveRes.warnings[6].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[7].offender == "doublevec4"); + REQUIRE(positiveRes.warnings[7].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[8].offender == "int"); + REQUIRE(positiveRes.warnings[8].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[9].offender == "intvec2"); + REQUIRE(positiveRes.warnings[9].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[10].offender == "intvec3"); + REQUIRE(positiveRes.warnings[10].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[11].offender == "intvec4"); + REQUIRE(positiveRes.warnings[11].reason == TestResult::Warning::Reason::Deprecated); + REQUIRE(positiveRes.warnings[12].offender == "string"); + REQUIRE(positiveRes.warnings[12].reason == TestResult::Warning::Reason::Deprecated); +} + +TEST_CASE("Documentation: Verifier Type Post Conditions", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + REQUIRE(BoolVerifier().type() != ""); + REQUIRE(DoubleVerifier().type() != ""); + REQUIRE(IntVerifier().type() != ""); + REQUIRE(StringVerifier().type() != ""); + REQUIRE(TableVerifier().type() != ""); + + REQUIRE(BoolVector2Verifier().type() != ""); + REQUIRE(IntVector2Verifier().type() != ""); + REQUIRE(DoubleVector2Verifier().type() != ""); + REQUIRE(BoolVector3Verifier().type() != ""); + REQUIRE(IntVector3Verifier().type() != ""); + REQUIRE(DoubleVector3Verifier().type() != ""); + REQUIRE(BoolVector4Verifier().type() != ""); + REQUIRE(IntVector4Verifier().type() != ""); + REQUIRE(DoubleVector4Verifier().type() != ""); + + REQUIRE(IntLessVerifier(0).type() != ""); + REQUIRE(DoubleLessVerifier(0.0).type() != ""); + REQUIRE(IntLessEqualVerifier(0).type() != ""); + REQUIRE(DoubleLessEqualVerifier(0.0).type() != ""); + REQUIRE(IntGreaterVerifier(0).type() != ""); + REQUIRE(DoubleGreaterVerifier(0.0).type() != ""); + REQUIRE(IntGreaterEqualVerifier(0).type() != ""); + REQUIRE(DoubleGreaterEqualVerifier(0.0).type() != ""); + + REQUIRE(BoolEqualVerifier(true).type() != ""); + REQUIRE(IntEqualVerifier(0).type() != ""); + REQUIRE(DoubleEqualVerifier(0.0).type() != ""); + REQUIRE(StringEqualVerifier(""s).type() != ""); + REQUIRE(BoolUnequalVerifier(true).type() != ""); + REQUIRE(IntUnequalVerifier(0).type() != ""); + REQUIRE(DoubleUnequalVerifier(0.0).type() != ""); + REQUIRE(StringUnequalVerifier(""s).type() != ""); + + REQUIRE(BoolInListVerifier({ true }).type() != ""); + REQUIRE(IntInListVerifier({ 0 }).type() != ""); + REQUIRE(DoubleInListVerifier({ 0.0 }).type() != ""); + REQUIRE(StringInListVerifier({ ""s }).type() != ""); + REQUIRE(BoolNotInListVerifier({ true }).type() != ""); + REQUIRE(IntNotInListVerifier({ 0 }).type() != ""); + REQUIRE(DoubleNotInListVerifier({ 0.0 }).type() != ""); + REQUIRE(StringNotInListVerifier({ ""s }).type() != ""); + + REQUIRE(IntInRangeVerifier({ 0, 1 }).type() != ""); + REQUIRE(DoubleInRangeVerifier({ 0.0, 1.0 }).type() != ""); + REQUIRE(IntNotInRangeVerifier({ 0, 1 }).type() != ""); + REQUIRE(DoubleNotInRangeVerifier({ 0.0, 1.0 }).type() != ""); + + REQUIRE(BoolAnnotationVerifier("A"s).type() != ""); + REQUIRE(IntAnnotationVerifier("A"s).type() != ""); + REQUIRE(DoubleAnnotationVerifier("A"s).type() != ""); + REQUIRE(StringAnnotationVerifier("A"s).type() != ""); + REQUIRE(TableAnnotationVerifier("A"s).type() != ""); + REQUIRE(AnnotationVerifier("A"s).type() != ""); + REQUIRE(AnnotationVerifier("A"s).type() != ""); + REQUIRE(AnnotationVerifier("A"s).type() != ""); + REQUIRE(AnnotationVerifier("A"s).type() != ""); + REQUIRE(AnnotationVerifier("A"s).type() != ""); + REQUIRE(AnnotationVerifier("A"s).type() != ""); + REQUIRE(AnnotationVerifier("A"s).type() != ""); + REQUIRE(AnnotationVerifier("A"s).type() != ""); + REQUIRE(AnnotationVerifier("A"s).type() != ""); + + REQUIRE(BoolDeprecatedVerifier().type() != ""); + REQUIRE(IntDeprecatedVerifier().type() != ""); + REQUIRE(DoubleDeprecatedVerifier().type() != ""); + REQUIRE(StringDeprecatedVerifier().type() != ""); + REQUIRE(TableDeprecatedVerifier().type() != ""); + REQUIRE(DeprecatedVerifier().type() != ""); + REQUIRE(DeprecatedVerifier().type() != ""); + REQUIRE(DeprecatedVerifier().type() != ""); + REQUIRE(DeprecatedVerifier().type() != ""); + REQUIRE(DeprecatedVerifier().type() != ""); + REQUIRE(DeprecatedVerifier().type() != ""); + REQUIRE(DeprecatedVerifier().type() != ""); + REQUIRE(DeprecatedVerifier().type() != ""); + REQUIRE(DeprecatedVerifier().type() != ""); + + REQUIRE(ReferencingVerifier("identifier"s).type() != ""); +} + +TEST_CASE("Documentation: Verifier Documentation Post Conditions", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + REQUIRE(BoolVerifier().documentation() != ""); + REQUIRE(DoubleVerifier().documentation() != ""); + REQUIRE(IntVerifier().documentation() != ""); + REQUIRE(StringVerifier().documentation() != ""); + REQUIRE(TableVerifier().documentation() != ""); + + REQUIRE(BoolVector2Verifier().documentation() != ""); + REQUIRE(IntVector2Verifier().documentation() != ""); + REQUIRE(DoubleVector2Verifier().documentation() != ""); + REQUIRE(BoolVector3Verifier().documentation() != ""); + REQUIRE(IntVector3Verifier().documentation() != ""); + REQUIRE(DoubleVector3Verifier().documentation() != ""); + REQUIRE(BoolVector4Verifier().documentation() != ""); + REQUIRE(IntVector4Verifier().documentation() != ""); + REQUIRE(DoubleVector4Verifier().documentation() != ""); + + REQUIRE(IntLessVerifier(0).documentation() != ""); + REQUIRE(DoubleLessVerifier(0.0).documentation() != ""); + REQUIRE(IntLessEqualVerifier(0).documentation() != ""); + REQUIRE(DoubleLessEqualVerifier(0.0).documentation() != ""); + REQUIRE(IntGreaterVerifier(0).documentation() != ""); + REQUIRE(DoubleGreaterVerifier(0.0).documentation() != ""); + REQUIRE(IntGreaterEqualVerifier(0).documentation() != ""); + REQUIRE(DoubleGreaterEqualVerifier(0.0).documentation() != ""); + + REQUIRE(BoolEqualVerifier(true).documentation() != ""); + REQUIRE(IntEqualVerifier(0).documentation() != ""); + REQUIRE(DoubleEqualVerifier(0.0).documentation() != ""); + REQUIRE(StringEqualVerifier(""s).documentation() != ""); + REQUIRE(BoolUnequalVerifier(true).documentation() != ""); + REQUIRE(IntUnequalVerifier(0).documentation() != ""); + REQUIRE(DoubleUnequalVerifier(0.0).documentation() != ""); + REQUIRE(StringUnequalVerifier(""s).documentation() != ""); + + REQUIRE(BoolInListVerifier({ true }).documentation() != ""); + REQUIRE(IntInListVerifier({ 0 }).documentation() != ""); + REQUIRE(DoubleInListVerifier({ 0.0 }).documentation() != ""); + REQUIRE(StringInListVerifier({ ""s }).documentation() != ""); + REQUIRE(BoolNotInListVerifier({ true }).documentation() != ""); + REQUIRE(IntNotInListVerifier({ 0 }).documentation() != ""); + REQUIRE(DoubleNotInListVerifier({ 0.0 }).documentation() != ""); + REQUIRE(StringNotInListVerifier({ ""s }).documentation() != ""); + + REQUIRE(IntInRangeVerifier({ 0, 1 }).documentation() != ""); + REQUIRE(DoubleInRangeVerifier({ 0.0, 1.0 }).documentation() != ""); + REQUIRE(IntNotInRangeVerifier({ 0, 1 }).documentation() != ""); + REQUIRE(DoubleNotInRangeVerifier({ 0.0, 1.0 }).documentation() != ""); + + REQUIRE(BoolAnnotationVerifier("A"s).documentation() != ""); + REQUIRE(IntAnnotationVerifier("A"s).documentation() != ""); + REQUIRE(DoubleAnnotationVerifier("A"s).documentation() != ""); + REQUIRE(StringAnnotationVerifier("A"s).documentation() != ""); + REQUIRE(TableAnnotationVerifier("A"s).documentation() != ""); + REQUIRE(AnnotationVerifier("A"s).documentation() != ""); + REQUIRE(AnnotationVerifier("A"s).documentation() != ""); + REQUIRE(AnnotationVerifier("A"s).documentation() != ""); + REQUIRE(AnnotationVerifier("A"s).documentation() != ""); + REQUIRE(AnnotationVerifier("A"s).documentation() != ""); + REQUIRE(AnnotationVerifier("A"s).documentation() != ""); + REQUIRE(AnnotationVerifier("A"s).documentation() != ""); + REQUIRE(AnnotationVerifier("A"s).documentation() != ""); + REQUIRE(AnnotationVerifier("A"s).documentation() != ""); + + REQUIRE(BoolDeprecatedVerifier().documentation() != ""); + REQUIRE(IntDeprecatedVerifier().documentation() != ""); + REQUIRE(DoubleDeprecatedVerifier().documentation() != ""); + REQUIRE(StringDeprecatedVerifier().documentation() != ""); + REQUIRE(TableDeprecatedVerifier().documentation() != ""); + REQUIRE(DeprecatedVerifier().documentation() != ""); + REQUIRE(DeprecatedVerifier().documentation() != ""); + REQUIRE(DeprecatedVerifier().documentation() != ""); + REQUIRE(DeprecatedVerifier().documentation() != ""); + REQUIRE(DeprecatedVerifier().documentation() != ""); + REQUIRE(DeprecatedVerifier().documentation() != ""); + REQUIRE(DeprecatedVerifier().documentation() != ""); + REQUIRE(DeprecatedVerifier().documentation() != ""); + REQUIRE(DeprecatedVerifier().documentation() != ""); + + REQUIRE(ReferencingVerifier("identifier"s).documentation() != ""); +} diff --git a/tests/test_documentation.inl b/tests/test_documentation.inl deleted file mode 100644 index 10c6b3b0ee..0000000000 --- a/tests/test_documentation.inl +++ /dev/null @@ -1,2924 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2019 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include -#include -#include - -#include - -#include - -class DocumentationTest : public testing::Test {}; - -TEST_F(DocumentationTest, Constructor) { - using namespace openspace::documentation; - - Documentation doc; - - // Basic Verifiers - doc.entries.emplace_back("BoolVerifier", new BoolVerifier, Optional::No); - doc.entries.emplace_back("DoubleVerifier", new DoubleVerifier, Optional::No); - doc.entries.emplace_back("IntVerifier", new IntVerifier, Optional::No); - doc.entries.emplace_back("StringVerifier", new StringVerifier, Optional::No); - doc.entries.emplace_back("TableVerifier", new TableVerifier, Optional::No); - - // Operator Verifiers - doc.entries.emplace_back("LessDouble", new DoubleLessVerifier(0.0), Optional::No); - doc.entries.emplace_back("LessInt", new IntLessVerifier(0), Optional::No); - - doc.entries.emplace_back("LessEqualDouble", new DoubleLessEqualVerifier(0.0), Optional::No); - doc.entries.emplace_back("LessEqualInt", new IntLessEqualVerifier(0), Optional::No); - - doc.entries.emplace_back("GreaterDouble", new DoubleGreaterVerifier(0.0), Optional::No); - doc.entries.emplace_back("GreaterInt", new IntGreaterVerifier(0), Optional::No); - - doc.entries.emplace_back("GreaterEqualDouble", new DoubleGreaterEqualVerifier(0.0), Optional::No); - doc.entries.emplace_back("GreaterEqualInt", new IntGreaterEqualVerifier(0), Optional::No); - - doc.entries.emplace_back("EqualBool", new BoolEqualVerifier(false), Optional::No); - doc.entries.emplace_back("EqualDouble", new DoubleEqualVerifier(0.0), Optional::No); - doc.entries.emplace_back("EqualInt", new IntEqualVerifier(0), Optional::No); - doc.entries.emplace_back("EqualString", new StringEqualVerifier(""), Optional::No); - - doc.entries.emplace_back("UnequalBool", new BoolUnequalVerifier(false), Optional::No); - doc.entries.emplace_back("UnequalDouble", new DoubleUnequalVerifier(0.0), Optional::No); - doc.entries.emplace_back("UnequalInt", new IntUnequalVerifier(0), Optional::No); - doc.entries.emplace_back("UnequalString", new StringUnequalVerifier(""), Optional::No); - - // List Verifiers - doc.entries.emplace_back("InListBool", new BoolInListVerifier({ true, false }), Optional::No); - doc.entries.emplace_back("InListDouble", new DoubleInListVerifier({ 0.0, 1.0}), Optional::No); - doc.entries.emplace_back("InListInt", new IntInListVerifier({ 0, 1 }), Optional::No); - doc.entries.emplace_back("InListString", new StringInListVerifier({ "", "a" }), Optional::No); - - doc.entries.emplace_back("NotInListBool", new BoolNotInListVerifier({ true, false }), Optional::No); - doc.entries.emplace_back("NotInListDouble", new DoubleNotInListVerifier({ 0.0, 1.0 }), Optional::No); - doc.entries.emplace_back("NotInListInt", new IntNotInListVerifier({ 0, 1 }), Optional::No); - doc.entries.emplace_back("NotInListString", new StringNotInListVerifier({ "", "a" }), Optional::No); - - doc.entries.emplace_back("StringListVerifier", new StringListVerifier, Optional::No); - doc.entries.emplace_back("IntListVerifier", new IntListVerifier, Optional::No); - - // Range Verifiers - doc.entries.emplace_back("InListDouble", new DoubleInRangeVerifier({ 0.0, 1.0 }), Optional::No); - doc.entries.emplace_back("InListInt", new IntInRangeVerifier({ 0, 1 }), Optional::No); - - doc.entries.emplace_back("NotInListDouble", new DoubleNotInRangeVerifier({ 0.0, 1.0 }), Optional::No); - doc.entries.emplace_back("NotInListInt", new IntNotInRangeVerifier({ 0, 1 }), Optional::No); - - // Misc Verifiers - doc.entries.emplace_back("AnnotationBool", new BoolAnnotationVerifier("Bool"), Optional::No); - doc.entries.emplace_back("AnnotationDouble", new DoubleAnnotationVerifier("Double"), Optional::No); - doc.entries.emplace_back("AnnotationInt", new IntAnnotationVerifier("Int"), Optional::No); - doc.entries.emplace_back("AnnotationString", new StringAnnotationVerifier("String"), Optional::No); - doc.entries.emplace_back("AnnotationTable", new TableAnnotationVerifier("Table"), Optional::No); -} - -TEST_F(DocumentationTest, InitializerConstructor) { - using namespace openspace::documentation; - - Documentation doc { - { - // Basic Verifiers - {"BoolVerifier", new BoolVerifier, Optional::No }, - {"DoubleVerifier", new DoubleVerifier, Optional::No }, - {"IntVerifier", new IntVerifier, Optional::No }, - {"StringVerifier", new StringVerifier, Optional::No }, - {"TableVerifier", new TableVerifier, Optional::No }, - - // Operator Verifiers - { "LessDouble", new DoubleLessVerifier(0.0), Optional::No }, - { "LessInt", new IntLessVerifier(0), Optional::No }, - - {"LessEqualDouble", new DoubleLessEqualVerifier(0.0), Optional::No }, - {"LessEqualInt", new IntLessEqualVerifier(0), Optional::No }, - - {"GreaterDouble", new DoubleGreaterVerifier(0.0), Optional::No }, - {"GreaterInt", new IntGreaterVerifier(0), Optional::No }, - - {"GreaterEqualDouble", new DoubleGreaterEqualVerifier(0.0), Optional::No }, - {"GreaterEqualInt", new IntGreaterEqualVerifier(0), Optional::No }, - - {"EqualBool", new BoolEqualVerifier(false), Optional::No }, - {"EqualDouble", new DoubleEqualVerifier(0.0), Optional::No }, - {"EqualInt", new IntEqualVerifier(0), Optional::No }, - {"EqualString", new StringEqualVerifier(""), Optional::No }, - - {"UnequalBool", new BoolUnequalVerifier(false), Optional::No }, - {"UnequalDouble", new DoubleUnequalVerifier(0.0), Optional::No }, - {"UnequalInt", new IntUnequalVerifier(0), Optional::No }, - {"UnequalString", new StringUnequalVerifier(""), Optional::No }, - - // List Verifiers - {"InListBool", new BoolInListVerifier({ true, false }), Optional::No }, - {"InListDouble", new DoubleInListVerifier({ 0.0, 1.0 }), Optional::No }, - {"InListInt", new IntInListVerifier({ 0, 1 }), Optional::No }, - {"InListString", new StringInListVerifier({ "", "a" }), Optional::No }, - - {"NotInListBool", new BoolNotInListVerifier({ true, false }), Optional::No }, - {"NotInListDouble", new DoubleNotInListVerifier({ 0.0, 1.0 }), Optional::No }, - {"NotInListInt", new IntNotInListVerifier({ 0, 1 }), Optional::No }, - {"NotInListString", new StringNotInListVerifier({ "", "a" }), Optional::No }, - - // Range Verifiers - {"InRangeDouble", new DoubleInRangeVerifier(0.0, 1.0), Optional::No }, - {"InRangeInt", new IntInRangeVerifier(0, 1), Optional::No }, - - {"InRangeDouble", new DoubleNotInRangeVerifier(0.0, 1.0), Optional::No }, - {"InRangeInt", new IntNotInRangeVerifier(0, 1), Optional::No }, - - // Misc Verifiers - {"AnnotationBool", new BoolAnnotationVerifier("Bool"), Optional::No }, - {"AnnotationDouble", new DoubleAnnotationVerifier("Double"), Optional::No }, - {"AnnotationInt", new IntAnnotationVerifier("Int"), Optional::No }, - {"AnnotationString", new StringAnnotationVerifier("String"), Optional::No }, - {"AnnotationTable", new TableAnnotationVerifier("Table"), Optional::No } - } - }; -} - -TEST_F(DocumentationTest, BoolVerifier) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Bool", new BoolVerifier, Optional::No }} - }; - - ghoul::Dictionary positive { - { "Bool", true } - }; - - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Bool", 0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Bool", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negativeExist { - { "Bool2", 0} - }; - negativeRes = testSpecification(doc, negativeExist); - - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Bool", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleVerifier) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double", new DoubleVerifier, Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", 0.0 } - }; - - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 0 } - }; - - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negativeExist{ - { "Double2" , 0.0 } - }; - negativeRes = testSpecification(doc, negativeExist); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, IntVerifier) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new IntVerifier, Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", 0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "Int", 0.0 } - }; - positiveRes = testSpecification(doc, positive2); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 0.1 } - }; - - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negativeExist { - { "Int2", 0 } - }; - negativeRes = testSpecification(doc, negativeExist); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, StringVerifier) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - {{ "String", new StringVerifier, Optional::No }} - }; - - ghoul::Dictionary positive { - { "String", ""s } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "String", 0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("String", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negativeExist { - { "String2", ""s } - }; - negativeRes = testSpecification(doc, negativeExist); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("String", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, TableVerifierType) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Table", new TableVerifier, Optional::No }} - }; - - ghoul::Dictionary positive { - { "Table", ghoul::Dictionary{} } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Table", 0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Table", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negativeExist { - { "Table2", ghoul::Dictionary{} } - }; - negativeRes = testSpecification(doc, negativeExist); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Table", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, StringListVerifierType) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - { { "StringList", new StringListVerifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { - "StringList", - ghoul::Dictionary { - { "1", "a"s }, - { "2", "b"s }, - { "3", "c"s } - } - } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "StringList", 0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("StringList", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { - "StringList", - ghoul::Dictionary { - { "1", "a"s }, - { "2", "b"s }, - { "3", 2.0 } - } - } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("StringList.3", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negativeExist { - { "StringList2", ghoul::Dictionary{} } - }; - negativeRes = testSpecification(doc, negativeExist); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("StringList", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, IntListVerifierType) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - { { "IntList", new IntListVerifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { - "IntList", - ghoul::Dictionary{ - { "1", 1 }, - { "2", 2 }, - { "3", 3 } - } - } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative{ - { "IntList", 0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("IntList", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { - "IntList", - ghoul::Dictionary{ - { "1", "a"s }, - { "2", 1 }, - { "3", 2 } - } - } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("IntList.1", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negativeExist { - { "IntList2", ghoul::Dictionary{} } - }; - negativeRes = testSpecification(doc, negativeExist); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("IntList", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, MixedVerifiers) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - { - { "Bool", new BoolVerifier, Optional::No }, - { "Double", new DoubleVerifier, Optional::No }, - { "Int", new IntVerifier, Optional::No }, - { "String", new StringVerifier, Optional::No }, - { "Table", new TableVerifier, Optional::No } - } - }; - - ghoul::Dictionary positive { - { "Bool", true }, - { "Double", 0.0 }, - { "Int", 0 }, - { "String", ""s }, - { "Table", ghoul::Dictionary{} } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative1 { - { "Bool", true }, - { "Double", 1 }, - { "Int", 0 }, - { "String", ""s }, - { "Table", ghoul::Dictionary{} } - }; - TestResult negativeRes = testSpecification(doc, negative1); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "Bool", true }, - { "Double", 0.0 }, - { "Int", ""s }, - { "String", 1 }, - { "Table", ghoul::Dictionary{} } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(2, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - EXPECT_EQ("String", negativeRes.offenses[1].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[1].reason); -} - -TEST_F(DocumentationTest, NestedTables) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - { - { "Outer_Int", new IntVerifier, Optional::No }, - { "Outer_Table", new TableVerifier({ - { "Inner_Double", new DoubleVerifier, Optional::No }, - { "Inner_String", new StringVerifier, Optional::No } - }), Optional::No }, - { "Outer_Double", new DoubleVerifier, Optional::No }, - { "Outer_Table2" , new TableVerifier({ - { "Inner_Double2", new DoubleVerifier, Optional::No }, - { "Inner_String2", new StringVerifier, Optional::No }, - { "Inner_Table" , new TableVerifier({ - { "Inner_Inner_Int", new IntVerifier, Optional::No } - }), Optional::No } - }), Optional::No} - } - }; - - ghoul::Dictionary positive { - { "Outer_Int", 1 }, - { "Outer_Table", ghoul::Dictionary { - { "Inner_Double", 0.0 }, - { "Inner_String", ""s } - }}, - { "Outer_Double", 0.0 }, - { "Outer_Table2", ghoul::Dictionary { - { "Inner_Double2", 0.0 }, - { "Inner_String2", ""s }, - { "Inner_Table", ghoul::Dictionary { - { "Inner_Inner_Int", 0 } - }} - }} - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negativeSimple { - { "Outer_Int", 1 }, - { "Outer_Table", 0}, - { "Outer_Double", 0.0 }, - { "Outer_Table2", ghoul::Dictionary { - { "Inner_Double2", 0.0 }, - { "Inner_String2", ""s }, - { "Inner_Table", ghoul::Dictionary { - { "Inner_Inner_Int", 0 } - }} - }} - }; - TestResult negativeRes = testSpecification(doc, negativeSimple); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Outer_Table", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negativeInner { - { "Outer_Int", 1 }, - { "Outer_Table", ghoul::Dictionary { - { "Inner_Double", ""s }, - { "Inner_String", ""s } - }}, - { "Outer_Double", 0.0 }, - { "Outer_Table2", ghoul::Dictionary { - { "Inner_Double2", 0.0 }, - { "Inner_String2", ""s }, - { "Inner_Table", ghoul::Dictionary { - { "Inner_Inner_Int", 0 } - }} - }} - }; - negativeRes = testSpecification(doc, negativeInner); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Outer_Table.Inner_Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negativeInner2 { - { "Outer_Int", 1 }, - { "Outer_Table", ghoul::Dictionary { - { "Inner_Double", ""s }, - { "Inner_String", 0.0 } - }}, - { "Outer_Double", 0.0 }, - { "Outer_Table2", ghoul::Dictionary { - { "Inner_Double2", 0.0 }, - { "Inner_String2", ""s }, - { "Inner_Table", ghoul::Dictionary { - { "Inner_Inner_Int", 0 } - }} - }} - }; - negativeRes = testSpecification(doc, negativeInner2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(2, negativeRes.offenses.size()); - EXPECT_EQ("Outer_Table.Inner_Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - EXPECT_EQ("Outer_Table.Inner_String", negativeRes.offenses[1].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[1].reason); - - ghoul::Dictionary negativeInnerSeparate { - { "Outer_Int", 1 }, - { "Outer_Table", ghoul::Dictionary { - { "Inner_Double", ""s }, - { "Inner_String", ""s } - } }, - { "Outer_Double", 0.0 }, - { "Outer_Table2", ghoul::Dictionary { - { "Inner_Double2", ""s }, - { "Inner_String2", ""s }, - { "Inner_Table", ghoul::Dictionary { - { "Inner_Inner_Int", 0 } - }} - }} - }; - negativeRes = testSpecification(doc, negativeInnerSeparate); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(2, negativeRes.offenses.size()); - EXPECT_EQ("Outer_Table.Inner_Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - EXPECT_EQ("Outer_Table2.Inner_Double2", negativeRes.offenses[1].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[1].reason); - - ghoul::Dictionary negativeInnerFull { - { "Outer_Int", 1 }, - { "Outer_Table", ghoul::Dictionary { - { "Inner_Double", ""s }, - { "Inner_String", ""s } - } }, - { "Outer_Double", 0.0 }, - { "Outer_Table2", ghoul::Dictionary { - { "Inner_Double2", ""s }, - { "Inner_String2", ""s }, - { "Inner_Table", ghoul::Dictionary { - { "Inner_Inner_Int", ""s } - }} - }} - }; - negativeRes = testSpecification(doc, negativeInnerFull); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(3, negativeRes.offenses.size()); - EXPECT_EQ("Outer_Table.Inner_Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - EXPECT_EQ("Outer_Table2.Inner_Double2", negativeRes.offenses[1].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[1].reason); - EXPECT_EQ("Outer_Table2.Inner_Table.Inner_Inner_Int", negativeRes.offenses[2].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[2].reason); -} - -TEST_F(DocumentationTest, Optional) { - using namespace openspace::documentation; - - Documentation doc { - { - { "Bool_Force", new BoolVerifier, Optional::No }, - { "Bool_Optional", new BoolVerifier, Optional::Yes } - } - }; - - ghoul::Dictionary positive { - { "Bool_Force", true }, - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "Bool_Force", true }, - { "Bool_Optional", true } - }; - positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Bool_Force", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "Bool_Optional", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Bool_Force", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative3 { - { "Bool_Force", true }, - { "Bool_Optional", 1 } - }; - negativeRes = testSpecification(doc, negative3); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Bool_Optional", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, RequiredInOptional) { - using namespace openspace::documentation; - - Documentation doc { - {{ - "a", - new TableVerifier({ - { - "b", - new IntVerifier, - Optional::No - }, - { - "c", - new IntVerifier, - Optional::Yes - } - }), - Optional::Yes - }} - }; - - ghoul::Dictionary positive { - { - "a", ghoul::Dictionary{ - { "b", 1 } - } - } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { - "a", ghoul::Dictionary{ - { "b", 1 }, - { "c", 2 } - } - } - }; - positiveRes = testSpecification(doc, positive2); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive3 {}; - positiveRes = testSpecification(doc, positive3); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "c", 2 }}} - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a.b", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); -} - -// Exhaustive documentations went away, but we are keeping this test just for funsies -TEST_F(DocumentationTest, Exhaustive) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new IntVerifier, Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int" , 1 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "False_Int", 1 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "Double", 2.0 } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, NestedExhaustive) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Table", new TableVerifier( - { { "a", new IntVerifier, Optional::No } } - ), Optional::No - }} - }; - - ghoul::Dictionary positive { - { "Table", ghoul::Dictionary{{ "a", 1 }}} - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Table", ghoul::Dictionary{{ "b", 2.0 }}} - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Table.a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::MissingKey, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, EmptyEntriesNonExhaustive) { - using namespace openspace::documentation; - - Documentation doc; - - ghoul::Dictionary positive {}; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "a", 1 } - }; - positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); -} - -TEST_F(DocumentationTest, EmptyNestedExhaustive) { - using namespace openspace::documentation; - - Documentation doc { - {{ - "Table", - new TableVerifier(), - Optional::No, - }} - }; - - ghoul::Dictionary positive { - { "Table", ghoul::Dictionary() } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Table", ghoul::Dictionary{ { "a", 1 }}} - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_TRUE(negativeRes.success); - ASSERT_EQ(0, negativeRes.offenses.size()); -} - -TEST_F(DocumentationTest, LessInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new IntLessVerifier(5), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", 0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 10 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, LessDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double", new DoubleLessVerifier(5.0), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", 0.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 10.0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, LessEqualInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new IntLessEqualVerifier(5), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", 0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positiveEqual { - { "Int", 5 } - }; - positiveRes = testSpecification(doc, positiveEqual); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 10 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, LessEqualDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double", new DoubleLessEqualVerifier(5.0), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", 0.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positiveEqual { - { "Double", 5.0 } - }; - positiveRes = testSpecification(doc, positiveEqual); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 10.0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, GreaterInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new IntGreaterVerifier(5), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", 10 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, GreaterDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double", new DoubleGreaterVerifier(5.0), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", 10.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 0.0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, GreaterEqualInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new IntGreaterEqualVerifier(5), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", 10 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positiveEqual { - { "Int", 5 } - }; - positiveRes = testSpecification(doc, positiveEqual); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, GreaterEqualDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double", new DoubleGreaterEqualVerifier(5.0), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", 10.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positiveEqual { - { "Double", 5.0 } - }; - positiveRes = testSpecification(doc, positiveEqual); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 0.0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, EqualBool) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Bool", new BoolEqualVerifier(true), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Bool", true} - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Bool", false } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Bool", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, EqualInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new IntEqualVerifier(1), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", 1} - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, EqualDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double", new DoubleEqualVerifier(1.0), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", 1.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 0.0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, EqualString) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - {{ "String", new StringEqualVerifier("string"s), Optional::No }} - }; - - ghoul::Dictionary positive { - { "String", "string"s } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "String", "no_string"s } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("String", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, UnequalBool) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Bool", new BoolUnequalVerifier(true), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Bool", false } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Bool", true } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Bool", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, UnequalInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new IntUnequalVerifier(1), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", 0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 1 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, UnequalDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double", new DoubleUnequalVerifier(1.0), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", 0.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 1.0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, UnequalString) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - {{ "String", new StringUnequalVerifier("string"s), Optional::No }} - }; - - ghoul::Dictionary positive { - { "String", "no_string"s } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "String", "string"s } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("String", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, ListBool) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Bool" , new BoolInListVerifier({ true }), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Bool", true } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Bool", false } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Bool", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, ListInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int" , new IntInListVerifier({ 0, 1, 2 }), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", 1 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "Int", 2 } - }; - positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 5 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, ListDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double" , new DoubleInListVerifier({ 0.0, 1.0, 2.0 }), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", 1.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "Double", 2.0 } - }; - positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 5.0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, ListString) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - {{ "String" , new StringInListVerifier({ "0"s, "1"s, "2"s }), Optional::No }} - }; - - ghoul::Dictionary positive { - { "String", "1"s } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "String", "2"s } - }; - positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "String", "5"s } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("String", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, NotListBool) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Bool" , new BoolNotInListVerifier({ true }), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Bool", false } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Bool", true } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Bool", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, NotListInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int" , new IntNotInListVerifier({ 0, 1, 2 }), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", -1 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "Int", 3 } - }; - positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 2 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, NotListDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double" , new DoubleNotInListVerifier({ 0.0, 1.0, 2.0 }), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", -1.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "Double", 3.0 } - }; - positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 1.0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, NotListString) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - {{ "String" , new StringNotInListVerifier({ "0"s, "1"s, "2"s }), Optional::No }} - }; - - ghoul::Dictionary positive { - { "String", "string"s } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "String", "foo_string"s } - }; - positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "String", "1"s } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("String", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, AnnotationBool) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Bool", new BoolAnnotationVerifier("Bool"), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Bool", true } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Bool", 0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Bool", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, AnnotationInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new IntAnnotationVerifier("Int"), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", 1 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 1.1 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, AnnotationDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double", new DoubleAnnotationVerifier("Double"), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", 0.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", true } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, AnnotationString) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - {{ "String", new StringAnnotationVerifier("String"), Optional::No }} - }; - - ghoul::Dictionary positive { - { "String", ""s } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "String", 1 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("String", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, AnnotationTable) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Table", new TableAnnotationVerifier("Table"), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Table", ghoul::Dictionary{} } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Table", 1 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Table", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, InRangeInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new InRangeVerifier(0, 5), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", 2 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "Int", 0 } - }; - positiveRes = testSpecification(doc, positive2); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive3 { - { "Int", 5 } - }; - positiveRes = testSpecification(doc, positive3); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 10 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, InRangeDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double", new InRangeVerifier(0.0, 5.0), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", 2.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "Double", 0.0 } - }; - positiveRes = testSpecification(doc, positive2); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive3 { - { "Double", 5.0 } - }; - positiveRes = testSpecification(doc, positive3); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive4 { - { "Double", 1.5 } - }; - positiveRes = testSpecification(doc, positive4); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 10.0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, NotInRangeInt) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Int", new NotInRangeVerifier(0, 5), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Int", -1 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "Int", 6 } - }; - positiveRes = testSpecification(doc, positive2); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Int", 2 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "Int", 0 } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative3 { - { "Int", 5 } - }; - negativeRes = testSpecification(doc, negative3); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Int", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, NotInRangeDouble) { - using namespace openspace::documentation; - - Documentation doc { - {{ "Double", new NotInRangeVerifier(0.0, 5.0), Optional::No }} - }; - - ghoul::Dictionary positive { - { "Double", -1.0 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "Double", 6.0 } - }; - positiveRes = testSpecification(doc, positive2); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Double", 0.0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "Double", 5.0 } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative3 { - { "Double", 2.5 } - }; - negativeRes = testSpecification(doc, negative3); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Double", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, Wildcard) { - using namespace openspace::documentation; - - Documentation doc { - {{ DocumentationEntry::Wildcard, new IntVerifier, Optional::No }} - }; - - ghoul::Dictionary positive { - { "a", 1 }, - { "b", 2 }, - { "c", 3 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", false }, - { "b", 2 }, - { "c", 3 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", false }, - { "b", false }, - { "c", 3 } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(2, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - EXPECT_EQ("b", negativeRes.offenses[1].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[1].reason); - - ghoul::Dictionary negative3 { - { "a", false }, - { "b", false }, - { "c", false } - }; - negativeRes = testSpecification(doc, negative3); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(3, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - EXPECT_EQ("b", negativeRes.offenses[1].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[1].reason); - EXPECT_EQ("c", negativeRes.offenses[2].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[2].reason); -} - -TEST_F(DocumentationTest, WildcardMixed) { - using namespace openspace::documentation; - - Documentation doc { - { - { DocumentationEntry::Wildcard, new IntVerifier , Optional::No}, - { "b", new IntGreaterVerifier(5), Optional::No } - } - }; - - ghoul::Dictionary positive { - { "a", 1 }, - { "b", 8 }, - { "c", 3 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", false }, - { "b", 2 }, - { "c", 3 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(2, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - EXPECT_EQ("b", negativeRes.offenses[1].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[1].reason); - - ghoul::Dictionary negative2 { - { "a", false }, - { "b", false }, - { "c", 3 } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(2, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - EXPECT_EQ("b", negativeRes.offenses[1].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[1].reason); - - ghoul::Dictionary negative3 { - { "a", false }, - { "b", 1 }, - { "c", false } - }; - negativeRes = testSpecification(doc, negative3); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(3, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - EXPECT_EQ("b", negativeRes.offenses[1].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[1].reason); - EXPECT_EQ("c", negativeRes.offenses[2].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[2].reason); - - ghoul::Dictionary negative4 { - { "a", false }, - { "b", 10 }, - { "c", false } - }; - negativeRes = testSpecification(doc, negative4); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(2, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - EXPECT_EQ("c", negativeRes.offenses[1].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[1].reason); -} - -TEST_F(DocumentationTest, Referencing) { - using namespace openspace::documentation; - - Documentation referenced { - "Referenced Name", - "referenced_id", - { - { "a", new IntVerifier, Optional::No }, - { "b", new DoubleVerifier, Optional::No } - }, - }; - DocEng.addDocumentation(referenced); - - Documentation doc {{ - { "Table", new ReferencingVerifier("referenced_id"), Optional::No } - }}; - - ghoul::Dictionary positive { - { "Table", ghoul::Dictionary{ { "a", 1 }, { "b", 2.0 } }} - }; - - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "Table", 1 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Table", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "Table", ghoul::Dictionary{ { "a", 1 }, { "b", true }}} - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Table.b", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - - Documentation wrongDoc {{ - { "Table", new ReferencingVerifier("WRONG"), Optional::No } - } }; - ghoul::Dictionary wrongNegative { - { "Table", ghoul::Dictionary{ { "a", 1 },{ "b", 2.0 } } } - }; - negativeRes = testSpecification(wrongDoc, wrongNegative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("Table", negativeRes.offenses[0].offender); - EXPECT_EQ( - TestResult::Offense::Reason::UnknownIdentifier, - negativeRes.offenses[0].reason - ); -} - - -TEST_F(DocumentationTest, AndOperator) { - using namespace openspace::documentation; - - Documentation doc { - { - { - "a", - new AndVerifier({ - new IntGreaterEqualVerifier(2), new IntLessEqualVerifier(5) - }), - Optional::No - } - } - }; - - ghoul::Dictionary positive { - { "a", 4 } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", 0 } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", 8 } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, OrOperator) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { - {{ "a", new OrVerifier({ new StringVerifier, new IntVerifier }), Optional::No }} - }; - - ghoul::Dictionary positive { - { "a", ""s } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary positive2 { - { "a", 1 } - }; - positiveRes = testSpecification(doc, positive2); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", false } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::Verification, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, BoolVector2Verifier) { - using namespace openspace::documentation; - - Documentation doc { - {{ "a", new BoolVector2Verifier, Optional::No }} - }; - - ghoul::Dictionary positive { - { "a", glm::bvec2(true) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true }, { "2", 1.0 } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, IntVector2Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new IntVector2Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::ivec2(2) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1 } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleVector2Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleVector2Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dvec2(2.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true }, { "2", 1.0 } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, BoolVector3Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new BoolVector3Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::bvec3(true) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 }, { "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, IntVector3Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new IntVector3Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::ivec3(2) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1 }, { "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleVector3Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleVector3Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dvec3(2.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 }, { "3", "s"} } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, BoolVector4Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new BoolVector4Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::bvec4(true) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 }, { "3", "s" }, { "4", 1 }}} - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, IntVector4Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new IntVector4Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::ivec4(2) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1 },{ "3", "s" }, { "4", 1 } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2{ - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleVector4Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleVector4Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dvec4(2.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" }, { "4", 1 } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleMatrix2x2Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleMatrix2x2Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dmat2x2(1.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary { { "1", true },{ "2", 1.0 },{ "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleMatrix2x3Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleMatrix2x3Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dmat2x3(1.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleMatrix2x4Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleMatrix2x4Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dmat2x4(1.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleMatrix3x2Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleMatrix3x2Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dmat3x2(1.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleMatrix3x3Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleMatrix3x3Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dmat3x3(1.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleMatrix3x4Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleMatrix3x4Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dmat3x4(1.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleMatrix4x2Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleMatrix4x2Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dmat4x2(1.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleMatrix4x3Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleMatrix4x3Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dmat4x3(1.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DoubleMatrix4x4Verifier) { - using namespace openspace::documentation; - - Documentation doc { - { { "a", new DoubleMatrix4x4Verifier, Optional::No } } - }; - - ghoul::Dictionary positive { - { "a", glm::dmat4x4(1.0) } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - - ghoul::Dictionary negative { - { "a", ghoul::Dictionary{ { "1", true },{ "2", 1.0 },{ "3", "s" } } } - }; - TestResult negativeRes = testSpecification(doc, negative); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); - - ghoul::Dictionary negative2 { - { "a", true } - }; - negativeRes = testSpecification(doc, negative2); - EXPECT_FALSE(negativeRes.success); - ASSERT_EQ(1, negativeRes.offenses.size()); - EXPECT_EQ("a", negativeRes.offenses[0].offender); - EXPECT_EQ(TestResult::Offense::Reason::WrongType, negativeRes.offenses[0].reason); -} - -TEST_F(DocumentationTest, DeprecatedVerifier) { - using namespace openspace::documentation; - using namespace std::string_literals; - - Documentation doc { { - { "bool", new BoolDeprecatedVerifier, Optional::No }, - { "int" , new IntDeprecatedVerifier, Optional::No }, - { "double", new DoubleDeprecatedVerifier, Optional::No }, - { "string" , new StringDeprecatedVerifier, Optional::No }, - { "boolvec2", new DeprecatedVerifier, Optional::No }, - { "intvec2", new DeprecatedVerifier, Optional::No }, - { "doublevec2", new DeprecatedVerifier, Optional::No }, - { "boolvec3", new DeprecatedVerifier, Optional::No }, - { "intvec3", new DeprecatedVerifier, Optional::No }, - { "doublevec3", new DeprecatedVerifier, Optional::No }, - { "boolvec4", new DeprecatedVerifier, Optional::No }, - { "intvec4", new DeprecatedVerifier, Optional::No }, - { "doublevec4", new DeprecatedVerifier, Optional::No } - }}; - - ghoul::Dictionary positive { - { "bool", true }, - { "int", 1 }, - { "double", 2.0 }, - { "string" , ""s }, - { "boolvec2", glm::bvec2() }, - { "intvec2", glm::ivec2() }, - { "doublevec2", glm::dvec2() }, - { "boolvec3", glm::bvec3() }, - { "intvec3", glm::ivec3() }, - { "doublevec3", glm::dvec3() }, - { "boolvec4", glm::bvec4() }, - { "intvec4", glm::ivec4() }, - { "doublevec4", glm::dvec4() } - }; - TestResult positiveRes = testSpecification(doc, positive); - EXPECT_TRUE(positiveRes.success); - EXPECT_EQ(0, positiveRes.offenses.size()); - ASSERT_EQ(13, positiveRes.warnings.size()); - EXPECT_EQ("bool", positiveRes.warnings[0].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[0].reason); - EXPECT_EQ("boolvec2", positiveRes.warnings[1].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[1].reason); - EXPECT_EQ("boolvec3", positiveRes.warnings[2].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[2].reason); - EXPECT_EQ("boolvec4", positiveRes.warnings[3].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[3].reason); - EXPECT_EQ("double", positiveRes.warnings[4].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[4].reason); - EXPECT_EQ("doublevec2", positiveRes.warnings[5].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[5].reason); - EXPECT_EQ("doublevec3", positiveRes.warnings[6].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[6].reason); - EXPECT_EQ("doublevec4", positiveRes.warnings[7].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[7].reason); - EXPECT_EQ("int", positiveRes.warnings[8].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[8].reason); - EXPECT_EQ("intvec2", positiveRes.warnings[9].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[9].reason); - EXPECT_EQ("intvec3", positiveRes.warnings[10].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[10].reason); - EXPECT_EQ("intvec4", positiveRes.warnings[11].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[11].reason); - EXPECT_EQ("string", positiveRes.warnings[12].offender); - EXPECT_EQ(TestResult::Warning::Reason::Deprecated, positiveRes.warnings[12].reason); -} - -TEST_F(DocumentationTest, VerifierTypePostConditions) { - using namespace openspace::documentation; - using namespace std::string_literals; - - EXPECT_NE("", BoolVerifier().type()); - EXPECT_NE("", DoubleVerifier().type()); - EXPECT_NE("", IntVerifier().type()); - EXPECT_NE("", StringVerifier().type()); - EXPECT_NE("", TableVerifier().type()); - - EXPECT_NE("", BoolVector2Verifier().type()); - EXPECT_NE("", IntVector2Verifier().type()); - EXPECT_NE("", DoubleVector2Verifier().type()); - EXPECT_NE("", BoolVector3Verifier().type()); - EXPECT_NE("", IntVector3Verifier().type()); - EXPECT_NE("", DoubleVector3Verifier().type()); - EXPECT_NE("", BoolVector4Verifier().type()); - EXPECT_NE("", IntVector4Verifier().type()); - EXPECT_NE("", DoubleVector4Verifier().type()); - - EXPECT_NE("", IntLessVerifier(0).type()); - EXPECT_NE("", DoubleLessVerifier(0.0).type()); - EXPECT_NE("", IntLessEqualVerifier(0).type()); - EXPECT_NE("", DoubleLessEqualVerifier(0.0).type()); - EXPECT_NE("", IntGreaterVerifier(0).type()); - EXPECT_NE("", DoubleGreaterVerifier(0.0).type()); - EXPECT_NE("", IntGreaterEqualVerifier(0).type()); - EXPECT_NE("", DoubleGreaterEqualVerifier(0.0).type()); - - EXPECT_NE("", BoolEqualVerifier(true).type()); - EXPECT_NE("", IntEqualVerifier(0).type()); - EXPECT_NE("", DoubleEqualVerifier(0.0).type()); - EXPECT_NE("", StringEqualVerifier(""s).type()); - EXPECT_NE("", BoolUnequalVerifier(true).type()); - EXPECT_NE("", IntUnequalVerifier(0).type()); - EXPECT_NE("", DoubleUnequalVerifier(0.0).type()); - EXPECT_NE("", StringUnequalVerifier(""s).type()); - - EXPECT_NE("", BoolInListVerifier({ true }).type()); - EXPECT_NE("", IntInListVerifier({ 0 }).type()); - EXPECT_NE("", DoubleInListVerifier({ 0.0 }).type()); - EXPECT_NE("", StringInListVerifier({ ""s }).type()); - EXPECT_NE("", BoolNotInListVerifier({ true }).type()); - EXPECT_NE("", IntNotInListVerifier({ 0 }).type()); - EXPECT_NE("", DoubleNotInListVerifier({ 0.0 }).type()); - EXPECT_NE("", StringNotInListVerifier({ ""s }).type()); - - EXPECT_NE("", IntInRangeVerifier({ 0, 1 }).type()); - EXPECT_NE("", DoubleInRangeVerifier({ 0.0, 1.0 }).type()); - EXPECT_NE("", IntNotInRangeVerifier({ 0, 1 }).type()); - EXPECT_NE("", DoubleNotInRangeVerifier({ 0.0, 1.0 }).type()); - - EXPECT_NE("", BoolAnnotationVerifier("A"s).type()); - EXPECT_NE("", IntAnnotationVerifier("A"s).type()); - EXPECT_NE("", DoubleAnnotationVerifier("A"s).type()); - EXPECT_NE("", StringAnnotationVerifier("A"s).type()); - EXPECT_NE("", TableAnnotationVerifier("A"s).type()); - EXPECT_NE("", AnnotationVerifier("A"s).type()); - EXPECT_NE("", AnnotationVerifier("A"s).type()); - EXPECT_NE("", AnnotationVerifier("A"s).type()); - EXPECT_NE("", AnnotationVerifier("A"s).type()); - EXPECT_NE("", AnnotationVerifier("A"s).type()); - EXPECT_NE("", AnnotationVerifier("A"s).type()); - EXPECT_NE("", AnnotationVerifier("A"s).type()); - EXPECT_NE("", AnnotationVerifier("A"s).type()); - EXPECT_NE("", AnnotationVerifier("A"s).type()); - - EXPECT_NE("", BoolDeprecatedVerifier().type()); - EXPECT_NE("", IntDeprecatedVerifier().type()); - EXPECT_NE("", DoubleDeprecatedVerifier().type()); - EXPECT_NE("", StringDeprecatedVerifier().type()); - EXPECT_NE("", TableDeprecatedVerifier().type()); - EXPECT_NE("", DeprecatedVerifier().type()); - EXPECT_NE("", DeprecatedVerifier().type()); - EXPECT_NE("", DeprecatedVerifier().type()); - EXPECT_NE("", DeprecatedVerifier().type()); - EXPECT_NE("", DeprecatedVerifier().type()); - EXPECT_NE("", DeprecatedVerifier().type()); - EXPECT_NE("", DeprecatedVerifier().type()); - EXPECT_NE("", DeprecatedVerifier().type()); - EXPECT_NE("", DeprecatedVerifier().type()); - - EXPECT_NE("", ReferencingVerifier("identifier"s).type()); -} - -TEST_F(DocumentationTest, VerifierDocumentationPostConditions) { - using namespace openspace::documentation; - using namespace std::string_literals; - - EXPECT_NE("", BoolVerifier().documentation()); - EXPECT_NE("", DoubleVerifier().documentation()); - EXPECT_NE("", IntVerifier().documentation()); - EXPECT_NE("", StringVerifier().documentation()); - EXPECT_NE("", TableVerifier().documentation()); - - EXPECT_NE("", BoolVector2Verifier().documentation()); - EXPECT_NE("", IntVector2Verifier().documentation()); - EXPECT_NE("", DoubleVector2Verifier().documentation()); - EXPECT_NE("", BoolVector3Verifier().documentation()); - EXPECT_NE("", IntVector3Verifier().documentation()); - EXPECT_NE("", DoubleVector3Verifier().documentation()); - EXPECT_NE("", BoolVector4Verifier().documentation()); - EXPECT_NE("", IntVector4Verifier().documentation()); - EXPECT_NE("", DoubleVector4Verifier().documentation()); - - EXPECT_NE("", IntLessVerifier(0).documentation()); - EXPECT_NE("", DoubleLessVerifier(0.0).documentation()); - EXPECT_NE("", IntLessEqualVerifier(0).documentation()); - EXPECT_NE("", DoubleLessEqualVerifier(0.0).documentation()); - EXPECT_NE("", IntGreaterVerifier(0).documentation()); - EXPECT_NE("", DoubleGreaterVerifier(0.0).documentation()); - EXPECT_NE("", IntGreaterEqualVerifier(0).documentation()); - EXPECT_NE("", DoubleGreaterEqualVerifier(0.0).documentation()); - - EXPECT_NE("", BoolEqualVerifier(true).documentation()); - EXPECT_NE("", IntEqualVerifier(0).documentation()); - EXPECT_NE("", DoubleEqualVerifier(0.0).documentation()); - EXPECT_NE("", StringEqualVerifier(""s).documentation()); - EXPECT_NE("", BoolUnequalVerifier(true).documentation()); - EXPECT_NE("", IntUnequalVerifier(0).documentation()); - EXPECT_NE("", DoubleUnequalVerifier(0.0).documentation()); - EXPECT_NE("", StringUnequalVerifier(""s).documentation()); - - EXPECT_NE("", BoolInListVerifier({ true }).documentation()); - EXPECT_NE("", IntInListVerifier({ 0 }).documentation()); - EXPECT_NE("", DoubleInListVerifier({ 0.0 }).documentation()); - EXPECT_NE("", StringInListVerifier({ ""s }).documentation()); - EXPECT_NE("", BoolNotInListVerifier({ true }).documentation()); - EXPECT_NE("", IntNotInListVerifier({ 0 }).documentation()); - EXPECT_NE("", DoubleNotInListVerifier({ 0.0 }).documentation()); - EXPECT_NE("", StringNotInListVerifier({ ""s }).documentation()); - - EXPECT_NE("", IntInRangeVerifier({ 0, 1 }).documentation()); - EXPECT_NE("", DoubleInRangeVerifier({ 0.0, 1.0 }).documentation()); - EXPECT_NE("", IntNotInRangeVerifier({ 0, 1 }).documentation()); - EXPECT_NE("", DoubleNotInRangeVerifier({ 0.0, 1.0 }).documentation()); - - EXPECT_NE("", BoolAnnotationVerifier("A"s).documentation()); - EXPECT_NE("", IntAnnotationVerifier("A"s).documentation()); - EXPECT_NE("", DoubleAnnotationVerifier("A"s).documentation()); - EXPECT_NE("", StringAnnotationVerifier("A"s).documentation()); - EXPECT_NE("", TableAnnotationVerifier("A"s).documentation()); - EXPECT_NE("", AnnotationVerifier("A"s).documentation()); - EXPECT_NE("", AnnotationVerifier("A"s).documentation()); - EXPECT_NE("", AnnotationVerifier("A"s).documentation()); - EXPECT_NE("", AnnotationVerifier("A"s).documentation()); - EXPECT_NE("", AnnotationVerifier("A"s).documentation()); - EXPECT_NE("", AnnotationVerifier("A"s).documentation()); - EXPECT_NE("", AnnotationVerifier("A"s).documentation()); - EXPECT_NE("", AnnotationVerifier("A"s).documentation()); - EXPECT_NE("", AnnotationVerifier("A"s).documentation()); - - EXPECT_NE("", BoolDeprecatedVerifier().documentation()); - EXPECT_NE("", IntDeprecatedVerifier().documentation()); - EXPECT_NE("", DoubleDeprecatedVerifier().documentation()); - EXPECT_NE("", StringDeprecatedVerifier().documentation()); - EXPECT_NE("", TableDeprecatedVerifier().documentation()); - EXPECT_NE("", DeprecatedVerifier().documentation()); - EXPECT_NE("", DeprecatedVerifier().documentation()); - EXPECT_NE("", DeprecatedVerifier().documentation()); - EXPECT_NE("", DeprecatedVerifier().documentation()); - EXPECT_NE("", DeprecatedVerifier().documentation()); - EXPECT_NE("", DeprecatedVerifier().documentation()); - EXPECT_NE("", DeprecatedVerifier().documentation()); - EXPECT_NE("", DeprecatedVerifier().documentation()); - EXPECT_NE("", DeprecatedVerifier().documentation()); - - EXPECT_NE("", ReferencingVerifier("identifier"s).documentation()); - -} diff --git a/tests/test_temporaltileprovider.inl b/tests/test_iswamanager.cpp similarity index 75% rename from tests/test_temporaltileprovider.inl rename to tests/test_iswamanager.cpp index d58f2ce6a8..7997fb45fa 100644 --- a/tests/test_temporaltileprovider.inl +++ b/tests/test_iswamanager.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,25 +22,21 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#ifdef OPENSPACE_MODULE_ISWA_ENABLED +#include "catch2/catch.hpp" + +#include +#include #include -#define _USE_MATH_DEFINES -#include -#include -#include +TEST_CASE("ISWAManager: Initialize", "[iswamanager]") { + openspace::IswaManager::deinitialize(); + REQUIRE_FALSE(openspace::IswaManager::isInitialized()); - -class TemporalTileProviderTest : public testing::Test {}; - -std::string fileName = "data/scene/debugglobe/map_service_configs/VIIRS_SNPP_CorrectedReflectance_TrueColor_temporal.xml"; - -TEST_F(TemporalTileProviderTest, Basic) { - double t = 2016.01; - openspace::Time::ref().setTime(t); - openspace::Time::ref().preSynchronization(); - openspace::Time::ref().postSynchronizationPreDraw(); - openspace::TemporalTileProvider provider(absPath(fileName)); + openspace::IswaManager::initialize(); + REQUIRE(openspace::IswaManager::isInitialized()); + REQUIRE(&openspace::IswaManager::ref() == &openspace::IswaManager::ref()); } +#endif // OPENSPACE_MODULE_ISWA_ENABLED diff --git a/tests/test_iswamanager.inl b/tests/test_iswamanager.inl deleted file mode 100644 index 8275b485d3..0000000000 --- a/tests/test_iswamanager.inl +++ /dev/null @@ -1,87 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2019 * - * * - * 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. * - ****************************************************************************************/ - -#ifdef OPENSPACE_MODULE_ISWA_ENABLED - -#define private public -#include -#define private private - -#include -#include - - -/* - * For each test the following is run: - * Constructor() -> setUp() -> test -> tearDown() -> Deconstructor() - */ - -namespace openspace { - -class IswaManagerTest : public testing::Test { -protected: - - IswaManagerTest() - : _downloadManager("", 0) - { - IswaManager::initialize(); - } - - ~IswaManagerTest() { - IswaManager::deinitialize(); - } - - void reset() {} - - DownloadManager _downloadManager; -}; - -TEST_F(IswaManagerTest, initialize){ - IswaManager::deinitialize(); - - ASSERT_FALSE(IswaManager::isInitialized()) << "IswaManager is initialized before initialize call"; - - IswaManager::initialize(); - - ASSERT_TRUE(IswaManager::isInitialized()) << "IswaManager is not initialized after initialize call"; - - ASSERT_NE(&IswaManager::ref(), nullptr) << "IswaManager ref() is not a nullptr"; - - EXPECT_EQ(&IswaManager::ref(), &IswaManager::ref()) << "IswaManager ref() returns the same object twice"; -} - -TEST_F(IswaManagerTest, iswaUrl){ - - //OsEng.loadSpiceKernels(); - //Time::ref().setTime(double(100000.0)); - //Time::ref().preSynchronization(); - //Time::ref().postSynchronizationPreDraw(); - //std::string url = ISWAManager::ref().iSWAurl(7); - //std::string expectedUrl = "http://iswa2.ccmc.gsfc.nasa.gov/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2000-01-02%2015:45:35&window=-1&cygnetId=7"; - - //EXPECT_EQ(expectedUrl, url); -} - -}//namespace openspace -#endif diff --git a/tests/test_latlonpatch.cpp b/tests/test_latlonpatch.cpp new file mode 100644 index 0000000000..df459ec25c --- /dev/null +++ b/tests/test_latlonpatch.cpp @@ -0,0 +1,142 @@ +/***************************************************************************************** + * * + * 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 "catch2/catch.hpp" + +#include +#include +#include + +TEST_CASE("LatLonPatch: findCenterControlPoint", "[latlonpatch]") { + using namespace openspace::globebrowsing; + + GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); +} + +TEST_CASE("LatLonPatch: Find Closest Corner", "[latlonpatch]") { + using namespace openspace::globebrowsing; + + constexpr float piOver4 = glm::pi() / 4.f; + Geodetic2 halfSize { piOver4, piOver4 }; + Geodetic2 center { 0, 0 }; + GeodeticPatch patch(center, halfSize); + + constexpr float piOver3 = glm::pi() / 3.f; + Geodetic2 point { piOver3, piOver3 }; + + Geodetic2 closestCorner = patch.closestCorner(point); + Geodetic2 northEastCorner = patch.corner(NORTH_EAST); + + REQUIRE(closestCorner.lat == northEastCorner.lat); + REQUIRE(closestCorner.lon == northEastCorner.lon); +} + +TEST_CASE("LatLonPatch: Find Closest Corner 2", "[latlonpatch]") { + using namespace openspace::globebrowsing; + + constexpr float piOver6 = glm::pi() / 4.f; + + Geodetic2 halfSize { 1.1 * piOver6, 1.1 * piOver6 }; + Geodetic2 center { piOver6, piOver6 }; + GeodeticPatch patch(center, halfSize); + + Geodetic2 point { 0, 0 }; + + Geodetic2 closestCorner = patch.closestCorner(point); + Geodetic2 expectedCorner = patch.corner(SOUTH_WEST); + + REQUIRE(closestCorner.lat == expectedCorner.lat); + REQUIRE(closestCorner.lon == expectedCorner.lon); +} + +TEST_CASE("LatLonPatch: Spherical Clamp 1", "[latlonpatch]") { + using namespace openspace::globebrowsing; + + GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); + + // inside patch latitude-wise, east of patch longitude-wise + Geodetic2 point { glm::pi() / 6.0, glm::pi() / 4.0 - 0.01 }; + + + Geodetic2 clampedPoint = patch.closestPoint(point); + Geodetic2 neCorner = patch.corner(NORTH_EAST); + //REQUIRE(clampedPoint.lat == neCorner.lat); + //REQUIRE(clampedPoint.lon == neCorner.lon); +} + +TEST_CASE("LatLonPatch: Spherical Clamp 2", "[latlonpatch]") { + using namespace openspace::globebrowsing; + + GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); + + // inside patch latitude-wise, west of patch longitude-wise + Geodetic2 point { glm::pi() / 6.0, glm::pi() / 4.0 + 0.01 }; + + Geodetic2 clampedPoint = patch.closestPoint(point); + Geodetic2 nwCorner = patch.corner(NORTH_WEST); + //REQUIRE(clampedPoint.lat == nwCorner.lat); + //REQUIRE(clampedPoint.lon == nwCorner.lon); +} + +TEST_CASE("LatLonPatch: Spherical Clamp 3", "[latlonpatch]") { + using namespace openspace::globebrowsing; + + GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); + + // North east of patch + Geodetic2 point { glm::pi() / 3.0, glm::pi() / 4.0 - 0.01 }; + + Geodetic2 clampedPoint = patch.closestPoint(point); + Geodetic2 neCorner = patch.corner(NORTH_EAST); + //REQUIRE(clampedPoint.lat == neCorner.lat); + //REQUIRE(clampedPoint.lon == neCorner.lon); +} + +TEST_CASE("LatLonPatch: Spherical Clamp 4", "[latlonpatch]") { + using namespace openspace::globebrowsing; + + GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); + + // South east of patch + Geodetic2 point { -glm::pi() / 3.0, glm::pi() / 4.0 - 0.01 }; + + Geodetic2 clampedPoint = patch.closestPoint(point); + Geodetic2 seCorner = patch.corner(SOUTH_EAST); + //REQUIRE(clampedPoint.lat == seCorner.lat); + //REQUIRE(clampedPoint.lon == seCorner.lon); +} + +TEST_CASE("LatLonPatch: Spherical Clamp 5", "[latlonpatch]") { + using namespace openspace::globebrowsing; + + GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); + + // South west of patch + Geodetic2 point { -glm::pi() / 3.0, 3 * glm::pi() / 4.0 + 0.01 }; + + Geodetic2 clampedPoint = patch.closestPoint(point); + Geodetic2 swCorner = patch.corner(SOUTH_WEST); + //REQUIRE(clampedPoint.lat == swCorner.lat); + //REQUIRE(clampedPoint.lon == swCorner.lon); +} diff --git a/tests/test_latlonpatch.inl b/tests/test_latlonpatch.inl deleted file mode 100644 index 73156dafeb..0000000000 --- a/tests/test_latlonpatch.inl +++ /dev/null @@ -1,167 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2019 * - * * - * 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 - -#define _USE_MATH_DEFINES -#include -#include - -class LatLonPatchTest : public testing::Test {}; - -using namespace openspace; - -TEST_F(LatLonPatchTest, findCenterControlPoint) { - - GeodeticPatch patch(0, 0, M_PI / 4, M_PI / 4); - -} - - - -TEST_F(LatLonPatchTest, TestFindClosestCorner) { - - Scalar piOver4 = M_PI / 4; - Geodetic2 halfSize(piOver4, piOver4); - Geodetic2 center(0, 0); - GeodeticPatch patch(center, halfSize); - - Scalar piOver3 = M_PI / 3; - Geodetic2 point(piOver3, piOver3); - - Geodetic2 closestCorner = patch.closestCorner(point); - Geodetic2 northEastCorner = patch.northEastCorner(); - - ASSERT_EQ(closestCorner.lat, northEastCorner.lat); - ASSERT_EQ(closestCorner.lon, northEastCorner.lon); - -} - -TEST_F(LatLonPatchTest, TestFindClosestCorner2) { - - Scalar piOver6 = M_PI / 4; - Scalar piOver3 = M_PI / 3; - - Geodetic2 halfSize(1.1*piOver6, 1.1*piOver6); - Geodetic2 center(piOver6, piOver6); - GeodeticPatch patch(center, halfSize); - - Geodetic2 point(0, 0); - - Geodetic2 closestCorner = patch.closestCorner(point); - Geodetic2 expectedCorner = patch.southWestCorner(); - - ASSERT_EQ(closestCorner.lat, expectedCorner.lat); - ASSERT_EQ(closestCorner.lon, expectedCorner.lon); - -} - - -TEST_F(LatLonPatchTest, TestSphericalClamp1) { - GeodeticPatch patch(0, 0, M_PI / 4, M_PI / 4); - - // inside patch latitude-wise, east of patch longitude-wise - Geodetic2 point(M_PI / 6, M_PI - 0.01); - - - Geodetic2 clampedPoint = patch.closestPoint(point); - Geodetic2 neCorner = patch.northEastCorner(); - ASSERT_EQ(clampedPoint.lat, neCorner.lat); - ASSERT_EQ(clampedPoint.lon, neCorner.lon); -} - - -TEST_F(LatLonPatchTest, TestSphericalClamp2) { - GeodeticPatch patch(0, 0, M_PI / 4, M_PI / 4); - - // inside patch latitude-wise, west of patch longitude-wise - Geodetic2 point(M_PI / 6, M_PI + 0.01); - - Geodetic2 clampedPoint = patch.closestPoint(point); - Geodetic2 nwCorner = patch.northWestCorner(); - ASSERT_EQ(clampedPoint.lat, nwCorner.lat); - ASSERT_EQ(clampedPoint.lon, nwCorner.lon); -} - -TEST_F(LatLonPatchTest, TestSphericalClamp3) { - GeodeticPatch patch(0, 0, M_PI / 4, M_PI / 4); - - // North east of patch - Geodetic2 point(M_PI / 3, M_PI - 0.01); - - Geodetic2 clampedPoint = patch.closestPoint(point); - Geodetic2 neCorner = patch.northEastCorner(); - ASSERT_EQ(clampedPoint.lat, neCorner.lat); - ASSERT_EQ(clampedPoint.lon, neCorner.lon); -} - -TEST_F(LatLonPatchTest, TestSphericalClamp4) { - GeodeticPatch patch(0, 0, M_PI / 4, M_PI / 4); - - // South east of patch - Geodetic2 point(-M_PI / 3, M_PI - 0.01); - - Geodetic2 clampedPoint = patch.closestPoint(point); - Geodetic2 seCorner = patch.southEastCorner(); - ASSERT_EQ(clampedPoint.lat, seCorner.lat); - ASSERT_EQ(clampedPoint.lon, seCorner.lon); -} - - -TEST_F(LatLonPatchTest, TestSphericalClamp5) { - GeodeticPatch patch(0, 0, M_PI / 4, M_PI / 4); - - // South west of patch - Geodetic2 point(-M_PI / 3, 3*M_PI + 0.01); - - Geodetic2 clampedPoint = patch.closestPoint(point); - Geodetic2 swCorner = patch.southWestCorner(); - ASSERT_EQ(clampedPoint.lat, swCorner.lat); - ASSERT_EQ(clampedPoint.lon, swCorner.lon); -} - -int radAsDeg(double rads) { - return floorf(Angle::fromRadians(rads).asDegrees()); -} - -TEST_F(LatLonPatchTest, PrintingSphericalClamp) { - GeodeticPatch patch(0, 0, M_PI / 4, M_PI / 4); - - using Ang = Angle; - Ang delta = Ang::fromDegrees(30); - std::cout << "point lat, lon --> clamped lat, lon" << std::endl; - for (Ang lat = Ang::fromDegrees(90); lat > -Ang::QUARTER; lat -= delta) { - for (Ang lon = Ang::fromDegrees(180); lon > -Ang::HALF; lon -= delta) { - - Geodetic2 point(lat.asRadians(), lon.asRadians()); - Geodetic2 clamped = patch.closestPoint(point); - std::cout - << radAsDeg(point.lat) << ", " - << radAsDeg(point.lon) << " --> " - << radAsDeg(clamped.lat) << ", " - << radAsDeg(clamped.lon) << std::endl; - } - std::cout << std::endl; - } -} diff --git a/tests/test_lrucache.inl b/tests/test_lrucache.cpp similarity index 67% rename from tests/test_lrucache.inl rename to tests/test_lrucache.cpp index 457217234e..27e95f02c3 100644 --- a/tests/test_lrucache.inl +++ b/tests/test_lrucache.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,59 +22,60 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include "catch2/catch.hpp" -#define _USE_MATH_DEFINES -#include +#include #include -class LRUCacheTest : public testing::Test {}; +namespace { + struct DefaultHasher { + unsigned long long operator()(int var) const { + return static_cast(var); + } + }; -struct DefaultHasher { - unsigned long long operator()(const int& var) const { - return static_cast(var); + struct MyKey { + int x, y; + }; + + bool operator==(const MyKey& a, const MyKey& b) { + return a.x == b.x && a.y == b.y; } -}; -TEST_F(LRUCacheTest, Get) { + std::ostream& operator<<(std::ostream& o, const MyKey& key) { + return o << key.x << ", " << key.y; + } + + // custom specialization + struct DefaultHasherMyKey { + unsigned long long operator()(const MyKey& s) const { + return s.x ^ (s.y << 1); + } + }; +} // namespace + +TEST_CASE("LRUCache: Get", "[lrucache]") { openspace::globebrowsing::cache::LRUCache lru(4); lru.put(1, "hej"); lru.put(12, "san"); - ASSERT_STREQ(lru.get(1).c_str(), "hej") << "testing get"; + REQUIRE(lru.get(1) == "hej"); } -TEST_F(LRUCacheTest, CleaningCache) { +TEST_CASE("LRUCache: CleaningCache", "[lrucache]") { openspace::globebrowsing::cache::LRUCache lru(4); lru.put(1, 1.2); lru.put(12, 2.3); lru.put(123, 33.4); lru.put(1234, 4.5); lru.put(12345, 6.7); - ASSERT_FALSE(lru.exist(1)) << "Element should have been cleaned out of cache"; - ASSERT_TRUE(lru.exist(12)) << "Element should remain in cache"; + REQUIRE_FALSE(lru.exist(1)); + REQUIRE(lru.exist(12)); } -struct MyKey { - int x, y; -}; - -bool operator==(const MyKey& a, const MyKey& b) { - return a.x == b.x && a.y == b.y; -} - -std::ostream& operator<<(std::ostream& o, const MyKey& key) { - return o << key.x << ", " << key.y; -} - -// custom specialization -struct DefaultHasherMyKey { - unsigned long long operator()(const MyKey& s) const { - return s.x ^ (s.y << 1); - } -}; - -TEST_F(LRUCacheTest, StructKey) { - openspace::globebrowsing::cache::LRUCache lru(4); +TEST_CASE("LRUCache: StructKey", "[lrucache]") { + openspace::globebrowsing::cache::LRUCache< + MyKey, std::string, DefaultHasherMyKey + > lru(4); // These two custom keys should be treated as equal MyKey key1 = { 2, 3 }; @@ -85,13 +86,13 @@ TEST_F(LRUCacheTest, StructKey) { lru.put(key1, val1); - ASSERT_TRUE(lru.exist(key1)); - ASSERT_EQ(lru.get(key1), val1); + REQUIRE(lru.exist(key1)); + REQUIRE(lru.get(key1) == val1); // Putting key2 should replace key1 lru.put(key2, val2); - ASSERT_EQ(key1, key2) << "key 1 and key2 should be considered equal"; - ASSERT_TRUE(lru.exist(key2)); - ASSERT_EQ(lru.get(key1), val2); - ASSERT_EQ(lru.get(key2), val2); + REQUIRE(key1 == key2); + REQUIRE(lru.exist(key2)); + REQUIRE(lru.get(key1) == val2); + REQUIRE(lru.get(key2) == val2); } diff --git a/tests/test_luaconversions.cpp b/tests/test_luaconversions.cpp new file mode 100644 index 0000000000..ea138ace75 --- /dev/null +++ b/tests/test_luaconversions.cpp @@ -0,0 +1,877 @@ +/***************************************************************************************** + * * + * 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 "catch2/catch.hpp" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + constexpr const int NumberFuzzTests = 10000; +} // namespace + +TEST_CASE("LuaConversion: LuaExecution", "[luaconversion]") { + lua_State* state = luaL_newstate(); + luaL_openlibs(state); + + const int status = luaL_loadstring(state, ""); + REQUIRE(status == LUA_OK); + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion", "[luaconversion]", bool, char, signed char, + unsigned char, short, unsigned short, int, unsigned int, long, unsigned long, + long long, unsigned long long, float, double, long double, glm::vec2, glm::vec3, + glm::vec4, glm::dvec2, glm::dvec3, glm::dvec4, glm::ivec2, glm::ivec3, glm::ivec4, + glm::uvec2, glm::uvec3, glm::uvec4, glm::mat2x2, glm::mat2x3, glm::mat2x4, + glm::mat3x2, glm::mat3x3, glm::mat3x4, glm::mat4x2, glm::mat4x3, glm::mat4x4, + glm::dmat2x2, glm::dmat2x3, glm::dmat2x4, glm::dmat3x2, glm::dmat3x3, glm::dmat3x4, + glm::dmat4x2, glm::dmat4x3, glm::dmat4x4) +{ + using T = TestType; + + lua_State* state = luaL_newstate(); + luaL_openlibs(state); + + const T val(1); + + using namespace openspace::properties; + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion Fuzz dis( + std::numeric_limits::lowest(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + + const T val = T(dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion Fuzz >short", "[luaconversion]", short, unsigned short, + int, unsigned int) +{ + using T = TestType; + using namespace openspace::properties; + + lua_State* state = luaL_newstate(); + + std::mt19937 gen(1337); + std::uniform_int_distribution dis( + std::numeric_limits::lowest(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + + const T val = T(dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + + +TEMPLATE_TEST_CASE("LuaConversion Fuzz Limited Signed", "[luaconversion]", long, + long long) +{ + using T = TestType; + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + + std::mt19937 gen(1337); + std::uniform_int_distribution<> dis( + // We need to limit the range of values as Lua uses 'doubles' to store, and some + // values will not be representable + std::numeric_limits::lowest(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion Fuzz Limited Unsigned", "[luaconversion]", + unsigned long, unsigned long long) +{ + using T = TestType; + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + + std::mt19937 gen(1337); + std::uniform_int_distribution dis( + // We need to limit the range of values as Lua uses 'doubles' to store, and some + // values will not be representable + std::numeric_limits::lowest(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion Float Fuzz", "[luaconversion]", float, double, + long double) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + 0.f, + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Vec2 Float Fuzz", "[luaconversion]", glm::vec2, + glm::dvec2) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} +TEMPLATE_TEST_CASE("LuaConversion: Vec2 Fuzz", "[luaconversion]", glm::ivec2, glm::uvec2) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_int_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Vec3 Float Fuzz", "[luaconversion]", glm::vec3, + glm::dvec3) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Vec3 Fuzz", "[luaconversion]", glm::ivec3, glm::uvec3) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_int_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Vec4 Float Fuzz", "[luaconversion]", glm::vec4, + glm::dvec4) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Vec4 Fuzz", "[luaconversion]", glm::ivec4, glm::uvec4) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_int_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Mat2x2 Fuzz", "[luaconversion]", glm::mat2x2, + glm::dmat2x2) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Mat2x3 Fuzz", "[luaconversion]", glm::mat2x3, + glm::dmat2x3) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Mat2x4 Fuzz", "[luaconversion]", glm::mat2x4, + glm::dmat2x4) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), + dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Mat3x2 Fuzz", "[luaconversion]", glm::mat3x2, + glm::dmat3x2) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Mat3x3 Fuzz", "[luaconversion]", glm::mat3x3, + glm::dmat3x3) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), + dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Mat3x4 Fuzz", "[luaconversion]", glm::mat3x4, + glm::dmat3x4) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), + dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Mat4x2 Fuzz", "[luaconversion]", glm::mat4x2, + glm::dmat4x2) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), + dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Mat4x3 Fuzz", "[luaconversion]", glm::mat4x3, + glm::dmat4x3) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), + dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + +TEMPLATE_TEST_CASE("LuaConversion: Mat4x4 Fuzz", "[luaconversion]", glm::mat4x4, + glm::dmat4x4) +{ + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + using T = TestType; + + std::mt19937 gen(1337); + std::uniform_real_distribution dis( + std::numeric_limits::min(), + std::numeric_limits::max() + ); + + for (int i = 0; i < NumberFuzzTests; ++i) { + const T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), + dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), + dis(gen), dis(gen), dis(gen)); + + const bool success = PropertyDelegate>::template toLuaValue( + state, + val + ); + REQUIRE(success); + bool success2; + const T value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == val); + + lua_pop(state, 1); + } + + lua_close(state); +} + + +TEST_CASE("LuaConversion: String", "[luaconversion]") { + lua_State* state = luaL_newstate(); + + using namespace openspace::properties; + bool success + = PropertyDelegate>::template toLuaValue( + state, "value"); + REQUIRE(success); + std::string value; + bool success2; + value = PropertyDelegate>::template fromLuaValue( + state, + success2 + ); + REQUIRE(success2); + REQUIRE(value == "value"); + + lua_close(state); +} diff --git a/tests/test_luaconversions.inl b/tests/test_luaconversions.inl deleted file mode 100644 index ca5fef1627..0000000000 --- a/tests/test_luaconversions.inl +++ /dev/null @@ -1,2216 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2019 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace { - constexpr int NumberFuzzTests = 100000; -} // namespace - -class LuaConversionTest : public testing::Test { -protected: - lua_State* state; - - LuaConversionTest() { - state = luaL_newstate(); - luaL_openlibs(state); - } - - ~LuaConversionTest() { - lua_close(state); - } - - void reset() { - lua_close(state); - state = luaL_newstate(); - luaL_openlibs(state); - } -}; - -TEST_F(LuaConversionTest, LuaExecution) { - int status = luaL_loadstring(state, ""); - EXPECT_EQ(status, LUA_OK); -} - -TEST_F(LuaConversionTest, Bool) { - using namespace openspace::properties; - bool success = PropertyDelegate>::toLuaValue( - state, - true - ); - EXPECT_TRUE(success) << "toLuaValue"; - bool value = static_cast(0); - value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, true) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Char) { - using namespace openspace::properties; - using T = char; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, CharFuzz) { - using namespace openspace::properties; - using T = char; - - std::mt19937 gen(1337); - std::uniform_int_distribution<> dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -//TEST_F(LuaConversionTest, WChar) { -// using namespace openspace::properties; -// using T = wchar_t; -// -// T val = T(1); -// -// bool success = PropertyDelegate>::toLuaValue( -// state, -// val -// ); -// EXPECT_TRUE(success) << "toLuaValue"; -// T value = PropertyDelegate>::fromLuaValue( -// state, -// success -// ); -// EXPECT_TRUE(success) << "fromLuaValue"; -// EXPECT_EQ(value, val) << "fromLuaValue"; -//} - -//TEST_F(LuaConversionTest, WCharFuzz) { -// using namespace openspace::properties; -// using T = wchar_t; -// -// std::mt19937 gen(1337); -// std::uniform_int_distribution<> dis( -// std::numeric_limits::lowest(), -// std::numeric_limits::max() -// ); -// -// constexpr int NumberFuzzTests = 10000; -// for (int i = 0; i < NumberFuzzTests; ++i) { -// T val = T(dis(gen)); -// -// bool success = PropertyDelegate>::toLuaValue( -// state, -// val -// ); -// EXPECT_TRUE(success) << "toLuaValue"; -// T value = PropertyDelegate>::fromLuaValue( -// state, -// success -// ); -// EXPECT_TRUE(success) << "fromLuaValue"; -// EXPECT_EQ(value, val) << "fromLuaValue"; -// } -//} - -TEST_F(LuaConversionTest, SignedChar) { - using namespace openspace::properties; - using T = signed char; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, SignedCharFuzz) { - using namespace openspace::properties; - using T = signed char; - - std::mt19937 gen(1337); - std::uniform_int_distribution<> dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, UnsignedChar) { - using namespace openspace::properties; - using T = unsigned char; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, UnsignedCharFuzz) { - using namespace openspace::properties; - using T = unsigned char; - - std::mt19937 gen(1337); - std::uniform_int_distribution<> dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Short) { - using namespace openspace::properties; - using T = short; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, ShortFuzz) { - using namespace openspace::properties; - using T = short; - - std::mt19937 gen(1337); - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, UnsignedShort) { - using namespace openspace::properties; - using T = unsigned short; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, UnsignedShortFuzz) { - using namespace openspace::properties; - using T = unsigned short; - - std::mt19937 gen(1337); - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Int) { - using namespace openspace::properties; - using T = int; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, IntFuzz) { - using namespace openspace::properties; - using T = int; - - std::mt19937 gen(1337); - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, UnsignedInt) { - using namespace openspace::properties; - using T = unsigned int; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, UnsignedIntFuzz) { - using namespace openspace::properties; - using T = unsigned int; - - std::mt19937 gen(1337); - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Long) { - using namespace openspace::properties; - using T = long; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, LongFuzz) { - using namespace openspace::properties; - using T = long; - - std::mt19937 gen(1337); - // We need to limit the range of values as Lua uses 'doubles' to store, and some - // values will not be representable - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, UnsignedLong) { - using namespace openspace::properties; - using T = unsigned long; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, UnsignedLongFuzz) { - using namespace openspace::properties; - using T = unsigned long; - - std::mt19937 gen(1337); - // We need to limit the range of values as Lua uses 'doubles' to store, and some - // values will not be representable - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, LongLong) { - using namespace openspace::properties; - using T = long long; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, LongLongFuzz) { - using namespace openspace::properties; - using T = long long; - - std::mt19937 gen(1337); - // We need to limit the range of values as Lua uses 'doubles' to store, and some - // values will not be representable - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, UnsignedLongLong) { - using namespace openspace::properties; - using T = unsigned long long; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, UnsignedLongLongFuzz) { - using namespace openspace::properties; - using T = unsigned long long; - - std::mt19937 gen(1337); - // We need to limit the range of values as Lua uses 'doubles' to store, and some - // values will not be representable - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Float) { - using namespace openspace::properties; - using T = float; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, FloatFuzz) { - using namespace openspace::properties; - using T = float; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - 0.f, - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Double) { - using namespace openspace::properties; - using T = double; - T val = T(1.0); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DoubleFuzz) { - using namespace openspace::properties; - using T = double; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - 0.0, - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, LongDouble) { - using namespace openspace::properties; - using T = long double; - T val = T(1.0); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, LongDoubleFuzz) { - using namespace openspace::properties; - using T = long double; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - 0l, - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Vec2) { - using namespace openspace::properties; - using T = glm::vec2; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Vec2Fuzz) { - using namespace openspace::properties; - using T = glm::vec2; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Vec3) { - using namespace openspace::properties; - using T = glm::vec3; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Vec3Fuzz) { - using namespace openspace::properties; - using T = glm::vec3; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Vec4) { - using namespace openspace::properties; - using T = glm::vec4; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Vec4Fuzz) { - using namespace openspace::properties; - using T = glm::vec4; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DVec2) { - using namespace openspace::properties; - using T = glm::dvec2; - T val = T(1.0); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DVec2Fuzz) { - using namespace openspace::properties; - using T = glm::dvec2; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DVec3) { - using namespace openspace::properties; - using T = glm::dvec3; - T val = T(1.0); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DVec3Fuzz) { - using namespace openspace::properties; - using T = glm::dvec3; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DVec4) { - using namespace openspace::properties; - using T = glm::dvec4; - T val = T(1.0); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DVec4Fuzz) { - using namespace openspace::properties; - using T = glm::dvec4; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, IVec2) { - using namespace openspace::properties; - using T = glm::ivec2; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, IVec2Fuzz) { - using namespace openspace::properties; - using T = glm::ivec2; - - std::mt19937 gen(1337); - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, IVec3) { - using namespace openspace::properties; - using T = glm::ivec3; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, IVec3Fuzz) { - using namespace openspace::properties; - using T = glm::ivec3; - - std::mt19937 gen(1337); - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, IVec4) { - using namespace openspace::properties; - using T = glm::ivec4; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, IVec4Fuzz) { - using namespace openspace::properties; - using T = glm::ivec4; - - std::mt19937 gen(1337); - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, UVec2) { - using namespace openspace::properties; - using T = glm::uvec2; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, UVec2Fuzz) { - using namespace openspace::properties; - using T = glm::uvec2; - - std::mt19937 gen(1337); - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, UVec3) { - using namespace openspace::properties; - using T = glm::uvec3; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, UVec3Fuzz) { - using namespace openspace::properties; - using T = glm::uvec3; - - std::mt19937 gen(1337); - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, UVec4) { - using namespace openspace::properties; - using T = glm::uvec4; - T val = T(1); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, UVec4Fuzz) { - using namespace openspace::properties; - using T = glm::uvec4; - - std::mt19937 gen(1337); - std::uniform_int_distribution dis( - std::numeric_limits::lowest(), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Mat2x2) { - using namespace openspace::properties; - using T = glm::mat2x2; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Mat2x2Fuzz) { - using namespace openspace::properties; - using T = glm::mat2x2; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Mat2x3) { - using namespace openspace::properties; - using T = glm::mat2x3; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Mat2x3Fuzz) { - using namespace openspace::properties; - using T = glm::mat2x3; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Mat2x4) { - using namespace openspace::properties; - using T = glm::mat2x4; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Mat2x4Fuzz) { - using namespace openspace::properties; - using T = glm::mat2x4; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Mat3x2) { - using namespace openspace::properties; - using T = glm::mat3x2; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Mat3x2Fuzz) { - using namespace openspace::properties; - using T = glm::mat3x2; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Mat3x3) { - using namespace openspace::properties; - using T = glm::mat3x3; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Mat3x3Fuzz) { - using namespace openspace::properties; - using T = glm::mat3x3; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Mat3x4) { - using namespace openspace::properties; - using T = glm::mat3x4; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Mat3x4Fuzz) { - using namespace openspace::properties; - using T = glm::mat3x4; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Mat4x2) { - using namespace openspace::properties; - using T = glm::mat4x2; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Mat4x2Fuzz) { - using namespace openspace::properties; - using T = glm::mat4x2; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), - dis(gen), dis(gen), - dis(gen), dis(gen), - dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Mat4x3) { - using namespace openspace::properties; - using T = glm::mat4x3; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Mat4x3Fuzz) { - using namespace openspace::properties; - using T = glm::mat4x3; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, Mat4x4) { - using namespace openspace::properties; - using T = glm::mat4x4; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, Mat4x4Fuzz) { - using namespace openspace::properties; - using T = glm::mat4x4; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DMat2x2) { - using namespace openspace::properties; - using T = glm::dmat2x2; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DMat2x2Fuzz) { - using namespace openspace::properties; - using T = glm::dmat2x2; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DMat2x3) { - using namespace openspace::properties; - using T = glm::dmat2x3; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DMat2x3Fuzz) { - using namespace openspace::properties; - using T = glm::dmat2x3; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DMat2x4) { - using namespace openspace::properties; - using T = glm::dmat2x4; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DMat2x4Fuzz) { - using namespace openspace::properties; - using T = glm::dmat2x4; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DMat3x2) { - using namespace openspace::properties; - using T = glm::dmat3x2; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DMat3x2Fuzz) { - using namespace openspace::properties; - using T = glm::dmat3x2; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen), dis(gen), dis(gen)); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DMat3x3) { - using namespace openspace::properties; - using T = glm::dmat3x3; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DMat3x3Fuzz) { - using namespace openspace::properties; - using T = glm::dmat3x3; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DMat3x4) { - using namespace openspace::properties; - using T = glm::dmat3x4; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DMat3x4Fuzz) { - using namespace openspace::properties; - using T = glm::dmat3x4; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DMat4x2) { - using namespace openspace::properties; - using T = glm::dmat4x2; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DMat4x2Fuzz) { - using namespace openspace::properties; - using T = glm::dmat4x2; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), - dis(gen), dis(gen), - dis(gen), dis(gen), - dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DMat4x3) { - using namespace openspace::properties; - using T = glm::dmat4x3; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DMat4x3Fuzz) { - using namespace openspace::properties; - using T = glm::dmat4x3; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, DMat4x4) { - using namespace openspace::properties; - using T = glm::dmat4x4; - T val = T(1.f); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; -} - -TEST_F(LuaConversionTest, DMat4x4Fuzz) { - using namespace openspace::properties; - using T = glm::dmat4x4; - - std::mt19937 gen(1337); - std::uniform_real_distribution dis( - T::value_type(0), - std::numeric_limits::max() - ); - - for (int i = 0; i < NumberFuzzTests; ++i) { - T val = T(dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen), - dis(gen), dis(gen), dis(gen), dis(gen) - ); - - bool success = PropertyDelegate>::toLuaValue( - state, - val - ); - EXPECT_TRUE(success) << "toLuaValue"; - T value = PropertyDelegate>::fromLuaValue( - state, - success - ); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, val) << "fromLuaValue"; - } -} - -TEST_F(LuaConversionTest, String) { - using namespace openspace::properties; - bool success - = PropertyDelegate>::toLuaValue( - state, "value"); - EXPECT_TRUE(success) << "toLuaValue"; - std::string value = ""; - value = PropertyDelegate>::fromLuaValue( - state, success); - EXPECT_TRUE(success) << "fromLuaValue"; - EXPECT_EQ(value, "value") << "fromLuaValue"; -} diff --git a/tests/test_optionproperty.inl b/tests/test_optionproperty.cpp similarity index 54% rename from tests/test_optionproperty.inl rename to tests/test_optionproperty.cpp index 8fd3a913ca..74161629bc 100644 --- a/tests/test_optionproperty.inl +++ b/tests/test_optionproperty.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,84 +22,78 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include "catch2/catch.hpp" + #include -class OptionPropertyTest : public testing::Test {}; - -TEST_F(OptionPropertyTest, NoOption) { +TEST_CASE("OptionProperty: No Option", "[optionproperty]") { openspace::properties::OptionProperty p({ "id", "gui", "desc" }); - ASSERT_EQ(false, p.hasOption()); + REQUIRE_FALSE(p.hasOption()); } -TEST_F(OptionPropertyTest, SingleOptionSingleZero) { +TEST_CASE("OptionProperty: Single Option Single Zero", "[optionproperty]") { openspace::properties::OptionProperty p({ "id", "gui", "desc"}); p.addOption(0, "a"); p = 0; - ASSERT_EQ(0, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == 0); + REQUIRE(p.option().description == "a"); } -TEST_F(OptionPropertyTest, SingleOptionSingleNegative) { +TEST_CASE("OptionProperty: Single Option Single Negative", "[optionproperty]") { openspace::properties::OptionProperty p({ "id", "gui", "desc" }); p.addOption(-1, "a"); p = -1; - ASSERT_EQ(-1, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == -1); + REQUIRE(p.option().description == "a"); } -TEST_F(OptionPropertyTest, SingleOptionSinglePositive) { +TEST_CASE("OptionProperty: Single Option Single Positive", "[optionproperty]") { openspace::properties::OptionProperty p({ "id", "gui", "desc" }); - p.addOptions({ - { 1, "a" } - }); + p.addOptions({ { 1, "a" } }); p = 1; - ASSERT_EQ(1, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == 1); + REQUIRE(p.option().description == "a"); } -TEST_F(OptionPropertyTest, SingleOptionMultipleZero) { +TEST_CASE("OptionProperty: Single Option Multiple Zero", "[optionproperty]") { openspace::properties::OptionProperty p({ "id", "gui", "desc" }); p.addOptions({ "a" }); p = 0; - ASSERT_EQ(0, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == 0); + REQUIRE(p.option().description == "a"); } -TEST_F(OptionPropertyTest, SingleOptionMultipleNegative) { +TEST_CASE("OptionProperty: Single Option Multiple Negative", "[optionproperty]") { openspace::properties::OptionProperty p({ "id", "gui", "desc" }); - p.addOptions({ - { -1, "a" } - }); + p.addOptions({ { -1, "a" } }); p = -1; - ASSERT_EQ(-1, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == -1); + REQUIRE(p.option().description == "a"); } -TEST_F(OptionPropertyTest, SingleOptionMultiplePositive) { +TEST_CASE("OptionProperty: Single Option Multiple Positive", "[optionproperty]") { openspace::properties::OptionProperty p({ "id", "gui", "desc" }); - p.addOptions({ - { 1, "a" } - }); + p.addOptions({ { 1, "a" } }); p = 1; - ASSERT_EQ(1, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == 1); + REQUIRE(p.option().description == "a"); } -TEST_F(OptionPropertyTest, SingleOptionsZeroBasedConsecutive) { +TEST_CASE("OptionProperty: Single Options Zero Based Consecutive", "[optionproperty]") { openspace::properties::OptionProperty p({ "id", "gui", "desc" }); p.addOption(0, "a"); @@ -107,19 +101,20 @@ TEST_F(OptionPropertyTest, SingleOptionsZeroBasedConsecutive) { p.addOption(2, "c"); p = 0; - ASSERT_EQ(0, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == 0); + REQUIRE(p.option().description == "a"); p = 1; - ASSERT_EQ(1, p.option().value); - ASSERT_EQ("b", p.option().description); + REQUIRE(p.option().value == 1); + REQUIRE(p.option().description == "b"); p = 2; - ASSERT_EQ(2, p.option().value); - ASSERT_EQ("c", p.option().description); + REQUIRE(p.option().value == 2); + REQUIRE(p.option().description == "c"); } -TEST_F(OptionPropertyTest, SingleOptionsZeroBasedNonConsecutive) { +TEST_CASE("OptionProperty: Single Options Zero Based Non Consecutive", "[optionproperty]") +{ openspace::properties::OptionProperty p({ "id", "gui", "desc" }); p.addOption(0, "a"); @@ -127,19 +122,20 @@ TEST_F(OptionPropertyTest, SingleOptionsZeroBasedNonConsecutive) { p.addOption(4, "c"); p = 0; - ASSERT_EQ(0, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == 0); + REQUIRE(p.option().description == "a"); p = 2; - ASSERT_EQ(2, p.option().value); - ASSERT_EQ("b", p.option().description); + REQUIRE(p.option().value == 2); + REQUIRE(p.option().description == "b"); p = 4; - ASSERT_EQ(4, p.option().value); - ASSERT_EQ("c", p.option().description); + REQUIRE(p.option().value == 4); + REQUIRE(p.option().description == "c"); } -TEST_F(OptionPropertyTest, SingleOptionsNegativeBasedConsecutive) { +TEST_CASE("OptionProperty: Single Options Negative Based Consecutive", "[optionproperty]") +{ openspace::properties::OptionProperty p({ "id", "gui", "desc" }); p.addOption(-1, "a"); @@ -147,19 +143,22 @@ TEST_F(OptionPropertyTest, SingleOptionsNegativeBasedConsecutive) { p.addOption(-3, "c"); p = -1; - ASSERT_EQ(-1, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == -1); + REQUIRE(p.option().description == "a"); p = -2; - ASSERT_EQ(-2, p.option().value); - ASSERT_EQ("b", p.option().description); + REQUIRE(p.option().value == -2); + REQUIRE(p.option().description == "b"); p = -3; - ASSERT_EQ(-3, p.option().value); - ASSERT_EQ("c", p.option().description); + REQUIRE(p.option().value == -3); + REQUIRE(p.option().description == "c"); } -TEST_F(OptionPropertyTest, SingleOptionsNonZeroBasedNonConsecutive) { +TEST_CASE( + "OptionProperty: Single Options Non Zero Based Non Consecutive", + "[optionproperty]") +{ openspace::properties::OptionProperty p({ "id", "gui", "desc" }); p.addOption(-1, "a"); @@ -167,19 +166,19 @@ TEST_F(OptionPropertyTest, SingleOptionsNonZeroBasedNonConsecutive) { p.addOption(-5, "c"); p = -1; - ASSERT_EQ(-1, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == -1); + REQUIRE(p.option().description == "a"); p = -3; - ASSERT_EQ(-3, p.option().value); - ASSERT_EQ("b", p.option().description); + REQUIRE(p.option().value == -3); + REQUIRE(p.option().description == "b"); p = -5; - ASSERT_EQ(-5, p.option().value); - ASSERT_EQ("c", p.option().description); + REQUIRE(p.option().value == -5); + REQUIRE(p.option().description == "c"); } -TEST_F(OptionPropertyTest, SingleOptionsZeroBasedAlternating) { +TEST_CASE("OptionProperty: Single Options Zero Based Alternating", "[optionproperty]") { openspace::properties::OptionProperty p({ "id", "gui", "desc" }); p.addOption(0, "a"); @@ -187,19 +186,20 @@ TEST_F(OptionPropertyTest, SingleOptionsZeroBasedAlternating) { p.addOption(-4, "c"); p = 0; - ASSERT_EQ(0, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == 0); + REQUIRE(p.option().description == "a"); p = 2; - ASSERT_EQ(2, p.option().value); - ASSERT_EQ("b", p.option().description); + REQUIRE(p.option().value == 2); + REQUIRE(p.option().description == "b"); p = -4; - ASSERT_EQ(-4, p.option().value); - ASSERT_EQ("c", p.option().description); + REQUIRE(p.option().value == -4); + REQUIRE(p.option().description == "c"); } -TEST_F(OptionPropertyTest, SingleOptionsNonZeroBasedAlternating) { +TEST_CASE("OptionProperty: Single Options Non Zero Based Alternating", "[optionproperty]") +{ openspace::properties::OptionProperty p({ "id", "gui", "desc" }); p.addOption(-20, "a"); @@ -207,14 +207,14 @@ TEST_F(OptionPropertyTest, SingleOptionsNonZeroBasedAlternating) { p.addOption(-10, "c"); p = -20; - ASSERT_EQ(-20, p.option().value); - ASSERT_EQ("a", p.option().description); + REQUIRE(p.option().value == -20); + REQUIRE(p.option().description == "a"); p = 2; - ASSERT_EQ(2, p.option().value); - ASSERT_EQ("b", p.option().description); + REQUIRE(p.option().value == 2); + REQUIRE(p.option().description == "b"); p = -10; - ASSERT_EQ(-10, p.option().value); - ASSERT_EQ("c", p.option().description); + REQUIRE(p.option().value == -10); + REQUIRE(p.option().description == "c"); } diff --git a/tests/test_patchcoverageprovider.inl b/tests/test_patchcoverageprovider.inl deleted file mode 100644 index 54b68fb3a1..0000000000 --- a/tests/test_patchcoverageprovider.inl +++ /dev/null @@ -1,203 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2019 * - * * - * 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 - -#define _USE_MATH_DEFINES -#include -#include - -class PatchCoverageProviderTest : public testing::Test {}; - -using namespace openspace; - -TEST_F(PatchCoverageProviderTest, getTileIndexWithBigPatch) { - - // Allocate data - GeodeticPatch patch(0,0,0,0); - ChunkIndex ci; - ChunkIndex ciExpected; - - // Create a provider with 1 in depth - PatchCoverageProvider provider( - Geodetic2(M_PI * 2, M_PI * 2), // size at level 0 - Geodetic2(- M_PI, - M_PI), // offset at level 0 - 1); // depth - - // A big patch - patch = GeodeticPatch( - Geodetic2(0,0), // Center - Geodetic2(M_PI / 2, M_PI / 2)); // Halfsize - - // Get its index - ci = provider.getTileIndex(patch); - ciExpected = {0, 0, 1}; - - ASSERT_EQ(ciExpected, ci); - - // Patch positioned at the border of 1 in x index - patch = GeodeticPatch( - Geodetic2(0, M_PI / 2), // Center - Geodetic2(M_PI / 2, M_PI / 2)); // Halfsize); - - // Get its index - ci = provider.getTileIndex(patch); - ciExpected = { 1, 0, 1 }; - - ASSERT_EQ(ciExpected, ci); - - // Patch positioned at a little less than the border of 1 in x index - patch = GeodeticPatch( - Geodetic2(0, M_PI / 2 - 0.0001), // Center - Geodetic2(M_PI / 2, M_PI / 2)); // Halfsize); - - // Get its index - ci = provider.getTileIndex(patch); - ciExpected = { 0, 0, 1 }; - - ASSERT_EQ(ciExpected, ci); -} - -TEST_F(PatchCoverageProviderTest, getTileIndexHigherDepthWithBigPatch) { - - // Allocate data - GeodeticPatch patch(0, 0, 0, 0); - ChunkIndex ci; - ChunkIndex ciExpected; - - // Create a provider with 3 in depth - // We still expect the same result since the patches are big - PatchCoverageProvider provider( - Geodetic2(M_PI * 2, M_PI * 2), // size at level 0 - Geodetic2(- M_PI, -M_PI), // offset at level 0 - 3); // depth - - // A big patch - patch = GeodeticPatch( - Geodetic2(0, 0), // Center - Geodetic2(M_PI / 2, M_PI / 2)); // Halfsize - - // Get its index - ci = provider.getTileIndex(patch); - ciExpected = { 0, 0, 1 }; - - ASSERT_EQ(ciExpected, ci); - - // Patch positioned at the border of 1 in x index - patch = GeodeticPatch( - Geodetic2(0, M_PI / 2), // Center - Geodetic2(M_PI / 2, M_PI / 2)); // Halfsize); - - // Get its index - ci = provider.getTileIndex(patch); - ciExpected = { 1, 0, 1 }; - - ASSERT_EQ(ciExpected, ci); - - // Patch positioned at a little less than the border of 1 in x index - patch = GeodeticPatch( - Geodetic2(0, M_PI / 2 - 0.0001), // Center - Geodetic2(M_PI / 2, M_PI / 2)); // Halfsize); - - // Get its index - ci = provider.getTileIndex(patch); - ciExpected = { 0, 0, 1 }; - - ASSERT_EQ(ciExpected, ci); -} - - -TEST_F(PatchCoverageProviderTest, getTileIndexHigherDepthWithSmallPatch) { - - // Allocate data - GeodeticPatch patch(0, 0, 0, 0); - ChunkIndex ci; - ChunkIndex ciExpected; - - // Create a provider with 3 in depth - // We still expect the same result since the patches are big - PatchCoverageProvider provider( - Geodetic2(M_PI * 2, M_PI * 2), // size at level 0 - Geodetic2(- M_PI, - M_PI), // offset at level 0 - 3); // depth - - // A small patch - patch = GeodeticPatch( - Geodetic2(0, 0), // Center - Geodetic2(M_PI / 8, M_PI / 8)); // Halfsize - - // Get its index - ci = provider.getTileIndex(patch); - ciExpected = { 3, 3, 3 }; - - ASSERT_EQ(ciExpected, ci); - - // A small patch near edge case - patch = GeodeticPatch( - Geodetic2(2 * M_PI / 8 + 2 * M_PI / 16 + 0.001, 2 * 2 * M_PI / 8 + 2 * M_PI / 16 - 0.001), // Center - Geodetic2(M_PI / 8, M_PI / 8)); // Halfsize - - // Get its index - ci = provider.getTileIndex(patch); - ciExpected = { 5, 1, 3 }; - - // A small patch near edge case other side - patch = GeodeticPatch( - Geodetic2(2 * M_PI / 8 + 2 * M_PI / 16 - 0.001, 2 * 2 * M_PI / 8 + 2 * M_PI / 16 + 0.001), // Center - Geodetic2(M_PI / 8, M_PI / 8)); // Halfsize - - // Get its index - ci = provider.getTileIndex(patch); - ciExpected = { 6, 2, 3 }; - - ASSERT_EQ(ciExpected, ci); -} - - -TEST_F(PatchCoverageProviderTest, getTileIndexWrapAround) { - - // Allocate data - GeodeticPatch patch(0, 0, 0, 0); - ChunkIndex ci; - ChunkIndex ciExpected; - - // Create a provider with 2 in depth - // We still expect the same result since the patches are big - PatchCoverageProvider provider( - Geodetic2(M_PI * 2, M_PI * 2), // size at level 0 - Geodetic2(-M_PI, -M_PI), // offset at level 0 - 2); // depth - - // A small patch - patch = GeodeticPatch( - Geodetic2(0, - M_PI + M_PI / 16), // Center - Geodetic2(M_PI / 8, M_PI / 8)); // Halfsize - - // Get its index - // We want negative indices - ci = provider.getTileIndex(patch); - ciExpected = { -1, 1, 2 }; - - ASSERT_EQ(ciExpected, ci); -} diff --git a/tests/test_rawvolumeio.inl b/tests/test_rawvolumeio.cpp similarity index 86% rename from tests/test_rawvolumeio.inl rename to tests/test_rawvolumeio.cpp index f68e3a0ce1..02bf9d7cab 100644 --- a/tests/test_rawvolumeio.inl +++ b/tests/test_rawvolumeio.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,30 +22,26 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "gtest/gtest.h" - -#include -#include +#include "catch2/catch.hpp" #include #include #include - -#include +#include +#include #include +#include -class RawVolumeIoTest : public testing::Test {}; - -TEST_F(RawVolumeIoTest, TinyInputOutput) { +TEST_CASE("RawVolumeIO: TinyInputOutput", "[rawvolumeio]") { using namespace openspace::volume; - glm::uvec3 dims{ 1, 1, 1 }; - float value = 0.5; + glm::uvec3 dims(1); + float value = 0.5f; RawVolume vol(dims); vol.set({ 0, 0, 0 }, value); - ASSERT_EQ(vol.get({ 0, 0, 0 }), value); + REQUIRE(vol.get({ 0, 0, 0 }) == value); std::string volumePath = absPath("${TESTDIR}/tinyvolume.rawvolume"); @@ -56,13 +52,13 @@ TEST_F(RawVolumeIoTest, TinyInputOutput) { // Read the 1x1x1 volume and make sure the value is the same. RawVolumeReader reader(volumePath, dims); std::unique_ptr> storedVolume = reader.read(); - ASSERT_EQ(storedVolume->get({ 0, 0, 0 }), value); + REQUIRE(storedVolume->get({ 0, 0, 0 }) == value); } -TEST_F(RawVolumeIoTest, BasicInputOutput) { +TEST_CASE("RawVolumeIO: BasicInputOutput", "[rawvolumeio]") { using namespace openspace::volume; - glm::uvec3 dims{ 2, 4, 8 }; + glm::uvec3 dims(2, 4, 8); auto value = [dims](glm::uvec3 v) { return static_cast(v.z * dims.z * dims.y + v.y * dims.y + v.x); }; @@ -70,7 +66,7 @@ TEST_F(RawVolumeIoTest, BasicInputOutput) { RawVolume vol(dims); vol.forEachVoxel([&vol, &value](glm::uvec3 x, float) { vol.set(x, value(x)); }); - vol.forEachVoxel([&value](glm::uvec3 x, float v) { ASSERT_EQ(v, value(x)); }); + vol.forEachVoxel([&value](glm::uvec3 x, float v) { REQUIRE(v == value(x)); }); std::string volumePath = absPath("${TESTDIR}/basicvolume.rawvolume"); @@ -82,6 +78,6 @@ TEST_F(RawVolumeIoTest, BasicInputOutput) { RawVolumeReader reader(volumePath, dims); std::unique_ptr> storedVolume = reader.read(); vol.forEachVoxel([&value](glm::uvec3 x, float v) { - ASSERT_EQ(v, value(x)); + REQUIRE(v == value(x)); }); } diff --git a/tests/test_scriptscheduler.inl b/tests/test_scriptscheduler.cpp similarity index 57% rename from tests/test_scriptscheduler.inl rename to tests/test_scriptscheduler.cpp index a12b363b05..fc3b2d9b40 100644 --- a/tests/test_scriptscheduler.inl +++ b/tests/test_scriptscheduler.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,31 +22,21 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include "catch2/catch.hpp" -// This include should be removed after the time class is not dependent on -// Spice anymore +#include #include #include +#include #include - #include -class ScriptSchedulerTest : public testing::Test { -protected: - void SetUp() override { - openspace::SpiceManager::initialize(); - openspace::SpiceManager::ref().loadKernel( - absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") - ); - } - - void TearDown() override { - openspace::SpiceManager::deinitialize(); - } -}; +TEST_CASE("ScriptScheduler: Simple Forward", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); -TEST_F(ScriptSchedulerTest, SimpleForward) { using namespace openspace::scripting; using namespace std::string_literals; @@ -59,21 +49,24 @@ TEST_F(ScriptSchedulerTest, SimpleForward) { }; scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - scheduler.loadScripts({ - { "1", testDictionary } - }); + scheduler.loadScripts({ { "1", testDictionary } }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 02")); - ASSERT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); - res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03") - ); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); + res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03")); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript1"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, MultipleForwardSingleJump) { +TEST_CASE("ScriptScheduler: Multiple Forward Single Jump", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -99,18 +92,25 @@ TEST_F(ScriptSchedulerTest, MultipleForwardSingleJump) { }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 02")); - ASSERT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript1"); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 06")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript2", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript2"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, MultipleForwardOrdering) { +TEST_CASE("ScriptScheduler: Multiple Forward Ordering", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -135,15 +135,22 @@ TEST_F(ScriptSchedulerTest, MultipleForwardOrdering) { }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 02")); - ASSERT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 06")); - ASSERT_EQ(2, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); - EXPECT_EQ("ForwardScript2", *(std::next(res.first))); + REQUIRE(std::distance(res.first, res.second) == 2); + REQUIRE(*(res.first) == "ForwardScript1"); + REQUIRE(*(std::next(res.first)) == "ForwardScript2"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, SimpleBackward) { +TEST_CASE("ScriptScheduler: Simple Backward", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -161,14 +168,21 @@ TEST_F(ScriptSchedulerTest, SimpleBackward) { }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 02")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "BackwardScript1"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, MultipleBackwardSingleJump) { +TEST_CASE("ScriptScheduler: Multiple Backward Single Jump", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -193,18 +207,25 @@ TEST_F(ScriptSchedulerTest, MultipleBackwardSingleJump) { }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 06")); - ASSERT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript2", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "BackwardScript2"); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "BackwardScript1"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, MultipleBackwardOrdering) { +TEST_CASE("ScriptScheduler: Multiple Backward Ordering", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -229,15 +250,22 @@ TEST_F(ScriptSchedulerTest, MultipleBackwardOrdering) { }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 06")); - ASSERT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - ASSERT_EQ(2, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript2", *(res.first)); - EXPECT_EQ("BackwardScript1", *(std::next(res.first))); + REQUIRE(std::distance(res.first, res.second) == 2); + REQUIRE(*(res.first) == "BackwardScript2"); + REQUIRE(*(std::next(res.first)) == "BackwardScript1"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, Empty) { +TEST_CASE("ScriptScheduler: Empty", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; static const std::vector TestTimes = { @@ -249,18 +277,25 @@ TEST_F(ScriptSchedulerTest, Empty) { for (double t : TestTimes) { ScriptScheduler scheduler; auto res = scheduler.progressTo(t); - EXPECT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); } // Then test the same thing but keeping the same ScriptScheduler ScriptScheduler scheduler; for (double t : TestTimes) { auto res = scheduler.progressTo(t); - EXPECT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); } + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, ForwardBackwards) { +TEST_CASE("ScriptScheduler: Forward Backwards", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -285,22 +320,29 @@ TEST_F(ScriptSchedulerTest, ForwardBackwards) { }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript1"); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "BackwardScript1"); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 07")); - ASSERT_EQ(2, std::distance(res.first, res.second)); + REQUIRE(std::distance(res.first, res.second) == 2); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript2", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "BackwardScript2"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, Rewind) { +TEST_CASE("ScriptScheduler: Rewind", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -325,16 +367,23 @@ TEST_F(ScriptSchedulerTest, Rewind) { }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 07")); - ASSERT_EQ(2, std::distance(res.first, res.second)); + REQUIRE(std::distance(res.first, res.second) == 2); scheduler.rewind(); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript1"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, CurrentTime) { +TEST_CASE("ScriptScheduler: CurrentTime", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; static const std::vector TestValues = { @@ -345,17 +394,23 @@ TEST_F(ScriptSchedulerTest, CurrentTime) { for (double t : TestValues) { ScriptScheduler scheduler; scheduler.progressTo(t); - EXPECT_EQ(t, scheduler.currentTime()); + REQUIRE(t == scheduler.currentTime()); } + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, AllScripts) { +TEST_CASE("ScriptScheduler: All Scripts", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; ScriptScheduler scheduler; - ghoul::Dictionary testDictionary1 = { { "Time", "2000 JAN 03"s }, { "ForwardScript", "ForwardScript1"s }, @@ -379,15 +434,22 @@ TEST_F(ScriptSchedulerTest, AllScripts) { { "2", testDictionary2 }, { "3", testDictionary3 } }); - + auto allScripts = scheduler.allScripts(); - ASSERT_EQ(3, allScripts.size()); - - EXPECT_LE(allScripts[0].time, allScripts[1].time); - EXPECT_LE(allScripts[1].time, allScripts[2].time); + REQUIRE(allScripts.size() == 3); + + REQUIRE(allScripts[0].time < allScripts[1].time); + REQUIRE(allScripts[1].time < allScripts[2].time); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, JumpEqual) { +TEST_CASE("ScriptScheduler: Jump Equal", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -403,30 +465,29 @@ TEST_F(ScriptSchedulerTest, JumpEqual) { { "1", testDictionary1 } }); - auto res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03 11:00:00") - ); - ASSERT_EQ(res.first, res.second); + auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03 11:00:00")); + REQUIRE(res.first == res.second); - res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03 12:00:00") - ); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); + res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03 12:00:00")); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript1"); - res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03 12:01:00") - ); - ASSERT_EQ(res.first, res.second); + res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03 12:01:00")); + REQUIRE(res.first == res.second); - res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03 12:00:00") - ); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript1", *(res.first)); + res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03 12:00:00")); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "BackwardScript1"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, SameTime) { +TEST_CASE("ScriptScheduler: Same Time", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -438,23 +499,24 @@ TEST_F(ScriptSchedulerTest, SameTime) { { "BackwardScript", "BackwardScript1"s } }; - scheduler.loadScripts({ - { "1", testDictionary1 } - }); + scheduler.loadScripts({ { "1", testDictionary1 } }); - auto res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03 12:00:00") - ); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); + auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03 12:00:00")); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript1"); - res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03 12:00:00") - ); - ASSERT_EQ(res.first, res.second); + res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03 12:00:00")); + REQUIRE(res.first == res.second); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, MultiInnerJump) { +TEST_CASE("ScriptScheduler: Multi Inner Jump", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -466,33 +528,33 @@ TEST_F(ScriptSchedulerTest, MultiInnerJump) { { "BackwardScript", "BackwardScript1"s } }; - scheduler.loadScripts({ - { "1", testDictionary1 } - }); + scheduler.loadScripts({ { "1", testDictionary1 } }); - auto res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03 10:00:00") - ); - ASSERT_EQ(res.first, res.second); + auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03 10:00:00")); + REQUIRE(res.first == res.second); - res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03 11:00:00") - ); - ASSERT_EQ(res.first, res.second); + res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03 11:00:00")); + REQUIRE(res.first == res.second); - res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03 13:00:00") - ); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); + res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03 13:00:00")); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript1"); - res = scheduler.progressTo( - openspace::Time::convertTime("2000 JAN 03 12:30:00") - ); - ASSERT_EQ(res.first, res.second); + res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 03 12:30:00")); + REQUIRE(res.first == res.second); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, MultipleForwardSingleJumpMultipleLoad) { +TEST_CASE( + "ScriptScheduler: Multiple Forward Single Jump Multiple Load", + "[scriptscheduler]") +{ + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -512,27 +574,31 @@ TEST_F(ScriptSchedulerTest, MultipleForwardSingleJumpMultipleLoad) { ScriptScheduler scheduler; scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - scheduler.loadScripts({ - { "1", testDictionary1 } - }); + scheduler.loadScripts({ { "1", testDictionary1 } }); - scheduler.loadScripts({ - { "1", testDictionary2 } - }); + scheduler.loadScripts({ { "1", testDictionary2 } }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 02")); - ASSERT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript1"); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 06")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript2", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript2"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, MultipleForwardOrderingMultipleLoad) { +TEST_CASE("ScriptScheduler: Multiple Forward Ordering Multiple Load" "[scriptscheduler]") +{ + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -551,23 +617,29 @@ TEST_F(ScriptSchedulerTest, MultipleForwardOrderingMultipleLoad) { ScriptScheduler scheduler; scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - scheduler.loadScripts({ - { "1", testDictionary1 } - }); - scheduler.loadScripts({ - { "1", testDictionary2 } - }); + scheduler.loadScripts({ { "1", testDictionary1 } }); + scheduler.loadScripts({ { "1", testDictionary2 } }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 02")); - ASSERT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 06")); - ASSERT_EQ(2, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); - EXPECT_EQ("ForwardScript2", *(std::next(res.first))); + REQUIRE(std::distance(res.first, res.second) == 2); + REQUIRE(*(res.first) == "ForwardScript1"); + REQUIRE(*(std::next(res.first)) == "ForwardScript2"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, MultipleBackwardSingleJumpMultipleLoad) { +TEST_CASE( + "ScriptScheduler: Multiple Backward Single Jump Multiple Load", + "[scriptscheduler]") +{ + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -586,26 +658,32 @@ TEST_F(ScriptSchedulerTest, MultipleBackwardSingleJumpMultipleLoad) { }; scheduler.progressTo(openspace::Time::convertTime("2000 JAN 07")); - scheduler.loadScripts({ - { "1", testDictionary1 } - }); - scheduler.loadScripts({ - { "1", testDictionary2 } - }); + scheduler.loadScripts({ { "1", testDictionary1 } }); + scheduler.loadScripts({ { "1", testDictionary2 } }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 06")); - ASSERT_EQ(res.first, res.second); + REQUIRE(res.first == res.second); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript2", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "BackwardScript2"); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "BackwardScript1"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, MultipleBackwardOrderingMultipleLoad) { +TEST_CASE( + "ScriptScheduler: Multiple Backward Ordering Multiple Load", + "[scriptscheduler]") +{ + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -624,23 +702,27 @@ TEST_F(ScriptSchedulerTest, MultipleBackwardOrderingMultipleLoad) { }; scheduler.progressTo(openspace::Time::convertTime("2000 JAN 07")); - scheduler.loadScripts({ - { "1", testDictionary1 } - }); - scheduler.loadScripts({ - { "1", testDictionary2 } - }); + scheduler.loadScripts({ { "1", testDictionary1 } }); + scheduler.loadScripts({ { "1", testDictionary2 } }); - auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 06")); - ASSERT_EQ(res.first, res.second); + std::pair res = + scheduler.progressTo(openspace::Time::convertTime("2000 JAN 06")); + REQUIRE(res.first == res.second); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - ASSERT_EQ(2, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript2", *(res.first)); - EXPECT_EQ("BackwardScript1", *(std::next(res.first))); + REQUIRE(std::distance(res.first, res.second) == 2); + REQUIRE(*(res.first) == "BackwardScript2"); + REQUIRE(*(std::next(res.first)) == "BackwardScript1"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, ForwardBackwardsMultipleLoad) { +TEST_CASE("ScriptScheduler: Forward Backwards Multiple Load", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -659,30 +741,33 @@ TEST_F(ScriptSchedulerTest, ForwardBackwardsMultipleLoad) { }; scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - scheduler.loadScripts({ - { "1", testDictionary1 } - }); - scheduler.loadScripts({ - { "1", testDictionary2 } - }); + scheduler.loadScripts({ { "1", testDictionary1 } }); + scheduler.loadScripts({ { "1", testDictionary2 } }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript1"); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "BackwardScript1"); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 07")); - ASSERT_EQ(2, std::distance(res.first, res.second)); + REQUIRE(std::distance(res.first, res.second) == 2); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("BackwardScript2", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "BackwardScript2"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, RewindMultipleLoad) { +TEST_CASE("ScriptScheduler: Rewind Multiple Load", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -701,24 +786,27 @@ TEST_F(ScriptSchedulerTest, RewindMultipleLoad) { }; scheduler.progressTo(openspace::Time::convertTime("2000 JAN 01")); - scheduler.loadScripts({ - { "1", testDictionary1 } - }); - scheduler.loadScripts({ - { "1", testDictionary2 } - }); + scheduler.loadScripts({ { "1", testDictionary1 } }); + scheduler.loadScripts({ { "1", testDictionary2 } }); auto res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 07")); - ASSERT_EQ(2, std::distance(res.first, res.second)); + REQUIRE(std::distance(res.first, res.second) == 2); scheduler.rewind(); res = scheduler.progressTo(openspace::Time::convertTime("2000 JAN 04")); - ASSERT_EQ(1, std::distance(res.first, res.second)); - EXPECT_EQ("ForwardScript1", *(res.first)); + REQUIRE(std::distance(res.first, res.second) == 1); + REQUIRE(*(res.first) == "ForwardScript1"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, AllScriptsMultipleLoad) { +TEST_CASE("ScriptScheduler: All Scripts Multiple Load", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -743,26 +831,25 @@ TEST_F(ScriptSchedulerTest, AllScriptsMultipleLoad) { { "BackwardScript", "BackwardScript3"s } }; - scheduler.loadScripts({ - { "1", testDictionary1 } - }); - - scheduler.loadScripts({ - { "1", testDictionary2 } - }); - - scheduler.loadScripts({ - { "1", testDictionary3 } - }); + scheduler.loadScripts({ { "1", testDictionary1 } }); + scheduler.loadScripts({ { "1", testDictionary2 } }); + scheduler.loadScripts({ { "1", testDictionary3 } }); auto allScripts = scheduler.allScripts(); - ASSERT_EQ(3, allScripts.size()); + REQUIRE(allScripts.size() == 3); - EXPECT_LE(allScripts[0].time, allScripts[1].time); - EXPECT_LE(allScripts[1].time, allScripts[2].time); + REQUIRE(allScripts[0].time < allScripts[1].time); + REQUIRE(allScripts[1].time < allScripts[2].time); + + openspace::SpiceManager::deinitialize(); } -TEST_F(ScriptSchedulerTest, AllScriptsMixedLoad) { +TEST_CASE("ScriptScheduler: All Scripts Mixed Load", "[scriptscheduler]") { + openspace::SpiceManager::initialize(); + openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + using namespace openspace::scripting; using namespace std::string_literals; @@ -787,18 +874,14 @@ TEST_F(ScriptSchedulerTest, AllScriptsMixedLoad) { { "BackwardScript", "BackwardScript3"s } }; - scheduler.loadScripts({ - { "1", testDictionary1 } - }); - - scheduler.loadScripts({ - { "1", testDictionary2 }, - { "2", testDictionary3 } - }); + scheduler.loadScripts({ { "1", testDictionary1 } }); + scheduler.loadScripts({ { "1", testDictionary2 }, { "2", testDictionary3 } }); auto allScripts = scheduler.allScripts(); - ASSERT_EQ(3, allScripts.size()); + REQUIRE(allScripts.size() == 3); - EXPECT_LE(allScripts[0].time, allScripts[1].time); - EXPECT_LE(allScripts[1].time, allScripts[2].time); + REQUIRE(allScripts[0].time < allScripts[1].time); + REQUIRE(allScripts[1].time < allScripts[2].time); + + openspace::SpiceManager::deinitialize(); } diff --git a/tests/test_spicemanager.cpp b/tests/test_spicemanager.cpp new file mode 100644 index 0000000000..f7cc53651e --- /dev/null +++ b/tests/test_spicemanager.cpp @@ -0,0 +1,493 @@ +/***************************************************************************************** + * * + * 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 "catch2/catch.hpp" + +#include +#include +#include "SpiceUsr.h" +#include "SpiceZpr.h" + +namespace { + constexpr const int FILLEN = 128; + constexpr const int TYPLEN = 32; + constexpr const int SRCLEN = 128; + + namespace spicemanager_constants { + SpiceInt handle; + char file[FILLEN], filtyp[TYPLEN], source[SRCLEN]; + } // namespace spicemanager_constants + + + + // In this testclass only a handset of the testfunctions require a single kernel. + // The remaining methods rely on multiple kernels, loaded as a SPICE 'meta-kernel' + void loadMetaKernel() { + const int k1 = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + REQUIRE(k1 == 1); + + const int k2 = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/cas00084.tsc") + ); + REQUIRE(k2 == 2); + + const int k3 = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/981005_PLTEPH-DE405S.bsp") + ); + REQUIRE(k3 == 3); + + const int k4 = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/020514_SE_SAT105.bsp") + ); + REQUIRE(k4 == 4); + + const int k5 = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/030201AP_SK_SM546_T45.bsp") + ); + REQUIRE(k5 == 5); + + const int k6 = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/cas_v37.tf") + ); + REQUIRE(k6 == 6); + + const int k7 = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/04135_04171pc_psiv2.bc") + ); + REQUIRE(k7 == 7); + + const int k8 = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/cpck05Mar2004.tpc") + ); + REQUIRE(k8 == 8); + + const int k9 = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/cas_iss_v09.ti") + ); + REQUIRE(k9 == 9); + } + + int loadLSKKernel() { + int kernelID = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + REQUIRE(kernelID == 1); + return kernelID; + } + + int loadPCKKernel() { + int kernelID = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/cpck05Mar2004.tpc") + ); + REQUIRE(kernelID == 1); + return kernelID; + } +} // namespace + +TEST_CASE("SpiceManager: Load Single Kernel", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + loadLSKKernel(); + // naif0008.tls is a text file, check if loaded. + SpiceBoolean found; + kdata_c( + 0, + "text", + FILLEN, + TYPLEN, + SRCLEN, + spicemanager_constants::file, + spicemanager_constants::filtyp, + spicemanager_constants::source, + &spicemanager_constants::handle, + &found + ); + + REQUIRE(found == SPICETRUE); + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Unload Kernel String", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + loadLSKKernel(); + // naif0008.tls is a text file, check if loaded. + SpiceBoolean found; + kdata_c( + 0, + "text", + FILLEN, + TYPLEN, + SRCLEN, + spicemanager_constants::file, + spicemanager_constants::filtyp, + spicemanager_constants::source, + &spicemanager_constants::handle, + &found + ); + REQUIRE(found == SPICETRUE); + + // unload using string keyword + openspace::SpiceManager::ref().unloadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + + found = SPICEFALSE; + kdata_c( + 0, + "text", + FILLEN, + TYPLEN, + SRCLEN, + spicemanager_constants::file, + spicemanager_constants::filtyp, + spicemanager_constants::source, + &spicemanager_constants::handle, + &found + ); + REQUIRE_FALSE(found == SPICETRUE); + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Unload Kernel Integer", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + int kernelID = loadLSKKernel(); + // naif0008.tls is a text file, check if loaded. + SpiceBoolean found; + kdata_c( + 0, + "text", + FILLEN, + TYPLEN, + SRCLEN, + spicemanager_constants::file, + spicemanager_constants::filtyp, + spicemanager_constants::source, + &spicemanager_constants::handle, + &found + ); + REQUIRE(found == SPICETRUE); + + // unload using unique int ID + openspace::SpiceManager::ref().unloadKernel(kernelID); + + found = SPICEFALSE; + kdata_c( + 0, + "text", + FILLEN, + TYPLEN, + SRCLEN, + spicemanager_constants::file, + spicemanager_constants::filtyp, + spicemanager_constants::source, + &spicemanager_constants::handle, + &found + ); + REQUIRE_FALSE(found == SPICETRUE); + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Has Value", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + loadPCKKernel(); + + int naifId = 399; // Earth + + std::string kernelPoolValue = "RADII"; + + const bool found = openspace::SpiceManager::ref().hasValue(naifId, kernelPoolValue); + REQUIRE(found); + + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Get Value From ID 1D", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + loadPCKKernel(); + + std::string target = "EARTH"; + std::string value1D = "MAG_NORTH_POLE_LAT"; + + double return1D; + REQUIRE_NOTHROW(openspace::SpiceManager::ref().getValue(target, value1D, return1D)); + REQUIRE(return1D == 78.565); + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Get Value From ID 3D", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + loadPCKKernel(); + + std::string target = "EARTH"; + std::string value3D = "RADII"; + + glm::dvec3 return3D = glm::dvec3(0.0); + REQUIRE_NOTHROW(openspace::SpiceManager::ref().getValue(target, value3D, return3D)); + + REQUIRE(return3D.x == 6378.14); + REQUIRE(return3D.y == 6378.14); + REQUIRE(return3D.z == 6356.75); + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Get Value From ID ND", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + loadPCKKernel(); + + std::string target = "SATURN"; + std::string valueND = "RING6_A"; + + std::vector returnND(5); + REQUIRE_NOTHROW(openspace::SpiceManager::ref().getValue(target, valueND, returnND)); + + std::vector controlVec{ 189870.0, 256900.0, 9000.0, 9000.0, 0.000003 }; + + REQUIRE(controlVec.size() == returnND.size()); + + for (unsigned int i = 0; i < returnND.size(); ++i){ + REQUIRE(controlVec[i] == returnND[i]); + } + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: String To Ephemeris Time", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + loadLSKKernel(); + + double ephemerisTime; + double control_ephemerisTime; + char date[SRCLEN] = "Thu Mar 20 12:53:29 PST 1997"; + str2et_c(date, &control_ephemerisTime); + + REQUIRE_NOTHROW( + ephemerisTime = openspace::SpiceManager::ref().ephemerisTimeFromDate(date) + ); + + REQUIRE(ephemerisTime == control_ephemerisTime); + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Get Target Position", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + using openspace::SpiceManager; + loadMetaKernel(); + + double et = 0.0; + double pos[3] = { 0.0, 0.0, 0.0 }; + double lt = 0.0; + char utctime[SRCLEN] = "2004 jun 11 19:32:00"; + + str2et_c(utctime, &et); + spkpos_c("EARTH", et, "J2000", "LT+S", "CASSINI", pos, <); + + glm::dvec3 targetPosition =glm::dvec3(0.0); + double lightTime = 0.0; + SpiceManager::AberrationCorrection corr = { + SpiceManager::AberrationCorrection::Type::LightTimeStellar, + SpiceManager::AberrationCorrection::Direction::Reception + }; + + REQUIRE_NOTHROW(targetPosition = SpiceManager::ref().targetPosition( + "EARTH", "CASSINI", "J2000", corr, et, lightTime) + ); + REQUIRE(pos[0] == Approx(targetPosition[0])); + REQUIRE(pos[1] == Approx(targetPosition[1])); + REQUIRE(pos[2] == Approx(targetPosition[2])); + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Get Target State", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + using openspace::SpiceManager; + loadMetaKernel(); + + double et; + double state[6]; + double lt; + char utctime[SRCLEN] = "2004 jun 11 19:32:00"; + + str2et_c(utctime, &et); + spkezr_c("EARTH", et, "J2000", "LT+S", "CASSINI", state, <); + + SpiceManager::AberrationCorrection corr = { + SpiceManager::AberrationCorrection::Type::LightTimeStellar, + SpiceManager::AberrationCorrection::Direction::Reception + }; + + SpiceManager::TargetStateResult res; + REQUIRE_NOTHROW( + res = SpiceManager::ref().targetState("EARTH", "CASSINI", "J2000", corr, et) + ); + + // x,y,z + for (int i = 0; i < 3; i++){ + REQUIRE(state[i] == Approx(res.position[i])); + REQUIRE(state[i+3] == Approx(res.velocity[i])); + } + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Transform matrix", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + loadMetaKernel(); + + double et; + double state[6]; + double state_t[6]; + double lt; + double referenceMatrix[6][6]; + + str2et_c("2004 jun 11 19:32:00", &et); + spkezr_c("PHOEBE", et, "J2000", "LT+S", "CASSINI", state, <); + sxform_c("J2000", "IAU_PHOEBE", et, referenceMatrix); + + openspace::SpiceManager::TransformMatrix stateMatrix; + REQUIRE_NOTHROW( + stateMatrix = openspace::SpiceManager::ref().stateTransformMatrix( + "J2000", "IAU_PHOEBE", et) + ); + + // check for matrix consistency + for (int i = 0; i < 6; i++) { + for (int j = 0; j < 6; j++) { + REQUIRE(referenceMatrix[i][j] == Approx(stateMatrix[i * 6 + j])); + } + } + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Get Position Transform Matrix", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + using openspace::SpiceManager; + loadMetaKernel(); + + double et; + double state[3] = { 1.0, 1.0, 1.0 }; + double state_t[3]; + double referenceMatrix[3][3]; + + str2et_c("2004 jun 11 19:32:00", &et); + pxform_c("CASSINI_HGA", "J2000", et, referenceMatrix); + + glm::dmat3 positionMatrix = glm::dmat3(1.0); + glm::dvec3 position(state[0], state[1], state[2]); + REQUIRE_NOTHROW(positionMatrix = SpiceManager::ref().positionTransformMatrix( + "CASSINI_HGA", "J2000", et) + ); + + // check for matrix consistency + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 3; j++) { + REQUIRE(referenceMatrix[i][j] == Approx(positionMatrix[j][i])); + } + } + +#if defined __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 + + // transform reference position into new frame + mxvg_c(referenceMatrix, state, 3, 3, state_t); + +#if defined __clang__ +#pragma clang diagnostic pop +#elif defined __GNUC__ +#pragma GCC diagnostic pop +#endif + + position = positionMatrix * position; + // check transformed values match + for (int i = 0; i < 3; i++) { + REQUIRE(position[i] == Approx(state_t[i])); + } + + openspace::SpiceManager::deinitialize(); +} + +TEST_CASE("SpiceManager: Get Field Of View", "[spicemanager]") { + openspace::SpiceManager::initialize(); + + using openspace::SpiceManager; + loadMetaKernel(); + + SpiceInt n; + SpiceInt cassini_ID; + double et; + double bounds_ref[5][3]; + char shape_ref[TYPLEN]; + char name_ref[FILLEN]; + double boresightVec[3]; + + str2et_c("2004 jun 11 19:32:00", &et); + SpiceBoolean found; + bodn2c_c("CASSINI_ISS_NAC", &cassini_ID, &found); + REQUIRE(found == SPICETRUE); + + getfov_c(cassini_ID, 5, TYPLEN, TYPLEN, shape_ref, name_ref, boresightVec, &n, bounds_ref); + + SpiceManager::FieldOfViewResult res; + + REQUIRE_NOTHROW(res = SpiceManager::ref().fieldOfView("CASSINI_ISS_NAC")); + + REQUIRE(found == SPICETRUE); + //check vectors have correct values + for (size_t i = 0; i < res.bounds.size(); i++) { + for (size_t j = 0; j < 3; j++) { + REQUIRE( + bounds_ref[i][j] == + Approx(res.bounds[i][static_cast(j)]) + ); + } + } + + openspace::SpiceManager::deinitialize(); +} diff --git a/tests/test_spicemanager.inl b/tests/test_spicemanager.inl deleted file mode 100644 index 619c6fb6b0..0000000000 --- a/tests/test_spicemanager.inl +++ /dev/null @@ -1,476 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2019 * - * * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this * - * software and associated documentation files (the "Software"), to deal in the Software * - * without restriction, including without limitation the rights to use, copy, modify, * - * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * - * permit persons to whom the Software is furnished to do so, subject to the following * - * conditions: * - * * - * The above copyright notice and this permission notice shall be included in all copies * - * or substantial portions of the Software. * - * * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * - * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * - * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - ****************************************************************************************/ - -#include - -#include - -#include "SpiceUsr.h" -#include "SpiceZpr.h" - -class SpiceManagerTest : public testing::Test { -protected: - void SetUp() override { - openspace::SpiceManager::initialize(); - } - - void TearDown() override { - openspace::SpiceManager::deinitialize(); - - } -}; - -//global constants -#define FILLEN 128 -#define TYPLEN 32 -#define SRCLEN 128 - -namespace spicemanager_constants { - const int nrMetaKernels = 9; - SpiceInt which, handle, count = 0; - char file[FILLEN], filtyp[TYPLEN], source[SRCLEN]; - double abs_error = 0.00001; -} // namespace spicemanager_constants - -// In this testclass only a handset of the testfunctions require a single kernel. -// The remaining methods rely on multiple kernels, loaded as a SPICE 'meta-kernel'. - -void loadMetaKernel() { - int k1 = openspace::SpiceManager::ref().loadKernel( - absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") - ); - EXPECT_EQ(1, k1) << "loadKernel did not return proper id"; - - int k2 = openspace::SpiceManager::ref().loadKernel( - absPath("${TESTDIR}/SpiceTest/spicekernels/cas00084.tsc") - ); - EXPECT_EQ(2, k2) << "loadKernel did not return proper id"; - - int k3 = openspace::SpiceManager::ref().loadKernel( - absPath("${TESTDIR}/SpiceTest/spicekernels/981005_PLTEPH-DE405S.bsp") - ); - EXPECT_EQ(3, k3) << "loadKernel did not return proper id"; - - int k4 = openspace::SpiceManager::ref().loadKernel( - absPath("${TESTDIR}/SpiceTest/spicekernels/020514_SE_SAT105.bsp") - ); - EXPECT_EQ(4, k4) << "loadKernel did not return proper id"; - - int k5 = openspace::SpiceManager::ref().loadKernel( - absPath("${TESTDIR}/SpiceTest/spicekernels/030201AP_SK_SM546_T45.bsp") - ); - EXPECT_EQ(5, k5) << "loadKernel did not return proper id"; - - int k6 = openspace::SpiceManager::ref().loadKernel( - absPath("${TESTDIR}/SpiceTest/spicekernels/cas_v37.tf") - ); - EXPECT_EQ(6, k6) << "loadKernel did not return proper id"; - - int k7 = openspace::SpiceManager::ref().loadKernel( - absPath("${TESTDIR}/SpiceTest/spicekernels/04135_04171pc_psiv2.bc") - ); - EXPECT_EQ(7, k7) << "loadKernel did not return proper id"; - - int k8 = openspace::SpiceManager::ref().loadKernel( - absPath("${TESTDIR}/SpiceTest/spicekernels/cpck05Mar2004.tpc") - ); - EXPECT_EQ(8, k8) << "loadKernel did not return proper id"; - - int k9 = openspace::SpiceManager::ref().loadKernel( - absPath("${TESTDIR}/SpiceTest/spicekernels/cas_iss_v09.ti") - ); - EXPECT_EQ(9, k9) << "loadKernel did not return proper id"; -} - -#define LSK absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") - -int loadLSKKernel() { - int kernelID = openspace::SpiceManager::ref().loadKernel( - LSK - ); - EXPECT_EQ(1, kernelID) << "loadKernel did not return proper id"; - return kernelID; -} - -#define PCK absPath("${TESTDIR}/SpiceTest/spicekernels/cpck05Mar2004.tpc") - -int loadPCKKernel() { - int kernelID = openspace::SpiceManager::ref().loadKernel( - PCK - ); - EXPECT_EQ(1, kernelID) << "loadKernel did not return proper id"; - return kernelID; -} - -std::string fileType(char type[]){ - std::string str(type); - return str; -} - -// Try loading single kernel -TEST_F(SpiceManagerTest, loadSingleKernel) { - loadLSKKernel(); - // naif0008.tls is a text file, check if loaded. - SpiceBoolean found; - kdata_c( - 0, - "text", - FILLEN, - TYPLEN, - SRCLEN, - spicemanager_constants::file, - spicemanager_constants::filtyp, - spicemanager_constants::source, - &spicemanager_constants::handle, - &found - ); - - ASSERT_TRUE(found == SPICETRUE) << "Kernel not loaded"; -} - -// Try unloading kernel using user assigned keyword -TEST_F(SpiceManagerTest, unloadKernelString) { - loadLSKKernel(); - // naif0008.tls is a text file, check if loaded. - SpiceBoolean found; - kdata_c( - 0, - "text", - FILLEN, - TYPLEN, - SRCLEN, - spicemanager_constants::file, - spicemanager_constants::filtyp, - spicemanager_constants::source, - &spicemanager_constants::handle, - &found - ); - ASSERT_TRUE(found == SPICETRUE); - - // unload using string keyword - openspace::SpiceManager::ref().unloadKernel(LSK); - - found = SPICEFALSE; - kdata_c( - 0, - "text", - FILLEN, - TYPLEN, - SRCLEN, - spicemanager_constants::file, - spicemanager_constants::filtyp, - spicemanager_constants::source, - &spicemanager_constants::handle, - &found - ); - EXPECT_FALSE(found == SPICETRUE); -} - -// Try unloading kernel using integer as ID -TEST_F(SpiceManagerTest, unloadKernelInteger) { - int kernelID = loadLSKKernel(); - // naif0008.tls is a text file, check if loaded. - SpiceBoolean found; - kdata_c( - 0, - "text", - FILLEN, - TYPLEN, - SRCLEN, - spicemanager_constants::file, - spicemanager_constants::filtyp, - spicemanager_constants::source, - &spicemanager_constants::handle, - &found - ); - ASSERT_TRUE(found == SPICETRUE); - - // unload using unique int ID - openspace::SpiceManager::ref().unloadKernel(kernelID); - - found = SPICEFALSE; - kdata_c( - 0, - "text", - FILLEN, - TYPLEN, - SRCLEN, - spicemanager_constants::file, - spicemanager_constants::filtyp, - spicemanager_constants::source, - &spicemanager_constants::handle, - &found - ); - EXPECT_FALSE(found == SPICETRUE) << "One or more kernels still present in kernel-pool"; -} - -// Attempt finding a value in kernelpool -TEST_F(SpiceManagerTest, hasValue) { - loadPCKKernel(); - - int naifId = 399; // Earth - - std::string kernelPoolValue = "RADII"; - - bool found = openspace::SpiceManager::ref().hasValue(naifId, kernelPoolValue); - ASSERT_TRUE(found) << "Could not find value for specified kernel"; -} - -// Get 1dim value from kernelpool -TEST_F(SpiceManagerTest, getValueFromID_1D) { - loadPCKKernel(); - - std::string target = "EARTH"; - std::string value1D = "MAG_NORTH_POLE_LAT"; - - double return1D; - ASSERT_NO_THROW(openspace::SpiceManager::ref().getValue(target, value1D, return1D)); - EXPECT_EQ(return1D, 78.565) << "Value not found / differs from expected return"; -} - -// Get 2dim value from kernelpool -TEST_F(SpiceManagerTest, getValueFromID_3D) { - loadPCKKernel(); - - std::string target = "EARTH"; - std::string value3D = "RADII"; - - glm::dvec3 return3D; - ASSERT_NO_THROW(openspace::SpiceManager::ref().getValue(target, value3D, return3D)); - - EXPECT_EQ(return3D.x, 6378.14) << "Value not found / differs from expected return"; - EXPECT_EQ(return3D.y, 6378.14) << "Value not found / differs from expected return"; - EXPECT_EQ(return3D.z, 6356.75) << "Value not found / differs from expected return"; -} - -// Get Ndim value from kernelpool -TEST_F(SpiceManagerTest, getValueFromID_ND) { - loadPCKKernel(); - - std::string target = "SATURN"; - std::string valueND = "RING6_A"; - - std::vector returnND(5); - ASSERT_NO_THROW(openspace::SpiceManager::ref().getValue(target, valueND, returnND)); - - std::vector controlVec{ 189870.0, 256900.0, 9000.0, 9000.0, 0.000003 }; - - ASSERT_EQ(controlVec.size(), returnND.size()) << "Vectors differ in size"; - - for (unsigned int i = 0; i < returnND.size(); ++i){ - EXPECT_EQ(controlVec[i], returnND[i]) << "Vector value not equal"; - } -} - -// Try converting string to Ephemeris time -TEST_F(SpiceManagerTest, stringToEphemerisTime) { - loadLSKKernel(); - - double ephemerisTime; - double control_ephemerisTime; - char date[SRCLEN] = "Thu Mar 20 12:53:29 PST 1997"; - str2et_c(date, &control_ephemerisTime); - - ASSERT_NO_THROW(ephemerisTime = openspace::SpiceManager::ref().ephemerisTimeFromDate(date)); - - EXPECT_EQ(ephemerisTime, control_ephemerisTime) << "Ephemeries times differ / not found"; -} - -// Try getting positional vector of target -TEST_F(SpiceManagerTest, getTargetPosition) { - using openspace::SpiceManager; - loadMetaKernel(); - - double et; - double pos[3]; - double lt; - char utctime[SRCLEN] = "2004 jun 11 19:32:00"; - - str2et_c(utctime, &et); - spkpos_c("EARTH", et, "J2000", "LT+S", "CASSINI", pos, <); - - glm::dvec3 targetPosition; - double lightTime = 0.0; - SpiceManager::AberrationCorrection corr = { - SpiceManager::AberrationCorrection::Type::LightTimeStellar, - SpiceManager::AberrationCorrection::Direction::Reception - }; - - ASSERT_NO_THROW(targetPosition = SpiceManager::ref().targetPosition( - "EARTH", "CASSINI", "J2000", corr, et, lightTime) - ); - EXPECT_DOUBLE_EQ(pos[0], targetPosition[0]) << "Position not found or differs from expected return"; - EXPECT_DOUBLE_EQ(pos[1], targetPosition[1]) << "Position not found or differs from expected return"; - EXPECT_DOUBLE_EQ(pos[2], targetPosition[2]) << "Position not found or differs from expected return"; -} - -// Try getting position & velocity vectors of target -TEST_F(SpiceManagerTest, getTargetState) { - using openspace::SpiceManager; - loadMetaKernel(); - - double et; - double state[6]; - double lt; - char utctime[SRCLEN] = "2004 jun 11 19:32:00"; - - str2et_c(utctime, &et); - spkezr_c("EARTH", et, "J2000", "LT+S", "CASSINI", state, <); - - SpiceManager::AberrationCorrection corr = { - SpiceManager::AberrationCorrection::Type::LightTimeStellar, - SpiceManager::AberrationCorrection::Direction::Reception - }; - - SpiceManager::TargetStateResult res; - ASSERT_NO_THROW(res = SpiceManager::ref().targetState("EARTH", "CASSINI", "J2000", corr, et)); - - // x,y,z - for (int i = 0; i < 3; i++){ - EXPECT_DOUBLE_EQ(state[i], res.position[i]) << "Position not found or differs from expected return"; - EXPECT_DOUBLE_EQ(state[i+3], res.velocity[i]) << "Velocity not found or differs from expected return"; - } -} - -// Try getting transformation matrix and transform position and velocity into new reference frame -//TEST_F(SpiceManagerTest, getStateTransformMatrix) { -// loadMetaKernel(); -// -// double et; -// double state[6]; -// double state_t[6]; -// double lt; -// double referenceMatrix[6][6]; -// -// str2et_c("2004 jun 11 19:32:00", &et); -// spkezr_c("PHOEBE", et, "J2000", "LT+S", "CASSINI", state, <); -// sxform_c("J2000", "IAU_PHOEBE", et, referenceMatrix); -// -// glm::dvec3 position(state[0], state[1], state[2]); -// glm::dvec3 velocity(state[3], state[4], state[5]); -// -// openspace::SpiceManager::TransformMatrix stateMatrix; -// ASSERT_NO_THROW(stateMatrix = openspace::SpiceManager::ref().stateTransformMatrix( -// "J2000", "IAU_PHOEBE", et)); -// -// // check for matrix consistency -// for (int i = 0; i < 6; i++) { -// for (int j = 0; j < 6; j++) { -// EXPECT_DOUBLE_EQ(referenceMatrix[i][j], stateMatrix[i * 6 + j]) << "State-matrix not set or has wrong values"; -// } -// } -// mxvg_c(referenceMatrix, state, 6, 6, state_t); -// -// -// for (int i = 0; i < 3; i++) { -// EXPECT_DOUBLE_EQ(position[i], state_t[i]) << "Position vector differs from its reference"; -// EXPECT_DOUBLE_EQ(velocity[i], state_t[i + 3]) << "Velocity vector differs from its reference"; -// } -//} - -// Try getting transformation matrix and transform the position only into new reference frame -TEST_F(SpiceManagerTest, getPositionTransformMatrix) { - using openspace::SpiceManager; - loadMetaKernel(); - - double et; - double state[3] = { 1.0, 1.0, 1.0 }; - double state_t[3]; - double referenceMatrix[3][3]; - - str2et_c("2004 jun 11 19:32:00", &et); - pxform_c("CASSINI_HGA", "J2000", et, referenceMatrix); - - glm::dmat3 positionMatrix; - glm::dvec3 position(state[0], state[1], state[2]); - ASSERT_NO_THROW(positionMatrix = SpiceManager::ref().positionTransformMatrix( - "CASSINI_HGA", "J2000", et) - ); - - // check for matrix consistency - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - EXPECT_DOUBLE_EQ(referenceMatrix[i][j], positionMatrix[j][i]) << "Position-matrix not set or has wrong values"; - } - } - -#if defined __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 - - // transform reference position into new frame - mxvg_c(referenceMatrix, state, 3, 3, state_t); - -#if defined __clang__ -#pragma clang diagnostic pop -#elif defined __GNUC__ -#pragma GCC diagnostic pop -#endif - - position = positionMatrix * position; - // check transformed values match - for (int i = 0; i < 3; i++) { - EXPECT_DOUBLE_EQ(position[i], state_t[i]) << "Position vector differs from its reference"; - } -} - -// Try to get boresight vector and instrument field of view boundary vectors -TEST_F(SpiceManagerTest, getFieldOfView) { - using openspace::SpiceManager; - loadMetaKernel(); - - SpiceInt n; - SpiceInt cassini_ID; - double et; - double bounds_ref[5][3]; - char shape_ref[TYPLEN]; - char name_ref[FILLEN]; - double boresightVec[3]; - - str2et_c("2004 jun 11 19:32:00", &et); - SpiceBoolean found; - bodn2c_c("CASSINI_ISS_NAC", &cassini_ID, &found); - ASSERT_TRUE(found == SPICETRUE) << "Cannot locate ID for Cassini"; - - getfov_c(cassini_ID, 5, TYPLEN, TYPLEN, shape_ref, name_ref, boresightVec, &n, bounds_ref); - - SpiceManager::FieldOfViewResult res; - - ASSERT_NO_THROW(res = SpiceManager::ref().fieldOfView("CASSINI_ISS_NAC")); - - ASSERT_TRUE(found == SPICETRUE); - //check vectors have correct values - for (size_t i = 0; i < res.bounds.size(); i++) { - for (size_t j = 0; j < 3; j++) { - EXPECT_DOUBLE_EQ( - bounds_ref[i][j], - res.bounds[i][static_cast(j)] - ) << "One or more Field of View Boundary vectors differ from expected output"; - } - } -} diff --git a/tests/test_ellipsoid.inl b/tests/test_temporaltileprovider.cpp similarity index 80% rename from tests/test_ellipsoid.inl rename to tests/test_temporaltileprovider.cpp index 05c283da28..0141fcc619 100644 --- a/tests/test_ellipsoid.inl +++ b/tests/test_temporaltileprovider.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,22 +22,14 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include -#include +#include "catch2/catch.hpp" -#define _USE_MATH_DEFINES -#include +#include +#include #include -class EllipsoidTest : public testing::Test {}; +namespace { + constexpr const char* fileName = "data/scene/debugglobe/map_service_configs/" + "VIIRS_SNPP_CorrectedReflectance_TrueColor_temporal.xml"; +} // namespace -using namespace openspace; - -TEST_F(EllipsoidTest, GeodeticSurfaceNormal) { - Ellipsoid ellipsoid(Vec3(1, 1, 1)); - - Vec3 geodeticNormal = ellipsoid.geodeticSurfaceNormal(Vec3(0, 0, 1)); - Vec3 expectedNormal = Vec3(0, 0, 1); - - ASSERT_EQ(geodeticNormal, expectedNormal); -} diff --git a/tests/test_timeline.inl b/tests/test_timeline.cpp similarity index 70% rename from tests/test_timeline.inl rename to tests/test_timeline.cpp index 61f3e600d6..3547677bfb 100644 --- a/tests/test_timeline.inl +++ b/tests/test_timeline.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2019 * + * 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 * @@ -22,60 +22,61 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include "catch2/catch.hpp" + #include #include -class TimelineTest : public testing::Test {}; - -TEST_F(TimelineTest, AddAndCountKeyframes) { +TEST_CASE("TimeLine: Add and Count Keyframes", "[timeline]") { openspace::Timeline timeline; timeline.addKeyframe(0.0, openspace::Time::now()); timeline.addKeyframe(1.0, openspace::Time::now()); - ASSERT_EQ(timeline.nKeyframes(), 2); + REQUIRE(timeline.nKeyframes() == 2); + } -TEST_F(TimelineTest, QueryKeyframes) { +TEST_CASE("TimeLine: Query Keyframes", "[timeline]") { openspace::Timeline timeline; timeline.addKeyframe(0.0, 0.f); timeline.addKeyframe(1.0, 1.f); - ASSERT_EQ(timeline.nKeyframes(), 2); + REQUIRE(timeline.nKeyframes() == 2); - ASSERT_EQ(timeline.firstKeyframeAfter(0.0)->data, 1.f) << "Incorrect keyframe returned"; - ASSERT_EQ(timeline.firstKeyframeAfter(0.0, false)->data, 1.f) << "Incorrect keyframe returned"; - ASSERT_EQ(timeline.firstKeyframeAfter(0.0, true)->data, 0.f) << "Incorrect keyframe returned"; + REQUIRE(timeline.firstKeyframeAfter(0.0)->data == Approx(1.f)); + REQUIRE(timeline.firstKeyframeAfter(0.0, false)->data == Approx(1.f)); + REQUIRE(timeline.firstKeyframeAfter(0.0, true)->data == Approx(0.f)); - ASSERT_EQ(timeline.lastKeyframeBefore(1.0)->data, 0.f) << "Incorrect keyframe returned"; - ASSERT_EQ(timeline.lastKeyframeBefore(1.0, false)->data, 0.f) << "Incorrect keyframe returned"; - ASSERT_EQ(timeline.lastKeyframeBefore(1.0, true)->data, 1.f) << "Incorrect keyframe returned"; + REQUIRE(timeline.lastKeyframeBefore(1.0)->data == Approx(0.f)); + REQUIRE(timeline.lastKeyframeBefore(1.0, false)->data == Approx(0.f)); + REQUIRE(timeline.lastKeyframeBefore(1.0, true)->data == Approx(1.f)); } -TEST_F(TimelineTest, RemoveKeyframes) { +TEST_CASE("TimeLine: Remove Keyframes", "[timeline]") { openspace::Timeline timeline; timeline.addKeyframe(0.0, 0.f); timeline.addKeyframe(1.0, 1.f); timeline.removeKeyframesBefore(0.0); - ASSERT_EQ(timeline.nKeyframes(), 2); + REQUIRE(timeline.nKeyframes() == 2); timeline.removeKeyframesBefore(0.0, false); - ASSERT_EQ(timeline.nKeyframes(), 2); + REQUIRE(timeline.nKeyframes() == 2); timeline.removeKeyframesBefore(0.0, true); - ASSERT_EQ(timeline.nKeyframes(), 1); + REQUIRE(timeline.nKeyframes() == 1); timeline.removeKeyframesAfter(1.0); - ASSERT_EQ(timeline.nKeyframes(), 1); + REQUIRE(timeline.nKeyframes() == 1); timeline.removeKeyframesAfter(1.0, false); - ASSERT_EQ(timeline.nKeyframes(), 1); + REQUIRE(timeline.nKeyframes() == 1); timeline.removeKeyframesAfter(1.0, true); - ASSERT_EQ(timeline.nKeyframes(), 0); + REQUIRE(timeline.nKeyframes() == 0); } -TEST_F(TimelineTest, RemoveKeyframesInRange) { +TEST_CASE("TimeLine: Remove Keyframes In Range", "[timeline]") { openspace::Timeline timeline; timeline.addKeyframe(0.0, 0.f); timeline.addKeyframe(1.0, 1.f); @@ -83,14 +84,14 @@ TEST_F(TimelineTest, RemoveKeyframesInRange) { timeline.addKeyframe(3.0, 3.f); timeline.removeKeyframesBetween(1.0, 2.0); - ASSERT_EQ(timeline.nKeyframes(), 4); + REQUIRE(timeline.nKeyframes() == 4); timeline.removeKeyframesBetween(1.0, 2.0, false, true); - ASSERT_EQ(timeline.nKeyframes(), 3); + REQUIRE(timeline.nKeyframes() == 3); timeline.removeKeyframesBetween(1.0, 2.0, true, true); - ASSERT_EQ(timeline.nKeyframes(), 2); + REQUIRE(timeline.nKeyframes() == 2); timeline.removeKeyframesBetween(-1.0, 4.0); - ASSERT_EQ(timeline.nKeyframes(), 0); + REQUIRE(timeline.nKeyframes() == 0); } diff --git a/tests/test_timequantizer.inl b/tests/test_timequantizer.cpp similarity index 83% rename from tests/test_timequantizer.inl rename to tests/test_timequantizer.cpp index bf8a099753..0730319838 100644 --- a/tests/test_timequantizer.inl +++ b/tests/test_timequantizer.cpp @@ -22,7 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "gtest/gtest.h" +#include "catch2/catch.hpp" + #include #include "modules/globebrowsing/src/timequantizer.h" #include @@ -30,43 +31,26 @@ #include "SpiceUsr.h" #include "SpiceZpr.h" -#define _USE_MATH_DEFINES -#include -#include +namespace { + constexpr const int FILLEN = 128; + constexpr const int TYPLEN = 32; + constexpr const int SRCLEN = 128; -class TimeQuantizerTest : public testing::Test { -protected: - void SetUp() override { - openspace::SpiceManager::initialize(); + namespace spicemanager_constants { + const int nrMetaKernels = 9; + SpiceInt which, handle, count = 0; + char file[FILLEN], filtyp[TYPLEN], source[SRCLEN]; + double abs_error = 0.00001; + } // namespace spicemanager_constants + + int loadLSKKernel() { + int kernelID = openspace::SpiceManager::ref().loadKernel( + absPath("${TESTDIR}/SpiceTest/spicekernels/naif0008.tls") + ); + REQUIRE(kernelID == 1); + return kernelID; } - - void TearDown() override { - openspace::SpiceManager::deinitialize(); - - } -}; - -//global constants -#define FILLEN 128 -#define TYPLEN 32 -#define SRCLEN 128 - -namespace spicemanager_constants { - const int nrMetaKernels = 9; - SpiceInt which, handle, count = 0; - char file[FILLEN], filtyp[TYPLEN], source[SRCLEN]; - double abs_error = 0.00001; -} // namespace spicemanager_constants - -#define LSK "C:\\Users\\OpenSpace\\Desktop\\profiles\\OpenSpace\\tests\\SpiceTest\\spicekernels\\naif0008.tls" - -int loadLSKKernel() { - int kernelID = openspace::SpiceManager::ref().loadKernel( - std::string(LSK) - ); - EXPECT_EQ(1, kernelID) << "loadKernel did not return proper id"; - return kernelID; -} +} // namespace static void singleTimeTest(openspace::Time& t, openspace::globebrowsing::TimeQuantizer& tq, bool clamp, @@ -74,7 +58,7 @@ static void singleTimeTest(openspace::Time& t, { t.setTime(input); tq.quantize(t, clamp); - EXPECT_EQ(t.ISO8601(), expected); + REQUIRE(t.ISO8601() == expected); } static void singleResolutionTest(openspace::globebrowsing::TimeQuantizer& tq, @@ -91,11 +75,11 @@ static void singleResolutionTest(openspace::globebrowsing::TimeQuantizer& tq, } if (expectFailure) { - EXPECT_TRUE(res.find(search) != std::string::npos); - EXPECT_TRUE(res.find(expectedType) != std::string::npos); + REQUIRE(res.find(search) != std::string::npos); + REQUIRE(res.find(expectedType) != std::string::npos); } else { - EXPECT_TRUE(res.find(search) == std::string::npos); + REQUIRE(res.find(search) == std::string::npos); } } @@ -112,10 +96,10 @@ static void singleStartTimeTest1(openspace::globebrowsing::TimeQuantizer& tq, } if (expectFailure) { - EXPECT_TRUE(res.find(expectedErrSubstring) != std::string::npos); + REQUIRE(res.find(expectedErrSubstring) != std::string::npos); } else { - EXPECT_TRUE(res.find(expectedErrSubstring) == std::string::npos); + REQUIRE(res.find(expectedErrSubstring) == std::string::npos); } } @@ -132,14 +116,16 @@ static void singleStartTimeTest2(std::string startTime, std::string expectedErrS } if (expectFailure) { - EXPECT_TRUE(res.find(expectedErrSubstring) != std::string::npos); + REQUIRE(res.find(expectedErrSubstring) != std::string::npos); } else { - EXPECT_TRUE(res.find(expectedErrSubstring) == std::string::npos); + REQUIRE(res.find(expectedErrSubstring) == std::string::npos); } } static void LoadSpiceKernel () { + openspace::SpiceManager::initialize(); + loadLSKKernel(); // naif0008.tls is a text file, check if loaded. SpiceBoolean found; @@ -156,11 +142,14 @@ static void LoadSpiceKernel () { &found ); - ASSERT_TRUE(found == SPICETRUE) << "Kernel not loaded"; + REQUIRE(found == SPICETRUE); + openspace::SpiceManager::deinitialize(); } -TEST_F(TimeQuantizerTest, TestYears) { - LoadSpiceKernel(); +TEST_CASE("TimeQuantizer: Test years resolution", "[timequantizer]") { + openspace::SpiceManager::initialize(); + + loadLSKKernel(); using namespace openspace::globebrowsing; TimeQuantizer t1; openspace::Time testT; @@ -186,10 +175,14 @@ TEST_F(TimeQuantizerTest, TestYears) { singleTimeTest(testT, t1, true, "2022-12-09T00:00:00", "2022-12-09T00:00:00.000"); singleTimeTest(testT, t1, true, "2028-12-08T23:59:59", "2025-12-09T00:00:00.000"); singleTimeTest(testT, t1, true, "2028-12-09T00:00:01", "2028-12-09T00:00:00.000"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(TimeQuantizerTest, TestDays) { - LoadSpiceKernel(); +TEST_CASE("TimeQuantizer: Test days resolution", "[timequantizer]") { + openspace::SpiceManager::initialize(); + + loadLSKKernel(); using namespace openspace::globebrowsing; TimeQuantizer t1; openspace::Time testT; @@ -226,10 +219,14 @@ TEST_F(TimeQuantizerTest, TestDays) { singleTimeTest(testT, t1, true, "2020-03-01T00:30:00", "2020-03-01T00:00:00.000"); singleTimeTest(testT, t1, true, "2019-03-04T00:00:02", "2019-03-04T00:00:00.000"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(TimeQuantizerTest, TestMonths) { - LoadSpiceKernel(); +TEST_CASE("TimeQuantizer: Test months resolution", "[timequantizer]") { + openspace::SpiceManager::initialize(); + + loadLSKKernel(); using namespace openspace::globebrowsing; TimeQuantizer t1; openspace::Time testT; @@ -262,10 +259,14 @@ TEST_F(TimeQuantizerTest, TestMonths) { singleTimeTest(testT, t1, true, "2016-11-28T00:00:05", "2016-11-28T00:00:00.000"); singleTimeTest(testT, t1, true, "2017-05-30T04:15:45", "2017-05-28T00:00:00.000"); singleTimeTest(testT, t1, true, "2017-10-17T05:01:00", "2017-05-28T00:00:00.000"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(TimeQuantizerTest, TestTimes) { - LoadSpiceKernel(); +TEST_CASE("TimeQuantizer: Test hours & minutes resolution", "[timequantizer]") { + openspace::SpiceManager::initialize(); + + loadLSKKernel(); using namespace openspace::globebrowsing; TimeQuantizer t1; openspace::Time testT; @@ -298,10 +299,14 @@ TEST_F(TimeQuantizerTest, TestTimes) { singleTimeTest(testT, t1, true, "2019-02-28T22:15:01", "2019-02-28T22:15:00.000"); singleTimeTest(testT, t1, true, "2019-02-28T22:29:59", "2019-02-28T22:15:00.000"); singleTimeTest(testT, t1, true, "2019-02-28T22:59:59", "2019-02-28T22:45:00.000"); + + openspace::SpiceManager::deinitialize(); } -TEST_F(TimeQuantizerTest, TestResolutionError) { - LoadSpiceKernel(); +TEST_CASE("TimeQuantizer: Test valid resolutions", "[timequantizer]") { + openspace::SpiceManager::initialize(); + + loadLSKKernel(); using namespace openspace::globebrowsing; TimeQuantizer t1; @@ -318,10 +323,14 @@ TEST_F(TimeQuantizerTest, TestResolutionError) { singleResolutionTest(t1, "30m", "(m)inute option.", false); singleResolutionTest(t1, "31m", "(m)inute option.", true); singleResolutionTest(t1, "10s", "unit format", true); + + openspace::SpiceManager::deinitialize(); } -TEST_F(TimeQuantizerTest, TestStartTimeError1) { - LoadSpiceKernel(); +TEST_CASE("TimeQuantizer: Test start time pre-existing object", "[timequantizer]") { + openspace::SpiceManager::initialize(); + + loadLSKKernel(); using namespace openspace::globebrowsing; TimeQuantizer t1; @@ -330,14 +339,20 @@ TEST_F(TimeQuantizerTest, TestStartTimeError1) { singleStartTimeTest1(t1, "2017-01-28T12:00:00", "Invalid start time value", true); singleStartTimeTest1(t1, "2017-01-28T00:01:00", "Invalid start time value", true); singleStartTimeTest1(t1, "2017-01-28T00:00:01", "Invalid start time value", true); + + openspace::SpiceManager::deinitialize(); } -TEST_F(TimeQuantizerTest, TestStartTimeError2) { - LoadSpiceKernel(); +TEST_CASE("TimeQuantizer: Test start time using constructor", "[timequantizer]") { + openspace::SpiceManager::initialize(); + + loadLSKKernel(); singleStartTimeTest2("2017-01-20T00:00:00", "Invalid start", false); singleStartTimeTest2("2017-01-29T00:00:00", "Invalid start day value", true); singleStartTimeTest2("2017-01-28T12:00:00", "Invalid start time value", true); singleStartTimeTest2("2017-01-28T00:01:00", "Invalid start time value", true); singleStartTimeTest2("2017-01-28T00:00:01", "Invalid start time value", true); + + openspace::SpiceManager::deinitialize(); } diff --git a/tests/tinyvolume.rawvolume b/tests/tinyvolume.rawvolume new file mode 100644 index 0000000000..2c7d7c4dad Binary files /dev/null and b/tests/tinyvolume.rawvolume differ