Merged master into StereoATM

This commit is contained in:
Jonathas Costa
2018-05-14 13:23:47 -04:00
101 changed files with 2620 additions and 2152 deletions

View File

@@ -315,7 +315,7 @@ void mainInitFunc() {
std::string screenshotPath = "${SCREENSHOTS}";
std::string screenshotNames = "OpenSpace";
if (OsEng.configuration().shouldUseScreenshotDate) {
std::time_t now = std::time(nullptr);
std::tm* nowTime = std::localtime(&now);
@@ -631,7 +631,6 @@ int main_main(int argc, char** argv) {
std::pair<int, int> glVersion = supportedOpenGLVersion();
// Create the OpenSpace engine and get arguments for the SGCT engine
// @CLEANUP: Replace the return valua with throwing an exception --abock
std::vector<std::string> sgctArguments;
bool requestQuit = false;
try {

View File

@@ -61,12 +61,12 @@ namespace {
void initTextureReaders() {
#ifdef GHOUL_USE_DEVIL
ghoul::io::TextureReader::ref().addReader(
std::make_shared<ghoul::io::TextureReaderDevIL>()
std::make_unique<ghoul::io::TextureReaderDevIL>()
);
#endif // GHOUL_USE_DEVIL
#ifdef GHOUL_USE_FREEIMAGE
ghoul::io::TextureReader::ref().addReader(
std::make_shared<ghoul::io::TextureReaderFreeImage>()
std::make_unique<ghoul::io::TextureReaderFreeImage>()
);
#endif // GHOUL_USE_FREEIMAGE
}

View File

@@ -0,0 +1,22 @@
-- This asset requires OpenSpace to be built with the OPENSPACE_MODULE_TOYVOLUME enabled
local assetHelper = asset.require("util/asset_helper")
local transforms = asset.require("scene/solarsystem/sun/transforms")
local ToyVolume = {
Identifier = "RenderableToyVolume",
Parent = transforms.SolarSystemBarycenter.Identifier,
Renderable = {
Type = "RenderableToyVolume",
Size = {5, 5, 5},
ScalingExponent = 11,
StepSize = 0.01,
Color = {1, 0, 0, 1}
},
GUI = {
Path = "/Examples"
}
}
local objects = { ToyVolume }
assetHelper.registerSceneGraphNodesAndExport(asset, objects)

View File

@@ -40,3 +40,11 @@ asset.syncedResource({
Type = "UrlSynchronization",
Url = "http://ipv4.download.thinkbroadband.com/5MB.zip"
})
asset.syncedResource({
Name = "Example No Hash",
Type = "UrlSynchronization",
Identifier = "no_hash",
Url = "http://wms.itn.liu.se/Mercury/Messenger_Mosaic/Messenger_Mosaic.wms",
UseHash = false
})

View File

@@ -110,9 +110,15 @@ local Earth = {
)
},
{
Identifier = "BMNG",
Name = "BMNH [Utah]",
Identifier = "BMNG_Utah",
FilePath = mapServiceConfigsPath .. "/Utah/Bmng.wms"
},
{
Name = "BMNH [Sweden]",
Identifier = "BMNG_Sweden",
FilePath = mapServiceConfigsPath .. "/LiU/Bmng.wms"
},
{
Identifier = "AMSR2_GCOM_W1_Sea_Ice_Concentration_Temporal",
Name = "AMSR2 GCOM W1 Sea Ice Concentration (Temporal)",
@@ -188,9 +194,15 @@ local Earth = {
Enabled = true
},
{
Identifier = "GEBCO",
Name = "Gebco [Utah]",
Identifier = "Gebco_Utah",
FilePath = mapServiceConfigsPath .. "/Utah/Gebco.wms"
}
},
{
Name = "Gebco [Sweden]",
Identifier = "Gebco_Sweden",
FilePath = mapServiceConfigsPath .. "/LiU/Gebco.wms"
},
},
Overlays = {
{

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Earth/Bmng/tile/${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>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/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>
<MaxConnections>10</MaxConnections>
</GDAL_WMS>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Moon/Clem_Uvvis/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>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/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>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Moon/Lola_Clr_Shade/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>

View File

@@ -0,0 +1,21 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Moon/Lola_DEM/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>
<DataType>Int16</DataType>
<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>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Moon/Lola_Shade/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>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Moon/Uvvis_Hybrid/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>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/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>

View File

@@ -1,68 +0,0 @@
<GDAL_WMS>
<Service name="TiledWMS">
<ServerUrl>http://onmoon.lmmp.nasa.gov/wms.cgi?</ServerUrl>
<TiledGroupName>LRO WAC Mosaic, LMMP</TiledGroupName>
<!--
Clementine LO Hybrid, LMMP
Clementine Mosaic, LMMP
LRO WAC Mosaic, LMMP
LOLA v2, LMMP
LOLA Shade v2, LMMP
LOLA ClrShade v2, LMMP
LOLA v4, LMMP
LOLA v4 Coverage, LMMP
LOLA v4 NoData Mask, LMMP
LOLA Shade v4, LMMP
LOLA ClrShade v4, LMMP
Apollo 15, LMMP
Apollo 15 DEM Grayscale, LMMP
Apollo 15 HillShade, LMMP
Apollo 15 Colorized HillShade, LMMP
Apollo 15 Colorized Confidence, LMMP
Apollo 16 image, LMMP
Apollo 16 DEM Grayscale, LMMP
Apollo 16 HillShade, LMMP
Apollo 16 Colorized HillShade, LMMP
Apollo 16 Colorized Confidence, LMMP
Apollo 17 image Old, LMMP
Apollo 17 image, LMMP
Apollo 17 DEM Grayscale, LMMP
Apollo 17 HillShade, LMMP
Apollo 17 Colorized HillShade, LMMP
Apollo 17 Colorized Confidence, LMMP
Apollo Zone image, LMMP
Apollo Zone image 3033, LMMP
Apollo Zone DEM Grayscale, LMMP
Apollo Zone HillShade, LMMP
Apollo Zone Colorized HillShade, LMMP
Apollo Zone Colorized Confidence, LMMP
LRO Diviner CF Filled, LMMP
LRO Diviner CF, LMMP
Clementine Color Ratio, LMMP
Clementine Optical Maturity, LMMP
Clementine FeO abundance, LMMP
Clementine TiO2 abundance, LMMP
LP Fe Abundance, colorized, LMMP
LP K Abundance, colorized, LMMP
LP Th Abundance, colorized, LMMP
LP H Abundance, colorized, LMMP
-->
</Service>
<DataWindow>
<UpperLeftX>-180.0</UpperLeftX>
<UpperLeftY>90</UpperLeftY>
<LowerRightX>180.0</LowerRightX>
<LowerRightY>-90</LowerRightY>
<TileLevel>20</TileLevel>
<TileCountX>2</TileCountX>
<TileCountY>1</TileCountY>
<YOrigin>top</YOrigin>
</DataWindow>
<BlockSizeX>512</BlockSizeX>
<BlockSizeY>512</BlockSizeY>
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>400</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
<Timeout>5</Timeout>
</GDAL_WMS>

View File

@@ -30,38 +30,85 @@ local Moon = {
SegmentsPerPatch = 64,
Layers = {
ColorLayers = {
-- Utah based servers
{
Identifier = "ClemUvvis",
Name = "Clem Uvvis",
FilePath = mapServiceConfigs .. "/Utah/ClemUvvis.wms"
},
{
Identifier = "Kaguya",
FilePath = mapServiceConfigs .. "/Utah/Kaguya.wms"
},
{
Identifier = "WAC_Utah",
Name = "WAC Utah",
Name = "WAC [Utah]",
FilePath = mapServiceConfigs .. "/Utah/Wac.wms",
Enabled = true
},
-- LMMP based servers
{
Identifier = "OnMoon",
FilePath = mapServiceConfigs .. "/OnMoonColor.wms"
}
Identifier = "WAC_Sweden",
Name = "WAC [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/WAC.wms"
},
{
Identifier = "ClemUvvis_Utah",
Name = "Clem Uvvis [Utah]",
FilePath = mapServiceConfigs .. "/Utah/ClemUvvis.wms"
},
{
Identifier = "ClemUvvis_Sweden",
Name = "Clem Uvvis [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Clem_Uvvis.wms"
},
{
Identifier = "UvvisHybrid_Utah",
Name = "Uvvis Hybrid [Utah]",
FilePath = mapServiceConfigs .. "/Utah/UvvisHybrid.wms"
},
{
Identifier = "UvvisHybrid_Sweden",
Name = "Uvvis Hybrid [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Uvvis_Hybrid.wms"
},
{
Identifier = "Kaguya_Utah",
Name = "Kaguya [Utah]",
FilePath = mapServiceConfigs .. "/Utah/Kaguya.wms"
},
{
Identifier = "Kaguya_Sweden",
Name = "Kaguya [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Kaguya.wms"
},
{
Identifier = "Lola_Clr_Shade_Utah",
Name = "Lola Clear Shade [Utah]",
FilePath = mapServiceConfigs .. "/Utah/LolaClrShade.wms"
},
{
Identifier = "Lola_Clr_Shade_Sweden",
Name = "Lola Clear Shade [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Lola_Clr_Shade.wms"
},
{
Identifier = "Lola_Shade_Utah",
Name = "Lola Shade [Utah]",
FilePath = mapServiceConfigs .. "/Utah/LolaShade.wms"
},
{
Identifier = "Lola_Shade_Sweden",
Name = "Lola Shade [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Lola_Shade.wms"
},
},
HeightLayers = {
-- Utah based servers
{
Identifier = "LolaDem",
Name = "WAC [Utah]",
Identifier = "LolaDem_Utah",
Name = "Lola DEM [Utah]",
FilePath = mapServiceConfigs .. "/Utah/LolaDem.wms",
Enabled = true,
TilePixelSize = 64,
Settings = { Multiplier = 0.5 }
},
{
Identifier = "LolaDem_Sweden",
Name = "Lola DEM [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Lola_DEM.wms",
TilePixelSize = 64,
Settings = { Multiplier = 0.5 }
}
}
},
ShadowGroup = {

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Mars/Color/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["Mars2000",DATUM["D_Mars_2000",SPHEROID["Mars_2000_IAU_IAG",3396190,169.8944472236118]],PRIMEM["Greenwich",0],UNIT["Decimal_Degree",0.0174532925199433]]</Projection>
<BlockSizeX>512</BlockSizeX>
<BlockSizeY>512</BlockSizeY>
<BandsCount>3</BandsCount>
<MaxConnections>10</MaxConnections>
</GDAL_WMS>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/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>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Mars/Mola_CTX/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>7</TileLevel>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>PROJCS["Mars2000_ECylindrical_clon0",GEOGCS["GCS_Mars_2000_Sphere",DATUM["Mars_2000_Sphere",SPHEROID["Mars_2000_Sphere",3396190,0]],PRIMEM["Reference_Meridian",0],UNIT["degree",0.0174532925199433]],PROJECTION["Equirectangular"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",0],PARAMETER["standard_parallel_1",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]]]</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<BandsCount>1</BandsCount>
<MaxConnections>10</MaxConnections>
</GDAL_WMS>

View File

@@ -21,28 +21,3 @@
<Path>./gdal-cache/mola_elevation</Path>
<Timeout>5</Timeout>
</GDAL_WMS>
<!-- <GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Mars/Mola_Elevation/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>
<DataType>Int16</DataType>
<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>
<MaxConnections>10</MaxConnections>
<Timeout>5</Timeout>
</GDAL_WMS>
-->

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Mars/Mola_HRSC/tile/${z}/${y}/${x}</ServerUrl>
</Service>
<DataWindow>
<UpperLeftX>-180.0</UpperLeftX>
<UpperLeftY>90.0</UpperLeftY>
<LowerRightX>180.0</LowerRightX>
<LowerRightY>-90.0</LowerRightY>
<SizeX>106694</SizeX>
<SizeY>53347</SizeY>
<TileLevel>7</TileLevel>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>GEOGCS["GCS_Mars_2000_Sphere",DATUM["D_Mars_2000_Sphere",SPHEROID["Mars_2000_Sphere_IAU_IAG",3396190.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
<BlockSizeX>512</BlockSizeX>
<BlockSizeY>512</BlockSizeY>
<BandsCount>3</BandsCount>
<MaxConnections>10</MaxConnections>
</GDAL_WMS>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Mars/Mola_PseudoColor/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>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http:/wms.itn.liu.se/Mars/Themis_IR_Day/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>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Mars/Themis_IR_Night/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>

View File

@@ -12,7 +12,7 @@
<TileLevel>7</TileLevel>
<YOrigin>top</YOrigin> <!-- fail: bottom -->
</DataWindow>
<!-- <Projection>GEOGCS["GCS_Mars_2000_Sphere",DATUM["D_Mars_2000_Sphere",SPHEROID["Mars_2000_Sphere_IAU_IAG",3396190.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection> -->
<Projection>GEOGCS["GCS_Mars_2000_Sphere",DATUM["D_Mars_2000_Sphere",SPHEROID["Mars_2000_Sphere_IAU_IAG",3396190.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]</Projection>
<BlockSizeX>512</BlockSizeX>
<BlockSizeY>512</BlockSizeY>
<BandsCount>3</BandsCount>

View File

@@ -7,8 +7,8 @@
<UpperLeftY>90.0</UpperLeftY>
<LowerRightX>180.0</LowerRightX>
<LowerRightY>-90.0</LowerRightY>
<SizeX>213390</SizeX>
<SizeY>106695</SizeY>
<SizeX>213388</SizeX>
<SizeY>71130</SizeY>
<TileLevel>9</TileLevel>
<YOrigin>top</YOrigin>
</DataWindow>

View File

@@ -19,8 +19,8 @@ local mapServiceConfigs = asset.localResource("map_service_configs")
local color_layers = {
{
Identifier = "MOC_WA_AMNH_Color",
Name = "MOC WA AMNH Color",
Identifier = "MOC_WA_Color_Utah",
Name = "MOC WA Color [Utah]",
FilePath = mapServiceConfigs .. "/Utah/Mars_Color.wms",
Enabled = true,
Fallback = {
@@ -30,40 +30,54 @@ local color_layers = {
}
},
{
Identifier = "Viking_MDIM",
Name = "Viking MDIM",
FilePath = mapServiceConfigs .. "/MARS_Viking_MDIM21.wms"
},
{
Identifier = "MOLA_Pseudo_Color",
Name = "MOLA Pseudo Color",
FilePath = mapServiceConfigs .. "/Utah/Mola_PseudoColor.wms"
},
{
Identifier = "MOLA_HRSC",
Name = "MOLA HRSC",
FilePath = mapServiceConfigs .. "/Utah/Mola_HRSC.wms"
Identifier = "MOC_WA_Color_LiU",
Name = "MOC WA Color [LiU]",
FilePath = mapServiceConfigs .. "/LiU/Color.wms",
Fallback = {
Name = "Mars Texture",
FilePath = textures .. "/mars.jpg",
Enabled = true
}
},
{
Identifier = "Viking_MDIM_Utah",
Name = "Viking MDIM [Utah]",
FilePath = mapServiceConfigs .. "/Utah/Mdim.wms"
},
{
Identifier = "Viking_MDIM_Sweden",
Name = "Viking MDIM [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/MDIM.wms"
},
{
Identifier = "Viking_MDIM_AWS",
Name = "Viking MDIM [AWS]",
FilePath = mapServiceConfigs .. "/AWS/Mdim.wms"
},
{
Identifier = "MOLA_Pseudo_Color_Utah",
Name = "MOLA Pseudo Color [Utah]",
FilePath = mapServiceConfigs .. "/Utah/Mola_PseudoColor.wms"
},
{
Identifier = "MOLA_Pseudo_Color_Sweden",
Name = "MOLA Pseudo Color [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Mola_PseudoColor.wms"
},
{
Identifier = "MOLA_Pseudo_Color_AWS",
Name = "MOLA Pseudo Color [AWS]",
FilePath = mapServiceConfigs .. "/AWS/Mola_PseudoColor.wms"
},
{
Identifier = "CTX_Mosaic_LiU",
Name = "CTX Mosaic [LiU]",
FilePath = mapServiceConfigs .. "/LiU/CTX.wms",
BlendMode = "Color"
Identifier = "MOLA_HRSC_Utah",
Name = "MOLA HRSC [Utah]",
FilePath = mapServiceConfigs .. "/Utah/Mola_HRSC.wms"
},
{
Identifier = "MOLA_HRSC_Sweden",
Name = "MOLA HRSC [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Mola_HRSC.wms"
},
{
Identifier = "CTX_Mosaic_Utah",
@@ -71,6 +85,12 @@ local color_layers = {
FilePath = mapServiceConfigs .. "/Utah/CTX.wms",
BlendMode = "Color"
},
{
Identifier = "CTX_Mosaic_Sweden",
Name = "CTX Mosaic [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/CTX.wms",
BlendMode = "Color"
},
{
Identifier = "CTX_Mosaic_AWS",
Name = "CTX Mosaic [AWS]",
@@ -83,6 +103,18 @@ local color_layers = {
FilePath = mapServiceConfigs .. "/Utah/Themis_IR_Day.wms",
BlendMode = "Color"
},
{
Identifier = "Themis_IR_Day_Sweden",
Name = "Themis IR Day [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Themis_IR_Day.wms",
BlendMode = "Color"
},
{
Identifier = "Themis_IR_Day_AWS",
Name = "Themis IR Day [AWS]",
FilePath = mapServiceConfigs .. "/AWS/Themis_IR_Day.wms",
BlendMode = "Color"
},
{
Identifier = "Themis_IR_Night_Utah",
Name = "Themis IR Night [Utah]",
@@ -90,9 +122,9 @@ local color_layers = {
BlendMode = "Color"
},
{
Identifier = "Themis_IR_Day_AWS_",
Name = "Themis IR Day [AWS]",
FilePath = mapServiceConfigs .. "/AWS/Themis_IR_Day.wms",
Identifier = "Themis_IR_Night_Sweden",
Name = "Themis IR Night [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Themis_IR_Night.wms",
BlendMode = "Color"
},
{
@@ -127,13 +159,13 @@ local height_layers = {
Identifier = "Mola_Europe",
Name = "Mola Elevation [Europe]",
FilePath = mapServiceConfigs .. "/LiU/Mola_Elevation.wms",
Enabled = true,
TilePixelSize = 90
},
{
Identifier = "Mola_Utah",
Name = "Mola Elevation [Utah]",
FilePath = mapServiceConfigs .. "/Utah/Mola_Elevation.wms",
Enabled = true,
TilePixelSize = 90
},
{

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Mercury/Messenger_MDIS/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>

View File

@@ -0,0 +1,20 @@
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://wms.itn.liu.se/Mercury/Messenger_Mosaic/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>

View File

@@ -8,7 +8,6 @@ asset.request('./trail')
local mapServiceConfigs = asset.localResource("map_service_configs")
local color_layers = {
-- Utah based servers
{
Identifier = "Messenger_MDIS_Utah",
Name = "Messenger MDIS [Utah]",
@@ -16,16 +15,25 @@ local color_layers = {
Enabled = true
},
{
Identifier = "Messenger_Mosaic_Utah",
Name = "Messenger Mosaic [Utah]",
FilePath = mapServiceConfigs .. "/Utah/MessengerMosaic.wms"
Identifier = "Messenger_MDIS_Sweden",
Name = "Messenger MDIS [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Messenger_MDIS.wms",
},
-- AWS based servers
{
Identifier = "Messenger_MDIS_AWS",
Name = "Messenger MDIS [AWS]",
FilePath = mapServiceConfigs .. "/AWS/MessengerMdis.wms"
},
{
Identifier = "Messenger_Mosaic_Utah",
Name = "Messenger Mosaic [Utah]",
FilePath = mapServiceConfigs .. "/Utah/MessengerMosaic.wms"
},
{
Identifier = "Messenger_Mosaic_Sweden",
Name = "Messenger Mosaic [Sweden]",
FilePath = mapServiceConfigs .. "/LiU/Messenger_Mosaic.wms"
},
{
Identifier = "Messenger_Mosaic_AWS",
Name = "Messenger Mosaic [AWS]",

View File

@@ -16,7 +16,7 @@ local MercuryTrail = {
},
Color = { 0.6, 0.5, 0.5 },
Period = 87.968,
Resolution = 100
Resolution = 1000
},
Tag = { "planetTrail_solarSystem", "planetTrail_terrestrial" },
GUI = {

View File

@@ -9,7 +9,7 @@ local textures = asset.syncedResource({
Type = "HttpSynchronization",
Name = "Saturn textures",
Identifier = "saturn_textures",
Version = 2
Version = 3
})
local Saturn = {
@@ -48,7 +48,7 @@ local SaturnRings = {
Renderable = {
Type = "RenderableRings",
Texture = textures .. "/saturn_rings.png",
Size = 140220000,
Size = 140445000,
Offset = { 74500 / 140445.100671159, 1.0 } -- min / max extend
},
GUI = {

View File

@@ -22,6 +22,27 @@ asset.require('util/default_dashboard')
local VoyagerAsset = asset.require('scene/solarsystem/missions/voyager/voyager1')
assetHelper.registerDashboardItems(asset, {
{
Type = "DashboardItemDistance",
Identifier = "Voyager1Distance",
GuiName = "Voyager 1 - Earth Distance",
SourceType = "Node",
SourceNodeName = "Voyager_1",
DestinationType = "Node",
DestinationNodeName = "Earth"
},
{
Type = "DashboardItemDistance",
Identifier = "Voyager2Distance",
GuiName = "Voyager 2 - Earth Distance",
SourceType = "Node",
SourceNodeName = "Voyager_2",
DestinationType = "Node",
DestinationNodeName = "Earth"
}
})
asset.onInitialize(function ()
openspace.time.setTime("1977 SEP 10 12:00:00")

View File

@@ -39,7 +39,9 @@ struct Configuration {
std::string windowConfiguration = "${CONFIG}/single.xml";
std::string asset = "default";
std::vector<std::string> globalCustomizationScripts;
std::map<std::string, std::string> pathTokens;
std::map<std::string, std::string> pathTokens = {
{ "CACHE" , "CACHE = \"${BASE}/cache\"" }
};
std::map<std::string, std::string> fonts;
struct Logging {
@@ -83,14 +85,14 @@ struct Configuration {
std::string onScreenTextScaling = "window";
bool usePerSceneCache = false;
bool isRenderingOnMasterDisabled = false;
bool isSceneTranslationOnMasterDisabled = false;
std::map<std::string, ghoul::Dictionary> moduleConfigurations;
std::string renderingMethod = "Framebuffer";
struct OpenGLDebugContext {
bool isActive = false;
bool isSynchronous = true;
@@ -129,6 +131,8 @@ std::string findConfiguration(const std::string& filename = "openspace.cfg");
Configuration loadConfigurationFromFile(const std::string& filename);
void parseLuaState(Configuration& configuration);
} // namespace openspace
#endif // __OPENSPACE_CORE___CONFIGURATION___H__

View File

@@ -76,12 +76,12 @@ namespace scripting {
struct ShutdownInformation {
// Whether the application is currently in shutdown mode (i.e. counting down the
// timer and closing it at '0'
bool inShutdown;
bool inShutdown = false;
// Total amount of time the application will wait before actually shutting down
float waitTime;
float waitTime = 0.f;
// Current state of the countdown; if it reaches '0', the application will
// close
float timer;
float timer = 0.f;
};
class OpenSpaceEngine {
@@ -95,7 +95,7 @@ public:
static OpenSpaceEngine& ref();
static bool isCreated();
~OpenSpaceEngine();
~OpenSpaceEngine() = default;
// callbacks
void initialize();
@@ -121,6 +121,9 @@ public:
void scheduleLoadSingleAsset(std::string assetPath);
void toggleShutdownMode();
// On purpose, there is no function that returns a non-const reference to
// Configuration; that guards us against anyone in the program changing the
// configuration values underneath our feet
const Configuration& configuration() const;
// Guaranteed to return a valid pointer
@@ -196,7 +199,6 @@ private:
OpenSpaceEngine(std::string programName,
std::unique_ptr<WindowWrapper> windowWrapper);
std::unique_ptr<LoadingScreen> createLoadingScreen();
void loadSingleAsset(const std::string& assetPath);
void gatherCommandlineArguments();
void loadFonts();
@@ -241,7 +243,7 @@ private:
properties::StringProperty sourceControlInformation;
} _versionInformation;
bool _hasScheduledAssetLoading;
bool _hasScheduledAssetLoading = false;
std::string _scheduledAssetPathToLoad;
struct {
@@ -269,7 +271,9 @@ private:
// The first frame might take some more time in the update loop, so we need to know to
// disable the synchronization; otherwise a hardware sync will kill us after 1 minute
bool _isFirstRenderingFirstFrame;
bool _isFirstRenderingFirstFrame = true;
glm::dvec2 _mousePosition;
static OpenSpaceEngine* _engine;
};

View File

@@ -22,8 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___INPUTDEVICESTATES___H__
#define __OPENSPACE_CORE___INPUTDEVICESTATES___H__
#ifndef __OPENSPACE_CORE___CAMERAINTERACTIONSTATES___H__
#define __OPENSPACE_CORE___CAMERAINTERACTIONSTATES___H__
#include <openspace/interaction/delayedvariable.h>
#include <ghoul/glm.h>
@@ -43,7 +43,7 @@ public:
virtual ~CameraInteractionStates() = default;
virtual void updateStateFromInput(const InputState& inputState, double deltaTime) = 0;
void setRotationalFriction(double friction);
void setHorizontalFriction(double friction);
void setVerticalFriction(double friction);
@@ -78,4 +78,4 @@ protected:
} // namespace openspace::interaction
#endif // __OPENSPACE_CORE___INPUTDEVICESTATES___H__
#endif // __OPENSPACE_CORE___CAMERAINTERACTIONSTATES___H__

View File

@@ -22,8 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___CAMERAINTERACTIONSTATES___H__
#define __OPENSPACE_CORE___CAMERAINTERACTIONSTATES___H__
#ifndef __OPENSPACE_CORE___INPUTDEVICESTATES___H__
#define __OPENSPACE_CORE___INPUTDEVICESTATES___H__
#include <openspace/interaction/delayedvariable.h>
#include <ghoul/glm.h>
@@ -43,7 +43,7 @@ public:
virtual ~CameraInteractionStates() = default;
virtual void updateStateFromInput(const InputState& inputState, double deltaTime) = 0;
void setRotationalFriction(double friction);
void setHorizontalFriction(double friction);
void setVerticalFriction(double friction);
@@ -78,4 +78,4 @@ protected:
} // namespace openspace::interaction
#endif // __OPENSPACE_CORE___CAMERAINTERACTIONSTATES___H__
#endif // __OPENSPACE_CORE___INPUTDEVICESTATES___H__

View File

@@ -22,8 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___JOYSTICKSTATE___H__
#define __OPENSPACE_CORE___JOYSTICKSTATE___H__
#ifndef __OPENSPACE_CORE___JOYSTICKCAMERASTATES___H__
#define __OPENSPACE_CORE___JOYSTICKCAMERASTATES___H__
#include <openspace/interaction/camerainteractionstates.h>
@@ -115,8 +115,9 @@ std::string to_string(const openspace::interaction::JoystickCameraStates::AxisTy
namespace ghoul {
template <>
openspace::interaction::JoystickCameraStates::AxisType from_string(const std::string& string);
openspace::interaction::JoystickCameraStates::AxisType
from_string(const std::string& string);
} // namespace ghoul
#endif // __OPENSPACE_CORE___JOYSTICKSTATE___H__
#endif // __OPENSPACE_CORE___JOYSTICKCAMERASTATES___H__

View File

@@ -52,9 +52,9 @@ enum class JoystickAction : uint8_t {
*/
struct JoystickInputState {
/// The maximum number of supported axes
static const int MaxAxes = 8;
static constexpr const int MaxAxes = 8;
/// The maximum number of supported buttons
static const int MaxButtons = 32;
static constexpr const int MaxButtons = 32;
/// Marks whether this joystick is connected. If this value is \c false, all other
/// members of this struct are undefined
@@ -123,4 +123,4 @@ openspace::interaction::JoystickAction from_string(const std::string& str);
} // namespace ghoul
#endif // __OPENSPACE_CORE___JOYSTICKSTATE___H__
#endif // __OPENSPACE_CORE___JOYSTICKINPUTSTATE___H__

View File

@@ -86,8 +86,10 @@ public:
void setJoystickAxisMapping(
int axis,
JoystickCameraStates::AxisType mapping,
JoystickCameraStates::AxisInvert shouldInvert = JoystickCameraStates::AxisInvert::No,
JoystickCameraStates::AxisNormalize shouldNormalize = JoystickCameraStates::AxisNormalize::No
JoystickCameraStates::AxisInvert shouldInvert =
JoystickCameraStates::AxisInvert::No,
JoystickCameraStates::AxisNormalize shouldNormalize =
JoystickCameraStates::AxisNormalize::No
);
JoystickCameraStates::AxisInformation joystickAxisMapping(int axis) const;

View File

@@ -86,7 +86,7 @@ private:
properties::FloatProperty _followFocusNodeRotationDistance;
properties::FloatProperty _minimumAllowedDistance;
properties::FloatProperty _mouseSensitivity;
properties::FloatProperty _joystickSensitivity;

View File

@@ -45,7 +45,7 @@ namespace ghoul::filesystem { class File; }
namespace ghoul::opengl {
class ProgramObject;
class Texture;
} // namespace opengl
} // namespace ghoul::opengl
namespace openspace {
@@ -61,8 +61,6 @@ public:
void initialize() override;
void deinitialize() override;
void setCamera(Camera* camera) override;
void setScene(Scene* scene) override;
void setResolution(glm::ivec2 res) override;
void setNAaSamples(int nAaSamples) override;
void setHDRExposure(float hdrExposure) override;
@@ -79,7 +77,8 @@ public:
void postRaycast(const RaycasterTask& raycasterTask);
void update() override;
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
void render(Scene* scene, Camera* camera, float blackoutFactor,
bool doPerformanceMeasurements) override;
/**
* Update render data
@@ -97,8 +96,6 @@ private:
void saveTextureToMemory(const GLenum color_buffer_attachment,
const int width, const int height, std::vector<double> & memory) const;
Camera* _camera;
Scene* _scene;
glm::ivec2 _resolution;
bool _dirtyResolution;

View File

@@ -44,7 +44,7 @@ namespace ghoul::filesystem { class File; }
namespace ghoul::opengl {
class ProgramObject;
class Texture;
}
} // namespace ghoul::opengl
namespace openspace {
@@ -76,8 +76,6 @@ public:
void updateHDRData();
void updateMSAASamplingPattern();
void setCamera(Camera* camera) override;
void setScene(Scene* scene) override;
void setResolution(glm::ivec2 res) override;
void setNAaSamples(int nAaSamples) override;
void setHDRExposure(float hdrExposure) override;
@@ -86,13 +84,13 @@ public:
float hdrBackground() const override;
int nAaSamples() const override;
/*const double * mSSAPattern() const override;*/
std::vector<double> mSSAPattern() const override;
void update() override;
void render(float blackoutFactor, bool doPerformanceMeasurements) override;
void performRaycasterTasks(const std::vector<RaycasterTask>& tasks);
void performDeferredTasks(const std::vector<DeferredcasterTask>& tasks);
void render(Scene* scene, Camera* camera, float blackoutFactor,
bool doPerformanceMeasurements) override;
/**
* Update render data
@@ -135,8 +133,6 @@ private:
bool _dirtyResolution;
bool _dirtyMsaaSamplingPattern;
Camera* _camera;
Scene* _scene;
glm::vec2 _resolution;
int _nAaSamples;
float _hdrExposure;

View File

@@ -36,7 +36,7 @@
namespace ghoul {
class Dictionary;
class SharedMemory;
}
} // ghoul
namespace ghoul::fontrendering { class Font; }
namespace ghoul::opengl { class ProgramObject; }
@@ -77,8 +77,7 @@ public:
Scene* scene();
void updateScene();
Camera* camera() const;
Renderer* renderer() const;
const Renderer& renderer() const;
RendererImplementation rendererImplementation() const;
RaycasterManager& raycasterManager();
DeferredcasterManager& deferredcasterManager();
@@ -91,6 +90,8 @@ public:
void render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix,
const glm::mat4& projectionMatrix);
bool mouseActivationCallback(const glm::dvec2& mousePosition) const;
void renderOverlays(const ShutdownInformation& shutdownInfo);
void postDraw();
@@ -101,24 +102,19 @@ public:
float globalBlackOutFactor();
void setGlobalBlackOutFactor(float factor);
void addScreenSpaceRenderable(std::shared_ptr<ScreenSpaceRenderable> s);
void removeScreenSpaceRenderable(std::shared_ptr<ScreenSpaceRenderable> s);
void addScreenSpaceRenderable(std::unique_ptr<ScreenSpaceRenderable> s);
void removeScreenSpaceRenderable(ScreenSpaceRenderable* s);
void removeScreenSpaceRenderable(const std::string& name);
std::shared_ptr<ScreenSpaceRenderable> screenSpaceRenderable(const std::string& name);
ScreenSpaceRenderable* screenSpaceRenderable(const std::string& name);
std::vector<ScreenSpaceRenderable*> screenSpaceRenderables() const;
std::unique_ptr<ghoul::opengl::ProgramObject> buildRenderProgram(
std::string name,
std::string vsPath,
std::string fsPath,
const ghoul::Dictionary& dictionary = ghoul::Dictionary());
const std::string& name, const std::string& vsPath, std::string fsPath,
ghoul::Dictionary dictionary = ghoul::Dictionary());
std::unique_ptr<ghoul::opengl::ProgramObject> buildRenderProgram(
std::string name,
std::string vsPath,
std::string fsPath,
std::string csPath,
const ghoul::Dictionary& dictionary = ghoul::Dictionary());
const std::string& name, const std::string& vsPath, std::string fsPath,
const std::string& csPath, ghoul::Dictionary dictionary = ghoul::Dictionary());
void removeRenderProgram(ghoul::opengl::ProgramObject* program);
@@ -144,13 +140,13 @@ public:
* Lets the renderer update the data to be brought into the rendererer programs
* as a 'rendererData' variable in the dictionary.
*/
void setRendererData(const ghoul::Dictionary& rendererData);
void setRendererData(ghoul::Dictionary rendererData);
/**
* Lets the renderer update the data to be brought into the post rendererer programs
* as a 'resolveData' variable in the dictionary.
*/
void setResolveData(const ghoul::Dictionary& resolveData);
void setResolveData(ghoul::Dictionary resolveData);
/**
* Returns the Lua library that contains all Lua functions available to affect the
@@ -164,8 +160,6 @@ public:
glm::ivec2 renderingResolution() const;
glm::ivec2 fontResolution() const;
std::vector<Syncable*> getSyncables();
properties::PropertyOwner& screenSpaceOwner();
private:
@@ -199,31 +193,37 @@ private:
properties::BoolProperty _showCameraInfo;
properties::TriggerProperty _takeScreenshot;
bool _shouldTakeScreenshot;
bool _shouldTakeScreenshot = false;
properties::BoolProperty _applyWarping;
properties::BoolProperty _showFrameNumber;
properties::BoolProperty _disableMasterRendering;
properties::BoolProperty _disableSceneTranslationOnMaster;
float _globalBlackOutFactor;
float _fadeDuration;
float _currentFadeTime;
int _fadeDirection;
float _globalBlackOutFactor = 1.f;
float _fadeDuration = 2.f;
float _currentFadeTime = 0.f;
int _fadeDirection = 0;
properties::IntProperty _nAaSamples;
properties::FloatProperty _hdrExposure;
properties::FloatProperty _hdrBackground;
properties::FloatProperty _gamma;
uint64_t _frameNumber;
uint64_t _frameNumber = 0;
std::vector<ghoul::opengl::ProgramObject*> _programs;
properties::PropertyOwner _screenSpaceOwner;
std::vector<std::shared_ptr<ScreenSpaceRenderable>> _screenSpaceRenderables;
std::vector<std::unique_ptr<ScreenSpaceRenderable>> _screenSpaceRenderables;
std::shared_ptr<ghoul::fontrendering::Font> _fontBig = nullptr;
std::shared_ptr<ghoul::fontrendering::Font> _fontInfo = nullptr;
std::shared_ptr<ghoul::fontrendering::Font> _fontDate = nullptr;
std::shared_ptr<ghoul::fontrendering::Font> _fontLog = nullptr;
struct {
glm::ivec4 rotation;
glm::ivec4 zoom;
glm::ivec4 roll;
} _cameraButtonLocations;
};
} // namespace openspace

View File

@@ -52,8 +52,6 @@ public:
virtual void initialize() = 0;
virtual void deinitialize() = 0;
virtual void setCamera(Camera* camera) = 0;
virtual void setScene(Scene* scene) = 0;
virtual void setResolution(glm::ivec2 res) = 0;
virtual void setNAaSamples(int nAaSamples) = 0;
virtual void setHDRExposure(float hdrExposure) = 0;
@@ -77,7 +75,8 @@ public:
virtual void update() = 0;
virtual void render(float blackoutFactor, bool doPerformanceMeasurements) = 0;
virtual void render(Scene* scene, Camera* camera, float blackoutFactor,
bool doPerformanceMeasurements) = 0;
/**
* Update render data
* Responsible for calling renderEngine::setRenderData

View File

@@ -70,10 +70,11 @@ public:
* Constructor that creates a ScreenLog with the provided \p timeToLive, and the
* minimum \p logLevel that is stored. Log message with a lower
* ghoul::logging::LogLevel are automatically discarded.
*
* \param timeToLive The time-to-live for the messages in this ScreenLog. Expired
* messages are removed whenever the #removeExpiredEntries method is called
* messages are removed whenever the #removeExpiredEntries method is called
* \param logLevel The minimum ghoul::logging::LogLevel that messages must
* have in order to be stored in the ScreenLog
* have in order to be stored in the ScreenLog
*/
ScreenLog(std::chrono::seconds timeToLive, LogLevel logLevel = LogLevel::Info);
@@ -85,6 +86,7 @@ public:
/**
* Overwritten ghoul::loggling::Log method that is called whenever a new log message
* shall be stored.
*
* \param level The ghoul::logging::LogLevel of the incoming log message
* \param category The category of the log message
* \param message The actual log message that was transmitted
@@ -95,17 +97,19 @@ public:
/**
* This method removes all the stored LogEntry%s that have expired, calculated by
* their <code>timeStamp</code> and the #_timeToLive value.
*
* \post All entries retrieved by the #entries function have a <code>timeStamp</code>
* that is lower than the current time + #_timeToLive. The current time used is the
* time when this method was last called
* that is lower than the current time + #_timeToLive. The current time used is
* the time when this method was last called
*/
void removeExpiredEntries();
/**
* Returns the list of all stored LogEntry%s.
*
* \return The list of all stored LogEntry%s
*/
std::vector<LogEntry> entries() const;
const std::vector<LogEntry>& entries() const;
private:
/// The list of all LogEntry%s stored by this ScreenLog
@@ -118,7 +122,8 @@ private:
/// The minimum LogLevel of messages
LogLevel _logLevel;
/// A mutex to ensure thread-safety
/// A mutex to ensure thread-safety since the logging and the removal of expired
/// entires can occur on different threads
mutable std::mutex _mutex;
};

View File

@@ -388,7 +388,7 @@ std::pair<glm::dvec3, std::string> DashboardItemAngle::positionAndLabel(
"focus"
};
case Type::Camera:
return { OsEng.renderEngine().camera()->positionVec3(), "camera" };
return { OsEng.renderEngine().scene()->camera()->positionVec3(), "camera" };
default:
return { glm::dvec3(0.0), "Unknown" };
}

View File

@@ -406,7 +406,7 @@ std::pair<glm::dvec3, std::string> DashboardItemDistance::positionAndLabel(
"focus"
};
case Type::Camera:
return { OsEng.renderEngine().camera()->positionVec3(), "camera" };
return { OsEng.renderEngine().scene()->camera()->positionVec3(), "camera" };
default:
return { glm::dvec3(0.0), "Unknown" };
}

View File

@@ -76,14 +76,13 @@ int addDashboardItemToScreenSpace(lua_State* L) {
return 0;
}
std::shared_ptr<ScreenSpaceRenderable> ssr =
OsEng.renderEngine().screenSpaceRenderable(name);
ScreenSpaceRenderable* ssr = OsEng.renderEngine().screenSpaceRenderable(name);
if (!ssr) {
return luaL_error(L, "Provided name is not a ScreenSpace item");
}
ScreenSpaceDashboard* dash = dynamic_cast<ScreenSpaceDashboard*>(ssr.get());
ScreenSpaceDashboard* dash = dynamic_cast<ScreenSpaceDashboard*>(ssr);
if (!dash) {
return luaL_error(
L,
@@ -106,14 +105,13 @@ int removeDashboardItemsFromScreenSpace(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::removeDashboardItemsFromScreenSpace");
std::string name = ghoul::lua::checkStringAndPop(L);
std::shared_ptr<ScreenSpaceRenderable> ssr =
OsEng.renderEngine().screenSpaceRenderable(name);
ScreenSpaceRenderable* ssr = OsEng.renderEngine().screenSpaceRenderable(name);
if (!ssr) {
return luaL_error(L, "Provided name is not a ScreenSpace item");
}
ScreenSpaceDashboard* dash = dynamic_cast<ScreenSpaceDashboard*>(ssr.get());
ScreenSpaceDashboard* dash = dynamic_cast<ScreenSpaceDashboard*>(ssr);
if (!dash) {
return luaL_error(L, "Provided name is a ScreenSpace item but not a dashboard");
}

View File

@@ -27,6 +27,7 @@
in vec4 vs_positionScreenSpace;
in vec4 vs_gPosition;
in float fade;
in float v_pointSize;
uniform vec3 color;
uniform int renderPhase;
@@ -45,18 +46,30 @@ Fragment getFragment() {
frag.depth = vs_positionScreenSpace.w;
frag.blend = BLEND_MODE_ADDITIVE;
vec4 depthCorrection = vec4(0.0, 0.0, 100.0, 0.0);
if (renderPhase == RenderPhasePoints) {
// Use the length of the vector (dot(circCoord, circCoord)) as factor in the
// smoothstep to gradually decrease the alpha on the edges of the point
vec2 circCoord = 2.0 * gl_PointCoord - 1.0;
frag.color.a *= 1.0 - smoothstep(1.0 - Delta, 1.0, dot(circCoord, circCoord));
}
//float circleClipping = 1.0 - smoothstep(1.0 - Delta, 1.0, dot(circCoord, circCoord));
float circleClipping = smoothstep(1.0, 1.0 - Delta, dot(circCoord, circCoord));
float transparencyCorrection = frag.color.a * circleClipping;
if (transparencyCorrection < 0.9) {
discard;
}
frag.color.a = transparencyCorrection;
}
// G-Buffer
frag.gPosition = vs_gPosition;
// JCC: The depthCorrection here is a temporary tweak
// to fix precision problems.
frag.gPosition = vs_gPosition + depthCorrection;
// There is no normal here
// TODO: Add the correct normal if necessary (JCC)
frag.gNormal = vec4(0.0, 0.0, 0.0, 1.0);
frag.gNormal = vec4(0.0, 0.0, -1.0, 1.0);
return frag;
}

View File

@@ -31,6 +31,7 @@ layout(location = 0) in vec3 in_point_position;
out vec4 vs_positionScreenSpace;
out vec4 vs_gPosition;
out float fade;
out float v_pointSize;
uniform dmat4 modelViewTransform;
uniform mat4 projectionTransform;
@@ -75,5 +76,6 @@ void main() {
vs_positionScreenSpace = z_normalization(projectionTransform * vs_gPosition);
gl_PointSize = (stride == 1 || int(modId) % stride == 0) ? float(pointSize) : float(pointSize) / 2;
gl_Position = vs_positionScreenSpace;
v_pointSize = gl_PointSize;
gl_Position = vs_positionScreenSpace;
}

View File

@@ -1,31 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#version __CONTEXT__
out vec4 renderTableColor;
void main() {
renderTableColor = vec4(0.0);
}

View File

@@ -1,31 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#version __CONTEXT__
layout(location = 0) in vec3 in_position;
void main() {
gl_Position = vec4(in_position, 1.0);
}

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -182,6 +182,7 @@ openspace.globebrowsing.parseInfoFile = function (file)
if ColorFile then
color = {
Identifier = Identifier,
Name = Name or Identifier,
Description = Description or "",
FilePath = dir .. '/' .. ColorFile,
BlendMode = "Color"
@@ -192,6 +193,7 @@ openspace.globebrowsing.parseInfoFile = function (file)
if HeightFile then
height = {
Identifier = Identifier,
Name = Name or Identifier,
Description = Description or "",
FilePath = dir .. '/' .. HeightFile,
TilePixelSize = 90

View File

@@ -53,13 +53,13 @@ void GuiJoystickComponent::render() {
const JoystickInputStates& states =
OsEng.navigationHandler().inputState().joystickInputStates();
for (int i = 0; i < states.size(); ++i) {
for (size_t i = 0; i < states.size(); ++i) {
const JoystickInputState& state = states[i];
if (!state.isConnected) {
continue;
}
ImGui::Text("%s [%i]", state.name.c_str(), i);
ImGui::Text("%s [%i]", state.name.c_str(), static_cast<int>(i));
ImGui::Text("%s", "Axes");
for (int j = 0; j < state.nAxes; ++j) {
float f = state.axes[j];

View File

@@ -89,10 +89,10 @@ int iswa_addScreenSpaceCygnet(lua_State* L) {
d.setValue("Type", "ScreenSpaceCygnet");
d.setValue("UpdateInterval", static_cast<float>(updateInterval));
std::shared_ptr<ScreenSpaceRenderable> s(
std::unique_ptr<ScreenSpaceRenderable> s(
ScreenSpaceRenderable::createFromDictionary(d)
);
OsEng.renderEngine().addScreenSpaceRenderable(s);
OsEng.renderEngine().addScreenSpaceRenderable(std::move(s));
}
return 0;
}

View File

@@ -65,8 +65,9 @@ void main() {
stencil = vec4(1.0);
}
else {
color = vec4(vec3(0.0), 0.0);
stencil = vec4(0.0);
discard;
// color = vec4(vec3(0.0), 0.0);
// stencil = vec4(0.0);
}
}
else {
@@ -79,8 +80,9 @@ void main() {
stencil = vec4(1.0);
}
else {
color = vec4(0.0);
stencil = vec4(0.0);
discard;
// color = vec4(0.0);
// stencil = vec4(0.0);
}
}
}

View File

@@ -41,6 +41,7 @@ namespace {
constexpr const char* KeyUrl = "Url";
constexpr const char* KeyIdentifier = "Identifier";
constexpr const char* KeyOverride = "Override";
constexpr const char* KeyUseHash = "UseHash";
constexpr const char* TempSuffix = ".tmp";
} // namespace
@@ -66,7 +67,8 @@ documentation::Documentation UrlSynchronization::Documentation() {
Optional::Yes,
"This optional identifier will be part of the used folder structure and, "
"if provided, can be used to manually find the downloaded folder in the "
"synchronization folder."
"synchronization folder. If this value is not specified, 'UseHash' has "
"to be set to 'true'."
},
{
KeyOverride,
@@ -77,6 +79,16 @@ documentation::Documentation UrlSynchronization::Documentation() {
"be downloaded, thus overwriting the local files. This is useful for "
"files that are updated regularly remotely and should be fetch at every "
"startup."
},
{
KeyUseHash,
new BoolVerifier,
Optional::Yes,
"If this value is set to 'true' (the default), the hash of the URL is "
"appended to the directory name to produce a unique directory under all "
"circumstances. If this is not desired, the URLSynchronization use the "
"bare directory name alone if this value is 'false'. If this value is "
"'false', the identifier has to be specified."
}
}
};
@@ -104,16 +116,37 @@ UrlSynchronization::UrlSynchronization(const ghoul::Dictionary& dict,
}
}
bool useHash = true;
if (dict.hasValue<bool>(KeyUseHash)) {
useHash = dict.value<bool>(KeyUseHash);
}
// We just merge all of the URLs together to generate a hash, it's not as stable to
// reordering URLs, but every other solution would be more error prone
std::string urlConcat = std::accumulate(_urls.begin(), _urls.end(), std::string());
size_t hash = std::hash<std::string>{}(urlConcat);
if (dict.hasValue<std::string>(KeyIdentifier)) {
std::string ident = dict.value<std::string>(KeyIdentifier);
_identifier = ident + "(" + std::to_string(hash) + ")";
if (useHash) {
_identifier = std::move(ident) + "(" + std::to_string(hash) + ")";
}
else {
_identifier = std::move(ident);
}
}
else {
_identifier = std::to_string(hash);
if (useHash) {
_identifier = std::to_string(hash);
}
else {
documentation::TestResult res;
res.success = false;
res.offenses.push_back({
std::string(KeyIdentifier) + "|" + KeyUseHash,
documentation::TestResult::Offense::Reason::MissingKey
});
throw documentation::SpecificationError(std::move(res), "UrlSynchronization");
}
}
if (dict.hasValue<bool>(KeyOverride)) {

View File

@@ -41,6 +41,10 @@
#pragma warning (disable : 4996)
#endif // _MSC_VER
// libtorrent defines a class with the name 'defer', which messes with out #define of the
// defer macro in ghoul/misc/defer.h
#undef defer
#include <libtorrent/torrent_handle.hpp>
#include <libtorrent/session.hpp>

View File

@@ -146,15 +146,19 @@ namespace {
"" // @TODO Missing documentation
};
static const openspace::properties::Property::PropertyInfo ZoomSensitivityDistanceThresholdInfo = {
static const openspace::properties::Property::PropertyInfo
ZoomSensitivityDistanceThresholdInfo = {
"ZoomSensitivityDistanceThreshold",
"Threshold of distance to target node for whether or not to use exponential zooming",
"Threshold of distance to target node for whether or not to use exponential "
"zooming",
"" // @TODO Missing documentation
};
static const openspace::properties::Property::PropertyInfo ZoomBoundarySphereMultiplierInfo = {
static const openspace::properties::Property::PropertyInfo
ZoomBoundarySphereMultiplierInfo = {
"ZoomBoundarySphereMultiplier",
"Multiplies a node's boundary sphere by this in order to limit zoom & prevent surface collision",
"Multiplies a node's boundary sphere by this in order to limit zoom & prevent "
"surface collision",
"" // @TODO Missing documentation
};
@@ -226,7 +230,12 @@ TouchInteraction::TouchInteraction()
, _orbitSpeedThreshold(OrbitSpinningThreshold, 0.005f, 0.f, 0.01f)
, _spinSensitivity(SpinningSensitivityInfo, 1.f, 0.f, 2.f)
, _zoomSensitivity(ZoomSensitivityInfo, 1.025f, 1.0f, 1.1f)
, _zoomSensitivityDistanceThreshold(ZoomSensitivityDistanceThresholdInfo, 0.05, 0.01, 0.25)
, _zoomSensitivityDistanceThreshold(
ZoomSensitivityDistanceThresholdInfo,
0.05,
0.01,
0.25
)
, _zoomBoundarySphereMultiplier(ZoomBoundarySphereMultiplierInfo, 1.001, 1.0, 1.01)
, _inputStillThreshold(InputSensitivityInfo, 0.0005f, 0.f, 0.001f)
// used to void wrongly interpreted roll interactions
@@ -252,8 +261,8 @@ TouchInteraction::TouchInteraction()
0.f,
1.f
)
, _ignoreGui(
{ "Ignore GUI", "Disable GUI touch interaction", "" }, // @TODO Missing documentation
, _ignoreGui( // @TODO Missing documentation
{ "Ignore GUI", "Disable GUI touch interaction", "" },
false
)
, _vel{ glm::dvec2(0.0), 0.0, 0.0, glm::dvec2(0.0) }
@@ -582,9 +591,15 @@ void TouchInteraction::directControl(const std::vector<TuioCursor>& list) {
[&sb](const TuioCursor& c) { return c.getSessionID() == sb.id; }
);
if (c != list.end()) {
screenPoints.push_back(glm::dvec2(2 * (c->getX() - 0.5), -2 * (c->getY() - 0.5))); // normalized -1 to 1 coordinates on screen
// normalized -1 to 1 coordinates on screen
screenPoints.push_back(
glm::dvec2(2 * (c->getX() - 0.5), -2 * (c->getY() - 0.5))
);
} else {
OsEng.moduleEngine().module<ImGUIModule>()->touchInput = { 1, glm::dvec2(0.0, 0.0), 1 };
OsEng.moduleEngine().module<ImGUIModule>()->touchInput = {
1,
glm::dvec2(0.0, 0.0), 1
};
resetAfterInput();
return;
}
@@ -891,7 +906,10 @@ int TouchInteraction::interpretInteraction(const std::vector<TuioCursor>& list,
}
);
double normalizedCentroidDistance = glm::distance(_centroid, lastCentroid) / list.size();
double normalizedCentroidDistance = glm::distance(
_centroid,
lastCentroid
) / list.size();
#ifdef TOUCH_DEBUG_PROPERTIES
_debugProperties.normalizedCentroidDistance = normalizedCentroidDistance;
_debugProperties.rollOn = rollOn;
@@ -935,17 +953,22 @@ void TouchInteraction::computeVelocities(const std::vector<TuioCursor>& list,
#ifdef TOUCH_DEBUG_PROPERTIES
const std::map<int, std::string> interactionNames = {
{ROT, "Rotation"},
{PINCH, "Pinch"},
{PAN, "Pan"},
{ROLL, "Roll"},
{PICK, "Pick"}
{ ROT, "Rotation" },
{ PINCH, "Pinch" },
{ PAN, "Pan" },
{ ROLL, "Roll" },
{ PICK, "Pick" }
};
_debugProperties.interpretedInteraction = interactionNames.at(action);
if (pinchConsecCt > 0 && action != PINCH) {
if( pinchConsecCt > 3 )
LINFO("PINCH_gesture_ended_with " << pinchConsecZoomFactor << " drag_distance_and " << pinchConsecCt << " counts.");
if (pinchConsecCt > 3) {
LDEBUG(fmt::format(
"PINCH gesture ended with {} drag distance and {} counts",
pinchConsecZoomFactor,
pinchConsecCt
));
}
pinchConsecCt = 0;
pinchConsecZoomFactor = 0.0;
}
@@ -988,13 +1011,16 @@ void TouchInteraction::computeVelocities(const std::vector<TuioCursor>& list,
glm::dvec3 centerPos = _focusNode->worldPosition();
glm::dvec3 currDistanceToFocusNode = camPos - centerPos;
double distanceFromFocusSurface = length(currDistanceToFocusNode) - _focusNode->boundingSphere();
double distanceFromFocusSurface =
length(currDistanceToFocusNode) - _focusNode->boundingSphere();
double zoomFactor = (distance - lastDistance);
#ifdef TOUCH_DEBUG_PROPERTIES
pinchConsecCt++;
pinchConsecZoomFactor += zoomFactor;
#endif
if ((length(currDistanceToFocusNode) / distanceFromFocusSurface) > _zoomSensitivityDistanceThreshold) {
if ((length(currDistanceToFocusNode) / distanceFromFocusSurface) >
_zoomSensitivityDistanceThreshold)
{
zoomFactor *= pow(
distanceFromFocusSurface,
static_cast<float>(_zoomSensitivity)
@@ -1184,10 +1210,14 @@ void TouchInteraction::step(double dt) {
#ifdef TOUCH_DEBUG_PROPERTIES
//Show velocity status every N frames
/*if (++stepVelUpdate >= 60) {
if (++stepVelUpdate >= 60) {
stepVelUpdate = 0;
LINFO("DistToFocusNode " << length(centerToCamera) << " stepZoomVelUpdate " << _vel.zoom);
}*/
LINFO(fmt::format(
"DistToFocusNode {} stepZoomVelUpdate {}",
length(centerToCamera),
_vel.zoom
));
}
#endif
_tap = false;

View File

@@ -34,9 +34,9 @@
#include <ghoul/opengl/ghoul_gl.h>
namespace {
static const openspace::properties::Property::PropertyInfo ScalingInfo = {
"Scaling",
"Scaling",
static const openspace::properties::Property::PropertyInfo SizeInfo = {
"Size",
"Size",
"" // @TODO Missing documentation
};
@@ -75,7 +75,7 @@ namespace openspace {
RenderableToyVolume::RenderableToyVolume(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _scaling(ScalingInfo, glm::vec3(1.f, 1.f, 1.f), glm::vec3(0.f), glm::vec3(10.f))
, _size(SizeInfo, glm::vec3(1.f, 1.f, 1.f), glm::vec3(0.f), glm::vec3(10.f))
, _scalingExponent(ScalingExponentInfo, 1, -10, 20)
, _stepSize(StepSizeInfo, 0.02f, 0.01f, 1.f )
, _translation(TranslationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(10.f))
@@ -83,24 +83,24 @@ RenderableToyVolume::RenderableToyVolume(const ghoul::Dictionary& dictionary)
, _color(ColorInfo, glm::vec4(1.f, 0.f, 0.f, 0.1f), glm::vec4(0.f), glm::vec4(1.f))
{
float stepSize, scalingExponent;
glm::vec3 scaling, translation, rotation;
glm::vec3 size, translation, rotation;
glm::vec4 color;
if (dictionary.getValue("ScalingExponent", scalingExponent)) {
if (dictionary.getValue(ScalingExponentInfo.identifier, scalingExponent)) {
_scalingExponent = static_cast<int>(scalingExponent);
}
if (dictionary.getValue("Scaling", scaling)) {
_scaling = scaling;
if (dictionary.getValue(SizeInfo.identifier, size)) {
_size = size;
}
if (dictionary.getValue("Translation", translation)) {
if (dictionary.getValue(TranslationInfo.identifier, translation)) {
_translation = translation;
}
if (dictionary.getValue("Rotation", rotation)) {
if (dictionary.getValue(RotationInfo.identifier, rotation)) {
_rotation = rotation;
}
if (dictionary.getValue("Color", color)) {
if (dictionary.getValue(ColorInfo.identifier, color)) {
_color = color;
}
if (dictionary.getValue("StepSize", stepSize)) {
if (dictionary.getValue(StepSizeInfo.identifier, stepSize)) {
_stepSize = stepSize;
}
}
@@ -124,7 +124,7 @@ void RenderableToyVolume::initializeGL() {
onEnabledChange(onChange);
addProperty(_scaling);
addProperty(_size);
addProperty(_scalingExponent);
addProperty(_stepSize);
addProperty(_translation);
@@ -158,7 +158,7 @@ void RenderableToyVolume::update(const UpdateData& data) {
transform = glm::scale(
transform,
static_cast<glm::vec3>(_scaling) *
static_cast<glm::vec3>(_size) *
std::pow(10.0f, static_cast<float>(_scalingExponent))
);

View File

@@ -51,7 +51,7 @@ public:
void update(const UpdateData& data) override;
private:
properties::Vec3Property _scaling;
properties::Vec3Property _size;
properties::IntProperty _scalingExponent;
properties::FloatProperty _stepSize;
properties::Vec3Property _translation;

View File

@@ -57,9 +57,8 @@ void ToyVolumeRaycaster::deinitialize() {
void ToyVolumeRaycaster::renderEntryPoints(const RenderData& data,
ghoul::opengl::ProgramObject& program)
{
program.setUniform("modelTransform", _modelTransform);
program.setUniform("modelViewTransform", glm::mat4(modelViewTransform(data)));
program.setUniform("viewProjection", data.camera.viewProjectionMatrix());
Renderable::setPscUniforms(program, data.camera, data.position);
// Cull back face
glEnable(GL_CULL_FACE);
@@ -73,9 +72,8 @@ void ToyVolumeRaycaster::renderExitPoints(const RenderData& data,
ghoul::opengl::ProgramObject& program)
{
// Uniforms
program.setUniform("modelTransform", _modelTransform);
program.setUniform("modelViewTransform", glm::mat4(modelViewTransform(data)));
program.setUniform("viewProjection", data.camera.viewProjectionMatrix());
Renderable::setPscUniforms(program, data.camera, data.position);
// Cull front face
glEnable(GL_CULL_FACE);
@@ -88,6 +86,16 @@ void ToyVolumeRaycaster::renderExitPoints(const RenderData& data,
glCullFace(GL_BACK);
}
glm::dmat4 ToyVolumeRaycaster::modelViewTransform(const RenderData& data) {
glm::dmat4 modelTransform =
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
glm::dmat4(data.modelTransform.rotation) *
glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale)) *
glm::dmat4(_modelTransform);
return data.camera.combinedViewMatrix() * modelTransform;
}
void ToyVolumeRaycaster::preRaycast(const RaycastData& data,
ghoul::opengl::ProgramObject& program)
{
@@ -103,6 +111,19 @@ void ToyVolumeRaycaster::postRaycast(const RaycastData&, ghoul::opengl::ProgramO
// For example: release texture units
}
bool ToyVolumeRaycaster::cameraIsInside(const RenderData& data,
glm::vec3& localPosition)
{
glm::vec4 modelPos =
glm::inverse(modelViewTransform(data)) * glm::vec4(0.0, 0.0, 0.0, 1.0);
localPosition = (glm::vec3(modelPos) + glm::vec3(0.5));
return (localPosition.x > 0 && localPosition.x < 1 &&
localPosition.y > 0 && localPosition.y < 1 &&
localPosition.z > 0 && localPosition.z < 1);
}
std::string ToyVolumeRaycaster::getBoundsVsPath() const {
return GlslBoundsVsPath;
}

View File

@@ -58,6 +58,7 @@ public:
ghoul::opengl::ProgramObject& program) override;
void postRaycast(const RaycastData& data,
ghoul::opengl::ProgramObject& program) override;
bool cameraIsInside(const RenderData& data, glm::vec3& localPosition) override;
std::string getBoundsVsPath() const override;
std::string getBoundsFsPath() const override;
@@ -69,6 +70,8 @@ public:
void setTime(double time);
void setStepSize(float time);
private:
glm::dmat4 modelViewTransform(const RenderData& data);
BoxGeometry _boundingBox;
glm::vec4 _color;
glm::mat4 _modelTransform;

View File

@@ -22,18 +22,15 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "PowerScaling/powerScaling_fs.hglsl"
#include "floatoperations.glsl"
#include "fragment.glsl"
in vec3 vPosition;
in vec4 worldPosition;
in vec3 modelPosition;
in vec4 viewPosition;
Fragment getFragment() {
vec4 position = worldPosition;
Fragment frag;
frag.color = vec4(vPosition + 0.5, 1.0);
frag.depth = pscDepth(position);
frag.color = vec4(modelPosition + 0.5, 1.0);
frag.depth = safeLength(viewPosition);
return frag;
}

View File

@@ -24,24 +24,20 @@
#version __CONTEXT__
#include "PowerScaling/powerScaling_vs.hglsl"
layout(location = 0) in vec4 vertPosition;
out vec3 vPosition;
out vec4 worldPosition;
out vec3 modelPosition;
out vec4 viewPosition;
uniform mat4 viewProjection;
uniform mat4 modelTransform;
uniform mat4 modelViewTransform;
void main() {
vPosition = vertPosition.xyz;
worldPosition = modelTransform*vertPosition;
vec4 position = pscTransform(worldPosition, mat4(1.0));
modelPosition = vertPosition.xyz;
viewPosition = modelViewTransform*vertPosition;
// project the position to view space
gl_Position = viewProjection * position;
gl_Position = viewProjection * viewPosition;
gl_Position.z = 1.0;
}

View File

@@ -1,26 +1,26 @@
#########################################################################################
# #
# OpenSpace #
# #
# Copyright (c) 2014-2017 #
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy of this #
# software and associated documentation files (the "Software"), to deal in the Software #
# without restriction, including without limitation the rights to use, copy, modify, #
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to #
# permit persons to whom the Software is furnished to do so, subject to the following #
# conditions: #
# #
# The above copyright notice and this permission notice shall be included in all copies #
# or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, #
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A #
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT #
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF #
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE #
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
#########################################################################################
##########################################################################################
# #
# OpenSpace #
# #
# Copyright (c) 2014-2018 #
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy of this #
# software and associated documentation files (the "Software"), to deal in the Software #
# without restriction, including without limitation the rights to use, copy, modify, #
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to #
# permit persons to whom the Software is furnished to do so, subject to the following #
# conditions: #
# #
# The above copyright notice and this permission notice shall be included in all copies #
# or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, #
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A #
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT #
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF #
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE #
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
##########################################################################################
# This file consists of snippets taken from various CEF projects.

View File

@@ -1,26 +1,26 @@
#########################################################################################
# #
# OpenSpace #
# #
# Copyright (c) 2014-2017 #
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy of this #
# software and associated documentation files (the "Software"), to deal in the Software #
# without restriction, including without limitation the rights to use, copy, modify, #
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to #
# permit persons to whom the Software is furnished to do so, subject to the following #
# conditions: #
# #
# The above copyright notice and this permission notice shall be included in all copies #
# or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, #
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A #
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT #
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF #
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE #
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
#########################################################################################
##########################################################################################
# #
# OpenSpace #
# #
# Copyright (c) 2014-2018 #
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy of this #
# software and associated documentation files (the "Software"), to deal in the Software #
# without restriction, including without limitation the rights to use, copy, modify, #
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to #
# permit persons to whom the Software is furnished to do so, subject to the following #
# conditions: #
# #
# The above copyright notice and this permission notice shall be included in all copies #
# or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, #
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A #
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT #
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF #
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE #
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
##########################################################################################
function(set_cef_targets cef_root main_target)

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2017 *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -1,26 +1,26 @@
#########################################################################################
# #
# OpenSpace #
# #
# Copyright (c) 2014-2017 #
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy of this #
# software and associated documentation files (the "Software"), to deal in the Software #
# without restriction, including without limitation the rights to use, copy, modify, #
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to #
# permit persons to whom the Software is furnished to do so, subject to the following #
# conditions: #
# #
# The above copyright notice and this permission notice shall be included in all copies #
# or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, #
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A #
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT #
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF #
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE #
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
#########################################################################################
##########################################################################################
# #
# OpenSpace #
# #
# Copyright (c) 2014-2018 #
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy of this #
# software and associated documentation files (the "Software"), to deal in the Software #
# without restriction, including without limitation the rights to use, copy, modify, #
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to #
# permit persons to whom the Software is furnished to do so, subject to the following #
# conditions: #
# #
# The above copyright notice and this permission notice shall be included in all copies #
# or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, #
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A #
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT #
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF #
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE #
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
##########################################################################################
function(build_webgui_source target_name)
set(NPM_COMMAND "npm" CACHE STRING "Location of NPM executable unless in PATH.")

View File

@@ -25,15 +25,14 @@
#ifndef _BLENDING_GLSL_
#define _BLENDING_GLSL_
/**
* Blend in src behind dst using normal blending
* dst is premultiplied
* src is expressed in straight RGBA
*/
void normalBlend(inout vec4 dst, vec4 src) {
dst.rgb = dst.rgb + (1.0 - dst.a) * src.a * src.rgb;
dst.a = dst.a + (1.0 - dst.a) * src.a;
dst.rgb = dst.rgb + (1.f - dst.a) * src.a * src.rgb;
dst.a = dst.a + (1.f - dst.a) * src.a;
}
/**
@@ -42,7 +41,7 @@ void normalBlend(inout vec4 dst, vec4 src) {
* src is expressed in straight RGBA
*/
void additiveBlend(inout vec4 dst, vec4 src) {
dst.rgb = dst.rgb + (1.0 - dst.a) * src.a * src.rgb;// dst.rgb = dst.rgb + src.a * src.rgb;
dst.rgb = dst.rgb + (1.f - dst.a) * src.a * src.rgb;// dst.rgb = dst.rgb + src.a * src.rgb;
//dst.a = dst.a + src.a;
}
@@ -55,7 +54,7 @@ void additiveBlend(inout vec4 dst, vec4 src) {
* stepSize = 1: alpha becomes src.a
*/
void normalBlendStep(inout vec4 dst, vec4 src, float stepSize) {
src.a = 1.0 - pow(1.0 - src.a, stepSize);
src.a = 1.f - pow(1.f - src.a, stepSize);
normalBlend(dst, src);
}
@@ -77,8 +76,8 @@ void additiveBlendStep(inout vec4 dst, vec4 src, float stepSize) {
* src is expressed in straight RGBA
*/
void blend(inout vec4 dst, vec4 src) {
dst.rgb = dst.rgb + (1.0 - dst.a) * src.a * src.rgb;
dst.a = dst.a + (1.0 - dst.a) * src.a;
dst.rgb = dst.rgb + (1.f - dst.a) * src.a * src.rgb;
dst.a = dst.a + (1.f - dst.a) * src.a;
}
/**
@@ -89,8 +88,8 @@ void blend(inout vec4 dst, vec4 src) {
* stepSize = 1: alpha becomes src.a
*/
void blendStep(inout vec4 dst, vec4 src, float stepSize) {
src.a = 1.0 - pow(1.0 - src.a, stepSize);
src.a = 1.0 - pow(1.f - src.a, stepSize);
blend(dst, src);
}
#endif
#endif // _BLENDING_GLSL_

View File

@@ -25,7 +25,6 @@
#ifndef _FLOATOPERATIONS_GLSL_
#define _FLOATOPERATIONS_GLSL_
/**
* Convert a positive floating point distance [0, 10^27]
* (size of observable universe)
@@ -51,43 +50,44 @@ float denormalizeFloat(float inpt) {
/**
* Compute the length of a vector.
* Supporting huge vectors, where the square of any of the components is too large to represent as a float.
* Supporting huge vectors, where the square of any of the components is too large to be
* represented as a float.
*/
float safeLength(vec4 v) {
float m = max(max(max(abs(v.x), abs(v.y)), abs(v.z)), abs(v.w));
if (m > 0.0) {
if (m > 0.f) {
return length(v / m) * m;
} else {
return 0;
return 0.f;
}
}
float safeLength(vec3 v) {
float m = max(max(abs(v.x), abs(v.y)), abs(v.z));
if (m > 0.0) {
if (m > 0.f) {
return length(v / m) * m;
} else {
return 0;
return 0.f;
}
}
float safeLength(vec2 v) {
float m = max(abs(v.x), abs(v.y));
if (m > 0.0) {
if (m > 0.f) {
return length(v / m) * m;
} else {
return 0;
return 0.f;
}
}
/**
* Normalize a vector
* Supporting huge vectors, where the square of any of the components is too large to represent as a float.
* Supporting huge vectors, where the square of any of the components is too large to be
* represent as a float.
*/
vec3 safeNormalize(vec3 v) {
float m = max(max(abs(v.x), abs(v.y)), abs(v.z));
return normalize(v / m);
}
#endif
#endif // _FLOATOPERATIONS_GLSL_

View File

@@ -36,11 +36,11 @@ uniform sampler2DMS mainColorTexture;
void main() {
vec4 color = vec4(0.0);
for (int i = 0; i < nAaSamples; i++) {
color += texelFetch(mainColorTexture, ivec2(gl_FragCoord), i);
color += texelFetch(mainColorTexture, ivec2(gl_FragCoord), i);
}
color /= nAaSamples;
//color.rgb *= blackoutFactor;
// color.rgb *= blackoutFactor;
finalColor = vec4(HDR(color.rgb * backgroundConstant, backgroundExposure), 1.0);
finalColor = vec4(HDR(color.rgb * backgroundConstant, backgroundExposure), 1.0);
}

View File

@@ -27,7 +27,7 @@
layout (location = 0) out vec4 finalColor;
in vec2 vTexCoord;
flat in vec3 vPosition;
// flat in vec3 vPosition;
uniform int currentSample;
uniform sampler2DMS pixelSizeTexture;

View File

@@ -28,11 +28,11 @@ layout(location = 0) in vec4 position;
layout(location = 1) in vec2 texCoord;
out vec2 vTexCoord;
flat out vec3 vPosition;
// flat out vec3 vPosition;
void main() {
vTexCoord = texCoord;
vPosition = position.xyz;
// vPosition = position.xyz;
gl_Position = position;
}

View File

@@ -28,6 +28,6 @@ layout (location = 0) out vec4 finalColor;
flat in vec3 vPosition;
void main() {
finalColor = vec4(0.5 * vPosition + 0.5, 1.0);
void main() {
finalColor = vec4(0.5 * vPosition + 0.5, 1.0);
}

View File

@@ -113,8 +113,6 @@ void main() {
for (steps = 0; (accumulatedAlpha.r < ALPHA_LIMIT || accumulatedAlpha.g < ALPHA_LIMIT || accumulatedAlpha.b < ALPHA_LIMIT) && steps < RAYCAST_MAX_STEPS; ++steps) {
while (sampleIndex < nAaSamples && currentDepth + nextStepSize * jitterFactor > raycastDepths[sampleIndex]) {
sampleIndex++;
aaOpacity -= opacityDecay;
@@ -132,7 +130,6 @@ void main() {
vec3 jitteredPosition = position + direction*jitteredStepSize;
position += direction * currentStepSize;
sample#{id}(jitteredPosition, direction, accumulatedColor, accumulatedAlpha, nextStepSize);
float sampleDistance = aaOpacity * (jitteredStepSize + previousJitterDistance);

View File

@@ -22,10 +22,9 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
//uniform float exposure;
uniform float gamma;
vec3 exponentialToneMapping(vec3 color, const float exposure) {
vec3 exponentialToneMapping(vec3 color, float exposure) {
color *= exposure;
color.r = color.r < 1.413 ? pow(color.r * 0.38317, 1.0 / gamma) : 1.0 - exp(-color.r);
@@ -35,62 +34,58 @@ vec3 exponentialToneMapping(vec3 color, const float exposure) {
return color;
}
vec3 linearToneMapping(vec3 color, const float exposure) {
vec3 linearToneMapping(vec3 color, float exposure) {
float tExposure = 0.08f;
color = clamp(tExposure * color, 0.0f, 1.0f);
color = pow(color, vec3(1.0f / gamma));
color = clamp(tExposure * color, 0.f, 1.f);
color = pow(color, vec3(1.f / gamma));
return color;
}
vec3 simpleReinhardToneMapping(vec3 color, const float exposure) {
vec3 simpleReinhardToneMapping(vec3 color, float exposure) {
float tExposure = 1.5f;
color *= tExposure/(1.0f + color / tExposure);
color = pow(color, vec3(1. / gamma));
color *= tExposure/(1.f + color / tExposure);
color = pow(color, vec3(1.f / gamma));
return color;
}
vec3 lumaBasedReinhardToneMapping(vec3 color, const float exposure)
{
vec3 lumaBasedReinhardToneMapping(vec3 color, float exposure) {
float luma = dot(color, vec3(0.2126f, 0.7152f, 0.0722f));
float toneMappedLuma = luma / (1.0f + luma);
float toneMappedLuma = luma / (1.f + luma);
color *= toneMappedLuma / luma;
color = pow(color, vec3(1.0f / gamma));
color = pow(color, vec3(1.f / gamma));
return color;
}
vec3 whitePreservingLumaBasedReinhardToneMapping(vec3 color, const float exposure)
{
float white = 4.0f;
vec3 whitePreservingLumaBasedReinhardToneMapping(vec3 color, float exposure) {
float white = 4.f;
//float luma = dot(color, vec3(0.2126f, 0.7152f, 0.0722f));
float luma = dot(color, vec3(0.4126f, 0.9152f, 0.2722f));
float toneMappedLuma = luma * (1.0f + luma / (white * white)) / (1.0f + luma);
float toneMappedLuma = luma * (1.f + luma / (white * white)) / (1.f + luma);
color *= toneMappedLuma / luma;
color = pow(color, vec3(1.0f / gamma));
color = pow(color, vec3(1.f / gamma));
return color;
}
vec3 RomBinDaHouseToneMapping(vec3 color, const float exposure)
{
color = exp( -1.0f / ( 2.72f * color + 0.15f ) );
color = pow(color, vec3(1.7 / gamma));
vec3 RomBinDaHouseToneMapping(vec3 color, float exposure) {
color = exp( -1.f / ( 2.72f * color + 0.15f ) );
color = pow(color, vec3(1.7f / gamma));
return color;
}
vec3 filmicToneMapping(vec3 color, const float exposure)
vec3 filmicToneMapping(vec3 color, float exposure)
{
color = max(vec3(0.0f), color - vec3(0.04f));
color = (color * (6.2f * color + 0.5f)) / (color * (6.2f * color + 20.0f) + 0.06f);
color = max(vec3(0.f), color - vec3(0.04f));
color = (color * (6.2f * color + 0.5f)) / (color * (6.2f * color + 20.f) + 0.06f);
return color;
}
vec3 Uncharted2ToneMapping(vec3 color, const float exposure)
{
vec3 Uncharted2ToneMapping(vec3 color, float exposure) {
float A = 0.15f;
float B = 0.50f;
float C = 0.10f;
float D = 0.20f;
float B = 0.5f;
float C = 0.1f;
float D = 0.2f;
float E = 0.02f;
float F = 0.30f;
float F = 0.3f;
float W = 11.2f;
float tExposure = 0.4f;
color *= tExposure;
@@ -101,7 +96,7 @@ vec3 Uncharted2ToneMapping(vec3 color, const float exposure)
return color;
}
vec3 jToneMapping(const vec3 color, const float exposure) {
vec3 jToneMapping(vec3 color, float exposure) {
return 1.0 - exp(-exposure * color);
}

View File

@@ -43,7 +43,6 @@ namespace {
constexpr const char* KeyAsset = "Asset";
constexpr const char* KeyGlobalCustomizationScripts = "GlobalCustomizationScripts";
constexpr const char* KeyPaths = "Paths";
constexpr const char* KeyPathsCACHE = "Paths.CACHE";
constexpr const char* KeyFonts = "Fonts";
constexpr const char* KeyLogging = "Logging";
constexpr const char* KeyLogDir = "LogDir";

View File

@@ -26,30 +26,29 @@
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/misc/exception.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/loglevel.h>
#include <ghoul/logging/htmllog.h>
#include <ghoul/logging/textlog.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/misc/exception.h>
namespace {
const char* keyType = "Type";
const char* keyFilename = "File";
const char* keyAppend = "Append";
const char* keyTimeStamping = "TimeStamping";
const char* keyDateStamping = "DateStamping";
const char* keyCategoryStamping = "CategoryStamping";
const char* keyLogLevelStamping = "LogLevelStamping";
const char* keyLogLevel = "LogLevel";
constexpr const char* KeyType = "Type";
constexpr const char* KeyFilename = "File";
constexpr const char* KeyAppend = "Append";
constexpr const char* KeyTimeStamping = "TimeStamping";
constexpr const char* KeyDateStamping = "DateStamping";
constexpr const char* KeyCategoryStamping = "CategoryStamping";
constexpr const char* KeyLogLevelStamping = "LogLevelStamping";
constexpr const char* KeyLogLevel = "LogLevel";
const char* valueHtmlLog = "html";
const char* valueTextLog = "Text";
constexpr const char* ValueHtmlLog = "html";
constexpr const char* ValueTextLog = "Text";
const char* BootstrapPath = "${WEB}/common/bootstrap.min.css";
const char* CssPath = "${WEB}/log/style.css";
const char* JsPath = "${WEB}/log/script.js";
constexpr const char* BootstrapPath = "${WEB}/common/bootstrap.min.css";
constexpr const char* CssPath = "${WEB}/log/style.css";
constexpr const char* JsPath = "${WEB}/log/script.js";
} // namespace
namespace openspace {
@@ -62,50 +61,50 @@ documentation::Documentation LogFactoryDocumentation() {
"core_logfactory",
{
{
keyType,
KeyType,
new StringInListVerifier({
// List from createLog
valueTextLog, valueHtmlLog
ValueTextLog, ValueHtmlLog
}),
Optional::No,
"The type of the new log to be generated."
},
{
keyFilename,
KeyFilename,
new StringVerifier,
Optional::No,
"The filename to which the log will be written."
},
{
keyAppend,
KeyAppend,
new BoolVerifier,
Optional::Yes,
"Determines whether the file will be cleared at startup or if the "
"contents will be appended to previous runs."
},
{
keyTimeStamping,
KeyTimeStamping,
new BoolVerifier,
Optional::Yes,
"Determines whether the log entires should be stamped with the time at "
"which the message was logged."
},
{
keyDateStamping,
KeyDateStamping,
new BoolVerifier,
Optional::Yes,
"Determines whether the log entries should be stamped with the date at "
"which the message was logged."
},
{
keyCategoryStamping,
KeyCategoryStamping,
new BoolVerifier,
Optional::Yes,
"Determines whether the log entries should be stamped with the "
"category that creates the log message."
},
{
keyLogLevelStamping,
KeyLogLevelStamping,
new BoolVerifier,
Optional::Yes,
"Determines whether the log entries should be stamped with the log level "
@@ -125,33 +124,33 @@ std::unique_ptr<ghoul::logging::Log> createLog(const ghoul::Dictionary& dictiona
);
// 'type' and 'filename' are required keys
std::string type = dictionary.value<std::string>(keyType);
std::string filename = absPath(dictionary.value<std::string>(keyFilename));
std::string type = dictionary.value<std::string>(KeyType);
std::string filename = absPath(dictionary.value<std::string>(KeyFilename));
// the rest are optional
bool append = true;
if (dictionary.hasKeyAndValue<bool>(keyAppend)) {
append = dictionary.value<bool>(keyAppend);
if (dictionary.hasKeyAndValue<bool>(KeyAppend)) {
append = dictionary.value<bool>(KeyAppend);
}
bool timeStamp = true;
if (dictionary.hasKeyAndValue<bool>(keyTimeStamping)) {
timeStamp = dictionary.value<bool>(keyTimeStamping);
if (dictionary.hasKeyAndValue<bool>(KeyTimeStamping)) {
timeStamp = dictionary.value<bool>(KeyTimeStamping);
}
bool dateStamp = true;
if (dictionary.hasKeyAndValue<bool>(keyDateStamping)) {
dateStamp = dictionary.value<bool>(keyDateStamping);
if (dictionary.hasKeyAndValue<bool>(KeyDateStamping)) {
dateStamp = dictionary.value<bool>(KeyDateStamping);
}
bool categoryStamp = true;
if (dictionary.hasKeyAndValue<bool>(keyCategoryStamping)) {
categoryStamp = dictionary.value<bool>(keyCategoryStamping);
if (dictionary.hasKeyAndValue<bool>(KeyCategoryStamping)) {
categoryStamp = dictionary.value<bool>(KeyCategoryStamping);
}
bool logLevelStamp = true;
if (dictionary.hasKeyAndValue<bool>(keyLogLevelStamping)) {
logLevelStamp = dictionary.value<bool>(keyLogLevelStamping);
if (dictionary.hasKeyAndValue<bool>(KeyLogLevelStamping)) {
logLevelStamp = dictionary.value<bool>(KeyLogLevelStamping);
}
std::string logLevel;
if (dictionary.hasKeyAndValue<std::string>(keyLogLevel)) {
logLevel = dictionary.value<std::string>(keyLogLevel);
if (dictionary.hasKeyAndValue<std::string>(KeyLogLevel)) {
logLevel = dictionary.value<std::string>(KeyLogLevel);
}
using Append = ghoul::logging::TextLog::Append;
@@ -160,18 +159,18 @@ std::unique_ptr<ghoul::logging::Log> createLog(const ghoul::Dictionary& dictiona
using CategoryStamping = ghoul::logging::Log::CategoryStamping;
using LogLevelStamping = ghoul::logging::Log::LogLevelStamping;
if (type == valueHtmlLog) {
if (type == ValueHtmlLog) {
std::vector<std::string> cssFiles{absPath(BootstrapPath), absPath(CssPath)};
std::vector<std::string> jsFiles{absPath(JsPath)};
if (logLevel.empty()) {
return std::make_unique<ghoul::logging::HTMLLog>(
filename,
append ? Append::Yes : Append::No,
timeStamp ? TimeStamping::Yes : TimeStamping::No,
dateStamp ? DateStamping::Yes : DateStamping::No,
categoryStamp ? CategoryStamping::Yes : CategoryStamping::No,
logLevelStamp ? LogLevelStamping::Yes : LogLevelStamping::No,
Append(append),
TimeStamping(timeStamp),
DateStamping(dateStamp),
CategoryStamping(categoryStamp),
LogLevelStamping(logLevelStamp),
cssFiles,
jsFiles
);
@@ -179,35 +178,36 @@ std::unique_ptr<ghoul::logging::Log> createLog(const ghoul::Dictionary& dictiona
else {
return std::make_unique<ghoul::logging::HTMLLog>(
filename,
append ? Append::Yes : Append::No,
timeStamp ? TimeStamping::Yes : TimeStamping::No,
dateStamp ? DateStamping::Yes : DateStamping::No,
categoryStamp ? CategoryStamping::Yes : CategoryStamping::No,
logLevelStamp ? LogLevelStamping::Yes : LogLevelStamping::No,
cssFiles, jsFiles,
Append(append),
TimeStamping(timeStamp),
DateStamping(dateStamp),
CategoryStamping(categoryStamp),
LogLevelStamping(logLevelStamp),
cssFiles,
jsFiles,
ghoul::logging::levelFromString(logLevel)
);
);
}
}
else if (type == valueTextLog) {
else if (type == ValueTextLog) {
if (logLevel.empty()) {
return std::make_unique<ghoul::logging::TextLog>(
filename,
append ? Append::Yes : Append::No,
timeStamp ? TimeStamping::Yes : TimeStamping::No,
dateStamp ? DateStamping::Yes : DateStamping::No,
categoryStamp ? CategoryStamping::Yes : CategoryStamping::No,
logLevelStamp ? LogLevelStamping::Yes : LogLevelStamping::No
Append(append),
TimeStamping(timeStamp),
DateStamping(dateStamp),
CategoryStamping(categoryStamp),
LogLevelStamping(logLevelStamp)
);
}
else {
return std::make_unique<ghoul::logging::TextLog>(
filename,
append ? Append::Yes : Append::No,
timeStamp ? TimeStamping::Yes : TimeStamping::No,
dateStamp ? DateStamping::Yes : DateStamping::No,
categoryStamp ? CategoryStamping::Yes : CategoryStamping::No,
logLevelStamp ? LogLevelStamping::Yes : LogLevelStamping::No,
Append(append),
TimeStamping(timeStamp),
DateStamping(dateStamp),
CategoryStamping(categoryStamp),
LogLevelStamping(logLevelStamp),
ghoul::logging::levelFromString(logLevel)
);
}

View File

@@ -39,17 +39,12 @@
#include <openspace/interaction/navigationhandler.h>
#include <openspace/network/networkengine.h>
#include <openspace/network/parallelpeer.h>
#include <openspace/performance/performancemeasurement.h>
#include <openspace/rendering/dashboard.h>
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/loadingscreen.h>
#include <openspace/rendering/luaconsole.h>
#include <openspace/rendering/renderable.h>
#include <openspace/scripting/scriptscheduler.h>
#include <openspace/scripting/scriptengine.h>
#include <openspace/scene/asset.h>
#include <openspace/scene/assetmanager.h>
#include <openspace/scene/assetloader.h>
@@ -58,19 +53,18 @@
#include <openspace/scene/scale.h>
#include <openspace/scene/scenelicense.h>
#include <openspace/scene/translation.h>
#include <openspace/util/resourcesynchronization.h>
#include <openspace/scripting/scriptscheduler.h>
#include <openspace/scripting/scriptengine.h>
#include <openspace/util/factorymanager.h>
#include <openspace/util/openspacemodule.h>
#include <openspace/util/resourcesynchronization.h>
#include <openspace/util/synchronizationwatcher.h>
#include <openspace/util/spicemanager.h>
#include <openspace/util/task.h>
#include <openspace/util/time.h>
#include <openspace/util/timemanager.h>
#include <openspace/util/transformationmanager.h>
#include <ghoul/ghoul.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <ghoul/cmdparser/commandlineparser.h>
#include <ghoul/cmdparser/singlecommand.h>
#include <ghoul/filesystem/filesystem.h>
@@ -80,12 +74,13 @@
#include <ghoul/logging/visualstudiooutputlog.h>
#include <ghoul/misc/defer.h>
#include <ghoul/opengl/debugcontext.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/systemcapabilities/systemcapabilities.h>
#include <ghoul/systemcapabilities/generalcapabilitiescomponent.h>
#include <ghoul/systemcapabilities/openglcapabilitiescomponent.h>
#include <glbinding/callbacks.h>
#include <numeric>
#if defined(_MSC_VER) && defined(OPENSPACE_ENABLE_VLD)
#include <vld.h>
@@ -100,8 +95,6 @@
#endif // __APPLE__
#include <numeric>
#include "openspaceengine_lua.inl"
using namespace openspace::scripting;
@@ -123,9 +116,9 @@ namespace {
std::string sgctConfigurationName;
std::string sceneName;
std::string cacheFolder;
std::string configurationOverwrite;
} commandlineArgumentPlaceholders;
static const openspace::properties::Property::PropertyInfo VersionInfo = {
"VersionInfo",
"Version Information",
@@ -152,7 +145,7 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
: _configuration(new Configuration)
, _scene(nullptr)
, _dashboard(new Dashboard)
, _downloadManager(nullptr)
, _downloadManager(std::make_unique<DownloadManager>())
, _console(new LuaConsole)
, _moduleEngine(new ModuleEngine)
, _networkEngine(new NetworkEngine)
@@ -175,10 +168,6 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
properties::StringProperty(VersionInfo, OPENSPACE_VERSION_STRING_FULL),
properties::StringProperty(SourceControlInfo, OPENSPACE_GIT_FULL)
}
, _hasScheduledAssetLoading(false)
, _scheduledAssetPathToLoad("")
, _shutdown({false, 0.f, 0.f})
, _isFirstRenderingFirstFrame(true)
{
_rootPropertyOwner->addPropertySubOwner(_moduleEngine.get());
@@ -189,6 +178,10 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
_rootPropertyOwner->addPropertySubOwner(_renderEngine.get());
_rootPropertyOwner->addPropertySubOwner(_renderEngine->screenSpaceOwner());
// The virtual property manager is not part of the rootProperty owner since it cannot
// have an identifier or the "regex as identifier" trick would not work
//_rootPropertyOwner->addPropertySubOwner(_virtualPropertyManager.get());
if (_windowWrapper) {
_rootPropertyOwner->addPropertySubOwner(_windowWrapper.get());
}
@@ -242,8 +235,6 @@ OpenSpaceEngine& OpenSpaceEngine::ref() {
return *_engine;
}
OpenSpaceEngine::~OpenSpaceEngine() {}
bool OpenSpaceEngine::isCreated() {
return _engine != nullptr;
}
@@ -254,7 +245,6 @@ void OpenSpaceEngine::create(int argc, char** argv,
bool& requestClose, bool consoleLog)
{
ghoul_assert(!_engine, "OpenSpaceEngine was already created");
//ghoul_assert(windowWrapper != nullptr, "No Window Wrapper was provided");
requestClose = false;
@@ -323,6 +313,18 @@ void OpenSpaceEngine::create(int argc, char** argv,
LDEBUG("Loading configuration from disk");
try {
*_engine->_configuration = loadConfigurationFromFile(configurationFilePath);
// If the user requested a commandline-based configuation script that should
// overwrite some of the values, this is the time to do it
if (!commandlineArgumentPlaceholders.configurationOverwrite.empty()) {
LDEBUG("Executing Lua script passed through the commandline:");
LDEBUG(commandlineArgumentPlaceholders.configurationOverwrite);
ghoul::lua::runScript(
_engine->_configuration->state,
commandlineArgumentPlaceholders.configurationOverwrite
);
parseLuaState(*_engine->_configuration);
}
}
catch (const documentation::SpecificationError& e) {
LFATAL(fmt::format(
@@ -373,7 +375,6 @@ void OpenSpaceEngine::create(int argc, char** argv,
);
}
const bool hasCacheCommandline = !commandlineArgumentPlaceholders.cacheFolder.empty();
const bool hasCacheConfig = _engine->_configuration->usePerSceneCache;
std::string cacheFolder = absPath("${CACHE}");
@@ -437,7 +438,8 @@ void OpenSpaceEngine::create(int argc, char** argv,
// Determining SGCT configuration file
LDEBUG("Determining SGCT configuration file");
std::string sgctConfigurationPath = _engine->_configuration->windowConfiguration;
LDEBUG(fmt::format("SGCT Configuration file: {}", sgctConfigurationPath));
if (!commandlineArgumentPlaceholders.sgctConfigurationName.empty()) {
LDEBUG(fmt::format(
"Overwriting SGCT configuration file with commandline argument: {}",
@@ -468,14 +470,14 @@ void OpenSpaceEngine::create(int argc, char** argv,
}
void OpenSpaceEngine::destroy() {
if (_engine->parallelPeer().status() !=
ParallelConnection::Status::Disconnected)
{
if (_engine->parallelPeer().status() != ParallelConnection::Status::Disconnected) {
_engine->parallelPeer().disconnect();
}
_engine->_syncEngine->removeSyncables(_engine->timeManager().getSyncables());
_engine->_syncEngine->removeSyncables(_engine->_renderEngine->getSyncables());
if (_engine->_scene && _engine->_scene->camera()) {
_engine->_syncEngine->removeSyncables(_engine->_scene->camera()->getSyncables());
}
_engine->_renderEngine->deinitializeGL();
@@ -505,7 +507,7 @@ void OpenSpaceEngine::initialize() {
glbinding::Binding::useCurrentContext();
glbinding::Binding::initialize();
// clear the screen so the user doesn't have to see old buffer contents from the
// clear the screen so the user doesn't have to see old buffer contents left on the
// graphics card
LDEBUG("Clearing all Windows");
_windowWrapper->clearAllWindows(glm::vec4(0.f, 0.f, 0.f, 1.f));
@@ -523,21 +525,10 @@ void OpenSpaceEngine::initialize() {
LDEBUG("Detecting capabilities");
SysCap.detectCapabilities();
using Verbosity = ghoul::systemcapabilities::SystemCapabilitiesComponent::Verbosity;
static const std::map<std::string, Verbosity> VerbosityMap = {
{ "None", Verbosity::None },
{ "Minimal", Verbosity::Minimal },
{ "Default", Verbosity::Default },
{ "Full", Verbosity::Full }
};
std::string v = _engine->_configuration->logging.capabilitiesVerbosity;
ghoul_assert(
VerbosityMap.find(v) != VerbosityMap.end(),
"Missing check for syscaps verbosity in openspace.cfg documentation"
Verbosity verbosity = ghoul::from_string<Verbosity>(
_engine->_configuration->logging.capabilitiesVerbosity
);
Verbosity verbosity = VerbosityMap.find(v)->second;
SysCap.logCapabilities(verbosity);
@@ -553,9 +544,6 @@ void OpenSpaceEngine::initialize() {
);
}
_downloadManager = std::make_unique<DownloadManager>();
// Register Lua script functions
LDEBUG("Registering Lua libraries");
registerCoreClasses(*_scriptEngine);
@@ -570,11 +558,10 @@ void OpenSpaceEngine::initialize() {
}
}
// TODO: Maybe move all scenegraph and renderengine stuff to initializeGL
scriptEngine().initialize();
writeStaticDocumentation();
_shutdown.waitTime = _engine->_configuration->shutdownCountdown;
if (!commandlineArgumentPlaceholders.sceneName.empty()) {
@@ -589,16 +576,20 @@ void OpenSpaceEngine::initialize() {
_renderEngine->initialize();
_loadingScreen = _engine->createLoadingScreen();
_loadingScreen = std::make_unique<LoadingScreen>(
LoadingScreen::ShowMessage(_configuration->loadingScreen.isShowingMessages),
LoadingScreen::ShowNodeNames(_configuration->loadingScreen.isShowingNodeNames),
LoadingScreen::ShowProgressbar(_configuration->loadingScreen.isShowingProgressbar)
);
_loadingScreen->render();
for (const auto& func : _moduleCallbacks.initialize) {
for (const std::function<void()>& func : _moduleCallbacks.initialize) {
func();
}
std::string assetPath = _engine->_configuration->asset;
_engine->_assetManager->initialize();
scheduleLoadSingleAsset(assetPath);
scheduleLoadSingleAsset(_engine->_configuration->asset);
LTRACE("OpenSpaceEngine::initialize(end)");
}
@@ -608,18 +599,6 @@ void OpenSpaceEngine::scheduleLoadSingleAsset(std::string assetPath) {
_scheduledAssetPathToLoad = assetPath;
}
std::unique_ptr<LoadingScreen> OpenSpaceEngine::createLoadingScreen() {
bool showMessage = _configuration->loadingScreen.isShowingMessages;
bool showNodeNames = _configuration->loadingScreen.isShowingNodeNames;
bool showProgressbar = _configuration->loadingScreen.isShowingProgressbar;
return std::make_unique<LoadingScreen>(
LoadingScreen::ShowMessage(showMessage),
LoadingScreen::ShowNodeNames(showNodeNames),
LoadingScreen::ShowProgressbar(showProgressbar)
);
}
void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
LTRACE("OpenSpaceEngine::loadSingleAsset(begin)");
@@ -630,12 +609,14 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
windowWrapper().setBarrier(true);
};
if (assetPath == "") {
if (assetPath.empty()) {
return;
}
if (_scene) {
_syncEngine->removeSyncables(_timeManager->getSyncables());
_syncEngine->removeSyncables(_renderEngine->getSyncables());
if (_scene && _scene->camera()) {
_syncEngine->removeSyncables(_scene->camera()->getSyncables());
}
_renderEngine->setScene(nullptr);
_renderEngine->setCamera(nullptr);
_navigationHandler->setCamera(nullptr);
@@ -643,10 +624,8 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
_rootPropertyOwner->removePropertySubOwner(_scene.get());
}
bool multiThreadedInitialization = _configuration->useMultithreadedInitialization;
std::unique_ptr<SceneInitializer> sceneInitializer;
if (multiThreadedInitialization) {
if (_configuration->useMultithreadedInitialization) {
unsigned int nAvailableThreads = std::thread::hardware_concurrency();
unsigned int nThreads = nAvailableThreads == 0 ? 2 : nAvailableThreads - 1;
sceneInitializer = std::make_unique<MultiThreadedSceneInitializer>(nThreads);
@@ -681,11 +660,11 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
_assetManager->rootAsset()->subTreeAssets();
std::unordered_set<std::shared_ptr<ResourceSynchronization>> resourceSyncs;
for (const auto& a : allAssets) {
for (const std::shared_ptr<Asset>& a : allAssets) {
std::vector<std::shared_ptr<ResourceSynchronization>> syncs =
a->ownSynchronizations();
for (const auto& s : syncs) {
for (const std::shared_ptr<ResourceSynchronization>& s : syncs) {
if (s->state() == ResourceSynchronization::State::Syncing) {
resourceSyncs.insert(s);
_loadingScreen->updateItem(
@@ -722,7 +701,7 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
(*it)->name(),
(*it)->name(),
LoadingScreen::ItemStatus::Finished,
1.0f
1.f
);
it = resourceSyncs.erase(it);
}
@@ -740,11 +719,13 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
_loadingScreen->finalize();
_renderEngine->updateScene();
_renderEngine->setGlobalBlackOutFactor(0.0);
_renderEngine->startFading(1, 3.0);
_renderEngine->setGlobalBlackOutFactor(0.f);
_renderEngine->startFading(1, 3.f);
_syncEngine->addSyncables(_timeManager->getSyncables());
_syncEngine->addSyncables(_renderEngine->getSyncables());
if (_scene && _scene->camera()) {
_syncEngine->addSyncables(_scene->camera()->getSyncables());
}
#ifdef __APPLE__
showTouchbar();
@@ -760,11 +741,11 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
void OpenSpaceEngine::deinitialize() {
LTRACE("OpenSpaceEngine::deinitialize(begin)");
for (const auto& func : _engine->_moduleCallbacks.deinitializeGL) {
for (const std::function<void()>& func : _engine->_moduleCallbacks.deinitializeGL) {
func();
}
for (const auto& func : _engine->_moduleCallbacks.deinitialize) {
for (const std::function<void()>& func : _engine->_moduleCallbacks.deinitialize) {
func();
}
@@ -799,32 +780,43 @@ void OpenSpaceEngine::gatherCommandlineArguments() {
commandlineArgumentPlaceholders.configurationName = "";
_commandlineParser->addCommand(std::make_unique<SingleCommand<std::string>>(
commandlineArgumentPlaceholders.configurationName, "--config", "-c",
"Provides the path to the OpenSpace configuration file"
"Provides the path to the OpenSpace configuration file."
));
commandlineArgumentPlaceholders.sgctConfigurationName = "";
_commandlineParser->addCommand(std::make_unique<SingleCommand<std::string>>(
commandlineArgumentPlaceholders.sgctConfigurationName, "--sgct", "-s",
"Provides the path to the SGCT configuration file, overriding the value set in "
"the OpenSpace configuration file"
"the OpenSpace configuration file."
));
commandlineArgumentPlaceholders.sceneName = "";
_commandlineParser->addCommand(std::make_unique<SingleCommand<std::string>>(
commandlineArgumentPlaceholders.sceneName, "--scene", "", "Provides the path to "
"the scene file, overriding the value set in the OpenSpace configuration file"
"the scene file, overriding the value set in the OpenSpace configuration file."
));
commandlineArgumentPlaceholders.cacheFolder = "";
_commandlineParser->addCommand(std::make_unique<SingleCommand<std::string>>(
commandlineArgumentPlaceholders.cacheFolder, "--cacheDir", "", "Provides the "
"path to a cache file, overriding the value set in the OpenSpace configuration "
"file"
"file."
));
commandlineArgumentPlaceholders.configurationOverwrite = "";
_commandlineParser->addCommand(std::make_unique<SingleCommand<std::string>>(
commandlineArgumentPlaceholders.configurationOverwrite, "--lua", "-l",
"Provides the ability to pass arbitrary Lua code to the application that will be "
"evaluated after the configuration file has been loaded but before the other "
"commandline arguments are triggered. This can be used to manipulate the "
"configuration file without editing the file on disk, for example in a "
"planetarium environment. Please not that the Lua script must not contain any - "
"or they will be interpreted as a new command. Similar, in Bash, ${...} will be "
"evaluated before it is passed to OpenSpace."
));
}
void OpenSpaceEngine::runGlobalCustomizationScripts() {
// @CLEANUP: Move this into the scene loading? ---abock
LINFO("Running Global initialization scripts");
ghoul::lua::LuaState state;
OsEng.scriptEngine().initializeLuaState(state);
@@ -866,7 +858,7 @@ void OpenSpaceEngine::loadFonts() {
));
}
}
try {
bool initSuccess = ghoul::fontrendering::FontRenderer::initialize();
if (!initSuccess) {
@@ -896,7 +888,7 @@ void OpenSpaceEngine::configureLogging(bool consoleLog) {
using ImmediateFlush = ghoul::logging::LogManager::ImmediateFlush;
LogManager::initialize(
level,
immediateFlush ? ImmediateFlush::Yes : ImmediateFlush::No
ImmediateFlush(immediateFlush)
);
if (consoleLog) {
LogMgr.addLog(std::make_unique<ConsoleLog>());
@@ -906,8 +898,15 @@ void OpenSpaceEngine::configureLogging(bool consoleLog) {
try {
LogMgr.addLog(createLog(log));
}
catch (const ghoul::RuntimeError& e) {
LERRORC(e.component, e.message);
catch (const documentation::SpecificationError& e) {
LERROR("Failed loading of log");
for (const documentation::TestResult::Offense& o : e.result.offenses) {
LERRORC(o.offender, std::to_string(o.reason));
}
for (const documentation::TestResult::Warning& w : e.result.warnings) {
LWARNINGC(w.offender, std::to_string(w.reason));
}
throw;
}
}
@@ -918,9 +917,7 @@ void OpenSpaceEngine::configureLogging(bool consoleLog) {
#endif // WIN32
#ifndef GHOUL_LOGGING_ENABLE_TRACE
std::string logLevel = "Info";
configurationManager().getValue(KeyLogLevel, logLevel);
LogLevel level = ghoul::logging::levelFromString(logLevel);
LogLevel level = ghoul::logging::levelFromString(_configuration->logging.level);
if (level == ghoul::logging::LogLevel::Trace) {
LWARNING(
@@ -996,8 +993,7 @@ void OpenSpaceEngine::initializeGL() {
}
for (const std::string& sev : _configuration->openGLDebugContext.severityFilters)
{
for (const std::string& sev : _configuration->openGLDebugContext.severityFilters){
setDebugMessageControl(
Source::DontCare,
Type::DontCare,
@@ -1041,6 +1037,7 @@ void OpenSpaceEngine::initializeGL() {
// state from KeyCheckOpenGLState
if (_configuration->isCheckingOpenGLState) {
using namespace glbinding;
// Infinite loop -- welcome to the danger zone
setCallbackMaskExcept(CallbackMask::After, { "glGetError" });
setAfterCallback([](const FunctionCall& f) {
@@ -1092,6 +1089,7 @@ void OpenSpaceEngine::initializeGL() {
if (_configuration->isLoggingOpenGLCalls) {
using namespace glbinding;
setCallbackMask(CallbackMask::After | CallbackMask::ParametersAndReturnValue);
glbinding::setAfterCallback([](const glbinding::FunctionCall& call) {
std::string arguments = std::accumulate(
@@ -1129,7 +1127,7 @@ void OpenSpaceEngine::initializeGL() {
_moduleEngine->initializeGL();
for (const auto& func : _moduleCallbacks.initializeGL) {
for (const std::function<void()>& func : _moduleCallbacks.initializeGL) {
func();
}
@@ -1146,7 +1144,7 @@ void OpenSpaceEngine::preSynchronization() {
perf = std::make_unique<performance::PerformanceMeasurement>(
"OpenSpaceEngine::preSynchronization",
OsEng.renderEngine().performanceManager()
);
);
}
FileSys.triggerFilesystemEvents();
@@ -1155,7 +1153,7 @@ void OpenSpaceEngine::preSynchronization() {
LINFO(fmt::format("Loading asset: {}", _scheduledAssetPathToLoad));
loadSingleAsset(_scheduledAssetPathToLoad);
_hasScheduledAssetLoading = false;
_scheduledAssetPathToLoad = "";
_scheduledAssetPathToLoad.clear();
}
if (_isFirstRenderingFirstFrame) {
@@ -1175,22 +1173,23 @@ void OpenSpaceEngine::preSynchronization() {
);
for (Iter it = scheduledScripts.first; it != scheduledScripts.second; ++it) {
_scriptEngine->queueScript(
*it, ScriptEngine::RemoteScripting::Yes
*it,
ScriptEngine::RemoteScripting::Yes
);
}
_renderEngine->updateScene();
//_navigationHandler->updateCamera(dt);
Camera* camera = _renderEngine->camera();
Camera* camera = _scene->camera();
if (camera) {
_navigationHandler->updateCamera(dt);
_renderEngine->camera()->invalidateCache();
camera->invalidateCache();
}
_parallelPeer->preSynchronization();
}
for (const auto& func : _moduleCallbacks.preSync) {
for (const std::function<void()>& func : _moduleCallbacks.preSync) {
func();
}
LTRACE("OpenSpaceEngine::preSynchronization(end)");
@@ -1239,10 +1238,10 @@ void OpenSpaceEngine::postSynchronizationPreDraw() {
_renderEngine->updateShaderPrograms();
if (!master) {
_renderEngine->camera()->invalidateCache();
_scene->camera()->invalidateCache();
}
for (const auto& func : _moduleCallbacks.postSyncPreDraw) {
for (const std::function<void()>& func : _moduleCallbacks.postSyncPreDraw) {
func();
}
@@ -1268,8 +1267,7 @@ void OpenSpaceEngine::postSynchronizationPreDraw() {
LTRACE("OpenSpaceEngine::postSynchronizationPreDraw(end)");
}
void OpenSpaceEngine::render(const glm::mat4& sceneMatrix,
const glm::mat4& viewMatrix,
void OpenSpaceEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix,
const glm::mat4& projectionMatrix)
{
LTRACE("OpenSpaceEngine::render(begin)");
@@ -1290,7 +1288,7 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix,
_renderEngine->render(sceneMatrix, viewMatrix, projectionMatrix);
for (const auto& func : _moduleCallbacks.render) {
for (const std::function<void()>& func : _moduleCallbacks.render) {
func();
}
@@ -1316,7 +1314,7 @@ void OpenSpaceEngine::drawOverlays() {
_console->render();
}
for (const auto& func : _moduleCallbacks.draw2D) {
for (const std::function<void()>& func : _moduleCallbacks.draw2D) {
func();
}
@@ -1336,7 +1334,7 @@ void OpenSpaceEngine::postDraw() {
_renderEngine->postDraw();
for (const auto& func : _moduleCallbacks.postDraw) {
for (const std::function<void()>& func : _moduleCallbacks.postDraw) {
func();
}
@@ -1345,20 +1343,20 @@ void OpenSpaceEngine::postDraw() {
_isFirstRenderingFirstFrame = false;
}
LTRACE("OpenSpaceEngine::postDraw(end)");
}
void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction action) {
for (const auto& func : _moduleCallbacks.keyboard) {
const bool consumed = func(key, mod, action);
if (consumed) {
using F = std::function<bool (Key, KeyModifier, KeyAction)>;
for (const F& func : _moduleCallbacks.keyboard) {
const bool isConsumed = func(key, mod, action);
if (isConsumed) {
return;
}
}
const bool consoleConsumed = _console->keyboardCallback(key, mod, action);
if (consoleConsumed) {
const bool isConsoleConsumed = _console->keyboardCallback(key, mod, action);
if (isConsoleConsumed) {
return;
}
@@ -1367,9 +1365,10 @@ void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction actio
}
void OpenSpaceEngine::charCallback(unsigned int codepoint, KeyModifier modifier) {
for (const auto& func : _moduleCallbacks.character) {
bool consumed = func(codepoint, modifier);
if (consumed) {
using F = std::function<bool (unsigned int, KeyModifier)>;
for (const F& func : _moduleCallbacks.character) {
bool isConsumed = func(codepoint, modifier);
if (isConsumed) {
return;
}
}
@@ -1378,9 +1377,10 @@ void OpenSpaceEngine::charCallback(unsigned int codepoint, KeyModifier modifier)
}
void OpenSpaceEngine::mouseButtonCallback(MouseButton button, MouseAction action) {
for (const auto& func : _moduleCallbacks.mouseButton) {
bool consumed = func(button, action);
if (consumed) {
using F = std::function<bool (MouseButton, MouseAction)>;
for (const F& func : _moduleCallbacks.mouseButton) {
bool isConsumed = func(button, action);
if (isConsumed) {
// If the mouse was released, we still want to forward it to the navigation
// handler in order to reliably terminate a rotation or zoom. Accidentally
// moving the cursor over a UI window is easy to miss and leads to weird
@@ -1394,21 +1394,34 @@ void OpenSpaceEngine::mouseButtonCallback(MouseButton button, MouseAction action
}
}
// Check if the user clicked on one of the 'buttons' the RenderEngine is drawing
if (action == MouseAction::Press) {
bool isConsumed = _renderEngine->mouseActivationCallback(_mousePosition);
if (isConsumed) {
return;
}
}
_navigationHandler->mouseButtonCallback(button, action);
}
void OpenSpaceEngine::mousePositionCallback(double x, double y) {
for (const auto& func : _moduleCallbacks.mousePosition) {
using F = std::function<void (double, double)>;
for (const F& func : _moduleCallbacks.mousePosition) {
func(x, y);
}
_mousePosition = { x, y };
_navigationHandler->mousePositionCallback(x, y);
}
void OpenSpaceEngine::mouseScrollWheelCallback(double posX, double posY) {
for (const auto& func : _moduleCallbacks.mouseScrollWheel) {
bool consumed = func(posX, posY);
if (consumed) {
using F = std::function<bool (double, double)>;
for (const F& func : _moduleCallbacks.mouseScrollWheel) {
bool isConsumed = func(posX, posY);
if (isConsumed) {
return;
}
}
@@ -1590,6 +1603,7 @@ void OpenSpaceEngine::registerModuleMouseScrollWheelCallback(
}
const Configuration& OpenSpaceEngine::configuration() const {
ghoul_assert(_configuration, "Configuration must not be nullptr");
return *_configuration;
}
@@ -1664,19 +1678,12 @@ interaction::KeyBindingManager& OpenSpaceEngine::keyBindingManager() {
}
properties::PropertyOwner& OpenSpaceEngine::rootPropertyOwner() {
ghoul_assert(
_rootPropertyOwner,
"Root Property Namespace must not be nullptr"
);
ghoul_assert(_rootPropertyOwner, "Root Property Namespace must not be nullptr");
return *_rootPropertyOwner;
}
VirtualPropertyManager& OpenSpaceEngine::virtualPropertyManager() {
ghoul_assert(
_virtualPropertyManager,
"Virtual Property Manager must not be nullptr"
);
ghoul_assert(_virtualPropertyManager, "Virtual Property Manager must not be nullptr");
return *_virtualPropertyManager;
}

View File

@@ -28,8 +28,12 @@
namespace openspace {
// The VirtualPropertyManager cannot have an identifier (and thus cannot be part of
// another PropertyOwner) as otherwise the regex-as-name trick would no longer work. I
// don't particular like this implementation, but it's what we got for now; I'm open to
// replacing it with a better mechanism
VirtualPropertyManager::VirtualPropertyManager()
: properties::PropertyOwner({ "VirtualPropertyManager" })
: properties::PropertyOwner({ "" })
{}
void VirtualPropertyManager::addProperty(std::unique_ptr<properties::Property> prop) {

View File

@@ -57,7 +57,7 @@ void JoystickCameraStates::updateStateFromInput(const InputState& inputState,
value = 0.f;
hasValue = false;
}
if (t.normalize) {
value = (value + 1.f) / 2.f;
}
@@ -148,8 +148,7 @@ void JoystickCameraStates::updateStateFromInput(const InputState& inputState,
else {
_localRotationState.velocity.decelerate(deltaTime);
}
for (int i = 0; i < JoystickInputState::MaxButtons; ++i) {
auto itRange = _buttonMapping.equal_range(i);
for (auto it = itRange.first; it != itRange.second; ++it) {
@@ -251,7 +250,7 @@ openspace::interaction::JoystickCameraStates::AxisType from_string(
const std::string& string)
{
using T = openspace::interaction::JoystickCameraStates::AxisType;
static const std::map<std::string, T> Map = {
{ "None", T::None },
{ "Orbit X", T::OrbitX },

View File

@@ -32,7 +32,9 @@ MouseCameraStates::MouseCameraStates(double sensitivity, double velocityScaleFac
: CameraInteractionStates(sensitivity, velocityScaleFactor)
{}
void MouseCameraStates::updateStateFromInput(const InputState& inputState, double deltaTime) {
void MouseCameraStates::updateStateFromInput(const InputState& inputState,
double deltaTime)
{
glm::dvec2 mousePosition = inputState.mousePosition();
bool button1Pressed = inputState.isMouseButtonPressed(MouseButton::Button1);

View File

@@ -297,9 +297,10 @@ void NavigationHandler::restoreCameraStateFromFile(const std::string& filepath)
}
}
void NavigationHandler::setJoystickAxisMapping(int axis, JoystickCameraStates::AxisType mapping,
JoystickCameraStates::AxisInvert shouldInvert,
JoystickCameraStates::AxisNormalize shouldNormalize)
void NavigationHandler::setJoystickAxisMapping(int axis,
JoystickCameraStates::AxisType mapping,
JoystickCameraStates::AxisInvert shouldInvert,
JoystickCameraStates::AxisNormalize shouldNormalize)
{
_orbitalNavigator->joystickStates().setAxisMapping(
axis,
@@ -309,7 +310,9 @@ void NavigationHandler::setJoystickAxisMapping(int axis, JoystickCameraStates::A
);
}
JoystickCameraStates::AxisInformation NavigationHandler::joystickAxisMapping(int axis) const {
JoystickCameraStates::AxisInformation
NavigationHandler::joystickAxisMapping(int axis) const
{
return _orbitalNavigator->joystickStates().axisMapping(axis);
}
@@ -323,7 +326,7 @@ float NavigationHandler::joystickAxisDeadzone(int axis) const {
void NavigationHandler::bindJoystickButtonCommand(int button, std::string command,
JoystickAction action,
JoystickCameraStates::ButtonCommandRemote remote)
JoystickCameraStates::ButtonCommandRemote remote)
{
_orbitalNavigator->joystickStates().bindButtonCommand(
button,

View File

@@ -101,7 +101,7 @@ int bindJoystickAxis(lua_State* L) {
if (n > 2) {
shouldInvert = lua_toboolean(L, 3);
}
bool shouldNormalize = false;
if (n > 3) {
shouldNormalize = lua_toboolean(L, 4);
@@ -178,13 +178,13 @@ int bindJoystickButton(lua_State* L) {
action,
interaction::JoystickCameraStates::ButtonCommandRemote(isRemote)
);
lua_settop(L, 0);
return 0;
}
int clearJoystickButton(lua_State* L) {
int n = ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::bindJoystickButton");
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::bindJoystickButton");
int button = static_cast<int>(lua_tonumber(L, 1));
@@ -195,7 +195,7 @@ int clearJoystickButton(lua_State* L) {
}
int joystickButton(lua_State* L) {
int n = ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::bindJoystickButton");
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::bindJoystickButton");
int button = static_cast<int>(lua_tonumber(L, 1));

View File

@@ -599,7 +599,7 @@ glm::dvec3 OrbitalNavigator::translateHorizontally(double deltaTime,
-_mouseStates.globalRotationVelocity().y * deltaTime,
-_mouseStates.globalRotationVelocity().x * deltaTime,
0) * speedScale);
glm::dquat joystickRotationDiffCamSpace = glm::dquat(glm::dvec3(
-_joystickStates.globalRotationVelocity().y * deltaTime,
-_joystickStates.globalRotationVelocity().x * deltaTime,

View File

@@ -30,6 +30,9 @@
#include <openspace/scene/scenegraphnode.h>
#include <openspace/util/timemanager.h>
// Apple uses 'defer' as named arguments in some functions, so unfortunately, we have to
// undef our defer macro from ghoul/misc/defer.h
#undef defer
#import <AppKit/NSButton.h>
#import <AppKit/NSCustomTouchBarItem.h>
#import <AppKit/NSTouchBar.h>

View File

@@ -70,6 +70,17 @@ std::vector<properties::Property*> allProperties() {
p.end()
);
// The virtual property manager is not part of the rootProperty owner since it cannot
// have an identifier or the "regex as identifier" trick would not work
std::vector<properties::Property*> p2 =
OsEng.virtualPropertyManager().propertiesRecursive();
properties.insert(
properties.end(),
p2.begin(),
p2.end()
);
return properties;
}

View File

@@ -59,9 +59,7 @@ namespace {
namespace openspace {
ABufferRenderer::ABufferRenderer()
: _camera(nullptr)
, _scene(nullptr)
, _resolution(glm::ivec2(0))
: _resolution(glm::ivec2(0))
, _dirtyResolution(true)
, _dirtyRendererData(true)
, _dirtyRaycastData(true)
@@ -76,15 +74,15 @@ ABufferRenderer::~ABufferRenderer() {}
void ABufferRenderer::initialize() {
LINFO("Initializing ABufferRenderer");
const GLfloat size = 1.0f;
const GLfloat size = 1.f;
const GLfloat vertex_data[] = {
// x y s t
-size, -size, 0.0f, 1.0f,
size, size, 0.0f, 1.0f,
-size, size, 0.0f, 1.0f,
-size, -size, 0.0f, 1.0f,
size, -size, 0.0f, 1.0f,
size, size, 0.0f, 1.0f,
-size, -size, 0.f, 1.f,
size, size, 0.f, 1.f,
-size, size, 0.f, 1.f,
-size, -size, 0.f, 1.f,
size, -size, 0.f, 1.f,
size, size, 0.f, 1.f,
};
@@ -95,14 +93,7 @@ void ABufferRenderer::initialize() {
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data), vertex_data, GL_STATIC_DRAW);
glVertexAttribPointer(
0,
4,
GL_FLOAT,
GL_FALSE,
sizeof(GLfloat) * 4,
nullptr
);
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 4, nullptr);
glEnableVertexAttribArray(0);
glGenTextures(1, &_anchorPointerTexture);
@@ -230,8 +221,9 @@ void ABufferRenderer::update() {
LERRORC(error.component, error.message);
}
}
for (auto &program : _boundsPrograms) {
using K = VolumeRaycaster* const;
using V = std::unique_ptr<ghoul::opengl::ProgramObject>;
for (std::pair<K, V>& program : _boundsPrograms) {
if (program.second->isDirty()) {
try {
program.second->rebuildFromFile();
@@ -243,57 +235,59 @@ void ABufferRenderer::update() {
}
void ABufferRenderer::updateMSAASamplingPattern() {
// @CLEANUP(abock): This should probably be merged with the same code from the
// framebuffer renderer?
LINFO("Updating MSAA Sampling Pattern");
const int GRIDSIZE = 32;
GLfloat step = 2.0f / static_cast<GLfloat>(GRIDSIZE);
GLfloat sizeX = -1.0f,
sizeY = 1.0f;
constexpr const int GridSize = 32;
GLfloat step = 2.f / static_cast<GLfloat>(GridSize);
GLfloat sizeX = -1.0f;
GLfloat sizeY = 1.0f;
const int NVERTEX = 4 * 6;
constexpr const int NVertex = 4 * 6;
// openPixelSizeVertexData
GLfloat vertexData[GRIDSIZE * GRIDSIZE * NVERTEX];
GLfloat vertexData[GridSize * GridSize * NVertex];
for (int y = 0; y < GRIDSIZE; ++y) {
for (int x = 0; x < GRIDSIZE; ++x) {
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX] = sizeX;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 1] = sizeY - step;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 2] = 0.0f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 3] = 1.0f;
for (int y = 0; y < GridSize; ++y) {
for (int x = 0; x < GridSize; ++x) {
vertexData[y * GridSize * NVertex + x * NVertex] = sizeX;
vertexData[y * GridSize * NVertex + x * NVertex + 1] = sizeY - step;
vertexData[y * GridSize * NVertex + x * NVertex + 2] = 0.f;
vertexData[y * GridSize * NVertex + x * NVertex + 3] = 1.f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 4] = sizeX + step;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 5] = sizeY;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 6] = 0.0f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 7] = 1.0f;
vertexData[y * GridSize * NVertex + x * NVertex + 4] = sizeX + step;
vertexData[y * GridSize * NVertex + x * NVertex + 5] = sizeY;
vertexData[y * GridSize * NVertex + x * NVertex + 6] = 0.f;
vertexData[y * GridSize * NVertex + x * NVertex + 7] = 1.f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 8] = sizeX;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 9] = sizeY;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 10] = 0.0f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 11] = 1.0f;
vertexData[y * GridSize * NVertex + x * NVertex + 8] = sizeX;
vertexData[y * GridSize * NVertex + x * NVertex + 9] = sizeY;
vertexData[y * GridSize * NVertex + x * NVertex + 10] = 0.f;
vertexData[y * GridSize * NVertex + x * NVertex + 11] = 1.f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 12] = sizeX;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 13] = sizeY - step;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 14] = 0.0f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 15] = 1.0f;
vertexData[y * GridSize * NVertex + x * NVertex + 12] = sizeX;
vertexData[y * GridSize * NVertex + x * NVertex + 13] = sizeY - step;
vertexData[y * GridSize * NVertex + x * NVertex + 14] = 0.f;
vertexData[y * GridSize * NVertex + x * NVertex + 15] = 1.f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 16] = sizeX + step;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 17] = sizeY - step;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 18] = 0.0f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 19] = 1.0f;
vertexData[y * GridSize * NVertex + x * NVertex + 16] = sizeX + step;
vertexData[y * GridSize * NVertex + x * NVertex + 17] = sizeY - step;
vertexData[y * GridSize * NVertex + x * NVertex + 18] = 0.f;
vertexData[y * GridSize * NVertex + x * NVertex + 19] = 1.f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 20] = sizeX + step;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 21] = sizeY;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 22] = 0.0f;
vertexData[y * GRIDSIZE * NVERTEX + x * NVERTEX + 23] = 1.0f;
vertexData[y * GridSize * NVertex + x * NVertex + 20] = sizeX + step;
vertexData[y * GridSize * NVertex + x * NVertex + 21] = sizeY;
vertexData[y * GridSize * NVertex + x * NVertex + 22] = 0.f;
vertexData[y * GridSize * NVertex + x * NVertex + 23] = 1.f;
sizeX += step;
}
sizeX = -1.0f;
sizeX = -1.f;
sizeY -= step;
}
GLuint pixelSizeQuadVAO = 0,
pixelSizeQuadVBO = 0;
GLuint pixelSizeQuadVAO = 0;
GLuint pixelSizeQuadVBO = 0;
glGenVertexArrays(1, &pixelSizeQuadVAO);
glBindVertexArray(pixelSizeQuadVAO);
@@ -303,20 +297,13 @@ void ABufferRenderer::updateMSAASamplingPattern() {
glBufferData(
GL_ARRAY_BUFFER,
sizeof(GLfloat) * GRIDSIZE * GRIDSIZE * NVERTEX,
sizeof(GLfloat) * GridSize * GridSize * NVertex,
vertexData,
GL_STATIC_DRAW
);
// Position
glVertexAttribPointer(
0,
4,
GL_FLOAT,
GL_FALSE,
0,
nullptr
);
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, nullptr);
glEnableVertexAttribArray(0);
// Saves current state
@@ -366,17 +353,12 @@ void ABufferRenderer::updateMSAASamplingPattern() {
return;
}
std::unique_ptr<ghoul::opengl::ProgramObject> pixelSizeProgram = nullptr;
try {
pixelSizeProgram = ghoul::opengl::ProgramObject::Build(
std::unique_ptr<ghoul::opengl::ProgramObject> pixelSizeProgram =
ghoul::opengl::ProgramObject::Build(
"OnePixel MSAA",
"${SHADERS}/framebuffer/pixelSizeMSAA.vert",
"${SHADERS}/framebuffer/pixelSizeMSAA.frag"
);
}
catch (const ghoul::RuntimeError& e) {
LERRORC(e.component, e.message);
}
pixelSizeProgram->activate();
@@ -385,7 +367,7 @@ void ABufferRenderer::updateMSAASamplingPattern() {
glBindVertexArray(pixelSizeQuadVAO);
glDisable(GL_DEPTH_TEST);
glDepthMask(false);
glDrawArrays(GL_TRIANGLES, 0, GRIDSIZE * GRIDSIZE * 6);
glDrawArrays(GL_TRIANGLES, 0, GridSize * GridSize * 6);
glBindVertexArray(0);
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
@@ -394,58 +376,58 @@ void ABufferRenderer::updateMSAASamplingPattern() {
pixelSizeProgram->deactivate();
// Now we render the Nx1 quad strip
GLuint nOneStripFramebuffer = 0,
nOneStripVAO = 0,
nOneStripVBO = 0,
nOneStripTexture = 0;
GLuint nOneStripFramebuffer = 0;
GLuint nOneStripVAO = 0;
GLuint nOneStripVBO = 0;
GLuint nOneStripTexture = 0;
sizeX = -1.0f;
step = 2.0f / static_cast<GLfloat>(_nAaSamples);
sizeX = -1.f;
step = 2.f / static_cast<GLfloat>(_nAaSamples);
GLfloat * nOneStripVertexData = new GLfloat[_nAaSamples * (NVERTEX + 12)];
std::vector<GLfloat> nOneStripVertexData(_nAaSamples * (NVertex + 12));
for (int x = 0; x < _nAaSamples; ++x) {
nOneStripVertexData[x * (NVERTEX + 12)] = sizeX;
nOneStripVertexData[x * (NVERTEX + 12) + 1] = -1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 2] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 3] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 4] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 5] = 0.0f;
nOneStripVertexData[x * (NVertex + 12)] = sizeX;
nOneStripVertexData[x * (NVertex + 12) + 1] = -1.0f;
nOneStripVertexData[x * (NVertex + 12) + 2] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 3] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 4] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 5] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 6] = sizeX + step;
nOneStripVertexData[x * (NVERTEX + 12) + 7] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 8] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 9] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 10] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 11] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 6] = sizeX + step;
nOneStripVertexData[x * (NVertex + 12) + 7] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 8] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 9] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 10] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 11] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 12] = sizeX;
nOneStripVertexData[x * (NVERTEX + 12) + 13] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 14] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 15] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 16] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 17] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 12] = sizeX;
nOneStripVertexData[x * (NVertex + 12) + 13] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 14] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 15] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 16] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 17] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 18] = sizeX;
nOneStripVertexData[x * (NVERTEX + 12) + 19] = -1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 20] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 21] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 22] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 23] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 18] = sizeX;
nOneStripVertexData[x * (NVertex + 12) + 19] = -1.0f;
nOneStripVertexData[x * (NVertex + 12) + 20] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 21] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 22] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 23] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 24] = sizeX + step;
nOneStripVertexData[x * (NVERTEX + 12) + 25] = -1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 26] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 27] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 28] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 29] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 24] = sizeX + step;
nOneStripVertexData[x * (NVertex + 12) + 25] = -1.0f;
nOneStripVertexData[x * (NVertex + 12) + 26] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 27] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 28] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 29] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 30] = sizeX + step;
nOneStripVertexData[x * (NVERTEX + 12) + 31] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 32] = 0.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 33] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 34] = 1.0f;
nOneStripVertexData[x * (NVERTEX + 12) + 35] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 30] = sizeX + step;
nOneStripVertexData[x * (NVertex + 12) + 31] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 32] = 0.0f;
nOneStripVertexData[x * (NVertex + 12) + 33] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 34] = 1.0f;
nOneStripVertexData[x * (NVertex + 12) + 35] = 1.0f;
sizeX += step;
}
@@ -456,8 +438,8 @@ void ABufferRenderer::updateMSAASamplingPattern() {
glBindBuffer(GL_ARRAY_BUFFER, nOneStripVBO);
glBufferData(
GL_ARRAY_BUFFER,
sizeof(GLfloat) * _nAaSamples * (NVERTEX + 12),
nOneStripVertexData,
sizeof(GLfloat) * _nAaSamples * (NVertex + 12),
nOneStripVertexData.data(),
GL_STATIC_DRAW
);
@@ -482,7 +464,6 @@ void ABufferRenderer::updateMSAASamplingPattern() {
reinterpret_cast<GLvoid*>(sizeof(GLfloat) * 4)
);
glEnableVertexAttribArray(1);
delete[] nOneStripVertexData;
// fbo texture buffer
glGenTextures(1, &nOneStripTexture);
@@ -519,17 +500,12 @@ void ABufferRenderer::updateMSAASamplingPattern() {
glViewport(0, 0, _nAaSamples, ONEPIXEL);
std::unique_ptr<ghoul::opengl::ProgramObject> nOneStripProgram = nullptr;
try {
nOneStripProgram = ghoul::opengl::ProgramObject::Build(
std::unique_ptr<ghoul::opengl::ProgramObject> nOneStripProgram =
ghoul::opengl::ProgramObject::Build(
"OneStrip MSAA",
"${SHADERS}/framebuffer/nOneStripMSAA.vert",
"${SHADERS}/framebuffer/nOneStripMSAA.frag"
);
}
catch (const ghoul::RuntimeError& e) {
LERRORC(e.component, e.message);
}
nOneStripProgram->activate();
@@ -541,7 +517,7 @@ void ABufferRenderer::updateMSAASamplingPattern() {
// render strip
glDrawBuffers(1, textureBuffers);
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
glClearColor(0.f, 1.f, 0.f, 1.f);
glClear(GL_COLOR_BUFFER_BIT);
glBindVertexArray(nOneStripVAO);
glDisable(GL_DEPTH_TEST);
@@ -584,10 +560,12 @@ void ABufferRenderer::updateMSAASamplingPattern() {
glDeleteVertexArrays(1, &nOneStripVAO);
}
void ABufferRenderer::render(float blackoutFactor, bool doPerformanceMeasurements) {
void ABufferRenderer::render(Scene* scene, Camera* camera, float blackoutFactor,
bool doPerformanceMeasurements)
{
PerfMeasure("ABufferRenderer::render");
if (!_scene || !_camera) {
if (!scene || !camera) {
return;
}
@@ -626,7 +604,7 @@ void ABufferRenderer::render(float blackoutFactor, bool doPerformanceMeasurement
Time time = OsEng.timeManager().time();
RenderData data {
*_camera,
*camera,
psc(),
time,
doPerformanceMeasurements,
@@ -634,7 +612,7 @@ void ABufferRenderer::render(float blackoutFactor, bool doPerformanceMeasurement
{}
};
RendererTasks tasks;
_scene->render(data, tasks);
scene->render(data, tasks);
_blackoutFactor = blackoutFactor;
glBindFramebuffer(GL_FRAMEBUFFER, defaultFbo);
@@ -670,8 +648,8 @@ void ABufferRenderer::render(float blackoutFactor, bool doPerformanceMeasurement
float logDistance = std::log(glm::length(cameraPos / maxComponent) * maxComponent)
/ std::log(10.f);
const float minLogDist = 15;
const float maxLogDist = 20;
const float minLogDist = 15.f;
const float maxLogDist = 20.f;
float t = (logDistance - minLogDist) / (maxLogDist - minLogDist);
t = glm::clamp(t, 0.0f, 1.0f);
@@ -703,7 +681,6 @@ void ABufferRenderer::render(float blackoutFactor, bool doPerformanceMeasurement
_mainDepthTextureUnit = nullptr;
}
void ABufferRenderer::preRaycast(const RaycasterTask& raycasterTask) {
VolumeRaycaster& raycaster = *raycasterTask.raycaster;
const RaycastData& raycastData = _raycastData[&raycaster];
@@ -733,17 +710,9 @@ void ABufferRenderer::postRaycast(const RaycasterTask& raycasterTask) {
raycaster.postRaycast(raycastData, *_resolveProgram);
}
void ABufferRenderer::setScene(Scene* scene) {
_scene = scene;
}
void ABufferRenderer::setCamera(Camera* camera) {
_camera = camera;
}
void ABufferRenderer::setResolution(glm::ivec2 res) {
if (res != _resolution) {
_resolution = res;
_resolution = std::move(res);
_dirtyResolution = true;
}
}
@@ -893,8 +862,6 @@ void ABufferRenderer::updateResolution() {
_dirtyResolution = false;
}
void ABufferRenderer::updateResolveDictionary() {
ghoul::Dictionary dict;
ghoul::Dictionary raycastersDict;
@@ -1026,29 +993,27 @@ void ABufferRenderer::updateRendererData() {
}
void ABufferRenderer::saveTextureToMemory(const GLenum color_buffer_attachment,
const int width, const int height, std::vector<double> & memory) const {
const int width, const int height, std::vector<double>& memory) const {
if (!memory.empty()) {
memory.clear();
}
memory.reserve(width * height * 3);
float * tempMemory = new float[width * height * 3];
std::vector<float> tmpMemory(width * height * 3);
if (color_buffer_attachment != GL_DEPTH_ATTACHMENT) {
glReadBuffer(color_buffer_attachment);
glReadPixels(0, 0, width, height, GL_RGB, GL_FLOAT, tempMemory);
glReadPixels(0, 0, width, height, GL_RGB, GL_FLOAT, tmpMemory.data());
}
else {
glReadPixels(0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, tempMemory);
glReadPixels(0, 0, width, height, GL_DEPTH_COMPONENT, GL_FLOAT, tmpMemory.data());
}
for (auto i = 0; i < width*height * 3; ++i) {
memory[i] = static_cast<double>(tempMemory[i]);
memory[i] = static_cast<double>(tmpMemory[i]);
}
delete[] tempMemory;
}
}
} // namespace openspace

File diff suppressed because it is too large Load Diff

View File

@@ -86,9 +86,7 @@
namespace {
constexpr const char* _loggerCat = "RenderEngine";
constexpr const char* KeyRenderingMethod = "RenderingMethod";
constexpr const std::chrono::seconds ScreenLogTimeToLive(15);
constexpr const char* DefaultRenderingMethod = "ABuffer";
constexpr const char* RenderFsPath = "${SHADERS}/render.frag";
constexpr const char* KeyFontMono = "Mono";
@@ -242,20 +240,14 @@ RenderEngine::RenderEngine()
, _showVersionInfo(ShowVersionInfo, true)
, _showCameraInfo(ShowCameraInfo, true)
, _takeScreenshot(TakeScreenshotInfo)
, _shouldTakeScreenshot(false)
, _applyWarping(ApplyWarpingInfo, false)
, _showFrameNumber(ShowFrameNumberInfo, false)
, _disableMasterRendering(DisableMasterInfo, false)
, _disableSceneTranslationOnMaster(DisableTranslationInfo, false)
, _globalBlackOutFactor(1.f)
, _fadeDuration(2.f)
, _currentFadeTime(0.f)
, _fadeDirection(0)
, _nAaSamples(AaSamplesInfo, 4, 1, 16)
, _hdrExposure(HDRExposureInfo, 0.4f, 0.01f, 10.0f)
, _hdrBackground(BackgroundExposureInfo, 2.8f, 0.01f, 10.0f)
, _gamma(GammaInfo, 2.2f, 0.01f, 10.0f)
, _frameNumber(0)
, _screenSpaceOwner({ "ScreenSpace" })
{
_doPerformanceMeasurements.onChange([this](){
@@ -284,26 +276,29 @@ RenderEngine::RenderEngine()
_renderer->setNAaSamples(_nAaSamples);
}
});
addProperty(_nAaSamples);
_hdrExposure.onChange([this]() {
if (_renderer) {
_renderer->setHDRExposure(_hdrExposure);
}
});
addProperty(_hdrExposure);
_hdrBackground.onChange([this]() {
if (_renderer) {
_renderer->setHDRBackground(_hdrBackground);
}
});
addProperty(_hdrBackground);
_gamma.onChange([this]() {
if (_renderer) {
_renderer->setGamma(_gamma);
}
});
addProperty(_nAaSamples);
addProperty(_hdrExposure);
addProperty(_hdrBackground);
addProperty(_gamma);
addProperty(_applyWarping);
_takeScreenshot.onChange([this](){
@@ -324,14 +319,14 @@ void RenderEngine::setRendererFromString(const std::string& renderingMethod) {
std::unique_ptr<Renderer> newRenderer = nullptr;
switch (_rendererImplementation) {
case RendererImplementation::Framebuffer:
newRenderer = std::make_unique<FramebufferRenderer>();
break;
case RendererImplementation::ABuffer:
newRenderer = std::make_unique<ABufferRenderer>();
break;
case RendererImplementation::Invalid:
LFATAL(fmt::format("Rendering method '{}' not available", renderingMethod));
case RendererImplementation::Framebuffer:
newRenderer = std::make_unique<FramebufferRenderer>();
break;
case RendererImplementation::ABuffer:
newRenderer = std::make_unique<ABufferRenderer>();
break;
case RendererImplementation::Invalid:
LFATAL(fmt::format("Rendering method '{}' not available", renderingMethod));
}
setRenderer(std::move(newRenderer));
@@ -352,9 +347,11 @@ void RenderEngine::initialize() {
}
}
_disableMasterRendering = OsEng.configuration().isRenderingOnMasterDisabled;
// We have to perform these initializations here as the OsEng has not been initialized
// in our constructor
_disableSceneTranslationOnMaster =
OsEng.configuration().isSceneTranslationOnMasterDisabled;
_disableMasterRendering = OsEng.configuration().isRenderingOnMasterDisabled;
_raycasterManager = std::make_unique<RaycasterManager>();
_deferredcasterManager = std::make_unique<DeferredcasterManager>();
@@ -365,30 +362,30 @@ void RenderEngine::initialize() {
#ifdef GHOUL_USE_DEVIL
ghoul::io::TextureReader::ref().addReader(
std::make_shared<ghoul::io::TextureReaderDevIL>()
std::make_unique<ghoul::io::TextureReaderDevIL>()
);
#endif // GHOUL_USE_DEVIL
#ifdef GHOUL_USE_FREEIMAGE
ghoul::io::TextureReader::ref().addReader(
std::make_shared<ghoul::io::TextureReaderFreeImage>()
std::make_unique<ghoul::io::TextureReaderFreeImage>()
);
#endif // GHOUL_USE_FREEIMAGE
#ifdef GHOUL_USE_SOIL
ghoul::io::TextureReader::ref().addReader(
std::make_shared<ghoul::io::TextureReaderSOIL>()
std::make_unique<ghoul::io::TextureReaderSOIL>()
);
ghoul::io::TextureWriter::ref().addWriter(
std::make_shared<ghoul::io::TextureWriterSOIL>()
std::make_unique<ghoul::io::TextureWriterSOIL>()
);
#endif // GHOUL_USE_SOIL
#ifdef GHOUL_USE_STB_IMAGE
ghoul::io::TextureReader::ref().addReader(
std::make_shared<ghoul::io::TextureReaderSTB>()
std::make_unique<ghoul::io::TextureReaderSTB>()
);
#endif // GHOUL_USE_STB_IMAGE
ghoul::io::TextureReader::ref().addReader(
std::make_shared<ghoul::io::TextureReaderCMAP>()
std::make_unique<ghoul::io::TextureReaderCMAP>()
);
MissionManager::initialize();
@@ -403,26 +400,21 @@ void RenderEngine::initializeGL() {
// development
OsEng.windowWrapper().setNearFarClippingPlane(0.001f, 1000.f);
try {
const float fontSizeBig = 50.f;
_fontBig = OsEng.fontManager().font(KeyFontMono, fontSizeBig);
const float fontSizeTime = 15.f;
_fontDate = OsEng.fontManager().font(KeyFontMono, fontSizeTime);
const float fontSizeMono = 10.f;
_fontInfo = OsEng.fontManager().font(KeyFontMono, fontSizeMono);
const float fontSizeLight = 8.f;
_fontLog = OsEng.fontManager().font(KeyFontLight, fontSizeLight);
} catch (const ghoul::fontrendering::Font::FreeTypeException& e) {
LERROR(e.what());
throw;
}
constexpr const float fontSizeBig = 50.f;
_fontBig = OsEng.fontManager().font(KeyFontMono, fontSizeBig);
constexpr const float fontSizeTime = 15.f;
_fontDate = OsEng.fontManager().font(KeyFontMono, fontSizeTime);
constexpr const float fontSizeMono = 10.f;
_fontInfo = OsEng.fontManager().font(KeyFontMono, fontSizeMono);
constexpr const float fontSizeLight = 8.f;
_fontLog = OsEng.fontManager().font(KeyFontLight, fontSizeLight);
LINFO("Initializing Log");
std::unique_ptr<ScreenLog> log = std::make_unique<ScreenLog>(ScreenLogTimeToLive);
_log = log.get();
ghoul::logging::LogManager::ref().addLog(std::move(log));
for (std::shared_ptr<ScreenSpaceRenderable>& ssr : _screenSpaceRenderables) {
for (std::unique_ptr<ScreenSpaceRenderable>& ssr : _screenSpaceRenderables) {
ssr->initializeGL();
}
@@ -431,7 +423,7 @@ void RenderEngine::initializeGL() {
}
void RenderEngine::deinitialize() {
for (std::shared_ptr<ScreenSpaceRenderable>& ssr : _screenSpaceRenderables) {
for (std::unique_ptr<ScreenSpaceRenderable>& ssr : _screenSpaceRenderables) {
ssr->deinitialize();
}
@@ -439,7 +431,7 @@ void RenderEngine::deinitialize() {
}
void RenderEngine::deinitializeGL() {
for (std::shared_ptr<ScreenSpaceRenderable>& ssr : _screenSpaceRenderables) {
for (std::unique_ptr<ScreenSpaceRenderable>& ssr : _screenSpaceRenderables) {
ssr->deinitializeGL();
}
}
@@ -453,7 +445,7 @@ void RenderEngine::updateScene() {
const Time& currentTime = OsEng.timeManager().time();
_scene->update({
{ glm::dvec3(0), glm::dmat3(1), 1.0 },
{ glm::dvec3(0.0), glm::dmat3(11.), 1.0 },
currentTime,
_performanceManager != nullptr
});
@@ -490,7 +482,7 @@ void RenderEngine::updateRenderer() {
}
void RenderEngine::updateScreenSpaceRenderables() {
for (std::shared_ptr<ScreenSpaceRenderable>& ssr : _screenSpaceRenderables) {
for (std::unique_ptr<ScreenSpaceRenderable>& ssr : _screenSpaceRenderables) {
ssr->update();
}
}
@@ -517,18 +509,18 @@ glm::ivec2 RenderEngine::fontResolution() const {
void RenderEngine::updateFade() {
// Temporary fade funtionality
const float fadedIn = 1.0;
const float fadedOut = 0.0;
constexpr const float FadedIn = 1.0;
constexpr const float FadedOut = 0.0;
// Don't restart the fade if you've already done it in that direction
const bool isFadedIn = (_fadeDirection > 0 && _globalBlackOutFactor == fadedIn);
const bool isFadedOut = (_fadeDirection < 0 && _globalBlackOutFactor == fadedOut);
const bool isFadedIn = (_fadeDirection > 0 && _globalBlackOutFactor == FadedIn);
const bool isFadedOut = (_fadeDirection < 0 && _globalBlackOutFactor == FadedOut);
if (isFadedIn || isFadedOut) {
_fadeDirection = 0;
}
if (_fadeDirection != 0) {
if (_currentFadeTime > _fadeDuration) {
_globalBlackOutFactor = _fadeDirection > 0 ? fadedIn : fadedOut;
_globalBlackOutFactor = _fadeDirection > 0 ? FadedIn : FadedOut;
_fadeDirection = 0;
}
else {
@@ -548,13 +540,13 @@ void RenderEngine::updateFade() {
}
_currentFadeTime += static_cast<float>(
OsEng.windowWrapper().averageDeltaTime()
);
);
}
}
}
void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix,
const glm::mat4& projectionMatrix)
const glm::mat4& projectionMatrix)
{
LTRACE("RenderEngine::render(begin)");
WindowWrapper& wrapper = OsEng.windowWrapper();
@@ -571,7 +563,12 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat
bool masterEnabled = wrapper.isMaster() ? !_disableMasterRendering : true;
if (masterEnabled && !wrapper.isGuiWindow() && _globalBlackOutFactor > 0.f) {
_renderer->render(_globalBlackOutFactor, _performanceManager != nullptr);
_renderer->render(
_scene,
_camera,
_globalBlackOutFactor,
_performanceManager != nullptr
);
}
if (_showFrameNumber) {
@@ -585,7 +582,7 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat
++_frameNumber;
for (std::shared_ptr<ScreenSpaceRenderable>& ssr : _screenSpaceRenderables) {
for (std::unique_ptr<ScreenSpaceRenderable>& ssr : _screenSpaceRenderables) {
if (ssr->isEnabled() && ssr->isReady()) {
ssr->render();
}
@@ -593,6 +590,52 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat
LTRACE("RenderEngine::render(end)");
}
bool RenderEngine::mouseActivationCallback(const glm::dvec2& mousePosition) const {
auto intersects = [](const glm::dvec2& mousePos, const glm::ivec4& bbox) {
return mousePos.x >= bbox.x && mousePos.x <= bbox.x + bbox.z &&
mousePos.y <= bbox.y && mousePos.y >= bbox.y - bbox.w;
};
if (intersects(mousePosition, _cameraButtonLocations.rotation)) {
constexpr const char* ToggleRotationFrictionScript = R"(
local f = 'NavigationHandler.OrbitalNavigator.Friction.RotationalFriction';
openspace.setPropertyValue(f, not openspace.getPropertyValue(f));)";
OsEng.scriptEngine().queueScript(
ToggleRotationFrictionScript,
scripting::ScriptEngine::RemoteScripting::Yes
);
return true;
}
if (intersects(mousePosition, _cameraButtonLocations.zoom)) {
constexpr const char* ToggleZoomFrictionScript = R"(
local f = 'NavigationHandler.OrbitalNavigator.Friction.ZoomFriction';
openspace.setPropertyValue(f, not openspace.getPropertyValue(f));)";
OsEng.scriptEngine().queueScript(
ToggleZoomFrictionScript,
scripting::ScriptEngine::RemoteScripting::Yes
);
return true;
}
if (intersects(mousePosition, _cameraButtonLocations.roll)) {
constexpr const char* ToggleRollFrictionScript = R"(
local f = 'NavigationHandler.OrbitalNavigator.Friction.RollFriction';
openspace.setPropertyValue(f, not openspace.getPropertyValue(f));)";
OsEng.scriptEngine().queueScript(
ToggleRollFrictionScript,
scripting::ScriptEngine::RemoteScripting::Yes
);
return true;
}
return false;
}
void RenderEngine::renderOverlays(const ShutdownInformation& info) {
const bool isMaster = OsEng.windowWrapper().isMaster();
if (isMaster || _showOverlayOnSlaves) {
@@ -613,7 +656,7 @@ void RenderEngine::renderOverlays(const ShutdownInformation& info) {
}
void RenderEngine::renderShutdownInformation(float timer, float fullTime) {
timer = timer < 0.f ? 0.f : timer;
timer = std::max(timer, 0.f);
auto size = ghoul::fontrendering::FontRenderer::defaultRenderer().boundingBox(
*_fontDate,
@@ -651,7 +694,7 @@ void RenderEngine::renderDashboard() {
perf = std::make_unique<performance::PerformanceMeasurement>(
"Main Dashboard::render",
OsEng.renderEngine().performanceManager()
);
);
}
glm::vec2 penPosition = glm::vec2(
10.f,
@@ -705,24 +748,14 @@ DeferredcasterManager& RenderEngine::deferredcasterManager() {
void RenderEngine::setScene(Scene* scene) {
_scene = scene;
if (_renderer) {
_renderer->setScene(scene);
}
}
void RenderEngine::setCamera(Camera* camera) {
_camera = camera;
if (_renderer) {
_renderer->setCamera(camera);
}
}
Camera* RenderEngine::camera() const {
return _camera;
}
Renderer* RenderEngine::renderer() const {
return _renderer.get();
const Renderer& RenderEngine::renderer() const {
return *_renderer;
}
RenderEngine::RendererImplementation RenderEngine::rendererImplementation() const {
@@ -744,27 +777,29 @@ void RenderEngine::startFading(int direction, float fadeDuration) {
}
/**
* Build a program object for rendering with the used renderer
*/
* Build a program object for rendering with the used renderer
*/
std::unique_ptr<ghoul::opengl::ProgramObject> RenderEngine::buildRenderProgram(
std::string name, std::string vsPath,
std::string fsPath, const ghoul::Dictionary& data)
const std::string& name,
const std::string& vsPath,
std::string fsPath,
ghoul::Dictionary data)
{
ghoul::Dictionary dict = data;
ghoul::Dictionary dict = std::move(data);
// set path to the current renderer's main fragment shader
dict.setValue("rendererData", _rendererData);
// parameterize the main fragment shader program with specific contents.
// fsPath should point to a shader file defining a Fragment getFragment() function
// instead of a void main() setting glFragColor, glFragDepth, etc.
dict.setValue("fragmentPath", fsPath);
dict.setValue("fragmentPath", std::move(fsPath));
using namespace ghoul::opengl;
std::unique_ptr<ProgramObject> program = ProgramObject::Build(
name,
vsPath,
absPath(RenderFsPath),
dict
std::move(dict)
);
if (program) {
@@ -777,17 +812,19 @@ std::unique_ptr<ghoul::opengl::ProgramObject> RenderEngine::buildRenderProgram(
* Build a program object for rendering with the used renderer
*/
std::unique_ptr<ghoul::opengl::ProgramObject> RenderEngine::buildRenderProgram(
std::string name, std::string vsPath,
std::string fsPath, std::string csPath,
const ghoul::Dictionary& data)
const std::string& name,
const std::string& vsPath,
std::string fsPath,
const std::string& csPath,
ghoul::Dictionary data)
{
ghoul::Dictionary dict = data;
ghoul::Dictionary dict = std::move(data);
dict.setValue("rendererData", _rendererData);
// parameterize the main fragment shader program with specific contents.
// fsPath should point to a shader file defining a Fragment getFragment() function
// instead of a void main() setting glFragColor, glFragDepth, etc.
dict.setValue("fragmentPath", fsPath);
dict.setValue("fragmentPath", std::move(fsPath));
using namespace ghoul::opengl;
std::unique_ptr<ProgramObject> program = ProgramObject::Build(
@@ -795,7 +832,7 @@ std::unique_ptr<ghoul::opengl::ProgramObject> RenderEngine::buildRenderProgram(
vsPath,
absPath(RenderFsPath),
csPath,
dict
std::move(dict)
);
if (program) {
@@ -825,8 +862,8 @@ void RenderEngine::removeRenderProgram(ghoul::opengl::ProgramObject* program) {
* Called from the renderer, whenever it needs to update
* the dictionary of all rendering programs.
*/
void RenderEngine::setRendererData(const ghoul::Dictionary& data) {
_rendererData = data;
void RenderEngine::setRendererData(ghoul::Dictionary data) {
_rendererData = std::move(data);
for (ghoul::opengl::ProgramObject* program : _programs) {
ghoul::Dictionary dict = program->dictionary();
dict.setValue("rendererData", _rendererData);
@@ -839,8 +876,8 @@ void RenderEngine::setRendererData(const ghoul::Dictionary& data) {
* Called from the renderer, whenever it needs to update
* the dictionary of all post rendering programs.
*/
void RenderEngine::setResolveData(const ghoul::Dictionary& data) {
_resolveData = data;
void RenderEngine::setResolveData(ghoul::Dictionary data) {
_resolveData = std::move(data);
for (ghoul::opengl::ProgramObject* program : _programs) {
ghoul::Dictionary dict = program->dictionary();
dict.setValue("resolveData", _resolveData);
@@ -849,22 +886,22 @@ void RenderEngine::setResolveData(const ghoul::Dictionary& data) {
}
/**
* Set raycasting uniforms on the program object, and setup raycasting.
*/
* Set raycasting uniforms on the program object, and setup raycasting.
*/
void RenderEngine::preRaycast(ghoul::opengl::ProgramObject& programObject) {
_renderer->preRaycast(programObject);
}
/**
* Tear down raycasting for the specified program object.
*/
* Tear down raycasting for the specified program object.
*/
void RenderEngine::postRaycast(ghoul::opengl::ProgramObject& programObject) {
_renderer->postRaycast(programObject);
}
/**
* Set renderer
*/
* Set renderer
*/
void RenderEngine::setRenderer(std::unique_ptr<Renderer> renderer) {
if (_renderer) {
_renderer->deinitialize();
@@ -875,8 +912,6 @@ void RenderEngine::setRenderer(std::unique_ptr<Renderer> renderer) {
_renderer->setNAaSamples(_nAaSamples);
_renderer->setHDRExposure(_hdrExposure);
_renderer->initialize();
_renderer->setCamera(_camera);
_renderer->setScene(_scene);
}
scripting::LuaLibrary RenderEngine::luaLibrary() {
@@ -939,7 +974,7 @@ std::shared_ptr<performance::PerformanceManager> RenderEngine::performanceManage
return _performanceManager;
}
void RenderEngine::addScreenSpaceRenderable(std::shared_ptr<ScreenSpaceRenderable> s) {
void RenderEngine::addScreenSpaceRenderable(std::unique_ptr<ScreenSpaceRenderable> s) {
s->initialize();
s->initializeGL();
@@ -948,41 +983,41 @@ void RenderEngine::addScreenSpaceRenderable(std::shared_ptr<ScreenSpaceRenderabl
_screenSpaceRenderables.push_back(std::move(s));
}
void RenderEngine::removeScreenSpaceRenderable(std::shared_ptr<ScreenSpaceRenderable> s) {
auto it = std::find(
void RenderEngine::removeScreenSpaceRenderable(ScreenSpaceRenderable* s) {
auto it = std::find_if(
_screenSpaceRenderables.begin(),
_screenSpaceRenderables.end(),
s
[s](const std::unique_ptr<ScreenSpaceRenderable>& r) { return r.get() == s; }
);
if (it != _screenSpaceRenderables.end()) {
s->deinitialize();
_screenSpaceOwner.removePropertySubOwner(s.get());
_screenSpaceOwner.removePropertySubOwner(s);
_screenSpaceRenderables.erase(it);
}
}
void RenderEngine::removeScreenSpaceRenderable(const std::string& name) {
std::shared_ptr<ScreenSpaceRenderable> s = screenSpaceRenderable(name);
ScreenSpaceRenderable* s = screenSpaceRenderable(name);
if (s) {
removeScreenSpaceRenderable(s);
}
}
std::shared_ptr<ScreenSpaceRenderable> RenderEngine::screenSpaceRenderable(
ScreenSpaceRenderable* RenderEngine::screenSpaceRenderable(
const std::string& identifier)
{
auto it = std::find_if(
_screenSpaceRenderables.begin(),
_screenSpaceRenderables.end(),
[&identifier](const std::shared_ptr<ScreenSpaceRenderable>& s) {
[&identifier](const std::unique_ptr<ScreenSpaceRenderable>& s) {
return s->identifier() == identifier;
}
);
if (it != _screenSpaceRenderables.end()) {
return *it;
return it->get();
}
else {
return nullptr;
@@ -995,7 +1030,7 @@ std::vector<ScreenSpaceRenderable*> RenderEngine::screenSpaceRenderables() const
_screenSpaceRenderables.begin(),
_screenSpaceRenderables.end(),
res.begin(),
[](std::shared_ptr<ScreenSpaceRenderable> p) { return p.get(); }
[](const std::unique_ptr<ScreenSpaceRenderable>& p) { return p.get(); }
);
return res;
}
@@ -1021,8 +1056,8 @@ void RenderEngine::renderCameraInformation() {
return;
}
const glm::vec4 enabled = glm::vec4(0.2f, 0.75f, 0.2f, 1.f);
const glm::vec4 disabled = glm::vec4(0.55f, 0.2f, 0.2f, 1.f);
const glm::vec4 EnabledColor = glm::vec4(0.2f, 0.75f, 0.2f, 1.f);
const glm::vec4 DisabledColor = glm::vec4(0.55f, 0.2f, 0.2f, 1.f);
using FR = ghoul::fontrendering::FontRenderer;
@@ -1034,19 +1069,25 @@ void RenderEngine::renderCameraInformation() {
float penPosY = fontResolution().y - rotationBox.boundingBox.y;
const float ySeparation = 5.f;
const float xSeparation = 5.f;
constexpr const float YSeparation = 5.f;
constexpr const float XSeparation = 5.f;
interaction::OrbitalNavigator nav = OsEng.navigationHandler().orbitalNavigator();
_cameraButtonLocations.rotation = {
fontResolution().x - rotationBox.boundingBox.x - XSeparation,
fontResolution().y - penPosY,
rotationBox.boundingBox.x,
rotationBox.boundingBox.y
};
FR::defaultRenderer().render(
*_fontInfo,
glm::vec2(fontResolution().x - rotationBox.boundingBox.x - xSeparation, penPosY),
nav.hasRotationalFriction() ? enabled : disabled,
glm::vec2(fontResolution().x - rotationBox.boundingBox.x - XSeparation, penPosY),
nav.hasRotationalFriction() ? EnabledColor : DisabledColor,
"%s",
"Rotation"
);
penPosY -= rotationBox.boundingBox.y + ySeparation;
penPosY -= rotationBox.boundingBox.y + YSeparation;
FR::BoundingBoxInformation zoomBox = FR::defaultRenderer().boundingBox(
*_fontInfo,
@@ -1054,14 +1095,20 @@ void RenderEngine::renderCameraInformation() {
"Zoom"
);
_cameraButtonLocations.zoom = {
fontResolution().x - zoomBox.boundingBox.x - XSeparation,
fontResolution().y - penPosY,
zoomBox.boundingBox.x,
zoomBox.boundingBox.y
};
FR::defaultRenderer().render(
*_fontInfo,
glm::vec2(fontResolution().x - zoomBox.boundingBox.x - xSeparation, penPosY),
nav.hasZoomFriction() ? enabled : disabled,
glm::vec2(fontResolution().x - zoomBox.boundingBox.x - XSeparation, penPosY),
nav.hasZoomFriction() ? EnabledColor : DisabledColor,
"%s",
"Zoom"
);
penPosY -= zoomBox.boundingBox.y + ySeparation;
penPosY -= zoomBox.boundingBox.y + YSeparation;
FR::BoundingBoxInformation rollBox = FR::defaultRenderer().boundingBox(
*_fontInfo,
@@ -1069,10 +1116,16 @@ void RenderEngine::renderCameraInformation() {
"Roll"
);
_cameraButtonLocations.roll = {
fontResolution().x - rollBox.boundingBox.x - XSeparation,
fontResolution().y - penPosY,
rollBox.boundingBox.x,
rollBox.boundingBox.y
};
FR::defaultRenderer().render(
*_fontInfo,
glm::vec2(fontResolution().x - rollBox.boundingBox.x - xSeparation, penPosY),
nav.hasRollFriction() ? enabled : disabled,
glm::vec2(fontResolution().x - rollBox.boundingBox.x - XSeparation, penPosY),
nav.hasRollFriction() ? EnabledColor : DisabledColor,
"%s",
"Roll"
);
@@ -1135,15 +1188,15 @@ void RenderEngine::renderScreenLog() {
_log->removeExpiredEntries();
const int max = 10;
const int categoryLength = 20;
const int messageLength = 140;
std::chrono::seconds fade(5);
constexpr const int MaxNumberMessages = 10;
constexpr const int CategoryLength = 20;
constexpr const int MessageLength = 140;
constexpr const std::chrono::seconds FadeTime(5);
const std::vector<ScreenLog::LogEntry> entries = _log->entries();
const std::vector<ScreenLog::LogEntry>& entries = _log->entries();
auto lastEntries =
entries.size() > max ?
std::make_pair(entries.rbegin(), entries.rbegin() + max) :
entries.size() > MaxNumberMessages ?
std::make_pair(entries.rbegin(), entries.rbegin() + MaxNumberMessages) :
std::make_pair(entries.rbegin(), entries.rend());
size_t nr = 1;
@@ -1153,22 +1206,22 @@ void RenderEngine::renderScreenLog() {
std::chrono::duration<double> diff = now - e->timeStamp;
float alpha = 1;
std::chrono::duration<double> ttf = ScreenLogTimeToLive - fade;
float alpha = 1.f;
std::chrono::duration<double> ttf = ScreenLogTimeToLive - FadeTime;
if (diff > ttf) {
auto d = (diff - ttf).count();
auto t = static_cast<float>(d) / static_cast<float>(fade.count());
auto t = static_cast<float>(d) / static_cast<float>(FadeTime.count());
float p = 0.8f - t;
alpha = (p <= 0.f) ? 0.f : pow(p, 0.4f);
}
// Since all log entries are ordered, once one exceeds alpha, all have
if (alpha <= 0.0) {
if (alpha <= 0.f) {
break;
}
const std::string lvl = "(" + ghoul::logging::stringFromLevel(e->level) + ")";
const std::string& message = e->message.substr(0, messageLength);
const std::string& message = e->message.substr(0, MessageLength);
nr += std::count(message.begin(), message.end(), '\n');
const glm::vec4 white(0.9f, 0.9f, 0.9f, alpha);
@@ -1179,7 +1232,7 @@ void RenderEngine::renderScreenLog() {
white,
"%-14s %s%s",
e->timeString.c_str(),
e->category.substr(0, categoryLength).c_str(),
e->category.substr(0, CategoryLength).c_str(),
e->category.length() > 20 ? "..." : "");
glm::vec4 color(glm::uninitialize);
@@ -1209,7 +1262,8 @@ void RenderEngine::renderScreenLog() {
lvl.c_str()
);
RenderFont(*_fontLog,
RenderFont(
*_fontLog,
glm::vec2(10 + 53 * _fontLog->pointSize(), _fontLog->pointSize() * nr * 2),
white,
"%s",
@@ -1219,14 +1273,6 @@ void RenderEngine::renderScreenLog() {
}
}
std::vector<Syncable*> RenderEngine::getSyncables() {
if (_camera) {
return _camera->getSyncables();
} else {
return {};
}
}
properties::PropertyOwner& RenderEngine::screenSpaceOwner() {
return _screenSpaceOwner;
}

View File

@@ -70,7 +70,8 @@ int toggleFade(lua_State* L) {
int fadeIn(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::fadeIn");
double t = luaL_checknumber(L, -1);
double t = luaL_checknumber(L, 1);
lua_pop(L, 1);
OsEng.renderEngine().startFading(1, static_cast<float>(t));
@@ -85,7 +86,8 @@ int fadeIn(lua_State* L) {
int fadeOut(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::fadeOut");
double t = luaL_checknumber(L, -1);
double t = luaL_checknumber(L, 1);
lua_pop(L, 1);
OsEng.renderEngine().startFading(-1, static_cast<float>(t));
@@ -108,10 +110,10 @@ int addScreenSpaceRenderable(lua_State* L) {
return 0;
}
std::shared_ptr<ScreenSpaceRenderable> s(
std::unique_ptr<ScreenSpaceRenderable> s(
ScreenSpaceRenderable::createFromDictionary(d)
);
OsEng.renderEngine().addScreenSpaceRenderable(s);
OsEng.renderEngine().addScreenSpaceRenderable(std::move(s));
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
return 0;
@@ -123,22 +125,7 @@ int removeScreenSpaceRenderable(lua_State* L) {
using ghoul::lua::errorLocation;
std::string name = ghoul::lua::checkStringAndPop(L);
std::shared_ptr<ScreenSpaceRenderable> s = OsEng.renderEngine().screenSpaceRenderable(
name
);
if (!s) {
LERRORC(
"removeScreenSpaceRenderable",
fmt::format(
"{}: Could not find ScreenSpaceRenderable '{}'", errorLocation(L), name
)
);
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
return 0;
}
OsEng.renderEngine().removeScreenSpaceRenderable(s);
OsEng.renderEngine().removeScreenSpaceRenderable(name);
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
return 0;

View File

@@ -30,6 +30,7 @@
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/scripting/scriptengine.h>
#include <openspace/scene/scene.h>
#include <openspace/util/camera.h>
#include <openspace/util/factorymanager.h>
@@ -540,7 +541,7 @@ void ScreenSpaceRenderable::draw(glm::mat4 modelTransform) {
_shader->setUniform(
_uniformCache.viewProj,
OsEng.renderEngine().camera()->viewProjectionMatrix()
OsEng.renderEngine().scene()->camera()->viewProjectionMatrix()
);
ghoul::opengl::TextureUnit unit;

View File

@@ -456,9 +456,10 @@ int addSceneGraphNode(lua_State* L) {
int removeSceneGraphNode(lua_State* L) {
using ghoul::lua::errorLocation;
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::removeSceneGraphNode");
const int n = ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::removeSceneGraphNode");
std::string nodeName = luaL_checkstring(L, 1);
std::string nodeName = luaL_checkstring(L, -1);
SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(nodeName);
if (!node) {
LERRORC(
@@ -475,15 +476,31 @@ int removeSceneGraphNode(lua_State* L) {
);
return 0;
}
node->deinitializeGL();
parent->detachChild(*node);
std::function<void (SceneGraphNode*, SceneGraphNode*)> removeNode =
[&removeNode](SceneGraphNode* parent, SceneGraphNode* node) {
std::vector<SceneGraphNode*> children = node->children();
std::unique_ptr<SceneGraphNode> n = parent->detachChild(*node);
ghoul_assert(n.get() == node, "Wrong node returned from detaching");
for (SceneGraphNode* c : children) {
removeNode(n.get(), c);
}
node->deinitializeGL();
node->deinitialize();
n = nullptr;
};
removeNode(parent, node);
lua_settop(L, 0);
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
return 0;
}
int hasSceneGraphNode(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::hasSceneGraphNode");

View File

@@ -407,7 +407,7 @@ void SceneGraphNode::attachChild(std::unique_ptr<SceneGraphNode> child) {
// Create link between parent and child
child->_parent = this;
SceneGraphNode* childRaw = child.get();
_children.push_back(std::move(child));
_children.push_back(std::move(child));
// Set scene of child (and children recursively)
childRaw->setScene(_scene);

Some files were not shown because too many files have changed in this diff Show More