mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-09 05:00:42 -06:00
Merge from feature/globebrowsing
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -155,3 +155,7 @@ data/scene/juno/juno/spice
|
||||
data/scene/juno/juno/Juno.mtl
|
||||
data/scene/juno/juno/Juno.obj
|
||||
KeyboardMapping.txt
|
||||
saturn_rings.png
|
||||
data/scene/debugglobe/textures/earth_clouds.jpg
|
||||
data/scene/debugglobe/textures/earth_reflectance.png
|
||||
data/scene/rosetta/rosetta/obj/Rosetta.obj
|
||||
|
||||
@@ -27,8 +27,6 @@ cmake_minimum_required (VERSION 3.4 FATAL_ERROR)
|
||||
project (OpenSpace)
|
||||
message(STATUS "Generating OpenSpace project")
|
||||
|
||||
set(BOOST_ROOT "G:/deps/bin/boost_1_60_0")
|
||||
|
||||
set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}")
|
||||
set(OPENSPACE_APPS_DIR "${OPENSPACE_BASE_DIR}/apps")
|
||||
set(OPENSPACE_EXT_DIR "${OPENSPACE_BASE_DIR}/ext")
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
namespace {
|
||||
const QSize WindowSize = QSize(640, 480);
|
||||
|
||||
const QString NewsURL = "http://openspace.itn.liu.se/news.txt";
|
||||
const QString NewsURL = "http://openspaceproject.com/news.txt";
|
||||
|
||||
const std::string _configurationFile = "openspace.cfg";
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ SyncWidget::SyncWidget(QWidget* parent, Qt::WindowFlags f)
|
||||
|
||||
ghoul::initialize();
|
||||
_downloadManager = std::make_unique<openspace::DownloadManager>(
|
||||
"http://openspace.itn.liu.se/data/request", DownloadApplicationVersion);
|
||||
"http://data.openspaceproject.com/request", DownloadApplicationVersion);
|
||||
|
||||
libtorrent::error_code ec;
|
||||
_session->listen_on(std::make_pair(20280, 20290), ec);
|
||||
|
||||
1
data/scene/iswa/tfs/autumn.tf
Normal file
1
data/scene/iswa/tfs/autumn.tf
Normal file
@@ -0,0 +1 @@
|
||||
${SCENE}/iswa/tfs/colormap_autumn.png
|
||||
20
data/scene/lodesritest/earth/BmngJan.wms
Normal file
20
data/scene/lodesritest/earth/BmngJan.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Earth/Bmng/tile/0/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>86400</SizeX>
|
||||
<SizeY>43200</SizeY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>240</BlockSizeX>
|
||||
<BlockSizeY>240</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/earth/BmngJanBathy.wms
Normal file
20
data/scene/lodesritest/earth/BmngJanBathy.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Earth/Bmng/tile/2/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>86400</SizeX>
|
||||
<SizeY>43200</SizeY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>240</BlockSizeX>
|
||||
<BlockSizeY>240</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/earth/BmngJanTopo.wms
Normal file
20
data/scene/lodesritest/earth/BmngJanTopo.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Earth/Bmng/tile/1/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>86400</SizeX>
|
||||
<SizeY>43200</SizeY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>240</BlockSizeX>
|
||||
<BlockSizeY>240</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
309
data/scene/lodesritest/lodesritest.mod
Normal file
309
data/scene/lodesritest/lodesritest.mod
Normal file
@@ -0,0 +1,309 @@
|
||||
return {
|
||||
-- Earth barycenter module
|
||||
{
|
||||
Name = "EarthBarycenter",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Ephemeris = {
|
||||
Type = "Static"
|
||||
}
|
||||
},
|
||||
-- EarthTrail module
|
||||
{
|
||||
Name = "EarthTrail",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderableTrail",
|
||||
Body = "EARTH",
|
||||
Frame = "GALACTIC",
|
||||
Observer = "SUN",
|
||||
RGB = { 0.5, 0.8, 1.0},
|
||||
TropicalOrbitPeriod = 365.242,
|
||||
EarthOrbitRatio = 1,
|
||||
DayLength = 24
|
||||
},
|
||||
GuiName = "/Solar/EarthTrail"
|
||||
},
|
||||
-- RenderableGlobe module
|
||||
{
|
||||
Name = "LodEarth",
|
||||
Parent = "EarthBarycenter",
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "EARTH",
|
||||
Reference = "ECLIPJ2000",
|
||||
Observer = "SUN",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430.bsp"
|
||||
}
|
||||
},
|
||||
Rotation = {
|
||||
Type = "Spice",
|
||||
Frame = "IAU_EARTH",
|
||||
Reference = "ECLIPJ2000"
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableGlobe",
|
||||
Frame = "IAU_EARTH",
|
||||
Body = "EARTH",
|
||||
Radii = {6378137.0, 6378137.0, 6356752.314245}, -- Earth's radii
|
||||
CameraMinHeight = 300,
|
||||
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
|
||||
SegmentsPerPatch = 64,
|
||||
TextureInitData = {
|
||||
ColorTextureMinimumSize = 512,--512,
|
||||
OverlayMinimumSize = 512,
|
||||
HeightMapMinimumSize = 64,
|
||||
},
|
||||
Textures = {
|
||||
ColorTextures = {
|
||||
{
|
||||
Name = "Black Marble Next Generation (January)",
|
||||
FilePath = "earth/BmngJan.wms",
|
||||
Enabled = true
|
||||
},
|
||||
{
|
||||
Name = "Black Marble Next Generation Bathymetry (January)",
|
||||
FilePath = "earth/BmngJanBathy.wms",
|
||||
},
|
||||
|
||||
},
|
||||
GrayScaleOverlays = {
|
||||
|
||||
},
|
||||
NightTextures = {
|
||||
},
|
||||
WaterMasks = {
|
||||
},
|
||||
Overlays = {
|
||||
},
|
||||
HeightMaps = {
|
||||
{
|
||||
Name = "Black Marble Next Generation (Januray)",
|
||||
FilePath = "earth/BmngJanTopo.wms",
|
||||
Enabled = true,
|
||||
},
|
||||
},
|
||||
HeightMapOverlays = {
|
||||
},
|
||||
},
|
||||
},
|
||||
GuiName = "/Solar/Planets/LodEarth"
|
||||
},
|
||||
{
|
||||
Name = "LodMoon",
|
||||
Parent = "EarthBarycenter",
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "MOON",
|
||||
Reference = "ECLIPJ2000",
|
||||
Observer = "SUN",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430.bsp"
|
||||
}
|
||||
},
|
||||
Rotation = {
|
||||
Type = "Spice",
|
||||
Frame = "IAU_MOON",
|
||||
Reference = "ECLIPJ2000"
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableGlobe",
|
||||
Frame = "IAU_MOON",
|
||||
Body = "MOON",
|
||||
Radii = {1737000.0, 1737000.0, 1737000.0}, -- Earth's radii
|
||||
CameraMinHeight = 300,
|
||||
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
|
||||
SegmentsPerPatch = 64,
|
||||
TextureInitData = {
|
||||
ColorTextureMinimumSize = 512,--512,
|
||||
OverlayMinimumSize = 512,
|
||||
HeightMapMinimumSize = 64,
|
||||
},
|
||||
Textures = {
|
||||
ColorTextures = {
|
||||
{
|
||||
Name = "ClemUvvis",
|
||||
FilePath = "moon/ClemUvvis.wms",
|
||||
Enabled = true,
|
||||
},
|
||||
{
|
||||
Name = "Gebco",
|
||||
FilePath = "moon/Gebco.wms",
|
||||
},
|
||||
{
|
||||
Name = "Kaguya",
|
||||
FilePath = "moon/Kaguya.wms",
|
||||
},
|
||||
-- {
|
||||
-- Name = "LolaClrShade",
|
||||
-- FilePath = "moon/LolaClrShade.wms",
|
||||
-- },
|
||||
-- {
|
||||
-- Name = "LolaShade",
|
||||
-- FilePath = "moon/LolaShade.wms",
|
||||
-- },
|
||||
{
|
||||
Name = "UvvisHybrid",
|
||||
FilePath = "moon/UvvisHybrid.wms",
|
||||
},
|
||||
{
|
||||
Name = "Wac",
|
||||
FilePath = "moon/Wac.wms",
|
||||
},
|
||||
|
||||
},
|
||||
GrayScaleOverlays = {
|
||||
|
||||
},
|
||||
NightTextures = {
|
||||
},
|
||||
WaterMasks = {
|
||||
},
|
||||
Overlays = {
|
||||
},
|
||||
HeightMaps = {
|
||||
{
|
||||
Name = "LolaDem",
|
||||
FilePath = "moon/LolaDem.wms",
|
||||
Enabled = true,
|
||||
},
|
||||
},
|
||||
HeightMapOverlays = {
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name = "LodMars",
|
||||
Parent = "EarthBarycenter",
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "MARS",
|
||||
Reference = "ECLIPJ2000",
|
||||
Observer = "SUN",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/MAR063.BSP"
|
||||
}
|
||||
},
|
||||
Rotation = {
|
||||
Type = "Spice",
|
||||
Frame = "IAU_MARS",
|
||||
Reference = "ECLIPJ2000"
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableGlobe",
|
||||
Frame = "IAU_MARS",
|
||||
Body = "MARS",
|
||||
Radii = {3390000.0, 3390000.0, 3390000.0}, -- Earth's radii
|
||||
CameraMinHeight = 300,
|
||||
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
|
||||
SegmentsPerPatch = 64,
|
||||
TextureInitData = {
|
||||
ColorTextureMinimumSize = 512,--512,
|
||||
OverlayMinimumSize = 512,
|
||||
HeightMapMinimumSize = 64,
|
||||
},
|
||||
Textures = {
|
||||
ColorTextures = {
|
||||
{
|
||||
Name = "MDIM",
|
||||
FilePath = "mars/Mdim.wms",
|
||||
Enabled = true,
|
||||
},
|
||||
{
|
||||
Name = "MolaPseudoColor",
|
||||
FilePath = "mars/MolaPseudoColor.wms",
|
||||
},
|
||||
},
|
||||
GrayScaleOverlays = {
|
||||
{
|
||||
Name = "ThemisIRDay",
|
||||
FilePath = "mars/ThemisIRDay.wms",
|
||||
},
|
||||
{
|
||||
Name = "ThemisIRNight",
|
||||
FilePath = "mars/ThemisIRNight.xml",
|
||||
},
|
||||
|
||||
},
|
||||
NightTextures = {
|
||||
},
|
||||
WaterMasks = {
|
||||
},
|
||||
Overlays = {
|
||||
},
|
||||
HeightMaps = {
|
||||
{
|
||||
Name = "MolaElevation",
|
||||
FilePath = "mars/MolaElevation.wms",
|
||||
Enabled = true,
|
||||
},
|
||||
},
|
||||
HeightMapOverlays = {
|
||||
},
|
||||
},
|
||||
},
|
||||
GuiName = "/Solar/Planets/LodEarth"
|
||||
},
|
||||
{
|
||||
Name = "LodMercury",
|
||||
Parent = "EarthBarycenter",
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "MERCURY",
|
||||
Reference = "ECLIPJ2000",
|
||||
Observer = "SUN",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430.bsp"
|
||||
}
|
||||
},
|
||||
Rotation = {
|
||||
Type = "Spice",
|
||||
Frame = "IAU_MERCURY",
|
||||
Reference = "ECLIPJ2000"
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableGlobe",
|
||||
Frame = "IAU_MERCURY",
|
||||
Body = "MERCURY",
|
||||
Radii = {2440000.0, 2440000.0, 2440000.0}, -- Earth's radii
|
||||
CameraMinHeight = 300,
|
||||
InteractionDepthBelowEllipsoid = 0, -- Useful when having negative height map values
|
||||
SegmentsPerPatch = 64,
|
||||
TextureInitData = {
|
||||
ColorTextureMinimumSize = 512,--512,
|
||||
OverlayMinimumSize = 512,
|
||||
HeightMapMinimumSize = 64,
|
||||
},
|
||||
Textures = {
|
||||
ColorTextures = {
|
||||
{
|
||||
Name = "MessengerMdis",
|
||||
FilePath = "mercury/MessengerMdis.wms",
|
||||
Enabled = true
|
||||
},
|
||||
{
|
||||
Name = "MessengerMosaic",
|
||||
FilePath = "mercury/MessengerMosaic.wms",
|
||||
}
|
||||
},
|
||||
GrayScaleOverlays = {
|
||||
|
||||
},
|
||||
NightTextures = {
|
||||
},
|
||||
WaterMasks = {
|
||||
},
|
||||
Overlays = {
|
||||
},
|
||||
HeightMaps = {
|
||||
},
|
||||
HeightMapOverlays = {
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
GuiName = "/Solar/Planets/LodEarth"
|
||||
},
|
||||
}
|
||||
20
data/scene/lodesritest/mars/Mdim.wms
Normal file
20
data/scene/lodesritest/mars/Mdim.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Mars/Mdim/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>92160</SizeX>
|
||||
<SizeY>46080</SizeY>
|
||||
<TileLevel>7</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</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>360</BlockSizeX>
|
||||
<BlockSizeY>360</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
21
data/scene/lodesritest/mars/MolaElevation.wms
Normal file
21
data/scene/lodesritest/mars/MolaElevation.wms
Normal file
@@ -0,0 +1,21 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Mars/MolaElevation/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>46080</SizeX>
|
||||
<SizeY>23040</SizeY>
|
||||
<TileLevel>6</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</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>360</BlockSizeX>
|
||||
<BlockSizeY>360</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<DataType>Int16</DataType>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/mars/MolaPseudoColor.wms
Normal file
20
data/scene/lodesritest/mars/MolaPseudoColor.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Mars/MolaPseudoColor/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>46080</SizeX>
|
||||
<SizeY>23040</SizeY>
|
||||
<TileLevel>6</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</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>360</BlockSizeX>
|
||||
<BlockSizeY>360</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/mars/ThemisIRDay.wms
Normal file
20
data/scene/lodesritest/mars/ThemisIRDay.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Mars/ThemisIRDay/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>213390</SizeX>
|
||||
<SizeY>106695</SizeY>
|
||||
<TileLevel>9</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</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>256</BlockSizeX>
|
||||
<BlockSizeY>256</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/mars/ThemisIRNight.wms
Normal file
20
data/scene/lodesritest/mars/ThemisIRNight.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Mars/ThemisIRNight/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>213388</SizeX>
|
||||
<SizeY>71130</SizeY>
|
||||
<TileLevel>9</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</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>256</BlockSizeX>
|
||||
<BlockSizeY>256</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/mercury/MessengerMdis.wms
Normal file
20
data/scene/lodesritest/mercury/MessengerMdis.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Mercury/MessengerMdis/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>61324</SizeX>
|
||||
<SizeY>30662</SizeY>
|
||||
<TileLevel>7</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>GEOGCS["GCS_Mercury_2015",DATUM["D_Mercury_2015",SPHEROID["Mercury_2015",2439400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
|
||||
<BlockSizeX>256</BlockSizeX>
|
||||
<BlockSizeY>256</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/mercury/MessengerMosaic.wms
Normal file
20
data/scene/lodesritest/mercury/MessengerMosaic.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Mercury/MessengerMosaic/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>23054</SizeX>
|
||||
<SizeY>11527</SizeY>
|
||||
<TileLevel>6</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>GEOGCS["GCS_Mercury_2015",DATUM["D_Mercury_2015",SPHEROID["Mercury_2015",2439400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
|
||||
<BlockSizeX>256</BlockSizeX>
|
||||
<BlockSizeY>256</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/moon/ClemUvvis.wms
Normal file
20
data/scene/lodesritest/moon/ClemUvvis.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Moon/ClemUvvis/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>92160</SizeX>
|
||||
<SizeY>46080</SizeY>
|
||||
<TileLevel>7</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>GEOGCS["GCS_Moon_2000",DATUM["D_Moon_2000",SPHEROID["Moon_2000_IAU_IAG",1737400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
|
||||
<BlockSizeX>360</BlockSizeX>
|
||||
<BlockSizeY>360</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
21
data/scene/lodesritest/moon/Gebco.wms
Normal file
21
data/scene/lodesritest/moon/Gebco.wms
Normal file
@@ -0,0 +1,21 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Earth/Gebco/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>43200</SizeX>
|
||||
<SizeY>21600</SizeY>
|
||||
<TileLevel>6</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>360</BlockSizeX>
|
||||
<BlockSizeY>360</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<DataType>Int16</DataType>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/moon/Kaguya.wms
Normal file
20
data/scene/lodesritest/moon/Kaguya.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Moon/Kaguya/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>1474560</SizeX>
|
||||
<SizeY>737280</SizeY>
|
||||
<TileLevel>11</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>GEOGCS["GCS_Moon_2000",DATUM["D_Moon_2000",SPHEROID["Moon_2000_IAU_IAG",1737400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
|
||||
<BlockSizeX>360</BlockSizeX>
|
||||
<BlockSizeY>360</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/moon/LolaClrShade.wms
Normal file
20
data/scene/lodesritest/moon/LolaClrShade.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Moon/LolaClrShade/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>92160</SizeX>
|
||||
<SizeY>46080</SizeY>
|
||||
<TileLevel>7</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>GEOGCS["GCS_Moon_2000",DATUM["D_Moon_2000",SPHEROID["Moon_2000_IAU_IAG",1737400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
|
||||
<BlockSizeX>360</BlockSizeX>
|
||||
<BlockSizeY>360</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
21
data/scene/lodesritest/moon/LolaDem.wms
Normal file
21
data/scene/lodesritest/moon/LolaDem.wms
Normal file
@@ -0,0 +1,21 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Moon/LolaDem/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>92160</SizeX>
|
||||
<SizeY>46080</SizeY>
|
||||
<TileLevel>7</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>GEOGCS["GCS_Moon_2000",DATUM["D_Moon_2000",SPHEROID["Moon_2000_IAU_IAG",1737400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
|
||||
<BlockSizeX>360</BlockSizeX>
|
||||
<BlockSizeY>360</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<DataType>Int16</DataType>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/moon/LolaShade.wms
Normal file
20
data/scene/lodesritest/moon/LolaShade.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Moon/LolaShade/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>92160</SizeX>
|
||||
<SizeY>46080</SizeY>
|
||||
<TileLevel>7</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>GEOGCS["GCS_Moon_2000",DATUM["D_Moon_2000",SPHEROID["Moon_2000_IAU_IAG",1737400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
|
||||
<BlockSizeX>360</BlockSizeX>
|
||||
<BlockSizeY>360</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/moon/UvvisHybrid.wms
Normal file
20
data/scene/lodesritest/moon/UvvisHybrid.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Moon/UvvisHybrid/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>184320</SizeX>
|
||||
<SizeY>92160</SizeY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>GEOGCS["GCS_Moon_2000",DATUM["D_Moon_2000",SPHEROID["Moon_2000_IAU_IAG",1737400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
|
||||
<BlockSizeX>360</BlockSizeX>
|
||||
<BlockSizeY>360</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
20
data/scene/lodesritest/moon/Wac.wms
Normal file
20
data/scene/lodesritest/moon/Wac.wms
Normal file
@@ -0,0 +1,20 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://planetarydev-1803629091.us-west-2.elb.amazonaws.com/Moon/Wac/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>109164</SizeX>
|
||||
<SizeY>54582</SizeY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>GEOGCS["GCS_Moon_2000",DATUM["D_Moon_2000",SPHEROID["Moon_2000_IAU_IAG",1737400.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
|
||||
<BlockSizeX>256</BlockSizeX>
|
||||
<BlockSizeY>256</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
<MaxConnections>10</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
@@ -1,5 +1,5 @@
|
||||
return {
|
||||
FileRequest = {
|
||||
{ Identifier = "saturn_textures", Destination = "textures", Version = 1 }
|
||||
{ Identifier = "saturn_textures", Destination = "textures", Version = 2 }
|
||||
},
|
||||
}
|
||||
@@ -42,6 +42,21 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/Planets/Saturn"
|
||||
},
|
||||
-- The rings of Saturn
|
||||
-- Using the 'Saturn's rings dark side mosaic' as a basis
|
||||
{
|
||||
Name = "SaturnRings",
|
||||
Parent = "Saturn",
|
||||
Renderable = {
|
||||
Type = "RenderableRings",
|
||||
Body = "SATURN BARYCENTER",
|
||||
Frame = "IAU_SATURN",
|
||||
Texture = "textures/saturn_rings.png",
|
||||
Size = { 0.140445100671159, 9.0 }, -- 140445.100671159km
|
||||
Offset = { 74500 / 140445.100671159, 1.0 } -- min / max extend
|
||||
},
|
||||
|
||||
},
|
||||
-- SaturnTrail module
|
||||
{
|
||||
Name = "SaturnTrail",
|
||||
|
||||
Submodule ext/ghoul updated: c0d55b213e...3f984822e7
@@ -27,18 +27,30 @@
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
#include <openspace/properties/scalarproperty.h>
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class OpenSpaceModule;
|
||||
|
||||
class SettingsEngine : public properties::PropertyOwner {
|
||||
public:
|
||||
SettingsEngine();
|
||||
SettingsEngine();
|
||||
|
||||
void initialize();
|
||||
|
||||
void setModules(std::vector<OpenSpaceModule*> modules);
|
||||
|
||||
private:
|
||||
properties::FloatProperty _eyeSeparation;
|
||||
void initEyeSeparation();
|
||||
void initSceneFiles();
|
||||
|
||||
properties::FloatProperty _eyeSeparation;
|
||||
properties::OptionProperty _scenes;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
#endif //#ifndef __SETTINGSENGINE_H__
|
||||
|
||||
@@ -50,13 +50,20 @@ public:
|
||||
std::string description;
|
||||
};
|
||||
|
||||
enum class DisplayType {
|
||||
RADIO,
|
||||
DROPDOWN
|
||||
};
|
||||
|
||||
/**
|
||||
* The constructor delegating the <code>identifier</code> and the <code>guiName</code>
|
||||
* to its super class.
|
||||
* \param identifier A unique identifier for this property
|
||||
* \param guiName The GUI name that should be used to represent this property
|
||||
* \param displayType Optional DisplayType for GUI (default RADIO)
|
||||
*/
|
||||
OptionProperty(std::string identifier, std::string guiName);
|
||||
OptionProperty(std::string identifier, std::string guiName, DisplayType displayType);
|
||||
|
||||
/**
|
||||
* Returns the name of the class for reflection purposes.
|
||||
@@ -65,6 +72,12 @@ public:
|
||||
std::string className() const override;
|
||||
using IntProperty::operator=;
|
||||
|
||||
/**
|
||||
* Returns the type for GUI display.
|
||||
* \return OptionType for display purposes
|
||||
*/
|
||||
DisplayType displayType() const;
|
||||
|
||||
/**
|
||||
* Adds the passed option to the list of available options. The <code>value</code> of
|
||||
* the <code>option</code> must not have been registered previously, or a warning will
|
||||
@@ -74,9 +87,16 @@ public:
|
||||
*/
|
||||
void addOption(int value, std::string desc);
|
||||
|
||||
/**
|
||||
* Appends options with vectors of values and descriptions
|
||||
* \param values A std::vector<int> of values for the options
|
||||
* \param descs A std::vector<string> of descriptions for each value
|
||||
*/
|
||||
void addOptions(std::vector<int> values, std::vector<std::string> descs);
|
||||
|
||||
/**
|
||||
* Returns the list of available options.
|
||||
* /return The list of available options
|
||||
* \return The list of available options
|
||||
*/
|
||||
const std::vector<Option>& options() const;
|
||||
|
||||
@@ -87,12 +107,19 @@ public:
|
||||
*/
|
||||
void setValue(int value) override;
|
||||
|
||||
/**
|
||||
* Get the description of the option that matches <code>value</code>
|
||||
* \param value The value of the option
|
||||
*/
|
||||
std::string getDescriptionByValue(int value);
|
||||
|
||||
private:
|
||||
static const std::string OptionsKey;
|
||||
std::string generateAdditionalDescription() const;
|
||||
|
||||
/// The list of options which have been registered with this OptionProperty
|
||||
std::vector<Option> _options;
|
||||
DisplayType _displayType;
|
||||
};
|
||||
|
||||
} // namespace properties
|
||||
|
||||
@@ -37,8 +37,9 @@ namespace properties {
|
||||
* NumericalProperty classes to outsource the definitions of class names, default values,
|
||||
* etc. Using the PropertyDelegate, it is possible to create new TemplateProperty types
|
||||
* without subclassing the TemplateProperty, but rather creating a specialized instance
|
||||
* of PropertyDelegate. See (http://openspace.itn.liu.se/trac/wiki/guides/properties) for
|
||||
* more detailed information.
|
||||
* of PropertyDelegate. See
|
||||
* (https://github.com/OpenSpace/OpenSpace/wiki/Concepts-Properties) for more detailed
|
||||
* information.
|
||||
* \see TemplateProperty
|
||||
* \see NumericalProperty
|
||||
* \tparam T The full class for which this specialized instance of PropertyDelegate is
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace properties {
|
||||
* to the PropertyDelegate::defaultValue method, providing the template parameter
|
||||
* <code>T</code> as argument. When a new TemplateProperty is required, that method needs
|
||||
* to be specialized for the new type or a compile-time error will occur
|
||||
* (See http://openspace.itn.liu.se/trac/wiki/guides/properties).
|
||||
* (See https://github.com/OpenSpace/OpenSpace/wiki/Concepts-Properties).
|
||||
* \tparam T The type of value that is stored in this TemplateProperty
|
||||
* \see Property
|
||||
* \see NumericalProperty
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
#ifndef __SCRIPT_HELPER_H__
|
||||
#define __SCRIPT_HELPER_H__
|
||||
|
||||
#define SCRIPT_CHECK_ARGUMENTS(__stack__, __reqArg__, __realArg__) \
|
||||
#define SCRIPT_CHECK_ARGUMENTS(__category__, __stack__, __reqArg__, __realArg__) \
|
||||
if (__realArg__ != __reqArg__) { \
|
||||
LERROR(ghoul::lua::errorLocation(__stack__) << "Expected " << __reqArg__ << \
|
||||
" arguments, got " << __realArg__); \
|
||||
LERRORC(__category__, ghoul::lua::errorLocation(__stack__) << "Expected " << \
|
||||
__reqArg__ << " arguments, got " << __realArg__); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,10 @@
|
||||
#ifndef __OPENSPACEMODULE_H__
|
||||
#define __OPENSPACEMODULE_H__
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -34,7 +37,7 @@ namespace openspace {
|
||||
* into a useful granularity to be mostly used self-sufficiently. Each OpenSpaceModule
|
||||
* needs a unique, nonempty <code>name</code>.
|
||||
*/
|
||||
class OpenSpaceModule {
|
||||
class OpenSpaceModule : public properties::PropertyOwner {
|
||||
public:
|
||||
/**
|
||||
* Constructs the OpenSpaceModule with a specific \p name. The uniqueness of the
|
||||
@@ -61,12 +64,6 @@ public:
|
||||
*/
|
||||
void deinitialize();
|
||||
|
||||
/**
|
||||
* Returns the name for this OpenSpaceModule.
|
||||
* \return THe name for this OpenSpaceModule
|
||||
*/
|
||||
std::string name() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Customization point for each derived class. The internalInitialize method is called
|
||||
@@ -85,9 +82,6 @@ protected:
|
||||
* path tokens.
|
||||
*/
|
||||
std::string modulePath() const;
|
||||
|
||||
/// The name of this OpenSpaceModule
|
||||
const std::string _name;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -682,7 +682,7 @@ public:
|
||||
* \param destinationFrame The name of the destination reference frame
|
||||
* \param ephemerisTimeFrom The time for the source reference frame
|
||||
* \param ephemerisTimeTo The time for the destination reference frame
|
||||
* \return Thetransformation matrix that maps between the \p sourceFrame at time
|
||||
* \return The transformation matrix that maps between the \p sourceFrame at time
|
||||
* \p ephemerisTimeFrom to the \p destinationFrame at the time \p ephemerisTimeTo.
|
||||
* \throws SpiceException If there is no coverage available for the specified
|
||||
* \p sourceFrame and \p destinationFrame
|
||||
|
||||
@@ -33,6 +33,7 @@ set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablepath.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplane.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanet.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablerings.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphere.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphericalgrid.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablestars.h
|
||||
@@ -54,6 +55,7 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablepath.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplane.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablerings.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphere.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablesphericalgrid.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablestars.cpp
|
||||
@@ -84,6 +86,8 @@ set(SHADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/pscstandard_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/pscstandard_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/rings_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/sphere_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/sphere_vs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/star_fs.glsl
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <modules/base/rendering/renderablestars.h>
|
||||
#include <modules/base/rendering/renderabletrail.h>
|
||||
#include <modules/base/rendering/renderablepath.h>
|
||||
#include <modules/base/rendering/renderablerings.h>
|
||||
#include <modules/base/rendering/renderablesphere.h>
|
||||
#include <modules/base/rendering/renderablesphericalgrid.h>
|
||||
#include <modules/base/rendering/renderableplanet.h>
|
||||
@@ -71,15 +72,16 @@ void BaseModule::internalInitialize() {
|
||||
auto fRenderable = FactoryManager::ref().factory<Renderable>();
|
||||
ghoul_assert(fRenderable, "Renderable factory was not created");
|
||||
|
||||
fRenderable->registerClass<RenderablePlanet>("RenderablePlanet");
|
||||
fRenderable->registerClass<RenderableStars>("RenderableStars");
|
||||
fRenderable->registerClass<RenderableConstellationBounds>("RenderableConstellationBounds");
|
||||
fRenderable->registerClass<RenderableModel>("RenderableModel");
|
||||
fRenderable->registerClass<RenderablePath>("RenderablePath");
|
||||
fRenderable->registerClass<RenderableTrail>("RenderableTrail");
|
||||
fRenderable->registerClass<RenderablePlane>("RenderablePlane");
|
||||
fRenderable->registerClass<RenderablePlanet>("RenderablePlanet");
|
||||
fRenderable->registerClass<RenderableRings>("RenderableRings");
|
||||
fRenderable->registerClass<RenderableSphere>("RenderableSphere");
|
||||
fRenderable->registerClass<RenderableSphericalGrid>("RenderableSphericalGrid");
|
||||
fRenderable->registerClass<RenderableModel>("RenderableModel");
|
||||
fRenderable->registerClass<RenderablePlane>("RenderablePlane");
|
||||
fRenderable->registerClass<RenderableStars>("RenderableStars");
|
||||
fRenderable->registerClass<RenderableTrail>("RenderableTrail");
|
||||
|
||||
auto fEphemeris = FactoryManager::ref().factory<Ephemeris>();
|
||||
ghoul_assert(fEphemeris, "Ephemeris factory was not created");
|
||||
|
||||
@@ -54,24 +54,19 @@ PlanetGeometry* PlanetGeometry::createFromDictionary(const ghoul::Dictionary& di
|
||||
}
|
||||
|
||||
PlanetGeometry::PlanetGeometry()
|
||||
//: _parent(nullptr)
|
||||
: _parent(nullptr)
|
||||
{
|
||||
setName("PlanetGeometry");
|
||||
}
|
||||
|
||||
PlanetGeometry::~PlanetGeometry()
|
||||
{
|
||||
}
|
||||
PlanetGeometry::~PlanetGeometry() {}
|
||||
|
||||
bool PlanetGeometry::initialize(Renderable* parent)
|
||||
{
|
||||
bool PlanetGeometry::initialize(Renderable* parent) {
|
||||
_parent = parent;
|
||||
return true;
|
||||
}
|
||||
|
||||
void PlanetGeometry::deinitialize()
|
||||
{
|
||||
}
|
||||
void PlanetGeometry::deinitialize() {}
|
||||
|
||||
} // namespace planetgeometry
|
||||
} // namespace openspace
|
||||
|
||||
@@ -109,9 +109,7 @@ bool RenderablePath::initialize() {
|
||||
|
||||
bool intervalSet = hasTimeInterval();
|
||||
if (intervalSet) {
|
||||
getInterval(_start, _stop);
|
||||
std::string start = SpiceManager::ref().dateFromEphemerisTime(_start);
|
||||
std::string stop = SpiceManager::ref().dateFromEphemerisTime(_stop);
|
||||
completeSuccess &= getInterval(_start, _stop);
|
||||
}
|
||||
|
||||
return completeSuccess;
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
const unsigned int NU_SAMPLES = 16;*/
|
||||
|
||||
public:
|
||||
RenderablePlanet(const ghoul::Dictionary& dictionary);
|
||||
explicit RenderablePlanet(const ghoul::Dictionary& dictionary);
|
||||
~RenderablePlanet();
|
||||
|
||||
bool initialize() override;
|
||||
|
||||
279
modules/base/rendering/renderablerings.cpp
Normal file
279
modules/base/rendering/renderablerings.cpp
Normal file
@@ -0,0 +1,279 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby 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/renderablerings.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
#include <ghoul/filesystem/filesystem>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "RenderableRings";
|
||||
|
||||
const std::string KeySize = "Size";
|
||||
const std::string KeyTexture = "Texture";
|
||||
const std::string KeyBody = "Body";
|
||||
const std::string KeyFrame = "Frame";
|
||||
const std::string KeyOrientation = "Orientation";
|
||||
const std::string KeyOffset = "Offset";
|
||||
const std::string KeyNightFactor = "NightFactor";
|
||||
const std::string KeyTransparency = "Transparency";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
RenderableRings::RenderableRings(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _texturePath("texture", "Texture")
|
||||
, _size("size", "Size", glm::vec2(1.f, 1.f), glm::vec2(0.f), glm::vec2(1.f, 25.f))
|
||||
, _offset("offset", "Texture Offset", glm::vec2(0.f, 1.f), glm::vec2(0.f), glm::vec2(1.f))
|
||||
, _nightFactor("nightFactor", "Night Factor", 0.33f, 0.f, 1.f)
|
||||
, _transparency("transparency", "Transparency", 0.15f, 0.f, 1.f)
|
||||
, _shader(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _textureFile(nullptr)
|
||||
, _textureIsDirty(false)
|
||||
, _quad(0)
|
||||
, _vertexPositionBuffer(0)
|
||||
, _planeIsDirty(false)
|
||||
, _hasSunPosition(false)
|
||||
{
|
||||
glm::vec2 size;
|
||||
dictionary.getValue(KeySize, size);
|
||||
_size = size;
|
||||
|
||||
if (dictionary.hasKeyAndValue<std::string>(KeyBody)) {
|
||||
_body = dictionary.value<std::string>(KeyBody);
|
||||
_hasSunPosition = true;
|
||||
}
|
||||
|
||||
if (dictionary.hasKeyAndValue<std::string>(KeyFrame)) {
|
||||
_frame = dictionary.value<std::string>(KeyFrame);
|
||||
}
|
||||
|
||||
if (dictionary.hasKeyAndValue<glm::mat3>(KeyOrientation)) {
|
||||
_orientation = dictionary.value<glm::mat3>(KeyOrientation);
|
||||
}
|
||||
|
||||
if (dictionary.hasKeyAndValue<std::string>(KeyTexture)) {
|
||||
_texturePath = absPath(dictionary.value<std::string>(KeyTexture));
|
||||
_textureFile = std::make_unique<ghoul::filesystem::File>(_texturePath);
|
||||
}
|
||||
|
||||
if (dictionary.hasKeyAndValue<glm::vec2>(KeyOffset)) {
|
||||
glm::vec2 off = dictionary.value<glm::vec2>(KeyOffset);
|
||||
_offset = off;
|
||||
}
|
||||
|
||||
if (dictionary.hasKeyAndValue<float>(KeyNightFactor)) {
|
||||
float v = dictionary.value<float>(KeyNightFactor);
|
||||
_nightFactor = v;
|
||||
}
|
||||
|
||||
if (dictionary.hasKeyAndValue<float>(KeyTransparency)) {
|
||||
float v = dictionary.value<float>(KeyTransparency);
|
||||
_transparency = v;
|
||||
}
|
||||
|
||||
addProperty(_offset);
|
||||
|
||||
addProperty(_size);
|
||||
_size.onChange([&](){ _planeIsDirty = true; });
|
||||
|
||||
addProperty(_texturePath);
|
||||
_texturePath.onChange([&](){ loadTexture(); });
|
||||
|
||||
_textureFile->setCallback(
|
||||
[&](const ghoul::filesystem::File&) { _textureIsDirty = true; }
|
||||
);
|
||||
|
||||
addProperty(_nightFactor);
|
||||
|
||||
addProperty(_transparency);
|
||||
|
||||
setBoundingSphere(_size.value());
|
||||
}
|
||||
|
||||
bool RenderableRings::isReady() const {
|
||||
return _shader && _texture;
|
||||
}
|
||||
|
||||
bool RenderableRings::initialize() {
|
||||
if (!_shader) {
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
_shader = renderEngine.buildRenderProgram("RingProgram",
|
||||
"${MODULE_BASE}/shaders/rings_vs.glsl",
|
||||
"${MODULE_BASE}/shaders/rings_fs.glsl"
|
||||
);
|
||||
if (!_shader)
|
||||
return false;
|
||||
|
||||
_shader->setIgnoreUniformLocationError(
|
||||
ghoul::opengl::ProgramObject::IgnoreError::Yes
|
||||
);
|
||||
}
|
||||
|
||||
glGenVertexArrays(1, &_quad); // generate array
|
||||
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
|
||||
createPlane();
|
||||
|
||||
loadTexture();
|
||||
|
||||
return isReady();
|
||||
}
|
||||
|
||||
bool RenderableRings::deinitialize() {
|
||||
glDeleteVertexArrays(1, &_quad);
|
||||
_quad = 0;
|
||||
|
||||
glDeleteBuffers(1, &_vertexPositionBuffer);
|
||||
_vertexPositionBuffer = 0;
|
||||
|
||||
_textureFile = nullptr;
|
||||
_texture = nullptr;
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_shader) {
|
||||
renderEngine.removeRenderProgram(_shader);
|
||||
_shader = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RenderableRings::render(const RenderData& data) {
|
||||
_shader->activate();
|
||||
|
||||
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_shader->setUniform("ModelTransform", glm::mat4(_orientation * _state));
|
||||
_shader->setUniform("textureOffset", _offset);
|
||||
_shader->setUniform("transparency", _transparency);
|
||||
|
||||
_shader->setUniform("hasSunPosition", _hasSunPosition);
|
||||
if (_hasSunPosition) {
|
||||
_shader->setUniform("_nightFactor", _nightFactor);
|
||||
_shader->setUniform("sunPosition", _sunPosition);
|
||||
}
|
||||
|
||||
setPscUniforms(*_shader.get(), data.camera, data.position);
|
||||
|
||||
ghoul::opengl::TextureUnit unit;
|
||||
unit.activate();
|
||||
_texture->bind();
|
||||
_shader->setUniform("texture1", unit);
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glBindVertexArray(_quad);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
_shader->deactivate();
|
||||
}
|
||||
|
||||
void RenderableRings::update(const UpdateData& data) {
|
||||
if (_shader->isDirty()) {
|
||||
_shader->rebuildFromFile();
|
||||
}
|
||||
|
||||
if (_planeIsDirty) {
|
||||
createPlane();
|
||||
_planeIsDirty = false;
|
||||
}
|
||||
|
||||
if (_textureIsDirty) {
|
||||
loadTexture();
|
||||
_textureIsDirty = false;
|
||||
}
|
||||
|
||||
if (!_frame.empty()) {
|
||||
_state = SpiceManager::ref().positionTransformMatrix(_frame, "GALACTIC", data.time);
|
||||
}
|
||||
|
||||
if (!_body.empty()) {
|
||||
double lt;
|
||||
_sunPosition = SpiceManager::ref().targetPosition(
|
||||
"SUN",
|
||||
_body,
|
||||
"GALACTIC",
|
||||
{},
|
||||
data.time,
|
||||
lt
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void RenderableRings::loadTexture() {
|
||||
if (_texturePath.value() != "") {
|
||||
std::unique_ptr<ghoul::opengl::Texture> texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath));
|
||||
if (texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_texturePath) << "'");
|
||||
_texture = std::move(texture);
|
||||
|
||||
// Textures of planets looks much smoother with AnisotropicMipMap rather than linear
|
||||
// _texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
|
||||
_texture->uploadTexture();
|
||||
_texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap);
|
||||
|
||||
|
||||
_textureFile = std::make_unique<ghoul::filesystem::File>(_texturePath);
|
||||
_textureFile->setCallback(
|
||||
[&](const ghoul::filesystem::File&) { _textureIsDirty = true; }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderableRings::createPlane() {
|
||||
// ============================
|
||||
// GEOMETRY (quad)
|
||||
// ============================
|
||||
const GLfloat size = _size.value()[0];
|
||||
const GLfloat w = _size.value()[1];
|
||||
const GLfloat vertex_data[] = {
|
||||
// x y z w s t
|
||||
-size, -size, 0.f, w, 0.f, 0.f,
|
||||
size, size, 0.f, w, 1.f, 1.f,
|
||||
-size, size, 0.f, w, 0.f, 1.f,
|
||||
-size, -size, 0.f, w, 0.f, 0.f,
|
||||
size, -size, 0.f, w, 1.f, 0.f,
|
||||
size, size, 0.f, w, 1.f, 1.f,
|
||||
};
|
||||
|
||||
glBindVertexArray(_quad); // bind array
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer); // bind buffer
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data), vertex_data, GL_STATIC_DRAW);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, reinterpret_cast<void*>(0));
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, reinterpret_cast<void*>(sizeof(GLfloat) * 4));
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
87
modules/base/rendering/renderablerings.h
Normal file
87
modules/base/rendering/renderablerings.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby 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 __RENDERABLERINGS_H__
|
||||
#define __RENDERABLERINGS_H__
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/vectorproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace filesystem {
|
||||
class File;
|
||||
}
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
}
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
class RenderableRings : public Renderable {
|
||||
public:
|
||||
RenderableRings(const ghoul::Dictionary& dictionary);
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
void loadTexture();
|
||||
void createPlane();
|
||||
|
||||
properties::StringProperty _texturePath;
|
||||
properties::Vec2Property _size;
|
||||
properties::Vec2Property _offset;
|
||||
properties::FloatProperty _nightFactor;
|
||||
properties::FloatProperty _transparency;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
std::unique_ptr<ghoul::filesystem::File> _textureFile;
|
||||
|
||||
bool _textureIsDirty;
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
bool _planeIsDirty;
|
||||
|
||||
std::string _frame;
|
||||
glm::mat3 _orientation;
|
||||
glm::mat3 _state;
|
||||
|
||||
std::string _body;
|
||||
glm::vec3 _sunPosition;
|
||||
bool _hasSunPosition;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __RENDERABLERINGS_H__
|
||||
@@ -552,14 +552,16 @@ void RenderableStars::createDataSlice(ColorOption option) {
|
||||
position[0], position[1], position[2], position[3]
|
||||
} };
|
||||
|
||||
layout.value.bvColor = _fullData[i + 3];
|
||||
layout.value.luminance = _fullData[i + 4];
|
||||
layout.value.absoluteMagnitude = _fullData[i + 5];
|
||||
|
||||
|
||||
#ifdef USING_STELLAR_TEST_GRID
|
||||
layout.value.bvColor = _fullData[i + 3];
|
||||
layout.value.luminance = _fullData[i + 3];
|
||||
layout.value.absoluteMagnitude = _fullData[i + 3];
|
||||
#else
|
||||
layout.value.bvColor = _fullData[i + 3];
|
||||
layout.value.luminance = _fullData[i + 4];
|
||||
layout.value.absoluteMagnitude = _fullData[i + 5];
|
||||
#endif
|
||||
|
||||
_slicedData.insert(_slicedData.end(),
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace openspace {
|
||||
|
||||
class RenderableStars : public Renderable {
|
||||
public:
|
||||
RenderableStars(const ghoul::Dictionary& dictionary);
|
||||
explicit RenderableStars(const ghoul::Dictionary& dictionary);
|
||||
~RenderableStars();
|
||||
|
||||
bool initialize() override;
|
||||
|
||||
@@ -71,6 +71,10 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
|
||||
, _vBufferID(0)
|
||||
, _needsSweep(true)
|
||||
, _oldTime(std::numeric_limits<double>::max())
|
||||
, _tropic(0.f)
|
||||
, _ratio(0.f)
|
||||
, _day(0.f)
|
||||
, _increment(0.f)
|
||||
{
|
||||
_successfullDictionaryFetch &= dictionary.getValue(keyBody, _target);
|
||||
_successfullDictionaryFetch &= dictionary.getValue(keyObserver, _observer);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace openspace {
|
||||
|
||||
class RenderableTrail : public Renderable {
|
||||
public:
|
||||
RenderableTrail(const ghoul::Dictionary& dictionary);
|
||||
explicit RenderableTrail(const ghoul::Dictionary& dictionary);
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
93
modules/base/shaders/rings_fs.glsl
Normal file
93
modules/base/shaders/rings_fs.glsl
Normal file
@@ -0,0 +1,93 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby 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 "PowerScaling/powerScaling_fs.hglsl"
|
||||
#include "fragment.glsl"
|
||||
|
||||
in vec2 vs_st;
|
||||
in vec4 vs_position;
|
||||
|
||||
uniform sampler1D texture1;
|
||||
uniform vec2 textureOffset;
|
||||
uniform float transparency;
|
||||
|
||||
uniform bool hasSunPosition;
|
||||
uniform vec3 sunPosition;
|
||||
uniform float _nightFactor;
|
||||
|
||||
Fragment getFragment() {
|
||||
vec4 position = vs_position;
|
||||
float depth = pscDepth(position);
|
||||
|
||||
// Moving the origin to the center
|
||||
vec2 st = (vs_st - vec2(0.5)) * 2.0;
|
||||
|
||||
// The length of the texture coordinates vector is our distance from the center
|
||||
float radius = length(st);
|
||||
|
||||
// We only want to consider ring-like objects so we need to discard everything else
|
||||
if (radius > 1.0)
|
||||
discard;
|
||||
|
||||
// Remapping the texture coordinates
|
||||
// Radius \in [0,1], texCoord \in [textureOffset.x, textureOffset.y]
|
||||
// textureOffset.x -> 0
|
||||
// textureOffset.y -> 1
|
||||
float texCoord = (radius - textureOffset.x) / (textureOffset.y - textureOffset.x);
|
||||
if (texCoord < 0.f || texCoord > 1.f)
|
||||
discard;
|
||||
|
||||
vec4 diffuse = texture(texture1, texCoord);
|
||||
float colorValue = length(diffuse.rgb);
|
||||
// times 3 as length of vec3(1.0, 1.0, 1.0) will return 3 and we want
|
||||
// to normalize the transparency value to [0,1]
|
||||
if (colorValue < 3*transparency) {
|
||||
diffuse.a = pow(colorValue / (3*transparency), 1);
|
||||
}
|
||||
|
||||
if (hasSunPosition) {
|
||||
// The normal for the one plane depends on whether we are dealing
|
||||
// with a front facing or back facing fragment
|
||||
vec3 normal;
|
||||
// The plane is oriented on the xz plane
|
||||
// WARNING: This might not be the case for Uranus
|
||||
if (gl_FrontFacing) {
|
||||
normal = vec3(0.0, 1.0, 0.0);
|
||||
}
|
||||
else {
|
||||
normal = vec3(0.0, -1.0, 0.0);
|
||||
}
|
||||
|
||||
// Reduce the color of the fragment by the user factor
|
||||
// if we are facing away from the Sun
|
||||
if (dot(sunPosition, normal) < 0)
|
||||
diffuse.xyz *= _nightFactor;
|
||||
}
|
||||
|
||||
Fragment frag;
|
||||
frag.color = diffuse;
|
||||
frag.depth = depth;
|
||||
return frag;
|
||||
|
||||
}
|
||||
47
modules/base/shaders/rings_vs.glsl
Normal file
47
modules/base/shaders/rings_vs.glsl
Normal file
@@ -0,0 +1,47 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
|
||||
layout(location = 0) in vec4 in_position;
|
||||
layout(location = 1) in vec2 in_st;
|
||||
|
||||
out vec2 vs_st;
|
||||
out vec4 vs_position;
|
||||
|
||||
uniform mat4 ViewProjection;
|
||||
uniform mat4 ModelTransform;
|
||||
|
||||
void main() {
|
||||
vec4 tmp = in_position;
|
||||
vec4 position = pscTransform(tmp, ModelTransform);
|
||||
|
||||
vs_position = tmp;
|
||||
vs_st = in_st;
|
||||
|
||||
position = ViewProjection * position;
|
||||
gl_Position = z_normalization(position);
|
||||
}
|
||||
@@ -59,9 +59,11 @@ namespace openspace {
|
||||
|
||||
DebugRenderer::~DebugRenderer()
|
||||
{
|
||||
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
|
||||
|
||||
const DebugRenderer& DebugRenderer::ref() {
|
||||
if (_reference == nullptr) {
|
||||
try {
|
||||
@@ -102,6 +104,7 @@ namespace openspace {
|
||||
&clippingSpacePoints[0],
|
||||
GL_STATIC_DRAW);
|
||||
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(clippingSpacePoints[0]), 0);
|
||||
|
||||
@@ -121,6 +124,7 @@ namespace openspace {
|
||||
_programObject->deactivate();
|
||||
}
|
||||
|
||||
|
||||
void DebugRenderer::renderBoxFaces(const Vertices& clippingSpaceBoxCorners, RGBA rgba) const {
|
||||
ghoul_assert(clippingSpaceBoxCorners.size() == 8, "Box must have 8 vertices");
|
||||
const Vertices& V = clippingSpaceBoxCorners;
|
||||
@@ -131,6 +135,7 @@ namespace openspace {
|
||||
T.push_back(V[1]); T.push_back(V[0]); T.push_back(V[4]);
|
||||
T.push_back(V[4]); T.push_back(V[5]); T.push_back(V[1]);
|
||||
|
||||
|
||||
T.push_back(V[3]); T.push_back(V[1]); T.push_back(V[5]);
|
||||
T.push_back(V[5]); T.push_back(V[7]); T.push_back(V[3]);
|
||||
|
||||
@@ -167,6 +172,7 @@ namespace openspace {
|
||||
lineVertices.push_back(V[1]); lineVertices.push_back(V[3]);
|
||||
lineVertices.push_back(V[4]); lineVertices.push_back(V[6]);
|
||||
lineVertices.push_back(V[5]); lineVertices.push_back(V[7]);
|
||||
|
||||
DebugRenderer::ref().renderVertices(lineVertices, GL_LINES, rgba);
|
||||
}
|
||||
|
||||
@@ -245,4 +251,5 @@ namespace openspace {
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -146,6 +146,7 @@ namespace openspace {
|
||||
protected:
|
||||
std::unique_ptr<ProgramObject> _programObject;
|
||||
|
||||
|
||||
// A raw pointer for the reason that it should not be deleted by the static
|
||||
// destructor and the normal destructor. This class has ownership
|
||||
static DebugRenderer* _reference;
|
||||
|
||||
@@ -158,7 +158,7 @@ else (WIN32)
|
||||
target_include_directories(
|
||||
openspace-module-globebrowsing
|
||||
SYSTEM PUBLIC
|
||||
${GDAL_INCLUDE}
|
||||
${GDAL_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#define __CHUNK_INDEX_H__
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
@@ -30,13 +30,6 @@
|
||||
#include "PowerScaling/powerScaling_fs.hglsl"
|
||||
|
||||
|
||||
|
||||
// The heightmaps is only used in the fragment shader visually debugging
|
||||
// the alignment and resolution of the heightmaps
|
||||
#include <${MODULE_GLOBEBROWSING}/shaders/tilevertexheight.hglsl>
|
||||
|
||||
|
||||
|
||||
// Below are all the tiles that are used for contributing
|
||||
// the actual fragment color
|
||||
|
||||
@@ -88,6 +81,54 @@ in vec3 ellipsoidNormalCameraSpace;
|
||||
in LevelWeights levelWeights;
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
// The heightmaps is only used in the fragment shader visually debugging
|
||||
// the alignment and resolution of the heightmaps
|
||||
|
||||
#if USE_HEIGHTMAP
|
||||
uniform Tile HeightMaps[NUMLAYERS_HEIGHTMAP];
|
||||
uniform Tile HeightMapsParent1[NUMLAYERS_HEIGHTMAP];
|
||||
uniform Tile HeightMapsParent2[NUMLAYERS_HEIGHTMAP];
|
||||
#endif // USE_HEIGHTMAP
|
||||
|
||||
#if USE_HEIGHTMAP_OVERLAY
|
||||
uniform Tile HeightMapOverlays[NUMLAYERS_HEIGHTMAP_OVERLAY];
|
||||
uniform Tile HeightMapOverlaysParent1[NUMLAYERS_HEIGHTMAP_OVERLAY];
|
||||
uniform Tile HeightMapOverlaysParent2[NUMLAYERS_HEIGHTMAP_OVERLAY];
|
||||
#endif // USE_HEIGHTMAP_OVERLAY
|
||||
|
||||
float getUntransformedTileVertexHeight(vec2 uv, LevelWeights levelWeights){
|
||||
float height = CHUNK_DEFAULT_HEIGHT;
|
||||
|
||||
#if USE_HEIGHTMAP
|
||||
// Calculate desired level based on distance to the vertex on the ellipsoid
|
||||
// Before any heightmapping is done
|
||||
height = calculateUntransformedHeight(
|
||||
uv,
|
||||
levelWeights, // Variable to determine which texture to sample from
|
||||
HeightMaps, HeightMapsParent1, HeightMapsParent2); // Three textures to sample from
|
||||
|
||||
#endif // USE_HEIGHTMAP
|
||||
|
||||
#if USE_HEIGHTMAP_OVERLAY
|
||||
height = calculateUntransformedHeightOverlay(
|
||||
height,
|
||||
uv,
|
||||
levelWeights, // Variable to determine which texture to sample from
|
||||
HeightMapOverlays, HeightMapOverlaysParent1, HeightMapOverlaysParent2); // Three textures to sample from
|
||||
|
||||
#endif // USE_HEIGHTMAP_OVERLAY
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This method defines the fragment color pipeline which is used in both
|
||||
* the local and global chunk rendering.
|
||||
@@ -193,4 +234,5 @@ vec4 getTileFragColor(){
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
#endif ///TILE_FRAG_COLOR_HGLSL
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifndef __TILE_PROVIDER_H__
|
||||
#define __TILE_PROVIDER_H__
|
||||
|
||||
#include "gdal_priv.h"
|
||||
#include <gdal_priv.h>
|
||||
|
||||
#include <openspace/engine/downloadmanager.h>
|
||||
#include <set>
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace openspace {
|
||||
struct TileProviderGroup {
|
||||
|
||||
void update();
|
||||
const std::vector<std::shared_ptr<TileProvider>> TileProviderGroup::getActiveTileProviders() const;
|
||||
const std::vector<std::shared_ptr<TileProvider>> getActiveTileProviders() const;
|
||||
|
||||
|
||||
std::vector<NamedTileProvider> tileProviders;
|
||||
@@ -52,6 +52,8 @@ RenderableCrawlingLine::RenderableCrawlingLine(const ghoul::Dictionary& dictiona
|
||||
, _imageSequenceTime(-1.f)
|
||||
, _vao(0)
|
||||
, _vbo(0)
|
||||
, _frameCounter(0)
|
||||
, _drawLine(false)
|
||||
{
|
||||
dictionary.getValue(KeySource, _source);
|
||||
dictionary.getValue(KeyTarget, _target);
|
||||
@@ -75,7 +77,6 @@ bool RenderableCrawlingLine::isReady() const {
|
||||
}
|
||||
|
||||
bool RenderableCrawlingLine::initialize() {
|
||||
_frameCounter = 0;
|
||||
bool completeSuccess = true;
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
|
||||
@@ -24,30 +24,20 @@
|
||||
|
||||
#include <modules/newhorizons/rendering/renderablefov.h>
|
||||
|
||||
#include <openspace/engine/configurationmanager.h>
|
||||
#include <modules/newhorizons/util/imagesequencer.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
#include <modules/newhorizons/util/imagesequencer.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
|
||||
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
#include <openspace/query/query.h>
|
||||
#include <glm/gtx/projection.hpp>
|
||||
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <iomanip>
|
||||
#include <utility>
|
||||
#include <chrono>
|
||||
#include <openspace/performance/performancemeasurement.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "RenderableFov";
|
||||
//constants
|
||||
|
||||
const std::string keyBody = "Body";
|
||||
const std::string keyFrame = "Frame";
|
||||
const std::string keyPathModule = "ModulePath";
|
||||
@@ -56,6 +46,9 @@ namespace {
|
||||
const std::string keyInstrumentMethod = "Instrument.Method";
|
||||
const std::string keyInstrumentAberration = "Instrument.Aberration";
|
||||
const std::string keyPotentialTargets = "PotentialTargets";
|
||||
|
||||
const int InterpolationSteps = 10;
|
||||
const int Stride = 8;
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
@@ -68,6 +61,10 @@ RenderableFov::RenderableFov(const ghoul::Dictionary& dictionary)
|
||||
, _texture(nullptr)
|
||||
, _drawFOV(false)
|
||||
, _mode(GL_LINES)
|
||||
//, _interceptTag{false, false, false, false, false, false, false, false}
|
||||
, _withinFOV(false)
|
||||
, _vBoundsSize(0)
|
||||
, _vPlaneSize(40)
|
||||
{
|
||||
bool success = dictionary.getValue(keyBody, _spacecraft);
|
||||
ghoul_assert(success, "");
|
||||
@@ -109,16 +106,12 @@ void RenderableFov::allocateData() {
|
||||
_bounds = std::move(res.bounds);
|
||||
_boresight = std::move(res.boresightVector);
|
||||
|
||||
_stride = 8;
|
||||
|
||||
_projectionBounds.resize(_bounds.size());
|
||||
int initBoundPoints = 2 * (_bounds.size() + 1);
|
||||
_fovBounds.resize(initBoundPoints*_stride);
|
||||
_fovBounds.resize(initBoundPoints * Stride);
|
||||
_vBoundsSize = static_cast<unsigned int>(_fovBounds.size());
|
||||
// allocate second vbo data
|
||||
_fovPlane.resize(40);
|
||||
_vPlaneSize = 40;
|
||||
_isteps = 10; // Interpolation steps per intersecting segment
|
||||
_fovPlane.resize(_vPlaneSize);
|
||||
|
||||
}
|
||||
catch (const SpiceManager::SpiceException& e) {
|
||||
@@ -126,10 +119,6 @@ void RenderableFov::allocateData() {
|
||||
}
|
||||
}
|
||||
|
||||
RenderableFov::~RenderableFov() {
|
||||
deinitialize();
|
||||
}
|
||||
|
||||
bool RenderableFov::initialize() {
|
||||
bool completeSuccess = true;
|
||||
if (_programObject == nullptr) {
|
||||
@@ -172,7 +161,7 @@ void RenderableFov::sendToGPU() {
|
||||
glBufferData(GL_ARRAY_BUFFER, _vBoundsSize * sizeof(GLfloat), NULL, GL_STATIC_DRAW); // orphaning the buffer, sending NULL data.
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, _vBoundsSize * sizeof(GLfloat), _fovBounds.data());
|
||||
|
||||
GLsizei st = sizeof(GLfloat) * _stride;
|
||||
GLsizei st = sizeof(GLfloat) * Stride;
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
glEnableVertexAttribArray(1);
|
||||
@@ -199,20 +188,22 @@ void RenderableFov::sendToGPU() {
|
||||
}
|
||||
|
||||
void RenderableFov::updateGPU() {
|
||||
PerfMeasure("updateGPU");
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _fovBoundsVBO);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, _vBoundsSize * sizeof(GLfloat), _fovBounds.data());
|
||||
if (!_rebuild){
|
||||
if (!_rebuild) {
|
||||
// no new points
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _fovPlaneVBO);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, _vPlaneSize * sizeof(GLfloat), _fovPlane.data());
|
||||
}else{
|
||||
}
|
||||
else {
|
||||
// new points - memory change
|
||||
glBindVertexArray(_fovPlaneVAO);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _fovPlaneVBO);
|
||||
glBufferData(GL_ARRAY_BUFFER, _vPlaneSize * sizeof(GLfloat), NULL, GL_STATIC_DRAW); // orphaning the buffer, sending NULL data.
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, _vPlaneSize * sizeof(GLfloat), _fovPlane.data());
|
||||
|
||||
GLsizei st = sizeof(GLfloat) * _stride;
|
||||
GLsizei st = sizeof(GLfloat) * Stride;
|
||||
glEnableVertexAttribArray(0);
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, st, (void*)0);
|
||||
@@ -268,8 +259,9 @@ psc RenderableFov::checkForIntercept(glm::dvec3 ray) {
|
||||
}
|
||||
// Orthogonal projection next to planets surface
|
||||
psc RenderableFov::orthogonalProjection(glm::dvec3 vecFov) {
|
||||
double lt;
|
||||
glm::dvec3 vecToTarget =
|
||||
SpiceManager::ref().targetPosition(_fovTarget, _spacecraft, _frame, _aberrationCorrection, _time, _lt);
|
||||
SpiceManager::ref().targetPosition(_fovTarget, _spacecraft, _frame, _aberrationCorrection, _time, lt);
|
||||
vecFov = SpiceManager::ref().frameTransformationMatrix(_instrumentID, _frame, _time) * vecFov;
|
||||
glm::dvec3 p = glm::proj(vecToTarget, vecFov);
|
||||
|
||||
@@ -279,7 +271,9 @@ psc RenderableFov::orthogonalProjection(glm::dvec3 vecFov) {
|
||||
return projection;
|
||||
}
|
||||
// Bisection method, simple recurtion
|
||||
glm::dvec3 RenderableFov::bisection(glm::dvec3 p1, glm::dvec3 p2, double tolerance) {
|
||||
glm::dvec3 RenderableFov::bisection(glm::dvec3 p1, glm::dvec3 p2) {
|
||||
const double Tolerance = 0.000000001; // very low tolerance factor
|
||||
|
||||
//check if point is on surface
|
||||
glm::dvec3 half = interpolate(p1, p2, 0.5f);
|
||||
|
||||
@@ -302,53 +296,52 @@ glm::dvec3 RenderableFov::bisection(glm::dvec3 p1, glm::dvec3 p2, double toleran
|
||||
ivec = result.surfaceVector;
|
||||
bool intercepted = result.interceptFound;
|
||||
|
||||
if (glm::distance(_previousHalf, half) < tolerance){
|
||||
if (glm::distance(_previousHalf, half) < Tolerance) {
|
||||
_previousHalf = glm::dvec3(0);
|
||||
return half;
|
||||
}
|
||||
_previousHalf = half;
|
||||
//recursive search
|
||||
if (!intercepted){
|
||||
return bisection(p1, half, tolerance);
|
||||
if (!intercepted) {
|
||||
return bisection(p1, half);
|
||||
}
|
||||
else{
|
||||
return bisection(half, p2, tolerance);
|
||||
else {
|
||||
return bisection(half, p2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RenderableFov::fovSurfaceIntercept(bool H[], std::vector<glm::dvec3> bounds) {
|
||||
_nrInserted = 0;
|
||||
_fovPlane.clear();// empty the array
|
||||
|
||||
double tolerance = 0.000000001; // very low tolerance factor
|
||||
_fovPlane.clear(); // empty the array
|
||||
|
||||
glm::dvec3 mid;
|
||||
glm::dvec3 interpolated;
|
||||
glm::dvec3 current;
|
||||
glm::dvec3 next;
|
||||
glm::vec4 tmp(1);
|
||||
if (bounds.size() > 1){
|
||||
for (int i = 0; i < bounds.size(); i++){
|
||||
if (bounds.size() > 1) {
|
||||
for (int i = 0; i < bounds.size(); ++i) {
|
||||
int k = (i + 1 > bounds.size() - 1) ? 0 : i + 1;
|
||||
|
||||
current = bounds[i];
|
||||
next = bounds[k];
|
||||
|
||||
if (H[i] == false){ // If point is non-interceptive, project it.
|
||||
if (H[i] == false) { // If point is non-interceptive, project it.
|
||||
insertPoint(_fovPlane, orthogonalProjection(current).vec4(), tmp);
|
||||
if (H[i + 1] == false && _withinFOV){
|
||||
if (H[i + 1] == false && _withinFOV) {
|
||||
// IFF incident point is also non-interceptive BUT something is within FOV
|
||||
// we need then to check if this segment makes contact with surface
|
||||
glm::dvec3 half = interpolate(current, next, 0.5f);
|
||||
|
||||
std::string bodyfixed = "IAU_";
|
||||
bool convert = (_frame.find(bodyfixed) == std::string::npos);
|
||||
if (convert)
|
||||
if (convert) {
|
||||
bodyfixed = SpiceManager::ref().frameFromBody(_fovTarget);
|
||||
else
|
||||
}
|
||||
else {
|
||||
bodyfixed = _frame;
|
||||
|
||||
}
|
||||
|
||||
SpiceManager::SurfaceInterceptResult res =
|
||||
SpiceManager::ref().surfaceIntercept(_fovTarget, _spacecraft,
|
||||
@@ -362,15 +355,14 @@ void RenderableFov::fovSurfaceIntercept(bool H[], std::vector<glm::dvec3> bounds
|
||||
ivec = res.surfaceVector;
|
||||
bool intercepted = res.interceptFound;
|
||||
|
||||
|
||||
if (intercepted){
|
||||
if (intercepted) {
|
||||
// find the two outer most points of intersection
|
||||
glm::dvec3 root1 = bisection(half, current, tolerance);
|
||||
glm::dvec3 root2 = bisection(half, next, tolerance);
|
||||
glm::dvec3 root1 = bisection(half, current);
|
||||
glm::dvec3 root2 = bisection(half, next);
|
||||
|
||||
insertPoint(_fovPlane, orthogonalProjection(root1).vec4(), col_sq);
|
||||
for (int j = 1; j < _isteps; j++){
|
||||
float t = (static_cast<float>(j) / _isteps);
|
||||
for (int j = 1; j < InterpolationSteps; ++j) {
|
||||
float t = (static_cast<float>(j) / InterpolationSteps);
|
||||
interpolated = interpolate(root1, root2, t);
|
||||
_interceptVector = checkForIntercept(interpolated);
|
||||
insertPoint(_fovPlane, _interceptVector.vec4(), col_sq);
|
||||
@@ -379,28 +371,28 @@ void RenderableFov::fovSurfaceIntercept(bool H[], std::vector<glm::dvec3> bounds
|
||||
}
|
||||
}
|
||||
}
|
||||
if (H[i] == true && H[i + 1] == false){ // current point is interceptive, next is not
|
||||
if (H[i] == true && H[i + 1] == false) { // current point is interceptive, next is not
|
||||
// find outer most point for interpolation
|
||||
mid = bisection(current, next, tolerance);
|
||||
for (int j = 1; j <= _isteps; j++){
|
||||
float t = (static_cast<float>(j) / _isteps);
|
||||
mid = bisection(current, next);
|
||||
for (int j = 1; j <= InterpolationSteps; ++j) {
|
||||
float t = (static_cast<float>(j) / InterpolationSteps);
|
||||
interpolated = interpolate(current, mid, t);
|
||||
_interceptVector = (j < _isteps) ? checkForIntercept(interpolated) : orthogonalProjection(interpolated);
|
||||
_interceptVector = (j < InterpolationSteps) ? checkForIntercept(interpolated) : orthogonalProjection(interpolated);
|
||||
insertPoint(_fovPlane, _interceptVector.vec4(), col_sq);
|
||||
}
|
||||
}
|
||||
if (H[i] == false && H[i + 1] == true){ // current point is non-interceptive, next is
|
||||
mid = bisection(next, current, tolerance);
|
||||
for (int j = 1; j <= _isteps; j++){
|
||||
float t = (static_cast<float>(j) / _isteps);
|
||||
mid = bisection(next, current);
|
||||
for (int j = 1; j <= InterpolationSteps; ++j) {
|
||||
float t = (static_cast<float>(j) / InterpolationSteps);
|
||||
interpolated = interpolate(mid, next, t);
|
||||
_interceptVector = (j > 1) ? checkForIntercept(interpolated) : orthogonalProjection(interpolated);
|
||||
insertPoint(_fovPlane, _interceptVector.vec4(), col_sq);
|
||||
}
|
||||
}
|
||||
if (H[i] == true && H[i + 1] == true){ // both points intercept
|
||||
for (int j = 0; j <= _isteps; j++){
|
||||
float t = (static_cast<float>(j) / _isteps);
|
||||
for (int j = 0; j <= InterpolationSteps; ++j) {
|
||||
float t = (static_cast<float>(j) / InterpolationSteps);
|
||||
interpolated = interpolate(current, next, t);
|
||||
_interceptVector = checkForIntercept(interpolated);
|
||||
insertPoint(_fovPlane, _interceptVector.vec4(), col_sq);
|
||||
@@ -408,7 +400,7 @@ void RenderableFov::fovSurfaceIntercept(bool H[], std::vector<glm::dvec3> bounds
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_nrInserted == 0){
|
||||
if (_nrInserted == 0) {
|
||||
_rebuild = false;
|
||||
}
|
||||
else {
|
||||
@@ -428,7 +420,8 @@ void RenderableFov::computeColors() {
|
||||
if (diff <= interpolationStart)
|
||||
t = static_cast<float>(1.0 - (diff / interpolationStart));
|
||||
|
||||
if (diff < 0.0) t = 0.f;
|
||||
if (diff < 0.0)
|
||||
t = 0.f;
|
||||
|
||||
// This is a bit hardcoded - either we go for color tables
|
||||
// or make these properties.
|
||||
@@ -451,35 +444,39 @@ void RenderableFov::computeColors() {
|
||||
col_end.w = alpha;
|
||||
}
|
||||
|
||||
void RenderableFov::determineTarget(){
|
||||
void RenderableFov::determineTarget() {
|
||||
PerfMeasure("determineTarget");
|
||||
_fovTarget = _potentialTargets[0]; //default;
|
||||
for (int i = 0; i < _potentialTargets.size(); i++){
|
||||
for (int i = 0; i < _potentialTargets.size(); ++i) {
|
||||
_withinFOV = openspace::SpiceManager::ref().isTargetInFieldOfView(
|
||||
_potentialTargets[i], _spacecraft,
|
||||
|
||||
_potentialTargets[i],
|
||||
_spacecraft,
|
||||
_instrumentID,
|
||||
SpiceManager::FieldOfViewMethod::Ellipsoid,
|
||||
_aberrationCorrection,
|
||||
SpiceManager::FieldOfViewMethod::Ellipsoid,
|
||||
_aberrationCorrection,
|
||||
_time
|
||||
);
|
||||
if (_withinFOV){
|
||||
);
|
||||
if (_withinFOV) {
|
||||
_fovTarget = _potentialTargets[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderableFov::computeIntercepts(const RenderData& data){
|
||||
void RenderableFov::computeIntercepts(const RenderData& data) {
|
||||
PerfMeasure("computeIntercepts");
|
||||
// for each FOV vector
|
||||
_fovBounds.clear();
|
||||
for (int i = 0; i <= _bounds.size(); i++){
|
||||
for (int i = 0; i <= _bounds.size(); ++i) {
|
||||
int r = (i == _bounds.size()) ? 0 : i;
|
||||
std::string bodyfixed = "IAU_";
|
||||
bool convert = (_frame.find(bodyfixed) == std::string::npos);
|
||||
if (convert)
|
||||
if (convert) {
|
||||
bodyfixed = SpiceManager::ref().frameFromBody(_fovTarget);
|
||||
else
|
||||
}
|
||||
else {
|
||||
bodyfixed = _frame;
|
||||
}
|
||||
|
||||
SpiceManager::SurfaceInterceptResult res =
|
||||
SpiceManager::ref().surfaceIntercept(_fovTarget, _spacecraft,
|
||||
@@ -494,23 +491,25 @@ void RenderableFov::computeIntercepts(const RenderData& data){
|
||||
_interceptTag[r] = res.interceptFound;
|
||||
|
||||
// if not found, use the orthogonal projected point
|
||||
if (!_interceptTag[r]) _projectionBounds[r] = orthogonalProjection(_bounds[r]);
|
||||
if (!_interceptTag[r]) {
|
||||
_projectionBounds[r] = orthogonalProjection(_bounds[r]);
|
||||
}
|
||||
|
||||
glm::vec4 fovOrigin = glm::vec4(0); //This will have to be fixed once spacecraft is 1:1!
|
||||
|
||||
if (_interceptTag[r]){
|
||||
if (_interceptTag[r]) {
|
||||
_interceptVector = PowerScaledCoordinate::CreatePowerScaledCoordinate(ivec[0], ivec[1], ivec[2]);
|
||||
_interceptVector[3] += 3;
|
||||
// INTERCEPTIONS
|
||||
insertPoint(_fovBounds, fovOrigin, col_start);
|
||||
insertPoint(_fovBounds, _interceptVector.vec4(), col_end);
|
||||
}
|
||||
else if (_withinFOV){
|
||||
else if (_withinFOV) {
|
||||
// OBJECT IN FOV, NO INTERCEPT FOR THIS FOV-RAY
|
||||
insertPoint(_fovBounds, fovOrigin, glm::vec4(0, 0, 1, 1));
|
||||
insertPoint(_fovBounds, _projectionBounds[r].vec4(), col_blue);
|
||||
}
|
||||
else{
|
||||
else {
|
||||
glm::vec4 corner(_bounds[r][0], _bounds[r][1], _bounds[r][2], data.position[3] + 2);
|
||||
corner = _spacecraftRotation*corner;
|
||||
// NONE OF THE FOV-RAYS INTERCEPT AND NO OBJECT IN FOV
|
||||
@@ -522,13 +521,16 @@ void RenderableFov::computeIntercepts(const RenderData& data){
|
||||
fovSurfaceIntercept(_interceptTag, _bounds);
|
||||
|
||||
glm::vec3 aim = (_spacecraftRotation * glm::vec4(_boresight, 1)).xyz();
|
||||
double lt;
|
||||
glm::dvec3 position =
|
||||
SpiceManager::ref().targetPosition(_fovTarget,
|
||||
_spacecraft,
|
||||
_frame,
|
||||
_aberrationCorrection,
|
||||
_time,
|
||||
_lt);
|
||||
SpiceManager::ref().targetPosition(
|
||||
_fovTarget,
|
||||
_spacecraft,
|
||||
_frame,
|
||||
_aberrationCorrection,
|
||||
_time,
|
||||
lt
|
||||
);
|
||||
psc p = PowerScaledCoordinate::CreatePowerScaledCoordinate(position.x, position.y, position.z);
|
||||
pss length = p.length();
|
||||
if (length[0] < DBL_EPSILON) {
|
||||
@@ -536,7 +538,7 @@ void RenderableFov::computeIntercepts(const RenderData& data){
|
||||
return;
|
||||
}
|
||||
//if aimed 80 deg away from target, dont draw white square
|
||||
if (glm::dot(glm::normalize(aim), glm::normalize(p.vec3())) < 0.2){
|
||||
if (glm::dot(glm::normalize(aim), glm::normalize(p.vec3())) < 0.2) {
|
||||
_drawFOV = false;
|
||||
}
|
||||
}
|
||||
@@ -551,12 +553,14 @@ void RenderableFov::render(const RenderData& data) {
|
||||
_programObject->setUniform("ModelTransform", glm::mat4(1));
|
||||
setPscUniforms(*_programObject.get(), data.camera, data.position);
|
||||
|
||||
if (openspace::ImageSequencer::ref().isReady())
|
||||
if (openspace::ImageSequencer::ref().isReady()) {
|
||||
_drawFOV = ImageSequencer::ref().instrumentActive(_instrumentID);
|
||||
}
|
||||
|
||||
if (_drawFOV){
|
||||
if (_drawFOV) {
|
||||
// update only when time progresses.
|
||||
if (_oldTime != _time){
|
||||
if (_oldTime != _time) {
|
||||
PerfMeasure("Total");
|
||||
determineTarget();
|
||||
computeColors();
|
||||
computeIntercepts(data);
|
||||
@@ -567,13 +571,13 @@ void RenderableFov::render(const RenderData& data) {
|
||||
|
||||
glLineWidth(_lineWidth);
|
||||
glBindVertexArray(_fovBoundsVAO);
|
||||
glDrawArrays(_mode, 0, static_cast<int>(_vBoundsSize / _stride));
|
||||
glDrawArrays(_mode, 0, static_cast<int>(_vBoundsSize / Stride));
|
||||
glBindVertexArray(0);
|
||||
|
||||
if (_drawFOV){
|
||||
if (_drawFOV) {
|
||||
glLineWidth(2.f);
|
||||
glBindVertexArray(_fovPlaneVAO);
|
||||
glDrawArrays(GL_LINE_LOOP, 0, static_cast<int>(_vPlaneSize / _stride));
|
||||
glDrawArrays(GL_LINE_LOOP, 0, static_cast<int>(_vPlaneSize / Stride));
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
glLineWidth(1.f);
|
||||
@@ -584,12 +588,7 @@ void RenderableFov::render(const RenderData& data) {
|
||||
void RenderableFov::update(const UpdateData& data) {
|
||||
_time = data.time;
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix(_instrumentID, _frame, data.time);
|
||||
_spacecraftRotation = glm::mat4(1);
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 3; j++){
|
||||
_spacecraftRotation[i][j] = static_cast<float>(_stateMatrix[i][j]);
|
||||
}
|
||||
}
|
||||
_spacecraftRotation = glm::mat4(_stateMatrix);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -22,28 +22,30 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __RenderableFov_H__
|
||||
#define __RenderableFov_H__
|
||||
#ifndef __RENDERABLEFOV_H__
|
||||
#define __RENDERABLEFOV_H__
|
||||
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/query/query.h>
|
||||
|
||||
// ghoul includes
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
//#include <openspace/util/runtimedata.h>
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
|
||||
} // namespace opengl
|
||||
} // namespace ghoul
|
||||
|
||||
namespace openspace {
|
||||
class RenderableFov : public Renderable{
|
||||
|
||||
class RenderableFov : public Renderable {
|
||||
public:
|
||||
RenderableFov(const ghoul::Dictionary& dictionary);
|
||||
~RenderableFov();
|
||||
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
@@ -53,14 +55,6 @@ public:
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
// properties
|
||||
properties::FloatProperty _lineWidth;
|
||||
properties::BoolProperty _drawSolid;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
|
||||
ghoul::opengl::Texture* _texture;
|
||||
openspace::SceneGraphNode* _targetNode;
|
||||
|
||||
// class methods
|
||||
void loadTexture();
|
||||
void allocateData();
|
||||
void insertPoint(std::vector<float>& arr, glm::vec4 p, glm::vec4 c);
|
||||
@@ -70,18 +64,23 @@ public:
|
||||
void sendToGPU();
|
||||
|
||||
|
||||
// helper methods
|
||||
void computeColors();
|
||||
void computeIntercepts(const RenderData& data);
|
||||
psc orthogonalProjection(glm::dvec3 camvec);
|
||||
psc checkForIntercept(glm::dvec3 ray);
|
||||
psc pscInterpolate(psc p0, psc p1, float t);
|
||||
glm::dvec3 interpolate(glm::dvec3 p0, glm::dvec3 p1, float t);
|
||||
glm::dvec3 bisection(glm::dvec3 p1, glm::dvec3 p2, double tolerance);
|
||||
glm::dvec3 bisection(glm::dvec3 p1, glm::dvec3 p2);
|
||||
|
||||
// properties
|
||||
properties::FloatProperty _lineWidth;
|
||||
properties::BoolProperty _drawSolid;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
|
||||
ghoul::opengl::Texture* _texture;
|
||||
|
||||
|
||||
// instance variables
|
||||
int _nrInserted = 0;
|
||||
int _isteps;
|
||||
bool _rebuild = false;
|
||||
bool _interceptTag[8];
|
||||
bool _withinFOV;
|
||||
@@ -106,7 +105,6 @@ public:
|
||||
std::vector<glm::dvec3> _bounds;
|
||||
std::vector<std::string> _potentialTargets;
|
||||
bool _drawFOV;
|
||||
double _lt;
|
||||
|
||||
// GPU
|
||||
GLuint _fovBoundsVAO;
|
||||
@@ -116,7 +114,6 @@ public:
|
||||
GLuint _fovPlaneVBO;
|
||||
unsigned int _vPlaneSize;
|
||||
GLenum _mode;
|
||||
unsigned int _stride;
|
||||
|
||||
// time
|
||||
double _time = 0;
|
||||
@@ -129,7 +126,8 @@ public:
|
||||
glm::vec4 col_end; // intersection end color
|
||||
glm::vec4 col_blue; // withinFov color
|
||||
glm::vec4 col_gray; // no intersection color
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __RENDERABLEFOV_H__
|
||||
|
||||
@@ -207,7 +207,7 @@ void RenderablePlaneProjection::loadTexture() {
|
||||
}
|
||||
}
|
||||
|
||||
void RenderablePlaneProjection::updatePlane(const Image img, double currentTime) {
|
||||
void RenderablePlaneProjection::updatePlane(const Image& img, double currentTime) {
|
||||
|
||||
std::string frame;
|
||||
std::vector<glm::dvec3> bounds;
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
private:
|
||||
void loadTexture();
|
||||
void updatePlane(const Image img, double currentTime);
|
||||
void updatePlane(const Image& img, double currentTime);
|
||||
std::string findClosestTarget(double currentTime);
|
||||
void setTarget(std::string body);
|
||||
|
||||
|
||||
@@ -22,33 +22,31 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/engine/configurationmanager.h>
|
||||
#include <modules/newhorizons/rendering/renderableshadowcylinder.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
#include <ghoul/filesystem/filesystem>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "RenderablePlane";
|
||||
const std::string _keyType = "TerminatorType";
|
||||
const std::string _keyLightSource = "LightSource";
|
||||
const std::string _keyObserver = "Observer";
|
||||
const std::string _keyBody = "Body";
|
||||
const std::string _keyBodyFrame = "BodyFrame";
|
||||
const std::string _keyMainFrame = "MainFrame";
|
||||
const std::string _keyAberration = "Aberration";
|
||||
|
||||
const std::string KeyType = "TerminatorType";
|
||||
const std::string KeyLightSource = "LightSource";
|
||||
const std::string KeyObserver = "Observer";
|
||||
const std::string KeyBody = "Body";
|
||||
const std::string KeyBodyFrame = "BodyFrame";
|
||||
const std::string KeyMainFrame = "MainFrame";
|
||||
const std::string KeyAberration = "Aberration";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
RenderableShadowCylinder::RenderableShadowCylinder(const ghoul::Dictionary& dictionary)
|
||||
|
||||
RenderableShadowCylinder::RenderableShadowCylinder(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _numberOfPoints("amountOfPoints", "Points", 190, 1, 300)
|
||||
, _shadowLength("shadowLength", "Shadow Length", 0.1, 0.0, 0.5)
|
||||
@@ -62,49 +60,32 @@ namespace openspace {
|
||||
addProperty(_shadowLength);
|
||||
addProperty(_shadowColor);
|
||||
|
||||
bool success = dictionary.getValue(_keyType, _terminatorType);
|
||||
ghoul_assert(success, "");
|
||||
success = dictionary.getValue(_keyLightSource, _lightSource);
|
||||
ghoul_assert(success, "");
|
||||
success = dictionary.getValue(_keyObserver, _observer);
|
||||
ghoul_assert(success, "");
|
||||
success = dictionary.getValue(_keyBody, _body);
|
||||
ghoul_assert(success, "");
|
||||
success = dictionary.getValue(_keyBodyFrame, _bodyFrame);
|
||||
ghoul_assert(success, "");
|
||||
success = dictionary.getValue(_keyMainFrame, _mainFrame);
|
||||
ghoul_assert(success, "");
|
||||
std::string a = "NONE";
|
||||
success = dictionary.getValue(_keyAberration, a);
|
||||
_aberration = SpiceManager::AberrationCorrection(a);
|
||||
ghoul_assert(success, "");
|
||||
}
|
||||
|
||||
RenderableShadowCylinder::~RenderableShadowCylinder() {}
|
||||
|
||||
bool RenderableShadowCylinder::isReady() const {
|
||||
bool ready = true;
|
||||
if (!_shader)
|
||||
ready &= false;
|
||||
return ready;
|
||||
_terminatorType = dictionary.value<std::string>(KeyType);
|
||||
_lightSource = dictionary.value<std::string>(KeyLightSource);
|
||||
_observer = dictionary.value<std::string>(KeyObserver);
|
||||
_body = dictionary.value<std::string>(KeyBody);
|
||||
_bodyFrame = dictionary.value<std::string>(KeyBodyFrame);
|
||||
_mainFrame = dictionary.value<std::string>(KeyMainFrame);
|
||||
|
||||
_aberration = SpiceManager::AberrationCorrection(dictionary.value<std::string>(KeyAberration));
|
||||
}
|
||||
|
||||
bool RenderableShadowCylinder::initialize() {
|
||||
glGenVertexArrays(1, &_vao); // generate array
|
||||
glGenBuffers(1, &_vbo); // generate buffer
|
||||
|
||||
bool completeSuccess = true;
|
||||
glGenVertexArrays(1, &_vao);
|
||||
glGenBuffers(1, &_vbo);
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
_shader = renderEngine.buildRenderProgram("ShadowProgram",
|
||||
_shader = renderEngine.buildRenderProgram(
|
||||
"ShadowProgram",
|
||||
"${MODULE_NEWHORIZONS}/shaders/terminatorshadow_vs.glsl",
|
||||
"${MODULE_NEWHORIZONS}/shaders/terminatorshadow_fs.glsl");
|
||||
"${MODULE_NEWHORIZONS}/shaders/terminatorshadow_fs.glsl"
|
||||
);
|
||||
|
||||
if (!_shader)
|
||||
return false;
|
||||
|
||||
|
||||
return completeSuccess;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RenderableShadowCylinder::deinitialize() {
|
||||
@@ -122,20 +103,16 @@ bool RenderableShadowCylinder::deinitialize() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RenderableShadowCylinder::isReady() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void RenderableShadowCylinder::render(const RenderData& data){
|
||||
glm::mat4 _transform = glm::mat4(1.0);
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 3; j++){
|
||||
_transform[i][j] = static_cast<float>(_stateMatrix[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
glDepthMask(false);
|
||||
// Activate shader
|
||||
_shader->activate();
|
||||
|
||||
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_shader->setUniform("ModelTransform", _transform);
|
||||
_shader->setUniform("ModelTransform", glm::mat4(_stateMatrix));
|
||||
_shader->setUniform("shadowColor", _shadowColor);
|
||||
setPscUniforms(*_shader.get(), data.camera, data.position);
|
||||
|
||||
@@ -150,10 +127,10 @@ void RenderableShadowCylinder::render(const RenderData& data){
|
||||
|
||||
void RenderableShadowCylinder::update(const UpdateData& data) {
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix(_bodyFrame, _mainFrame, data.time);
|
||||
_time = data.time;
|
||||
if (_shader->isDirty())
|
||||
if (_shader->isDirty()) {
|
||||
_shader->rebuildFromFile();
|
||||
createCylinder();
|
||||
}
|
||||
createCylinder(data.time);
|
||||
}
|
||||
|
||||
glm::vec4 psc_addition(glm::vec4 v1, glm::vec4 v2) {
|
||||
@@ -169,52 +146,51 @@ glm::vec4 psc_addition(glm::vec4 v1, glm::vec4 v2) {
|
||||
}
|
||||
}
|
||||
|
||||
void RenderableShadowCylinder::createCylinder() {
|
||||
double targetEpoch;
|
||||
glm::dvec3 observerPosition;
|
||||
void RenderableShadowCylinder::createCylinder(double time) {
|
||||
auto res = SpiceManager::ref().terminatorEllipse(
|
||||
_body,
|
||||
_observer,
|
||||
_bodyFrame,
|
||||
_lightSource,
|
||||
SpiceManager::terminatorTypeFromString(_terminatorType),
|
||||
_aberration,
|
||||
time,
|
||||
_numberOfPoints
|
||||
);
|
||||
|
||||
std::vector<psc> terminatorPoints;
|
||||
SpiceManager::TerminatorType t = SpiceManager::terminatorTypeFromString(_terminatorType);
|
||||
// if (_terminatorType == "UMBRAL")
|
||||
// t = SpiceManager::TerminatorType::Umbral;
|
||||
// else if (_terminatorType == "PENUMBRAL")
|
||||
// t = SpiceManager::TerminatorType::Penumbral;
|
||||
|
||||
auto res = SpiceManager::ref().terminatorEllipse(_body, _observer, _bodyFrame,
|
||||
_lightSource, t, _aberration, _time, _numberOfPoints);
|
||||
|
||||
targetEpoch = res.targetEphemerisTime;
|
||||
observerPosition = std::move(res.observerPosition);
|
||||
|
||||
std::vector<glm::dvec3> ps = std::move(res.terminatorPoints);
|
||||
for (auto&& p : ps) {
|
||||
PowerScaledCoordinate psc = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z);
|
||||
psc[3] += 3;
|
||||
terminatorPoints.push_back(psc);
|
||||
}
|
||||
std::transform(
|
||||
res.terminatorPoints.begin(),
|
||||
res.terminatorPoints.end(),
|
||||
std::back_inserter(terminatorPoints),
|
||||
[](const glm::dvec3& p) {
|
||||
PowerScaledCoordinate psc = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z);
|
||||
psc[3] += 3;
|
||||
return psc;
|
||||
}
|
||||
);
|
||||
|
||||
double lt;
|
||||
glm::dvec3 vecLightSource =
|
||||
SpiceManager::ref().targetPosition(_body, _lightSource, _mainFrame, _aberration, _time, lt);
|
||||
SpiceManager::ref().targetPosition(_body, _lightSource, _mainFrame, _aberration, time, lt);
|
||||
|
||||
glm::dmat3 _stateMatrix = glm::inverse(SpiceManager::ref().positionTransformMatrix(_bodyFrame, _mainFrame, _time));
|
||||
|
||||
vecLightSource = _stateMatrix * vecLightSource;
|
||||
vecLightSource = glm::inverse(_stateMatrix) * vecLightSource;
|
||||
|
||||
vecLightSource *= _shadowLength;
|
||||
_vertices.clear();
|
||||
|
||||
psc endpoint = psc::CreatePowerScaledCoordinate(vecLightSource.x, vecLightSource.y, vecLightSource.z);
|
||||
for (auto v : terminatorPoints){
|
||||
_vertices.push_back(CylinderVBOLayout(v[0], v[1], v[2], v[3]));
|
||||
for (const auto& v : terminatorPoints) {
|
||||
_vertices.push_back({ v[0], v[1], v[2], v[3] });
|
||||
glm::vec4 f = psc_addition(v.vec4(), endpoint.vec4());
|
||||
_vertices.push_back(CylinderVBOLayout(f[0], f[1], f[2], f[3]));
|
||||
_vertices.push_back({ f[0], f[1], f[2], f[3] });
|
||||
}
|
||||
_vertices.push_back(_vertices[0]);
|
||||
_vertices.push_back(_vertices[1]);
|
||||
|
||||
glBindVertexArray(_vao); // bind array
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo); // bind buffer
|
||||
glBufferData(GL_ARRAY_BUFFER, _vertices.size() * sizeof(CylinderVBOLayout), NULL, GL_DYNAMIC_DRAW); // orphaning the buffer, sending NULL data.
|
||||
glBindVertexArray(_vao);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, _vertices.size() * sizeof(CylinderVBOLayout), NULL, GL_DYNAMIC_DRAW);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, _vertices.size() * sizeof(CylinderVBOLayout), &_vertices[0]);
|
||||
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef RENDERABLESHADOWCYLINDER_H_
|
||||
#define RENDERABLESHADOWCYLINDER_H_
|
||||
#ifndef __RENDERABLESHADOWCYLINDER_H__
|
||||
#define __RENDERABLESHADOWCYLINDER_H__
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
@@ -33,67 +33,52 @@
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace filesystem {
|
||||
class File;
|
||||
}
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
}
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
}
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
struct LinePoint;
|
||||
class RenderableShadowCylinder : public Renderable {
|
||||
|
||||
class RenderableShadowCylinder : public Renderable {
|
||||
public:
|
||||
RenderableShadowCylinder(const ghoul::Dictionary& dictionary);
|
||||
|
||||
public:
|
||||
RenderableShadowCylinder(const ghoul::Dictionary& dictionary);
|
||||
~RenderableShadowCylinder();
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
bool isReady() const override;
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
struct CylinderVBOLayout {
|
||||
CylinderVBOLayout(double a1, double a2, double a3, double a4){
|
||||
x = a1;
|
||||
y = a2;
|
||||
z = a3;
|
||||
e = a4;
|
||||
}
|
||||
float x, y, z, e;
|
||||
};
|
||||
|
||||
void createCylinder();
|
||||
properties::IntProperty _numberOfPoints;
|
||||
properties::FloatProperty _shadowLength;
|
||||
properties::Vec4Property _shadowColor;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
GLuint _vao;
|
||||
GLuint _vbo;
|
||||
|
||||
std::vector<CylinderVBOLayout> _vertices;
|
||||
|
||||
std::string _terminatorType;
|
||||
std::string _lightSource;
|
||||
std::string _observer;
|
||||
std::string _body;
|
||||
std::string _bodyFrame;
|
||||
std::string _mainFrame;
|
||||
SpiceManager::AberrationCorrection _aberration;
|
||||
|
||||
double _time;
|
||||
private:
|
||||
struct CylinderVBOLayout {
|
||||
float x, y, z, e;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
#endif // RENDERABLESHADOWCYLINDER_H_
|
||||
void createCylinder(double time);
|
||||
properties::IntProperty _numberOfPoints;
|
||||
properties::FloatProperty _shadowLength;
|
||||
properties::Vec4Property _shadowColor;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
|
||||
GLuint _vao;
|
||||
GLuint _vbo;
|
||||
|
||||
std::vector<CylinderVBOLayout> _vertices;
|
||||
|
||||
std::string _terminatorType;
|
||||
std::string _lightSource;
|
||||
std::string _observer;
|
||||
std::string _body;
|
||||
std::string _bodyFrame;
|
||||
std::string _mainFrame;
|
||||
SpiceManager::AberrationCorrection _aberration;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __RENDERABLESHADOWCYLINDER_H__
|
||||
|
||||
@@ -32,7 +32,7 @@ const std::string _loggerCat = "Decoder";
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Decoder* Decoder::createFromDictionary(const ghoul::Dictionary& dictionary, const std::string type)
|
||||
Decoder* Decoder::createFromDictionary(const ghoul::Dictionary& dictionary, const std::string& type)
|
||||
{
|
||||
ghoul::TemplateFactory<Decoder>* factory
|
||||
= FactoryManager::ref().factory<Decoder>();
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace openspace {
|
||||
|
||||
class Decoder {
|
||||
public:
|
||||
static Decoder* createFromDictionary(const ghoul::Dictionary& dictionary, const std::string type);
|
||||
static Decoder* createFromDictionary(const ghoul::Dictionary& dictionary, const std::string& type);
|
||||
|
||||
Decoder(const ghoul::Dictionary& dictionary);
|
||||
virtual ~Decoder();
|
||||
|
||||
@@ -22,17 +22,22 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/newhorizons/util/hongkangparser.h>
|
||||
|
||||
#include <modules/newhorizons/util/imagesequencer.h>
|
||||
#include <modules/newhorizons/util/instrumentdecoder.h>
|
||||
|
||||
#include <openspace/util/time.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/filesystem/directory.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <iomanip>
|
||||
#include <limits>
|
||||
#include <modules/newhorizons/util/hongkangparser.h>
|
||||
#include <modules/newhorizons/util/instrumentdecoder.h>
|
||||
|
||||
|
||||
namespace {
|
||||
@@ -43,35 +48,34 @@ namespace {
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
HongKangParser::HongKangParser(std::string name, const std::string& fileName,
|
||||
HongKangParser::HongKangParser(std::string name, std::string fileName,
|
||||
std::string spacecraft,
|
||||
ghoul::Dictionary translationDictionary,
|
||||
std::vector<std::string> potentialTargets)
|
||||
: _name(std::move(name))
|
||||
, _defaultCaptureImage(absPath("${OPENSPACE_DATA}/scene/common/textures/placeholder.png"))
|
||||
, _fileName(std::move(fileName))
|
||||
, _spacecraft(std::move(spacecraft))
|
||||
, _potentialTargets(std::move(potentialTargets))
|
||||
{
|
||||
_fileName = fileName;
|
||||
_spacecraft = spacecraft;
|
||||
_potentialTargets = potentialTargets;
|
||||
|
||||
//get the different instrument types
|
||||
const std::vector<std::string>& decoders = translationDictionary.keys();
|
||||
//for each decoder (assuming might have more if hong makes changes)
|
||||
for (int i = 0; i < decoders.size(); i++){
|
||||
for (int i = 0; i < decoders.size(); ++i) {
|
||||
//create dictionary containing all {playbookKeys , spice IDs}
|
||||
if (decoders[i] == "Instrument"){
|
||||
if (decoders[i] == "Instrument") {
|
||||
ghoul::Dictionary typeDictionary;
|
||||
translationDictionary.getValue(decoders[i], typeDictionary);
|
||||
//for each playbook call -> create a Decoder object
|
||||
const std::vector<std::string>& keys = typeDictionary.keys();
|
||||
//std::string abort = decoders[i] + "." + keyStopCommand;
|
||||
for (int j = 0; j < keys.size(); j++){
|
||||
for (int j = 0; j < keys.size(); ++j) {
|
||||
std::string currentKey = decoders[i] + "." + keys[j];
|
||||
|
||||
ghoul::Dictionary decoderDictionary;
|
||||
translationDictionary.getValue(currentKey, decoderDictionary);
|
||||
|
||||
Decoder *decoder = Decoder::createFromDictionary(decoderDictionary, decoders[i]);
|
||||
Decoder* decoder = Decoder::createFromDictionary(decoderDictionary, decoders[i]);
|
||||
//insert decoder to map - this will be used in the parser to determine
|
||||
//behavioral characteristics of each instrument
|
||||
_fileTranslation[keys[j]] = decoder;
|
||||
@@ -81,43 +85,26 @@ HongKangParser::HongKangParser(std::string name, const std::string& fileName,
|
||||
}
|
||||
}
|
||||
|
||||
void HongKangParser::findPlaybookSpecifiedTarget(std::string line, std::string& target){
|
||||
void HongKangParser::findPlaybookSpecifiedTarget(std::string line, std::string& target) {
|
||||
//remembto add this lua later...
|
||||
std::transform(line.begin(), line.end(), line.begin(), toupper);
|
||||
std::vector<std::string> ptarg = _potentialTargets;
|
||||
for (auto p : ptarg){
|
||||
for (const auto& p : ptarg) {
|
||||
// loop over all targets and determine from 4th col which target this instrument points to
|
||||
std::transform(line.begin(), line.end(), line.begin(), toupper);
|
||||
if (line.find(p) != std::string::npos){
|
||||
target = p;
|
||||
break;
|
||||
}
|
||||
else{
|
||||
else {
|
||||
// not found - we set void until we have more info.
|
||||
target = "VOID";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HongKangParser::writeUTCEventFile(const Image image){
|
||||
std::string time_beg = SpiceManager::ref().dateFromEphemerisTime(image.startTime);
|
||||
std::string time_end = SpiceManager::ref().dateFromEphemerisTime(image.stopTime);
|
||||
|
||||
_eventsAsUTCFile << std::fixed
|
||||
<< std::setw(10) << time_beg << "->"
|
||||
<< std::setw(10) << time_end
|
||||
<< std::setw(10) << (int)getMetFromET(image.startTime) << "->"
|
||||
<< std::setw(10) << (int)getMetFromET(image.stopTime)
|
||||
<< std::setw(10) << image.target << std::setw(10);
|
||||
for (auto instrument : image.activeInstruments){
|
||||
_eventsAsUTCFile << " " << instrument;
|
||||
}
|
||||
}
|
||||
|
||||
bool HongKangParser::create(){
|
||||
bool HongKangParser::create() {
|
||||
//check input for errors.
|
||||
int tmp;
|
||||
bool hasObserver = SpiceManager::ref().hasNaifId(_spacecraft);
|
||||
tmp = SpiceManager::ref().naifId(_spacecraft);
|
||||
if (!hasObserver){
|
||||
LERROR("SPICE navigation system has no pooled observer: '" << _spacecraft << "' in kernel" <<
|
||||
"Please check that all necessary kernels are loaded"<<
|
||||
@@ -129,8 +116,6 @@ bool HongKangParser::create(){
|
||||
<< "please check modfile");
|
||||
}
|
||||
|
||||
_eventsAsUTCFile.open("utcEvents.txt");
|
||||
|
||||
if (size_t position = _fileName.find_last_of(".") + 1){
|
||||
if (position != std::string::npos){
|
||||
std::string extension = ghoul::filesystem::File(_fileName).fileExtension();
|
||||
@@ -149,7 +134,6 @@ bool HongKangParser::create(){
|
||||
std::string previousTarget;
|
||||
|
||||
std::string previousCamera;
|
||||
std::string previousScanner;
|
||||
|
||||
TimeRange cameraRange;
|
||||
TimeRange scanRange;
|
||||
@@ -176,8 +160,6 @@ bool HongKangParser::create(){
|
||||
std::string met = line.substr(25, 9);
|
||||
double time = getETfromMet(met);
|
||||
|
||||
Image image;
|
||||
|
||||
if (foundEvent){
|
||||
//store the time, this is used for getNextCaptureTime()
|
||||
_captureProgression.push_back(time);
|
||||
@@ -194,8 +176,17 @@ bool HongKangParser::create(){
|
||||
findPlaybookSpecifiedTarget(line, cameraTarget);
|
||||
|
||||
//fill image
|
||||
createImage(image, time, time + shutter, cameraSpiceID, cameraTarget, _defaultCaptureImage);
|
||||
writeUTCEventFile(image);
|
||||
|
||||
Image image;
|
||||
image.startTime = time;
|
||||
image.stopTime = time + shutter;
|
||||
image.path = _defaultCaptureImage;
|
||||
image.activeInstruments = cameraSpiceID;
|
||||
image.target = cameraTarget;
|
||||
image.isPlaceholder = true;
|
||||
image.projected = false;
|
||||
//createImage(image, time, time + shutter, cameraSpiceID, cameraTarget, _defaultCaptureImage);
|
||||
|
||||
//IFF spaccraft has decided to switch target, store in target map (used for: 'next observation focus')
|
||||
if (previousTarget != image.target){
|
||||
previousTarget = image.target;
|
||||
@@ -234,11 +225,17 @@ bool HongKangParser::create(){
|
||||
_instrumentTimes.push_back(std::make_pair(it->first, scanRange));
|
||||
|
||||
//store individual image
|
||||
createImage(image, scan_start, scan_stop, scannerSpiceID, scannerTarget, _defaultCaptureImage);
|
||||
writeUTCEventFile(image);
|
||||
Image image;
|
||||
image.startTime = scan_start;
|
||||
image.stopTime = scan_stop;
|
||||
image.path = _defaultCaptureImage;
|
||||
image.activeInstruments = scannerSpiceID;
|
||||
image.target = cameraTarget;
|
||||
image.isPlaceholder = true;
|
||||
image.projected = false;
|
||||
|
||||
_subsetMap[image.target]._subset.push_back(image);
|
||||
_subsetMap[image.target]._range.setRange(scan_start);
|
||||
_subsetMap[scannerTarget]._subset.push_back(image);
|
||||
_subsetMap[scannerTarget]._range.setRange(scan_start);
|
||||
}
|
||||
}
|
||||
//go back to stored position in file
|
||||
@@ -256,7 +253,6 @@ bool HongKangParser::create(){
|
||||
capture_start = -1;
|
||||
}
|
||||
}
|
||||
_eventsAsUTCFile << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,31 +266,33 @@ bool HongKangParser::create(){
|
||||
bool HongKangParser::augmentWithSpice(Image& image,
|
||||
std::string spacecraft,
|
||||
std::vector<std::string> payload,
|
||||
std::vector<std::string> potentialTargets){
|
||||
std::vector<std::string> potentialTargets)
|
||||
{
|
||||
image.target = "VOID";
|
||||
// we have (?) to cast to int, unfortunately
|
||||
// Why? --abock
|
||||
// because: old comment --m
|
||||
int exposureTime = image.stopTime - image.startTime;
|
||||
if (exposureTime == 0)
|
||||
if (exposureTime == 0) {
|
||||
exposureTime = 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < potentialTargets.size(); i++){
|
||||
bool success = false;
|
||||
for (int i = 0; i < potentialTargets.size(); ++i) {
|
||||
bool _withinFOV = false;
|
||||
for (int j = 0; j < image.activeInstruments.size(); j++){
|
||||
for (int j = 0; j < image.activeInstruments.size(); ++j) {
|
||||
double time = image.startTime;
|
||||
for (int k = 0; k < exposureTime; k++){
|
||||
time += k;
|
||||
_withinFOV = SpiceManager::ref().isTargetInFieldOfView(
|
||||
potentialTargets[i],
|
||||
spacecraft,
|
||||
potentialTargets[i],
|
||||
spacecraft,
|
||||
image.activeInstruments[j],
|
||||
SpiceManager::FieldOfViewMethod::Ellipsoid,
|
||||
{},
|
||||
SpiceManager::FieldOfViewMethod::Ellipsoid,
|
||||
{},
|
||||
time
|
||||
);
|
||||
if (_withinFOV){
|
||||
);
|
||||
|
||||
if (_withinFOV) {
|
||||
image.target = potentialTargets[i];
|
||||
_withinFOV = false;
|
||||
}
|
||||
@@ -304,17 +302,17 @@ bool HongKangParser::augmentWithSpice(Image& image,
|
||||
return false;
|
||||
}
|
||||
|
||||
void HongKangParser::createImage(Image& image, double startTime, double stopTime, std::vector<std::string> instr, std::string targ, std::string path) {
|
||||
image.startTime = startTime;
|
||||
image.stopTime = stopTime;
|
||||
image.path = path;
|
||||
for (int i = 0; i < instr.size(); i++){
|
||||
image.activeInstruments.push_back(instr[i]);
|
||||
}
|
||||
image.target = targ;
|
||||
image.projected = false;
|
||||
image.isPlaceholder = true;
|
||||
}
|
||||
//Image HongKangParser::createImage(double startTime, double stopTime, std::vector<std::string> instr, std::string targ, std::string path) {
|
||||
// image.startTime = startTime;
|
||||
// image.stopTime = stopTime;
|
||||
// image.path = path;
|
||||
// for (int i = 0; i < instr.size(); i++){
|
||||
// image.activeInstruments.push_back(instr[i]);
|
||||
// }
|
||||
// image.target = targ;
|
||||
// image.projected = false;
|
||||
// image.isPlaceholder = true;
|
||||
//}
|
||||
|
||||
double HongKangParser::getETfromMet(std::string line){
|
||||
std::string::size_type sz;
|
||||
|
||||
@@ -28,17 +28,18 @@
|
||||
#include <modules/newhorizons/util/imagesequencer.h>
|
||||
#include <modules/newhorizons/util/sequenceparser.h>
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class HongKangParser : public SequenceParser {
|
||||
public:
|
||||
HongKangParser();
|
||||
HongKangParser(std::string name, const std::string& fileName,
|
||||
HongKangParser(std::string name, std::string fileName,
|
||||
std::string spacecraft,
|
||||
ghoul::Dictionary dictionary,
|
||||
std::vector<std::string> potentialTargets);
|
||||
@@ -47,19 +48,16 @@ public:
|
||||
void findPlaybookSpecifiedTarget(std::string line, std::string& target);
|
||||
virtual std::map<std::string, Decoder*> getTranslation(){ return _fileTranslation; };
|
||||
|
||||
void writeUTCEventFile(const Image image);
|
||||
|
||||
private:
|
||||
double getMetFromET(double et);
|
||||
double getETfromMet(std::string timestr);
|
||||
double getETfromMet(double met);
|
||||
|
||||
void createImage(Image& image,
|
||||
double startTime,
|
||||
double stopTime,
|
||||
std::vector<std::string> instr,
|
||||
std::string targ,
|
||||
std::string pot);
|
||||
//Image createImage(double startTime,
|
||||
// double stopTime,
|
||||
// std::vector<std::string> instr,
|
||||
// std::string targ,
|
||||
// std::string pot);
|
||||
|
||||
bool augmentWithSpice(Image& image,
|
||||
std::string spacecraft,
|
||||
@@ -74,7 +72,6 @@ private:
|
||||
std::string _spacecraft;
|
||||
std::map<std::string, Decoder*> _fileTranslation;
|
||||
std::vector<std::string> _potentialTargets;
|
||||
std::ofstream _eventsAsUTCFile;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -46,6 +46,10 @@ ImageSequencer* ImageSequencer::_instance = nullptr;
|
||||
|
||||
ImageSequencer::ImageSequencer()
|
||||
: _hasData(false)
|
||||
, _currentTime(0.0)
|
||||
, _previousTime(0.0)
|
||||
, _intervalLength(0.0)
|
||||
, _nextCapture(0.0)
|
||||
{}
|
||||
|
||||
ImageSequencer& ImageSequencer::ref() {
|
||||
@@ -63,22 +67,22 @@ void ImageSequencer::deinitialize() {
|
||||
_instance = nullptr;
|
||||
}
|
||||
|
||||
bool ImageSequencer::isReady(){
|
||||
bool ImageSequencer::isReady() {
|
||||
return _hasData;
|
||||
}
|
||||
|
||||
void ImageSequencer::updateSequencer(double time){
|
||||
if (Time::ref().timeJumped() && Time::ref().deltaTime() == 0){
|
||||
void ImageSequencer::updateSequencer(double time) {
|
||||
if (Time::ref().timeJumped() && Time::ref().deltaTime() == 0) {
|
||||
Time::ref().setDeltaTime(0.1);
|
||||
} // Time is not properly updated when time jump with dt = 0
|
||||
|
||||
if (_currentTime != time){
|
||||
if (_currentTime != time) {
|
||||
_previousTime = _currentTime;
|
||||
_currentTime = time;
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<double, std::string> ImageSequencer::getNextTarget(){
|
||||
std::pair<double, std::string> ImageSequencer::getNextTarget() {
|
||||
auto compareTime = [](const std::pair<double, std::string> &a,
|
||||
const std::pair<double, std::string> &b)->bool{
|
||||
return a.first < b.first;
|
||||
@@ -93,7 +97,7 @@ std::pair<double, std::string> ImageSequencer::getNextTarget(){
|
||||
return std::make_pair(0.0, "");
|
||||
}
|
||||
|
||||
std::pair<double, std::string> ImageSequencer::getCurrentTarget(){
|
||||
std::pair<double, std::string> ImageSequencer::getCurrentTarget() {
|
||||
auto compareTime = [](const std::pair<double, std::string> &a,
|
||||
const std::pair<double, std::string> &b)->bool{
|
||||
return a.first < b.first;
|
||||
@@ -109,7 +113,7 @@ std::pair<double, std::string> ImageSequencer::getCurrentTarget(){
|
||||
return std::make_pair(0.0, "No Target");
|
||||
}
|
||||
|
||||
std::pair<double, std::vector<std::string>> ImageSequencer::getIncidentTargetList(int range){
|
||||
std::pair<double, std::vector<std::string>> ImageSequencer::getIncidentTargetList(int range) {
|
||||
std::pair<double, std::vector<std::string>> incidentTargets;
|
||||
|
||||
auto compareTime = [](const std::pair<double, std::string> &a,
|
||||
@@ -158,7 +162,7 @@ double ImageSequencer::getNextCaptureTime(){
|
||||
|
||||
return nextCaptureTime;
|
||||
}
|
||||
const Image ImageSequencer::getLatestImageForInstrument(const std::string _instrumentID){
|
||||
Image ImageSequencer::getLatestImageForInstrument(const std::string& _instrumentID){
|
||||
auto it = _latestImages.find(_instrumentID);
|
||||
if (it != _latestImages.end())
|
||||
return _latestImages[_instrumentID];
|
||||
@@ -369,14 +373,13 @@ void ImageSequencer::runSequenceParser(SequenceParser* parser){
|
||||
|
||||
// find the smallest separation of images in time
|
||||
double epsilon;
|
||||
epsilon = findMin(source);
|
||||
//epsilon = findMin(source);
|
||||
epsilon = findMin(destination);
|
||||
// set epsilon as 1% smaller than min
|
||||
epsilon -= min*0.01;
|
||||
|
||||
// IFF images have same time as mission planned capture, erase that event from
|
||||
// 'predicted event file' (mission-playbook)
|
||||
std::vector<Image> tmp;
|
||||
for (int i = 0; i < source.size(); i++){
|
||||
for (int j = 0; j < destination.size(); j++){
|
||||
double diff = abs(source[i].startTime - destination[j].startTime);
|
||||
|
||||
@@ -136,7 +136,8 @@ public:
|
||||
/*
|
||||
* returns latest captured image
|
||||
*/
|
||||
const Image getLatestImageForInstrument(const std::string _instrumentID);
|
||||
Image getLatestImageForInstrument(const std::string& instrumentID);
|
||||
|
||||
private:
|
||||
void sortData();
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ InstrumentDecoder::InstrumentDecoder(const ghoul::Dictionary& dictionary)
|
||||
dictionary.getValue(keyStopCommand, _stopCommand);
|
||||
}
|
||||
|
||||
std::vector<std::string> spice;
|
||||
ghoul::Dictionary spiceDictionary;
|
||||
success = dictionary.getValue(keySpice, spiceDictionary);
|
||||
ghoul_assert(success, "Instrument did not provide spice ids");
|
||||
|
||||
@@ -45,12 +45,12 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
LabelParser::LabelParser(std::string name, const std::string& fileName,
|
||||
ghoul::Dictionary translationDictionary)
|
||||
LabelParser::LabelParser(std::string name, std::string fileName,
|
||||
const ghoul::Dictionary& translationDictionary)
|
||||
: _name(std::move(name))
|
||||
, _badDecoding(false)
|
||||
, _fileName(std::move(fileName))
|
||||
{
|
||||
_fileName = fileName;
|
||||
//get the different instrument types
|
||||
const std::vector<std::string>& decoders = translationDictionary.keys();
|
||||
//for each decoder (assuming might have more if hong makes changes)
|
||||
@@ -167,9 +167,10 @@ bool LabelParser::create() {
|
||||
|
||||
// open up label files
|
||||
std::string line = "";
|
||||
std::string previousSequence;
|
||||
TimeRange instrumentRange;
|
||||
|
||||
double startTime = 0.0;
|
||||
double stopTime = 0.0;
|
||||
do {
|
||||
std::getline(file, line);
|
||||
|
||||
@@ -204,10 +205,11 @@ bool LabelParser::create() {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
||||
if (read == "START_TIME"){
|
||||
std::string start = line.substr(line.find("=") + 2);
|
||||
start.erase(std::remove(start.begin(), start.end(), ' '), start.end());
|
||||
_startTime = SpiceManager::ref().ephemerisTimeFromDate(start);
|
||||
startTime = SpiceManager::ref().ephemerisTimeFromDate(start);
|
||||
count++;
|
||||
|
||||
getline(file, line);
|
||||
@@ -222,7 +224,7 @@ bool LabelParser::create() {
|
||||
),
|
||||
stop.end()
|
||||
);
|
||||
_stopTime = SpiceManager::ref().ephemerisTimeFromDate(stop);
|
||||
stopTime = SpiceManager::ref().ephemerisTimeFromDate(stop);
|
||||
count++;
|
||||
}
|
||||
else{
|
||||
@@ -244,12 +246,12 @@ bool LabelParser::create() {
|
||||
Image image;
|
||||
std::vector<std::string> spiceInstrument;
|
||||
spiceInstrument.push_back(_instrumentID);
|
||||
createImage(image, _startTime, _startTime, spiceInstrument, _target, path);
|
||||
createImage(image, startTime, stopTime, spiceInstrument, _target, path);
|
||||
|
||||
_subsetMap[image.target]._subset.push_back(image);
|
||||
_subsetMap[image.target]._range.setRange(_startTime);
|
||||
_subsetMap[image.target]._range.setRange(startTime);
|
||||
|
||||
_captureProgression.push_back(_startTime);
|
||||
_captureProgression.push_back(startTime);
|
||||
std::stable_sort(_captureProgression.begin(), _captureProgression.end());
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ class LabelParser : public SequenceParser{
|
||||
public:
|
||||
LabelParser();
|
||||
LabelParser(std::string name,
|
||||
const std::string& fileName,
|
||||
ghoul::Dictionary translationDictionary);
|
||||
std::string fileName,
|
||||
const ghoul::Dictionary& translationDictionary);
|
||||
|
||||
bool create() override;
|
||||
|
||||
@@ -72,8 +72,6 @@ private:
|
||||
std::string _instrumentHostID;
|
||||
std::string _detectorType;
|
||||
std::string _sequenceID;
|
||||
double _startTime;
|
||||
double _stopTime;
|
||||
bool _badDecoding;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,6 +39,9 @@ void renderOptionProperty(properties::Property* prop, const std::string& ownerNa
|
||||
void renderSelectionProperty(properties::Property* prop, const std::string& ownerName);
|
||||
void renderStringProperty(properties::Property* prop, const std::string& ownerName);
|
||||
void renderIntProperty(properties::Property* prop, const std::string& ownerName);
|
||||
void renderIVec2Property(properties::Property* prop, const std::string& ownerName);
|
||||
void renderIVec3Property(properties::Property* prop, const std::string& ownerName);
|
||||
void renderIVec4Property(properties::Property* prop, const std::string& ownerName);
|
||||
void renderFloatProperty(properties::Property* prop, const std::string& ownerName);
|
||||
void renderVec2Property(properties::Property* prop, const std::string& ownerName);
|
||||
void renderVec3Property(properties::Property* prop, const std::string& ownerName);
|
||||
|
||||
@@ -135,6 +135,9 @@ void GuiPropertyComponent::renderProperty(properties::Property* prop, properties
|
||||
static std::map<std::string, Func> FunctionMapping = {
|
||||
{ "BoolProperty", &renderBoolProperty },
|
||||
{ "IntProperty", &renderIntProperty },
|
||||
{ "IVec2Property", &renderIVec2Property },
|
||||
{ "IVec3Property", &renderIVec3Property },
|
||||
{ "IVec4Property", &renderIVec4Property },
|
||||
{ "FloatProperty", &renderFloatProperty },
|
||||
{ "Vec2Property", &renderVec2Property },
|
||||
{ "Vec3Property", &renderVec3Property },
|
||||
|
||||
@@ -71,13 +71,24 @@ void renderOptionProperty(Property* prop, const std::string& ownerName) {
|
||||
|
||||
int value = *p;
|
||||
std::vector<OptionProperty::Option> options = p->options();
|
||||
for (const OptionProperty::Option& o : options) {
|
||||
ImGui::RadioButton(name.c_str(), &value, o.value);
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::Text(o.description.c_str());
|
||||
renderTooltip(prop);
|
||||
|
||||
switch (p->displayType()) {
|
||||
case OptionProperty::DisplayType::RADIO: {
|
||||
for (const OptionProperty::Option& o : options) {
|
||||
ImGui::RadioButton(name.c_str(), &value, o.value);
|
||||
ImGui::SameLine();
|
||||
ImGui::Text(o.description.c_str());
|
||||
renderTooltip(prop);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OptionProperty::DisplayType::DROPDOWN: {
|
||||
std::string nodeNames = "";
|
||||
for (const OptionProperty::Option& o : options) {
|
||||
nodeNames += o.description + '\0';
|
||||
}
|
||||
ImGui::Combo(name.c_str(), &value, nodeNames.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (value != p->value())
|
||||
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
|
||||
@@ -161,6 +172,87 @@ void renderIntProperty(Property* prop, const std::string& ownerName) {
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void renderIVec2Property(Property* prop, const std::string& ownerName) {
|
||||
IVec2Property* p = static_cast<IVec2Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
IVec2Property::ValueType value = *p;
|
||||
float min = std::min(p->minValue().x, p->minValue().y);
|
||||
float max = std::max(p->maxValue().x, p->maxValue().y);
|
||||
ImGui::SliderInt2(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
min,
|
||||
max
|
||||
);
|
||||
renderTooltip(prop);
|
||||
|
||||
if (value != p->value()) {
|
||||
executeScript(p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "}"
|
||||
);
|
||||
}
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void renderIVec3Property(Property* prop, const std::string& ownerName) {
|
||||
IVec3Property* p = static_cast<IVec3Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
IVec3Property::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);
|
||||
|
||||
ImGui::SliderInt3(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
min,
|
||||
max
|
||||
);
|
||||
renderTooltip(prop);
|
||||
|
||||
if (value != p->value())
|
||||
executeScript(p->fullyQualifiedIdentifier(),
|
||||
"{" + std::to_string(value.x) + "," +
|
||||
std::to_string(value.y) + "," +
|
||||
std::to_string(value.z) + "}");
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void renderIVec4Property(Property* prop, const std::string& ownerName) {
|
||||
IVec4Property* p = static_cast<IVec4Property*>(prop);
|
||||
std::string name = p->guiName();
|
||||
ImGui::PushID((ownerName + "." + name).c_str());
|
||||
|
||||
IVec4Property::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);
|
||||
|
||||
ImGui::SliderInt4(
|
||||
name.c_str(),
|
||||
&value.x,
|
||||
min,
|
||||
max
|
||||
);
|
||||
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) + "}");
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
|
||||
void renderFloatProperty(Property* prop, const std::string& ownerName) {
|
||||
FloatProperty* p = static_cast<FloatProperty*>(prop);
|
||||
std::string name = p->guiName();
|
||||
|
||||
@@ -8,7 +8,7 @@ return {
|
||||
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
|
||||
-- of all entities that will be visible during an instance of OpenSpace
|
||||
-- Scene = "${SCENE}/default-moon.scene",
|
||||
--Scene = "${SCENE}/default.scene",
|
||||
-- Scene = "${SCENE}/default.scene",
|
||||
-- Scene = "${SCENE}/globebrowsing.scene",
|
||||
-- Scene = "${SCENE}/rosetta.scene",
|
||||
-- Scene = "${SCENE}/dawn.scene",
|
||||
@@ -52,8 +52,12 @@ return {
|
||||
Type = "text",
|
||||
File = "${BASE_PATH}/ScriptLog.txt"
|
||||
},
|
||||
KeyboardShortcuts = {
|
||||
Type = "text",
|
||||
File = "${BASE_PATH}/KeyboardMapping.txt"
|
||||
},
|
||||
ShutdownCountdown = 3,
|
||||
DownloadRequestURL = "http://openspace.itn.liu.se/request.cgi",
|
||||
DownloadRequestURL = "http://130.236.132.168/request.cgi",
|
||||
RenderingMethod = "Framebuffer"
|
||||
--RenderingMethod = "ABuffer" -- alternative: "Framebuffer"
|
||||
|
||||
|
||||
@@ -19,9 +19,11 @@ helper.setCommonKeys = function()
|
||||
openspace.bindKey("COMMA", "openspace.setRenderer('Framebuffer');")
|
||||
openspace.bindKey("PERIOD", "openspace.setRenderer('ABuffer');")
|
||||
|
||||
openspace.bindKey("f", helper.property.invert('Interaction.horizontalFriction'))
|
||||
openspace.bindKey("Shift+f", helper.property.invert('Interaction.rotationalFriction'))
|
||||
openspace.bindKey("Shift+Ctrl+f", helper.property.invert('Interaction.verticalFriction'))
|
||||
|
||||
openspace.bindKey("f", helper.property.invert('Interaction.rotationalFriction'))
|
||||
openspace.bindKey("Shift+f", helper.property.invert('Interaction.zoomFriction'))
|
||||
|
||||
openspace.bindKey("w", "openspace.toggleFade(3)")
|
||||
end
|
||||
|
||||
helper.setDeltaTimeKeys = function(t)
|
||||
|
||||
@@ -93,6 +93,7 @@ set(OPENSPACE_SOURCE
|
||||
${OPENSPACE_BASE_DIR}/src/util/progressbar.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/util/screenlog.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/util/spicemanager.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/util/spicemanager_lua.inl
|
||||
${OPENSPACE_BASE_DIR}/src/util/syncbuffer.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/util/histogram.cpp
|
||||
${OPENSPACE_BASE_DIR}/src/util/time.cpp
|
||||
|
||||
@@ -298,7 +298,6 @@ std::vector<std::shared_ptr<DownloadManager::FileFuture>> DownloadManager::downl
|
||||
std::ifstream temporary(requestFile);
|
||||
std::string line;
|
||||
int nFiles = 0;
|
||||
int nFinished = 0;
|
||||
while (std::getline(temporary, line)) {
|
||||
++nFiles;
|
||||
#ifdef __APPLE__
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace {
|
||||
namespace openspace {
|
||||
|
||||
void ModuleEngine::initialize() {
|
||||
for (OpenSpaceModule* m : AllModules)
|
||||
for (OpenSpaceModule* m : AllModules())
|
||||
registerModule(std::unique_ptr<OpenSpaceModule>(m));
|
||||
}
|
||||
|
||||
|
||||
@@ -74,11 +74,9 @@
|
||||
#include <modules/iswa/util/iswamanager.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef OPENSPACE_ENABLE_VLD
|
||||
#if defined(_MSC_VER) && defined(OPENSPACE_ENABLE_VLD)
|
||||
#include <vld.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <WinBase.h>
|
||||
@@ -416,28 +414,35 @@ bool OpenSpaceEngine::initialize() {
|
||||
ConfigurationManager::KeyShutdownCountdown, _shutdownWait
|
||||
);
|
||||
|
||||
// Load scenegraph
|
||||
if (!commandlineArgumentPlaceholders.sceneName.empty())
|
||||
configurationManager().setValue(
|
||||
ConfigurationManager::KeyConfigScene,
|
||||
commandlineArgumentPlaceholders.sceneName);
|
||||
|
||||
// Initialize the SettingsEngine
|
||||
_settingsEngine->initialize();
|
||||
_settingsEngine->setModules(_moduleEngine->modules());
|
||||
|
||||
// Initialize the Scene
|
||||
Scene* sceneGraph = new Scene;
|
||||
_renderEngine->setSceneGraph(sceneGraph);
|
||||
|
||||
// initialize the RenderEngine
|
||||
_renderEngine->initialize();
|
||||
sceneGraph->initialize();
|
||||
|
||||
std::string scenePath = "";
|
||||
configurationManager().getValue(ConfigurationManager::KeyConfigScene, scenePath);
|
||||
sceneGraph->scheduleLoadSceneFile(scenePath);
|
||||
|
||||
// Initialize the RenderEngine
|
||||
_renderEngine->setSceneGraph(sceneGraph);
|
||||
_renderEngine->initialize();
|
||||
_renderEngine->setGlobalBlackOutFactor(0.0);
|
||||
_renderEngine->startFading(1, 3.0);
|
||||
|
||||
std::string sceneDescriptionPath = "";
|
||||
if (commandlineArgumentPlaceholders.sceneName.empty()) {
|
||||
success = configurationManager().getValue(
|
||||
ConfigurationManager::KeyConfigScene, sceneDescriptionPath);
|
||||
}
|
||||
else
|
||||
sceneDescriptionPath = commandlineArgumentPlaceholders.sceneName;
|
||||
sceneGraph->scheduleLoadSceneFile(sceneDescriptionPath);
|
||||
|
||||
//_interactionHandler->setKeyboardController(new interaction::KeyboardControllerFixed);
|
||||
//_interactionHandler->setMouseController(new interaction::OrbitalMouseController);
|
||||
|
||||
// Run start up scripts
|
||||
runPreInitializationScripts(sceneDescriptionPath);
|
||||
runPreInitializationScripts(scenePath);
|
||||
|
||||
// Load a light and a monospaced font
|
||||
loadFonts();
|
||||
@@ -813,14 +818,13 @@ void OpenSpaceEngine::postDraw() {
|
||||
bool showGui = _windowWrapper->hasGuiWindow() ? _windowWrapper->isGuiWindow() : true;
|
||||
if (showGui) {
|
||||
_renderEngine->renderScreenLog();
|
||||
|
||||
if (_console->isVisible())
|
||||
_console->render();
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
if (_gui->isEnabled())
|
||||
if (_gui->isEnabled() && _isMaster && _windowWrapper->isRegularRendering())
|
||||
_gui->endFrame();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (_isInShutdownMode)
|
||||
_renderEngine->renderShutdownInformation(_shutdownCountdown, _shutdownWait);
|
||||
|
||||
@@ -25,17 +25,62 @@
|
||||
#include <openspace/engine/settingsengine.h>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/configurationmanager.h>
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/util/openspacemodule.h>
|
||||
#include <openspace/scene/scene.h>
|
||||
|
||||
#include <ghoul/ghoul.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
SettingsEngine::SettingsEngine() :
|
||||
_eyeSeparation("eyeSeparation", "Eye Separation" , 0.f, 0.f, 10.f)
|
||||
SettingsEngine::SettingsEngine()
|
||||
: _eyeSeparation("eyeSeparation", "Eye Separation" , 0.f, 0.f, 10.f)
|
||||
, _scenes("scenes", "Scene", properties::OptionProperty::DisplayType::DROPDOWN)
|
||||
{
|
||||
setName("Global Properties");
|
||||
}
|
||||
|
||||
void SettingsEngine::initialize() {
|
||||
initEyeSeparation();
|
||||
initSceneFiles();
|
||||
}
|
||||
|
||||
void SettingsEngine::setModules(std::vector<OpenSpaceModule*> modules) {
|
||||
for (OpenSpaceModule* m : modules) {
|
||||
addPropertySubOwner(m);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsEngine::initEyeSeparation() {
|
||||
addProperty(_eyeSeparation);
|
||||
setName("Global");
|
||||
|
||||
// Set interaction to change the window's (SGCT's) eye separation
|
||||
_eyeSeparation.onChange(
|
||||
[this](){ OsEng.windowWrapper().setEyeSeparationDistance(_eyeSeparation); });
|
||||
[this]() { OsEng.windowWrapper().setEyeSeparationDistance(_eyeSeparation); });
|
||||
}
|
||||
|
||||
void SettingsEngine::initSceneFiles() {
|
||||
addProperty(_scenes);
|
||||
|
||||
// Load all matching files in the Scene
|
||||
// TODO: match regex with either with new ghoul readFiles or local code
|
||||
std::string sceneDir = "${SCENE}";
|
||||
std::vector<std::string> scenes = ghoul::filesystem::Directory(sceneDir).readFiles();
|
||||
for (std::size_t i = 0; i < scenes.size(); ++i) {
|
||||
_scenes.addOption(i, scenes[i]);
|
||||
}
|
||||
|
||||
// Set interaction to change ConfigurationManager and schedule the load
|
||||
_scenes.onChange(
|
||||
[this]() {
|
||||
std::string sceneFile = _scenes.getDescriptionByValue(_scenes);
|
||||
OsEng.configurationManager().setValue(
|
||||
ConfigurationManager::KeyConfigScene, sceneFile);
|
||||
OsEng.renderEngine().scene()->scheduleLoadSceneFile(sceneFile);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace luascriptfunctions {
|
||||
*/
|
||||
int setOrigin(lua_State* L) {
|
||||
using ghoul::lua::luaTypeToString;
|
||||
const std::string _loggerCat = "lua.setOrigin";
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 1)
|
||||
@@ -46,7 +45,10 @@ int setOrigin(lua_State* L) {
|
||||
|
||||
SceneGraphNode* node = sceneGraphNode(s);
|
||||
if (!node) {
|
||||
LWARNING("Could not find a node in scenegraph called '" << s <<"'");
|
||||
LWARNINGC(
|
||||
"lua.setOrigin",
|
||||
"Could not find a node in scenegraph called '" << s << "'"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -62,7 +64,6 @@ int setOrigin(lua_State* L) {
|
||||
*/
|
||||
int bindKey(lua_State* L) {
|
||||
using ghoul::lua::luaTypeToString;
|
||||
const std::string _loggerCat = "lua.bindKey";
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 2)
|
||||
@@ -78,7 +79,7 @@ int bindKey(lua_State* L) {
|
||||
openspace::KeyWithModifier iKey = openspace::stringToKey(key);
|
||||
|
||||
if (iKey.key == openspace::Key::Unknown) {
|
||||
LERROR("Could not find key '"<< key <<"'");
|
||||
LERRORC("lua.bindKey", "Could not find key '"<< key << "'");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -99,7 +100,6 @@ int bindKey(lua_State* L) {
|
||||
*/
|
||||
int clearKeys(lua_State* L) {
|
||||
using ghoul::lua::luaTypeToString;
|
||||
const std::string _loggerCat = "lua.clearKeys";
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 0)
|
||||
@@ -117,7 +117,6 @@ int clearKeys(lua_State* L) {
|
||||
*/
|
||||
int setInteractionMode(lua_State* L) {
|
||||
using ghoul::lua::luaTypeToString;
|
||||
const std::string _loggerCat = "lua.setInteractionMode";
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 1)
|
||||
|
||||
@@ -303,11 +303,7 @@ void LuaConsole::charCallback(unsigned int codepoint, KeyModifier modifier) {
|
||||
void LuaConsole::render() {
|
||||
const float font_size = 10.0f;
|
||||
|
||||
glm::ivec4 viewportPixelCoordinates = OsEng.windowWrapper().viewportPixelCoordinates();
|
||||
int x1 = viewportPixelCoordinates.x;
|
||||
int xSize = viewportPixelCoordinates.y;
|
||||
int y1 = viewportPixelCoordinates.z;
|
||||
int ySize = viewportPixelCoordinates.w;
|
||||
int ySize = OsEng.windowWrapper().viewportPixelCoordinates().w;
|
||||
|
||||
float startY = static_cast<float>(ySize) - 2.0f * font_size;
|
||||
startY = startY - font_size * 15.0f * 2.0f;
|
||||
|
||||
@@ -47,8 +47,10 @@ PerformanceManager::PerformanceManager()
|
||||
const int totalSize = sizeof(PerformanceLayout);
|
||||
LINFO("Create shared memory of " << totalSize << " bytes");
|
||||
|
||||
if (ghoul::SharedMemory::exists(PerformanceMeasurementSharedData))
|
||||
LWARNING("Shared memory for Performance measurements already existed.");
|
||||
if (ghoul::SharedMemory::exists(PerformanceMeasurementSharedData)) {
|
||||
LWARNING("Shared memory for Performance measurements already existed. Removing.");
|
||||
ghoul::SharedMemory::remove(PerformanceMeasurementSharedData);
|
||||
}
|
||||
|
||||
ghoul::SharedMemory::create(PerformanceMeasurementSharedData, totalSize);
|
||||
|
||||
@@ -57,7 +59,7 @@ PerformanceManager::PerformanceManager()
|
||||
void* ptr = _performanceMemory->memory();
|
||||
|
||||
// Using the placement-new to create a PerformanceLayout in the shared memory
|
||||
PerformanceLayout* layout = new (ptr) PerformanceLayout;
|
||||
new (ptr) PerformanceLayout;
|
||||
}
|
||||
|
||||
PerformanceManager::~PerformanceManager() {
|
||||
|
||||
@@ -35,12 +35,23 @@ const std::string OptionProperty::OptionsKey = "Options";
|
||||
|
||||
OptionProperty::OptionProperty(std::string identifier, std::string guiName)
|
||||
: IntProperty(std::move(identifier), std::move(guiName))
|
||||
, _displayType(DisplayType::RADIO)
|
||||
{}
|
||||
|
||||
OptionProperty::OptionProperty(std::string identifier, std::string guiName, DisplayType displayType)
|
||||
: IntProperty(std::move(identifier), std::move(guiName))
|
||||
, _displayType(displayType)
|
||||
{}
|
||||
|
||||
std::string OptionProperty::className() const {
|
||||
return "OptionProperty";
|
||||
}
|
||||
|
||||
OptionProperty::DisplayType OptionProperty::displayType() const
|
||||
{
|
||||
return _displayType;
|
||||
}
|
||||
|
||||
const std::vector<OptionProperty::Option>& OptionProperty::options() const {
|
||||
return _options;
|
||||
}
|
||||
@@ -61,6 +72,23 @@ void OptionProperty::addOption(int value, std::string desc) {
|
||||
_options.push_back(std::move(option));
|
||||
}
|
||||
|
||||
void OptionProperty::addOptions(std::vector<int> values, std::vector<std::string> descs) {
|
||||
if (values.size() != descs.size()) {
|
||||
LERROR("Skipping " << this->fullyQualifiedIdentifier() << ": "
|
||||
<< "number of values (" << values.size() << ") "
|
||||
<< "does not equal number of descriptions (" << descs.size() << ")"
|
||||
);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
LDEBUG(this->fullyQualifiedIdentifier() << ": Adding "
|
||||
<< descs[i]
|
||||
<< " (" << values[i] << ")"
|
||||
);
|
||||
this->addOption(values[i], descs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void OptionProperty::setValue(int value) {
|
||||
// Check if the passed value belongs to any option
|
||||
for (auto o : _options) {
|
||||
@@ -75,6 +103,14 @@ void OptionProperty::setValue(int value) {
|
||||
LERROR("Could not find an option for value '" << value << "' in OptionProperty");
|
||||
}
|
||||
|
||||
std::string OptionProperty::getDescriptionByValue(int value) {
|
||||
for (auto option : _options) {
|
||||
if (option.value == value) {
|
||||
return option.description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string OptionProperty::generateAdditionalDescription() const {
|
||||
// @REFACTOR from selectionproperty.cpp, possible refactoring? ---abock
|
||||
std::string result;
|
||||
|
||||
@@ -33,10 +33,10 @@ namespace properties {
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "Property";
|
||||
const std::string _metaDataKeyGuiName = "guiName";
|
||||
const std::string _metaDataKeyGroup = "Group";
|
||||
const std::string _metaDataKeyVisible = "isVisible";
|
||||
const std::string _metaDataKeyReadOnly = "isReadOnly";
|
||||
const std::string MetaDataKeyGuiName = "guiName";
|
||||
const std::string MetaDataKeyGroup = "Group";
|
||||
const std::string MetaDataKeyVisible = "isVisible";
|
||||
const std::string MetaDataKeyReadOnly = "isReadOnly";
|
||||
|
||||
const std::string _metaDataKeyViewPrefix = "view.";
|
||||
}
|
||||
@@ -61,7 +61,7 @@ Property::Property(std::string identifier, std::string guiName)
|
||||
LWARNING("Property GUI name is empty");
|
||||
|
||||
setVisible(true);
|
||||
_metaData.setValue(_metaDataKeyGuiName, std::move(guiName));
|
||||
_metaData.setValue(MetaDataKeyGuiName, std::move(guiName));
|
||||
}
|
||||
|
||||
Property::~Property() {}
|
||||
@@ -114,7 +114,7 @@ bool Property::setStringValue(std::string value) {
|
||||
|
||||
std::string Property::guiName() const {
|
||||
std::string result;
|
||||
_metaData.getValue(_metaDataKeyGuiName, result);
|
||||
_metaData.getValue(MetaDataKeyGuiName, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -123,27 +123,27 @@ std::string Property::description() const {
|
||||
}
|
||||
|
||||
void Property::setGroupIdentifier(std::string groupId) {
|
||||
_metaData.setValue(_metaDataKeyGroup, std::move(groupId));
|
||||
_metaData.setValue(MetaDataKeyGroup, std::move(groupId));
|
||||
}
|
||||
|
||||
std::string Property::groupIdentifier() const {
|
||||
std::string result;
|
||||
_metaData.getValue(_metaDataKeyGroup, result);
|
||||
_metaData.getValue(MetaDataKeyGroup, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Property::setVisible(bool state) {
|
||||
_metaData.setValue(_metaDataKeyVisible, state);
|
||||
_metaData.setValue(MetaDataKeyVisible, state);
|
||||
}
|
||||
|
||||
bool Property::isVisible() const {
|
||||
bool visible = true;
|
||||
_metaData.getValue(_metaDataKeyVisible, visible);
|
||||
_metaData.getValue(MetaDataKeyVisible, visible);
|
||||
return visible;
|
||||
}
|
||||
|
||||
void Property::setReadOnly(bool state) {
|
||||
_metaData.setValue(_metaDataKeyReadOnly, state);
|
||||
_metaData.setValue(MetaDataKeyReadOnly, state);
|
||||
}
|
||||
|
||||
void Property::setViewOption(std::string option, bool value) {
|
||||
@@ -188,14 +188,14 @@ std::string Property::generateBaseDescription() const {
|
||||
|
||||
std::string Property::generateMetaDataDescription() const {
|
||||
bool isVisible, isReadOnly;
|
||||
_metaData.getValue(_metaDataKeyVisible, isVisible);
|
||||
_metaData.getValue(_metaDataKeyReadOnly, isReadOnly);
|
||||
_metaData.getValue(MetaDataKeyVisible, isVisible);
|
||||
_metaData.getValue(MetaDataKeyReadOnly, isReadOnly);
|
||||
|
||||
return
|
||||
MetaDataKey + " = {" +
|
||||
_metaDataKeyGroup + " = '" + groupIdentifier() + "'," +
|
||||
_metaDataKeyVisible + " = " + (isVisible ? "true" : "false") + "," +
|
||||
_metaDataKeyReadOnly +" = " + (isReadOnly ? "true" : "false") + "}";
|
||||
MetaDataKeyGroup + " = '" + groupIdentifier() + "'," +
|
||||
MetaDataKeyVisible + " = " + (isVisible ? "true" : "false") + "," +
|
||||
MetaDataKeyReadOnly +" = " + (isReadOnly ? "true" : "false") + "}";
|
||||
}
|
||||
|
||||
std::string Property::generateAdditionalDescription() const {
|
||||
|
||||
@@ -71,12 +71,12 @@ Renderable* Renderable::createFromDictionary(const ghoul::Dictionary& dictionary
|
||||
}
|
||||
|
||||
Renderable::Renderable()
|
||||
: _enabled("enabled", "Is Enabled", true)
|
||||
, _startTime("")
|
||||
, _endTime("")
|
||||
, _targetBody("")
|
||||
, _hasBody(false)
|
||||
, _hasTimeInterval(false)
|
||||
: _enabled("enabled", "Is Enabled", true)
|
||||
, _startTime("")
|
||||
, _endTime("")
|
||||
, _targetBody("")
|
||||
, _hasBody(false)
|
||||
, _hasTimeInterval(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -325,11 +325,19 @@ void RenderEngine::preSynchronization() {
|
||||
|
||||
void RenderEngine::postSynchronizationPreDraw() {
|
||||
//temporary fade funtionality
|
||||
float fadedIn = 1.0;
|
||||
float fadedOut = 0.0;
|
||||
// Don't restart the fade if you've already done it in that direction
|
||||
if ( (_fadeDirection > 0 && _globalBlackOutFactor == fadedIn)
|
||||
|| (_fadeDirection < 0 && _globalBlackOutFactor == fadedOut)) {
|
||||
_fadeDirection = 0;
|
||||
}
|
||||
|
||||
if (_fadeDirection != 0) {
|
||||
if (_currentFadeTime > _fadeDuration){
|
||||
_globalBlackOutFactor = _fadeDirection > 0 ? fadedIn : fadedOut;
|
||||
_fadeDirection = 0;
|
||||
_globalBlackOutFactor = fminf(1.f, fmaxf(0.f, _globalBlackOutFactor));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (_fadeDirection < 0)
|
||||
_globalBlackOutFactor = glm::smoothstep(1.f, 0.f, _currentFadeTime / _fadeDuration);
|
||||
@@ -712,6 +720,13 @@ scripting::LuaLibrary RenderEngine::luaLibrary() {
|
||||
"bool",
|
||||
"Sets the performance measurements"
|
||||
},
|
||||
{
|
||||
"toggleFade",
|
||||
&luascriptfunctions::toggleFade,
|
||||
"number",
|
||||
"Toggles fading in or out",
|
||||
true
|
||||
},
|
||||
{
|
||||
"fadeIn",
|
||||
&luascriptfunctions::fadeIn,
|
||||
@@ -1212,16 +1227,10 @@ RenderEngine::RendererImplementation RenderEngine::rendererFromString(const std:
|
||||
|
||||
void RenderEngine::renderInformation() {
|
||||
// TODO: Adjust font_size properly when using retina screen
|
||||
const float fontSizeMono = 10.f;
|
||||
const float fontSizeTime = 15.f;
|
||||
|
||||
using Font = ghoul::fontrendering::Font;
|
||||
using ghoul::fontrendering::RenderFont;
|
||||
|
||||
|
||||
if (_showInfo && _fontDate && _fontInfo) {
|
||||
double currentTime = Time::ref().currentTime();
|
||||
|
||||
glm::vec2 penPosition = glm::vec2(
|
||||
10.f,
|
||||
OsEng.windowWrapper().viewportPixelCoordinates().w
|
||||
@@ -1248,6 +1257,7 @@ void RenderEngine::renderInformation() {
|
||||
|
||||
#ifdef OPENSPACE_MODULE_NEWHORIZONS_ENABLED
|
||||
bool hasNewHorizons = scene()->sceneGraphNode("NewHorizons");
|
||||
double currentTime = Time::ref().currentTime();
|
||||
|
||||
if (openspace::ImageSequencer::ref().isReady()) {
|
||||
penPosition.y -= 25.f;
|
||||
@@ -1265,7 +1275,6 @@ void RenderEngine::renderInformation() {
|
||||
SpiceManager::ref().getValue("PLUTO", "RADII", radii);
|
||||
a = radii.x;
|
||||
b = radii.y;
|
||||
c = radii.z;
|
||||
float radius = (a + b) / 2.f;
|
||||
float distToSurf = glm::length(nhPos.vec3()) - radius;
|
||||
|
||||
@@ -1334,11 +1343,14 @@ void RenderEngine::renderInformation() {
|
||||
int minute = second / 60;
|
||||
second = second % 60;
|
||||
|
||||
std::string hh, mm, ss, coundtown;
|
||||
std::string hh, mm, ss;
|
||||
|
||||
if (hour < 10) hh.append("0");
|
||||
if (minute < 10) mm.append("0");
|
||||
if (second < 10) ss.append("0");
|
||||
if (hour < 10)
|
||||
hh.append("0");
|
||||
if (minute < 10)
|
||||
mm.append("0");
|
||||
if (second < 10)
|
||||
ss.append("0");
|
||||
|
||||
hh.append(std::to_string(hour));
|
||||
mm.append(std::to_string(minute));
|
||||
|
||||
@@ -107,6 +107,25 @@ int setPerformanceMeasurement(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* toggleFade(float):
|
||||
* Toggle a global fade over (float) seconds
|
||||
*/
|
||||
int toggleFade(lua_State* L) {
|
||||
int nArguments = lua_gettop(L);
|
||||
if (nArguments != 1)
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments);
|
||||
|
||||
double t = luaL_checknumber(L, -1);
|
||||
|
||||
float fadedIn = 1.0;
|
||||
int direction = OsEng.renderEngine().globalBlackOutFactor() == fadedIn ? -1 : 1;
|
||||
|
||||
OsEng.renderEngine().startFading(direction, static_cast<float>(t));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* fadeIn(float):
|
||||
@@ -139,7 +158,6 @@ int fadeOut(lua_State* L) {
|
||||
}
|
||||
|
||||
int registerScreenSpaceRenderable(lua_State* L) {
|
||||
static const std::string _loggerCat = "registerScreenSpaceRenderable";
|
||||
using ghoul::lua::errorLocation;
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
@@ -151,7 +169,7 @@ int registerScreenSpaceRenderable(lua_State* L) {
|
||||
ghoul::lua::luaDictionaryFromState(L, d);
|
||||
}
|
||||
catch (const ghoul::lua::LuaFormatException& e) {
|
||||
LERROR(e.what());
|
||||
LERRORC("registerScreenSpaceRenderable", e.what());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -162,7 +180,6 @@ int registerScreenSpaceRenderable(lua_State* L) {
|
||||
}
|
||||
|
||||
int unregisterScreenSpaceRenderable(lua_State* L) {
|
||||
static const std::string _loggerCat = "unregisterScreenSpaceRenderable";
|
||||
using ghoul::lua::errorLocation;
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
@@ -173,7 +190,7 @@ int unregisterScreenSpaceRenderable(lua_State* L) {
|
||||
|
||||
std::shared_ptr<ScreenSpaceRenderable> s = OsEng.renderEngine().screenSpaceRenderable(name);
|
||||
if (!s) {
|
||||
LERROR(errorLocation(L) << "Could not find ScreenSpaceRenderable '" << name << "'");
|
||||
LERRORC("unregisterScreenSpaceRenderable", errorLocation(L) << "Could not find ScreenSpaceRenderable '" << name << "'");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -270,9 +270,6 @@ glm::mat4 ScreenSpaceRenderable::rotationMatrix() {
|
||||
if (!_useEuclideanCoordinates) {
|
||||
glm::vec2 position = _sphericalPosition.value();
|
||||
|
||||
float theta = position.x;
|
||||
float phi = position.y - M_PI_2;
|
||||
|
||||
rotation = glm::rotate(rotation, position.x, glm::vec3(0.f, 1.f, 0.f));
|
||||
rotation = glm::rotate(
|
||||
rotation,
|
||||
|
||||
@@ -91,9 +91,12 @@ void Scene::update(const UpdateData& data) {
|
||||
if (!_sceneGraphToLoad.empty()) {
|
||||
OsEng.renderEngine().scene()->clearSceneGraph();
|
||||
try {
|
||||
// Reset the InteractionManager to Orbital/default mode
|
||||
// TODO: Decide if it belongs in the scene and/or how it gets reloaded
|
||||
// OsEng.interactionHandler().setInteractionModeToOrbital();
|
||||
|
||||
loadSceneInternal(_sceneGraphToLoad);
|
||||
_sceneGraphToLoad = "";
|
||||
|
||||
|
||||
// After loading the scene, the keyboard bindings have been set
|
||||
|
||||
std::string type;
|
||||
@@ -109,6 +112,9 @@ void Scene::update(const UpdateData& data) {
|
||||
if (hasType && hasFile) {
|
||||
OsEng.interactionHandler().writeKeyboardDocumentation(type, file);
|
||||
}
|
||||
|
||||
LINFO("Loaded " << _sceneGraphToLoad);
|
||||
_sceneGraphToLoad = "";
|
||||
}
|
||||
catch (const ghoul::RuntimeError& e) {
|
||||
LERROR(e.what());
|
||||
@@ -150,6 +156,7 @@ void Scene::scheduleLoadSceneFile(const std::string& sceneDescriptionFilePath) {
|
||||
}
|
||||
|
||||
void Scene::clearSceneGraph() {
|
||||
LINFO("Clearing current scene graph");
|
||||
// deallocate the scene graph. Recursive deallocation will occur
|
||||
_graph.clear();
|
||||
//if (_root) {
|
||||
|
||||
@@ -29,8 +29,6 @@ namespace openspace {
|
||||
namespace {
|
||||
|
||||
void applyRegularExpression(lua_State* L, std::regex regex, std::vector<properties::Property*> properties, int type) {
|
||||
static const std::string _loggerCat = "property_setValue";
|
||||
|
||||
using ghoul::lua::errorLocation;
|
||||
using ghoul::lua::luaTypeToString;
|
||||
|
||||
@@ -42,10 +40,12 @@ void applyRegularExpression(lua_State* L, std::regex regex, std::vector<properti
|
||||
// value change if the types agree
|
||||
|
||||
if (type != prop->typeLua()) {
|
||||
LERROR(errorLocation(L) << "Property '" <<
|
||||
prop->fullyQualifiedIdentifier() <<
|
||||
"' does not accept input of type '" << luaTypeToString(type) <<
|
||||
"'. Requested type: '" << luaTypeToString(prop->typeLua()) << "'");
|
||||
LERRORC("property_setValue",
|
||||
errorLocation(L) << "Property '" <<
|
||||
prop->fullyQualifiedIdentifier() <<
|
||||
"' does not accept input of type '" << luaTypeToString(type) <<
|
||||
"'. Requested type: '" << luaTypeToString(prop->typeLua()) << "'"
|
||||
);
|
||||
}
|
||||
else {
|
||||
prop->setLuaValue(L);
|
||||
@@ -74,25 +74,24 @@ namespace luascriptfunctions {
|
||||
* with the type the denoted Property expects
|
||||
*/
|
||||
int property_setValueSingle(lua_State* L) {
|
||||
static const std::string _loggerCat = "property_setValue";
|
||||
using ghoul::lua::errorLocation;
|
||||
using ghoul::lua::luaTypeToString;
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
SCRIPT_CHECK_ARGUMENTS(L, 2, nArguments);
|
||||
SCRIPT_CHECK_ARGUMENTS("property_setValueSingle", L, 2, nArguments);
|
||||
|
||||
std::string uri = luaL_checkstring(L, -2);
|
||||
const int type = lua_type(L, -1);
|
||||
|
||||
properties::Property* prop = property(uri);
|
||||
if (!prop) {
|
||||
LERROR(errorLocation(L) << "Property with URI '" << uri << "' was not found");
|
||||
LERRORC("property_setValue", errorLocation(L) << "Property with URI '" << uri << "' was not found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (type != prop->typeLua()) {
|
||||
LERROR(errorLocation(L) << "Property '" << uri <<
|
||||
LERRORC("property_setValue", errorLocation(L) << "Property '" << uri <<
|
||||
"' does not accept input of type '" << luaTypeToString(type) <<
|
||||
"'. Requested type: '" << luaTypeToString(prop->typeLua()) << "'");
|
||||
return 0;
|
||||
@@ -116,12 +115,11 @@ int property_setValueSingle(lua_State* L) {
|
||||
* the regular expression. The regular expression has to be of the ECMAScript grammar.
|
||||
*/
|
||||
int property_setValueRegex(lua_State* L) {
|
||||
static const std::string _loggerCat = "property_setValueRegex";
|
||||
using ghoul::lua::errorLocation;
|
||||
using ghoul::lua::luaTypeToString;
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
SCRIPT_CHECK_ARGUMENTS(L, 2, nArguments);
|
||||
SCRIPT_CHECK_ARGUMENTS("property_setValueRegex<", L, 2, nArguments);
|
||||
|
||||
std::string regex = luaL_checkstring(L, -2);
|
||||
try {
|
||||
@@ -133,7 +131,7 @@ int property_setValueRegex(lua_State* L) {
|
||||
);
|
||||
}
|
||||
catch (const std::regex_error& e) {
|
||||
LERROR("Malformed regular expression: '" << regex << "'");
|
||||
LERRORC("property_setValueRegex", "Malformed regular expression: '" << regex << "'");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -148,12 +146,11 @@ int property_setValueRegex(lua_State* L) {
|
||||
*/
|
||||
|
||||
int property_setValue(lua_State* L) {
|
||||
static const std::string _loggerCat = "property_setValueRegex";
|
||||
using ghoul::lua::errorLocation;
|
||||
using ghoul::lua::luaTypeToString;
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
SCRIPT_CHECK_ARGUMENTS(L, 2, nArguments);
|
||||
SCRIPT_CHECK_ARGUMENTS("property_setValue", L, 2, nArguments);
|
||||
|
||||
std::string regex = luaL_checkstring(L, -2);
|
||||
|
||||
@@ -188,13 +185,16 @@ int property_getValue(lua_State* L) {
|
||||
using ghoul::lua::errorLocation;
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
SCRIPT_CHECK_ARGUMENTS(L, 1, nArguments);
|
||||
SCRIPT_CHECK_ARGUMENTS("property_getValue", L, 1, nArguments);
|
||||
|
||||
std::string uri = luaL_checkstring(L, -1);
|
||||
|
||||
openspace::properties::Property* prop = property(uri);
|
||||
if (!prop) {
|
||||
LERROR(errorLocation(L) << "Property with URL '" << uri << "' was not found");
|
||||
LERRORC(
|
||||
"property_getValue",
|
||||
errorLocation(L) << "Property with URL '" << uri << "' was not found"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@@ -209,10 +209,8 @@ int property_getValue(lua_State* L) {
|
||||
* be passed to the setPropertyValue method.
|
||||
*/
|
||||
int loadScene(lua_State* L) {
|
||||
static const std::string _loggerCat = "loadScene";
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
SCRIPT_CHECK_ARGUMENTS(L, 1, nArguments);
|
||||
SCRIPT_CHECK_ARGUMENTS("loadScene", L, 1, nArguments);
|
||||
|
||||
std::string sceneFile = luaL_checkstring(L, -1);
|
||||
|
||||
@@ -222,18 +220,17 @@ int loadScene(lua_State* L) {
|
||||
}
|
||||
|
||||
int addSceneGraphNode(lua_State* L) {
|
||||
static const std::string _loggerCat = "addSceneGraphNode";
|
||||
using ghoul::lua::errorLocation;
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
SCRIPT_CHECK_ARGUMENTS(L, 1, nArguments);
|
||||
SCRIPT_CHECK_ARGUMENTS("addSceneGraphNode", L, 1, nArguments);
|
||||
|
||||
ghoul::Dictionary d;
|
||||
try {
|
||||
ghoul::lua::luaDictionaryFromState(L, d);
|
||||
}
|
||||
catch (const ghoul::lua::LuaFormatException& e) {
|
||||
LERROR(e.what());
|
||||
LERRORC("addSceneGraphNode", e.what());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -242,28 +239,32 @@ int addSceneGraphNode(lua_State* L) {
|
||||
std::string parent = d.value<std::string>(SceneGraphNode::KeyParentName);
|
||||
SceneGraphNode* parentNode = OsEng.renderEngine().scene()->sceneGraphNode(parent);
|
||||
if (!parentNode) {
|
||||
LERROR(errorLocation(L) << "Could not find parent node '" << parent << "'");
|
||||
LERRORC(
|
||||
"addSceneGraphNode",
|
||||
errorLocation(L) << "Could not find parent node '" << parent << "'"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
node->setParent(parentNode);
|
||||
node->initialize();
|
||||
OsEng.renderEngine().scene()->sceneGraph().addSceneGraphNode(node);
|
||||
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int removeSceneGraphNode(lua_State* L) {
|
||||
static const std::string _loggerCat = "removeSceneGraphNode";
|
||||
using ghoul::lua::errorLocation;
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
SCRIPT_CHECK_ARGUMENTS(L, 1, nArguments);
|
||||
SCRIPT_CHECK_ARGUMENTS("removeSceneGraphNode", L, 1, nArguments);
|
||||
|
||||
std::string nodeName = luaL_checkstring(L, -1);
|
||||
SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(nodeName);
|
||||
if (!node) {
|
||||
LERROR(errorLocation(L) << "Could not find node '" << nodeName << "'");
|
||||
LERRORC(
|
||||
"removeSceneGraphNode",
|
||||
errorLocation(L) << "Could not find node '" << nodeName << "'"
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -499,7 +499,7 @@ bool SceneGraph::removeSceneGraphNode(SceneGraphNode* node) {
|
||||
}
|
||||
|
||||
// Remove internal node from the list of nodes
|
||||
SceneGraphNodeInternal* internalNode = *it;
|
||||
//SceneGraphNodeInternal* internalNode = *it;
|
||||
_nodes.erase(it);
|
||||
|
||||
if (OsEng.interactionHandler().focusNode() == node)
|
||||
|
||||
@@ -99,11 +99,11 @@ SceneGraphNode* SceneGraphNode::createFromDictionary(const ghoul::Dictionary& di
|
||||
LDEBUG("Successfully create ephemeris for '" << result->name() << "'");
|
||||
}
|
||||
|
||||
std::string parentName;
|
||||
if (!dictionary.getValue(KeyParentName, parentName)) {
|
||||
LWARNING("Could not find '" << KeyParentName << "' key, using 'Root'.");
|
||||
parentName = "Root";
|
||||
}
|
||||
//std::string parentName;
|
||||
//if (!dictionary.getValue(KeyParentName, parentName)) {
|
||||
// LWARNING("Could not find '" << KeyParentName << "' key, using 'Root'.");
|
||||
// parentName = "Root";
|
||||
//}
|
||||
|
||||
//SceneGraphNode* parentNode = sceneGraphNode(parentName);
|
||||
//if (parentNode == nullptr) {
|
||||
|
||||
@@ -42,18 +42,18 @@ namespace luascriptfunctions {
|
||||
case LUA_TFUNCTION:
|
||||
case LUA_TUSERDATA:
|
||||
case LUA_TTHREAD:
|
||||
LOG(level, "Function parameter was of type '" <<
|
||||
LOGC(level, "print", "Function parameter was of type '" <<
|
||||
luaTypeToString(type) << "'");
|
||||
case LUA_TNIL:
|
||||
break;
|
||||
case LUA_TBOOLEAN:
|
||||
LOG(level, lua_toboolean(L, -1));
|
||||
LOGC(level, "print", lua_toboolean(L, -1));
|
||||
break;
|
||||
case LUA_TNUMBER:
|
||||
LOG(level, lua_tonumber(L, -1));
|
||||
LOGC(level, "print", lua_tonumber(L, -1));
|
||||
break;
|
||||
case LUA_TSTRING:
|
||||
LOG(level, lua_tostring(L, -1));
|
||||
LOGC(level, "print", lua_tostring(L, -1));
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -36,10 +36,10 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
OpenSpaceModule::OpenSpaceModule(std::string name)
|
||||
: _name(std::move(name))
|
||||
{
|
||||
ghoul_assert(!_name.empty(), "Name must not be empty");
|
||||
OpenSpaceModule::OpenSpaceModule(std::string name) {
|
||||
ghoul_assert(!name.empty(), "Name must not be empty");
|
||||
|
||||
setName(name);
|
||||
}
|
||||
|
||||
void OpenSpaceModule::initialize() {
|
||||
@@ -63,10 +63,6 @@ void OpenSpaceModule::deinitialize() {
|
||||
internalDeinitialize();
|
||||
}
|
||||
|
||||
std::string OpenSpaceModule::name() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
std::string OpenSpaceModule::modulePath() const {
|
||||
std::string moduleName = name();
|
||||
std::transform(moduleName.begin(), moduleName.end(), moduleName.begin(), tolower);
|
||||
|
||||
@@ -711,7 +711,6 @@ glm::dmat3 SpiceManager::positionTransformMatrix(const std::string& fromFrame,
|
||||
throwOnSpiceError("");
|
||||
SpiceBoolean success = !(failed_c());
|
||||
reset_c();
|
||||
bool estimated = false;
|
||||
if (!success)
|
||||
result = getEstimatedTransformMatrix(fromFrame, toFrame, ephemerisTime);
|
||||
|
||||
@@ -951,9 +950,6 @@ glm::dvec3 SpiceManager::getEstimatedPosition(const std::string& target,
|
||||
throw SpiceException(format("No position for '{}' at any time", target));
|
||||
}
|
||||
|
||||
|
||||
int observerId = naifId(observer);
|
||||
|
||||
const std::set<double>& coveredTimes = _spkCoverageTimes.find(targetId)->second;
|
||||
|
||||
glm::dvec3 pos;
|
||||
|
||||
@@ -35,10 +35,8 @@ namespace luascriptfunctions {
|
||||
*/
|
||||
|
||||
int loadKernel(lua_State* L) {
|
||||
const std::string _loggerCat = "loadKernel";
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
SCRIPT_CHECK_ARGUMENTS(L, 1, nArguments);
|
||||
SCRIPT_CHECK_ARGUMENTS("loadKernel", L, 1, nArguments);
|
||||
|
||||
bool isString = (lua_isstring(L, -1) == 1);
|
||||
if (!isString) {
|
||||
@@ -59,16 +57,15 @@ int loadKernel(lua_State* L) {
|
||||
* automatically resolved.
|
||||
*/
|
||||
int unloadKernel(lua_State* L) {
|
||||
const std::string _loggerCat = "loadKernel";
|
||||
|
||||
int nArguments = lua_gettop(L);
|
||||
SCRIPT_CHECK_ARGUMENTS(L, 1, nArguments);
|
||||
SCRIPT_CHECK_ARGUMENTS("unloadKernel", L, 1, nArguments);
|
||||
|
||||
bool isString = (lua_isstring(L, -1) == 1);
|
||||
bool isNumber = (lua_isnumber(L, -1) == 1);
|
||||
|
||||
if (!isString && !isNumber) {
|
||||
LERROR(
|
||||
LERRORC(
|
||||
"loadKernel",
|
||||
ghoul::lua::errorLocation(L) <<
|
||||
"Expected argument of type 'string' or 'number'"
|
||||
);
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
@MODULE_HEADERS@
|
||||
namespace openspace {
|
||||
|
||||
std::vector<OpenSpaceModule*> AllModules = {
|
||||
@MODULE_CLASSES@};
|
||||
auto AllModules = []() -> std::vector<OpenSpaceModule*> {
|
||||
return {
|
||||
@MODULE_CLASSES@ };
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -374,8 +374,10 @@ function (handle_internal_modules)
|
||||
if (OPENSPACE_DEPENDENCIES)
|
||||
foreach (dependency ${OPENSPACE_DEPENDENCIES})
|
||||
create_option_name(${dependency} dependencyOptionName)
|
||||
set(${dependencyOptionName} ON CACHE BOOL "ff" FORCE)
|
||||
message(STATUS "${dependencyOptionName} was set to build, due to dependency towards ${optionName}")
|
||||
if (NOT ${dependencyOptionName})
|
||||
set(${dependencyOptionName} ON CACHE BOOL "ff" FORCE)
|
||||
message(STATUS "${dependencyOptionName} was set to build, due to dependency towards ${optionName}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
endif ()
|
||||
@@ -428,12 +430,17 @@ function (handle_internal_modules)
|
||||
#"#endif\n\n"
|
||||
)
|
||||
|
||||
list(APPEND MODULE_CLASSES " new ${MODULE_NAME},\n")
|
||||
list(APPEND MODULE_CLASSES " new ${MODULE_NAME},\n")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
string(REPLACE ";" "" MODULE_HEADERS ${MODULE_HEADERS})
|
||||
string(REPLACE ";" "" MODULE_CLASSES ${MODULE_CLASSES})
|
||||
if (NOT "${MODULE_HEADERS}" STREQUAL "")
|
||||
string(REPLACE ";" "" MODULE_HEADERS ${MODULE_HEADERS})
|
||||
endif ()
|
||||
|
||||
if (NOT "${MODULE_CLASSES}" STREQUAL "")
|
||||
string(REPLACE ";" "" MODULE_CLASSES ${MODULE_CLASSES})
|
||||
endif ()
|
||||
|
||||
configure_file(
|
||||
${OPENSPACE_CMAKE_EXT_DIR}/module_registration.template
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user