mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-07 20:09:58 -05:00
Merge branch 'develop' into feature/iSWA
This commit is contained in:
+21
@@ -89,6 +89,9 @@ data/scene/earth/textures/earth_bluemarble.jpg
|
||||
data/scene/earth/textures/earth_bluemarble_height.jpg
|
||||
data/scene/earth/textures/earth_night.jpg
|
||||
data/scene/earth/textures/marker.png
|
||||
data/scene/earth/textures/earth_clouds.jpg
|
||||
data/scene/earth/textures/earth_reflectance.png
|
||||
data/scene/moon/textures/Moon16k.dds
|
||||
data/scene/newhorizons/jupiter/europa/textures/europa.jpg
|
||||
data/scene/newhorizons/jupiter/ganymede/textures/ganymede.jpg
|
||||
data/scene/newhorizons/jupiter/io/textures/io.jpg
|
||||
@@ -129,3 +132,21 @@ data/scene/milkyway-eso/textures/eso0932a_blend.png
|
||||
data/scene/stars-denver/denver_colorbv.cmap
|
||||
data/scene/stars-denver/speck/stars.speck
|
||||
data/scene/stars-denver/textures/halo.png
|
||||
data/scene/newhorizons/pluto/pluto/full_images/
|
||||
data/scene/rosetta/67P/rosettaimages/
|
||||
data/spice/RosettaKernels_New/
|
||||
data/scene/newhorizons/pluto/charon/utcEvents.txt
|
||||
data/scene/rosetta/67P/obj/67P_HD_2015-05-09.obj
|
||||
data/scene/rosetta/67P/obj/may9_map.jpg
|
||||
data/scene/rosetta/67P/textures/may9_map.jpg
|
||||
data/scene/newhorizons/pluto/charon/textures/cpdem-Mcolor2-MLorriCA-lr-5_ZMfs-cyl.jpg
|
||||
data/scene/newhorizons/pluto/charon/textures/cpmap_cyl_HR_0e.jpg
|
||||
data/scene/volumetricmilkyway/milkyway/
|
||||
ScriptLog.txt
|
||||
data/scene/atmosphereearth/textures/ToastMapOfEarth.jpg
|
||||
data/scene/atmosphereearth/textures/earth_bluemarble.jpg
|
||||
data/scene/atmosphereearth/textures/earth_bluemarble_height.jpg
|
||||
data/scene/atmosphereearth/textures/earth_clouds.jpg
|
||||
data/scene/atmosphereearth/textures/earth_night.jpg
|
||||
data/scene/atmosphereearth/textures/earth_reflectance.png
|
||||
data/scene/atmosphereearth/textures/marker.png
|
||||
|
||||
@@ -191,6 +191,7 @@ void MainWindow::initialize() {
|
||||
|
||||
ghoul::logging::LogManager::initialize(ghoul::logging::LogManager::LogLevel::Debug);
|
||||
LogMgr.addLog( std::make_unique< ghoul::logging::ConsoleLog >() );
|
||||
// TODO: This can crash the system in cases where the logfile can't be created ---abock
|
||||
LogMgr.addLog( std::make_unique< ghoul::logging::HTMLLog >("LauncherLog.html", ghoul::logging::HTMLLog::Append::No) );
|
||||
LogMgr.addLog( std::make_unique< QLog >() );
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
<!-- 16:9 aspect ratio -->
|
||||
<Size x="1280" y="720" />
|
||||
<Res x="1280" y="720" />
|
||||
<!-- <Size x="960" y="540" /> -->
|
||||
<!-- <Size x="640" y="360" /> -->
|
||||
<!--<Size x="640" y="310" />-->
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
scene elements have been initialized, thus they should be used to set the time at
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
|
||||
openspace.time.setTime(openspace.time.currentWallTime())
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after all objects in the scene have been
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", true)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", true)
|
||||
openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
|
||||
if openspace.modules.isLoaded("ISWA") then
|
||||
openspace.iswa.addCdfFiles("${OPENSPACE_DATA}/cdflist.json");
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
ScenePath = ".",
|
||||
CommonFolder = "common",
|
||||
Camera = {
|
||||
Focus = "Earth",
|
||||
Position = {1, 0, 0, 2},
|
||||
},
|
||||
Modules = {
|
||||
"sun",
|
||||
"earth",
|
||||
"stars",
|
||||
--"stars-denver",
|
||||
"milkyway",
|
||||
-- "milkyway-eso",
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
FileRequest = {
|
||||
{ Identifier = "earth_textures", Destination = "textures", Version = 2 }
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
return {
|
||||
-- Earth barycenter module
|
||||
{
|
||||
Name = "EarthBarycenter",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Static = true,
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "EARTH BARYCENTER",
|
||||
Reference = "ECLIPJ2000",
|
||||
Observer = "SUN",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
|
||||
}
|
||||
},
|
||||
},
|
||||
-- Earth module
|
||||
{
|
||||
Name = "Earth",
|
||||
Parent = "EarthBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_EARTH",
|
||||
Body = "EARTH",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 6.371, 6 },
|
||||
Segments = 100
|
||||
},
|
||||
Shadow_Group = {
|
||||
Source1 = {
|
||||
Name = "Sun",
|
||||
-- All radius in meters
|
||||
Radius = {696.3, 6}
|
||||
},
|
||||
--Source2 = { Name = "Monolith", Radius = {0.01, 6} },
|
||||
Caster1 = {
|
||||
Name = "Moon",
|
||||
-- All radius in meters
|
||||
Radius = {1.737, 6}
|
||||
},
|
||||
--Caster2 = { Name = "Independency Day Ship", Radius = {0.0, 0.0} }
|
||||
},
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/earth_bluemarble.jpg",
|
||||
Night = "textures/earth_night.jpg",
|
||||
--Height = "textures/earth_bluemarble_height.jpg",
|
||||
-- Depth = "textures/earth_depth.png",
|
||||
Reflectance = "textures/earth_reflectance.png",
|
||||
Clouds = "textures/earth_clouds.jpg"
|
||||
},
|
||||
Atmosphere = {
|
||||
-- Atmosphere radius in Km
|
||||
AtmoshereRadius = 6420,
|
||||
--AtmoshereRadius = 6390,
|
||||
--PlanetRadius = 6371,
|
||||
PlanetRadius = 6360,
|
||||
PlanetAverageGroundReflectance = 0.1,
|
||||
Rayleigh = {
|
||||
Coefficients = {
|
||||
-- Wavelengths are given in 10^-9m
|
||||
Wavelengths = {680, 550, 440},
|
||||
-- Reflection coefficients are given in km^-1
|
||||
Scattering = {5.8e-3, 1.35e-2, 3.31e-2},
|
||||
-- In Rayleigh scattering, the coefficients of absorption and scattering are the same.
|
||||
},
|
||||
-- Thichkness of atmosphere if its density were uniform, in Km
|
||||
H_R = 8.0,
|
||||
},
|
||||
-- Default
|
||||
Mie = {
|
||||
Coefficients = {
|
||||
-- Reflection coefficients are given in km^-1
|
||||
Scattering = {4e-3, 4e-3, 4e-3},
|
||||
--Scattering = {2e-5, 2e-5, 2e-5},
|
||||
-- Extinction coefficients are a fraction of the Scattering coefficients
|
||||
Extinction = {4e-3/0.9, 4e-3/0.9, 4e-3/0.9}
|
||||
-- Height scale (atmosphere thickness for constant density) in Km
|
||||
},
|
||||
H_M = 1.2,
|
||||
-- Mie Phase Function Value (G e [-1.0, 1.0]. If G = 1.0, Mie phase function = Rayleigh Phase Function)
|
||||
G = 1.0,
|
||||
},
|
||||
-- Clear Sky
|
||||
-- Mie = {
|
||||
-- Coefficients = {
|
||||
-- Scattering = {20e-3, 20e-3, 20e-3},
|
||||
-- Extinction = 1.0/0.9,
|
||||
-- }
|
||||
-- H_M = 1.2,
|
||||
-- G = 0.76,
|
||||
-- },
|
||||
-- Cloudy
|
||||
-- Mie = {
|
||||
-- Coefficients = {
|
||||
-- Scattering = {3e-3, 3e-3, 3e-3},
|
||||
-- Extinction = 1.0/0.9,
|
||||
-- }
|
||||
-- H_M = 3.0,
|
||||
-- G = 0.65,
|
||||
-- },
|
||||
}
|
||||
},
|
||||
|
||||
GuiName = "/Solar/Planets/Earth"
|
||||
},
|
||||
-- EarthTrail module
|
||||
{
|
||||
Name = "EarthTrail",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderableTrail",
|
||||
Body = "EARTH",
|
||||
Frame = "GALACTIC",
|
||||
Observer = "SUN",
|
||||
RGB = { 0.5, 0.8, 1.0},
|
||||
TropicalOrbitPeriod = 365.242,
|
||||
EarthOrbitRatio = 1,
|
||||
DayLength = 24
|
||||
},
|
||||
GuiName = "/Solar/EarthTrail"
|
||||
},
|
||||
{
|
||||
Name = "EarthMarker",
|
||||
Parent = "Earth",
|
||||
Renderable = {
|
||||
Type = "RenderablePlane",
|
||||
Size = {3.0, 11.0},
|
||||
Origin = "Center",
|
||||
Billboard = true,
|
||||
Texture = "textures/marker.png"
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
Position = {0, 0, 0, 5}
|
||||
}
|
||||
}
|
||||
-- Plane
|
||||
-- {
|
||||
-- Name = "EarthPlane",
|
||||
-- Parent = "Earth",
|
||||
-- Renderable = {
|
||||
-- Type = "RenderablePlane",
|
||||
-- Billboard = true,
|
||||
-- Size = { 6.371, 6 },
|
||||
-- Texture = "textures/graph.jpg",
|
||||
-- Atmosphere = {
|
||||
-- Type = "Nishita", -- for example, values missing etc etc
|
||||
-- MieFactor = 1.0,
|
||||
-- MieColor = {1.0, 1.0, 1.0}
|
||||
-- }
|
||||
-- },
|
||||
-- Ephemeris = {
|
||||
-- Type = "Static",
|
||||
-- Position = { 6.371*2, 0, 0, 6},
|
||||
-- },
|
||||
-- }
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
return {
|
||||
-- Earth barycenter module
|
||||
{
|
||||
Name = "EarthBarycenter",
|
||||
Parent = "Root",
|
||||
Static = true,
|
||||
--[[
|
||||
Ephemeris = {
|
||||
Type = "Kepler",
|
||||
Inclination = 0.00041,
|
||||
AscendingNode = 349.2,
|
||||
Perihelion = 102.8517,
|
||||
SemiMajorAxis = 1.00002,
|
||||
DailyMotion = 0.9855796,
|
||||
Eccentricity = 0.0166967,
|
||||
MeanLongitude = 328.40353
|
||||
}
|
||||
--]]
|
||||
Ephemeris = {
|
||||
Type = "Static"
|
||||
}
|
||||
},
|
||||
-- RenderableGlobe module
|
||||
{
|
||||
Name = "DebugGlobe",
|
||||
Parent = "Root",
|
||||
Renderable = {
|
||||
Type = "RenderableGlobe",
|
||||
Frame = "IAU_EARTH",
|
||||
Body = "EARTH",
|
||||
Radii = {6378137.0, 6378137.0, 6356752.314245}, -- Earth's radii
|
||||
SegmentsPerPatch = 64,
|
||||
TextureInitData = {
|
||||
ColorTextureMinimumSize = 1024,
|
||||
OverlayMinimumSize = 2048,
|
||||
HeightMapMinimumSize = 64,
|
||||
},
|
||||
Textures = {
|
||||
ColorTextures = {
|
||||
{
|
||||
Name = "Temporal VIIRS SNPP",
|
||||
FilePath = "map_service_configs/Temporal_VIIRS_SNPP_CorrectedReflectance_TrueColor.xml",
|
||||
Enabled = false,
|
||||
},
|
||||
{
|
||||
Name = "Temporal MODIS Aqua CorrectedRecflectance TrueColor",
|
||||
FilePath = "map_service_configs/Temporal_MODIS_Aqua_CorrectedReflectance_TrueColor.xml",
|
||||
Enabled = false,
|
||||
},
|
||||
{
|
||||
Name = "MODIS_Terra_CorrectedReflectance_TrueColor",
|
||||
FilePath = "map_service_configs/MODIS_Terra_CorrectedReflectance_TrueColor.xml",
|
||||
Enabled = false,
|
||||
},
|
||||
{
|
||||
Name = "ESRI Imagery World 2D",
|
||||
FilePath = "map_service_configs/ESRI_Imagery_World_2D.wms",
|
||||
Enabled = true,
|
||||
},
|
||||
},
|
||||
NightTextures = {
|
||||
{
|
||||
Name = "Earth at Night 2012",
|
||||
FilePath = "map_service_configs/VIIRS_CityLights_2012.xml",
|
||||
Enabled = false,
|
||||
},
|
||||
},
|
||||
HeightMaps = {
|
||||
{
|
||||
Name = "Terrain tileset",
|
||||
FilePath = "map_service_configs/TERRAIN.wms",
|
||||
Enabled = true,
|
||||
},
|
||||
},
|
||||
WaterMasks = {
|
||||
{
|
||||
Name = "MODIS_Water_Mask",
|
||||
FilePath = "map_service_configs/MODIS_Water_Mask.xml",
|
||||
Enabled = false,
|
||||
},
|
||||
},
|
||||
Overlays = {
|
||||
{
|
||||
Name = "Coastlines",
|
||||
FilePath = "map_service_configs/Coastlines.xml",
|
||||
Enabled = false,
|
||||
},
|
||||
{
|
||||
Name = "Reference_Features",
|
||||
FilePath = "map_service_configs/Reference_Features.xml",
|
||||
Enabled = false,
|
||||
},
|
||||
{
|
||||
Name = "Reference_Labels",
|
||||
FilePath = "map_service_configs/Reference_Labels.xml",
|
||||
Enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
--[[
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "EARTH",
|
||||
Reference = "ECLIPJ2000",
|
||||
Observer = "SUN",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
|
||||
}
|
||||
},
|
||||
--]]
|
||||
GuiName = "/Solar/Planets/DebugGlobe"
|
||||
},
|
||||
--[[
|
||||
-- EarthTrail module
|
||||
{
|
||||
Name = "EarthTrail",
|
||||
Parent = "EarthBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderableTrail",
|
||||
Body = "EARTH",
|
||||
Frame = "GALACTIC",
|
||||
Observer = "SUN",
|
||||
RGB = { 0.5, 0.8, 1.0},
|
||||
TropicalOrbitPeriod = 365.242,
|
||||
EarthOrbitRatio = 1,
|
||||
DayLength = 24
|
||||
},
|
||||
GuiName = "/Solar/EarthTrail"
|
||||
},
|
||||
--]]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
FileRequest = {
|
||||
{ Identifier = "earth_textures", Destination = "textures", Version = 1 }
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/ASTER_GDEM_Greyscale_Shaded_Relief/default/2016-05-16/EPSG4326_31m/${z}/${y}/${x}.jpg</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>12</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>1</BandsCount>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/Coastlines/default/2013-08-21/EPSG4326_250m/${z}/${y}/${x}.png</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>9</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>4</BandsCount>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,24 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/${z}/${y}/${x}</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<TileLevel>15</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
<MaxConnections>5</MaxConnections>
|
||||
<!--
|
||||
<Cache>
|
||||
<Path>./gdalwmscache</Path>
|
||||
<Depth>2</Depth>
|
||||
<Extension>.jpg</Extension>
|
||||
</Cache>
|
||||
<OfflineMode>true</OfflineMode>
|
||||
-->
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/MODIS_Aqua_CorrectedReflectance_TrueColor/default/2013-08-21/EPSG4326_250m/${z}/${y}/${x}.jpg</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/MLS_O3_46hPa_Day/default/2013-08-21/EPSG4326_2km/${z}/${y}/${x}.png</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>5</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>4</BandsCount>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/MODIS_Terra_Brightness_Temp_Band31_Day/default/2013-08-21/EPSG4326_1km/${z}/${y}/${x}.png</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>4</BandsCount>
|
||||
</GDAL_WMS>
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/MODIS_Terra_CorrectedReflectance_TrueColor/default/2016-05-16/EPSG4326_250m/${z}/${y}/${x}.jpg</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/MODIS_Water_Mask/default/2013-08-21/EPSG4326_250m/${z}/${y}/${x}.png</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>7</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>4</BandsCount>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/Reference_Features/default/2013-08-21/EPSG4326_250m/${z}/${y}/${x}.png</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>9</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>4</BandsCount>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/Reference_Labels/default/2013-08-21/EPSG4326_250m/${z}/${y}/${x}.png</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>9</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>4</BandsCount>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,13 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TiledWMS">
|
||||
<ServerUrl>http://198.102.45.23/arcgis/rest/services/worldelevation3d/terrain3d?</ServerUrl>
|
||||
<TiledGroupName>GCS_Elevation</TiledGroupName>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<YOrigin>bottom</YOrigin>
|
||||
</DataWindow>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,8 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TiledWMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/twms-geo/twms.cgi?</ServerUrl>
|
||||
<TiledGroupName>MODIS TERRA tileset</TiledGroupName>
|
||||
<Change key="${time}">2016-04-12</Change>
|
||||
</Service>
|
||||
<MaxConnections>20</MaxConnections>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,36 @@
|
||||
<OpenSpaceTemporalGDALDataset>
|
||||
<OpenSpaceTimeStart>2012-05-08</OpenSpaceTimeStart>
|
||||
<OpenSpaceTimeEnd></OpenSpaceTimeEnd>
|
||||
<OpenSpaceTimeResolution>1d</OpenSpaceTimeResolution>
|
||||
<OpenSpaceTimeIdFormat>YYYY-MM-DD</OpenSpaceTimeIdFormat>
|
||||
<GDAL_WMS>
|
||||
<Service name="WMS">
|
||||
<Version>1.1.1</Version>
|
||||
<ServerUrl>http://map2.vis.earthdata.nasa.gov/wms/wms.php?TIME=${OpenSpaceTimeId}</ServerUrl>
|
||||
<SRS>EPSG:4326</SRS>
|
||||
<ImageFormat>image/png</ImageFormat>
|
||||
<Transparent>TRUE</Transparent>
|
||||
<Layers>Aqua_Orbit_Asc</Layers>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
</GDAL_WMS>
|
||||
</OpenSpaceTemporalGDALDataset>
|
||||
<!--
|
||||
https://map2.vis.earthdata.nasa.gov/wms/wms.php?TIME=2014-07-17&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=Aqua_Orbit_Asc&WIDTH=512&HEIGHT=512&SRS=EPSG%3A4326&STYLES=&BBOX=46.125%2C48.375%2C46.6875%2C48.9375
|
||||
|
||||
|
||||
https://map2.vis.earthdata.nasa.gov/wms/wms.php?TIME=2015-11-23&service=WMS&request=GetMap&version=1.1.1&layers=Aqua_Orbit_Asc&styles=&srs=EPSG:4326&transparent=FALSE&format=image/png&width=512&height=512&bbox=-180.00000000,18.00000000,-108.00000000,90.00000000
|
||||
-->
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<OpenSpaceTemporalGDALDataset>
|
||||
<OpenSpaceTimeStart>2012-05-08</OpenSpaceTimeStart>
|
||||
<OpenSpaceTimeEnd></OpenSpaceTimeEnd>
|
||||
<OpenSpaceTimeResolution>1d</OpenSpaceTimeResolution>
|
||||
<OpenSpaceTimeIdFormat>YYYY-MM-DD</OpenSpaceTimeIdFormat>
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/MODIS_Aqua_CorrectedReflectance_TrueColor/default/${OpenSpaceTimeId}/EPSG4326_250m/${z}/${y}/${x}.jpg</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
</GDAL_WMS>
|
||||
</OpenSpaceTemporalGDALDataset>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<OpenSpaceTemporalGDALDataset>
|
||||
<OpenSpaceTimeStart>2015-11-24</OpenSpaceTimeStart>
|
||||
<OpenSpaceTimeEnd></OpenSpaceTimeEnd>
|
||||
<OpenSpaceTimeResolution>1d</OpenSpaceTimeResolution>
|
||||
<OpenSpaceTimeIdFormat>YYYY-MM-DD</OpenSpaceTimeIdFormat>
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/VIIRS_SNPP_CorrectedReflectance_TrueColor/default/${OpenSpaceTimeId}/EPSG4326_250m/${z}/${y}/${x}.jpg</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
</GDAL_WMS>
|
||||
</OpenSpaceTemporalGDALDataset>
|
||||
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/VIIRS_CityLights_2012/default/2012-01-01/EPSG4326_500m/${z}/${y}/${x}.jpg</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>4</BandsCount>
|
||||
</GDAL_WMS>
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="TMS">
|
||||
<ServerUrl>http://map1.vis.earthdata.nasa.gov/wmts-geo/VIIRS_SNPP_CorrectedReflectance_TrueColor/default/2016-05-16/EPSG4326_250m/${z}/${y}/${x}.jpg</ServerUrl>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90</UpperLeftY>
|
||||
<LowerRightX>396.0</LowerRightX>
|
||||
<LowerRightY>-198</LowerRightY>
|
||||
<TileLevel>8</TileLevel>
|
||||
<TileCountX>2</TileCountX>
|
||||
<TileCountY>1</TileCountY>
|
||||
<YOrigin>top</YOrigin>
|
||||
</DataWindow>
|
||||
<Projection>EPSG:4326</Projection>
|
||||
<BlockSizeX>512</BlockSizeX>
|
||||
<BlockSizeY>512</BlockSizeY>
|
||||
<BandsCount>3</BandsCount>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,7 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="VirtualEarth">
|
||||
<ServerUrl>http://a${server_num}.ortho.tiles.virtualearth.net/tiles/a${quadkey}.jpeg?g=90</ServerUrl>
|
||||
</Service>
|
||||
<MaxConnections>4</MaxConnections>
|
||||
<Cache/>
|
||||
</GDAL_WMS>
|
||||
@@ -0,0 +1,17 @@
|
||||
<GDAL_WMS>
|
||||
<Service name="WMS">
|
||||
<ServerUrl>http://192.168.1.167/OnMars/wms.cgi?</ServerUrl>
|
||||
<ImageFormat>image/png</ImageFormat>
|
||||
<Layers>Mars Mola elevation</Layers>
|
||||
</Service>
|
||||
<DataWindow>
|
||||
<UpperLeftX>-180.0</UpperLeftX>
|
||||
<UpperLeftY>90.0</UpperLeftY>
|
||||
<LowerRightX>180.0</LowerRightX>
|
||||
<LowerRightY>-90.0</LowerRightY>
|
||||
<SizeX>2666666</SizeX>
|
||||
<SizeY>1333333</SizeY>
|
||||
<YOrigin>bottom</YOrigin>
|
||||
</DataWindow>
|
||||
<DataType>Int16</DataType>
|
||||
</GDAL_WMS>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 159 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 645 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
@@ -0,0 +1,89 @@
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
scene elements have been initialized, thus they should be used to set the time at
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
|
||||
--YYYY-MM-DDTHH:MN:SS
|
||||
--openspace.time.setTime(openspace.time.currentWallTime())
|
||||
--[[
|
||||
-- March 9, 2016 total eclipse times from land
|
||||
-- Palembang, South Sumatra, Indonesia
|
||||
-- Partial solar eclipse begins: 6:20 a.m. local Western Indonesian Time
|
||||
-- Total solar eclipse begins: 7:20 a.m. local time
|
||||
-- Maximum eclipse: 7:21 a.m. local time
|
||||
-- Total solar eclipse ends: 7:22 a.m. local time
|
||||
-- Partial solar eclipse ends: 8:31 a.m. local time
|
||||
|
||||
-- 6:20 -> 23:20 day before in UTC
|
||||
]]--
|
||||
openspace.time.setTime("2016-03-08T22:45:00")
|
||||
|
||||
|
||||
-- Total Lunar Eclipse Jan 31, 2018 at 10:51:13 UTC
|
||||
-- Regions seeing, at least, some parts of the eclipse: North/East Europe,
|
||||
-- Asia, Australia, North/East Africa, North America, North/East South America,
|
||||
-- Pacific, Atlantic, Indian Ocean, Arctic, Antarctica.
|
||||
--openspace.time.setTime("2018-01-31T10:30:00")
|
||||
|
||||
--openspace.time.setDeltaTime(200.0)
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after all objects in the scene have been
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", false)
|
||||
--openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTrail.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTexture.renderable.enabled", false)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
return {
|
||||
ScenePath = ".",
|
||||
CommonFolder = "common",
|
||||
Camera = {
|
||||
Focus = "Earth",
|
||||
--Focus = "Moon",
|
||||
Position = {1, 0, 0, 5},
|
||||
},
|
||||
Modules = {
|
||||
"sun",
|
||||
"mercury",
|
||||
"venus",
|
||||
"earth",
|
||||
"moon",
|
||||
"mars",
|
||||
--"jupiter",
|
||||
"saturn",
|
||||
"uranus",
|
||||
"neptune",
|
||||
"stars",
|
||||
-- "stars-denver",
|
||||
"milkyway",
|
||||
-- "milkyway-eso",
|
||||
--"constellationbounds",
|
||||
-- "fieldlines",
|
||||
--"io",
|
||||
--"europa",
|
||||
--"ganymede",
|
||||
--"callisto",
|
||||
--"gridGalactic",
|
||||
--"gridEcliptic",
|
||||
--"gridEquatorial",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,6 @@ function postInitialization()
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
|
||||
openspace.setPerformanceMeasurement(true)
|
||||
|
||||
if openspace.modules.isLoaded("ISWA") then
|
||||
|
||||
openspace.iswa.addCdfFiles("${OPENSPACE_DATA}/cdflist.json");
|
||||
@@ -57,25 +55,18 @@ return {
|
||||
},
|
||||
Modules = {
|
||||
"sun",
|
||||
--"mercury",
|
||||
--"venus",
|
||||
"mercury",
|
||||
"venus",
|
||||
"earth",
|
||||
--"mars",
|
||||
--"jupiter",
|
||||
--"saturn",
|
||||
--"uranus",
|
||||
--"neptune",
|
||||
"mars",
|
||||
"jupiter",
|
||||
"saturn",
|
||||
"uranus",
|
||||
"neptune",
|
||||
"stars",
|
||||
--"stars-denver",
|
||||
"milkyway",
|
||||
--"milkyway-eso",
|
||||
"constellationbounds",
|
||||
--"io",
|
||||
--"europa",
|
||||
--"ganymede",
|
||||
--"callisto",
|
||||
--"gridGalactic",
|
||||
--"gridEcliptic",
|
||||
--"gridEquatorial",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return {
|
||||
FileRequest = {
|
||||
{ Identifier = "earth_textures", Destination = "textures", Version = 1 }
|
||||
{ Identifier = "earth_textures", Destination = "textures", Version = 2 }
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
+17
-33
@@ -4,21 +4,15 @@ return {
|
||||
Name = "EarthBarycenter",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Static = true,
|
||||
--[[
|
||||
Ephemeris = {
|
||||
Type = "Kepler",
|
||||
Inclination = 0.00041,
|
||||
AscendingNode = 349.2,
|
||||
Perihelion = 102.8517,
|
||||
SemiMajorAxis = 1.00002,
|
||||
DailyMotion = 0.9855796,
|
||||
Eccentricity = 0.0166967,
|
||||
MeanLongitude = 328.40353
|
||||
}
|
||||
--]]
|
||||
Ephemeris = {
|
||||
Type = "Static"
|
||||
}
|
||||
Type = "Spice",
|
||||
Body = "EARTH BARYCENTER",
|
||||
Reference = "ECLIPJ2000",
|
||||
Observer = "SUN",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
|
||||
}
|
||||
},
|
||||
},
|
||||
-- Earth module
|
||||
{
|
||||
@@ -27,7 +21,7 @@ return {
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_EARTH",
|
||||
Body = "EARTH",
|
||||
Body = "EARTH",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 6.371, 6 },
|
||||
@@ -36,30 +30,20 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/earth_bluemarble.jpg",
|
||||
Night = "textures/earth_night.jpg",
|
||||
Height = "textures/earth_bluemarble_height.jpg"
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "EARTH",
|
||||
Reference = "ECLIPJ2000",
|
||||
Observer = "SUN",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
|
||||
Night = "textures/earth_night.jpg",
|
||||
--Height = "textures/earth_bluemarble_height.jpg",
|
||||
-- Depth = "textures/earth_depth.png",
|
||||
Reflectance = "textures/earth_reflectance.png",
|
||||
Clouds = "textures/earth_clouds.jpg"
|
||||
}
|
||||
},
|
||||
|
||||
GuiName = "/Solar/Planets/Earth"
|
||||
},
|
||||
-- EarthTrail module
|
||||
{
|
||||
Name = "EarthTrail",
|
||||
Parent = "EarthBarycenter",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderableTrail",
|
||||
Body = "EARTH",
|
||||
@@ -82,7 +66,7 @@ return {
|
||||
Billboard = true,
|
||||
Texture = "textures/marker.png"
|
||||
},
|
||||
Ephemeris = {
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
Position = {0, 0, 0, 5}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,13 @@ return {
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableMultiresVolume",
|
||||
ReferenceFrame = "HEEQ",
|
||||
Translation = {0, 0, 0},
|
||||
Rotation = {2.1, 0, 0},
|
||||
Scaling = {1.1, 1.1, 1.1},
|
||||
ScalingExponent = 13,
|
||||
Source = "tsp/enlil_nh_128_128_16.tsp",
|
||||
ErrorHistogramsSource = "tsp/enlil_nh_128_128_16.errorHistograms",
|
||||
ErrorHistogramsSource = "tsp/enlil_nh_128_128_16_50.errorHistograms",
|
||||
TransferFunction = "transferfunctions/fire.txt",
|
||||
BrickSelector = "tf",
|
||||
},
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
scene elements have been initialized, thus they should be used to set the time at
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
|
||||
openspace.time.setTime("2015 JAN 01 12:00:00.000")
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after all objects in the scene have been
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
ScenePath = ".",
|
||||
CommonFolder = "common",
|
||||
Camera = {
|
||||
Focus = "Earth",
|
||||
Position = {1, 0, 0, 5},
|
||||
},
|
||||
Modules = {
|
||||
"sun",
|
||||
"mercury",
|
||||
"venus",
|
||||
"earth",
|
||||
"mars",
|
||||
"jupiter",
|
||||
"saturn",
|
||||
"uranus",
|
||||
"neptune",
|
||||
"stars",
|
||||
"fieldlines",
|
||||
-- "stars-denver",
|
||||
"milkyway",
|
||||
-- "milkyway-eso",
|
||||
"constellationbounds",
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
scene elements have been initialized, thus they should be used to set the time at
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
|
||||
--openspace.time.setTime("2015 NOV 24 00:00:00")
|
||||
openspace.time.setTime(openspace.time.currentWallTime())
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
|
||||
--openspace.bindKey("v", "openspace.setPropertyValue('DebugGlobe.saveOrThrowCamera', true)")
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
openspace.setInteractionMode('GlobeBrowsingInteractionMode')
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
ScenePath = ".",
|
||||
CommonFolder = "common",
|
||||
Camera = {
|
||||
Focus = "DebugGlobe",
|
||||
Position = {1, 0, 0, 8},
|
||||
},
|
||||
Modules = {
|
||||
"debugglobe",
|
||||
"stars",
|
||||
"milkyway",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/callisto.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -16,11 +16,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/europa.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -16,11 +16,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/ganymede.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -16,11 +16,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/io.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -30,11 +30,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/jupiter.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Static" -- jupiter is at its barycenter
|
||||
|
||||
@@ -25,11 +25,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/mars.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -25,11 +25,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/mercury.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
FileRequest = {
|
||||
{ Identifier = "moon_textures", Destination = "textures", Version = 1 }
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
return {
|
||||
-- Moon module
|
||||
{
|
||||
Name = "Moon",
|
||||
Parent = "EarthBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderablePlanet",
|
||||
Frame = "IAU_MOON",
|
||||
Body = "MOON",
|
||||
Geometry = {
|
||||
Type = "SimpleSphere",
|
||||
Radius = { 1.737, 6},
|
||||
Segments = 100
|
||||
},
|
||||
Shadow_Group = {
|
||||
Source1 = {
|
||||
Name = "Sun",
|
||||
Radius = {696.3, 6}
|
||||
},
|
||||
Caster1 = {
|
||||
Name = "Earth",
|
||||
Radius = {6.371, 6}
|
||||
},
|
||||
},
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/Moon16K.dds",
|
||||
--Color = "textures/moonmap4k.jpg",
|
||||
},
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "MOON",
|
||||
Reference = "ECLIPJ2000",
|
||||
Observer = "EARTH BARYCENTER",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
|
||||
}
|
||||
},
|
||||
Rotation = {
|
||||
Type = "Spice",
|
||||
Frame = "IAU_MOON",
|
||||
Reference = "ECLIPJ2000"
|
||||
},
|
||||
GuiName = "/Solar/Planets/MOON"
|
||||
},
|
||||
-- MoonTrail module
|
||||
{
|
||||
Name = "MoonTrail",
|
||||
Parent = "EarthBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderableTrail",
|
||||
Body = "MOON",
|
||||
Frame = "GALACTIC",
|
||||
Observer = "EARTH BARYCENTER",
|
||||
RGB = { 0.5, 0.3, 0.3 },
|
||||
TropicalOrbitPeriod = 60,
|
||||
EarthOrbitRatio = 0.01,
|
||||
DayLength = 1.0,
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "${COMMON_MODULE}/textures/glare_blue.png",
|
||||
-- need to add different texture
|
||||
},
|
||||
},
|
||||
GuiName = "/Solar/MoonTrail"
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/neptune.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -18,11 +18,6 @@ return {
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "CALLISTO",
|
||||
|
||||
@@ -18,11 +18,6 @@ return {
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "EUROPA",
|
||||
|
||||
@@ -18,11 +18,6 @@ return {
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "GANYMEDE",
|
||||
|
||||
@@ -18,11 +18,6 @@ return {
|
||||
Project = "textures/defaultProj.png",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
Observer = "NEW HORIZONS",
|
||||
Target = "IO",
|
||||
|
||||
@@ -32,11 +32,6 @@ return {
|
||||
Project = "textures/lorriTest1.jpg",
|
||||
Sequencing = "true",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
},
|
||||
Projection = {
|
||||
--Sequence = "F:/JupiterFullSequence",
|
||||
Sequence = "${OPENSPACE_DATA}/scene/newhorizons/jupiter/jupiter/ProjectionsOfInterest",
|
||||
|
||||
@@ -25,11 +25,6 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/gray.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
|
||||
@@ -25,11 +25,6 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/gray.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
|
||||
@@ -25,11 +25,6 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/gray.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
|
||||
@@ -50,7 +50,7 @@ return {
|
||||
Sequencing = "true"
|
||||
},
|
||||
Projection = {
|
||||
Sequence = "${OPENSPACE_DATA}/scene/newhorizons/pluto/pluto/full_images",
|
||||
Sequence = "${OPENSPACE_DATA}/scene/newhorizons/pluto/pluto/images",
|
||||
EventFile = "${OPENSPACE_DATA}/scene/newhorizons/pluto/pluto/assets/core_v9h_obs_getmets_v8_time_fix_nofrcd_mld.txt",
|
||||
SequenceType = "hybrid",
|
||||
Observer = "NEW HORIZONS",
|
||||
|
||||
@@ -25,11 +25,6 @@ return {
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/gray.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
|
||||
@@ -25,11 +25,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/saturn.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -25,11 +25,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/uranus.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -25,11 +25,6 @@ return {
|
||||
Type = "simple",
|
||||
Color = "textures/venus.jpg",
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
scene elements have been initialized, thus they should be used to set the time at
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
|
||||
openspace.time.setTime(openspace.time.currentWallTime())
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after all objects in the scene have been
|
||||
created and initialized, but before the first render call. This is the place to set
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", true)
|
||||
-- openspace.setPropertyValue("EarthMarker.renderable.enabled", true)
|
||||
-- openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
|
||||
|
||||
-- openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
-- openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
ScenePath = ".",
|
||||
CommonFolder = "common",
|
||||
Camera = {
|
||||
Focus = "Volumetric Milky Way",
|
||||
Position = {1, 0, 0, 5},
|
||||
},
|
||||
Modules = {
|
||||
"volumetricmilkyway"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
return {
|
||||
TorrentFiles = {
|
||||
{ File = "milkyway.torrent", Destination = "." }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
local kiloparsec = 3.086 * 10^19;
|
||||
|
||||
return {
|
||||
{
|
||||
Name = "Volumetric Milky Way",
|
||||
Parent = "Root",
|
||||
Ephemeris = {
|
||||
Type = "Static",
|
||||
Position = {0, 0, 0, 0}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableGalaxy",
|
||||
Translation = {0, 0, 0},
|
||||
Volume = {
|
||||
Filename = "${OPENSPACE_DATA}/scene/volumetricmilkyway/milkyway/milkyway_512_512_64_RGBA32F.volume",
|
||||
Dimensions = {512, 512, 64},
|
||||
Size = {50 * kiloparsec, 50 * kiloparsec, 12.5 * kiloparsec},
|
||||
},
|
||||
Points = {
|
||||
Filename = "${OPENSPACE_DATA}/scene/volumetricmilkyway/milkyway/milkyway_points.binary",
|
||||
Scaling = {kiloparsec, kiloparsec, kiloparsec}
|
||||
}
|
||||
},
|
||||
GuiName = "/VolumetricMilkyWay"
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,10 @@ public:
|
||||
static const std::string KeyLuaDocumentationType;
|
||||
/// The key that stores the save location of the Lua documentation
|
||||
static const std::string KeyLuaDocumentationFile;
|
||||
/// The key that stores the type of scripting log that should be stored
|
||||
static const std::string KeyScriptLogType;
|
||||
/// The key that stores the save location of the scripting log
|
||||
static const std::string KeyScriptLogFile;
|
||||
/// The key that stores the type of Property documentation that should be stored
|
||||
static const std::string KeyPropertyDocumentationType;
|
||||
/// The key that stores the save location of the Property documentation
|
||||
|
||||
@@ -50,6 +50,7 @@ class RenderEngine;
|
||||
class SyncBuffer;
|
||||
class ModuleEngine;
|
||||
class WindowWrapper;
|
||||
class SettingsEngine;
|
||||
|
||||
namespace interaction { class InteractionHandler; }
|
||||
namespace gui { class GUI; }
|
||||
@@ -130,13 +131,14 @@ private:
|
||||
std::unique_ptr<ghoul::cmdparser::CommandlineParser> _commandlineParser;
|
||||
std::unique_ptr<LuaConsole> _console;
|
||||
std::unique_ptr<ModuleEngine> _moduleEngine;
|
||||
std::unique_ptr<SettingsEngine> _settingsEngine;
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
std::unique_ptr<gui::GUI> _gui;
|
||||
#endif
|
||||
std::unique_ptr<network::ParallelConnection> _parallelConnection;
|
||||
std::unique_ptr<WindowWrapper> _windowWrapper;
|
||||
std::unique_ptr<ghoul::fontrendering::FontManager> _fontManager;
|
||||
|
||||
|
||||
// Others
|
||||
std::unique_ptr<properties::PropertyOwner> _globalPropertyNamespace;
|
||||
std::unique_ptr<SyncBuffer> _syncBuffer;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __SETTINGSENGINE_H__
|
||||
#define __SETTINGSENGINE_H__
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
#include <openspace/properties/scalarproperty.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class SettingsEngine : public properties::PropertyOwner {
|
||||
public:
|
||||
SettingsEngine();
|
||||
|
||||
private:
|
||||
properties::FloatProperty _eyeSeparation;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
#endif //#ifndef __SETTINGSENGINE_H__
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
glm::mat4 viewProjectionMatrix() const override;
|
||||
glm::mat4 modelMatrix() const override;
|
||||
void setNearFarClippingPlane(float near, float far) override;
|
||||
void setEyeSeparationDistance(float distance) override;
|
||||
|
||||
glm::ivec4 viewportPixelCoordinates() const override;
|
||||
|
||||
|
||||
@@ -147,6 +147,12 @@ public:
|
||||
*/
|
||||
virtual void setNearFarClippingPlane(float near, float far);
|
||||
|
||||
/**
|
||||
* Sets the stereo eye separation distance for the render engine.
|
||||
* \param distance The distance between eyes for stereo rendering.
|
||||
*/
|
||||
virtual void setEyeSeparationDistance(float distance);
|
||||
|
||||
/**
|
||||
* Returns the location and size of the current viewport (<code>x</code>,
|
||||
* <code>width</code>, <code>y</code>, and <code>height</code>). If there is only a
|
||||
|
||||
@@ -30,8 +30,12 @@
|
||||
#include <openspace/network/parallelconnection.h>
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/mouse.h>
|
||||
#include <openspace/util/keys.h>
|
||||
|
||||
#include <list>
|
||||
#include <modules/globebrowsing/globes/renderableglobe.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace openspace {
|
||||
@@ -41,62 +45,44 @@ class SceneGraphNode;
|
||||
|
||||
namespace interaction {
|
||||
|
||||
|
||||
//#define USE_OLD_INTERACTIONHANDLER
|
||||
#ifdef USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
class InteractionHandler : public properties::PropertyOwner {
|
||||
public:
|
||||
InteractionHandler();
|
||||
|
||||
~InteractionHandler();
|
||||
|
||||
// Mutators
|
||||
void setKeyboardController(KeyboardController* controller);
|
||||
void setMouseController(MouseController* controller);
|
||||
void setFocusNode(SceneGraphNode* node);
|
||||
void setCamera(Camera* camera);
|
||||
void setInteractionSensitivity(float sensitivity);
|
||||
void resetKeyBindings();
|
||||
void setInvertRoll(bool invert);
|
||||
void setInvertRotation(bool invert);
|
||||
|
||||
void addController(Controller* controller);
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
|
||||
void bindKey(Key key, KeyModifier modifier, std::string lua);
|
||||
|
||||
void lockControls();
|
||||
void unlockControls();
|
||||
|
||||
void update(double deltaTime);
|
||||
|
||||
void setFocusNode(SceneGraphNode* node);
|
||||
|
||||
// Accessors
|
||||
const SceneGraphNode* const focusNode() const;
|
||||
void setCamera(Camera* camera);
|
||||
const Camera* const camera() const;
|
||||
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
|
||||
double deltaTime() const;
|
||||
|
||||
void orbitDelta(const glm::quat& rotation);
|
||||
|
||||
void orbit(const float &dx, const float &dy, const float &dz, const float &dist);
|
||||
|
||||
//void distance(const float &d);
|
||||
|
||||
void rotateDelta(const glm::quat& rotation);
|
||||
|
||||
void distanceDelta(const PowerScaledScalar& distance, size_t iterations = 0);
|
||||
|
||||
void lookAt(const glm::quat& rotation);
|
||||
|
||||
void setRotation(const glm::quat& rotation);
|
||||
|
||||
void resetKeyBindings();
|
||||
void bindKey(Key key, KeyModifier modifier, std::string lua);
|
||||
|
||||
void setInteractionSensitivity(float sensitivity);
|
||||
float interactionSensitivity() const;
|
||||
|
||||
void setInvertRoll(bool invert);
|
||||
bool invertRoll() const;
|
||||
|
||||
void setInvertRotation(bool invert);
|
||||
bool invertRotation() const;
|
||||
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
* interaction. The functions contained are
|
||||
@@ -106,28 +92,45 @@ public:
|
||||
*/
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
private:
|
||||
friend class Controller;
|
||||
|
||||
// Callback functions
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
|
||||
// Interaction functions
|
||||
void orbitDelta(const glm::quat& rotation);
|
||||
void orbit(const float &dx, const float &dy, const float &dz, const float &dist);
|
||||
void rotateDelta(const glm::quat& rotation);
|
||||
void distanceDelta(const PowerScaledScalar& distance, size_t iterations = 0);
|
||||
void lookAt(const glm::quat& rotation);
|
||||
void setRotation(const glm::quat& rotation);
|
||||
|
||||
private:
|
||||
// Remove copy and move constructors
|
||||
InteractionHandler(const InteractionHandler&) = delete;
|
||||
InteractionHandler& operator=(const InteractionHandler&) = delete;
|
||||
InteractionHandler(InteractionHandler&&) = delete;
|
||||
InteractionHandler& operator=(InteractionHandler&&) = delete;
|
||||
|
||||
Camera* _camera;
|
||||
SceneGraphNode* _focusNode;
|
||||
|
||||
double _deltaTime;
|
||||
std::mutex _mutex;
|
||||
|
||||
bool _validKeyLua;
|
||||
|
||||
std::multimap<KeyWithModifier, std::string > _keyLua;
|
||||
|
||||
// Settings
|
||||
float _controllerSensitivity;
|
||||
bool _invertRoll;
|
||||
bool _invertRotation;
|
||||
|
||||
// Pointers to entities to affect
|
||||
Camera* _camera;
|
||||
SceneGraphNode* _focusNode;
|
||||
|
||||
// Cached data
|
||||
double _deltaTime;
|
||||
std::mutex _mutex;
|
||||
|
||||
//bool _validKeyLua;
|
||||
std::multimap<KeyWithModifier, std::string > _keyLua;
|
||||
|
||||
|
||||
KeyboardController* _keyboardController;
|
||||
MouseController* _mouseController;
|
||||
std::vector<Controller*> _controllers;
|
||||
@@ -141,6 +144,216 @@ private:
|
||||
std::mutex _keyframeMutex;
|
||||
};
|
||||
|
||||
#else // USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
|
||||
class InputState
|
||||
{
|
||||
public:
|
||||
InputState();
|
||||
~InputState();
|
||||
|
||||
// Callback functions
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double mouseX, double mouseY);
|
||||
void mouseScrollWheelCallback(double mouseScrollDelta);
|
||||
|
||||
// Mutators
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
|
||||
// Accessors
|
||||
const std::list<std::pair<Key, KeyModifier> >& getPressedKeys();
|
||||
const std::list<MouseButton>& getPressedMouseButtons();
|
||||
glm::dvec2 getMousePosition();
|
||||
double getMouseScrollDelta();
|
||||
std::vector<network::datamessagestructures::PositionKeyframe>& getKeyFrames();
|
||||
|
||||
bool isKeyPressed(std::pair<Key, KeyModifier> keyModPair);
|
||||
bool isMouseButtonPressed(MouseButton mouseButton);
|
||||
private:
|
||||
// Input from keyboard and mouse
|
||||
std::list<std::pair<Key, KeyModifier> > _keysDown;
|
||||
std::list<MouseButton> _mouseButtonsDown;
|
||||
glm::dvec2 _mousePosition;
|
||||
double _mouseScrollDelta;
|
||||
|
||||
// Remote input via keyframes
|
||||
std::vector<network::datamessagestructures::PositionKeyframe> _keyframes;
|
||||
std::mutex _keyframeMutex;
|
||||
};
|
||||
|
||||
class InteractionMode
|
||||
{
|
||||
public:
|
||||
InteractionMode(std::shared_ptr<InputState> inputState);
|
||||
~InteractionMode();
|
||||
|
||||
// Mutators
|
||||
virtual void setFocusNode(SceneGraphNode* focusNode);
|
||||
void setCamera(Camera* camera);
|
||||
|
||||
// Accessors
|
||||
SceneGraphNode* focusNode();
|
||||
Camera* camera();
|
||||
|
||||
virtual void update(double deltaTime) = 0;
|
||||
protected:
|
||||
/**
|
||||
Inner class that acts as a smoothing filter to a variable. The filter has a step
|
||||
response on a form that resembles the function y = 1-e^(-t/scale). The variable
|
||||
will be updates as soon as it is set to a value (calling the set() function).
|
||||
*/
|
||||
template <typename T, typename ScaleType>
|
||||
class delayedVariable {
|
||||
public:
|
||||
delayedVariable(ScaleType scale) {
|
||||
_scale = scale;
|
||||
}
|
||||
void set(T value) {
|
||||
_targetValue = value;
|
||||
_currentValue = _currentValue + (_targetValue - _currentValue) * _scale;
|
||||
}
|
||||
T get() {
|
||||
return _currentValue;
|
||||
}
|
||||
private:
|
||||
ScaleType _scale;
|
||||
T _targetValue;
|
||||
T _currentValue;
|
||||
};
|
||||
|
||||
struct MouseState {
|
||||
MouseState(double scale)
|
||||
: velocity(scale)
|
||||
, previousPosition(0.0, 0.0) {}
|
||||
glm::dvec2 previousPosition;
|
||||
delayedVariable<glm::dvec2, double> velocity;
|
||||
};
|
||||
|
||||
std::shared_ptr<InputState> _inputState;
|
||||
SceneGraphNode* _focusNode;
|
||||
Camera* _camera;
|
||||
};
|
||||
|
||||
class KeyframeInteractionMode : public InteractionMode
|
||||
{
|
||||
public:
|
||||
KeyframeInteractionMode(std::shared_ptr<InputState> inputState);
|
||||
~KeyframeInteractionMode();
|
||||
|
||||
virtual void update(double deltaTime);
|
||||
private:
|
||||
double _currentKeyframeTime;
|
||||
};
|
||||
|
||||
class OrbitalInteractionMode : public InteractionMode
|
||||
{
|
||||
public:
|
||||
OrbitalInteractionMode(
|
||||
std::shared_ptr<InputState> inputState,
|
||||
double sensitivity,
|
||||
double velocityScaleFactor);
|
||||
~OrbitalInteractionMode();
|
||||
|
||||
virtual void update(double deltaTime);
|
||||
protected:
|
||||
void updateMouseStatesFromInput(double deltaTime);
|
||||
void updateCameraStateFromMouseStates();
|
||||
|
||||
double _sensitivity;
|
||||
|
||||
MouseState _globalRotationMouseState;
|
||||
MouseState _localRotationMouseState;
|
||||
MouseState _truckMovementMouseState;
|
||||
MouseState _rollMouseState;
|
||||
|
||||
glm::dquat _localCameraRotation;
|
||||
glm::dquat _globalCameraRotation;
|
||||
};
|
||||
|
||||
class GlobeBrowsingInteractionMode : public OrbitalInteractionMode
|
||||
{
|
||||
public:
|
||||
GlobeBrowsingInteractionMode(
|
||||
std::shared_ptr<InputState> inputState,
|
||||
double sensitivity,
|
||||
double velocityScaleFactor);
|
||||
~GlobeBrowsingInteractionMode();
|
||||
|
||||
virtual void setFocusNode(SceneGraphNode* focusNode);
|
||||
virtual void update(double deltaTime);
|
||||
private:
|
||||
void updateCameraStateFromMouseStates();
|
||||
RenderableGlobe* _globe;
|
||||
};
|
||||
|
||||
|
||||
class InteractionHandler : public properties::PropertyOwner
|
||||
{
|
||||
public:
|
||||
InteractionHandler();
|
||||
~InteractionHandler();
|
||||
|
||||
// Mutators
|
||||
void setFocusNode(SceneGraphNode* node);
|
||||
void setCamera(Camera* camera);
|
||||
|
||||
// Interaction mode setters
|
||||
void setInteractionModeToOrbital();
|
||||
void setInteractionModeToGlobeBrowsing();
|
||||
|
||||
void resetKeyBindings();
|
||||
|
||||
void addKeyframe(const network::datamessagestructures::PositionKeyframe &kf);
|
||||
void clearKeyframes();
|
||||
|
||||
void bindKey(Key key, KeyModifier modifier, std::string lua);
|
||||
void lockControls();
|
||||
void unlockControls();
|
||||
|
||||
void update(double deltaTime);
|
||||
|
||||
// Accessors
|
||||
SceneGraphNode* const focusNode() const;
|
||||
Camera* const camera() const;
|
||||
std::shared_ptr<InputState> inputState() const;
|
||||
|
||||
/**
|
||||
* Returns the Lua library that contains all Lua functions available to affect the
|
||||
* interaction. The functions contained are
|
||||
* - openspace::luascriptfunctions::setOrigin
|
||||
* \return The Lua library that contains all Lua functions available to affect the
|
||||
* interaction
|
||||
*/
|
||||
static scripting::ScriptEngine::LuaLibrary luaLibrary();
|
||||
|
||||
// Callback functions
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
|
||||
private:
|
||||
void setInteractionMode(std::shared_ptr<InteractionMode> interactionMode);
|
||||
|
||||
std::multimap<KeyWithModifier, std::string > _keyLua;
|
||||
|
||||
std::shared_ptr<InputState> _inputState;
|
||||
|
||||
std::shared_ptr<InteractionMode> _currentInteractionMode;
|
||||
|
||||
std::shared_ptr<OrbitalInteractionMode> _orbitalInteractionMode;
|
||||
std::shared_ptr<GlobeBrowsingInteractionMode> _globebrowsingInteractionMode;
|
||||
|
||||
// Properties
|
||||
properties::StringProperty _origin;
|
||||
properties::StringProperty _coordinateSystem;
|
||||
};
|
||||
|
||||
#endif // USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
} // namespace interaction
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
|
||||
//#define USE_OLD_INTERACTIONHANDLER
|
||||
#ifdef USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
#ifndef __MOUSECONTROLLER_H__
|
||||
#define __MOUSECONTROLLER_H__
|
||||
|
||||
@@ -101,4 +105,7 @@ private:
|
||||
} // namespace interaction
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __MOUSECONTROLLER_H__
|
||||
#endif // __MOUSECONTROLLER_H__
|
||||
|
||||
|
||||
#endif // USE_OLD_INTERACTIONHANDLER
|
||||
|
||||
@@ -48,9 +48,9 @@ namespace properties {
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultMaximumValue<TYPE>(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultSteppingValue<TYPE>(); \
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultSteppingValue<TYPE>(); \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
@@ -133,12 +133,12 @@ namespace properties {
|
||||
return DEFAULT_MAX_VALUE; \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::defaultSteppingValue<TYPE>() \
|
||||
{ \
|
||||
{ \
|
||||
return DEFAULT_STEPPING; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
@@ -283,16 +283,20 @@ template <typename T>
|
||||
bool NumericalProperty<T>::setLuaValue(lua_State* state)
|
||||
{
|
||||
bool success = false;
|
||||
T value = PropertyDelegate<NumericalProperty<T>>::template fromLuaValue<T>(state, success);
|
||||
T value = PropertyDelegate<NumericalProperty<T>>::template fromLuaValue<T>(
|
||||
state, success
|
||||
);
|
||||
if (success)
|
||||
TemplateProperty<T>::setValue(value);
|
||||
TemplateProperty<T>::setValue(std::move(value));
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool NumericalProperty<T>::getLuaValue(lua_State* state) const
|
||||
{
|
||||
bool success = PropertyDelegate<NumericalProperty<T>>::template toLuaValue<T>(state, TemplateProperty<T>::_value);
|
||||
bool success = PropertyDelegate<NumericalProperty<T>>::template toLuaValue<T>(
|
||||
state, TemplateProperty<T>::_value
|
||||
);
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -303,16 +307,20 @@ int NumericalProperty<T>::typeLua() const {
|
||||
|
||||
template <typename T>
|
||||
bool NumericalProperty<T>::getStringValue(std::string& value) const {
|
||||
bool success = PropertyDelegate<NumericalProperty<T>>::template toString<T>(value, TemplateProperty<T>::_value);
|
||||
bool success = PropertyDelegate<NumericalProperty<T>>::template toString<T>(
|
||||
value, TemplateProperty<T>::_value
|
||||
);
|
||||
return success;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool NumericalProperty<T>::setStringValue(std::string value) {
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<NumericalProperty<T>>::template fromString<T>(value, success);
|
||||
T thisValue = PropertyDelegate<NumericalProperty<T>>::template fromString<T>(
|
||||
value, success
|
||||
);
|
||||
if (success)
|
||||
TemplateProperty<T>::set(ghoul::any(thisValue));
|
||||
TemplateProperty<T>::set(ghoul::any(std::move(thisValue)));
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace properties {
|
||||
|
||||
REGISTER_TEMPLATEPROPERTY_HEADER(BoolProperty, bool);
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(CharProperty, char);
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(WCharProperty, wchar_t);
|
||||
//REGISTER_NUMERICALPROPERTY_HEADER(WCharProperty, wchar_t);
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(SignedCharProperty, signed char);
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(UCharProperty, unsigned char);
|
||||
REGISTER_NUMERICALPROPERTY_HEADER(ShortProperty, short);
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
static Renderable* createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
// constructors & destructor
|
||||
Renderable();
|
||||
Renderable(const ghoul::Dictionary& dictionary);
|
||||
virtual ~Renderable();
|
||||
|
||||
|
||||
@@ -102,6 +102,8 @@ public:
|
||||
|
||||
bool writeDocumentation(const std::string& filename, const std::string& type) const;
|
||||
|
||||
bool writeLog(const std::string& script);
|
||||
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
@@ -111,7 +113,9 @@ public:
|
||||
void preSynchronization();
|
||||
|
||||
void queueScript(const std::string &script);
|
||||
|
||||
|
||||
void setLogFile(const std::string& filename, const std::string& type);
|
||||
|
||||
std::vector<std::string> cachedScripts();
|
||||
|
||||
std::vector<std::string> allLuaFunctions() const;
|
||||
@@ -122,6 +126,7 @@ public:
|
||||
void cacheScript(const std::string &library, const std::string &function, const std::string &script);
|
||||
|
||||
private:
|
||||
|
||||
bool registerLuaLibrary(lua_State* state, const LuaLibrary& library);
|
||||
void addLibraryFunctions(lua_State* state, const LuaLibrary& library, bool replace);
|
||||
|
||||
@@ -142,6 +147,14 @@ private:
|
||||
//parallel variables
|
||||
std::map<std::string, std::map<std::string, std::string>> _cachedScripts;
|
||||
std::mutex _cachedScriptsMutex;
|
||||
|
||||
//logging variables
|
||||
bool _logFileExists = false;
|
||||
bool _logScripts = true;
|
||||
std::string _logType;
|
||||
std::string _logFilename;
|
||||
|
||||
|
||||
};
|
||||
|
||||
} // namespace scripting
|
||||
|
||||
+177
-146
@@ -1,26 +1,26 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __CAMERA_H__
|
||||
#define __CAMERA_H__
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
// open space includes
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
#include <openspace/util/syncbuffer.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
|
||||
// glm includes
|
||||
#include <ghoul/glm.h>
|
||||
@@ -37,147 +39,176 @@
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
namespace openspace {
|
||||
/**
|
||||
This class still needs some more love. Suggested improvements:
|
||||
- Remove psc from the camera class interface.
|
||||
- Accessors should return constant references to double precision class members.
|
||||
- Remove the scaling variable (What is it used for?)
|
||||
- Remove the maxFov and sinMaxfov variables. Redundant since the fov is embedded
|
||||
within the perspective projection matrix.
|
||||
- Remove focusposition, part of the integration with the scale graph. The
|
||||
"focus position" should not be needed since we assume the camera is always
|
||||
positioned relative to its origin. When orbiting another object (not in origin),
|
||||
the focus position should probably be handled outside the camera class
|
||||
(interaction handler) since it does not affect the state of the camera
|
||||
(only how it interacts).
|
||||
- The class might need some more reasonable accessors depending on use cases.
|
||||
(up vector world space?)
|
||||
- Make clear which function returns a combined view matrix (things that are
|
||||
dependent on the separate sgct nodes).
|
||||
*/
|
||||
class Camera {
|
||||
/**
|
||||
Used to explicitly show which variables within the Camera class that are used
|
||||
for caching.
|
||||
*/
|
||||
template<typename T>
|
||||
struct Cached
|
||||
{
|
||||
Cached() { isDirty = true; }
|
||||
T datum;
|
||||
bool isDirty;
|
||||
};
|
||||
|
||||
//class Camera {
|
||||
//public:
|
||||
// enum class ProjectionMode {
|
||||
// Perspective,
|
||||
// Orthographic,
|
||||
// Frustum,
|
||||
// FixedPerspective
|
||||
// };
|
||||
//
|
||||
// Camera();
|
||||
//
|
||||
// void setPosition(psc pos);
|
||||
// const psc& position() const;
|
||||
//
|
||||
// void setFocus(psc focus);
|
||||
// const psc& focus() const;
|
||||
//
|
||||
// void setUpVector(psc upVector);
|
||||
// const psc& upVector() const;
|
||||
//
|
||||
// void setScaling(float scaling);
|
||||
// float scaling() const;
|
||||
//
|
||||
// const glm::mat4& viewMatrix() const;
|
||||
//
|
||||
// void setProjectionMatrix(glm::mat4 projectionMatrix);
|
||||
// const glm::mat4& projectionMatrix() const;
|
||||
//
|
||||
// void setMaxFox(float fov);
|
||||
// float maxFov() const;
|
||||
//
|
||||
//
|
||||
// // derived values
|
||||
// psc lookVector() const;
|
||||
//
|
||||
//private:
|
||||
// void invalidateViewMatrix();
|
||||
// void updateViewMatrix() const; // has to be constant to be called from getter methods
|
||||
//
|
||||
// psc _position;
|
||||
// psc _focus;
|
||||
// psc _upVector;
|
||||
//
|
||||
// glm::mat4 _projectionMatrix;
|
||||
// mutable glm::mat4 _viewMatrix;
|
||||
// float _scaling;
|
||||
//
|
||||
// float _maxFov;
|
||||
//
|
||||
// mutable bool _viewMatrixIsDirty;
|
||||
//};
|
||||
// now working with float precision. To be changed to double later.
|
||||
// The reason double does not work yet is because of the setUniform function
|
||||
// in ghoul::opengl
|
||||
typedef glm::dquat Quat;
|
||||
typedef glm::dmat4 Mat4;
|
||||
typedef glm::dvec3 Vec3;
|
||||
|
||||
class SyncBuffer;
|
||||
// Static constants
|
||||
static const Vec3 _VIEW_DIRECTION_CAMERA_SPACE;
|
||||
static const Vec3 _LOOKUP_VECTOR_CAMERA_SPACE;
|
||||
public:
|
||||
Camera();
|
||||
Camera(const Camera& o);
|
||||
~Camera();
|
||||
|
||||
class Camera {
|
||||
public:
|
||||
Camera();
|
||||
~Camera();
|
||||
// Mutators
|
||||
void setPositionVec3(Vec3 pos);
|
||||
void setFocusPositionVec3(Vec3 pos);
|
||||
void setRotation(Quat rotation);
|
||||
void setScaling(glm::vec2 scaling);
|
||||
void setMaxFov(float fov);
|
||||
|
||||
void setPosition(psc pos);
|
||||
const psc& position() const;
|
||||
|
||||
const psc& unsynchedPosition() const;
|
||||
// Relative mutators
|
||||
void rotate(Quat rotation);
|
||||
|
||||
void setModelMatrix(glm::mat4 modelMatrix);
|
||||
const glm::mat4& modelMatrix() const;
|
||||
// Accessors
|
||||
// Remove Vec3 from the name when psc is gone
|
||||
const Vec3& positionVec3() const;
|
||||
const Vec3& unsynchedPositionVec3() const;
|
||||
const Vec3& focusPositionVec3() const;
|
||||
const Vec3& viewDirectionWorldSpace() const;
|
||||
const Vec3& lookUpVectorCameraSpace() const;
|
||||
const Vec3& lookUpVectorWorldSpace() const;
|
||||
const glm::vec2& scaling() const;
|
||||
const Mat4& viewRotationMatrix() const;
|
||||
const Quat& rotationQuaternion() const;
|
||||
float maxFov() const;
|
||||
float sinMaxFov() const;
|
||||
|
||||
void setViewMatrix(glm::mat4 viewMatrix);
|
||||
const glm::mat4& viewMatrix() const;
|
||||
// @TODO this should simply be called viewMatrix!
|
||||
// Or it needs to be changed so that it actually is combined. Right now it is
|
||||
// only the view matrix that is the same for all SGCT cameras.
|
||||
// Right now this function returns the actual combined matrix which makes some
|
||||
// of the old calls to the function wrong..
|
||||
const Mat4& combinedViewMatrix() const;
|
||||
|
||||
void setProjectionMatrix(glm::mat4 projectionMatrix);
|
||||
const glm::mat4& projectionMatrix() const;
|
||||
// Synchronization
|
||||
void postSynchronizationPreDraw();
|
||||
void preSynchronization();
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
|
||||
const glm::mat4& viewProjectionMatrix() const;
|
||||
/**
|
||||
Handles SGCT's internal matrices. Also caches a calculated viewProjection
|
||||
matrix. This is the data that is different for different cameras within
|
||||
SGCT.
|
||||
*/
|
||||
class SgctInternal {
|
||||
friend class Camera;
|
||||
public:
|
||||
void setViewMatrix(glm::mat4 viewMatrix);
|
||||
void setProjectionMatrix(glm::mat4 projectionMatrix);
|
||||
|
||||
void setCameraDirection(glm::vec3 cameraDirection);
|
||||
glm::vec3 cameraDirection() const;
|
||||
const glm::mat4& viewMatrix() const;
|
||||
const glm::mat4& projectionMatrix() const;
|
||||
const glm::mat4& viewProjectionMatrix() const;
|
||||
private:
|
||||
SgctInternal();
|
||||
SgctInternal(const SgctInternal& o)
|
||||
: _viewMatrix(o._viewMatrix)
|
||||
, _projectionMatrix(o._projectionMatrix)
|
||||
, _cachedViewProjectionMatrix(o._cachedViewProjectionMatrix)
|
||||
{}
|
||||
|
||||
void setFocusPosition(psc pos);
|
||||
const psc& focusPosition() const;
|
||||
// State
|
||||
glm::mat4 _viewMatrix;
|
||||
glm::mat4 _projectionMatrix;
|
||||
|
||||
void setViewRotationMatrix(glm::mat4 m);
|
||||
const glm::mat4& viewRotationMatrix() const;
|
||||
void compileViewRotationMatrix();
|
||||
// Cache
|
||||
mutable Cached<glm::mat4> _cachedViewProjectionMatrix;
|
||||
mutable std::mutex _mutex;
|
||||
} sgctInternal;
|
||||
|
||||
void rotate(const glm::quat& rotation);
|
||||
void setRotation(glm::quat rotation);
|
||||
// const glm::quat& rotation() const;
|
||||
void setRotation(glm::mat4 rotation);
|
||||
// Deprecated
|
||||
[[deprecated("Replaced by Camera::setPositionVec3()")]]
|
||||
void setPosition(psc pos);
|
||||
[[deprecated("Replaced by Camera::setFocusPositionVec3()")]]
|
||||
void setFocusPosition(psc pos);
|
||||
[[deprecated("Replaced by Camera::positionVec3()")]]
|
||||
psc position() const;
|
||||
[[deprecated("Replaced by Camera::unsynchedPositionVec3()")]]
|
||||
psc unsynchedPosition() const;
|
||||
[[deprecated("Replaced by Camera::focusPositionVec3()")]]
|
||||
psc focusPosition() const;
|
||||
// @TODO use Camera::SgctInternal interface instead
|
||||
[[deprecated("Replaced by Camera::SgctInternal::viewMatrix()")]]
|
||||
const glm::mat4& viewMatrix() const;
|
||||
[[deprecated("Replaced by Camera::SgctInternal::projectionMatrix()")]]
|
||||
const glm::mat4& projectionMatrix() const;
|
||||
[[deprecated("Replaced by Camera::SgctInternal::viewProjectionMatrix()")]]
|
||||
const glm::mat4& viewProjectionMatrix() const;
|
||||
private:
|
||||
/**
|
||||
Class encapsulating data that needs to be synched between SGCT nodes.
|
||||
Are all three variables (i.e. local, shared, synced) really neccessary? /EB
|
||||
*/
|
||||
template <typename T>
|
||||
struct SyncData {
|
||||
SyncData() {}
|
||||
SyncData(const SyncData& d)
|
||||
: local(d.local), shared(d.shared), synced(d.synced) {}
|
||||
|
||||
const glm::vec3& viewDirection() const;
|
||||
void serialize(SyncBuffer* syncBuffer) { syncBuffer->encode(shared); }
|
||||
void deserialize(SyncBuffer* syncBuffer) { syncBuffer->decode(shared); }
|
||||
void postSynchronizationPreDraw() { synced = shared; }
|
||||
void preSynchronization() { shared = local; }
|
||||
|
||||
const float& maxFov() const;
|
||||
const float& sinMaxFov() const;
|
||||
void setMaxFov(float fov);
|
||||
void setScaling(glm::vec2 scaling);
|
||||
const glm::vec2& scaling() const;
|
||||
T local;
|
||||
T shared;
|
||||
T synced;
|
||||
};
|
||||
|
||||
void setLookUpVector(glm::vec3 lookUp);
|
||||
const glm::vec3& lookUpVector() const;
|
||||
// State of the camera
|
||||
SyncData<Vec3> _position;
|
||||
SyncData<Quat> _rotation;
|
||||
SyncData<glm::vec2> _scaling;
|
||||
|
||||
void postSynchronizationPreDraw();
|
||||
void preSynchronization();
|
||||
void serialize(SyncBuffer* syncBuffer);
|
||||
void deserialize(SyncBuffer* syncBuffer);
|
||||
// _focusPosition to be removed
|
||||
Vec3 _focusPosition;
|
||||
float _maxFov;
|
||||
|
||||
private:
|
||||
float _maxFov;
|
||||
float _sinMaxFov;
|
||||
mutable glm::mat4 _viewProjectionMatrix;
|
||||
glm::mat4 _modelMatrix;
|
||||
glm::mat4 _viewMatrix;
|
||||
glm::mat4 _projectionMatrix;
|
||||
mutable bool _dirtyViewProjectionMatrix;
|
||||
glm::vec3 _viewDirection;
|
||||
glm::vec3 _cameraDirection;
|
||||
psc _focusPosition;
|
||||
// glm::quat _viewRotation;
|
||||
|
||||
glm::vec3 _lookUp;
|
||||
|
||||
mutable std::mutex _mutex;
|
||||
|
||||
//local variables
|
||||
glm::mat4 _localViewRotationMatrix;
|
||||
glm::vec2 _localScaling;
|
||||
psc _localPosition;
|
||||
|
||||
//shared copies of local variables
|
||||
glm::vec2 _sharedScaling;
|
||||
psc _sharedPosition;
|
||||
glm::mat4 _sharedViewRotationMatrix;
|
||||
|
||||
//synced copies of local variables
|
||||
glm::vec2 _syncedScaling;
|
||||
psc _syncedPosition;
|
||||
glm::mat4 _syncedViewRotationMatrix;
|
||||
|
||||
};
|
||||
// Cached data
|
||||
mutable Cached<Vec3> _cachedViewDirection;
|
||||
mutable Cached<Mat4> _cachedViewRotationMatrix;
|
||||
mutable Cached<Mat4> _cachedCombinedViewMatrix;
|
||||
mutable Cached<float> _cachedSinMaxFov;
|
||||
|
||||
mutable std::mutex _mutex;
|
||||
};
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __CAMERA_H__
|
||||
#endif // __CAMERA_H__
|
||||
@@ -42,8 +42,10 @@ public:
|
||||
PowerScaledScalar(float f1, float f2);
|
||||
static PowerScaledScalar CreatePSS(double d1);
|
||||
|
||||
const glm::vec2& vec2() const;
|
||||
float lengthf() const;
|
||||
const glm::vec2& vec2() const;
|
||||
float lengthf() const;
|
||||
double lengthd() const;
|
||||
|
||||
|
||||
// operator overloading
|
||||
PowerScaledScalar& operator=(const PowerScaledScalar& rhs);
|
||||
|
||||
@@ -58,6 +58,10 @@ class SyncBuffer;
|
||||
|
||||
class Time {
|
||||
public:
|
||||
Time(double secondsJ2000 = -1);
|
||||
Time(const Time& other);
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the Time singleton.
|
||||
* \return <code>true</code> if the initialization succeeded, <code>false</code>
|
||||
@@ -73,6 +77,8 @@ public:
|
||||
*/
|
||||
static void deinitialize();
|
||||
|
||||
static Time now();
|
||||
|
||||
/**
|
||||
* Returns the reference to the Time singleton object.
|
||||
* \return The reference to the Time singleton object
|
||||
@@ -116,6 +122,8 @@ public:
|
||||
*/
|
||||
double currentTime() const;
|
||||
|
||||
double unsyncedJ2000Seconds() const;
|
||||
|
||||
/**
|
||||
* Returns the current time as a formatted date string compliant with ISO 8601 and
|
||||
* thus also compliant with the Spice library.
|
||||
@@ -123,6 +131,12 @@ public:
|
||||
*/
|
||||
std::string currentTimeUTC() const;
|
||||
|
||||
/**
|
||||
* Returns the current time as a ISO 8601 formatted, i.e YYYY-MM-DDThh:mm:ssZ
|
||||
* \return The current time as a ISO 8601 formatted string
|
||||
*/
|
||||
std::string ISO8601() const;
|
||||
|
||||
/**
|
||||
* Sets the delta time value that is the number of seconds that should pass for each
|
||||
* real-time second. This value is used in the advanceTime(double) method to easily
|
||||
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
libgdal.1.dylib
|
||||
@@ -154,7 +154,7 @@ void RenderablePath::render(const RenderData& data) {
|
||||
|
||||
_programObject->activate();
|
||||
psc currentPosition = data.position;
|
||||
glm::mat4 camrot = data.camera.viewRotationMatrix();
|
||||
glm::mat4 camrot = glm::mat4(data.camera.viewRotationMatrix());
|
||||
glm::mat4 transform = glm::mat4(1);
|
||||
|
||||
// setup the data to the shader
|
||||
|
||||
@@ -187,7 +187,7 @@ bool RenderablePlane::deinitialize() {
|
||||
void RenderablePlane::render(const RenderData& data) {
|
||||
glm::mat4 transform = glm::mat4(1.0);
|
||||
if (_billboard)
|
||||
transform = glm::inverse(data.camera.viewRotationMatrix());
|
||||
transform = glm::inverse(glm::mat4(data.camera.viewRotationMatrix()));
|
||||
|
||||
// Activate shader
|
||||
_shader->activate();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,6 +31,11 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// ghoul includes
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
@@ -46,6 +51,53 @@ class PlanetGeometry;
|
||||
}
|
||||
|
||||
class RenderablePlanet : public Renderable {
|
||||
public:
|
||||
// Shadow structure
|
||||
typedef struct {
|
||||
std::pair<std::string, float> source;
|
||||
std::pair<std::string, float> caster;
|
||||
} ShadowConf;
|
||||
|
||||
struct ShadowRenderingStruct {
|
||||
float xu, xp;
|
||||
float rs, rc;
|
||||
glm::vec3 sourceCasterVec;
|
||||
glm::vec3 casterPositionVec;
|
||||
bool isShadowing;
|
||||
};
|
||||
|
||||
// See: Precomputed Atmospheric Scattering from Bruneton et al.
|
||||
// for explanation of the following parameters.
|
||||
|
||||
const unsigned int TRANSMITTANCE_TABLE_WIDTH = 256;
|
||||
const unsigned int TRANSMITTANCE_TABLE_HEIGHT = 64;
|
||||
|
||||
const unsigned int IRRADIANCE_TABLE_WIDTH = 64;
|
||||
const unsigned int IRRADIANCE_TABLE_HEIGHT = 16;
|
||||
|
||||
const unsigned int DELTA_E_TABLE_WIDTH = 64;
|
||||
const unsigned int DELTA_E_TABLE_HEIGHT = 16;
|
||||
|
||||
|
||||
/*const unsigned int TRANSMITTANCE_TABLE_WIDTH = 512;
|
||||
const unsigned int TRANSMITTANCE_TABLE_HEIGHT = 128;
|
||||
|
||||
const unsigned int IRRADIANCE_TABLE_WIDTH = 128;
|
||||
const unsigned int IRRADIANCE_TABLE_HEIGHT = 32;
|
||||
|
||||
const unsigned int DELTA_E_TABLE_WIDTH = 128;
|
||||
const unsigned int DELTA_E_TABLE_HEIGHT = 32;*/
|
||||
|
||||
const unsigned int R_SAMPLES = 32;
|
||||
const unsigned int MU_SAMPLES = 128;
|
||||
const unsigned int MU_S_SAMPLES = 32;
|
||||
const unsigned int NU_SAMPLES = 8;
|
||||
|
||||
/*const unsigned int R_SAMPLES = 64;
|
||||
const unsigned int MU_SAMPLES = 256;
|
||||
const unsigned int MU_S_SAMPLES = 64;
|
||||
const unsigned int NU_SAMPLES = 16;*/
|
||||
|
||||
public:
|
||||
RenderablePlanet(const ghoul::Dictionary& dictionary);
|
||||
~RenderablePlanet();
|
||||
@@ -60,15 +112,69 @@ public:
|
||||
protected:
|
||||
void loadTexture();
|
||||
|
||||
private:
|
||||
void loadComputationPrograms();
|
||||
void unloadComputationPrograms();
|
||||
void createComputationTextures();
|
||||
void deleteComputationTextures();
|
||||
void deleteUnusedComputationTextures();
|
||||
void loadAtmosphereDataIntoShaderProgram(std::unique_ptr<ghoul::opengl::ProgramObject> & shaderProg);
|
||||
void executeCalculations(const GLuint vao, const GLenum drawBuffers[2], const GLsizei vertexSize);
|
||||
void preCalculateAtmosphereParam();
|
||||
void createAtmosphereFBO();
|
||||
void createRenderQuad(GLuint * vao, GLuint * vbo, const GLfloat size);
|
||||
void renderQuadForCalc(const GLuint vao, const GLsizei size);
|
||||
void step3DTexture(std::unique_ptr<ghoul::opengl::ProgramObject> & shaderProg,
|
||||
const int layer, const bool doCalc = true);
|
||||
void saveTextureToPPMFile(const GLenum color_buffer_attachment, const std::string & fileName,
|
||||
const int width, const int height) const;
|
||||
|
||||
private:
|
||||
properties::StringProperty _colorTexturePath;
|
||||
properties::StringProperty _nightTexturePath;
|
||||
properties::StringProperty _heightMapTexturePath;
|
||||
properties::StringProperty _cloudsTexturePath;
|
||||
properties::StringProperty _reflectanceTexturePath;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _transmittanceProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _irradianceProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _irradianceSupTermsProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _inScatteringProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _inScatteringSupTermsProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaEProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaSProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaSSupTermsProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _deltaJProgramObject;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _atmosphereProgramObject;
|
||||
ghoul::opengl::TextureUnit _dummyTextureUnit;
|
||||
ghoul::opengl::TextureUnit _dummy3DTextureUnit;
|
||||
ghoul::opengl::TextureUnit _transmittanceTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _irradianceTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _inScatteringTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _deltaETableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _deltaSRayleighTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _deltaSMieTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _deltaJTableTextureUnit;
|
||||
ghoul::opengl::TextureUnit _atmosphereTextureUnit;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _nightTexture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _reflectanceTexture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _heightMapTexture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _cloudsTexture;
|
||||
GLuint _transmittanceTableTexture;
|
||||
GLuint _irradianceTableTexture;
|
||||
GLuint _inScatteringTableTexture;
|
||||
GLuint _deltaETableTexture;
|
||||
GLuint _deltaSRayleighTableTexture;
|
||||
GLuint _deltaSMieTableTexture;
|
||||
GLuint _deltaJTableTexture;
|
||||
GLuint _dummyTexture;
|
||||
GLuint _dummy3DTexture;
|
||||
GLuint _atmosphereTexture;
|
||||
GLuint _atmosphereFBO;
|
||||
GLuint _atmosphereRenderVAO;
|
||||
GLuint _atmosphereRenderVBO;
|
||||
|
||||
properties::FloatProperty _heightExaggeration;
|
||||
|
||||
@@ -76,13 +182,36 @@ private:
|
||||
properties::BoolProperty _performShading;
|
||||
properties::IntProperty _rotation;
|
||||
float _alpha;
|
||||
std::vector< ShadowConf > _shadowConfArray;
|
||||
float _planetRadius;
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
std::string _frame;
|
||||
std::string _target;
|
||||
bool _hasNightTexture;
|
||||
bool _hasReflectanceTexture;
|
||||
bool _hasHeightTexture;
|
||||
bool _hasCloudsTexture;
|
||||
bool _shadowEnabled;
|
||||
double _time;
|
||||
|
||||
// Atmosphere Data
|
||||
bool _atmosphereCalculated;
|
||||
bool _atmosphereEnabled;
|
||||
float _atmosphereRadius;
|
||||
float _atmospherePlanetRadius;
|
||||
float _planetAverageGroundReflectance;
|
||||
float _rayleighHeightScale;
|
||||
float _mieHeightScale;
|
||||
float _miePhaseConstant;
|
||||
glm::vec3 _mieExtinctionCoeff;
|
||||
glm::vec3 _rayleighScatteringCoeff;
|
||||
glm::vec3 _mieScatteringCoeff;
|
||||
|
||||
|
||||
bool tempPic;
|
||||
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -148,7 +148,7 @@ void RenderableTrail::render(const RenderData& data) {
|
||||
_programObject->activate();
|
||||
psc currentPosition = data.position;
|
||||
psc campos = data.camera.position();
|
||||
glm::mat4 camrot = data.camera.viewRotationMatrix();
|
||||
glm::mat4 camrot = glm::mat4(data.camera.viewRotationMatrix());
|
||||
|
||||
glm::mat4 transform = glm::mat4(1);
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
// Atmosphere Rendering Parameters
|
||||
uniform float Rg;
|
||||
uniform float Rt;
|
||||
uniform float AVERAGE_GROUND_REFLECTANCE;
|
||||
uniform float HR;
|
||||
uniform vec3 betaR;
|
||||
uniform float HM;
|
||||
uniform vec3 betaMSca;
|
||||
uniform vec3 betaMEx;
|
||||
uniform float mieG;
|
||||
|
||||
const float ATM_EPSILON = 1.0;
|
||||
// const float RL = Rt + 1.0;
|
||||
|
||||
// const float Rg = 6360.0;
|
||||
// const float Rt = 6420.0;
|
||||
// const float RL = 6421.0;
|
||||
// const float ATM_EPSILON = 1.0;
|
||||
|
||||
// const float AVERAGE_GROUND_REFLECTANCE = 0.1;
|
||||
|
||||
// // Rayleigh
|
||||
// const float HR = 8.0;
|
||||
// const vec3 betaR = vec3(5.8e-3, 1.35e-2, 3.31e-2);
|
||||
|
||||
// // Mie
|
||||
// // DEFAULT
|
||||
// const float HM = 1.2;
|
||||
// const vec3 betaMSca = vec3(4e-3);
|
||||
// //const vec3 betaMSca = vec3(2e-5);
|
||||
// const vec3 betaMEx = betaMSca / 0.9;
|
||||
// const float mieG = 1.0;
|
||||
|
||||
// Integration steps
|
||||
const int TRANSMITTANCE_STEPS = 500;
|
||||
const int INSCATTER_INTEGRAL_SAMPLES = 50;
|
||||
const int IRRADIANCE_INTEGRAL_SAMPLES = 32;
|
||||
const int INSCATTER_SPHERICAL_INTEGRAL_SAMPLES = 16;
|
||||
|
||||
// The next values crash NVIDIA driver for Quadro K620 -- JCC
|
||||
// const int TRANSMITTANCE_INTEGRAL_SAMPLES = 1000;
|
||||
// const int INSCATTER_INTEGRAL_SAMPLES = 100;
|
||||
// const int IRRADIANCE_INTEGRAL_SAMPLES = 64;
|
||||
// const int INSCATTER_SPHERICAL_INTEGRAL_SAMPLES = 32;
|
||||
|
||||
const float M_PI = 3.141592657;
|
||||
|
||||
const int TRANSMITTANCE_W = 256;
|
||||
const int TRANSMITTANCE_H = 64;
|
||||
|
||||
const int SKY_W = 64;
|
||||
const int SKY_H = 16;
|
||||
|
||||
const int OTHER_TEXTURES_W = 64;
|
||||
const int OTHER_TEXTURES_H = 16;
|
||||
|
||||
|
||||
const int RES_R = 32;
|
||||
const int RES_MU = 128;
|
||||
const int RES_MU_S = 32;
|
||||
const int RES_NU = 8;
|
||||
@@ -0,0 +1,501 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#define EPSILON 0.0001f
|
||||
|
||||
// Sun Irradiance
|
||||
const float ISun = 50.0;
|
||||
const uint numberOfShadows = 1;
|
||||
|
||||
struct ShadowRenderingStruct {
|
||||
float xu, xp;
|
||||
float rs, rc;
|
||||
vec3 sourceCasterVec;
|
||||
vec3 casterPositionVec;
|
||||
bool isShadowing;
|
||||
};
|
||||
|
||||
uniform ShadowRenderingStruct shadowDataArray[numberOfShadows];
|
||||
|
||||
uniform mat4 completeInverse;
|
||||
uniform mat4 projInverse;
|
||||
|
||||
uniform vec4 campos;
|
||||
uniform vec4 objpos;
|
||||
uniform vec3 sun_pos;
|
||||
|
||||
uniform vec4 cameraPosObj;
|
||||
uniform vec4 planetPositionObj;
|
||||
uniform vec3 sunPositionObj;
|
||||
|
||||
uniform bool _performShading = true;
|
||||
uniform float transparency;
|
||||
uniform int shadows;
|
||||
|
||||
uniform float screenX;
|
||||
uniform float screenY;
|
||||
uniform float screenWIDTH;
|
||||
uniform float screenHEIGHT;
|
||||
|
||||
uniform float time;
|
||||
uniform sampler2D texture1;
|
||||
uniform sampler2D nightTex;
|
||||
uniform sampler2D cloudsTexture;
|
||||
|
||||
uniform sampler2D reflectanceTexture;
|
||||
uniform sampler2D transmittanceTexture;
|
||||
uniform sampler2D irradianceTexture;
|
||||
uniform sampler3D inscatterTexture;
|
||||
|
||||
in vec2 vs_st;
|
||||
in vec2 vs_nightTex;
|
||||
in vec4 vs_normal;
|
||||
in vec4 vs_position;
|
||||
in vec4 vs_posWorld;
|
||||
|
||||
#include "hdr.glsl"
|
||||
#include "PowerScaling/powerScaling_fs.hglsl"
|
||||
#include "fragment.glsl"
|
||||
#include "atmosphere_common.glsl"
|
||||
|
||||
vec4 butterworthFunc(const float d, const float r, const float n) {
|
||||
return vec4(vec3(sqrt(r/(r + pow(d, 2*n)))), 1.0);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
****** ALL CALCULATIONS FOR ATMOSPHERE ARE KM AND IN OBJECT SPACE SYSTEM ******
|
||||
*******************************************************************************/
|
||||
|
||||
/* Calculates the intersection of the view ray direction with the atmosphere and
|
||||
* returns the first intersection (0.0 when inside atmosphere): offset
|
||||
* and the second intersection: maxLength
|
||||
*/
|
||||
|
||||
struct Ray {
|
||||
vec4 origin;
|
||||
vec4 direction;
|
||||
};
|
||||
|
||||
struct Ellipsoid {
|
||||
vec4 center;
|
||||
vec4 size;
|
||||
};
|
||||
|
||||
bool intersectEllipsoid(const Ray ray, const Ellipsoid ellipsoid, out float offset, out float maxLength) {
|
||||
vec4 O_C = ray.origin-ellipsoid.center;
|
||||
vec4 dir = normalize(ray.direction);
|
||||
|
||||
offset = 0.0f;
|
||||
maxLength = 0.0f;
|
||||
|
||||
float a =
|
||||
((dir.x*dir.x)/(ellipsoid.size.x*ellipsoid.size.x))
|
||||
+ ((dir.y*dir.y)/(ellipsoid.size.y*ellipsoid.size.y))
|
||||
+ ((dir.z*dir.z)/(ellipsoid.size.z*ellipsoid.size.z));
|
||||
float b =
|
||||
((2.f*O_C.x*dir.x)/(ellipsoid.size.x*ellipsoid.size.x))
|
||||
+ ((2.f*O_C.y*dir.y)/(ellipsoid.size.y*ellipsoid.size.y))
|
||||
+ ((2.f*O_C.z*dir.z)/(ellipsoid.size.z*ellipsoid.size.z));
|
||||
float c =
|
||||
((O_C.x*O_C.x)/(ellipsoid.size.x*ellipsoid.size.x))
|
||||
+ ((O_C.y*O_C.y)/(ellipsoid.size.y*ellipsoid.size.y))
|
||||
+ ((O_C.z*O_C.z)/(ellipsoid.size.z*ellipsoid.size.z))
|
||||
- 1.f;
|
||||
|
||||
float d = ((b*b)-(4.f*a*c));
|
||||
if ( d<0.f || a==0.f || b==0.f || c==0.f )
|
||||
return false;
|
||||
|
||||
d = sqrt(d);
|
||||
|
||||
float t1 = (-b+d)/(2.f*a);
|
||||
float t2 = (-b-d)/(2.f*a);
|
||||
|
||||
if( t1<=EPSILON && t2<=EPSILON )
|
||||
return false; // both intersections are behind the ray origin
|
||||
|
||||
bool back = (t1<=EPSILON || t2<=EPSILON); // If only one intersection (t>0) then we are inside the ellipsoid and the intersection is at the back of the ellipsoid
|
||||
float t=0.f;
|
||||
if( t1<=EPSILON )
|
||||
t = t2;
|
||||
else
|
||||
if( t2<=EPSILON )
|
||||
t = t1;
|
||||
else
|
||||
t=(t1<t2) ? t1 : t2;
|
||||
|
||||
if( t<EPSILON ) return false; // Too close to intersection
|
||||
|
||||
vec4 intersection = ray.origin + t*dir;
|
||||
vec4 normal = intersection-ellipsoid.center;
|
||||
normal.x = 2.f*normal.x/(ellipsoid.size.x*ellipsoid.size.x);
|
||||
normal.y = 2.f*normal.y/(ellipsoid.size.y*ellipsoid.size.y);
|
||||
normal.z = 2.f*normal.z/(ellipsoid.size.z*ellipsoid.size.z);
|
||||
|
||||
normal.w = 0.f;
|
||||
normal *= (back) ? -1.f : 1.f;
|
||||
normal = normalize(normal);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool intersectAtmosphere(const vec4 planetPos, const vec3 rayDirection, const float sphereRadius,
|
||||
out float offset, out float maxLength) {
|
||||
offset = 0.0f;
|
||||
maxLength = 0.0f;
|
||||
|
||||
vec3 l = planetPos.xyz - cameraPosObj.xyz;
|
||||
float s = dot(l, rayDirection);
|
||||
float l2 = dot(l, l);
|
||||
|
||||
// sphereRadius in Km
|
||||
float r = sphereRadius - EPSILON; // EPSILON to avoid surface acne
|
||||
float r2 = r * r;
|
||||
|
||||
if (l2 <= r2) {
|
||||
// ray origin inside sphere
|
||||
float m2 = l2 - (s*s);
|
||||
float q = sqrt(r2 - m2);
|
||||
maxLength = s + q;
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (s >= 0.0) {
|
||||
// ray outside sphere
|
||||
float m2 = l2 - (s*s);
|
||||
if (m2 <= r2) {
|
||||
// ray hits atmosphere
|
||||
float q = sqrt(r2 - m2);
|
||||
offset = s-q;
|
||||
maxLength = (s+q)-offset;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Rayleigh phase function
|
||||
float phaseFunctionR(float mu) {
|
||||
return (3.0 / (16.0 * M_PI)) * (1.0 + mu * mu);
|
||||
}
|
||||
|
||||
// Mie phase function
|
||||
float phaseFunctionM(float mu) {
|
||||
return 1.5 * 1.0 / (4.0 * M_PI) * (1.0 - mieG*mieG) * pow(1.0 + (mieG*mieG) - 2.0*mieG*mu, -3.0/2.0) * (1.0 + mu * mu) / (2.0 + mieG*mieG);
|
||||
}
|
||||
|
||||
float opticalDepth(float H, float r, float mu, float d) {
|
||||
float a = sqrt((0.5/H)*r);
|
||||
vec2 a01 = a*vec2(mu, mu + d / r);
|
||||
vec2 a01s = sign(a01);
|
||||
vec2 a01sq = a01*a01;
|
||||
float x = a01s.y > a01s.x ? exp(a01sq.x) : 0.0;
|
||||
vec2 y = a01s / (2.3193*abs(a01) + sqrt(1.52*a01sq + 4.0)) * vec2(1.0, exp(-d/H*(d/(2.0*r)+mu)));
|
||||
return sqrt((6.2831*H)*r) * exp((Rg-r)/H) * (x + dot(y, vec2(1.0, -1.0)));
|
||||
}
|
||||
|
||||
vec4 texture4D(sampler3D table, float r, float mu, float muS, float nu)
|
||||
{
|
||||
float H = sqrt(Rt * Rt - Rg * Rg);
|
||||
float rho = sqrt(r * r - Rg * Rg);
|
||||
float rmu = r * mu;
|
||||
float delta = rmu * rmu - r * r + Rg * Rg;
|
||||
vec4 cst = rmu < 0.0 && delta > 0.0 ? vec4(1.0, 0.0, 0.0, 0.5 - 0.5 / float(RES_MU)) : vec4(-1.0, H * H, H, 0.5 + 0.5 / float(RES_MU));
|
||||
float uR = 0.5 / float(RES_R) + rho / H * (1.0 - 1.0 / float(RES_R));
|
||||
float uMu = cst.w + (rmu * cst.x + sqrt(delta + cst.y)) / (rho + cst.z) * (0.5 - 1.0 / float(RES_MU));
|
||||
float uMuS = 0.5 / float(RES_MU_S) + (atan(max(muS, -0.1975) * tan(1.26 * 1.1)) / 1.1 + (1.0 - 0.26)) * 0.5 * (1.0 - 1.0 / float(RES_MU_S));
|
||||
float lerp = (nu + 1.0) / 2.0 * (float(RES_NU) - 1.0);
|
||||
float uNu = floor(lerp);
|
||||
lerp = lerp - uNu;
|
||||
return texture(table, vec3((uNu + uMuS) / float(RES_NU), uMu, uR)) * (1.0 - lerp) +
|
||||
texture(table, vec3((uNu + uMuS + 1.0) / float(RES_NU), uMu, uR)) * lerp;
|
||||
}
|
||||
|
||||
vec3 analyticTransmittance(float r, float mu, float d) {
|
||||
return exp(- betaR * opticalDepth(HR, r, mu, d) - betaMEx * opticalDepth(HM, r, mu, d));
|
||||
}
|
||||
|
||||
vec3 getMie(vec4 rayMie) {
|
||||
return rayMie.rgb * rayMie.a / max(rayMie.r, 1e-4) * (betaR.r / betaR);
|
||||
}
|
||||
|
||||
vec2 getTransmittanceUV(float r, float mu) {
|
||||
float uR, uMu;
|
||||
uR = sqrt((r - Rg) / (Rt - Rg));
|
||||
uMu = atan((mu + 0.15) / (1.0 + 0.15) * tan(1.5)) / 1.5;
|
||||
return vec2(uMu, uR);
|
||||
}
|
||||
|
||||
vec3 transmittanceFromTexture(float r, float mu) {
|
||||
vec2 uv = getTransmittanceUV(r, mu);
|
||||
return texture(transmittanceTexture, uv).rgb;
|
||||
}
|
||||
|
||||
vec3 transmittanceWithShadow(float r, float mu) {
|
||||
return mu < -sqrt(1.0 - (Rg / r) * (Rg / r)) ? vec3(0.0) : transmittanceFromTexture(r, mu);
|
||||
}
|
||||
|
||||
vec3 transmittance(float r, float mu, vec3 v, vec3 x0) {
|
||||
vec3 result;
|
||||
float r1 = length(x0);
|
||||
float mu1 = dot(x0, v) / r;
|
||||
if (mu > 0.0) {
|
||||
result = min(transmittanceFromTexture(r, mu) /
|
||||
transmittanceFromTexture(r1, mu1), 1.0);
|
||||
} else {
|
||||
result = min(transmittanceFromTexture(r1, -mu1) /
|
||||
transmittanceFromTexture(r, -mu), 1.0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
vec2 getIrradianceUV(float r, float muS) {
|
||||
float uR = (r - Rg) / (Rt - Rg);
|
||||
float uMuS = (muS + 0.2) / (1.0 + 0.2);
|
||||
return vec2(uMuS, uR);
|
||||
}
|
||||
|
||||
vec3 irradiance(sampler2D sampler, float r, float muS) {
|
||||
vec2 uv = getIrradianceUV(r, muS);
|
||||
return texture(sampler, uv).rgb;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculates the light scattering in the view direction comming from other
|
||||
* light rays scattered in the atmosphere.
|
||||
* The view direction here is the ray: x + tv, s is the sun direction,
|
||||
* r and mu the position and zenith cossine angle as in the paper.
|
||||
*/
|
||||
vec3 inscatterLight(inout vec3 x, inout float t, vec3 v, vec3 s,
|
||||
out float r, out float mu, out vec3 attenuation) {
|
||||
vec3 result;
|
||||
r = length(x);
|
||||
mu = dot(x, v) / r;
|
||||
float d = -r * mu - sqrt(r * r * (mu * mu - 1.0) + Rt * Rt);
|
||||
if (d > 0.0) {
|
||||
x += d * v;
|
||||
t -= d;
|
||||
mu = (r * mu + d) / Rt;
|
||||
r = Rt;
|
||||
}
|
||||
// Intersects atmosphere?
|
||||
if (r <= Rt) {
|
||||
float nu = dot(v, s);
|
||||
float muS = dot(x, s) / r;
|
||||
float phaseR = phaseFunctionR(nu);
|
||||
float phaseM = phaseFunctionM(nu);
|
||||
vec4 inscatter = max(texture4D(inscatterTexture, r, mu, muS, nu), 0.0);
|
||||
if (t > 0.0) {
|
||||
vec3 x0 = x + t * v;
|
||||
float r0 = length(x0);
|
||||
float rMu0 = dot(x0, v);
|
||||
float mu0 = rMu0 / r0;
|
||||
float muS0 = dot(x0, s) / r0;
|
||||
|
||||
attenuation = analyticTransmittance(r, mu, t);
|
||||
//attenuation = transmittance(r, mu, v, x+t*v);
|
||||
|
||||
//The following Code is generating surface acne on atmosphere. JCC
|
||||
// We need a better acne avoindance constant (0.01). Done!! Adaptive from distance to x
|
||||
if (r0 > Rg + 0.1*r) {
|
||||
inscatter = max(inscatter - attenuation.rgbr * texture4D(inscatterTexture, r0, mu0, muS0, nu), 0.0);
|
||||
const float EPS = 0.004;
|
||||
float muHoriz = -sqrt(1.0 - (Rg / r) * (Rg / r));
|
||||
if (abs(mu - muHoriz) < EPS) {
|
||||
float a = ((mu - muHoriz) + EPS) / (2.0 * EPS);
|
||||
|
||||
mu = muHoriz - EPS;
|
||||
r0 = sqrt(r * r + t * t + 2.0 * r * t * mu);
|
||||
mu0 = (r * mu + t) / r0;
|
||||
vec4 inScatter0 = texture4D(inscatterTexture, r, mu, muS, nu);
|
||||
vec4 inScatter1 = texture4D(inscatterTexture, r0, mu0, muS0, nu);
|
||||
vec4 inScatterA = max(inScatter0 - attenuation.rgbr * inScatter1, 0.0);
|
||||
|
||||
mu = muHoriz + EPS;
|
||||
r0 = sqrt(r * r + t * t + 2.0 * r * t * mu);
|
||||
mu0 = (r * mu + t) / r0;
|
||||
inScatter0 = texture4D(inscatterTexture, r, mu, muS, nu);
|
||||
inScatter1 = texture4D(inscatterTexture, r0, mu0, muS0, nu);
|
||||
vec4 inScatterB = max(inScatter0 - attenuation.rgbr * inScatter1, 0.0);
|
||||
|
||||
inscatter = mix(inScatterA, inScatterB, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
inscatter.w *= smoothstep(0.00, 0.02, muS);
|
||||
result = max(inscatter.rgb * phaseR + getMie(inscatter) * phaseM, 0.0);
|
||||
|
||||
} else {
|
||||
// No intersection with earth
|
||||
result = vec3(0.0);
|
||||
}
|
||||
return result * ISun;
|
||||
}
|
||||
|
||||
vec3 groundColor(vec3 x, float t, vec3 v, vec3 s, float r, float mu, vec3 attenuation)
|
||||
{
|
||||
vec3 result;
|
||||
// Ray hits ground
|
||||
if (t > 0.0) {
|
||||
vec3 x0 = x + t * v;
|
||||
float r0 = length(x0);
|
||||
vec3 n = x0 / r0;
|
||||
|
||||
// Fixing texture coordinates:
|
||||
vec4 reflectance = texture(reflectanceTexture, vs_st) * vec4(0.2, 0.2, 0.2, 1.0);
|
||||
|
||||
// The following code is generating surface acne in ground.
|
||||
// It is only necessary inside atmosphere rendering. JCC
|
||||
// if (r0 > Rg + 0.01) {
|
||||
// reflectance = vec4(0.4, 0.4, 0.4, 0.0);
|
||||
// }
|
||||
|
||||
float muS = dot(n, s);
|
||||
vec3 sunLight = transmittanceWithShadow(r0, muS);
|
||||
|
||||
vec3 groundSkyLight = irradiance(irradianceTexture, r0, muS);
|
||||
|
||||
vec4 clouds = vec4(0.85)*texture(cloudsTexture, vs_st);
|
||||
vec3 groundColor = (reflectance.rgb + clouds.rgb) *
|
||||
(max(muS, 0.0) * sunLight + groundSkyLight) * ISun / M_PI;
|
||||
|
||||
// Yellowish reflection from sun on oceans and rivers
|
||||
if (reflectance.w > 0.0) {
|
||||
vec3 h = normalize(s - v);
|
||||
float fresnel = 0.02 + 0.98 * pow(1.0 - dot(-v, h), 5.0);
|
||||
float waterBrdf = fresnel * pow(max(dot(h, n), 0.0), 150.0);
|
||||
groundColor += reflectance.w * max(waterBrdf, 0.0) * sunLight * ISun;
|
||||
}
|
||||
|
||||
result = attenuation * groundColor;
|
||||
} else {
|
||||
// No hit
|
||||
result = vec3(0.0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
vec3 sunColor(vec3 x, float t, vec3 v, vec3 s, float r, float mu) {
|
||||
if (t > 0.0) {
|
||||
return vec3(0.0);
|
||||
} else {
|
||||
vec3 transmittance = r <= Rt ? transmittanceWithShadow(r, mu) : vec3(1.0);
|
||||
float isun = step(cos(M_PI / 180.0), dot(v, s)) * ISun;
|
||||
return transmittance * isun;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
******* CALCULATIONS FOR SHADOWS ARE IN WORLD SPACE IN METERS *********
|
||||
***********************************************************************/
|
||||
// TODO: Change calculations for view space in KM.
|
||||
vec4 calcShadow(const ShadowRenderingStruct shadowInfoArray[numberOfShadows], const vec3 position) {
|
||||
if (shadowInfoArray[0].isShadowing) {
|
||||
vec3 pc = shadowInfoArray[0].casterPositionVec - position;
|
||||
vec3 sc_norm = normalize(shadowInfoArray[0].sourceCasterVec); // we can pass this normalized to the shader
|
||||
vec3 pc_proj = dot(pc, sc_norm) * sc_norm;
|
||||
vec3 d = pc - pc_proj;
|
||||
|
||||
float length_d = length(d);
|
||||
float length_pc_proj = length(pc_proj);
|
||||
|
||||
float r_p_pi = shadowInfoArray[0].rc * (length_pc_proj + shadowInfoArray[0].xp) / shadowInfoArray[0].xp;
|
||||
|
||||
//float r_u_pi = shadowInfoArray[0].rc * (length_pc_proj + shadowInfoArray[0].xu) / shadowInfoArray[0].xu;
|
||||
float r_u_pi = shadowInfoArray[0].rc * (shadowInfoArray[0].xu - length_pc_proj) / shadowInfoArray[0].xu;
|
||||
|
||||
if ( length_d < r_u_pi ) { // umbra
|
||||
//return vec4(0.0, 0.0, 0.0, 1.0);
|
||||
//return vec4(1.0, 0.0, 0.0, 1.0);
|
||||
return butterworthFunc(length_d, r_u_pi, 4.0);
|
||||
}
|
||||
else if ( length_d < r_p_pi ) {// penumbra
|
||||
//return vec4(0.5, 0.5, 0.5, 1.0);
|
||||
//return vec4(0.0, 1.0, 0.0, 1.0);
|
||||
return vec4(vec3(length_d/r_p_pi), 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
return vec4(1.0);
|
||||
}
|
||||
|
||||
Fragment getFragment() {
|
||||
vec4 position = vs_position;
|
||||
float depth = pscDepth(position);
|
||||
vec4 diffuse = texture(texture1, vs_st);
|
||||
vec4 diffuse2 = texture(nightTex, vs_st);
|
||||
vec4 clouds = texture(cloudsTexture, vs_st);
|
||||
|
||||
Fragment frag;
|
||||
if (_performShading) {
|
||||
// atmosphere
|
||||
vec4 viewport = vec4(screenX, screenY, screenWIDTH, screenHEIGHT);
|
||||
vec4 ndcPos;
|
||||
ndcPos.xy = ((2.0 * gl_FragCoord.xy) - (2.0 * viewport.xy)) / (viewport.zw) - 1;
|
||||
ndcPos.z = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far) /
|
||||
(gl_DepthRange.far - gl_DepthRange.near);
|
||||
ndcPos.w = 1.0;
|
||||
vec4 clipPos = ndcPos / gl_FragCoord.w;
|
||||
vec4 projCoords = projInverse * clipPos;
|
||||
vec4 viewDirection = normalize(completeInverse * vec4(projCoords.xyz, 0.0));
|
||||
vec3 v = normalize(viewDirection.xyz);
|
||||
|
||||
float offset, maxLength;
|
||||
vec4 ppos = vec4(0.0);
|
||||
//if (intersectAtmosphere(planetPositionObj, v, Rt, offset, maxLength)) {
|
||||
if (intersectAtmosphere(ppos, v, Rg, offset, maxLength)) {
|
||||
// Following paper nomenclature
|
||||
float t = offset;
|
||||
vec3 x = cameraPosObj.xyz;// + offset * v;
|
||||
float r = length(x);
|
||||
float mu = dot(x, v) / r;
|
||||
vec3 s = normalize(sunPositionObj);
|
||||
|
||||
vec3 attenuation;
|
||||
vec3 inscatterColor = inscatterLight(x, t, v, s, r, mu, attenuation);
|
||||
vec3 groundColor = groundColor(x, t, v, s, r, mu, attenuation);
|
||||
vec3 sunColor = sunColor(x, t, v, s, r, mu);
|
||||
|
||||
//diffuse = HDR(vec4(sunColor + groundColor + inscatterColor, 1.0));
|
||||
//diffuse = HDR(vec4(sunColor, 1.0));
|
||||
//diffuse = HDR(vec4(groundColor, 1.0));
|
||||
//diffuse = HDR(vec4(inscatterColor, 1.0));
|
||||
|
||||
//diffuse = HDR(vec4(sunColor + groundColor + inscatterColor, 1.0) + diffuse2);
|
||||
diffuse = HDR((vec4(sunColor + groundColor + inscatterColor, 1.0) + diffuse2) *
|
||||
calcShadow(shadowDataArray, vs_posWorld.xyz) );
|
||||
}
|
||||
// else
|
||||
// diffuse = HDR(diffuse);
|
||||
}
|
||||
|
||||
diffuse[3] = transparency;
|
||||
frag.color = diffuse;
|
||||
frag.depth = depth;
|
||||
|
||||
return frag;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform mat4 ViewProjection;
|
||||
uniform mat4 ModelTransform;
|
||||
uniform mat4 NormalTransform;
|
||||
|
||||
layout(location = 0) in vec4 in_position;
|
||||
layout(location = 1) in vec2 in_st;
|
||||
layout(location = 2) in vec3 in_normal;
|
||||
//layout(location = 3) in vec2 in_nightTex;
|
||||
|
||||
|
||||
out vec2 vs_st;
|
||||
out vec4 vs_normal;
|
||||
out vec4 vs_position;
|
||||
out vec4 vs_posWorld;
|
||||
out float s;
|
||||
out vec4 ray;
|
||||
|
||||
#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
|
||||
void main()
|
||||
{
|
||||
// set variables
|
||||
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));
|
||||
|
||||
// This is the wright transformation for the normals
|
||||
vs_normal = normalize(NormalTransform * vec4(in_normal,0));
|
||||
|
||||
// The position is not in world coordinates, it is in
|
||||
// regular view/eye coordinates.
|
||||
vec4 position = pscTransform(tmp, ModelTransform);
|
||||
|
||||
// Vertex position in world coordinates in meters and
|
||||
// with no powerscalling coordiantes
|
||||
vec3 local_vertex_pos = mat3(ModelTransform) * in_position.xyz;
|
||||
vec4 vP = psc_addition(vec4(local_vertex_pos,in_position.w),objpos);
|
||||
vec4 conv = vec4(vP.xyz * pow(10,vP.w), 1.0);
|
||||
vs_posWorld = conv;
|
||||
|
||||
vs_position = tmp;
|
||||
|
||||
// Now the position is transformed from view coordinates to SGCT projection
|
||||
// coordinates.
|
||||
position = ViewProjection * position;
|
||||
gl_Position = z_normalization(position);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include "atmosphere_common.glsl"
|
||||
#include "fragment.glsl"
|
||||
#include "PowerScaling/powerScalingMath.hglsl"
|
||||
|
||||
layout(location = 1) out vec4 renderTableColor;
|
||||
|
||||
// See paper algorithm
|
||||
uniform int line;
|
||||
uniform sampler2D deltaETexture;
|
||||
|
||||
Fragment getFragment() {
|
||||
if (line == 4)
|
||||
renderTableColor = vec4(0.0);
|
||||
else if (line == 10) {
|
||||
vec2 uv = gl_FragCoord.xy / vec2(OTHER_TEXTURES_W, OTHER_TEXTURES_H);
|
||||
renderTableColor = texture(deltaETexture, uv);
|
||||
}
|
||||
|
||||
Fragment frag;
|
||||
frag.color = vec4(1.0);
|
||||
frag.depth = 1.0;
|
||||
|
||||
return frag;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
layout(location = 0) in vec3 in_position;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(in_position, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include "atmosphere_common.glsl"
|
||||
#include "fragment.glsl"
|
||||
#include "PowerScaling/powerScalingMath.hglsl"
|
||||
|
||||
layout(location = 1) out vec4 renderTarget1;
|
||||
|
||||
uniform float r;
|
||||
uniform vec4 dhdH;
|
||||
|
||||
uniform sampler2D transmittanceTexture;
|
||||
uniform sampler2D deltaETexture;
|
||||
uniform sampler3D deltaSRTexture;
|
||||
uniform sampler3D deltaSMTexture;
|
||||
uniform float first;
|
||||
|
||||
const float dphi = M_PI / float(INSCATTER_SPHERICAL_INTEGRAL_SAMPLES);
|
||||
const float dtheta = M_PI / float(INSCATTER_SPHERICAL_INTEGRAL_SAMPLES);
|
||||
|
||||
void getMuMuSNu(const float r, vec4 dhdH, out float mu, out float mu_s, out float nu) {
|
||||
float x = gl_FragCoord.x - 0.5;
|
||||
float y = gl_FragCoord.y - 0.5;
|
||||
if (y < float(RES_MU) / 2.0) {
|
||||
float d = 1.0 - y / (float(RES_MU) / 2.0 - 1.0);
|
||||
d = min(max(dhdH.z, d * dhdH.w), dhdH.w * 0.999);
|
||||
mu = (Rg * Rg - r * r - d * d) / (2.0 * r * d);
|
||||
mu = min(mu, -sqrt(1.0 - (Rg / r) * (Rg / r)) - 0.001);
|
||||
} else {
|
||||
float d = (y - float(RES_MU) / 2.0) / (float(RES_MU) / 2.0 - 1.0);
|
||||
d = min(max(dhdH.x, d * dhdH.y), dhdH.y * 0.999);
|
||||
mu = (Rt * Rt - r * r - d * d) / (2.0 * r * d);
|
||||
}
|
||||
mu_s = mod(x, float(RES_MU_S)) / (float(RES_MU_S) - 1.0);
|
||||
mu_s = tan((2.0 * mu_s - 1.0 + 0.26) * 1.1) / tan(1.26 * 1.1);
|
||||
nu = -1.0 + floor(x / float(RES_MU_S)) / (float(RES_NU) - 1.0) * 2.0;
|
||||
}
|
||||
|
||||
vec3 transmittanceFromTexture(const float r, const float mu) {
|
||||
float u_r = sqrt((r - Rg) / (Rt - Rg));
|
||||
// See Colliene to understand the different mapping.
|
||||
float u_mu = atan((mu + 0.15) / (1.0 + 0.15) * tan(1.5)) / 1.5;
|
||||
|
||||
return texture(transmittanceTexture, vec2(u_mu, u_r)).rgb;
|
||||
}
|
||||
|
||||
vec3 transmittance(const float r, const float mu, float d) {
|
||||
vec3 result;
|
||||
float r1 = sqrt(r * r + d * d + 2.0 * r * mu * d);
|
||||
float mu1 = (r * mu + d) / r1;
|
||||
if (mu > 0.0) {
|
||||
result = min(transmittanceFromTexture(r, mu) /
|
||||
transmittanceFromTexture(r1, mu1), 1.0);
|
||||
} else {
|
||||
result = min(transmittanceFromTexture(r1, -mu1) /
|
||||
transmittanceFromTexture(r, -mu), 1.0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Rayleigh phase
|
||||
float phaseFunctionR(const float mu) {
|
||||
return (3.0 / (16.0 * M_PI)) * (1.0 + mu * mu);
|
||||
}
|
||||
|
||||
// Mie phase
|
||||
float phaseFunctionM(const float mu) {
|
||||
return (3.0 / (8.0 * M_PI)) *
|
||||
( ( (1.0 - (mieG*mieG) ) * (1+mu*mu) ) /
|
||||
( (2+mieG*mieG) * pow(1+mieG*mieG - 2.0*mieG*mu, 3.0/2.0) ) );
|
||||
}
|
||||
|
||||
vec3 irradiance(sampler2D calcTexture, const float r, const float mu_s) {
|
||||
float u_r = (r - Rg) / (Rt - Rg);
|
||||
float u_mu_s = (mu_s + 0.2) / (1.0 + 0.2);
|
||||
return texture(calcTexture, vec2(u_mu_s, u_r)).rgb;
|
||||
}
|
||||
|
||||
vec4 texture4D(sampler3D table, const float r, const float mu,
|
||||
const float mu_s, const float nu)
|
||||
{
|
||||
float H = sqrt(Rt * Rt - Rg * Rg);
|
||||
float rho = sqrt(r * r - Rg * Rg);
|
||||
float rmu = r * mu;
|
||||
float delta = rmu * rmu - r * r + Rg * Rg;
|
||||
vec4 cst = rmu < 0.0 && delta > 0.0 ? vec4(1.0, 0.0, 0.0, 0.5 - 0.5 / float(RES_MU)) : vec4(-1.0, H * H, H, 0.5 + 0.5 / float(RES_MU));
|
||||
float u_r = 0.5 / float(RES_R) + rho / H * (1.0 - 1.0 / float(RES_R));
|
||||
float u_mu = cst.w + (rmu * cst.x + sqrt(delta + cst.y)) / (rho + cst.z) * (0.5 - 1.0 / float(RES_MU));
|
||||
float u_mu_s = 0.5 / float(RES_MU_S) + (atan(max(mu_s, -0.1975) * tan(1.26 * 1.1)) / 1.1 + (1.0 - 0.26)) * 0.5 * (1.0 - 1.0 / float(RES_MU_S));
|
||||
float lerp = (nu + 1.0) / 2.0 * (float(RES_NU) - 1.0);
|
||||
float uNu = floor(lerp);
|
||||
lerp = lerp - uNu;
|
||||
return texture(table, vec3((uNu + u_mu_s) / float(RES_NU), u_mu, u_r)) * (1.0 - lerp) +
|
||||
texture(table, vec3((uNu + u_mu_s + 1.0) / float(RES_NU), u_mu, u_r)) * lerp;
|
||||
}
|
||||
|
||||
void inscatter(float r, float mu, float mu_s, float nu, out vec3 raymie) {
|
||||
r = clamp(r, Rg, Rt);
|
||||
mu = clamp(mu, -1.0, 1.0);
|
||||
mu_s = clamp(mu_s, -1.0, 1.0);
|
||||
float var = sqrt(1.0 - mu * mu) * sqrt(1.0 - mu_s * mu_s);
|
||||
nu = clamp(nu, mu_s * mu - var, mu_s * mu + var);
|
||||
|
||||
float cthetamin = -sqrt(1.0 - (Rg / r) * (Rg / r));
|
||||
|
||||
vec3 v = vec3(sqrt(1.0 - mu * mu), 0.0, mu);
|
||||
float sx = v.x == 0.0 ? 0.0 : (nu - mu_s * mu) / v.x;
|
||||
vec3 s = vec3(sx, sqrt(max(0.0, 1.0 - sx * sx - mu_s * mu_s)), mu_s);
|
||||
|
||||
raymie = vec3(0.0);
|
||||
|
||||
for (int itheta = 0; itheta < INSCATTER_SPHERICAL_INTEGRAL_SAMPLES; ++itheta) {
|
||||
float theta = (float(itheta) + 0.5) * dtheta;
|
||||
float ctheta = cos(theta);
|
||||
|
||||
float greflectance = 0.0;
|
||||
float dground = 0.0;
|
||||
vec3 gtransp = vec3(0.0);
|
||||
if (ctheta < cthetamin) {
|
||||
greflectance = AVERAGE_GROUND_REFLECTANCE / M_PI;
|
||||
dground = -r * ctheta - sqrt(r * r * (ctheta * ctheta - 1.0) + Rg * Rg);
|
||||
gtransp = transmittance(Rg, -(r * ctheta + dground) / Rg, dground);
|
||||
}
|
||||
|
||||
for (int iphi = 0; iphi < 2 * INSCATTER_SPHERICAL_INTEGRAL_SAMPLES; ++iphi) {
|
||||
float phi = (float(iphi) + 0.5) * dphi;
|
||||
float dw = dtheta * dphi * sin(theta);
|
||||
vec3 w = vec3(cos(phi) * sin(theta), sin(phi) * sin(theta), ctheta);
|
||||
|
||||
float nu1 = dot(s, w);
|
||||
float nu2 = dot(v, w);
|
||||
float pr2 = phaseFunctionR(nu2);
|
||||
float pm2 = phaseFunctionM(nu2);
|
||||
|
||||
vec3 gnormal = (vec3(0.0, 0.0, r) + dground * w) / Rg;
|
||||
vec3 girradiance = irradiance(deltaETexture, Rg, dot(gnormal, s));
|
||||
|
||||
vec3 raymie1;
|
||||
|
||||
raymie1 = greflectance * girradiance * gtransp;
|
||||
|
||||
if (first == 1.0) {
|
||||
float pr1 = phaseFunctionR(nu1);
|
||||
float pm1 = phaseFunctionM(nu1);
|
||||
vec3 ray1 = texture4D(deltaSRTexture, r, w.z, mu_s, nu1).rgb;
|
||||
vec3 mie1 = texture4D(deltaSMTexture, r, w.z, mu_s, nu1).rgb;
|
||||
raymie1 += ray1 * pr1 + mie1 * pm1;
|
||||
} else {
|
||||
raymie1 += texture4D(deltaSRTexture, r, w.z, mu_s, nu1).rgb;
|
||||
}
|
||||
|
||||
raymie += raymie1 * (betaR * exp(-(r - Rg) / HR) * pr2 + betaMSca * exp(-(r - Rg) / HM) * pm2) * dw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Fragment getFragment() {
|
||||
vec3 raymie;
|
||||
float mu, mu_s, nu;
|
||||
getMuMuSNu(r, dhdH, mu, mu_s, nu);
|
||||
inscatter(r, mu, mu_s, nu, raymie);
|
||||
|
||||
renderTarget1 = vec4(raymie, 1.0);
|
||||
|
||||
Fragment frag;
|
||||
frag.color = vec4(1.0);
|
||||
frag.depth = 1.0;
|
||||
|
||||
return frag;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform int layer;
|
||||
|
||||
layout (triangles) in;
|
||||
layout (triangle_strip, max_vertices = 3) out;
|
||||
|
||||
void main()
|
||||
{
|
||||
int n;
|
||||
for (n = 0; n < gl_in.length(); ++n) {
|
||||
gl_Position = gl_in[n].gl_Position;
|
||||
gl_Layer = layer;
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
layout(location = 0) in vec3 in_position;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(in_position, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include "atmosphere_common.glsl"
|
||||
#include "fragment.glsl"
|
||||
#include "PowerScaling/powerScalingMath.hglsl"
|
||||
|
||||
layout(location = 1) out vec4 renderTarget1;
|
||||
|
||||
uniform int layer;
|
||||
|
||||
uniform sampler3D deltaSRTexture;
|
||||
uniform sampler3D deltaSMTexture;
|
||||
|
||||
Fragment getFragment() {
|
||||
vec3 uvw = vec3(gl_FragCoord.xy, float(layer) + 0.5) / vec3(ivec3(RES_MU_S * RES_NU, RES_MU, RES_R));
|
||||
vec4 ray = texture(deltaSRTexture, uvw);
|
||||
vec4 mie = texture(deltaSMTexture, uvw);
|
||||
|
||||
// We are using only the red component of the Mie scattering
|
||||
// See the Precomputed Atmosphere Scattering paper for details about
|
||||
// the angular precision.
|
||||
renderTarget1 = vec4(ray.rgb, mie.r);
|
||||
|
||||
Fragment frag;
|
||||
frag.color = vec4(1.0);
|
||||
frag.depth = 1.0;
|
||||
|
||||
return frag;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform int layer;
|
||||
|
||||
layout (triangles) in;
|
||||
layout (triangle_strip, max_vertices = 3) out;
|
||||
|
||||
void main()
|
||||
{
|
||||
int n;
|
||||
for (n = 0; n < gl_in.length(); ++n) {
|
||||
gl_Position = gl_in[n].gl_Position;
|
||||
gl_Layer = layer;
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
layout(location = 0) in vec3 in_position;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(in_position, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include "atmosphere_common.glsl"
|
||||
#include "fragment.glsl"
|
||||
#include "PowerScaling/powerScalingMath.hglsl"
|
||||
|
||||
layout(location = 1) out vec4 renderTarget1;
|
||||
|
||||
uniform int layer;
|
||||
|
||||
uniform sampler3D deltaSTexture;
|
||||
|
||||
// Rayleigh phase
|
||||
float phaseFunctionR(const float mu) {
|
||||
return (3.0 / (16.0 * M_PI)) * (1.0 + mu * mu);
|
||||
}
|
||||
|
||||
Fragment getFragment() {
|
||||
float x = gl_FragCoord.x - 0.5;
|
||||
float y = gl_FragCoord.y - 0.5;
|
||||
|
||||
float nu = -1.0 + floor(x / float(RES_MU_S)) / (float(RES_NU) - 1.0) * 2.0;
|
||||
vec3 uvw = vec3(gl_FragCoord.xy, float(layer) + 0.5) / vec3(ivec3(RES_MU_S * RES_NU, RES_MU, RES_R));
|
||||
|
||||
renderTarget1 = vec4(texture(deltaSTexture, uvw).rgb / phaseFunctionR(nu), 1.0);
|
||||
|
||||
Fragment frag;
|
||||
frag.color = vec4(1.0);
|
||||
frag.depth = 1.0;
|
||||
|
||||
return frag;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform int layer;
|
||||
|
||||
layout (triangles) in;
|
||||
layout (triangle_strip, max_vertices = 3) out;
|
||||
|
||||
void main()
|
||||
{
|
||||
int n;
|
||||
for (n = 0; n < gl_in.length(); ++n) {
|
||||
gl_Position = gl_in[n].gl_Position;
|
||||
gl_Layer = layer;
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
layout(location = 0) in vec3 in_position;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(in_position, 1.0);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user