diff --git a/.gitignore b/.gitignore
index b472ae264b..4dda8bd97a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -87,6 +87,9 @@ data/scene/missions/rosetta/67P/rosettaimages
data/scene/missions/rosetta/67P/textures
data/scene/missions/rosetta/rosetta/rosetta
data/scene/missions/rosetta/rosetta/textures
+data/scene/missions/voyager/**/*.png
+data/scene/missions/voyager/**/*.jpg
+data/scene/missions/voyager/**/*.obj
data/scene/moon/textures
data/scene/neptune/textures
data/scene/pluto/textures
@@ -117,6 +120,7 @@ data/spice/nh_kernels
data/spice/OsirisRexKernels
data/spice/plu055.bsp
data/spice/Rosetta
+data/spice/voyager
data/spice/sat375.bsp
data/spice/new_horizons/
data/scene/mars/map_datasets/mars_COL_v006_mars2000_rgb.tif
diff --git a/data/scene/mars/map_service_configs/Utah/Mola_HRSC.xml b/data/scene/mars/map_service_configs/Utah/Mola_HRSC.xml
new file mode 100644
index 0000000000..207dc4a20b
--- /dev/null
+++ b/data/scene/mars/map_service_configs/Utah/Mola_HRSC.xml
@@ -0,0 +1,20 @@
+
+
+ http://openspace.sci.utah.edu/Mars/MolaHRSC/tile/${z}/${y}/${x}
+
+
+ -180.0
+ 90.0
+ 180.0
+ -90.0
+ 106694
+ 53347
+ 7
+ top
+
+
+ 512
+ 512
+ 3
+ 10
+
\ No newline at end of file
diff --git a/data/scene/mars/mars.mod b/data/scene/mars/mars.mod
index 8a8de8a503..37dd566334 100644
--- a/data/scene/mars/mars.mod
+++ b/data/scene/mars/mars.mod
@@ -51,6 +51,10 @@ return {
Name = "MOLA Pseudo Color",
FilePath = "map_service_configs/Utah/Mola_PseudoColor.xml"
},
+ {
+ Name = "MOLA HRSC",
+ FilePath = "map_service_configs/Utah/Mola_HRSC.xml"
+ },
{
Name = "Viking MDIM [Utah]",
FilePath = "map_service_configs/Utah/Mdim.xml"
diff --git a/data/scene/missions/voyager/voyager1/voyager1.data b/data/scene/missions/voyager/voyager1/voyager1.data
new file mode 100644
index 0000000000..e902245411
--- /dev/null
+++ b/data/scene/missions/voyager/voyager1/voyager1.data
@@ -0,0 +1,6 @@
+return {
+ FileRequest = {
+ { Identifier = "voyager1_model", Destination = ".", Version = 1 },
+ { Identifier = "voyager1_spice", Destination = "${SPICE}/voyager", Version = 1 }
+ }
+}
\ No newline at end of file
diff --git a/data/scene/missions/voyager/voyager1/voyager1.mod b/data/scene/missions/voyager/voyager1/voyager1.mod
new file mode 100644
index 0000000000..6c00c69648
--- /dev/null
+++ b/data/scene/missions/voyager/voyager1/voyager1.mod
@@ -0,0 +1,163 @@
+local Kernels = {
+ '${SPICE}/voyager/vg1_v02.tf',
+ '${SPICE}/voyager/vg100019.tsc',
+ '${SPICE}/voyager/Voyager_1.a54206u_V0.2_merged.bsp',
+ '${SPICE}/voyager/voyager_1.ST+1991_a54418u.merged.bsp',
+ '${SPICE}/voyager/vgr1_jup230.bsp',
+ '${SPICE}/voyager/vgr1_sat337.bsp',
+ '${SPICE}/voyager/vgr1_super.bc',
+ '${SPICE}/voyager/vgr1_super_v2.bc'
+}
+
+local RotationMatrix = {
+ -1, 0, 0,
+ 0, 0, -1,
+ 0, -1, 0
+}
+
+return {
+ {
+ Name = "Voyager 1",
+ Parent = "SolarSystemBarycenter",
+ Transform = {
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 1",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ Rotation = {
+ Type = "SpiceRotation",
+ SourceFrame = "VG1_SC_BUS",
+ DestinationFrame = "GALACTIC"
+ }
+ },
+ GuiPath = "/Solar System/Missions/Voyager 1"
+ },
+ {
+ Name = "Voyager 1 Main",
+ Parent = "Voyager 1",
+ Renderable = {
+ Type = "RenderableModel",
+ Geometry = {
+ Type = "MultiModelGeometry",
+ GeometryFile = "voyager-main.obj"
+ },
+ ColorTexture = "voyager-main.jpg",
+ ModelTransform = RotationMatrix
+ },
+ GuiPath = "/Solar System/Missions/Voyager 1"
+ },
+ {
+ Name = "Voyager 1 Antanna",
+ Parent = "Voyager 1",
+ Renderable = {
+ Type = "RenderableModel",
+ Geometry = {
+ Type = "MultiModelGeometry",
+ GeometryFile = "voyager-antenna.obj"
+ },
+ ColorTexture = "voyager-antenna.png",
+ ModelTransform = RotationMatrix
+ },
+ GuiPath = "/Solar System/Missions/Voyager 1"
+ },
+
+ -- The trails are organized as follows. The cruise phases can be resolved in relatively
+ -- low resolution since they are just straight lines
+ -- The encounter phases should be much higher resolution or otherwise artifacts would appear
+ {
+ Name = "Voyager 1 Trail Cruise Earth-Jupiter",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 1",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1977 SEP 05",
+ EndTime = "1979 MAR 04",
+ SampleInterval = 545 * 2 -- 545 is the number of days between the Start and End time
+ },
+ GuiName = "/Solar System/Missions/Voyager 1"
+ },
+ {
+ Name = "Voyager 1 Trail Encounter Jupiter",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 1",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ Color = { 0.70,0.50,0.20 },
+ EnableFade = false,
+ StartTime = "1979 MAR 03 23:24:00", -- @TODO: Probably an off-by-one bug in RenderableTrailTrajectory?
+ EndTime = "1979 MAR 09",
+ SampleInterval = 100
+ },
+ GuiName = "/Solar System/Missions/Voyager 1"
+ },
+ {
+ Name = "Voyager 1 Trail Cruise Jupiter-Saturn",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 1",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ EnableFade = false,
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1979 MAR 09",
+ EndTime = "1980 NOV 11",
+ SampleInterval = 618 * 2 -- 618 is the number of days between the Start and End time
+ },
+ GuiName = "/Solar System/Missions/Voyager 1"
+ },
+ {
+ Name = "Voyager 1 Trail Encounter Saturn",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 1",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ EnableFade = false,
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1980 NOV 10 23:08:30", -- @TODO: Probably an off-by-one bug in RenderableTrailTrajectory?
+ EndTime = "1980 NOV 16",
+ SampleInterval = 100
+ },
+ GuiName = "/Solar System/Missions/Voyager 1"
+ },
+ {
+ Name = "Voyager 1 Trail Cruise Saturn-Inf",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 1",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ EnableFade = false,
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1980 NOV 16",
+ EndTime = "2021 JAN 01",
+ SampleInterval = 14656 * 2 -- 14656 is the number of days between the Start and End time
+ },
+ GuiName = "/Solar System/Missions/Voyager 1"
+ }
+}
diff --git a/data/scene/missions/voyager/voyager2/voyager2.data b/data/scene/missions/voyager/voyager2/voyager2.data
new file mode 100644
index 0000000000..7ebe88eab3
--- /dev/null
+++ b/data/scene/missions/voyager/voyager2/voyager2.data
@@ -0,0 +1,6 @@
+return {
+ FileRequest = {
+ { Identifier = "voyager2_model", Destination = ".", Version = 1 },
+ { Identifier = "voyager2_spice", Destination = "${SPICE}/voyager", Version = 1 }
+ }
+}
\ No newline at end of file
diff --git a/data/scene/missions/voyager/voyager2/voyager2.mod b/data/scene/missions/voyager/voyager2/voyager2.mod
new file mode 100644
index 0000000000..5dfaeab338
--- /dev/null
+++ b/data/scene/missions/voyager/voyager2/voyager2.mod
@@ -0,0 +1,241 @@
+local Kernels = {
+ '${SPICE}/voyager/vg2_v02.tf',
+ '${SPICE}/voyager/vg200022.tsc',
+ '${SPICE}/voyager/Voyager_2.m05016u.merged.bsp',
+ '${SPICE}/voyager/voyager_2.ST+1992_m05208u.merged.bsp',
+ '${SPICE}/voyager/vgr2_jup230.bsp',
+ '${SPICE}/voyager/vgr2_sat337.bsp',
+ '${SPICE}/voyager/vgr2_ura083.bsp',
+ '${SPICE}/voyager/vgr2_nep081.bsp',
+ '${SPICE}/voyager/vgr2_super.bc',
+ '${SPICE}/voyager/vgr2_super_v2.bc'
+}
+
+local RotationMatrix = {
+ -1, 0, 0,
+ 0, 0, -1,
+ 0, -1, 0
+}
+
+return {
+ {
+ Name = "Voyager 2",
+ Parent = "SolarSystemBarycenter",
+ Transform = {
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 2",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ Rotation = {
+ Type = "SpiceRotation",
+ SourceFrame = "VG2_SC_BUS",
+ DestinationFrame = "GALACTIC"
+ }
+ },
+ GuiPath = "/Solar System/Missions/Voyager 2"
+ },
+ {
+ Name = "Voyager 2 Main",
+ Parent = "Voyager 2",
+ Renderable = {
+ Type = "RenderableModel",
+ Geometry = {
+ Type = "MultiModelGeometry",
+ GeometryFile = "voyager-main.obj"
+ },
+ ColorTexture = "voyager-main.jpg",
+ ModelTransform = RotationMatrix
+ },
+ GuiPath = "/Solar System/Missions/Voyager 2"
+ },
+ {
+ Name = "Voyager 2 Antanna",
+ Parent = "Voyager 2",
+ Renderable = {
+ Type = "RenderableModel",
+ Geometry = {
+ Type = "MultiModelGeometry",
+ GeometryFile = "voyager-antenna.obj"
+ },
+ ColorTexture = "voyager-antenna.png",
+ ModelTransform = RotationMatrix
+ },
+ GuiPath = "/Solar System/Missions/Voyager 2"
+ },
+
+ -- The trails are organized as follows. The cruise phases can be resolved in relatively
+ -- low resolution since they are just straight lines
+ -- The encounter phases should be much higher resolution or otherwise artifacts would appear
+ {
+ Name = "Voyager 2 Trail Cruise Earth-Jupiter",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 2",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1977 SEP 05",
+ EndTime = "1979 JUL 06",
+ SampleInterval = 669 * 2 -- 669 is the number of days between the Start and End time
+ },
+ GuiName = "/Solar System/Missions/Voyager 2"
+ },
+ {
+ Name = "Voyager 2 Trail Encounter Jupiter",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 2",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ Color = { 0.70,0.50,0.20 },
+ EnableFade = false,
+ StartTime = "1979 JUL 05 23:24:00", -- @TODO: Probably an off-by-one bug in RenderableTrailTrajectory?
+ EndTime = "1979 JUL 15",
+ SampleInterval = 100
+ },
+ GuiName = "/Solar System/Missions/Voyager 2"
+ },
+ {
+ Name = "Voyager 2 Trail Cruise Jupiter-Saturn",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 2",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ EnableFade = false,
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1979 JUL 15",
+ EndTime = "1981 AUG 23",
+ SampleInterval = 770 * 2 -- 770 is the number of days between the Start and End time
+ },
+ GuiName = "/Solar System/Missions/Voyager 2"
+ },
+ {
+ Name = "Voyager 2 Trail Encounter Saturn",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 2",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ EnableFade = false,
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1981 AUG 22 23:08:30", -- @TODO: Probably an off-by-one bug in RenderableTrailTrajectory?
+ EndTime = "1981 AUG 30",
+ SampleInterval = 100
+ },
+ GuiName = "/Solar System/Missions/Voyager 2"
+ },
+ {
+ Name = "Voyager 2 Trail Cruise Saturn-Uranus",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 2",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ EnableFade = false,
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1981 AUG 30",
+ EndTime = "1986 JAN 22",
+ SampleInterval = 1971 * 2 -- 1971 is the number of days between the Start and End time
+ },
+ GuiName = "/Solar System/Missions/Voyager 2"
+ },
+ {
+ Name = "Voyager 2 Trail Encounter Uranus",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 2",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ EnableFade = false,
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1986 JAN 21 23:30:00", -- @TODO: Probably an off-by-one bug in RenderableTrailTrajectory?
+ EndTime = "1986 JAN 27",
+ SampleInterval = 100
+ },
+ GuiName = "/Solar System/Missions/Voyager 2"
+ },
+ {
+ Name = "Voyager 2 Trail Cruise Uranus-Neptune",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 2",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ EnableFade = false,
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1986 JAN 27",
+ EndTime = "1989 AUG 24",
+ SampleInterval = 1305 * 2 -- 1305 is the number of days between the Start and End time
+ },
+ GuiName = "/Solar System/Missions/Voyager 2"
+ },
+ {
+ Name = "Voyager 2 Trail Encounter Neptune",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 2",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ EnableFade = false,
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1989 AUG 23 23:30:00", -- @TODO: Probably an off-by-one bug in RenderableTrailTrajectory?
+ EndTime = "1989 AUG 26",
+ SampleInterval = 100
+ },
+ GuiName = "/Solar System/Missions/Voyager 2"
+ },
+ {
+ Name = "Voyager 2 Trail Cruise Neptune-Inf",
+ Parent = "SolarSystemBarycenter",
+ Renderable = {
+ Type = "RenderableTrailTrajectory",
+ Translation = {
+ Type = "SpiceTranslation",
+ Target = "VOYAGER 2",
+ Observer = "SUN",
+ Kernels = Kernels
+ },
+ EnableFade = false,
+ Color = { 0.70,0.50,0.20 },
+ StartTime = "1989 AUG 26",
+ EndTime = "2021 JAN 01",
+ SampleInterval = 11451 * 2 -- 11451 is the number of days between the Start and End time
+ },
+ GuiName = "/Solar System/Missions/Voyager 2"
+ },
+}
diff --git a/data/scene/neptune/neptune.mod b/data/scene/neptune/neptune.mod
index 7fbade114f..232e872a1c 100644
--- a/data/scene/neptune/neptune.mod
+++ b/data/scene/neptune/neptune.mod
@@ -54,7 +54,18 @@ return {
Observer = "SUN"
},
Color = {0.2, 0.5, 1.0 },
- Period = 60200,
+ -- Period = 60200,
+ -- Yes, this period is wrong, but the SPICE kernel we load by default only
+ -- goes back to 1850. Neptunes orbit is 164 years, which would mean that we
+ -- exceed the SPICE kernel if we go back before 2014, if we try to compute the
+ -- entire orbit. Cutting the orbit length to 100 years allows us to go back
+ -- to 1950 instead, which is good enough.
+ -- If the positions are needed before that, a different set of kernels are
+ -- needed, namely:
+ -- https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de431_part-1.bsp
+ -- https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de431_part-2.bsp
+ -- that cover a larger time span: -13201-MAY-06 00:00 to 17191-MAR-15 00:00
+ Period = 36500,
Resolution = 1000
},
Tag = { "planetTrail_solarSystem", "planetTrail_giants" },
diff --git a/data/scene/voyager.scene b/data/scene/voyager.scene
new file mode 100644
index 0000000000..7d6b0430e1
--- /dev/null
+++ b/data/scene/voyager.scene
@@ -0,0 +1,67 @@
+dofile(openspace.absPath('${SCRIPTS}/scene_helper.lua'))
+
+function preInitialization()
+ --[[
+ The scripts in this function are executed after the scene is loaded but before the
+ scene elements have been initialized, thus they should be used to set the time at
+ which the scene should start and other settings that might determine initialization
+ critical objects.
+ ]]--
+
+ openspace.spice.loadKernel("${SPICE}/naif0012.tls")
+ openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
+
+ -- openspace.time.setTime(openspace.time.currentWallTime())
+ openspace.time.setTime("1977 SEP 10 12:00:00")
+ dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
+end
+
+function postInitialization()
+ openspace.printInfo("Setting default values")
+
+ openspace.setPropertyValueSingle("Global Properties.GlobeBrowsing.GdalWrapper.LogGdalErrors", false)
+ openspace.setPropertyValueSingle("Earth.RenderableGlobe.Debug.LevelByProjectedAreaElseDistance", false)
+
+ openspace.globebrowsing.goToGeo(58.5877, 16.1924, 20000000)
+
+ openspace.printInfo("Done setting default values")
+
+ -- Defined in scene_helper.lua
+ -- Used to create focus buttons for a subset of scenegraph nodes
+ mark_interesting_nodes({
+ "Earth", "Voyager 1", "Voyager 2", "Jupiter", "Saturn", "Uranus", "Neptune"
+ })
+end
+
+
+return {
+ ScenePath = ".",
+ CommonFolder = "common",
+ Camera = {
+ Focus = "Earth",
+ Position = {0, 0, 0},
+ Rotation = {0.758797, 0.221490, -0.605693, -0.091135},
+ },
+ Modules = {
+ -- # Solar system objects
+ "sun",
+ "mercury",
+ "venus",
+ "earth",
+ "moon",
+ "mars",
+ "jupiter",
+ "saturn",
+ "uranus",
+ "neptune",
+ -- "satellites",
+
+ -- "grids",
+ -- "digitaluniverse",
+ "stars/digitaluniverse",
+ "milkyway/digitaluniverse",
+
+ "missions/voyager"
+ }
+}
+
diff --git a/include/openspace/engine/wrapper/sgctwindowwrapper.h b/include/openspace/engine/wrapper/sgctwindowwrapper.h
index 2b09f00e3b..eebc9c7520 100644
--- a/include/openspace/engine/wrapper/sgctwindowwrapper.h
+++ b/include/openspace/engine/wrapper/sgctwindowwrapper.h
@@ -81,6 +81,9 @@ public:
void swapBuffer() const override;
+ int nWindows() const override;
+ int currentWindowId() const override;
+
private:
properties::FloatProperty _eyeSeparation;
properties::BoolProperty _showStatsGraph;
diff --git a/include/openspace/engine/wrapper/windowwrapper.h b/include/openspace/engine/wrapper/windowwrapper.h
index df302ff64a..e5abd90461 100644
--- a/include/openspace/engine/wrapper/windowwrapper.h
+++ b/include/openspace/engine/wrapper/windowwrapper.h
@@ -271,8 +271,21 @@ public:
*/
virtual void takeScreenshot(bool applyWarping = false) const;
+ /**
+ * Encourages the windowing system to swap the back- and front buffers
+ */
virtual void swapBuffer() const;
+ /**
+ * Returns the number of windows that are currently instantiated
+ */
+ virtual int nWindows() const;
+
+ /**
+ * Returns the id of the current window (in the range [0, nWindows -1])
+ */
+ virtual int currentWindowId() const;
+
struct WindowWrapperException : public ghoul::RuntimeError {
explicit WindowWrapperException(const std::string& msg);
};
diff --git a/include/openspace/properties/numericalproperty.inl b/include/openspace/properties/numericalproperty.inl
index c0a07e3127..95b027b692 100644
--- a/include/openspace/properties/numericalproperty.inl
+++ b/include/openspace/properties/numericalproperty.inl
@@ -159,17 +159,17 @@ namespace openspace::properties {
template <> \
template <> \
bool PropertyDelegate>::toLuaValue(lua_State* lua, \
- TYPE value) \
+ TYPE val) \
{ \
- return TO_LUA_LAMBDA_EXPRESSION(lua, value); \
+ return TO_LUA_LAMBDA_EXPRESSION(lua, val); \
} \
\
template <> \
template <> \
bool PropertyDelegate>::toLuaValue(lua_State* state, \
- TYPE value) \
+ TYPE val) \
{ \
- return PropertyDelegate>::toLuaValue(state, value); \
+ return PropertyDelegate>::toLuaValue(state, val); \
} \
\
template <> \
diff --git a/include/openspace/properties/templateproperty.inl b/include/openspace/properties/templateproperty.inl
index 32ecffb1ab..b21ff70211 100644
--- a/include/openspace/properties/templateproperty.inl
+++ b/include/openspace/properties/templateproperty.inl
@@ -106,16 +106,17 @@ namespace openspace::properties {
template <> \
template <> \
TYPE PropertyDelegate>::fromLuaValue(lua_State* l, \
- bool& s) \
+ bool& successful) \
{ \
- return FROM_LUA_LAMBDA_EXPRESSION(l, s); \
+ return FROM_LUA_LAMBDA_EXPRESSION(l, successful); \
} \
\
template <> \
template <> \
- bool PropertyDelegate>::toLuaValue(lua_State* l, TYPE v)\
+ bool PropertyDelegate>::toLuaValue(lua_State* l, \
+ TYPE value) \
{ \
- return TO_LUA_LAMBDA_EXPRESSION(l, v); \
+ return TO_LUA_LAMBDA_EXPRESSION(l, value); \
} \
\
template <> \
@@ -125,10 +126,10 @@ namespace openspace::properties {
\
template <> \
template <> \
- TYPE PropertyDelegate>::fromString(std::string v, \
- bool& s) \
+ TYPE PropertyDelegate>::fromString(std::string value, \
+ bool& successful) \
{ \
- return FROM_STRING_LAMBDA_EXPRESSION(v, s); \
+ return FROM_STRING_LAMBDA_EXPRESSION(value, successful); \
} \
\
template <> \
diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h
index f3064d00d0..87f3ea92b4 100644
--- a/include/openspace/rendering/renderengine.h
+++ b/include/openspace/rendering/renderengine.h
@@ -77,6 +77,7 @@ public:
void initialize();
void initializeGL();
void deinitialize();
+ void deinitializeGL();
void setScene(Scene* scene);
Scene* scene();
diff --git a/include/openspace/rendering/screenspacerenderable.h b/include/openspace/rendering/screenspacerenderable.h
index 24d301d2a0..ab631d411e 100644
--- a/include/openspace/rendering/screenspacerenderable.h
+++ b/include/openspace/rendering/screenspacerenderable.h
@@ -64,7 +64,7 @@ public:
virtual bool deinitialize();
virtual bool deinitializeGL();
- virtual void update() = 0;
+ virtual void update();
virtual bool isReady() const;
bool isEnabled() const;
diff --git a/include/openspace/util/distanceconstants.h b/include/openspace/util/distanceconstants.h
index daa2a1bba1..9d6b52ab94 100644
--- a/include/openspace/util/distanceconstants.h
+++ b/include/openspace/util/distanceconstants.h
@@ -25,15 +25,14 @@
#ifndef __OPENSPACE_CORE___DISTANCECONSTANTS___H__
#define __OPENSPACE_CORE___DISTANCECONSTANTS___H__
-namespace openspace {
-
-namespace distanceconstants {
- const float EarthRadius = 6371;
- const float LightYear = 9.4607304725808E15;
- const float AstronomicalUnit = 1.495978707E11;
- const float Parsec = 3.0856776E16;
-}
-
-}
+namespace openspace::distanceconstants {
+ constexpr double EarthRadius = 6371;
+ constexpr double LightYear = 9.4607304725808E15;
+ constexpr double LightMonth = LightYear / 12;
+ constexpr double LightDay = LightYear / 365;
+ constexpr double LightHour = LightDay / 24;
+ constexpr double AstronomicalUnit = 1.495978707E11;
+ constexpr double Parsec = 3.0856776E16;
+} // openspace::distanceconstants
#endif // __OPENSPACE_CORE___DISTANCECONSTANTS___H__
diff --git a/include/openspace/util/distanceconversion.h b/include/openspace/util/distanceconversion.h
new file mode 100644
index 0000000000..e2d7c7c14f
--- /dev/null
+++ b/include/openspace/util/distanceconversion.h
@@ -0,0 +1,37 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2017 *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this *
+ * software and associated documentation files (the "Software"), to deal in the Software *
+ * without restriction, including without limitation the rights to use, copy, modify, *
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
+ * permit persons to whom the Software is furnished to do so, subject to the following *
+ * conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included in all copies *
+ * or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ ****************************************************************************************/
+
+#ifndef __OPENSPACE_CORE___DISTANCECONVERSION___H__
+#define __OPENSPACE_CORE___DISTANCECONVERSION___H__
+
+#include
+#include
+
+namespace openspace {
+
+std::pair simplifyDistance(double meters);
+
+} // namespace openspace
+
+#endif // __OPENSPACE_CORE___DISTANCECONVERSION___H__
diff --git a/include/openspace/util/timeconversion.h b/include/openspace/util/timeconversion.h
new file mode 100644
index 0000000000..9e570c6d15
--- /dev/null
+++ b/include/openspace/util/timeconversion.h
@@ -0,0 +1,37 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2017 *
+ * *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this *
+ * software and associated documentation files (the "Software"), to deal in the Software *
+ * without restriction, including without limitation the rights to use, copy, modify, *
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
+ * permit persons to whom the Software is furnished to do so, subject to the following *
+ * conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included in all copies *
+ * or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
+ * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
+ * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
+ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ ****************************************************************************************/
+
+#ifndef __OPENSPACE_CORE___TIMECONVERSION___H__
+#define __OPENSPACE_CORE___TIMECONVERSION___H__
+
+#include
+#include
+
+namespace openspace {
+
+std::pair simplifyTime(double seconds);
+
+} // namespace openspace
+
+#endif // __OPENSPACE_CORE___TIMECONVERSION___H__
diff --git a/modules/base/rendering/screenspaceframebuffer.cpp b/modules/base/rendering/screenspaceframebuffer.cpp
index d6d9803957..32ae93e247 100644
--- a/modules/base/rendering/screenspaceframebuffer.cpp
+++ b/modules/base/rendering/screenspaceframebuffer.cpp
@@ -66,7 +66,12 @@ ScreenSpaceFramebuffer::ScreenSpaceFramebuffer(const ghoul::Dictionary& dictiona
);
_id = id();
- setName("ScreenSpaceFramebuffer" + std::to_string(_id));
+ if (_id == 0) {
+ setName("ScreenSpaceFramebuffer");
+ }
+ else {
+ setName("ScreenSpaceFramebuffer " + std::to_string(_id));
+ }
glm::vec2 resolution = OsEng.windowWrapper().currentWindowResolution();
addProperty(_size);
diff --git a/modules/base/rendering/screenspaceimagelocal.cpp b/modules/base/rendering/screenspaceimagelocal.cpp
index a9fb5e1cb8..edc2d38f14 100644
--- a/modules/base/rendering/screenspaceimagelocal.cpp
+++ b/modules/base/rendering/screenspaceimagelocal.cpp
@@ -89,7 +89,12 @@ ScreenSpaceImageLocal::ScreenSpaceImageLocal(const ghoul::Dictionary& dictionary
}
else {
static int id = 0;
- setName("ScreenSpaceImageLocal " + std::to_string(id));
+ if (id == 0) {
+ setName("ScreenSpaceImageLocal");
+ }
+ else {
+ setName("ScreenSpaceImageLocal " + std::to_string(id));
+ }
++id;
}
diff --git a/modules/base/rendering/screenspaceimageonline.cpp b/modules/base/rendering/screenspaceimageonline.cpp
index 93b2e8f62f..b4dfe62a2c 100644
--- a/modules/base/rendering/screenspaceimageonline.cpp
+++ b/modules/base/rendering/screenspaceimageonline.cpp
@@ -89,7 +89,12 @@ ScreenSpaceImageOnline::ScreenSpaceImageOnline(const ghoul::Dictionary& dictiona
}
else {
static int id = 0;
- setName("ScreenSpaceImageOnline " + std::to_string(id));
+ if (id == 0) {
+ setName("ScreenSpaceImageOnline");
+ }
+ else {
+ setName("ScreenSpaceImageOnline " + std::to_string(id));
+ }
++id;
}
diff --git a/modules/base/rotation/fixedrotation.cpp b/modules/base/rotation/fixedrotation.cpp
index df05dbb397..4719adbfee 100644
--- a/modules/base/rotation/fixedrotation.cpp
+++ b/modules/base/rotation/fixedrotation.cpp
@@ -544,7 +544,7 @@ void FixedRotation::update(const UpdateData&) {
glm::vec3 y = yAxis();
glm::vec3 z = zAxis();
- static const float Epsilon = 1e-3;
+ static const float Epsilon = 1e-3f;
if (glm::dot(x, y) > 1.f - Epsilon ||
glm::dot(y, z) > 1.f - Epsilon ||
diff --git a/modules/base/rotation/luarotation.cpp b/modules/base/rotation/luarotation.cpp
index 03ff884a7d..4840de00b5 100644
--- a/modules/base/rotation/luarotation.cpp
+++ b/modules/base/rotation/luarotation.cpp
@@ -110,7 +110,9 @@ void LuaRotation::update(const UpdateData& data) {
auto now = high_resolution_clock::now();
lua_pushnumber(
_state,
- duration_cast(now.time_since_epoch()).count()
+ static_cast(
+ duration_cast(now.time_since_epoch()).count()
+ )
);
// Execute the scaling function
diff --git a/modules/base/rotation/staticrotation.cpp b/modules/base/rotation/staticrotation.cpp
index 3929b9c808..ae40d286e6 100644
--- a/modules/base/rotation/staticrotation.cpp
+++ b/modules/base/rotation/staticrotation.cpp
@@ -64,7 +64,7 @@ documentation::Documentation StaticRotation::Documentation() {
}
StaticRotation::StaticRotation()
- : _rotationMatrix(RotationInfo, glm::dmat3(1.0))
+ : _rotationMatrix(RotationInfo, glm::dmat3(1.0), glm::dmat3(-1.0), glm::dmat3(1.0))
{
addProperty(_rotationMatrix);
_rotationMatrix.onChange([this]() { _matrix = _rotationMatrix; });
diff --git a/modules/base/scale/luascale.cpp b/modules/base/scale/luascale.cpp
index a688351003..eb3194303a 100644
--- a/modules/base/scale/luascale.cpp
+++ b/modules/base/scale/luascale.cpp
@@ -101,7 +101,9 @@ void LuaScale::update(const UpdateData& data) {
auto now = high_resolution_clock::now();
lua_pushnumber(
_state,
- duration_cast(now.time_since_epoch()).count()
+ static_cast(
+ duration_cast(now.time_since_epoch()).count()
+ )
);
// Execute the scaling function
diff --git a/modules/base/translation/luatranslation.cpp b/modules/base/translation/luatranslation.cpp
index 7dd8353d9e..bb5e3ddcc3 100644
--- a/modules/base/translation/luatranslation.cpp
+++ b/modules/base/translation/luatranslation.cpp
@@ -118,7 +118,9 @@ void LuaTranslation::update(const UpdateData& data) {
auto now = high_resolution_clock::now();
lua_pushnumber(
_state,
- duration_cast(now.time_since_epoch()).count()
+ static_cast(
+ duration_cast(now.time_since_epoch()).count()
+ )
);
// Execute the scaling function
diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequencesetup.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequencesetup.cpp
index 538186e5e0..4547f444f2 100644
--- a/modules/fieldlinessequence/rendering/renderablefieldlinessequencesetup.cpp
+++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequencesetup.cpp
@@ -303,8 +303,12 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
LERROR(_name << ": The field " << std::string(KeyInputFileType) << " is missing!");
return false;
} else {
- std::transform(inputFileTypeString.begin(), inputFileTypeString.end(),
- inputFileTypeString.begin(), ::tolower);
+ std::transform(
+ inputFileTypeString.begin(),
+ inputFileTypeString.end(),
+ inputFileTypeString.begin(),
+ [](char c) { return static_cast(tolower(c)); }
+ );
// Verify that the input type is correct
if (inputFileTypeString == ValueInputFileTypeCdf) {
sourceFileType = SourceFileType::Cdf;
diff --git a/modules/fieldlinessequence/util/fieldlinesstate.cpp b/modules/fieldlinessequence/util/fieldlinesstate.cpp
index 51c8b7b0d9..d55ba96569 100644
--- a/modules/fieldlinessequence/util/fieldlinesstate.cpp
+++ b/modules/fieldlinessequence/util/fieldlinesstate.cpp
@@ -373,7 +373,7 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) {
// Returns one of the extra quantity vectors, _extraQuantities[index].
// If index is out of scope an empty vector is returned and the referenced bool is false.
-const std::vector& FieldlinesState::extraQuantity(const size_t index,
+std::vector FieldlinesState::extraQuantity(const size_t index,
bool& isSuccessful) const {
if (index < _extraQuantities.size()) {
isSuccessful = true;
diff --git a/modules/fieldlinessequence/util/fieldlinesstate.h b/modules/fieldlinessequence/util/fieldlinesstate.h
index 66d417deff..10a1faa4ae 100644
--- a/modules/fieldlinessequence/util/fieldlinesstate.h
+++ b/modules/fieldlinessequence/util/fieldlinesstate.h
@@ -64,7 +64,7 @@ public:
const std::vector& vertexPositions() const;
// Special getter. Returns extraQuantities[INDEX].
- const std::vector& extraQuantity(const size_t INDEX, bool& isSuccesful) const;
+ std::vector extraQuantity(const size_t INDEX, bool& isSuccesful) const;
void setModel(const fls::Model m) { _model = m; }
void setTriggerTime(const double t) { _triggerTime = t; }
diff --git a/modules/galaxy/rendering/galaxyraycaster.cpp b/modules/galaxy/rendering/galaxyraycaster.cpp
index 1c3ed1d186..f5f7fc83a3 100644
--- a/modules/galaxy/rendering/galaxyraycaster.cpp
+++ b/modules/galaxy/rendering/galaxyraycaster.cpp
@@ -115,9 +115,7 @@ void GalaxyRaycaster::preRaycast(const RaycastData& data,
program.setUniform(galaxyTextureUniformName, *_textureUnit);
}
-void GalaxyRaycaster::postRaycast(const RaycastData& data,
- ghoul::opengl::ProgramObject& program)
-{
+void GalaxyRaycaster::postRaycast(const RaycastData&, ghoul::opengl::ProgramObject&) {
_textureUnit = nullptr; // release texture unit.
}
diff --git a/modules/galaxy/rendering/renderablegalaxy.cpp b/modules/galaxy/rendering/renderablegalaxy.cpp
index 6ef4b4c635..39e7432dcd 100644
--- a/modules/galaxy/rendering/renderablegalaxy.cpp
+++ b/modules/galaxy/rendering/renderablegalaxy.cpp
@@ -340,22 +340,22 @@ void RenderableGalaxy::render(const RenderData& data, RendererTasks& tasks) {
float maxDim = std::max(std::max(galaxySize.x, galaxySize.y), galaxySize.z);
- float lowerRampStart = maxDim * 0.02;
- float lowerRampEnd = maxDim * 0.5;
+ float lowerRampStart = maxDim * 0.02f;
+ float lowerRampEnd = maxDim * 0.5f;
- float upperRampStart = maxDim * 2.0;
- float upperRampEnd = maxDim * 10;
+ float upperRampStart = maxDim * 2.f;
+ float upperRampEnd = maxDim * 10.f;
- float opacityCoefficient = 1.0;
+ float opacityCoefficient = 1.f;
if (length < lowerRampStart) {
- opacityCoefficient = 0; // camera really close
+ opacityCoefficient = 0.f; // camera really close
} else if (length < lowerRampEnd) {
opacityCoefficient = (length - lowerRampStart) / (lowerRampEnd - lowerRampStart);
} else if (length < upperRampStart) {
- opacityCoefficient = 1.0; // sweet spot (max)
+ opacityCoefficient = 1.f; // sweet spot (max)
} else if (length < upperRampEnd) {
- opacityCoefficient = 1.0 - (length - upperRampStart) /
+ opacityCoefficient = 1.f - (length - upperRampStart) /
(upperRampEnd - upperRampStart); //fade out
} else {
opacityCoefficient = 0;
@@ -363,7 +363,7 @@ void RenderableGalaxy::render(const RenderData& data, RendererTasks& tasks) {
_opacityCoefficient = opacityCoefficient;
ghoul_assert(
- _opacityCoefficient >= 0.0 && _opacityCoefficient <= 1.0,
+ _opacityCoefficient >= 0.f && _opacityCoefficient <= 1.f,
"Opacity coefficient was not between 0 and 1"
);
if (opacityCoefficient > 0) {
diff --git a/modules/globebrowsing/cache/memoryawaretilecache.cpp b/modules/globebrowsing/cache/memoryawaretilecache.cpp
index 6cc13be786..ab4cf6ec52 100644
--- a/modules/globebrowsing/cache/memoryawaretilecache.cpp
+++ b/modules/globebrowsing/cache/memoryawaretilecache.cpp
@@ -301,7 +301,8 @@ void MemoryAwareTileCache::update() {
size_t MemoryAwareTileCache::getGPUAllocatedDataSize() const {
return std::accumulate(
_textureContainerMap.cbegin(),
- _textureContainerMap.cend(), 0,
+ _textureContainerMap.cend(),
+ size_t(0),
[](size_t s, const std::pair& p)
{
@@ -316,7 +317,8 @@ size_t MemoryAwareTileCache::getGPUAllocatedDataSize() const {
size_t MemoryAwareTileCache::getCPUAllocatedDataSize() const {
size_t dataSize = std::accumulate(
_textureContainerMap.cbegin(),
- _textureContainerMap.cend(), 0,
+ _textureContainerMap.cend(),
+ size_t(0),
[](size_t s, const std::pair& p)
{
diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl
index 85c6e6d040..b217d08138 100644
--- a/modules/globebrowsing/globebrowsingmodule_lua.inl
+++ b/modules/globebrowsing/globebrowsingmodule_lua.inl
@@ -162,8 +162,8 @@ int goToGeo(lua_State* L) {
return luaL_error(L, "Expected 2 or 3 arguments.");
}
- double latitude = static_cast(lua_tonumber(L, 1));
- double longitude = static_cast(lua_tonumber(L, 2));
+ double latitude = lua_tonumber(L, 1);
+ double longitude = lua_tonumber(L, 2);
if (nArguments == 2) {
OsEng.moduleEngine().module()->goToGeo(latitude, longitude);
diff --git a/modules/globebrowsing/meshes/trianglesoup.cpp b/modules/globebrowsing/meshes/trianglesoup.cpp
index 428aa3ed98..7ae355db65 100644
--- a/modules/globebrowsing/meshes/trianglesoup.cpp
+++ b/modules/globebrowsing/meshes/trianglesoup.cpp
@@ -87,7 +87,7 @@ void TriangleSoup::setElements(std::vector elements) {
_elementData.resize(elements.size());
_gpuDataNeedUpdate = true;
for (size_t i = 0; i < elements.size(); i++) {
- _elementData[i] = static_cast(elements[i]);
+ _elementData[i] = elements[i];
}
}
@@ -128,8 +128,8 @@ bool TriangleSoup::updateDataOnGPU() {
// Positions at location 0
if (_useVertexPositions) {
glEnableVertexAttribArray(0);
- glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex),
- reinterpret_cast(offsetof(Vertex, position)));
+ glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), nullptr);
+ //reinterpret_cast(offsetof(Vertex, position)));
}
// Textures at location 1
if (_useTextureCoordinates) {
diff --git a/modules/globebrowsing/other/pixelbuffer.cpp b/modules/globebrowsing/other/pixelbuffer.cpp
index c34050495a..001a2a8018 100644
--- a/modules/globebrowsing/other/pixelbuffer.cpp
+++ b/modules/globebrowsing/other/pixelbuffer.cpp
@@ -38,7 +38,7 @@ PixelBuffer::PixelBuffer(size_t numBytes, Usage usage)
{
glGenBuffers(1, &_id);
bind();
- glBufferData(GL_PIXEL_UNPACK_BUFFER, _numBytes, 0, static_cast(_usage));
+ glBufferData(GL_PIXEL_UNPACK_BUFFER, _numBytes, nullptr, static_cast(_usage));
unbind();
}
diff --git a/modules/globebrowsing/rendering/chunkrenderer.cpp b/modules/globebrowsing/rendering/chunkrenderer.cpp
index 7f5711961f..bc4550d518 100644
--- a/modules/globebrowsing/rendering/chunkrenderer.cpp
+++ b/modules/globebrowsing/rendering/chunkrenderer.cpp
@@ -399,7 +399,7 @@ void ChunkRenderer::renderChunkLocally(const Chunk& chunk, const RenderData& dat
glm::dvec3 cornerModelSpace = ellipsoid.cartesianSurfacePosition(corner);
cornersModelSpace[i] = cornerModelSpace;
glm::dvec3 cornerCameraSpace =
- glm::dvec3(dmat4(modelViewTransform) * glm::dvec4(cornerModelSpace, 1));
+ glm::dvec3(modelViewTransform * glm::dvec4(cornerModelSpace, 1));
cornersCameraSpace[i] = cornerCameraSpace;
programObject->setUniform(cornerNames[i], vec3(cornerCameraSpace));
diff --git a/modules/globebrowsing/tile/pixelregion.cpp b/modules/globebrowsing/tile/pixelregion.cpp
index fabd02f3a7..6e884e4c50 100644
--- a/modules/globebrowsing/tile/pixelregion.cpp
+++ b/modules/globebrowsing/tile/pixelregion.cpp
@@ -118,12 +118,12 @@ void PixelRegion::scale(double s) {
void PixelRegion::downscalePow2(int exponent, PixelCoordinate wrt) {
start += wrt;
- start.x = ceil(start.x / static_cast(pow(2, exponent)));// >>= exponent;
- start.y = ceil(start.y / static_cast(pow(2, exponent)));// >>= exponent;
+ start.x = static_cast(ceil(start.x / static_cast(pow(2, exponent))));
+ start.y = static_cast(ceil(start.y / static_cast(pow(2, exponent))));
numPixels.x =
- ceil(numPixels.x / static_cast(pow(2, exponent)));// >>= exponent;
+ static_cast(ceil(numPixels.x / static_cast(pow(2, exponent))));
numPixels.y =
- ceil(numPixels.y / static_cast(pow(2, exponent)));// >>= exponent;
+ static_cast(ceil(numPixels.y / static_cast(pow(2, exponent))));
start -= wrt;
}
diff --git a/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp b/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp
index 38b1198d33..9b324a9700 100644
--- a/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp
+++ b/modules/globebrowsing/tile/rawtiledatareader/gdalrawtiledatareader.cpp
@@ -126,12 +126,17 @@ void GdalRawTileDataReader::initialize() {
// Assume all raster bands have the same data type
_gdalDatasetMetaDataCached.rasterCount = _dataset->GetRasterCount();
- _gdalDatasetMetaDataCached.scale = _dataset->GetRasterBand(1)->GetScale();
- _gdalDatasetMetaDataCached.offset = _dataset->GetRasterBand(1)->GetOffset();
+ _gdalDatasetMetaDataCached.scale = static_cast(
+ _dataset->GetRasterBand(1)->GetScale()
+ );
+ _gdalDatasetMetaDataCached.offset = static_cast(
+ _dataset->GetRasterBand(1)->GetOffset()
+ );
_gdalDatasetMetaDataCached.rasterXSize = _dataset->GetRasterXSize();
_gdalDatasetMetaDataCached.rasterYSize = _dataset->GetRasterYSize();
- _gdalDatasetMetaDataCached.noDataValue =
- _dataset->GetRasterBand(1)->GetNoDataValue();
+ _gdalDatasetMetaDataCached.noDataValue = static_cast(
+ _dataset->GetRasterBand(1)->GetNoDataValue()
+ );
_gdalDatasetMetaDataCached.dataType =
tiledatatype::getGdalDataType(_initData.glType());
@@ -145,7 +150,7 @@ void GdalRawTileDataReader::initialize() {
calculateTileLevelDifference(_initData.dimensions().x);
int numOverviews = _dataset->GetRasterBand(1)->GetOverviewCount();
- _cached._maxLevel = -_cached._tileLevelDifference;
+ _cached._maxLevel = static_cast(-_cached._tileLevelDifference);
if (numOverviews > 0) {
_cached._maxLevel += numOverviews - 1;
}
@@ -162,7 +167,7 @@ RawTile::ReadError GdalRawTileDataReader::rasterRead(
);
PixelRegion::PixelCoordinate end = io.write.region.end();
- size_t largestIndex =
+ [[maybe_unused]] size_t largestIndex =
(end.y - 1) * io.write.bytesPerLine + (end.x - 1) * _initData.bytesPerPixel();
ghoul_assert(largestIndex <= io.write.totalNumBytes, "Invalid write region");
@@ -191,7 +196,7 @@ RawTile::ReadError GdalRawTileDataReader::rasterRead(
io.write.region.numPixels.y, // width to write y in destination
_gdalDatasetMetaDataCached.dataType, // Type
static_cast(_initData.bytesPerPixel()), // Pixel spacing
- static_cast(-io.write.bytesPerLine) // Line spacing
+ -static_cast(io.write.bytesPerLine) // Line spacing
);
// Convert error to RawTile::ReadError
@@ -236,7 +241,7 @@ int GdalRawTileDataReader::calculateTileLevelDifference(int minimumPixelSize) co
}
int sizeLevel0 = maxOverview->GetXSize();
double diff = log2(minimumPixelSize) - log2(sizeLevel0);
- return diff;
+ return static_cast(diff);
}
} // namespace openspace::globebrowsing
diff --git a/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp b/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp
index ed49aa1620..062b4cfc4b 100644
--- a/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp
+++ b/modules/globebrowsing/tile/rawtiledatareader/rawtiledatareader.cpp
@@ -577,7 +577,7 @@ TileDepthTransform RawTileDataReader::calculateTileDepthTransform() {
TileDepthTransform transform;
transform.depthOffset = depthOffset();
- transform.depthScale = depthScale() * maximumValue;
+ transform.depthScale = static_cast(depthScale() * maximumValue);
return transform;
}
diff --git a/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp b/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp
index 46d8c6052d..596e24b9c2 100644
--- a/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp
+++ b/modules/globebrowsing/tile/rawtiledatareader/simplerawtiledatareader.cpp
@@ -115,14 +115,16 @@ RawTile::ReadError SimpleRawTileDataReader::rasterRead(
y * _initData.bytesPerLine() +
x * _initData.bytesPerPixel();
- int xInSource =
+ int xInSource = static_cast(
io.read.region.start.x +
static_cast(x) / io.write.region.numPixels.x *
- io.read.region.numPixels.x;
- int yInSource =
+ io.read.region.numPixels.x
+ );
+ int yInSource = static_cast(
io.read.region.start.y +
static_cast(y) / io.write.region.numPixels.y *
- io.read.region.numPixels.y;
+ io.read.region.numPixels.y
+ );
glm::vec4 sourceTexel = _dataTexture->texelAsFloat(xInSource, yInSource);
@@ -141,7 +143,7 @@ RawTile::ReadError SimpleRawTileDataReader::rasterRead(
char value = static_cast(
sourceTexel[rasterBand - 1] * 255
);
- *reinterpret_cast(pixelWriteDestination) = value;
+ *pixelWriteDestination = value;
break;
}
case GL_UNSIGNED_SHORT: {
diff --git a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp
index ff2811e1ab..ae7b55fe98 100644
--- a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp
+++ b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp
@@ -141,6 +141,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
+ throw ghoul::MissingCaseException();
}
break;
case 2:
@@ -169,6 +170,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
+ throw ghoul::MissingCaseException();
}
break;
case 3:
@@ -198,6 +200,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
+ throw ghoul::MissingCaseException();
}
break;
case 4:
@@ -227,11 +230,12 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
+ throw ghoul::MissingCaseException();
}
break;
default:
LERROR("Unknown number of channels for OpenGL texture: " << rasterCount);
- break;
+ throw ghoul::MissingCaseException();
}
return format;
}
@@ -267,6 +271,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
+ throw ghoul::MissingCaseException();
}
break;
case 2:
@@ -295,6 +300,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
+ throw ghoul::MissingCaseException();
}
break;
case 3:
@@ -324,6 +330,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
+ throw ghoul::MissingCaseException();
}
break;
case 4:
@@ -353,11 +360,12 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
+ throw ghoul::MissingCaseException();
}
break;
default:
LERROR("Unknown number of channels for OpenGL texture: " << rasterCount);
- break;
+ throw ghoul::MissingCaseException();
}
return format;
}
@@ -380,7 +388,7 @@ GLenum getOpenGLDataType(GDALDataType gdalType) {
return GL_DOUBLE;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
- return GL_UNSIGNED_BYTE;
+ throw ghoul::MissingCaseException();
}
}
@@ -402,7 +410,7 @@ GDALDataType getGdalDataType(GLenum glType) {
return GDT_Float64;
default:
LERROR("OpenGL data type unknown to GDAL: " << glType);
- return GDT_Unknown;
+ throw ghoul::MissingCaseException();
}
}
@@ -410,12 +418,16 @@ GDALDataType getGdalDataType(GLenum glType) {
size_t numberOfRasters(ghoul::opengl::Texture::Format format) {
switch (format) {
- case ghoul::opengl::Texture::Format::Red: return 1;
- case ghoul::opengl::Texture::Format::RG: return 2;
- case ghoul::opengl::Texture::Format::RGB:;
- [[fallthrough]]; case ghoul::opengl::Texture::Format::BGR: return 3;
- case ghoul::opengl::Texture::Format::RGBA:;
- [[fallthrough]]; case ghoul::opengl::Texture::Format::BGRA: return 4;
+ case ghoul::opengl::Texture::Format::Red:
+ return 1;
+ case ghoul::opengl::Texture::Format::RG:
+ return 2;
+ case ghoul::opengl::Texture::Format::RGB:
+ case ghoul::opengl::Texture::Format::BGR:
+ return 3;
+ case ghoul::opengl::Texture::Format::RGBA:
+ case ghoul::opengl::Texture::Format::BGRA:
+ return 4;
default: {
ghoul_assert(false, "Unknown format");
return 0;
@@ -436,7 +448,7 @@ size_t numberOfBytes(GLenum glType) {
case GL_DOUBLE: return sizeof(GLdouble);
default: {
ghoul_assert(false, "Unknown data type");
- return 0;
+ throw ghoul::MissingCaseException();
}
}
}
@@ -455,7 +467,7 @@ size_t getMaximumValue(GLenum glType) {
return 1ULL << 31ULL;
default: {
ghoul_assert(false, "Unknown data type");
- return 0ULL;
+ throw ghoul::MissingCaseException();
}
}
}
@@ -480,7 +492,7 @@ float interpretFloat(GLenum glType, const char* src) {
return static_cast(*reinterpret_cast(src));
default: {
ghoul_assert(false, "Unknown data type");
- return 0;
+ throw ghoul::MissingCaseException();
}
}
}
@@ -504,7 +516,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
- return GLenum(0);
+ throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::RG:
switch (glType) {
@@ -523,7 +535,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
- return GLenum(0);
+ throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::RGB:
switch (glType) {
@@ -542,7 +554,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
- return GLenum(0);
+ throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::RGBA:
switch (glType) {
@@ -561,7 +573,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
- return GLenum(0);
+ throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::BGR:
switch (glType) {
@@ -580,7 +592,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
- return GLenum(0);
+ throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::BGRA:
switch (glType) {
@@ -599,16 +611,16 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
- return GLenum(0);
+ throw ghoul::MissingCaseException();
}
default:
LERROR(
"Unknown format for OpenGL texture: " <<
- static_cast
- >(format)
+ static_cast>(
+ format
+ )
);
- return GLenum(0);
+ throw ghoul::MissingCaseException();
}
}
diff --git a/modules/globebrowsing/tile/tileindex.cpp b/modules/globebrowsing/tile/tileindex.cpp
index 72f66bb578..01c35b01fa 100644
--- a/modules/globebrowsing/tile/tileindex.cpp
+++ b/modules/globebrowsing/tile/tileindex.cpp
@@ -46,8 +46,8 @@ TileIndex::TileIndex(const TileIndex& other)
: x(other.x), y(other.y), level(other.level)
{}
-TileIndex::TileIndex(const Geodetic2& point, int level)
- : level(level)
+TileIndex::TileIndex(const Geodetic2& point, int level_)
+ : level(level_)
{
int numIndicesAtLevel = 1 << level;
double u = 0.5 + point.lon / (2 * glm::pi());
@@ -55,8 +55,8 @@ TileIndex::TileIndex(const Geodetic2& point, int level)
double xIndexSpace = u * numIndicesAtLevel;
double yIndexSpace = v * numIndicesAtLevel;
- x = floor(xIndexSpace);
- y = floor(yIndexSpace);
+ x = static_cast(floor(xIndexSpace));
+ y = static_cast(floor(yIndexSpace));
}
TileIndex::TileIndex(const ghoul::Dictionary& dict) {
diff --git a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp
index af24cfbc68..60a3eeb5d2 100644
--- a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp
+++ b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp
@@ -500,7 +500,7 @@ std::vector