diff --git a/apps/Launcher/syncwidget.cpp b/apps/Launcher/syncwidget.cpp index e621733131..b58511ea23 100644 --- a/apps/Launcher/syncwidget.cpp +++ b/apps/Launcher/syncwidget.cpp @@ -454,7 +454,12 @@ void SyncWidget::syncButtonPressed() { if (QFileInfo(dataFile).exists()) { ghoul::Dictionary dataDictionary; - ghoul::lua::loadDictionaryFromFile(dataFile.toStdString(), dataDictionary); + try { + ghoul::lua::loadDictionaryFromFile(dataFile.toStdString(), dataDictionary); + } + catch (const ghoul::lua::LuaLoadingException& exception) { + LWARNINGC(exception.component, exception.message); + } ghoul::Dictionary directDownloadFiles; ghoul::Dictionary fileRequests; diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index b17adaa7b4..3bc0f706c2 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -313,7 +313,6 @@ void mainInitFunc() { void mainPreSyncFunc() { LTRACE("main::mainPreSyncFunc(begin)"); - OsEng.setRunTime(sgct::Engine::getTime()); OsEng.preSynchronization(); LTRACE("main::mainPreSyncFunc(end)"); } diff --git a/data/scene/default.scene b/data/scene/default.scene index ae01952cfb..3236f8943b 100644 --- a/data/scene/default.scene +++ b/data/scene/default.scene @@ -86,59 +86,10 @@ function postInitialization() openspace.printInfo("Setting default values") - openspace.setPropertyValueSingle("SunGlare.renderable.Enabled", false) - openspace.setPropertyValueSingle("SunMarker.renderable.Enabled", false) - - openspace.setPropertyValueSingle("Constellation Bounds.renderable.Enabled", false) openspace.setPropertyValueSingle("Global Properties.GlobeBrowsing.GdalWrapper.LogGdalErrors", false) - -- Digital Universe - openspace.setPropertyValueSingle("Wilkinson Microwave Anisotropy Probe (WMAP).renderable.Enabled", false) - openspace.setPropertyValueSingle("Quasars.renderable.Enabled", false) - openspace.setPropertyValueSingle("Pulsars.renderable.Enabled", false) - openspace.setPropertyValueSingle("Globular Clusters.renderable.Enabled", false) - openspace.setPropertyValueSingle("Kepler Planetary Candidates.renderable.Enabled", false) - openspace.setPropertyValueSingle("Local Dwarf Galaxies.renderable.Enabled", false) - openspace.setPropertyValueSingle("Exoplanets.renderable.Enabled", false) - openspace.setPropertyValueSingle("Sloan Digital Sky Survey.renderable.Enabled", false) - openspace.setPropertyValueSingle("Planetary Nebulae.renderable.Enabled", false) - openspace.setPropertyValueSingle("OB Associations.renderable.Enabled", false) - openspace.setPropertyValueSingle("Open Star Clusters.renderable.Enabled", false) - openspace.setPropertyValueSingle("Supernova Remnants.renderable.Enabled", false) - openspace.setPropertyValueSingle("HII Regions.renderable.Enabled", false) - openspace.setPropertyValueSingle("Abell Galaxy Clusters.renderable.Enabled", false) - openspace.setPropertyValueSingle("2MASS Galaxies.renderable.Enabled", false) - openspace.setPropertyValueSingle("6dF Galaxies.renderable.Enabled", false) - openspace.setPropertyValueSingle("2dF Galaxies.renderable.Enabled", false) - openspace.setPropertyValueSingle("Cosmic Background Explorer.renderable.Enabled", false) - openspace.setPropertyValueSingle("Planck.renderable.Enabled", false) - openspace.setPropertyValueSingle("Dwarfs.renderable.Enabled", false) - openspace.setPropertyValueSingle("Nearby Galaxy Groups.renderable.Enabled", false) - openspace.setPropertyValueSingle("Galaxy Cluster Labels.renderable.Enabled", false) - openspace.setPropertyValueSingle("Voids.renderable.Enabled", false) - openspace.setPropertyValueSingle("Galaxy Superclusters.renderable.Enabled", false) - openspace.setPropertyValueSingle("Stars Labels.renderable.Enabled", false) - openspace.setPropertyValueSingle("Stars Labels - Alternate.renderable.Enabled", false) - openspace.setPropertyValueSingle("Tully Galaxies.renderable.Enabled", false) - openspace.setPropertyValueSingle("Tully Galaxies Pics.renderable.Enabled", false) - openspace.setPropertyValueSingle("Constellations (Extragalactic).renderable.Enabled", false) - openspace.setPropertyValueSingle("Constellations.renderable.Enabled", false) - - openspace.setPropertyValueSingle("Earth.RenderableGlobe.Atmosphere", true) openspace.setPropertyValueSingle("Earth.RenderableGlobe.Debug.LevelByProjectedAreaElseDistance", false) - openspace.setPropertyValueSingle("Ecliptic Grid.renderable.Enabled", false) - openspace.setPropertyValueSingle("Ecliptic Grid Labels.renderable.Enabled", false) - openspace.setPropertyValueSingle("Equatorial Grid.renderable.Enabled", false) - openspace.setPropertyValueSingle("Equatorial Grid Labels.renderable.Enabled", false) - openspace.setPropertyValueSingle("Galactic Grid.renderable.Enabled", false) - openspace.setPropertyValueSingle("Galactic Grid Labels.renderable.Enabled", false) - openspace.setPropertyValueSingle("100kly Grid.renderable.Enabled", false) - openspace.setPropertyValueSingle("1Mly Grid.renderable.Enabled", false) - openspace.setPropertyValueSingle("10Mly Grid.renderable.Enabled", false) - openspace.setPropertyValueSingle("100Mly Grid.renderable.Enabled", false) - openspace.setPropertyValueSingle("20Gly Grid.renderable.Enabled", false) - openspace.globebrowsing.goToGeo(58.5877, 16.1924, 20000000) openspace.printInfo("Done setting default values") diff --git a/data/scene/digitaluniverse/2dF/2dF.data b/data/scene/digitaluniverse/2dF/2dF.data index 7c5cc11406..9d82da14ca 100644 --- a/data/scene/digitaluniverse/2dF/2dF.data +++ b/data/scene/digitaluniverse/2dF/2dF.data @@ -1,6 +1,6 @@ return { FileRequest = { - { Identifier = "digitaluniverse_2df_speck", Destination = "speck", Version = 1 }, - { Identifier = "digitaluniverse_2df_textures", Destination = "textures", Version = 1 } + { Identifier = "digitaluniverse_2dF_speck", Destination = "speck", Version = 1 }, + { Identifier = "digitaluniverse_2dF_textures", Destination = "textures", Version = 1 } } } diff --git a/data/scene/digitaluniverse/2dF/2dF.mod b/data/scene/digitaluniverse/2dF/2dF.mod index 224b6ca01a..b7ad2c59da 100644 --- a/data/scene/digitaluniverse/2dF/2dF.mod +++ b/data/scene/digitaluniverse/2dF/2dF.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 1.0, 1.0 }, Transparency = 1.0, File = "speck/2dF.speck", diff --git a/data/scene/digitaluniverse/2mass/2mass.mod b/data/scene/digitaluniverse/2mass/2mass.mod index 47873fb2b6..5dc7fa5400 100644 --- a/data/scene/digitaluniverse/2mass/2mass.mod +++ b/data/scene/digitaluniverse/2mass/2mass.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 0.4, 0.2 }, Transparency = 1.0, File = "speck/2MASS.speck", diff --git a/data/scene/digitaluniverse/6dF/6dF.data b/data/scene/digitaluniverse/6dF/6dF.data index 665e88cf1d..9f14c15faf 100644 --- a/data/scene/digitaluniverse/6dF/6dF.data +++ b/data/scene/digitaluniverse/6dF/6dF.data @@ -1,6 +1,6 @@ return { FileRequest = { - { Identifier = "digitaluniverse_6df_speck", Destination = "speck", Version = 1 }, - { Identifier = "digitaluniverse_6df_textures", Destination = "textures", Version = 1 } + { Identifier = "digitaluniverse_6dF_speck", Destination = "speck", Version = 1 }, + { Identifier = "digitaluniverse_6dF_textures", Destination = "textures", Version = 1 } } } diff --git a/data/scene/digitaluniverse/6dF/6dF.mod b/data/scene/digitaluniverse/6dF/6dF.mod index a485a2c989..1db843fafe 100644 --- a/data/scene/digitaluniverse/6dF/6dF.mod +++ b/data/scene/digitaluniverse/6dF/6dF.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 1.0, 1.0 }, Transparency = 1.0, File = "speck/6dF.speck", diff --git a/data/scene/digitaluniverse/abell/abell.mod b/data/scene/digitaluniverse/abell/abell.mod index 0113c4ae1c..8cab971966 100644 --- a/data/scene/digitaluniverse/abell/abell.mod +++ b/data/scene/digitaluniverse/abell/abell.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 0.4, 0.2 }, Transparency = 1.0, ScaleFactor = 525.0, diff --git a/data/scene/digitaluniverse/alternatestarlabels/alternatestarlabels.mod b/data/scene/digitaluniverse/alternatestarlabels/alternatestarlabels.mod index f3d3b0f020..9e2820810a 100644 --- a/data/scene/digitaluniverse/alternatestarlabels/alternatestarlabels.mod +++ b/data/scene/digitaluniverse/alternatestarlabels/alternatestarlabels.mod @@ -4,12 +4,10 @@ return { Name = "Stars Labels - Alternate", Parent = "Root", Renderable = { - --Type = "RenderablePoints", Type = "RenderableBillboardsCloud", + Enabled = false, Color = {1.0, 1.0, 1.0}, Transparency = 0.65, - --ScaleFactor = 10.0, - --File = "speck/stars.speck", LabelFile = "speck/stars-altlbl.label", TextColor = { 0.4, 0.4, 0.4, 1.0 }, DrawLabels = true, diff --git a/data/scene/digitaluniverse/backgroundradiation/backgroundradiation.mod b/data/scene/digitaluniverse/backgroundradiation/backgroundradiation.mod index 1917b8b11b..482b1f4a6e 100644 --- a/data/scene/digitaluniverse/backgroundradiation/backgroundradiation.mod +++ b/data/scene/digitaluniverse/backgroundradiation/backgroundradiation.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableSphere", + Enabled = false, Size = 3975.41417036064E23, Segments = 80, Alpha = 0.5, @@ -18,6 +19,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableSphere", + Enabled = false, Size = 3975.41417036064E23, Segments = 80, Alpha = 0.5, @@ -31,6 +33,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableSphere", + Enabled = false, Size = 3975.41417036064E23, Segments = 80, Alpha = 0.5, diff --git a/data/scene/digitaluniverse/clusters/clusters.mod b/data/scene/digitaluniverse/clusters/clusters.mod index 139be7894a..a0b1631ad4 100644 --- a/data/scene/digitaluniverse/clusters/clusters.mod +++ b/data/scene/digitaluniverse/clusters/clusters.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = {1.0, 1.0, 1.0}, Transparency = 0.65, LabelFile = "speck/galclust.label", diff --git a/data/scene/digitaluniverse/constellationbounds/constellationbounds.mod b/data/scene/digitaluniverse/constellationbounds/constellationbounds.mod index 7ea14dbe6d..677dc21c20 100644 --- a/data/scene/digitaluniverse/constellationbounds/constellationbounds.mod +++ b/data/scene/digitaluniverse/constellationbounds/constellationbounds.mod @@ -10,6 +10,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableConstellationBounds", + Enabled = false, File = "data/bound_20.dat", ConstellationFile = "data/constellations.dat" -- ConstellationSelection = zodiacs diff --git a/data/scene/digitaluniverse/constellations/constellations.mod b/data/scene/digitaluniverse/constellations/constellations.mod index 79e977852f..0beb479c0c 100644 --- a/data/scene/digitaluniverse/constellations/constellations.mod +++ b/data/scene/digitaluniverse/constellations/constellations.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableDUMeshes", + Enabled = false, Color = { 1.0, 0.4, 0.2 }, Transparency = 1.0, ScaleFactor = 1.0, @@ -23,6 +24,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableDUMeshes", + Enabled = false, Color = { 1.0, 0.4, 0.2 }, Transparency = 1.0, ScaleFactor = 1.0, diff --git a/data/scene/digitaluniverse/dwarfs/dwarfs.mod b/data/scene/digitaluniverse/dwarfs/dwarfs.mod index 714ab351e5..57669d09c7 100644 --- a/data/scene/digitaluniverse/dwarfs/dwarfs.mod +++ b/data/scene/digitaluniverse/dwarfs/dwarfs.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 0.5, 1.0, 0.2 }, Transparency = 0.999, File = "speck/dwarfs.speck", diff --git a/data/scene/digitaluniverse/exoplanets/exoplanets.mod b/data/scene/digitaluniverse/exoplanets/exoplanets.mod index f27575f1c7..43da47d10c 100644 --- a/data/scene/digitaluniverse/exoplanets/exoplanets.mod +++ b/data/scene/digitaluniverse/exoplanets/exoplanets.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 1.0, 1.0 }, Transparency = 0.65, ScaleFactor = 10.0, diff --git a/data/scene/digitaluniverse/globularclusters/globularclusters.mod b/data/scene/digitaluniverse/globularclusters/globularclusters.mod index beb31a0cd0..67e0c2ba79 100644 --- a/data/scene/digitaluniverse/globularclusters/globularclusters.mod +++ b/data/scene/digitaluniverse/globularclusters/globularclusters.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 0.8, 0.8, 0.0 }, Transparency = 0.35, File = "speck/gc.speck", diff --git a/data/scene/digitaluniverse/grids/grids.mod b/data/scene/digitaluniverse/grids/grids.mod index 8262f14711..de3ce0111f 100644 --- a/data/scene/digitaluniverse/grids/grids.mod +++ b/data/scene/digitaluniverse/grids/grids.mod @@ -4,6 +4,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = {1.0, 1.0, 1.0}, Transparency = 0.65, --ScaleFactor = 10.0, @@ -30,6 +31,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = {1.0, 1.0, 1.0}, Transparency = 0.65, --ScaleFactor = 10.0, @@ -47,6 +49,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = {1.0, 1.0, 1.0}, Transparency = 0.65, --ScaleFactor = 10.0, @@ -64,6 +67,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableDUMeshes", + Enabled = false, Color = {1.0, 1.0, 1.0}, Transparency = 0.4, ScaleFactor = 1.0, @@ -82,6 +86,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableDUMeshes", + Enabled = false, Color = {1.0, 1.0, 1.0}, Transparency = 0.4, ScaleFactor = 1.0, @@ -100,6 +105,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableDUMeshes", + Enabled = false, Color = {1.0, 1.0, 1.0}, Transparency = 0.4, ScaleFactor = 1.0, @@ -118,6 +124,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableDUMeshes", + Enabled = false, Color = {1.0, 1.0, 1.0}, Transparency = 0.4, ScaleFactor = 1.0, @@ -136,6 +143,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableDUMeshes", + Enabled = false, Color = {1.0, 1.0, 1.0}, Transparency = 0.4, ScaleFactor = 1.0, diff --git a/data/scene/digitaluniverse/groups/groups.mod b/data/scene/digitaluniverse/groups/groups.mod index a368235e90..ffc76b86de 100644 --- a/data/scene/digitaluniverse/groups/groups.mod +++ b/data/scene/digitaluniverse/groups/groups.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 1.0, 1.0 }, Transparency = 0.65, --ScaleFactor = 10.0, diff --git a/data/scene/digitaluniverse/h2regions/h2regions.mod b/data/scene/digitaluniverse/h2regions/h2regions.mod index 8ac65d49f6..eb89a14b7a 100644 --- a/data/scene/digitaluniverse/h2regions/h2regions.mod +++ b/data/scene/digitaluniverse/h2regions/h2regions.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 0.0, 0.5, 1.0 }, Transparency = 0.35, File = "speck/h2.speck", diff --git a/data/scene/digitaluniverse/kepler/kepler.mod b/data/scene/digitaluniverse/kepler/kepler.mod index 010a388509..9e213f4efa 100644 --- a/data/scene/digitaluniverse/kepler/kepler.mod +++ b/data/scene/digitaluniverse/kepler/kepler.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 1.0, 0.0 }, Transparency = 0.99, ScaleFactor = 395.0, diff --git a/data/scene/digitaluniverse/localdwarfs/localdwarfs.mod b/data/scene/digitaluniverse/localdwarfs/localdwarfs.mod index 6542380b62..8247103091 100644 --- a/data/scene/digitaluniverse/localdwarfs/localdwarfs.mod +++ b/data/scene/digitaluniverse/localdwarfs/localdwarfs.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 0.5, 1.0, 0.2 }, Transparency = 0.3, File = "speck/localdwarfs.speck", diff --git a/data/scene/digitaluniverse/obassociations/obassociations.mod b/data/scene/digitaluniverse/obassociations/obassociations.mod index c6c53c209b..fab705012b 100644 --- a/data/scene/digitaluniverse/obassociations/obassociations.mod +++ b/data/scene/digitaluniverse/obassociations/obassociations.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 0.0, 0.0, 1.0 }, Transparency = 0.5, File = "speck/ob.speck", diff --git a/data/scene/digitaluniverse/openclusters/openclusters.mod b/data/scene/digitaluniverse/openclusters/openclusters.mod index aaba2cb547..03950a0836 100644 --- a/data/scene/digitaluniverse/openclusters/openclusters.mod +++ b/data/scene/digitaluniverse/openclusters/openclusters.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 0.1, 0.8, 0.4 }, Transparency = 0.5, File = "speck/oc.speck", diff --git a/data/scene/digitaluniverse/planetarynebulae/planetarynebulae.mod b/data/scene/digitaluniverse/planetarynebulae/planetarynebulae.mod index ecc8729fa9..93b589e042 100644 --- a/data/scene/digitaluniverse/planetarynebulae/planetarynebulae.mod +++ b/data/scene/digitaluniverse/planetarynebulae/planetarynebulae.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = {0.4, 0.4, 0.9}, Transparency = 0.35, File = "speck/pn.speck", diff --git a/data/scene/digitaluniverse/pulsars/pulsars.mod b/data/scene/digitaluniverse/pulsars/pulsars.mod index ba1533260c..0f548c0f27 100644 --- a/data/scene/digitaluniverse/pulsars/pulsars.mod +++ b/data/scene/digitaluniverse/pulsars/pulsars.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 0.7, 0.0, 0.0 }, Transparency = 0.5, File = "speck/pulsar.speck", diff --git a/data/scene/digitaluniverse/quasars/quasars.mod b/data/scene/digitaluniverse/quasars/quasars.mod index 69616d3c2c..664810f3e3 100644 --- a/data/scene/digitaluniverse/quasars/quasars.mod +++ b/data/scene/digitaluniverse/quasars/quasars.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 0.4, 0.2 }, Transparency = 1.0, File = "speck/quasars.speck", diff --git a/data/scene/digitaluniverse/sloandss/sloandss.mod b/data/scene/digitaluniverse/sloandss/sloandss.mod index 82550dda59..2eae94af43 100644 --- a/data/scene/digitaluniverse/sloandss/sloandss.mod +++ b/data/scene/digitaluniverse/sloandss/sloandss.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 0.8, 0.8, 1.0 }, Transparency = 1.0, ScaleFactor = 507.88, diff --git a/data/scene/digitaluniverse/starlabels/starlabels.mod b/data/scene/digitaluniverse/starlabels/starlabels.mod index 3df269d0a2..9b218fba77 100644 --- a/data/scene/digitaluniverse/starlabels/starlabels.mod +++ b/data/scene/digitaluniverse/starlabels/starlabels.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 1.0, 1.0 }, Transparency = 0.65, LabelFile = "speck/stars.label", diff --git a/data/scene/digitaluniverse/superclusters/superclusters.mod b/data/scene/digitaluniverse/superclusters/superclusters.mod index 9316e376cc..ee173bdb2e 100644 --- a/data/scene/digitaluniverse/superclusters/superclusters.mod +++ b/data/scene/digitaluniverse/superclusters/superclusters.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 1.0, 1.0 }, Transparency = 0.65, File = "speck/superclust.speck", diff --git a/data/scene/digitaluniverse/supernovaremnants/supernovaremnants.mod b/data/scene/digitaluniverse/supernovaremnants/supernovaremnants.mod index 3bdcb404bf..d9cd87b994 100644 --- a/data/scene/digitaluniverse/supernovaremnants/supernovaremnants.mod +++ b/data/scene/digitaluniverse/supernovaremnants/supernovaremnants.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 0.5, 0.0 }, Transparency = 0.5, File = "speck/snr.speck", diff --git a/data/scene/digitaluniverse/tully/tully.data b/data/scene/digitaluniverse/tully/tully.data index c5832f18f8..705b46f71d 100644 --- a/data/scene/digitaluniverse/tully/tully.data +++ b/data/scene/digitaluniverse/tully/tully.data @@ -1,6 +1,6 @@ return { FileRequest = { - { Identifier = "digitaluniverse_tully_speck", Destination = "speck", Version = 1 } + { Identifier = "digitaluniverse_tully_speck", Destination = "speck", Version = 1 }, { Identifier = "digitaluniverse_tully_textures", Destination = "textures", Version = 1 } } } diff --git a/data/scene/digitaluniverse/tully/tully.mod b/data/scene/digitaluniverse/tully/tully.mod index 47a6342dce..a64d7080e6 100644 --- a/data/scene/digitaluniverse/tully/tully.mod +++ b/data/scene/digitaluniverse/tully/tully.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 0.4, 0.2 }, Transparency = 0.99, ScaleFactor = 502.77, @@ -38,6 +39,7 @@ return { Parent = "Root", Renderable = { Type = "RenderablePlanesCloud", + Enabled = false, Color = { 1.0, 1.0, 1.0 }, Transparency = 0.99, ScaleFactor = 27.39, diff --git a/data/scene/digitaluniverse/voids/voids.mod b/data/scene/digitaluniverse/voids/voids.mod index 00403ebf2e..eec3534b46 100644 --- a/data/scene/digitaluniverse/voids/voids.mod +++ b/data/scene/digitaluniverse/voids/voids.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableBillboardsCloud", + Enabled = false, Color = { 1.0, 1.0, 1.0 }, Transparency = 0.65, --ScaleFactor = 10.0, diff --git a/data/scene/examples/luatransforms/luatransforms.mod b/data/scene/examples/luatransforms/luatransforms.mod new file mode 100644 index 0000000000..8ba5ea62b8 --- /dev/null +++ b/data/scene/examples/luatransforms/luatransforms.mod @@ -0,0 +1,21 @@ +return { + -- Earth barycenter module + { + Name = "Lua Transformation", + Parent = "SolarSystemBarycenter", + Transform = { + Rotation = { + Type = "LuaRotation", + Script = "rotation.lua" + }, + Scale = { + Type = "LuaScale", + Script = "scale.lua" + }, + Translation = { + Type = "LuaTranslation", + Script = "translate.lua" + } + } + } +} diff --git a/data/scene/examples/luatransforms/rotation.lua b/data/scene/examples/luatransforms/rotation.lua new file mode 100644 index 0000000000..0db9bd5949 --- /dev/null +++ b/data/scene/examples/luatransforms/rotation.lua @@ -0,0 +1,6 @@ +-- t1: Ingame seconds past the J2000 epoch +-- t2: Wallclock milliseconds past the J2000 epoch + +function rotation(t1, t2) + return 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 +end diff --git a/data/scene/examples/luatransforms/scale.lua b/data/scene/examples/luatransforms/scale.lua new file mode 100644 index 0000000000..99ac664c5f --- /dev/null +++ b/data/scene/examples/luatransforms/scale.lua @@ -0,0 +1,6 @@ +-- t1: Ingame seconds past the J2000 epoch +-- t2: Wallclock milliseconds past the J2000 epoch + +function scale(t1, t2) + return 1.0; +end diff --git a/data/scene/examples/luatransforms/translate.lua b/data/scene/examples/luatransforms/translate.lua new file mode 100644 index 0000000000..3dfb769e98 --- /dev/null +++ b/data/scene/examples/luatransforms/translate.lua @@ -0,0 +1,6 @@ +-- t1: Ingame seconds past the J2000 epoch +-- t2: Wallclock milliseconds past the J2000 epoch + +function translation(t1, t2) + return 0.0, 0.0, 0.0 +end diff --git a/data/scene/grids/grids.mod b/data/scene/grids/grids.mod index 656210b155..29371f6fe2 100644 --- a/data/scene/grids/grids.mod +++ b/data/scene/grids/grids.mod @@ -5,6 +5,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableSphericalGrid", + Enabled = false, GridColor = { 0.7, 0.0, 0.0, 0.5}, LineWidth = 2.0, Radius = 9.46377307652E17; @@ -20,6 +21,7 @@ return { Parent = "Root", Renderable = { Type = "RenderableSphericalGrid", + Enabled = false, GridColor = { 0.0, 0.0, 1.0, 0.8}, LineWidth = 2.0, Radius = 6.2440846E17, @@ -35,6 +37,7 @@ return { Parent = "SolarSystem", Renderable = { Type = "RenderableSphericalGrid", + Enabled = false, LineWidth = 2.0, Radius = 9.46377307652E18; GridColor = { 0.0, 0.6, 0.6, 0.6} diff --git a/data/scene/mars/mars.mod b/data/scene/mars/mars.mod index dff1ff6c77..c06dd591ee 100644 --- a/data/scene/mars/mars.mod +++ b/data/scene/mars/mars.mod @@ -79,20 +79,24 @@ return { }, { Name = "Themis IR Day [Utah]", - FilePath = "map_service_configs/Utah/Themis_IR_Day.xml" + FilePath = "map_service_configs/Utah/Themis_IR_Day.xml", + BlendMode = "Color" }, { Name = "Themis IR Night [Utah]", - FilePath = "map_service_configs/Utah/Themis_IR_Night.xml" + FilePath = "map_service_configs/Utah/Themis_IR_Night.xml", + BlendMode = "Color" }, { Name = "Themis IR Day [AWS]", - FilePath = "map_service_configs/AWS/Themis_IR_Day.wms" + FilePath = "map_service_configs/AWS/Themis_IR_Day.wms", + BlendMode = "Color" }, { Name = "Themis IR Night [AWS]", - FilePath = "map_service_configs/AWS/Themis_IR_Night.wms" + FilePath = "map_service_configs/AWS/Themis_IR_Night.wms", + BlendMode = "Color" } }, Overlays = { diff --git a/data/scene/missions/osirisrex/bennu/bennu.mod b/data/scene/missions/osirisrex/bennu/bennu.mod index d031ad045e..be4ecd3c1f 100644 --- a/data/scene/missions/osirisrex/bennu/bennu.mod +++ b/data/scene/missions/osirisrex/bennu/bennu.mod @@ -32,12 +32,7 @@ return { Fadeable = false, Ghosting = false, }, - Textures = { - Type = "simple", - Color = "textures/gray.png", - Project = "textures/defaultProj.png", - Default = "textures/defaultProj.png" - }, + ColorTexture = "textures/gray.png", Projection = { Sequence = "InstrumentTimes", SequenceType = "instrument-times", diff --git a/data/scene/moon/map_service_configs/MoonTrek/LRO WAC.wms b/data/scene/moon/map_service_configs/MoonTrek/LRO WAC.wms deleted file mode 100644 index 1085bbda66..0000000000 --- a/data/scene/moon/map_service_configs/MoonTrek/LRO WAC.wms +++ /dev/null @@ -1,20 +0,0 @@ - - - http://asgard.sci.utah.edu/Moon/Wac/tile/${z}/${y}/${x} - - - -180.0 - 90.0 - 180.0 - -90.0 - 109164 - 54582 - 8 - top - - 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]] - 256 - 256 - 1 - 10 - \ No newline at end of file diff --git a/data/scene/moon/map_service_configs/Utah/Wac.wms b/data/scene/moon/map_service_configs/Utah/Wac.wms index 141b412fe0..1085bbda66 100644 --- a/data/scene/moon/map_service_configs/Utah/Wac.wms +++ b/data/scene/moon/map_service_configs/Utah/Wac.wms @@ -1,6 +1,6 @@ - http://moontrek.jpl.nasa.gov/trektiles/Moon/EQ/LRO_WAC_Mosaic_Global_303ppd_v02/1.0.0/default/default028mm/${z}/${y}/${x}.jpg + http://asgard.sci.utah.edu/Moon/Wac/tile/${z}/${y}/${x} -180.0 diff --git a/data/scene/moon/moon.mod b/data/scene/moon/moon.mod index 0cb2ec7748..50af1eccbf 100644 --- a/data/scene/moon/moon.mod +++ b/data/scene/moon/moon.mod @@ -24,9 +24,8 @@ return { ColorLayers = { -- MoonTrek based servers { - Name = "WAC [MoonTrek]", - FilePath = "map_service_configs/MoonTrek/LRO WAC.wms", - Enabled = true + Name = "Apollo 16 Metric Cam Image Mosaic", + FilePath = "map_service_configs/MoonTrek/Apollo16_Metric_Cam_Image_Mosaic.wms" }, -- Utah based servers { @@ -38,9 +37,9 @@ return { FilePath = "map_service_configs/Utah/Kaguya.wms" }, { - Name = "WAC [Utah]", - FilePath = "map_service_configs/Utah/Wac.wms" - -- Enabled = true, + Name = "WAC Utah", + FilePath = "map_service_configs/Utah/Wac.wms", + Enabled = true } }, HeightLayers = { diff --git a/data/scene/osirisrex.scene b/data/scene/osirisrex.scene index 684823781b..946582269a 100644 --- a/data/scene/osirisrex.scene +++ b/data/scene/osirisrex.scene @@ -121,7 +121,7 @@ return { "sun", "mercury", "venus", - "lodglobes/earth", + "earth", "moon", "mars", "jupiter", diff --git a/data/scene/sun/sun.mod b/data/scene/sun/sun.mod index adbd19bda4..c59a37ecd9 100644 --- a/data/scene/sun/sun.mod +++ b/data/scene/sun/sun.mod @@ -69,6 +69,7 @@ return { Name = "SunMarker", Parent = "Sun", Renderable = { + Enabled = false, Type = "RenderablePlane", Size = 3.0E11, Origin = "Center", diff --git a/data/web/log/script.js b/data/web/log/script.js index ac198a1189..fefe69a3c0 100644 --- a/data/web/log/script.js +++ b/data/web/log/script.js @@ -9,7 +9,7 @@ function remove(node) { node.parentNode.removeChild(node); } -function scrollTo(selector) { +function scrollToPosition(selector) { var element = document.querySelector(selector); if (element && element.scrollIntoView) { element.scrollIntoView(); @@ -34,7 +34,7 @@ function pluralize(nItems, singular, plural) { } function scrollLink(content, selector) { - var html = '' + content + ""; + var html = '' + content + ""; return html; } diff --git a/data/web/log/style.css b/data/web/log/style.css index 80a17198ed..5b14dc72ad 100644 --- a/data/web/log/style.css +++ b/data/web/log/style.css @@ -87,6 +87,7 @@ thead th:first-child { .summary { padding: 5px; + cursor: pointer; } .summary-warning { background-color: #fef8c3; diff --git a/data/web/scenelicense/main.hbs b/data/web/scenelicense/main.hbs new file mode 100644 index 0000000000..786b51a823 --- /dev/null +++ b/data/web/scenelicense/main.hbs @@ -0,0 +1,9 @@ +
+
+

OpenSpace Scene License Information

+

Version: {{version.[0]}}.{{version.[1]}}.{{version.[2]}}

+ {{#each sceneLicenses}} + {{> scenelicense}} + {{/each}} +
+
\ No newline at end of file diff --git a/data/web/scenelicense/scenelicense.hbs b/data/web/scenelicense/scenelicense.hbs new file mode 100644 index 0000000000..2bd8e98d20 --- /dev/null +++ b/data/web/scenelicense/scenelicense.hbs @@ -0,0 +1,16 @@ +
+
+
+

+ + {{module}} + +

{{name}}

+
+

{{attribution}}

+

{{url}}

+

{{licenseText}}

+

+
+
+
diff --git a/data/web/scenelicense/script.js b/data/web/scenelicense/script.js new file mode 100644 index 0000000000..e0594d2829 --- /dev/null +++ b/data/web/scenelicense/script.js @@ -0,0 +1,28 @@ +window.onload = function () { + var mainTemplateElement = document.getElementById('mainTemplate'); + var mainTemplate = Handlebars.compile(mainTemplateElement.innerHTML); + + var sceneLicenseTemplate = document.getElementById('sceneLicenseTemplate'); + Handlebars.registerPartial('scenelicense', sceneLicenseTemplate.innerHTML); + + Handlebars.registerHelper('urlify', function(options, context) { + var data = context.data; + var identifier = options.replace(" ", "-").toLowerCase(); + + while (data = data._parent) { + if (data.key !== undefined) { + identifier = data.key + "-" + identifier; + } + } + + return identifier; + }); + + var data = { + sceneLicenses: sceneLicenses, + version: version + } + + var contents = mainTemplate(data); + document.body.innerHTML = contents; +} \ No newline at end of file diff --git a/include/openspace/engine/configurationmanager.h b/include/openspace/engine/configurationmanager.h index 28a5ecaab7..0f0004a6da 100644 --- a/include/openspace/engine/configurationmanager.h +++ b/include/openspace/engine/configurationmanager.h @@ -69,6 +69,8 @@ public: static const std::string KeyFactoryDocumentation; /// The key that stores the location of the asset file that is initially loaded static const std::string KeyConfigAsset; + /// The key that stores the scene license documentation values + static const std::string KeySceneLicenseDocumentation; /// The key that stores the location of the scene file that is initially loaded static const std::string KeyConfigTasksRoot; /// The key that stores the subdirectory containing a list of all startup scripts to diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index fcb32ea0a4..ebf0f3b3ea 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -81,9 +81,6 @@ public: static OpenSpaceEngine& ref(); static bool isCreated(); - double runTime(); - void setRunTime(double t); - // callbacks void initialize(); void initializeGL(); @@ -106,6 +103,7 @@ public: void enableBarrier(); void disableBarrier(); + void writeDocumentation(); void toggleShutdownMode(); @@ -239,8 +237,6 @@ private: std::vector> mouseScrollWheel; } _moduleCallbacks; - double _runTime; - // Structure that is responsible for the delayed shutdown of the application struct { // Whether the application is currently in shutdown mode (i.e. counting down the diff --git a/include/openspace/engine/wrapper/sgctwindowwrapper.h b/include/openspace/engine/wrapper/sgctwindowwrapper.h index 7dc3db262b..d106ce400d 100644 --- a/include/openspace/engine/wrapper/sgctwindowwrapper.h +++ b/include/openspace/engine/wrapper/sgctwindowwrapper.h @@ -49,6 +49,7 @@ public: double averageDeltaTime() const override; double deltaTime() const override; + double applicationTime() const override; glm::vec2 mousePosition() const override; uint32_t mouseButtons(int maxNumber) const override; glm::ivec2 currentWindowSize() const override; diff --git a/include/openspace/engine/wrapper/windowwrapper.h b/include/openspace/engine/wrapper/windowwrapper.h index 252eb4258a..23713c50de 100644 --- a/include/openspace/engine/wrapper/windowwrapper.h +++ b/include/openspace/engine/wrapper/windowwrapper.h @@ -106,6 +106,13 @@ public: */ virtual double deltaTime() const; + /** + * Returns the time that has passed (in seconds) since application start + * \return The time that has passed (in seconds) since application start + * @return [description] + */ + virtual double applicationTime() const; + /** * Returns the location of the mouse cursor in pixel screen coordinates. On default, * this method returns 0,0. diff --git a/include/openspace/interaction/luaconsole.h b/include/openspace/interaction/luaconsole.h index bbc32acc14..ea9b5c87ca 100644 --- a/include/openspace/interaction/luaconsole.h +++ b/include/openspace/interaction/luaconsole.h @@ -55,6 +55,7 @@ public: private: void parallelConnectionChanged(const ParallelConnection::Status& status); + void addToCommand(std::string c); std::string sanitizeInput(std::string str); @@ -68,7 +69,6 @@ private: properties::Vec4Property _historyTextColor; properties::IntProperty _historyLength; - size_t _inputPosition; std::vector _commandsHistory; size_t _activeCommand; diff --git a/include/openspace/performance/performancemanager.h b/include/openspace/performance/performancemanager.h index 30094f1075..6b12dfa914 100644 --- a/include/openspace/performance/performancemanager.h +++ b/include/openspace/performance/performancemanager.h @@ -44,7 +44,9 @@ public: static void createGlobalSharedMemory(); static void destroyGlobalSharedMemory(); - PerformanceManager(); + PerformanceManager(std::string loggingDirectory = "${BASE_PATH}", + std::string prefix = "PM-"); + ~PerformanceManager(); void resetPerformanceMeasurements(); diff --git a/include/openspace/properties/propertyowner.h b/include/openspace/properties/propertyowner.h index d74fe18199..061a77d8fe 100644 --- a/include/openspace/properties/propertyowner.h +++ b/include/openspace/properties/propertyowner.h @@ -224,12 +224,20 @@ public: std::vector tags() const; /** - * Adds a tag to the Property's list of assigned tags. Tags are useful for creating - * groups of Properties that can be used in batch operations. + * Adds a tag to the PropertyOwner's list of assigned tags. Tags are useful for + * creating oups of Properties that can be used in batch operations or to mark up + * PropertyOwners for other usages (such signalling to GUI applications). * \param tag The string that is to be assigned to the Property */ void addTag(std::string tag); + /** + * Removes a tag from this PropertyOwner. No error is reported if the tag does not + * exist + * @param tag The tag is that is to be removed from this PropertyOwner + */ + void removeTag(const std::string& tag); + private: /// The name of this PropertyOwner std::string _name; diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index f298be337f..0f0ee7dd19 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -65,7 +65,8 @@ public: enum class FrametimeType { DtTimeAvg = 0, FPS, - FPSAvg + FPSAvg, + None }; RenderEngine(); @@ -108,8 +109,8 @@ public: void registerScreenSpaceRenderable(std::shared_ptr s); void unregisterScreenSpaceRenderable(std::shared_ptr s); - void unregisterScreenSpaceRenderable(std::string name); - std::shared_ptr screenSpaceRenderable(std::string name); + void unregisterScreenSpaceRenderable(const std::string& name); + std::shared_ptr screenSpaceRenderable(const std::string& name); std::vector screenSpaceRenderables() const; std::unique_ptr buildRenderProgram( @@ -168,8 +169,6 @@ public: // Temporary fade functionality void startFading(int direction, float fadeDuration); - void sortScreenspaceRenderables(); - glm::ivec2 renderingResolution() const; glm::ivec2 fontResolution() const; @@ -177,7 +176,7 @@ public: private: void setRenderer(std::unique_ptr renderer); - RendererImplementation rendererFromString(const std::string& method); + RendererImplementation rendererFromString(const std::string& method) const; void renderInformation(); @@ -185,7 +184,7 @@ private: Scene* _scene; std::unique_ptr _raycasterManager; - properties::BoolProperty _performanceMeasurements; + properties::BoolProperty _doPerformanceMeasurements; std::unique_ptr _performanceManager; std::unique_ptr _renderer; diff --git a/include/openspace/scene/scale.h b/include/openspace/scene/scale.h index 2c1876148e..a9f8cbd856 100644 --- a/include/openspace/scene/scale.h +++ b/include/openspace/scene/scale.h @@ -47,10 +47,13 @@ public: virtual ~Scale() = default; virtual bool initialize(); - virtual double scaleValue() const = 0; + virtual double scaleValue() const; virtual void update(const UpdateData& data); static documentation::Documentation Documentation(); + +protected: + double _scale; }; } // namespace openspace diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index 25b4daf0b1..a2d98597e7 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -32,10 +32,12 @@ #include #include +#include +#include +#include +#include #include #include -#include -#include #include @@ -43,8 +45,6 @@ namespace ghoul { class Dictionary; } namespace openspace { -class SceneGraphNode; - namespace documentation { struct Documentation; } // Notifications: @@ -129,6 +129,8 @@ public: */ void unregisterNode(SceneGraphNode* node); + void addSceneLicense(SceneLicense license); + /** * Mark the node registry as dirty */ @@ -139,6 +141,14 @@ public: */ const std::vector& allSceneGraphNodes() const; + /** + * Write information about the license information for the scenegraph nodes that are + * contained in this scene + * \param path The file path that will contain the documentation about the licenses + * used in this scene + */ + void writeSceneLicenseDocumentation(const std::string& path) const; + /** * Return a a map from name to scene graph node. */ @@ -178,6 +188,8 @@ private: bool _dirtyNodeRegistry; SceneGraphNode _rootDummy; + std::vector _licenses; + std::mutex _programUpdateLock; std::set _programsToUpdate; std::vector> _programs; diff --git a/include/openspace/scene/scenelicense.h b/include/openspace/scene/scenelicense.h new file mode 100644 index 0000000000..fab818aad4 --- /dev/null +++ b/include/openspace/scene/scenelicense.h @@ -0,0 +1,58 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2017 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#ifndef __OPENSPACE_CORE___SCENELICENSE___H__ +#define __OPENSPACE_CORE___SCENELICENSE___H__ + +#include + +#include +#include + +namespace ghoul { + class Dictionary; +} // namespace ghoul + +namespace openspace { + +struct SceneLicense { + // module must not be empty + SceneLicense(const ghoul::Dictionary& dictionary, std::string module); + + std::string module; + + std::string name; + std::string attribution; + std::string url; + std::string licenseText; + + static documentation::Documentation Documentation(); +}; + +void writeSceneLicenseDocumentation(const std::vector& licenses, + const std::string& file, const std::string& type); + +} // namespace openspace + +#endif // __OPENSPACE_CORE___SCENELICENSE___H__ diff --git a/modules/base/shaders/path_fs.glsl b/include/openspace/scene/scenelicensewriter.h similarity index 76% rename from modules/base/shaders/path_fs.glsl rename to include/openspace/scene/scenelicensewriter.h index 5abb243452..0bd591d139 100644 --- a/modules/base/shaders/path_fs.glsl +++ b/include/openspace/scene/scenelicensewriter.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014 - 2017 * + * Copyright (c) 2014-2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -21,20 +21,28 @@ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ + +#ifndef __OPENSPACE_CORE___SCENELICENSEWRITER___H__ +#define __OPENSPACE_CORE___SCENELICENSEWRITER___H__ -#include "PowerScaling/powerScaling_fs.hglsl" -#include "fragment.glsl" +#include -in vec4 vs_positionScreenSpace; -in vec4 vs_pointColor; +#include +#include -Fragment getFragment() { - if (vs_pointColor.a < 0.01) { - discard; - } - Fragment frag; - frag.color = vs_pointColor; - frag.depth = vs_positionScreenSpace.w; - return frag; -} +namespace openspace { + +class SceneLicenseWriter : public DocumentationGenerator { +public: + SceneLicenseWriter(const std::vector& licenses); + +private: + std::string generateJson() const override; + + const std::vector& _licenses; +}; + +} // namespace openspace + +#endif // __OPENSPACE_CORE___SCENELICENSEWRITER___H__ diff --git a/include/openspace/scene/sceneloader.h b/include/openspace/scene/sceneloader.h index 4fcd7010ed..8e7413f09a 100644 --- a/include/openspace/scene/sceneloader.h +++ b/include/openspace/scene/sceneloader.h @@ -27,6 +27,8 @@ #include #include +#include + #include #include @@ -34,6 +36,7 @@ #include #include +#include namespace openspace { @@ -62,11 +65,6 @@ private: std::unique_ptr camera; }; - /** - * Load a directory. - */ - void loadDirectory(const std::string& path); - /** * Load a camera from a dictionary */ diff --git a/include/openspace/scene/translation.h b/include/openspace/scene/translation.h index 21ce0515b4..bcd7597c68 100644 --- a/include/openspace/scene/translation.h +++ b/include/openspace/scene/translation.h @@ -48,7 +48,7 @@ public: virtual ~Translation() = default; virtual bool initialize(); - virtual glm::dvec3 position() const = 0; + virtual glm::dvec3 position() const; virtual void update(const UpdateData& data); glm::dvec3 position(double time); @@ -63,6 +63,8 @@ protected: void notifyObservers(); std::function _onParameterChangeCallback; + + glm::dvec3 _positionValue; }; } // namespace openspace diff --git a/include/openspace/util/transformationmanager.h b/include/openspace/util/transformationmanager.h index 7d90a4dfbc..054933a67d 100644 --- a/include/openspace/util/transformationmanager.h +++ b/include/openspace/util/transformationmanager.h @@ -59,10 +59,10 @@ public: TransformationManager(); ~TransformationManager(); - glm::dmat3 frameTransformationMatrix(std::string from, std::string to, double ephemerisTime) const; + glm::dmat3 frameTransformationMatrix(const std::string& from, const std::string& to, double ephemerisTime) const; private: - glm::dmat3 kameleonTransformationMatrix(std::string from, std::string to, double ephemerisTime) const; + glm::dmat3 kameleonTransformationMatrix(const std::string& from, const std::string& to, double ephemerisTime) const; #ifdef OPENSPACE_MODULE_KAMELEON_ENABLED std::shared_ptr _kameleon; diff --git a/modules/base/CMakeLists.txt b/modules/base/CMakeLists.txt index 6f85ec7df9..5ac1aa21a3 100644 --- a/modules/base/CMakeLists.txt +++ b/modules/base/CMakeLists.txt @@ -37,8 +37,11 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.h ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.h ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.h + ${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.h ${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.h + ${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.h ${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.h + ${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.h ${CMAKE_CURRENT_SOURCE_DIR}/scale/staticscale.h ) source_group("Header Files" FILES ${HEADER_FILES}) @@ -56,8 +59,11 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimagelocal.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.cpp ${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.cpp ${CMAKE_CURRENT_SOURCE_DIR}/scale/staticscale.cpp ) source_group("Source Files" FILES ${SOURCE_FILES}) @@ -67,13 +73,8 @@ set(SHADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/shaders/imageplane_vs.glsl ${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_fs.glsl ${CMAKE_CURRENT_SOURCE_DIR}/shaders/model_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/path_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/path_gs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/path_vs.glsl ${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_fs.glsl ${CMAKE_CURRENT_SOURCE_DIR}/shaders/plane_vs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/pscstandard_fs.glsl - ${CMAKE_CURRENT_SOURCE_DIR}/shaders/pscstandard_vs.glsl ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderabletrail_fs.glsl ${CMAKE_CURRENT_SOURCE_DIR}/shaders/renderabletrail_vs.glsl ${CMAKE_CURRENT_SOURCE_DIR}/shaders/screenspace_fs.glsl diff --git a/modules/base/basemodule.cpp b/modules/base/basemodule.cpp index 86e9e000b2..c7165bbd5b 100644 --- a/modules/base/basemodule.cpp +++ b/modules/base/basemodule.cpp @@ -43,10 +43,13 @@ #include #include +#include #include +#include #include +#include #include #include @@ -85,16 +88,19 @@ void BaseModule::internalInitialize() { auto fTranslation = FactoryManager::ref().factory(); ghoul_assert(fTranslation, "Ephemeris factory was not created"); + fTranslation->registerClass("LuaTranslation"); fTranslation->registerClass("StaticTranslation"); auto fRotation = FactoryManager::ref().factory(); ghoul_assert(fRotation, "Rotation factory was not created"); + fRotation->registerClass("LuaRotation"); fRotation->registerClass("StaticRotation"); auto fScale = FactoryManager::ref().factory(); ghoul_assert(fScale, "Scale factory was not created"); + fScale->registerClass("LuaScale"); fScale->registerClass("StaticScale"); auto fModelGeometry = FactoryManager::ref().factory(); @@ -112,8 +118,11 @@ std::vector BaseModule::documentations() const { ScreenSpaceFramebuffer::Documentation(), ScreenSpaceImageLocal::Documentation(), ScreenSpaceImageOnline::Documentation(), + LuaRotation::Documentation(), StaticRotation::Documentation(), + LuaScale::Documentation(), StaticScale::Documentation(), + LuaTranslation::Documentation(), StaticTranslation::Documentation(), modelgeometry::ModelGeometry::Documentation(), }; diff --git a/modules/base/rendering/screenspaceimagelocal.cpp b/modules/base/rendering/screenspaceimagelocal.cpp index bb22e5bb36..7527cbae99 100644 --- a/modules/base/rendering/screenspaceimagelocal.cpp +++ b/modules/base/rendering/screenspaceimagelocal.cpp @@ -38,7 +38,6 @@ namespace { const char* KeyName = "Name"; - const char* KeyUrl = "URL"; static const openspace::properties::Property::PropertyInfo TexturePathInfo = { "TexturePath", diff --git a/modules/base/rotation/luarotation.cpp b/modules/base/rotation/luarotation.cpp new file mode 100644 index 0000000000..5192a85b9e --- /dev/null +++ b/modules/base/rotation/luarotation.cpp @@ -0,0 +1,133 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2017 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +namespace { + static const openspace::properties::Property::PropertyInfo ScriptInfo = { + "Script", + "Script", + "This value is the path to the Lua script that will be executed to compute the " + "rotation for this transformation. The script needs to define a function " + "'rotation' that takes the current simulation time in seconds past the J2000 " + "epoch as the first argument, the current wall time as milliseconds past the " + "J2000 epoch as the second argument and computes the rotation returned as 9 " + "values." + };} // namespace + +namespace openspace { + +documentation::Documentation LuaRotation::Documentation() { + using namespace openspace::documentation; + return { + "Lua Rotation", + "base_transform_rotation_lua", + { + { + "Type", + new StringEqualVerifier("LuaRotation"), + Optional::No + }, + { + ScriptInfo.identifier, + new StringVerifier, + Optional::No, + ScriptInfo.description + } + } + }; +} + +LuaRotation::LuaRotation() + : _luaScriptFile(ScriptInfo) + , _state(false) +{ + addProperty(_luaScriptFile); +} + +LuaRotation::LuaRotation(const ghoul::Dictionary& dictionary) + : LuaRotation() +{ + documentation::testSpecificationAndThrow( + Documentation(), + dictionary, + "LuaRotation" + ); + + _luaScriptFile = absPath(dictionary.value(ScriptInfo.identifier)); +} + +void LuaRotation::update(const UpdateData& data) { + ghoul::lua::runScriptFile(_state, _luaScriptFile); + + // Get the scaling function + lua_getglobal(_state, "rotation"); + bool isFunction = lua_isfunction(_state, -1); + if (!isFunction) { + LERRORC( + "LuaRotation", + "Script '" << _luaScriptFile << "' does not have a function 'rotation'" + ); + return; + } + + // First argument is the number of seconds past the J2000 epoch in ingame time + lua_pushnumber(_state, data.time.j2000Seconds()); + + // Second argument is the number of milliseconds past the J2000 epoch in wallclock + using namespace std::chrono; + auto now = high_resolution_clock::now(); + lua_pushnumber( + _state, + duration_cast(now.time_since_epoch()).count() + ); + + // Execute the scaling function + int success = lua_pcall(_state, 2, 9, 0); + if (success != 0) { + LERRORC( + "LuaScale", + "Error executing 'rotation': " << lua_tostring(_state, -1) + ); + } + + double values[9]; + for (int i = 0; i < 9; ++i) { + values[i] = luaL_checknumber(_state, -1 - i); + } + + _matrix = glm::make_mat3(values); +} + +} // namespace openspace diff --git a/modules/base/shaders/pscstandard_vs.glsl b/modules/base/rotation/luarotation.h similarity index 71% rename from modules/base/shaders/pscstandard_vs.glsl rename to modules/base/rotation/luarotation.h index 2f74b5193f..0c6a2d444f 100644 --- a/modules/base/shaders/pscstandard_vs.glsl +++ b/modules/base/rotation/luarotation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014 - 2017 * + * Copyright (c) 2014-2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,32 +22,33 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#version __CONTEXT__ +#ifndef __OPENSPACE_MODULE_BASE___LUAROTATION___H__ +#define __OPENSPACE_MODULE_BASE___LUAROTATION___H__ -#include "PowerScaling/powerScaling_vs.hglsl" +#include -layout(location = 0) in vec4 in_position; -layout(location = 1) in vec2 in_st; -layout(location = 2) in vec3 in_normal; +#include -out vec2 vs_st; -out vec4 vs_normal; -out vec4 vs_position; +#include -uniform mat4 ViewProjection; -uniform mat4 ModelTransform; - - -void main() { - vs_st = in_st; - vs_position = in_position; - vec4 tmp = in_position; - - // this is wrong for the normal. The normal transform is the transposed inverse of the model transform - vs_normal = normalize(ModelTransform * vec4(in_normal,0)); +namespace openspace { - vec4 position = pscTransform(tmp, ModelTransform); - vs_position = tmp; - position = ViewProjection * position; - gl_Position = z_normalization(position); -} +namespace documentation { struct Documentation; } + +class LuaRotation : public Rotation { +public: + LuaRotation(); + LuaRotation(const ghoul::Dictionary& dictionary); + + void update(const UpdateData& data) override; + + static documentation::Documentation Documentation(); + +private: + properties::StringProperty _luaScriptFile; + ghoul::lua::LuaState _state; +}; + +} // namespace openspace + +#endif // __OPENSPACE_MODULE_BASE___LUAROTATION___H__ diff --git a/modules/base/scale/luascale.cpp b/modules/base/scale/luascale.cpp new file mode 100644 index 0000000000..30636c4be4 --- /dev/null +++ b/modules/base/scale/luascale.cpp @@ -0,0 +1,119 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2017 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +namespace { + static const openspace::properties::Property::PropertyInfo ScriptInfo = { + "Script", + "Script", + "This value is the path to the Lua script that will be executed to compute the " + "scaling factor for this transformation. The script needs to define a function " + "'scale' that takes the current simulation time in seconds past the J2000 epoch " + "as the first argument, the current wall time as milliseconds past the J2000 " + "epoch the second argument and computes the scaling factor." + }; +} // namespace + +namespace openspace { + +documentation::Documentation LuaScale::Documentation() { + using namespace openspace::documentation; + return { + "Lua Scaling", + "base_scale_lua", + { + { + ScriptInfo.identifier, + new StringVerifier, + Optional::No, + ScriptInfo.description + } + } + }; +} + +LuaScale::LuaScale() + : _luaScriptFile(ScriptInfo) + , _state(false) +{ + addProperty(_luaScriptFile); +} + +LuaScale::LuaScale(const ghoul::Dictionary& dictionary) + : LuaScale() +{ + documentation::testSpecificationAndThrow(Documentation(), dictionary, "LuaScale"); + + _luaScriptFile = absPath(dictionary.value(ScriptInfo.identifier)); +} + +void LuaScale::update(const UpdateData& data) { + ghoul::lua::runScriptFile(_state, _luaScriptFile); + + // Get the scaling function + lua_getglobal(_state, "scale"); + bool isFunction = lua_isfunction(_state, -1); + if (!isFunction) { + LERRORC( + "LuaScale", + "Script '" << _luaScriptFile << "' does not have a function 'scale'" + ); + return; + } + + // First argument is the number of seconds past the J2000 epoch in ingame time + lua_pushnumber(_state, data.time.j2000Seconds()); + + // Second argument is the number of milliseconds past the J2000 epoch in wallclock + using namespace std::chrono; + auto now = high_resolution_clock::now(); + lua_pushnumber( + _state, + duration_cast(now.time_since_epoch()).count() + ); + + // Execute the scaling function + int success = lua_pcall(_state, 2, 1, 0); + if (success != 0) { + LERRORC( + "LuaScale", + "Error executing 'scale': " << lua_tostring(_state, -1) + ); + } + + _scale = luaL_checknumber(_state, -1); +} + +} // namespace openspace diff --git a/modules/base/shaders/path_gs.glsl b/modules/base/scale/luascale.h similarity index 67% rename from modules/base/shaders/path_gs.glsl rename to modules/base/scale/luascale.h index 4c8785014b..2a96aca443 100644 --- a/modules/base/shaders/path_gs.glsl +++ b/modules/base/scale/luascale.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014 - 2017 * + * Copyright (c) 2014-2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,43 +22,33 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#version __CONTEXT__ +#ifndef __OPENSPACE_MODULE_BASE___LUASCALE___H__ +#define __OPENSPACE_MODULE_BASE___LUASCALE___H__ -#include "PowerScaling/powerScalingMath.hglsl" -#include <${SHADERS_GENERATED}/constants.hglsl>:notrack +#include -layout(points) in; -layout(location = 0) in vec4 vs_point_position[]; -layout(location = 1) in flat int isHour[]; -layout(location = 2) in vec4 vs_point_color[]; +#include -layout(points, max_vertices = 4) out; -layout(location = 0) out vec4 gs_point_position; -layout(location = 1) out vec4 gs_point_color; +#include -uniform mat4 projection; -uniform mat4 ViewProjection; +namespace openspace { + +namespace documentation { struct Documentation; } + +class LuaScale : public Scale { +public: + LuaScale(); + LuaScale(const ghoul::Dictionary& dictionary); -const vec2 corners[4] = vec2[4]( - vec2(0.0, 1.0), - vec2(0.0, 0.0), - vec2(1.0, 1.0), - vec2(1.0, 0.0) -); + void update(const UpdateData& data) override; + static documentation::Documentation Documentation(); -void main() { - gs_point_color = vs_point_color[0]; - gs_point_position = vs_point_position[0]; - if (isHour[0] == 1) { - gl_Position = gl_in[0].gl_Position; - EmitVertex(); - EndPrimitive(); - } - else { - gl_Position = gl_in[0].gl_Position; - EmitVertex(); - EndPrimitive(); - return; - } -} +private: + properties::StringProperty _luaScriptFile; + ghoul::lua::LuaState _state; +}; + +} // namespace openspace + +#endif // __OPENSPACE_MODULE_BASE___LUASCALE___H__ diff --git a/modules/base/scale/staticscale.cpp b/modules/base/scale/staticscale.cpp index 8a9f895856..3659e6b7ce 100644 --- a/modules/base/scale/staticscale.cpp +++ b/modules/base/scale/staticscale.cpp @@ -58,6 +58,8 @@ StaticScale::StaticScale() : _scaleValue(ScaleInfo, 1.0, 1.0, 1e6) { addProperty(_scaleValue); + + _scaleValue.onChange([&](){ _scale = _scaleValue; }); } StaticScale::StaticScale(const ghoul::Dictionary& dictionary) @@ -68,8 +70,4 @@ StaticScale::StaticScale(const ghoul::Dictionary& dictionary) _scaleValue = static_cast(dictionary.value(ScaleInfo.identifier)); } -double StaticScale::scaleValue() const { - return _scaleValue; -} - } // namespace openspace diff --git a/modules/base/scale/staticscale.h b/modules/base/scale/staticscale.h index aff8812ee7..11aa0c5ad1 100644 --- a/modules/base/scale/staticscale.h +++ b/modules/base/scale/staticscale.h @@ -38,8 +38,6 @@ public: StaticScale(); StaticScale(const ghoul::Dictionary& dictionary); - double scaleValue() const override; - static documentation::Documentation Documentation(); private: diff --git a/modules/base/shaders/imageplane_fs.glsl b/modules/base/shaders/imageplane_fs.glsl index ff334f0a1d..30e028d884 100644 --- a/modules/base/shaders/imageplane_fs.glsl +++ b/modules/base/shaders/imageplane_fs.glsl @@ -29,7 +29,6 @@ in float vs_screenSpaceDepth; uniform sampler2D texture1; - Fragment getFragment() { Fragment frag; diff --git a/modules/base/translation/luatranslation.cpp b/modules/base/translation/luatranslation.cpp new file mode 100644 index 0000000000..85b20c52ef --- /dev/null +++ b/modules/base/translation/luatranslation.cpp @@ -0,0 +1,141 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2017 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +namespace { + static const openspace::properties::Property::PropertyInfo ScriptInfo = { + "Script", + "Script", + "This value is the path to the Lua script that will be executed to compute the " + "translation for this transformation. The script needs to define a function " + "'translate' that takes the current simulation time in seconds past the J2000 " + "epoch as the first argument, the current wall time as milliseconds past the " + "J2000 epoch as the second argument and computes the translation." + }; +} // namespace + +namespace openspace { + +documentation::Documentation LuaTranslation::Documentation() { + using namespace documentation; + return { + "Lua Translation", + "base_transform_translation_lua", + { + { + "Type", + new StringEqualVerifier("LuaTranslation"), + Optional::No + }, + { + ScriptInfo.identifier, + new StringVerifier, + Optional::No, + ScriptInfo.description + } + } + }; +} + + +LuaTranslation::LuaTranslation() + : _luaScriptFile(ScriptInfo) + , _state(false) +{ + addProperty(_luaScriptFile); + + _luaScriptFile.onChange([&](){ + _fileHandle = std::make_unique(_luaScriptFile); + _fileHandle->setCallback([&](const ghoul::filesystem::File&){ + notifyObservers(); + }); + }); +} + +LuaTranslation::LuaTranslation(const ghoul::Dictionary& dictionary) + : LuaTranslation() +{ + documentation::testSpecificationAndThrow( + Documentation(), + dictionary, + "StaticTranslation" + ); + + _luaScriptFile = absPath(dictionary.value(ScriptInfo.identifier)); +} + +void LuaTranslation::update(const UpdateData& data) { + ghoul::lua::runScriptFile(_state, _luaScriptFile); + + // Get the scaling function + lua_getglobal(_state, "translation"); + bool isFunction = lua_isfunction(_state, -1); + if (!isFunction) { + LERRORC( + "LuaScale", + "Script '" << _luaScriptFile << "' does not have a function 'translation'" + ); + return; + } + + // First argument is the number of seconds past the J2000 epoch in ingame time + lua_pushnumber(_state, data.time.j2000Seconds()); + + // Second argument is the number of milliseconds past the J2000 epoch in wallclock + using namespace std::chrono; + auto now = high_resolution_clock::now(); + lua_pushnumber( + _state, + duration_cast(now.time_since_epoch()).count() + ); + + // Execute the scaling function + int success = lua_pcall(_state, 2, 3, 0); + if (success != 0) { + LERRORC( + "LuaScale", + "Error executing 'translation': " << lua_tostring(_state, -1) + ); + } + + double values[3]; + for (int i = 0; i < 3; ++i) { + values[i] = luaL_checknumber(_state, -1 - i); + } + + _positionValue = glm::make_vec3(values); +} + +} // namespace openspace diff --git a/modules/base/shaders/path_vs.glsl b/modules/base/translation/luatranslation.h similarity index 63% rename from modules/base/shaders/path_vs.glsl rename to modules/base/translation/luatranslation.h index 6b9af3658a..2ee4302d75 100644 --- a/modules/base/shaders/path_vs.glsl +++ b/modules/base/translation/luatranslation.h @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014 - 2017 * + * Copyright (c) 2014-2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,42 +22,38 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#version __CONTEXT__ +#ifndef __OPENSPACE_MODULE_BASE___LUATRANSLATION___H__ +#define __OPENSPACE_MODULE_BASE___LUATRANSLATION___H__ -#include "PowerScaling/powerScaling_vs.hglsl" +#include -in vec4 in_point_position; +#include -out vec4 vs_positionScreenSpace; -out vec4 vs_pointColor; +#include +#include -uniform vec3 color; -uniform mat4 modelViewTransform; -uniform mat4 projectionTransform; -uniform int pointSteps; +#include +namespace openspace { -void main() { - vec4 positionCameraSpace = modelViewTransform * in_point_position; - vec4 positionClipSpace = projectionTransform * positionCameraSpace; - vs_positionScreenSpace = z_normalization(positionClipSpace); +namespace documentation { struct Documentation; } + +class LuaTranslation : public Translation { +public: + LuaTranslation(); + LuaTranslation(const ghoul::Dictionary& dictionary); - gl_Position = vs_positionScreenSpace; + virtual void update(const UpdateData& data) override; - if (mod(gl_VertexID, pointSteps) == 0) { - vs_pointColor.rgb = color; - gl_PointSize = 5.0f; - } - else { - vs_pointColor.rgb = (color + vec3(0.6, 0.6, 0.6)) / 2.0; - gl_PointSize = 2.f; - } + static documentation::Documentation Documentation(); - // I don't like this random variable k defined in powerScalingMath.hglsl. - // Will ignore it and use 10 in protest of psc dependencies. /KB - // float maximumDistance = pow(k, 10); - float maximumDistance = pow(10, 10); - float distanceToCamera = length(positionCameraSpace.xyz); +private: + properties::StringProperty _luaScriptFile; + ghoul::lua::LuaState _state; - vs_pointColor.a = maximumDistance / (distanceToCamera / 100.0); -} + std::unique_ptr _fileHandle; +}; + +} // namespace openspace + +#endif // __OPENSPACE_MODULE_BASE___LUATRANSLATION___H__ diff --git a/modules/base/translation/statictranslation.cpp b/modules/base/translation/statictranslation.cpp index be2c3c9520..a201294070 100644 --- a/modules/base/translation/statictranslation.cpp +++ b/modules/base/translation/statictranslation.cpp @@ -69,6 +69,8 @@ StaticTranslation::StaticTranslation() ) { addProperty(_position); + + _position.onChange([&](){ _positionValue = _position; }); } StaticTranslation::StaticTranslation(const ghoul::Dictionary& dictionary) @@ -83,8 +85,4 @@ StaticTranslation::StaticTranslation(const ghoul::Dictionary& dictionary) _position = dictionary.value(PositionInfo.identifier); } -glm::dvec3 StaticTranslation::position() const { - return _position; -} - } // namespace openspace diff --git a/modules/base/translation/statictranslation.h b/modules/base/translation/statictranslation.h index df9d4c4e77..50860dbbc7 100644 --- a/modules/base/translation/statictranslation.h +++ b/modules/base/translation/statictranslation.h @@ -38,8 +38,6 @@ public: StaticTranslation(); StaticTranslation(const ghoul::Dictionary& dictionary); - virtual glm::dvec3 position() const override; - static documentation::Documentation Documentation(); private: diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp index 861ba89103..d9130ae819 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp @@ -654,8 +654,8 @@ void RenderableBillboardsCloud::renderLabels(const RenderData& data, const glm:: scale = 306391534.73091 * PARSEC; break; } - - for (const auto pair : _labelData) { + + for (const std::pair& pair : _labelData) { //glm::vec3 scaledPos(_transformationMatrix * glm::dvec4(pair.first, 1.0)); glm::vec3 scaledPos(pair.first); scaledPos *= scale; @@ -673,8 +673,7 @@ void RenderableBillboardsCloud::renderLabels(const RenderData& data, const glm:: _renderOption.value(), "%s", pair.second.c_str()); - } - + } } void RenderableBillboardsCloud::render(const RenderData& data, RendererTasks&) { diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.cpp b/modules/digitaluniverse/rendering/renderabledumeshes.cpp index 38de01879d..cae2c552b1 100644 --- a/modules/digitaluniverse/rendering/renderabledumeshes.cpp +++ b/modules/digitaluniverse/rendering/renderabledumeshes.cpp @@ -235,15 +235,15 @@ RenderableDUMeshes::RenderableDUMeshes(const ghoul::Dictionary& dictionary) , _alphaValue(TransparencyInfo, 1.f, 0.f, 1.f) , _scaleFactor(ScaleFactorInfo, 1.f, 0.f, 64.f) //, _pointColor(ColorInfo, glm::vec3(1.f, 0.4f, 0.2f), glm::vec3(0.f, 0.f, 0.f), glm::vec3(1.0f, 1.0f, 1.0f)) - , _drawLabels(DrawLabelInfo, false) , _textColor( TextColorInfo, glm::vec4(1.0f, 1.0, 1.0f, 1.f), glm::vec4(0.f), glm::vec4(1.f) ) - , _textSize(TextSizeInfo, 8.0, 0.5, 24.0) + , _textSize(TextSizeInfo, 8.0, 0.5, 24.0) , _drawElements(DrawElementsInfo, true) + , _drawLabels(DrawLabelInfo, false) , _renderOption(RenderOptionInfo, properties::OptionProperty::DisplayType::Dropdown) , _program(nullptr) , _fontRenderer(nullptr) @@ -251,10 +251,8 @@ RenderableDUMeshes::RenderableDUMeshes(const ghoul::Dictionary& dictionary) , _speckFile("") , _labelFile("") , _unit(Parsec) - , _nValuesPerAstronomicalObject(0) + , _nValuesPerAstronomicalObject(0) { - using File = ghoul::filesystem::File; - documentation::testSpecificationAndThrow( Documentation(), dictionary, @@ -382,7 +380,6 @@ void RenderableDUMeshes::initialize() { bool success = loadData(); if (!success) { throw ghoul::RuntimeError("Error loading data"); - return; } createMeshes(); @@ -400,7 +397,7 @@ void RenderableDUMeshes::initialize() { } void RenderableDUMeshes::deinitialize() { - for (auto pair : _renderingMeshesMap) { + for (const std::pair& pair : _renderingMeshesMap) { for (int i = 0; i < pair.second.numU; ++i) { glDeleteVertexArrays(1, &pair.second.vaoArray[i]); glDeleteBuffers(1, &pair.second.vboArray[i]); @@ -414,8 +411,10 @@ void RenderableDUMeshes::deinitialize() { } } -void RenderableDUMeshes::renderMeshes(const RenderData& data, const glm::dmat4& modelViewMatrix, - const glm::dmat4& projectionMatrix) { +void RenderableDUMeshes::renderMeshes(const RenderData&, + const glm::dmat4& modelViewMatrix, + const glm::dmat4& projectionMatrix) +{ // Saving current OpenGL state GLboolean blendEnabled = glIsEnabled(GL_BLEND); GLenum blendEquationRGB; @@ -514,7 +513,7 @@ void RenderableDUMeshes::renderLabels(const RenderData& data, const glm::dmat4& break; } - for (const auto pair : _labelData) { + for (const std::pair& pair : _labelData) { //glm::vec3 scaledPos(_transformationMatrix * glm::dvec4(pair.first, 1.0)); glm::vec3 scaledPos(pair.first); scaledPos *= scale; diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.h b/modules/digitaluniverse/rendering/renderabledumeshes.h index 157e514249..8df9af8f1e 100644 --- a/modules/digitaluniverse/rendering/renderabledumeshes.h +++ b/modules/digitaluniverse/rendering/renderabledumeshes.h @@ -154,7 +154,7 @@ private: glm::dmat4 _transformationMatrix; std::unordered_map _meshColorMap; - std::unordered_map _renderingMeshesMap; + std::unordered_map _renderingMeshesMap; }; diff --git a/modules/digitaluniverse/rendering/renderableplanescloud.cpp b/modules/digitaluniverse/rendering/renderableplanescloud.cpp index 0dc45352dc..f4af818063 100644 --- a/modules/digitaluniverse/rendering/renderableplanescloud.cpp +++ b/modules/digitaluniverse/rendering/renderableplanescloud.cpp @@ -278,8 +278,6 @@ RenderablePlanesCloud::RenderablePlanesCloud(const ghoul::Dictionary& dictionary , _sluminosity(1.f) , _transformationMatrix(glm::dmat4(1.0)) { - using File = ghoul::filesystem::File; - documentation::testSpecificationAndThrow( Documentation(), dictionary, @@ -431,7 +429,6 @@ void RenderablePlanesCloud::initialize() { bool success = loadData(); if (!success) { throw ghoul::RuntimeError("Error loading data"); - return; } createPlanes(); @@ -468,8 +465,10 @@ void RenderablePlanesCloud::deinitialize() { } } -void RenderablePlanesCloud::renderPlanes(const RenderData& data, const glm::dmat4& modelViewMatrix, - const glm::dmat4& projectionMatrix) { +void RenderablePlanesCloud::renderPlanes(const RenderData&, + const glm::dmat4& modelViewMatrix, + const glm::dmat4& projectionMatrix) +{ // Saving current OpenGL state GLboolean blendEnabled = glIsEnabled(GL_BLEND); GLenum blendEquationRGB; @@ -580,7 +579,7 @@ void RenderablePlanesCloud::renderLabels(const RenderData& data, const glm::dmat break; } - for (const auto pair : _labelData) { + for (const std::pair& pair : _labelData) { //glm::vec3 scaledPos(_transformationMatrix * glm::dvec4(pair.first, 1.0)); glm::vec3 scaledPos(pair.first); scaledPos *= scale; diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index 339bee2da6..c4dd1f619d 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -168,6 +168,7 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layeradjustment.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layergroup.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layergroupid.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layermanager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/rendering/layer/layerrendersettings.cpp diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl index e5674a6983..d984c37ab7 100644 --- a/modules/globebrowsing/globebrowsingmodule_lua.inl +++ b/modules/globebrowsing/globebrowsingmodule_lua.inl @@ -221,6 +221,8 @@ int loadWMSCapabilities(lua_State* L) { std::move(globe), std::move(url) ); + + return 0; } int removeWMSServer(lua_State* L) { diff --git a/modules/base/shaders/pscstandard_fs.glsl b/modules/globebrowsing/rendering/layer/layergroupid.cpp similarity index 58% rename from modules/base/shaders/pscstandard_fs.glsl rename to modules/globebrowsing/rendering/layer/layergroupid.cpp index 94f501eb84..7a3d6010a2 100644 --- a/modules/base/shaders/pscstandard_fs.glsl +++ b/modules/globebrowsing/rendering/layer/layergroupid.cpp @@ -2,7 +2,7 @@ * * * OpenSpace * * * - * Copyright (c) 2014 - 2017 * + * Copyright (c) 2014-2017 * * * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * * software and associated documentation files (the "Software"), to deal in the Software * @@ -22,54 +22,48 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "PowerScaling/powerScaling_fs.hglsl" -#include "fragment.glsl" +#include -in vec2 vs_st; -in vec4 vs_normal; -in vec4 vs_position; +namespace openspace::globebrowsing::layergroupid { -uniform vec4 campos; -uniform vec4 objpos; -uniform vec3 sun_pos; -uniform bool _performShading = true; -uniform float transparency; -uniform int shadows; -uniform float time; -uniform sampler2D texture1; - - -Fragment getFragment() { - vec4 position = vs_position; - float depth = pscDepth(position); - vec4 diffuse = texture(texture1, vs_st); - - Fragment frag; - if (_performShading) { - vec3 n = normalize(vs_normal.xyz); - vec3 l_pos = vec3(sun_pos); // sun. - vec3 l_dir = normalize(l_pos - objpos.xyz); - float intensity = min(max(5 * dot(n,l_dir), 0.0), 1); - - // float shine = 0.0001; - - const vec4 specular = vec4(0.5); - vec4 ambient = vec4(0.0, 0.0, 0.0, transparency); - /* - if(intensity > 0.f){ - // halfway vector - vec3 h = normalize(l_dir + e); - // specular factor - float intSpec = max(dot(h,n),0.0); - spec = specular * pow(intSpec, shine); +TypeID getTypeIDFromTypeString(const std::string& typeString) { + for (int i = 0; i < NUM_LAYER_TYPES; ++i) { + if (typeString == LAYER_TYPE_NAMES[i]) { + return static_cast(i); } - */ - diffuse = max(intensity * diffuse, ambient); } - - frag.color.rgb = diffuse.rgb; - frag.color.a = transparency; - frag.depth = depth; - - return frag; + return TypeID::Unknown; } + +layergroupid::GroupID getGroupIDFromName(const std::string& layerGroupName) { + for (int i = 0; i < layergroupid::NUM_LAYER_GROUPS; ++i) { + if (layerGroupName == layergroupid::LAYER_GROUP_NAMES[i]) { + return static_cast(i); + } + } + return GroupID::Unknown; +} + +layergroupid::AdjustmentTypeID getAdjustmentTypeIDFromName( + const std::string& adjustmentTypeName) +{ + for (int i = 0; i < layergroupid::NUM_ADJUSTMENT_TYPES; ++i) { + if (adjustmentTypeName == layergroupid::ADJUSTMENT_TYPE_NAMES[i]) { + return static_cast(i); + } + } + return AdjustmentTypeID::None; +} + +layergroupid::BlendModeID getBlendModeIDFromName( + const std::string& blendModeName) +{ + for (int i = 0; i < layergroupid::NUM_BLEND_MODES; ++i) { + if (blendModeName == layergroupid::BLEND_MODE_NAMES[i]) { + return static_cast(i); + } + } + return BlendModeID::Normal; +} + +} // namespace openspace::globebrowsing::layergroupid diff --git a/modules/globebrowsing/rendering/layer/layergroupid.h b/modules/globebrowsing/rendering/layer/layergroupid.h index 70eced37a8..b5f4c56eea 100644 --- a/modules/globebrowsing/rendering/layer/layergroupid.h +++ b/modules/globebrowsing/rendering/layer/layergroupid.h @@ -110,45 +110,15 @@ enum class BlendModeID { Color = 4, }; -static TypeID getTypeIDFromTypeString(std::string typeString) { - for (int i = 0; i < NUM_LAYER_TYPES; ++i) { - if (typeString == LAYER_TYPE_NAMES[i]) { - return static_cast(i); - } - } - return TypeID::Unknown; -} +TypeID getTypeIDFromTypeString(const std::string& typeString); -static layergroupid::GroupID getGroupIDFromName(std::string layerGroupName) { - for (int i = 0; i < layergroupid::NUM_LAYER_GROUPS; ++i) { - if (layerGroupName == layergroupid::LAYER_GROUP_NAMES[i]) { - return static_cast(i); - } - } - return GroupID::Unknown; -} +layergroupid::GroupID getGroupIDFromName(const std::string& layerGroupName); -static layergroupid::AdjustmentTypeID getAdjustmentTypeIDFromName( - std::string adjustmentTypeName) -{ - for (int i = 0; i < layergroupid::NUM_ADJUSTMENT_TYPES; ++i) { - if (adjustmentTypeName == layergroupid::ADJUSTMENT_TYPE_NAMES[i]) { - return static_cast(i); - } - } - return AdjustmentTypeID::None; -} +layergroupid::AdjustmentTypeID getAdjustmentTypeIDFromName( + const std::string& adjustmentTypeName); -static layergroupid::BlendModeID getBlendModeIDFromName( - std::string blendModeName) -{ - for (int i = 0; i < layergroupid::NUM_BLEND_MODES; ++i) { - if (blendModeName == layergroupid::BLEND_MODE_NAMES[i]) { - return static_cast(i); - } - } - return BlendModeID::Normal; -} +layergroupid::BlendModeID getBlendModeIDFromName( + const std::string& blendModeName); } // namespace openspace::globebrowsing::layergroupid diff --git a/modules/globebrowsing/scripts/layer_support.lua b/modules/globebrowsing/scripts/layer_support.lua index 51b718051b..7bf39408a7 100644 --- a/modules/globebrowsing/scripts/layer_support.lua +++ b/modules/globebrowsing/scripts/layer_support.lua @@ -162,19 +162,25 @@ openspace.globebrowsing.parseInfoFile = function (file) local dir = openspace.directoryForPath(file) dofile(file) - local color = { - Name = Name, - Description = Description or "", - FilePath = dir .. '/' .. ColorFile, - BlendMode = "Color" - } + local color = nil + if ColorFile then + color = { + Name = Name, + Description = Description or "", + FilePath = dir .. '/' .. ColorFile, + BlendMode = "Color" + } + end - local height = { - Name = Name, - Description = Description or "", - FilePath = dir .. '/' .. HeightFile, - TilePixelSize = 90 - } + local height = nil + if HeightFile then + local height = { + Name = Name, + Description = Description or "", + FilePath = dir .. '/' .. HeightFile, + TilePixelSize = 90 + } + end return color, height end @@ -186,8 +192,12 @@ openspace.globebrowsing.addBlendingLayersFromDirectory = function (dir, node_nam if file:find('.info') then c, h = openspace.globebrowsing.parseInfoFile(file) - openspace.globebrowsing.addLayer(node_name, "ColorLayers", c) - openspace.globebrowsing.addLayer(node_name, "HeightLayers", h) + if c then + openspace.globebrowsing.addLayer(node_name, "ColorLayers", c) + end + if h then + openspace.globebrowsing.addLayer(node_name, "HeightLayers", h) + end end end end diff --git a/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h b/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h index 6b18be0a3d..53983cc470 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h +++ b/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.h @@ -41,7 +41,7 @@ namespace openspace::globebrowsing { /** * Function for passing GDAL error messages to the GHOUL logging system. */ -static void gdalErrorHandler(CPLErr eErrClass, int errNo, const char* msg); +void gdalErrorHandler(CPLErr eErrClass, int errNo, const char* msg); /** * Singleton class interfacing with global GDAL functions. diff --git a/modules/imgui/src/gui.cpp b/modules/imgui/src/gui.cpp index 660113928b..fb06d6aae9 100644 --- a/modules/imgui/src/gui.cpp +++ b/modules/imgui/src/gui.cpp @@ -49,7 +49,7 @@ const char* configurationFile = "imgui.ini"; //const char* GuiFont = "${FONTS}/ubuntu/Ubuntu-Regular.ttf"; const char* GuiFont = "${FONTS}/arimo/Arimo-Regular.ttf"; const float FontSize = 14.f; -const ImVec2 size = ImVec2(350, 500); +const ImVec2 size = ImVec2(500, 500); //GLuint fontTex = 0; // A VBO max size of 0 will cause a lazy instantiation of the buffer @@ -385,6 +385,7 @@ void GUI::initialize() { _globalProperty.initialize(); _globalProperty.setHasRegularProperties(true); _featuredProperties.initialize(); + _featuredProperties.setHasRegularProperties(true); _virtualProperty.initialize(); _filePath.initialize(); #ifdef GLOBEBROWSING_USE_GDAL diff --git a/modules/imgui/src/guiglobebrowsingcomponent.cpp b/modules/imgui/src/guiglobebrowsingcomponent.cpp index bef1343640..cee66900d8 100644 --- a/modules/imgui/src/guiglobebrowsingcomponent.cpp +++ b/modules/imgui/src/guiglobebrowsingcomponent.cpp @@ -64,7 +64,6 @@ void GuiGlobeBrowsingComponent::render() { using Layer = GlobeBrowsingModule::Layer; bool e = _isEnabled; - e = e; ImGui::Begin("Globe Browsing", &e, WindowSize, 0.5f); _isEnabled = e; diff --git a/modules/imgui/src/guimissioncomponent.cpp b/modules/imgui/src/guimissioncomponent.cpp index 609b2963cc..2991523553 100644 --- a/modules/imgui/src/guimissioncomponent.cpp +++ b/modules/imgui/src/guimissioncomponent.cpp @@ -47,7 +47,7 @@ namespace { openspace::MissionPhase::Trace t = mission.phaseTrace(currentTime, 0); int treeOption = t.empty() ? 0 : ImGuiTreeNodeFlags_DefaultOpen; - if (ImGui::TreeNodeEx(("%s" + missionHashname).c_str(), treeOption, mission.name().c_str())) { + if (ImGui::TreeNodeEx(("%s" + missionHashname).c_str(), treeOption, "%s", mission.name().c_str())) { if (!mission.description().empty()) { ImGui::Text("%s", mission.description().c_str()); } diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp index 416830d85b..05e4dd7145 100644 --- a/modules/imgui/src/guipropertycomponent.cpp +++ b/modules/imgui/src/guipropertycomponent.cpp @@ -147,8 +147,8 @@ namespace openspace::gui { GuiPropertyComponent::GuiPropertyComponent(std::string name, UseTreeLayout useTree, IsTopLevelWindow topLevel) : GuiComponent(std::move(name)) , _useTreeLayout(useTree) - , _isTopLevel(topLevel) , _currentUseTreeLayout(useTree) + , _isTopLevel(topLevel) {} void GuiPropertyComponent::setSource(SourceFunction function) { diff --git a/modules/imgui/src/guispacetimecomponent.cpp b/modules/imgui/src/guispacetimecomponent.cpp index b15af1f468..e4c0438683 100644 --- a/modules/imgui/src/guispacetimecomponent.cpp +++ b/modules/imgui/src/guispacetimecomponent.cpp @@ -139,10 +139,12 @@ void GuiSpaceTimeComponent::render() { CaptionText("Time Controls"); ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.f); + ImGui::Text("Current Date: %s", OsEng.timeManager().time().UTC().c_str()); + constexpr int BufferSize = 256; static char Buffer[BufferSize]; bool dateChanged = ImGui::InputText( - "Date", + "Change Date", Buffer, BufferSize, ImGuiInputTextFlags_EnterReturnsTrue @@ -207,8 +209,26 @@ void GuiSpaceTimeComponent::render() { incrementTime(-1); } ImGui::SameLine(); - - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 55.f); + + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 15.f); + + bool nowDay = ImGui::Button("Now"); + if (nowDay) { + std::string nowTime = Time::now().UTC(); + // UTC returns a string of the type YYYY MMM DDTHH:mm:ss.xxx + // setTime doesn't like the T in it and wants a space instead + nowTime[11] = ' '; + + OsEng.scriptEngine().queueScript( + "openspace.time.setTime(\"" + nowTime + "\")", + scripting::ScriptEngine::RemoteScripting::Yes + ); + + } + ImGui::SameLine(); + + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 15.f); + bool plusDay = ImGui::Button("+Day"); if (plusDay) { @@ -262,13 +282,6 @@ void GuiSpaceTimeComponent::render() { ); } - auto setDeltaTime = [](std::chrono::seconds dt) { - OsEng.scriptEngine().queueScript( - "openspace.time.setDeltaTime(" + std::to_string(dt.count()) + ")", - scripting::ScriptEngine::RemoteScripting::Yes - ); - }; - bool minusDs = ImGui::Button("-1d/s"); if (minusDs) { OsEng.scriptEngine().queueScript( diff --git a/modules/space/rendering/renderableconstellationbounds.cpp b/modules/space/rendering/renderableconstellationbounds.cpp index 6cf78bb426..529a50c577 100644 --- a/modules/space/rendering/renderableconstellationbounds.cpp +++ b/modules/space/rendering/renderableconstellationbounds.cpp @@ -274,8 +274,10 @@ bool RenderableConstellationBounds::loadVertexFile() { std::string fileName = absPath(_vertexFilename); std::ifstream file; - file.exceptions(std::ifstream::goodbit); file.open(fileName); + if (!file.good()) { + return false; + } ConstellationBound currentBound; currentBound.constellationAbbreviation = ""; diff --git a/modules/space/shaders/rings_vs.glsl b/modules/space/shaders/rings_vs.glsl index d71df06305..654d204deb 100644 --- a/modules/space/shaders/rings_vs.glsl +++ b/modules/space/shaders/rings_vs.glsl @@ -34,7 +34,6 @@ out vec4 vs_position; uniform mat4 modelViewProjectionTransform; - void main() { vs_st = in_st; diff --git a/openspace.cfg b/openspace.cfg index 82f8abc32b..ec309b3607 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -78,6 +78,7 @@ return { KeyboardShortcuts = "${DOCUMENTATION}/KeyboardMapping.html", Documentation = "${DOCUMENTATION}/Documentation.html", FactoryDocumentation = "${DOCUMENTATION}/FactoryDocumentation.html", + LicenseDocumentation = "${DOCUMENTATION}/License.html", -- CheckOpenGLState = true, -- LogEachOpenGLCall = true, diff --git a/scripts/scene_helper.lua b/scripts/scene_helper.lua index 9b12b56023..b97a32d37c 100644 --- a/scripts/scene_helper.lua +++ b/scripts/scene_helper.lua @@ -1,5 +1,7 @@ mark_interesting_nodes = function(nodes) for _, n in pairs(nodes) do - openspace.addTag(n, "GUI.Interesting") + if openspace.hasSceneGraphNode(n) then + openspace.addTag(n, "GUI.Interesting") + end end end diff --git a/shaders/framebuffer/exitframebuffer.frag b/shaders/framebuffer/exitframebuffer.frag index baae8fbe37..53b08a7a60 100644 --- a/shaders/framebuffer/exitframebuffer.frag +++ b/shaders/framebuffer/exitframebuffer.frag @@ -24,7 +24,6 @@ #version __CONTEXT__ - #include "floatoperations.glsl" #include <#{fragmentPath}> diff --git a/shaders/framebuffer/inside.glsl b/shaders/framebuffer/inside.glsl index 9c5587c325..e97be8ab50 100644 --- a/shaders/framebuffer/inside.glsl +++ b/shaders/framebuffer/inside.glsl @@ -22,7 +22,6 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ - void getEntry(inout vec3 entryPos, inout float entryDepth) { entryPos = cameraPosInRaycaster; entryDepth = 0; diff --git a/shaders/luaconsole.vert b/shaders/luaconsole.vert index b2d9c6de77..8b79da0aa3 100644 --- a/shaders/luaconsole.vert +++ b/shaders/luaconsole.vert @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ - #version __CONTEXT__ +#version __CONTEXT__ in vec2 in_position; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 58eaf3bc62..065989adc1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -136,6 +136,8 @@ set(OPENSPACE_SOURCE ${OPENSPACE_BASE_DIR}/src/scene/scene.cpp ${OPENSPACE_BASE_DIR}/src/scene/scene_doc.inl ${OPENSPACE_BASE_DIR}/src/scene/scene_lua.inl + ${OPENSPACE_BASE_DIR}/src/scene/scenelicense.cpp + ${OPENSPACE_BASE_DIR}/src/scene/scenelicensewriter.cpp ${OPENSPACE_BASE_DIR}/src/scene/sceneloader.cpp ${OPENSPACE_BASE_DIR}/src/scene/scenegraphnode.cpp ${OPENSPACE_BASE_DIR}/src/scene/scenegraphnode_doc.inl @@ -294,6 +296,8 @@ set(OPENSPACE_HEADER ${OPENSPACE_BASE_DIR}/include/openspace/scene/rotation.h ${OPENSPACE_BASE_DIR}/include/openspace/scene/scale.h ${OPENSPACE_BASE_DIR}/include/openspace/scene/scene.h + ${OPENSPACE_BASE_DIR}/include/openspace/scene/scenelicense.h + ${OPENSPACE_BASE_DIR}/include/openspace/scene/scenelicensewriter.h ${OPENSPACE_BASE_DIR}/include/openspace/scene/sceneloader.h ${OPENSPACE_BASE_DIR}/include/openspace/scene/scenegraphnode.h ${OPENSPACE_BASE_DIR}/include/openspace/scripting/lualibrary.h diff --git a/src/documentation/documentationgenerator.cpp b/src/documentation/documentationgenerator.cpp index 75026e4f30..f594855e02 100644 --- a/src/documentation/documentationgenerator.cpp +++ b/src/documentation/documentationgenerator.cpp @@ -30,6 +30,8 @@ #include #include +#include + #include namespace { @@ -158,6 +160,12 @@ std::string escapedJson(const std::string& text) { case '\\': jsonString += "\\\\"; break; + case '\n': + jsonString += "\\\\n"; + break; + case '\r': + jsonString += "\\r"; + break; default: jsonString += c; } diff --git a/src/engine/configurationmanager.cpp b/src/engine/configurationmanager.cpp index 0a8c468a14..2770d73bc8 100644 --- a/src/engine/configurationmanager.cpp +++ b/src/engine/configurationmanager.cpp @@ -58,7 +58,9 @@ const string ConfigurationManager::KeyPropertyDocumentation = "PropertyDocumenta const string ConfigurationManager::KeyKeyboardShortcuts = "KeyboardShortcuts"; const string ConfigurationManager::KeyDocumentation = "Documentation"; const string ConfigurationManager::KeyFactoryDocumentation = "FactoryDocumentation"; + const string ConfigurationManager::KeyConfigAsset = "Asset"; +const string ConfigurationManager::KeySceneLicenseDocumentation = "LicenseDocumentation"; const string ConfigurationManager::KeyConfigTasksRoot = "TasksRoot"; const string ConfigurationManager::KeyLogging = "Logging"; diff --git a/src/engine/configurationmanager_doc.inl b/src/engine/configurationmanager_doc.inl index ae2ede7fcf..cf194be5b7 100644 --- a/src/engine/configurationmanager_doc.inl +++ b/src/engine/configurationmanager_doc.inl @@ -200,6 +200,14 @@ documentation::Documentation ConfigurationManager::Documentation() { "created in the current application configuration. Any previous file in this " "location will be silently overritten." }, + { + ConfigurationManager::KeySceneLicenseDocumentation, + new StringVerifier, + Optional::Yes, + "The file that will be created on startup containing the scene license " + "information. Any previous file in this location will be silently " + "overwritten." + }, { ConfigurationManager::KeyLauncher, new TableVerifier({ diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 2b31f35dce..67c18fd629 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -165,7 +166,6 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName, properties::StringProperty(VersionInfo, OPENSPACE_VERSION_STRING_FULL), properties::StringProperty(SourceControlInfo, OPENSPACE_GIT_FULL) } - , _runTime(0.0) , _shutdown({false, 0.f, 0.f}) , _isFirstRenderingFirstFrame(true) { @@ -330,23 +330,18 @@ void OpenSpaceEngine::create(int argc, char** argv, ConfigurationManager::KeyPerSceneCache ); std::string cacheFolder = absPath("${CACHE}"); - if (hasCacheCommandline) { - cacheFolder = commandlineArgumentPlaceholders.cacheFolder; - // @CLEANUP: Why is this commented out? ---abock - //FileSys.registerPathToken( - // "${CACHE}", - // commandlineArgumentPlaceholders.cacheFolder, - // ghoul::filesystem::FileSystem::Override::Yes - //); - } - if (hasCacheConfiguration) { - std::string scene = _engine->configurationManager().value( - ConfigurationManager::KeyConfigAsset - ); - cacheFolder += "-" + ghoul::filesystem::File(scene).baseName(); - } if (hasCacheCommandline || hasCacheConfiguration) { + if (hasCacheCommandline) { + cacheFolder = commandlineArgumentPlaceholders.cacheFolder; + } + if (hasCacheConfiguration) { + std::string scene = _engine->configurationManager().value( + ConfigurationManager::KeyConfigAsset + ); + cacheFolder += "-" + ghoul::filesystem::File(scene).baseName(); + } + LINFO("Old cache: " << absPath("${CACHE}")); LINFO("New cache: " << cacheFolder); FileSys.registerPathToken( @@ -357,8 +352,7 @@ void OpenSpaceEngine::create(int argc, char** argv, } // Create directories that doesn't exist - auto tokens = FileSys.tokens(); - for (const std::string& token : tokens) { + for (const std::string& token : FileSys.tokens()) { if (!FileSys.directoryExists(token)) { std::string p = absPath(token); FileSys.createDirectory(p, ghoul::filesystem::FileSystem::Recursive::Yes); @@ -387,9 +381,7 @@ void OpenSpaceEngine::create(int argc, char** argv, } // Create the cachemanager - FileSys.createCacheManager( - absPath("${" + ConfigurationManager::KeyCache + "}"), CacheVersion - ); + FileSys.createCacheManager(cacheFolder, CacheVersion); // Register the provided shader directories ghoul::opengl::ShaderPreprocessor::addIncludePath(absPath("${SHADERS}")); @@ -454,7 +446,7 @@ void OpenSpaceEngine::initialize() { glbinding::Binding::useCurrentContext(); glbinding::Binding::initialize(); - // clear the screen so the user don't have to see old buffer contents from the + // clear the screen so the user doesn't have to see old buffer contents from the // graphics card LDEBUG("Clearing all Windows"); _windowWrapper->clearAllWindows(glm::vec4(0.f, 0.f, 0.f, 1.f)); @@ -639,7 +631,16 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { keyBindingManager().writeDocumentation( absPath(configurationManager().value( ConfigurationManager::KeyKeyboardShortcuts - )) + )) + ); + } + + if (configurationManager().hasKey(ConfigurationManager::KeySceneLicenseDocumentation)) + { + _scene->writeSceneLicenseDocumentation( + absPath(configurationManager().value( + ConfigurationManager::KeySceneLicenseDocumentation + )) ); } @@ -648,7 +649,7 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) { _scene->writeDocumentation( absPath(configurationManager().value( ConfigurationManager::KeyPropertyDocumentation - )) + )) ); } } @@ -846,10 +847,11 @@ void OpenSpaceEngine::initializeGL() { } LTRACE("OpenSpaceEngine::initializeGL::Console::initialize(end)"); - const std::string key = ConfigurationManager::KeyOpenGLDebugContext; - if (_configurationManager->hasKey(key)) { + if (_configurationManager->hasKey(ConfigurationManager::KeyOpenGLDebugContext)) { LTRACE("OpenSpaceEngine::initializeGL::DebugContext(begin)"); - ghoul::Dictionary dict = _configurationManager->value(key); + ghoul::Dictionary dict = _configurationManager->value( + ConfigurationManager::KeyOpenGLDebugContext + ); bool debug = dict.value(ConfigurationManager::PartActivate); // Debug output is not available before 4.3 @@ -869,7 +871,6 @@ void OpenSpaceEngine::initializeGL() { setDebugOutput(DebugOutput(debug), SynchronousOutput(synchronous)); - if (dict.hasKey(ConfigurationManager::PartFilterIdentifier)) { ghoul::Dictionary filterDict = dict.value( ConfigurationManager::PartFilterIdentifier @@ -1046,20 +1047,9 @@ void OpenSpaceEngine::initializeGL() { LINFO("Finished initializing OpenGL"); - LINFO("IsUsingSwapGroups: " << _windowWrapper->isUsingSwapGroups()); - LINFO("IsSwapGroupMaster: " << _windowWrapper->isSwapGroupMaster()); - LTRACE("OpenSpaceEngine::initializeGL(end)"); } -double OpenSpaceEngine::runTime() { - return _runTime; -} - -void OpenSpaceEngine::setRunTime(double d) { - _runTime = d; -} - void OpenSpaceEngine::preSynchronization() { LTRACE("OpenSpaceEngine::preSynchronization(begin)"); FileSys.triggerFilesystemEvents(); @@ -1175,7 +1165,7 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix, func(); } - if (_shutdown.inShutdown) { + if (isGuiWindow && _shutdown.inShutdown) { _renderEngine->renderShutdownInformation(_shutdown.timer, _shutdown.waitTime); } @@ -1355,19 +1345,18 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() { {}, "string, string", "Adds a tag (second argument) to a scene graph node (first argument)" + }, + { + "removeTag", + &luascriptfunctions::removeTag, + {}, + "string, string", + "Removes a tag (second argument) from a scene graph node (first argument)" } } }; } -void OpenSpaceEngine::enableBarrier() { - _windowWrapper->setBarrier(true); -} - -void OpenSpaceEngine::disableBarrier() { - _windowWrapper->setBarrier(false); -} - // Registers a callback for a specific CallbackOption void OpenSpaceEngine::registerModuleCallback(OpenSpaceEngine::CallbackOption option, std::function function) @@ -1401,7 +1390,7 @@ void OpenSpaceEngine::registerModuleCallback(OpenSpaceEngine::CallbackOption opt throw ghoul::MissingCaseException(); } } - + void OpenSpaceEngine::registerModuleKeyboardCallback( std::function function) { diff --git a/src/engine/openspaceengine_lua.inl b/src/engine/openspaceengine_lua.inl index 7fd89319e6..20a3185037 100644 --- a/src/engine/openspaceengine_lua.inl +++ b/src/engine/openspaceengine_lua.inl @@ -176,7 +176,31 @@ int addTag(lua_State* L) { return luaL_error(L, "Unknown scene graph node type '%s'", uri.c_str()); } - node->addTag(tag); + node->addTag(std::move(tag)); + + return 0; +} + +/** + * \ingroup LuaScripts + * removeTag(): + * Removes a tag from a SceneGraphNode + */ +int removeTag(lua_State* L) { + const int nArguments = lua_gettop(L); + if (nArguments != 2) { + return luaL_error(L, "Expected %i arguments, got %i", 2, nArguments); + } + + const std::string uri = lua_tostring(L, -2); + const std::string tag = lua_tostring(L, -1); + + SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(uri); + if (!node) { + return luaL_error(L, "Unknown scene graph node type '%s'", uri.c_str()); + } + + node->removeTag(tag); return 0; } diff --git a/src/engine/wrapper/sgctwindowwrapper.cpp b/src/engine/wrapper/sgctwindowwrapper.cpp index dc19d46551..2d543cd25e 100644 --- a/src/engine/wrapper/sgctwindowwrapper.cpp +++ b/src/engine/wrapper/sgctwindowwrapper.cpp @@ -64,7 +64,7 @@ SGCTWindowWrapper::SGCTWindowWrapper() setEyeSeparationDistance(_eyeSeparation); }); } - + void SGCTWindowWrapper::terminate() { sgct::Engine::instance()->terminate(); } @@ -72,7 +72,7 @@ void SGCTWindowWrapper::terminate() { void SGCTWindowWrapper::setBarrier(bool enabled) { sgct::SGCTWindow::setBarrier(enabled); } - + void SGCTWindowWrapper::setSynchronization(bool enabled) { sgct_core::ClusterManager::instance()->setUseIgnoreSync(enabled); } @@ -90,7 +90,7 @@ void SGCTWindowWrapper::clearAllWindows(const glm::vec4& clearColor) { bool SGCTWindowWrapper::windowHasResized() const { return sgct::Engine::instance()->getCurrentWindowPtr()->isWindowResized(); } - + double SGCTWindowWrapper::averageDeltaTime() const { return sgct::Engine::instance()->getAvgDt(); } @@ -98,7 +98,11 @@ double SGCTWindowWrapper::averageDeltaTime() const { double SGCTWindowWrapper::deltaTime() const { return sgct::Engine::instance()->getDt(); } - + +double SGCTWindowWrapper::applicationTime() const { + return sgct::Engine::getTime(); +} + glm::vec2 SGCTWindowWrapper::mousePosition() const { int id = sgct::Engine::instance()->getCurrentWindowPtr()->getId(); double posX, posY; @@ -157,7 +161,7 @@ glm::ivec2 SGCTWindowWrapper::currentDrawBufferResolution() const { } throw WindowWrapperException("No viewport available"); } - + glm::vec2 SGCTWindowWrapper::dpiScaling() const { return glm::vec2( sgct::Engine::instance()->getCurrentWindowPtr()->getXScale(), @@ -168,7 +172,7 @@ glm::vec2 SGCTWindowWrapper::dpiScaling() const { int SGCTWindowWrapper::currentNumberOfAaSamples() const { return sgct::Engine::instance()->getCurrentWindowPtr()->getNumberOfAASamples(); } - + bool SGCTWindowWrapper::isRegularRendering() const { sgct::SGCTWindow* w = sgct::Engine::instance()->getCurrentWindowPtr(); std::size_t nViewports = w->getNumberOfViewports(); @@ -194,7 +198,7 @@ bool SGCTWindowWrapper::isGuiWindow() const { GuiWindowTag ); } - + bool SGCTWindowWrapper::isMaster() const { return sgct::Engine::instance()->isMaster(); } @@ -206,7 +210,7 @@ bool SGCTWindowWrapper::isSwapGroupMaster() const { bool SGCTWindowWrapper::isUsingSwapGroups() const { return sgct::Engine::instance()->getCurrentWindowPtr()->isUsingSwapGroups(); } - + glm::mat4 SGCTWindowWrapper::viewProjectionMatrix() const { return sgct::Engine::instance()->getCurrentModelViewProjectionMatrix(); } @@ -214,7 +218,7 @@ glm::mat4 SGCTWindowWrapper::viewProjectionMatrix() const { glm::mat4 SGCTWindowWrapper::modelMatrix() const { return sgct::Engine::instance()->getModelMatrix(); } - + void SGCTWindowWrapper::setNearFarClippingPlane(float nearPlane, float farPlane) { sgct::Engine::instance()->setNearAndFarClippingPlanes(nearPlane, farPlane); } @@ -225,39 +229,33 @@ void SGCTWindowWrapper::setEyeSeparationDistance(float distance) { glm::ivec4 SGCTWindowWrapper::viewportPixelCoordinates() const { int x1, xSize, y1, ySize; - sgct::Engine::instance()->getCurrentWindowPtr()->getCurrentViewportPixelCoords(x1, - y1, - xSize, - ySize); + sgct::Engine::instance()->getCurrentWindowPtr()->getCurrentViewportPixelCoords( + x1, + y1, + xSize, + ySize + ); return glm::ivec4(x1, xSize, y1, ySize); } - + bool SGCTWindowWrapper::isExternalControlConnected() const { return sgct::Engine::instance()->isExternalControlConnected(); } - + void SGCTWindowWrapper::sendMessageToExternalControl(const std::vector& message) const { sgct::Engine::instance()->sendMessageToExternalControl( message.data(), static_cast(message.size()) ); } - + bool SGCTWindowWrapper::isSimpleRendering() const { return (sgct::Engine::instance()->getCurrentRenderTarget() != sgct::Engine::NonLinearBuffer); - } - + void SGCTWindowWrapper::takeScreenshot(bool applyWarping) const { sgct::SGCTSettings::instance()->setCaptureFromBackBuffer(applyWarping); sgct::Engine::instance()->takeScreenshot(); } - -//void forEachWindow(std::function function) { -// size_t n = sgct::Engine::instance()->getNumberOfWindows(); -// for (size_t i = 0; i < n; ++i) -// function(); -//} - -} // namespace openspace +} // namespace openspace diff --git a/src/engine/wrapper/windowwrapper.cpp b/src/engine/wrapper/windowwrapper.cpp index 63906bfaf3..c057e52982 100644 --- a/src/engine/wrapper/windowwrapper.cpp +++ b/src/engine/wrapper/windowwrapper.cpp @@ -93,19 +93,23 @@ double WindowWrapper::averageDeltaTime() const { double WindowWrapper::deltaTime() const { return 0.0; } - + +double WindowWrapper::applicationTime() const { + return 0.0; +} + glm::vec2 WindowWrapper::mousePosition() const { return glm::vec2(0.f); } - + uint32_t WindowWrapper::mouseButtons(int) const { return uint32_t(0); } - + glm::ivec2 WindowWrapper::currentWindowSize() const { return glm::ivec2(0); } - + glm::ivec2 WindowWrapper::currentWindowResolution() const { return currentWindowSize(); } @@ -154,11 +158,11 @@ glm::mat4 WindowWrapper::viewProjectionMatrix() const { glm::mat4 WindowWrapper::modelMatrix() const { return glm::mat4(1.f); } - + void WindowWrapper::setNearFarClippingPlane(float, float) {} void WindowWrapper::setEyeSeparationDistance(float) {} - + glm::ivec4 WindowWrapper::viewportPixelCoordinates() const { return glm::ivec4( 0, @@ -167,19 +171,19 @@ glm::ivec4 WindowWrapper::viewportPixelCoordinates() const { currentWindowResolution().y ); } - - + + bool WindowWrapper::isExternalControlConnected() const { return false; } - + void WindowWrapper::sendMessageToExternalControl(const std::vector&) const { } - + bool WindowWrapper::isSimpleRendering() const { return true; } - + void WindowWrapper::takeScreenshot(bool) const {} - + } // namespace openspace diff --git a/src/interaction/keybindingmanager.cpp b/src/interaction/keybindingmanager.cpp index b4da308a78..e2a6d3fb35 100644 --- a/src/interaction/keybindingmanager.cpp +++ b/src/interaction/keybindingmanager.cpp @@ -138,7 +138,7 @@ std::string KeyBindingManager::generateJson() const { } return jsonString; -} +} scripting::LuaLibrary KeyBindingManager::luaLibrary() { return { diff --git a/src/interaction/keyframenavigator.cpp b/src/interaction/keyframenavigator.cpp index 9d9070e609..e830925241 100644 --- a/src/interaction/keyframenavigator.cpp +++ b/src/interaction/keyframenavigator.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -37,7 +38,7 @@ namespace openspace::interaction { void KeyframeNavigator::updateCamera(Camera& camera) { - double now = OsEng.runTime(); + double now = OsEng.windowWrapper().applicationTime(); if (_cameraPoseTimeline.nKeyframes() == 0) { return; diff --git a/src/network/parallelconnection.cpp b/src/network/parallelconnection.cpp index 39509c52a0..882ff32875 100644 --- a/src/network/parallelconnection.cpp +++ b/src/network/parallelconnection.cpp @@ -587,7 +587,7 @@ void ParallelConnection::initializationMessageReceived(){ double ParallelConnection::calculateBufferedKeyframeTime(double originalTime) { std::lock_guard latencyLock(_latencyMutex); - double timeDiff = OsEng.runTime() - originalTime; + double timeDiff = OsEng.windowWrapper().applicationTime() - originalTime; if (_latencyDiffs.size() == 0) { _initialTimeDiff = timeDiff; } @@ -1084,7 +1084,7 @@ void ParallelConnection::preSynchronization() { if (OsEng.timeManager().time().timeJumped()) { _timeJumped = true; } - double now = OsEng.runTime(); + double now = OsEng.windowWrapper().applicationTime(); if (_lastCameraKeyframeTimestamp + _cameraKeyframeInterval < now) { sendCameraKeyframe(); @@ -1156,7 +1156,7 @@ void ParallelConnection::sendCameraKeyframe() { kf._focusNode = focusNode->name(); // Timestamp as current runtime of OpenSpace instance - kf._timestamp = OsEng.runTime(); + kf._timestamp = OsEng.windowWrapper().applicationTime(); // Create a buffer for the keyframe std::vector buffer; @@ -1180,7 +1180,7 @@ void ParallelConnection::sendTimeKeyframe() { kf._time = time.j2000Seconds(); // Timestamp as current runtime of OpenSpace instance - kf._timestamp = OsEng.runTime(); + kf._timestamp = OsEng.windowWrapper().applicationTime(); // Create a buffer for the keyframe std::vector buffer; diff --git a/src/performance/performancemanager.cpp b/src/performance/performancemanager.cpp index 0e511237aa..7eee5569b0 100644 --- a/src/performance/performancemanager.cpp +++ b/src/performance/performancemanager.cpp @@ -130,10 +130,10 @@ void PerformanceManager::destroyGlobalSharedMemory() { sharedMemory.releaseLock(); } -PerformanceManager::PerformanceManager() +PerformanceManager::PerformanceManager(std::string loggingDirectory, std::string prefix) : _loggingEnabled(false) - , _logDir(absPath("${BASE_PATH}")) - , _prefix("PM-") + , _logDir(absPath(std::move(loggingDirectory))) + , _prefix(std::move(prefix)) , _ext("log") , _performanceMemory(nullptr) , _tick(0) diff --git a/src/properties/propertyowner.cpp b/src/properties/propertyowner.cpp index 671dde7fe6..6568b7146c 100644 --- a/src/properties/propertyowner.cpp +++ b/src/properties/propertyowner.cpp @@ -34,14 +34,6 @@ namespace openspace::properties { namespace { const char* _loggerCat = "PropertyOwner"; - - bool propertyLess(Property* lhs, Property* rhs) { - return lhs->identifier() < rhs->identifier(); - } - - bool subOwnerLess(PropertyOwner* lhs, PropertyOwner* rhs) { - return lhs->name() < rhs->name(); - } } // namespace @@ -290,4 +282,11 @@ void PropertyOwner::addTag(std::string tag) { _tags.push_back(std::move(tag)); } +void PropertyOwner::removeTag(const std::string& tag) { + _tags.erase( + std::remove(_tags.begin(), _tags.end(), tag), + _tags.end() + ); +} + } // namespace openspace::properties diff --git a/src/rendering/renderable.cpp b/src/rendering/renderable.cpp index a73095ec4f..c4e52442fe 100644 --- a/src/rendering/renderable.cpp +++ b/src/rendering/renderable.cpp @@ -67,6 +67,12 @@ documentation::Documentation Renderable::Documentation() { "of the valid Renderables that are available for creation (see the " "FactoryDocumentation for a list of possible Renderables), which depends on " "the configration of the application" + }, + { + EnabledInfo.identifier, + new BoolVerifier, + Optional::Yes, + EnabledInfo.description } } }; @@ -134,6 +140,10 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary) _hasTimeInterval = true; } + if (dictionary.hasKey(EnabledInfo.identifier)) { + _enabled = dictionary.value(EnabledInfo.identifier); + } + addProperty(_enabled); } diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 5f75f47b82..8b9660c124 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -196,7 +196,7 @@ RenderEngine::RenderEngine() , _camera(nullptr) , _scene(nullptr) , _raycasterManager(nullptr) - , _performanceMeasurements(PerformanceInfo) + , _doPerformanceMeasurements(PerformanceInfo) , _performanceManager(nullptr) , _renderer(nullptr) , _rendererImplementation(RendererImplementation::Invalid) @@ -219,18 +219,26 @@ RenderEngine::RenderEngine() , _nAaSamples(AaSamplesInfo, 8, 1, 16) , _frameNumber(0) { - _performanceMeasurements.onChange([this](){ - if (_performanceMeasurements) { + _doPerformanceMeasurements.onChange([this](){ + if (_doPerformanceMeasurements) { if (!_performanceManager) { - _performanceManager = std::make_unique(); - const std::string KeyLogDir = ConfigurationManager::KeyLogging + "." + ConfigurationManager::PartLogDir; + std::string loggingDir = "${BASE_PATH}"; + + const std::string KeyDir = ConfigurationManager::KeyLogging + "." + ConfigurationManager::PartLogDir; + if (OsEng.configurationManager().hasKey(KeyDir)) { + loggingDir = OsEng.configurationManager().value(KeyDir); + } + + std::string prefix = "PM-"; const std::string KeyPrefix = ConfigurationManager::KeyLogging + "." + ConfigurationManager::PartLogPerformancePrefix; - if (OsEng.configurationManager().hasKeyAndValue(KeyLogDir)) { - _performanceManager->logDir(OsEng.configurationManager().value(KeyLogDir)); - } - if (OsEng.configurationManager().hasKeyAndValue(KeyPrefix)) { - _performanceManager->prefix(OsEng.configurationManager().value(KeyPrefix)); + if (OsEng.configurationManager().hasKey(KeyPrefix)) { + prefix = OsEng.configurationManager().value(KeyPrefix); } + + _performanceManager = std::make_unique( + loggingDir, + prefix + ); } } else { @@ -238,20 +246,14 @@ RenderEngine::RenderEngine() } }); - addProperty(_performanceMeasurements); + addProperty(_doPerformanceMeasurements); - _frametimeType.addOption( - static_cast(FrametimeType::DtTimeAvg), - "Average Deltatime" - ); - _frametimeType.addOption( - static_cast(FrametimeType::FPS), - "Frames per second" - ); - _frametimeType.addOption( - static_cast(FrametimeType::FPSAvg), - "Average frames per second" - ); + _frametimeType.addOptions({ + { static_cast(FrametimeType::DtTimeAvg), "Average Deltatime" }, + { static_cast(FrametimeType::FPS), "Frames per second" }, + { static_cast(FrametimeType::FPSAvg), "Average frames per second" }, + { static_cast(FrametimeType::None), "None" } + }); addProperty(_frametimeType); addProperty(_showDate); @@ -278,9 +280,6 @@ RenderEngine::RenderEngine() addProperty(_disableMasterRendering); } -/** - * Destructor - */ RenderEngine::~RenderEngine() {} void RenderEngine::setRendererFromString(const std::string& renderingMethod) { @@ -307,7 +306,7 @@ void RenderEngine::initialize() { std::string renderingMethod = DefaultRenderingMethod; // If the user specified a rendering method that he would like to use, use that - auto& confManager = OsEng.configurationManager(); + ConfigurationManager& confManager = OsEng.configurationManager(); if (confManager.hasKeyAndValue(KeyRenderingMethod)) { renderingMethod = confManager.value(KeyRenderingMethod); } else { @@ -372,7 +371,7 @@ void RenderEngine::initializeGL() { // set the close clip plane and the far clip plane to extreme values while in // development - OsEng.windowWrapper().setNearFarClippingPlane(0.001f, 10000.f); + OsEng.windowWrapper().setNearFarClippingPlane(0.001f, 1000.f); try { const float fontSizeBig = 50.f; @@ -398,7 +397,7 @@ void RenderEngine::initializeGL() { } void RenderEngine::deinitialize() { - for (std::shared_ptr ssr : _screenSpaceRenderables) { + for (std::shared_ptr& ssr : _screenSpaceRenderables) { ssr->deinitialize(); } @@ -527,8 +526,9 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat } _camera->sgctInternal.setProjectionMatrix(projectionMatrix); } - - if (!(wrapper.isMaster() && _disableMasterRendering) && !wrapper.isGuiWindow()) { + + bool masterEnabled = wrapper.isMaster() ? !_disableMasterRendering : true; + if (masterEnabled && !wrapper.isGuiWindow() && _globalBlackOutFactor > 0.f) { _renderer->render(_globalBlackOutFactor, _performanceManager != nullptr); } @@ -546,7 +546,7 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat RenderFont(*_fontBig, penPosition, "%i", _frameNumber); } - _frameNumber++; + ++_frameNumber; for (std::shared_ptr& ssr : _screenSpaceRenderables) { if (ssr->isEnabled() && ssr->isReady()) { @@ -570,7 +570,6 @@ void RenderEngine::renderShutdownInformation(float timer, float fullTime) { fontResolution().x - size.boundingBox.x - 10, fontResolution().y - size.boundingBox.y ); - // penPosition.y -= _fontDate->height(); RenderFontCr( *_fontDate, @@ -741,7 +740,6 @@ void RenderEngine::setRendererData(const ghoul::Dictionary& data) { } } - /** * Set resolve data * Called from the renderer, whenever it needs to update @@ -811,7 +809,6 @@ scripting::LuaLibrary RenderEngine::luaLibrary() { "number", "" }, - //also temporary @JK { "fadeOut", &luascriptfunctions::fadeOut, @@ -848,7 +845,7 @@ performance::PerformanceManager* RenderEngine::performanceManager() { void RenderEngine::registerScreenSpaceRenderable(std::shared_ptr s) { s->initialize(); - _screenSpaceRenderables.push_back(s); + _screenSpaceRenderables.push_back(std::move(s)); } void RenderEngine::unregisterScreenSpaceRenderable( @@ -866,7 +863,7 @@ void RenderEngine::unregisterScreenSpaceRenderable( } } -void RenderEngine::unregisterScreenSpaceRenderable(std::string name){ +void RenderEngine::unregisterScreenSpaceRenderable(const std::string& name){ std::shared_ptr s = screenSpaceRenderable(name); if (s) { unregisterScreenSpaceRenderable(s); @@ -874,14 +871,22 @@ void RenderEngine::unregisterScreenSpaceRenderable(std::string name){ } std::shared_ptr RenderEngine::screenSpaceRenderable( - std::string name) + const std::string& name) { - for (auto s : _screenSpaceRenderables) { - if (s->name() == name) { - return s; + auto it = std::find_if( + _screenSpaceRenderables.begin(), + _screenSpaceRenderables.end(), + [name](const std::shared_ptr& s) { + return s->name() == name; } + ); + + if (it != _screenSpaceRenderables.end()) { + return *it; + } + else { + return nullptr; } - return nullptr; } std::vector RenderEngine::screenSpaceRenderables() const { @@ -896,7 +901,7 @@ std::vector RenderEngine::screenSpaceRenderables() const } RenderEngine::RendererImplementation RenderEngine::rendererFromString( - const std::string& impl) + const std::string& impl) const { const std::map RenderingMethods = { { "ABuffer", RendererImplementation::ABuffer }, @@ -927,73 +932,64 @@ std::string RenderEngine::progressToStr(int size, double t) { } void RenderEngine::renderInformation() { - // TODO: Adjust font_size properly when using retina screen using ghoul::fontrendering::RenderFont; - if (_fontDate) { - glm::vec2 penPosition = glm::vec2( - 10.f, - fontResolution().y - //OsEng.windowWrapper().viewportPixelCoordinates().w + glm::vec2 penPosition = glm::vec2( + 10.f, + fontResolution().y + ); + + // If the console is opened, move all text downwards + penPosition.y -= OsEng.console().currentHeight(); + + if (_showDate && _fontDate) { + penPosition.y -= _fontDate->height(); + RenderFontCr( + *_fontDate, + penPosition, + "Date: %s", + OsEng.timeManager().time().UTC().c_str() + ); + } + else { + penPosition.y -= _fontInfo->height(); + } + + if (_showInfo && _fontInfo) { + RenderFontCr( + *_fontInfo, + penPosition, + "Simulation increment (s): %.3f", + OsEng.timeManager().time().deltaTime() ); - penPosition.y -= OsEng.console().currentHeight(); - - if (_showDate && _fontDate) { - penPosition.y -= _fontDate->height(); - RenderFontCr( - *_fontDate, - penPosition, - "Date: %s", - OsEng.timeManager().time().UTC().c_str() - ); + FrametimeType frametimeType = FrametimeType(_frametimeType.value()); + switch (frametimeType) { + case FrametimeType::DtTimeAvg: + RenderFontCr( + *_fontInfo, + penPosition, + "Avg. Frametime: %.5f", + OsEng.windowWrapper().averageDeltaTime() + ); + break; + case FrametimeType::FPS: + RenderFontCr( + *_fontInfo, + penPosition, + "FPS: %3.2f", + 1.0 / OsEng.windowWrapper().deltaTime() + ); + break; + case FrametimeType::FPSAvg: + RenderFontCr( + *_fontInfo, + penPosition, + "Avg. FPS: %3.2f", + 1.0 / OsEng.windowWrapper().averageDeltaTime() + ); + break; } - else { - penPosition.y -= _fontInfo->height(); - } - if (_showInfo && _fontInfo) { - RenderFontCr( - *_fontInfo, - penPosition, - "Simulation increment (s): %.3f", - OsEng.timeManager().time().deltaTime() - ); - - FrametimeType frametimeType = FrametimeType(_frametimeType.value()); - switch (frametimeType) { - case FrametimeType::DtTimeAvg: - RenderFontCr( - *_fontInfo, - penPosition, - "Avg. Frametime: %.5f", - OsEng.windowWrapper().averageDeltaTime() - ); - break; - case FrametimeType::FPS: - RenderFontCr( - *_fontInfo, - penPosition, - "FPS: %3.2f", - 1.0 / OsEng.windowWrapper().deltaTime() - ); - break; - case FrametimeType::FPSAvg: - RenderFontCr( - *_fontInfo, - penPosition, - "Avg. FPS: %3.2f", - 1.0 / OsEng.windowWrapper().averageDeltaTime() - ); - break; - default: - RenderFontCr( - *_fontInfo, - penPosition, - "Avg. Frametime: %.5f", - OsEng.windowWrapper().averageDeltaTime() - ); - break; - } ParallelConnection::Status status = OsEng.parallelConnection().status(); size_t nConnections = OsEng.parallelConnection().nConnections(); @@ -1030,7 +1026,7 @@ void RenderEngine::renderInformation() { } } - if (connectionInfo != "") { + if (!connectionInfo.empty()) { RenderFontCr( *_fontInfo, penPosition, @@ -1040,268 +1036,268 @@ void RenderEngine::renderInformation() { #ifdef OPENSPACE_MODULE_SPACECRAFTINSTRUMENTS_ENABLED - bool hasNewHorizons = scene() && scene()->sceneGraphNode("NewHorizons"); - double currentTime = OsEng.timeManager().time().j2000Seconds(); - //if (MissionManager::ref().hasCurrentMission()) { + bool hasNewHorizons = scene()->sceneGraphNode("NewHorizons"); + double currentTime = OsEng.timeManager().time().j2000Seconds(); - // const Mission& mission = MissionManager::ref().currentMission(); + //if (MissionManager::ref().hasCurrentMission()) { - // if (mission.phases().size() > 0) { - // static const glm::vec4 nextMissionColor(0.7, 0.3, 0.3, 1); - // //static const glm::vec4 missionProgressColor(0.4, 1.0, 1.0, 1); - // static const glm::vec4 currentMissionColor(0.0, 0.5, 0.5, 1); - // static const glm::vec4 missionProgressColor = currentMissionColor;// (0.4, 1.0, 1.0, 1); - // // static const glm::vec4 currentLeafMissionColor = missionProgressColor; - // static const glm::vec4 nonCurrentMissionColor(0.3, 0.3, 0.3, 1); + // const Mission& mission = MissionManager::ref().currentMission(); - // // Add spacing - // RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, " "); + // if (mission.phases().size() > 0) { + // static const glm::vec4 nextMissionColor(0.7, 0.3, 0.3, 1); + // //static const glm::vec4 missionProgressColor(0.4, 1.0, 1.0, 1); + // static const glm::vec4 currentMissionColor(0.0, 0.5, 0.5, 1); + // static const glm::vec4 missionProgressColor = currentMissionColor;// (0.4, 1.0, 1.0, 1); + // // static const glm::vec4 currentLeafMissionColor = missionProgressColor; + // static const glm::vec4 nonCurrentMissionColor(0.3, 0.3, 0.3, 1); - // auto phaseTrace = mission.phaseTrace(currentTime); + // // Add spacing + // RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, " "); - // if (phaseTrace.size()) { - // const MissionPhase& phase = phaseTrace.back().get(); - // std::string title = "Current Mission Phase: " + phase.name(); - // RenderFontCr(*_fontInfo, penPosition, missionProgressColor, title.c_str()); - // double remaining = phase.timeRange().end - currentTime; - // float t = static_cast(1.0 - remaining / phase.timeRange().duration()); - // std::string progress = progressToStr(25, t); - // //RenderFontCr(*_fontInfo, penPosition, missionProgressColor, - // // "%.0f s %s %.1f %%", remaining, progress.c_str(), t * 100); - // } - // else { - // RenderFontCr(*_fontInfo, penPosition, nextMissionColor, "Next Mission:"); - // double remaining = mission.timeRange().start - currentTime; - // RenderFontCr(*_fontInfo, penPosition, nextMissionColor, - // "%.0f s", remaining); - // } + // auto phaseTrace = mission.phaseTrace(currentTime); - // bool showAllPhases = false; + // if (phaseTrace.size()) { + // const MissionPhase& phase = phaseTrace.back().get(); + // std::string title = "Current Mission Phase: " + phase.name(); + // RenderFontCr(*_fontInfo, penPosition, missionProgressColor, title.c_str()); + // double remaining = phase.timeRange().end - currentTime; + // float t = static_cast(1.0 - remaining / phase.timeRange().duration()); + // std::string progress = progressToStr(25, t); + // //RenderFontCr(*_fontInfo, penPosition, missionProgressColor, + // // "%.0f s %s %.1f %%", remaining, progress.c_str(), t * 100); + // } + // else { + // RenderFontCr(*_fontInfo, penPosition, nextMissionColor, "Next Mission:"); + // double remaining = mission.timeRange().start - currentTime; + // RenderFontCr(*_fontInfo, penPosition, nextMissionColor, + // "%.0f s", remaining); + // } - // typedef std::pair PhaseWithDepth; - // std::stack S; - // int pixelIndentation = 20; - // S.push({ &mission, 0 }); - // while (!S.empty()) { - // const MissionPhase* phase = S.top().first; - // int depth = S.top().second; - // S.pop(); + // bool showAllPhases = false; - // bool isCurrentPhase = phase->timeRange().includes(currentTime); + // typedef std::pair PhaseWithDepth; + // std::stack S; + // int pixelIndentation = 20; + // S.push({ &mission, 0 }); + // while (!S.empty()) { + // const MissionPhase* phase = S.top().first; + // int depth = S.top().second; + // S.pop(); - // penPosition.x += depth * pixelIndentation; - // if (isCurrentPhase) { - // double remaining = phase->timeRange().end - currentTime; - // float t = static_cast(1.0 - remaining / phase->timeRange().duration()); - // std::string progress = progressToStr(25, t); - // RenderFontCr(*_fontInfo, penPosition, currentMissionColor, - // "%s %s %.1f %%", - // phase->name().c_str(), - // progress.c_str(), - // t * 100 - // ); - // } - // else { - // RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, phase->name().c_str()); - // } - // penPosition.x -= depth * pixelIndentation; + // bool isCurrentPhase = phase->timeRange().includes(currentTime); - // if (isCurrentPhase || showAllPhases) { - // // phases are sorted increasingly by start time, and will be popped - // // last-in-first-out from the stack, so add them in reversed order. - // int indexLastPhase = static_cast(phase->phases().size()) - 1; - // for (int i = indexLastPhase; 0 <= i; --i) { - // S.push({ &phase->phases()[i], depth + 1 }); - // } - // } - // } - // } - // } + // penPosition.x += depth * pixelIndentation; + // if (isCurrentPhase) { + // double remaining = phase->timeRange().end - currentTime; + // float t = static_cast(1.0 - remaining / phase->timeRange().duration()); + // std::string progress = progressToStr(25, t); + // RenderFontCr(*_fontInfo, penPosition, currentMissionColor, + // "%s %s %.1f %%", + // phase->name().c_str(), + // progress.c_str(), + // t * 100 + // ); + // } + // else { + // RenderFontCr(*_fontInfo, penPosition, nonCurrentMissionColor, phase->name().c_str()); + // } + // penPosition.x -= depth * pixelIndentation; + + // if (isCurrentPhase || showAllPhases) { + // // phases are sorted increasingly by start time, and will be popped + // // last-in-first-out from the stack, so add them in reversed order. + // int indexLastPhase = static_cast(phase->phases().size()) - 1; + // for (int i = indexLastPhase; 0 <= i; --i) { + // S.push({ &phase->phases()[i], depth + 1 }); + // } + // } + // } + // } + // } - if (openspace::ImageSequencer::ref().isReady()) { - penPosition.y -= 25.f; + if (openspace::ImageSequencer::ref().isReady()) { + penPosition.y -= 25.f; - glm::vec4 targetColor(0.00, 0.75, 1.00, 1); + glm::vec4 targetColor(0.00, 0.75, 1.00, 1); - if (hasNewHorizons) { - try { - double lt; - glm::dvec3 p = - SpiceManager::ref().targetPosition("PLUTO", "NEW HORIZONS", "GALACTIC", {}, currentTime, lt); - psc nhPos = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z); - float a, b; - glm::dvec3 radii; - SpiceManager::ref().getValue("PLUTO", "RADII", radii); - a = static_cast(radii.x); - b = static_cast(radii.y); - float radius = (a + b) / 2.f; - float distToSurf = glm::length(nhPos.vec3()) - radius; + if (hasNewHorizons) { + try { + double lt; + glm::dvec3 p = + SpiceManager::ref().targetPosition("PLUTO", "NEW HORIZONS", "GALACTIC", {}, currentTime, lt); + psc nhPos = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z); + float a, b; + glm::dvec3 radii; + SpiceManager::ref().getValue("PLUTO", "RADII", radii); + a = static_cast(radii.x); + b = static_cast(radii.y); + float radius = (a + b) / 2.f; + float distToSurf = glm::length(nhPos.vec3()) - radius; - RenderFont(*_fontInfo, - penPosition, - "Distance to Pluto: % .1f (KM)", - distToSurf - ); - penPosition.y -= _fontInfo->height(); - } - catch (...) { - // @CLEANUP: This is bad as it will discard all exceptions - // without telling us about it! ---abock - } + RenderFont(*_fontInfo, + penPosition, + "Distance to Pluto: % .1f (KM)", + distToSurf + ); + penPosition.y -= _fontInfo->height(); } + catch (...) { + // @CLEANUP: This is bad as it will discard all exceptions + // without telling us about it! ---abock + } + } - double remaining = openspace::ImageSequencer::ref().getNextCaptureTime() - currentTime; - float t = static_cast(1.0 - remaining / openspace::ImageSequencer::ref().getIntervalLength()); + double remaining = openspace::ImageSequencer::ref().getNextCaptureTime() - currentTime; + float t = static_cast(1.0 - remaining / openspace::ImageSequencer::ref().getIntervalLength()); - std::string str = SpiceManager::ref().dateFromEphemerisTime( - ImageSequencer::ref().getNextCaptureTime(), - "YYYY MON DD HR:MN:SC" + std::string str = SpiceManager::ref().dateFromEphemerisTime( + ImageSequencer::ref().getNextCaptureTime(), + "YYYY MON DD HR:MN:SC" + ); + + glm::vec4 active(0.6, 1, 0.00, 1); + glm::vec4 brigther_active(0.9, 1, 0.75, 1); + + if (remaining > 0) { + + std::string progress = progressToStr(25, t); + brigther_active *= (1 - t); + + RenderFontCr(*_fontInfo, + penPosition, + active * t + brigther_active, + "Next instrument activity:" ); - glm::vec4 active(0.6, 1, 0.00, 1); - glm::vec4 brigther_active(0.9, 1, 0.75, 1); + RenderFontCr(*_fontInfo, + penPosition, + active * t + brigther_active, + "%.0f s %s %.1f %%", + remaining, progress.c_str(), t * 100 + ); - if (remaining > 0) { - - std::string progress = progressToStr(25, t); - brigther_active *= (1 - t); + RenderFontCr(*_fontInfo, + penPosition, + active, + "Data acquisition time: %s", + str.c_str() + ); + } + std::pair nextTarget = ImageSequencer::ref().getNextTarget(); + std::pair currentTarget = ImageSequencer::ref().getCurrentTarget(); - RenderFontCr(*_fontInfo, + if (currentTarget.first > 0.0) { + int timeleft = static_cast(nextTarget.first - currentTime); + + int hour = timeleft / 3600; + int second = timeleft % 3600; + int minute = second / 60; + second = second % 60; + + std::string hh, mm, ss; + + if (hour < 10) + hh.append("0"); + if (minute < 10) + mm.append("0"); + if (second < 10) + ss.append("0"); + + hh.append(std::to_string(hour)); + mm.append(std::to_string(minute)); + ss.append(std::to_string(second)); + + RenderFontCr(*_fontInfo, + penPosition, + targetColor, + "Data acquisition adjacency: [%s:%s:%s]", + hh.c_str(), mm.c_str(), ss.c_str() + ); + +#if 0 +// Why is it (2) in the original? ---abock + //std::pair> incidentTargets = ImageSequencer::ref().getIncidentTargetList(0); + //std::pair> incidentTargets = ImageSequencer::ref().getIncidentTargetList(2); + std::string space; + glm::vec4 color; + size_t isize = incidentTargets.second.size(); + for (size_t p = 0; p < isize; p++) { + double t = static_cast(p + 1) / static_cast(isize + 1); + t = (p > isize / 2) ? 1 - t : t; + t += 0.3; + color = (p == isize / 2) ? targetColor : glm::vec4(t, t, t, 1); + + RenderFont(*_fontInfo, penPosition, - active * t + brigther_active, - "Next instrument activity:" + color, + "%s%s", + space.c_str(), incidentTargets.second[p].c_str() ); - RenderFontCr(*_fontInfo, - penPosition, - active * t + brigther_active, - "%.0f s %s %.1f %%", - remaining, progress.c_str(), t * 100 - ); - RenderFontCr(*_fontInfo, - penPosition, - active, - "Data acquisition time: %s", - str.c_str() - ); + for (int k = 0; k < incidentTargets.second[p].size() + 2; k++) + space += " "; } - std::pair nextTarget = ImageSequencer::ref().getNextTarget(); - std::pair currentTarget = ImageSequencer::ref().getCurrentTarget(); +#endif + penPosition.y -= _fontInfo->height(); - if (currentTarget.first > 0.0) { - int timeleft = static_cast(nextTarget.first - currentTime); + std::map activeMap = ImageSequencer::ref().getActiveInstruments(); + glm::vec4 firing(0.58 - t, 1 - t, 1 - t, 1); + glm::vec4 notFiring(0.5, 0.5, 0.5, 1); - int hour = timeleft / 3600; - int second = timeleft % 3600; - int minute = second / 60; - second = second % 60; - - std::string hh, mm, ss; - - if (hour < 10) - hh.append("0"); - if (minute < 10) - mm.append("0"); - if (second < 10) - ss.append("0"); - - hh.append(std::to_string(hour)); - mm.append(std::to_string(minute)); - ss.append(std::to_string(second)); - - RenderFontCr(*_fontInfo, - penPosition, - targetColor, - "Data acquisition adjacency: [%s:%s:%s]", - hh.c_str(), mm.c_str(), ss.c_str() - ); - - #if 0 - // Why is it (2) in the original? ---abock - //std::pair> incidentTargets = ImageSequencer::ref().getIncidentTargetList(0); - //std::pair> incidentTargets = ImageSequencer::ref().getIncidentTargetList(2); - std::string space; - glm::vec4 color; - size_t isize = incidentTargets.second.size(); - for (size_t p = 0; p < isize; p++) { - double t = static_cast(p + 1) / static_cast(isize + 1); - t = (p > isize / 2) ? 1 - t : t; - t += 0.3; - color = (p == isize / 2) ? targetColor : glm::vec4(t, t, t, 1); + RenderFontCr(*_fontInfo, + penPosition, + active, + "Active Instruments:" + ); + for (auto m : activeMap) { + if (m.second == false) { RenderFont(*_fontInfo, penPosition, - color, - "%s%s", - space.c_str(), incidentTargets.second[p].c_str() - ); - - - for (int k = 0; k < incidentTargets.second[p].size() + 2; k++) - space += " "; - } - #endif - penPosition.y -= _fontInfo->height(); - - std::map activeMap = ImageSequencer::ref().getActiveInstruments(); - glm::vec4 firing(0.58 - t, 1 - t, 1 - t, 1); - glm::vec4 notFiring(0.5, 0.5, 0.5, 1); - - RenderFontCr(*_fontInfo, - penPosition, - active, - "Active Instruments:" + glm::vec4(0.3, 0.3, 0.3, 1), + "| |" + ); + RenderFontCr(*_fontInfo, + penPosition, + glm::vec4(0.3, 0.3, 0.3, 1), + " %5s", + m.first.c_str() ); - for (auto m : activeMap) { - if (m.second == false) { + } + else { + RenderFont(*_fontInfo, + penPosition, + glm::vec4(0.3, 0.3, 0.3, 1), + "|" + ); + if (m.first == "NH_LORRI") { RenderFont(*_fontInfo, penPosition, - glm::vec4(0.3, 0.3, 0.3, 1), - "| |" - ); - RenderFontCr(*_fontInfo, - penPosition, - glm::vec4(0.3, 0.3, 0.3, 1), - " %5s", - m.first.c_str() - ); - - } - else { - RenderFont(*_fontInfo, - penPosition, - glm::vec4(0.3, 0.3, 0.3, 1), - "|" - ); - if (m.first == "NH_LORRI") { - RenderFont(*_fontInfo, - penPosition, - firing, - " + " - ); - } - RenderFont(*_fontInfo, - penPosition, - glm::vec4(0.3, 0.3, 0.3, 1), - " |" - ); - RenderFontCr(*_fontInfo, - penPosition, - active, - " %5s", - m.first.c_str() + firing, + " + " ); } + RenderFont(*_fontInfo, + penPosition, + glm::vec4(0.3, 0.3, 0.3, 1), + " |" + ); + RenderFontCr(*_fontInfo, + penPosition, + active, + " %5s", + m.first.c_str() + ); } } } -#endif } +#endif } } @@ -1325,9 +1321,6 @@ void RenderEngine::renderVersionInformation() { OPENSPACE_GIT_COMMIT ); - - - FR::defaultRenderer().render( *_fontInfo, glm::vec2( @@ -1366,11 +1359,11 @@ void RenderEngine::renderScreenLog() { _log->removeExpiredEntries(); const int max = 10; - const int category_length = 20; - const int msg_length = 140; + const int categoryLength = 20; + const int messageLength = 140; std::chrono::seconds fade(5); - auto entries = _log->entries(); + const std::vector& entries = _log->entries(); auto lastEntries = entries.size() > max ? std::make_pair(entries.rbegin(), entries.rbegin() + max) : @@ -1390,87 +1383,72 @@ void RenderEngine::renderScreenLog() { auto d = (diff - ttf).count(); auto t = static_cast(d) / static_cast(fade.count()); float p = 0.8f - t; - alpha = (p <= 0.f) ? 0.f : pow(p, 0.3f); + 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.0) { break; + } const std::string lvl = "(" + ghoul::logging::stringFromLevel(e->level) + ")"; - const std::string& message = e->message.substr(0, msg_length); + 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, 1.0f); + const glm::vec4 white(0.9f, 0.9f, 0.9f, alpha); RenderFont( *_fontLog, glm::vec2(10.f, _fontLog->pointSize() * nr * 2), - White * alpha, - "%-14s %s%s", // Format - e->timeString.c_str(), // Time string - e->category.substr(0, category_length).c_str(), // Category string - e->category.length() > 20 ? "..." : ""); // Pad category with "..." - - const glm::vec4 Red(1.f, 0.f, 0.f, 1.f); - const glm::vec4 Yellow(1.f, 1.f, 0.f, 1.f); - const glm::vec4 Green(0.f, 1.f, 0.f, 1.f); - const glm::vec4 Blue(0.f, 0.f, 1.f, 1.f); + white, + "%-14s %s%s", + e->timeString.c_str(), + e->category.substr(0, categoryLength).c_str(), + e->category.length() > 20 ? "..." : ""); glm::vec4 color(glm::uninitialize); switch (e->level) { case ghoul::logging::LogLevel::Debug: - color = Green; + color = glm::vec4(0.f, 1.f, 0.f, alpha); break; case ghoul::logging::LogLevel::Warning: - color = Yellow; + color = glm::vec4(1.f, 1.f, 0.f, alpha); break; case ghoul::logging::LogLevel::Error: - color = Red; + color = glm::vec4(1.f, 0.f, 0.f, alpha); break; case ghoul::logging::LogLevel::Fatal: - color = Blue; + color = glm::vec4(0.3f, 0.3f, 0.85f, alpha); break; default: - color = White; + color = white; break; } - // const float font_with_light = 5; RenderFont( *_fontLog, glm::vec2(10 + 39 * _fontLog->pointSize(), _fontLog->pointSize() * nr * 2), - color * alpha, - "%s", // Format - lvl.c_str()); // Pad category with "..." if exceeds category_length + color, + "%s", + lvl.c_str() + ); RenderFont(*_fontLog, glm::vec2(10 + 53 * _fontLog->pointSize(), _fontLog->pointSize() * nr * 2), - White * alpha, - "%s", // Format - message.c_str()); // Pad category with "..." if exceeds category_length + white, + "%s", + message.c_str() + ); ++nr; } } -std::vector RenderEngine::getSyncables(){ +std::vector RenderEngine::getSyncables() { if (_camera) { return _camera->getSyncables(); } else { - return std::vector(); + return {}; } } -void RenderEngine::sortScreenspaceRenderables() { - std::sort( - _screenSpaceRenderables.begin(), - _screenSpaceRenderables.end(), - [](const std::shared_ptr& j, - const std::shared_ptr& i) - { - return i->depth() > j->depth(); - } - ); -} - }// namespace openspace diff --git a/src/rendering/screenspacerenderable.cpp b/src/rendering/screenspacerenderable.cpp index 0a6041c06a..8cb07181e9 100644 --- a/src/rendering/screenspacerenderable.cpp +++ b/src/rendering/screenspacerenderable.cpp @@ -34,8 +34,6 @@ #include namespace { - const char* _loggerCat = "ScreenSpaceRenderable"; - const char* KeyType = "Type"; const char* KeyTag = "Tag"; const float PlaneDepth = -2.f; diff --git a/src/scene/scale.cpp b/src/scene/scale.cpp index dae3cf2ae1..da0b9efc35 100644 --- a/src/scene/scale.cpp +++ b/src/scene/scale.cpp @@ -72,12 +72,17 @@ std::unique_ptr Scale::createFromDictionary(const ghoul::Dictionary& dict Scale::Scale() : properties::PropertyOwner({ "Scale" }) + , _scale(1.0) {} bool Scale::initialize() { return true; } - + +double Scale::scaleValue() const { + return _scale; +} + void Scale::update(const UpdateData&) {} } // namespace openspace diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 783fb43e9b..c95f426223 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -143,6 +143,10 @@ void Scene::updateNodeRegistry() { _dirtyNodeRegistry = false; } +void Scene::addSceneLicense(SceneLicense license) { + _licenses.push_back(std::move(license)); +} + void Scene::sortTopologically() { _topologicallySortedNodes.insert( _topologicallySortedNodes.end(), @@ -267,7 +271,6 @@ const std::vector& Scene::allSceneGraphNodes() const { return _topologicallySortedNodes; } - SceneGraphNode* Scene::loadNode(const ghoul::Dictionary& dict) { // First interpret the dictionary std::vector dependencyNames; @@ -344,6 +347,11 @@ SceneGraphNode* Scene::loadNode(const ghoul::Dictionary& dict) { return rawNodePointer; } +void Scene::writeSceneLicenseDocumentation(const std::string& path) const { + SceneLicenseWriter writer(_licenses); + writer.writeDocumentation(path); +} + std::string Scene::generateJson() const { std::function createJson = [&createJson](properties::PropertyOwner* owner) -> std::string @@ -486,6 +494,14 @@ scripting::LuaLibrary Scene::luaLibrary() { {}, "string", "Removes the SceneGraphNode identified by name" + }, + { + "hasSceneGraphNode", + &luascriptfunctions::hasSceneGraphNode, + {}, + "string", + "Checks whether the specifies SceneGraphNode is present in the current " + "scene" } } }; diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index d6f341b6ef..ca7651bfd6 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -397,4 +397,16 @@ int removeSceneGraphNode(lua_State* L) { return 1; } + +int hasSceneGraphNode(lua_State* L) { + int nArguments = lua_gettop(L); + SCRIPT_CHECK_ARGUMENTS("removeSceneGraphNode", L, 1, nArguments); + + std::string nodeName = luaL_checkstring(L, -1); + SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(nodeName); + + lua_pushboolean(L, node != nullptr); + return 1; +} + } // namespace openspace::luascriptfunctions diff --git a/src/scene/scenelicense.cpp b/src/scene/scenelicense.cpp new file mode 100644 index 0000000000..9718e11925 --- /dev/null +++ b/src/scene/scenelicense.cpp @@ -0,0 +1,94 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2017 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#include + +#include +#include + +#include +#include +#include + +#include +#include + +namespace { + const char* LicenseKeyName = "Name"; + const char* LicenseKeyAttribution = "Attribution"; + const char* LicenseKeyUrl = "URL"; + const char* LicenseKeyLicenseText = "License"; +} // namespace + +namespace openspace { + +documentation::Documentation SceneLicense::Documentation() { + using namespace documentation; + + return { + "License Information", + "core_license", + { + { + LicenseKeyName, + new StringVerifier, + Optional::No, + "A short, descriptive name for the license employed for this node." + }, + { + LicenseKeyAttribution, + new StringVerifier, + Optional::No, + "The organization that shall be attributed to the licensed content." + }, + { + LicenseKeyUrl, + new StringVerifier, + Optional::Yes, + "The URL pointing to the original license." + }, + { + LicenseKeyLicenseText, + new StringVerifier, + Optional::No, + "The full text of the license agreements." + } + } + }; +} + +SceneLicense::SceneLicense(const ghoul::Dictionary& dictionary, std::string m) + : module(std::move(m)) +{ + ghoul_assert(!module.empty(), "Module name must not be empty"); + + documentation::testSpecificationAndThrow(Documentation(), dictionary, "SceneLicense"); + + name = dictionary.value(LicenseKeyName); + attribution = dictionary.value(LicenseKeyAttribution); + dictionary.getValue(LicenseKeyUrl, url); + licenseText = dictionary.value(LicenseKeyLicenseText); +} + +} // namespace openspace diff --git a/src/scene/scenelicensewriter.cpp b/src/scene/scenelicensewriter.cpp new file mode 100644 index 0000000000..454ae4afbd --- /dev/null +++ b/src/scene/scenelicensewriter.cpp @@ -0,0 +1,82 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2017 * + * * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this * + * software and associated documentation files (the "Software"), to deal in the Software * + * without restriction, including without limitation the rights to use, copy, modify, * + * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to * + * permit persons to whom the Software is furnished to do so, subject to the following * + * conditions: * + * * + * The above copyright notice and this permission notice shall be included in all copies * + * or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + ****************************************************************************************/ + +#include + +#include + +namespace { + const char* MainTemplateFilename = "${OPENSPACE_DATA}/web/scenelicense/main.hbs"; + const char* SceneLicenseTemplateFilename = "${OPENSPACE_DATA}/web/scenelicense/scenelicense.hbs"; + const char* JsFilename = "${OPENSPACE_DATA}/web/scenelicense/script.js"; +} // namespace + +namespace openspace { + +SceneLicenseWriter::SceneLicenseWriter(const std::vector& licenses) + : DocumentationGenerator( + "Documentation", + "sceneLicenses", + { + { "sceneLicenseTemplate", SceneLicenseTemplateFilename }, + { "mainTemplate", MainTemplateFilename } + }, + JsFilename + ) + , _licenses(licenses) +{} + +std::string SceneLicenseWriter::generateJson() const { + std::stringstream json; + json << "["; + for (const SceneLicense& license : _licenses) { + json << "{"; + json << "\"module\": \"" << escapedJson(license.module) << "\", "; + json << "\"name\": \"" << escapedJson(license.name) << "\", "; + json << "\"attribution\": \"" << escapedJson(license.attribution) << "\", "; + json << "\"url\": \"" << escapedJson(license.url) << "\", "; + json << "\"licenseText\": \"" << escapedJson(license.licenseText) << "\""; + json << "}"; + + if (&license != &(_licenses.back())) { + json << ","; + } + } + + json << "]"; + + + std::string jsonString = ""; + for (const char& c : json.str()) { + if (c == '\'') { + jsonString += "\\'"; + } else { + jsonString += c; + } + } + + return jsonString; +} + +} // namespace openspace diff --git a/src/scene/sceneloader.cpp b/src/scene/sceneloader.cpp index 59d4f60518..8f72210c40 100644 --- a/src/scene/sceneloader.cpp +++ b/src/scene/sceneloader.cpp @@ -41,7 +41,6 @@ namespace { const char* KeyPathScene = "ScenePath"; const char* KeyAssets = "Assets"; const char* AssetExtension = ".asset"; - const char* KeyCamera = "Camera"; const char* KeyCameraFocus = "Focus"; const char* KeyCameraPosition = "Position"; diff --git a/src/scene/translation.cpp b/src/scene/translation.cpp index 03d07c7aba..5b41e97a63 100644 --- a/src/scene/translation.cpp +++ b/src/scene/translation.cpp @@ -73,6 +73,7 @@ std::unique_ptr Translation::createFromDictionary( Translation::Translation() : properties::PropertyOwner({ "Translation" }) + , _positionValue(glm::dvec3(0.0)) {} bool Translation::initialize() { @@ -81,6 +82,10 @@ bool Translation::initialize() { void Translation::update(const UpdateData&) {} +glm::dvec3 Translation::position() const { + return _positionValue; +} + glm::dvec3 Translation::position(double time) { update({ {}, diff --git a/src/util/taskloader.cpp b/src/util/taskloader.cpp index 245d17bcd2..c6780c5e55 100644 --- a/src/util/taskloader.cpp +++ b/src/util/taskloader.cpp @@ -42,7 +42,7 @@ namespace openspace { std::vector> TaskLoader::tasksFromDictionary(const ghoul::Dictionary& tasksDictionary) { std::vector> tasks; std::vector keys = tasksDictionary.keys(); - for (const std::string key : keys) { + for (const std::string& key : keys) { std::string taskName; ghoul::Dictionary subTask; if (tasksDictionary.getValue(key, taskName)) { @@ -52,7 +52,7 @@ std::vector> TaskLoader::tasksFromDictionary(const ghoul:: } else if (tasksDictionary.getValue(key, subTask)) { std::string taskType = subTask.value("Type"); std::unique_ptr task = Task::createFromDictionary(subTask); - if (task == nullptr) { + if (!task) { LERROR("Failed to create a Task object of type '" << taskType << "'"); } tasks.push_back(std::move(task)); diff --git a/src/util/timemanager.cpp b/src/util/timemanager.cpp index 27d16c2bb3..102a8d7fc0 100644 --- a/src/util/timemanager.cpp +++ b/src/util/timemanager.cpp @@ -23,7 +23,9 @@ ****************************************************************************************/ #include + #include +#include #include #include @@ -45,7 +47,7 @@ void TimeManager::preSynchronization(double dt) { } void TimeManager::consumeKeyframes(double dt) { - double now = OsEng.runTime(); + double now = OsEng.windowWrapper().applicationTime(); const std::deque>& keyframes = _timeline.keyframes(); auto firstFutureKeyframe = std::lower_bound(keyframes.begin(), keyframes.end(), now, &compareKeyframeTimeWithTime); @@ -114,10 +116,10 @@ void TimeManager::consumeKeyframes(double dt) { double parameter = (t1 - t0) / (t2 - t0); double y0 = time().j2000Seconds(); - double yPrime0 = time().deltaTime(); + // double yPrime0 = time().deltaTime(); double y2 = nextTime.j2000Seconds(); - double yPrime2 = nextTime.deltaTime(); + // double yPrime2 = nextTime.deltaTime(); double y1 = (1 - parameter) * y0 + parameter * y2; double y1Prime = (y1 - y0) / dt; diff --git a/src/util/transformationmanager.cpp b/src/util/transformationmanager.cpp index 3c5f5e442b..71cb0b04e3 100644 --- a/src/util/transformationmanager.cpp +++ b/src/util/transformationmanager.cpp @@ -26,9 +26,6 @@ #include #include -#define _USE_MATH_DEFINES -#include - namespace { const char* _loggerCat = "TransformationManager"; } // namespace @@ -53,9 +50,10 @@ TransformationManager::~TransformationManager(){ #endif } -glm::dmat3 TransformationManager::kameleonTransformationMatrix(std::string from, - std::string to, - double ephemerisTime) const +glm::dmat3 TransformationManager::kameleonTransformationMatrix( + [[maybe_unused]] const std::string& from, + [[maybe_unused]] const std::string& to, + [[maybe_unused]] double ephemerisTime) const { #ifdef OPENSPACE_MODULE_KAMELEON_ENABLED ccmc::Position in0 = {1.f, 0.f, 0.f}; @@ -80,9 +78,10 @@ glm::dmat3 TransformationManager::kameleonTransformationMatrix(std::string from, #endif } -glm::dmat3 TransformationManager::frameTransformationMatrix(std::string from, - std::string to, - double ephemerisTime) const +glm::dmat3 TransformationManager::frameTransformationMatrix( + [[maybe_unused]] const std::string& from, + [[maybe_unused]] const std::string& to, + [[maybe_unused]] double ephemerisTime) const { #ifdef OPENSPACE_MODULE_KAMELEON_ENABLED auto fromit = _kameleonFrames.find(from); diff --git a/support/cmake/handle_applications.cmake b/support/cmake/handle_applications.cmake index db8393551f..df8861fd0a 100644 --- a/support/cmake/handle_applications.cmake +++ b/support/cmake/handle_applications.cmake @@ -30,17 +30,19 @@ function (handle_applications) list(REMOVE_ITEM appDirs ".DS_Store") message(STATUS "Configuration application") + # First create all of the options for the applications. In case that one of the + # applications fail to include later, we still want all of them listed foreach (app ${appDirs}) set(app_dir "${OPENSPACE_APPS_DIR}/${app}") string(TOUPPER ${app} upper_app) - option(OPENSPACE_APPLICATION_${upper_app} "${app} Application" OFF) - get_application_attribute_default(${app_dir} is_default_application) - if (${is_default_application}) - option(OPENSPACE_APPLICATION_${upper_app} "Build ${app} application" ${is_default_application}) - endif () + option(OPENSPACE_APPLICATION_${upper_app} "Build ${app} application" ${is_default_application}) + endforeach () + foreach (app ${appDirs}) + set(app_dir "${OPENSPACE_APPS_DIR}/${app}") + string(TOUPPER ${app} upper_app) if (OPENSPACE_APPLICATION_${upper_app}) message(STATUS "Adding application ${app}") add_subdirectory(${app_dir})