mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-18 02:49:03 -06:00
Merge branch 'master' of github.com:OpenSpace/OpenSpace into feature/data-management
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -88,6 +88,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
|
||||
@@ -118,6 +121,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
|
||||
|
||||
@@ -94,7 +94,10 @@ private:
|
||||
void clear();
|
||||
QStringList selectedScenes() const;
|
||||
|
||||
void handleFileFutureAddition(const std::vector<std::shared_ptr<openspace::DownloadManager::FileFuture>>& futures);
|
||||
void handleFileFutureAddition(
|
||||
const std::vector<std::shared_ptr<openspace::DownloadManager::FileFuture>>&
|
||||
futures
|
||||
);
|
||||
|
||||
void handleDirectFiles();
|
||||
void handleFileRequest();
|
||||
@@ -116,7 +119,10 @@ private:
|
||||
std::set<std::string> _filesDownloading;
|
||||
|
||||
std::vector<std::shared_ptr<openspace::DownloadManager::FileFuture>> _futures;
|
||||
std::map<std::shared_ptr<openspace::DownloadManager::FileFuture>, InfoWidget*> _futureInfoWidgetMap;
|
||||
std::map<
|
||||
std::shared_ptr<openspace::DownloadManager::FileFuture>,
|
||||
InfoWidget*
|
||||
> _futureInfoWidgetMap;
|
||||
|
||||
std::vector<std::shared_ptr<openspace::DownloadManager::FileFuture>> _futuresToAdd;
|
||||
std::atomic_flag _mutex;
|
||||
|
||||
1
assets/keybindings.asset
Normal file
1
assets/keybindings.asset
Normal file
@@ -0,0 +1 @@
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'));
|
||||
@@ -1,13 +1,16 @@
|
||||
asset.require("keybindings")
|
||||
|
||||
asset.request("sun/sun")
|
||||
--asset.request("planets/planets")
|
||||
-- asset.request("planets/moons")
|
||||
asset.request("planets/trails")
|
||||
-- asset.request("dwarfplanets/pluto")
|
||||
|
||||
|
||||
|
||||
local sceneHelper = asset.require("scenehelper")
|
||||
|
||||
asset.onInitialize(function ()
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_common_keys.lua'))
|
||||
openspace.time.setTime(openspace.time.currentWallTime())
|
||||
|
||||
|
||||
|
||||
20
data/scene/mars/map_service_configs/Utah/Mola_HRSC.xml
Normal file
20
data/scene/mars/map_service_configs/Utah/Mola_HRSC.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://openspace.sci.utah.edu/Mars/MolaHRSC/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>106694</SizeX>
|
||||
<SizeY>53347</SizeY>
|
||||
<TileLevel>7</TileLevel>
|
||||
<YOrigin>top</YOrigin> <!-- fail: bottom -->
|
||||
</DataWindow>
|
||||
<!-- <Projection>GEOGCS["GCS_Mars_2000_Sphere",DATUM["D_Mars_2000_Sphere",SPHEROID["Mars_2000_Sphere_IAU_IAG",3396190.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection> -->
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
@@ -50,6 +50,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"
|
||||
|
||||
6
data/scene/missions/voyager/voyager1/voyager1.data
Normal file
6
data/scene/missions/voyager/voyager1/voyager1.data
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
FileRequest = {
|
||||
{ Identifier = "voyager1_model", Destination = ".", Version = 1 },
|
||||
{ Identifier = "voyager1_spice", Destination = "${SPICE}/voyager", Version = 1 }
|
||||
}
|
||||
}
|
||||
163
data/scene/missions/voyager/voyager1/voyager1.mod
Normal file
163
data/scene/missions/voyager/voyager1/voyager1.mod
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
6
data/scene/missions/voyager/voyager2/voyager2.data
Normal file
6
data/scene/missions/voyager/voyager2/voyager2.data
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
FileRequest = {
|
||||
{ Identifier = "voyager2_model", Destination = ".", Version = 1 },
|
||||
{ Identifier = "voyager2_spice", Destination = "${SPICE}/voyager", Version = 1 }
|
||||
}
|
||||
}
|
||||
241
data/scene/missions/voyager/voyager2/voyager2.mod
Normal file
241
data/scene/missions/voyager/voyager2/voyager2.mod
Normal file
@@ -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"
|
||||
},
|
||||
}
|
||||
@@ -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" },
|
||||
|
||||
67
data/scene/voyager.scene
Normal file
67
data/scene/voyager.scene
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Submodule ext/ghoul updated: 4dce717aac...d7aec4688b
@@ -81,6 +81,9 @@ public:
|
||||
|
||||
void swapBuffer() const override;
|
||||
|
||||
int nWindows() const override;
|
||||
int currentWindowId() const override;
|
||||
|
||||
private:
|
||||
properties::FloatProperty _eyeSeparation;
|
||||
properties::BoolProperty _showStatsGraph;
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -141,35 +141,35 @@ namespace openspace::properties {
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* state, \
|
||||
bool& success) \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* lua, \
|
||||
bool& successful) \
|
||||
{ \
|
||||
return FROM_LUA_LAMBDA_EXPRESSION(state, success); \
|
||||
return FROM_LUA_LAMBDA_EXPRESSION(lua, successful); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* state, \
|
||||
bool& success) \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* lua, \
|
||||
bool& successful) \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>( \
|
||||
state, success); \
|
||||
lua, successful); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue<TYPE>(lua_State* state, \
|
||||
TYPE value) \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue<TYPE>(lua_State* lua, \
|
||||
TYPE val) \
|
||||
{ \
|
||||
return TO_LUA_LAMBDA_EXPRESSION(state, value); \
|
||||
return TO_LUA_LAMBDA_EXPRESSION(lua, val); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<NumericalProperty<TYPE>>::toLuaValue<TYPE>(lua_State* state, \
|
||||
TYPE value) \
|
||||
TYPE val) \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue<TYPE>(state, value); \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue<TYPE>(state, val); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
@@ -187,9 +187,9 @@ namespace openspace::properties {
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(std::string value, \
|
||||
bool& success) \
|
||||
bool& successful) \
|
||||
{ \
|
||||
return FROM_STRING_LAMBDA_EXPRESSION(value, success); \
|
||||
return FROM_STRING_LAMBDA_EXPRESSION(value, successful); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
@@ -205,18 +205,18 @@ namespace openspace::properties {
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
|
||||
TYPE inValue) \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& out, \
|
||||
TYPE in) \
|
||||
{ \
|
||||
return TO_STRING_LAMBDA_EXPRESSION(outValue, inValue); \
|
||||
return TO_STRING_LAMBDA_EXPRESSION(out, in); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<NumericalProperty<TYPE>>::toString(std::string& outValue, \
|
||||
TYPE inValue) \
|
||||
bool PropertyDelegate<NumericalProperty<TYPE>>::toString(std::string& out, \
|
||||
TYPE in) \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::toString(outValue, inValue); \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::toString(out, in); \
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -106,16 +106,17 @@ namespace openspace::properties {
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>(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<TemplateProperty<TYPE>>::toLuaValue<TYPE>(lua_State* l, TYPE v)\
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue<TYPE>(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<TemplateProperty<TYPE>>::fromString(std::string v, \
|
||||
bool& s) \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(std::string value, \
|
||||
bool& successful) \
|
||||
{ \
|
||||
return FROM_STRING_LAMBDA_EXPRESSION(v, s); \
|
||||
return FROM_STRING_LAMBDA_EXPRESSION(value, successful); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace ghoul::fontrendering {
|
||||
|
||||
namespace ghoul::opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
class Texture;
|
||||
} // namespace ghoul::opengl
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -75,6 +75,7 @@ public:
|
||||
void initialize();
|
||||
void initializeGL();
|
||||
void deinitialize();
|
||||
void deinitializeGL();
|
||||
|
||||
void setScene(Scene* scene);
|
||||
Scene* scene();
|
||||
@@ -106,9 +107,9 @@ public:
|
||||
float globalBlackOutFactor();
|
||||
void setGlobalBlackOutFactor(float factor);
|
||||
|
||||
void registerScreenSpaceRenderable(std::shared_ptr<ScreenSpaceRenderable> s);
|
||||
void unregisterScreenSpaceRenderable(std::shared_ptr<ScreenSpaceRenderable> s);
|
||||
void unregisterScreenSpaceRenderable(const std::string& name);
|
||||
void addScreenSpaceRenderable(std::shared_ptr<ScreenSpaceRenderable> s);
|
||||
void removeScreenSpaceRenderable(std::shared_ptr<ScreenSpaceRenderable> s);
|
||||
void removeScreenSpaceRenderable(const std::string& name);
|
||||
std::shared_ptr<ScreenSpaceRenderable> screenSpaceRenderable(const std::string& name);
|
||||
std::vector<ScreenSpaceRenderable*> screenSpaceRenderables() const;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace openspace {
|
||||
class BlockPlaneIntersectionGeometry {
|
||||
public:
|
||||
// initializers
|
||||
BlockPlaneIntersectionGeometry(glm::vec3 blockSize, glm::vec3 planeNormal, float planeDistance);
|
||||
BlockPlaneIntersectionGeometry(glm::vec3 blockSize, glm::vec3 planeNormal,
|
||||
float planeDistance);
|
||||
~BlockPlaneIntersectionGeometry();
|
||||
|
||||
bool initialize();
|
||||
|
||||
@@ -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__
|
||||
|
||||
37
include/openspace/util/distanceconversion.h
Normal file
37
include/openspace/util/distanceconversion.h
Normal file
@@ -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 <string>
|
||||
#include <utility>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
std::pair<double, std::string> simplifyDistance(double meters);
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___DISTANCECONVERSION___H__
|
||||
@@ -48,10 +48,11 @@ public:
|
||||
// Sets the power scaled coordinates with w = 0
|
||||
PowerScaledCoordinate(glm::vec3 v);
|
||||
|
||||
static PowerScaledCoordinate CreatePowerScaledCoordinate(double d1, double d2, double d3);
|
||||
static PowerScaledCoordinate CreatePowerScaledCoordinate(double d1, double d2,
|
||||
double d3);
|
||||
|
||||
// get functions
|
||||
// return the full, unmodified PSC
|
||||
// return the full, unmodified PSC
|
||||
const glm::vec4& vec4() const;
|
||||
|
||||
// returns the rescaled, "normal" coordinates
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace openspace {
|
||||
class PowerScaledSphere {
|
||||
public:
|
||||
// initializers
|
||||
PowerScaledSphere(const PowerScaledScalar& radius,
|
||||
PowerScaledSphere(const PowerScaledScalar& radius,
|
||||
int segments = 8);
|
||||
|
||||
PowerScaledSphere(glm::vec3 radius, int segments);
|
||||
|
||||
37
include/openspace/util/timeconversion.h
Normal file
37
include/openspace/util/timeconversion.h
Normal file
@@ -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 <string>
|
||||
#include <utility>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
std::pair<double, std::string> simplifyTime(double seconds);
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___TIMECONVERSION___H__
|
||||
@@ -34,6 +34,7 @@ set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrail.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailorbit.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailtrajectory.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacedashboard.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.h
|
||||
@@ -57,6 +58,7 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrail.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailorbit.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrailtrajectory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacedashboard.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.cpp
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <modules/base/rendering/renderableplane.h>
|
||||
#include <modules/base/rendering/modelgeometry.h>
|
||||
#include <modules/base/rendering/multimodelgeometry.h>
|
||||
#include <modules/base/rendering/screenspacedashboard.h>
|
||||
#include <modules/base/rendering/screenspaceimagelocal.h>
|
||||
#include <modules/base/rendering/screenspaceimageonline.h>
|
||||
#include <modules/base/rendering/screenspaceframebuffer.h>
|
||||
@@ -72,6 +73,7 @@ void BaseModule::internalInitialize() {
|
||||
auto fSsRenderable = FactoryManager::ref().factory<ScreenSpaceRenderable>();
|
||||
ghoul_assert(fSsRenderable, "ScreenSpaceRenderable factory was not created");
|
||||
|
||||
fSsRenderable->registerClass<ScreenSpaceDashboard>("ScreenSpaceDashboard");
|
||||
fSsRenderable->registerClass<ScreenSpaceImageLocal>("ScreenSpaceImageLocal");
|
||||
fSsRenderable->registerClass<ScreenSpaceImageOnline>("ScreenSpaceImageOnline");
|
||||
fSsRenderable->registerClass<ScreenSpaceFramebuffer>("ScreenSpaceFramebuffer");
|
||||
@@ -117,6 +119,7 @@ std::vector<documentation::Documentation> BaseModule::documentations() const {
|
||||
RenderableSphere::Documentation(),
|
||||
RenderableTrailOrbit::Documentation(),
|
||||
RenderableTrailTrajectory::Documentation(),
|
||||
ScreenSpaceDashboard::Documentation(),
|
||||
ScreenSpaceFramebuffer::Documentation(),
|
||||
ScreenSpaceImageLocal::Documentation(),
|
||||
ScreenSpaceImageOnline::Documentation(),
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
MultiModelGeometry(const ghoul::Dictionary& dictionary);
|
||||
|
||||
private:
|
||||
bool loadModel(const std::string& filename);
|
||||
virtual bool loadModel(const std::string& filename) override;
|
||||
};
|
||||
|
||||
} // namespace openspace::modelgeometry
|
||||
|
||||
@@ -259,7 +259,7 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
setPscUniforms(*_shader.get(), data.camera, data.position);
|
||||
|
||||
if (_fadeOutThreshold > -1.0) {
|
||||
float distCamera = glm::distance(
|
||||
double distCamera = glm::distance(
|
||||
data.camera.positionVec3(),
|
||||
data.position.dvec3()
|
||||
);
|
||||
|
||||
@@ -47,12 +47,12 @@ namespace documentation { struct Documentation; }
|
||||
class RenderableTrailOrbit : public RenderableTrail {
|
||||
public:
|
||||
explicit RenderableTrailOrbit(const ghoul::Dictionary& dictionary);
|
||||
|
||||
|
||||
void initializeGL() override;
|
||||
void deinitializeGL() override;
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
|
||||
182
modules/base/rendering/screenspacedashboard.cpp
Normal file
182
modules/base/rendering/screenspacedashboard.cpp
Normal file
@@ -0,0 +1,182 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/base/rendering/screenspacedashboard.h>
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/interaction/navigationhandler.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/util/distanceconversion.h>>
|
||||
#include <openspace/util/timeconversion.h>
|
||||
#include <openspace/util/timemanager.h>
|
||||
|
||||
#include <ghoul/font/fontmanager.h>
|
||||
#include <ghoul/font/fontrenderer.h>
|
||||
|
||||
namespace {
|
||||
const char* KeyName = "Name";
|
||||
const char* KeyFontMono = "Mono";
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation ScreenSpaceDashboard::Documentation() {
|
||||
using namespace openspace::documentation;
|
||||
return {
|
||||
"ScreenSpace Dashboard",
|
||||
"base_screenspace_dashboard",
|
||||
{
|
||||
{
|
||||
KeyName,
|
||||
new StringVerifier,
|
||||
Optional::Yes,
|
||||
"Specifies the GUI name of the ScreenSpaceDashboard"
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
ScreenSpaceDashboard::ScreenSpaceDashboard(const ghoul::Dictionary& dictionary)
|
||||
: ScreenSpaceFramebuffer(dictionary)
|
||||
, _fontRenderer(nullptr)
|
||||
, _fontDate(nullptr)
|
||||
, _fontInfo(nullptr)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
"ScreenSpaceDashboard"
|
||||
);
|
||||
|
||||
if (dictionary.hasKey(KeyName)) {
|
||||
setName(dictionary.value<std::string>(KeyName));
|
||||
}
|
||||
else {
|
||||
static int id = 0;
|
||||
if (id == 0) {
|
||||
setName("ScreenSpaceDashboard");
|
||||
}
|
||||
else {
|
||||
setName("ScreenSpaceDashboard" + std::to_string(id));
|
||||
}
|
||||
++id;
|
||||
}
|
||||
|
||||
_scale = 1.f;
|
||||
_scale.setMaxValue(15.f);
|
||||
|
||||
_size.onChange([this]() {
|
||||
_fontRenderer->setFramebufferSize({ _size.value().z, _size.value().w });
|
||||
});
|
||||
}
|
||||
|
||||
ScreenSpaceDashboard::~ScreenSpaceDashboard() {}
|
||||
|
||||
bool ScreenSpaceDashboard::initializeGL() {
|
||||
ScreenSpaceFramebuffer::initializeGL();
|
||||
|
||||
_fontRenderer = ghoul::fontrendering::FontRenderer::createDefault();
|
||||
_fontRenderer->setFramebufferSize({ _size.value().z, _size.value().w });
|
||||
|
||||
|
||||
_fontDate = OsEng.fontManager().font(
|
||||
KeyFontMono,
|
||||
48
|
||||
);
|
||||
_fontInfo = OsEng.fontManager().font(
|
||||
KeyFontMono,
|
||||
32
|
||||
);
|
||||
|
||||
addRenderFunction([this]() {
|
||||
|
||||
glm::vec2 penPosition = glm::vec2(
|
||||
10.f,
|
||||
_size.value().w
|
||||
);
|
||||
|
||||
penPosition.y -= _fontDate->height();
|
||||
RenderFontCr(
|
||||
*_fontDate,
|
||||
penPosition,
|
||||
"Date: %s",
|
||||
OsEng.timeManager().time().UTC().c_str()
|
||||
);
|
||||
|
||||
std::pair<double, std::string> deltaTime = simplifyTime(
|
||||
OsEng.timeManager().time().deltaTime()
|
||||
);
|
||||
RenderFontCr(
|
||||
*_fontInfo,
|
||||
penPosition,
|
||||
"Simulation increment: %.1f %s / second",
|
||||
deltaTime.first,
|
||||
deltaTime.second.c_str()
|
||||
);
|
||||
|
||||
double distance = glm::length(
|
||||
OsEng.renderEngine().camera()->positionVec3() -
|
||||
OsEng.navigationHandler().focusNode()->worldPosition()
|
||||
);
|
||||
std::pair<double, std::string> dist = simplifyDistance(distance);
|
||||
RenderFontCr(
|
||||
*_fontInfo,
|
||||
penPosition,
|
||||
"Distance from focus: %f %s",
|
||||
dist.first,
|
||||
dist.second.c_str()
|
||||
);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScreenSpaceDashboard::deinitializeGL() {
|
||||
_fontRenderer = nullptr;
|
||||
return ScreenSpaceFramebuffer::deinitializeGL();
|
||||
}
|
||||
|
||||
bool ScreenSpaceDashboard::isReady() const {
|
||||
return (_fontRenderer != nullptr) &&
|
||||
(_fontDate != nullptr) &&
|
||||
(_fontInfo != nullptr) &&
|
||||
ScreenSpaceFramebuffer::isReady();
|
||||
}
|
||||
|
||||
void ScreenSpaceDashboard::update() {
|
||||
if (OsEng.windowWrapper().windowHasResized()) {
|
||||
glm::ivec2 size = OsEng.windowWrapper().currentWindowResolution();
|
||||
_size = { 0.f, 0.f, size.x, size.y };
|
||||
_originalViewportSize = size;
|
||||
createFramebuffer();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
61
modules/base/rendering/screenspacedashboard.h
Normal file
61
modules/base/rendering/screenspacedashboard.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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_MODULE_BASE___SCREENSPACEDASHBOARD___H__
|
||||
#define __OPENSPACE_MODULE_BASE___SCREENSPACEDASHBOARD___H__
|
||||
|
||||
#include <modules/base/rendering/screenspaceframebuffer.h>
|
||||
|
||||
namespace ghoul::fontrendering {
|
||||
class Font;
|
||||
class FontRenderer;
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
class ScreenSpaceDashboard: public ScreenSpaceFramebuffer {
|
||||
public:
|
||||
ScreenSpaceDashboard(const ghoul::Dictionary& dictionary);
|
||||
~ScreenSpaceDashboard();
|
||||
|
||||
bool initializeGL() override;
|
||||
bool deinitializeGL() override;
|
||||
|
||||
bool isReady() const override;
|
||||
void update() override;
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
std::unique_ptr<ghoul::fontrendering::FontRenderer> _fontRenderer;
|
||||
|
||||
std::shared_ptr<ghoul::fontrendering::Font> _fontDate;
|
||||
std::shared_ptr<ghoul::fontrendering::Font> _fontInfo;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_BASE___SCREENSPACEDASHBOARD___H__
|
||||
@@ -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);
|
||||
@@ -77,7 +82,7 @@ ScreenSpaceFramebuffer::~ScreenSpaceFramebuffer() {}
|
||||
|
||||
bool ScreenSpaceFramebuffer::initializeGL() {
|
||||
ScreenSpaceRenderable::initializeGL();
|
||||
createFragmentbuffer();
|
||||
createFramebuffer();
|
||||
|
||||
return isReady();
|
||||
}
|
||||
@@ -85,7 +90,9 @@ bool ScreenSpaceFramebuffer::initializeGL() {
|
||||
bool ScreenSpaceFramebuffer::deinitializeGL() {
|
||||
ScreenSpaceRenderable::deinitializeGL();
|
||||
|
||||
_framebuffer->activate();
|
||||
_framebuffer->detachAll();
|
||||
_framebuffer->deactivate();
|
||||
removeAllRenderFunctions();
|
||||
|
||||
return true;
|
||||
@@ -98,7 +105,7 @@ void ScreenSpaceFramebuffer::render() {
|
||||
float xratio = _originalViewportSize.x / (size.z-size.x);
|
||||
float yratio = _originalViewportSize.y / (size.w-size.y);;
|
||||
|
||||
if (!_renderFunctions.empty()) {
|
||||
if (!_renderFunctions.empty() || !_renderFunctionsShared.empty()) {
|
||||
glViewport(
|
||||
static_cast<GLint>(-size.x * xratio),
|
||||
static_cast<GLint>(-size.y * yratio),
|
||||
@@ -108,10 +115,12 @@ void ScreenSpaceFramebuffer::render() {
|
||||
GLint defaultFBO = _framebuffer->getActiveObject();
|
||||
_framebuffer->activate();
|
||||
|
||||
glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClearColor(0.f, 0.f, 0.f, 0.f);
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
for (const auto& renderFunction : _renderFunctions) {
|
||||
renderFunction();
|
||||
}
|
||||
for (const auto& renderFunction : _renderFunctionsShared) {
|
||||
(*renderFunction)();
|
||||
}
|
||||
_framebuffer->deactivate();
|
||||
@@ -126,15 +135,15 @@ void ScreenSpaceFramebuffer::render() {
|
||||
|
||||
glm::mat4 rotation = rotationMatrix();
|
||||
glm::mat4 translation = translationMatrix();
|
||||
glm::mat4 scale = scaleMatrix();
|
||||
scale = glm::scale(scale, glm::vec3((1.0/xratio), -(1.0/yratio), 1.0f));
|
||||
glm::mat4 scale = glm::scale(
|
||||
scaleMatrix(),
|
||||
glm::vec3((1.f / xratio), (1.f / yratio), 1.f)
|
||||
);
|
||||
glm::mat4 modelTransform = rotation*translation*scale;
|
||||
draw(modelTransform);
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::update() {}
|
||||
|
||||
bool ScreenSpaceFramebuffer::isReady() const {
|
||||
bool ready = true;
|
||||
if (!_shader) {
|
||||
@@ -150,17 +159,22 @@ void ScreenSpaceFramebuffer::setSize(glm::vec4 size) {
|
||||
_size.set(size);
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::addRenderFunction(std::function<void()> renderFunction) {
|
||||
_renderFunctions.push_back(std::move(renderFunction));
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::addRenderFunction(
|
||||
std::shared_ptr<std::function<void()>> renderFunction)
|
||||
{
|
||||
_renderFunctions.push_back(renderFunction);
|
||||
_renderFunctionsShared.push_back(std::move(renderFunction));
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::removeAllRenderFunctions() {
|
||||
_renderFunctions.clear();
|
||||
_renderFunctionsShared.clear();
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::createFragmentbuffer() {
|
||||
void ScreenSpaceFramebuffer::createFramebuffer() {
|
||||
_framebuffer = std::make_unique<ghoul::opengl::FramebufferObject>();
|
||||
_framebuffer->activate();
|
||||
_texture = std::make_unique<ghoul::opengl::Texture>(glm::uvec3(
|
||||
|
||||
@@ -51,23 +51,25 @@ public:
|
||||
bool initializeGL() override;
|
||||
bool deinitializeGL() override;
|
||||
void render() override;
|
||||
void update() override;
|
||||
bool isReady() const override;
|
||||
|
||||
void setSize(glm::vec4);
|
||||
void addRenderFunction(std::shared_ptr<std::function<void()>> renderFunction);
|
||||
void addRenderFunction(std::function<void()> renderFunction);
|
||||
void removeAllRenderFunctions();
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
void createFragmentbuffer();
|
||||
static int id();
|
||||
|
||||
protected:
|
||||
void createFramebuffer();
|
||||
properties::Vec4Property _size;
|
||||
|
||||
private:
|
||||
static int id();
|
||||
|
||||
std::unique_ptr<ghoul::opengl::FramebufferObject> _framebuffer;
|
||||
std::vector<std::shared_ptr<std::function<void()>>> _renderFunctions;
|
||||
std::vector<std::shared_ptr<std::function<void()>>> _renderFunctionsShared;
|
||||
std::vector<std::function<void()>> _renderFunctions;
|
||||
|
||||
int _id;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -355,7 +355,6 @@ FixedRotation::FixedRotation(const ghoul::Dictionary& dictionary)
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
_xAxis.type.addOptions({
|
||||
{ Axis::Type::Object, "Object" },
|
||||
@@ -544,7 +543,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 ||
|
||||
@@ -574,8 +573,8 @@ glm::vec3 FixedRotation::xAxis() const {
|
||||
case Axis::Type::Object:
|
||||
if (_xAxis.node && _attachedNode) {
|
||||
glm::vec3 dir = glm::vec3(glm::normalize(
|
||||
glm::dvec3(_xAxis.node->worldPosition()) -
|
||||
glm::dvec3(_attachedNode->worldPosition())
|
||||
_xAxis.node->worldPosition() -
|
||||
_attachedNode->worldPosition()
|
||||
));
|
||||
return _xAxis.invertObject ? -dir : dir;
|
||||
}
|
||||
@@ -629,8 +628,8 @@ glm::vec3 FixedRotation::yAxis() const {
|
||||
case Axis::Type::Object:
|
||||
if (_yAxis.node && _attachedNode) {
|
||||
glm::vec3 dir = glm::vec3(glm::normalize(
|
||||
glm::dvec3(_yAxis.node->worldPosition()) -
|
||||
glm::dvec3(_attachedNode->worldPosition())
|
||||
_yAxis.node->worldPosition() -
|
||||
_attachedNode->worldPosition()
|
||||
));
|
||||
return _yAxis.invertObject ? -dir : dir;
|
||||
}
|
||||
@@ -684,8 +683,8 @@ glm::vec3 FixedRotation::zAxis() const {
|
||||
case Axis::Type::Object:
|
||||
if (_zAxis.node && _attachedNode) {
|
||||
glm::vec3 dir = glm::vec3(glm::normalize(
|
||||
glm::dvec3(_zAxis.node->worldPosition()) -
|
||||
glm::dvec3(_attachedNode->worldPosition())
|
||||
_zAxis.node->worldPosition() -
|
||||
_attachedNode->worldPosition()
|
||||
));
|
||||
return _zAxis.invertObject ? -dir : dir;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,9 @@ void LuaRotation::update(const UpdateData& data) {
|
||||
auto now = high_resolution_clock::now();
|
||||
lua_pushnumber(
|
||||
_state,
|
||||
duration_cast<milliseconds>(now.time_since_epoch()).count()
|
||||
static_cast<lua_Number>(
|
||||
duration_cast<milliseconds>(now.time_since_epoch()).count()
|
||||
)
|
||||
);
|
||||
|
||||
// Execute the scaling function
|
||||
|
||||
@@ -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; });
|
||||
|
||||
@@ -101,7 +101,9 @@ void LuaScale::update(const UpdateData& data) {
|
||||
auto now = high_resolution_clock::now();
|
||||
lua_pushnumber(
|
||||
_state,
|
||||
duration_cast<milliseconds>(now.time_since_epoch()).count()
|
||||
static_cast<lua_Number>(
|
||||
duration_cast<milliseconds>(now.time_since_epoch()).count()
|
||||
)
|
||||
);
|
||||
|
||||
// Execute the scaling function
|
||||
|
||||
@@ -118,7 +118,9 @@ void LuaTranslation::update(const UpdateData& data) {
|
||||
auto now = high_resolution_clock::now();
|
||||
lua_pushnumber(
|
||||
_state,
|
||||
duration_cast<milliseconds>(now.time_since_epoch()).count()
|
||||
static_cast<lua_Number>(
|
||||
duration_cast<milliseconds>(now.time_since_epoch()).count()
|
||||
)
|
||||
);
|
||||
|
||||
// Execute the scaling function
|
||||
|
||||
@@ -107,7 +107,14 @@ void DebugRenderer::renderVertices(const Vertices& clippingSpacePoints, GLenum m
|
||||
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(clippingSpacePoints[0]), 0);
|
||||
glVertexAttribPointer(
|
||||
0,
|
||||
4,
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
sizeof(clippingSpacePoints[0]),
|
||||
nullptr
|
||||
);
|
||||
|
||||
// Draw the vertices
|
||||
glDrawArrays(mode, 0, static_cast<GLsizei>(clippingSpacePoints.size()));
|
||||
|
||||
@@ -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<char>(tolower(c)); }
|
||||
);
|
||||
// Verify that the input type is correct
|
||||
if (inputFileTypeString == ValueInputFileTypeCdf) {
|
||||
sourceFileType = SourceFileType::Cdf;
|
||||
|
||||
@@ -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<float>& FieldlinesState::extraQuantity(const size_t index,
|
||||
std::vector<float> FieldlinesState::extraQuantity(const size_t index,
|
||||
bool& isSuccessful) const {
|
||||
if (index < _extraQuantities.size()) {
|
||||
isSuccessful = true;
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
const std::vector<glm::vec3>& vertexPositions() const;
|
||||
|
||||
// Special getter. Returns extraQuantities[INDEX].
|
||||
const std::vector<float>& extraQuantity(const size_t INDEX, bool& isSuccesful) const;
|
||||
std::vector<float> extraQuantity(const size_t INDEX, bool& isSuccesful) const;
|
||||
|
||||
void setModel(const fls::Model m) { _model = m; }
|
||||
void setTriggerTime(const double t) { _triggerTime = t; }
|
||||
|
||||
@@ -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.
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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<const TileTextureInitData::HashKey,
|
||||
TextureContainerTileCache>& 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<const TileTextureInitData::HashKey,
|
||||
TextureContainerTileCache>& p)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,8 @@ namespace openspace::globebrowsing::chunklevelevaluator {
|
||||
*/
|
||||
class ProjectedArea : public Evaluator {
|
||||
public:
|
||||
virtual int getDesiredLevel(const Chunk& chunk, const RenderData& data) const;
|
||||
virtual int getDesiredLevel(
|
||||
const Chunk& chunk, const RenderData& data) const override;
|
||||
};
|
||||
|
||||
} // namespace openspace::globebrowsing::chunklevelevaluator
|
||||
|
||||
@@ -502,16 +502,11 @@ std::string GlobeBrowsingModule::layerTypeNamesList() {
|
||||
void GlobeBrowsingModule::loadWMSCapabilities(std::string name, std::string globe,
|
||||
std::string url)
|
||||
{
|
||||
auto downloadFunction = [](const std::string& url) {
|
||||
auto downloadFunction = [](const std::string& downloadUrl) {
|
||||
GDALDatasetH dataset = GDALOpen(
|
||||
url.c_str(),
|
||||
downloadUrl.c_str(),
|
||||
GA_ReadOnly
|
||||
);
|
||||
// GDAL_OF_READONLY | GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR,
|
||||
// nullptr,
|
||||
// nullptr,
|
||||
// nullptr
|
||||
//);
|
||||
|
||||
char** subDatasets = GDALGetMetadata(dataset, "SUBDATASETS");
|
||||
int nSubdatasets = CSLCount(subDatasets);
|
||||
|
||||
@@ -162,8 +162,8 @@ int goToGeo(lua_State* L) {
|
||||
return luaL_error(L, "Expected 2 or 3 arguments.");
|
||||
}
|
||||
|
||||
double latitude = static_cast<double>(lua_tonumber(L, 1));
|
||||
double longitude = static_cast<double>(lua_tonumber(L, 2));
|
||||
double latitude = lua_tonumber(L, 1);
|
||||
double longitude = lua_tonumber(L, 2);
|
||||
|
||||
if (nArguments == 2) {
|
||||
OsEng.moduleEngine().module<GlobeBrowsingModule>()->goToGeo(latitude, longitude);
|
||||
|
||||
@@ -95,7 +95,7 @@ void PointGlobe::initialize() {
|
||||
|
||||
// Position at location 0
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(glm::vec2), 0);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(glm::vec2), nullptr);
|
||||
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ void TriangleSoup::setVertexPositions(std::vector<glm::vec4> positions) {
|
||||
_gpuDataNeedUpdate = true;
|
||||
_vertexData.resize(positions.size());
|
||||
for (size_t i = 0; i < positions.size(); i++) {
|
||||
_vertexData[i].position[0] = static_cast<GLfloat>(positions[i].x);
|
||||
_vertexData[i].position[1] = static_cast<GLfloat>(positions[i].y);
|
||||
_vertexData[i].position[2] = static_cast<GLfloat>(positions[i].z);
|
||||
_vertexData[i].position[3] = static_cast<GLfloat>(positions[i].w);
|
||||
_vertexData[i].position[0] = positions[i].x;
|
||||
_vertexData[i].position[1] = positions[i].y;
|
||||
_vertexData[i].position[2] = positions[i].z;
|
||||
_vertexData[i].position[3] = positions[i].w;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ void TriangleSoup::setVertexTextureCoordinates(std::vector<glm::vec2> textures)
|
||||
_gpuDataNeedUpdate = true;
|
||||
_vertexData.resize(textures.size());
|
||||
for (size_t i = 0; i < textures.size(); i++) {
|
||||
_vertexData[i].texture[0] = static_cast<GLfloat>(textures[i].s);
|
||||
_vertexData[i].texture[1] = static_cast<GLfloat>(textures[i].t);
|
||||
_vertexData[i].texture[0] = textures[i].s;
|
||||
_vertexData[i].texture[1] = textures[i].t;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,9 +77,9 @@ void TriangleSoup::setVertexNormals(std::vector<glm::vec3> normals) {
|
||||
_gpuDataNeedUpdate = true;
|
||||
_vertexData.resize(normals.size());
|
||||
for (size_t i = 0; i < normals.size(); i++) {
|
||||
_vertexData[i].normal[0] = static_cast<GLfloat>(normals[i].x);
|
||||
_vertexData[i].normal[1] = static_cast<GLfloat>(normals[i].y);
|
||||
_vertexData[i].normal[2] = static_cast<GLfloat>(normals[i].z);
|
||||
_vertexData[i].normal[0] = normals[i].x;
|
||||
_vertexData[i].normal[1] = normals[i].y;
|
||||
_vertexData[i].normal[2] = normals[i].z;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ void TriangleSoup::setElements(std::vector<unsigned int> elements) {
|
||||
_elementData.resize(elements.size());
|
||||
_gpuDataNeedUpdate = true;
|
||||
for (size_t i = 0; i < elements.size(); i++) {
|
||||
_elementData[i] = static_cast<GLuint>(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<const GLvoid*>(offsetof(Vertex, position)));
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), nullptr);
|
||||
//reinterpret_cast<const GLvoid*>(offsetof(Vertex, position)));
|
||||
}
|
||||
// Textures at location 1
|
||||
if (_useTextureCoordinates) {
|
||||
|
||||
@@ -38,7 +38,7 @@ PixelBuffer::PixelBuffer(size_t numBytes, Usage usage)
|
||||
{
|
||||
glGenBuffers(1, &_id);
|
||||
bind();
|
||||
glBufferData(GL_PIXEL_UNPACK_BUFFER, _numBytes, 0, static_cast<GLenum>(_usage));
|
||||
glBufferData(GL_PIXEL_UNPACK_BUFFER, _numBytes, nullptr, static_cast<GLenum>(_usage));
|
||||
unbind();
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ void ChunkRenderer::renderChunkLocally(const Chunk& chunk, const RenderData& dat
|
||||
Geodetic2 corner = chunk.surfacePatch().getCorner(q);
|
||||
glm::dvec3 cornerModelSpace = ellipsoid.cartesianSurfacePosition(corner);
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ LayerGroup::LayerGroup(layergroupid::GroupID id, const ghoul::Dictionary& dict)
|
||||
try {
|
||||
addLayer(fallbackLayerDict);
|
||||
}
|
||||
catch (const ghoul::RuntimeError& e) {
|
||||
LERRORC(e.component, e.message);
|
||||
catch (const ghoul::RuntimeError& except) {
|
||||
LERRORC(except.component, except.message);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ public:
|
||||
void initialize();
|
||||
void deinitialize();
|
||||
|
||||
std::shared_ptr<Layer> addLayer(layergroupid::GroupID groupId, ghoul::Dictionary layerDict);
|
||||
std::shared_ptr<Layer> addLayer(layergroupid::GroupID groupId,
|
||||
ghoul::Dictionary layerDict);
|
||||
void deleteLayer(layergroupid::GroupID groupId, std::string layerName);
|
||||
|
||||
const LayerGroup& layerGroup(size_t groupId);
|
||||
|
||||
@@ -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<float>(pow(2, exponent)));// >>= exponent;
|
||||
start.y = ceil(start.y / static_cast<float>(pow(2, exponent)));// >>= exponent;
|
||||
start.x = static_cast<int>(ceil(start.x / static_cast<float>(pow(2, exponent))));
|
||||
start.y = static_cast<int>(ceil(start.y / static_cast<float>(pow(2, exponent))));
|
||||
numPixels.x =
|
||||
ceil(numPixels.x / static_cast<float>(pow(2, exponent)));// >>= exponent;
|
||||
static_cast<int>(ceil(numPixels.x / static_cast<float>(pow(2, exponent))));
|
||||
numPixels.y =
|
||||
ceil(numPixels.y / static_cast<float>(pow(2, exponent)));// >>= exponent;
|
||||
static_cast<int>(ceil(numPixels.y / static_cast<float>(pow(2, exponent))));
|
||||
start -= wrt;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ RawTile RawTile::createDefault(const TileTextureInitData& initData) {
|
||||
defaultRes.textureInitData = std::make_shared<TileTextureInitData>(initData);
|
||||
defaultRes.imageData = new char[initData.totalNumBytes()];
|
||||
std::fill_n(
|
||||
static_cast<char*>(defaultRes.imageData),
|
||||
defaultRes.imageData,
|
||||
initData.totalNumBytes(),
|
||||
char(0)
|
||||
);
|
||||
|
||||
@@ -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<float>(
|
||||
_dataset->GetRasterBand(1)->GetScale()
|
||||
);
|
||||
_gdalDatasetMetaDataCached.offset = static_cast<float>(
|
||||
_dataset->GetRasterBand(1)->GetOffset()
|
||||
);
|
||||
_gdalDatasetMetaDataCached.rasterXSize = _dataset->GetRasterXSize();
|
||||
_gdalDatasetMetaDataCached.rasterYSize = _dataset->GetRasterYSize();
|
||||
_gdalDatasetMetaDataCached.noDataValue =
|
||||
_dataset->GetRasterBand(1)->GetNoDataValue();
|
||||
_gdalDatasetMetaDataCached.noDataValue = static_cast<float>(
|
||||
_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<int>(-_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<int>(_initData.bytesPerPixel()), // Pixel spacing
|
||||
static_cast<int>(-io.write.bytesPerLine) // Line spacing
|
||||
-static_cast<int>(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<int>(diff);
|
||||
}
|
||||
|
||||
} // namespace openspace::globebrowsing
|
||||
|
||||
@@ -577,7 +577,7 @@ TileDepthTransform RawTileDataReader::calculateTileDepthTransform() {
|
||||
|
||||
TileDepthTransform transform;
|
||||
transform.depthOffset = depthOffset();
|
||||
transform.depthScale = depthScale() * maximumValue;
|
||||
transform.depthScale = static_cast<float>(depthScale() * maximumValue);
|
||||
return transform;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,14 +115,16 @@ RawTile::ReadError SimpleRawTileDataReader::rasterRead(
|
||||
y * _initData.bytesPerLine() +
|
||||
x * _initData.bytesPerPixel();
|
||||
|
||||
int xInSource =
|
||||
int xInSource = static_cast<int>(
|
||||
io.read.region.start.x +
|
||||
static_cast<float>(x) / io.write.region.numPixels.x *
|
||||
io.read.region.numPixels.x;
|
||||
int yInSource =
|
||||
io.read.region.numPixels.x
|
||||
);
|
||||
int yInSource = static_cast<int>(
|
||||
io.read.region.start.y +
|
||||
static_cast<float>(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<char>(
|
||||
sourceTexel[rasterBand - 1] * 255
|
||||
);
|
||||
*reinterpret_cast<char*>(pixelWriteDestination) = value;
|
||||
*pixelWriteDestination = value;
|
||||
break;
|
||||
}
|
||||
case GL_UNSIGNED_SHORT: {
|
||||
|
||||
@@ -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<float>(*reinterpret_cast<const GLdouble*>(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<std::underlying_type_t<
|
||||
ghoul::opengl::Texture::Format>
|
||||
>(format)
|
||||
static_cast<std::underlying_type_t<ghoul::opengl::Texture::Format>>(
|
||||
format
|
||||
)
|
||||
);
|
||||
return GLenum(0);
|
||||
throw ghoul::MissingCaseException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,16 +38,16 @@ namespace {
|
||||
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
TileIndex::TileIndex(int x, int y, int level)
|
||||
: x(x), y(y), level(level)
|
||||
TileIndex::TileIndex(int x_, int y_, int level_)
|
||||
: x(x_), y(y_), level(level_)
|
||||
{}
|
||||
|
||||
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<double>());
|
||||
@@ -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<int>(floor(xIndexSpace));
|
||||
y = static_cast<int>(floor(yIndexSpace));
|
||||
}
|
||||
|
||||
TileIndex::TileIndex(const ghoul::Dictionary& dict) {
|
||||
|
||||
@@ -500,7 +500,7 @@ std::vector<Time> TimeQuantizer::quantized(const Time& start, const Time& end) c
|
||||
const double delta = endSeconds - startSeconds;
|
||||
|
||||
ghoul_assert(int(delta) % int(_resolution) == 0, "Quantization error");
|
||||
const int nSteps = delta / _resolution;
|
||||
const int nSteps = static_cast<int>(delta / _resolution);
|
||||
|
||||
std::vector<Time> result(nSteps + 1);
|
||||
for (int i = 0; i <= nSteps; ++i) {
|
||||
|
||||
@@ -56,7 +56,7 @@ bool TextTileProvider::initialize() {
|
||||
|
||||
_font = OsEng.fontManager().font("Mono", static_cast<float>(_fontSize));
|
||||
|
||||
_fontRenderer = std::unique_ptr<FontRenderer>(FontRenderer::createDefault());
|
||||
_fontRenderer = FontRenderer::createDefault();
|
||||
_fontRenderer->setFramebufferSize(glm::vec2(_initData.dimensions()));
|
||||
|
||||
glGenFramebuffers(1, &_fbo);
|
||||
|
||||
@@ -61,7 +61,7 @@ TileProviderByLevel::TileProviderByLevel(const ghoul::Dictionary& dictionary) {
|
||||
"Must define key '" + std::string(KeyMaxLevel) + "'"
|
||||
);
|
||||
}
|
||||
maxLevel = std::round(floatMaxLevel);
|
||||
maxLevel = static_cast<int>(std::round(floatMaxLevel));
|
||||
|
||||
ghoul::Dictionary providerDict;
|
||||
if (!levelProviderDict.getValue<ghoul::Dictionary>(KeyTileProvider, providerDict))
|
||||
@@ -129,7 +129,7 @@ bool TileProviderByLevel::deinitialize() {
|
||||
for (const std::shared_ptr<TileProvider>& tp : _levelTileProviders) {
|
||||
success &= tp->deinitialize();
|
||||
}
|
||||
|
||||
|
||||
return TileProvider::deinitialize() && success;
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ unsigned int TileTextureInitData::getUniqueIdFromTextureFormat(
|
||||
case Format::DepthComponent:
|
||||
return 6;
|
||||
default:
|
||||
ghoul_assert(false, "Unknown texture format");
|
||||
throw ghoul::MissingCaseException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
|
||||
OsEng.registerModuleKeyboardCallback(
|
||||
[&](Key key, KeyModifier mod, KeyAction action) -> bool {
|
||||
if (gui.isEnabled()) {
|
||||
if (gui.isEnabled() || gui._performance.isEnabled()) {
|
||||
return gui.keyCallback(key, mod, action);
|
||||
}
|
||||
else {
|
||||
@@ -201,7 +201,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
|
||||
OsEng.registerModuleCharCallback(
|
||||
[&](unsigned int codepoint, KeyModifier modifier) -> bool {
|
||||
if (gui.isEnabled()) {
|
||||
if (gui.isEnabled() || gui._performance.isEnabled()) {
|
||||
return gui.charCallback(codepoint, modifier);
|
||||
}
|
||||
else {
|
||||
@@ -212,7 +212,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
|
||||
OsEng.registerModuleMouseButtonCallback(
|
||||
[&](MouseButton button, MouseAction action) -> bool {
|
||||
if (gui.isEnabled()) {
|
||||
if (gui.isEnabled() || gui._performance.isEnabled()) {
|
||||
return gui.mouseButtonCallback(button, action);
|
||||
}
|
||||
else {
|
||||
@@ -223,7 +223,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
|
||||
OsEng.registerModuleMouseScrollWheelCallback(
|
||||
[&](double, double posY) -> bool {
|
||||
if (gui.isEnabled()) {
|
||||
if (gui.isEnabled() || gui._performance.isEnabled()) {
|
||||
return gui.mouseWheelCallback(posY);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
#include <openspace/util/keys.h>
|
||||
#include <openspace/util/mouse.h>
|
||||
|
||||
struct ImGuiContext;
|
||||
|
||||
namespace openspace::gui {
|
||||
|
||||
class GUI : public GuiComponent {
|
||||
@@ -87,11 +89,14 @@ public:
|
||||
|
||||
bool _showInternals;
|
||||
|
||||
properties::BoolProperty _showHelpText;
|
||||
|
||||
private:
|
||||
void renderAndUpdatePropertyVisibility();
|
||||
|
||||
properties::Property::Visibility _currentVisibility;
|
||||
|
||||
std::vector<ImGuiContext*> _contexts;
|
||||
};
|
||||
|
||||
void CaptionText(const char* text);
|
||||
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
|
||||
void setVisibility(properties::Property::Visibility visibility);
|
||||
void setHasRegularProperties(bool hasOnlyRegularProperties);
|
||||
void setShowHelpTooltip(bool showHelpTooltip);
|
||||
|
||||
void render() override;
|
||||
|
||||
@@ -76,6 +77,7 @@ protected:
|
||||
UseTreeLayout _useTreeLayout;
|
||||
bool _currentUseTreeLayout;
|
||||
IsTopLevelWindow _isTopLevel;
|
||||
bool _showHelpTooltip;
|
||||
};
|
||||
|
||||
} // namespace openspace::gui
|
||||
|
||||
@@ -36,60 +36,90 @@ namespace openspace::properties {
|
||||
namespace openspace {
|
||||
|
||||
using IsRegularProperty = ghoul::Boolean;
|
||||
using ShowToolTip = ghoul::Boolean;
|
||||
|
||||
void executeScript(const std::string& id, const std::string& value,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
|
||||
void renderBoolProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderOptionProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderSelectionProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderStringProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderDoubleProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderIntProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderIVec2Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderIVec3Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderIVec4Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderFloatProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderVec2Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderVec3Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderVec4Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderDVec2Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderDVec3Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderDVec4Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderDMat2Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderDMat3Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderDMat4Property(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
void renderTriggerProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes);
|
||||
IsRegularProperty isRegular = IsRegularProperty::Yes,
|
||||
ShowToolTip showTooltip = ShowToolTip::Yes);
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <modules/imgui/imguimodule.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/mission/missionmanager.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/keys.h>
|
||||
@@ -226,7 +227,7 @@ void addScreenSpaceRenderableLocal(std::string texturePath) {
|
||||
const std::string luaTable =
|
||||
"{Type = 'ScreenSpaceImageLocal', TexturePath = openspace.absPath('" +
|
||||
texturePath + "') }";
|
||||
const std::string script = "openspace.registerScreenSpaceRenderable(" +
|
||||
const std::string script = "openspace.addScreenSpaceRenderable(" +
|
||||
luaTable + ");";
|
||||
OsEng.scriptEngine().queueScript(
|
||||
script,
|
||||
@@ -237,7 +238,7 @@ void addScreenSpaceRenderableLocal(std::string texturePath) {
|
||||
void addScreenSpaceRenderableOnline(std::string texturePath) {
|
||||
const std::string luaTable =
|
||||
"{Type = 'ScreenSpaceImageOnline', TexturePath = '" + texturePath + "' }";
|
||||
const std::string script = "openspace.registerScreenSpaceRenderable(" +
|
||||
const std::string script = "openspace.addScreenSpaceRenderable(" +
|
||||
luaTable + ");";
|
||||
OsEng.scriptEngine().queueScript(
|
||||
script,
|
||||
@@ -245,6 +246,13 @@ void addScreenSpaceRenderableOnline(std::string texturePath) {
|
||||
);
|
||||
}
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ShowHelpInfo = {
|
||||
"ShowHelpText",
|
||||
"Show tooltip help",
|
||||
"If this value is enabled these kinds of tooltips are shown for most properties "
|
||||
"explaining what impact they have on the visuals."
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace::gui {
|
||||
@@ -268,6 +276,7 @@ GUI::GUI()
|
||||
GuiPropertyComponent::UseTreeLayout::No,
|
||||
GuiPropertyComponent::IsTopLevelWindow::Yes)
|
||||
, _showInternals(false)
|
||||
, _showHelpText(ShowHelpInfo, true)
|
||||
, _currentVisibility(properties::Property::Visibility::Developer)
|
||||
{
|
||||
addPropertySubOwner(_help);
|
||||
@@ -286,6 +295,14 @@ GUI::GUI()
|
||||
#ifdef OPENSPACE_MODULE_ISWA_ENABLED
|
||||
addPropertySubOwner(_iswa);
|
||||
#endif // OPENSPACE_MODULE_ISWA_ENABLED
|
||||
|
||||
addProperty(_showHelpText);
|
||||
_showHelpText.onChange([this](){
|
||||
_globalProperty.setShowHelpTooltip(_showHelpText);
|
||||
_property.setShowHelpTooltip(_showHelpText);
|
||||
_screenSpaceProperty.setShowHelpTooltip(_showHelpText);
|
||||
_virtualProperty.setShowHelpTooltip(_showHelpText);
|
||||
});
|
||||
}
|
||||
|
||||
void GUI::initialize() {
|
||||
@@ -301,96 +318,105 @@ void GUI::initialize() {
|
||||
strcpy(iniFileBuffer, cachedFile.c_str());
|
||||
#endif
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.IniFilename = iniFileBuffer;
|
||||
io.DeltaTime = 1.f / 60.f;
|
||||
io.KeyMap[ImGuiKey_Tab] = static_cast<int>(Key::Tab);
|
||||
io.KeyMap[ImGuiKey_LeftArrow] = static_cast<int>(Key::Left);
|
||||
io.KeyMap[ImGuiKey_RightArrow] = static_cast<int>(Key::Right);
|
||||
io.KeyMap[ImGuiKey_UpArrow] = static_cast<int>(Key::Up);
|
||||
io.KeyMap[ImGuiKey_DownArrow] = static_cast<int>(Key::Down);
|
||||
io.KeyMap[ImGuiKey_Home] = static_cast<int>(Key::Home);
|
||||
io.KeyMap[ImGuiKey_End] = static_cast<int>(Key::End);
|
||||
io.KeyMap[ImGuiKey_Delete] = static_cast<int>(Key::Delete);
|
||||
io.KeyMap[ImGuiKey_Backspace] = static_cast<int>(Key::BackSpace);
|
||||
io.KeyMap[ImGuiKey_Enter] = static_cast<int>(Key::Enter);
|
||||
io.KeyMap[ImGuiKey_Escape] = static_cast<int>(Key::Escape);
|
||||
io.KeyMap[ImGuiKey_A] = static_cast<int>(Key::A);
|
||||
io.KeyMap[ImGuiKey_C] = static_cast<int>(Key::C);
|
||||
io.KeyMap[ImGuiKey_V] = static_cast<int>(Key::V);
|
||||
io.KeyMap[ImGuiKey_X] = static_cast<int>(Key::X);
|
||||
io.KeyMap[ImGuiKey_Y] = static_cast<int>(Key::Y);
|
||||
io.KeyMap[ImGuiKey_Z] = static_cast<int>(Key::Z);
|
||||
int nWindows = OsEng.windowWrapper().nWindows();
|
||||
_contexts.resize(nWindows);
|
||||
|
||||
io.RenderDrawListsFn = RenderDrawLists;
|
||||
io.Fonts->AddFontFromFileTTF(
|
||||
absPath(GuiFont).c_str(),
|
||||
FontSize
|
||||
);
|
||||
for (int i = 0; i < nWindows; ++i) {
|
||||
_contexts[i] = ImGui::CreateContext();
|
||||
ImGui::SetCurrentContext(_contexts[i]);
|
||||
//}
|
||||
|
||||
captionFont = io.Fonts->AddFontFromFileTTF(
|
||||
absPath(GuiFont).c_str(),
|
||||
FontSize * 1.5f
|
||||
);
|
||||
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
style.WindowPadding = { 4.f, 4.f };
|
||||
style.WindowRounding = 0.f;
|
||||
style.FramePadding = { 3.f, 3.f };
|
||||
style.FrameRounding = 0.f;
|
||||
style.ItemSpacing = { 3.f, 2.f };
|
||||
style.ItemInnerSpacing = { 3.f, 2.f };
|
||||
style.TouchExtraPadding = { 1.f, 1.f };
|
||||
style.IndentSpacing = 15.f;
|
||||
style.ScrollbarSize = 10.f;
|
||||
style.ScrollbarRounding = 0.f;
|
||||
style.GrabMinSize = 10.f;
|
||||
style.GrabRounding = 16.f;
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.IniFilename = iniFileBuffer;
|
||||
io.DeltaTime = 1.f / 60.f;
|
||||
io.KeyMap[ImGuiKey_Tab] = static_cast<int>(Key::Tab);
|
||||
io.KeyMap[ImGuiKey_LeftArrow] = static_cast<int>(Key::Left);
|
||||
io.KeyMap[ImGuiKey_RightArrow] = static_cast<int>(Key::Right);
|
||||
io.KeyMap[ImGuiKey_UpArrow] = static_cast<int>(Key::Up);
|
||||
io.KeyMap[ImGuiKey_DownArrow] = static_cast<int>(Key::Down);
|
||||
io.KeyMap[ImGuiKey_Home] = static_cast<int>(Key::Home);
|
||||
io.KeyMap[ImGuiKey_End] = static_cast<int>(Key::End);
|
||||
io.KeyMap[ImGuiKey_Delete] = static_cast<int>(Key::Delete);
|
||||
io.KeyMap[ImGuiKey_Backspace] = static_cast<int>(Key::BackSpace);
|
||||
io.KeyMap[ImGuiKey_Enter] = static_cast<int>(Key::Enter);
|
||||
io.KeyMap[ImGuiKey_Escape] = static_cast<int>(Key::Escape);
|
||||
io.KeyMap[ImGuiKey_A] = static_cast<int>(Key::A);
|
||||
io.KeyMap[ImGuiKey_C] = static_cast<int>(Key::C);
|
||||
io.KeyMap[ImGuiKey_V] = static_cast<int>(Key::V);
|
||||
io.KeyMap[ImGuiKey_X] = static_cast<int>(Key::X);
|
||||
io.KeyMap[ImGuiKey_Y] = static_cast<int>(Key::Y);
|
||||
io.KeyMap[ImGuiKey_Z] = static_cast<int>(Key::Z);
|
||||
|
||||
style.Colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
|
||||
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
|
||||
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.13f, 0.13f, 0.13f, 0.96f);
|
||||
style.Colors[ImGuiCol_ChildWindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
style.Colors[ImGuiCol_PopupBg] = ImVec4(0.05f, 0.05f, 0.10f, 0.90f);
|
||||
style.Colors[ImGuiCol_Border] = ImVec4(0.65f, 0.65f, 0.65f, 0.59f);
|
||||
style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
style.Colors[ImGuiCol_FrameBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.30f);
|
||||
style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.91f, 0.94f, 0.99f, 0.40f);
|
||||
style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.90f, 0.90f, 0.90f, 0.45f);
|
||||
style.Colors[ImGuiCol_TitleBg] = ImVec4(0.71f, 0.81f, 1.00f, 0.45f);
|
||||
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.71f, 0.81f, 1.00f, 0.45f);
|
||||
style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.51f, 0.69f, 1.00f, 0.63f);
|
||||
style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.26f, 0.27f, 0.33f, 0.80f);
|
||||
style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.75f, 0.80f, 0.43f);
|
||||
style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.75f, 0.80f, 0.65f);
|
||||
style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.40f, 0.75f, 0.80f, 0.65f);
|
||||
style.Colors[ImGuiCol_ComboBg] = ImVec4(0.36f, 0.46f, 0.56f, 1.00f);
|
||||
style.Colors[ImGuiCol_CheckMark] = ImVec4(1.00f, 1.00f, 1.00f, 0.50f);
|
||||
style.Colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
|
||||
style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.50f, 0.80f, 0.76f, 1.00f);
|
||||
style.Colors[ImGuiCol_Button] = ImVec4(0.36f, 0.54f, 0.68f, 0.62f);
|
||||
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.36f, 0.54f, 0.68f, 1.00f);
|
||||
style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.36f, 0.61f, 0.81f, 1.00f);
|
||||
style.Colors[ImGuiCol_Header] = ImVec4(0.69f, 0.69f, 0.69f, 0.45f);
|
||||
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.36f, 0.54f, 0.68f, 0.62f);
|
||||
style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.53f, 0.63f, 0.87f, 0.80f);
|
||||
style.Colors[ImGuiCol_Column] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
|
||||
style.Colors[ImGuiCol_ColumnHovered] = ImVec4(0.70f, 0.60f, 0.60f, 1.00f);
|
||||
style.Colors[ImGuiCol_ColumnActive] = ImVec4(0.90f, 0.70f, 0.70f, 1.00f);
|
||||
style.Colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(1.00f, 1.00f, 1.00f, 0.60f);
|
||||
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(1.00f, 1.00f, 1.00f, 0.90f);
|
||||
style.Colors[ImGuiCol_CloseButton] = ImVec4(0.75f, 0.75f, 0.75f, 1.00f);
|
||||
style.Colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.52f, 0.52f, 0.52f, 0.60f);
|
||||
style.Colors[ImGuiCol_CloseButtonActive] = ImVec4(0.52f, 0.52f, 0.52f, 1.00f);
|
||||
style.Colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||
style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||
style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
|
||||
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.44f, 0.63f, 1.00f, 0.35f);
|
||||
style.Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
||||
io.RenderDrawListsFn = RenderDrawLists;
|
||||
io.Fonts->AddFontFromFileTTF(
|
||||
absPath(GuiFont).c_str(),
|
||||
FontSize
|
||||
);
|
||||
|
||||
captionFont = io.Fonts->AddFontFromFileTTF(
|
||||
absPath(GuiFont).c_str(),
|
||||
FontSize * 1.5f
|
||||
);
|
||||
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
style.WindowPadding = { 4.f, 4.f };
|
||||
style.WindowRounding = 0.f;
|
||||
style.FramePadding = { 3.f, 3.f };
|
||||
style.FrameRounding = 0.f;
|
||||
style.ItemSpacing = { 3.f, 2.f };
|
||||
style.ItemInnerSpacing = { 3.f, 2.f };
|
||||
style.TouchExtraPadding = { 1.f, 1.f };
|
||||
style.IndentSpacing = 15.f;
|
||||
style.ScrollbarSize = 10.f;
|
||||
style.ScrollbarRounding = 0.f;
|
||||
style.GrabMinSize = 10.f;
|
||||
style.GrabRounding = 16.f;
|
||||
|
||||
style.Colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
|
||||
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
|
||||
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.13f, 0.13f, 0.13f, 0.96f);
|
||||
style.Colors[ImGuiCol_ChildWindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
style.Colors[ImGuiCol_PopupBg] = ImVec4(0.05f, 0.05f, 0.10f, 0.90f);
|
||||
style.Colors[ImGuiCol_Border] = ImVec4(0.65f, 0.65f, 0.65f, 0.59f);
|
||||
style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
style.Colors[ImGuiCol_FrameBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.30f);
|
||||
style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.91f, 0.94f, 0.99f, 0.40f);
|
||||
style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.90f, 0.90f, 0.90f, 0.45f);
|
||||
style.Colors[ImGuiCol_TitleBg] = ImVec4(0.71f, 0.81f, 1.00f, 0.45f);
|
||||
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.71f, 0.81f, 1.00f, 0.45f);
|
||||
style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.51f, 0.69f, 1.00f, 0.63f);
|
||||
style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.26f, 0.27f, 0.33f, 0.80f);
|
||||
style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.75f, 0.80f, 0.43f);
|
||||
style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.75f, 0.80f, 0.65f);
|
||||
style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.40f, 0.75f, 0.80f, 0.65f);
|
||||
style.Colors[ImGuiCol_ComboBg] = ImVec4(0.36f, 0.46f, 0.56f, 1.00f);
|
||||
style.Colors[ImGuiCol_CheckMark] = ImVec4(1.00f, 1.00f, 1.00f, 0.50f);
|
||||
style.Colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
|
||||
style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.50f, 0.80f, 0.76f, 1.00f);
|
||||
style.Colors[ImGuiCol_Button] = ImVec4(0.36f, 0.54f, 0.68f, 0.62f);
|
||||
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.36f, 0.54f, 0.68f, 1.00f);
|
||||
style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.36f, 0.61f, 0.81f, 1.00f);
|
||||
style.Colors[ImGuiCol_Header] = ImVec4(0.69f, 0.69f, 0.69f, 0.45f);
|
||||
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.36f, 0.54f, 0.68f, 0.62f);
|
||||
style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.53f, 0.63f, 0.87f, 0.80f);
|
||||
style.Colors[ImGuiCol_Column] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
|
||||
style.Colors[ImGuiCol_ColumnHovered] = ImVec4(0.70f, 0.60f, 0.60f, 1.00f);
|
||||
style.Colors[ImGuiCol_ColumnActive] = ImVec4(0.90f, 0.70f, 0.70f, 1.00f);
|
||||
style.Colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(1.00f, 1.00f, 1.00f, 0.60f);
|
||||
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(1.00f, 1.00f, 1.00f, 0.90f);
|
||||
style.Colors[ImGuiCol_CloseButton] = ImVec4(0.75f, 0.75f, 0.75f, 1.00f);
|
||||
style.Colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.52f, 0.52f, 0.52f, 0.60f);
|
||||
style.Colors[ImGuiCol_CloseButtonActive] = ImVec4(0.52f, 0.52f, 0.52f, 1.00f);
|
||||
style.Colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||
style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||
style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||
style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
|
||||
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.44f, 0.63f, 1.00f, 0.35f);
|
||||
style.Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
||||
}
|
||||
_property.initialize();
|
||||
_property.setHasRegularProperties(true);
|
||||
_screenSpaceProperty.initialize();
|
||||
@@ -417,6 +443,11 @@ void GUI::initialize() {
|
||||
void GUI::deinitialize() {
|
||||
ImGui::Shutdown();
|
||||
|
||||
int nWindows = OsEng.windowWrapper().nWindows();
|
||||
for (int i = 0; i < nWindows; ++i) {
|
||||
ImGui::DestroyContext(_contexts[i]);
|
||||
}
|
||||
|
||||
#ifdef OPENSPACE_MODULE_ISWA_ENABLED
|
||||
_iswa.deinitialize();
|
||||
#endif // OPENSPACE_MODULE_ISWA_ENABLED
|
||||
@@ -450,8 +481,17 @@ void GUI::initializeGL() {
|
||||
|
||||
unsigned char* pngData;
|
||||
glm::ivec2 textureSize;
|
||||
ImGui::GetIO().Fonts->GetTexDataAsRGBA32(&pngData, &textureSize.x, &textureSize.y);
|
||||
int nWindows = OsEng.windowWrapper().nWindows();
|
||||
for (int i = 0; i < nWindows; ++i) {
|
||||
//_contexts[i] = ImGui::CreateContext();
|
||||
ImGui::SetCurrentContext(_contexts[i]);
|
||||
|
||||
ImGui::GetIO().Fonts->GetTexDataAsRGBA32(
|
||||
&pngData,
|
||||
&textureSize.x,
|
||||
&textureSize.y
|
||||
);
|
||||
}
|
||||
_fontTexture = std::make_unique<ghoul::opengl::Texture>(
|
||||
pngData,
|
||||
glm::uvec3(textureSize.x, textureSize.y, 1)
|
||||
@@ -461,7 +501,12 @@ void GUI::initializeGL() {
|
||||
_fontTexture->uploadTexture();
|
||||
GLuint id = *_fontTexture;
|
||||
uint64_t tmp = id;
|
||||
ImGui::GetIO().Fonts->TexID = reinterpret_cast<void*>(tmp);
|
||||
for (int i = 0; i < nWindows; ++i) {
|
||||
//_contexts[i] = ImGui::CreateContext();
|
||||
ImGui::SetCurrentContext(_contexts[i]);
|
||||
|
||||
ImGui::GetIO().Fonts->TexID = reinterpret_cast<void*>(tmp);
|
||||
}
|
||||
|
||||
glGenBuffers(1, &vbo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
@@ -558,6 +603,9 @@ void GUI::startFrame(float deltaTime, const glm::vec2& windowSize,
|
||||
const glm::vec2& dpiScaling, const glm::vec2& mousePos,
|
||||
uint32_t mouseButtonsPressed)
|
||||
{
|
||||
int iWindow = OsEng.windowWrapper().currentWindowId();
|
||||
ImGui::SetCurrentContext(_contexts[iWindow]);
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.DisplaySize = ImVec2(windowSize.x, windowSize.y);
|
||||
io.DisplayFramebufferScale = ImVec2(dpiScaling.x, dpiScaling.y);
|
||||
@@ -576,7 +624,10 @@ void GUI::endFrame() {
|
||||
_program->rebuildFromFile();
|
||||
}
|
||||
|
||||
if (OsEng.renderEngine().doesPerformanceMeasurements()) {
|
||||
bool perf = OsEng.renderEngine().doesPerformanceMeasurements();
|
||||
_performance.setEnabled(perf);
|
||||
|
||||
if (_performance.isEnabled()) {
|
||||
_performance.render();
|
||||
}
|
||||
|
||||
@@ -777,6 +828,14 @@ void GUI::render() {
|
||||
addScreenSpaceRenderableOnline(std::string(addImageOnlineBuffer));
|
||||
}
|
||||
|
||||
bool addDashboard = ImGui::Button("Add Dashboard");
|
||||
if (addDashboard) {
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.addScreenSpaceRenderable({ Type = 'ScreenSpaceDashboard' });",
|
||||
openspace::scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
|
||||
ImGui::Checkbox("ImGUI Internals", &_showInternals);
|
||||
if (_showInternals) {
|
||||
ImGui::Begin("Style Editor");
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <openspace/util/timemanager.h>
|
||||
|
||||
namespace {
|
||||
const ImVec2 size = ImVec2(350, 500);
|
||||
static const ImVec2 Size = ImVec2(350, 500);
|
||||
|
||||
void renderMission(const openspace::Mission& mission) {
|
||||
// The hashname is necessary since ImGui computes a hash based off the name of the
|
||||
@@ -99,7 +99,7 @@ GuiMissionComponent::GuiMissionComponent() : GuiComponent("Mission Information")
|
||||
|
||||
void GuiMissionComponent::render() {
|
||||
bool v = _isEnabled;
|
||||
ImGui::Begin(name().c_str(), &v, size, 0.75f);
|
||||
ImGui::Begin(name().c_str(), &v, Size, 0.75f);
|
||||
_isEnabled = v;
|
||||
|
||||
ghoul_assert(
|
||||
|
||||
@@ -56,7 +56,6 @@ void GuiParallelComponent::renderDisconnected() {
|
||||
}
|
||||
|
||||
void GuiParallelComponent::renderClientWithHost() {
|
||||
|
||||
ParallelConnection& parallel = OsEng.parallelConnection();
|
||||
|
||||
std::string connectionInfo = "Session hosted by \"" + parallel.hostName() + "\"\n";
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace {
|
||||
std::vector<std::string>(path.begin() + 1, path.end()),
|
||||
owner
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
void simplifyTree(TreeNode& node) {
|
||||
// Merging consecutive nodes if they only have a single child
|
||||
@@ -166,6 +166,10 @@ void GuiPropertyComponent::setHasRegularProperties(bool hasOnlyRegularProperties
|
||||
_hasOnlyRegularProperties = hasOnlyRegularProperties;
|
||||
}
|
||||
|
||||
void GuiPropertyComponent::setShowHelpTooltip(bool showHelpTooltip) {
|
||||
_showHelpTooltip = showHelpTooltip;
|
||||
}
|
||||
|
||||
void GuiPropertyComponent::renderPropertyOwner(properties::PropertyOwner* owner) {
|
||||
if (owner->propertiesRecursive().empty()) {
|
||||
return;
|
||||
@@ -263,6 +267,7 @@ void GuiPropertyComponent::render() {
|
||||
dynamic_cast<SceneGraphNode*>(owner),
|
||||
"When using the tree layout, all owners must be SceneGraphNodes"
|
||||
);
|
||||
(void)owner; // using [[maybe_unused]] in the for loop gives an error
|
||||
}
|
||||
|
||||
// Sort:
|
||||
@@ -373,7 +378,7 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop,
|
||||
properties::PropertyOwner* owner)
|
||||
{
|
||||
using Func = std::function<
|
||||
void(properties::Property*, const std::string&, IsRegularProperty)
|
||||
void(properties::Property*, const std::string&, IsRegularProperty, ShowToolTip)
|
||||
>;
|
||||
static const std::map<std::string, Func> FunctionMapping = {
|
||||
{ "BoolProperty", &renderBoolProperty },
|
||||
@@ -389,6 +394,9 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop,
|
||||
{ "DVec2Property", &renderDVec2Property },
|
||||
{ "DVec3Property", &renderDVec3Property },
|
||||
{ "DVec4Property", &renderDVec4Property },
|
||||
{ "DMat2Property", &renderDMat2Property },
|
||||
{ "DMat3Property", &renderDMat3Property },
|
||||
{ "DMat4Property", &renderDMat4Property },
|
||||
{ "StringProperty", &renderStringProperty },
|
||||
{ "OptionProperty", &renderOptionProperty },
|
||||
{ "TriggerProperty", &renderTriggerProperty },
|
||||
@@ -406,14 +414,16 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop,
|
||||
it->second(
|
||||
prop,
|
||||
owner->name(),
|
||||
IsRegularProperty(_hasOnlyRegularProperties)
|
||||
IsRegularProperty(_hasOnlyRegularProperties),
|
||||
ShowToolTip(_showHelpTooltip)
|
||||
);
|
||||
}
|
||||
else {
|
||||
it->second(
|
||||
prop,
|
||||
"",
|
||||
IsRegularProperty(_hasOnlyRegularProperties)
|
||||
IsRegularProperty(_hasOnlyRegularProperties),
|
||||
ShowToolTip(_showHelpTooltip)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <openspace/scene/scene.h>
|
||||
|
||||
namespace {
|
||||
const ImVec2 size = ImVec2(350, 500);
|
||||
static const ImVec2 Size = ImVec2(350, 500);
|
||||
} // namespace
|
||||
|
||||
namespace openspace::gui {
|
||||
@@ -45,7 +45,7 @@ namespace openspace::gui {
|
||||
GuiSpaceTimeComponent::GuiSpaceTimeComponent() : GuiComponent("Space/Time") {}
|
||||
|
||||
void GuiSpaceTimeComponent::render() {
|
||||
ImGui::Begin(name().c_str(), nullptr, size, 0.5f, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
ImGui::Begin(name().c_str(), nullptr, Size, 0.5f, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
|
||||
std::vector<SceneGraphNode*> nodes =
|
||||
OsEng.renderEngine().scene()->allSceneGraphNodes();
|
||||
@@ -175,10 +175,10 @@ void GuiSpaceTimeComponent::render() {
|
||||
|
||||
double newTime = [days, j2000, seconds](){
|
||||
if (days < 0) {
|
||||
return static_cast<double>(j2000 - seconds);
|
||||
return j2000 - seconds;
|
||||
}
|
||||
else {
|
||||
return static_cast<double>(j2000 + seconds);
|
||||
return j2000 + seconds;
|
||||
}
|
||||
}();
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/properties/scalarproperty.h>
|
||||
#include <openspace/properties/matrixproperty.h>
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
#include <openspace/properties/selectionproperty.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
@@ -85,7 +86,7 @@ void executeScript(const std::string& id, const std::string& value,
|
||||
}
|
||||
|
||||
void renderBoolProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
BoolProperty* p = static_cast<BoolProperty*>(prop);
|
||||
@@ -94,7 +95,9 @@ void renderBoolProperty(Property* prop, const std::string& ownerName,
|
||||
|
||||
BoolProperty::ValueType value = *p;
|
||||
ImGui::Checkbox(name.c_str(), &value);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
executeScript(p->fullyQualifiedIdentifier(), value ? "true" : "false", isRegular);
|
||||
@@ -103,7 +106,7 @@ void renderBoolProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderOptionProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
OptionProperty* p = static_cast<OptionProperty*>(prop);
|
||||
@@ -120,7 +123,9 @@ void renderOptionProperty(Property* prop, const std::string& ownerName,
|
||||
ImGui::Separator();
|
||||
for (const OptionProperty::Option& o : options) {
|
||||
ImGui::RadioButton(o.description.c_str(), &value, o.value);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
break;
|
||||
@@ -134,13 +139,13 @@ void renderOptionProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
nodeNames += '\0';
|
||||
|
||||
int idx = std::distance(
|
||||
int idx = static_cast<int>(std::distance(
|
||||
options.begin(),
|
||||
std::find_if(
|
||||
options.begin(),
|
||||
options.end(),
|
||||
[value](const OptionProperty::Option& o) { return o.value == value; }
|
||||
));
|
||||
)));
|
||||
|
||||
int oldIdx = idx;
|
||||
ImGui::Combo(name.c_str(), &idx, nodeNames.c_str());
|
||||
@@ -159,7 +164,7 @@ void renderOptionProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderSelectionProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
SelectionProperty* p = static_cast<SelectionProperty*>(prop);
|
||||
@@ -179,7 +184,9 @@ void renderSelectionProperty(Property* prop, const std::string& ownerName,
|
||||
) != selectedIndices.end();
|
||||
|
||||
ImGui::Checkbox(description.c_str(), &selected);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (selected) {
|
||||
newSelectedIndices.push_back(i);
|
||||
@@ -200,14 +207,14 @@ void renderSelectionProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderStringProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
StringProperty* p = static_cast<StringProperty*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
std::string value = FileSys.convertPathSeparator(p->value(), '/');
|
||||
const std::string value = p->value();
|
||||
|
||||
static const int bufferSize = 256;
|
||||
static char buffer[bufferSize];
|
||||
@@ -222,13 +229,14 @@ void renderStringProperty(Property* prop, const std::string& ownerName,
|
||||
bufferSize,
|
||||
ImGuiInputTextFlags_EnterReturnsTrue
|
||||
);
|
||||
renderTooltip(prop);
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (hasNewValue) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
"'" + std::string(buffer) + "'",
|
||||
"[[" + std::string(buffer) + "]]",
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
@@ -237,7 +245,7 @@ void renderStringProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDoubleProperty(properties::Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DoubleProperty* p = static_cast<DoubleProperty*>(prop);
|
||||
@@ -249,7 +257,9 @@ void renderDoubleProperty(properties::Property* prop, const std::string& ownerNa
|
||||
float max = static_cast<float>(p->maxValue());
|
||||
|
||||
ImGui::SliderFloat(name.c_str(), &value, min, max, "%.5f");
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (value != static_cast<float>(p->value())) {
|
||||
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value), isRegular);
|
||||
@@ -259,7 +269,7 @@ void renderDoubleProperty(properties::Property* prop, const std::string& ownerNa
|
||||
}
|
||||
|
||||
void renderIntProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IntProperty* p = static_cast<IntProperty*>(prop);
|
||||
@@ -271,7 +281,9 @@ void renderIntProperty(Property* prop, const std::string& ownerName,
|
||||
int max = p->maxValue();
|
||||
|
||||
ImGui::SliderInt(name.c_str(), &value, min, max);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value), isRegular);
|
||||
@@ -281,7 +293,7 @@ void renderIntProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderIVec2Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IVec2Property* p = static_cast<IVec2Property*>(prop);
|
||||
@@ -289,20 +301,22 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
IVec2Property::ValueType value = *p;
|
||||
int min = std::min(p->minValue().x, p->minValue().y);
|
||||
int max = std::max(p->maxValue().x, p->maxValue().y);
|
||||
int min = glm::compMin(p->minValue());
|
||||
int max = glm::compMax(p->maxValue());
|
||||
ImGui::SliderInt2(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
min,
|
||||
max
|
||||
);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "}",
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
@@ -311,7 +325,7 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderIVec3Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IVec3Property* p = static_cast<IVec3Property*>(prop);
|
||||
@@ -319,8 +333,8 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
IVec3Property::ValueType value = *p;
|
||||
int min = std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z);
|
||||
int max = std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z);
|
||||
int min = glm::compMin(p->minValue());
|
||||
int max = glm::compMax(p->maxValue());
|
||||
|
||||
ImGui::SliderInt3(
|
||||
name.c_str(),
|
||||
@@ -328,13 +342,14 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
|
||||
min,
|
||||
max
|
||||
);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "," +
|
||||
std::to_string(value.z) + "}",
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
@@ -342,7 +357,7 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderIVec4Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
IVec4Property* p = static_cast<IVec4Property*>(prop);
|
||||
@@ -350,12 +365,8 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
IVec4Property::ValueType value = *p;
|
||||
int min = std::min(std::min(std::min(
|
||||
p->minValue().x, p->minValue().y), p->minValue().z), p->minValue().w
|
||||
);
|
||||
int max = std::max(std::max(std::max(
|
||||
p->maxValue().x, p->maxValue().y), p->maxValue().z), p->maxValue().w
|
||||
);
|
||||
int min = glm::compMin(p->minValue());
|
||||
int max = glm::compMax(p->maxValue());
|
||||
|
||||
ImGui::SliderInt4(
|
||||
name.c_str(),
|
||||
@@ -363,15 +374,14 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
|
||||
min,
|
||||
max
|
||||
);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," +
|
||||
std::to_string(value.y) + "," +
|
||||
std::to_string(value.z) + "," +
|
||||
std::to_string(value.w) + "}",
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
@@ -379,7 +389,7 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderFloatProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
FloatProperty* p = static_cast<FloatProperty*>(prop);
|
||||
@@ -390,7 +400,9 @@ void renderFloatProperty(Property* prop, const std::string& ownerName,
|
||||
float min = p->minValue();
|
||||
float max = p->maxValue();
|
||||
ImGui::SliderFloat(name.c_str(), &value, min, max, "%.5f");
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value), isRegular);
|
||||
@@ -400,7 +412,7 @@ void renderFloatProperty(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
Vec2Property* p = static_cast<Vec2Property*>(prop);
|
||||
@@ -408,8 +420,9 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
Vec2Property::ValueType value = *p;
|
||||
float min = std::min(p->minValue().x, p->minValue().y);
|
||||
float max = std::max(p->maxValue().x, p->maxValue().y);
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
|
||||
ImGui::SliderFloat2(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
@@ -417,12 +430,14 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
max,
|
||||
"%.5f"
|
||||
);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "}",
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
@@ -431,7 +446,7 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
Vec3Property* p = static_cast<Vec3Property*>(prop);
|
||||
@@ -439,10 +454,8 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
Vec3Property::ValueType value = *p;
|
||||
float min = std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z);
|
||||
float max = std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z);
|
||||
|
||||
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
|
||||
if (prop->viewOption(Property::ViewOptions::Color)) {
|
||||
ImGui::ColorEdit3(
|
||||
@@ -459,14 +472,14 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
"%.5f"
|
||||
);
|
||||
}
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," +
|
||||
std::to_string(value.y) + "," +
|
||||
std::to_string(value.z) + "}",
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
@@ -475,7 +488,7 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
Vec4Property* p = static_cast<Vec4Property*>(prop);
|
||||
@@ -483,10 +496,8 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
Vec4Property::ValueType value = *p;
|
||||
float min = std::min(std::min(std::min(
|
||||
p->minValue().x, p->minValue().y), p->minValue().z), p->minValue().w);
|
||||
float max = std::max(std::max(std::max(
|
||||
p->maxValue().x, p->maxValue().y), p->maxValue().z), p->maxValue().w);
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
|
||||
if (prop->viewOption(Property::ViewOptions::Color)) {
|
||||
ImGui::ColorEdit4(
|
||||
@@ -503,16 +514,14 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
"%.5f"
|
||||
);
|
||||
}
|
||||
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (value != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," +
|
||||
std::to_string(value.y) + "," +
|
||||
std::to_string(value.z) + "," +
|
||||
std::to_string(value.w) + "}",
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
@@ -521,7 +530,7 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDVec2Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DVec2Property* p = static_cast<DVec2Property*>(prop);
|
||||
@@ -529,8 +538,8 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
glm::vec2 value = glm::dvec2(*p);
|
||||
float min = static_cast<float>(std::min(p->minValue().x, p->minValue().y));
|
||||
float max = static_cast<float>(std::max(p->maxValue().x, p->maxValue().y));
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
ImGui::SliderFloat2(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
@@ -538,12 +547,14 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
|
||||
max,
|
||||
"%.5f"
|
||||
);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (glm::dvec2(value) != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "}",
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
@@ -552,7 +563,7 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDVec3Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DVec3Property* p = static_cast<DVec3Property*>(prop);
|
||||
@@ -560,12 +571,8 @@ void renderDVec3Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
glm::vec3 value = glm::dvec3(*p);
|
||||
float min = static_cast<float>(
|
||||
std::min(std::min(p->minValue().x, p->minValue().y), p->minValue().z)
|
||||
);
|
||||
float max = static_cast<float>(
|
||||
std::max(std::max(p->maxValue().x, p->maxValue().y), p->maxValue().z)
|
||||
);
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
|
||||
bool changed = ImGui::SliderFloat3(
|
||||
name.c_str(),
|
||||
@@ -574,14 +581,14 @@ void renderDVec3Property(Property* prop, const std::string& ownerName,
|
||||
max,
|
||||
"%.5f"
|
||||
);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," +
|
||||
std::to_string(value.y) + "," +
|
||||
std::to_string(value.z) + "}",
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
@@ -590,7 +597,7 @@ void renderDVec3Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderDVec4Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DVec4Property* p = static_cast<DVec4Property*>(prop);
|
||||
@@ -598,16 +605,8 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
glm::vec4 value = glm::dvec4(*p);
|
||||
float min = static_cast<float>(
|
||||
std::min(std::min(std::min(
|
||||
p->minValue().x, p->minValue().y), p->minValue().z), p->minValue().w
|
||||
)
|
||||
);
|
||||
float max = static_cast<float>(
|
||||
std::max(std::max(std::max(
|
||||
p->maxValue().x, p->maxValue().y), p->maxValue().z), p->maxValue().w
|
||||
)
|
||||
);
|
||||
float min = static_cast<float>(glm::compMin(p->minValue()));
|
||||
float max = static_cast<float>(glm::compMax(p->maxValue()));
|
||||
|
||||
ImGui::SliderFloat4(
|
||||
name.c_str(),
|
||||
@@ -616,15 +615,148 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
|
||||
max,
|
||||
"%.5f"
|
||||
);
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (glm::dvec4(value) != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," +
|
||||
std::to_string(value.y) + "," +
|
||||
std::to_string(value.z) + "," +
|
||||
std::to_string(value.w) + "}",
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void renderDMat2Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DMat2Property* p = static_cast<DMat2Property*>(prop);
|
||||
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::Text("%s", name.c_str());
|
||||
|
||||
glm::mat2 value = glm::dmat2(*p);
|
||||
glm::dvec2 minValues = {
|
||||
glm::compMin(p->minValue()[0]),
|
||||
glm::compMin(p->minValue()[1])
|
||||
};
|
||||
float min = static_cast<float>(glm::compMin(minValues));
|
||||
|
||||
glm::dvec2 maxValues = {
|
||||
glm::compMax(p->maxValue()[0]),
|
||||
glm::compMax(p->maxValue()[1])
|
||||
};
|
||||
float max = static_cast<float>(glm::compMax(maxValues));
|
||||
|
||||
ImGui::SliderFloat2("[0]", glm::value_ptr(value[0]), min, max);
|
||||
ImGui::SliderFloat2("[1]", glm::value_ptr(value[1]), min, max);
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (glm::dmat2(value) != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void renderDMat3Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DMat3Property* p = static_cast<DMat3Property*>(prop);
|
||||
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::Text("%s", name.c_str());
|
||||
|
||||
glm::mat3 value = glm::dmat3(*p);
|
||||
glm::dvec3 minValues = {
|
||||
glm::compMin(p->minValue()[0]),
|
||||
glm::compMin(p->minValue()[1]),
|
||||
glm::compMin(p->minValue()[2])
|
||||
};
|
||||
float min = static_cast<float>(glm::compMin(minValues));
|
||||
|
||||
glm::dvec3 maxValues = {
|
||||
glm::compMax(p->maxValue()[0]),
|
||||
glm::compMax(p->maxValue()[1]),
|
||||
glm::compMax(p->maxValue()[2])
|
||||
};
|
||||
float max = static_cast<float>(glm::compMax(maxValues));
|
||||
|
||||
|
||||
ImGui::SliderFloat3("[0]", glm::value_ptr(value[0]), min, max);
|
||||
ImGui::SliderFloat3("[1]", glm::value_ptr(value[1]), min, max);
|
||||
ImGui::SliderFloat3("[2]", glm::value_ptr(value[2]), min, max);
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (glm::dmat3(value) != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void renderDMat4Property(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
DMat4Property* p = static_cast<DMat4Property*>(prop);
|
||||
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
ImGui::Text("%s", name.c_str());
|
||||
|
||||
glm::mat4 value = glm::dmat4(*p);
|
||||
glm::dvec4 minValues = {
|
||||
glm::compMin(p->minValue()[0]),
|
||||
glm::compMin(p->minValue()[1]),
|
||||
glm::compMin(p->minValue()[2]),
|
||||
glm::compMin(p->minValue()[3])
|
||||
};
|
||||
float min = static_cast<float>(glm::compMin(minValues));
|
||||
|
||||
glm::dvec4 maxValues = {
|
||||
glm::compMax(p->maxValue()[0]),
|
||||
glm::compMax(p->maxValue()[1]),
|
||||
glm::compMax(p->maxValue()[2]),
|
||||
glm::compMax(p->maxValue()[3])
|
||||
};
|
||||
float max = static_cast<float>(glm::compMax(maxValues));
|
||||
|
||||
|
||||
ImGui::SliderFloat4("[0]", glm::value_ptr(value[0]), min, max);
|
||||
ImGui::SliderFloat4("[1]", glm::value_ptr(value[1]), min, max);
|
||||
ImGui::SliderFloat4("[2]", glm::value_ptr(value[2]), min, max);
|
||||
ImGui::SliderFloat4("[3]", glm::value_ptr(value[3]), min, max);
|
||||
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
if (glm::dmat4(value) != p->value()) {
|
||||
executeScript(
|
||||
p->fullyQualifiedIdentifier(),
|
||||
std::to_string(value),
|
||||
isRegular
|
||||
);
|
||||
}
|
||||
@@ -633,7 +765,7 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
|
||||
}
|
||||
|
||||
void renderTriggerProperty(Property* prop, const std::string& ownerName,
|
||||
IsRegularProperty isRegular)
|
||||
IsRegularProperty isRegular, ShowToolTip showTooltip)
|
||||
{
|
||||
ghoul_assert(prop, "prop must not be nullptr");
|
||||
std::string name = prop->guiName();
|
||||
@@ -643,7 +775,9 @@ void renderTriggerProperty(Property* prop, const std::string& ownerName,
|
||||
if (pressed) {
|
||||
executeScript(prop->fullyQualifiedIdentifier(), "nil", isRegular);
|
||||
}
|
||||
renderTooltip(prop);
|
||||
if (showTooltip) {
|
||||
renderTooltip(prop);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
@@ -148,9 +148,7 @@ void DataProcessor::initializeVectors(int numOptions){
|
||||
}
|
||||
|
||||
void DataProcessor::calculateFilterValues(std::vector<int> selectedOptions) {
|
||||
int numSelected = selectedOptions.size();
|
||||
std::shared_ptr<Histogram> histogram;
|
||||
float mean, standardDeviation, filterMid, filterWidth;
|
||||
int numSelected = static_cast<int>(selectedOptions.size());
|
||||
|
||||
_filterValues = glm::vec2(0.0);
|
||||
if (numSelected <= 0) {
|
||||
@@ -159,10 +157,12 @@ void DataProcessor::calculateFilterValues(std::vector<int> selectedOptions) {
|
||||
|
||||
if (!_histograms.empty()) {
|
||||
for (int option : selectedOptions) {
|
||||
float filterMid;
|
||||
float filterWidth;
|
||||
if (!_useHistogram) {
|
||||
mean = (1.0/_numValues[option])*_sum[option];
|
||||
standardDeviation = _standardDeviation[option];
|
||||
histogram = _histograms[option];
|
||||
float mean = (1.f / _numValues[option]) * _sum[option];
|
||||
float standardDeviation = _standardDeviation[option];
|
||||
std::shared_ptr<Histogram> histogram = _histograms[option];
|
||||
|
||||
filterMid = histogram->highestBinValue(_useHistogram);
|
||||
filterWidth = mean+histogram->binWidth();
|
||||
@@ -196,13 +196,13 @@ void DataProcessor::calculateFilterValues(std::vector<int> selectedOptions) {
|
||||
void DataProcessor::add(std::vector<std::vector<float>>& optionValues,
|
||||
std::vector<float>& sum)
|
||||
{
|
||||
int numOptions = optionValues.size();
|
||||
int numOptions = static_cast<int>(optionValues.size());
|
||||
int numValues;
|
||||
float mean, value, variance, standardDeviation;
|
||||
|
||||
for (int i=0; i<numOptions; i++) {
|
||||
std::vector<float> values = optionValues[i];
|
||||
numValues = values.size();
|
||||
numValues = static_cast<int>(values.size());
|
||||
|
||||
variance = 0;
|
||||
mean = (1.0f/numValues)*sum[i];
|
||||
|
||||
@@ -68,7 +68,7 @@ std::vector<std::string> DataProcessorJson::readMetadata(std::string data,
|
||||
void DataProcessorJson::addDataValues(std::string data,
|
||||
properties::SelectionProperty& dataOptions)
|
||||
{
|
||||
int numOptions = dataOptions.options().size();
|
||||
int numOptions = static_cast<int>(dataOptions.options().size());
|
||||
initializeVectors(numOptions);
|
||||
|
||||
if (!data.empty()) {
|
||||
@@ -87,7 +87,7 @@ void DataProcessorJson::addDataValues(std::string data,
|
||||
|
||||
for(int y=0; y<row.size(); y++){
|
||||
json col = row.at(y);
|
||||
int colsize = col.size();
|
||||
int colsize = static_cast<int>(col.size());
|
||||
|
||||
for(int x=0; x<colsize; x++){
|
||||
value = col.at(x);
|
||||
@@ -105,32 +105,33 @@ void DataProcessorJson::addDataValues(std::string data,
|
||||
}
|
||||
|
||||
std::vector<float*> DataProcessorJson::processData(std::string data,
|
||||
properties::SelectionProperty& dataOptions,
|
||||
properties::SelectionProperty& optionProp,
|
||||
glm::size3_t& dimensions)
|
||||
{
|
||||
if (!data.empty()) {
|
||||
json j = json::parse(data);
|
||||
json variables = j["variables"];
|
||||
|
||||
std::vector<int> selectedOptions = dataOptions.value();
|
||||
std::vector<int> selectedOptions = optionProp.value();
|
||||
// int numSelected = selectedOptions.size();
|
||||
|
||||
auto options = dataOptions.options();
|
||||
int numOptions = options.size();
|
||||
const std::vector<properties::SelectionProperty::Option>& options =
|
||||
optionProp.options();
|
||||
int numOptions = static_cast<int>(options.size());
|
||||
|
||||
float value;
|
||||
int rowsize, colsize, i;
|
||||
|
||||
std::vector<float*> dataOptions(numOptions, nullptr);
|
||||
for(int option : selectedOptions){
|
||||
dataOptions[option] = new float[dimensions.x*dimensions.y]{0.f};
|
||||
dataOptions[option] = new float[dimensions.x*dimensions.y]{ 0.f };
|
||||
|
||||
json row = variables[options[option].description];
|
||||
rowsize = row.size();
|
||||
rowsize = static_cast<int>(row.size());
|
||||
|
||||
for(int y=0; y<rowsize; y++){
|
||||
json col = row.at(y);
|
||||
colsize = col.size();
|
||||
colsize = static_cast<int>(col.size());
|
||||
|
||||
for(int x=0; x<colsize; x++){
|
||||
value = col.at(x);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <modules/iswa/util/dataprocessorkameleon.h>
|
||||
//#include <algorithm>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace {
|
||||
const char* _loggerCat = "DataProcessorKameleon";
|
||||
@@ -43,7 +44,7 @@ DataProcessorKameleon::DataProcessorKameleon()
|
||||
DataProcessorKameleon::~DataProcessorKameleon(){}
|
||||
|
||||
std::vector<std::string> DataProcessorKameleon::readMetadata(std::string path,
|
||||
glm::size3_t& dimensions)
|
||||
glm::size3_t&)
|
||||
{
|
||||
if (!path.empty()) {
|
||||
if (path != _kwPath || !_kw) {
|
||||
@@ -71,7 +72,7 @@ std::vector<std::string> DataProcessorKameleon::readMetadata(std::string path,
|
||||
void DataProcessorKameleon::addDataValues(std::string path,
|
||||
properties::SelectionProperty& dataOptions)
|
||||
{
|
||||
int numOptions = dataOptions.options().size();
|
||||
int numOptions = static_cast<int>(dataOptions.options().size());
|
||||
initializeVectors(numOptions);
|
||||
|
||||
if (!path.empty()) {
|
||||
@@ -83,7 +84,7 @@ void DataProcessorKameleon::addDataValues(std::string path,
|
||||
std::vector<std::vector<float>> optionValues(numOptions, std::vector<float>());
|
||||
auto options = dataOptions.options();
|
||||
|
||||
int numValues = _dimensions.x*_dimensions.y*_dimensions.z;
|
||||
int numValues = static_cast<int>(_dimensions.x * _dimensions.y * _dimensions.z);
|
||||
|
||||
float* values;
|
||||
float value;
|
||||
@@ -120,23 +121,23 @@ std::vector<float*> DataProcessorKameleon::processData(std::string path,
|
||||
}
|
||||
|
||||
std::vector<float*> DataProcessorKameleon::processData(std::string path,
|
||||
properties::SelectionProperty& dataOptions,
|
||||
properties::SelectionProperty& optionProp,
|
||||
glm::size3_t& dimensions)
|
||||
{
|
||||
int numOptions = dataOptions.options().size();
|
||||
int numOptions = static_cast<int>(optionProp.options().size());
|
||||
|
||||
if (!path.empty()) {
|
||||
if (path != _kwPath || !_kw) {
|
||||
initializeKameleonWrapper(path);
|
||||
}
|
||||
|
||||
std::vector<int> selectedOptions = dataOptions.value();
|
||||
std::vector<int> selectedOptions = optionProp.value();
|
||||
// int numSelected = selectedOptions.size();
|
||||
|
||||
auto options = dataOptions.options();
|
||||
int numOptions = options.size();
|
||||
const std::vector<properties::SelectionProperty::Option>& options =
|
||||
optionProp.options();
|
||||
|
||||
int numValues = dimensions.x*dimensions.y*dimensions.z;
|
||||
int numValues = static_cast<int>(glm::compMul(dimensions));
|
||||
|
||||
float value;
|
||||
|
||||
@@ -148,7 +149,7 @@ std::vector<float*> DataProcessorKameleon::processData(std::string path,
|
||||
_slice
|
||||
);
|
||||
|
||||
for (int i=0; i<numValues; i++) {
|
||||
for (int i = 0; i < numValues; i++) {
|
||||
value = dataOptions[option][i];
|
||||
dataOptions[option][i] = processDataPoint(value, option);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ std::vector<std::string> DataProcessorText::readMetadata(std::string data,
|
||||
void DataProcessorText::addDataValues(std::string data,
|
||||
properties::SelectionProperty& dataOptions)
|
||||
{
|
||||
int numOptions = dataOptions.options().size();
|
||||
int numOptions = static_cast<int>(dataOptions.options().size());
|
||||
initializeVectors(numOptions);
|
||||
|
||||
if (!data.empty()) {
|
||||
@@ -147,16 +147,16 @@ void DataProcessorText::addDataValues(std::string data,
|
||||
}
|
||||
|
||||
std::vector<float*> DataProcessorText::processData(std::string data,
|
||||
properties::SelectionProperty& dataOptions,
|
||||
properties::SelectionProperty& options,
|
||||
glm::size3_t& dimensions)
|
||||
{
|
||||
if (!data.empty()) {
|
||||
std::string line;
|
||||
std::stringstream memorystream(data);
|
||||
|
||||
std::vector<int> selectedOptions = dataOptions.value();
|
||||
std::vector<int> selectedOptions = options.value();
|
||||
// int numSelected = selectedOptions.size();
|
||||
int numOptions = dataOptions.options().size();
|
||||
int numOptions = static_cast<int>(options.options().size());
|
||||
|
||||
std::vector<float> values;
|
||||
float value;
|
||||
@@ -164,8 +164,8 @@ std::vector<float*> DataProcessorText::processData(std::string data,
|
||||
int first, last, option, lineSize;
|
||||
|
||||
std::vector<float*> dataOptions(numOptions, nullptr);
|
||||
for (int option : selectedOptions) {
|
||||
dataOptions[option] = new float[dimensions.x*dimensions.y]{0.0f};
|
||||
for (int o : selectedOptions) {
|
||||
dataOptions[o] = new float[dimensions.x * dimensions.y] { 0.f };
|
||||
}
|
||||
|
||||
int numValues = 0;
|
||||
@@ -203,12 +203,11 @@ std::vector<float*> DataProcessorText::processData(std::string data,
|
||||
// first = 0;
|
||||
last = 0;
|
||||
option = -3;
|
||||
lineSize = line.size();
|
||||
lineSize = static_cast<int>(line.size());
|
||||
|
||||
while (last < lineSize) {
|
||||
|
||||
first = line.find_first_not_of(" \t", last);
|
||||
last = line.find_first_of(" \t", first);
|
||||
first = static_cast<int>(line.find_first_not_of(" \t", last));
|
||||
last = static_cast<int>(line.find_first_of(" \t", first));
|
||||
last = (last > 0)? last : lineSize;
|
||||
|
||||
auto it = std::find(
|
||||
|
||||
@@ -93,7 +93,7 @@ int iswa_addScreenSpaceCygnet(lua_State* L) {
|
||||
std::shared_ptr<ScreenSpaceRenderable> s(
|
||||
ScreenSpaceRenderable::createFromDictionary(d)
|
||||
);
|
||||
OsEng.renderEngine().registerScreenSpaceRenderable(s);
|
||||
OsEng.renderEngine().addScreenSpaceRenderable(s);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -184,12 +184,12 @@ bool KameleonWrapper::open(const std::string& filename) {
|
||||
}
|
||||
|
||||
void KameleonWrapper::close() {
|
||||
if (_kameleon)
|
||||
if (_kameleon) {
|
||||
_kameleon->close();
|
||||
if (_interpolator)
|
||||
delete _interpolator;
|
||||
if (_kameleon)
|
||||
delete _kameleon;
|
||||
}
|
||||
|
||||
delete _interpolator;
|
||||
delete _kameleon;
|
||||
|
||||
_kameleon = nullptr;
|
||||
_interpolator = nullptr;
|
||||
@@ -202,8 +202,7 @@ float* KameleonWrapper::getUniformSampledValues(
|
||||
const std::string& var,
|
||||
const glm::size3_t& outDimensions)
|
||||
{
|
||||
assert(_model && _interpolator);
|
||||
assert(outDimensions.x > 0 && outDimensions.y > 0 && outDimensions.z > 0);
|
||||
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
|
||||
LINFO("Loading variable " << var << " from CDF data with a uniform sampling");
|
||||
|
||||
unsigned int size = static_cast<unsigned int>(
|
||||
@@ -384,8 +383,7 @@ float* KameleonWrapper::getUniformSliceValues(const std::string& var,
|
||||
const glm::size3_t& outDimensions,
|
||||
const float& slice)
|
||||
{
|
||||
assert(_model && _interpolator);
|
||||
assert(outDimensions.x > 0 && outDimensions.y > 0 && outDimensions.z > 0);
|
||||
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
|
||||
LINFO("Loading variable " << var << " from CDF data with a uniform sampling");
|
||||
|
||||
unsigned int size = static_cast<unsigned int>(
|
||||
@@ -414,8 +412,8 @@ float* KameleonWrapper::getUniformSliceValues(const std::string& var,
|
||||
LDEBUG(var << "Min: " << varMin);
|
||||
LDEBUG(var << "Max: " << varMax);
|
||||
|
||||
double maxValue = 0.0;
|
||||
double minValue = std::numeric_limits<double>::max();
|
||||
//double maxValue = 0.0;
|
||||
//double minValue = std::numeric_limits<double>::max();
|
||||
|
||||
float missingValue = _model->getMissingValue();
|
||||
|
||||
@@ -517,8 +515,7 @@ float* KameleonWrapper::getUniformSampledVectorValues(const std::string& xVar,
|
||||
const std::string& zVar,
|
||||
const glm::size3_t& outDimensions)
|
||||
{
|
||||
assert(_model && _interpolator);
|
||||
assert(outDimensions.x > 0 && outDimensions.y > 0 && outDimensions.z > 0);
|
||||
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
|
||||
LINFO(
|
||||
"Loading variables " << xVar << " " << yVar << " " << zVar <<
|
||||
" from CDF data with a uniform sampling"
|
||||
@@ -597,7 +594,7 @@ KameleonWrapper::Fieldlines KameleonWrapper::getClassifiedFieldLines(
|
||||
const std::vector<glm::vec3>& seedPoints,
|
||||
float stepSize )
|
||||
{
|
||||
assert(_model && _interpolator);
|
||||
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
|
||||
LINFO(
|
||||
"Creating " << seedPoints.size() << " fieldlines from variables " <<
|
||||
xVar << " " << yVar << " " << zVar
|
||||
@@ -654,7 +651,7 @@ KameleonWrapper::Fieldlines KameleonWrapper::getFieldLines(const std::string& xV
|
||||
const std::string& yVar, const std::string& zVar,
|
||||
const std::vector<glm::vec3>& seedPoints, float stepSize, const glm::vec4& color)
|
||||
{
|
||||
assert(_model && _interpolator);
|
||||
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
|
||||
LINFO(
|
||||
"Creating " << seedPoints.size() << " fieldlines from variables " <<
|
||||
xVar << " " << yVar << " " << zVar
|
||||
@@ -744,7 +741,7 @@ KameleonWrapper::Fieldlines KameleonWrapper::getLorentzTrajectories(
|
||||
glm::vec3 KameleonWrapper::getModelBarycenterOffset() {
|
||||
// ENLIL is centered, no need for offset
|
||||
if (_type == Model::ENLIL) {
|
||||
return glm::vec3(0,0,0);
|
||||
return glm::vec3(0.f);
|
||||
}
|
||||
|
||||
glm::vec3 offset;
|
||||
@@ -770,8 +767,9 @@ glm::vec4 KameleonWrapper::getModelBarycenterOffsetScaled() {
|
||||
}
|
||||
|
||||
glm::vec3 KameleonWrapper::getModelScale() {
|
||||
if (_type == Model::ENLIL)
|
||||
return glm::vec3(1.0f, 1.0f, 1.0f);
|
||||
if (_type == Model::ENLIL) {
|
||||
return glm::vec3(1.f);
|
||||
}
|
||||
|
||||
glm::vec3 scale;
|
||||
scale.x = _xMax - _xMin;
|
||||
|
||||
@@ -394,8 +394,8 @@ void RenderableKameleonVolume::loadCdf(const std::string& path) {
|
||||
KameleonVolumeReader reader(path);
|
||||
|
||||
if (_autoValueBounds) {
|
||||
_lowerValueBound = reader.minValue(_variable);
|
||||
_upperValueBound = reader.maxValue(_variable);
|
||||
_lowerValueBound = static_cast<float>(reader.minValue(_variable));
|
||||
_upperValueBound = static_cast<float>(reader.maxValue(_variable));
|
||||
}
|
||||
|
||||
std::vector<std::string> variables = reader.gridVariableNames();
|
||||
|
||||
@@ -130,8 +130,14 @@ void KameleonVolumeToRawTask::perform(const Task::ProgressCallback& progressCall
|
||||
outputMetadata.setValue<glm::vec3>(KeyDimensions, _dimensions);
|
||||
outputMetadata.setValue<glm::vec3>(KeyLowerDomainBound, _lowerDomainBound);
|
||||
outputMetadata.setValue<glm::vec3>(KeyUpperDomainBound, _upperDomainBound);
|
||||
outputMetadata.setValue<float>(KeyMinValue, reader.minValue(_variable));
|
||||
outputMetadata.setValue<float>(KeyMaxValue, reader.maxValue(_variable));
|
||||
outputMetadata.setValue<float>(
|
||||
KeyMinValue,
|
||||
static_cast<float>(reader.minValue(_variable))
|
||||
);
|
||||
outputMetadata.setValue<float>(
|
||||
KeyMaxValue,
|
||||
static_cast<float>(reader.maxValue(_variable))
|
||||
);
|
||||
|
||||
ghoul::DictionaryLuaFormatter formatter;
|
||||
std::string metadataString = formatter.format(outputMetadata);
|
||||
|
||||
@@ -170,7 +170,7 @@ void AtlasManager::addToAtlas(int firstBrickIndex, int lastBrickIndex, float* ma
|
||||
unsigned int atlasCoords = _freeAtlasCoords.back();
|
||||
_freeAtlasCoords.pop_back();
|
||||
int level = _nOtLevels - floor(log((7.0 * (float(brickIndex % _nOtNodes)) + 1.0))/log(8)) - 1;
|
||||
assert(atlasCoords <= 0x0FFFFFFF);
|
||||
ghoul_assert(atlasCoords <= 0x0FFFFFFF, "@MISSING");
|
||||
unsigned int atlasData = (level << 28) + atlasCoords;
|
||||
_brickMap.insert(std::pair<unsigned int, unsigned int>(brickIndex, atlasData));
|
||||
_nStreamedBricks++;
|
||||
|
||||
@@ -358,8 +358,8 @@ bool LocalTfBrickSelector::calculateBrickErrors() {
|
||||
for (int i = 0; i < gradients.size(); i++) {
|
||||
float x = (i + 0.5f) / tfWidth;
|
||||
float sample = histogram->interpolate(x);
|
||||
assert(sample >= 0);
|
||||
assert(gradients[i] >= 0);
|
||||
ghoul_assert(sample >= 0, "@MISSING");
|
||||
ghoul_assert(gradients[i] >= 0, "@MISSING");
|
||||
error += sample * gradients[i];
|
||||
}
|
||||
_brickErrors[brickIndex].spatial = error;
|
||||
@@ -375,8 +375,8 @@ bool LocalTfBrickSelector::calculateBrickErrors() {
|
||||
for (int i = 0; i < gradients.size(); i++) {
|
||||
float x = (i + 0.5f) / tfWidth;
|
||||
float sample = histogram->interpolate(x);
|
||||
assert(sample >= 0);
|
||||
assert(gradients[i] >= 0);
|
||||
ghoul_assert(sample >= 0, "@MISSING");
|
||||
ghoul_assert(gradients[i] >= 0, "@MISSING");
|
||||
error += sample * gradients[i];
|
||||
}
|
||||
_brickErrors[brickIndex].temporal = error;
|
||||
|
||||
@@ -187,8 +187,6 @@ RenderableMultiresVolume::RenderableMultiresVolume (const ghoul::Dictionary& dic
|
||||
, _rotation(RotationInfo, glm::vec3(0.f, 0.f, 0.f), glm::vec3(0.f), glm::vec3(6.28f))
|
||||
{
|
||||
std::string name;
|
||||
//bool success = dictionary.getValue(constants::scenegraphnode::keyName, name);
|
||||
//assert(success);
|
||||
|
||||
_filename = "";
|
||||
bool success = dictionary.getValue(KeyDataSource, _filename);
|
||||
@@ -513,7 +511,8 @@ bool RenderableMultiresVolume::initializeSelector() {
|
||||
} else {
|
||||
// Build histograms from tsp file.
|
||||
LWARNING("Failed to open " << cacheFilename);
|
||||
if (success &= _errorHistogramManager->buildHistograms(nHistograms)) {
|
||||
success &= _errorHistogramManager->buildHistograms(nHistograms);
|
||||
if (success) {
|
||||
LINFO("Writing cache to " << cacheFilename);
|
||||
_errorHistogramManager->saveToFile(cacheFilename);
|
||||
}
|
||||
@@ -539,7 +538,11 @@ bool RenderableMultiresVolume::initializeSelector() {
|
||||
} else {
|
||||
// Build histograms from tsp file.
|
||||
LWARNING("Failed to open " << cacheFilename);
|
||||
if (success &= _histogramManager->buildHistograms(_tsp.get(), nHistograms)) {
|
||||
success &= _histogramManager->buildHistograms(
|
||||
_tsp.get(),
|
||||
nHistograms
|
||||
);
|
||||
if (success) {
|
||||
LINFO("Writing cache to " << cacheFilename);
|
||||
_histogramManager->saveToFile(cacheFilename);
|
||||
}
|
||||
@@ -565,7 +568,8 @@ bool RenderableMultiresVolume::initializeSelector() {
|
||||
} else {
|
||||
// Build histograms from tsp file.
|
||||
LWARNING("Failed to open " << cacheFilename);
|
||||
if (success &= _localErrorHistogramManager->buildHistograms(nHistograms)) {
|
||||
success &= _localErrorHistogramManager->buildHistograms(nHistograms);
|
||||
if (success) {
|
||||
LINFO("Writing cache to " << cacheFilename);
|
||||
_localErrorHistogramManager->saveToFile(cacheFilename);
|
||||
}
|
||||
@@ -678,7 +682,7 @@ void RenderableMultiresVolume::update(const UpdateData& data) {
|
||||
}
|
||||
else if (_useGlobalTime) {
|
||||
double t = (_time - _startTime) / (_endTime - _startTime);
|
||||
currentTimestep = t * numTimesteps;
|
||||
currentTimestep = static_cast<int>(t * numTimesteps);
|
||||
visible = currentTimestep >= 0 && currentTimestep < numTimesteps;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -311,7 +311,7 @@ bool SimpleTfBrickSelector::calculateBrickImportances() {
|
||||
float x = static_cast<float>(i) / static_cast<float>(tfWidth);
|
||||
float sample = histogram->interpolate(x);
|
||||
|
||||
assert(sample >= 0);
|
||||
ghoul_assert(sample >= 0, "@MISSING");
|
||||
dotProduct += sample * tf->sample(i).w;
|
||||
}
|
||||
_brickImportances[brickIndex] = dotProduct;
|
||||
|
||||
@@ -367,8 +367,8 @@ bool TfBrickSelector::calculateBrickErrors() {
|
||||
for (int i = 0; i < gradients.size(); i++) {
|
||||
float x = (i + 0.5f) / tfWidth;
|
||||
float sample = histogram->interpolate(x);
|
||||
assert(sample >= 0);
|
||||
assert(gradients[i] >= 0);
|
||||
ghoul_assert(sample >= 0, "@MISSING");
|
||||
ghoul_assert(gradients[i] >= 0, "@MISSING");
|
||||
error += sample * gradients[i];
|
||||
}
|
||||
_brickErrors[brickIndex] = error;
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace documentation { struct Documentation; }
|
||||
class RenderableFov : public Renderable {
|
||||
public:
|
||||
RenderableFov(const ghoul::Dictionary& dictionary);
|
||||
|
||||
|
||||
void initializeGL() override;
|
||||
void deinitializeGL() override;
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
void render(const RenderData& data, RendererTasks& rendererTask) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
@@ -153,7 +153,7 @@ private:
|
||||
properties::Vec4Property square; // Color for the orthogonal square
|
||||
} _colors;
|
||||
};
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_SPACECRAFTINSTRUMENTS___RENDERABLEFOV___H__
|
||||
|
||||
@@ -56,9 +56,8 @@
|
||||
|
||||
#include <glm/ext.hpp>
|
||||
|
||||
#pragma warning (pop)
|
||||
#ifdef WIN32
|
||||
|
||||
#pragma warning (pop)
|
||||
#endif // WIN32
|
||||
|
||||
|
||||
@@ -222,19 +221,19 @@ TouchInteraction::TouchInteraction()
|
||||
, _pickingRadiusMinimum(PickingRadiusInfo, 0.1f, 0.f, 1.f)
|
||||
, _vel{ glm::dvec2(0.0), 0.0, 0.0, glm::dvec2(0.0) }
|
||||
, _sensitivity{ glm::dvec2(0.08, 0.045), 4.0, 2.75, glm::dvec2(0.08, 0.045) }
|
||||
, _centroid(glm::dvec3(0.0))
|
||||
// calculated with two vectors with known diff in length, then
|
||||
// projDiffLength/diffLength.
|
||||
, _projectionScaleFactor(1.000004)
|
||||
, _currentRadius(1.0)
|
||||
, _slerpdT(1000)
|
||||
, _numOfTests(0)
|
||||
, _timeSlack(0.0)
|
||||
, _numOfTests(0)
|
||||
, _directTouchMode(false)
|
||||
, _tap(false)
|
||||
, _doubleTap(false)
|
||||
, _lmSuccess(true)
|
||||
, _guiON(false)
|
||||
, _centroid(glm::dvec3(0.0))
|
||||
{
|
||||
addProperty(_touchActive);
|
||||
addProperty(_unitTest);
|
||||
@@ -361,7 +360,6 @@ void TouchInteraction::directControl(const std::vector<TuioCursor>& list) {
|
||||
dvec3 centerPos = ptr->node->worldPosition();
|
||||
|
||||
dvec3 directionToCenter = normalize(centerPos - camPos);
|
||||
dvec3 centerToCamera = camPos - centerPos;
|
||||
dvec3 lookUp = ptr->camera->lookUpVectorWorldSpace();
|
||||
dvec3 camDirection = ptr->camera->viewDirectionWorldSpace();
|
||||
|
||||
@@ -388,17 +386,19 @@ void TouchInteraction::directControl(const std::vector<TuioCursor>& list) {
|
||||
dvec3 eulerAngles(q[1], q[0], 0);
|
||||
dquat rotationDiffCamSpace = dquat(eulerAngles);
|
||||
|
||||
dvec3 centerToCamera = camPos - centerPos;
|
||||
|
||||
dquat rotationDiffWorldSpace =
|
||||
globalCamRot * rotationDiffCamSpace * inverse(globalCamRot);
|
||||
dvec3 rotationDiffVec3 =
|
||||
centerToCamera * rotationDiffWorldSpace - centerToCamera;
|
||||
camPos += rotationDiffVec3;
|
||||
|
||||
dvec3 centerToCamera = camPos - centerPos;
|
||||
centerToCamera = camPos - centerPos;
|
||||
directionToCenter = normalize(-centerToCamera);
|
||||
dvec3 lookUpWhenFacingCenter =
|
||||
globalCamRot * dvec3(ptr->camera->lookUpVectorCameraSpace());
|
||||
dmat4 lookAtMat = lookAt(
|
||||
lookAtMat = lookAt(
|
||||
dvec3(0, 0, 0),
|
||||
directionToCenter,
|
||||
lookUpWhenFacingCenter);
|
||||
@@ -758,12 +758,12 @@ int TouchInteraction::interpretInteraction(const std::vector<TuioCursor>& list,
|
||||
double minDiff = 1000;
|
||||
int id = 0;
|
||||
for (const TuioCursor& c : list) {
|
||||
TuioPoint point = std::find_if(
|
||||
TuioPoint itPoint = std::find_if(
|
||||
lastProcessed.begin(),
|
||||
lastProcessed.end(),
|
||||
[&c](const Point& p) { return p.first == c.getSessionID(); }
|
||||
)->second;
|
||||
double diff = c.getX() - point.getX() + c.getY() - point.getY();
|
||||
double diff = c.getX() - itPoint.getX() + c.getY() - itPoint.getY();
|
||||
if (!c.isMoving()) {
|
||||
diff = minDiff = 0.0;
|
||||
id = c.getSessionID();
|
||||
@@ -785,8 +785,14 @@ int TouchInteraction::interpretInteraction(const std::vector<TuioCursor>& list,
|
||||
[&c](const Point& p) { return p.first == c.getSessionID(); }
|
||||
)->second;
|
||||
double res = 0.0;
|
||||
float lastAngle = point.getAngle(_centroid.x, _centroid.y);
|
||||
float currentAngle = c.getAngle(_centroid.x, _centroid.y);
|
||||
float lastAngle = point.getAngle(
|
||||
static_cast<float>(_centroid.x),
|
||||
static_cast<float>(_centroid.y)
|
||||
);
|
||||
float currentAngle = c.getAngle(
|
||||
static_cast<float>(_centroid.x),
|
||||
static_cast<float>(_centroid.y)
|
||||
);
|
||||
if (lastAngle > currentAngle + 1.5 * M_PI) {
|
||||
res = currentAngle + (2 * M_PI - lastAngle);
|
||||
}
|
||||
@@ -812,7 +818,9 @@ int TouchInteraction::interpretInteraction(const std::vector<TuioCursor>& list,
|
||||
return ROT;
|
||||
}
|
||||
else {
|
||||
float avgDistance = std::abs(dist - lastDist) / list.at(0).getMotionSpeed();
|
||||
float avgDistance = static_cast<float>(
|
||||
std::abs(dist - lastDist) / list.at(0).getMotionSpeed()
|
||||
);
|
||||
// if average distance between 3 fingers are constant we have panning
|
||||
if (avgDistance < _interpretPan && list.size() == 3) {
|
||||
return PAN;
|
||||
@@ -855,7 +863,10 @@ void TouchInteraction::computeVelocities(const std::vector<TuioCursor>& list,
|
||||
list.end(),
|
||||
0.0,
|
||||
[&](double d, const TuioCursor& c) {
|
||||
return d + c.getDistance(_centroid.x, _centroid.y);
|
||||
return d + c.getDistance(
|
||||
static_cast<float>(_centroid.x),
|
||||
static_cast<float>(_centroid.y)
|
||||
);
|
||||
}
|
||||
) / list.size();
|
||||
double lastDistance = std::accumulate(
|
||||
@@ -863,7 +874,10 @@ void TouchInteraction::computeVelocities(const std::vector<TuioCursor>& list,
|
||||
lastProcessed.end(),
|
||||
0.0f,
|
||||
[&](float d, const Point& p) {
|
||||
return d + p.second.getDistance(_centroid.x, _centroid.y);
|
||||
return d + p.second.getDistance(
|
||||
static_cast<float>(_centroid.x),
|
||||
static_cast<float>(_centroid.y)
|
||||
);
|
||||
}
|
||||
) / lastProcessed.size();
|
||||
|
||||
@@ -887,8 +901,14 @@ void TouchInteraction::computeVelocities(const std::vector<TuioCursor>& list,
|
||||
[&c](const Point& p) { return p.first == c.getSessionID(); }
|
||||
)->second;
|
||||
double res = diff;
|
||||
double lastAngle = point.getAngle(_centroid.x, _centroid.y);
|
||||
double currentAngle = c.getAngle(_centroid.x, _centroid.y);
|
||||
double lastAngle = point.getAngle(
|
||||
static_cast<float>(_centroid.x),
|
||||
static_cast<float>(_centroid.y)
|
||||
);
|
||||
double currentAngle = c.getAngle(
|
||||
static_cast<float>(_centroid.x),
|
||||
static_cast<float>(_centroid.y)
|
||||
);
|
||||
// if's used to set angles 359 + 1 = 0 and 0 - 1 = 359
|
||||
if (lastAngle > currentAngle + 1.5 * M_PI) {
|
||||
res += currentAngle + (2 * M_PI - lastAngle);
|
||||
@@ -1010,8 +1030,8 @@ void TouchInteraction::step(double dt) {
|
||||
centerToCamera;
|
||||
camPos += rotationDiffVec3;
|
||||
|
||||
dvec3 centerToCamera = camPos - centerPos;
|
||||
directionToCenter = normalize(-centerToCamera);
|
||||
dvec3 centerToCam = camPos - centerPos;
|
||||
directionToCenter = normalize(-centerToCam);
|
||||
dvec3 lookUpWhenFacingCenter = globalCamRot *
|
||||
dvec3(_camera->lookUpVectorCameraSpace());
|
||||
dmat4 lookAtMat = lookAt(
|
||||
@@ -1022,11 +1042,11 @@ void TouchInteraction::step(double dt) {
|
||||
}
|
||||
{ // Zooming
|
||||
centerToBoundingSphere = -directionToCenter * boundingSphere;
|
||||
dvec3 centerToCamera = camPos - centerPos;
|
||||
double distToSurface = length(centerToCamera - centerToBoundingSphere);
|
||||
dvec3 centerToCam = camPos - centerPos;
|
||||
double distToSurface = length(centerToCam - centerToBoundingSphere);
|
||||
|
||||
if (length(_vel.zoom * dt) < distToSurface &&
|
||||
length(centerToCamera + directionToCenter*_vel.zoom * dt) >
|
||||
length(centerToCam + directionToCenter*_vel.zoom * dt) >
|
||||
length(centerToBoundingSphere))
|
||||
{
|
||||
camPos += directionToCenter * _vel.zoom * dt;
|
||||
@@ -1055,12 +1075,12 @@ void TouchInteraction::unitTest() {
|
||||
|
||||
// set _selected pos and new pos (on screen)
|
||||
std::vector<TuioCursor> lastFrame = {
|
||||
{ TuioCursor(0, 10, 0.45, 0.4) }, // session id, cursor id, x, y
|
||||
{ TuioCursor(1, 11, 0.55, 0.6) }
|
||||
{ TuioCursor(0, 10, 0.45f, 0.4f) }, // session id, cursor id, x, y
|
||||
{ TuioCursor(1, 11, 0.55f, 0.6f) }
|
||||
};
|
||||
std::vector<TuioCursor> currFrame = {
|
||||
{ TuioCursor(0, 10, 0.2, 0.6) }, // (-0.6,-0.2)
|
||||
{ TuioCursor(1, 11, 0.8, 0.4) } // (0.6, 0.2)
|
||||
{ TuioCursor(0, 10, 0.2f, 0.6f) }, // (-0.6,-0.2)
|
||||
{ TuioCursor(1, 11, 0.8f, 0.4f) } // (0.6, 0.2)
|
||||
};
|
||||
|
||||
// call update
|
||||
@@ -1099,7 +1119,7 @@ void TouchInteraction::decelerate(double dt) {
|
||||
double frequency = 1.0 / _deceleratesPerSecond;
|
||||
// Number of times velocities should decelerate, depending on chosen frequency and
|
||||
// time slack over from last frame
|
||||
int times = (dt + _timeSlack) / frequency;
|
||||
int times = static_cast<int>((dt + _timeSlack) / frequency);
|
||||
// Save the new time slack for the next frame
|
||||
_timeSlack = fmod((dt + _timeSlack), frequency);
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ void RawVolumeWriter<VoxelType>::write(
|
||||
std::vector<VoxelType> buffer(_bufferSize);
|
||||
std::ofstream file(_path, std::ios::binary);
|
||||
|
||||
int nChunks = size / _bufferSize;
|
||||
int nChunks = static_cast<int>(size / _bufferSize);
|
||||
if (size % _bufferSize > 0) {
|
||||
nChunks++;
|
||||
}
|
||||
|
||||
@@ -157,20 +157,20 @@ RenderableTimeVaryingVolume::RenderableTimeVaryingVolume(
|
||||
const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _clipPlanes(nullptr)
|
||||
, _stepSize(StepSizeInfo, 0.02, 0.01, 1)
|
||||
, _stepSize(StepSizeInfo, 0.02f, 0.001f, 1.f)
|
||||
, _gridType(GridTypeInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _secondsBefore(SecondsBeforeInfo, 0.0, 0.01, SecondsInOneDay)
|
||||
, _secondsAfter(SecondsAfterInfo, 0.0, 0.01, SecondsInOneDay)
|
||||
, _secondsBefore(SecondsBeforeInfo, 0.f, 0.01f, SecondsInOneDay)
|
||||
, _secondsAfter(SecondsAfterInfo, 0.f, 0.01f, SecondsInOneDay)
|
||||
, _sourceDirectory(SourceDirectoryInfo)
|
||||
, _transferFunctionPath(TransferFunctionInfo)
|
||||
, _triggerTimeJump(TriggerTimeJumpInfo)
|
||||
, _jumpToTimestep(JumpToTimestepInfo, 0, 0, 256)
|
||||
, _currentTimestep(CurrentTimeStepInfo, 0, 0, 256)
|
||||
, _opacity(OpacityInfo, 10.0f, 0.0f, 50.0f)
|
||||
, _rNormalization(rNormalizationInfo, 0.0f, 0.0f, 2.0f)
|
||||
, _rUpperBound(rUpperBoundInfo, 1.0f, 0.0f, 2.0f)
|
||||
, _lowerValueBound(lowerValueBoundInfo, 0.0f, 0.0f, 1000000.0f)
|
||||
, _upperValueBound(upperValueBoundInfo, 0.0f, 0.0f, 1000000.0f)
|
||||
, _opacity(OpacityInfo, 10.f, 0.f, 500.f)
|
||||
, _rNormalization(rNormalizationInfo, 0.f, 0.f, 2.f)
|
||||
, _rUpperBound(rUpperBoundInfo, 1.f, 0.f, 2.f)
|
||||
, _lowerValueBound(lowerValueBoundInfo, 0.f, 0.f, 1000000.f)
|
||||
, _upperValueBound(upperValueBoundInfo, 0.f, 0.f, 1000000.f)
|
||||
, _raycaster(nullptr)
|
||||
, _transferFunction(nullptr)
|
||||
{
|
||||
@@ -192,6 +192,10 @@ RenderableTimeVaryingVolume::RenderableTimeVaryingVolume(
|
||||
});
|
||||
_gridType.setValue(static_cast<int>(volume::VolumeGridType::Cartesian));
|
||||
|
||||
if (dictionary.hasValue<float>(KeyStepSize)) {
|
||||
_stepSize = dictionary.value<float>(KeyStepSize);
|
||||
}
|
||||
|
||||
if (dictionary.hasValue<float>(KeySecondsBefore)) {
|
||||
_secondsBefore = dictionary.value<float>(KeySecondsBefore);
|
||||
}
|
||||
@@ -296,7 +300,7 @@ void RenderableTimeVaryingVolume::initializeGL() {
|
||||
});
|
||||
|
||||
const int lastTimestep = (_volumeTimesteps.size() > 0) ?
|
||||
(_volumeTimesteps.size() - 1) :
|
||||
static_cast<int>(_volumeTimesteps.size() - 1) :
|
||||
0;
|
||||
_currentTimestep.setMaxValue(lastTimestep);
|
||||
_jumpToTimestep.setMaxValue(lastTimestep);
|
||||
@@ -326,6 +330,12 @@ void RenderableTimeVaryingVolume::initializeGL() {
|
||||
VolumeGridType::Cartesian
|
||||
);
|
||||
});
|
||||
|
||||
_transferFunctionPath.onChange([this] {
|
||||
_transferFunction =
|
||||
std::make_shared<TransferFunction>(_transferFunctionPath);
|
||||
_raycaster->setTransferFunction(_transferFunction);
|
||||
});
|
||||
}
|
||||
|
||||
void RenderableTimeVaryingVolume::loadTimestepMetadata(const std::string& path) {
|
||||
@@ -425,7 +435,8 @@ void RenderableTimeVaryingVolume::jumpToTimestep(int target) {
|
||||
OsEng.timeManager().setTimeNextFrame(t->time);
|
||||
}
|
||||
|
||||
void RenderableTimeVaryingVolume::update(const UpdateData& data) {
|
||||
void RenderableTimeVaryingVolume::update(const UpdateData&) {
|
||||
_transferFunction->update();
|
||||
if (_raycaster) {
|
||||
Timestep* t = currentTimestep();
|
||||
_currentTimestep = timestepIndex(t);
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_MODULE_VOLUME___RENDERABLEKAMELEONVOLUME___H__
|
||||
#define __OPENSPACE_MODULE_VOLUME___RENDERABLEKAMELEONVOLUME___H__
|
||||
#ifndef __OPENSPACE_MODULE_VOLUME___RENDERABLETIMEVARYINGVOLUME___H__
|
||||
#define __OPENSPACE_MODULE_VOLUME___RENDERABLETIMEVARYINGVOLUME___H__
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
@@ -106,4 +106,4 @@ private:
|
||||
} // namespace volume
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_MODULE_KAMELEONVOLUME___RENDERABLEKAMELEONVOLUME___H__
|
||||
#endif // __OPENSPACE_MODULE_VOLUME___RENDERABLETIMEVARYINGVOLUME___H__
|
||||
|
||||
@@ -43,6 +43,8 @@ public:
|
||||
|
||||
TextureSliceVolumeReader(std::vector<std::string> paths, size_t sliceCacheMaxItems,
|
||||
size_t sliceCacheSize);
|
||||
virtual ~TextureSliceVolumeReader() = default;
|
||||
|
||||
VoxelType get(const glm::ivec3& coordinates) const;
|
||||
virtual glm::ivec3 dimensions() const;
|
||||
void setPaths(const std::vector<std::string> paths);
|
||||
|
||||
@@ -56,20 +56,20 @@ typename VolumeType::VoxelType VolumeSampler<VolumeType>::sample(
|
||||
for (int y = minCoords.y; y <= maxCoords.y; y++) {
|
||||
for (int x = minCoords.x; x <= maxCoords.x; x++) {
|
||||
glm::ivec3 sampleCoords = glm::ivec3(x, y, z);
|
||||
float filterCoefficient = 1.0;
|
||||
float filterCoefficient = 1.f;
|
||||
|
||||
if (x == minCoords.x) {
|
||||
filterCoefficient *= (1.0 - t.x);
|
||||
filterCoefficient *= (1.f - t.x);
|
||||
} else if (x == maxCoords.x) {
|
||||
filterCoefficient *= t.x;
|
||||
}
|
||||
if (y == minCoords.y) {
|
||||
filterCoefficient *= (1.0 - t.y);
|
||||
filterCoefficient *= (1.f - t.y);
|
||||
} else if (y == maxCoords.y) {
|
||||
filterCoefficient *= t.y;
|
||||
}
|
||||
if (z == minCoords.z) {
|
||||
filterCoefficient *= (1.0 - t.z);
|
||||
filterCoefficient *= (1.f - t.z);
|
||||
} else if (z == maxCoords.z) {
|
||||
filterCoefficient *= t.z;
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ return {
|
||||
ShowNodeNames = true,
|
||||
ShowProgressbar = true
|
||||
},
|
||||
-- CheckOpenGLState = true,
|
||||
-- LogEachOpenGLCall = true,
|
||||
CheckOpenGLState = true,
|
||||
LogEachOpenGLCall = true,
|
||||
|
||||
ShutdownCountdown = 3,
|
||||
-- OnScreenTextScaling = "framebuffer",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user