diff --git a/.gitignore b/.gitignore index 5306c5559c..a39f0eb829 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,17 @@ -*~ -*.swp .DS_Store .vscode /bin/ /build/ /cache/ -Thumbs.db -tmp/ - -/documentation /doc +/documentation /ext/SGCT +/logs +tmp/ +Thumbs.db +*~ +*.swp *.gglsl *.GhoulGenerated.glsl *.OpenSpaceGenerated.glsl @@ -30,7 +30,6 @@ install_manifest.txt .project shaders/ABuffer/constants.hglsl -log.html ScriptLog.txt data/scene/atmosphereearth/textures @@ -118,4 +117,4 @@ data/spice/nh_kernels data/spice/OsirisRexKernels data/spice/plu055.bsp data/spice/Rosetta -data/spice/sat375.bsp \ No newline at end of file +data/spice/sat375.bsp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d1d06c72f..234bfc2e8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,9 +28,9 @@ project (OpenSpace) message(STATUS "Generating OpenSpace project") set(OPENSPACE_VERSION_MAJOR 0) -set(OPENSPACE_VERSION_MINOR 8) +set(OPENSPACE_VERSION_MINOR 9) set(OPENSPACE_VERSION_PATCH 0) -set(OPENSPACE_VERSION_STRING "prerelease-13 (Earth Day)") +set(OPENSPACE_VERSION_STRING "prerelease-14 (Astronomy Live)") set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}") set(OPENSPACE_APPS_DIR "${OPENSPACE_BASE_DIR}/apps") diff --git a/apps/Launcher/CMakeLists.txt b/apps/Launcher/CMakeLists.txt index 8d21984d12..0b2cfba232 100644 --- a/apps/Launcher/CMakeLists.txt +++ b/apps/Launcher/CMakeLists.txt @@ -29,7 +29,8 @@ if (WIN32) set(RESOURCE_FILE ${OPENSPACE_APPS_DIR}/Launcher/openspace.rc) endif () -include (${GHOUL_BASE_DIR}/support/cmake/handle_external_library.cmake) +include(${GHOUL_BASE_DIR}/support/cmake/handle_external_library.cmake) +include(${OPENSPACE_CMAKE_EXT_DIR}/support_macros.cmake) set(application_path ${OPENSPACE_APPS_DIR}/Launcher) @@ -65,6 +66,8 @@ add_executable(${APPLICATION_NAME} MACOSX_BUNDLE ${RESOURCE_FILES} ) +set_compile_settings(${APPLICATION_NAME}) + target_link_libraries(${APPLICATION_NAME} Qt5::Widgets Qt5::Network diff --git a/apps/OpenSpace/CMakeLists.txt b/apps/OpenSpace/CMakeLists.txt index 6f9d4bb247..a2c52bed76 100644 --- a/apps/OpenSpace/CMakeLists.txt +++ b/apps/OpenSpace/CMakeLists.txt @@ -23,6 +23,7 @@ ########################################################################################## include(${GHOUL_BASE_DIR}/support/cmake/CopySharedLibraries.cmake) +include(${OPENSPACE_CMAKE_EXT_DIR}/support_macros.cmake) set(APPLICATION_NAME OpenSpace) set(APPLICATION_LINK_TO_OPENSPACE ON) @@ -130,3 +131,5 @@ if (MSVC) "/NODEFAULTLIB:LIBCMTD.lib /NODEFAULTLIB:LIBCMT.lib" ) endif() + +set_compile_settings(${APPLICATION_NAME}) diff --git a/apps/TaskRunner/CMakeLists.txt b/apps/TaskRunner/CMakeLists.txt index 69f23771d3..f05c53d6a9 100644 --- a/apps/TaskRunner/CMakeLists.txt +++ b/apps/TaskRunner/CMakeLists.txt @@ -26,6 +26,7 @@ set(APPLICATION_NAME TaskRunner) set(APPLICATION_LINK_TO_OPENSPACE ON) include (${GHOUL_BASE_DIR}/support/cmake/handle_external_library.cmake) +include(${OPENSPACE_CMAKE_EXT_DIR}/support_macros.cmake) set(application_path ${OPENSPACE_APPS_DIR}/TaskRunner) @@ -37,3 +38,4 @@ add_executable(${APPLICATION_NAME} MACOSX_BUNDLE ${SOURCE_FILES} ) +set_compile_settings(${APPLICATION_NAME}) diff --git a/data/scene/missions/newhorizons/jupiter/callisto/callisto.mod b/data/scene/missions/newhorizons/jupiter/callisto/callisto.mod index c99c354d59..3a51e4c5bb 100644 --- a/data/scene/missions/newhorizons/jupiter/callisto/callisto.mod +++ b/data/scene/missions/newhorizons/jupiter/callisto/callisto.mod @@ -1,3 +1,5 @@ +local callisto_radius = 1.8213E6 + return { -- Callisto module { @@ -7,9 +9,10 @@ return { Type = "RenderablePlanetProjection", Frame = "IAU_CALLISTO", Body = "CALLISTO", + Radius = callisto_radius, Geometry = { Type = "SimpleSphere", - Radius = 1.8213E6, + Radius = callisto_radius, Segments = 100 }, Textures = { diff --git a/data/scene/missions/newhorizons/jupiter/europa/europa.mod b/data/scene/missions/newhorizons/jupiter/europa/europa.mod index 21e07a2703..37a137fdb0 100644 --- a/data/scene/missions/newhorizons/jupiter/europa/europa.mod +++ b/data/scene/missions/newhorizons/jupiter/europa/europa.mod @@ -1,3 +1,5 @@ +local europa_radius = 1.8213E6 + return { -- Europa module { @@ -7,9 +9,10 @@ return { Type = "RenderablePlanetProjection", Frame = "IAU_EUROPA", Body = "EUROPA", + Radius = europa_radius, Geometry = { Type = "SimpleSphere", - Radius = 1.8213E6, + Radius = europa_radius, Segments = 100 }, Textures = { diff --git a/data/scene/missions/newhorizons/jupiter/ganymede/ganymede.mod b/data/scene/missions/newhorizons/jupiter/ganymede/ganymede.mod index 5fa473d332..9d16289f9b 100644 --- a/data/scene/missions/newhorizons/jupiter/ganymede/ganymede.mod +++ b/data/scene/missions/newhorizons/jupiter/ganymede/ganymede.mod @@ -1,3 +1,5 @@ +local ganymede_local = 1.8213E6 + return { -- Ganymede module { @@ -7,9 +9,10 @@ return { Type = "RenderablePlanetProjection", Frame = "IAU_GANYMEDE", Body = "GANYMEDE", + Radius = ganymede_local, Geometry = { Type = "SimpleSphere", - Radius = 1.8213E6, + Radius = ganymede_local, Segments = 100 }, Textures = { diff --git a/data/scene/missions/newhorizons/jupiter/io/io.mod b/data/scene/missions/newhorizons/jupiter/io/io.mod index d4e5260cbd..60ed022544 100644 --- a/data/scene/missions/newhorizons/jupiter/io/io.mod +++ b/data/scene/missions/newhorizons/jupiter/io/io.mod @@ -1,3 +1,5 @@ +local io_radius = 1.8213E6 + return { -- Io module { @@ -7,9 +9,10 @@ return { Type = "RenderablePlanetProjection", Frame = "IAU_IO", Body = "IO", + Radius = io_radius, Geometry = { Type = "SimpleSphere", - Radius = 1.8213E6, + Radius = io_radius, Segments = 100 }, Textures = { @@ -74,7 +77,7 @@ return { Parent = "Io", Renderable = { Type = "RenderablePlane", - Size = {1.0, 7.4}, + Size = 10^7.4, Origin = "Center", Billboard = true, Texture = "textures/Io-Text.png", diff --git a/data/scene/missions/newhorizons/jupiter/jupiter/jupiter.mod b/data/scene/missions/newhorizons/jupiter/jupiter/jupiter.mod index 17f3a6afea..f4fbe278f0 100644 --- a/data/scene/missions/newhorizons/jupiter/jupiter/jupiter.mod +++ b/data/scene/missions/newhorizons/jupiter/jupiter/jupiter.mod @@ -1,3 +1,5 @@ +local jupiter_local = 0.71492E8 + return { -- Jupiter barycenter module { @@ -20,9 +22,10 @@ return { Type = "RenderablePlanetProjection", Frame = "IAU_JUPITER", Body = "JUPITER", + Radius = jupiter_local, Geometry = { Type = "SimpleSphere", - Radius = 0.71492E8, + Radius = jupiter_local, Segments = 200, }, Textures = { diff --git a/data/scene/missions/newhorizons/newhorizons/newhorizons.mod b/data/scene/missions/newhorizons/newhorizons/newhorizons.mod index 40368d7efc..3e00eac771 100644 --- a/data/scene/missions/newhorizons/newhorizons/newhorizons.mod +++ b/data/scene/missions/newhorizons/newhorizons/newhorizons.mod @@ -1,46 +1,36 @@ if UseAccurateNewHorizonsKernels then NewHorizonsKernels = { - -- SCLK - "${SPICE}/nh_kernels/sclk/new-horizons_0976.tsc", - -- "${SPICE}/NewHorizonsKernels/new_horizons_413.tsc", + "${SPICE}/nh_20170126/spk/nh_pred_20141201_20190301_od122.bsp", + "${SPICE}/nh_20170126/spk/NavSE_plu047_od122.bsp", + "${SPICE}/nh_20170126/spk/NavPE_de433_od122.bsp", - -- SPK - "${SPICE}/nh_kernels/spk/nh_pred_20141201_20190301_od122.bsp", - -- "${SPICE}/nh_kernels/spk/nh_pred_20120501_20160913_od093.bsp", - "${SPICE}/nh_kernels/spk/plu_all_mvi.spk", "${SPICE}/jup260.bsp", - -- "${SPICE}/NewHorizonsKernels/de413.bsp", - -- CK - "${SPICE}/nh_kernels/ck/nh_scispi_2015_pred.bc", - "${SPICE}/nh_kernels/ck/nh_scispi_2015_recon.bc", - "${SPICE}/nh_kernels/ck/nh_lorri_wcs.bc", - "${SPICE}/nh_kernels/ck/plutonet_PS104.bc", + "${SPICE}/nh_20170126/ck/nh_scispi_2015_pred.bc", + "${SPICE}/nh_20170126/ck/nh_scispi_2015_recon.bc", + "${SPICE}/nh_20170126/ck/nh_lorri_wcs.bc", + + "${SPICE}/nh_20170126/smithed_pc_and_sp/PLU_LORRI_ALL_161216.bc", - -- FK - "${SPICE}/nh_kernels/fk/nh_soc_misc_v001.tf", - "${SPICE}/nh_kernels/fk/nh_v220.tf", + "${SPICE}/nh_20170126/sclk/new-horizons_1121.tsc", - -- IK - "${SPICE}/nh_kernels/ik/nh_alice_v120.ti", - "${SPICE}/nh_kernels/ik/nh_allinstruments_v002.ti", - "${SPICE}/nh_kernels/ik/nh_astr_v000.ti", - "${SPICE}/nh_kernels/ik/nh_fss_v000.ti", - "${SPICE}/nh_kernels/ik/nh_lorri_v100.ti", - "${SPICE}/nh_kernels/ik/nh_pepssi_v110.ti", - "${SPICE}/nh_kernels/ik/nh_ralph_v100.ti", - "${SPICE}/nh_kernels/ik/nh_rex_v100.ti", - "${SPICE}/nh_kernels/ik/nh_sdc_v101.ti", - "${SPICE}/nh_kernels/ik/nh_swap_v100.ti", + "${SPICE}/nh_20170126/pck/nh_targets_v001.tpc", + "${SPICE}/nh_20170126/pck/nh_pcnh_005.tpc", - -- LSK - "${SPICE}/nh_kernels/lsk/naif0011.tls", - - -- PCK - "${SPICE}/nh_kernels/pck/nh_targets_v001.tpc", - "${SPICE}/nh_kernels/pck/pck00010.tpc", - "${SPICE}/nh_kernels/pck/nh_pcnh_002.tpc" - }; + "${SPICE}/nh_20170126/fk/nh_v220.tf", + "${SPICE}/nh_20170126/ik/nh_allinstruments_v002.ti", + "${SPICE}/nh_20170126/ik/nh_alice_v200.ti", + "${SPICE}/nh_20170126/ik/nh_lorri_v201.ti", + "${SPICE}/nh_20170126/ik/nh_pepssi_v110.ti", + "${SPICE}/nh_20170126/ik/nh_ralph_v100.ti", + "${SPICE}/nh_20170126/ik/nh_rex_v100.ti", + "${SPICE}/nh_20170126/ik/nh_sdc_v101.ti", + "${SPICE}/nh_20170126/ik/nh_swap_v100.ti", + "${SPICE}/nh_20170126/ik/nh_astr_v000.ti", + "${SPICE}/nh_20170126/ik/nh_fss_v000.ti", + "${SPICE}/nh_20170126/fk/nh_soc_misc_v001.tf", + "${SPICE}/nh_20170126/spk/nh_stars.bsp", + } else NewHorizonsKernels = { --SCLK @@ -118,12 +108,6 @@ return { Ghosting = false, }, }, - Transform = { - Scale = { - Type = "StaticScale", - Scale = 100 - } - }, }, --NewHorizonsTrail module --[[{ diff --git a/data/scene/missions/newhorizons/newhorizonsfov/newhorizonsfov.mod b/data/scene/missions/newhorizons/newhorizonsfov/newhorizonsfov.mod index 7ece77d4e9..7c2c7fd4e5 100644 --- a/data/scene/missions/newhorizons/newhorizonsfov/newhorizonsfov.mod +++ b/data/scene/missions/newhorizons/newhorizonsfov/newhorizonsfov.mod @@ -1,22 +1,21 @@ +local LorriOffset = { -6.626, -4.1, -3.23 } +local RalphOffset = { -6.9, -4.6, 8.7 } +local AliceOffset = { -7.9, -1.7, 8.3 } +local RexOffset = { 0, 0, 0 } + return { -- NewHorizonsFov main module - { + { Name = "NH_LORRI", Parent = "NewHorizonsPosition", Renderable = { Type = "RenderableFov", Body = "NEW HORIZONS", Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { + Color = { 0.8, 0.7, 0.7 }, + Instrument = { Name = "NH_LORRI", - Method = "ELLIPSOID", - Aberration = "NONE", + Aberration = "NONE" }, PotentialTargets = { "Pluto", @@ -24,281 +23,311 @@ return { "Jupiter", "Io", "Europa", "Ganymede", "Callisto" } }, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = LorriOffset + } + } }, + -- NewHorizonsFov module NH_RALPH_LEISA - { - Name = "NH_RALPH_LEISA", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableFov", - Body = "NEW HORIZONS", - Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { - Name = "NH_RALPH_LEISA", - Method = "ELLIPSOID", - Aberration = "NONE", - }, - PotentialTargets = { - "Pluto", - "Charon", - "Jupiter", "Io", "Europa", "Ganymede", "Callisto" - } +{ + Name = "NH_RALPH_LEISA", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableFov", + Body = "NEW HORIZONS", + Frame = "NH_SPACECRAFT", + RGB = { 0.8, 0.7, 0.7 }, + Instrument = { + Name = "NH_RALPH_LEISA", + Aberration = "NONE" }, + PotentialTargets = { + "Pluto", + "Charon", + "Jupiter", "Io", "Europa", "Ganymede", "Callisto" + } }, + Transform = { + Translation = { + Type = "StaticTranslation", + Position = RalphOffset + } + } +}, - -- NewHorizonsFov module NH_RALPH_MVIC_PAN1 - { - Name = "NH_RALPH_MVIC_PAN1", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableFov", - Body = "NEW HORIZONS", - Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { - Name = "NH_RALPH_MVIC_PAN1", - Method = "ELLIPSOID", - Aberration = "NONE", - }, - PotentialTargets = { - "Pluto", - "Charon", - "Jupiter", "Io", "Europa", "Ganymede", "Callisto" - } +-- NewHorizonsFov module NH_RALPH_MVIC_PAN1 +{ + Name = "NH_RALPH_MVIC_PAN1", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableFov", + Body = "NEW HORIZONS", + Frame = "NH_SPACECRAFT", + RGB = { 0.8, 0.7, 0.7 }, + Instrument = { + Name = "NH_RALPH_MVIC_PAN1", + Aberration = "NONE" }, + PotentialTargets = { + "Pluto", + "Charon", + "Jupiter", "Io", "Europa", "Ganymede", "Callisto" + } }, - -- NewHorizonsFov module NH_RALPH_MVIC_PAN2 - { - Name = "NH_RALPH_MVIC_PAN2", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableFov", - Body = "NEW HORIZONS", - Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { - Name = "NH_RALPH_MVIC_PAN2", - Method = "ELLIPSOID", - Aberration = "NONE", - }, - PotentialTargets = { - "Pluto", - "Charon", - "Jupiter", "Io", "Europa", "Ganymede", "Callisto" - } + Transform = { + Translation = { + Type = "StaticTranslation", + Position = RalphOffset + } + } +}, +-- NewHorizonsFov module NH_RALPH_MVIC_PAN2 +{ + Name = "NH_RALPH_MVIC_PAN2", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableFov", + Body = "NEW HORIZONS", + Frame = "NH_SPACECRAFT", + RGB = { 0.8, 0.7, 0.7 }, + Instrument = { + Name = "NH_RALPH_MVIC_PAN2", + Aberration = "NONE" }, + PotentialTargets = { + "Pluto", + "Charon", + "Jupiter", "Io", "Europa", "Ganymede", "Callisto" + } }, - -- NewHorizonsFov module NH_RALPH_MVIC_RED - { - Name = "NH_RALPH_MVIC_RED", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableFov", - Body = "NEW HORIZONS", - Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { - Name = "NH_RALPH_MVIC_RED", - Method = "ELLIPSOID", - Aberration = "NONE", - }, - PotentialTargets = { - "Pluto", - "Charon", - "Jupiter", "Io", "Europa", "Ganymede", "Callisto" - } + Transform = { + Translation = { + Type = "StaticTranslation", + Position = RalphOffset + } + } +}, +-- NewHorizonsFov module NH_RALPH_MVIC_RED +{ + Name = "NH_RALPH_MVIC_RED", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableFov", + Body = "NEW HORIZONS", + Frame = "NH_SPACECRAFT", + RGB = { 0.8, 0.7, 0.7 }, + Instrument = { + Name = "NH_RALPH_MVIC_RED", + Aberration = "NONE" }, + PotentialTargets = { + "Pluto", + "Charon", + "Jupiter", "Io", "Europa", "Ganymede", "Callisto" + } }, - -- NewHorizonsFov module NH_RALPH_MVIC_BLUE - { - Name = "NH_RALPH_MVIC_BLUE", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableFov", - Body = "NEW HORIZONS", - Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { - Name = "NH_RALPH_MVIC_BLUE", - Method = "ELLIPSOID", - Aberration = "NONE", - }, - PotentialTargets = { - "Pluto", - "Charon", - "Jupiter", "Io", "Europa", "Ganymede", "Callisto" - } + Transform = { + Translation = { + Type = "StaticTranslation", + Position = RalphOffset + } + } +}, + + -- NewHorizonsFov module NH_RALPH_MVIC_BLUE + { + Name = "NH_RALPH_MVIC_BLUE", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableFov", + Body = "NEW HORIZONS", + Frame = "NH_SPACECRAFT", + RGB = { 0.8, 0.7, 0.7 }, + Instrument = { + Name = "NH_RALPH_MVIC_BLUE", + Aberration = "NONE" }, + PotentialTargets = { + "Pluto", + "Charon", + "Jupiter", "Io", "Europa", "Ganymede", "Callisto" + } }, - -- NewHorizonsFov module NH_RALPH_MVIC_FT - { - Name = "NH_RALPH_MVIC_FT", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableFov", - Body = "NEW HORIZONS", - Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { - Name = "NH_RALPH_MVIC_FT", - Method = "ELLIPSOID", - Aberration = "NONE", - }, - PotentialTargets = { - "Pluto", - "Charon", - "Jupiter", "Io", "Europa", "Ganymede", "Callisto" - } + Transform = { + Translation = { + Type = "StaticTranslation", + Position = RalphOffset + } + } +}, + +-- NewHorizonsFov module NH_RALPH_MVIC_FT +{ + Name = "NH_RALPH_MVIC_FT", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableFov", + Body = "NEW HORIZONS", + Frame = "NH_SPACECRAFT", + RGB = { 0.8, 0.7, 0.7 }, + Instrument = { + Name = "NH_RALPH_MVIC_FT", + Aberration = "NONE" }, + PotentialTargets = { + "Pluto", + "Charon", + "Jupiter", "Io", "Europa", "Ganymede", "Callisto" + } }, - -- NewHorizonsFov module NH_RALPH_MVIC_METHANE - { - Name = "NH_RALPH_MVIC_METHANE", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableFov", - Body = "NEW HORIZONS", - Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { - Name = "NH_RALPH_MVIC_METHANE", - Method = "ELLIPSOID", - Aberration = "NONE", - }, - PotentialTargets = { - "Pluto", - "Charon", - "Jupiter", "Io", "Europa", "Ganymede", "Callisto" - } + Transform = { + Translation = { + Type = "StaticTranslation", + Position = RalphOffset + } + } +}, + +-- NewHorizonsFov module NH_RALPH_MVIC_METHANE +{ + Name = "NH_RALPH_MVIC_METHANE", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableFov", + Body = "NEW HORIZONS", + Frame = "NH_SPACECRAFT", + RGB = { 0.8, 0.7, 0.7 }, + Instrument = { + Name = "NH_RALPH_MVIC_METHANE", + Aberration = "NONE" }, + PotentialTargets = { + "Pluto", + "Charon", + "Jupiter", "Io", "Europa", "Ganymede", "Callisto" + } }, - -- NewHorizonsFov module NH_RALPH_MVIC_NIR - { - Name = "NH_RALPH_MVIC_NIR", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableFov", - Body = "NEW HORIZONS", - Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { - Name = "NH_RALPH_MVIC_NIR", - Method = "ELLIPSOID", - Aberration = "NONE", - }, - PotentialTargets = { - "Pluto", - "Charon", - "Jupiter", "Io", "Europa", "Ganymede", "Callisto" - } + Transform = { + Translation = { + Type = "StaticTranslation", + Position = RalphOffset + } + } +}, + +-- NewHorizonsFov module NH_RALPH_MVIC_NIR +{ + Name = "NH_RALPH_MVIC_NIR", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableFov", + Body = "NEW HORIZONS", + Frame = "NH_SPACECRAFT", + RGB = { 0.8, 0.7, 0.7 }, + Instrument = { + Name = "NH_RALPH_MVIC_NIR", + Aberration = "NONE" }, + PotentialTargets = { + "Pluto", + "Charon", + "Jupiter", "Io", "Europa", "Ganymede", "Callisto" + } }, - -- NewHorizonsFov module NH_ALICE_AIRGLOW - { - Name = "NH_ALICE_AIRGLOW", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableFov", - Body = "NEW HORIZONS", - Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { - Name = "NH_ALICE_AIRGLOW", - Method = "ELLIPSOID", - Aberration = "NONE", - }, - PotentialTargets = { - "Pluto", - "Charon", - "Jupiter", "Io", "Europa", "Ganymede", "Callisto" - } + Transform = { + Translation = { + Type = "StaticTranslation", + Position = RalphOffset + } + } +}, + +-- NewHorizonsFov module NH_ALICE_AIRGLOW +{ + Name = "NH_ALICE_AIRGLOW", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableFov", + Body = "NEW HORIZONS", + Frame = "NH_SPACECRAFT", + RGB = { 0.8, 0.7, 0.7 }, + Instrument = { + Name = "NH_ALICE_AIRGLOW", + Aberration = "NONE" }, + PotentialTargets = { + "Pluto", + "Charon", + "Jupiter", "Io", "Europa", "Ganymede", "Callisto" + } }, - -- NewHorizonsFov module NH_ALICE_SOC - { - Name = "NH_ALICE_SOC", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableFov", - Body = "NEW HORIZONS", - Frame = "NH_SPACECRAFT", - RGB = { 0.8, 0.7, 0.7 }, - Textures = { - Type = "simple", - Color = "textures/glare_blue.png", - -- need to add different texture - }, - Instrument = { - Name = "NH_ALICE_SOC", - Method = "ELLIPSOID", - Aberration = "NONE", - }, - PotentialTargets = { - "Pluto", - "Charon", - "Jupiter", "Io", "Europa", "Ganymede", "Callisto" - } + Transform = { + Translation = { + Type = "StaticTranslation", + Position = AliceOffset + } + } +}, + +-- NewHorizonsFov module NH_ALICE_SOC +{ + Name = "NH_ALICE_SOC", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableFov", + Body = "NEW HORIZONS", + Frame = "NH_SPACECRAFT", + RGB = { 0.8, 0.7, 0.7 }, + Instrument = { + Name = "NH_ALICE_SOC", + Aberration = "NONE" }, + PotentialTargets = { + "Pluto", + "Charon", + "Jupiter", "Io", "Europa", "Ganymede", "Callisto" + } }, - { - Name = "NH_REX", - Parent = "NewHorizonsPosition", - Renderable = { - Type = "RenderableCrawlingLine", - Source = "NH_REX", - Target = "EARTH", - -- Body = "NEW HORIZONS", - Frame = "GALACTIC", - Color = { 1.0, 0.7, 0.0 }, - Instrument = "NH_REX" + Transform = { + Translation = { + Type = "StaticTranslation", + Position = AliceOffset }, } -} \ No newline at end of file + }, + +-- Module NH_REX +{ + Name = "NH_REX", + Parent = "NewHorizonsPosition", + Renderable = { + Type = "RenderableCrawlingLine", + Source = "NH_REX", + Target = "EARTH", + Instrument = "NH_REX", + Color = { + Start = { 1.0, 0.7, 0.0, 1.0}, + End = {0.0, 0.0, 0.0, 0.0 } + } + }, + Transform = { + Rotation = { + Type = "StaticRotation", + Rotation = { + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + 1.0, 0.0, 0.0 + } + }, + Translation = { + Type = "StaticTranslation", + Position = RexOffset + } + } +} +} diff --git a/data/scene/missions/newhorizons/pluto/charon/charon.mod b/data/scene/missions/newhorizons/pluto/charon/charon.mod index 7cc7544f84..1813547e25 100644 --- a/data/scene/missions/newhorizons/pluto/charon/charon.mod +++ b/data/scene/missions/newhorizons/pluto/charon/charon.mod @@ -1,6 +1,9 @@ +local charon_radius = 6.035E5 + if UseAccurateNewHorizonsKernels then NewHorizonsKernels = { - "${SPICE}/nh_kernels/spk/NavSE_plu047_od122.bsp" + "${SPICE}/nh_20170126/spk/NavSE_plu047_od122.bsp", + "${SPICE}/nh_20170126/spk/NavPE_de433_od122.bsp", } else NewHorizonsKernels = { @@ -8,12 +11,12 @@ else } end -Files = { +local Files = { low = "textures/charon_highres.jpg", med = "textures/charon_highres.jpg", high = "textures/cpmap_cyl_HR_0e.jpg" } -ColorTexture = Files[TextureResolution] +local ColorTexture = Files[TextureResolution] return { -- CharonProjection module @@ -22,9 +25,10 @@ return { Parent = "PlutoBarycenter", Renderable = { Type = "RenderablePlanetProjection", + Radius = charon_radius, Geometry = { Type = "SimpleSphere", - Radius = 6.035E5, + Radius = charon_radius, Segments = 100 }, Textures = { diff --git a/data/scene/missions/newhorizons/pluto/hydra/hydra.mod b/data/scene/missions/newhorizons/pluto/hydra/hydra.mod index dbffd9a8a2..9418f4ceb4 100644 --- a/data/scene/missions/newhorizons/pluto/hydra/hydra.mod +++ b/data/scene/missions/newhorizons/pluto/hydra/hydra.mod @@ -1,6 +1,8 @@ +local charon_radius = 0.53E5 + if UseAccurateNewHorizonsKernels then NewHorizonsKernels = { - "${SPICE}/nh_kernels/spk/NavSE_plu047_od122.bsp" + "${SPICE}/nh_20170126/spk/NavSE_plu047_od122.bsp" } else NewHorizonsKernels = { @@ -17,9 +19,10 @@ return { Type = "RenderablePlanet", Frame = "IAU_PLUTO", Body = "HYDRA", + Radius = charon_radius, Geometry = { Type = "SimpleSphere", - Radius = { 0.53 , 5 }, + Radius = charon_radius, Segments = 100 }, Textures = { diff --git a/data/scene/missions/newhorizons/pluto/kerberos/kerberos.mod b/data/scene/missions/newhorizons/pluto/kerberos/kerberos.mod index 5710783747..9dab2c556f 100644 --- a/data/scene/missions/newhorizons/pluto/kerberos/kerberos.mod +++ b/data/scene/missions/newhorizons/pluto/kerberos/kerberos.mod @@ -1,6 +1,8 @@ +local kerberos_radius = 0.1E5 + if UseAccurateNewHorizonsKernels then NewHorizonsKernels = { - "${SPICE}/nh_kernels/spk/NavSE_plu047_od122.bsp" + "${SPICE}/nh_20170126/spk/NavSE_plu047_od122.bsp" } else NewHorizonsKernels = { @@ -17,9 +19,10 @@ return { Type = "RenderablePlanet", Frame = "IAU_PLUTO", Body = "KERBEROS", + Radius = kerberos_radius, Geometry = { Type = "SimpleSphere", - Radius = { 0.1 , 5 }, + Radius = kerberos_radius, Segments = 100 }, Textures = { diff --git a/data/scene/missions/newhorizons/pluto/nix/nix.mod b/data/scene/missions/newhorizons/pluto/nix/nix.mod index 8a4373431c..5ea9374cf0 100644 --- a/data/scene/missions/newhorizons/pluto/nix/nix.mod +++ b/data/scene/missions/newhorizons/pluto/nix/nix.mod @@ -1,6 +1,8 @@ +local nix_radius = 0.45E5 + if UseAccurateNewHorizonsKernels then NewHorizonsKernels = { - "${SPICE}/nh_kernels/spk/NavSE_plu047_od122.bsp" + "${SPICE}/nh_20170126/spk/NavSE_plu047_od122.bsp" } else NewHorizonsKernels = { @@ -17,9 +19,10 @@ return { Type = "RenderablePlanet", Frame = "IAU_PLUTO", Body = "NIX", + Radius = nix_radius, Geometry = { Type = "SimpleSphere", - Radius = 0.45E5, + Radius = nix_radius, Segments = 100 }, Textures = { diff --git a/data/scene/missions/newhorizons/pluto/pluto/pluto.mod b/data/scene/missions/newhorizons/pluto/pluto/pluto.mod index 6709f03fdb..4e54ff8b2a 100644 --- a/data/scene/missions/newhorizons/pluto/pluto/pluto.mod +++ b/data/scene/missions/newhorizons/pluto/pluto/pluto.mod @@ -1,7 +1,9 @@ +local pluto_radius = 1.173E6 + if UseAccurateNewHorizonsKernels then NewHorizonsKernels = { - "${SPICE}/nh_kernels/spk/NavPE_de433_od122.bsp", - "${SPICE}/nh_kernels/spk/NavSE_plu047_od122.bsp" + "${SPICE}/nh_20170126/spk/NavPE_de433_od122.bsp", + "${SPICE}/nh_20170126/spk/NavSE_plu047_od122.bsp" } else NewHorizonsKernels = { @@ -9,12 +11,12 @@ else } end -Files = { +local Files = { low = "textures/pluto_large.jpg", med = "textures/Shenk_180.jpg", high = "textures/pmap_cyl_HR_LOR_lowres.jpg" } -ColorTexture = Files[TextureResolution] +local ColorTexture = Files[TextureResolution] return { -- Pluto barycenter module @@ -36,9 +38,10 @@ return { Parent = "PlutoBarycenter", Renderable = { Type = "RenderablePlanetProjection", + Radius = pluto_radius, Geometry = { Type = "SimpleSphere", - Radius = 1.173E6, + Radius = pluto_radius, Segments = 100 }, Textures = { @@ -205,7 +208,7 @@ return { Parent = "Pluto", Renderable = { Type = "RenderablePlane", - Size = {1.0, 6.4}, + Size = 10.0^6.4, Origin = "Center", Billboard = true, ProjectionListener = false, diff --git a/data/scene/missions/newhorizons/pluto/styx/styx.mod b/data/scene/missions/newhorizons/pluto/styx/styx.mod index 8637601452..da6e1bce05 100644 --- a/data/scene/missions/newhorizons/pluto/styx/styx.mod +++ b/data/scene/missions/newhorizons/pluto/styx/styx.mod @@ -1,6 +1,8 @@ +local styx_radius = 0.75E4 + if UseAccurateNewHorizonsKernels then NewHorizonsKernels = { - "${SPICE}/nh_kernels/spk/NavSE_plu047_od122.bsp" + "${SPICE}/nh_20170126/spk/NavSE_plu047_od122.bsp" } else NewHorizonsKernels = { @@ -17,9 +19,10 @@ return { Type = "RenderablePlanet", Frame = "IAU_PLUTO", Body = "STYX", + Radius = styx_radius, Geometry = { Type = "SimpleSphere", - Radius = 0.75E4, + Radius = styx_radius, Segments = 100 }, Textures = { diff --git a/data/scene/sun/sun.data b/data/scene/sun/sun.data index 036b730b5b..9824f25df4 100644 --- a/data/scene/sun/sun.data +++ b/data/scene/sun/sun.data @@ -1,5 +1,5 @@ return { FileRequest = { - { Identifier = "sun_textures", Destination = "textures", Version = 1 } + { Identifier = "sun_textures", Destination = "textures", Version = 3 } }, } \ No newline at end of file diff --git a/ext/ghoul b/ext/ghoul index ca2a3be343..9f27e93d41 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit ca2a3be343eff2c88b77696e75fa801ae31acfe3 +Subproject commit 9f27e93d41a68eeab2f7bd1424c07ae2854fe21b diff --git a/include/openspace/documentation/documentation.h b/include/openspace/documentation/documentation.h index 5e64e3b4bc..852b8faa9b 100644 --- a/include/openspace/documentation/documentation.h +++ b/include/openspace/documentation/documentation.h @@ -34,8 +34,7 @@ namespace ghoul { class Dictionary; } -namespace openspace { -namespace documentation { +namespace openspace::documentation { using Optional = ghoul::Boolean; using Exhaustive = ghoul::Boolean; @@ -303,9 +302,7 @@ TestResult testSpecification(const Documentation& documentation, void testSpecificationAndThrow(const Documentation& documentation, const ghoul::Dictionary& dictionary, std::string component); -} // namespace documentation - -} // namespace openspace +} // namespace openspace::documentation // Make the overload for std::to_string available for the Offense::Reason for easier // error logging diff --git a/include/openspace/documentation/documentationengine.h b/include/openspace/documentation/documentationengine.h index 5ab18d9f03..9e73e9f8c5 100644 --- a/include/openspace/documentation/documentationengine.h +++ b/include/openspace/documentation/documentationengine.h @@ -31,8 +31,7 @@ #include -namespace openspace { -namespace documentation { +namespace openspace::documentation { /** * The DocumentationEngine has the ability to collect all Documentation%s that are @@ -92,8 +91,7 @@ private: static DocumentationEngine* _instance; }; -} // namespace documentation -} // namespace openspace +} // namespace openspace::documentation #define DocEng (openspace::documentation::DocumentationEngine::ref()) diff --git a/include/openspace/documentation/documentationgenerator.h b/include/openspace/documentation/documentationgenerator.h index ca91bc9eff..10c6d7ad91 100644 --- a/include/openspace/documentation/documentationgenerator.h +++ b/include/openspace/documentation/documentationgenerator.h @@ -100,6 +100,15 @@ private: const std::string _javascriptFile; }; + +/** + * This function takes a \p text and escapes all necessary characters () that JSON + * does not want in its strings. + * \param text The text that is to be escaped + * \return The same text will all required characteres escaped + */ +std::string escapedJson(const std::string& text); + } // namespace openspace #endif // __OPENSPACE_CORE___DOCUMENTATIONGENERATOR___H__ diff --git a/include/openspace/documentation/verifier.h b/include/openspace/documentation/verifier.h index ddf39e6c9a..d82681b0e7 100644 --- a/include/openspace/documentation/verifier.h +++ b/include/openspace/documentation/verifier.h @@ -32,8 +32,7 @@ #include #include -namespace openspace { -namespace documentation { +namespace openspace::documentation { /** * The base class of all Verifier%s. Each object must have an Verifier::operator() @@ -1153,8 +1152,7 @@ extern template struct DeprecatedVerifier; extern template struct DeprecatedVerifier; extern template struct DeprecatedVerifier; -} // namespace documentation -} // namespace openspace +} // namespace openspace::documentation #include "verifier.inl" diff --git a/include/openspace/documentation/verifier.inl b/include/openspace/documentation/verifier.inl index 70751ac380..eef0247b73 100644 --- a/include/openspace/documentation/verifier.inl +++ b/include/openspace/documentation/verifier.inl @@ -29,10 +29,9 @@ namespace std { std::string to_string(std::string value); -} +} // namespace std -namespace openspace { -namespace documentation { +namespace openspace::documentation { template TestResult TemplateVerifier::operator()(const ghoul::Dictionary& dict, @@ -355,5 +354,4 @@ std::string DeprecatedVerifier::documentation() const { return T::documentation() + " (deprecated)"; } -} // namespace documentation -} // namespace openspace +} // namespace openspace::documentation diff --git a/include/openspace/engine/configurationmanager.h b/include/openspace/engine/configurationmanager.h index cb8d87a35e..2f9c387251 100644 --- a/include/openspace/engine/configurationmanager.h +++ b/include/openspace/engine/configurationmanager.h @@ -1,4 +1,4 @@ -/***************************************************************************************** +/***************************************************************************************** * * * OpenSpace * * * @@ -28,6 +28,7 @@ #include namespace openspace { + namespace documentation { struct Documentation; } /** diff --git a/include/openspace/engine/logfactory.h b/include/openspace/engine/logfactory.h index 026208f33d..aca800a2cb 100644 --- a/include/openspace/engine/logfactory.h +++ b/include/openspace/engine/logfactory.h @@ -27,12 +27,8 @@ #include -namespace ghoul { - -class Dictionary; -namespace logging { class Log; } - -} // namespace ghoul +namespace ghoul { class Dictionary; } +namespace ghoul::logging { class Log; } namespace openspace { diff --git a/include/openspace/engine/moduleengine.h b/include/openspace/engine/moduleengine.h index 08a9c663c3..7c1e39392b 100644 --- a/include/openspace/engine/moduleengine.h +++ b/include/openspace/engine/moduleengine.h @@ -33,13 +33,7 @@ #include #include -namespace ghoul { -namespace systemcapabilities { - -struct Version; - -} // namespace systemcapabilities -} // namespace ghoul +namespace ghoul::systemcapabilities { struct Version; } namespace openspace { diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index df4c372ee5..f5f77fcdea 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -35,14 +35,9 @@ #include #include -namespace ghoul { - -class Dictionary; - -namespace cmdparser { class CommandlineParser; } -namespace fontrendering { class FontManager; } - -} // namespace ghoul +namespace ghoul { class Dictionary; } +namespace ghoul::cmdparser { class CommandlineParser; } +namespace ghoul::fontrendering { class FontManager; } namespace openspace { diff --git a/include/openspace/interaction/controller.h b/include/openspace/interaction/controller.h index baa63c12a3..41076f09b1 100644 --- a/include/openspace/interaction/controller.h +++ b/include/openspace/interaction/controller.h @@ -30,8 +30,7 @@ #include #include -namespace openspace { -namespace interaction { +namespace openspace::interaction { class NavigationHandler; @@ -47,7 +46,6 @@ protected: NavigationHandler* _handler; }; -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction #endif // __OPENSPACE_CORE___CONTROLLER___H__ diff --git a/include/openspace/interaction/delayedvariable.h b/include/openspace/interaction/delayedvariable.h index ad8b7e039e..6110094300 100644 --- a/include/openspace/interaction/delayedvariable.h +++ b/include/openspace/interaction/delayedvariable.h @@ -25,8 +25,7 @@ #ifndef __OPENSPACE_CORE___DELAYEDVARIABLE___H__ #define __OPENSPACE_CORE___DELAYEDVARIABLE___H__ -namespace openspace { -namespace interaction { +namespace openspace::interaction { /** * Class that acts as a smoothing filter to a variable. The filter has a step @@ -51,8 +50,7 @@ private: T _currentValue; }; -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction #include "delayedvariable.inl" diff --git a/include/openspace/interaction/delayedvariable.inl b/include/openspace/interaction/delayedvariable.inl index 03e8137f13..b6dfeaa336 100644 --- a/include/openspace/interaction/delayedvariable.inl +++ b/include/openspace/interaction/delayedvariable.inl @@ -25,8 +25,7 @@ #include #include -namespace openspace { -namespace interaction { +namespace openspace::interaction { template DelayedVariable::DelayedVariable(ScaleType scaleFactor, ScaleType friction) @@ -72,5 +71,4 @@ T DelayedVariable::get() const { return _currentValue; } -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction diff --git a/include/openspace/interaction/inputstate.h b/include/openspace/interaction/inputstate.h index 250a51743a..4295d4d0dc 100644 --- a/include/openspace/interaction/inputstate.h +++ b/include/openspace/interaction/inputstate.h @@ -28,12 +28,11 @@ #include #include -#include +#include #include -namespace openspace { -namespace interaction { +namespace openspace::interaction { class InputState { public: @@ -64,7 +63,6 @@ private: double _mouseScrollDelta; }; -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction #endif // __OPENSPACE_CORE___INPUTSTATE___H__ diff --git a/include/openspace/interaction/interpolator.h b/include/openspace/interaction/interpolator.h index cf4bafb25d..625b9f2b0d 100644 --- a/include/openspace/interaction/interpolator.h +++ b/include/openspace/interaction/interpolator.h @@ -27,8 +27,7 @@ #include -namespace openspace { -namespace interaction { +namespace openspace::interaction { /* * Interpolates a typename T using a transfer function. @@ -44,7 +43,7 @@ public: void setDeltaTime(float deltaTime); void setTransferFunction(std::function transferFunction); void setInterpolationTime(float interpolationTime); - void step(); + void step(); float deltaTimeScaled() const; T value() const; @@ -57,8 +56,7 @@ private: float _scaledDeltaTime; }; -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction #include "interpolator.inl" diff --git a/include/openspace/interaction/interpolator.inl b/include/openspace/interaction/interpolator.inl index c9ad0ed612..e1a0b324c1 100644 --- a/include/openspace/interaction/interpolator.inl +++ b/include/openspace/interaction/interpolator.inl @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace interaction { +namespace openspace::interaction { template Interpolator::Interpolator() @@ -81,5 +80,4 @@ bool Interpolator::isInterpolating() const { return _t < 1.0 && _t >= 0.0; } -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction diff --git a/include/openspace/interaction/keybindingmanager.h b/include/openspace/interaction/keybindingmanager.h index 2d4432f06f..6d64273d92 100644 --- a/include/openspace/interaction/keybindingmanager.h +++ b/include/openspace/interaction/keybindingmanager.h @@ -32,14 +32,13 @@ #include namespace openspace { + class Camera; + class SceneGraphNode; +} // namespace -class Camera; -class SceneGraphNode; +namespace openspace::interaction { -namespace interaction { - -class KeyBindingManager : public DocumentationGenerator -{ +class KeyBindingManager : public DocumentationGenerator { public: KeyBindingManager(); ~KeyBindingManager() = default; @@ -81,7 +80,6 @@ private: std::multimap _keyLua; }; -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction #endif // __OPENSPACE_CORE___KEYBINDINGMANAGER___H__ diff --git a/include/openspace/interaction/keyframenavigator.h b/include/openspace/interaction/keyframenavigator.h index 511e2ae3df..7aa679f626 100644 --- a/include/openspace/interaction/keyframenavigator.h +++ b/include/openspace/interaction/keyframenavigator.h @@ -28,17 +28,14 @@ #include #include -#include +#include #include -namespace openspace { +namespace openspace { class Camera; } -class Camera; +namespace openspace::interaction { -namespace interaction { - -class KeyframeNavigator -{ +class KeyframeNavigator { public: struct CameraPose { glm::dvec3 position; @@ -63,7 +60,6 @@ private: Timeline _cameraPoseTimeline; }; -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction #endif // __OPENSPACE_CORE___KEYFRAMENAVIGATOR___H__ diff --git a/include/openspace/interaction/luaconsole.h b/include/openspace/interaction/luaconsole.h index de5da697ef..bbc32acc14 100644 --- a/include/openspace/interaction/luaconsole.h +++ b/include/openspace/interaction/luaconsole.h @@ -35,11 +35,7 @@ #include #include -namespace ghoul { -namespace opengl { - class ProgramObject; -} // namespace opengl -} // namespace ghoul +namespace ghoul::opengl { class ProgramObject; } namespace openspace { diff --git a/include/openspace/interaction/mousestate.h b/include/openspace/interaction/mousestate.h index c6db1380a7..40b619f036 100644 --- a/include/openspace/interaction/mousestate.h +++ b/include/openspace/interaction/mousestate.h @@ -28,10 +28,9 @@ #include #include -#include +#include -namespace openspace { -namespace interaction { +namespace openspace::interaction { struct MouseState { MouseState(double scaleFactor); @@ -42,14 +41,13 @@ struct MouseState { DelayedVariable velocity; }; -class MouseStates -{ +class MouseStates { public: /** - \param sensitivity - \param velocityScaleFactor can be set to 60 to remove the inertia of the - interaction. Lower value will make it harder to move the camera. - */ + * \param sensitivity + * \param velocityScaleFactor can be set to 60 to remove the inertia of the + * interaction. Lower value will make it harder to move the camera. + */ MouseStates(double sensitivity, double velocityScaleFactor); void updateMouseStatesFromInput(const InputState& inputState, double deltaTime); void setRotationalFriction(double friction); @@ -74,7 +72,6 @@ private: MouseState _globalRollMouseState; }; -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction #endif // __OPENSPACE_CORE___MOUSESTATE___H__ diff --git a/include/openspace/interaction/navigationhandler.h b/include/openspace/interaction/navigationhandler.h index 2d0c930d4a..03aad77069 100644 --- a/include/openspace/interaction/navigationhandler.h +++ b/include/openspace/interaction/navigationhandler.h @@ -38,11 +38,11 @@ #include namespace openspace { + class Camera; + class SceneGraphNode; +} // namespace openspace -class Camera; -class SceneGraphNode; - -namespace interaction { +namespace openspace::interaction { class NavigationHandler : public properties::PropertyOwner { public: @@ -85,6 +85,7 @@ public: * interaction */ static scripting::LuaLibrary luaLibrary(); + private: bool _cameraUpdatedFromScript = false; @@ -99,7 +100,6 @@ private: properties::BoolProperty _useKeyFrameInteraction; }; -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction #endif // __OPENSPACE_CORE___NAVIGATIONHANDLER___H__ diff --git a/include/openspace/interaction/orbitalnavigator.h b/include/openspace/interaction/orbitalnavigator.h index bdd97f39ba..92832f214f 100644 --- a/include/openspace/interaction/orbitalnavigator.h +++ b/include/openspace/interaction/orbitalnavigator.h @@ -34,16 +34,16 @@ #include #include -#include +#include #include namespace openspace { + class SceneGraphNode; + class Camera; + struct SurfacePositionHandle; +} // namespace -class SceneGraphNode; -class Camera; -class SurfacePositionHandle; - -namespace interaction { +namespace openspace::interaction { class OrbitalNavigator : public properties::PropertyOwner { public: @@ -191,7 +191,6 @@ private: const glm::dvec3 cameraPositionWorldSpace); }; -} // namespace interaction -} // namespace openspace +} // namespace openspace::interaction #endif // __OPENSPACE_CORE___ORBITALNAVIGATOR___H__ diff --git a/include/openspace/mission/mission.h b/include/openspace/mission/mission.h index b5dfe70f50..03e19d1ff6 100644 --- a/include/openspace/mission/mission.h +++ b/include/openspace/mission/mission.h @@ -34,6 +34,7 @@ namespace ghoul { class Dictionary; } namespace openspace { + namespace documentation { struct Documentation; } /** diff --git a/include/openspace/network/messagestructures.h b/include/openspace/network/messagestructures.h index b3943d7fed..6104ce1abd 100644 --- a/include/openspace/network/messagestructures.h +++ b/include/openspace/network/messagestructures.h @@ -25,18 +25,14 @@ #ifndef __OPENSPACE_CORE___MESSAGESTRUCTURES___H__ #define __OPENSPACE_CORE___MESSAGESTRUCTURES___H__ -//std includes #include #include -//glm includes #include -//openspace includes #include -namespace openspace{ -namespace datamessagestructures { +namespace openspace::datamessagestructures { enum class Type : uint32_t { CameraData = 0, TimeData, @@ -187,7 +183,6 @@ struct ScriptMessage { }; }; -} //namespace messagestructures -} // namespace openspace +} // namespace openspace::messagestructures #endif // __OPENSPACE_CORE___MESSAGESTRUCTURES___H__ diff --git a/include/openspace/network/parallelconnection.h b/include/openspace/network/parallelconnection.h index f14c871599..14b58f9579 100644 --- a/include/openspace/network/parallelconnection.h +++ b/include/openspace/network/parallelconnection.h @@ -25,20 +25,16 @@ #ifndef __OPENSPACE_CORE___PARALLELCONNECTION___H__ #define __OPENSPACE_CORE___PARALLELCONNECTION___H__ -//openspace includes #include #include #include #include #include -//glm includes #include -//ghoul includes #include -//std includes #include #include #include @@ -48,8 +44,6 @@ #include #include - - #if defined(WIN32) || defined(__MING32__) || defined(__MING64__) typedef size_t _SOCKET; #else diff --git a/include/openspace/performance/performancelayout.h b/include/openspace/performance/performancelayout.h index de9f5a450f..8210f553a4 100644 --- a/include/openspace/performance/performancelayout.h +++ b/include/openspace/performance/performancelayout.h @@ -27,8 +27,7 @@ #include -namespace openspace { -namespace performance { +namespace openspace::performance { struct PerformanceLayout { static const int8_t Version = 0; @@ -57,7 +56,6 @@ struct PerformanceLayout { int16_t nFunctionEntries; }; -} // namespace performance -} // namespace openspace +} // namespace openspace::performance #endif // __OPENSPACE_CORE___PERFORMANCELAYOUT___H__ diff --git a/include/openspace/performance/performancemanager.h b/include/openspace/performance/performancemanager.h index 21e7c64b27..ddc85bdce0 100644 --- a/include/openspace/performance/performancemanager.h +++ b/include/openspace/performance/performancemanager.h @@ -33,15 +33,11 @@ #include #include -namespace ghoul { - class SharedMemory; -} +namespace ghoul { class SharedMemory; } -namespace openspace { +namespace openspace { class SceneGraphNode; } -class SceneGraphNode; - -namespace performance { +namespace openspace::performance { class PerformanceManager { public: @@ -95,7 +91,6 @@ private: bool createLogDir(); }; -} // namespace performance -} // namespace openspace +} // namespace openspace::performance #endif // __OPENSPACE_CORE___PERFORMANCEMANAGER___H__ diff --git a/include/openspace/performance/performancemeasurement.h b/include/openspace/performance/performancemeasurement.h index c820f81230..58d90650e2 100644 --- a/include/openspace/performance/performancemeasurement.h +++ b/include/openspace/performance/performancemeasurement.h @@ -31,8 +31,7 @@ #include #include -namespace openspace { -namespace performance { +namespace openspace::performance { class PerformanceManager; @@ -59,7 +58,6 @@ private: OsEng.renderEngine().performanceManager() \ ) -} // namespace performance -} // namespace openspace +} // namespace openspace::performance #endif // __OPENSPACE_CORE___PERFORMANCEMEASUREMENT___H__ diff --git a/include/openspace/properties/matrix/dmat2property.h b/include/openspace/properties/matrix/dmat2property.h index 978090b4a3..28e4f575d5 100644 --- a/include/openspace/properties/matrix/dmat2property.h +++ b/include/openspace/properties/matrix/dmat2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DMat2Property, glm::dmat2x2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DMAT2PROPERTY___H__ diff --git a/include/openspace/properties/matrix/dmat2x3property.h b/include/openspace/properties/matrix/dmat2x3property.h index 69603e57c4..615958219a 100644 --- a/include/openspace/properties/matrix/dmat2x3property.h +++ b/include/openspace/properties/matrix/dmat2x3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DMat2x3Property, glm::dmat2x3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DMAT2X3PROPERTY___H__ diff --git a/include/openspace/properties/matrix/dmat2x4property.h b/include/openspace/properties/matrix/dmat2x4property.h index 3300ec67d7..793e78edf3 100644 --- a/include/openspace/properties/matrix/dmat2x4property.h +++ b/include/openspace/properties/matrix/dmat2x4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DMat2x4Property, glm::dmat2x4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DMAT2X4PROPERTY___H__ diff --git a/include/openspace/properties/matrix/dmat3property.h b/include/openspace/properties/matrix/dmat3property.h index 4052005316..56100acab5 100644 --- a/include/openspace/properties/matrix/dmat3property.h +++ b/include/openspace/properties/matrix/dmat3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DMat3Property, glm::dmat3x3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DMAT3PROPERTY___H__ diff --git a/include/openspace/properties/matrix/dmat3x2property.h b/include/openspace/properties/matrix/dmat3x2property.h index 15a01d557a..799c56fc0b 100644 --- a/include/openspace/properties/matrix/dmat3x2property.h +++ b/include/openspace/properties/matrix/dmat3x2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DMat3x2Property, glm::dmat3x2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DMAT3X2PROPERTY___H__ diff --git a/include/openspace/properties/matrix/dmat3x4property.h b/include/openspace/properties/matrix/dmat3x4property.h index ba460f5714..118645dbc0 100644 --- a/include/openspace/properties/matrix/dmat3x4property.h +++ b/include/openspace/properties/matrix/dmat3x4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DMat3x4Property, glm::dmat3x4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DMAT3X4PROPERTY___H__ diff --git a/include/openspace/properties/matrix/dmat4property.h b/include/openspace/properties/matrix/dmat4property.h index 3124aa57d8..1e309587e0 100644 --- a/include/openspace/properties/matrix/dmat4property.h +++ b/include/openspace/properties/matrix/dmat4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DMat4Property, glm::dmat4x4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DMAT4PROPERTY___H__ diff --git a/include/openspace/properties/matrix/dmat4x2property.h b/include/openspace/properties/matrix/dmat4x2property.h index 1d0e1bfc94..f944f7bc60 100644 --- a/include/openspace/properties/matrix/dmat4x2property.h +++ b/include/openspace/properties/matrix/dmat4x2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DMat4x2Property, glm::dmat4x2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DMAT4X2PROPERTY___H__ diff --git a/include/openspace/properties/matrix/dmat4x3property.h b/include/openspace/properties/matrix/dmat4x3property.h index 0843a3c944..54fa7e9eb3 100644 --- a/include/openspace/properties/matrix/dmat4x3property.h +++ b/include/openspace/properties/matrix/dmat4x3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DMat4x3Property, glm::dmat4x3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DMAT4X3PROPERTY___H__ diff --git a/include/openspace/properties/matrix/mat2property.h b/include/openspace/properties/matrix/mat2property.h index 8b48a60c3a..c691616f50 100644 --- a/include/openspace/properties/matrix/mat2property.h +++ b/include/openspace/properties/matrix/mat2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Mat2Property, glm::mat2x2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___MAT2PROPERTY___H__ diff --git a/include/openspace/properties/matrix/mat2x3property.h b/include/openspace/properties/matrix/mat2x3property.h index 406834f057..ca318af60c 100644 --- a/include/openspace/properties/matrix/mat2x3property.h +++ b/include/openspace/properties/matrix/mat2x3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Mat2x3Property, glm::mat2x3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___MAT2X3PROPERTY___H__ diff --git a/include/openspace/properties/matrix/mat2x4property.h b/include/openspace/properties/matrix/mat2x4property.h index a678da4051..e5eb8e0a8e 100644 --- a/include/openspace/properties/matrix/mat2x4property.h +++ b/include/openspace/properties/matrix/mat2x4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Mat2x4Property, glm::mat2x4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___MAT2X4PROPERTY___H__ diff --git a/include/openspace/properties/matrix/mat3property.h b/include/openspace/properties/matrix/mat3property.h index 8c428fce4f..419846f9d4 100644 --- a/include/openspace/properties/matrix/mat3property.h +++ b/include/openspace/properties/matrix/mat3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Mat3Property, glm::mat3x3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___MAT3PROPERTY___H__ diff --git a/include/openspace/properties/matrix/mat3x2property.h b/include/openspace/properties/matrix/mat3x2property.h index bfc5e2ef58..2753bb5962 100644 --- a/include/openspace/properties/matrix/mat3x2property.h +++ b/include/openspace/properties/matrix/mat3x2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Mat3x2Property, glm::mat3x2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___MAT3X2PROPERTY___H__ diff --git a/include/openspace/properties/matrix/mat3x4property.h b/include/openspace/properties/matrix/mat3x4property.h index 8f87c3ca52..cb1a6156b9 100644 --- a/include/openspace/properties/matrix/mat3x4property.h +++ b/include/openspace/properties/matrix/mat3x4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Mat3x4Property, glm::mat3x4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___MAT3X4PROPERTY___H__ diff --git a/include/openspace/properties/matrix/mat4property.h b/include/openspace/properties/matrix/mat4property.h index da2175ec20..bff8de9669 100644 --- a/include/openspace/properties/matrix/mat4property.h +++ b/include/openspace/properties/matrix/mat4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Mat4Property, glm::mat4x4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___MAT4PROPERTY___H__ diff --git a/include/openspace/properties/matrix/mat4x2property.h b/include/openspace/properties/matrix/mat4x2property.h index e57ecdaaee..b5b38b92fb 100644 --- a/include/openspace/properties/matrix/mat4x2property.h +++ b/include/openspace/properties/matrix/mat4x2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Mat4x2Property, glm::mat4x2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___MAT4X2PROPERTY___H__ diff --git a/include/openspace/properties/matrix/mat4x3property.h b/include/openspace/properties/matrix/mat4x3property.h index cd8931479b..9c01ccf656 100644 --- a/include/openspace/properties/matrix/mat4x3property.h +++ b/include/openspace/properties/matrix/mat4x3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Mat4x3Property, glm::mat4x3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___MAT4X3PROPERTY___H__ diff --git a/include/openspace/properties/numericalproperty.h b/include/openspace/properties/numericalproperty.h index 77ee822063..45633abb89 100644 --- a/include/openspace/properties/numericalproperty.h +++ b/include/openspace/properties/numericalproperty.h @@ -27,8 +27,7 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { template class NumericalProperty : public TemplateProperty { @@ -73,8 +72,7 @@ protected: T _stepping; }; -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #include "openspace/properties/numericalproperty.inl" diff --git a/include/openspace/properties/numericalproperty.inl b/include/openspace/properties/numericalproperty.inl index e7d46cf07e..0263286b8c 100644 --- a/include/openspace/properties/numericalproperty.inl +++ b/include/openspace/properties/numericalproperty.inl @@ -24,8 +24,7 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { #define REGISTER_NUMERICALPROPERTY_HEADER(CLASS_NAME, TYPE) \ typedef NumericalProperty CLASS_NAME; \ @@ -361,5 +360,4 @@ std::string NumericalProperty::generateAdditionalDescription() const { return result; } -} // namespace properties -} // namespace openspace +} // namespace openspace::properties diff --git a/include/openspace/properties/optionproperty.h b/include/openspace/properties/optionproperty.h index 60d2fdc12f..c5a292f665 100644 --- a/include/openspace/properties/optionproperty.h +++ b/include/openspace/properties/optionproperty.h @@ -29,8 +29,7 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { /** * The OptionProperty is a property that provides a number of predefined (using the @@ -131,7 +130,6 @@ private: DisplayType _displayType; }; -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___OPTIONPROPERTY___H__ diff --git a/include/openspace/properties/property.h b/include/openspace/properties/property.h index 80b446b5a3..eb5ecc3b52 100644 --- a/include/openspace/properties/property.h +++ b/include/openspace/properties/property.h @@ -28,13 +28,13 @@ #include #include + #include #include struct lua_State; -namespace openspace { -namespace properties { +namespace openspace::properties { class PropertyOwner; @@ -417,7 +417,6 @@ private: OnChangeHandle _currentHandleValue; }; -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___PROPERTY___H__ diff --git a/include/openspace/properties/propertydelegate.h b/include/openspace/properties/propertydelegate.h index 9611d8f1f4..ac087745d1 100644 --- a/include/openspace/properties/propertydelegate.h +++ b/include/openspace/properties/propertydelegate.h @@ -29,8 +29,7 @@ struct lua_State; -namespace openspace { -namespace properties { +namespace openspace::properties { /** * The PropertyDelegate class is used by (among others) the TemplateProperty and the @@ -158,8 +157,7 @@ public: static bool toString(std::string& outValue, U inValue); }; -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #include diff --git a/include/openspace/properties/propertydelegate.inl b/include/openspace/properties/propertydelegate.inl index 36ac0ed6ea..de258decba 100644 --- a/include/openspace/properties/propertydelegate.inl +++ b/include/openspace/properties/propertydelegate.inl @@ -24,8 +24,7 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { template std::string PropertyDelegate::className() { @@ -95,5 +94,4 @@ U PropertyDelegate::fromString(std::string value, bool& success) { "Unimplemented PropertyDelegate::fromString specialization"); } -} // namespace properties -} // namespace openspace +} // namespace openspace::properties diff --git a/include/openspace/properties/propertyowner.h b/include/openspace/properties/propertyowner.h index 4fdec7bb12..693b7df1e6 100644 --- a/include/openspace/properties/propertyowner.h +++ b/include/openspace/properties/propertyowner.h @@ -29,8 +29,7 @@ #include #include -namespace openspace { -namespace properties { +namespace openspace::properties { class Property; @@ -236,7 +235,6 @@ private: std::vector _tags; }; -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___PROPERTYOWNER___H__ diff --git a/include/openspace/properties/scalar/boolproperty.h b/include/openspace/properties/scalar/boolproperty.h index 35ead669c1..c5f4f53ee6 100644 --- a/include/openspace/properties/scalar/boolproperty.h +++ b/include/openspace/properties/scalar/boolproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_TEMPLATEPROPERTY_HEADER(BoolProperty, bool); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___BOOLPROPERTY___H__ diff --git a/include/openspace/properties/scalar/charproperty.h b/include/openspace/properties/scalar/charproperty.h index c8a2c9910e..75e06ad974 100644 --- a/include/openspace/properties/scalar/charproperty.h +++ b/include/openspace/properties/scalar/charproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(CharProperty, char); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___CHARPROPERTY___H__ diff --git a/include/openspace/properties/scalar/doubleproperty.h b/include/openspace/properties/scalar/doubleproperty.h index 27401c7422..2aeb2c8cad 100644 --- a/include/openspace/properties/scalar/doubleproperty.h +++ b/include/openspace/properties/scalar/doubleproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DoubleProperty, double); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DOUBLEPROPERTY___H__ diff --git a/include/openspace/properties/scalar/floatproperty.h b/include/openspace/properties/scalar/floatproperty.h index fc780787a4..249e598a43 100644 --- a/include/openspace/properties/scalar/floatproperty.h +++ b/include/openspace/properties/scalar/floatproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(FloatProperty, float); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___FLOATPROPERTY___H__ diff --git a/include/openspace/properties/scalar/intproperty.h b/include/openspace/properties/scalar/intproperty.h index 4c55848994..7472e2d2f3 100644 --- a/include/openspace/properties/scalar/intproperty.h +++ b/include/openspace/properties/scalar/intproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(IntProperty, int); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___INTPROPERTY___H__ diff --git a/include/openspace/properties/scalar/longdoubleproperty.h b/include/openspace/properties/scalar/longdoubleproperty.h index 47db702438..46fa894f3c 100644 --- a/include/openspace/properties/scalar/longdoubleproperty.h +++ b/include/openspace/properties/scalar/longdoubleproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(LongDoubleProperty, long double); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___LONGDOUBLEPROPERTY___H__ diff --git a/include/openspace/properties/scalar/longlongproperty.h b/include/openspace/properties/scalar/longlongproperty.h index b95de8c278..6433510761 100644 --- a/include/openspace/properties/scalar/longlongproperty.h +++ b/include/openspace/properties/scalar/longlongproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(LongLongProperty, long long); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___LONGLONGPROPERTY___H__ diff --git a/include/openspace/properties/scalar/longproperty.h b/include/openspace/properties/scalar/longproperty.h index 5b09507df9..e59777fb0b 100644 --- a/include/openspace/properties/scalar/longproperty.h +++ b/include/openspace/properties/scalar/longproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(LongProperty, long); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___LONGPROPERTY___H__ diff --git a/include/openspace/properties/scalar/shortproperty.h b/include/openspace/properties/scalar/shortproperty.h index 7a2dd2c6a5..7549578b1b 100644 --- a/include/openspace/properties/scalar/shortproperty.h +++ b/include/openspace/properties/scalar/shortproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(ShortProperty, short); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___SHORTPROPERTY___H__ diff --git a/include/openspace/properties/scalar/signedcharproperty.h b/include/openspace/properties/scalar/signedcharproperty.h index d808e1bb4d..21ebd59f6d 100644 --- a/include/openspace/properties/scalar/signedcharproperty.h +++ b/include/openspace/properties/scalar/signedcharproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(SignedCharProperty, signed char); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___SIGNEDCHARPROPERTY___H__ diff --git a/include/openspace/properties/scalar/ucharproperty.h b/include/openspace/properties/scalar/ucharproperty.h index 8460a72710..622fcaa31e 100644 --- a/include/openspace/properties/scalar/ucharproperty.h +++ b/include/openspace/properties/scalar/ucharproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(UCharProperty, unsigned char); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___UCHARPROPERTY___H__ diff --git a/include/openspace/properties/scalar/uintproperty.h b/include/openspace/properties/scalar/uintproperty.h index 53c11668a0..a7188563aa 100644 --- a/include/openspace/properties/scalar/uintproperty.h +++ b/include/openspace/properties/scalar/uintproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(UIntProperty, unsigned int); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___UINTPROPERTY___H__ diff --git a/include/openspace/properties/scalar/ulonglongproperty.h b/include/openspace/properties/scalar/ulonglongproperty.h index 7e57f0c28a..b3aa684b08 100644 --- a/include/openspace/properties/scalar/ulonglongproperty.h +++ b/include/openspace/properties/scalar/ulonglongproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(ULongLongProperty, unsigned long long); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___ULONGLONGPROPERTY___H__ diff --git a/include/openspace/properties/scalar/ulongproperty.h b/include/openspace/properties/scalar/ulongproperty.h index 8be77cc026..a13add2543 100644 --- a/include/openspace/properties/scalar/ulongproperty.h +++ b/include/openspace/properties/scalar/ulongproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(ULongProperty, unsigned long); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___ULONGPROPERTY___H__ diff --git a/include/openspace/properties/scalar/ushortproperty.h b/include/openspace/properties/scalar/ushortproperty.h index 890ca2b881..2bd9fa7fd6 100644 --- a/include/openspace/properties/scalar/ushortproperty.h +++ b/include/openspace/properties/scalar/ushortproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(UShortProperty, unsigned short); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___USHORTPROPERTY___H__ diff --git a/include/openspace/properties/scalar/wcharproperty.h b/include/openspace/properties/scalar/wcharproperty.h index 07f10d03cb..cb840ff570 100644 --- a/include/openspace/properties/scalar/wcharproperty.h +++ b/include/openspace/properties/scalar/wcharproperty.h @@ -42,12 +42,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { //REGISTER_NUMERICALPROPERTY_HEADER(WCharProperty, wchar_t); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___WCHARPROPERTY___H__ diff --git a/include/openspace/properties/selectionproperty.h b/include/openspace/properties/selectionproperty.h index 672659ebdb..1a7d58ed73 100644 --- a/include/openspace/properties/selectionproperty.h +++ b/include/openspace/properties/selectionproperty.h @@ -29,8 +29,7 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { class SelectionProperty : public TemplateProperty> { public: @@ -77,7 +76,6 @@ template <> template <> bool PropertyDelegate>>::toString(std::string& outValue, std::vector inValue); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___SELECTIONPROPERTY___H__ diff --git a/include/openspace/properties/stringproperty.h b/include/openspace/properties/stringproperty.h index 43b7761722..432e488d3c 100644 --- a/include/openspace/properties/stringproperty.h +++ b/include/openspace/properties/stringproperty.h @@ -27,12 +27,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_TEMPLATEPROPERTY_HEADER(StringProperty, std::string); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___STRINGPROPERTY___H__ diff --git a/include/openspace/properties/templateproperty.h b/include/openspace/properties/templateproperty.h index feddc84167..4eea529a0d 100644 --- a/include/openspace/properties/templateproperty.h +++ b/include/openspace/properties/templateproperty.h @@ -27,8 +27,7 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { /** * This concrete subclass of Property handles a single parameter value that is of type @@ -91,7 +90,7 @@ public: virtual ghoul::any get() const override; /** - * Sets the value fro the provided ghoul::any object. If the types between + * Sets the value from the provided ghoul::any object. If the types between * T and value disagree, an error is logged and the stored * value remains unchanged. */ @@ -186,8 +185,7 @@ protected: T _value; }; -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #include "openspace/properties/templateproperty.inl" diff --git a/include/openspace/properties/templateproperty.inl b/include/openspace/properties/templateproperty.inl index 7e4c2b790e..3f6201736d 100644 --- a/include/openspace/properties/templateproperty.inl +++ b/include/openspace/properties/templateproperty.inl @@ -24,8 +24,7 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { // The following macros can be used to quickly generate the necessary PropertyDelegate // specializations required by the TemplateProperty class. Use the @@ -240,16 +239,23 @@ const std::type_info& TemplateProperty::type() const { template bool TemplateProperty::getLuaValue(lua_State* state) const { - bool success = PropertyDelegate>::template toLuaValue(state, _value); + bool success = PropertyDelegate>::template toLuaValue( + state, + _value + ); return success; } template bool TemplateProperty::setLuaValue(lua_State* state) { bool success = false; - T thisValue = PropertyDelegate>::template fromLuaValue(state, success); - if (success) + T thisValue = PropertyDelegate>::template fromLuaValue( + state, + success + ); + if (success) { set(ghoul::any(thisValue)); + } return success; } @@ -260,18 +266,24 @@ int TemplateProperty::typeLua() const { template bool TemplateProperty::getStringValue(std::string& value) const { - bool success = PropertyDelegate>::template toString(value, _value); + bool success = PropertyDelegate>::template toString( + value, + _value + ); return success; } template bool TemplateProperty::setStringValue(std::string value) { bool success = false; - T thisValue = PropertyDelegate>::template fromString(value, success); - if (success) + T thisValue = PropertyDelegate>::template fromString( + value, + success + ); + if (success) { set(ghoul::any(thisValue)); + } return success; } -} // namespace properties -} // namespace openspace +} // namespace openspace::properties diff --git a/include/openspace/properties/triggerproperty.h b/include/openspace/properties/triggerproperty.h index 47afb82b25..0040949cad 100644 --- a/include/openspace/properties/triggerproperty.h +++ b/include/openspace/properties/triggerproperty.h @@ -27,8 +27,7 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { /** * TriggerProperty that can be used to fire events into your code using the callback @@ -67,7 +66,6 @@ public: void set(ghoul::any value); }; -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___TRIGGERPROPERTY___H__ diff --git a/include/openspace/properties/vector/bvec2property.h b/include/openspace/properties/vector/bvec2property.h index 5f5164ea2f..7418ef3edf 100644 --- a/include/openspace/properties/vector/bvec2property.h +++ b/include/openspace/properties/vector/bvec2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_TEMPLATEPROPERTY_HEADER(BVec2Property, glm::bvec2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___BVEC2PROPERTY___H__ diff --git a/include/openspace/properties/vector/bvec3property.h b/include/openspace/properties/vector/bvec3property.h index f50fccbfb0..cb9b94a5df 100644 --- a/include/openspace/properties/vector/bvec3property.h +++ b/include/openspace/properties/vector/bvec3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_TEMPLATEPROPERTY_HEADER(BVec3Property, glm::bvec3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___BVEC3PROPERTY___H__ diff --git a/include/openspace/properties/vector/bvec4property.h b/include/openspace/properties/vector/bvec4property.h index 0bd80ad32f..16e4d14401 100644 --- a/include/openspace/properties/vector/bvec4property.h +++ b/include/openspace/properties/vector/bvec4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_TEMPLATEPROPERTY_HEADER(BVec4Property, glm::bvec4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___BVEC4PROPERTY___H__ diff --git a/include/openspace/properties/vector/dvec2property.h b/include/openspace/properties/vector/dvec2property.h index 84cd253505..9f926355d8 100644 --- a/include/openspace/properties/vector/dvec2property.h +++ b/include/openspace/properties/vector/dvec2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DVec2Property, glm::dvec2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DVEC2PROPERTY___H__ diff --git a/include/openspace/properties/vector/dvec3property.h b/include/openspace/properties/vector/dvec3property.h index 63a057d8fb..17a0451878 100644 --- a/include/openspace/properties/vector/dvec3property.h +++ b/include/openspace/properties/vector/dvec3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DVec3Property, glm::dvec3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DVEC3PROPERTY___H__ diff --git a/include/openspace/properties/vector/dvec4property.h b/include/openspace/properties/vector/dvec4property.h index 6fbd0b337d..7671b0cbe3 100644 --- a/include/openspace/properties/vector/dvec4property.h +++ b/include/openspace/properties/vector/dvec4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(DVec4Property, glm::dvec4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___DVEC4PROPERTY___H__ diff --git a/include/openspace/properties/vector/ivec2property.h b/include/openspace/properties/vector/ivec2property.h index e9c986dfc7..73d60dc2b3 100644 --- a/include/openspace/properties/vector/ivec2property.h +++ b/include/openspace/properties/vector/ivec2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(IVec2Property, glm::ivec2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___IVEC2PROPERTY___H__ diff --git a/include/openspace/properties/vector/ivec3property.h b/include/openspace/properties/vector/ivec3property.h index d6242dd434..45a1d8d8b9 100644 --- a/include/openspace/properties/vector/ivec3property.h +++ b/include/openspace/properties/vector/ivec3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(IVec3Property, glm::ivec3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___IVEC3PROPERTY___H__ diff --git a/include/openspace/properties/vector/ivec4property.h b/include/openspace/properties/vector/ivec4property.h index 8d234e7f5c..114da0c47f 100644 --- a/include/openspace/properties/vector/ivec4property.h +++ b/include/openspace/properties/vector/ivec4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(IVec4Property, glm::ivec4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___IVEC4PROPERTY___H__ diff --git a/include/openspace/properties/vector/uvec2property.h b/include/openspace/properties/vector/uvec2property.h index fd0cad517b..aba6cf11f7 100644 --- a/include/openspace/properties/vector/uvec2property.h +++ b/include/openspace/properties/vector/uvec2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(UVec2Property, glm::uvec2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___UVEC2PROPERTY___H__ diff --git a/include/openspace/properties/vector/uvec3property.h b/include/openspace/properties/vector/uvec3property.h index b46ed1e6d9..c3a92e2e68 100644 --- a/include/openspace/properties/vector/uvec3property.h +++ b/include/openspace/properties/vector/uvec3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(UVec3Property, glm::uvec3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___UVEC3PROPERTY___H__ diff --git a/include/openspace/properties/vector/uvec4property.h b/include/openspace/properties/vector/uvec4property.h index 367ffea1a5..d172653400 100644 --- a/include/openspace/properties/vector/uvec4property.h +++ b/include/openspace/properties/vector/uvec4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(UVec4Property, glm::uvec4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___UVEC4PROPERTY___H__ diff --git a/include/openspace/properties/vector/vec2property.h b/include/openspace/properties/vector/vec2property.h index 3476c013c7..b3b55c1eed 100644 --- a/include/openspace/properties/vector/vec2property.h +++ b/include/openspace/properties/vector/vec2property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Vec2Property, glm::vec2); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___VEC2PROPERTY___H__ diff --git a/include/openspace/properties/vector/vec3property.h b/include/openspace/properties/vector/vec3property.h index 5c43e59606..cfc71d9290 100644 --- a/include/openspace/properties/vector/vec3property.h +++ b/include/openspace/properties/vector/vec3property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Vec3Property, glm::vec3); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___VEC3PROPERTY___H__ diff --git a/include/openspace/properties/vector/vec4property.h b/include/openspace/properties/vector/vec4property.h index 85bf3a3e87..e75cab5f44 100644 --- a/include/openspace/properties/vector/vec4property.h +++ b/include/openspace/properties/vector/vec4property.h @@ -29,12 +29,10 @@ #include -namespace openspace { -namespace properties { +namespace openspace::properties { REGISTER_NUMERICALPROPERTY_HEADER(Vec4Property, glm::vec4); -} // namespace properties -} // namespace openspace +} // namespace openspace::properties #endif // __OPENSPACE_CORE___VEC4PROPERTY___H__ diff --git a/include/openspace/query/query.h b/include/openspace/query/query.h index 52fafb8d85..e6e68f1bfa 100644 --- a/include/openspace/query/query.h +++ b/include/openspace/query/query.h @@ -30,9 +30,7 @@ namespace openspace { -namespace properties { - class Property; -} +namespace properties { class Property; } class Renderable; class Scene; diff --git a/include/openspace/rendering/abufferrenderer.h b/include/openspace/rendering/abufferrenderer.h index b155f8eba8..bb2741bfca 100644 --- a/include/openspace/rendering/abufferrenderer.h +++ b/include/openspace/rendering/abufferrenderer.h @@ -82,13 +82,13 @@ public: void update(); void render(float blackoutFactor, bool doPerformanceMeasurements) override; - /** * Update render data * Responsible for calling renderEngine::setRenderData */ virtual void updateRendererData() override; virtual void raycastersChanged(VolumeRaycaster& raycaster, bool attached) override; + private: void clear(); diff --git a/include/openspace/rendering/framebufferrenderer.h b/include/openspace/rendering/framebufferrenderer.h index 58384198d4..2bfc1e5c0f 100644 --- a/include/openspace/rendering/framebufferrenderer.h +++ b/include/openspace/rendering/framebufferrenderer.h @@ -37,16 +37,12 @@ #include #include -namespace ghoul { - class Dictionary; - - namespace filesystem { - class File; - } - namespace opengl { - class ProgramObject; - class Texture; - } +namespace ghoul { class Dictionary; } +namespace ghoul::filesystem { class File; } + +namespace ghoul::opengl { + class ProgramObject; + class Texture; } namespace openspace { diff --git a/include/openspace/rendering/raycasterlistener.h b/include/openspace/rendering/raycasterlistener.h index 3efa452113..60cacc2047 100644 --- a/include/openspace/rendering/raycasterlistener.h +++ b/include/openspace/rendering/raycasterlistener.h @@ -32,8 +32,8 @@ class VolumeRaycaster; class RaycasterListener { public: virtual void raycastersChanged(VolumeRaycaster& raycaster, bool attached) = 0; -}; // RaycasterListener +}; -} // openspace +} // namespace openspace #endif // __OPENSPACE_CORE___RAYCASTERLISTENER___H__ diff --git a/include/openspace/rendering/renderable.h b/include/openspace/rendering/renderable.h index a5bafcc8d5..56ddd157a2 100644 --- a/include/openspace/rendering/renderable.h +++ b/include/openspace/rendering/renderable.h @@ -29,13 +29,11 @@ #include -namespace ghoul { - namespace opengl { - class ProgramObject; - class Texture; - } - class Dictionary; -} // namespace ghoul +namespace ghoul { class Dictionary; } +namespace ghoul::opengl { + class ProgramObject; + class Texture; +} namespace openspace { @@ -76,7 +74,6 @@ public: void setBoundingSphere(float boundingSphere); float boundingSphere() const; - virtual void render(const RenderData& data); virtual void render(const RenderData& data, RendererTasks& rendererTask); virtual void update(const UpdateData& data); virtual SurfacePositionHandle calculateSurfacePositionHandle( diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index 232f1222e2..864e55857d 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -33,22 +33,18 @@ #include #include - namespace ghoul { -namespace fontrendering { - class Font; + class Dictionary; + class SharedMemory; } -namespace opengl { - class ProgramObject; -} -class Dictionary; -class SharedMemory; -} // namespace ghoul +namespace ghoul::fontrendering { class Font; } +namespace ghoul::opengl { class ProgramObject; } namespace openspace { namespace performance { class PerformanceManager; } namespace scripting { struct LuaLibrary; } + class Camera; class RaycasterManager; class DeferredcasterManager; diff --git a/include/openspace/rendering/renderer.h b/include/openspace/rendering/renderer.h index 365b988355..8bd1719475 100644 --- a/include/openspace/rendering/renderer.h +++ b/include/openspace/rendering/renderer.h @@ -32,16 +32,11 @@ #include #include -namespace ghoul { - class Dictionary; - - namespace filesystem { - class File; - } - namespace opengl { - class ProgramObject; - class Texture; - } +namespace ghoul { class Dictionary; } +namespace ghoul::filesystem { class File; } +namespace ghoul::opengl { + class ProgramObject; + class Texture; } namespace openspace { @@ -68,12 +63,12 @@ public: /** * Set raycasting uniforms on the program object, and setup raycasting. */ - virtual void preRaycast(ghoul::opengl::ProgramObject& programObject) {}; + virtual void preRaycast(ghoul::opengl::ProgramObject& /*programObject*/) {}; /** * Tear down raycasting for the specified program object. */ - virtual void postRaycast(ghoul::opengl::ProgramObject& programObject) {}; + virtual void postRaycast(ghoul::opengl::ProgramObject& /*programObject*/) {}; virtual void update() = 0; diff --git a/include/openspace/rendering/volume.h b/include/openspace/rendering/volume.h index f175a029e0..ab5f6e63f2 100644 --- a/include/openspace/rendering/volume.h +++ b/include/openspace/rendering/volume.h @@ -28,18 +28,15 @@ #include #include -namespace ghoul { - namespace opengl { - class Texture; - class ProgramObject; - } +namespace ghoul::opengl { + class Texture; + class ProgramObject; } namespace openspace { class Volume { public: - /** * Constructor */ diff --git a/include/openspace/rendering/volumeraycaster.h b/include/openspace/rendering/volumeraycaster.h index e9cb1674b0..73f4e1965b 100644 --- a/include/openspace/rendering/volumeraycaster.h +++ b/include/openspace/rendering/volumeraycaster.h @@ -29,11 +29,9 @@ #include #include -namespace ghoul { - namespace opengl { - class Texture; - class ProgramObject; - } +namespace ghoul::opengl { + class Texture; + class ProgramObject; } namespace openspace { @@ -51,30 +49,30 @@ public: /** * Render the volume's entry points (front face of the bounding geometry) */ - virtual void renderEntryPoints(const RenderData& data, ghoul::opengl::ProgramObject& program) = 0; + virtual void renderEntryPoints(const RenderData& /*data*/, ghoul::opengl::ProgramObject& /*program*/) = 0; /** * Render the volume's exit points (back face of the bounding geometry) */ - virtual void renderExitPoints(const RenderData& data, ghoul::opengl::ProgramObject& program) = 0; + virtual void renderExitPoints(const RenderData& /*data*/, ghoul::opengl::ProgramObject& /*program*/) = 0; /** * Prepare the volume for the ABuffer's resolve step. * Make sure textures are up to date, bind them to texture units, set program uniforms etc. */ - virtual void preRaycast(const RaycastData& data, ghoul::opengl::ProgramObject& program) {}; + virtual void preRaycast(const RaycastData& /*data*/, ghoul::opengl::ProgramObject& /*program*/) {}; /** * Clean up for the volume after the ABuffer's resolve step. * Make sure texture units are deinitialized, etc. */ - virtual void postRaycast(const RaycastData& data, ghoul::opengl::ProgramObject& program) {}; + virtual void postRaycast(const RaycastData& /*data*/, ghoul::opengl::ProgramObject& /*program*/) {}; /** * Return true if the camera is inside the volume. * Also set localPosition to the camera position in the volume's local coordainte system. */ - virtual bool cameraIsInside(const RenderData& data, glm::vec3& localPosition) { return false; }; + virtual bool cameraIsInside(const RenderData& /*data*/, glm::vec3& /*localPosition*/) { return false; }; /** * Return a path the file to use as vertex shader * diff --git a/include/openspace/scene/scenemanager.h b/include/openspace/scene/scenemanager.h index 26e73d9857..5d84be8066 100644 --- a/include/openspace/scene/scenemanager.h +++ b/include/openspace/scene/scenemanager.h @@ -43,6 +43,6 @@ private: std::vector> _scenes; }; -} // namespace +} // namespace openspace #endif // __OPENSPACE_CORE___SCENEMANAGER___H__ diff --git a/include/openspace/scripting/lualibrary.h b/include/openspace/scripting/lualibrary.h index e49adc1026..f64624f1f6 100644 --- a/include/openspace/scripting/lualibrary.h +++ b/include/openspace/scripting/lualibrary.h @@ -30,8 +30,7 @@ #include #include -namespace openspace { -namespace scripting { +namespace openspace::scripting { /** * This structure represents a Lua library, itself consisting of a unique #name and @@ -78,7 +77,6 @@ struct LuaLibrary { bool operator<(const LuaLibrary& rhs) const; }; -} // namespace scripting -} // namespace openspace +} // namespace openspace::scripting #endif // __OPENSPACE_CORE___LUALIBRARY___H__ diff --git a/include/openspace/scripting/scriptengine.h b/include/openspace/scripting/scriptengine.h index 5c6e42a6da..ec5f4265f6 100644 --- a/include/openspace/scripting/scriptengine.h +++ b/include/openspace/scripting/scriptengine.h @@ -38,11 +38,9 @@ #include #include -namespace openspace { +namespace openspace { class SyncBuffer; } -class SyncBuffer; - -namespace scripting { +namespace openspace::scripting { /** * The ScriptEngine is responsible for handling the execution of custom Lua functions and @@ -132,7 +130,6 @@ private: std::string _logFilename; }; -} // namespace scripting -} // namespace openspace +} // namespace openspace::scripting #endif // __OPENSPACE_CORE___SCRIPTENGINE___H__ diff --git a/include/openspace/scripting/scriptscheduler.h b/include/openspace/scripting/scriptscheduler.h index fce3028caf..5db048fa85 100644 --- a/include/openspace/scripting/scriptscheduler.h +++ b/include/openspace/scripting/scriptscheduler.h @@ -30,13 +30,11 @@ #include #include -namespace ghoul { -class Dictionary; -} // namespace ghoul +namespace ghoul { class Dictionary; } -namespace openspace { -namespace documentation { struct Documentation; } -namespace scripting { +namespace openspace::documentation { struct Documentation; } + +namespace openspace::scripting { /** * Maintains an ordered list of ScheduledScripts and provides a simple @@ -123,7 +121,6 @@ private: }; -} // namespace scripting -} // namespace openspace +} // namespace openspace::scripting #endif // __OPENSPACE_CORE___SCRIPTSCHEDULER___H__ diff --git a/include/openspace/scripting/systemcapabilitiesbinding.h b/include/openspace/scripting/systemcapabilitiesbinding.h index 107b97b5c3..3bacf19891 100644 --- a/include/openspace/scripting/systemcapabilitiesbinding.h +++ b/include/openspace/scripting/systemcapabilitiesbinding.h @@ -27,13 +27,11 @@ #include -namespace openspace { -namespace scripting { +namespace openspace::scripting { LuaLibrary generalSystemCapabilities(); LuaLibrary openglSystemCapabilities(); -} // namespace scripting -} // namespace openspace +} // namespace openspace::scripting #endif // __OPENSPACE_CORE___SYSTEMCAPABILITIESBINDING___H__ diff --git a/include/openspace/util/powerscaledcoordinate.h b/include/openspace/util/powerscaledcoordinate.h index 24b9925abc..568fe788b1 100644 --- a/include/openspace/util/powerscaledcoordinate.h +++ b/include/openspace/util/powerscaledcoordinate.h @@ -25,17 +25,13 @@ #ifndef __OPENSPACE_CORE___POWERSCALEDCOORDINATE___H__ #define __OPENSPACE_CORE___POWERSCALEDCOORDINATE___H__ -// open space includes -// glm includes #include #include #include #include -namespace openspace -{ +namespace openspace { -// forward declare the power scaled scalars class PowerScaledScalar; class PowerScaledCoordinate { diff --git a/include/openspace/util/powerscaledscalar.h b/include/openspace/util/powerscaledscalar.h index 3e1e06e1a2..0832479716 100644 --- a/include/openspace/util/powerscaledscalar.h +++ b/include/openspace/util/powerscaledscalar.h @@ -25,7 +25,6 @@ #ifndef __OPENSPACE_CORE___POWERSCALEDSCALAR___H__ #define __OPENSPACE_CORE___POWERSCALEDSCALAR___H__ -// glm includes #include #include #include diff --git a/include/openspace/util/powerscaledsphere.h b/include/openspace/util/powerscaledsphere.h index 7c18782b8c..c7ad591436 100644 --- a/include/openspace/util/powerscaledsphere.h +++ b/include/openspace/util/powerscaledsphere.h @@ -25,7 +25,6 @@ #ifndef __OPENSPACE_CORE___POWERSCALEDSPHERE___H__ #define __OPENSPACE_CORE___POWERSCALEDSPHERE___H__ -// open space includes #include #include #include diff --git a/include/openspace/util/syncdata.h b/include/openspace/util/syncdata.h index daeeaeedc0..0b6e037075 100644 --- a/include/openspace/util/syncdata.h +++ b/include/openspace/util/syncdata.h @@ -46,10 +46,10 @@ protected: // Allowing SyncEngine synchronization methods and at the same time hiding them // from the used of implementations of the interface friend class SyncEngine; - virtual void presync(bool isMaster) {}; - virtual void encode(SyncBuffer* syncBuffer) = 0; - virtual void decode(SyncBuffer* syncBuffer) = 0; - virtual void postsync(bool isMaster) {}; + virtual void presync(bool /*isMaster*/) {}; + virtual void encode(SyncBuffer* /*syncBuffer*/) = 0; + virtual void decode(SyncBuffer* /*syncBuffer*/) = 0; + virtual void postsync(bool /*isMaster*/) {}; }; /** @@ -121,7 +121,6 @@ protected: T data; T doubleBufferedData; std::mutex _mutex; - }; } // namespace openspace diff --git a/include/openspace/util/time.h b/include/openspace/util/time.h index 947f7a0948..d65cc4e43c 100644 --- a/include/openspace/util/time.h +++ b/include/openspace/util/time.h @@ -54,7 +54,6 @@ namespace openspace { * * The synchronization of the simulation time requires */ - class Time { public: /** diff --git a/include/openspace/util/timerange.h b/include/openspace/util/timerange.h index b7739f1322..ff75683847 100644 --- a/include/openspace/util/timerange.h +++ b/include/openspace/util/timerange.h @@ -32,7 +32,6 @@ namespace openspace { namespace documentation { struct Documentation; } struct TimeRange { - /** * Default constructor initializes an empty time range. */ diff --git a/include/openspace/util/transformationmanager.h b/include/openspace/util/transformationmanager.h index 1c0c93f9d1..7d90a4dfbc 100644 --- a/include/openspace/util/transformationmanager.h +++ b/include/openspace/util/transformationmanager.h @@ -27,10 +27,22 @@ #include #include + #ifdef OPENSPACE_MODULE_KAMELEON_ENABLED + +#ifdef WIN32 +#pragma warning (push) +#pragma warning (disable : 4619) // #pragma warning: there is no warning number '4675' +#endif // WIN32 + #include + +#ifdef WIN32 +#pragma warning (pop) +#endif // WIN32 #endif + #include namespace ccmc { diff --git a/include/openspace/util/updatestructures.h b/include/openspace/util/updatestructures.h index 3e6529a8cd..86631d0cb7 100644 --- a/include/openspace/util/updatestructures.h +++ b/include/openspace/util/updatestructures.h @@ -34,9 +34,7 @@ namespace openspace { class Deferredcaster; class VolumeRaycaster; -struct InitializeData { - -}; +struct InitializeData {}; struct TransformData { glm::dvec3 translation; @@ -50,7 +48,6 @@ struct UpdateData { const bool doPerformanceMeasurement; }; - struct RenderData { const Camera& camera; // psc position to be removed in favor of the double precision position defined in diff --git a/logs/.gitignore b/logs/.gitignore deleted file mode 100644 index d6b7ef32c8..0000000000 --- a/logs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/modules/base/basemodule.cpp b/modules/base/basemodule.cpp index 85382d5add..530801d161 100644 --- a/modules/base/basemodule.cpp +++ b/modules/base/basemodule.cpp @@ -52,7 +52,7 @@ namespace openspace { -BaseModule::BaseModule() : OpenSpaceModule(BaseModule::Name) {} +BaseModule::BaseModule() : OpenSpaceModule(BaseModule::Name) {} void BaseModule::internalInitialize() { FactoryManager::ref().addFactory( diff --git a/modules/base/rendering/modelgeometry.cpp b/modules/base/rendering/modelgeometry.cpp index 5b1cc4b287..c82d08c700 100644 --- a/modules/base/rendering/modelgeometry.cpp +++ b/modules/base/rendering/modelgeometry.cpp @@ -44,8 +44,7 @@ namespace { const int8_t CurrentCacheVersion = 3; } // namespace -namespace openspace { -namespace modelgeometry { +namespace openspace::modelgeometry { documentation:: Documentation ModelGeometry::Documentation() { using namespace documentation; @@ -295,5 +294,4 @@ bool ModelGeometry::loadCachedFile(const std::string& filename) { void ModelGeometry::setUniforms(ghoul::opengl::ProgramObject&) {} -} // namespace modelgeometry -} // namespace openspace +} // namespace openspace::modelgeometry diff --git a/modules/base/rendering/modelgeometry.h b/modules/base/rendering/modelgeometry.h index f76685404c..e6d547a724 100644 --- a/modules/base/rendering/modelgeometry.h +++ b/modules/base/rendering/modelgeometry.h @@ -31,18 +31,13 @@ #include -namespace ghoul { - class Dictionary; +namespace ghoul { class Dictionary; } +namespace ghoul::opengl { class ProgramObject; } - namespace opengl { class ProgramObject; } -} // namespace ghoul +namespace openspace { class Renderable; } +namespace openspace::documentation { struct Documentation; } -namespace openspace { - -class Renderable; - -namespace documentation { struct Documentation; } -namespace modelgeometry { +namespace openspace::modelgeometry { class ModelGeometry : public properties::PropertyOwner { public: @@ -89,7 +84,6 @@ protected: std::string _file; }; -} // namespace modelgeometry -} // namespace openspace +} // namespace openspace::modelgeometry #endif // __OPENSPACE_MODULE_BASE___MODELGEOMETRY___H__ diff --git a/modules/base/rendering/multimodelgeometry.cpp b/modules/base/rendering/multimodelgeometry.cpp index ee8ea50aa2..084358401a 100644 --- a/modules/base/rendering/multimodelgeometry.cpp +++ b/modules/base/rendering/multimodelgeometry.cpp @@ -28,8 +28,7 @@ #include -namespace openspace { -namespace modelgeometry { +namespace openspace::modelgeometry { MultiModelGeometry::MultiModelGeometry(const ghoul::Dictionary& dictionary) : ModelGeometry(dictionary) @@ -59,5 +58,4 @@ bool MultiModelGeometry::loadModel(const std::string& filename) { return true; } -} // namespace modelgeometry -} // namespace openspace +} // namespace openspace::modelgeometry diff --git a/modules/base/rendering/multimodelgeometry.h b/modules/base/rendering/multimodelgeometry.h index 57f255f646..d062cda355 100644 --- a/modules/base/rendering/multimodelgeometry.h +++ b/modules/base/rendering/multimodelgeometry.h @@ -28,11 +28,11 @@ #include namespace openspace { + class RenderableModel; + class RenderableModelProjection; +} // namespace openspace -class RenderableModel; -class RenderableModelProjection; - -namespace modelgeometry { +namespace openspace::modelgeometry { class MultiModelGeometry : public ModelGeometry { public: @@ -42,7 +42,6 @@ private: bool loadModel(const std::string& filename); }; -} // namespace modelgeometry -} // namespace openspace +} // namespace openspace::modelgeometry #endif // __OPENSPACE_MODULE_BASE___MULTIMODELGEOMETRY___H__ diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index 97175e9d9c..306fbfa497 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -51,7 +51,6 @@ namespace { const char* keyBody = "Body"; const char* keyStart = "StartTime"; const char* keyEnd = "EndTime"; - } // namespace namespace openspace { @@ -177,7 +176,7 @@ bool RenderableModel::deinitialize() { return true; } -void RenderableModel::render(const RenderData& data) { +void RenderableModel::render(const RenderData& data, RendererTasks&) { _programObject->activate(); // Fading diff --git a/modules/base/rendering/renderablemodel.h b/modules/base/rendering/renderablemodel.h index f169710df7..fadd85bde6 100644 --- a/modules/base/rendering/renderablemodel.h +++ b/modules/base/rendering/renderablemodel.h @@ -34,12 +34,10 @@ #include -namespace ghoul { -namespace opengl { +namespace ghoul::opengl { class ProgramObject; class Texture; -} // namespace opengl -} // namespace ghoul +} // namespace ghoul::opengl namespace openspace { @@ -47,10 +45,7 @@ struct RenderData; struct UpdateData; namespace documentation { struct Documentation; } - -namespace modelgeometry { -class ModelGeometry; -} +namespace modelgeometry { class ModelGeometry; } class RenderableModel : public Renderable { public: @@ -61,7 +56,7 @@ public: bool isReady() const override; - void render(const RenderData& data) override; + void render(const RenderData& data, RendererTasks& rendererTask) override; void update(const UpdateData& data) override; static documentation::Documentation Documentation(); diff --git a/modules/base/rendering/renderableplane.cpp b/modules/base/rendering/renderableplane.cpp index d6f1047d38..93abb65c0f 100644 --- a/modules/base/rendering/renderableplane.cpp +++ b/modules/base/rendering/renderableplane.cpp @@ -104,7 +104,7 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary) "RenderablePlane" ); - _size = dictionary.value(KeySize); + _size = static_cast(dictionary.value(KeySize)); if (dictionary.hasKey(KeyBillboard)) { _billboard = dictionary.value(KeyBillboard); @@ -173,7 +173,7 @@ bool RenderablePlane::deinitialize() { return true; } -void RenderablePlane::render(const RenderData& data) { +void RenderablePlane::render(const RenderData& data, RendererTasks&) { _shader->activate(); //if (_projectionListener){ // //get parent node-texture and set with correct dimensions diff --git a/modules/base/rendering/renderableplane.h b/modules/base/rendering/renderableplane.h index aad6a2b2e9..4b49246dbe 100644 --- a/modules/base/rendering/renderableplane.h +++ b/modules/base/rendering/renderableplane.h @@ -33,14 +33,12 @@ #include -namespace ghoul { -namespace filesystem { class File; } +namespace ghoul::filesystem { class File; } -namespace opengl { +namespace ghoul::opengl { class ProgramObject; class Texture; -} -} // namespace ghoul +} // namespace ghoul::opengl namespace openspace { @@ -60,7 +58,7 @@ public: bool isReady() const override; - void render(const RenderData& data) override; + void render(const RenderData& data, RendererTasks& rendererTask) override; void update(const UpdateData& data) override; static documentation::Documentation Documentation(); diff --git a/modules/base/rendering/renderablesphere.cpp b/modules/base/rendering/renderablesphere.cpp index 25ca8c0494..79959887bf 100644 --- a/modules/base/rendering/renderablesphere.cpp +++ b/modules/base/rendering/renderablesphere.cpp @@ -108,7 +108,7 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary) "RenderableSphere" ); - _size = dictionary.value(KeySize); + _size = static_cast(dictionary.value(KeySize)); _segments = static_cast(dictionary.value(KeySegments)); _texturePath = absPath(dictionary.value(KeyTexture)); @@ -181,7 +181,7 @@ bool RenderableSphere::deinitialize() { return true; } -void RenderableSphere::render(const RenderData& data) { +void RenderableSphere::render(const RenderData& data, RendererTasks&) { glm::mat4 transform = glm::mat4(1.0); transform = glm::rotate(transform, static_cast(M_PI_2), glm::vec3(1, 0, 0)); diff --git a/modules/base/rendering/renderablesphere.h b/modules/base/rendering/renderablesphere.h index 8f74d6fe96..12417125d2 100644 --- a/modules/base/rendering/renderablesphere.h +++ b/modules/base/rendering/renderablesphere.h @@ -32,12 +32,10 @@ #include #include -namespace ghoul { -namespace opengl { +namespace ghoul::opengl { class ProgramObject; class Texture; -} -} // namespace ghoul +} // namespace ghoul::opengl namespace openspace { @@ -56,7 +54,7 @@ public: bool isReady() const override; - void render(const RenderData& data) override; + void render(const RenderData& data, RendererTasks& rendererTask) override; void update(const UpdateData& data) override; static documentation::Documentation Documentation(); diff --git a/modules/base/rendering/renderablesphericalgrid.cpp b/modules/base/rendering/renderablesphericalgrid.cpp index 00a1f8b862..f960e02fa8 100644 --- a/modules/base/rendering/renderablesphericalgrid.cpp +++ b/modules/base/rendering/renderablesphericalgrid.cpp @@ -34,7 +34,7 @@ #include namespace { - static const std::string _loggerCat = "RenderableSphericalGrid"; + static const char* _loggerCat = "RenderableSphericalGrid"; const char* KeyGridType = "GridType"; const char* KeyGridColor = "GridColor"; const char* KeyGridMatrix = "GridMatrix"; @@ -42,7 +42,8 @@ namespace { const char* KeyGridRadius = "GridRadius"; const char* KeyGridParentsRotation = "ParentsRotation"; const glm::vec2 GridRadius = { 1.f, 20.f }; -} +} // namespace + namespace openspace { RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictionary) @@ -196,7 +197,7 @@ bool RenderableSphericalGrid::initialize(){ return completeSuccess; } -void RenderableSphericalGrid::render(const RenderData& data){ +void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){ _gridProgram->activate(); glm::mat4 transform; @@ -233,4 +234,5 @@ void RenderableSphericalGrid::update(const UpdateData& data) { _parentMatrix = SpiceManager::ref().positionTransformMatrix("IAU_JUPITER", "GALACTIC", data.time.j2000Seconds()); } -} \ No newline at end of file + +} // namespace openspace diff --git a/modules/base/rendering/renderablesphericalgrid.h b/modules/base/rendering/renderablesphericalgrid.h index b4dabab32a..54673c86b5 100644 --- a/modules/base/rendering/renderablesphericalgrid.h +++ b/modules/base/rendering/renderablesphericalgrid.h @@ -33,7 +33,7 @@ namespace openspace { -class RenderableSphericalGrid : public Renderable{ +class RenderableSphericalGrid : public Renderable { public: RenderableSphericalGrid(const ghoul::Dictionary& dictionary); ~RenderableSphericalGrid(); @@ -43,7 +43,7 @@ public: bool isReady() const override; - void render(const RenderData& data) override; + void render(const RenderData& data, RendererTasks& rendererTask) override; void update(const UpdateData& data) override; protected: diff --git a/modules/base/rendering/renderabletrail.cpp b/modules/base/rendering/renderabletrail.cpp index 67194fc487..bfe21f3880 100644 --- a/modules/base/rendering/renderabletrail.cpp +++ b/modules/base/rendering/renderabletrail.cpp @@ -56,7 +56,7 @@ namespace { { "Lines+Points", RenderingModeLinesPoints }, { "Points+Lines", RenderingModeLinesPoints } }; -} +} // namespace namespace openspace { @@ -217,7 +217,7 @@ bool RenderableTrail::isReady() const { return _programObject != nullptr; } -void RenderableTrail::render(const RenderData & data) { +void RenderableTrail::render(const RenderData& data, RendererTasks&) { _programObject->activate(); glm::dmat4 modelTransform = diff --git a/modules/base/rendering/renderabletrail.h b/modules/base/rendering/renderabletrail.h index f96f5d7bed..962bdf5245 100644 --- a/modules/base/rendering/renderabletrail.h +++ b/modules/base/rendering/renderabletrail.h @@ -36,12 +36,10 @@ #include -namespace ghoul { -namespace opengl { +namespace ghoul::opengl { class ProgramObject; class Texture; -} // namespace opengl -} // namespace ghoul +} // namespace ghoul::opengl namespace openspace { @@ -86,7 +84,7 @@ public: * \c _floatingRenderInformation using the provided \p data * \param data The data that is necessary to render this Renderable */ - void render(const RenderData& data) override; + void render(const RenderData& data, RendererTasks& rendererTask) override; protected: explicit RenderableTrail(const ghoul::Dictionary& dictionary); diff --git a/modules/base/rendering/renderabletrailorbit.cpp b/modules/base/rendering/renderabletrailorbit.cpp index fe11720f80..c8ebaa048d 100644 --- a/modules/base/rendering/renderabletrailorbit.cpp +++ b/modules/base/rendering/renderabletrailorbit.cpp @@ -83,7 +83,7 @@ namespace { const char* KeyPeriod = "Period"; const char* KeyResolution = "Resolution"; -} +} // namespace namespace openspace { diff --git a/modules/base/rendering/renderabletrailtrajectory.cpp b/modules/base/rendering/renderabletrailtrajectory.cpp index 8094ba3abd..1969e9a58c 100644 --- a/modules/base/rendering/renderabletrailtrajectory.cpp +++ b/modules/base/rendering/renderabletrailtrajectory.cpp @@ -49,7 +49,7 @@ namespace { const char* KeySampleInterval = "SampleInterval"; const char* KeyTimeStampSubsample = "TimeStampSubsampleFactor"; const char* KeyShowFullTrail = "ShowFullTrail"; -} +} // namespace namespace openspace { @@ -255,7 +255,7 @@ void RenderableTrailTrajectory::update(const UpdateData& data) { // If only trail so far should be rendered, we need to find the corresponding time // in the array and only render it until then _primaryRenderInformation.first = 0; - double t = (data.time.j2000Seconds() - _start) / (_end - _start); + double t = std::max(0.0, (data.time.j2000Seconds() - _start) / (_end - _start)); _primaryRenderInformation.count = std::min( static_cast(ceil(_vertexArray.size() * t)), static_cast(_vertexArray.size() - 1) diff --git a/modules/base/rendering/screenspaceframebuffer.cpp b/modules/base/rendering/screenspaceframebuffer.cpp index 1f4d6fe118..26f1118543 100644 --- a/modules/base/rendering/screenspaceframebuffer.cpp +++ b/modules/base/rendering/screenspaceframebuffer.cpp @@ -181,4 +181,5 @@ int ScreenSpaceFramebuffer::id(){ static int id = 0; return id++; } -} //namespace openspace \ No newline at end of file + +} //namespace openspace diff --git a/modules/base/rotation/staticrotation.cpp b/modules/base/rotation/staticrotation.cpp index e8aa408dd8..eb7c5815c8 100644 --- a/modules/base/rotation/staticrotation.cpp +++ b/modules/base/rotation/staticrotation.cpp @@ -29,7 +29,7 @@ namespace { const char* KeyRotation = "Rotation"; -} +} // namespace namespace openspace { diff --git a/modules/base/scale/staticscale.cpp b/modules/base/scale/staticscale.cpp index 6eb819e419..16de25b4a9 100644 --- a/modules/base/scale/staticscale.cpp +++ b/modules/base/scale/staticscale.cpp @@ -29,7 +29,7 @@ namespace { const char* KeyValue = "Scale"; -} +} // namespace namespace openspace { diff --git a/modules/base/shaders/imageplane_fs.glsl b/modules/base/shaders/imageplane_fs.glsl index 0673ba4782..ff334f0a1d 100644 --- a/modules/base/shaders/imageplane_fs.glsl +++ b/modules/base/shaders/imageplane_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,27 +22,25 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -uniform float time; -uniform sampler2D texture1; - -in vec2 vs_st; -in vec4 vs_positionScreenSpace; - -#include "PowerScaling/powerScaling_fs.hglsl" #include "fragment.glsl" -Fragment getFragment() -{ - vec4 diffuse; - if (gl_FrontFacing) - diffuse = texture(texture1, vs_st); +in vec2 vs_st; +in float vs_screenSpaceDepth; + +uniform sampler2D texture1; + + +Fragment getFragment() { + Fragment frag; + + if (gl_FrontFacing) { + frag.color = texture(texture1, vs_st); + } else { - diffuse = vec4(0.8); + frag.color = vec4(0.8); } - Fragment frag; - frag.color = diffuse; - frag.depth = vs_positionScreenSpace.w; + frag.depth = vs_screenSpaceDepth; return frag; } diff --git a/modules/base/shaders/imageplane_vs.glsl b/modules/base/shaders/imageplane_vs.glsl index 4b0bb8424d..1d1a27a13c 100644 --- a/modules/base/shaders/imageplane_vs.glsl +++ b/modules/base/shaders/imageplane_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,25 +24,23 @@ #version __CONTEXT__ -uniform mat4 modelViewProjectionTransform; +#include "PowerScaling/powerScaling_vs.hglsl" layout(location = 0) in vec4 in_position; layout(location = 1) in vec2 in_st; out vec2 vs_st; -out vec4 vs_positionScreenSpace; -out float s; +out float vs_screenSpaceDepth; -#include "PowerScaling/powerScaling_vs.hglsl" +uniform mat4 modelViewProjectionTransform; -void main() -{ - vec4 position = vec4(in_position.xyz * pow(10, in_position.w), 1); - vec4 positionClipSpace = modelViewProjectionTransform * position; - // Write output - vs_positionScreenSpace = z_normalization(positionClipSpace); - gl_Position = vs_positionScreenSpace; +void main() { + const vec4 position = vec4(in_position.xyz * pow(10, in_position.w), 1); + const vec4 positionClipSpace = modelViewProjectionTransform * position; + const vec4 positionScreenSpace = z_normalization(positionClipSpace); - vs_st = in_st; -} \ No newline at end of file + gl_Position = positionScreenSpace; + vs_st = in_st; + vs_screenSpaceDepth = positionScreenSpace.w; +} diff --git a/modules/base/shaders/model_fs.glsl b/modules/base/shaders/model_fs.glsl index 3a14dc24dd..da2bb50a24 100644 --- a/modules/base/shaders/model_fs.glsl +++ b/modules/base/shaders/model_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,65 +22,55 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -// Uniforms -uniform float transparency; -uniform float fading; -uniform bool performShading = true; +#include "fragment.glsl" -uniform vec3 directionToSunViewSpace; - -uniform sampler2D texture1; - -// Input from the vertex shader in vec2 vs_st; in vec3 vs_normalViewSpace; in vec4 vs_positionCameraSpace; -in vec4 vs_positionScreenSpace; +in float vs_screenSpaceDepth; -#include "PowerScaling/powerScaling_fs.hglsl" -#include "fragment.glsl" +uniform float fading; +uniform bool performShading = true; +uniform vec3 directionToSunViewSpace; +uniform sampler2D texture1; + +const vec3 SpecularAlbedo = vec3(1.0); Fragment getFragment() { - vec4 textureSample = texture(texture1, vs_st); - - vec3 diffuseAlbedo = textureSample.rgb; - vec3 specularAlbedo = vec3(1); + const vec3 diffuseAlbedo = texture(texture1, vs_st).rgb; - vec3 color; + Fragment frag; if (performShading) { // Some of these values could be passed in as uniforms - vec3 lightColorAmbient = vec3(1); - vec3 lightColor = vec3(1); + const vec3 lightColorAmbient = vec3(1.0); + const vec3 lightColor = vec3(1.0); - vec3 n = normalize(vs_normalViewSpace); - vec3 l = directionToSunViewSpace; - vec3 c = normalize(vs_positionCameraSpace.xyz); - vec3 r = reflect(l, n); + const vec3 n = normalize(vs_normalViewSpace); + const vec3 l = directionToSunViewSpace; + const vec3 c = normalize(vs_positionCameraSpace.xyz); + const vec3 r = reflect(l, n); - float ambientIntensity = 0.2; - float diffuseIntensity = 1; - float specularIntensity = 1; + const float ambientIntensity = 0.2; + const float diffuseIntensity = 1; + const float specularIntensity = 1; - float diffuseCosineFactor = dot(n,l); - float specularCosineFactor = dot(c,r); - float specularPower = 100; + const float diffuseCosineFactor = dot(n,l); + const float specularCosineFactor = dot(c,r); + const float specularPower = 100.0; - vec3 ambientColor = ambientIntensity * lightColorAmbient * diffuseAlbedo; - vec3 diffuseColor = diffuseIntensity * lightColor * diffuseAlbedo * max(diffuseCosineFactor, 0); - vec3 specularColor = specularIntensity * lightColor * specularAlbedo * pow(max(specularCosineFactor, 0), specularPower); + const vec3 ambientColor = ambientIntensity * lightColorAmbient * diffuseAlbedo; + const vec3 diffuseColor = diffuseIntensity * lightColor * diffuseAlbedo * max(diffuseCosineFactor, 0); + const vec3 specularColor = specularIntensity * lightColor * SpecularAlbedo * pow(max(specularCosineFactor, 0), specularPower); - color = ambientColor + diffuseColor + specularColor; + frag.color.rgb = ambientColor + diffuseColor + specularColor; } else { - color = diffuseAlbedo; + frag.color.rgb = diffuseAlbedo; } - float alpha = fading * transparency; - - Fragment frag; - frag.color = vec4(color, alpha); - frag.depth = vs_positionScreenSpace.w; + frag.color.a = fading; + frag.depth = vs_screenSpaceDepth; return frag; } diff --git a/modules/base/shaders/model_vs.glsl b/modules/base/shaders/model_vs.glsl index 2837c67a44..fb54dd8a1d 100644 --- a/modules/base/shaders/model_vs.glsl +++ b/modules/base/shaders/model_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,38 +24,30 @@ #version __CONTEXT__ -// Vertex attributes +#include "PowerScaling/powerScaling_vs.hglsl" + layout(location = 0) in vec4 in_position; layout(location = 1) in vec2 in_st; layout(location = 2) in vec3 in_normal; -// Uniforms +out vec2 vs_st; +out vec3 vs_normalViewSpace; +out float vs_screenSpaceDepth; +out vec4 vs_positionCameraSpace; + uniform mat4 modelViewTransform; uniform mat4 projectionTransform; -uniform vec3 cameraDirectionWorldSpace; - -uniform float _magnification; - -// Outputs -out vec2 vs_st; -out vec3 vs_normalViewSpace; -out vec4 vs_positionScreenSpace; -out vec4 vs_positionCameraSpace; - -#include "PowerScaling/powerScaling_vs.hglsl" void main() { - vec4 position = in_position; - position.xyz *= pow(10, _magnification); - vs_positionCameraSpace = modelViewTransform * position; - vec4 positionClipSpace = projectionTransform * vs_positionCameraSpace; + vs_positionCameraSpace = modelViewTransform * in_position; + const vec4 positionClipSpace = projectionTransform * vs_positionCameraSpace; + const vec4 positionScreenSpace = z_normalization(positionClipSpace); - // Write output + gl_Position = positionScreenSpace; vs_st = in_st; - vs_positionScreenSpace = z_normalization(positionClipSpace); - gl_Position = vs_positionScreenSpace; + vs_screenSpaceDepth = positionScreenSpace.w; // The normal transform should be the transposed inverse of the model transform? vs_normalViewSpace = normalize(mat3(modelViewTransform) * in_normal); -} \ No newline at end of file +} diff --git a/modules/base/shaders/path_fs.glsl b/modules/base/shaders/path_fs.glsl index 101d592048..5abb243452 100644 --- a/modules/base/shaders/path_fs.glsl +++ b/modules/base/shaders/path_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -28,10 +28,11 @@ in vec4 vs_positionScreenSpace; in vec4 vs_pointColor; -Fragment getFragment() { - if (vs_pointColor.a < 0.01) +Fragment getFragment() { + if (vs_pointColor.a < 0.01) { discard; + } Fragment frag; frag.color = vs_pointColor; frag.depth = vs_positionScreenSpace.w; diff --git a/modules/base/shaders/path_gs.glsl b/modules/base/shaders/path_gs.glsl index b5305ff15f..4c8785014b 100644 --- a/modules/base/shaders/path_gs.glsl +++ b/modules/base/shaders/path_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,76 +24,33 @@ #version __CONTEXT__ -const vec2 corners[4] = vec2[4]( - vec2(0.0, 1.0), - vec2(0.0, 0.0), - vec2(1.0, 1.0), - vec2(1.0, 0.0) -); - #include "PowerScaling/powerScalingMath.hglsl" #include <${SHADERS_GENERATED}/constants.hglsl>:notrack layout(points) in; -layout(points, max_vertices = 4) out; - -uniform mat4 ViewProjection; layout(location = 0) in vec4 vs_point_position[]; - -//out flat int isHour; layout(location = 1) in flat int isHour[]; layout(location = 2) in vec4 vs_point_color[]; +layout(points, max_vertices = 4) out; layout(location = 0) out vec4 gs_point_position; layout(location = 1) out vec4 gs_point_color; - -//out flat int isHour; - -//out float billboardSize; - uniform mat4 projection; +uniform mat4 ViewProjection; + +const vec2 corners[4] = vec2[4]( + vec2(0.0, 1.0), + vec2(0.0, 0.0), + vec2(1.0, 1.0), + vec2(1.0, 0.0) +); -//uniform float scaleFactor; void main() { - gs_point_color = vs_point_color[0]; gs_point_position = vs_point_position[0]; - //gs_point_position = gl_in[0].gl_Position; if (isHour[0] == 1) { - /*vec4 projPos[4]; - for (int i = 0; i < 4; ++i) { - vec4 p1 = gl_in[0].gl_Position; - p1.xy += vec2(99999999*(corners[i] - vec2(0.5))); - projPos[i] = ViewProjection * p1; - } - - // Calculate the positions of the lower left and upper right corners of the - // billboard in screen-space - const vec2 screenSize = vec2(SCREEN_WIDTH, SCREEN_HEIGHT); - vec2 ll = (((projPos[1].xy / projPos[1].w) + 1) / 2) * screenSize; - vec2 ur = (((projPos[2].xy / projPos[2].w) + 1) / 2) * screenSize; - - // The billboard is smaller than one pixel, we can discard it - vec2 distance = abs(ll - ur); - float sizeInPixels = length(distance); - //if (sizeInPixels < 3) - // return; - - for(int i = 0; i < 4; i++) { - gs_point_position = gl_in[0].gl_Position; - gl_Position = projPos[i]; - // billboardSize = sizeInPixels; - EmitVertex(); - } - - - for(int i = 0; i < 4; i++) { - gl_Position = gl_in[0].gl_Position;; - // billboardSize = sizeInPixels; - - }*/ gl_Position = gl_in[0].gl_Position; EmitVertex(); EndPrimitive(); diff --git a/modules/base/shaders/path_vs.glsl b/modules/base/shaders/path_vs.glsl index e492beaa3e..54be145867 100644 --- a/modules/base/shaders/path_vs.glsl +++ b/modules/base/shaders/path_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,32 +24,33 @@ #version __CONTEXT__ +#include "PowerScaling/powerScaling_vs.hglsl" + in vec4 in_point_position; +out vec4 vs_positionScreenSpace; +out vec4 vs_pointColor; + uniform vec3 color; uniform mat4 modelViewTransform; uniform mat4 projectionTransform; uniform int pointSteps; -out vec4 vs_positionScreenSpace; -out vec4 vs_pointColor; -#include "PowerScaling/powerScaling_vs.hglsl" - -void main() { - vec4 positionCameraSpace = modelViewTransform * in_point_position; - vec4 positionClipSpace = projectionTransform * positionCameraSpace; +void main() { + const vec4 positionCameraSpace = modelViewTransform * in_point_position; + const vec4 positionClipSpace = projectionTransform * positionCameraSpace; vs_positionScreenSpace = z_normalization(positionClipSpace); - + gl_Position = vs_positionScreenSpace; - - if(mod(gl_VertexID, pointSteps) == 0) { + + if (mod(gl_VertexID, pointSteps) == 0) { vs_pointColor.rgb = color; - gl_PointSize = 5.0f; + gl_PointSize = 5.0f; } else { - vs_pointColor.rgb = (color + vec3(0.6f, 0.6f, 0.6f)) / 2; - gl_PointSize = 2.f; + vs_pointColor.rgb = (color + vec3(0.6, 0.6, 0.6)) / 2.0; + gl_PointSize = 2.f; } // I don't like this random variable k defined in powerScalingMath.hglsl. @@ -57,6 +58,6 @@ void main() { // float maximumDistance = pow(k, 10); float maximumDistance = pow(10, 10); float distanceToCamera = length(positionCameraSpace.xyz); - - vs_pointColor.a = maximumDistance / (distanceToCamera/100); -} \ No newline at end of file + + vs_pointColor.a = maximumDistance / (distanceToCamera / 100.0); +} diff --git a/modules/base/shaders/plane_fs.glsl b/modules/base/shaders/plane_fs.glsl index e8056437c2..bd5aca7084 100644 --- a/modules/base/shaders/plane_fs.glsl +++ b/modules/base/shaders/plane_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,47 +22,40 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -uniform float time; -uniform sampler2D texture1; -uniform bool additiveBlending; +#include "fragment.glsl" +in float vs_screenSpaceDepth; in vec2 vs_st; -in vec4 vs_positionScreenSpace; in vec4 vs_gPosition; in vec3 vs_gNormal; -#include "PowerScaling/powerScaling_fs.hglsl" -#include "fragment.glsl" +uniform sampler2D texture1; +uniform bool additiveBlending; + Fragment getFragment() { - vec4 diffuse; - if(gl_FrontFacing) - diffuse = texture(texture1, vs_st); - else - diffuse = texture(texture1, vec2(1-vs_st.s,vs_st.t)); - - //vec4 diffuse = vec4(1,vs_st,1); - //vec4 diffuse = vec4(1,0,0,1); - // if(position.w > 9.0) { - // diffuse = vec4(1,0,0,1); - // } - - if (diffuse.a == 0.0) - discard; - Fragment frag; - frag.color = diffuse; - frag.depth = vs_positionScreenSpace.w; + if (gl_FrontFacing) { + frag.color = texture(texture1, vs_st); + } + else { + frag.color = texture(texture1, vec2(1 - vs_st.s, vs_st.t)); + } + + if (frag.color.a == 0.0) { + discard; + } + + frag.depth = vs_screenSpaceDepth; if (additiveBlending) { frag.blend = BLEND_MODE_ADDITIVE; } // G-Buffer - frag.gOtherData = vec4(diffuse.xyz, 1.0); + frag.gOtherData = vec4(frag.color.xyz, 1.0); frag.gPosition = vs_gPosition; frag.gNormal = vec4(vs_gNormal, 1.0); return frag; - } diff --git a/modules/base/shaders/plane_vs.glsl b/modules/base/shaders/plane_vs.glsl index fbed4c793d..2f43978706 100644 --- a/modules/base/shaders/plane_vs.glsl +++ b/modules/base/shaders/plane_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,32 +24,32 @@ #version __CONTEXT__ -uniform mat4 modelViewProjectionTransform; -uniform mat4 modelViewTransform; +#include "PowerScaling/powerScaling_vs.hglsl" layout(location = 0) in vec4 in_position; layout(location = 1) in vec2 in_st; out vec2 vs_st; +out float vs_screenSpaceDepth; out vec4 vs_positionScreenSpace; -out float s; // G-Buffer out vec4 vs_gPosition; out vec3 vs_gNormal; -#include "PowerScaling/powerScaling_vs.hglsl" +uniform mat4 modelViewProjectionTransform; +uniform mat4 modelViewTransform; -void main() -{ - // Transform the damn psc to homogenous coordinate - vec4 position = vec4(in_position.xyz * pow(10, in_position.w), 1); - vec4 positionClipSpace = modelViewProjectionTransform * position; - vs_positionScreenSpace = z_normalization(positionClipSpace); - gl_Position = vs_positionScreenSpace; +void main() { + const vec4 position = vec4(in_position.xyz * pow(10, in_position.w), 1); + const vec4 positionClipSpace = modelViewProjectionTransform * position; + const vec4 positionScreenSpace = z_normalization(positionClipSpace); + + gl_Position = positionScreenSpace; // G-Buffer vs_gNormal = vec3(0.0); vs_gPosition = vec4(modelViewTransform * position); // Must be in SGCT eye space; vs_st = in_st; -} \ No newline at end of file + vs_screenSpaceDepth = positionScreenSpace.w; +} diff --git a/modules/base/shaders/pscstandard_fs.glsl b/modules/base/shaders/pscstandard_fs.glsl index 8eb494e4d5..ea5aeb3fcf 100644 --- a/modules/base/shaders/pscstandard_fs.glsl +++ b/modules/base/shaders/pscstandard_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,27 +22,23 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -uniform vec4 campos; -uniform vec4 objpos; -//uniform vec3 camdir; // add this for specular - -uniform vec3 sun_pos; - -uniform bool _performShading = true; -uniform float transparency; -uniform int shadows; - -uniform float time; -uniform sampler2D texture1; +#include "PowerScaling/powerScaling_fs.hglsl" +#include "fragment.glsl" in vec2 vs_st; in vec4 vs_normal; in vec4 vs_position; -#include "fragment.glsl" -#include "PowerScaling/powerScaling_fs.hglsl" +uniform vec4 campos; +uniform vec4 objpos; +uniform vec3 sun_pos; +uniform bool _performShading = true; +uniform float transparency; +uniform int shadows; +uniform float time; +uniform sampler2D texture1; + -//#include "PowerScaling/powerScaling_vs.hglsl" Fragment getFragment() { vec4 position = vs_position; float depth = pscDepth(position); @@ -50,20 +46,15 @@ Fragment getFragment() { Fragment frag; if (_performShading) { - // directional lighting - vec3 origin = vec3(0.0); - vec4 spec = vec4(0.0); + const vec3 n = normalize(vs_normal.xyz); + const vec3 l_pos = vec3(sun_pos); // sun. + const vec3 l_dir = normalize(l_pos - objpos.xyz); + const float intensity = min(max(5 * dot(n,l_dir), 0.0), 1); - vec3 n = normalize(vs_normal.xyz); - //vec3 e = normalize(camdir); - vec3 l_pos = vec3(sun_pos); // sun. - vec3 l_dir = normalize(l_pos-objpos.xyz); - float intensity = min(max(5*dot(n,l_dir), 0.0), 1); - - float shine = 0.0001; + // float shine = 0.0001; - vec4 specular = vec4(0.5); - vec4 ambient = vec4(0.0,0.0,0.0,transparency); + const vec4 specular = vec4(0.5); + const vec4 ambient = vec4(0.0, 0.0, 0.0, transparency); /* if(intensity > 0.f){ // halfway vector @@ -76,8 +67,8 @@ Fragment getFragment() { diffuse = max(intensity * diffuse, ambient); } - diffuse[3] = transparency; - frag.color = diffuse; + frag.color.rgb = diffuse.rgb; + frag.color.a = transparency; frag.depth = depth; return frag; diff --git a/modules/base/shaders/pscstandard_vs.glsl b/modules/base/shaders/pscstandard_vs.glsl index 936d7cece4..2f74b5193f 100644 --- a/modules/base/shaders/pscstandard_vs.glsl +++ b/modules/base/shaders/pscstandard_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,26 +24,22 @@ #version __CONTEXT__ -uniform mat4 ViewProjection; -uniform mat4 ModelTransform; +#include "PowerScaling/powerScaling_vs.hglsl" layout(location = 0) in vec4 in_position; -//in vec3 in_position; layout(location = 1) in vec2 in_st; layout(location = 2) in vec3 in_normal; out vec2 vs_st; out vec4 vs_normal; out vec4 vs_position; -out float s; -#include "PowerScaling/powerScaling_vs.hglsl" +uniform mat4 ViewProjection; +uniform mat4 ModelTransform; -void main() -{ - // set variables + +void main() { vs_st = in_st; - //vs_stp = in_position.xyz; vs_position = in_position; vec4 tmp = in_position; diff --git a/modules/base/shaders/renderabletrail_fs.glsl b/modules/base/shaders/renderabletrail_fs.glsl index 5ae1a7aabf..d52a1dfec9 100644 --- a/modules/base/shaders/renderabletrail_fs.glsl +++ b/modules/base/shaders/renderabletrail_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,11 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -// Fragile! Keep in sync with RenderableTrail::render::RenderPhase -#define RenderPhaseLines 0 -#define RenderPhasePoints 1 - -#define Delta 0.25 +#include "fragment.glsl" in vec4 vs_positionScreenSpace; in vec4 vs_gPosition; @@ -35,7 +31,12 @@ in float fade; uniform vec3 color; uniform int renderPhase; -#include "fragment.glsl" +// Fragile! Keep in sync with RenderableTrail::render::RenderPhase +#define RenderPhaseLines 0 +#define RenderPhasePoints 1 + +#define Delta 0.25 + Fragment getFragment() { Fragment frag; @@ -48,19 +49,6 @@ Fragment getFragment() { // smoothstep to gradually decrease the alpha on the edges of the point vec2 circCoord = 2.0 * gl_PointCoord - 1.0; frag.color.a *= 1.0 - smoothstep(1.0 - Delta, 1.0, dot(circCoord, circCoord)); - - - - // if (dot(circCoord, circCoord) > 1.0) { - - // } - // frag.color.a *= smoothstep(); - - // // Check for length > 1.0 without a square root - // frag.color.a *= smoothstep(dot(circCoord, circCoord), 1.0, 1.0 - 1.0 / pointSize); - // if (dot(circCoord, circCoord) > 1.0) { - // discard; - // } } // G-Buffer @@ -70,6 +58,5 @@ Fragment getFragment() { // TODO: Add the correct normal if necessary (JCC) frag.gNormal = vec4(0.0, 0.0, 0.0, 1.0); - return frag; } diff --git a/modules/base/shaders/renderabletrail_vs.glsl b/modules/base/shaders/renderabletrail_vs.glsl index 725d15048d..d7c901d622 100644 --- a/modules/base/shaders/renderabletrail_vs.glsl +++ b/modules/base/shaders/renderabletrail_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,10 +24,7 @@ #version __CONTEXT__ -// Fragile! Keep in sync with RenderableTrail::render -#define VERTEX_SORTING_NEWESTFIRST 0 -#define VERTEX_SORTING_OLDESTFIRST 1 -#define VERTEX_SORTING_NOSORTING 2 +#include "PowerScaling/powerScaling_vs.hglsl" layout(location = 0) in vec3 in_point_position; @@ -37,7 +34,6 @@ out float fade; uniform dmat4 modelViewTransform; uniform mat4 projectionTransform; - uniform int idOffset; uniform int nVertices; uniform bool useLineFade; @@ -46,7 +42,11 @@ uniform int vertexSortingMethod; uniform int pointSize; uniform int stride; -#include "PowerScaling/powerScaling_vs.hglsl" +// Fragile! Keep in sync with RenderableTrail::render +#define VERTEX_SORTING_NEWESTFIRST 0 +#define VERTEX_SORTING_OLDESTFIRST 1 +#define VERTEX_SORTING_NOSORTING 2 + void main() { int modId = gl_VertexID; diff --git a/modules/base/shaders/screenspace_fs.glsl b/modules/base/shaders/screenspace_fs.glsl index 22b09a4987..f9413e055b 100644 --- a/modules/base/shaders/screenspace_fs.glsl +++ b/modules/base/shaders/screenspace_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,26 +22,27 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -uniform sampler2D texture1; -uniform float OcclusionDepth; -uniform float Alpha; +#include "fragment.glsl" +#include "PowerScaling/powerScaling_fs.hglsl" in vec2 vs_st; in vec4 vs_position; -#include "fragment.glsl" -#include "PowerScaling/powerScaling_fs.hglsl" +uniform sampler2D texture1; +uniform float OcclusionDepth; +uniform float Alpha; + Fragment getFragment() { Fragment frag; // power scale coordinates for depth. w value is set to 1.0. float depth = (1.0 + log(abs(OcclusionDepth) + 1/pow(k, 1.0))/log(k)) / 27.0; - frag.color = texture(texture1, vec2(vs_st.s, vs_st.t)); - frag.color.a = (frag.color.a != 0.0f) ? Alpha : frag.color.a; - if(frag.color.a == 0.0f){ + frag.color = texture(texture1, vs_st); + frag.color.a = (frag.color.a != 0.0) ? Alpha : frag.color.a; + if (frag.color.a == 0.0) { discard; - } + } frag.depth = denormalizeFloat(depth); diff --git a/modules/base/shaders/screenspace_vs.glsl b/modules/base/shaders/screenspace_vs.glsl index cdeafae745..4ffb61ee20 100644 --- a/modules/base/shaders/screenspace_vs.glsl +++ b/modules/base/shaders/screenspace_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,17 +24,18 @@ #version __CONTEXT__ -uniform mat4 ModelTransform; -uniform mat4 ViewProjectionMatrix; - layout(location = 0) in vec4 in_position; layout(location = 1) in vec2 in_st; out vec2 vs_st; out vec4 vs_position; -void main(){ +uniform mat4 ModelTransform; +uniform mat4 ViewProjectionMatrix; + + +void main() { vs_st = in_st; - vs_position = ViewProjectionMatrix * ModelTransform * in_position; - gl_Position = vec4(vs_position); + vs_position = ViewProjectionMatrix * ModelTransform * in_position; + gl_Position = vec4(vs_position); } diff --git a/modules/base/shaders/sphere_fs.glsl b/modules/base/shaders/sphere_fs.glsl index a1ac08c628..43aea222ef 100644 --- a/modules/base/shaders/sphere_fs.glsl +++ b/modules/base/shaders/sphere_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,68 +22,35 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -uniform float time; -uniform sampler2D texture1; -uniform float alpha; +#include "fragment.glsl" +#include "PowerScaling/powerScaling_fs.hglsl" in vec2 vs_st; in vec4 vs_position; in vec4 vs_gPosition; -#include "fragment.glsl" -#include "PowerScaling/powerScaling_fs.hglsl" +uniform float time; +uniform sampler2D texture1; +uniform float alpha; -Fragment getFragment() -{ + +Fragment getFragment() { vec4 position = vs_position; - // This has to be fixed with the ScaleGraph in place (precision deficiency in depth buffer) ---abock - float depth = pscDepth(position); - vec4 diffuse; - vec2 texCoord = vs_st; // Why is this here? ---abock texCoord.s = 1 - texCoord.s; texCoord.t = 1 - texCoord.y; - // if(gl_FrontFacing) - diffuse = texture(texture1, texCoord); - // else - // diffuse = texture(texture1, vec2(1-vs_st.s,vs_st.t)); - - diffuse.a *= alpha; - - // diffuse.a = 0.0; - - //vec4 diffuse = vec4(1,vs_st,1); - //vec4 diffuse = vec4(1,0,0,1); - // if(position.w > 9.0) { - // diffuse = vec4(1,0,0,1); - // } - - - // #if 0 - // diffuse = vec4(vs_position.xyz / 10, 1.0); - // #else - // // if (abs(vs_st.r - 0.75) <= 0.01 && abs(vs_st.g - 0.5) <= 0.01) - // if (abs(vs_st.g - 0.5) <= 0.01) - // diffuse = vec4(vec2(vs_st), 0.0, 1.0); - // else - // diffuse = vec4(0.0); - // #endif - - //diffuse = vec4(1.0, 0.0, 0.0, 1.0); - Fragment frag; - frag.color = diffuse; - frag.depth = depth; + frag.color = texture(texture1, texCoord) * vec4(1.0, 1.0, 1.0, alpha); + frag.depth = pscDepth(position); // G-Buffer - frag.gOtherData = vec4(diffuse.xyz, 1.0); + frag.gOtherData = vec4(frag.color.xyz, 1.0); frag.gPosition = vs_gPosition; // There is no normal here // TODO: Add the correct normal (JCC) frag.gNormal = vec4(0.0, 0.0, 0.0, 1.0); - return frag; -} + } diff --git a/modules/base/shaders/sphere_vs.glsl b/modules/base/shaders/sphere_vs.glsl index ad31f64787..62f55bc54e 100644 --- a/modules/base/shaders/sphere_vs.glsl +++ b/modules/base/shaders/sphere_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,8 +24,7 @@ #version __CONTEXT__ -uniform mat4 ViewProjection; -uniform mat4 ModelTransform; +#include "PowerScaling/powerScaling_vs.hglsl" layout(location = 0) in vec4 in_position; layout(location = 1) in vec2 in_st; @@ -35,18 +34,17 @@ out vec4 vs_position; out float s; out vec4 vs_gPosition; -#include "PowerScaling/powerScaling_vs.hglsl" +uniform mat4 ViewProjection; +uniform mat4 ModelTransform; -void main() -{ + +void main() { vec4 tmp = in_position; - mat4 mt = ModelTransform; - - mt = mat4(0, -1, 0, 0, - 1, 0, 0, 0, - 0, 0, -1, 0, - 0, 0, 0, 1) * mt; + mat4 mt = mat4(0.0, -1.0, 0.0, 0.0, + 1.0, 0.0, 0.0, 0.0, + 0.0, 0.0, -1.0, 0.0, + 0.0, 0.0, 0.0, 1.0) * ModelTransform; vec4 position = pscTransform(tmp, mt); @@ -56,4 +54,5 @@ void main() position = ViewProjection * position; gl_Position = z_normalization(position); + } diff --git a/modules/base/translation/statictranslation.cpp b/modules/base/translation/statictranslation.cpp index 069c64e10e..3af71ff175 100644 --- a/modules/base/translation/statictranslation.cpp +++ b/modules/base/translation/statictranslation.cpp @@ -29,7 +29,7 @@ namespace { const char* KeyPosition = "Position"; -} +} // namespace namespace openspace { diff --git a/modules/debugging/debuggingmodule.cpp b/modules/debugging/debuggingmodule.cpp index bbebf4a0db..4e89c43622 100644 --- a/modules/debugging/debuggingmodule.cpp +++ b/modules/debugging/debuggingmodule.cpp @@ -33,9 +33,7 @@ namespace openspace { -DebuggingModule::DebuggingModule() - : OpenSpaceModule(Name) -{} +DebuggingModule::DebuggingModule() : OpenSpaceModule(Name) {} void DebuggingModule::internalInitialize() { auto fRenderable = FactoryManager::ref().factory(); diff --git a/modules/debugging/rendering/debugrenderer.cpp b/modules/debugging/rendering/debugrenderer.cpp index a84a0ff170..2860714987 100644 --- a/modules/debugging/rendering/debugrenderer.cpp +++ b/modules/debugging/rendering/debugrenderer.cpp @@ -35,9 +35,8 @@ #include namespace { - const std::string _loggerCat = "DebugRenderer"; -} - + const char* _loggerCat = "DebugRenderer"; +} // namespace namespace openspace { diff --git a/modules/debugging/rendering/debugshader_fs.glsl b/modules/debugging/rendering/debugshader_fs.glsl index e119339bef..1d3072700a 100644 --- a/modules/debugging/rendering/debugshader_fs.glsl +++ b/modules/debugging/rendering/debugshader_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * diff --git a/modules/debugging/rendering/debugshader_vs.glsl b/modules/debugging/rendering/debugshader_vs.glsl index 45f4357ad8..e078ea9f31 100644 --- a/modules/debugging/rendering/debugshader_vs.glsl +++ b/modules/debugging/rendering/debugshader_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * diff --git a/modules/debugging/rendering/renderabledebugplane.cpp b/modules/debugging/rendering/renderabledebugplane.cpp index 53278c1c42..1cc77421d2 100644 --- a/modules/debugging/rendering/renderabledebugplane.cpp +++ b/modules/debugging/rendering/renderabledebugplane.cpp @@ -40,8 +40,8 @@ #include namespace { - const std::string _loggerCat = "RenderablePlaneTexture"; -} + const char* _loggerCat = "RenderablePlaneTexture"; +} // namespace namespace openspace { @@ -49,7 +49,7 @@ RenderableDebugPlane::RenderableDebugPlane(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _texture("texture", "Texture", -1, -1, 255) , _billboard("billboard", "Billboard", false) - , _size("size", "Size", 10, 0, std::pow(10, 25)) + , _size("size", "Size", 10.f, 0.f, std::pow(10.f, 25.f)) , _origin(Origin::Center) , _shader(nullptr) , _quad(0) @@ -152,7 +152,7 @@ bool RenderableDebugPlane::deinitialize() { return true; } -void RenderableDebugPlane::render(const RenderData& data) { +void RenderableDebugPlane::render(const RenderData& data, RendererTasks&) { glm::mat4 transform = glm::mat4(1.0); if (_billboard) transform = glm::inverse(glm::mat4(data.camera.viewRotationMatrix())); @@ -175,7 +175,7 @@ void RenderableDebugPlane::render(const RenderData& data) { _shader->deactivate(); } -void RenderableDebugPlane::update(const UpdateData& data) { +void RenderableDebugPlane::update(const UpdateData&) { if (_shader->isDirty()) _shader->rebuildFromFile(); diff --git a/modules/debugging/rendering/renderabledebugplane.h b/modules/debugging/rendering/renderabledebugplane.h index 6a5aaafb6d..aa3dbd8fed 100644 --- a/modules/debugging/rendering/renderabledebugplane.h +++ b/modules/debugging/rendering/renderabledebugplane.h @@ -31,25 +31,17 @@ #include #include -namespace ghoul { - namespace filesystem { - class File; - } - namespace opengl { - class ProgramObject; - class Texture; - } -} +namespace ghoul::filesystem { class File; } +namespace ghoul::opengl { + class ProgramObject; + class Texture; +} // namespace ghoul::opengl namespace openspace { - struct LinePoint; -class RenderableDebugPlane: public Renderable { - - enum class Origin { - LowerLeft, LowerRight, UpperLeft, UpperRight, Center - }; +struct LinePoint; +class RenderableDebugPlane : public Renderable { public: RenderableDebugPlane(const ghoul::Dictionary& dictionary); ~RenderableDebugPlane(); @@ -59,10 +51,14 @@ public: bool isReady() const override; - void render(const RenderData& data) override; + void render(const RenderData& data, RendererTasks& rendererTask) override; void update(const UpdateData& data) override; private: + enum class Origin { + LowerLeft, LowerRight, UpperLeft, UpperRight, Center + }; + void createPlane(); properties::IntProperty _texture; diff --git a/modules/fieldlines/fieldlinesmodule.cpp b/modules/fieldlines/fieldlinesmodule.cpp index f677bd8d95..39f3fdf876 100644 --- a/modules/fieldlines/fieldlinesmodule.cpp +++ b/modules/fieldlines/fieldlinesmodule.cpp @@ -33,9 +33,7 @@ namespace openspace { -FieldlinesModule::FieldlinesModule() - : OpenSpaceModule(Name) -{} +FieldlinesModule::FieldlinesModule() : OpenSpaceModule(Name) {} void FieldlinesModule::internalInitialize() { auto fRenderable = FactoryManager::ref().factory(); diff --git a/modules/fieldlines/rendering/renderablefieldlines.cpp b/modules/fieldlines/rendering/renderablefieldlines.cpp index a6dc9e6f52..0240dc897e 100644 --- a/modules/fieldlines/rendering/renderablefieldlines.cpp +++ b/modules/fieldlines/rendering/renderablefieldlines.cpp @@ -70,7 +70,7 @@ namespace { const int SeedPointSourceFile = 0; const int SeedPointSourceTable = 1; -} +} // namespace namespace openspace { @@ -239,7 +239,7 @@ bool RenderableFieldlines::deinitialize() { return true; } -void RenderableFieldlines::render(const RenderData& data) { +void RenderableFieldlines::render(const RenderData& data, RendererTasks&) { _program->activate(); _program->setUniform("modelViewProjection", data.camera.viewProjectionMatrix()); _program->setUniform("modelTransform", glm::mat4(1.0)); diff --git a/modules/fieldlines/rendering/renderablefieldlines.h b/modules/fieldlines/rendering/renderablefieldlines.h index a6b28821b2..1827b83353 100644 --- a/modules/fieldlines/rendering/renderablefieldlines.h +++ b/modules/fieldlines/rendering/renderablefieldlines.h @@ -35,14 +35,11 @@ #include #include -namespace ghoul { -namespace opengl { - class ProgramObject; -} -} +namespace ghoul::opengl { class ProgramObject; } namespace openspace { - struct LinePoint; + +struct LinePoint; class RenderableFieldlines : public Renderable { public: @@ -53,7 +50,7 @@ public: bool isReady() const override; - void render(const RenderData& data) override; + void render(const RenderData& data, RendererTasks& rendererTask) override; void update(const UpdateData& data) override; private: diff --git a/modules/fieldlines/shaders/fieldline_fs.glsl b/modules/fieldlines/shaders/fieldline_fs.glsl index 879b1cfbc7..a3e103aa59 100644 --- a/modules/fieldlines/shaders/fieldline_fs.glsl +++ b/modules/fieldlines/shaders/fieldline_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,6 +22,9 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include "fragment.glsl" +#include "PowerScaling/powerScaling_fs.hglsl" + in vec4 gs_color; in vec4 gs_position; in vec3 gs_normal; @@ -30,43 +33,17 @@ uniform bool classification; uniform vec4 fieldLineColor; - -#include "fragment.glsl" -#include "PowerScaling/powerScaling_fs.hglsl" - - -Fragment getFragment() -{ - float alpha = 1-length(gs_normal)*length(gs_normal); - vec4 fragColor; - if (classification) - fragColor = vec4(gs_color.rgb * alpha, 1.0); - else - fragColor = vec4(fieldLineColor.rgb * fieldLineColor.a * alpha, 1.0); - - float depth = pscDepth(gs_position); +Fragment getFragment() { + const float alpha = 1 - length(gs_normal) * length(gs_normal); Fragment frag; - frag.depth = depth; - frag.color = fragColor; + if (classification) { + frag.color = vec4(gs_color.rgb * alpha, 1.0); + } + else { + frag.color = vec4(fieldLineColor.rgb * fieldLineColor.a * alpha, 1.0); + } + + frag.depth = pscDepth(gs_position); return frag; } - - - -// #include "ABuffer/abufferStruct.hglsl" -// #include "ABuffer/abufferAddToBuffer.hglsl" -// #include "PowerScaling/powerScaling_fs.hglsl" - -// void main() { -// float alpha = 1-length(gs_normal)*length(gs_normal); -// vec4 fragColor; -// if (classification) -// fragColor = vec4(gs_color.rgb, alpha); -// else -// fragColor = vec4(fieldLineColor.rgb, fieldLineColor.a * alpha); - -// float depth = pscDepth(gs_position); -// ABufferStruct_t frag = createGeometryFragment(fragColor, gs_position, depth); -// addToBuffer(frag); -// } diff --git a/modules/fieldlines/shaders/fieldline_gs.glsl b/modules/fieldlines/shaders/fieldline_gs.glsl index 35845bcc4e..4bc4b75cbb 100644 --- a/modules/fieldlines/shaders/fieldline_gs.glsl +++ b/modules/fieldlines/shaders/fieldline_gs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,19 +24,19 @@ #version __CONTEXT__ -uniform mat4 modelViewProjection; -uniform mat4 modelTransform; -uniform vec3 cameraViewDir; +#include "PowerScaling/powerScaling_vs.hglsl" +layout(lines_adjacency) in; in vec4 vs_color[]; + +layout(triangle_strip, max_vertices = 4) out; out vec4 gs_color; out vec4 gs_position; out vec3 gs_normal; -#include "PowerScaling/powerScaling_vs.hglsl" - -layout(lines_adjacency) in; -layout(triangle_strip, max_vertices = 4) out; +uniform mat4 modelViewProjection; +uniform mat4 modelTransform; +uniform vec3 cameraViewDir; vec4 prismoid[4]; @@ -61,14 +61,14 @@ void main() { vec3 p0, p1, p2, p3; p0 = gl_in[0].gl_Position.xyz; p1 = gl_in[1].gl_Position.xyz; p2 = gl_in[2].gl_Position.xyz; p3 = gl_in[3].gl_Position.xyz; - vec3 n0 = normalize(p1-p0); - vec3 n1 = normalize(p2-p1); - vec3 n2 = normalize(p3-p2); - vec3 u = normalize(n0+n1); - vec3 v = normalize(n1+n2); + vec3 n0 = normalize(p1 - p0); + vec3 n1 = normalize(p2 - p1); + vec3 n2 = normalize(p3 - p2); + vec3 u = normalize(n0 + n1); + vec3 v = normalize(n1 + n2); float EARTH_RADIUS = 6371000.0; - float width = 0.1*EARTH_RADIUS; + float width = 0.1 * EARTH_RADIUS; // Calculate normals for all 4 new vertices vec3 normals[4]; @@ -78,10 +78,10 @@ void main() { normals[2] = -normals[3]; // Calculate positions for the new vertices - prismoid[0] = vec4(p1 + normals[0]*width, 0); - prismoid[1] = vec4(p1 + normals[1]*width, 0); - prismoid[2] = vec4(p2 + normals[2]*width, 0); - prismoid[3] = vec4(p2 + normals[3]*width, 0); + prismoid[0] = vec4(p1 + normals[0] * width, 0.0); + prismoid[1] = vec4(p1 + normals[1] * width, 0.0); + prismoid[2] = vec4(p2 + normals[2] * width, 0.0); + prismoid[3] = vec4(p2 + normals[3] * width, 0.0); // Send normals and verticies to fragment shader gs_normal = normals[0]; @@ -95,5 +95,5 @@ void main() { gs_normal = normals[2]; ABufferEmitVertex(prismoid[2]); - EndPrimitive(); + EndPrimitive(); } diff --git a/modules/fieldlines/shaders/fieldline_vs.glsl b/modules/fieldlines/shaders/fieldline_vs.glsl index 394a48c14b..415b5f858e 100644 --- a/modules/fieldlines/shaders/fieldline_vs.glsl +++ b/modules/fieldlines/shaders/fieldline_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,17 +24,18 @@ #version __CONTEXT__ -uniform mat4 modelViewProjection; -uniform mat4 modelTransform; +#include "PowerScaling/powerScaling_vs.hglsl" layout(location = 0) in vec3 in_position; layout(location = 1) in vec4 in_color; out vec4 vs_color; -#include "PowerScaling/powerScaling_vs.hglsl" +uniform mat4 modelViewProjection; +uniform mat4 modelTransform; -void main() { + +void main() { vs_color = in_color; gl_Position = vec4(in_position, 0); } diff --git a/modules/galaxy/rendering/galaxyraycaster.h b/modules/galaxy/rendering/galaxyraycaster.h index b65e08eff6..f3ea1a32e2 100644 --- a/modules/galaxy/rendering/galaxyraycaster.h +++ b/modules/galaxy/rendering/galaxyraycaster.h @@ -34,18 +34,16 @@ #include #include -namespace ghoul { - namespace opengl { - class Texture; - class TextureUnit; - class ProgramObject; - } -} +namespace ghoul::opengl { + class Texture; + class TextureUnit; + class ProgramObject; +} // namespace ghoul::opengl namespace openspace { struct RenderData; -class RaycastData; +struct RaycastData; class GalaxyRaycaster : public VolumeRaycaster { public: diff --git a/modules/galaxy/rendering/renderablegalaxy.cpp b/modules/galaxy/rendering/renderablegalaxy.cpp index 2d7cd49bd2..9146885392 100644 --- a/modules/galaxy/rendering/renderablegalaxy.cpp +++ b/modules/galaxy/rendering/renderablegalaxy.cpp @@ -186,8 +186,6 @@ bool RenderableGalaxy::initialize() { float maxdist = 0; - - float x, y, z, r, g, b, a; for (size_t i = 0; i < _nPoints; ++i) { float x = pointData[i * 7 + 0]; float y = pointData[i * 7 + 1]; diff --git a/modules/galaxy/shaders/galaxyraycast.glsl b/modules/galaxy/shaders/galaxyraycast.glsl index 7bdf9d9dd3..8132f1a432 100644 --- a/modules/galaxy/shaders/galaxyraycast.glsl +++ b/modules/galaxy/shaders/galaxyraycast.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2016 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -32,17 +32,17 @@ void sample#{id}(vec3 samplePos, vec3 dir, inout vec3 accumulatedColor, inout vec3 accumulatedAlpha, - inout float maxStepSize) { - + inout float maxStepSize) +{ + vec3 aspect = aspect#{id}; - maxStepSize = maxStepSize#{id} / length(dir/aspect); + maxStepSize = maxStepSize#{id} / length(dir / aspect); vec4 sampledColor = texture(galaxyTexture#{id}, samplePos.xyz); float STEP_SIZE = maxStepSize#{id}; vec3 alphaTint = vec3(0.3, 0.54, 0.85); - //alphaTint = vec3(0.0, 0.5, 1.0); sampledColor = sampledColor*sampledColor; sampledColor.a = pow(sampledColor.a, 0.7); @@ -86,12 +86,8 @@ void sample#{id}(vec3 samplePos, vec3 oneMinusFrontAlpha = vec3(1.0) - accumulatedAlpha; accumulatedColor += oneMinusFrontAlpha * backColor; accumulatedAlpha += oneMinusFrontAlpha * backAlpha; - - // acc+= 1.0; - - //accumulatedColor = vec3(opacityCoefficient#{id}); } float stepSize#{id}(vec3 samplePos, vec3 dir) { - return maxStepSize#{id} * length(dir * 1.0/aspect#{id}); + return maxStepSize#{id} * length(dir * 1.0 / aspect#{id}); } diff --git a/modules/galaxy/shaders/points.fs b/modules/galaxy/shaders/points.fs index 5ab9374fc8..810b75863d 100644 --- a/modules/galaxy/shaders/points.fs +++ b/modules/galaxy/shaders/points.fs @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,26 +22,22 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -uniform float emittanceFactor; +#include "fragment.glsl" +#include "PowerScaling/powerScaling_fs.hglsl" in vec3 vsPosition; in vec3 vsColor; -#include "fragment.glsl" -#include "PowerScaling/powerScaling_fs.hglsl" +uniform float emittanceFactor; + Fragment getFragment() { - vec4 color = vec4(vsColor, 1.0); - Fragment frag; - float depth = pscDepth(vec4(vsPosition, 0.0)); - - float coefficient = exp(1.38 * log(emittanceFactor) - 2*log(depth)); + const float coefficient = exp(1.38 * log(emittanceFactor) - 2*log(depth)); frag.color = vec4(vsColor.rgb * coefficient, 1.0); - - frag.depth = depth; + frag.depth = pscDepth(vec4(vsPosition, 0.0)); return frag; } diff --git a/modules/galaxy/shaders/points.vs b/modules/galaxy/shaders/points.vs index b4b3f5dfb3..94effc2889 100644 --- a/modules/galaxy/shaders/points.vs +++ b/modules/galaxy/shaders/points.vs @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,9 +24,7 @@ #version __CONTEXT__ -uniform mat4 model; -uniform mat4 view; -uniform mat4 projection; +#include "PowerScaling/powerScaling_vs.hglsl" in vec3 inPosition; in vec3 inColor; @@ -34,15 +32,17 @@ in vec3 inColor; out vec3 vsPosition; out vec3 vsColor; +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; -#include "PowerScaling/powerScaling_vs.hglsl" -void main() { +void main() { vec4 p = vec4(inPosition, 1.0); - vec4 worldPosition = model * p; + vec4 worldPosition = model * vec4(inPosition, 1.0); worldPosition.w = 0.0; - vec4 position = worldPosition; //pscTransform(worldPosition, model); + vec4 position = worldPosition; //pscTransform(worldPosition, model); position = pscTransform(position, mat4(1.0)); diff --git a/modules/galaxy/shaders/raycasterbounds.fs b/modules/galaxy/shaders/raycasterbounds.fs index 76b85b859b..d4d1027dac 100644 --- a/modules/galaxy/shaders/raycasterbounds.fs +++ b/modules/galaxy/shaders/raycasterbounds.fs @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,21 +22,21 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include "PowerScaling/powerScaling_fs.hglsl" +#include "fragment.glsl" + in vec3 vPosition; in vec4 worldPosition; uniform uint blendMode; -#include "PowerScaling/powerScaling_fs.hglsl" -#include "fragment.glsl" Fragment getFragment() { - vec4 fragColor = vec4((vPosition+0.5), 1.0); - vec4 position = worldPosition; - float depth = pscDepth(position); + const vec4 position = worldPosition; + const float depth = pscDepth(position); Fragment frag; - frag.color = fragColor; + frag.color = vec4((vPosition + 0.5), 1.0); frag.depth = depth; frag.blend = blendMode; return frag; diff --git a/modules/galaxy/shaders/raycasterbounds.vs b/modules/galaxy/shaders/raycasterbounds.vs index a304a22d03..b1f5014578 100644 --- a/modules/galaxy/shaders/raycasterbounds.vs +++ b/modules/galaxy/shaders/raycasterbounds.vs @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2016 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -21,29 +21,26 @@ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ - + #version __CONTEXT__ -layout(location = 0) in vec4 vertPosition; +#include "PowerScaling/powerScaling_vs.hglsl" -uniform mat4 viewProjection; -uniform mat4 modelTransform; +layout(location = 0) in vec4 vertPosition; out vec3 vPosition; out vec4 worldPosition; -#include "PowerScaling/powerScaling_vs.hglsl" +uniform mat4 viewProjection; +uniform mat4 modelTransform; + void main() { - vPosition = vertPosition.xyz; + vPosition = vertPosition.xyz; - worldPosition = modelTransform * vec4(vertPosition.xyz, 1.0); + worldPosition = modelTransform * vec4(vertPosition.xyz, 1.0); worldPosition.w = 0.0; - vec4 position = pscTransform(worldPosition, mat4(1.0)); + const vec4 position = pscTransform(worldPosition, mat4(1.0)); - - - // project the position to view space gl_Position = z_normalization(viewProjection * position); - //gl_Position.z = 1.0; } diff --git a/modules/galaxy/tasks/milkywayconversiontask.h b/modules/galaxy/tasks/milkywayconversiontask.h index 4e00b9c975..4c1897457a 100644 --- a/modules/galaxy/tasks/milkywayconversiontask.h +++ b/modules/galaxy/tasks/milkywayconversiontask.h @@ -32,10 +32,9 @@ #include #include - namespace openspace { -namespace documentation { struct Documentation; } +namespace documentation { struct Documentation; } /** * Converts a set of exr image slices to a raw volume @@ -58,6 +57,6 @@ private: glm::ivec3 _outDimensions; }; -} +} // namespace openspace #endif // __OPENSPACE_MODULE_GALAXY___MILKYWAYCONVERSIONTASK___H__ diff --git a/modules/galaxy/tasks/milkywaypointsconversiontask.cpp b/modules/galaxy/tasks/milkywaypointsconversiontask.cpp index 0df1bcdb1f..eb8b61c0be 100644 --- a/modules/galaxy/tasks/milkywaypointsconversiontask.cpp +++ b/modules/galaxy/tasks/milkywaypointsconversiontask.cpp @@ -42,7 +42,7 @@ namespace openspace { : _inFilename(inFilename) , _outFilename(outFilename) {}*/ -MilkywayPointsConversionTask::MilkywayPointsConversionTask(const ghoul::Dictionary & dictionary) {} +MilkywayPointsConversionTask::MilkywayPointsConversionTask(const ghoul::Dictionary&) {} MilkywayPointsConversionTask::~MilkywayPointsConversionTask() {} @@ -64,7 +64,7 @@ void MilkywayPointsConversionTask::perform(const Task::ProgressCallback & progre std::vector pointData(nFloats); float x, y, z, r, g, b, a; - for (size_t i = 0; i < nPoints; ++i) { + for (int64_t i = 0; i < nPoints; ++i) { in >> x >> y >> z >> r >> g >> b >> a; if (in.good()) { pointData[i * 7 + 0] = x; diff --git a/modules/galaxy/tasks/milkywaypointsconversiontask.h b/modules/galaxy/tasks/milkywaypointsconversiontask.h index d20eb4bcef..296da7f3ba 100644 --- a/modules/galaxy/tasks/milkywaypointsconversiontask.h +++ b/modules/galaxy/tasks/milkywaypointsconversiontask.h @@ -32,7 +32,6 @@ #include #include - namespace openspace { namespace documentation { struct Documentation; } @@ -56,6 +55,6 @@ private: std::string _outFilename; }; -} +} // namespace openspace #endif // __OPENSPACE_MODULE_GALAXY___MILKYWAYPOINTSCONVERSIONTASK_H__ diff --git a/modules/globebrowsing/cache/lrucache.h b/modules/globebrowsing/cache/lrucache.h index 8ebf224a9c..7f7b55c6d9 100644 --- a/modules/globebrowsing/cache/lrucache.h +++ b/modules/globebrowsing/cache/lrucache.h @@ -29,9 +29,7 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace cache { +namespace openspace::globebrowsing::cache { /** * Templated class implementing a Least-Recently-Used Cache. @@ -83,9 +81,7 @@ private: size_t _maximumCacheSize; }; -} // namespace cache -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::cache #include diff --git a/modules/globebrowsing/cache/lrucache.inl b/modules/globebrowsing/cache/lrucache.inl index 47c0eb4126..2e2c7b8403 100644 --- a/modules/globebrowsing/cache/lrucache.inl +++ b/modules/globebrowsing/cache/lrucache.inl @@ -24,9 +24,7 @@ #include -namespace openspace { -namespace globebrowsing { -namespace cache { +namespace openspace::globebrowsing::cache { template LRUCache::LRUCache(size_t size) @@ -163,6 +161,4 @@ LRUCache::cleanAndFetchPopped() return toReturn; } -} // namespace cache -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::cache diff --git a/modules/globebrowsing/cache/memoryawaretilecache.cpp b/modules/globebrowsing/cache/memoryawaretilecache.cpp index 98f439f700..b507e4f35f 100644 --- a/modules/globebrowsing/cache/memoryawaretilecache.cpp +++ b/modules/globebrowsing/cache/memoryawaretilecache.cpp @@ -35,13 +35,11 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace cache { - namespace { const char* _loggerCat = "MemoryAwareTileCache"; -} +} // namespace + +namespace openspace::globebrowsing::cache { MemoryAwareTileCache::MemoryAwareTileCache() : PropertyOwner("TileCache") @@ -80,11 +78,14 @@ MemoryAwareTileCache::MemoryAwareTileCache() setSizeEstimated(_tileCacheSize * 1024 * 1024); }); _cpuAllocatedTileData.setMaxValue( - CpuCap.installedMainMemory() * 0.25); + static_cast(CpuCap.installedMainMemory() * 0.25) + ); _gpuAllocatedTileData.setMaxValue( - CpuCap.installedMainMemory() * 0.25); + static_cast(CpuCap.installedMainMemory() * 0.25) + ); _tileCacheSize.setMaxValue( - CpuCap.installedMainMemory() * 0.25); + static_cast(CpuCap.installedMainMemory() * 0.25) + ); setSizeEstimated(_tileCacheSize * 1024 * 1024); @@ -262,10 +263,13 @@ void MemoryAwareTileCache::put(const ProviderTileKey& key, } void MemoryAwareTileCache::update() { - size_t dataSizeCPU = getCPUAllocatedDataSize(); - size_t dataSizeGPU = getGPUAllocatedDataSize(); - _cpuAllocatedTileData.setValue(dataSizeCPU / 1024 / 1024); - _gpuAllocatedTileData.setValue(dataSizeGPU / 1024 / 1024); + const size_t dataSizeCPU = getCPUAllocatedDataSize(); + const size_t dataSizeGPU = getGPUAllocatedDataSize(); + + const size_t ByteToMegaByte = 1024 * 1024; + + _cpuAllocatedTileData.setValue(dataSizeCPU / ByteToMegaByte); + _gpuAllocatedTileData.setValue(dataSizeGPU / ByteToMegaByte); } size_t MemoryAwareTileCache::getGPUAllocatedDataSize() const { @@ -306,7 +310,4 @@ bool MemoryAwareTileCache::shouldUsePbo() const { return _usePbo; } -} // namespace cache -} // namespace globebrowsing -} // namespace openspace - +} // namespace openspace::globebrowsing::cache diff --git a/modules/globebrowsing/cache/memoryawaretilecache.h b/modules/globebrowsing/cache/memoryawaretilecache.h index 21f2d26dcc..f69b6d03b4 100644 --- a/modules/globebrowsing/cache/memoryawaretilecache.h +++ b/modules/globebrowsing/cache/memoryawaretilecache.h @@ -41,9 +41,7 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace cache { +namespace openspace::globebrowsing::cache { struct ProviderTileKey { TileIndex tileIndex; @@ -87,7 +85,6 @@ struct ProviderTileHasher { class MemoryAwareTileCache : public properties::PropertyOwner { public: - MemoryAwareTileCache(); ~MemoryAwareTileCache(); @@ -131,8 +128,6 @@ private: properties::BoolProperty _usePbo; }; -} // namespace cache -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::cache #endif // __OPENSPACE_MODULE_GLOBEBROWSING___MEMORY_AWARE_TILE_CACHE___H__ diff --git a/modules/globebrowsing/cache/texturecontainer.cpp b/modules/globebrowsing/cache/texturecontainer.cpp index 5e7b4ccfc2..c0a49a3b5c 100644 --- a/modules/globebrowsing/cache/texturecontainer.cpp +++ b/modules/globebrowsing/cache/texturecontainer.cpp @@ -25,9 +25,7 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace cache { +namespace openspace::globebrowsing::cache { TextureContainer::TextureContainer(TileTextureInitData initData, size_t numTextures) : _initData(initData) @@ -86,6 +84,4 @@ size_t TextureContainer::size() const { return _textures.size(); }; -} -} -} +} // namespace openspace::globebrowsing::cache diff --git a/modules/globebrowsing/cache/texturecontainer.h b/modules/globebrowsing/cache/texturecontainer.h index bcab70e17c..abfb2a0b92 100644 --- a/modules/globebrowsing/cache/texturecontainer.h +++ b/modules/globebrowsing/cache/texturecontainer.h @@ -30,16 +30,13 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace cache { +namespace openspace::globebrowsing::cache { /** * Owner of texture data used for tiles. Instead of dynamically allocating textures one * by one, they are created once and reused. */ -class TextureContainer -{ +class TextureContainer { public: /** * \param initData is the description of the texture type. @@ -74,8 +71,6 @@ private: size_t _numTextures; }; -} // namespace cache -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::cache #endif // __OPENSPACE_MODULE_GLOBEBROWSING___TEXTURE_CONTAINER___H__ diff --git a/modules/globebrowsing/chunk/chunk.cpp b/modules/globebrowsing/chunk/chunk.cpp index dca2d4697d..ad4327be84 100644 --- a/modules/globebrowsing/chunk/chunk.cpp +++ b/modules/globebrowsing/chunk/chunk.cpp @@ -32,9 +32,7 @@ #include #include - -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { const float Chunk::DEFAULT_HEIGHT = 0.0f; @@ -64,7 +62,7 @@ bool Chunk::isVisible() const { Chunk::Status Chunk::update(const RenderData& data) { const auto& savedCamera = _owner.savedCamera(); const Camera& camRef = savedCamera != nullptr ? *savedCamera : data.camera; - RenderData myRenderData = { camRef, data.position, data.doPerformanceMeasurement, data.doPerformanceMeasurement, data.renderBinMask, data.modelTransform }; + RenderData myRenderData = { camRef, data.position, data.time, data.doPerformanceMeasurement, data.renderBinMask, data.modelTransform }; _isVisible = true; if (_owner.chunkedLodGlobe()->testIfCullable(*this, myRenderData)) { @@ -222,5 +220,4 @@ std::vector Chunk::getBoundingPolyhedronCorners() const { return corners; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/chunk/chunk.h b/modules/globebrowsing/chunk/chunk.h index c235fa4525..3a2d97f4de 100644 --- a/modules/globebrowsing/chunk/chunk.h +++ b/modules/globebrowsing/chunk/chunk.h @@ -32,11 +32,9 @@ #include -namespace openspace { +namespace openspace { struct RenderData; } -struct RenderData; - -namespace globebrowsing { +namespace openspace::globebrowsing { class RenderableGlobe; struct TileIndex; @@ -101,7 +99,6 @@ private: const GeodeticPatch _surfacePatch; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___CHUNK___H__ diff --git a/modules/globebrowsing/chunk/chunklevelevaluator/availabletiledataevaluator.cpp b/modules/globebrowsing/chunk/chunklevelevaluator/availabletiledataevaluator.cpp index 8191439767..bb2c1856a0 100644 --- a/modules/globebrowsing/chunk/chunklevelevaluator/availabletiledataevaluator.cpp +++ b/modules/globebrowsing/chunk/chunklevelevaluator/availabletiledataevaluator.cpp @@ -31,11 +31,9 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace chunklevelevaluator { +namespace openspace::globebrowsing::chunklevelevaluator { -int AvailableTileData::getDesiredLevel(const Chunk& chunk, const RenderData& data) const { +int AvailableTileData::getDesiredLevel(const Chunk& chunk, const RenderData&) const { auto layerManager = chunk.owner().chunkedLodGlobe()->layerManager(); // auto layers = layerManager->layerGroup(LayerManager::HeightLayers).activeLayers(); int currLevel = chunk.tileIndex().level; @@ -52,6 +50,4 @@ int AvailableTileData::getDesiredLevel(const Chunk& chunk, const RenderData& dat return currLevel - 1; } -} // namespace chunklevelevaluator -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::chunklevelevaluator diff --git a/modules/globebrowsing/chunk/chunklevelevaluator/availabletiledataevaluator.h b/modules/globebrowsing/chunk/chunklevelevaluator/availabletiledataevaluator.h index f0ac953813..d9a55aaabf 100644 --- a/modules/globebrowsing/chunk/chunklevelevaluator/availabletiledataevaluator.h +++ b/modules/globebrowsing/chunk/chunklevelevaluator/availabletiledataevaluator.h @@ -27,9 +27,7 @@ #include -namespace openspace { -namespace globebrowsing { -namespace chunklevelevaluator { +namespace openspace::globebrowsing::chunklevelevaluator { /** * If this chunk has available tile data for any LayerGroup on any of its active @@ -42,8 +40,6 @@ public: int getDesiredLevel(const Chunk& chunk, const RenderData& data) const override; }; -} // namespace chunklevelevaluator -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::chunklevelevaluator #endif // __OPENSPACE_MODULE_GLOBEBROWSING___AVAILABLETILEDATAEVALUATOR___H__ diff --git a/modules/globebrowsing/chunk/chunklevelevaluator/chunklevelevaluator.h b/modules/globebrowsing/chunk/chunklevelevaluator/chunklevelevaluator.h index 2634174bd7..1cf54ce448 100644 --- a/modules/globebrowsing/chunk/chunklevelevaluator/chunklevelevaluator.h +++ b/modules/globebrowsing/chunk/chunklevelevaluator/chunklevelevaluator.h @@ -25,15 +25,11 @@ #ifndef __OPENSPACE_MODULE_GLOBEBROWSING___CHUNKLEVELEVALUATOR___H__ #define __OPENSPACE_MODULE_GLOBEBROWSING___CHUNKLEVELEVALUATOR___H__ -namespace openspace { +namespace openspace { struct RenderData; } -struct RenderData; - -namespace globebrowsing { - -class Chunk; +namespace openspace::globebrowsing { class Chunk; } -namespace chunklevelevaluator { +namespace openspace::globebrowsing::chunklevelevaluator { /** * Abstract class defining an interface for accessing a desired level of a Chunk. @@ -48,8 +44,6 @@ public: virtual int getDesiredLevel(const Chunk& chunk, const RenderData& data) const = 0; }; -} // namespace chunklevelevaluator -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::chunklevelevaluator #endif // __OPENSPACE_MODULE_GLOBEBROWSING___CHUNKLEVELEVALUATOR___H__ diff --git a/modules/globebrowsing/chunk/chunklevelevaluator/distanceevaluator.cpp b/modules/globebrowsing/chunk/chunklevelevaluator/distanceevaluator.cpp index 73624a9e26..2afc4f290c 100644 --- a/modules/globebrowsing/chunk/chunklevelevaluator/distanceevaluator.cpp +++ b/modules/globebrowsing/chunk/chunklevelevaluator/distanceevaluator.cpp @@ -31,9 +31,7 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace chunklevelevaluator { +namespace openspace::globebrowsing::chunklevelevaluator { int Distance::getDesiredLevel(const Chunk& chunk, const RenderData& data) const { // Calculations are done in the reference frame of the globe @@ -71,6 +69,4 @@ int Distance::getDesiredLevel(const Chunk& chunk, const RenderData& data) const return desiredLevel; } -} // namespace chunklevelevaluator -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::chunklevelevaluator diff --git a/modules/globebrowsing/chunk/chunklevelevaluator/distanceevaluator.h b/modules/globebrowsing/chunk/chunklevelevaluator/distanceevaluator.h index ead3ba050d..e602296559 100644 --- a/modules/globebrowsing/chunk/chunklevelevaluator/distanceevaluator.h +++ b/modules/globebrowsing/chunk/chunklevelevaluator/distanceevaluator.h @@ -27,9 +27,7 @@ #include -namespace openspace { -namespace globebrowsing { -namespace chunklevelevaluator { +namespace openspace::globebrowsing::chunklevelevaluator { /** * Evaluate the Chunk level depending on the distance from the Camera to the Chunk. @@ -41,8 +39,6 @@ public: int getDesiredLevel(const Chunk& chunk, const RenderData& data) const override; }; -} // namespace chunklevelevaluator -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::chunklevelevaluator #endif // __OPENSPACE_MODULE_GLOBEBROWSING___DISTANCEEVALUATOR___H__ diff --git a/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.cpp b/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.cpp index 31514dc6c5..2bbb6f4a32 100644 --- a/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.cpp +++ b/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.cpp @@ -31,9 +31,7 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace chunklevelevaluator { +namespace openspace::globebrowsing::chunklevelevaluator { int ProjectedArea::getDesiredLevel(const Chunk& chunk, const RenderData& data) const { // Calculations are done in the reference frame of the globe @@ -122,9 +120,7 @@ int ProjectedArea::getDesiredLevel(const Chunk& chunk, const RenderData& data) c double scaledArea = globe.generalProperties().lodScaleFactor * projectedChunkAreaApprox; - return chunk.tileIndex().level + round(scaledArea - 1); + return chunk.tileIndex().level + static_cast(round(scaledArea - 1)); } -} // namespace chunklevelevaluator -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::chunklevelevaluator diff --git a/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.h b/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.h index 0bd0bee3f1..2db4b76450 100644 --- a/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.h +++ b/modules/globebrowsing/chunk/chunklevelevaluator/projectedareaevaluator.h @@ -27,9 +27,7 @@ #include -namespace openspace { -namespace globebrowsing { -namespace chunklevelevaluator { +namespace openspace::globebrowsing::chunklevelevaluator { /** * Evaluate the chunk level using the area of the non-heightmapped Chunk projected @@ -43,9 +41,6 @@ public: virtual int getDesiredLevel(const Chunk& chunk, const RenderData& data) const; }; - -} // namespace chunklevelevaluator -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::chunklevelevaluator #endif // __OPENSPACE_MODULE_GLOBEBROWSING___PROJECTEDAREAEVALUATOR___H__ diff --git a/modules/globebrowsing/chunk/chunknode.cpp b/modules/globebrowsing/chunk/chunknode.cpp index 9b229cc54f..e600f29884 100644 --- a/modules/globebrowsing/chunk/chunknode.cpp +++ b/modules/globebrowsing/chunk/chunknode.cpp @@ -29,8 +29,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { ChunkNode::ChunkNode(const Chunk& chunk, ChunkNode* parent) : _parent(parent) @@ -186,5 +185,4 @@ const Chunk& ChunkNode::getChunk() const { return _chunk; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/chunk/chunknode.h b/modules/globebrowsing/chunk/chunknode.h index 09ff70d302..02a4ef0abd 100644 --- a/modules/globebrowsing/chunk/chunknode.h +++ b/modules/globebrowsing/chunk/chunknode.h @@ -31,8 +31,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class ChunkedLodGlobe; @@ -80,7 +79,6 @@ private: Chunk _chunk; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___CHUNKNODE___H__ diff --git a/modules/globebrowsing/chunk/culling/chunkculler.h b/modules/globebrowsing/chunk/culling/chunkculler.h index 9c09e55c8e..7b0678ac83 100644 --- a/modules/globebrowsing/chunk/culling/chunkculler.h +++ b/modules/globebrowsing/chunk/culling/chunkculler.h @@ -25,15 +25,10 @@ #ifndef __OPENSPACE_MODULE_GLOBEBROWSING___CHUNKCULLER___H__ #define __OPENSPACE_MODULE_GLOBEBROWSING___CHUNKCULLER___H__ -namespace openspace { +namespace openspace { struct RenderData; } +namespace openspace::globebrowsing { class Chunk; } -struct RenderData; - -namespace globebrowsing { - -class Chunk; - -namespace culling { +namespace openspace::globebrowsing::culling { class ChunkCuller { public: @@ -46,8 +41,6 @@ public: virtual bool isCullable(const Chunk& chunk, const RenderData& renderData) = 0; }; -} // namespace culling -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::culling #endif // __OPENSPACE_MODULE_GLOBEBROWSING___CHUNKCULLER___H__ diff --git a/modules/globebrowsing/chunk/culling/frustumculler.cpp b/modules/globebrowsing/chunk/culling/frustumculler.cpp index 8d3c5ee849..573f94da24 100644 --- a/modules/globebrowsing/chunk/culling/frustumculler.cpp +++ b/modules/globebrowsing/chunk/culling/frustumculler.cpp @@ -28,9 +28,7 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace culling { +namespace openspace::globebrowsing::culling { FrustumCuller::FrustumCuller(AABB3 viewFrustum) : _viewFrustum(std::move(viewFrustum)) @@ -59,6 +57,4 @@ bool FrustumCuller::isCullable(const Chunk& chunk, const RenderData& data) { return !(_viewFrustum.intersects(bounds)); } -} // namespace culling -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::culling diff --git a/modules/globebrowsing/chunk/culling/frustumculler.h b/modules/globebrowsing/chunk/culling/frustumculler.h index 28cb74287f..2b0f2e3c3a 100644 --- a/modules/globebrowsing/chunk/culling/frustumculler.h +++ b/modules/globebrowsing/chunk/culling/frustumculler.h @@ -29,9 +29,7 @@ #include -namespace openspace { -namespace globebrowsing { -namespace culling { +namespace openspace::globebrowsing::culling { /** * Culls all chunks that are completely outside the view frustum. @@ -56,8 +54,6 @@ private: const AABB3 _viewFrustum; }; -} // namespace culling -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::culling #endif // __OPENSPACE_MODULE_GLOBEBROWSING___FRUSTUMCULLER___H__ diff --git a/modules/globebrowsing/chunk/culling/horizonculler.cpp b/modules/globebrowsing/chunk/culling/horizonculler.cpp index c7c62a89bd..8f4577c7a6 100644 --- a/modules/globebrowsing/chunk/culling/horizonculler.cpp +++ b/modules/globebrowsing/chunk/culling/horizonculler.cpp @@ -28,9 +28,7 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace culling { +namespace openspace::globebrowsing::culling { bool HorizonCuller::isCullable(const Chunk& chunk, const RenderData& data) { // Calculations are done in the reference frame of the globe. Hence, the camera @@ -58,16 +56,20 @@ bool HorizonCuller::isCullable(const Chunk& chunk, const RenderData& data) { // real closest point, glm::dvec3 corners[4]; corners[0] = ellipsoid.cartesianSurfacePosition( - chunk.surfacePatch().getCorner(NORTH_WEST)); + chunk.surfacePatch().getCorner(NORTH_WEST) + ); corners[1] = ellipsoid.cartesianSurfacePosition( - chunk.surfacePatch().getCorner(NORTH_EAST)); + chunk.surfacePatch().getCorner(NORTH_EAST) + ); corners[2] = ellipsoid.cartesianSurfacePosition( - chunk.surfacePatch().getCorner(SOUTH_WEST)); + chunk.surfacePatch().getCorner(SOUTH_WEST) + ); corners[3] = ellipsoid.cartesianSurfacePosition( - chunk.surfacePatch().getCorner(SOUTH_EAST)); + chunk.surfacePatch().getCorner(SOUTH_EAST) + ); for (int i = 0; i < 4; ++i) { - float distance = glm::length(cameraPosition - corners[i]); + double distance = glm::length(cameraPosition - corners[i]); if (distance < glm::length(cameraPosition - objectPosition)) { objectPosition = corners[i]; } @@ -100,6 +102,4 @@ bool HorizonCuller::isCullable(const glm::dvec3& cameraPosition, return distanceToObjectSquared > minimumAllowedDistanceToObjectSquared; } -} // namespace culling -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::culling diff --git a/modules/globebrowsing/chunk/culling/horizonculler.h b/modules/globebrowsing/chunk/culling/horizonculler.h index 8823796c9e..bd14bef947 100644 --- a/modules/globebrowsing/chunk/culling/horizonculler.h +++ b/modules/globebrowsing/chunk/culling/horizonculler.h @@ -29,9 +29,7 @@ #include -namespace openspace { -namespace globebrowsing { -namespace culling { +namespace openspace::globebrowsing::culling { /** * In this implementation of the horizon culling, the closer the ellipsoid is to a @@ -50,8 +48,6 @@ private: double minimumGlobeRadius); }; -} // namespace culling -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::culling #endif // __OPENSPACE_MODULE_GLOBEBROWSING___HORIZONCULLER___H__ diff --git a/modules/globebrowsing/geometry/aabb.cpp b/modules/globebrowsing/geometry/aabb.cpp index d9e47cc691..e1280219ef 100644 --- a/modules/globebrowsing/geometry/aabb.cpp +++ b/modules/globebrowsing/geometry/aabb.cpp @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { AABB1::AABB1() : AABB1(std::numeric_limits::max(), -std::numeric_limits::max()) @@ -185,5 +184,4 @@ AABB3::AABBSpatialRelation AABB3::relationTo(const AABB3& o) const { return AABB3::AABBSpatialRelation::None; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/geometry/aabb.h b/modules/globebrowsing/geometry/aabb.h index 5277230fcb..d5793ad282 100644 --- a/modules/globebrowsing/geometry/aabb.h +++ b/modules/globebrowsing/geometry/aabb.h @@ -27,8 +27,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct AABB1 { enum class AABBSpatialRelation { @@ -99,7 +98,6 @@ struct AABB3 { glm::vec3 max; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___AABB___H__ diff --git a/modules/globebrowsing/geometry/angle.h b/modules/globebrowsing/geometry/angle.h index 1963f0d0a2..bc51a27dd9 100644 --- a/modules/globebrowsing/geometry/angle.h +++ b/modules/globebrowsing/geometry/angle.h @@ -29,8 +29,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { template class Angle { @@ -129,8 +128,7 @@ private: using dAngle = Angle; using fAngle = Angle; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #include diff --git a/modules/globebrowsing/geometry/angle.inl b/modules/globebrowsing/geometry/angle.inl index f84431f91f..f814464b1a 100644 --- a/modules/globebrowsing/geometry/angle.inl +++ b/modules/globebrowsing/geometry/angle.inl @@ -24,8 +24,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { template const T Angle::PI = 3.14159265358979323846264338327950; @@ -240,5 +239,4 @@ Angle Angle::getAbs() const { return Angle(*this).abs(); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/geometry/ellipsoid.cpp b/modules/globebrowsing/geometry/ellipsoid.cpp index 9d51d762d2..020f4da2d6 100644 --- a/modules/globebrowsing/geometry/ellipsoid.cpp +++ b/modules/globebrowsing/geometry/ellipsoid.cpp @@ -27,8 +27,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { Ellipsoid::Ellipsoid(glm::dvec3 radii) : _radii(radii) { updateInternalCache(); @@ -132,7 +131,7 @@ double Ellipsoid::longitudalDistance(double lat, double lon1, double lon2) const return meanRadius * std::abs(lon2 - lon1); } -double Ellipsoid::greatCircleDistance(const Geodetic2& p1, const Geodetic2& p2) const{ +double Ellipsoid::greatCircleDistance(const Geodetic2& p1, const Geodetic2& p2) const { // https://en.wikipedia.org/wiki/Meridian_arc // https://en.wikipedia.org/wiki/Great-circle_distance#Vector_version @@ -146,22 +145,19 @@ double Ellipsoid::greatCircleDistance(const Geodetic2& p1, const Geodetic2& p2) return centralAngle * glm::length(centralNormal); } -Geodetic2 Ellipsoid::cartesianToGeodetic2(const glm::dvec3& p) const -{ +Geodetic2 Ellipsoid::cartesianToGeodetic2(const glm::dvec3& p) const { glm::dvec3 normal = geodeticSurfaceNormalForGeocentricallyProjectedPoint(p); return Geodetic2( asin(normal.z / length(normal)), // Latitude atan2(normal.y, normal.x)); // Longitude } -glm::dvec3 Ellipsoid::cartesianSurfacePosition(const Geodetic2& geodetic2) const -{ +glm::dvec3 Ellipsoid::cartesianSurfacePosition(const Geodetic2& geodetic2) const { // Position on surface : height = 0 return cartesianPosition(Geodetic3({ geodetic2, 0 })); } -glm::dvec3 Ellipsoid::cartesianPosition(const Geodetic3& geodetic3) const -{ +glm::dvec3 Ellipsoid::cartesianPosition(const Geodetic3& geodetic3) const { glm::dvec3 normal = geodeticSurfaceNormal(geodetic3.geodetic2); glm::dvec3 k = _cached._radiiSquared * normal; double gamma = sqrt(dot(k, normal)); @@ -169,5 +165,4 @@ glm::dvec3 Ellipsoid::cartesianPosition(const Geodetic3& geodetic3) const return rSurface + geodetic3.height * normal; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/geometry/ellipsoid.h b/modules/globebrowsing/geometry/ellipsoid.h index 9dac318f5b..88310c86a6 100644 --- a/modules/globebrowsing/geometry/ellipsoid.h +++ b/modules/globebrowsing/geometry/ellipsoid.h @@ -30,8 +30,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { /** * This class is based largely on the Ellipsoid class defined in the book @@ -99,7 +98,6 @@ private: glm::dvec3 _radii; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___ELLIPSOID___H__ diff --git a/modules/globebrowsing/geometry/geodetic2.cpp b/modules/globebrowsing/geometry/geodetic2.cpp index b97d0a2e5e..5935ba80ae 100644 --- a/modules/globebrowsing/geometry/geodetic2.cpp +++ b/modules/globebrowsing/geometry/geodetic2.cpp @@ -24,8 +24,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { Geodetic2::Geodetic2(double latitude, double longitude) : lat(latitude) @@ -60,5 +59,4 @@ Geodetic2 Geodetic2::operator/(double scalar) const { return Geodetic2(lat / scalar, lon / scalar); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/geometry/geodetic2.h b/modules/globebrowsing/geometry/geodetic2.h index 9c4e029fb5..00ec239374 100644 --- a/modules/globebrowsing/geometry/geodetic2.h +++ b/modules/globebrowsing/geometry/geodetic2.h @@ -27,8 +27,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct Geodetic2 { Geodetic2(double latitude = 0.0, double longitude = 0.0); @@ -51,7 +50,6 @@ struct Geodetic2 { double lon; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GEODETIC2___H__ diff --git a/modules/globebrowsing/geometry/geodetic3.h b/modules/globebrowsing/geometry/geodetic3.h index e0d6bb337d..33c4963b5f 100644 --- a/modules/globebrowsing/geometry/geodetic3.h +++ b/modules/globebrowsing/geometry/geodetic3.h @@ -27,15 +27,13 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct Geodetic3 { Geodetic2 geodetic2; double height; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GEODETIC3___H__ diff --git a/modules/globebrowsing/geometry/geodeticpatch.cpp b/modules/globebrowsing/geometry/geodeticpatch.cpp index 72f515d91b..75de380997 100644 --- a/modules/globebrowsing/geometry/geodeticpatch.cpp +++ b/modules/globebrowsing/geometry/geodeticpatch.cpp @@ -29,8 +29,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { GeodeticPatch::GeodeticPatch(double centerLat, double centerLon, double halfSizeLat, double halfSizeLon) @@ -241,5 +240,4 @@ Geodetic2 GeodeticPatch::closestPoint(const Geodetic2& p) const { return Geodetic2(clampedLat, clampedLon); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/geometry/geodeticpatch.h b/modules/globebrowsing/geometry/geodeticpatch.h index eff1392431..fda307db1f 100644 --- a/modules/globebrowsing/geometry/geodeticpatch.h +++ b/modules/globebrowsing/geometry/geodeticpatch.h @@ -29,8 +29,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class GeodeticPatch { public: @@ -110,7 +109,6 @@ private: Geodetic2 _halfSize; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GEODETICPATCH___H__ diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index 0f5a8c2c24..404348d26a 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -73,7 +73,7 @@ void GlobeBrowsingModule::internalInitialize() { // Convert from MB to Bytes GdalWrapper::create( 16ULL * 1024ULL * 1024ULL, // 16 MB - CpuCap.installedMainMemory() * 0.25 * 1024 * 1024); // 25% of total RAM + static_cast(CpuCap.installedMainMemory() * 0.25 * 1024 * 1024)); // 25% of total RAM addPropertySubOwner(GdalWrapper::ref()); #endif // GLOBEBROWSING_USE_GDAL }); diff --git a/modules/globebrowsing/globebrowsingmodule.h b/modules/globebrowsing/globebrowsingmodule.h index 2faad330ef..0f16467c73 100644 --- a/modules/globebrowsing/globebrowsingmodule.h +++ b/modules/globebrowsing/globebrowsingmodule.h @@ -29,18 +29,18 @@ #include #include -namespace openspace { - class Camera; -namespace globebrowsing { +namespace openspace::globebrowsing { class RenderableGlobe; - class TileIndex; - class Geodetic2; - class Geodetic3; + struct TileIndex; + struct Geodetic2; + struct Geodetic3; -namespace cache { - class MemoryAwareTileCache; -} -} + namespace cache { class MemoryAwareTileCache; } +} // namespace openspace::globebrowsing + +namespace openspace { + +class Camera; class GlobeBrowsingModule : public OpenSpaceModule { public: diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl index 0ac27b6baf..a46ccb1dfa 100644 --- a/modules/globebrowsing/globebrowsingmodule_lua.inl +++ b/modules/globebrowsing/globebrowsingmodule_lua.inl @@ -22,7 +22,6 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ - #include #include @@ -35,12 +34,10 @@ #include #include -namespace openspace { -namespace globebrowsing { -namespace luascriptfunctions { +namespace openspace::globebrowsing::luascriptfunctions { /** - Adds a layer to the specified globe. + *Adds a layer to the specified globe. */ int addLayer(lua_State* L) { using ghoul::lua::errorLocation; @@ -176,7 +173,4 @@ int goToGeo(lua_State* L) { return 0; } - -} // namespace luascriptfunctions -} // nameapace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::luascriptfunctions diff --git a/modules/globebrowsing/globes/chunkedlodglobe.cpp b/modules/globebrowsing/globes/chunkedlodglobe.cpp index f60945fd31..fcb667cb95 100644 --- a/modules/globebrowsing/globes/chunkedlodglobe.cpp +++ b/modules/globebrowsing/globes/chunkedlodglobe.cpp @@ -49,8 +49,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { const TileIndex ChunkedLodGlobe::LEFT_HEMISPHERE_INDEX = TileIndex(0, 0, 1); const TileIndex ChunkedLodGlobe::RIGHT_HEMISPHERE_INDEX = TileIndex(1, 0, 1); @@ -191,8 +190,9 @@ float ChunkedLodGlobe::getHeight(glm::dvec3 position) const { } ghoul::opengl::Texture* tileTexture = tile.texture(); - if (!tileTexture) + if (!tileTexture) { return 0; + } glm::vec2 transformedUv = Tile::TileUvToTextureSamplePosition( uvTransform, @@ -251,10 +251,10 @@ float ChunkedLodGlobe::getHeight(glm::dvec3 position) const { continue; } - float sample0 = sample00 * (1.0 - samplePosFract.x) + sample10 * samplePosFract.x; - float sample1 = sample01 * (1.0 - samplePosFract.x) + sample11 * samplePosFract.x; + float sample0 = sample00 * (1.f - samplePosFract.x) + sample10 * samplePosFract.x; + float sample1 = sample01 * (1.f - samplePosFract.x) + sample11 * samplePosFract.x; - float sample = sample0 * (1.0 - samplePosFract.y) + sample1 * samplePosFract.y; + float sample = sample0 * (1.f - samplePosFract.y) + sample1 * samplePosFract.y; // Same as is used in the shader. This is not a perfect solution but // if the sample is actually a no-data-value (min_float) the interpolated @@ -278,7 +278,7 @@ void ChunkedLodGlobe::notifyShaderRecompilation() { _shadersNeedRecompilation = true; } -void ChunkedLodGlobe::render(const RenderData& data) { +void ChunkedLodGlobe::render(const RenderData& data, RendererTasks&) { stats.startNewRecord(); if (_shadersNeedRecompilation) { _renderer->recompileShaders(_owner); @@ -356,9 +356,10 @@ void ChunkedLodGlobe::debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp } void ChunkedLodGlobe::update(const UpdateData& data) { - setBoundingSphere(_owner.ellipsoid().maximumRadius() * data.modelTransform.scale); + setBoundingSphere(static_cast( + _owner.ellipsoid().maximumRadius() * data.modelTransform.scale + )); _renderer->update(); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/globes/chunkedlodglobe.h b/modules/globebrowsing/globes/chunkedlodglobe.h index 52f5e61d3c..15f9ea3091 100644 --- a/modules/globebrowsing/globes/chunkedlodglobe.h +++ b/modules/globebrowsing/globes/chunkedlodglobe.h @@ -33,16 +33,11 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { -namespace chunklevelevaluator { - class Evaluator; -} // namespace chunklevelevaluator +namespace chunklevelevaluator { class Evaluator; } -namespace culling { - class ChunkCuller; -} // namespace culling +namespace culling { class ChunkCuller; } class Chunk; class ChunkNode; @@ -61,7 +56,7 @@ public: bool deinitialize() override; bool isReady() const override; - void render(const RenderData& data) override; + void render(const RenderData& data, RendererTasks& rendererTask) override; void update(const UpdateData& data) override; /** @@ -145,7 +140,6 @@ private: bool _shadersNeedRecompilation; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___CHUNKED_LOD_GLOBE___H__ diff --git a/modules/globebrowsing/globes/pointglobe.cpp b/modules/globebrowsing/globes/pointglobe.cpp index 110571ae35..c81f4ec215 100644 --- a/modules/globebrowsing/globes/pointglobe.cpp +++ b/modules/globebrowsing/globes/pointglobe.cpp @@ -33,8 +33,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { PointGlobe::PointGlobe(const RenderableGlobe& owner) : _owner(owner) @@ -69,7 +68,7 @@ bool PointGlobe::initialize() { glBindVertexArray(_vaoID); - std::array quadVertexData = {{ + std::array quadVertexData = {{ glm::vec2(-1.0f, -1.0f), glm::vec2(1.0f, -1.0f), glm::vec2(-1.0f, 1.0f), @@ -104,7 +103,7 @@ bool PointGlobe::isReady() const { return (_vaoID != 0) && (_vertexBufferID != 0); } -void PointGlobe::render(const RenderData& data) { +void PointGlobe::render(const RenderData& data, RendererTasks&) { _programObject->activate(); // Calculate variables to be used as uniform variables in shader @@ -116,10 +115,12 @@ void PointGlobe::render(const RenderData& data) { glm::normalize(glm::dvec3(1000000.0f) - bodyPosition)); glm::dvec3 camToBody = bodyPosition - data.camera.positionVec3(); - float distanceToBody = glm::length(camToBody); + float distanceToBody = static_cast(glm::length(camToBody)); - float avgRadius = _owner.ellipsoid().averageRadius(); - float lightIntensity = _lightIntensity.value() * data.modelTransform.scale * avgRadius / distanceToBody; + float avgRadius = static_cast(_owner.ellipsoid().averageRadius()); + float lightIntensity = static_cast( + _lightIntensity.value() * data.modelTransform.scale * avgRadius / distanceToBody + ); float lightIntensityClamped = glm::min(lightIntensity, _intensityClamp.value()); //float lightOverflow = glm::max(lightIntensity - lightIntensityClamped, 0.0f); @@ -162,5 +163,4 @@ void PointGlobe::render(const RenderData& data) { _programObject->deactivate(); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/globes/pointglobe.h b/modules/globebrowsing/globes/pointglobe.h index 34c28ab6fb..59cd91fdee 100644 --- a/modules/globebrowsing/globes/pointglobe.h +++ b/modules/globebrowsing/globes/pointglobe.h @@ -30,12 +30,9 @@ #include -namespace ghoul { namespace opengl { -class ProgramObject; -} } +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class RenderableGlobe; @@ -48,7 +45,7 @@ public: bool deinitialize() override; bool isReady() const override; - void render(const RenderData& data) override; + void render(const RenderData& data, RendererTasks& rendererTask) override; private: const RenderableGlobe& _owner; @@ -61,7 +58,6 @@ private: properties::FloatProperty _lightIntensity; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___POINTGLOBE___H__ diff --git a/modules/globebrowsing/globes/renderableglobe.cpp b/modules/globebrowsing/globes/renderableglobe.cpp index ca5e58bbf8..646b222fcc 100644 --- a/modules/globebrowsing/globes/renderableglobe.cpp +++ b/modules/globebrowsing/globes/renderableglobe.cpp @@ -68,14 +68,12 @@ namespace { const char* keyBackground = "Background"; const char* keyGamma = "Gamma"; #endif -} +} // namespace -namespace openspace { +using namespace openspace::properties; -using namespace properties; +namespace openspace::globebrowsing { -namespace globebrowsing { - RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) : _debugProperties({ BoolProperty("saveOrThrowCamera", "save or throw camera", false), @@ -158,12 +156,12 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) glm::dvec3 radii; dictionary.getValue(keyRadii, radii); _ellipsoid = Ellipsoid(radii); - setBoundingSphere(_ellipsoid.maximumRadius()); + setBoundingSphere(static_cast(_ellipsoid.maximumRadius())); // Ghoul can't read ints from lua dictionaries... double patchSegmentsd; dictionary.getValue(keySegmentsPerPatch, patchSegmentsd); - int patchSegments = patchSegmentsd; + int patchSegments = static_cast(patchSegmentsd); // Init layer manager ghoul::Dictionary layersDictionary; @@ -175,7 +173,10 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) _layerManager = std::make_shared(layersDictionary); _chunkedLodGlobe = std::make_shared( - *this, patchSegments, _layerManager); + *this, + patchSegments, + _layerManager + ); //_pointGlobe = std::make_shared(*this); _distanceSwitch.addSwitchValue(_chunkedLodGlobe); @@ -587,7 +588,7 @@ bool RenderableGlobe::isReady() const { return true; } -void RenderableGlobe::render(const RenderData& data, RendererTasks& tasks) { +void RenderableGlobe::render(const RenderData& data, RendererTasks& renderTask) { bool statsEnabled = _debugProperties.collectStats.value(); _chunkedLodGlobe->stats.setEnabled(statsEnabled); @@ -607,7 +608,7 @@ void RenderableGlobe::render(const RenderData& data, RendererTasks& tasks) { setSaveCamera(nullptr); } } - _distanceSwitch.render(data); + _distanceSwitch.render(data, renderTask); } if (_savedCamera != nullptr) { DebugRenderer::ref().renderCameraFrustum(data, *_savedCamera); @@ -616,7 +617,7 @@ void RenderableGlobe::render(const RenderData& data, RendererTasks& tasks) { #ifdef OPENSPACE_MODULE_ATMOSPHERE_ENABLED if (_atmosphereEnabled) { DeferredcasterTask task{ _deferredcaster.get(), data }; - tasks.deferredcasterTasks.push_back(task); + renderTask.deferredcasterTasks.push_back(task); } #endif } @@ -789,5 +790,4 @@ void RenderableGlobe::updateAtmosphereParameters() { } #endif -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/globes/renderableglobe.h b/modules/globebrowsing/globes/renderableglobe.h index d071a9d319..9732080204 100644 --- a/modules/globebrowsing/globes/renderableglobe.h +++ b/modules/globebrowsing/globes/renderableglobe.h @@ -34,13 +34,13 @@ #include #include -namespace openspace { - #ifdef OPENSPACE_MODULE_ATMOSPHERE_ENABLED +namespace openspace { class AtmosphereDeferredcaster; +} #endif -namespace globebrowsing { +namespace openspace::globebrowsing { class ChunkedLodGlobe; class PointGlobe; @@ -134,7 +134,7 @@ public: bool deinitialize() override; bool isReady() const override; - void render(const RenderData& data, RendererTasks& tasks) override; + void render(const RenderData& data, RendererTasks& rendererTask) override; void update(const UpdateData& data) override; // Getters that perform calculations @@ -223,7 +223,6 @@ private: #endif }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___RENDERABLEGLOBE___H__ diff --git a/modules/globebrowsing/meshes/basicgrid.cpp b/modules/globebrowsing/meshes/basicgrid.cpp index 47dd8e3a13..f96b6f2f42 100644 --- a/modules/globebrowsing/meshes/basicgrid.cpp +++ b/modules/globebrowsing/meshes/basicgrid.cpp @@ -63,7 +63,7 @@ int BasicGrid::ySegments() const { return _ySegments; } -void BasicGrid::validate(int xSegments, int ySegments) { +void BasicGrid::validate([[maybe_unused]] int xSegments, [[maybe_unused]] int ySegments) { ghoul_assert( xSegments > 0 && ySegments > 0, std::string("Resolution must be at least 1x1. (") + diff --git a/modules/globebrowsing/meshes/basicgrid.h b/modules/globebrowsing/meshes/basicgrid.h index ab71f540c6..efcceff7c1 100644 --- a/modules/globebrowsing/meshes/basicgrid.h +++ b/modules/globebrowsing/meshes/basicgrid.h @@ -31,8 +31,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class BasicGrid : public Grid { public: @@ -67,7 +66,6 @@ private: inline size_t numVertices(int xSegments, int ySegments); }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___BASICGRIDGEOMETRY___H__ diff --git a/modules/globebrowsing/meshes/grid.cpp b/modules/globebrowsing/meshes/grid.cpp index 69a800ddd8..60597fafbf 100644 --- a/modules/globebrowsing/meshes/grid.cpp +++ b/modules/globebrowsing/meshes/grid.cpp @@ -24,8 +24,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { Grid::Grid(int xSegments, int ySegments) : _xSegments(xSegments) @@ -36,5 +35,4 @@ TriangleSoup& Grid::geometry() { return *_geometry; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/meshes/grid.h b/modules/globebrowsing/meshes/grid.h index cf6c8b990c..4f3bc0d722 100644 --- a/modules/globebrowsing/meshes/grid.h +++ b/modules/globebrowsing/meshes/grid.h @@ -32,8 +32,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { /** * Abstract class defining an interface used for geometries with grid structures. @@ -97,7 +96,6 @@ protected: const int _ySegments; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GRIDGEOMETRY___H__ diff --git a/modules/globebrowsing/meshes/skirtedgrid.cpp b/modules/globebrowsing/meshes/skirtedgrid.cpp index d0211c3675..e3b194308d 100644 --- a/modules/globebrowsing/meshes/skirtedgrid.cpp +++ b/modules/globebrowsing/meshes/skirtedgrid.cpp @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { SkirtedGrid::SkirtedGrid(unsigned int xSegments, unsigned int ySegments, TriangleSoup::Positions usePositions, @@ -61,10 +60,12 @@ int SkirtedGrid::ySegments() const { return _ySegments; } -void SkirtedGrid::validate(int xSegments, int ySegments) { +void SkirtedGrid::validate([[maybe_unused]] int xSegments, [[maybe_unused]] int ySegments) +{ ghoul_assert( xSegments > 0 && ySegments > 0, - "Resolution must be at least 1x1. (" + std::to_string(xSegments) + ", " + std::to_string(ySegments) + ")" + "Resolution must be at least 1x1. (" + std::to_string(xSegments) + ", " + + std::to_string(ySegments) + ")" ); } @@ -172,5 +173,4 @@ std::vector SkirtedGrid::createNormals(int xSegments, int ySegments) return normals; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/meshes/skirtedgrid.h b/modules/globebrowsing/meshes/skirtedgrid.h index 66c675887f..4ca45b3434 100644 --- a/modules/globebrowsing/meshes/skirtedgrid.h +++ b/modules/globebrowsing/meshes/skirtedgrid.h @@ -30,8 +30,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { /** * This grid is the same as BasicGrid except it has skirts around its edges. @@ -72,7 +71,6 @@ private: size_t numVertices(int xSegments, int ySegments); }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___SKIRTEDGRID___H__ diff --git a/modules/globebrowsing/meshes/trianglesoup.cpp b/modules/globebrowsing/meshes/trianglesoup.cpp index 897dd3027d..e83b9d4506 100644 --- a/modules/globebrowsing/meshes/trianglesoup.cpp +++ b/modules/globebrowsing/meshes/trianglesoup.cpp @@ -27,11 +27,10 @@ #include namespace { - const std::string _loggerCat = "TriangleSoup"; + const char* _loggerCat = "TriangleSoup"; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { TriangleSoup::TriangleSoup(std::vector elements, Positions usePositions, TextureCoordinates useTextures, Normals useNormals) @@ -166,9 +165,13 @@ void TriangleSoup::drawUsingActiveProgram() { } glBindVertexArray(_vaoID); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _elementBufferID); - glDrawElements(GL_TRIANGLES, _elementData.size(), GL_UNSIGNED_INT, 0); + glDrawElements( + GL_TRIANGLES, + static_cast(_elementData.size()), + GL_UNSIGNED_INT, + nullptr + ); glBindVertexArray(0); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/meshes/trianglesoup.h b/modules/globebrowsing/meshes/trianglesoup.h index 5085003cec..0c4e188981 100644 --- a/modules/globebrowsing/meshes/trianglesoup.h +++ b/modules/globebrowsing/meshes/trianglesoup.h @@ -31,8 +31,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { /** * Class to hold vertex data and handling OpenGL interfacing and rendering. @@ -101,7 +100,6 @@ private: bool _gpuDataNeedUpdate; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___TRIANGLESOUP___H__ diff --git a/modules/globebrowsing/other/concurrentjobmanager.h b/modules/globebrowsing/other/concurrentjobmanager.h index fad0a62704..5644f6ad58 100644 --- a/modules/globebrowsing/other/concurrentjobmanager.h +++ b/modules/globebrowsing/other/concurrentjobmanager.h @@ -30,8 +30,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { // Templated abstract base class representing a job to be done. // Client code derive from this class and implement the virtual execute() method @@ -67,8 +66,7 @@ private: ThreadPool threadPool; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #include "concurrentjobmanager.inl" diff --git a/modules/globebrowsing/other/concurrentjobmanager.inl b/modules/globebrowsing/other/concurrentjobmanager.inl index 763f46b848..2bef4779b4 100644 --- a/modules/globebrowsing/other/concurrentjobmanager.inl +++ b/modules/globebrowsing/other/concurrentjobmanager.inl @@ -24,8 +24,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { template Job

::Job() {} @@ -64,5 +63,4 @@ size_t ConcurrentJobManager

::numFinishedJobs() const { return _finishedJobs.size(); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/other/concurrentqueue.h b/modules/globebrowsing/other/concurrentqueue.h index e66f64e734..28317e84f5 100644 --- a/modules/globebrowsing/other/concurrentqueue.h +++ b/modules/globebrowsing/other/concurrentqueue.h @@ -29,8 +29,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { /** * Templated thread-safe queue based on std::thread and std::queue @@ -54,8 +53,7 @@ private: mutable std::condition_variable _cond; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #include "concurrentqueue.inl" diff --git a/modules/globebrowsing/other/concurrentqueue.inl b/modules/globebrowsing/other/concurrentqueue.inl index f493cacc7f..ef2bc2ea12 100644 --- a/modules/globebrowsing/other/concurrentqueue.inl +++ b/modules/globebrowsing/other/concurrentqueue.inl @@ -22,8 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { template T ConcurrentQueue::pop() { @@ -71,5 +70,4 @@ size_t ConcurrentQueue::size() const { return s; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/other/distanceswitch.cpp b/modules/globebrowsing/other/distanceswitch.cpp index aeb95de079..8e74e5f9ac 100644 --- a/modules/globebrowsing/other/distanceswitch.cpp +++ b/modules/globebrowsing/other/distanceswitch.cpp @@ -26,8 +26,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { DistanceSwitch::~DistanceSwitch() {} @@ -45,7 +44,7 @@ bool DistanceSwitch::deinitialize() { return true; } -void DistanceSwitch::render(const RenderData& data) { +void DistanceSwitch::render(const RenderData& data, RendererTasks& tasks) { const double distanceToCamera = distance(data.camera.positionVec3(), data.modelTransform.translation); @@ -58,7 +57,7 @@ void DistanceSwitch::render(const RenderData& data) { for (std::shared_ptr renderable : _renderables) { const double distance = res * renderable->boundingSphere() / tan(fov / 2); if (distanceToCamera < distance) { - renderable->render(data); + renderable->render(data, tasks); } } } @@ -73,5 +72,4 @@ void DistanceSwitch::addSwitchValue(std::shared_ptr renderable) { _renderables.push_back(renderable); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/other/distanceswitch.h b/modules/globebrowsing/other/distanceswitch.h index 2ba77a9d90..45d9a6bd3c 100644 --- a/modules/globebrowsing/other/distanceswitch.h +++ b/modules/globebrowsing/other/distanceswitch.h @@ -29,12 +29,13 @@ #include namespace openspace { + class Renderable; + struct RenderData; + struct RendererTasks; + struct UpdateData; +} // namespace openspace -class Renderable; -struct RenderData; -struct UpdateData; - -namespace globebrowsing { +namespace openspace::globebrowsing { /** * Selects a specific Renderable to be used for rendering, based on distance to the @@ -51,7 +52,7 @@ public: * Picks the first Renderable with the associated maxDistance greater than the * current distance to the camera */ - void render(const RenderData& data); + void render(const RenderData& data, RendererTasks& rendererTask); void update(const UpdateData& data); /** @@ -63,7 +64,6 @@ private: std::vector> _renderables; }; -} // namespace globebrowsing -} // openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___DISTANCESWITCH___H__ diff --git a/modules/globebrowsing/other/lruthreadpool.h b/modules/globebrowsing/other/lruthreadpool.h index 1b89e04ce1..fa0d7a9de6 100644 --- a/modules/globebrowsing/other/lruthreadpool.h +++ b/modules/globebrowsing/other/lruthreadpool.h @@ -37,11 +37,9 @@ // Implementatin based on http://progsch.net/wordpress/?p=81 -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { -template -class LRUThreadPool; +template class LRUThreadPool; template class LRUThreadPoolWorker { @@ -93,8 +91,7 @@ private: bool _stop; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #include "lruthreadpool.inl" diff --git a/modules/globebrowsing/other/lruthreadpool.inl b/modules/globebrowsing/other/lruthreadpool.inl index bcc57029b5..48042299ec 100644 --- a/modules/globebrowsing/other/lruthreadpool.inl +++ b/modules/globebrowsing/other/lruthreadpool.inl @@ -22,8 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { template LRUThreadPoolWorker::LRUThreadPoolWorker(LRUThreadPool& pool) @@ -144,5 +143,4 @@ void LRUThreadPool::clearEnqueuedTasks() { } // release lock } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/other/pixelbuffer.cpp b/modules/globebrowsing/other/pixelbuffer.cpp index 22b8264a48..5c313cd4a0 100644 --- a/modules/globebrowsing/other/pixelbuffer.cpp +++ b/modules/globebrowsing/other/pixelbuffer.cpp @@ -27,9 +27,9 @@ namespace { const char* _loggerCat = "PixelBuffer"; -}; +} // namespace -using namespace openspace::globebrowsing; +namespace openspace::globebrowsing { PixelBuffer::PixelBuffer(size_t numBytes, Usage usage) : _numBytes(numBytes) @@ -82,3 +82,5 @@ bool PixelBuffer::isMapped() const { PixelBuffer::operator GLuint() const { return _id; } + +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/other/pixelbuffer.h b/modules/globebrowsing/other/pixelbuffer.h index 1f9ee4918e..ffbfbb6308 100644 --- a/modules/globebrowsing/other/pixelbuffer.h +++ b/modules/globebrowsing/other/pixelbuffer.h @@ -27,8 +27,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { /** * Handles an OpenGL pixel buffer which contains data allocated on the GPU. A simple @@ -37,8 +36,7 @@ namespace globebrowsing { * address pointer, the user needs to ensure the data is unmapped before the data can * be used on the GPU / CPU depending on Usage. */ -class PixelBuffer -{ +class PixelBuffer { public: /** * All kinds of usage for pixel buffer objects as defined by the OpenGL standard. @@ -134,7 +132,6 @@ private: bool _isMapped; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___PIXEL_BUFFER___H__ diff --git a/modules/globebrowsing/other/pixelbuffercontainer.h b/modules/globebrowsing/other/pixelbuffercontainer.h index f1fdcfb9aa..adfc5220d9 100644 --- a/modules/globebrowsing/other/pixelbuffercontainer.h +++ b/modules/globebrowsing/other/pixelbuffercontainer.h @@ -29,8 +29,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { /** * Templated class which owns one or many PixelBuffers. The @@ -38,8 +37,7 @@ namespace globebrowsing { * mapped. */ template -class PixelBufferContainer -{ +class PixelBufferContainer { public: /** * Creates numPixelBuffers pixel buffer objects, each with numBytesPerBuffer bytes @@ -107,8 +105,7 @@ private: std::map _indexMap; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #include "pixelbuffercontainer.inl" diff --git a/modules/globebrowsing/other/pixelbuffercontainer.inl b/modules/globebrowsing/other/pixelbuffercontainer.inl index c1a4e4aaa2..2f9109145f 100644 --- a/modules/globebrowsing/other/pixelbuffercontainer.inl +++ b/modules/globebrowsing/other/pixelbuffercontainer.inl @@ -22,8 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { template PixelBufferContainer::PixelBufferContainer(size_t numBytesPerBuffer, @@ -126,5 +125,4 @@ GLuint PixelBufferContainer::idOfMappedBuffer(KeyType key) { return 0; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/other/prioritizingconcurrentjobmanager.h b/modules/globebrowsing/other/prioritizingconcurrentjobmanager.h index 6b166dd1a2..947c2bbdd1 100644 --- a/modules/globebrowsing/other/prioritizingconcurrentjobmanager.h +++ b/modules/globebrowsing/other/prioritizingconcurrentjobmanager.h @@ -31,8 +31,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { /** * Concurrent job manager which prioritizes which jobs to work on depending on which @@ -91,8 +90,7 @@ private: }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #include "prioritizingconcurrentjobmanager.inl" diff --git a/modules/globebrowsing/other/prioritizingconcurrentjobmanager.inl b/modules/globebrowsing/other/prioritizingconcurrentjobmanager.inl index dbfbcbefdf..dcd41be2ef 100644 --- a/modules/globebrowsing/other/prioritizingconcurrentjobmanager.inl +++ b/modules/globebrowsing/other/prioritizingconcurrentjobmanager.inl @@ -24,16 +24,15 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { -template +template PrioritizingConcurrentJobManager::PrioritizingConcurrentJobManager( LRUThreadPool pool) : _threadPool(pool) { } -template +template void PrioritizingConcurrentJobManager::enqueueJob(std::shared_ptr> job, KeyType key) { @@ -44,29 +43,29 @@ void PrioritizingConcurrentJobManager::enqueueJob(std::shared_ptr +template std::vector PrioritizingConcurrentJobManager::getKeysToUnfinishedJobs() { return _threadPool.getUnqueuedTasksKeys(); } -template +template std::vector PrioritizingConcurrentJobManager::getKeysToEnqueuedJobs() { return _threadPool.getQueuedTasksKeys(); } -template +template bool PrioritizingConcurrentJobManager::touch(KeyType key) { return _threadPool.touch(key); } -template +template void PrioritizingConcurrentJobManager::clearEnqueuedJobs() { _threadPool.clearEnqueuedTasks(); } -template +template std::shared_ptr> PrioritizingConcurrentJobManager::popFinishedJob() { ghoul_assert(_finishedJobs.size() > 0, "There is no finished job to pop!"); std::lock_guard lock(_finishedJobsMutex); @@ -74,10 +73,9 @@ std::shared_ptr> PrioritizingConcurrentJobManager::popFinishe return result; } -template +template size_t PrioritizingConcurrentJobManager::numFinishedJobs() const { return _finishedJobs.size(); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/other/statscollector.cpp b/modules/globebrowsing/other/statscollector.cpp index 21bd3168a1..266180873a 100644 --- a/modules/globebrowsing/other/statscollector.cpp +++ b/modules/globebrowsing/other/statscollector.cpp @@ -28,8 +28,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { StatsCollector::StatsCollector(const std::string& filename, int dumpEveryXRecord, Enabled enabled, const std::string & delimiter) @@ -118,5 +117,4 @@ void StatsCollector::writeData() { ofs.close(); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/other/statscollector.h b/modules/globebrowsing/other/statscollector.h index 1d78e81eb9..29b4ca4a72 100644 --- a/modules/globebrowsing/other/statscollector.h +++ b/modules/globebrowsing/other/statscollector.h @@ -32,8 +32,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { template class TemplatedStatsCollector { @@ -116,8 +115,7 @@ private: bool _hasWrittenHeader; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #include "statscollector.inl" diff --git a/modules/globebrowsing/other/statscollector.inl b/modules/globebrowsing/other/statscollector.inl index 3ee7b93f8c..594d2afabf 100644 --- a/modules/globebrowsing/other/statscollector.inl +++ b/modules/globebrowsing/other/statscollector.inl @@ -22,8 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { template TemplatedStatsCollector::TemplatedStatsCollector(bool& enabled, @@ -108,5 +107,4 @@ void TemplatedStatsCollector::writeNextRecord(std::ostream& os) { } } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/other/threadpool.cpp b/modules/globebrowsing/other/threadpool.cpp index a5a6fb718a..2daf24fd68 100644 --- a/modules/globebrowsing/other/threadpool.cpp +++ b/modules/globebrowsing/other/threadpool.cpp @@ -24,12 +24,9 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { -Worker::Worker(ThreadPool& pool) - : pool(pool) -{} +Worker::Worker(ThreadPool& pool) : pool(pool) {} void Worker::operator()() { std::function task; @@ -106,5 +103,4 @@ void ThreadPool::clearTasks() { } // release lock } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/other/threadpool.h b/modules/globebrowsing/other/threadpool.h index 475714086f..dbf01d4010 100644 --- a/modules/globebrowsing/other/threadpool.h +++ b/modules/globebrowsing/other/threadpool.h @@ -35,8 +35,7 @@ // Implementatin based on http://progsch.net/wordpress/?p=81 -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class ThreadPool; @@ -70,7 +69,6 @@ private: bool stop; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___THREAD_POOL___H__ diff --git a/modules/globebrowsing/rendering/chunkrenderer.cpp b/modules/globebrowsing/rendering/chunkrenderer.cpp index 56936bfe57..2a3b0695b3 100644 --- a/modules/globebrowsing/rendering/chunkrenderer.cpp +++ b/modules/globebrowsing/rendering/chunkrenderer.cpp @@ -33,8 +33,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { ChunkRenderer::ChunkRenderer(std::shared_ptr grid, std::shared_ptr layerManager) @@ -203,8 +202,9 @@ void ChunkRenderer::renderChunkGlobally(const Chunk& chunk, const RenderData& da glm::dmat4 inverseModelTransform = chunk.owner().inverseModelTransform(); glm::dvec3 cameraPosition = glm::dvec3( inverseModelTransform * glm::dvec4(data.camera.positionVec3(), 1)); - float distanceScaleFactor = chunk.owner().generalProperties().lodScaleFactor * - ellipsoid.minimumRadius(); + float distanceScaleFactor = static_cast( + chunk.owner().generalProperties().lodScaleFactor * ellipsoid.minimumRadius() + ); programObject->setUniform("cameraPosition", glm::vec3(cameraPosition)); programObject->setUniform("distanceScaleFactor", distanceScaleFactor); programObject->setUniform("chunkLevel", chunk.tileIndex().level); @@ -279,8 +279,11 @@ void ChunkRenderer::renderChunkLocally(const Chunk& chunk, const RenderData& dat if (_layerManager->hasAnyBlendingLayersEnabled()) { - float distanceScaleFactor = chunk.owner().generalProperties().lodScaleFactor * - chunk.owner().ellipsoid().minimumRadius(); + float distanceScaleFactor = static_cast( + chunk.owner().generalProperties().lodScaleFactor * + chunk.owner().ellipsoid().minimumRadius() + ); + programObject->setUniform("distanceScaleFactor", distanceScaleFactor); programObject->setUniform("chunkLevel", chunk.tileIndex().level); } @@ -352,5 +355,4 @@ void ChunkRenderer::renderChunkLocally(const Chunk& chunk, const RenderData& dat programObject->deactivate(); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace:;globebrowsing diff --git a/modules/globebrowsing/rendering/chunkrenderer.h b/modules/globebrowsing/rendering/chunkrenderer.h index 9caf680685..37149c26df 100644 --- a/modules/globebrowsing/rendering/chunkrenderer.h +++ b/modules/globebrowsing/rendering/chunkrenderer.h @@ -27,15 +27,11 @@ #include -namespace ghoul { namespace opengl { - class ProgramObject; -} } +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { +namespace openspace { struct RenderData; } -struct RenderData; - -namespace globebrowsing { +namespace openspace::globebrowsing { class Chunk; class Grid; @@ -103,7 +99,6 @@ private: std::shared_ptr _localGpuLayerManager; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___CHUNK_RENDERER___H__ diff --git a/modules/globebrowsing/rendering/gpu/gpuchunktile.cpp b/modules/globebrowsing/rendering/gpu/gpuchunktile.cpp index 9efcdd9f74..f776aa854f 100644 --- a/modules/globebrowsing/rendering/gpu/gpuchunktile.cpp +++ b/modules/globebrowsing/rendering/gpu/gpuchunktile.cpp @@ -27,8 +27,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void GPUChunkTile::setValue(ghoul::opengl::ProgramObject* programObject, const ChunkTile& chunkTile) @@ -48,5 +47,4 @@ void GPUChunkTile::deactivate() { gpuTexture.deactivate(); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpuchunktile.h b/modules/globebrowsing/rendering/gpu/gpuchunktile.h index 490c7a81bd..e94536ecd7 100644 --- a/modules/globebrowsing/rendering/gpu/gpuchunktile.h +++ b/modules/globebrowsing/rendering/gpu/gpuchunktile.h @@ -31,12 +31,9 @@ #include -namespace ghoul { namespace opengl { -class ProgramObject; -}} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct ChunkTile; @@ -72,7 +69,6 @@ private: GPUTileUvTransform gpuTileUvTransform; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPUCHUNKTILE___H__ diff --git a/modules/globebrowsing/rendering/gpu/gpuchunktilepile.cpp b/modules/globebrowsing/rendering/gpu/gpuchunktilepile.cpp index a07cd46857..f905ddb0d1 100644 --- a/modules/globebrowsing/rendering/gpu/gpuchunktilepile.cpp +++ b/modules/globebrowsing/rendering/gpu/gpuchunktilepile.cpp @@ -24,9 +24,7 @@ #include - -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void GPUChunkTilePile::setValue(ghoul::opengl::ProgramObject* programObject, const ChunkTilePile& chunkTilePile) @@ -56,5 +54,4 @@ void GPUChunkTilePile::deactivate() { } } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpuchunktilepile.h b/modules/globebrowsing/rendering/gpu/gpuchunktilepile.h index e09b516370..be896aa15a 100644 --- a/modules/globebrowsing/rendering/gpu/gpuchunktilepile.h +++ b/modules/globebrowsing/rendering/gpu/gpuchunktilepile.h @@ -33,12 +33,9 @@ #include -namespace ghoul { namespace opengl { -class ProgramObject; -}} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { /** * Manages a GPU representation of a ChunkTilePile @@ -71,7 +68,6 @@ private: std::vector _gpuChunkTiles; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPUCHUNKTILEPILE___H__ diff --git a/modules/globebrowsing/rendering/gpu/gpuheightlayer.cpp b/modules/globebrowsing/rendering/gpu/gpuheightlayer.cpp index ce2fa871ef..658dab374e 100644 --- a/modules/globebrowsing/rendering/gpu/gpuheightlayer.cpp +++ b/modules/globebrowsing/rendering/gpu/gpuheightlayer.cpp @@ -30,8 +30,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void GPUHeightLayer::setValue(ghoul::opengl::ProgramObject* programObject, const Layer& layer, const TileIndex& tileIndex, @@ -49,5 +48,4 @@ void GPUHeightLayer::bind(ghoul::opengl::ProgramObject* programObject, const Lay } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpuheightlayer.h b/modules/globebrowsing/rendering/gpu/gpuheightlayer.h index 14e9ac7cfc..c0b25b308f 100644 --- a/modules/globebrowsing/rendering/gpu/gpuheightlayer.h +++ b/modules/globebrowsing/rendering/gpu/gpuheightlayer.h @@ -31,12 +31,9 @@ #include #include -namespace ghoul { namespace opengl { -class ProgramObject; -}} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class Layer; struct TileIndex; @@ -70,7 +67,6 @@ private: GPUTileDepthTransform _gpuDepthTransform; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPUHEIGHTLAYER___H__ diff --git a/modules/globebrowsing/rendering/gpu/gpulayer.cpp b/modules/globebrowsing/rendering/gpu/gpulayer.cpp index edfeb457ef..e7bea852a2 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayer.cpp +++ b/modules/globebrowsing/rendering/gpu/gpulayer.cpp @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void GPULayer::setValue(ghoul::opengl::ProgramObject* programObject, const Layer& layer, const TileIndex& tileIndex, int pileSize) @@ -84,5 +83,4 @@ void GPULayer::deactivate() { gpuChunkTilePile.deactivate(); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpulayer.h b/modules/globebrowsing/rendering/gpu/gpulayer.h index 746c581b25..e7edba9cb3 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayer.h +++ b/modules/globebrowsing/rendering/gpu/gpulayer.h @@ -31,12 +31,9 @@ #include #include -namespace ghoul { namespace opengl { -class ProgramObject; -}} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class Layer; struct TileIndex; @@ -80,7 +77,6 @@ private: GPUData gpuColor; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPULAYER___H__ diff --git a/modules/globebrowsing/rendering/gpu/gpulayeradjustment.cpp b/modules/globebrowsing/rendering/gpu/gpulayeradjustment.cpp index 69ff1707bb..7634e693fe 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayeradjustment.cpp +++ b/modules/globebrowsing/rendering/gpu/gpulayeradjustment.cpp @@ -25,8 +25,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void GPULayerAdjustment::setValue(ghoul::opengl::ProgramObject* programObject, const LayerAdjustment& layerAdjustment) @@ -44,8 +43,9 @@ void GPULayerAdjustment::setValue(ghoul::opengl::ProgramObject* programObject, } } -void GPULayerAdjustment::bind(const LayerAdjustment& layerAdjustment, ghoul::opengl::ProgramObject* programObject, - const std::string& nameBase) +void GPULayerAdjustment::bind(const LayerAdjustment& layerAdjustment, + ghoul::opengl::ProgramObject* programObject, + const std::string& nameBase) { switch (layerAdjustment.type()) { case layergroupid::AdjustmentTypeID::None: @@ -60,5 +60,4 @@ void GPULayerAdjustment::bind(const LayerAdjustment& layerAdjustment, ghoul::ope } } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpulayeradjustment.h b/modules/globebrowsing/rendering/gpu/gpulayeradjustment.h index 3a53b8808f..fbf8cafc82 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayeradjustment.h +++ b/modules/globebrowsing/rendering/gpu/gpulayeradjustment.h @@ -22,19 +22,16 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___GPULAYER_ADJUSMENT___H__ -#define __OPENSPACE_MODULE_GLOBEBROWSING___GPULAYER_ADJUSMENT___H__ +#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___GPULAYER_ADJUSTMENT___H__ +#define __OPENSPACE_MODULE_GLOBEBROWSING___GPULAYER_ADJUSTMENT___H__ #include -namespace ghoul { namespace opengl { -class ProgramObject; -}} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { -struct LayerAdjustment; +class LayerAdjustment; class GPULayerAdjustment{ public: @@ -50,7 +47,6 @@ private: GPUData gpuChromaKeyTolerance; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing -#endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPULAYER_ADJUSMENT___H__ +#endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPULAYER_ADJUSTMENT___H__ diff --git a/modules/globebrowsing/rendering/gpu/gpulayergroup.cpp b/modules/globebrowsing/rendering/gpu/gpulayergroup.cpp index 12715dff59..75df047c05 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayergroup.cpp +++ b/modules/globebrowsing/rendering/gpu/gpulayergroup.cpp @@ -28,8 +28,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void GPULayerGroup::setValue(ghoul::opengl::ProgramObject* programObject, const LayerGroup& layerGroup, const TileIndex& tileIndex) @@ -77,5 +76,4 @@ void GPULayerGroup::deactivate() { } } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpulayergroup.h b/modules/globebrowsing/rendering/gpu/gpulayergroup.h index 0ca34a1dad..d94c9daa32 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayergroup.h +++ b/modules/globebrowsing/rendering/gpu/gpulayergroup.h @@ -32,12 +32,9 @@ #include -namespace ghoul { namespace opengl { -class ProgramObject; -}} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct ChunkTile; class Layer; @@ -82,7 +79,6 @@ private: std::vector> _gpuActiveLayers; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPULAYERGROUP___H__ diff --git a/modules/globebrowsing/rendering/gpu/gpulayermanager.cpp b/modules/globebrowsing/rendering/gpu/gpulayermanager.cpp index b73e96bcc7..79de8e1535 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayermanager.cpp +++ b/modules/globebrowsing/rendering/gpu/gpulayermanager.cpp @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void GPULayerManager::setValue(ghoul::opengl::ProgramObject* programObject, const LayerManager& layerManager, @@ -52,7 +51,12 @@ void GPULayerManager::bind(ghoul::opengl::ProgramObject* programObject, for (size_t i = 0; i < layerGroups.size(); ++i) { const std::string& nameBase = layergroupid::LAYER_GROUP_NAMES[i]; - _gpuLayerGroups[i]->bind(programObject, *layerGroups[i], nameBase, i); + _gpuLayerGroups[i]->bind( + programObject, + *layerGroups[i], + nameBase, + static_cast(i) + ); } } @@ -62,5 +66,4 @@ void GPULayerManager::deactivate() { } } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpulayermanager.h b/modules/globebrowsing/rendering/gpu/gpulayermanager.h index def785685d..8c6f237da7 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayermanager.h +++ b/modules/globebrowsing/rendering/gpu/gpulayermanager.h @@ -30,12 +30,9 @@ #include -namespace ghoul { namespace opengl { -class ProgramObject; -}} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class LayerManager; @@ -72,7 +69,6 @@ private: std::vector> _gpuLayerGroups; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPULAYERMANAGER___H__ diff --git a/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.cpp b/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.cpp index 71824f88a5..256e08f8c7 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.cpp +++ b/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.cpp @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void GPULayerRenderSettings::setValue(ghoul::opengl::ProgramObject* programObject, const LayerRenderSettings& layerSettings) @@ -42,7 +41,8 @@ void GPULayerRenderSettings::setValue(ghoul::opengl::ProgramObject* programObjec } } -void GPULayerRenderSettings::bind(const LayerRenderSettings& layerSettings, ghoul::opengl::ProgramObject* programObject, +void GPULayerRenderSettings::bind(const LayerRenderSettings& layerSettings, + ghoul::opengl::ProgramObject* programObject, const std::string& nameBase) { gpuOpacity.bind(programObject, nameBase + "opacity"); @@ -55,5 +55,4 @@ void GPULayerRenderSettings::bind(const LayerRenderSettings& layerSettings, ghou } } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.h b/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.h index 5720616e4e..6b2c1c4f04 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.h +++ b/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.h @@ -29,12 +29,9 @@ #include -namespace ghoul { namespace opengl { -class ProgramObject; -}} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct LayerRenderSettings; @@ -68,7 +65,6 @@ private: GPUData gpuValueBlending; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPULAYERRENDERSETTINGS___H__ diff --git a/modules/globebrowsing/rendering/gpu/gputiledepthtransform.cpp b/modules/globebrowsing/rendering/gpu/gputiledepthtransform.cpp index deb14fabc7..85279b9472 100644 --- a/modules/globebrowsing/rendering/gpu/gputiledepthtransform.cpp +++ b/modules/globebrowsing/rendering/gpu/gputiledepthtransform.cpp @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void GPUTileDepthTransform::setValue(ghoul::opengl::ProgramObject* programObject, const TileDepthTransform& depthTransform) @@ -43,5 +42,4 @@ void GPUTileDepthTransform::bind(ghoul::opengl::ProgramObject* programObject, _gpuDepthScale.bind(programObject, nameBase + "depthScale"); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gputiledepthtransform.h b/modules/globebrowsing/rendering/gpu/gputiledepthtransform.h index 4e16940280..79cf907630 100644 --- a/modules/globebrowsing/rendering/gpu/gputiledepthtransform.h +++ b/modules/globebrowsing/rendering/gpu/gputiledepthtransform.h @@ -29,12 +29,9 @@ #include -namespace ghoul { namespace opengl { -class ProgramObject; -}} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct TileDepthTransform; @@ -64,7 +61,6 @@ private: GPUData _gpuDepthScale; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPUTILEDEPTHTRANSFORM___H__ diff --git a/modules/globebrowsing/rendering/gpu/gputileuvtransform.cpp b/modules/globebrowsing/rendering/gpu/gputileuvtransform.cpp index 477b02b75b..32f25f1ff5 100644 --- a/modules/globebrowsing/rendering/gpu/gputileuvtransform.cpp +++ b/modules/globebrowsing/rendering/gpu/gputileuvtransform.cpp @@ -30,8 +30,7 @@ //#include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void GPUTileUvTransform::setValue(ghoul::opengl::ProgramObject* programObject, const TileUvTransform& tileUvTransform) @@ -47,5 +46,4 @@ void GPUTileUvTransform::bind(ghoul::opengl::ProgramObject* programObject, _gpuUvScale.bind(programObject, nameBase + "uvScale"); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gputileuvtransform.h b/modules/globebrowsing/rendering/gpu/gputileuvtransform.h index 066eebfc47..fb52dcaa33 100644 --- a/modules/globebrowsing/rendering/gpu/gputileuvtransform.h +++ b/modules/globebrowsing/rendering/gpu/gputileuvtransform.h @@ -29,12 +29,9 @@ #include -namespace ghoul { namespace opengl { -class ProgramObject; -}} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct TileUvTransform; @@ -64,7 +61,6 @@ private: GPUData _gpuUvScale; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___GPUTILEUVTRANSFORM___H__ diff --git a/modules/globebrowsing/rendering/layer/layer.cpp b/modules/globebrowsing/rendering/layer/layer.cpp index d4f482ba8c..2cc362463d 100644 --- a/modules/globebrowsing/rendering/layer/layer.cpp +++ b/modules/globebrowsing/rendering/layer/layer.cpp @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { namespace { const char* _loggerCat = "Layer"; @@ -38,7 +37,7 @@ namespace { const char* keySettings = "Settings"; const char* keyAdjustment = "Adjustment"; const char* KeyBlendMode = "BlendMode"; -} +} // namespace Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict) : properties::PropertyOwner(layerDict.value(keyName)) @@ -322,5 +321,4 @@ void Layer::removeVisibleProperties() { } } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/layer/layer.h b/modules/globebrowsing/rendering/layer/layer.h index c8380e5b4f..bf1d055eb2 100644 --- a/modules/globebrowsing/rendering/layer/layer.h +++ b/modules/globebrowsing/rendering/layer/layer.h @@ -37,12 +37,9 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { -namespace tileprovider { - class TileProvider; -} +namespace tileprovider { class TileProvider; } class Layer : public properties::PropertyOwner { public: @@ -94,7 +91,6 @@ private: std::function _onChangeCallback; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___LAYER___H__ diff --git a/modules/globebrowsing/rendering/layer/layeradjustment.cpp b/modules/globebrowsing/rendering/layer/layeradjustment.cpp index fad6678097..bae061c736 100644 --- a/modules/globebrowsing/rendering/layer/layeradjustment.cpp +++ b/modules/globebrowsing/rendering/layer/layeradjustment.cpp @@ -24,14 +24,13 @@ #include -namespace openspace { -namespace globebrowsing { - namespace { const char* keyType = "Type"; const char* keyChromaKeyColor = "ChromaKeyColor"; const char* keyChromaKeyTolerance = "ChromaKeyTolerance"; -} +} // namespace + +namespace openspace::globebrowsing { LayerAdjustment::LayerAdjustment() : properties::PropertyOwner("adjustment") @@ -130,5 +129,4 @@ void LayerAdjustment::onChange(std::function callback) { _onChangeCallback = std::move(callback); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/layer/layeradjustment.h b/modules/globebrowsing/rendering/layer/layeradjustment.h index 20b9f11a78..00517ab544 100644 --- a/modules/globebrowsing/rendering/layer/layeradjustment.h +++ b/modules/globebrowsing/rendering/layer/layeradjustment.h @@ -33,15 +33,11 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { -namespace tileprovider { - class TileProvider; -} +namespace tileprovider { class TileProvider; } -class LayerAdjustment : public properties::PropertyOwner -{ +class LayerAdjustment : public properties::PropertyOwner { public: LayerAdjustment(); ~LayerAdjustment() = default; @@ -66,7 +62,6 @@ private: std::function _onChangeCallback; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___LAYER_ADJUSTMENT___H__ diff --git a/modules/globebrowsing/rendering/layer/layergroup.cpp b/modules/globebrowsing/rendering/layer/layergroup.cpp index 7b038c8f58..cb97b32217 100644 --- a/modules/globebrowsing/rendering/layer/layergroup.cpp +++ b/modules/globebrowsing/rendering/layer/layergroup.cpp @@ -30,8 +30,7 @@ namespace { const char* _loggerCat = "LayerGroup"; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { LayerGroup::LayerGroup(layergroupid::GroupID id) : properties::PropertyOwner(std::move(layergroupid::LAYER_GROUP_NAMES[id])) @@ -125,5 +124,4 @@ void LayerGroup::onChange(std::function callback) { } } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/layer/layergroup.h b/modules/globebrowsing/rendering/layer/layergroup.h index 8cf6d22d9b..602cfaf342 100644 --- a/modules/globebrowsing/rendering/layer/layergroup.h +++ b/modules/globebrowsing/rendering/layer/layergroup.h @@ -35,13 +35,9 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { - -namespace tileprovider { - class TileProvider; -} +namespace tileprovider { class TileProvider; } /** * Convenience class for dealing with multiple Layers. @@ -78,7 +74,6 @@ private: std::function _onChangeCallback; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___LAYERGROUP___H__ diff --git a/modules/globebrowsing/rendering/layer/layergroupid.h b/modules/globebrowsing/rendering/layer/layergroupid.h index 8445c4b962..c015a999c1 100644 --- a/modules/globebrowsing/rendering/layer/layergroupid.h +++ b/modules/globebrowsing/rendering/layer/layergroupid.h @@ -27,9 +27,7 @@ #include -namespace openspace { -namespace globebrowsing { -namespace layergroupid { +namespace openspace::globebrowsing::layergroupid { static const int NUM_LAYER_GROUPS = 5; static const std::string LAYER_GROUP_NAMES[NUM_LAYER_GROUPS] = { @@ -152,8 +150,6 @@ static layergroupid::BlendModeID getBlendModeIDFromName( return BlendModeID::Normal; } -} // namespace layergroupid -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::layergroupid #endif // __OPENSPACE_MODULE_GLOBEBROWSING___LAYERGROUPID___H__ diff --git a/modules/globebrowsing/rendering/layer/layermanager.cpp b/modules/globebrowsing/rendering/layer/layermanager.cpp index b2a2a98e24..d59d994861 100644 --- a/modules/globebrowsing/rendering/layer/layermanager.cpp +++ b/modules/globebrowsing/rendering/layer/layermanager.cpp @@ -28,23 +28,22 @@ #include #include -namespace openspace { -namespace globebrowsing { - namespace { - const char* _loggerCat = "LayerManager"; -} + const char* _loggerCat = "LayerManager"; +} // namespace + +namespace openspace::globebrowsing { LayerManager::LayerManager(const ghoul::Dictionary& layerGroupsDict) : properties::PropertyOwner("Layers") { - // First create empty layer groups in case not all are specified + // First create empty layer groups in case not all are specified _layerGroups.resize(layergroupid::NUM_LAYER_GROUPS); for (int i = 0; i < _layerGroups.size(); ++i) { - ghoul::Dictionary emptyDict; + ghoul::Dictionary emptyDict; _layerGroups[i] = std::make_shared( - static_cast(i), emptyDict - ); + static_cast(i), emptyDict + ); } std::vector layerGroupNamesInDict = layerGroupsDict.keys(); @@ -57,8 +56,8 @@ LayerManager::LayerManager(const ghoul::Dictionary& layerGroupsDict) if (groupId != layergroupid::GroupID::Unknown) { ghoul::Dictionary layerGroupDict = layerGroupsDict.value(groupName); - _layerGroups[static_cast(groupId)] = - std::make_shared(groupId, layerGroupDict); + _layerGroups[static_cast(groupId)] = + std::make_shared(groupId, layerGroupDict); } else { LWARNING("Unknown layer group: " + groupName); @@ -170,5 +169,4 @@ void LayerManager::onChange(std::function callback) { } } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/layer/layermanager.h b/modules/globebrowsing/rendering/layer/layermanager.h index 454a02d9f8..6fda583ded 100644 --- a/modules/globebrowsing/rendering/layer/layermanager.h +++ b/modules/globebrowsing/rendering/layer/layermanager.h @@ -34,8 +34,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct LayerGroup; @@ -69,7 +68,6 @@ private: std::vector> _layerGroups; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___LAYERMANAGER___H__ diff --git a/modules/globebrowsing/rendering/layer/layerrendersettings.cpp b/modules/globebrowsing/rendering/layer/layerrendersettings.cpp index 8cbbd95a79..15e11c7615 100644 --- a/modules/globebrowsing/rendering/layer/layerrendersettings.cpp +++ b/modules/globebrowsing/rendering/layer/layerrendersettings.cpp @@ -24,16 +24,15 @@ #include -namespace openspace { -namespace globebrowsing { - namespace { const char* keyOpacity = "Opacity"; const char* keyGamma = "Gamma"; const char* keyMultiplier = "Multiplier"; const char* keyOffset = "Offset"; const char* keyValueBlending = "ValueBlending"; -} +} // namespace + +namespace openspace::globebrowsing { LayerRenderSettings::LayerRenderSettings() : properties::PropertyOwner("Settings") @@ -112,5 +111,4 @@ void LayerRenderSettings::setDefaultValues() { valueBlending = 1.f; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/layer/layerrendersettings.h b/modules/globebrowsing/rendering/layer/layerrendersettings.h index 95538ee28d..3128556f1e 100644 --- a/modules/globebrowsing/rendering/layer/layerrendersettings.h +++ b/modules/globebrowsing/rendering/layer/layerrendersettings.h @@ -30,8 +30,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct LayerRenderSettings : public properties::PropertyOwner { LayerRenderSettings(); @@ -60,7 +59,6 @@ private: void setDefaultValues(); }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___LAYERRENDERSETTINGS___H__ diff --git a/modules/globebrowsing/rendering/layershadermanager.cpp b/modules/globebrowsing/rendering/layershadermanager.cpp index bf51dddfc2..a352b896cb 100644 --- a/modules/globebrowsing/rendering/layershadermanager.cpp +++ b/modules/globebrowsing/rendering/layershadermanager.cpp @@ -35,8 +35,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { bool LayerShaderManager::LayerShaderPreprocessingData::LayerGroupPreprocessingData::operator==( const LayerGroupPreprocessingData& other) const { @@ -79,7 +78,15 @@ LayerShaderManager::LayerShaderPreprocessingData const LayerGroup& layerGroup = layerManager->layerGroup(i); std::vector> layers = layerGroup.activeLayers(); - layeredTextureInfo.lastLayerIdx = layerGroup.activeLayers().size() - 1; + // This check was implicit before; not sure if it will fire or will be handled + // elsewhere + //ghoul_assert( + // !layerGroup.activeLayers().empty(), + // "If activeLayers is empty the following line will lead to an overflow" + //); + layeredTextureInfo.lastLayerIdx = static_cast( + layerGroup.activeLayers().size() - 1 + ); layeredTextureInfo.layerBlendingEnabled = layerGroup.layerBlendingEnabled(); for (const std::shared_ptr& layer : layers) { @@ -231,5 +238,4 @@ bool LayerShaderManager::updatedOnLastCall() { return _updatedOnLastCall; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/rendering/layershadermanager.h b/modules/globebrowsing/rendering/layershadermanager.h index 026e98ecd0..bb39b971f0 100644 --- a/modules/globebrowsing/rendering/layershadermanager.h +++ b/modules/globebrowsing/rendering/layershadermanager.h @@ -31,14 +31,9 @@ #include #include -namespace ghoul { -namespace opengl { -class ProgramObject; -} -} +namespace ghoul::opengl { class ProgramObject; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class RenderableGlobe; @@ -105,7 +100,6 @@ private: bool _updatedOnLastCall; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___LAYER_SHADER_MANAGER___H__ diff --git a/modules/globebrowsing/shaders/blending.hglsl b/modules/globebrowsing/shaders/blending.hglsl index 6bcba5a4b3..62de022b35 100644 --- a/modules/globebrowsing/shaders/blending.hglsl +++ b/modules/globebrowsing/shaders/blending.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -68,63 +68,59 @@ vec3 hsv2rgb(vec3 c) } */ -vec3 hsl2rgb( in vec3 c ) { - vec3 rgb = clamp( abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),6.0)-3.0)-1.0, 0.0, 1.0 ); +vec3 hsl2rgb(in vec3 c) { + vec3 rgb = clamp(abs(mod(c.x * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0); - return c.z + c.y * (rgb-0.5)*(1.0-abs(2.0*c.z-1.0)); + return c.z + c.y * (rgb - 0.5) * (1.0 - abs(2.0 * c.z - 1.0)); } -vec3 HueShift (in vec3 Color, in float Shift) { - vec3 P = vec3(0.55735)*dot(vec3(0.55735),Color); - - vec3 U = Color-P; - - vec3 V = cross(vec3(0.55735),U); - - Color = U*cos(Shift*6.2832) + V*sin(Shift*6.2832) + P; - - return vec3(Color); +vec3 HueShift(in vec3 color, in float shift) { + const vec3 P = vec3(0.55735) * dot(vec3(0.55735), color); + const vec3 U = color - P; + const vec3 V = cross(vec3(0.55735), U); + const vec3 c = U*cos(shift*6.2832) + V*sin(shift*6.2832) + P; + return c; } -vec3 rgb2hsl( in vec3 c ) { - float h = 0.0; +vec3 rgb2hsl(in vec3 c) { + float h = 0.0; float s = 0.0; float l = 0.0; float r = c.r; float g = c.g; float b = c.b; - float cMin = min( r, min( g, b ) ); - float cMax = max( r, max( g, b ) ); + float cMin = min(r, min(g, b)); + float cMax = max(r, max(g, b)); - l = ( cMax + cMin ) / 2.0; - if ( cMax > cMin ) { + l = (cMax + cMin) / 2.0; + if (cMax > cMin) { float cDelta = cMax - cMin; - + //s = l < .05 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) ); Original - s = l < .0 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) ); - + s = (l < 0.0) ? cDelta / (cMax + cMin) : cDelta / (2.0 - (cMax + cMin)); + if ( r == cMax ) { - h = ( g - b ) / cDelta; + h = (g - b) / cDelta; } else if ( g == cMax ) { - h = 2.0 + ( b - r ) / cDelta; + h = 2.0 + (b - r) / cDelta; } else { - h = 4.0 + ( r - g ) / cDelta; + h = 4.0 + (r - g) / cDelta; } - if ( h < 0.0) { + if (h < 0.0) { h += 6.0; } h = h / 6.0; } - return vec3( h, s, l ); + return vec3(h, s, l); } vec3 rgb2hsv(vec3 c) { vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); //vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); //vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); - vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); - vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); + vec4 p = (c.g < c.b) ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy); + vec4 q = (c.r < p.x) ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx); float d = q.x - min(q.w, q.y); float e = 1.0e-10; diff --git a/modules/globebrowsing/shaders/ellipsoid.hglsl b/modules/globebrowsing/shaders/ellipsoid.hglsl index 7589bee984..6a00242f58 100644 --- a/modules/globebrowsing/shaders/ellipsoid.hglsl +++ b/modules/globebrowsing/shaders/ellipsoid.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -32,36 +32,34 @@ struct PositionNormalPair { struct Intersection { bool intersects; - float nearParameter;// Along ray - float farParameter; // Along ray + float nearParameter; // Along ray + float farParameter; // Along ray }; -vec3 geodeticSurfaceNormal(float latitude, float longitude) -{ - float cosLat = cos(latitude); +vec3 geodeticSurfaceNormal(float latitude, float longitude) { + const float cosLat = cos(latitude); return vec3( cosLat * cos(longitude), cosLat * sin(longitude), - sin(latitude)); + sin(latitude) + ); } -PositionNormalPair geodetic3ToCartesian( - float latitude, - float longitude, - float height, - vec3 radiiSquared) +PositionNormalPair geodetic3ToCartesian(float latitude, float longitude, float height, + vec3 radiiSquared) { - vec3 normal = geodeticSurfaceNormal(latitude, longitude); - vec3 k = radiiSquared * normal; - float gamma = sqrt(dot(k, normal)); - vec3 rSurface = k / gamma; + const vec3 normal = geodeticSurfaceNormal(latitude, longitude); + const vec3 k = radiiSquared * normal; + const float gamma = sqrt(dot(k, normal)); + const vec3 rSurface = k / gamma; PositionNormalPair toReturn; toReturn.position = rSurface + height * normal; toReturn.normal = normal; return toReturn; } -PositionNormalPair geodetic2ToCartesian(float latitude, float longitude, vec3 radiiSquared) +PositionNormalPair geodetic2ToCartesian(float latitude, float longitude, + vec3 radiiSquared) { // Position on surface : height = 0 return geodetic3ToCartesian(latitude, longitude, 0, radiiSquared); @@ -71,34 +69,32 @@ vec3 latLonToCartesian(float latitude, float longitude, float radius) { return radius * vec3( cos(latitude) * cos(longitude), cos(latitude) * sin(longitude), - sin(latitude)); + sin(latitude) + ); } // // Assumes ellipsoid is at (0, 0, 0) // -Intersection rayIntersectEllipsoid( - vec3 rayOrigin, - vec3 rayOriginSquared, - vec3 rayDirection, - vec3 oneOverEllipsoidRadiiSquared) +Intersection rayIntersectEllipsoid(vec3 rayOrigin, vec3 rayOriginSquared, + vec3 rayDirection, vec3 oneOverEllipsoidRadiiSquared) { - float a = dot(rayDirection * rayDirection, oneOverEllipsoidRadiiSquared); - float b = 2.0 * dot(rayOrigin * rayDirection, oneOverEllipsoidRadiiSquared); - float c = dot(rayOriginSquared, oneOverEllipsoidRadiiSquared) - 1.0; - float discriminant = b * b - 4.0 * a * c; + const float a = dot(rayDirection * rayDirection, oneOverEllipsoidRadiiSquared); + const float b = 2.0 * dot(rayOrigin * rayDirection, oneOverEllipsoidRadiiSquared); + const float c = dot(rayOriginSquared, oneOverEllipsoidRadiiSquared) - 1.0; + const float discriminant = b * b - 4.0 * a * c; if (discriminant < 0.0) { return Intersection(false, 0.0, 0.0); } else if (discriminant == 0.0) { - float time = -0.5 * b / a; + const float time = -0.5 * b / a; return Intersection(true, time, time); } - float t = -0.5 * (b + (b > 0.0 ? 1.0 : -1.0) * sqrt(discriminant)); - float root1 = t / a; - float root2 = c / t; + const float t = -0.5 * (b + (b > 0.0 ? 1.0 : -1.0) * sqrt(discriminant)); + const float root1 = t / a; + const float root2 = c / t; return Intersection(true, min(root1, root2), max(root1, root2)); } diff --git a/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl b/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl index 8fde3ed3a4..00b8762ad1 100644 --- a/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl +++ b/modules/globebrowsing/shaders/globalchunkedlodpatch_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -30,7 +30,7 @@ Fragment getFragment() { frag.color = getTileFragColor(); #if SHOW_CHUNK_EDGES - frag.color += patchBorderOverlay(fs_uv, vec3(0,1,0), 0.02); + frag.color += patchBorderOverlay(fs_uv, vec3(0.0, 1.0, 0.0), 0.02); #endif // SHOW_CHUNK_EDGES // TODO: Change the color for the new deferred system (JCC) diff --git a/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl b/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl index 895fe388c0..e0023f11c5 100644 --- a/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl +++ b/modules/globebrowsing/shaders/globalchunkedlodpatch_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -31,18 +31,6 @@ #include <${MODULE_GLOBEBROWSING}/shaders/tileheight.hglsl> #include <${MODULE_GLOBEBROWSING}/shaders/tilevertexskirt.hglsl> -uniform mat4 modelViewProjectionTransform; -uniform mat4 modelViewTransform; -uniform vec3 radiiSquared; - -uniform vec2 minLatLon; -uniform vec2 lonLatScalingFactor; -uniform vec3 cameraPosition; -uniform float chunkMinHeight; - -uniform float distanceScaleFactor; -uniform int chunkLevel; - layout(location = 1) in vec2 in_uv; out vec2 fs_uv; @@ -57,20 +45,37 @@ out vec3 ellipsoidTangentThetaCameraSpace; out vec3 ellipsoidTangentPhiCameraSpace; #endif //USE_ACCURATE_NORMALS +uniform mat4 modelViewProjectionTransform; +uniform mat4 modelViewTransform; +uniform vec3 radiiSquared; + +uniform vec2 minLatLon; +uniform vec2 lonLatScalingFactor; +uniform vec3 cameraPosition; +uniform float chunkMinHeight; + +uniform float distanceScaleFactor; +uniform int chunkLevel; + + PositionNormalPair globalInterpolation(vec2 uv) { vec2 lonLatInput; lonLatInput.y = minLatLon.y + lonLatScalingFactor.y * uv.y; // Lat lonLatInput.x = minLatLon.x + lonLatScalingFactor.x * uv.x; // Lon - PositionNormalPair positionPairModelSpace = geodetic2ToCartesian(lonLatInput.y, lonLatInput.x, radiiSquared); + PositionNormalPair positionPairModelSpace = geodetic2ToCartesian( + lonLatInput.y, + lonLatInput.x, + radiiSquared + ); return positionPairModelSpace; } void main() { PositionNormalPair pair = globalInterpolation(in_uv); - float distToVertexOnEllipsoid = + const float distToVertexOnEllipsoid = length(pair.position + pair.normal * chunkMinHeight - cameraPosition); - float levelInterpolationParameter = + const float levelInterpolationParameter = getLevelInterpolationParameter( chunkLevel, distanceScaleFactor, @@ -89,18 +94,23 @@ void main() { // Calculate tangents // tileDelta is a step length (epsilon). Should be small enough for accuracy but not // Too small for precision. 1 / 512 is good. - float tileDelta = 1.0f / 512.0f; - PositionNormalPair pair10 = globalInterpolation(in_uv + vec2(1.0, 0.0) * tileDelta); - PositionNormalPair pair01 = globalInterpolation(in_uv + vec2(0.0, 1.0) * tileDelta); - vec3 ellipsoidTangentTheta = normalize(pair10.position - pair.position); - vec3 ellipsoidTangentPhi = normalize(pair01.position - pair.position); + const float tileDelta = 1.0 / 512.0; + const PositionNormalPair pair10 = globalInterpolation( + in_uv + vec2(1.0, 0.0) * tileDelta + ); + const PositionNormalPair pair01 = globalInterpolation( + in_uv + vec2(0.0, 1.0) * tileDelta + ); + const vec3 ellipsoidTangentTheta = normalize(pair10.position - pair.position); + const vec3 ellipsoidTangentPhi = normalize(pair01.position - pair.position); ellipsoidTangentThetaCameraSpace = mat3(modelViewTransform) * ellipsoidTangentTheta; ellipsoidTangentPhiCameraSpace = mat3(modelViewTransform) * ellipsoidTangentPhi; #endif // USE_ACCURATE_NORMALS // Add the height in the direction of the normal pair.position += pair.normal * height; - vec4 positionClippingSpace = modelViewProjectionTransform * vec4(pair.position, 1); + const vec4 positionClippingSpace = + modelViewProjectionTransform * vec4(pair.position, 1); // Write output fs_uv = in_uv; diff --git a/modules/globebrowsing/shaders/globeshading.hglsl b/modules/globebrowsing/shaders/globeshading.hglsl index 25b73cc827..cdaf0cf3d9 100644 --- a/modules/globebrowsing/shaders/globeshading.hglsl +++ b/modules/globebrowsing/shaders/globeshading.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -25,37 +25,32 @@ #ifndef GLOBESHADING_HGLSL #define GLOBESHADING_HGLSL -float orenNayarDiffuse( - vec3 lightDirection, - vec3 viewDirection, - vec3 surfaceNormal, - float roughness) +float orenNayarDiffuse(vec3 lightDirection, vec3 viewDirection, vec3 surfaceNormal, + float roughness) { // calculate intermediary values - float NdotL = dot(surfaceNormal, lightDirection); - float NdotV = dot(surfaceNormal, viewDirection); + const float NdotL = dot(surfaceNormal, lightDirection); + const float NdotV = dot(surfaceNormal, viewDirection); - float angleVN = acos(NdotV); - float angleLN = acos(NdotL); + const float angleVN = acos(NdotV); + const float angleLN = acos(NdotL); - float alpha = max(angleVN, angleLN); - float beta = min(angleVN, angleLN); - float gamma = dot( + const float alpha = max(angleVN, angleLN); + const float beta = min(angleVN, angleLN); + const float gamma = dot( viewDirection - surfaceNormal * dot(viewDirection, surfaceNormal), lightDirection - surfaceNormal * dot(lightDirection, surfaceNormal) ); - float roughnessSquared = roughness * roughness; + const float roughnessSquared = roughness * roughness; // calculate A and B - float A = 1.0 - 0.5 * (roughnessSquared / (roughnessSquared + 0.57)); - float B = 0.45 * (roughnessSquared / (roughnessSquared + 0.09)); - float C = sin(alpha) * tan(beta); + const float A = 1.0 - 0.5 * (roughnessSquared / (roughnessSquared + 0.57)); + const float B = 0.45 * (roughnessSquared / (roughnessSquared + 0.09)); + const float C = sin(alpha) * tan(beta); // put it all together - float L1 = max(0.0, NdotL) * (A + B * max(0.0, gamma) * C); - - return L1; + return max(0.0, NdotL) * (A + B * max(0.0, gamma) * C); } -#endif // GLOBESHADING_HGLSL \ No newline at end of file +#endif // GLOBESHADING_HGLSL diff --git a/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl b/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl index d925e154db..a2861a3a3c 100644 --- a/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl +++ b/modules/globebrowsing/shaders/localchunkedlodpatch_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * diff --git a/modules/globebrowsing/shaders/localchunkedlodpatch_vs.glsl b/modules/globebrowsing/shaders/localchunkedlodpatch_vs.glsl index a488502345..6076debffb 100644 --- a/modules/globebrowsing/shaders/localchunkedlodpatch_vs.glsl +++ b/modules/globebrowsing/shaders/localchunkedlodpatch_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -31,21 +31,6 @@ #include <${MODULE_GLOBEBROWSING}/shaders/tileheight.hglsl> #include <${MODULE_GLOBEBROWSING}/shaders/tilevertexskirt.hglsl> - -uniform mat4 projectionTransform; - -// Input points in camera space -uniform vec3 p00; -uniform vec3 p10; -uniform vec3 p01; -uniform vec3 p11; -uniform vec3 patchNormalCameraSpace; -uniform vec3 patchNormalModelSpace; -uniform float chunkMinHeight; - -uniform float distanceScaleFactor; -uniform int chunkLevel; - layout(location = 1) in vec2 in_uv; out vec2 fs_uv; @@ -60,6 +45,19 @@ out vec3 ellipsoidTangentThetaCameraSpace; out vec3 ellipsoidTangentPhiCameraSpace; #endif // USE_ACCURATE_NORMALS +uniform mat4 projectionTransform; +// Input points in camera space +uniform vec3 p00; +uniform vec3 p10; +uniform vec3 p01; +uniform vec3 p11; +uniform vec3 patchNormalCameraSpace; +uniform vec3 patchNormalModelSpace; +uniform float chunkMinHeight; + +uniform float distanceScaleFactor; +uniform int chunkLevel; + vec3 bilinearInterpolation(vec2 uv) { vec3 p0 = (1 - uv.x) * p00 + uv.x * p10; vec3 p1 = (1 - uv.x) * p01 + uv.x * p11; @@ -68,15 +66,14 @@ vec3 bilinearInterpolation(vec2 uv) { } void main() { - // Position in cameraspace vec3 p = bilinearInterpolation(in_uv); // Calculate desired level based on distance to the vertex on the ellipsoid // Before any heightmapping is done - float distToVertexOnEllipsoid = + const float distToVertexOnEllipsoid = length(p + patchNormalCameraSpace * chunkMinHeight); - float levelInterpolationParameter = + const float levelInterpolationParameter = getLevelInterpolationParameter( chunkLevel, distanceScaleFactor, @@ -85,16 +82,14 @@ void main() { // use level weight for height sampling, and output to fragment shader levelWeights = getLevelWeights(levelInterpolationParameter); - // Get the height value - float height = getTileHeightScaled(in_uv, levelWeights); - - // Apply skirts - height -= getTileVertexSkirtLength(); + // Get the height value and apply skirts + const float height = + getTileHeightScaled(in_uv, levelWeights) - getTileVertexSkirtLength(); // Translate the point along normal p += patchNormalCameraSpace * height; - vec4 positionClippingSpace = projectionTransform * vec4(p, 1); + const vec4 positionClippingSpace = projectionTransform * vec4(p, 1); #if USE_ACCURATE_NORMALS // Calculate tangents diff --git a/modules/globebrowsing/shaders/pointglobe_fs.glsl b/modules/globebrowsing/shaders/pointglobe_fs.glsl index 5977cfddab..3e70f7c165 100644 --- a/modules/globebrowsing/shaders/pointglobe_fs.glsl +++ b/modules/globebrowsing/shaders/pointglobe_fs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -24,22 +24,21 @@ #include "fragment.glsl" +in vec4 vs_positionClipSpace; +in vec2 vs_positionModelSpace; + //uniform vec3 directionToSunViewSpace; uniform vec3 positionCameraSpace; //uniform float lightOverflow; -in vec4 vs_positionClipSpace; -in vec2 vs_positionModelSpace; Fragment getFragment() { - - float alpha = 1 - sqrt(pow(vs_positionModelSpace.x, 2) + pow(vs_positionModelSpace.y, 2)); + float alpha = + 1.0 - sqrt(pow(vs_positionModelSpace.x, 2) + pow(vs_positionModelSpace.y, 2)); alpha = pow(alpha, 3); Fragment frag; - frag.color = vec4(1,1,1, alpha);// + vec4(1,1,1,1) * 0.0000000001 * directionToSunViewSpace.x; - //frag.color *= 1 + (lightOverflow * lightOverflow) * 0.0001; + frag.color = vec4(1.0, 1.0, 1.0, alpha); frag.depth = vs_positionClipSpace.w; frag.blend = BLEND_MODE_ADDITIVE; return frag; } - diff --git a/modules/globebrowsing/shaders/pointglobe_vs.glsl b/modules/globebrowsing/shaders/pointglobe_vs.glsl index c68b63d1bf..79e879f861 100644 --- a/modules/globebrowsing/shaders/pointglobe_vs.glsl +++ b/modules/globebrowsing/shaders/pointglobe_vs.glsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -28,26 +28,27 @@ layout(location = 0) in vec2 in_position; +out vec4 vs_positionClipSpace; +out vec4 vs_positionCameraSpace; +out vec2 vs_positionModelSpace; + uniform float lightIntensityClamped; uniform mat4 modelViewTransform; uniform mat4 projectionTransform; uniform mat4 directionToSunViewSpace; -out vec4 vs_positionClipSpace; -out vec4 vs_positionCameraSpace; -out vec2 vs_positionModelSpace; - void main() { vs_positionModelSpace = in_position; - float totalIntensity = lightIntensityClamped; - - vec4 positionCameraSpace = modelViewTransform * vec4(in_position * totalIntensity, 0, 1); - - // Position - vec4 positionClipSpace = projectionTransform * positionCameraSpace; + const float totalIntensity = lightIntensityClamped; + + const vec4 positionCameraSpace = modelViewTransform * vec4( + in_position * totalIntensity, + 0.0, + 1.0 + ); + const vec4 positionClipSpace = projectionTransform * positionCameraSpace; vs_positionClipSpace = z_normalization(positionClipSpace); - gl_Position = z_normalization(positionClipSpace); } diff --git a/modules/globebrowsing/shaders/texturetilemapping.hglsl b/modules/globebrowsing/shaders/texturetilemapping.hglsl index c3455c69de..b1b0472991 100644 --- a/modules/globebrowsing/shaders/texturetilemapping.hglsl +++ b/modules/globebrowsing/shaders/texturetilemapping.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -80,43 +80,40 @@ vec4 performLayerSettingsRGB(vec4 currentValue, const LayerSettings settings) { performLayerSettingsRGB(currentValue.r, settings), performLayerSettingsRGB(currentValue.g, settings), performLayerSettingsRGB(currentValue.b, settings), - currentValue.a); + currentValue.a + ); return newValue; } float performLayerSettingsAlpha(float currentValue, const LayerSettings settings) { - float newValue = currentValue; - newValue = newValue * settings.opacity; - return newValue; + return currentValue * settings.opacity; } vec4 performLayerSettingsAlpha(vec4 currentValue, const LayerSettings settings) { - vec4 newValue = currentValue; - newValue.a = performLayerSettingsAlpha(currentValue.a, settings); - return newValue; + return vec4(currentValue.rgb, performLayerSettingsAlpha(currentValue.a, settings)); } float performLayerSettings(float currentValue, const LayerSettings settings) { - float newValue = performLayerSettingsRGB(currentValue, settings); - newValue = performLayerSettingsAlpha(newValue, settings); - return newValue; + return performLayerSettingsAlpha( + performLayerSettingsRGB(currentValue, settings), + settings + ); } vec4 performLayerSettings(vec4 currentValue, const LayerSettings settings) { - vec4 newValue = performLayerSettingsRGB(currentValue, settings); - newValue = performLayerSettingsAlpha(newValue, settings); - return newValue; + return performLayerSettingsAlpha( + performLayerSettingsRGB(currentValue, settings), + settings + ); } #for id, layerGroup in layerGroups #for i in 0..#{lastLayerIndex#{layerGroup}} -vec4 getSample#{layerGroup}#{i}( - const vec2 uv, - const LevelWeights levelWeights, - const Layer #{layerGroup}[#{lastLayerIndex#{layerGroup}} + 1]) +vec4 getSample#{layerGroup}#{i}(const vec2 uv, const LevelWeights levelWeights, + const Layer #{layerGroup}[#{lastLayerIndex#{layerGroup}} + 1]) { vec4 color = vec4(0,0,0,1); @@ -178,12 +175,18 @@ vec4 blend#{layerGroup}#{i}(vec4 currentColor, vec4 newColor, float blendFactor) #for id, layerGroup in layerGroups #for i in 0..#{lastLayerIndex#{layerGroup}} -vec4 performAdjustment#{layerGroup}#{i}(vec4 currentColor, const LayerAdjustment adjustment) { +vec4 performAdjustment#{layerGroup}#{i}(vec4 currentColor, + const LayerAdjustment adjustment) +{ #if (#{#{layerGroup}#{i}LayerAdjustmentType} == 0) // Default, None - return currentColor; + return currentColor; #elif (#{#{layerGroup}#{i}LayerAdjustmentType} == 1) // ChromaKey - if (distance(currentColor.rgb, adjustment.chromaKeyColor) <= adjustment.chromaKeyTolerance) { - return vec4(0,0,0,0); + if (distance( + currentColor.rgb, + adjustment.chromaKeyColor + ) <= adjustment.chromaKeyTolerance) + { + return vec4(0.0); } else { return currentColor; diff --git a/modules/globebrowsing/shaders/tile.hglsl b/modules/globebrowsing/shaders/tile.hglsl index 922e261ee8..ac56c8fcb8 100644 --- a/modules/globebrowsing/shaders/tile.hglsl +++ b/modules/globebrowsing/shaders/tile.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -41,7 +41,7 @@ vec4 patchBorderOverlay(vec2 uv, vec3 borderColor, float borderSize) { ///////////////////////////////////////////////////////////////////// -// ChunkTile Depth Transform // +// ChunkTile Depth Transform // ///////////////////////////////////////////////////////////////////// struct TileDepthTransform { @@ -49,16 +49,17 @@ struct TileDepthTransform { float depthOffset; }; -float getTransformedTexVal(const TileDepthTransform transform, const float val){ +float getTransformedTexVal(const TileDepthTransform transform, const float val) { return transform.depthOffset + transform.depthScale * val; } -vec4 getTransformedTexVal(const TileDepthTransform transform, const vec4 val){ +vec4 getTransformedTexVal(const TileDepthTransform transform, const vec4 val) { return transform.depthOffset + transform.depthScale * val; } + ///////////////////////////////////////////////////////////////////// -// ChunkTile UV Transform // +// ChunkTile UV Transform // ///////////////////////////////////////////////////////////////////// struct TileUvTransform { @@ -68,40 +69,47 @@ struct TileUvTransform { ///////////////////////////////////////////////////////////////////// -// ChunkTile // +// ChunkTile // ///////////////////////////////////////////////////////////////////// + struct ChunkTile { sampler2D textureSampler; TileUvTransform uvTransform; }; -vec2 compensateSourceTextureSampling(vec2 startOffset, vec2 sizeDiff, const ChunkTile chunkTile, vec2 tileUV){ - ivec2 resolution = textureSize(chunkTile.textureSampler, 0); +vec2 compensateSourceTextureSampling(vec2 startOffset, vec2 sizeDiff, + const ChunkTile chunkTile, vec2 tileUV) +{ + const ivec2 resolution = textureSize(chunkTile.textureSampler, 0); - vec2 sourceSize = vec2(resolution) + sizeDiff; - vec2 currentSize = vec2(resolution); - vec2 sourceToCurrentSize = currentSize / sourceSize; - tileUV = sourceToCurrentSize * (tileUV - startOffset / sourceSize); - return tileUV; + const vec2 sourceSize = vec2(resolution) + sizeDiff; + const vec2 currentSize = vec2(resolution); + const vec2 sourceToCurrentSize = currentSize / sourceSize; + return sourceToCurrentSize * (tileUV - startOffset / sourceSize); } -vec2 TileUVToTextureSamplePosition(const ChunkTile chunkTile, vec2 tileUV){ +vec2 TileUVToTextureSamplePosition(const ChunkTile chunkTile, vec2 tileUV) { vec2 uv = chunkTile.uvTransform.uvOffset + chunkTile.uvTransform.uvScale * tileUV; - uv = compensateSourceTextureSampling(TILE_PIXEL_START_OFFSET, TILE_PIXEL_SIZE_DIFFERENCE, chunkTile, uv); - return uv; + return compensateSourceTextureSampling( + TILE_PIXEL_START_OFFSET, + TILE_PIXEL_SIZE_DIFFERENCE, + chunkTile, + uv + ); } -vec4 getTexVal(const ChunkTile chunkTile, vec2 tileUV){ - vec2 samplePosition = TileUVToTextureSamplePosition(chunkTile, tileUV); - vec4 texVal = texture(chunkTile.textureSampler, samplePosition); - return texVal; +vec4 getTexVal(const ChunkTile chunkTile, vec2 tileUV) { + return texture( + chunkTile.textureSampler, + TileUVToTextureSamplePosition(chunkTile, tileUV) + ); } - ///////////////////////////////////////////////////////////////////// // Chunk Tile Pile // ///////////////////////////////////////////////////////////////////// + struct ChunkTilePile { ChunkTile chunkTile0; ChunkTile chunkTile1; @@ -137,21 +145,26 @@ struct LevelWeights { float w3; }; -float getLevelInterpolationParameter(int chunkLevel, float distanceScaleFactor, float distToVertexOnEllipsoid){ - float projectedScaleFactor = distanceScaleFactor / distToVertexOnEllipsoid; - float desiredLevel = log2(projectedScaleFactor); +float getLevelInterpolationParameter(int chunkLevel, float distanceScaleFactor, + float distToVertexOnEllipsoid) +{ + const float projectedScaleFactor = distanceScaleFactor / distToVertexOnEllipsoid; + const float desiredLevel = log2(projectedScaleFactor); return chunkLevel - desiredLevel; } -LevelWeights getLevelWeights(float levelInterpolationParameter){ +LevelWeights getLevelWeights(float levelInterpolationParameter) { LevelWeights levelWeights; - levelWeights.w1 = clamp(1 - levelInterpolationParameter, 0 , 1); - levelWeights.w2 = (clamp(levelInterpolationParameter, 0 , 1) - clamp(levelInterpolationParameter - 1, 0 , 1)); - levelWeights.w3 = clamp(levelInterpolationParameter - 1, 0 , 1); + levelWeights.w1 = clamp(1.0 - levelInterpolationParameter, 0.0, 1.0); + levelWeights.w2 = ( + clamp(levelInterpolationParameter, 0.0, 1.0) - + clamp(levelInterpolationParameter - 1.0, 0.0, 1.0) + ); + levelWeights.w3 = clamp(levelInterpolationParameter - 1.0, 0.0, 1.0); return levelWeights; } -LevelWeights getDefaultLevelWeights(){ +LevelWeights getDefaultLevelWeights() { LevelWeights levelWeights; levelWeights.w1 = 1; levelWeights.w2 = 0; @@ -159,12 +172,10 @@ LevelWeights getDefaultLevelWeights(){ return levelWeights; } - -vec4 getTexVal(const ChunkTilePile chunkTilePile, const LevelWeights w, const vec2 uv){ +vec4 getTexVal(const ChunkTilePile chunkTilePile, const LevelWeights w, const vec2 uv) { return w.w1 * getTexVal(chunkTilePile.chunkTile0, uv) + w.w2 * getTexVal(chunkTilePile.chunkTile1, uv) + w.w3 * getTexVal(chunkTilePile.chunkTile2, uv); } - #endif // TEXTURETILE_HGLSL diff --git a/modules/globebrowsing/shaders/tilefragcolor.hglsl b/modules/globebrowsing/shaders/tilefragcolor.hglsl index 906b7c242b..0261e7dc5a 100644 --- a/modules/globebrowsing/shaders/tilefragcolor.hglsl +++ b/modules/globebrowsing/shaders/tilefragcolor.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -30,9 +30,7 @@ #include <${MODULE_GLOBEBROWSING}/shaders/tileheight.hglsl> #include "PowerScaling/powerScaling_fs.hglsl" - -// Below are all the tiles that are used for contributing -// the actual fragment color +// Below are all the tiles that are used for contributing the actual fragment color #if USE_COLORTEXTURE uniform Layer ColorLayers[NUMLAYERS_COLORTEXTURE]; @@ -59,12 +57,12 @@ uniform vec2 vertexResolution; #endif // USE_ATMOSPHERE #if USE_NIGHTTEXTURE || USE_WATERMASK || USE_ATMOSPHERE || PERFORM_SHADING - uniform vec3 lightDirectionCameraSpace; - float waterReflectance = 0.0; +uniform vec3 lightDirectionCameraSpace; +float waterReflectance = 0.0; #endif #if PERFORM_SHADING - uniform float orenNayarRoughness; +uniform float orenNayarRoughness; #endif in vec4 fs_position; @@ -88,15 +86,17 @@ in LevelWeights levelWeights; * */ vec4 getTileFragColor() { - - vec4 color = vec4(0.3,0.3,0.3,1); + vec4 color = vec4(0.3, 0.3, 0.3, 1.0); vec3 normal = normalize(ellipsoidNormalCameraSpace); #if USE_ACCURATE_NORMALS - normal = getTileNormal(fs_uv, levelWeights, - normalize(ellipsoidNormalCameraSpace), - normalize(ellipsoidTangentThetaCameraSpace), - normalize(ellipsoidTangentPhiCameraSpace)); + normal = getTileNormal( + fs_uv, + levelWeights, + normalize(ellipsoidNormalCameraSpace), + normalize(ellipsoidTangentThetaCameraSpace), + normalize(ellipsoidTangentPhiCameraSpace) + ); #endif /// USE_ACCURATE_NORMALS #if USE_COLORTEXTURE @@ -104,7 +104,8 @@ vec4 getTileFragColor() { color, fs_uv, levelWeights, - ColorLayers); + ColorLayers + ); #endif // USE_COLORTEXTURE #if USE_WATERMASK @@ -116,7 +117,8 @@ vec4 getTileFragColor() { normal, lightDirectionCameraSpace, // Should already be normalized positionCameraSpace, - waterReflectance); + waterReflectance + ); #endif // USE_WATERMASK @@ -127,7 +129,8 @@ vec4 getTileFragColor() { levelWeights, NightLayers, normalize(ellipsoidNormalCameraSpace), - lightDirectionCameraSpace); // Should already be normalized + lightDirectionCameraSpace // Should already be normalized + ); #endif // USE_NIGHTTEXTURE @@ -137,29 +140,30 @@ vec4 getTileFragColor() { normal, lightDirectionCameraSpace, normalize(positionCameraSpace), - orenNayarRoughness); + orenNayarRoughness + ); #endif // PERFORM_SHADING #if USE_ATMOSPHERE // Temporary until the real atmosphere code is here //color = color + vec4(0.5,0.5,1,0) * 0.3; // Just to see something for now - vec3 n = normalize(ellipsoidNormalCameraSpace); - vec3 l = lightDirectionCameraSpace; - vec3 c = normalize(positionCameraSpace); + const vec3 n = normalize(ellipsoidNormalCameraSpace); + const vec3 l = lightDirectionCameraSpace; + const vec3 c = normalize(positionCameraSpace); float cosFactor = 1 - clamp(dot(-n * 0.9, c), 0, 1); cosFactor *= 1.1; cosFactor -= 0.1; - cosFactor = clamp(cosFactor, 0, 1); + cosFactor = clamp(cosFactor, 0.0, 1.0); cosFactor = cosFactor + pow(cosFactor, 5); - float shadowLight = 0.15; - float cosFactorLight = pow(max(dot(-l, n), -shadowLight) + shadowLight, 0.8); + const float shadowLight = 0.15; + const float cosFactorLight = pow(max(dot(-l, n), -shadowLight) + shadowLight, 0.8); //float cosFactorScatter = pow(max(dot(l, n) + shadowLight, 0), 5); //float cosFactorLight = max(dot(-lightDirectionCameraSpace, normalize(ellipsoidNormalCameraSpace)), 0); //vec3 r = reflect(l, n); //float scatteredLight = pow(clamp(dot(-r,c), 0, 1), 20); - vec3 atmosphereColor = vec3(0.5,0.5,1) * 2; - color = color + vec4(atmosphereColor,0) * cosFactor * cosFactorLight * 0.5; + const vec3 atmosphereColor = vec3(0.5, 0.5, 1.0) * 2.0; + color += vec4(atmosphereColor,0) * cosFactor * cosFactorLight * 0.5; #endif // USE_ATMOSPHERE #if USE_OVERLAY @@ -167,7 +171,8 @@ vec4 getTileFragColor() { color, fs_uv, levelWeights, - Overlays); + Overlays + ); #endif // USE_OVERLAY #if SHOW_HEIGHT_INTENSITIES @@ -176,7 +181,7 @@ vec4 getTileFragColor() { color.b *= 0.1; float untransformedHeight = getUntransformedTileVertexHeight(fs_uv, levelWeights); - float contourLine = fract(10*untransformedHeight) > 0.98 ? 1 : 0; + float contourLine = fract(10.0 * untransformedHeight) > 0.98 ? 1.0 : 0.0; color.r += untransformedHeight; color.b = contourLine; #endif @@ -189,9 +194,7 @@ vec4 getTileFragColor() { #endif #endif - return color; } - #endif ///TILE_FRAG_COLOR_HGLSL diff --git a/modules/globebrowsing/shaders/tileheight.hglsl b/modules/globebrowsing/shaders/tileheight.hglsl index 2f8b6ea746..98f4f0661a 100644 --- a/modules/globebrowsing/shaders/tileheight.hglsl +++ b/modules/globebrowsing/shaders/tileheight.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -30,7 +30,6 @@ #include <${MODULE_GLOBEBROWSING}/shaders/tile.hglsl> #include <${MODULE_GLOBEBROWSING}/shaders/ellipsoid.hglsl> - #ifndef USE_HEIGHTMAP #define USE_HEIGHTMAP #{useAccurateNormals} #endif //USE_HEIGHTMAP @@ -52,7 +51,7 @@ uniform float deltaPhi1; uniform float tileDelta; #endif //USE_ACCURATE_NORMALS -float getUntransformedTileHeight(vec2 uv, LevelWeights levelWeights){ +float getUntransformedTileHeight(vec2 uv, LevelWeights levelWeights) { float height = CHUNK_DEFAULT_HEIGHT; #if USE_HEIGHTMAP @@ -60,15 +59,15 @@ float getUntransformedTileHeight(vec2 uv, LevelWeights levelWeights){ // Before any heightmapping is done height = calculateUntransformedHeight( uv, - levelWeights, // Variable to determine which texture to sample from - HeightLayers); // Three textures to sample from - + levelWeights, // Variable to determine which texture to sample from + HeightLayers // Three textures to sample from + ); #endif // USE_HEIGHTMAP return height; } -float getTileHeight(vec2 uv, LevelWeights levelWeights){ +float getTileHeight(vec2 uv, LevelWeights levelWeights) { float height = CHUNK_DEFAULT_HEIGHT; #if USE_HEIGHTMAP @@ -76,14 +75,15 @@ float getTileHeight(vec2 uv, LevelWeights levelWeights){ // Before any heightmapping is done height = calculateHeight( uv, - levelWeights, // Variable to determine which texture to sample from - HeightLayers); // Three textures to sample from + levelWeights, // Variable to determine which texture to sample from + HeightLayers // Three textures to sample from + ); #endif // USE_HEIGHTMAP return height; } -float getTileHeightScaled(vec2 uv, LevelWeights levelWeights){ +float getTileHeightScaled(vec2 uv, LevelWeights levelWeights) { float height = getTileHeight(uv, levelWeights); #if USE_HEIGHTMAP @@ -93,33 +93,30 @@ float getTileHeightScaled(vec2 uv, LevelWeights levelWeights){ return height; } -vec3 getTileNormal( - vec2 uv, - LevelWeights levelWeights, - vec3 ellipsoidNormalCameraSpace, - vec3 ellipsoidTangentThetaCameraSpace, - vec3 ellipsoidTangentPhiCameraSpace) +vec3 getTileNormal(vec2 uv, LevelWeights levelWeights, vec3 ellipsoidNormalCameraSpace, + vec3 ellipsoidTangentThetaCameraSpace, + vec3 ellipsoidTangentPhiCameraSpace) { - vec3 normal = ellipsoidNormalCameraSpace; + return ellipsoidNormalCameraSpace; #if USE_ACCURATE_NORMALS - float deltaPhi = mix(deltaPhi0, deltaPhi1, uv.x); - float deltaTheta = mix(deltaTheta0, deltaTheta1, uv.y); + const float deltaPhi = mix(deltaPhi0, deltaPhi1, uv.x); + const float deltaTheta = mix(deltaTheta0, deltaTheta1, uv.y); - vec3 deltaPhiVec = ellipsoidTangentPhiCameraSpace * deltaPhi; - vec3 deltaThetaVec = ellipsoidTangentThetaCameraSpace * deltaTheta; + const vec3 deltaPhiVec = ellipsoidTangentPhiCameraSpace * deltaPhi; + const vec3 deltaThetaVec = ellipsoidTangentThetaCameraSpace * deltaTheta; - float height00 = getTileHeightScaled(uv, levelWeights); - float height10 = getTileHeightScaled(uv + vec2(tileDelta, 0.0f), levelWeights); - float height01 = getTileHeightScaled(uv + vec2(0.0f, tileDelta), levelWeights); + const float height00 = getTileHeightScaled(uv, levelWeights); + const float height10 = getTileHeightScaled(uv + vec2(tileDelta, 0.0f), levelWeights); + const float height01 = getTileHeightScaled(uv + vec2(0.0f, tileDelta), levelWeights); - vec3 diffTheta = deltaThetaVec + ellipsoidNormalCameraSpace * (height10 - height00); - vec3 diffPhi = deltaPhiVec + ellipsoidNormalCameraSpace * (height01 - height00); + const vec3 diffTheta = + deltaThetaVec + ellipsoidNormalCameraSpace * (height10 - height00); + const vec3 diffPhi = + deltaPhiVec + ellipsoidNormalCameraSpace * (height01 - height00); - normal = normalize(cross(diffTheta, diffPhi)); + return normalize(cross(diffTheta, diffPhi)); #endif // USE_ACCURATE_NORMALS - return normal; } - #endif // TILE_HEIGHT_HGLSL diff --git a/modules/globebrowsing/shaders/tilevertexskirt.hglsl b/modules/globebrowsing/shaders/tilevertexskirt.hglsl index 1c86a24986..de2aa6b435 100644 --- a/modules/globebrowsing/shaders/tilevertexskirt.hglsl +++ b/modules/globebrowsing/shaders/tilevertexskirt.hglsl @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014-2017 * + * Copyright (c) 2014 - 2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -30,14 +30,14 @@ uniform int xSegments; uniform float skirtLength; -bool tileVertexIsSkirtVertex(){ - int vertexIDx = gl_VertexID % (xSegments + 3); - int vertexIDy = gl_VertexID / (xSegments + 3); +bool tileVertexIsSkirtVertex() { + const int vertexIDx = gl_VertexID % (xSegments + 3); + const int vertexIDy = gl_VertexID / (xSegments + 3); return vertexIDx == 0 || vertexIDy == 0 || vertexIDx == (xSegments + 2) || vertexIDy == (xSegments + 2); } -float getTileVertexSkirtLength(){ +float getTileVertexSkirtLength() { return tileVertexIsSkirtVertex() ? skirtLength : 0.0; } diff --git a/modules/globebrowsing/tile/asynctiledataprovider.cpp b/modules/globebrowsing/tile/asynctiledataprovider.cpp index 46723e5fbc..3371048b61 100644 --- a/modules/globebrowsing/tile/asynctiledataprovider.cpp +++ b/modules/globebrowsing/tile/asynctiledataprovider.cpp @@ -37,8 +37,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { namespace { const char* _loggerCat = "AsyncTileDataProvider"; @@ -266,5 +265,4 @@ float AsyncTileDataProvider::noDataValueAsFloat() const { return _rawTileDataReader->noDataValueAsFloat(); } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/asynctiledataprovider.h b/modules/globebrowsing/tile/asynctiledataprovider.h index d318eb3851..7a00c487e2 100644 --- a/modules/globebrowsing/tile/asynctiledataprovider.h +++ b/modules/globebrowsing/tile/asynctiledataprovider.h @@ -25,7 +25,6 @@ #ifndef __OPENSPACE_MODULE_GLOBEBROWSING___ASYNC_TILE_DATAPROVIDER___H__ #define __OPENSPACE_MODULE_GLOBEBROWSING___ASYNC_TILE_DATAPROVIDER___H__ - #include #include @@ -39,8 +38,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { //class GlobeBrowsingModule; struct RawTile; @@ -128,7 +126,6 @@ private: bool _shouldBeDeleted; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___ASYNC_TILE_DATAPROVIDER___H__ diff --git a/modules/globebrowsing/tile/chunktile.h b/modules/globebrowsing/tile/chunktile.h index 3fa3bcde07..e5abc5b699 100644 --- a/modules/globebrowsing/tile/chunktile.h +++ b/modules/globebrowsing/tile/chunktile.h @@ -30,8 +30,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct ChunkTile { ChunkTile() : tile(Tile::TileUnavailable) {}; @@ -47,7 +46,6 @@ struct ChunkTile { using ChunkTilePile = std::vector; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___CHUNKTILE___H__ diff --git a/modules/globebrowsing/tile/pixelregion.cpp b/modules/globebrowsing/tile/pixelregion.cpp index 4375afd19a..e0aa166d83 100644 --- a/modules/globebrowsing/tile/pixelregion.cpp +++ b/modules/globebrowsing/tile/pixelregion.cpp @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { PixelRegion::PixelRegion(const PixelCoordinate& pixelStart, const PixelRange& numberOfPixels) @@ -258,13 +257,15 @@ PixelRegion::PixelCoordinate PixelRegion::end() const { bool PixelRegion::lineIntersect(Side side, int p) { switch (side) { - case Side::LEFT: - case Side::RIGHT: - return start.x <= p && p <= (start.x + numPixels.x); + case Side::LEFT: + case Side::RIGHT: + return start.x <= p && p <= (start.x + numPixels.x); - case Side::TOP: - case Side::BOTTOM: - return start.y <= p && p <= (start.y + numPixels.y); + case Side::TOP: + case Side::BOTTOM: + return start.y <= p && p <= (start.y + numPixels.y); + default: + throw ghoul::MissingCaseException(); } } @@ -278,5 +279,4 @@ bool PixelRegion::equals(const PixelRegion& r) const { return start == r.start && numPixels == r.numPixels; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/pixelregion.h b/modules/globebrowsing/tile/pixelregion.h index e85f2a84b1..05c43d961e 100644 --- a/modules/globebrowsing/tile/pixelregion.h +++ b/modules/globebrowsing/tile/pixelregion.h @@ -27,8 +27,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct PixelRegion { using PixelCoordinate = glm::ivec2; @@ -100,7 +99,6 @@ struct PixelRegion { PixelRange numPixels; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___PIXELREGION___H__ diff --git a/modules/globebrowsing/tile/rawtile.cpp b/modules/globebrowsing/tile/rawtile.cpp index a8afc49b01..ec36caa9fc 100644 --- a/modules/globebrowsing/tile/rawtile.cpp +++ b/modules/globebrowsing/tile/rawtile.cpp @@ -27,8 +27,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { RawTile::RawTile() : imageData(nullptr) @@ -48,5 +47,4 @@ RawTile RawTile::createDefault(const TileTextureInitData& initData) { } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/rawtile.h b/modules/globebrowsing/tile/rawtile.h index 5b609b16f4..9ef0023f53 100644 --- a/modules/globebrowsing/tile/rawtile.h +++ b/modules/globebrowsing/tile/rawtile.h @@ -33,14 +33,12 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct TileMetaData; class TileTextureInitData; struct RawTile { - enum class ReadError { None = 0, Debug = 1, @@ -61,8 +59,6 @@ struct RawTile { static RawTile createDefault(const TileTextureInitData& initData); }; -} // namespace globebrowsing -} // namespace openspace - +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___RAWTILE___H__ diff --git a/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp b/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp index 45eaa90a8b..c6838bca67 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp @@ -21,6 +21,7 @@ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ + #ifdef GLOBEBROWSING_USE_GDAL #include @@ -45,11 +46,10 @@ #include namespace { - const std::string _loggerCat = "GdalRawTileDataReader"; + const char* _loggerCat = "GdalRawTileDataReader"; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { std::ostream& operator<<(std::ostream& os, const PixelRegion& pr) { return os << pr.start.x << ", " << pr.start.y << " with size " << pr.numPixels.x << @@ -337,8 +337,8 @@ RawTile::ReadError GdalRawTileDataReader::rasterRead( dataDest += io.write.region.start.x * _initData.bytesPerPixel(); GDALRasterBand* gdalRasterBand = _dataset->GetRasterBand(rasterBand); - CPLErr readError = CE_Failure; - readError = gdalRasterBand->RasterIO( + CPLErr readError = CE_Failure; + readError = gdalRasterBand->RasterIO( GF_Read, io.read.region.start.x, // Begin read x io.read.region.start.y, // Begin read y @@ -397,7 +397,6 @@ int GdalRawTileDataReader::calculateTileLevelDifference(int minimumPixelSize) co return diff; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing -#endif // GLOBEBROWSING_USE_GDAL \ No newline at end of file +#endif // GLOBEBROWSING_USE_GDAL diff --git a/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.h b/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.h index 8280b61ec3..1ffbd64b54 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.h +++ b/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.h @@ -47,8 +47,7 @@ class GDALDataset; class GDALRasterBand; -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class GeodeticPatch; @@ -133,8 +132,7 @@ private: mutable std::mutex _datasetLock; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // GLOBEBROWSING_USE_GDAL diff --git a/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.cpp b/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.cpp index 952dbb93f8..0e09f07d9d 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.cpp @@ -37,10 +37,9 @@ namespace { const char* _loggerCat = "GdalWrapper"; -} +} // namespace -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void gdalErrorHandler(CPLErr eErrClass, int errNo, const char *msg) { if (GdalWrapper::ref().logGdalErrors()) { @@ -183,8 +182,6 @@ void GdalWrapper::setGdalProxyConfiguration() { } } - -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // GLOBEBROWSING_USE_GDAL diff --git a/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h b/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h index 643aaf55ff..6b18be0a3d 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h +++ b/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h @@ -36,8 +36,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { /** * Function for passing GDAL error messages to the GHOUL logging system. @@ -88,8 +87,7 @@ private: static std::mutex _mutexLock; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // GLOBEBROWSING_USE_GDAL diff --git a/modules/globebrowsing/tile/rawtiledatareader/iodescription.cpp b/modules/globebrowsing/tile/rawtiledatareader/iodescription.cpp index 77597f562c..bf46400e8d 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/iodescription.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/iodescription.cpp @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { IODescription IODescription::cut(PixelRegion::Side side, int pos) { PixelRegion readPreCut = read.region; @@ -62,5 +61,4 @@ IODescription IODescription::cut(PixelRegion::Side side, int pos) { return whatCameOff; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/rawtiledatareader/iodescription.h b/modules/globebrowsing/tile/rawtiledatareader/iodescription.h index a469492c30..7e561bf694 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/iodescription.h +++ b/modules/globebrowsing/tile/rawtiledatareader/iodescription.h @@ -33,8 +33,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct IODescription { struct ReadData { @@ -52,7 +51,6 @@ struct IODescription { IODescription cut(PixelRegion::Side side, int pos); }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___IO_DESCRIPTION___H__ diff --git a/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp b/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp index b88fb167ed..66c8320816 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp @@ -53,8 +53,7 @@ #define _USE_MATH_DEFINES #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { const PixelRegion RawTileDataReader::padding = PixelRegion( TileTextureInitData::tilePixelStartOffset, @@ -410,5 +409,4 @@ RawTile::ReadError RawTileDataReader::postProcessErrorCheck( return RawTile::ReadError::None; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.h b/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.h index 4d0b5197e9..c7bfbbf975 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.h +++ b/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.h @@ -40,8 +40,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class GeodeticPatch; @@ -172,7 +171,6 @@ private: bool _hasBeenInitialized; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___RAW_TILE_DATA_READER___H__ diff --git a/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp b/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp index e0d4d72ac7..d8ac4908ff 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp @@ -38,11 +38,10 @@ #include namespace { - const std::string _loggerCat = "SimpleRawTileDataReader"; -} + const char* _loggerCat = "SimpleRawTileDataReader"; +} // namespace -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { SimpleRawTileDataReader::SimpleRawTileDataReader(const std::string& filePath, const TileTextureInitData& initData, @@ -160,5 +159,4 @@ RawTile::ReadError SimpleRawTileDataReader::rasterRead( } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.h b/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.h index 0716dca804..970584b88d 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.h +++ b/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.h @@ -39,8 +39,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class GeodeticPatch; @@ -78,7 +77,6 @@ private: std::unique_ptr _dataTexture; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___SIMPLE_RAW_TILE_DATA_READER___H__ diff --git a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp index 4278175d9b..b9acd07e37 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp @@ -42,11 +42,9 @@ namespace { const char* _loggerCat = "TileDataType"; -} +} // namespace -namespace openspace { -namespace globebrowsing { -namespace tiledatatype { +namespace openspace::globebrowsing::tiledatatype { #ifdef GLOBEBROWSING_USE_GDAL @@ -618,6 +616,4 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { } } -} // namespace tiledatatype -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::tiledatatype diff --git a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.h b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.h index a0961bd6d0..d4881cff3e 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.h +++ b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.h @@ -34,9 +34,7 @@ #include #endif // GLOBEBROWSING_USE_GDAL -namespace openspace { -namespace globebrowsing { -namespace tiledatatype { +namespace openspace::globebrowsing::tiledatatype { #ifdef GLOBEBROWSING_USE_GDAL GLenum getOpenGLDataType(GDALDataType gdalType); @@ -54,8 +52,6 @@ size_t numberOfBytes(GLenum glType); size_t getMaximumValue(GLenum glType); float interpretFloat(GLenum glType, const char* src); -} // namespace tiledatatype -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::tiledatatype #endif // __OPENSPACE_MODULE_GLOBEBROWSING___TILE_DATA_TYPE___H__ diff --git a/modules/globebrowsing/tile/textureformat.h b/modules/globebrowsing/tile/textureformat.h index 607a804faf..c19a5ea38e 100644 --- a/modules/globebrowsing/tile/textureformat.h +++ b/modules/globebrowsing/tile/textureformat.h @@ -28,16 +28,13 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct TextureFormat { ghoul::opengl::Texture::Format ghoulFormat; GLenum glFormat; }; - -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___TEXTUREFORMAT___H__ diff --git a/modules/globebrowsing/tile/tile.cpp b/modules/globebrowsing/tile/tile.cpp index dc851ef376..f05b9ebe84 100644 --- a/modules/globebrowsing/tile/tile.cpp +++ b/modules/globebrowsing/tile/tile.cpp @@ -28,11 +28,10 @@ #include namespace { - const std::string _loggerCat = "Tile"; -} + const char* _loggerCat = "Tile"; +} // namespace -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { const Tile Tile::TileUnavailable = Tile(nullptr, nullptr, Tile::Status::Unavailable); @@ -65,5 +64,4 @@ glm::vec2 Tile::TileUvToTextureSamplePosition(const TileUvTransform& uvTransform return uv; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/tile.h b/modules/globebrowsing/tile/tile.h index 97056193af..7f4e617f0b 100644 --- a/modules/globebrowsing/tile/tile.h +++ b/modules/globebrowsing/tile/tile.h @@ -30,12 +30,9 @@ #include -namespace ghoul { namespace opengl { - class Texture; -}} +namespace ghoul::opengl { class Texture; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct TileMetaData; struct TileUvTransform; @@ -104,8 +101,7 @@ private: Status _status; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___TILE___H__ diff --git a/modules/globebrowsing/tile/tiledepthtransform.h b/modules/globebrowsing/tile/tiledepthtransform.h index 9212863b72..4734684b01 100644 --- a/modules/globebrowsing/tile/tiledepthtransform.h +++ b/modules/globebrowsing/tile/tiledepthtransform.h @@ -25,15 +25,13 @@ #ifndef __OPENSPACE_MODULE_GLOBEBROWSING___TILEDEPTHTRANSFORM___H__ #define __OPENSPACE_MODULE_GLOBEBROWSING___TILEDEPTHTRANSFORM___H__ -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct TileDepthTransform { float depthScale; float depthOffset; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___TILEDEPTHTRANSFORM___H__ diff --git a/modules/globebrowsing/tile/tileindex.cpp b/modules/globebrowsing/tile/tileindex.cpp index c6fb3147d6..73d78e2885 100644 --- a/modules/globebrowsing/tile/tileindex.cpp +++ b/modules/globebrowsing/tile/tileindex.cpp @@ -34,10 +34,9 @@ namespace { const char* KeyLevel = "Level"; const char* KeyX = "X"; const char* KeyY = "Y"; -} +} // namespace -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { TileIndex::TileIndex(int x, int y, int level) : x(x), y(y), level(level) @@ -154,5 +153,4 @@ std::ostream& operator<<(std::ostream& os, const TileIndex& ci) { return os; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/tileindex.h b/modules/globebrowsing/tile/tileindex.h index 41d0fb0b77..ee78c8842b 100644 --- a/modules/globebrowsing/tile/tileindex.h +++ b/modules/globebrowsing/tile/tileindex.h @@ -30,12 +30,9 @@ #include #include -namespace ghoul { - class Dictionary; -} +namespace ghoul { class Dictionary; } -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct Geodetic2; @@ -117,7 +114,6 @@ struct TileIndex { std::ostream& operator<<(std::ostream& os, const TileIndex& ti); -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___TILE_INDEX___H__ diff --git a/modules/globebrowsing/tile/tileloadjob.cpp b/modules/globebrowsing/tile/tileloadjob.cpp index 3fe11ae7e1..ab76bf23da 100644 --- a/modules/globebrowsing/tile/tileloadjob.cpp +++ b/modules/globebrowsing/tile/tileloadjob.cpp @@ -26,8 +26,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { TileLoadJob::TileLoadJob(std::shared_ptr rawTileDataReader, const TileIndex& tileIndex) @@ -75,5 +74,4 @@ bool TileLoadJob::hasOwnershipOfData() const { return _hasOwnershipOfData; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/tileloadjob.h b/modules/globebrowsing/tile/tileloadjob.h index 06daeb0f5d..9c6db1aac2 100644 --- a/modules/globebrowsing/tile/tileloadjob.h +++ b/modules/globebrowsing/tile/tileloadjob.h @@ -28,8 +28,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { class RawTileDataReader; struct RawTile; @@ -65,11 +64,11 @@ struct TileLoadJob : public Job { */ void execute() override; - /** - * Marks the job as finised and releases ownership of the data. - * Unless the job is marked as finished, the pixel data will be deallocated - * when the job is deleted. - */ + /** + * Marks the job as finised and releases ownership of the data. + * Unless the job is marked as finished, the pixel data will be deallocated + * when the job is deleted. + */ std::shared_ptr product() override; /** @@ -85,10 +84,9 @@ protected: std::shared_ptr _rawTile; TileIndex _chunkIndex; char* _pboMappedDataDestination; - bool _hasOwnershipOfData; + bool _hasOwnershipOfData; }; -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___TILELOADJOB___H__ diff --git a/modules/globebrowsing/tile/tilemetadata.cpp b/modules/globebrowsing/tile/tilemetadata.cpp index 2b7e20d9eb..125a8065ae 100644 --- a/modules/globebrowsing/tile/tilemetadata.cpp +++ b/modules/globebrowsing/tile/tilemetadata.cpp @@ -24,8 +24,7 @@ #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { void TileMetaData::serialize(std::ostream& os) { os << maxValues.size() << std::endl; @@ -54,5 +53,4 @@ TileMetaData TileMetaData::deserialize(std::istream& is) { return res; } -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/tile/tilemetadata.h b/modules/globebrowsing/tile/tilemetadata.h index 64c82db2e3..c89874d519 100644 --- a/modules/globebrowsing/tile/tilemetadata.h +++ b/modules/globebrowsing/tile/tilemetadata.h @@ -28,8 +28,7 @@ #include #include -namespace openspace { -namespace globebrowsing { +namespace openspace::globebrowsing { struct TileMetaData { std::vector maxValues; @@ -40,8 +39,6 @@ struct TileMetaData { static TileMetaData deserialize(std::istream& s); }; -} // namespace globebrowsing -} // namespace openspace - +} // namespace openspace::globebrowsing #endif // __OPENSPACE_MODULE_GLOBEBROWSING___TILEMETADATA___H__ diff --git a/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp b/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp index e7343007f0..f41906c331 100644 --- a/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp @@ -51,9 +51,7 @@ namespace { const char* KeyPreCacheLevel = "PreCacheLevel"; } -namespace openspace { -namespace globebrowsing { -namespace tileprovider { +namespace openspace::globebrowsing::tileprovider { DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary) : TileProvider(dictionary) @@ -249,6 +247,4 @@ TileDepthTransform DefaultTileProvider::depthTransform() { } } -} // namespace tileprovider -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::tileprovider diff --git a/modules/globebrowsing/tile/tileprovider/defaulttileprovider.h b/modules/globebrowsing/tile/tileprovider/defaulttileprovider.h index bf2928dd37..e9f68f21b9 100644 --- a/modules/globebrowsing/tile/tileprovider/defaulttileprovider.h +++ b/modules/globebrowsing/tile/tileprovider/defaulttileprovider.h @@ -22,8 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___CACHING_TILE_PROVIDER___H__ -#define __OPENSPACE_MODULE_GLOBEBROWSING___CACHING_TILE_PROVIDER___H__ +#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___DEFAULT_TILE_PROVIDER___H__ +#define __OPENSPACE_MODULE_GLOBEBROWSING___DEFAULT_TILE_PROVIDER___H__ #include #include @@ -31,16 +31,14 @@ #include #include -namespace openspace { +namespace openspace { class PixelBuffer; } -class PixelBuffer; - -namespace globebrowsing { - -class AsyncTileDataProvider; -struct RawTile; +namespace openspace::globebrowsing { + class AsyncTileDataProvider; + struct RawTile; +} // namespace openspace::globebrowsing -namespace tileprovider { +namespace openspace::globebrowsing::tileprovider { /** * Provides tiles loaded by AsyncTileDataProvider and @@ -90,8 +88,6 @@ private: bool _performPreProcessing; }; -} // namespace tileprovider -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::tileprovider -#endif // __OPENSPACE_MODULE_GLOBEBROWSING___CACHING_TILE_PROVIDER___H__ +#endif // __OPENSPACE_MODULE_GLOBEBROWSING___DEFAULT_TILE_PROVIDER___H__ diff --git a/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp b/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp index 38efce4ba6..acbbfbdbb0 100644 --- a/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp @@ -30,11 +30,9 @@ namespace { const char* KeyFilePath = "FilePath"; -} +} // namespace -namespace openspace { -namespace globebrowsing { -namespace tileprovider { +namespace openspace::globebrowsing::tileprovider { SingleImageProvider::SingleImageProvider(const ghoul::Dictionary& dictionary) : _tile(nullptr, nullptr, Tile::Status::Unavailable) @@ -57,11 +55,11 @@ SingleImageProvider::SingleImageProvider(const std::string& imagePath) reset(); } -Tile SingleImageProvider::getTile(const TileIndex& tileIndex) { +Tile SingleImageProvider::getTile(const TileIndex&) { return _tile; } -Tile::Status SingleImageProvider::getTileStatus(const TileIndex& index) { +Tile::Status SingleImageProvider::getTileStatus(const TileIndex&) { return _tile.status(); } @@ -98,6 +96,4 @@ int SingleImageProvider::maxLevel() { return 1337; // unlimited } -} // namespace tileprovider -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::tileprovider diff --git a/modules/globebrowsing/tile/tileprovider/singleimageprovider.h b/modules/globebrowsing/tile/tileprovider/singleimageprovider.h index d15aaa77f7..808e504e4f 100644 --- a/modules/globebrowsing/tile/tileprovider/singleimageprovider.h +++ b/modules/globebrowsing/tile/tileprovider/singleimageprovider.h @@ -29,9 +29,7 @@ #include -namespace openspace { -namespace globebrowsing { -namespace tileprovider { +namespace openspace::globebrowsing::tileprovider { class SingleImageProvider : public TileProvider { public: @@ -53,8 +51,6 @@ private: properties::StringProperty _filePath; }; -} // namespace tileprovider -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::tileprovider #endif // __OPENSPACE_MODULE_GLOBEBROWSING___SINGLE_IMAGE_PROVIDER___H__ diff --git a/modules/globebrowsing/tile/tileprovider/sizereferencetileprovider.cpp b/modules/globebrowsing/tile/tileprovider/sizereferencetileprovider.cpp index fb12db848a..448adff75e 100644 --- a/modules/globebrowsing/tile/tileprovider/sizereferencetileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/sizereferencetileprovider.cpp @@ -36,23 +36,18 @@ #include #include -using namespace ghoul::fontrendering; - -namespace openspace { -namespace globebrowsing { -namespace tileprovider { - namespace { const char* KeyRadii = "Radii"; -} +} // namespace + +namespace openspace::globebrowsing::tileprovider { SizeReferenceTileProvider::SizeReferenceTileProvider(const ghoul::Dictionary& dictionary) : TextTileProvider(LayerManager::getTileTextureInitData(layergroupid::GroupID::ColorLayers)) , _backgroundTile(Tile::TileUnavailable) { - _fontSize = 50; - _font = OsEng.fontManager().font("Mono", _fontSize); + _font = OsEng.fontManager().font("Mono", static_cast(_fontSize)); glm::dvec3 radii(1,1,1); dictionary.getValue(KeyRadii, radii); @@ -114,6 +109,4 @@ TileIndex::TileHashKey SizeReferenceTileProvider::toHash(const TileIndex& tileIn return key; } -} // namespace tileprovider -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::tileprovider diff --git a/modules/globebrowsing/tile/tileprovider/sizereferencetileprovider.h b/modules/globebrowsing/tile/tileprovider/sizereferencetileprovider.h index dc325feea7..170031766d 100644 --- a/modules/globebrowsing/tile/tileprovider/sizereferencetileprovider.h +++ b/modules/globebrowsing/tile/tileprovider/sizereferencetileprovider.h @@ -29,9 +29,7 @@ #include -namespace openspace { -namespace globebrowsing { -namespace tileprovider { +namespace openspace::globebrowsing::tileprovider { /** * Constructed with an ellipsoid and uses that to render the longitudal length of each @@ -53,8 +51,6 @@ private: Tile _backgroundTile; }; -} // namespace tileprovider -} // namespace globebrowsing -} // namespace openspace +} // namespace openspace::globebrowsing::tileprovider #endif // __OPENSPACE_MODULE_GLOBEBROWSING___SIZEREFERENCE_TILE_PROVIDER___H__ diff --git a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp index 1c3666e0eb..c0086553cc 100644 --- a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp @@ -36,17 +36,15 @@ #include namespace { - const std::string _loggerCat = "TemporalTileProvider"; + const char* _loggerCat = "TemporalTileProvider"; const char* KeyFilePath = "FilePath"; const char* KeyBasePath = "BasePath"; const char* KeyPreCacheStartTime = "PreCacheStartTime"; const char* KeyPreCacheEndTime = "PreCacheEndTime"; -} +} // namespace -namespace openspace { -namespace globebrowsing { -namespace tileprovider { +namespace openspace::globebrowsing::tileprovider { const char* TemporalTileProvider::URL_TIME_PLACEHOLDER("${OpenSpaceTimeId}"); @@ -284,7 +282,7 @@ std::shared_ptr TemporalTileProvider::getTileProvider(const Time& std::shared_ptr TemporalTileProvider::getTileProvider( const TimeKey& timekey) { - std::unordered_map>::iterator it = _tileProviderMap.find(timekey); + std::unordered_map>::iterator it = _tileProviderMap.find(timekey); if (it != _tileProviderMap.end()) { return it->second; } @@ -481,8 +479,6 @@ std::vector