mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-23 05:19:18 -06:00
Merged master info NewAtmosphere.
This commit is contained in:
@@ -41,7 +41,7 @@ function preInitialization()
|
||||
openspace.bindKey("F4", "openspace.setPropertyValue('Interaction.origin', 'Earth')")
|
||||
openspace.bindKey("F3", "openspace.setPropertyValue('Interaction.origin', 'Moon')")
|
||||
|
||||
openspace.setPathToken("${MARS_DATA}", "C:/Users/jonco_000/Pessoal/Work/OpenSpace/Source/OpenSpace/data/scene/lodglobes/mars")
|
||||
--openspace.setPathToken("${MARS_DATA}", "C:/Users/jonco_000/Pessoal/Work/OpenSpace/Source/OpenSpace/data/scene/lodglobes/mars")
|
||||
--openspace.setPathToken("${MARS_DATA}", "F:/Pessoal/Work/OpenSpace/Source/OpenSpace/data/scene/lodglobes/mars")
|
||||
end
|
||||
|
||||
@@ -58,15 +58,11 @@ function postInitialization()
|
||||
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.resetCameraDirection()
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Transparency", 0.33)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
|
||||
--openspace.setInteractionMode('GlobeBrowsing')
|
||||
|
||||
if openspace.modules.isLoaded("ISWA") then
|
||||
openspace.iswa.addCdfFiles("${OPENSPACE_DATA}/cdflist.json");
|
||||
end
|
||||
@@ -78,36 +74,15 @@ return {
|
||||
CommonFolder = "common",
|
||||
Camera = {
|
||||
Focus = "Earth",
|
||||
--Focus = "Mars",
|
||||
--Position = {526781518487.171326, 257168309890.072144, -1381125204152.817383},
|
||||
--Rotation = {-0.106166, 0.981574, -0.084545, 0.134513},
|
||||
--Position = {-21230341452.764542, -75199905816.520981, 126295587136.952240},
|
||||
--Rotation = {0.243724, 0.002268, 0.964416, 0.102449},
|
||||
--Position = {-21235464763.652920, -75191278487.585068, 126294839057.346405},
|
||||
--Rotation = {0.224913, -0.096227, 0.939918, 0.238136},
|
||||
|
||||
-- Mars Position
|
||||
--Position = {113807010618.012451, -93349316388.687042, 190403814045.631592},
|
||||
--Rotation = {0.527685, 0.455945, -0.495623, 0.517707},
|
||||
Position = {1, 0, 0},
|
||||
Rotation = {0.250635, -0.028751, 0.879269, 0.404030},
|
||||
},
|
||||
Modules = {
|
||||
"sun",
|
||||
--"atmosphereearth",
|
||||
--"atmospheremars",
|
||||
--"moon",
|
||||
|
||||
"lodglobes/earth",
|
||||
"lodglobes/mars",
|
||||
"lodglobes/moon",
|
||||
--"satellites",
|
||||
--"mars-satellites",
|
||||
--"toyvolume",
|
||||
--"earth",
|
||||
"stars",
|
||||
--"stars-denver",
|
||||
"milkyway",
|
||||
-- "milkyway-eso",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,15 +20,15 @@ function postInitialization()
|
||||
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("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("PlutoTrail.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTexture.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.setPropertyValue("MilkyWay.renderable.Transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
@@ -20,14 +20,22 @@ function postInitialization()
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("Constellation Bounds.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.setPropertyValue("MilkyWay.renderable.Transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Segments", 50)
|
||||
|
||||
openspace.addVirtualProperty("BoolProperty", "Show Trails", "*Trail.renderable.enabled", true, nil, nil)
|
||||
openspace.addVirtualProperty(
|
||||
"BoolProperty",
|
||||
"Show Trails",
|
||||
"*Trail.renderable.enabled",
|
||||
"Disable or enable all trails of the scene at the same time",
|
||||
true,
|
||||
nil,
|
||||
nil
|
||||
)
|
||||
|
||||
openspace.navigation.resetCameraDirection()
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ function postInitialization()
|
||||
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("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.setPropertyValue("MilkyWay.renderable.Transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
@@ -19,64 +19,53 @@ function preInitialization()
|
||||
|
||||
-- Toggle night texture, shading, atmosphere and water
|
||||
openspace.bindKey("s",
|
||||
helper.property.invert('Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.enabled') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.performShading') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.atmosphere') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.enabled'),
|
||||
helper.property.invert('Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.Enabled') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.PerformShading') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.Atmosphere') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.Enabled'),
|
||||
"Toggle night texture, shading, atmosphere, and water for Earth."
|
||||
)
|
||||
|
||||
-- Toggle background
|
||||
openspace.bindKey("b",
|
||||
helper.property.invert('MilkyWay.renderable.enabled') ..
|
||||
helper.property.invert('Stars.renderable.enabled'),
|
||||
helper.property.invert('MilkyWay.renderable.Enabled') ..
|
||||
helper.property.invert('Stars.renderable.Enabled'),
|
||||
"Toggle background (Stars and Milkyway)."
|
||||
)
|
||||
|
||||
openspace.bindKey("g",
|
||||
"openspace.setInteractionMode('GlobeBrowsing')" ..
|
||||
helper.property.invert('MilkyWay.renderable.enabled') ..
|
||||
helper.property.invert('Stars.renderable.enabled') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.enabled') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.performShading') ..
|
||||
helper.property.invert('Mars.RenderableGlobe.performShading') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.atmosphere') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.enabled') ..
|
||||
helper.property.invert('Moon.RenderableGlobe.enabled') ..
|
||||
helper.property.invert('Sun.renderable.enabled'),
|
||||
helper.property.invert('MilkyWay.renderable.Enabled') ..
|
||||
helper.property.invert('Stars.renderable.Enabled') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.Enabled') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.PerformShading') ..
|
||||
helper.property.invert('Mars.RenderableGlobe.PerformShading') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.Atmosphere') ..
|
||||
helper.property.invert('Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.Enabled') ..
|
||||
helper.property.invert('Moon.RenderableGlobe.Enabled') ..
|
||||
helper.property.invert('Sun.renderable.Enabled'),
|
||||
"Toogles background and shading mode on the Earth and Mars alongside visibility of the Moon and the Sun"
|
||||
)
|
||||
|
||||
openspace.bindKey("h",
|
||||
"openspace.setPropertyValue('*Trail.renderable.enabled', false)",
|
||||
"openspace.setPropertyValue('*Trail.renderable.Enabled', false)",
|
||||
"Disables visibility of the trails"
|
||||
)
|
||||
|
||||
--[[
|
||||
-- Toggle trails
|
||||
openspace.bindKey("o",
|
||||
'openspace.setPropertyValue("*Trail.renderable.enabled", false)'
|
||||
)
|
||||
openspace.bindKey("p",
|
||||
'openspace.setPropertyValue("*Trail.renderable.enabled", true)'
|
||||
)
|
||||
|
||||
]]
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
openspace.printInfo("Setting default values")
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Segments", 50)
|
||||
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", true)
|
||||
openspace.setPropertyValue("SunGlare.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("Sun.renderable.Enabled", true)
|
||||
openspace.setPropertyValue("SunGlare.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.Enabled", false)
|
||||
|
||||
openspace.setPropertyValue("Earth.RenderableGlobe.atmosphere", true)
|
||||
openspace.setPropertyValue("Earth.RenderableGlobe.Debug.levelByProjectedAreaElseDistance", false)
|
||||
openspace.setPropertyValue("Earth.RenderableGlobe.Layers.ColorLayers.blendTileLevels", true)
|
||||
openspace.setPropertyValue("Earth.RenderableGlobe.Atmosphere", true)
|
||||
openspace.setPropertyValue("Earth.RenderableGlobe.Debug.LevelByProjectedAreaElseDistance", false)
|
||||
openspace.setPropertyValue("Earth.RenderableGlobe.Layers.ColorLayers.BlendTileLevels", true)
|
||||
|
||||
openspace.globebrowsing.goToGeo(0, 0, 20000000)
|
||||
|
||||
|
||||
@@ -26,14 +26,14 @@ function postInitialization()
|
||||
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("Sun.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.Enabled", true)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.Enabled", true)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Segments", 50)
|
||||
|
||||
openspace.setPropertyValue('Jupiter.renderable.performShading', false);
|
||||
openspace.setPropertyValue('Jupiter.renderable.PerformShading', false);
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--local marsEllipsoid = {3396190.0, 3396190.0, 3376200.0}
|
||||
--local marsEllipsoid = {3376200.0, 3376200.0, 3376200.0}
|
||||
local marsEllipsoid = {3396190.0, 3396190.0, 3396190.0}
|
||||
|
||||
|
||||
--[[
|
||||
local patches = {
|
||||
{
|
||||
Name = "West Candor Chasma",
|
||||
@@ -74,7 +74,7 @@ local patches = {
|
||||
Height = openspace.absPath("${MARS_DATA}/map_datasets/HiRISE/Part_of_Area_Traversed_by_the_Mars_Exploration_Rover_Heightmap.vrt")
|
||||
},
|
||||
}
|
||||
|
||||
]]
|
||||
local function createTextureLayers(patches)
|
||||
result = {}
|
||||
for k,v in pairs(patches) do
|
||||
@@ -138,16 +138,7 @@ return {
|
||||
FilePath = "map_service_configs/Utah/MolaPseudoColor.xml",
|
||||
-- Enabled = true,
|
||||
},
|
||||
{
|
||||
Name = "Mars COL v006",
|
||||
FilePath = openspace.absPath("${MARS_DATA}/map_datasets/mars_COL_v006_mars2000_rgb.vrt"),
|
||||
Enabled = true
|
||||
},
|
||||
{
|
||||
Name = "MOLA Pseudo Color",
|
||||
FilePath = "map_service_configs/Utah/MolaPseudoColor.xml",
|
||||
-- Enabled = true,
|
||||
},
|
||||
--[[
|
||||
{
|
||||
Name = "Mars COL v006",
|
||||
FilePath = openspace.absPath("${MARS_DATA}/map_datasets/mars_COL_v006_mars2000_rgb.vrt"),
|
||||
@@ -158,12 +149,14 @@ return {
|
||||
FilePath = "map_service_configs/CTX_Mosaic.xml",
|
||||
--Enabled = true,
|
||||
},
|
||||
]]
|
||||
{
|
||||
Name = "CTX Mosaic [Utah]",
|
||||
FilePath = "map_service_configs/Utah/CTX_Mosaic.xml",
|
||||
},
|
||||
table.unpack(createTextureLayers(patches))
|
||||
--[[{
|
||||
--table.unpack(createTextureLayers(patches))
|
||||
--[[
|
||||
{
|
||||
Name = "Themis IR Day",
|
||||
FilePath = "map_service_configs/Utah/ThemisIRDay.xml",
|
||||
},
|
||||
@@ -203,7 +196,7 @@ return {
|
||||
TilePixelSize = 90,
|
||||
DoPreProcessing = true,
|
||||
},
|
||||
table.unpack(createHeightLayers(patches))
|
||||
--table.unpack(createHeightLayers(patches))
|
||||
--[[
|
||||
{
|
||||
Name = "Mola Elevation [Utah]",
|
||||
|
||||
@@ -6,6 +6,7 @@ return {
|
||||
Type = "RenderableSphere",
|
||||
Size = 10E22,
|
||||
Segments = 40,
|
||||
Alpha = 0.2,
|
||||
Texture = "textures/DarkUniverse_mellinger_8k.jpg",
|
||||
Orientation = "Inside/Outside"
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ return {
|
||||
Type = "SpiceTranslation",
|
||||
Body = "OSIRIS-REX",
|
||||
Frame = "IAU_EARTH",
|
||||
Observer = "EARTH",
|
||||
Observer = "EARTH",
|
||||
},
|
||||
Color = { 0.9, 0.9, 0.0 },
|
||||
StartTime = "2016 SEP 8 23:05:00.50",
|
||||
|
||||
@@ -26,15 +26,15 @@ function postInitialization()
|
||||
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("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("PlutoTrail.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTexture.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.setPropertyValue("MilkyWay.renderable.Transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Segments", 50)
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
@@ -28,15 +28,15 @@ function postInitialization()
|
||||
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("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", true)
|
||||
openspace.setPropertyValue("PlutoTexture.renderable.enabled", false)
|
||||
openspace.setPropertyValue("PlutoTrail.renderable.Enabled", true)
|
||||
openspace.setPropertyValue("PlutoTexture.renderable.Enabled", false)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Segments", 50)
|
||||
|
||||
-- Activate night textures and water masks
|
||||
openspace.setPropertyValue("Earth.RenderableGlobe.WaterMasks", {0, 1});
|
||||
|
||||
@@ -28,14 +28,14 @@ function postInitialization()
|
||||
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("Sun.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.Enabled", true)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.Enabled", true)
|
||||
|
||||
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Transparency", 0.55)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Segments", 50)
|
||||
|
||||
openspace.setPropertyValue('67P.renderable.performShading', false);
|
||||
openspace.setPropertyValue('67P.renderable.PerformShading', false);
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
@@ -25,12 +25,12 @@ function postInitialization()
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunGlare.renderable.enabled", false)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.enabled", false)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.enabled", false)
|
||||
openspace.setPropertyValue("EarthTrail.renderable.enabled", false)
|
||||
openspace.setPropertyValue("Earth.renderable.performShading", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("SunGlare.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("MilkyWay.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("EarthMarker.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("EarthTrail.renderable.Enabled", false)
|
||||
openspace.setPropertyValue("Earth.renderable.PerformShading", false)
|
||||
|
||||
openspace.navigation.resetCameraDirection()
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ function postInitialization()
|
||||
graphical settings for the renderables.
|
||||
]]--
|
||||
openspace.printInfo("Setting default values")
|
||||
openspace.setPropertyValue("Sun.renderable.enabled", false)
|
||||
openspace.setPropertyValue("SunMarker.renderable.enabled", true)
|
||||
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)
|
||||
|
||||
|
||||
Submodule ext/ghoul updated: 9f27e93d41...1fc3d1f78d
@@ -45,16 +45,8 @@ public:
|
||||
|
||||
void setModules(const std::vector<OpenSpaceModule*>& modules);
|
||||
|
||||
bool busyWaitForDecode();
|
||||
bool logSGCTOutOfOrderErrors();
|
||||
bool useDoubleBuffering();
|
||||
|
||||
private:
|
||||
properties::OptionProperty _scenes;
|
||||
properties::BoolProperty _busyWaitForDecode;
|
||||
properties::BoolProperty _logSGCTOutOfOrderErrors;
|
||||
properties::BoolProperty _useDoubleBuffering;
|
||||
properties::BoolProperty _spiceUseExceptions;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -65,9 +65,9 @@ private:
|
||||
};
|
||||
|
||||
// Properties
|
||||
properties::BoolProperty _rollFriction;
|
||||
properties::BoolProperty _rotationalFriction;
|
||||
properties::BoolProperty _horizontalFriction;
|
||||
properties::BoolProperty _verticalFriction;
|
||||
properties::BoolProperty _zoomFriction;
|
||||
properties::FloatProperty _followFocusNodeRotationDistance;
|
||||
properties::FloatProperty _minimumAllowedDistance;
|
||||
properties::FloatProperty _sensitivity;
|
||||
|
||||
@@ -32,16 +32,11 @@ namespace openspace::properties {
|
||||
template <typename T>
|
||||
class NumericalProperty : public TemplateProperty<T> {
|
||||
public:
|
||||
NumericalProperty(std::string identifier, std::string guiName,
|
||||
Property::Visibility visibility = Property::Visibility::User);
|
||||
NumericalProperty(std::string identifier, std::string guiName, T value,
|
||||
Property::Visibility visibility = Property::Visibility::User);
|
||||
NumericalProperty(std::string identifier, std::string guiName, T value,
|
||||
T minimumValue, T maximumValue,
|
||||
Property::Visibility visibility = Property::Visibility::User);
|
||||
NumericalProperty(std::string identifier, std::string guiName, T value,
|
||||
T minimumValue, T maximumValue, T steppingValue,
|
||||
Property::Visibility visibility = Property::Visibility::User);
|
||||
NumericalProperty(Property::PropertyInfo info);
|
||||
NumericalProperty(Property::PropertyInfo info, T value);
|
||||
NumericalProperty(Property::PropertyInfo info, T value, T minimumValue, T maximumValue);
|
||||
NumericalProperty(Property::PropertyInfo info, T value, T minimumValue, T maximumValue,
|
||||
T steppingValue);
|
||||
|
||||
bool getLuaValue(lua_State* state) const override;
|
||||
bool setLuaValue(lua_State* state) override;
|
||||
|
||||
@@ -232,50 +232,41 @@ const std::string NumericalProperty<T>::SteppingValueKey = "SteppingValue";
|
||||
// a single constructor
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(std::string identifier, std::string guiName,
|
||||
Property::Visibility visibility)
|
||||
NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info)
|
||||
: NumericalProperty<T>(
|
||||
std::move(identifier), std::move(guiName),
|
||||
std::move(info),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMinimumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMaximumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>(),
|
||||
visibility
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>()
|
||||
)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(std::string identifier,
|
||||
std::string guiName, T value,
|
||||
Property::Visibility visibility)
|
||||
NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info, T value)
|
||||
: NumericalProperty<T>(
|
||||
std::move(identifier), std::move(guiName), std::move(value),
|
||||
std::move(info),
|
||||
std::move(value),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMinimumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultMaximumValue<T>(),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>(),
|
||||
visibility
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>()
|
||||
)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(std::string identifier, std::string guiName,
|
||||
T value, T minimumValue, T maximumValue,
|
||||
Property::Visibility visibility)
|
||||
NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info, T value,
|
||||
T minimumValue, T maximumValue)
|
||||
: NumericalProperty<T>(
|
||||
std::move(identifier) , std::move(guiName), std::move(value),
|
||||
std::move(minimumValue), std::move(maximumValue),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>(),
|
||||
visibility
|
||||
std::move(info),
|
||||
std::move(value), std::move(minimumValue), std::move(maximumValue),
|
||||
PropertyDelegate<NumericalProperty<T>>::template defaultSteppingValue<T>()
|
||||
)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(std::string identifier,
|
||||
std::string guiName, T value,
|
||||
T minimumValue, T maximumValue, T steppingValue,
|
||||
Property::Visibility visibility)
|
||||
: TemplateProperty<T>(std::move(identifier), std::move(guiName), std::move(value),
|
||||
visibility)
|
||||
NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info, T value,
|
||||
T minimumValue, T maximumValue, T steppingValue)
|
||||
: TemplateProperty<T>(std::move(info), std::move(value))
|
||||
, _minimumValue(std::move(minimumValue))
|
||||
, _maximumValue(std::move(maximumValue))
|
||||
, _stepping(std::move(steppingValue))
|
||||
|
||||
@@ -57,21 +57,23 @@ public:
|
||||
/**
|
||||
* The constructor delegating the <code>identifier</code> and the <code>guiName</code>
|
||||
* to its super class.
|
||||
* \param identifier A unique identifier for this property
|
||||
* \param guiName The GUI name that should be used to represent this property
|
||||
* \param info The PropertyInfo structure that contains all the required static
|
||||
* information for initializing this Property.
|
||||
* \pre \p info.identifier must not be empty
|
||||
* \pre \p info.guiName must not be empty
|
||||
*/
|
||||
OptionProperty(std::string identifier, std::string guiName,
|
||||
Property::Visibility visibility = Property::Visibility::User);
|
||||
OptionProperty(Property::PropertyInfo info);
|
||||
|
||||
/**
|
||||
* The constructor delegating the <code>identifier</code> and the <code>guiName</code>
|
||||
* to its super class.
|
||||
* \param identifier A unique identifier for this property
|
||||
* \param guiName The GUI name that should be used to represent this property
|
||||
* \param info The PropertyInfo structure that contains all the required static
|
||||
* information for initializing this Property.
|
||||
* \param displayType Optional DisplayType for GUI (default RADIO)
|
||||
* \pre \p info.identifier must not be empty
|
||||
* \pre \p info.guiName must not be empty
|
||||
*/
|
||||
OptionProperty(std::string identifier, std::string guiName, DisplayType displayType,
|
||||
Property::Visibility visibility = Property::Visibility::User);
|
||||
OptionProperty(PropertyInfo info, DisplayType displayType);
|
||||
|
||||
/**
|
||||
* Returns the name of the class for reflection purposes.
|
||||
|
||||
@@ -63,14 +63,29 @@ class PropertyOwner;
|
||||
class Property {
|
||||
public:
|
||||
/**
|
||||
* The visibility classes for Property%s. The classes are strictly ordered as
|
||||
* All > Developer > User > Hidden
|
||||
*/
|
||||
* The visibility classes for Property%s. The classes are strictly ordered as
|
||||
* All > Developer > User > Hidden
|
||||
*/
|
||||
enum class Visibility {
|
||||
All = 3, ///< Visible for all types, no matter what
|
||||
Hidden = 2, ///< Never visible
|
||||
Developer = 1, ///< Visible in Developer mode
|
||||
User = 0 ///< Visible in User mode
|
||||
Hidden = 3, ///< Never visible
|
||||
Developer = 2, ///< Visible in Developer mode
|
||||
User = 1, ///< Visible in User mode
|
||||
All = 0, ///< Visible for all types, no matter what
|
||||
};
|
||||
|
||||
/**
|
||||
* This structure is passed to the constructor of a Property and contains the unique
|
||||
* identifier, a GUI name and descriptive text that are both user facing.
|
||||
*/
|
||||
struct PropertyInfo {
|
||||
/// The unique identifier that is part of the fully qualified URI of this Property
|
||||
std::string identifier;
|
||||
/// The name that is displayed in the user interface
|
||||
std::string guiName;
|
||||
/// The user facing description of this Property
|
||||
std::string description;
|
||||
/// Determins the visibility of this Property in the user interface
|
||||
Visibility visibility = Visibility::All;
|
||||
};
|
||||
|
||||
/// An OnChangeHandle is returned by the onChange method to uniquely identify an
|
||||
@@ -85,16 +100,14 @@ public:
|
||||
* The constructor for the property. The <code>identifier</code> needs to be unique
|
||||
* for each PropertyOwner. The <code>guiName</code> will be stored in the metaData
|
||||
* to be accessed by the GUI elements using the <code>guiName</code> key. The default
|
||||
* visibility settings is <code>true</code>, whereas the default read-only state is
|
||||
* visibility settings is Visibility::All, whereas the default read-only state is
|
||||
* <code>false</code>.
|
||||
* \param identifier A unique identifier for this property. It has to be unique to the
|
||||
* PropertyOwner and cannot contain any <code>.</code>s
|
||||
* \param guiName The human-readable GUI name for this Property
|
||||
* \pre \p identifier must not be empty
|
||||
* \pre \p guiName must not be empty
|
||||
* \param info The PropertyInfo structure that contains all the required static
|
||||
* information for initializing this Property.
|
||||
* \pre \p info.identifier must not be empty
|
||||
* \pre \p info.guiName must not be empty
|
||||
*/
|
||||
Property(std::string identifier, std::string guiName,
|
||||
Visibility visibility = Visibility::All);
|
||||
Property(PropertyInfo info);
|
||||
|
||||
/**
|
||||
* The destructor taking care of deallocating all unused memory. This method will not
|
||||
@@ -258,18 +271,12 @@ public:
|
||||
std::string guiName() const;
|
||||
|
||||
/**
|
||||
* Returns the description for this Property that contains all necessary information
|
||||
* required for creating a GUI representation. The format of the description is a
|
||||
* valid Lua table, i.e., it is surrounded by a pair of <code>{</code> and
|
||||
* <code>}</code> with key,value pairs between. Each value can either be a number, a
|
||||
* string, a bool, or another table. The general values set by this base function
|
||||
* are: <code>Identifier</code>, <code>Name</code>, <code>Type</code>. All other
|
||||
* values are specific to the type and are added in a specific subclass, which require
|
||||
* the subclass to call this method first.
|
||||
* \return The descriptive text for the Property that can be used for constructing a
|
||||
* GUI representation
|
||||
* This function returns a user-facing description of the Property which can be
|
||||
* displayed in the user interface to inform the user what this Property does and how
|
||||
* it affects the rendering.
|
||||
* \return The description of this Property
|
||||
*/
|
||||
virtual std::string description() const;
|
||||
std::string description() const;
|
||||
|
||||
/**
|
||||
* Sets the identifier of the group that this Property belongs to. Property groups can
|
||||
@@ -407,6 +414,12 @@ protected:
|
||||
/// The identifier for this Property
|
||||
std::string _identifier;
|
||||
|
||||
/// The GUI user-facing name of this Property
|
||||
std::string _guiName;
|
||||
|
||||
/// The user-facing description of this Property
|
||||
std::string _description;
|
||||
|
||||
/// The Dictionary containing all meta data necessary for external applications
|
||||
ghoul::Dictionary _metaData;
|
||||
|
||||
@@ -415,6 +428,13 @@ protected:
|
||||
|
||||
private:
|
||||
OnChangeHandle _currentHandleValue;
|
||||
|
||||
#ifdef _DEBUG
|
||||
// These identifiers can be used for debugging. Each Property is assigned one unique
|
||||
// identifier.
|
||||
static uint64_t Identifier;
|
||||
uint64_t _id;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
* @} @}
|
||||
*/
|
||||
|
||||
#include <openspace/properties/numericalproperty.h>
|
||||
#include <openspace/properties/templateproperty.h>
|
||||
|
||||
namespace openspace::properties {
|
||||
|
||||
|
||||
@@ -38,8 +38,7 @@ public:
|
||||
std::string description;
|
||||
};
|
||||
|
||||
SelectionProperty(std::string identifier, std::string guiName,
|
||||
Property::Visibility visibility = Property::Visibility::User);
|
||||
SelectionProperty(Property::PropertyInfo info);
|
||||
|
||||
void addOption(Option option);
|
||||
void removeOptions();
|
||||
|
||||
@@ -51,27 +51,19 @@ namespace openspace::properties {
|
||||
template <typename T>
|
||||
class TemplateProperty : public Property {
|
||||
public:
|
||||
typedef T ValueType;
|
||||
|
||||
/**
|
||||
* The constructor initializing the TemplateProperty with the provided
|
||||
* <code>identifier</code> and human-readable <code>guiName</code>. The default value
|
||||
* for the stored type <code>T</code> is retrieved using the PropertyDelegate's
|
||||
* PropertyDelegate::defaultValue method, which must be specialized for new types or
|
||||
* a compile-error will occur.
|
||||
* \param identifier The identifier that is used for this TemplateProperty
|
||||
* \param guiName The human-readable GUI name for this TemplateProperty
|
||||
*/
|
||||
TemplateProperty(std::string identifier, std::string guiName,
|
||||
Property::Visibility visibility = Visibility::User);
|
||||
using ValueType = T;
|
||||
|
||||
/**
|
||||
* The constructor initializing the TemplateProperty with the provided
|
||||
* <code>identifier</code>, human-readable <code>guiName</code> and provided
|
||||
* <code>value</code>.
|
||||
* \param info The PropertyInfo structure that contains all the required static
|
||||
* information for initializing this Property.
|
||||
* \pre \p info.identifier must not be empty
|
||||
* \pre \p info.guiName must not be empty
|
||||
*/
|
||||
TemplateProperty(std::string identifier, std::string guiName, T value,
|
||||
Property::Visibility visibility = Visibility::User);
|
||||
TemplateProperty(Property::PropertyInfo info,
|
||||
T value = PropertyDelegate<TemplateProperty<T>>::template defaultValue<T>());
|
||||
|
||||
/**
|
||||
* Returns the class name for this TemplateProperty. The default implementation makes
|
||||
@@ -159,7 +151,7 @@ public:
|
||||
|
||||
/**
|
||||
* The assignment operator allows the TemplateProperty's value to be set without using
|
||||
* the TemplateProperty::set method. It will be done internally by thos method and it
|
||||
* the TemplateProperty::set method. It will be done internally by this method and it
|
||||
* allows assignments such as <code>prop = T(1)</code>.
|
||||
* \param val The value that should be set.
|
||||
*/
|
||||
|
||||
@@ -142,25 +142,9 @@ namespace openspace::properties {
|
||||
} \
|
||||
|
||||
|
||||
|
||||
// Delegating constructors are necessary; automatic template deduction cannot
|
||||
// deduce template argument for 'U' if 'default' methods are used as default values in
|
||||
// a single constructor
|
||||
|
||||
template <typename T>
|
||||
TemplateProperty<T>::TemplateProperty(std::string identifier, std::string guiName,
|
||||
Property::Visibility visibility)
|
||||
: TemplateProperty<T>(
|
||||
std::move(identifier), std::move(guiName),
|
||||
PropertyDelegate<TemplateProperty<T>>::template defaultValue<T>(),
|
||||
visibility)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
TemplateProperty<T>::TemplateProperty(std::string identifier, std::string guiName,
|
||||
T value, Property::Visibility visibility)
|
||||
: Property(std::move(identifier), std::move(guiName), visibility)
|
||||
TemplateProperty<T>::TemplateProperty(Property::PropertyInfo info, T value)
|
||||
: Property(std::move(info))
|
||||
, _value(std::move(value))
|
||||
{}
|
||||
|
||||
@@ -169,11 +153,6 @@ std::string TemplateProperty<T>::className() const {
|
||||
return PropertyDelegate<TemplateProperty<T>>::className();
|
||||
}
|
||||
|
||||
//template <typename T>
|
||||
//std::string TemplateProperty<T>::description() {
|
||||
// return
|
||||
//}
|
||||
|
||||
template <typename T>
|
||||
TemplateProperty<T>::operator T() {
|
||||
return _value;
|
||||
|
||||
@@ -38,11 +38,12 @@ public:
|
||||
/**
|
||||
* Initializes the TriggerProperty by delegating the <code>identifier</code> and
|
||||
* <code>guiName</code> to the Property constructor.
|
||||
* \param identifier The unique identifier used for this Property
|
||||
* \param guiName The human-readable name of this Property
|
||||
* \param info The PropertyInfo structure that contains all the required static
|
||||
* information for initializing this Property.
|
||||
* \pre \p info.identifier must not be empty
|
||||
* \pre \p info.guiName must not be empty
|
||||
*/
|
||||
TriggerProperty(std::string identifier, std::string guiName,
|
||||
Property::Visibility visibility = Property::Visibility::User);
|
||||
TriggerProperty(PropertyInfo info);
|
||||
|
||||
/**
|
||||
* Returns the class name <code>TriggerProperty</code>.
|
||||
|
||||
@@ -61,7 +61,6 @@ public:
|
||||
static std::unique_ptr<Renderable> createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
// constructors & destructor
|
||||
Renderable();
|
||||
Renderable(const ghoul::Dictionary& dictionary);
|
||||
virtual ~Renderable();
|
||||
|
||||
|
||||
@@ -89,6 +89,132 @@ namespace {
|
||||
const char* keyATMDebug = "Debug";
|
||||
const char* keyTextureScale = "PreCalculatedTextureScale";
|
||||
const char* keySaveTextures = "SaveCalculatedTextures";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AtmosphereHeightInfo = {
|
||||
"atmmosphereHeight",
|
||||
"Atmosphere Height (KM)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AverageGroundReflectanceInfo = {
|
||||
"AverageGroundReflectance",
|
||||
"Average Ground Reflectance (%)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo RayleighHeightScaleInfo = {
|
||||
"RayleighHeightScale",
|
||||
"Rayleigh Height Scale (KM)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo RayleighScatteringCoeffXInfo = {
|
||||
"RayleighScatteringCoeffX",
|
||||
"Rayleigh Scattering Coeff X (x10e-3)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo RayleighScatteringCoeffYInfo = {
|
||||
"RayleighScatteringCoeffY",
|
||||
"Rayleigh Scattering Coeff Y (x10e-3)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo RayleighScatteringCoeffZInfo = {
|
||||
"RayleighScatteringCoeffZ",
|
||||
"Rayleigh Scattering Coeff Z (x10e-3)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OzoneLayerInfo = {
|
||||
"Ozone",
|
||||
"Ozone Layer Enabled",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OzoneHeightScaleInfo = {
|
||||
"OzoneLayerHeightScale",
|
||||
"Ozone Height Scale (KM)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OzoneLayerCoeffXInfo = {
|
||||
"OzoneLayerCoeffX",
|
||||
"Ozone Layer Extinction Coeff X (x10e-5)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OzoneLayerCoeffYInfo = {
|
||||
"OzoneLayerCoeffY",
|
||||
"Ozone Layer Extinction Coeff Y (x10e-5)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OzoneLayerCoeffZInfo = {
|
||||
"OzoneLayerCoeffZ",
|
||||
"Ozone Layer Extinction Coeff Z (x10e-5)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo MieHeightScaleInfo = {
|
||||
"MieHeightScale",
|
||||
"Mie Height Scale (KM)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo MieScatteringCoeffXInfo = {
|
||||
"MieScatteringCoeffX",
|
||||
"Mie Scattering Coeff X (x10e-3)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo MieScatteringCoeffYInfo = {
|
||||
"MieScatteringCoeffY",
|
||||
"Mie Scattering Coeff Y (x10e-3)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo MieScatteringCoeffZInfo = {
|
||||
"MieScatteringCoeffZ",
|
||||
"Mie Scattering Coeff Z (x10e-3)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo MieScatteringExtinctionPropCoeffInfo = {
|
||||
"MieScatteringExtinctionPropCoefficient",
|
||||
"Mie Scattering/Extinction Proportion Coefficient (%)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo MieAsymmetricFactorGInfo = {
|
||||
"MieAsymmetricFactorG",
|
||||
"Mie Asymmetric Factor G",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SunIntensityInfo = {
|
||||
"SunIntensity",
|
||||
"Sun Intensity",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AtmosphereExposureInfo = {
|
||||
"HdrExposure",
|
||||
"Atmosphere Exposure",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AtmosphereGammaInfo = {
|
||||
"Gamma",
|
||||
"Gamma Correction",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo EnableSunOnCameraPositionInfo = {
|
||||
"SunFollowingCamera",
|
||||
"Enable Sun On Camera Position",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -121,28 +247,27 @@ namespace openspace {
|
||||
|
||||
RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _atmosphereHeightP("atmmosphereHeight", "Atmosphere Height (KM)", 60.0f, 0.1f, 99.0f)
|
||||
, _groundAverageReflectanceP("averageGroundReflectance", "Average Ground Reflectance (%)", 0.1f, 0.0f, 1.0f)
|
||||
, _rayleighHeightScaleP("rayleighHeightScale", "Rayleigh Height Scale (KM)", 8.0f, 0.1f, 20.0f)
|
||||
, _rayleighScatteringCoeffXP("rayleighScatteringCoeffX", "Rayleigh Scattering Coeff X (x10e-3)", 1.0f, 0.01f, 100.0f)
|
||||
, _rayleighScatteringCoeffYP("rayleighScatteringCoeffY", "Rayleigh Scattering Coeff Y (x10e-3)", 1.0f, 0.01f, 100.0f)
|
||||
, _rayleighScatteringCoeffZP("rayleighScatteringCoeffZ", "Rayleigh Scattering Coeff Z (x10e-3)", 1.0f, 0.01f, 100.0f)
|
||||
, _ozoneEnabledP("ozone", "Ozone Layer Enabled", true)
|
||||
, _ozoneHeightScaleP("ozoneLayerHeightScale", "Ozone Height Scale (KM)", 8.0f, 0.1f, 20.0f)
|
||||
, _ozoneCoeffXP("ozoneLayerCoeffX", "Ozone Layer Extinction Coeff X (x10e-5)", 3.426f, 0.01f, 100.0f)
|
||||
, _ozoneCoeffYP("ozoneLayerCoeffY", "Ozone Layer Extinction Coeff Y (x10e-5)", 8.298f, 0.01f, 100.0f)
|
||||
, _ozoneCoeffZP("ozoneLayerCoeffZ", "Ozone Layer Extinction Coeff Z (x10e-5)", 0.356f, 0.01f, 100.0f)
|
||||
, _mieHeightScaleP("mieHeightScale", "Mie Height Scale (KM)", 1.2f, 0.1f, 20.0f)
|
||||
, _mieScatteringCoeffXP("mieScatteringCoeffX", "Mie Scattering Coeff X (x10e-3)", 4.0f, 0.01f, 1000.0f)
|
||||
, _mieScatteringCoeffYP("mieScatteringCoeffY", "Mie Scattering Coeff Y (x10e-3)", 4.0f, 0.01f, 1000.0f)
|
||||
, _mieScatteringCoeffZP("mieScatteringCoeffZ", "Mie Scattering Coeff Z (x10e-3)", 4.0f, 0.01f, 1000.0f)
|
||||
, _mieScatteringExtinctionPropCoefficientP("mieScatteringExtinctionPropCoefficient",
|
||||
"Mie Scattering/Extinction Proportion Coefficient (%)", 0.9f, 0.01f, 1.0f)
|
||||
, _mieAsymmetricFactorGP("mieAsymmetricFactorG", "Mie Asymmetric Factor G", 0.85f, -1.0f, 1.0f)
|
||||
, _sunIntensityP("sunIntensity", "Sun Intensity", 50.0f, 0.1f, 1000.0f)
|
||||
, _hdrExpositionP("hdrExposition", "HDR", 0.4f, 0.01f, 5.0f)
|
||||
, _gammaConstantP("gamma", "Gamma Correction", 1.8f, 0.1f, 3.0f)
|
||||
, _sunFollowingCameraEnabledP("sunFollowingCamera", "Enable Sun On Camera Position", false)
|
||||
, _atmosphereHeightP(AtmosphereHeightInfo, 60.0f, 0.1f, 99.0f)
|
||||
, _groundAverageReflectanceP(AverageGroundReflectanceInfo, 0.1f, 0.0f, 1.0f)
|
||||
, _rayleighHeightScaleP(RayleighHeightScaleInfo, 8.0f, 0.1f, 20.0f)
|
||||
, _rayleighScatteringCoeffXP(RayleighScatteringCoeffXInfo, 1.0f, 0.01f, 100.0f)
|
||||
, _rayleighScatteringCoeffYP(RayleighScatteringCoeffYInfo, 1.0f, 0.01f, 100.0f)
|
||||
, _rayleighScatteringCoeffZP(RayleighScatteringCoeffZInfo, 1.0f, 0.01f, 100.0f)
|
||||
, _ozoneEnabledP(OzoneLayerInfo, true)
|
||||
, _ozoneHeightScaleP(OzoneHeightScaleInfo, 8.0f, 0.1f, 20.0f)
|
||||
, _ozoneCoeffXP(OzoneLayerCoeffXInfo, 3.426f, 0.01f, 100.0f)
|
||||
, _ozoneCoeffYP(OzoneLayerCoeffYInfo, 8.298f, 0.01f, 100.0f)
|
||||
, _ozoneCoeffZP(OzoneLayerCoeffZInfo, 0.356f, 0.01f, 100.0f)
|
||||
, _mieHeightScaleP(MieHeightScaleInfo, 1.2f, 0.1f, 20.0f)
|
||||
, _mieScatteringCoeffXP(MieScatteringCoeffXInfo, 4.0f, 0.01f, 1000.0f)
|
||||
, _mieScatteringCoeffYP(MieScatteringCoeffYInfo, 4.0f, 0.01f, 1000.0f)
|
||||
, _mieScatteringCoeffZP(MieScatteringCoeffZInfo, 4.0f, 0.01f, 1000.0f)
|
||||
, _mieScatteringExtinctionPropCoefficientP(MieScatteringExtinctionPropCoeffInfo, 0.9f, 0.01f, 1.0f)
|
||||
, _mieAsymmetricFactorGP(MieAsymmetricFactorGInfo, 0.85f, -1.0f, 1.0f)
|
||||
, _sunIntensityP(SunIntensityInfo, 50.0f, 0.1f, 1000.0f)
|
||||
, _hdrExpositionP(AtmosphereExposureInfo, 0.4f, 0.01f, 5.0f)
|
||||
, _gammaConstantP(AtmosphereGammaInfo, 1.8f, 0.1f, 3.0f)
|
||||
, _sunFollowingCameraEnabledP(EnableSunOnCameraPositionInfo, false)
|
||||
, _atmosphereEnabled(false)
|
||||
, _ozoneLayerEnabled(false)
|
||||
, _sunFollowingCameraEnabled(false)
|
||||
|
||||
@@ -46,11 +46,20 @@ namespace {
|
||||
const char* KeyGeometry = "Geometry";
|
||||
const char* KeyTexture = "Textures.Color";
|
||||
const char* KeyModelTransform = "Rotation.ModelTransform";
|
||||
const char* KeyFading = "Shading.Fadeable";
|
||||
|
||||
const char* keyBody = "Body";
|
||||
const char* keyStart = "StartTime";
|
||||
const char* keyEnd = "EndTime";
|
||||
static const openspace::properties::Property::PropertyInfo TextureInfo = {
|
||||
"ColorTexture", // @TODO replace with only "Texture"
|
||||
"Color Texture",
|
||||
"This value points to a color texture file that is applied to the geometry "
|
||||
"rendered in this object."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ShadingInfo = {
|
||||
"PerformShading",
|
||||
"Perform Shading",
|
||||
"This value determines whether this model should be shaded by using the position "
|
||||
"of the Sun."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -68,10 +77,15 @@ documentation::Documentation RenderableModel::Documentation() {
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyTexture,
|
||||
KeyTexture, // @TODO replace with TextureInfo.identifier
|
||||
new StringVerifier,
|
||||
"A color texture that can be applied to the model specified by the "
|
||||
"Geometry.",
|
||||
TextureInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
ShadingInfo.identifier,
|
||||
new BoolVerifier,
|
||||
ShadingInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
@@ -80,13 +94,6 @@ documentation::Documentation RenderableModel::Documentation() {
|
||||
"Specifies a distinct transformation matrix that is applied to the "
|
||||
"model. If it is not specified, it is equal to the Identity matrix.",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyFading,
|
||||
new BoolVerifier,
|
||||
"Specifies whether the model should be periodically fading in and out. "
|
||||
"If this value is not specified, it will not fade.",
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -95,10 +102,8 @@ documentation::Documentation RenderableModel::Documentation() {
|
||||
RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _geometry(nullptr)
|
||||
, _colorTexturePath("colorTexture", "Color Texture")
|
||||
, _performFade("performFading", "Perform Fading", false)
|
||||
, _performShading("performShading", "Perform Shading", true)
|
||||
, _fading("fading", "Fade", 0)
|
||||
, _colorTexturePath(TextureInfo)
|
||||
, _performShading(ShadingInfo, true)
|
||||
, _programObject(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _modelTransform(1.0)
|
||||
@@ -129,8 +134,8 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
_modelTransform = dictionary.value<glm::dmat3>(KeyModelTransform);
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(KeyFading)) {
|
||||
_performFade = dictionary.value<bool>(KeyFading);
|
||||
if (dictionary.hasKey(ShadingInfo.identifier)) {
|
||||
_performShading = dictionary.value<bool>(ShadingInfo.identifier);
|
||||
}
|
||||
|
||||
addPropertySubOwner(_geometry.get());
|
||||
@@ -139,7 +144,6 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
|
||||
_colorTexturePath.onChange(std::bind(&RenderableModel::loadTexture, this));
|
||||
|
||||
addProperty(_performShading);
|
||||
addProperty(_performFade);
|
||||
}
|
||||
|
||||
bool RenderableModel::isReady() const {
|
||||
@@ -179,14 +183,6 @@ bool RenderableModel::deinitialize() {
|
||||
void RenderableModel::render(const RenderData& data, RendererTasks&) {
|
||||
_programObject->activate();
|
||||
|
||||
// Fading
|
||||
if (_performFade && _fading > 0.f) {
|
||||
_fading = _fading - 0.01f;
|
||||
}
|
||||
else if (!_performFade && _fading < 1.f) {
|
||||
_fading = _fading + 0.01f;
|
||||
}
|
||||
|
||||
// Model transform and view transform needs to be in double precision
|
||||
glm::dmat4 modelTransform =
|
||||
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
|
||||
@@ -201,7 +197,7 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
|
||||
_programObject->setUniform("modelViewTransform", glm::mat4(modelViewTransform));
|
||||
_programObject->setUniform("projectionTransform", data.camera.projectionMatrix());
|
||||
_programObject->setUniform("performShading", _performShading);
|
||||
_programObject->setUniform("fading", _fading);
|
||||
_programObject->setUniform("fading", 1.f); // @TODO remove this
|
||||
|
||||
_geometry->setUniforms(*_programObject);
|
||||
|
||||
|
||||
@@ -68,9 +68,7 @@ private:
|
||||
std::unique_ptr<modelgeometry::ModelGeometry> _geometry;
|
||||
|
||||
properties::StringProperty _colorTexturePath;
|
||||
properties::BoolProperty _performFade;
|
||||
properties::BoolProperty _performShading;
|
||||
properties::FloatProperty _fading;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
|
||||
@@ -38,10 +38,37 @@
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
namespace {
|
||||
const char* KeySize = "Size";
|
||||
const char* KeyBillboard = "Billboard";
|
||||
const char* KeyBlendMode = "BlendMode";
|
||||
const char* KeyTexture = "Texture";
|
||||
enum BlendMode {
|
||||
BlendModeNormal = 0,
|
||||
BlendModeAdditive
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TextureInfo = {
|
||||
"Texture",
|
||||
"Texture",
|
||||
"This value specifies an image that is loaded from disk and is used as a texture "
|
||||
"that is applied to this plane. This image has to be square."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo BillboardInfo = {
|
||||
"Billboard",
|
||||
"Billboard mode",
|
||||
"This value specifies whether the plane is a billboard, which means that it is "
|
||||
"always facing the camera. If this is false, it can be oriented using other "
|
||||
"transformations."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SizeInfo = {
|
||||
"Size",
|
||||
"Size (in meters)",
|
||||
"This value specifies the size of the plane in meters."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo BlendModeInfo = {
|
||||
"BlendMode",
|
||||
"Blending Mode",
|
||||
"This determines the blending mode that is applied to this plane."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -53,31 +80,27 @@ documentation::Documentation RenderablePlane::Documentation() {
|
||||
"base_renderable_plane",
|
||||
{
|
||||
{
|
||||
KeySize,
|
||||
SizeInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
"Specifies the size of the square plane in meters.",
|
||||
SizeInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyBillboard,
|
||||
BillboardInfo.identifier,
|
||||
new BoolVerifier,
|
||||
"Specifies whether the plane is a billboard, which means that it is "
|
||||
"always facing the camera. If this is false, it can be oriented using "
|
||||
"other transformations. The default is 'false'.",
|
||||
BillboardInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyBlendMode,
|
||||
BlendModeInfo.identifier,
|
||||
new StringInListVerifier({ "Normal", "Additive" }),
|
||||
"Specifies the blend mode that is applied to this plane. The default "
|
||||
"value is 'Normal'.",
|
||||
BlendModeInfo.description, // + " The default value is 'Normal'.",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyTexture,
|
||||
TextureInfo.identifier,
|
||||
new StringVerifier,
|
||||
"Specifies the texture that is applied to this plane. This image has to "
|
||||
"be a square image.",
|
||||
TextureInfo.description,
|
||||
Optional::No
|
||||
}
|
||||
}
|
||||
@@ -87,12 +110,12 @@ documentation::Documentation RenderablePlane::Documentation() {
|
||||
|
||||
RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _texturePath("texture", "Texture")
|
||||
, _billboard("billboard", "Billboard", false)
|
||||
, _size("size", "Size", 10, 0, std::pow(10, 25))
|
||||
, _texturePath(TextureInfo)
|
||||
, _billboard(BillboardInfo, false)
|
||||
, _size(SizeInfo, 10.f, 0.f, 1e25f)
|
||||
, _blendMode(BlendModeInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _shader(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _blendMode(BlendMode::Normal)
|
||||
, _quad(0)
|
||||
, _vertexPositionBuffer(0)
|
||||
, _planeIsDirty(false)
|
||||
@@ -104,23 +127,39 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
|
||||
"RenderablePlane"
|
||||
);
|
||||
|
||||
_size = static_cast<float>(dictionary.value<double>(KeySize));
|
||||
_size = static_cast<float>(dictionary.value<double>(SizeInfo.identifier));
|
||||
|
||||
if (dictionary.hasKey(KeyBillboard)) {
|
||||
_billboard = dictionary.value<bool>(KeyBillboard);
|
||||
if (dictionary.hasKey(BillboardInfo.identifier)) {
|
||||
_billboard = dictionary.value<bool>(BillboardInfo.identifier);
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(KeyBlendMode)) {
|
||||
const std::string v = dictionary.value<std::string>(KeyBlendMode);
|
||||
_blendMode.addOptions({
|
||||
{ BlendModeNormal, "Normal" },
|
||||
{ BlendModeAdditive, "Additive"}
|
||||
});
|
||||
_blendMode.onChange([&]() {
|
||||
switch (_blendMode) {
|
||||
case BlendModeNormal:
|
||||
setRenderBin(Renderable::RenderBin::Opaque);
|
||||
break;
|
||||
case BlendModeAdditive:
|
||||
setRenderBin(Renderable::RenderBin::Transparent);
|
||||
break;
|
||||
default:
|
||||
throw ghoul::MissingCaseException();
|
||||
}
|
||||
});
|
||||
|
||||
if (dictionary.hasKey(BlendModeInfo.identifier)) {
|
||||
const std::string v = dictionary.value<std::string>(BlendModeInfo.identifier);
|
||||
if (v == "Normal") {
|
||||
_blendMode = BlendMode::Normal;
|
||||
_blendMode = BlendModeNormal;
|
||||
}
|
||||
else if (v == "Additive") {
|
||||
_blendMode = BlendMode::Additive;
|
||||
setRenderBin(Renderable::RenderBin::Transparent);
|
||||
_blendMode = BlendModeAdditive;
|
||||
}
|
||||
}
|
||||
_texturePath = absPath(dictionary.value<std::string>(KeyTexture));
|
||||
_texturePath = absPath(dictionary.value<std::string>(TextureInfo.identifier));
|
||||
_textureFile = std::make_unique<ghoul::filesystem::File>(_texturePath);
|
||||
|
||||
addProperty(_billboard);
|
||||
@@ -218,10 +257,10 @@ void RenderablePlane::render(const RenderData& data, RendererTasks&) {
|
||||
OsEng.renderEngine().rendererImplementation() == RenderEngine::RendererImplementation::ABuffer;
|
||||
|
||||
if (usingABufferRenderer) {
|
||||
_shader->setUniform("additiveBlending", _blendMode == BlendMode::Additive);
|
||||
_shader->setUniform("additiveBlending", _blendMode == BlendModeAdditive);
|
||||
}
|
||||
|
||||
bool additiveBlending = _blendMode == BlendMode::Additive && usingFramebufferRenderer;
|
||||
bool additiveBlending = _blendMode == BlendModeAdditive && usingFramebufferRenderer;
|
||||
if (additiveBlending) {
|
||||
glDepthMask(false);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
@@ -64,24 +65,18 @@ public:
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
enum class BlendMode : int {
|
||||
Normal = 0,
|
||||
Additive
|
||||
};
|
||||
|
||||
void loadTexture();
|
||||
void createPlane();
|
||||
|
||||
properties::StringProperty _texturePath;
|
||||
properties::BoolProperty _billboard;
|
||||
properties::FloatProperty _size;
|
||||
properties::OptionProperty _blendMode;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
std::unique_ptr<ghoul::filesystem::File> _textureFile;
|
||||
|
||||
BlendMode _blendMode;
|
||||
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
|
||||
|
||||
@@ -41,15 +41,44 @@
|
||||
#include <math.h>
|
||||
|
||||
namespace {
|
||||
const char* KeySize = "Size";
|
||||
const char* KeySegments = "Segments";
|
||||
const char* KeyTexture = "Texture";
|
||||
const char* KeyOrientation = "Orientation";
|
||||
|
||||
enum Orientation {
|
||||
Outside = 1,
|
||||
Inside = 2
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TextureInfo = {
|
||||
"Texture",
|
||||
"Texture",
|
||||
"This value specifies an image that is loaded from disk and is used as a texture "
|
||||
"that is applied to this sphere. This image is expected to be an equirectangular "
|
||||
"projection."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OrientationInfo = {
|
||||
"Orientation",
|
||||
"Orientation",
|
||||
"Specifies whether the texture is applied to the inside of the sphere, the "
|
||||
"outside of the sphere, or both."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SegmentsInfo = {
|
||||
"Segments",
|
||||
"Number of Segments",
|
||||
"This value specifies the number of segments that the sphere is separated in."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SizeInfo = {
|
||||
"Size",
|
||||
"Size (in meters)",
|
||||
"This value specifies the radius of the sphere in meters."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TransparencyInfo = {
|
||||
"Alpha",
|
||||
"Transparency",
|
||||
"This value determines the transparency of the sphere. If this value is set to "
|
||||
"1, the sphere is completely opaque. At 0, the sphere is completely transparent."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -61,28 +90,33 @@ documentation::Documentation RenderableSphere::Documentation() {
|
||||
"base_renderable_sphere",
|
||||
{
|
||||
{
|
||||
KeySize,
|
||||
SizeInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
"Specifies the radius of the sphere in meters.",
|
||||
SizeInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeySegments,
|
||||
SegmentsInfo.identifier,
|
||||
new IntVerifier,
|
||||
"Specifies the number of segments the sphere is separated in.",
|
||||
SegmentsInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyTexture,
|
||||
TextureInfo.identifier,
|
||||
new StringVerifier,
|
||||
"Specifies the texture that is applied to the sphere.",
|
||||
TextureInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyOrientation,
|
||||
OrientationInfo.identifier,
|
||||
new StringInListVerifier({ "Inside", "Outside", "Inside/Outside" }),
|
||||
"Specifies whether the texture is applied to the inside of the sphere, "
|
||||
"the outside of the sphere, or both. The default value is 'Outside'.",
|
||||
OrientationInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
TransparencyInfo.identifier,
|
||||
new DoubleInRangeVerifier(0.0, 1.0),
|
||||
TransparencyInfo.description,
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
@@ -92,11 +126,11 @@ documentation::Documentation RenderableSphere::Documentation() {
|
||||
|
||||
RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _texturePath("texture", "Texture")
|
||||
, _orientation("orientation", "Orientation")
|
||||
, _size("size", "Size", 1.f, 0.f, std::pow(10.f, 45))
|
||||
, _segments("segments", "Segments", 8, 4, 100)
|
||||
, _transparency("transparency", "Transparency", 1.f, 0.f, 1.f)
|
||||
, _texturePath(TextureInfo)
|
||||
, _orientation(OrientationInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _size(SizeInfo, 1.f, 0.f, 1e35f)
|
||||
, _segments(SegmentsInfo, 8, 4, 1000)
|
||||
, _transparency(TransparencyInfo, 1.f, 0.f, 1.f)
|
||||
, _shader(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _sphere(nullptr)
|
||||
@@ -108,16 +142,18 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
|
||||
"RenderableSphere"
|
||||
);
|
||||
|
||||
_size = static_cast<float>(dictionary.value<double>(KeySize));
|
||||
_segments = static_cast<int>(dictionary.value<double>(KeySegments));
|
||||
_texturePath = absPath(dictionary.value<std::string>(KeyTexture));
|
||||
_size = static_cast<float>(dictionary.value<double>(SizeInfo.identifier));
|
||||
_segments = static_cast<int>(dictionary.value<double>(SegmentsInfo.identifier));
|
||||
_texturePath = absPath(dictionary.value<std::string>(TextureInfo.identifier));
|
||||
|
||||
_orientation.addOption(Outside, "Outside");
|
||||
_orientation.addOption(Inside, "Inside");
|
||||
_orientation.addOption(Outside | Inside, "Inside/Outside");
|
||||
_orientation.addOptions({
|
||||
{ Outside, "Outside" },
|
||||
{ Inside, "Inside" },
|
||||
{ Outside | Inside, "Inside/Outside" }
|
||||
});
|
||||
|
||||
if (dictionary.hasKey(KeyOrientation)) {
|
||||
const std::string v = dictionary.value<std::string>(KeyOrientation);
|
||||
if (dictionary.hasKey(OrientationInfo.identifier)) {
|
||||
const std::string v = dictionary.value<std::string>(OrientationInfo.identifier);
|
||||
if (v == "Inside") {
|
||||
_orientation = Inside;
|
||||
}
|
||||
@@ -128,7 +164,7 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
|
||||
_orientation = Outside | Inside;
|
||||
}
|
||||
else {
|
||||
ghoul_assert(false, "Missing 'case' label");
|
||||
throw ghoul::MissingCaseException();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -142,12 +178,24 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_segments);
|
||||
_segments.onChange([this](){ _sphereIsDirty = true; });
|
||||
|
||||
_transparency.onChange([this](){
|
||||
if (_transparency > 0.f && _transparency < 1.f) {
|
||||
setRenderBin(Renderable::RenderBin::Transparent);
|
||||
}
|
||||
else {
|
||||
setRenderBin(Renderable::RenderBin::Opaque);
|
||||
}
|
||||
});
|
||||
if (dictionary.hasKey(TransparencyInfo.identifier)) {
|
||||
_transparency = static_cast<float>(
|
||||
dictionary.value<double>(TransparencyInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_transparency);
|
||||
|
||||
addProperty(_texturePath);
|
||||
_texturePath.onChange([this]() {loadTexture(); });
|
||||
_texturePath.onChange([this]() { loadTexture(); });
|
||||
|
||||
|
||||
setRenderBin(Renderable::RenderBin::Transparent);
|
||||
}
|
||||
|
||||
bool RenderableSphere::isReady() const {
|
||||
|
||||
@@ -35,12 +35,6 @@
|
||||
|
||||
namespace {
|
||||
const char* KeyTranslation = "Translation";
|
||||
const char* KeyColor = "Color";
|
||||
const char* KeyEnableFade = "EnableFade";
|
||||
const char* KeyFade = "Fade";
|
||||
const char* KeyLineWidth = "LineWidth";
|
||||
const char* KeyPointSize = "PointSize";
|
||||
const char* KeyRendering = "Rendering";
|
||||
|
||||
// The possible values for the _renderingModes property
|
||||
enum RenderingMode {
|
||||
@@ -56,6 +50,54 @@ namespace {
|
||||
{ "Lines+Points", RenderingModeLinesPoints },
|
||||
{ "Points+Lines", RenderingModeLinesPoints }
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LineColorInfo = {
|
||||
"Color",
|
||||
"Color",
|
||||
"This value determines the RGB main color for the lines and points of the trail."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo EnableFadeInfo = {
|
||||
"EnableFade",
|
||||
"Enable line fading of old points",
|
||||
"Toggles whether the trail should fade older points out. If this value is "
|
||||
"'true', the 'Fade' parameter determines the speed of fading. If this value is "
|
||||
"'false', the entire trail is rendered at full opacity and color."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FadeInfo = {
|
||||
"Fade",
|
||||
"Line fade",
|
||||
"The fading factor that is applied to the trail if the 'EnableFade' value is "
|
||||
"'true'. If it is 'false', this setting has no effect. The higher the number, "
|
||||
"the less fading is applied."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LineWidthInfo = {
|
||||
"LineWidth",
|
||||
"Line Width",
|
||||
"This value specifies the line width of the trail if the selected rendering "
|
||||
"method includes lines. If the rendering mode is set to Points, this value is "
|
||||
"ignored."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo PointSizeInfo = {
|
||||
"PointSize",
|
||||
"Point Size",
|
||||
"This value specifies the base size of the points along the line if the selected "
|
||||
"rendering method includes points. If the rendering mode is set the Lines, this "
|
||||
"value is ignored. If a subsampling of the values is performed, the subsampled "
|
||||
"values are half this size."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo RenderingModeInfo = {
|
||||
"Rendering",
|
||||
"Rendering Mode",
|
||||
"Determines how the trail should be rendered to the screen.If 'Lines' is "
|
||||
"selected, only the line part is visible, if 'Points' is selected, only the "
|
||||
"corresponding points (and subpoints) are shown. 'Lines+Points' shows both parts."
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -74,56 +116,42 @@ documentation::Documentation RenderableTrail::Documentation() {
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyColor,
|
||||
LineColorInfo.identifier,
|
||||
new DoubleVector3Verifier,
|
||||
"The main color the for lines and points on this trail. The value is "
|
||||
"interpreted as an RGB value.",
|
||||
LineColorInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyEnableFade,
|
||||
EnableFadeInfo.identifier,
|
||||
new BoolVerifier,
|
||||
"Toggles whether the trail should fade older points out. If this value "
|
||||
"is 'true', the 'Fade' parameter determines the speed of fading. If this "
|
||||
"value is 'false', the entire trail is rendered at full opacity and "
|
||||
"color. The default value is 'true'.",
|
||||
EnableFadeInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyFade,
|
||||
FadeInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
"The fading factor that is applied to the trail if the 'EnableFade' "
|
||||
"value is 'true'. If it is 'false', this setting has no effect. The "
|
||||
"higher the number, the less fading is applied. This value defaults to "
|
||||
"1.0.",
|
||||
FadeInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyLineWidth,
|
||||
LineWidthInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
"This value specifies the line width of the trail if this rendering "
|
||||
"method is selected. It defaults to 2.0.",
|
||||
LineWidthInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyPointSize,
|
||||
PointSizeInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
"This value specifies the base size of the points along the line if this "
|
||||
"rendering method is selected. If a subsampling of the values is "
|
||||
"performed, the subsampled values are half this size. The default value "
|
||||
"is 1.0.",
|
||||
PointSizeInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyRendering,
|
||||
RenderingModeInfo.identifier,
|
||||
new StringInListVerifier(
|
||||
// Taken from the RenderingModeConversion map above
|
||||
{ "Lines", "Points", "Lines+Points", "Points + Lines" }
|
||||
{ "Lines", "Points", "Lines+Points", "Points+Lines" }
|
||||
),
|
||||
"Determines how the trail should be rendered to the screen. If 'Lines' "
|
||||
"is selected, only the line part is visible, if 'Points' is selected, "
|
||||
"only the corresponding points (and subpoints) are shown. "
|
||||
"Lines+Points' shows both parts. On default, only the lines are rendered",
|
||||
RenderingModeInfo.description,
|
||||
Optional::Yes
|
||||
}
|
||||
},
|
||||
@@ -133,15 +161,12 @@ documentation::Documentation RenderableTrail::Documentation() {
|
||||
|
||||
RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _lineColor("lineColor", "Color", glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _useLineFade("useLineFade", "Use Line Fade", true)
|
||||
, _lineFade("lineFade", "Line Fade", 1.f, 0.f, 20.f)
|
||||
, _lineWidth("lineWidth", "Line Width", 2.f, 1.f, 20.f)
|
||||
, _pointSize("pointSize", "Point Size", 1, 1, 64)
|
||||
, _renderingModes(
|
||||
"renderingMode",
|
||||
"Rendering Mode",
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
, _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, _useLineFade(EnableFadeInfo, true)
|
||||
, _lineFade(FadeInfo, 1.f, 0.f, 30.f)
|
||||
, _lineWidth(LineWidthInfo, 2.f, 1.f, 20.f)
|
||||
, _pointSize(PointSizeInfo, 1, 1, 64)
|
||||
, _renderingModes(RenderingModeInfo, properties::OptionProperty::DisplayType::Dropdown
|
||||
)
|
||||
{
|
||||
_translation = std::unique_ptr<Translation>(Translation::createFromDictionary(
|
||||
@@ -149,26 +174,28 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
|
||||
));
|
||||
addPropertySubOwner(_translation.get());
|
||||
|
||||
_lineColor = dictionary.value<glm::vec3>(KeyColor);
|
||||
_lineColor = dictionary.value<glm::vec3>(LineColorInfo.identifier);
|
||||
addProperty(_lineColor);
|
||||
|
||||
if (dictionary.hasKeyAndValue<bool>(KeyEnableFade)) {
|
||||
_useLineFade = dictionary.value<bool>(KeyEnableFade);
|
||||
if (dictionary.hasKeyAndValue<bool>(EnableFadeInfo.identifier)) {
|
||||
_useLineFade = dictionary.value<bool>(EnableFadeInfo.identifier);
|
||||
}
|
||||
addProperty(_useLineFade);
|
||||
|
||||
if (dictionary.hasKeyAndValue<double>(KeyFade)) {
|
||||
_lineFade = static_cast<float>(dictionary.value<double>(KeyFade));
|
||||
if (dictionary.hasKeyAndValue<double>(FadeInfo.identifier)) {
|
||||
_lineFade = static_cast<float>(dictionary.value<double>(FadeInfo.identifier));
|
||||
}
|
||||
addProperty(_lineFade);
|
||||
|
||||
if (dictionary.hasKeyAndValue<double>(KeyLineWidth)) {
|
||||
_lineWidth = static_cast<float>(dictionary.value<double>(KeyLineWidth));
|
||||
if (dictionary.hasKeyAndValue<double>(LineWidthInfo.identifier)) {
|
||||
_lineWidth = static_cast<float>(dictionary.value<double>(
|
||||
LineWidthInfo.identifier
|
||||
));
|
||||
}
|
||||
addProperty(_lineWidth);
|
||||
|
||||
if (dictionary.hasKeyAndValue<double>(KeyPointSize)) {
|
||||
_pointSize = static_cast<int>(dictionary.value<double>(KeyPointSize));
|
||||
if (dictionary.hasKeyAndValue<double>(PointSizeInfo.identifier)) {
|
||||
_pointSize = static_cast<int>(dictionary.value<double>(PointSizeInfo.identifier));
|
||||
}
|
||||
addProperty(_pointSize);
|
||||
|
||||
@@ -180,9 +207,9 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
|
||||
|
||||
// This map is not accessed out of order as long as the Documentation is adapted
|
||||
// whenever the map changes. The documentation will check for valid values
|
||||
if (dictionary.hasKeyAndValue<std::string>(KeyRendering)) {
|
||||
if (dictionary.hasKeyAndValue<std::string>(RenderingModeInfo.identifier)) {
|
||||
_renderingModes = RenderingModeConversion.at(
|
||||
dictionary.value<std::string>(KeyRendering)
|
||||
dictionary.value<std::string>(RenderingModeInfo.identifier)
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -81,8 +81,24 @@
|
||||
// items in memory as was shown to be much slower than the current system. ---abock
|
||||
|
||||
namespace {
|
||||
const char* KeyPeriod = "Period";
|
||||
const char* KeyResolution = "Resolution";
|
||||
static const openspace::properties::Property::PropertyInfo PeriodInfo = {
|
||||
"Period",
|
||||
"Period (in days)",
|
||||
"The objects period, i.e. the length of its orbit around the parent object given "
|
||||
"in (Earth) days. In the case of Earth, this would be a sidereal year "
|
||||
"(=365.242 days). If this values is specified as multiples of the period, it is "
|
||||
"possible to show the effects of precession."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ResolutionInfo = {
|
||||
"Resolution",
|
||||
"Number of samples along the orbit",
|
||||
"The number of samples along the orbit. This determines the resolution of the "
|
||||
"trail; the tradeoff being that a higher resolution is able to resolve more "
|
||||
"detail, but will take more resources while rendering, too. The higher, the "
|
||||
"smoother the trail, but also more memory will be used."
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -94,27 +110,15 @@ documentation::Documentation RenderableTrailOrbit::Documentation() {
|
||||
"base_renderable_renderabletrailorbit",
|
||||
{
|
||||
{
|
||||
"Type",
|
||||
new StringEqualVerifier("RenderableTrailOrbit"),
|
||||
"",
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyPeriod,
|
||||
PeriodInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
"The objects period, i.e. the length of its orbit around the parent "
|
||||
"object given in (Earth) days. In the case of Earth, this would be a "
|
||||
"sidereal year (=365.242 days). If this values is specified as multiples "
|
||||
"of the period, it is possible to show the effects of precession.",
|
||||
PeriodInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyResolution,
|
||||
ResolutionInfo.identifier,
|
||||
new IntVerifier,
|
||||
"The number of samples along the orbit. This determines the resolution "
|
||||
"of the trail; the tradeoff being that a higher resolution is able to "
|
||||
"resolve more detail, but will take more resources while rendering, too. "
|
||||
"The higher, the smoother the trail, but also more memory will be used.",
|
||||
ResolutionInfo.description,
|
||||
Optional::No
|
||||
}
|
||||
}
|
||||
@@ -134,8 +138,8 @@ documentation::Documentation RenderableTrailOrbit::Documentation() {
|
||||
|
||||
RenderableTrailOrbit::RenderableTrailOrbit(const ghoul::Dictionary& dictionary)
|
||||
: RenderableTrail(dictionary)
|
||||
, _period("period", "Period in days", 0.0, 0.0, 1e9)
|
||||
, _resolution("resolution", "Number of Samples along Orbit", 10000, 1, 1000000)
|
||||
, _period(PeriodInfo, 0.0, 0.0, 1e9)
|
||||
, _resolution(ResolutionInfo, 10000, 1, 1000000)
|
||||
, _needsFullSweep(true)
|
||||
, _indexBufferDirty(true)
|
||||
, _previousTime(0)
|
||||
@@ -152,12 +156,12 @@ RenderableTrailOrbit::RenderableTrailOrbit(const ghoul::Dictionary& dictionary)
|
||||
|
||||
// Period is in days
|
||||
using namespace std::chrono;
|
||||
long long factor = duration_cast<seconds>(hours(24)).count();
|
||||
_period = dictionary.value<double>(KeyPeriod) * factor;
|
||||
const long long sph = duration_cast<seconds>(hours(24)).count();
|
||||
_period = dictionary.value<double>(PeriodInfo.identifier) * sph;
|
||||
_period.onChange([&] { _needsFullSweep = true; _indexBufferDirty = true; });
|
||||
addProperty(_period);
|
||||
|
||||
_resolution = static_cast<int>(dictionary.value<double>(KeyResolution));
|
||||
_resolution = static_cast<int>(dictionary.value<double>(ResolutionInfo.identifier));
|
||||
_resolution.onChange([&] { _needsFullSweep = true; _indexBufferDirty = true; });
|
||||
addProperty(_resolution);
|
||||
|
||||
|
||||
@@ -44,11 +44,45 @@
|
||||
|
||||
namespace {
|
||||
const char* KeyTranslation = "Translation";
|
||||
const char* KeyStartTime = "StartTime";
|
||||
const char* KeyEndTime = "EndTime";
|
||||
const char* KeySampleInterval = "SampleInterval";
|
||||
const char* KeyTimeStampSubsample = "TimeStampSubsampleFactor";
|
||||
const char* KeyShowFullTrail = "ShowFullTrail";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo StartTimeInfo = {
|
||||
"StartTime",
|
||||
"Start Time",
|
||||
"The start time for the range of this trajectory. The date must be in ISO 8601 "
|
||||
"format: YYYY MM DD HH:mm:ss.xxx."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo EndTimeInfo = {
|
||||
"EndTime",
|
||||
"End Time",
|
||||
"The end time for the range of this trajectory. The date must be in ISO 8601 "
|
||||
"format: YYYY MM DD HH:mm:ss.xxx."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SampleIntervalInfo = {
|
||||
"SampleInterval",
|
||||
"Sample Interval",
|
||||
"The interval between samples of the trajectory. This value (together with "
|
||||
"'TimeStampSubsampleFactor') determines how far apart (in time) the samples are "
|
||||
"spaced along the trajectory. The time interval between 'StartTime' and "
|
||||
"'EndTime' is split into 'SampleInterval' * 'TimeStampSubsampleFactor' segments."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TimeSubSampleInfo = {
|
||||
"TimeStampSubsampleFactor",
|
||||
"Time Stamp Subsampling Factor",
|
||||
"The factor that is used to create subsamples along the trajectory. This value "
|
||||
"(together with 'SampleInterval') determines how far apart (in time) the samples "
|
||||
"are spaced along the trajectory. The time interval between 'StartTime' and "
|
||||
"'EndTime' is split into 'SampleInterval' * 'TimeStampSubsampleFactor' segments."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo RenderFullPathInfo = {
|
||||
"ShowFullTrail",
|
||||
"Render Full Trail",
|
||||
"If this value is set to 'true', the entire trail will be rendered; if it is "
|
||||
"'false', only the trail until the current time in the application will be shown."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -61,56 +95,39 @@ documentation::Documentation RenderableTrailTrajectory::Documentation() {
|
||||
"base_renderable_renderabletrailtrajectory",
|
||||
{
|
||||
{
|
||||
"Type",
|
||||
new StringEqualVerifier("RenderableTrailTrajectory"),
|
||||
"",
|
||||
StartTimeInfo.identifier,
|
||||
new StringAnnotationVerifier("A valid date in ISO 8601 format"),
|
||||
StartTimeInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyStartTime,
|
||||
new StringAnnotationVerifier("A valid date"),
|
||||
"The start time for the range of this trajectory. The date must be in "
|
||||
"ISO 8601 format: YYYY MM DD HH:mm:ss.xxx",
|
||||
EndTimeInfo.identifier,
|
||||
new StringAnnotationVerifier("A valid date in ISO 8601 format"),
|
||||
EndTimeInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyEndTime,
|
||||
new StringAnnotationVerifier("A valid date"),
|
||||
"The end time for the range of this trajectory. The date must be in "
|
||||
"ISO 8601 format: YYYY MM DD HH:mm:ss.xxx",
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeySampleInterval,
|
||||
SampleIntervalInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
"The interval between samples of the trajectory. This value (together "
|
||||
"with 'TimeStampSubsampleFactor') determines how far apart (in time) the "
|
||||
"samples are spaced along the trajectory. The time interval between "
|
||||
"'StartTime' and 'EndTime' is split into 'SampleInterval' * "
|
||||
"'TimeStampSubsampleFactor' segments.",
|
||||
SampleIntervalInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyTimeStampSubsample,
|
||||
TimeSubSampleInfo.identifier,
|
||||
new IntVerifier,
|
||||
"The factor that is used to create subsamples along the trajectory. This "
|
||||
"value (together with 'SampleInterval') determines how far apart (in "
|
||||
"time) the samples are spaced along the trajectory. The time interval "
|
||||
"between 'StartTime' and 'EndTime' is split into 'SampleInterval' * "
|
||||
"'TimeStampSubsampleFactor' segments. The default value for this is 1",
|
||||
TimeSubSampleInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyShowFullTrail,
|
||||
RenderFullPathInfo.identifier,
|
||||
new BoolVerifier,
|
||||
"If this value is set to 'true', the entire trail will be rendered; if "
|
||||
"it is 'false', only the trail until the current time in the application "
|
||||
"will be shown. The default value for this setting is 'false'.",
|
||||
RenderFullPathInfo.description,
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// @TODO cleanup
|
||||
// Insert the parents documentation entries until we have a verifier that can deal
|
||||
// with class hierarchy
|
||||
documentation::Documentation parentDoc = RenderableTrail::Documentation();
|
||||
@@ -125,15 +142,11 @@ documentation::Documentation RenderableTrailTrajectory::Documentation() {
|
||||
|
||||
RenderableTrailTrajectory::RenderableTrailTrajectory(const ghoul::Dictionary& dictionary)
|
||||
: RenderableTrail(dictionary)
|
||||
, _startTime("startTime", "Start Time")
|
||||
, _endTime("endTime", "End Time")
|
||||
, _sampleInterval("sampleInterval", "Sample Interval", 2.0, 2.0, 1e6)
|
||||
, _timeStampSubsamplingFactor(
|
||||
"subSample",
|
||||
"Time Stamp Subsampling Factor",
|
||||
1, 1, 1000000000
|
||||
)
|
||||
, _renderFullTrail("renderFullTrail", "Render Full Trail", false)
|
||||
, _startTime(StartTimeInfo)
|
||||
, _endTime(EndTimeInfo)
|
||||
, _sampleInterval(SampleIntervalInfo, 2.0, 2.0, 1e6)
|
||||
, _timeStampSubsamplingFactor(TimeSubSampleInfo, 1, 1, 1000000000)
|
||||
, _renderFullTrail(RenderFullPathInfo, false)
|
||||
, _needsFullSweep(true)
|
||||
, _subsamplingIsDirty(true)
|
||||
{
|
||||
@@ -147,28 +160,28 @@ RenderableTrailTrajectory::RenderableTrailTrajectory(const ghoul::Dictionary& di
|
||||
_needsFullSweep = true;
|
||||
});
|
||||
|
||||
_startTime = dictionary.value<std::string>(KeyStartTime);
|
||||
_startTime = dictionary.value<std::string>(StartTimeInfo.identifier);
|
||||
_startTime.onChange([this] { _needsFullSweep = true; });
|
||||
addProperty(_startTime);
|
||||
|
||||
_endTime = dictionary.value<std::string>(KeyEndTime);
|
||||
_endTime = dictionary.value<std::string>(EndTimeInfo.identifier);
|
||||
_endTime.onChange([this] { _needsFullSweep = true; });
|
||||
addProperty(_endTime);
|
||||
|
||||
_sampleInterval = dictionary.value<double>(KeySampleInterval);
|
||||
_sampleInterval = dictionary.value<double>(SampleIntervalInfo.identifier);
|
||||
_sampleInterval.onChange([this] { _needsFullSweep = true; });
|
||||
addProperty(_sampleInterval);
|
||||
|
||||
if (dictionary.hasKeyAndValue<double>(KeyTimeStampSubsample)) {
|
||||
if (dictionary.hasKeyAndValue<double>(TimeSubSampleInfo.identifier)) {
|
||||
_timeStampSubsamplingFactor = static_cast<int>(
|
||||
dictionary.value<double>(KeyTimeStampSubsample)
|
||||
dictionary.value<double>(TimeSubSampleInfo.identifier)
|
||||
);
|
||||
}
|
||||
_timeStampSubsamplingFactor.onChange([this] { _subsamplingIsDirty = true; });
|
||||
addProperty(_timeStampSubsamplingFactor);
|
||||
|
||||
if (dictionary.hasKeyAndValue<bool>(KeyShowFullTrail)) {
|
||||
_renderFullTrail = dictionary.value<bool>(KeyShowFullTrail);
|
||||
if (dictionary.hasKeyAndValue<bool>(RenderFullPathInfo.identifier)) {
|
||||
_renderFullTrail = dictionary.value<bool>(RenderFullPathInfo.identifier);
|
||||
}
|
||||
addProperty(_renderFullTrail);
|
||||
|
||||
|
||||
@@ -34,6 +34,15 @@
|
||||
#include <openspace/rendering/framebufferrenderer.h>
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
|
||||
|
||||
namespace {
|
||||
static const openspace::properties::Property::PropertyInfo SizeInfo = {
|
||||
"Size",
|
||||
"Size",
|
||||
"This value explicitly specifies the size of the screen space plane."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation ScreenSpaceFramebuffer::Documentation() {
|
||||
@@ -48,7 +57,7 @@ documentation::Documentation ScreenSpaceFramebuffer::Documentation() {
|
||||
|
||||
ScreenSpaceFramebuffer::ScreenSpaceFramebuffer(const ghoul::Dictionary& dictionary)
|
||||
: ScreenSpaceRenderable(dictionary)
|
||||
, _size("size", "Size", glm::vec4(0), glm::vec4(0), glm::vec4(2000))
|
||||
, _size(SizeInfo, glm::vec4(0), glm::vec4(0), glm::vec4(16384))
|
||||
, _framebuffer(nullptr)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
@@ -63,13 +72,11 @@ ScreenSpaceFramebuffer::ScreenSpaceFramebuffer(const ghoul::Dictionary& dictiona
|
||||
glm::vec2 resolution = OsEng.windowWrapper().currentWindowResolution();
|
||||
addProperty(_size);
|
||||
_size.set(glm::vec4(0, 0, resolution.x,resolution.y));
|
||||
|
||||
_scale.setValue(1.0f);
|
||||
}
|
||||
|
||||
ScreenSpaceFramebuffer::~ScreenSpaceFramebuffer(){}
|
||||
ScreenSpaceFramebuffer::~ScreenSpaceFramebuffer() {}
|
||||
|
||||
bool ScreenSpaceFramebuffer::initialize(){
|
||||
bool ScreenSpaceFramebuffer::initialize() {
|
||||
_originalViewportSize = OsEng.windowWrapper().currentWindowResolution();
|
||||
|
||||
createPlane();
|
||||
@@ -79,7 +86,7 @@ bool ScreenSpaceFramebuffer::initialize(){
|
||||
return isReady();
|
||||
}
|
||||
|
||||
bool ScreenSpaceFramebuffer::deinitialize(){
|
||||
bool ScreenSpaceFramebuffer::deinitialize() {
|
||||
glDeleteVertexArrays(1, &_quad);
|
||||
_quad = 0;
|
||||
|
||||
@@ -88,7 +95,7 @@ bool ScreenSpaceFramebuffer::deinitialize(){
|
||||
|
||||
_texture = nullptr;
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_shader) {
|
||||
renderEngine.removeRenderProgram(_shader);
|
||||
_shader = nullptr;
|
||||
@@ -120,7 +127,7 @@ void ScreenSpaceFramebuffer::render() {
|
||||
glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
for(auto renderFunction : _renderFunctions){
|
||||
for (const auto& renderFunction : _renderFunctions) {
|
||||
(*renderFunction)();
|
||||
}
|
||||
_framebuffer->deactivate();
|
||||
@@ -142,42 +149,48 @@ void ScreenSpaceFramebuffer::render() {
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::update() {}
|
||||
|
||||
void ScreenSpaceFramebuffer::update(){}
|
||||
|
||||
bool ScreenSpaceFramebuffer::isReady() const{
|
||||
bool ScreenSpaceFramebuffer::isReady() const {
|
||||
bool ready = true;
|
||||
if (!_shader)
|
||||
if (!_shader) {
|
||||
ready &= false;
|
||||
if(!_texture)
|
||||
}
|
||||
if (!_texture) {
|
||||
ready &= false;
|
||||
}
|
||||
return ready;
|
||||
}
|
||||
|
||||
|
||||
void ScreenSpaceFramebuffer::setSize(glm::vec4 size){
|
||||
void ScreenSpaceFramebuffer::setSize(glm::vec4 size) {
|
||||
_size.set(size);
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::addRenderFunction(std::shared_ptr<std::function<void()>> renderFunction){
|
||||
void ScreenSpaceFramebuffer::addRenderFunction(
|
||||
std::shared_ptr<std::function<void()>> renderFunction)
|
||||
{
|
||||
_renderFunctions.push_back(renderFunction);
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::removeAllRenderFunctions(){
|
||||
void ScreenSpaceFramebuffer::removeAllRenderFunctions() {
|
||||
_renderFunctions.clear();
|
||||
}
|
||||
|
||||
void ScreenSpaceFramebuffer::createFragmentbuffer(){
|
||||
void ScreenSpaceFramebuffer::createFragmentbuffer() {
|
||||
_framebuffer = std::make_unique<ghoul::opengl::FramebufferObject>();
|
||||
_framebuffer->activate();
|
||||
_texture = std::make_unique<ghoul::opengl::Texture>(glm::uvec3(_originalViewportSize.x, _originalViewportSize.y, 1));
|
||||
_texture = std::make_unique<ghoul::opengl::Texture>(glm::uvec3(
|
||||
_originalViewportSize.x,
|
||||
_originalViewportSize.y,
|
||||
1
|
||||
));
|
||||
_texture->uploadTexture();
|
||||
_texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
|
||||
_framebuffer->attachTexture(_texture.get(), GL_COLOR_ATTACHMENT0);
|
||||
_framebuffer->deactivate();
|
||||
}
|
||||
|
||||
int ScreenSpaceFramebuffer::id(){
|
||||
int ScreenSpaceFramebuffer::id() {
|
||||
static int id = 0;
|
||||
return id++;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,15 @@ namespace {
|
||||
const char* KeyName = "Name";
|
||||
const char* KeyTexturePath = "TexturePath";
|
||||
const char* KeyUrl = "URL";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TexturePathInfo = {
|
||||
"TexturePath",
|
||||
"Texture path",
|
||||
"Sets the path of the texture that is displayed on this screen space plane. If "
|
||||
"this value is changed, the image at the new path will automatically be loaded "
|
||||
"and displayed. The size of the image will also automatically set the default "
|
||||
"size of this plane."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -70,7 +79,7 @@ ScreenSpaceImage::ScreenSpaceImage(const ghoul::Dictionary& dictionary)
|
||||
: ScreenSpaceRenderable(dictionary)
|
||||
, _downloadImage(false)
|
||||
, _textureIsDirty(false)
|
||||
, _texturePath("texturePath", "Texture path", "")
|
||||
, _texturePath(TexturePathInfo)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
|
||||
@@ -28,7 +28,12 @@
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
namespace {
|
||||
const char* KeyRotation = "Rotation";
|
||||
static const openspace::properties::Property::PropertyInfo RotationInfo = {
|
||||
"Rotation",
|
||||
"Rotation",
|
||||
"This value is the used as a 3x3 rotation matrix that is applied to the scene "
|
||||
"graph node that this transformation is attached to relative to its parent."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -46,7 +51,7 @@ documentation::Documentation StaticRotation::Documentation() {
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyRotation,
|
||||
RotationInfo.identifier,
|
||||
new OrVerifier(
|
||||
new DoubleVector3Verifier(),
|
||||
new DoubleMatrix3Verifier()
|
||||
@@ -61,8 +66,11 @@ documentation::Documentation StaticRotation::Documentation() {
|
||||
}
|
||||
|
||||
StaticRotation::StaticRotation()
|
||||
: _rotationMatrix("rotation", "Rotation", glm::dmat3(1.0))
|
||||
{}
|
||||
: _rotationMatrix(RotationInfo, glm::dmat3(1.0))
|
||||
{
|
||||
addProperty(_rotationMatrix);
|
||||
_rotationMatrix.onChange([this]() { _matrix = _rotationMatrix; });
|
||||
}
|
||||
|
||||
StaticRotation::StaticRotation(const ghoul::Dictionary& dictionary)
|
||||
: StaticRotation()
|
||||
@@ -74,18 +82,16 @@ StaticRotation::StaticRotation(const ghoul::Dictionary& dictionary)
|
||||
);
|
||||
|
||||
|
||||
if (dictionary.hasKeyAndValue<glm::dvec3>(KeyRotation)) {
|
||||
if (dictionary.hasKeyAndValue<glm::dvec3>(RotationInfo.identifier)) {
|
||||
_rotationMatrix = glm::mat3_cast(
|
||||
glm::dquat(dictionary.value<glm::dvec3>(KeyRotation))
|
||||
glm::dquat(dictionary.value<glm::dvec3>(RotationInfo.identifier))
|
||||
);
|
||||
}
|
||||
else {
|
||||
// Must be glm::dmat3 due to specification restriction
|
||||
_rotationMatrix = dictionary.value<glm::dmat3>(KeyRotation);
|
||||
_rotationMatrix = dictionary.value<glm::dmat3>(RotationInfo.identifier);
|
||||
}
|
||||
|
||||
addProperty(_rotationMatrix);
|
||||
_rotationMatrix.onChange([this]() { _matrix = _rotationMatrix; });
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -28,7 +28,12 @@
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
namespace {
|
||||
const char* KeyValue = "Scale";
|
||||
static const openspace::properties::Property::PropertyInfo ScaleInfo = {
|
||||
"Scale",
|
||||
"Scale",
|
||||
"This value is used as a scaling factor for the scene graph node that this "
|
||||
"transformation is attached to relative to its parent."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -40,27 +45,27 @@ documentation::Documentation StaticScale::Documentation() {
|
||||
"base_scale_static",
|
||||
{
|
||||
{
|
||||
KeyValue,
|
||||
ScaleInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
"The scaling factor by which the scenegraph node is scaled."
|
||||
ScaleInfo.description,
|
||||
Optional::No
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
StaticScale::StaticScale()
|
||||
: _scaleValue("scale", "Scale", 1.0, 1.0, 1000.0)
|
||||
: _scaleValue(ScaleInfo, 1.0, 1.0, 1e6)
|
||||
{
|
||||
addProperty(_scaleValue);
|
||||
}
|
||||
|
||||
|
||||
StaticScale::StaticScale(const ghoul::Dictionary& dictionary)
|
||||
: StaticScale()
|
||||
{
|
||||
documentation::testSpecificationAndThrow(Documentation(), dictionary, "StaticScale");
|
||||
|
||||
_scaleValue = static_cast<float>(dictionary.value<double>(KeyValue));
|
||||
_scaleValue = static_cast<float>(dictionary.value<double>(ScaleInfo.identifier));
|
||||
}
|
||||
|
||||
double StaticScale::scaleValue() const {
|
||||
|
||||
@@ -28,7 +28,12 @@
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
namespace {
|
||||
const char* KeyPosition = "Position";
|
||||
static const openspace::properties::Property::PropertyInfo PositionInfo = {
|
||||
"Position",
|
||||
"Position",
|
||||
"This value is used as a static offset (in meters) that is applied to the scene "
|
||||
"graph node that this transformation is attached to relative to its parent."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -46,10 +51,9 @@ documentation::Documentation StaticTranslation::Documentation() {
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyPosition,
|
||||
PositionInfo.identifier,
|
||||
new DoubleVector3Verifier,
|
||||
"Specifies the position (in meters) that this scenegraph node is located "
|
||||
"at relative to its parent",
|
||||
PositionInfo.description,
|
||||
Optional::No
|
||||
}
|
||||
},
|
||||
@@ -60,8 +64,7 @@ documentation::Documentation StaticTranslation::Documentation() {
|
||||
|
||||
StaticTranslation::StaticTranslation()
|
||||
: _position(
|
||||
"position",
|
||||
"Position",
|
||||
PositionInfo,
|
||||
glm::dvec3(0.0),
|
||||
glm::dvec3(-std::numeric_limits<double>::max()),
|
||||
glm::dvec3(std::numeric_limits<double>::max())
|
||||
@@ -76,10 +79,10 @@ StaticTranslation::StaticTranslation(const ghoul::Dictionary& dictionary)
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
"StaticEphemeris"
|
||||
"StaticTranslation"
|
||||
);
|
||||
|
||||
_position = dictionary.value<glm::dvec3>(KeyPosition);
|
||||
_position = dictionary.value<glm::dvec3>(PositionInfo.identifier);
|
||||
}
|
||||
|
||||
glm::dvec3 StaticTranslation::position() const {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <modules/debugging/debuggingmodule.h>
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
|
||||
@@ -42,4 +43,11 @@ void DebuggingModule::internalInitialize() {
|
||||
fRenderable->registerClass<RenderableDebugPlane>("RenderableDebugPlane");
|
||||
}
|
||||
|
||||
std::vector<documentation::Documentation> DebuggingModule::documentations() const {
|
||||
return {
|
||||
RenderableDebugPlane::Documentation()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -35,6 +35,8 @@ public:
|
||||
|
||||
DebuggingModule();
|
||||
|
||||
std::vector<documentation::Documentation> documentations() const override;
|
||||
|
||||
protected:
|
||||
void internalInitialize() override;
|
||||
};
|
||||
|
||||
@@ -39,62 +39,138 @@
|
||||
#include <ghoul/opengl/texture.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
#include <openspace/documentation/documentation.h>
|
||||
#include <openspace/documentation/verifier.h>
|
||||
|
||||
namespace {
|
||||
const char* _loggerCat = "RenderablePlaneTexture";
|
||||
enum Origin {
|
||||
LowerLeft = 0,
|
||||
LowerRight,
|
||||
UpperLeft,
|
||||
UpperRight,
|
||||
Center
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TextureInfo = {
|
||||
"Texture",
|
||||
"Texture",
|
||||
"The OpenGL name of the texture that is displayed on this plane."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo BillboardInfo = {
|
||||
"Billboard",
|
||||
"Billboard mode",
|
||||
"This value specifies whether the plane is a billboard, which means that it is "
|
||||
"always facing the camera. If this is false, it can be oriented using other "
|
||||
"transformations."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SizeInfo = {
|
||||
"Size",
|
||||
"Size (in meters)",
|
||||
"This value specifies the size of the plane in meters."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OriginInfo = {
|
||||
"Origin",
|
||||
"Texture Coordinate Origin",
|
||||
"The origin of the texture coorinate system."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation RenderableDebugPlane::Documentation() {
|
||||
using namespace documentation;
|
||||
return {
|
||||
"RenderableDebugPlane",
|
||||
"debugging_renderable_debugplane",
|
||||
{
|
||||
{
|
||||
TextureInfo.identifier,
|
||||
new IntVerifier,
|
||||
TextureInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
BillboardInfo.identifier,
|
||||
new BoolVerifier,
|
||||
BillboardInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
SizeInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
SizeInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
OriginInfo.identifier,
|
||||
new StringInListVerifier(
|
||||
{ "LowerLeft", "LowerRight", "UpperLeft", "UpperRight", "Center" }
|
||||
),
|
||||
OriginInfo.description,
|
||||
Optional::Yes
|
||||
}
|
||||
},
|
||||
Exhaustive::Yes
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
RenderableDebugPlane::RenderableDebugPlane(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _texture("texture", "Texture", -1, -1, 255)
|
||||
, _billboard("billboard", "Billboard", false)
|
||||
, _size("size", "Size", 10.f, 0.f, std::pow(10.f, 25.f))
|
||||
, _origin(Origin::Center)
|
||||
, _texture(TextureInfo, -1, -1, 512)
|
||||
, _billboard(BillboardInfo, false)
|
||||
, _size(SizeInfo, 10.f, 0.f, 1e25f)
|
||||
, _origin(OriginInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _shader(nullptr)
|
||||
, _quad(0)
|
||||
, _vertexPositionBuffer(0)
|
||||
{
|
||||
dictionary.getValue("Size", _size);
|
||||
|
||||
if (dictionary.hasKey("Name")){
|
||||
dictionary.getValue("Name", _nodeName);
|
||||
if (dictionary.hasKey(TextureInfo.identifier)) {
|
||||
_texture = static_cast<int>(dictionary.value<double>(TextureInfo.identifier));
|
||||
}
|
||||
|
||||
if (dictionary.hasKey("Texture")) {
|
||||
int t;
|
||||
dictionary.getValue("Texture", t);
|
||||
_texture = t;
|
||||
if (dictionary.hasKey(SizeInfo.identifier)) {
|
||||
_size = static_cast<float>(dictionary.value<double>(SizeInfo.identifier));
|
||||
}
|
||||
|
||||
std::string origin;
|
||||
if (dictionary.getValue("Origin", origin)) {
|
||||
if (dictionary.hasKey(BillboardInfo.identifier)) {
|
||||
_billboard = dictionary.value<bool>(BillboardInfo.identifier);
|
||||
}
|
||||
|
||||
_origin.addOptions({
|
||||
{ LowerLeft, "LowerLeft" },
|
||||
{ LowerRight, "LowerRight" },
|
||||
{ UpperLeft, "UpperLeft" },
|
||||
{ UpperRight, "UpperRight" },
|
||||
{ Center, "Center" }
|
||||
});
|
||||
_origin.setValue(Center);
|
||||
|
||||
if (dictionary.hasKey(OriginInfo.identifier)) {
|
||||
const std::string origin = dictionary.value<std::string>(OriginInfo.identifier);
|
||||
if (origin == "LowerLeft") {
|
||||
_origin = Origin::LowerLeft;
|
||||
_origin = LowerLeft;
|
||||
}
|
||||
else if (origin == "LowerRight") {
|
||||
_origin = Origin::LowerRight;
|
||||
_origin = LowerRight;
|
||||
}
|
||||
else if (origin == "UpperLeft") {
|
||||
_origin = Origin::UpperLeft;
|
||||
_origin = UpperLeft;
|
||||
}
|
||||
else if (origin == "UpperRight") {
|
||||
_origin = Origin::UpperRight;
|
||||
_origin = UpperRight;
|
||||
}
|
||||
else if (origin == "Center") {
|
||||
_origin = Origin::Center;
|
||||
_origin = Center;
|
||||
}
|
||||
}
|
||||
|
||||
// Attempt to get the billboard value
|
||||
bool billboard = false;
|
||||
if (dictionary.getValue("Billboard", billboard)) {
|
||||
_billboard = billboard;
|
||||
else {
|
||||
_origin = Center;
|
||||
}
|
||||
|
||||
int texture;
|
||||
if (dictionary.getValue("Texture", texture))
|
||||
_texture = texture;
|
||||
addProperty(_texture);
|
||||
|
||||
addProperty(_billboard);
|
||||
@@ -105,13 +181,13 @@ RenderableDebugPlane::RenderableDebugPlane(const ghoul::Dictionary& dictionary)
|
||||
setBoundingSphere(_size);
|
||||
}
|
||||
|
||||
RenderableDebugPlane::~RenderableDebugPlane() {
|
||||
}
|
||||
RenderableDebugPlane::~RenderableDebugPlane() {}
|
||||
|
||||
bool RenderableDebugPlane::isReady() const {
|
||||
bool ready = true;
|
||||
if (!_shader)
|
||||
if (!_shader) {
|
||||
ready &= false;
|
||||
}
|
||||
return ready;
|
||||
}
|
||||
|
||||
@@ -120,19 +196,14 @@ bool RenderableDebugPlane::initialize() {
|
||||
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
|
||||
createPlane();
|
||||
|
||||
if (_shader == nullptr) {
|
||||
// Plane Program
|
||||
|
||||
if (!_shader) {
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
_shader = renderEngine.buildRenderProgram("PlaneProgram",
|
||||
"${MODULE_BASE}/shaders/plane_vs.glsl",
|
||||
"${MODULE_BASE}/shaders/plane_fs.glsl"
|
||||
);
|
||||
if (!_shader)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return isReady();
|
||||
}
|
||||
|
||||
@@ -154,8 +225,9 @@ bool RenderableDebugPlane::deinitialize() {
|
||||
|
||||
void RenderableDebugPlane::render(const RenderData& data, RendererTasks&) {
|
||||
glm::mat4 transform = glm::mat4(1.0);
|
||||
if (_billboard)
|
||||
if (_billboard) {
|
||||
transform = glm::inverse(glm::mat4(data.camera.viewRotationMatrix()));
|
||||
}
|
||||
|
||||
// Activate shader
|
||||
_shader->activate();
|
||||
@@ -176,11 +248,13 @@ void RenderableDebugPlane::render(const RenderData& data, RendererTasks&) {
|
||||
}
|
||||
|
||||
void RenderableDebugPlane::update(const UpdateData&) {
|
||||
if (_shader->isDirty())
|
||||
if (_shader->isDirty()) {
|
||||
_shader->rebuildFromFile();
|
||||
}
|
||||
|
||||
if (_planeIsDirty)
|
||||
if (_planeIsDirty) {
|
||||
createPlane();
|
||||
}
|
||||
}
|
||||
|
||||
void RenderableDebugPlane::createPlane() {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
@@ -37,6 +38,8 @@ namespace ghoul::opengl {
|
||||
class Texture;
|
||||
} // namespace ghoul::opengl
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
namespace openspace {
|
||||
|
||||
struct LinePoint;
|
||||
@@ -54,19 +57,15 @@ public:
|
||||
void render(const RenderData& data, RendererTasks& rendererTask) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
enum class Origin {
|
||||
LowerLeft, LowerRight, UpperLeft, UpperRight, Center
|
||||
};
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
void createPlane();
|
||||
|
||||
properties::IntProperty _texture;
|
||||
properties::BoolProperty _billboard;
|
||||
properties::FloatProperty _size;
|
||||
|
||||
Origin _origin;
|
||||
std::string _nodeName;
|
||||
properties::OptionProperty _origin;
|
||||
|
||||
bool _planeIsDirty;
|
||||
|
||||
|
||||
@@ -70,23 +70,52 @@ namespace {
|
||||
|
||||
const int SeedPointSourceFile = 0;
|
||||
const int SeedPointSourceTable = 1;
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo StepSizeInfo = {
|
||||
"StepSize",
|
||||
"Fieldline Step Size",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo Classification = {
|
||||
"Classification",
|
||||
"Fieldline Classification",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FieldlineColorInfo = {
|
||||
"FieldlineColor",
|
||||
"Fieldline Color",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SeedPointSourceInfo = {
|
||||
"Source",
|
||||
"SeedPoint Source",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SeedPointFileInfo = {
|
||||
"SourceFile",
|
||||
"SeedPoint File",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
RenderableFieldlines::RenderableFieldlines(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _stepSize("stepSize", "Fieldline Step Size", defaultFieldlineStepSize, 0.f, 10.f)
|
||||
, _classification("classification", "Fieldline Classification", true)
|
||||
, _stepSize(StepSizeInfo, defaultFieldlineStepSize, 0.f, 10.f)
|
||||
, _classification(Classification, true)
|
||||
, _fieldlineColor(
|
||||
"fieldlineColor",
|
||||
"Fieldline Color",
|
||||
FieldlineColorInfo,
|
||||
defaultFieldlineColor,
|
||||
glm::vec4(0.f),
|
||||
glm::vec4(1.f)
|
||||
)
|
||||
, _seedPointSource("source", "SeedPoint Source")
|
||||
, _seedPointSourceFile("sourceFile", "SeedPoint File")
|
||||
, _seedPointSource(SeedPointSourceInfo)
|
||||
, _seedPointSourceFile(SeedPointFileInfo)
|
||||
, _program(nullptr)
|
||||
, _seedPointsAreDirty(true)
|
||||
, _fieldLinesAreDirty(true)
|
||||
|
||||
@@ -51,18 +51,48 @@ namespace {
|
||||
const std::string GlslBoundsVsPath = "${MODULES}/toyvolume/shaders/boundsVs.glsl";
|
||||
const std::string GlslBoundsFsPath = "${MODULES}/toyvolume/shaders/boundsFs.glsl";
|
||||
const std::string _loggerCat = "Renderable Galaxy";
|
||||
}
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo StepSizeInfo = {
|
||||
"StepSize",
|
||||
"Step Size",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo PointStepSizeInfo = {
|
||||
"PointStepSize",
|
||||
"Point Step Size",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TranslationInfo = {
|
||||
"Translation",
|
||||
"Translation",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo RotationInfo = {
|
||||
"Rotation",
|
||||
"Euler rotation",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo EnabledPointsRatioInfo = {
|
||||
"NEnabledPointsRatio",
|
||||
"Enabled points",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
RenderableGalaxy::RenderableGalaxy(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _stepSize("stepSize", "Step Size", 0.012, 0.0005, 0.05)
|
||||
, _pointStepSize("pointStepSize", "Point Step Size", 0.01, 0.01, 0.1)
|
||||
, _translation("translation", "Translation", glm::vec3(0.0, 0.0, 0.0), glm::vec3(0.0), glm::vec3(10.0))
|
||||
, _rotation("rotation", "Euler rotation", glm::vec3(0.0, 0.0, 0.0), glm::vec3(0), glm::vec3(6.28))
|
||||
, _enabledPointsRatio("nEnabledPointsRatio", "Enabled points", 0.2, 0, 1) {
|
||||
|
||||
, _stepSize(StepSizeInfo, 0.012f, 0.0005f, 0.05f)
|
||||
, _pointStepSize(PointStepSizeInfo, 0.01f, 0.01f, 0.1f)
|
||||
, _translation(TranslationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(10.f))
|
||||
, _rotation(RotationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(6.28f))
|
||||
, _enabledPointsRatio(EnabledPointsRatioInfo, 0.2f, 0.f, 1.f)
|
||||
{
|
||||
float stepSize;
|
||||
glm::vec3 scaling, translation, rotation;
|
||||
glm::vec4 color;
|
||||
|
||||
@@ -37,6 +37,46 @@
|
||||
|
||||
namespace {
|
||||
const char* _loggerCat = "MemoryAwareTileCache";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo CpuAllocatedDataInfo = {
|
||||
"CpuAllocatedTileData",
|
||||
"CPU allocated tile data (MB)",
|
||||
"This value denotes the amount of RAM memory (in MB) that this tile cache is "
|
||||
"utilizing."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo GpuAllocatedDataInfo = {
|
||||
"GpuAllocatedTileData",
|
||||
"GPU allocated tile data (MB)",
|
||||
"This value denotes the amount of GPU memory (in MB) that this tile cache is "
|
||||
"utilizing."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TileCacheSizeInfo = {
|
||||
"TileCacheSize",
|
||||
"Tile cache size",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ApplyTileCacheInfo = {
|
||||
"ApplyTileCacheSize",
|
||||
"Apply tile cache size",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ClearTileCacheInfo = {
|
||||
"ClearTileCache",
|
||||
"Clear tile cache",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo UsePboInfo = {
|
||||
"UsePbo",
|
||||
"Use PBO",
|
||||
"If this value is enabled, pixel buffer objects are used to upload the texture "
|
||||
"data asynchronously. If this value is disabled, the upload is synchronously."
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace::globebrowsing::cache {
|
||||
@@ -44,27 +84,12 @@ namespace openspace::globebrowsing::cache {
|
||||
MemoryAwareTileCache::MemoryAwareTileCache()
|
||||
: PropertyOwner("TileCache")
|
||||
, _numTextureBytesAllocatedOnCPU(0)
|
||||
, _cpuAllocatedTileData(
|
||||
"cpuAllocatedTileData", "CPU allocated tile data (MB)",
|
||||
1024, // Default
|
||||
128, // Minimum
|
||||
2048, // Maximum
|
||||
1) // Step: One MB
|
||||
, _gpuAllocatedTileData(
|
||||
"gpuAllocatedTileData", "GPU allocated tile data (MB)",
|
||||
1024, // Default
|
||||
128, // Minimum
|
||||
2048, // Maximum
|
||||
1) // Step: One MB
|
||||
, _tileCacheSize(
|
||||
"tileCacheSize", "Tile cache size",
|
||||
1024, // Default
|
||||
128, // Minimum
|
||||
2048, // Maximum
|
||||
1) // Step: One MB
|
||||
, _applyTileCacheSize("applyTileCacheSize", "Apply tile cache size")
|
||||
, _clearTileCache("clearTileCache", "Clear tile cache")
|
||||
, _usePbo("usePbo", "Use PBO", false)
|
||||
, _cpuAllocatedTileData(CpuAllocatedDataInfo, 1024, 128, 2048, 1)
|
||||
, _gpuAllocatedTileData(GpuAllocatedDataInfo, 1024, 128, 2048, 1)
|
||||
, _tileCacheSize(TileCacheSizeInfo, 1024, 128, 2048, 1)
|
||||
, _applyTileCacheSize(ApplyTileCacheInfo)
|
||||
, _clearTileCache(ClearTileCacheInfo)
|
||||
, _usePbo(UsePboInfo, false)
|
||||
{
|
||||
createDefaultTextureContainers();
|
||||
|
||||
@@ -144,7 +169,8 @@ void MemoryAwareTileCache::setSizeEstimated(size_t estimatedSize) {
|
||||
|
||||
size_t sumTextureTypeSize = std::accumulate(
|
||||
_textureContainerMap.cbegin(),
|
||||
_textureContainerMap.cend(), 0,
|
||||
_textureContainerMap.cend(),
|
||||
size_t(0),
|
||||
[](size_t s, const std::pair<const TileTextureInitData::HashKey,
|
||||
TextureContainerTileCache>& p)
|
||||
{
|
||||
|
||||
@@ -57,7 +57,8 @@ const GeodeticPatch ChunkedLodGlobe::COVERAGE = GeodeticPatch(0, 0, 90, 180);
|
||||
|
||||
ChunkedLodGlobe::ChunkedLodGlobe(const RenderableGlobe& owner, size_t segmentsPerPatch,
|
||||
std::shared_ptr<LayerManager> layerManager)
|
||||
: minSplitDepth(2)
|
||||
: Renderable({ { "Name", owner.name() } })
|
||||
, minSplitDepth(2)
|
||||
, maxSplitDepth(22)
|
||||
, stats(StatsCollector(absPath("test_stats"), 1, StatsCollector::Enabled::No))
|
||||
, _owner(owner)
|
||||
|
||||
@@ -33,20 +33,27 @@
|
||||
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
|
||||
namespace {
|
||||
static const openspace::properties::Property::PropertyInfo IntensityClampInfo = {
|
||||
"IntensityClamp",
|
||||
"Intensity clamp",
|
||||
""
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LightIntensityInfo = {
|
||||
"LightIntensity",
|
||||
"Light intensity",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
PointGlobe::PointGlobe(const RenderableGlobe& owner)
|
||||
: _owner(owner)
|
||||
, _intensityClamp(
|
||||
"intensityClamp",
|
||||
"Intensity clamp",
|
||||
1, 0, 1
|
||||
)
|
||||
, _lightIntensity(
|
||||
"lightIntensity",
|
||||
"Light intensity",
|
||||
1, 0, 50
|
||||
)
|
||||
: Renderable({ { "Name", owner.name() } })
|
||||
, _owner(owner)
|
||||
, _intensityClamp(IntensityClampInfo, 1.f, 0.f, 1.f)
|
||||
, _lightIntensity(LightIntensityInfo, 1.f, 0.f, 50.f)
|
||||
{
|
||||
addProperty(_intensityClamp);
|
||||
addProperty(_lightIntensity);
|
||||
|
||||
@@ -37,6 +37,120 @@ namespace {
|
||||
const char* keyShadowGroup = "Shadow_Group";
|
||||
const char* keyShadowSource = "Source";
|
||||
const char* keyShadowCaster = "Caster";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SaveOrThrowInfo = {
|
||||
"SaveOrThrowCamera",
|
||||
"Save or throw camera",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ShowChunkEdgeInfo = {
|
||||
"ShowChunkEdges",
|
||||
"Show chunk edges",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ShowChunkBoundsInfo = {
|
||||
"ShowChunkBounds",
|
||||
"Show chunk bounds",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ShowChunkAABBInfo = {
|
||||
"ShowChunkAABB",
|
||||
"Show chunk AABB",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HeightResolutionInfo = {
|
||||
"ShowHeightResolution",
|
||||
"Show height resolution",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HeightIntensityInfo = {
|
||||
"ShowHeightIntensities",
|
||||
"Show height intensities",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FrustumCullingInfo = {
|
||||
"PerformFrustumCulling",
|
||||
"Perform frustum culling",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HorizonCullingInfo = {
|
||||
"PerformHorizonCulling",
|
||||
"Perform horizon culling",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LevelProjectedAreaInfo = {
|
||||
"LevelByProjectedAreaElseDistance",
|
||||
"Level by projected area (else distance)",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ResetTileProviderInfo = {
|
||||
"ResetTileProviders",
|
||||
"Reset tile providers",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo CollectStatsInfo = {
|
||||
"CollectStats",
|
||||
"Collect stats",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LimitLevelInfo = {
|
||||
"LimitLevelByAvailableData",
|
||||
"Limit level by available data",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ModelSpaceRenderingInfo = {
|
||||
"ModelSpaceRenderingCutoffLevel",
|
||||
"Model Space Rendering Cutoff Level",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo PerformShadingInfo = {
|
||||
"PerformShading",
|
||||
"Perform shading",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AtmosphereInfo = {
|
||||
"Atmosphere",
|
||||
"Atmosphere",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AccurateNormalsInfo = {
|
||||
"UseAccurateNormals",
|
||||
"Use Accurate Normals",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LodScaleFactorInfo = {
|
||||
"LodScaleFactor",
|
||||
"Level of Detail Scale Factor",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo CameraMinHeightInfo = {
|
||||
"CameraMinHeight",
|
||||
"Camera Minimum Height",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OrenNayarRoughnessInfo = {
|
||||
"OrenNayarRoughness",
|
||||
"orenNayarRoughness",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
} // namespace
|
||||
|
||||
using namespace openspace::properties;
|
||||
@@ -44,30 +158,29 @@ using namespace openspace::properties;
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
: _debugProperties({
|
||||
BoolProperty("saveOrThrowCamera", "save or throw camera", false),
|
||||
BoolProperty("showChunkEdges", "show chunk edges", false),
|
||||
BoolProperty("showChunkBounds", "show chunk bounds", false),
|
||||
BoolProperty("showChunkAABB", "show chunk AABB", false),
|
||||
BoolProperty("showHeightResolution", "show height resolution", false),
|
||||
BoolProperty("showHeightIntensities", "show height intensities", false),
|
||||
BoolProperty("performFrustumCulling", "perform frustum culling", true),
|
||||
BoolProperty("performHorizonCulling", "perform horizon culling", true),
|
||||
BoolProperty("levelByProjectedAreaElseDistance", "level by projected area (else distance)", true),
|
||||
BoolProperty("resetTileProviders", "reset tile providers", false),
|
||||
BoolProperty("toggleEnabledEveryFrame", "toggle enabled every frame", false),
|
||||
BoolProperty("collectStats", "collect stats", false),
|
||||
BoolProperty("limitLevelByAvailableData", "Limit level by available data", true),
|
||||
IntProperty("modelSpaceRenderingCutoffLevel", "Model Space Rendering Cutoff Level", 10, 1, 22)
|
||||
: Renderable(dictionary)
|
||||
, _debugProperties({
|
||||
BoolProperty(SaveOrThrowInfo, false),
|
||||
BoolProperty(ShowChunkEdgeInfo, false),
|
||||
BoolProperty(ShowChunkBoundsInfo, false),
|
||||
BoolProperty(ShowChunkAABBInfo, false),
|
||||
BoolProperty(HeightResolutionInfo, false),
|
||||
BoolProperty(HeightIntensityInfo, false),
|
||||
BoolProperty(FrustumCullingInfo, true),
|
||||
BoolProperty(HorizonCullingInfo, true),
|
||||
BoolProperty(LevelProjectedAreaInfo, true),
|
||||
BoolProperty(ResetTileProviderInfo, false),
|
||||
BoolProperty(CollectStatsInfo, false),
|
||||
BoolProperty(LimitLevelInfo, true),
|
||||
IntProperty(ModelSpaceRenderingInfo, 10, 1, 22)
|
||||
})
|
||||
, _generalProperties({
|
||||
BoolProperty("enabled", "Enabled", true),
|
||||
BoolProperty("performShading", "perform shading", true),
|
||||
BoolProperty("atmosphere", "atmosphere", false),
|
||||
BoolProperty("useAccurateNormals", "useAccurateNormals", false),
|
||||
FloatProperty("lodScaleFactor", "lodScaleFactor",10.0f, 1.0f, 50.0f),
|
||||
FloatProperty("cameraMinHeight", "cameraMinHeight", 100.0f, 0.0f, 1000.0f),
|
||||
FloatProperty("orenNayarRoughness", "orenNayarRoughness", 0.0f, 0.0f, 1.0f)
|
||||
BoolProperty(PerformShadingInfo, true),
|
||||
BoolProperty(AtmosphereInfo, false),
|
||||
BoolProperty(AccurateNormalsInfo, false),
|
||||
FloatProperty(LodScaleFactorInfo, 10.f, 1.f, 50.f),
|
||||
FloatProperty(CameraMinHeightInfo, 100.f, 0.f, 1000.f),
|
||||
FloatProperty(OrenNayarRoughnessInfo, 0.f, 0.f, 1.f)
|
||||
})
|
||||
, _debugPropertyOwner("Debug")
|
||||
, _texturePropertyOwner("Textures")
|
||||
@@ -107,7 +220,6 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
_distanceSwitch.addSwitchValue(_chunkedLodGlobe);
|
||||
//_distanceSwitch.addSwitchValue(_pointGlobe);
|
||||
|
||||
addProperty(_generalProperties.isEnabled);
|
||||
addProperty(_generalProperties.atmosphereEnabled);
|
||||
addProperty(_generalProperties.performShading);
|
||||
addProperty(_generalProperties.useAccurateNormals);
|
||||
@@ -127,7 +239,6 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
_debugProperties.levelByProjectedAreaElseDistance
|
||||
);
|
||||
_debugPropertyOwner.addProperty(_debugProperties.resetTileProviders);
|
||||
_debugPropertyOwner.addProperty(_debugProperties.toggleEnabledEveryFrame);
|
||||
_debugPropertyOwner.addProperty(_debugProperties.collectStats);
|
||||
_debugPropertyOwner.addProperty(_debugProperties.limitLevelByAvailableData);
|
||||
_debugPropertyOwner.addProperty(_debugProperties.modelSpaceRenderingCutoffLevel);
|
||||
@@ -240,12 +351,7 @@ void RenderableGlobe::render(const RenderData& data, RendererTasks& renderTask)
|
||||
bool statsEnabled = _debugProperties.collectStats.value();
|
||||
_chunkedLodGlobe->stats.setEnabled(statsEnabled);
|
||||
|
||||
if (_debugProperties.toggleEnabledEveryFrame.value()) {
|
||||
_generalProperties.isEnabled.setValue(
|
||||
!_generalProperties.isEnabled.value()
|
||||
);
|
||||
}
|
||||
if (_generalProperties.isEnabled.value()) {
|
||||
if (_enabled) {
|
||||
if (_debugProperties.saveOrThrowCamera.value()) {
|
||||
_debugProperties.saveOrThrowCamera.setValue(false);
|
||||
|
||||
|
||||
@@ -70,14 +70,12 @@ public:
|
||||
properties::BoolProperty performHorizonCulling;
|
||||
properties::BoolProperty levelByProjectedAreaElseDistance;
|
||||
properties::BoolProperty resetTileProviders;
|
||||
properties::BoolProperty toggleEnabledEveryFrame;
|
||||
properties::BoolProperty collectStats;
|
||||
properties::BoolProperty limitLevelByAvailableData;
|
||||
properties::IntProperty modelSpaceRenderingCutoffLevel;
|
||||
};
|
||||
|
||||
struct GeneralProperties {
|
||||
properties::BoolProperty isEnabled;
|
||||
properties::BoolProperty performShading;
|
||||
properties::BoolProperty atmosphereEnabled;
|
||||
properties::BoolProperty useAccurateNormals;
|
||||
|
||||
@@ -52,7 +52,7 @@ void* PixelBufferContainer<KeyType>::mapBuffer(KeyType key, PixelBuffer::Access
|
||||
_pixelBuffers[i]->unbind();
|
||||
if (dataPtr) { // Success in mapping
|
||||
// Add this index to the map of mapped pixel buffers
|
||||
_indexMap.emplace(key, i);
|
||||
_indexMap.emplace(key, static_cast<int>(i));
|
||||
return dataPtr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,13 +35,9 @@ void GPULayerRenderSettings::setValue(ghoul::opengl::ProgramObject* programObjec
|
||||
gpuGamma.setValue(programObject, layerSettings.gamma.value());
|
||||
gpuMultiplier.setValue(programObject, layerSettings.multiplier.value());
|
||||
gpuOffset.setValue(programObject, layerSettings.offset.value());
|
||||
|
||||
if (layerSettings.useValueBlending) {
|
||||
gpuValueBlending.setValue(programObject, layerSettings.valueBlending.value());
|
||||
}
|
||||
}
|
||||
|
||||
void GPULayerRenderSettings::bind(const LayerRenderSettings& layerSettings,
|
||||
void GPULayerRenderSettings::bind(const LayerRenderSettings&,
|
||||
ghoul::opengl::ProgramObject* programObject,
|
||||
const std::string& nameBase)
|
||||
{
|
||||
@@ -49,10 +45,6 @@ void GPULayerRenderSettings::bind(const LayerRenderSettings& layerSettings,
|
||||
gpuGamma.bind(programObject, nameBase + "gamma");
|
||||
gpuMultiplier.bind(programObject, nameBase + "multiplier");
|
||||
gpuOffset.bind(programObject, nameBase + "offset");
|
||||
|
||||
if (layerSettings.useValueBlending) {
|
||||
gpuValueBlending.bind(programObject, nameBase + "valueBlending");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace openspace::globebrowsing
|
||||
|
||||
@@ -37,31 +37,55 @@ namespace {
|
||||
const char* keySettings = "Settings";
|
||||
const char* keyAdjustment = "Adjustment";
|
||||
const char* KeyBlendMode = "BlendMode";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TypeInfo = {
|
||||
"Type",
|
||||
"Type",
|
||||
"The type of this Layer. This value is a read-only property and thus cannot be "
|
||||
"changed."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo BlendModeInfo = {
|
||||
"BlendMode",
|
||||
"Blend Mode",
|
||||
"This value specifies the blend mode that is applied to this layer. The blend "
|
||||
"mode determines how this layer is added to the underlying layers beneath."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo EnabledInfo = {
|
||||
"Enabled",
|
||||
"Enabled",
|
||||
"If this value is enabled, the layer will be used for the final composition of "
|
||||
"the planet. If this value is disabled, the layer will be ignored in the "
|
||||
"composition."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ResetInfo = {
|
||||
"Reset",
|
||||
"Reset",
|
||||
"If this value is triggered, this layer will be reset. This will delete the "
|
||||
"local cache for this layer and will trigger a fresh load of all tiles."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ColorInfo = {
|
||||
"Color",
|
||||
"Color",
|
||||
"If the 'Type' of this layer is a solid color, this value determines what this "
|
||||
"solid color is."
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict)
|
||||
: properties::PropertyOwner(layerDict.value<std::string>(keyName))
|
||||
, _typeOption(
|
||||
"type",
|
||||
"Type",
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
)
|
||||
, _blendModeOption(
|
||||
"blendMode",
|
||||
"Blend Mode",
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
)
|
||||
, _enabled(properties::BoolProperty("enabled", "Enabled", false))
|
||||
, _reset("reset", "Reset")
|
||||
, _typeOption(TypeInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _blendModeOption(BlendModeInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _enabled(EnabledInfo, false)
|
||||
, _reset(ResetInfo)
|
||||
, _tileProvider(nullptr)
|
||||
, _otherTypesProperties{
|
||||
properties::Vec3Property (
|
||||
"color",
|
||||
"Color",
|
||||
glm::vec4(1.f, 1.f, 1.f, 1.f),
|
||||
glm::vec4(0.f),
|
||||
glm::vec4(1.f))
|
||||
}
|
||||
, _otherTypesProperties({
|
||||
{ ColorInfo, glm::vec4(1.f), glm::vec4(0.f), glm::vec4(1.f) }
|
||||
})
|
||||
, _layerGroupId(id)
|
||||
{
|
||||
layergroupid::TypeID typeID = parseTypeIdFromDictionary(layerDict);
|
||||
|
||||
@@ -28,32 +28,34 @@ namespace {
|
||||
const char* keyType = "Type";
|
||||
const char* keyChromaKeyColor = "ChromaKeyColor";
|
||||
const char* keyChromaKeyTolerance = "ChromaKeyTolerance";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ChromaKeyColorInfo = {
|
||||
"ChromaKeyColor",
|
||||
"Chroma Key Color",
|
||||
"This color is used as the chroma key for the layer that is adjusted."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ChromaKeyToleranceInfo = {
|
||||
"ChromaKeyTolerance",
|
||||
"Chroma Key Tolerance",
|
||||
"This value determines the tolerance that is used to determine whether a color "
|
||||
"is matching the selected Chroma key."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TypeInfo = {
|
||||
"Type",
|
||||
"Type",
|
||||
"The type of layer adjustment that is applied to the underlying layer."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
LayerAdjustment::LayerAdjustment()
|
||||
: properties::PropertyOwner("adjustment")
|
||||
, chromaKeyColor(
|
||||
"chromaKeyColor",
|
||||
"Chroma key color",
|
||||
glm::vec3(0.f, 0.f, 0.f),
|
||||
glm::vec3(0.f),
|
||||
glm::vec3(1.f)
|
||||
)
|
||||
, chromaKeyTolerance(
|
||||
"chromaKeyTolerance",
|
||||
"Chroma key tolerance",
|
||||
0,
|
||||
0,
|
||||
1
|
||||
)
|
||||
, _typeOption(
|
||||
"type",
|
||||
"Type",
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
)
|
||||
, _onChangeCallback([](){})
|
||||
, chromaKeyColor(ChromaKeyColorInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(1.f))
|
||||
, chromaKeyTolerance(ChromaKeyToleranceInfo, 0.f, 0.f, 1.f)
|
||||
, _typeOption(TypeInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
{
|
||||
// Add options to option properties
|
||||
for (int i = 0; i < layergroupid::NUM_ADJUSTMENT_TYPES; ++i) {
|
||||
@@ -66,7 +68,9 @@ LayerAdjustment::LayerAdjustment()
|
||||
removeVisibleProperties();
|
||||
_type = static_cast<layergroupid::AdjustmentTypeID>(_typeOption.value());
|
||||
addVisibleProperties();
|
||||
_onChangeCallback();
|
||||
if (_onChangeCallback) {
|
||||
_onChangeCallback();
|
||||
}
|
||||
});
|
||||
chromaKeyColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
|
||||
|
||||
@@ -28,14 +28,23 @@
|
||||
|
||||
namespace {
|
||||
const char* _loggerCat = "LayerGroup";
|
||||
}
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo BlendTileInfo = {
|
||||
"BlendTileLevels",
|
||||
"Blend between levels",
|
||||
"If this value is enabled, images between different levels are interpolated, "
|
||||
"rather than switching between levels abruptly. This makes transitions smoother "
|
||||
"and more visually pleasing."
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
LayerGroup::LayerGroup(layergroupid::GroupID id)
|
||||
: properties::PropertyOwner(std::move(layergroupid::LAYER_GROUP_NAMES[id]))
|
||||
, _groupId(id)
|
||||
, _levelBlendingEnabled("blendTileLevels", "blend tile levels", false)
|
||||
, _levelBlendingEnabled(BlendTileInfo, true)
|
||||
{
|
||||
addProperty(_levelBlendingEnabled);
|
||||
}
|
||||
|
||||
@@ -30,56 +30,87 @@ namespace {
|
||||
const char* keyMultiplier = "Multiplier";
|
||||
const char* keyOffset = "Offset";
|
||||
const char* keyValueBlending = "ValueBlending";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SetDefaultInfo = {
|
||||
"SetDefault",
|
||||
"Set Default",
|
||||
"If this value is triggered it will reset all of these values to their default "
|
||||
"values."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OpacityInfo = {
|
||||
"Opacity",
|
||||
"Opacity",
|
||||
"This value sets the transparency of this layer. If this value is equal to '1', "
|
||||
"the layer is completely opaque. If this value is equal to '0', the layer is "
|
||||
"completely transparent."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo GammaInfo = {
|
||||
"Gamma",
|
||||
"Gamma",
|
||||
"This value is used as an exponent to adjust the color for each tile."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo MultiplierInfo = {
|
||||
"Multiplier",
|
||||
"Multiplier",
|
||||
"This value is used as a multiplier to adjust the color applied after taking the "
|
||||
"gamma value as an exponent."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OffsetInfo = {
|
||||
"Offset",
|
||||
"Offset",
|
||||
"This value is used as an additive modifier to adjust the color applied after "
|
||||
"the gamma exponent and the multiplier has been performed."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
LayerRenderSettings::LayerRenderSettings()
|
||||
: properties::PropertyOwner("Settings")
|
||||
, setDefault("setDefault", "Set Default")
|
||||
, opacity(properties::FloatProperty("opacity", "Opacity", 1.f, 0.f, 1.f))
|
||||
, gamma(properties::FloatProperty("gamma", "Gamma", 1, 0, 5))
|
||||
, multiplier(properties::FloatProperty("multiplier", "Multiplier", 1.f, 0.f, 20.f))
|
||||
, offset(properties::FloatProperty("offset", "Offset", 0.f, -10000.f, 10000.f))
|
||||
, valueBlending(properties::FloatProperty("valueBlending", "Value Blending",
|
||||
1.f, 0.f, 1.f))
|
||||
, useValueBlending(false)
|
||||
, setDefault(SetDefaultInfo)
|
||||
, opacity(OpacityInfo, 1.f, 0.f, 1.f)
|
||||
, gamma(GammaInfo, 1.f, 0.f, 5.f)
|
||||
, multiplier(MultiplierInfo, 1.f, 0.f, 20.f)
|
||||
, offset(OffsetInfo, 0.f, -10000.f, 10000.f)
|
||||
{
|
||||
// Implicitly added properties (other ones are not for all layer types)
|
||||
addProperty(opacity);
|
||||
addProperty(gamma);
|
||||
addProperty(multiplier);
|
||||
addProperty(offset);
|
||||
addProperty(setDefault);
|
||||
|
||||
setDefault.onChange([this](){ setDefaultValues(); });
|
||||
setDefault.onChange([this](){
|
||||
opacity = 1.f;
|
||||
gamma = 1.f;
|
||||
multiplier = 1.f;
|
||||
offset = 0.f;
|
||||
});
|
||||
}
|
||||
|
||||
void LayerRenderSettings::setValuesFromDictionary(
|
||||
const ghoul::Dictionary& renderSettingsDict)
|
||||
const ghoul::Dictionary& renderSettingsDict)
|
||||
{
|
||||
float dictOpacity;
|
||||
float dictGamma;
|
||||
float dictMultiplier;
|
||||
float dictOffset;
|
||||
float dictValueBlending;
|
||||
|
||||
if(renderSettingsDict.getValue(keyOpacity, dictOpacity)) {
|
||||
if (renderSettingsDict.getValue(keyOpacity, dictOpacity)) {
|
||||
opacity = dictOpacity;
|
||||
}
|
||||
if(renderSettingsDict.getValue(keyGamma, dictGamma)) {
|
||||
if (renderSettingsDict.getValue(keyGamma, dictGamma)) {
|
||||
gamma = dictGamma;
|
||||
}
|
||||
if(renderSettingsDict.getValue(keyMultiplier, dictMultiplier)) {
|
||||
if (renderSettingsDict.getValue(keyMultiplier, dictMultiplier)) {
|
||||
multiplier = dictMultiplier;
|
||||
}
|
||||
if(renderSettingsDict.getValue(keyOffset, dictOffset)) {
|
||||
if (renderSettingsDict.getValue(keyOffset, dictOffset)) {
|
||||
multiplier = dictOffset;
|
||||
}
|
||||
if(renderSettingsDict.getValue(keyValueBlending, dictValueBlending)) {
|
||||
valueBlending = dictValueBlending;
|
||||
useValueBlending = true;
|
||||
}
|
||||
}
|
||||
|
||||
float LayerRenderSettings::performLayerSettings(float currentValue) const {
|
||||
@@ -103,12 +134,4 @@ glm::vec4 LayerRenderSettings::performLayerSettings(glm::vec4 currentValue) cons
|
||||
return newValue;
|
||||
}
|
||||
|
||||
void LayerRenderSettings::setDefaultValues() {
|
||||
opacity = 1.f;
|
||||
gamma = 1.f;
|
||||
multiplier = 1.f;
|
||||
offset = 0.f;
|
||||
valueBlending = 1.f;
|
||||
}
|
||||
|
||||
} // namespace openspace::globebrowsing
|
||||
|
||||
@@ -42,10 +42,6 @@ struct LayerRenderSettings : public properties::PropertyOwner {
|
||||
properties::FloatProperty multiplier;
|
||||
properties::FloatProperty offset;
|
||||
|
||||
// Optional properties
|
||||
properties::FloatProperty valueBlending;
|
||||
bool useValueBlending = false;
|
||||
|
||||
void setValuesFromDictionary(const ghoul::Dictionary& renderSettingsDict);
|
||||
|
||||
/// This function matches the function with the same name in the
|
||||
@@ -54,9 +50,6 @@ struct LayerRenderSettings : public properties::PropertyOwner {
|
||||
/// This function matches the function with the same name in the
|
||||
/// shader code
|
||||
glm::vec4 performLayerSettings(glm::vec4 currentValue) const;
|
||||
|
||||
private:
|
||||
void setDefaultValues();
|
||||
};
|
||||
|
||||
} // namespace openspace::globebrowsing
|
||||
|
||||
@@ -42,7 +42,11 @@ RawTile RawTile::createDefault(const TileTextureInitData& initData) {
|
||||
RawTile defaultRes;
|
||||
defaultRes.textureInitData = std::make_shared<TileTextureInitData>(initData);
|
||||
defaultRes.imageData = new char[initData.totalNumBytes()];
|
||||
std::fill_n(static_cast<char*>(defaultRes.imageData), initData.totalNumBytes(), 0);
|
||||
std::fill_n(
|
||||
static_cast<char*>(defaultRes.imageData),
|
||||
initData.totalNumBytes(),
|
||||
char(0)
|
||||
);
|
||||
return defaultRes;
|
||||
|
||||
}
|
||||
|
||||
@@ -33,10 +33,34 @@
|
||||
#include <ghoul/ghoul.h>
|
||||
#include <ghoul/logging/consolelog.h>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable : 4251) // needs to have dll-interface to be used by clients
|
||||
#endif // WIN32
|
||||
|
||||
#include <gdal_priv.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (pop)
|
||||
#endif // WIN32
|
||||
|
||||
namespace {
|
||||
const char* _loggerCat = "GdalWrapper";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LogGdalErrorInfo = {
|
||||
"LogGdalErrors",
|
||||
"Log GDAL errors",
|
||||
"If this value is enabled, any error that is raised by GDAL will be logged using "
|
||||
"the logmanager. If this value is disabled, any error will be ignored."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo GdalMaximumCacheInfo = {
|
||||
"GdalMaximumCacheSize",
|
||||
"GDAL maximum cache size",
|
||||
"This function sets the maximum amount of RAM memory in MB that GDAL is "
|
||||
"permitted to use for caching."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace::globebrowsing {
|
||||
@@ -56,8 +80,7 @@ void gdalErrorHandler(CPLErr eErrClass, int errNo, const char *msg) {
|
||||
GdalWrapper* GdalWrapper::_singleton = nullptr;
|
||||
std::mutex GdalWrapper::_mutexLock;
|
||||
|
||||
void GdalWrapper::create(size_t maximumCacheSize,
|
||||
size_t maximumMaximumCacheSize) {
|
||||
void GdalWrapper::create(size_t maximumCacheSize, size_t maximumMaximumCacheSize) {
|
||||
std::lock_guard<std::mutex> guard(_mutexLock);
|
||||
_singleton = new GdalWrapper(maximumCacheSize, maximumMaximumCacheSize);
|
||||
}
|
||||
@@ -85,12 +108,11 @@ bool GdalWrapper::logGdalErrors() const {
|
||||
return _logGdalErrors;
|
||||
}
|
||||
|
||||
GdalWrapper::GdalWrapper(size_t maximumCacheSize,
|
||||
size_t maximumMaximumCacheSize)
|
||||
GdalWrapper::GdalWrapper(size_t maximumCacheSize, size_t maximumMaximumCacheSize)
|
||||
: PropertyOwner("GdalWrapper")
|
||||
, _logGdalErrors("logGdalErrors", "Log GDAL errors", true)
|
||||
, _logGdalErrors(LogGdalErrorInfo, true)
|
||||
, _gdalMaximumCacheSize (
|
||||
"gdalMaximumCacheSize", "GDAL maximum cache size",
|
||||
GdalMaximumCacheInfo,
|
||||
maximumCacheSize / (1024 * 1024), // Default
|
||||
0, // Minimum: No caching
|
||||
maximumMaximumCacheSize / (1024 * 1024), // Maximum
|
||||
|
||||
@@ -49,14 +49,30 @@ namespace {
|
||||
const char* KeyFilePath = "FilePath";
|
||||
const char* KeyBasePath = "BasePath";
|
||||
const char* KeyPreCacheLevel = "PreCacheLevel";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FilePathInfo = {
|
||||
"FilePath",
|
||||
"File Path",
|
||||
"The path of the GDAL file or the image file that is to be used in this tile "
|
||||
"provider."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TilePixelSizeInfo = {
|
||||
"TilePixelSize",
|
||||
"Tile Pixel Size",
|
||||
"This value is the preferred size (in pixels) for each tile. Choosing the right "
|
||||
"value is a tradeoff between more efficiency (larger images) and better quality "
|
||||
"(smaller images). The tile pixel size has to be smaller than the size of the "
|
||||
"complete image if a single image is used."
|
||||
};
|
||||
}
|
||||
|
||||
namespace openspace::globebrowsing::tileprovider {
|
||||
|
||||
DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
|
||||
: TileProvider(dictionary)
|
||||
, _filePath("filePath", "File Path", "")
|
||||
, _tilePixelSize("tilePixelSize", "Tile Pixel Size", 32, 32, 1024)
|
||||
, _filePath(FilePathInfo, "")
|
||||
, _tilePixelSize(TilePixelSizeInfo, 32, 32, 2048)
|
||||
, _preCacheLevel(0)
|
||||
{
|
||||
_tileCache = OsEng.moduleEngine().module<GlobeBrowsingModule>()->tileCache();
|
||||
@@ -80,7 +96,7 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
|
||||
int tilePixelSize = 0;
|
||||
if (dictionary.getValue<double>(KeyTilePixelSize, pixelSize)) {
|
||||
LDEBUG("Default pixel size overridden: " << pixelSize);
|
||||
tilePixelSize = pixelSize;
|
||||
tilePixelSize = static_cast<int>(pixelSize);
|
||||
}
|
||||
TileTextureInitData initData(LayerManager::getTileTextureInitData(
|
||||
_layerGroupID, tilePixelSize));
|
||||
@@ -105,15 +121,13 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_tilePixelSize);
|
||||
}
|
||||
|
||||
DefaultTileProvider::DefaultTileProvider(
|
||||
std::shared_ptr<AsyncTileDataProvider> tileReader)
|
||||
DefaultTileProvider::DefaultTileProvider(std::shared_ptr<AsyncTileDataProvider> tileReader)
|
||||
: _asyncTextureDataProvider(tileReader)
|
||||
, _filePath("filePath", "File Path", "")
|
||||
, _tilePixelSize("tilePixelSize", "Tile Pixel Size", 32, 32, 1024)
|
||||
{ }
|
||||
, _filePath(FilePathInfo, "")
|
||||
, _tilePixelSize(TilePixelSizeInfo, 32, 32, 2048)
|
||||
{}
|
||||
|
||||
DefaultTileProvider::~DefaultTileProvider()
|
||||
{ }
|
||||
DefaultTileProvider::~DefaultTileProvider() {}
|
||||
|
||||
void DefaultTileProvider::update() {
|
||||
if (_asyncTextureDataProvider) {
|
||||
|
||||
@@ -30,13 +30,20 @@
|
||||
|
||||
namespace {
|
||||
const char* KeyFilePath = "FilePath";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FilePathInfo = {
|
||||
"FilePath",
|
||||
"File Path",
|
||||
"The file path that is used for this image provider. The file must point to an "
|
||||
"image that is then loaded and used for all tiles."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace::globebrowsing::tileprovider {
|
||||
|
||||
SingleImageProvider::SingleImageProvider(const ghoul::Dictionary& dictionary)
|
||||
: _tile(nullptr, nullptr, Tile::Status::Unavailable)
|
||||
, _filePath("filePath", "File Path", "")
|
||||
, _filePath(FilePathInfo)
|
||||
{
|
||||
// Required input
|
||||
std::string filePath;
|
||||
@@ -50,7 +57,7 @@ SingleImageProvider::SingleImageProvider(const ghoul::Dictionary& dictionary)
|
||||
|
||||
SingleImageProvider::SingleImageProvider(const std::string& imagePath)
|
||||
: _tile(nullptr, nullptr, Tile::Status::Unavailable)
|
||||
, _filePath("filePath", "File Path", imagePath)
|
||||
, _filePath(FilePathInfo, imagePath)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,9 @@ void SizeReferenceTileProvider::renderText(const ghoul::fontrendering::FontRende
|
||||
|
||||
glm::vec2 textPosition;
|
||||
textPosition.x = 0;
|
||||
textPosition.y = aboveEquator ? _fontSize / 2 : _initData.dimensionsWithPadding().y - 3 * _fontSize / 2;
|
||||
textPosition.y = aboveEquator ?
|
||||
_fontSize / 2.f :
|
||||
_initData.dimensionsWithPadding().y - 3.f * _fontSize / 2.f;
|
||||
glm::vec4 color(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
fontRenderer.render(
|
||||
@@ -80,7 +82,7 @@ void SizeReferenceTileProvider::renderText(const ghoul::fontrendering::FontRende
|
||||
color,
|
||||
" %.0f %s",
|
||||
tileLongitudalLength, unit.c_str()
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
int SizeReferenceTileProvider::roundedLongitudalLength(const TileIndex& tileIndex) const {
|
||||
@@ -95,7 +97,7 @@ int SizeReferenceTileProvider::roundedLongitudalLength(const TileIndex& tileInde
|
||||
if (useKm) {
|
||||
l /= 1000;
|
||||
}
|
||||
l = std::round(l);
|
||||
l = static_cast<int>(std::round(l));
|
||||
if (useKm) {
|
||||
l *= 1000;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,13 @@ namespace {
|
||||
const char* KeyBasePath = "BasePath";
|
||||
const char* KeyPreCacheStartTime = "PreCacheStartTime";
|
||||
const char* KeyPreCacheEndTime = "PreCacheEndTime";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FilePathInfo = {
|
||||
"FilePath",
|
||||
"File Path",
|
||||
"This is the path to the XML configuration file that describes the temporal tile "
|
||||
"information."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace::globebrowsing::tileprovider {
|
||||
@@ -56,7 +63,7 @@ const char* TemporalTileProvider::TemporalXMLTags::TIME_FORMAT = "OpenSpaceTimeI
|
||||
|
||||
TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary)
|
||||
: _initDict(dictionary)
|
||||
, _filePath("filePath", "File Path", "")
|
||||
, _filePath(FilePathInfo)
|
||||
, _successfulInitialization(false)
|
||||
{
|
||||
std::string filePath;
|
||||
@@ -64,7 +71,7 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary)
|
||||
try {
|
||||
filePath = absPath(filePath);
|
||||
}
|
||||
catch (const std::runtime_error& e) {
|
||||
catch (const std::runtime_error&) {
|
||||
// File path was not a path to a file but a GDAL config or empty
|
||||
}
|
||||
|
||||
@@ -116,7 +123,7 @@ bool TemporalTileProvider::readFilePath() {
|
||||
ghoul::filesystem::File(_filePath.value()).directoryName()
|
||||
);
|
||||
}
|
||||
catch (const std::runtime_error& e) {
|
||||
catch (const std::runtime_error&) {
|
||||
// File path was not a path to a file but a GDAL config or empty
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ TextTileProvider::TextTileProvider(const TileTextureInitData& initData, size_t f
|
||||
, _fontSize(fontSize)
|
||||
{
|
||||
_tileCache = OsEng.moduleEngine().module<GlobeBrowsingModule>()->tileCache();
|
||||
_font = OsEng.fontManager().font("Mono", _fontSize);
|
||||
_font = OsEng.fontManager().font("Mono", static_cast<float>(_fontSize));
|
||||
|
||||
_fontRenderer = std::unique_ptr<FontRenderer>(FontRenderer::createDefault());
|
||||
_fontRenderer->setFramebufferSize(_initData.dimensionsWithPadding());
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
namespace openspace::globebrowsing::tileprovider {
|
||||
|
||||
TileIndexTileProvider::TileIndexTileProvider(const ghoul::Dictionary& dict)
|
||||
TileIndexTileProvider::TileIndexTileProvider(const ghoul::Dictionary&)
|
||||
: TextTileProvider(LayerManager::getTileTextureInitData(
|
||||
layergroupid::GroupID::ColorLayers
|
||||
))
|
||||
|
||||
@@ -34,6 +34,49 @@
|
||||
|
||||
namespace {
|
||||
const char* _loggerCat = "DataCygnet";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DataOptionsInfo = {
|
||||
"DataOptions",
|
||||
"Data Options",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo UseLogInfo = {
|
||||
"UseLog",
|
||||
"Use Logarithm",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo UseHistogramInfo = {
|
||||
"UseHistogram",
|
||||
"Auto Contrast",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AutoFilterInfo = {
|
||||
"AutoFilter",
|
||||
"Auto Filter",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo NormalizeValuesInfo = {
|
||||
"NormValues",
|
||||
"Normalize Values",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo BackgroundInfo = {
|
||||
"BackgroundValues",
|
||||
"Background Values",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TransferFunctionsFile = {
|
||||
"Transferfunctions",
|
||||
"Transfer Functions",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -41,13 +84,13 @@ namespace openspace {
|
||||
DataCygnet::DataCygnet(const ghoul::Dictionary& dictionary)
|
||||
: IswaCygnet(dictionary)
|
||||
, _dataProcessor(nullptr)
|
||||
, _dataOptions("dataOptions", "Data Options")
|
||||
, _useLog("useLog","Use Logarithm", false)
|
||||
, _useHistogram("useHistogram", "Auto Contrast", false)
|
||||
, _autoFilter("autoFilter", "Auto Filter", true)
|
||||
, _normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
|
||||
, _backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
|
||||
, _transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
|
||||
, _dataOptions(DataOptionsInfo)
|
||||
, _useLog(UseLogInfo, false)
|
||||
, _useHistogram(UseHistogramInfo, false)
|
||||
, _autoFilter(AutoFilterInfo, true)
|
||||
, _normValues(NormalizeValuesInfo, glm::vec2(1.f), glm::vec2(0.f), glm::vec2(5.f))
|
||||
, _backgroundValues(BackgroundInfo, glm::vec2(0.f), glm::vec2(0.f), glm::vec2(1.f))
|
||||
, _transferFunctionsFile(TransferFunctionsFile, "${SCENE}/iswa/tfs/default.tf")
|
||||
//FOR TESTING
|
||||
, _numOfBenchmarks(0)
|
||||
, _avgBenchmarkTime(0.0f)
|
||||
|
||||
@@ -38,15 +38,34 @@
|
||||
namespace {
|
||||
const char* _loggerCat = "IswaBaseGroup";
|
||||
using json = nlohmann::json;
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo EnabledInfo = {
|
||||
"Enabled",
|
||||
"Enabled",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AlphaInfo = {
|
||||
"Alpha",
|
||||
"Alpha",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DeleteInfo = {
|
||||
"Delete",
|
||||
"Delete",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
IswaBaseGroup::IswaBaseGroup(std::string name, std::string type)
|
||||
: properties::PropertyOwner(std::move(name))
|
||||
, _enabled("enabled", "Enabled", true)
|
||||
, _alpha("alpha", "Alpha", 0.9f, 0.0f, 1.0f)
|
||||
, _delete("delete", "Delete")
|
||||
, _enabled(EnabledInfo, true)
|
||||
, _alpha(AlphaInfo, 0.9f, 0.f, 1.f)
|
||||
, _delete(DeleteInfo)
|
||||
, _registered(false)
|
||||
, _type(type)
|
||||
, _dataProcessor(nullptr)
|
||||
@@ -55,7 +74,7 @@ IswaBaseGroup::IswaBaseGroup(std::string name, std::string type)
|
||||
addProperty(_alpha);
|
||||
addProperty(_delete);
|
||||
|
||||
_groupEvent = std::make_shared<ghoul::Event<ghoul::Dictionary> >();
|
||||
_groupEvent = std::make_shared<ghoul::Event<ghoul::Dictionary>>();
|
||||
registerProperties();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,14 +35,25 @@
|
||||
|
||||
namespace {
|
||||
const char* _loggerCat = "IswaCygnet";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DeleteInfo = {
|
||||
"Delete",
|
||||
"Delete",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
static const openspace::properties::Property::PropertyInfo AlphaInfo = {
|
||||
"Alpha",
|
||||
"Alpha",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _delete("delete", "Delete")
|
||||
, _alpha("alpha", "Alpha", 0.9f, 0.0f, 1.0f)
|
||||
, _delete(DeleteInfo)
|
||||
, _alpha(AlphaInfo, 0.9f, 0.f, 1.f)
|
||||
, _shader(nullptr)
|
||||
, _group(nullptr)
|
||||
, _textureDirty(false)
|
||||
|
||||
@@ -38,18 +38,61 @@
|
||||
namespace {
|
||||
const char* _loggerCat = "IswaDataGroup";
|
||||
using json = nlohmann::json;
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo UseLogInfo = {
|
||||
"UseLog",
|
||||
"Use Logarithm",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo UseHistogramInfo = {
|
||||
"UseHistogram",
|
||||
"Auto Contrast",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AutoFilterInfo = {
|
||||
"AutoFilter",
|
||||
"Auto Filter",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo NormalizeValues = {
|
||||
"NormValues",
|
||||
"Normalize Values",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo BackgroundInfo = {
|
||||
"BackgroundValues",
|
||||
"Background Values",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TransferFunctionInfo = {
|
||||
"Transferfunctions",
|
||||
"Transfer Functions",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DataOptionsInfo = {
|
||||
"DataOptions",
|
||||
"Data Options",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace{
|
||||
IswaDataGroup::IswaDataGroup(std::string name, std::string type)
|
||||
: IswaBaseGroup(name, type)
|
||||
, _useLog("useLog","Use Logarithm", false)
|
||||
, _useHistogram("useHistogram", "Auto Contrast", false)
|
||||
, _autoFilter("autoFilter", "Auto Filter", true)
|
||||
, _normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
|
||||
, _backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
|
||||
, _transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
|
||||
, _dataOptions("dataOptions", "Data Options")
|
||||
, _useLog(UseLogInfo, false)
|
||||
, _useHistogram(UseHistogramInfo, false)
|
||||
, _autoFilter(AutoFilterInfo, true)
|
||||
, _normValues(NormalizeValues, glm::vec2(1.f), glm::vec2(0.f), glm::vec2(5.f))
|
||||
, _backgroundValues(BackgroundInfo, glm::vec2(0.f), glm::vec2(0.f), glm::vec2(1.f))
|
||||
, _transferFunctionsFile(TransferFunctionInfo, "${SCENE}/iswa/tfs/default.tf")
|
||||
, _dataOptions(DataOptionsInfo)
|
||||
{
|
||||
addProperty(_useLog);
|
||||
addProperty(_useHistogram);
|
||||
|
||||
@@ -38,15 +38,28 @@
|
||||
namespace {
|
||||
const char* _loggerCat = "IswaDataGroup";
|
||||
using json = nlohmann::json;
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ResolutionInfo = {
|
||||
"Resolution",
|
||||
"Resolution%",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FieldlineSeedInfo = {
|
||||
"FieldlineSeedsIndexFile",
|
||||
"Fieldline Seedpoints",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace{
|
||||
IswaKameleonGroup::IswaKameleonGroup(std::string name, std::string type)
|
||||
:IswaDataGroup(name, type)
|
||||
,_resolution("resolution", "Resolution%", 100.0f, 10.0f, 200.0f)
|
||||
,_fieldlines("fieldlineSeedsIndexFile", "Fieldline Seedpoints")
|
||||
,_fieldlineIndexFile("")
|
||||
,_kameleonPath("")
|
||||
: IswaDataGroup(name, type)
|
||||
, _resolution(ResolutionInfo, 100.f, 10.f, 200.f)
|
||||
, _fieldlines(FieldlineSeedInfo)
|
||||
, _fieldlineIndexFile("")
|
||||
, _kameleonPath("")
|
||||
{
|
||||
addProperty(_resolution);
|
||||
addProperty(_fieldlines);
|
||||
|
||||
@@ -33,15 +33,33 @@
|
||||
namespace {
|
||||
using json = nlohmann::json;
|
||||
const char* _loggerCat = "KameleonPlane";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FieldLineSeedsInfo = {
|
||||
"FieldlineSeedsIndexFile",
|
||||
"Fieldline Seedpoints",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ResolutionInfo = {
|
||||
"Resolution",
|
||||
"Resolution%",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SliceInfo = {
|
||||
"Slice",
|
||||
"Slice",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
KameleonPlane::KameleonPlane(const ghoul::Dictionary& dictionary)
|
||||
: DataCygnet(dictionary)
|
||||
, _fieldlines("fieldlineSeedsIndexFile", "Fieldline Seedpoints")
|
||||
, _resolution("resolution", "Resolution%", 100.0f, 10.0f, 200.0f)
|
||||
, _slice("slice", "Slice", 0.0, 0.0, 1.0)
|
||||
, _fieldlines(FieldLineSeedsInfo)
|
||||
, _resolution(ResolutionInfo, 100.f, 10.f, 200.f)
|
||||
, _slice(SliceInfo, 0.f, 0.f, 1.f)
|
||||
{
|
||||
addProperty(_resolution);
|
||||
addProperty(_slice);
|
||||
|
||||
@@ -28,6 +28,11 @@
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable : 4619) // #pragma warning: there is no warning number '4675'
|
||||
#endif // WIN32
|
||||
|
||||
#include <ccmc/Kameleon.h>
|
||||
#include <ccmc/Model.h>
|
||||
#include <ccmc/Interpolator.h>
|
||||
@@ -35,6 +40,10 @@
|
||||
#include <ccmc/ENLIL.h>
|
||||
#include <ccmc/CCMCTime.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (pop)
|
||||
#endif // WIN32
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include <cstdio>
|
||||
@@ -940,9 +949,24 @@ void KameleonWrapper::getGridVariables(std::string& x, std::string& y, std::stri
|
||||
y = tokens.at(1);
|
||||
z = tokens.at(2);
|
||||
|
||||
std::transform(x.begin(), x.end(), x.begin(), ::tolower);
|
||||
std::transform(y.begin(), y.end(), y.begin(), ::tolower);
|
||||
std::transform(z.begin(), z.end(), z.begin(), ::tolower);
|
||||
std::transform(
|
||||
x.begin(),
|
||||
x.end(),
|
||||
x.begin(),
|
||||
[](char c) { return static_cast<char>(tolower(c)); }
|
||||
);
|
||||
std::transform(
|
||||
y.begin(),
|
||||
y.end(),
|
||||
y.begin(),
|
||||
[](char c) { return static_cast<char>(tolower(c)); }
|
||||
);
|
||||
std::transform(
|
||||
z.begin(),
|
||||
z.end(),
|
||||
z.begin(),
|
||||
[](char c) { return static_cast<char>(tolower(c)); }
|
||||
);
|
||||
}
|
||||
|
||||
KameleonWrapper::GridType KameleonWrapper::getGridType(
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable : 4345) // #pragma warning: there is no warning number '4345'
|
||||
#pragma warning (disable : 4619) // #pragma warning: there is no warning number '4619'
|
||||
#pragma warning (disable : 4675) // #pragma warning: there is no warning number '4675'
|
||||
#pragma warning (disable : 4800) // #pragma warning: there is no warning number '4800'
|
||||
|
||||
@@ -58,30 +58,102 @@ namespace {
|
||||
const char* KeyCache = "Cache";
|
||||
const char* KeyGridType = "GridType";
|
||||
const char* ValueSphericalGridType = "Spherical";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DimensionsInfo = {
|
||||
"Dimensions",
|
||||
"Dimensions",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo VariableInfo = {
|
||||
"Variable",
|
||||
"Variable",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LowerDomainBoundInfo = {
|
||||
"LowerDomainBound",
|
||||
"Lower Domain Bound",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo UpperDomainBoundInfo = {
|
||||
"UpperDomainBound",
|
||||
"Upper Domain Bound",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DomainScaleInfo = {
|
||||
"DomainScale",
|
||||
"Domain scale",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LowerValueBoundInfo = {
|
||||
"LowerValueBound",
|
||||
"Lower Value Bound",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo UpperValueBoundInfo = {
|
||||
"UpperValueBound",
|
||||
"Upper Value Bound",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo GridTypeInfo = {
|
||||
"GridType",
|
||||
"Grid Type",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo StepSizeInfo = {
|
||||
"StepSize",
|
||||
"Step Size",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SourcePathInfo = {
|
||||
"SourcePath",
|
||||
"Source Path",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TransferFunctionInfo = {
|
||||
"TransferFunctionPath",
|
||||
"Transfer Function Path",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo CacheInfo = {
|
||||
"Cache",
|
||||
"Cache",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
RenderableKameleonVolume::RenderableKameleonVolume(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _dimensions("dimensions", "Dimensions")
|
||||
, _variable("variable", "Variable")
|
||||
, _lowerDomainBound("lowerDomainBound", "Lower Domain Bound")
|
||||
, _upperDomainBound("upperDomainBound", "Upper Domain Bound")
|
||||
, _domainScale("domainScale", "Domain scale")
|
||||
, _dimensions(DimensionsInfo)
|
||||
, _variable(VariableInfo)
|
||||
, _lowerDomainBound(LowerDomainBoundInfo)
|
||||
, _upperDomainBound(UpperDomainBoundInfo)
|
||||
, _domainScale(DomainScaleInfo)
|
||||
, _autoDomainBounds(false)
|
||||
, _lowerValueBound("lowerValueBound", "Lower Value Bound", 0.f, 0.f, 1.f)
|
||||
, _upperValueBound("upperValueBound", "Upper Value Bound", 1.f, 0.01f, 1.f)
|
||||
, _lowerValueBound(LowerValueBoundInfo, 0.f, 0.f, 1.f)
|
||||
, _upperValueBound(UpperValueBoundInfo, 1.f, 0.01f, 1.f)
|
||||
, _autoValueBounds(false)
|
||||
, _gridType("gridType", "Grid Type", properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _gridType(GridTypeInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _autoGridType(false)
|
||||
, _clipPlanes(nullptr)
|
||||
, _stepSize("stepSize", "Step Size", 0.02f, 0.01f, 1.f)
|
||||
, _sourcePath("sourcePath", "Source Path")
|
||||
, _transferFunctionPath("transferFunctionPath", "Transfer Function Path")
|
||||
, _stepSize(StepSizeInfo, 0.02f, 0.01f, 1.f)
|
||||
, _sourcePath(SourcePathInfo)
|
||||
, _transferFunctionPath(TransferFunctionInfo)
|
||||
, _raycaster(nullptr)
|
||||
, _transferFunction(nullptr)
|
||||
, _cache("cache", "Cache")
|
||||
, _cache(CacheInfo)
|
||||
{
|
||||
|
||||
glm::vec3 dimensions;
|
||||
|
||||
@@ -80,6 +80,85 @@ namespace {
|
||||
const char* GlslHelperPath = "${MODULES}/multiresvolume/shaders/helper.glsl";
|
||||
const char* GlslHeaderPath = "${MODULES}/multiresvolume/shaders/header.glsl";
|
||||
bool registeredGlslHelpers = false;
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo StepSizeCoefficientInfo = {
|
||||
"StepSizeCoefficient",
|
||||
"Stepsize Coefficient",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo CurrentTimeInfo = {
|
||||
"CurrentTime",
|
||||
"Current Time",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo MemoryBudgetInfo = {
|
||||
"MemoryBudget",
|
||||
"Memory Budget",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo StreamingBudgetInfo = {
|
||||
"StreamingBudget",
|
||||
"Streaming Budget",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo UseGlobalTimeInfo = {
|
||||
"UseGlobalTime",
|
||||
"Global Time",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LoopInfo = {
|
||||
"Loop",
|
||||
"Loop",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SelectorNameInfo = {
|
||||
"Selector",
|
||||
"Brick Selector",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo StatsToFileInfo = {
|
||||
"PrintStats",
|
||||
"Print Stats",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo StatsToFileNameInfo = {
|
||||
"PrintStatsFileName",
|
||||
"Stats Filename",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ScalingExponentInfo = {
|
||||
"ScalingExponent",
|
||||
"Scaling Exponent",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ScalingInfo = {
|
||||
"Scaling",
|
||||
"Scaling",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TranslationInfo = {
|
||||
"Translation",
|
||||
"Translation",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo RotationInfo = {
|
||||
"Rotation",
|
||||
"Euler rotation",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -95,20 +174,20 @@ RenderableMultiresVolume::RenderableMultiresVolume (const ghoul::Dictionary& dic
|
||||
, _errorHistogramManager(nullptr)
|
||||
, _histogramManager(nullptr)
|
||||
, _localErrorHistogramManager(nullptr)
|
||||
, _stepSizeCoefficient("stepSizeCoefficient", "Stepsize Coefficient", 1.f, 0.01f, 10.f)
|
||||
, _currentTime("currentTime", "Current Time", 0, 0, 0)
|
||||
, _memoryBudget("memoryBudget", "Memory Budget", 0, 0, 0)
|
||||
, _streamingBudget("streamingBudget", "Streaming Budget", 0, 0, 0)
|
||||
, _useGlobalTime("useGlobalTime", "Global Time", false)
|
||||
, _loop("loop", "Loop", false)
|
||||
, _selectorName("selector", "Brick Selector")
|
||||
, _stepSizeCoefficient(StepSizeCoefficientInfo, 1.f, 0.01f, 10.f)
|
||||
, _currentTime(CurrentTimeInfo, 0, 0, 0)
|
||||
, _memoryBudget(MemoryBudgetInfo, 0, 0, 0)
|
||||
, _streamingBudget(StreamingBudgetInfo, 0, 0, 0)
|
||||
, _useGlobalTime(UseGlobalTimeInfo, false)
|
||||
, _loop(LoopInfo, false)
|
||||
, _selectorName(SelectorNameInfo)
|
||||
, _gatheringStats(false)
|
||||
, _statsToFile("printStats", "Print Stats", false)
|
||||
, _statsToFileName("printStatsFileName", "Stats Filename")
|
||||
, _scalingExponent("scalingExponent", "Scaling Exponent", 1, -10, 20)
|
||||
, _scaling("scaling", "Scaling", glm::vec3(1.f), glm::vec3(0.f), glm::vec3(10.f))
|
||||
, _translation("translation", "Translation", glm::vec3(0.f), glm::vec3(0.f), glm::vec3(10.f))
|
||||
, _rotation("rotation", "Euler rotation", glm::vec3(0.f, 0.f, 0.f), glm::vec3(0.f), glm::vec3(6.28f))
|
||||
, _statsToFile(StatsToFileInfo, false)
|
||||
, _statsToFileName(StatsToFileNameInfo)
|
||||
, _scalingExponent(ScalingExponentInfo, 1, -10, 20)
|
||||
, _scaling(ScalingInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(10.f))
|
||||
, _translation(TranslationInfo, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(10.f))
|
||||
, _rotation(RotationInfo, glm::vec3(0.f, 0.f, 0.f), glm::vec3(0.f), glm::vec3(6.28f))
|
||||
{
|
||||
std::string name;
|
||||
//bool success = dictionary.getValue(constants::scenegraphnode::keyName, name);
|
||||
@@ -349,9 +428,24 @@ bool RenderableMultiresVolume::initialize() {
|
||||
unsigned int maxInitialBudget = 2048;
|
||||
int initialBudget = std::min(maxInitialBudget, maxNumBricks);
|
||||
|
||||
_currentTime = properties::IntProperty("currentTime", "Current Time", 0, 0, _tsp->header().numTimesteps_ - 1);
|
||||
_memoryBudget = properties::IntProperty("memoryBudget", "Memory Budget", initialBudget, 0, maxNumBricks);
|
||||
_streamingBudget = properties::IntProperty("streamingBudget", "Streaming Budget", initialBudget, 0, maxNumBricks);
|
||||
_currentTime = properties::IntProperty(
|
||||
CurrentTimeInfo,
|
||||
0,
|
||||
0,
|
||||
_tsp->header().numTimesteps_ - 1
|
||||
);
|
||||
_memoryBudget = properties::IntProperty(
|
||||
MemoryBudgetInfo,
|
||||
initialBudget,
|
||||
0,
|
||||
maxNumBricks
|
||||
);
|
||||
_streamingBudget = properties::IntProperty(
|
||||
StreamingBudgetInfo,
|
||||
initialBudget,
|
||||
0,
|
||||
maxNumBricks
|
||||
);
|
||||
addProperty(_currentTime);
|
||||
addProperty(_memoryBudget);
|
||||
addProperty(_streamingBudget);
|
||||
|
||||
@@ -51,6 +51,85 @@ namespace {
|
||||
const char* KeyFrameConversions = "FrameConversions";
|
||||
|
||||
const int InterpolationSteps = 5;
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LineWidthInfo = {
|
||||
"LineWidth",
|
||||
"Line Width",
|
||||
"This value determines width of the lines connecting the instrument to the "
|
||||
"corners of the field of view."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DrawSolidInfo = {
|
||||
"SolidDraw",
|
||||
"Solid Draw",
|
||||
"This value determines whether the field of view should be rendered as a solid "
|
||||
"or as lines only."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo StandoffDistanceInfo = {
|
||||
"StandOffDistance",
|
||||
"Standoff Distance Factor",
|
||||
"This value determines the standoff distance factor which influences the "
|
||||
"distance of the plane to the focus object. If this value is '1', the field of "
|
||||
"view will be rendered exactly on the surface of, for example, a planet. With a "
|
||||
"value of smaller than 1, the field of view will hover of ther surface, thus "
|
||||
"making it more visible."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DefaultStartColorInfo = {
|
||||
"Colors.DefaultStart",
|
||||
"Start of default color",
|
||||
"This value determines the color of the field of view frustum close to the "
|
||||
"instrument. The final colors are interpolated between this value and the end "
|
||||
"color."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DefaultEndColorInfo = {
|
||||
"Colors.DefaultEnd",
|
||||
"End of default color",
|
||||
"This value determines the color of the field of view frustum close to the "
|
||||
"target. The final colors are interpolated between this value and the start "
|
||||
"color."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ActiveColorInfo = {
|
||||
"Colors.Active",
|
||||
"Active Color",
|
||||
"This value determines the color that is used when the instrument's field of "
|
||||
"view is active."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TargetInFovInfo = {
|
||||
"Colors.TargetInFieldOfView",
|
||||
"Target in field-of-view Color",
|
||||
"This value determines the color that is used if the target is inside the field "
|
||||
"of view of the instrument but the instrument is not yet active."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo IntersectionStartInfo = {
|
||||
"Colors.IntersectionStart",
|
||||
"Start of the intersection",
|
||||
"This value determines the color that is used close to the instrument if one of "
|
||||
"the field of view corners is intersecting the target object. The final color is "
|
||||
"retrieved by interpolating between this color and the intersection end color."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo IntersectionEndInfo = {
|
||||
"Colors.IntersectionEnd",
|
||||
"End of the intersection",
|
||||
"This value determines the color that is used close to the target if one of the "
|
||||
"field of view corners is intersecting the target object. The final color is "
|
||||
"retrieved by interpolating between this color and the intersection begin color."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SquareColorInfo = {
|
||||
"Colors.Square",
|
||||
"Orthogonal Square",
|
||||
"This value determines the color that is used for the field of view square in "
|
||||
"the case that there is no intersection and that the instrument is not currently "
|
||||
"active."
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -121,6 +200,18 @@ documentation::Documentation RenderableFov::Documentation() {
|
||||
"A list of frame conversions that should be registered with the "
|
||||
"SpiceManager.",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
LineWidthInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
LineWidthInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
StandoffDistanceInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
StandoffDistanceInfo.description,
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -129,47 +220,19 @@ documentation::Documentation RenderableFov::Documentation() {
|
||||
|
||||
RenderableFov::RenderableFov(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _lineWidth("lineWidth", "Line Width", 1.f, 1.f, 20.f)
|
||||
, _drawSolid("solidDraw", "Draw as Quads", false)
|
||||
, _standOffDistance("standOffDistance", "Standoff Distance", 0.9999, 0.99, 1.0, 0.000001)
|
||||
, _lineWidth(LineWidthInfo, 1.f, 1.f, 20.f)
|
||||
, _drawSolid(DrawSolidInfo, false)
|
||||
, _standOffDistance(StandoffDistanceInfo, 0.9999, 0.99, 1.0, 0.000001)
|
||||
, _programObject(nullptr)
|
||||
, _drawFOV(false)
|
||||
, _colors({
|
||||
{
|
||||
"colors.defaultStart",
|
||||
"Start of default color",
|
||||
glm::vec4(0.4f)
|
||||
},
|
||||
{
|
||||
"colors.defaultEnd",
|
||||
"End of default color",
|
||||
glm::vec4(0.85f, 0.85f, 0.85f, 1.f)
|
||||
},
|
||||
{
|
||||
"colors.active",
|
||||
"Active Color",
|
||||
glm::vec4(0.f, 1.f, 0.f, 1.f)
|
||||
},
|
||||
{
|
||||
"colors.targetInFieldOfView",
|
||||
"Target-in-field-of-view Color",
|
||||
glm::vec4(0.f, 0.5f, 0.7f, 1.f)
|
||||
},
|
||||
{
|
||||
"colors.intersectionStart",
|
||||
"Start of the intersection",
|
||||
glm::vec4(1.f, 0.89f, 0.f, 1.f)
|
||||
},
|
||||
{
|
||||
"colors.intersectionEnd",
|
||||
"End of the intersection",
|
||||
glm::vec4(1.f, 0.29f, 0.f, 1.f)
|
||||
},
|
||||
{
|
||||
"colors.square",
|
||||
"Orthogonal Square",
|
||||
glm::vec4(0.85f, 0.85f, 0.85f, 1.f)
|
||||
}
|
||||
{ DefaultStartColorInfo, glm::vec4(0.4f) },
|
||||
{ DefaultEndColorInfo, glm::vec4(0.85f, 0.85f, 0.85f, 1.f) },
|
||||
{ ActiveColorInfo, glm::vec4(0.f, 1.f, 0.f, 1.f) },
|
||||
{ TargetInFovInfo, glm::vec4(0.f, 0.5f, 0.7f, 1.f) },
|
||||
{ IntersectionStartInfo, glm::vec4(1.f, 0.89f, 0.f, 1.f) },
|
||||
{ IntersectionEndInfo, glm::vec4(1.f, 0.29f, 0.f, 1.f) },
|
||||
{ SquareColorInfo, glm::vec4(0.85f, 0.85f, 0.85f, 1.f) }
|
||||
})
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
@@ -208,6 +271,18 @@ RenderableFov::RenderableFov(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(LineWidthInfo.identifier)) {
|
||||
_lineWidth = static_cast<float>(dictionary.value<double>(
|
||||
LineWidthInfo.identifier
|
||||
));
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(StandoffDistanceInfo.identifier)) {
|
||||
_standOffDistance = static_cast<float>(dictionary.value<double>(
|
||||
StandoffDistanceInfo.identifier
|
||||
));
|
||||
}
|
||||
|
||||
addProperty(_lineWidth);
|
||||
addProperty(_drawSolid);
|
||||
addProperty(_standOffDistance);
|
||||
|
||||
@@ -53,6 +53,21 @@ namespace {
|
||||
const char* keyTextureColor = "Textures.Color";
|
||||
|
||||
const char* _destination = "GALACTIC";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ColorTextureInfo = {
|
||||
"ColorTexture",
|
||||
"Color Base Texture",
|
||||
"This is the path to a local image file that is used as the base texture for "
|
||||
"the model on which the image projections are layered."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo PerformShadingInfo = {
|
||||
"PerformShading",
|
||||
"Perform Shading",
|
||||
"If this value is enabled, the model will be shaded based on the relative "
|
||||
"location to the Sun. If this value is disabled, shading is disabled and the "
|
||||
"entire model is rendered brightly."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -83,12 +98,17 @@ documentation::Documentation RenderableModelProjection::Documentation() {
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
keyTextureColor,
|
||||
keyTextureColor, // @TODO Change to ColorTextureInfo.identifier
|
||||
new StringVerifier,
|
||||
"The base texture for the model that is shown before any projection "
|
||||
"occurred.",
|
||||
ColorTextureInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
PerformShadingInfo.identifier,
|
||||
new BoolVerifier,
|
||||
PerformShadingInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
keyBoundingSphereRadius,
|
||||
new DoubleVerifier,
|
||||
@@ -104,13 +124,13 @@ documentation::Documentation RenderableModelProjection::Documentation() {
|
||||
|
||||
RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _colorTexturePath("colorTexture", "Color Texture")
|
||||
, _rotation("rotation", "Rotation", glm::vec3(0.f), glm::vec3(0.f), glm::vec3(360.f))
|
||||
, _colorTexturePath(ColorTextureInfo)
|
||||
, _rotation({ "Rotation", "Rotation", "" }, glm::vec3(0.f), glm::vec3(0.f), glm::vec3(360.f)) // @TODO Remove this property
|
||||
, _programObject(nullptr)
|
||||
, _fboProgramObject(nullptr)
|
||||
, _baseTexture(nullptr)
|
||||
, _geometry(nullptr)
|
||||
, _performShading("performShading", "Perform Shading", true)
|
||||
, _performShading(PerformShadingInfo, true)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
@@ -119,7 +139,7 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
|
||||
);
|
||||
|
||||
std::string name;
|
||||
[[maybe_unused]] bool success = dictionary.getValue(SceneGraphNode::KeyName, name);
|
||||
[[ maybe_unused ]] bool success = dictionary.getValue(SceneGraphNode::KeyName, name);
|
||||
ghoul_assert(success, "Name was not passed to RenderableModelProjection");
|
||||
|
||||
using ghoul::Dictionary;
|
||||
@@ -146,6 +166,10 @@ RenderableModelProjection::RenderableModelProjection(const ghoul::Dictionary& di
|
||||
dictionary.getValue(keyBoundingSphereRadius, boundingSphereRadius);
|
||||
setBoundingSphere(boundingSphereRadius);
|
||||
|
||||
if (dictionary.hasKey(PerformShadingInfo.identifier)) {
|
||||
_performShading = dictionary.value<bool>(PerformShadingInfo.identifier);
|
||||
}
|
||||
|
||||
Renderable::addProperty(_performShading);
|
||||
Renderable::addProperty(_rotation);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,34 @@ namespace {
|
||||
const char* keyRadius = "Geometry.Radius";
|
||||
// const char* keyShading = "PerformShading";
|
||||
const char* _mainFrame = "GALACTIC";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ColorTextureInfo = {
|
||||
"PlanetTexture",
|
||||
"Color Base Texture",
|
||||
"The path to the base color texture that is used on the planet prior to any "
|
||||
"image projection."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HeightTextureInfo = {
|
||||
"HeightMap",
|
||||
"Heightmap Texture",
|
||||
"The path to the height map texture that is used for the planet. If no height "
|
||||
"map is specified the planet does not use a height field."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ShiftMeridianInfo = {
|
||||
"ShiftMeridian",
|
||||
"Shift Meridian by 180 deg",
|
||||
"Shift the position of the meridian by 180 degrees. This value "
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HeightExaggerationInfo = {
|
||||
"HeightExaggeration",
|
||||
"Height Exaggeration",
|
||||
"This value determines the level of height exaggeration that is applied to a "
|
||||
"potential height field. A value of '0' inhibits the height field, whereas a "
|
||||
"value of '1' uses the measured height field."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -99,20 +127,21 @@ documentation::Documentation RenderablePlanetProjection::Documentation() {
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
keyColorTexture,
|
||||
keyColorTexture, // @TODO This should be ColorTextureInfo.identifier
|
||||
new StringVerifier,
|
||||
"The path to the base color texture that is used on the planet prior to "
|
||||
"any image projection. The path can use tokens of the form '${...}' or "
|
||||
"be specified relative to the directory of the mod file.",
|
||||
ColorTextureInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
keyHeightTexture,
|
||||
keyHeightTexture, // @TODO This should be HeightTextureInfo.identifier
|
||||
new StringVerifier,
|
||||
"The path to the height map texture that is used on the planet. The path "
|
||||
"can use tokens of the form '${...}' or be specified relative to the "
|
||||
"directory of the mod file. If no height map is specified the planet "
|
||||
"does not use a height field.",
|
||||
HeightTextureInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
HeightExaggerationInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
HeightExaggerationInfo.description,
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
@@ -121,16 +150,15 @@ documentation::Documentation RenderablePlanetProjection::Documentation() {
|
||||
|
||||
RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _colorTexturePath("planetTexture", "RGB Texture")
|
||||
, _heightMapTexturePath("heightMap", "Heightmap Texture")
|
||||
, _rotation("rotation", "Rotation", 0, 0, 360)
|
||||
, _colorTexturePath(ColorTextureInfo)
|
||||
, _heightMapTexturePath(HeightTextureInfo)
|
||||
, _rotation({ "Rotation", "Rotation", "" }, 0, 0, 360) // @TODO Missing documentation
|
||||
, _programObject(nullptr)
|
||||
, _fboProgramObject(nullptr)
|
||||
, _baseTexture(nullptr)
|
||||
, _heightMapTexture(nullptr)
|
||||
, _shiftMeridianBy180("shiftMeiridian", "Shift Meridian by 180 deg", false)
|
||||
, _heightExaggeration("heightExaggeration", "Height Exaggeration", 1.f, 0.f, 100.f)
|
||||
, _debugProjectionTextureRotation("debug.projectionTextureRotation", "Projection Texture Rotation", 0.f, 0.f, 360.f)
|
||||
, _shiftMeridianBy180({"asd", "", "" }, false) // @TODO Missing documentation
|
||||
, _heightExaggeration(HeightExaggerationInfo, 1.f, 0.f, 100.f)
|
||||
, _capture(false)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
@@ -187,8 +215,13 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
|
||||
addProperty(_heightMapTexturePath);
|
||||
_heightMapTexturePath.onChange(std::bind(&RenderablePlanetProjection::loadTextures, this));
|
||||
|
||||
if (dictionary.hasKey(HeightExaggerationInfo.identifier)) {
|
||||
_heightExaggeration = static_cast<float>(
|
||||
dictionary.value<double>(HeightExaggerationInfo.identifier)
|
||||
);
|
||||
}
|
||||
|
||||
addProperty(_heightExaggeration);
|
||||
addProperty(_debugProjectionTextureRotation);
|
||||
|
||||
addProperty(_shiftMeridianBy180);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,6 @@ private:
|
||||
properties::BoolProperty _shiftMeridianBy180;
|
||||
|
||||
properties::FloatProperty _heightExaggeration;
|
||||
properties::FloatProperty _debugProjectionTextureRotation;
|
||||
|
||||
std::unique_ptr<planetgeometry::PlanetGeometry> _geometry;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <modules/newhorizons/rendering/renderableshadowcylinder.h>
|
||||
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/powerscaledcoordinate.h>
|
||||
@@ -33,39 +34,234 @@
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
|
||||
namespace {
|
||||
const char* KeyType = "TerminatorType";
|
||||
const char* KeyLightSource = "LightSource";
|
||||
const char* KeyObserver = "Observer";
|
||||
const char* KeyBody = "Body";
|
||||
const char* KeyBodyFrame = "BodyFrame";
|
||||
const char* KeyMainFrame = "MainFrame";
|
||||
const char* KeyAberration = "Aberration";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo NumberPointsInfo = {
|
||||
"AmountOfPoints",
|
||||
"Points",
|
||||
"This value determines the number of control points that is used to construct "
|
||||
"the shadow geometry. The higher this number, the more detailed the shadow is, "
|
||||
"but it will have a negative impact on the performance."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ShadowLengthInfo = {
|
||||
"ShadowLength",
|
||||
"Shadow Length",
|
||||
"This value determines the length of the shadow that is cast by the target "
|
||||
"object. The total distance of the shadow is equal to the distance from the "
|
||||
"target to the Sun multiplied with this value."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ShadowColorInfo = {
|
||||
"ShadowColor",
|
||||
"Shadow Color",
|
||||
"This value determines the color that is used for the shadow cylinder."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TerminatorTypeInfo = {
|
||||
"TerminatorType",
|
||||
"Terminator Type",
|
||||
"This value determines the type of the terminator that is used to calculate the "
|
||||
"shadow eclipse."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo LightSourceInfo = {
|
||||
"LightSource",
|
||||
"Light Source",
|
||||
"This value determines the SPICE name of the object that is used as the "
|
||||
"illuminator for computing the shadow cylinder."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ObserverInfo = {
|
||||
"Observer",
|
||||
"Observer",
|
||||
"This value specifies the SPICE name of the object that is the observer of the "
|
||||
"shadow cylinder."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo BodyInfo = {
|
||||
"Body",
|
||||
"Target Body",
|
||||
"This value is the SPICE name of target body that is used as the shadow caster "
|
||||
"for the shadow cylinder."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo BodyFrameInfo = {
|
||||
"BodyFrame",
|
||||
"Body Frame",
|
||||
"This value is the SPICE name of the reference frame in which the shadow "
|
||||
"cylinder is expressed."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo AberrationInfo = {
|
||||
"Aberration",
|
||||
"Aberration",
|
||||
"This value determines the aberration method that is used to compute the shadow "
|
||||
"cylinder."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
documentation::Documentation RenderableShadowCylinder::Documentation() {
|
||||
using namespace documentation;
|
||||
return {
|
||||
"RenderableShadowCylinder",
|
||||
"newhorizons_renderable_shadowcylinder",
|
||||
{
|
||||
{
|
||||
"Type",
|
||||
new StringEqualVerifier("RenderableShadowCylinder"),
|
||||
"",
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
NumberPointsInfo.identifier,
|
||||
new IntVerifier,
|
||||
NumberPointsInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
ShadowLengthInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
ShadowLengthInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
ShadowColorInfo.identifier,
|
||||
new DoubleVector4Verifier,
|
||||
ShadowColorInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
TerminatorTypeInfo.identifier,
|
||||
new StringInListVerifier({
|
||||
// Synchronized with SpiceManager::terminatorTypeFromString
|
||||
"UMBRAL", "PENUMBRAL"
|
||||
}),
|
||||
TerminatorTypeInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
LightSourceInfo.identifier,
|
||||
new StringVerifier,
|
||||
LightSourceInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
ObserverInfo.identifier,
|
||||
new StringVerifier,
|
||||
ObserverInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
BodyInfo.identifier,
|
||||
new StringVerifier,
|
||||
BodyInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
BodyFrameInfo.identifier,
|
||||
new StringVerifier,
|
||||
BodyFrameInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
AberrationInfo.identifier,
|
||||
new StringInListVerifier({
|
||||
// SpiceManager::AberrationCorrection::AberrationCorrection
|
||||
"NONE", "LT", "LT+S", "CN", "CN+S"
|
||||
}),
|
||||
AberrationInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
},
|
||||
Exhaustive::Yes
|
||||
};
|
||||
}
|
||||
|
||||
RenderableShadowCylinder::RenderableShadowCylinder(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _numberOfPoints("amountOfPoints", "Points", 190, 1, 300)
|
||||
, _shadowLength("shadowLength", "Shadow Length", 0.1f, 0.0f, 0.5f)
|
||||
, _shadowColor("shadowColor", "Shadow Color",
|
||||
glm::vec4(1.f, 1.f, 1.f, 0.25f), glm::vec4(0.f), glm::vec4(1.f))
|
||||
, _numberOfPoints(NumberPointsInfo, 190, 1, 300)
|
||||
, _shadowLength(ShadowLengthInfo, 0.1f, 0.f, 0.5f)
|
||||
, _shadowColor(
|
||||
ShadowColorInfo,
|
||||
glm::vec4(1.f, 1.f, 1.f, 0.25f),
|
||||
glm::vec4(0.f), glm::vec4(1.f)
|
||||
)
|
||||
, _terminatorType(
|
||||
TerminatorTypeInfo,
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
)
|
||||
, _lightSource(LightSourceInfo)
|
||||
, _observer(ObserverInfo)
|
||||
, _body(BodyInfo)
|
||||
, _bodyFrame(BodyFrameInfo)
|
||||
, _mainFrame({"mainFrame", "Main Frame", ""}) // @TODO Remove this
|
||||
, _aberration(AberrationInfo)
|
||||
, _shader(nullptr)
|
||||
, _vao(0)
|
||||
, _vbo(0)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
"RenderableShadowCylinder"
|
||||
);
|
||||
|
||||
if (dictionary.hasKey(NumberPointsInfo.identifier)) {
|
||||
_numberOfPoints = static_cast<int>(
|
||||
dictionary.value<double>(NumberPointsInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_numberOfPoints);
|
||||
|
||||
|
||||
if (dictionary.hasKey(ShadowLengthInfo.identifier)) {
|
||||
_shadowLength = static_cast<float>(
|
||||
dictionary.value<double>(ShadowLengthInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_shadowLength);
|
||||
|
||||
|
||||
if (dictionary.hasKey(ShadowColorInfo.identifier)) {
|
||||
_shadowColor = dictionary.value<glm::vec4>(ShadowLengthInfo.identifier);
|
||||
}
|
||||
_shadowColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_shadowColor);
|
||||
|
||||
_terminatorType = dictionary.value<std::string>(KeyType);
|
||||
_lightSource = dictionary.value<std::string>(KeyLightSource);
|
||||
_observer = dictionary.value<std::string>(KeyObserver);
|
||||
_body = dictionary.value<std::string>(KeyBody);
|
||||
_bodyFrame = dictionary.value<std::string>(KeyBodyFrame);
|
||||
|
||||
_terminatorType.addOptions({
|
||||
{ static_cast<int>(SpiceManager::TerminatorType::Umbral), "Umbral" },
|
||||
{ static_cast<int>(SpiceManager::TerminatorType::Penumbral), "Penumbral" }
|
||||
});
|
||||
_terminatorType = static_cast<int>(SpiceManager::terminatorTypeFromString(
|
||||
dictionary.value<std::string>(TerminatorTypeInfo.identifier)
|
||||
));
|
||||
addProperty(_terminatorType);
|
||||
|
||||
|
||||
_lightSource = dictionary.value<std::string>(LightSourceInfo.identifier);
|
||||
_observer = dictionary.value<std::string>(ObserverInfo.identifier);
|
||||
_body = dictionary.value<std::string>(BodyInfo.identifier);
|
||||
_bodyFrame = dictionary.value<std::string>(BodyFrameInfo.identifier);
|
||||
_mainFrame = dictionary.value<std::string>(KeyMainFrame);
|
||||
|
||||
_aberration = SpiceManager::AberrationCorrection(dictionary.value<std::string>(KeyAberration));
|
||||
|
||||
using T = SpiceManager::AberrationCorrection::Type;
|
||||
_aberration.addOptions({
|
||||
{ static_cast<int>(T::None), "None" },
|
||||
{ static_cast<int>(T::ConvergedNewtonian), "Converged Newtonian" },
|
||||
{ static_cast<int>(T::ConvergedNewtonianStellar), "Converged Newtonian Stellar" },
|
||||
{ static_cast<int>(T::LightTime), "Light Time" },
|
||||
{ static_cast<int>(T::LightTimeStellar), "Light Time Stellar" },
|
||||
|
||||
});
|
||||
SpiceManager::AberrationCorrection aberration = SpiceManager::AberrationCorrection(
|
||||
dictionary.value<std::string>(AberrationInfo.identifier)
|
||||
);
|
||||
_aberration = static_cast<int>(aberration.type);
|
||||
}
|
||||
|
||||
bool RenderableShadowCylinder::initialize() {
|
||||
@@ -79,10 +275,6 @@ bool RenderableShadowCylinder::initialize() {
|
||||
"${MODULE_NEWHORIZONS}/shaders/terminatorshadow_fs.glsl"
|
||||
);
|
||||
|
||||
if (!_shader)
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -136,7 +328,11 @@ void RenderableShadowCylinder::render(const RenderData& data, RendererTasks&) {
|
||||
}
|
||||
|
||||
void RenderableShadowCylinder::update(const UpdateData& data) {
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix(_bodyFrame, _mainFrame, data.time.j2000Seconds());
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix(
|
||||
_bodyFrame,
|
||||
_mainFrame,
|
||||
data.time.j2000Seconds()
|
||||
);
|
||||
if (_shader->isDirty()) {
|
||||
_shader->rebuildFromFile();
|
||||
}
|
||||
@@ -162,8 +358,11 @@ void RenderableShadowCylinder::createCylinder(double time) {
|
||||
_observer,
|
||||
_bodyFrame,
|
||||
_lightSource,
|
||||
SpiceManager::terminatorTypeFromString(_terminatorType),
|
||||
_aberration,
|
||||
static_cast<SpiceManager::TerminatorType>(_terminatorType.value()),
|
||||
{
|
||||
SpiceManager::AberrationCorrection::Type(_aberration.value()),
|
||||
SpiceManager::AberrationCorrection::Direction::Reception
|
||||
},
|
||||
time,
|
||||
_numberOfPoints
|
||||
);
|
||||
@@ -181,8 +380,17 @@ void RenderableShadowCylinder::createCylinder(double time) {
|
||||
);
|
||||
|
||||
double lt;
|
||||
glm::dvec3 vecLightSource =
|
||||
SpiceManager::ref().targetPosition(_body, _lightSource, _mainFrame, _aberration, time, lt);
|
||||
glm::dvec3 vecLightSource = SpiceManager::ref().targetPosition(
|
||||
_body,
|
||||
_lightSource,
|
||||
_mainFrame,
|
||||
{
|
||||
SpiceManager::AberrationCorrection::Type(_aberration.value()),
|
||||
SpiceManager::AberrationCorrection::Direction::Reception
|
||||
},
|
||||
time,
|
||||
lt
|
||||
);
|
||||
|
||||
vecLightSource = glm::inverse(_stateMatrix) * vecLightSource;
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/scalar/intproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/properties/vector/vec4property.h>
|
||||
@@ -37,6 +39,8 @@
|
||||
|
||||
namespace ghoul::opengl { class ProgramObject; }
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
namespace openspace {
|
||||
|
||||
struct RenderData;
|
||||
@@ -53,15 +57,26 @@ public:
|
||||
void render(const RenderData& data, RendererTasks& rendererTask) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
struct CylinderVBOLayout {
|
||||
float x, y, z, e;
|
||||
};
|
||||
|
||||
void createCylinder(double time);
|
||||
|
||||
|
||||
properties::IntProperty _numberOfPoints;
|
||||
properties::FloatProperty _shadowLength;
|
||||
properties::Vec4Property _shadowColor;
|
||||
properties::OptionProperty _terminatorType;
|
||||
properties::StringProperty _lightSource;
|
||||
properties::StringProperty _observer;
|
||||
properties::StringProperty _body;
|
||||
properties::StringProperty _bodyFrame;
|
||||
properties::StringProperty _mainFrame;
|
||||
properties::OptionProperty _aberration;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
|
||||
@@ -71,14 +86,7 @@ private:
|
||||
GLuint _vbo;
|
||||
|
||||
std::vector<CylinderVBOLayout> _vertices;
|
||||
|
||||
std::string _terminatorType;
|
||||
std::string _lightSource;
|
||||
std::string _observer;
|
||||
std::string _body;
|
||||
std::string _bodyFrame;
|
||||
std::string _mainFrame;
|
||||
SpiceManager::AberrationCorrection _aberration;
|
||||
// SpiceManager::AberrationCorrection
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -71,6 +71,44 @@ namespace {
|
||||
"${OPENSPACE_DATA}/scene/common/textures/placeholder.png";
|
||||
|
||||
const char* _loggerCat = "ProjectionComponent";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ProjectionInfo = {
|
||||
"PerformProjection",
|
||||
"Perform Projections",
|
||||
"If this value is enabled, this ProjectionComponent will perform projections. If "
|
||||
"it is disabled, projections will be ignored."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ClearProjectionInfo = {
|
||||
"ClearAllProjections",
|
||||
"Clear Projections",
|
||||
"If this property is triggered, it will remove all the projections that have "
|
||||
"already been applied."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FadingInfo = {
|
||||
"ProjectionFading",
|
||||
"Projection Fading",
|
||||
"This value fades the previously performed projections in or out. If this value "
|
||||
"is equal to '1', the projections are fully visible, if the value is equal to "
|
||||
"'0', the performed projections are completely invisible."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TextureSizeInfo = {
|
||||
"TextureSize",
|
||||
"Texture Size",
|
||||
"This value determines the size of the texture into which the images are "
|
||||
"projected and thus provides the limit to the resolution of projections that can "
|
||||
"be applied. Changing this value will not cause the texture to be automatically "
|
||||
"updated, but triggering the 'ApplyTextureSize' property is required."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ApplyTextureSizeInfo = {
|
||||
"ApplyTextureSize",
|
||||
"Apply Texture Size",
|
||||
"Triggering this property applies a new size to the underlying projection "
|
||||
"texture. The old texture is resized and interpolated to fit the new size."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -168,11 +206,11 @@ documentation::Documentation ProjectionComponent::Documentation() {
|
||||
|
||||
ProjectionComponent::ProjectionComponent()
|
||||
: properties::PropertyOwner("ProjectionComponent")
|
||||
, _performProjection("performProjection", "Perform Projections", true)
|
||||
, _clearAllProjections("clearAllProjections", "Clear Projections", false)
|
||||
, _projectionFading("projectionFading", "Projection Fading", 1.f, 0.f, 1.f)
|
||||
, _textureSize("textureSize", "Texture Size", ivec2(16), ivec2(16), ivec2(32768))
|
||||
, _applyTextureSize("applyTextureSize", "Apply Texture Size")
|
||||
, _performProjection(ProjectionInfo, true)
|
||||
, _clearAllProjections(ClearProjectionInfo, false)
|
||||
, _projectionFading(FadingInfo, 1.f, 0.f, 1.f)
|
||||
, _textureSize(TextureSizeInfo, ivec2(16), ivec2(16), ivec2(32768))
|
||||
, _applyTextureSize(ApplyTextureSizeInfo)
|
||||
, _textureSizeDirty(false)
|
||||
, _projectionTexture(nullptr)
|
||||
{
|
||||
|
||||
@@ -42,9 +42,6 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
gui::GUI OnScreenGUIModule::gui;
|
||||
Touch OnScreenGUIModule::touchInput;
|
||||
|
||||
OnScreenGUIModule::OnScreenGUIModule() : OpenSpaceModule(Name) {
|
||||
addPropertySubOwner(gui);
|
||||
|
||||
@@ -59,7 +56,7 @@ OnScreenGUIModule::OnScreenGUIModule() : OpenSpaceModule(Name) {
|
||||
|
||||
OsEng.registerModuleCallback(
|
||||
OpenSpaceEngine::CallbackOption::Initialize,
|
||||
[](){
|
||||
[&](){
|
||||
LDEBUGC("OnScreenGUIModule", "Initializing GUI");
|
||||
gui.initialize();
|
||||
|
||||
@@ -107,7 +104,7 @@ OnScreenGUIModule::OnScreenGUIModule() : OpenSpaceModule(Name) {
|
||||
|
||||
OsEng.registerModuleCallback(
|
||||
OpenSpaceEngine::CallbackOption::Deinitialize,
|
||||
[](){
|
||||
[&](){
|
||||
LDEBUGC("OnScreenGui", "Deinitialize GUI");
|
||||
gui.deinitialize();
|
||||
}
|
||||
@@ -115,7 +112,7 @@ OnScreenGUIModule::OnScreenGUIModule() : OpenSpaceModule(Name) {
|
||||
|
||||
OsEng.registerModuleCallback(
|
||||
OpenSpaceEngine::CallbackOption::InitializeGL,
|
||||
[](){
|
||||
[&](){
|
||||
LDEBUGC("OnScreenGui", "Initializing GUI OpenGL");
|
||||
gui.initializeGL();
|
||||
}
|
||||
@@ -123,7 +120,7 @@ OnScreenGUIModule::OnScreenGUIModule() : OpenSpaceModule(Name) {
|
||||
|
||||
OsEng.registerModuleCallback(
|
||||
OpenSpaceEngine::CallbackOption::DeinitializeGL,
|
||||
[](){
|
||||
[&](){
|
||||
LDEBUGC("OnScreenGui", "Deinitialize GUI OpenGL");
|
||||
gui.deinitializeGL();
|
||||
}
|
||||
@@ -134,7 +131,7 @@ OnScreenGUIModule::OnScreenGUIModule() : OpenSpaceModule(Name) {
|
||||
// everything else in the case of fisheyes. With this being in the Render callback
|
||||
// the GUI would be rendered on top of each of the cube faces
|
||||
OpenSpaceEngine::CallbackOption::PostDraw,
|
||||
[](){
|
||||
[&](){
|
||||
WindowWrapper& wrapper = OsEng.windowWrapper();
|
||||
bool showGui = wrapper.hasGuiWindow() ? wrapper.isGuiWindow() : true;
|
||||
if (wrapper.isMaster() && showGui ) {
|
||||
@@ -164,7 +161,7 @@ OnScreenGUIModule::OnScreenGUIModule() : OpenSpaceModule(Name) {
|
||||
);
|
||||
|
||||
OsEng.registerModuleKeyboardCallback(
|
||||
[](Key key, KeyModifier mod, KeyAction action) -> bool {
|
||||
[&](Key key, KeyModifier mod, KeyAction action) -> bool {
|
||||
if (gui.isEnabled()) {
|
||||
return gui.keyCallback(key, mod, action);
|
||||
}
|
||||
@@ -175,7 +172,7 @@ OnScreenGUIModule::OnScreenGUIModule() : OpenSpaceModule(Name) {
|
||||
);
|
||||
|
||||
OsEng.registerModuleCharCallback(
|
||||
[](unsigned int codepoint, KeyModifier modifier) -> bool {
|
||||
[&](unsigned int codepoint, KeyModifier modifier) -> bool {
|
||||
if (gui.isEnabled()) {
|
||||
return gui.charCallback(codepoint, modifier);
|
||||
}
|
||||
@@ -186,7 +183,7 @@ OnScreenGUIModule::OnScreenGUIModule() : OpenSpaceModule(Name) {
|
||||
);
|
||||
|
||||
OsEng.registerModuleMouseButtonCallback(
|
||||
[](MouseButton button, MouseAction action) -> bool {
|
||||
[&](MouseButton button, MouseAction action) -> bool {
|
||||
if (gui.isEnabled()) {
|
||||
return gui.mouseButtonCallback(button, action);
|
||||
}
|
||||
@@ -197,7 +194,7 @@ OnScreenGUIModule::OnScreenGUIModule() : OpenSpaceModule(Name) {
|
||||
);
|
||||
|
||||
OsEng.registerModuleMouseScrollWheelCallback(
|
||||
[](double, double posY) -> bool {
|
||||
[&](double, double posY) -> bool {
|
||||
if (gui.isEnabled()) {
|
||||
return gui.mouseWheelCallback(posY);
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ public:
|
||||
|
||||
OnScreenGUIModule();
|
||||
|
||||
static gui::GUI gui;
|
||||
static Touch touchInput;
|
||||
gui::GUI gui;
|
||||
Touch touchInput = { false, glm::vec2(0), 0 };
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
|
||||
namespace openspace::gui::luascriptfunctions {
|
||||
|
||||
/**
|
||||
@@ -35,7 +37,7 @@ int show(lua_State* L) {
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
|
||||
}
|
||||
|
||||
OnScreenGUIModule::gui.setEnabled(true);
|
||||
OsEng.moduleEngine().module<OnScreenGUIModule>()->gui.setEnabled(true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -50,7 +52,7 @@ int hide(lua_State* L) {
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
|
||||
}
|
||||
|
||||
OnScreenGUIModule::gui.setEnabled(false);
|
||||
OsEng.moduleEngine().module<OnScreenGUIModule>()->gui.setEnabled(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -65,7 +67,9 @@ int toggle(lua_State* L) {
|
||||
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
|
||||
}
|
||||
|
||||
OnScreenGUIModule::gui.setEnabled(!OnScreenGUIModule::gui.isEnabled());
|
||||
OsEng.moduleEngine().module<OnScreenGUIModule>()->gui.setEnabled(
|
||||
!OsEng.moduleEngine().module<OnScreenGUIModule>()->gui.isEnabled()
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,19 @@
|
||||
|
||||
#include <modules/onscreengui/include/guicomponent.h>
|
||||
|
||||
namespace {
|
||||
static const openspace::properties::Property::PropertyInfo EnabledInfo = {
|
||||
"Enabled",
|
||||
"Is Enabled",
|
||||
"This setting determines whether this object will be visible or not."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace::gui {
|
||||
|
||||
GuiComponent::GuiComponent(std::string name)
|
||||
: properties::PropertyOwner(std::move(name))
|
||||
, _isEnabled("enabled", "Is Enabled", false)
|
||||
, _isEnabled(EnabledInfo, false)
|
||||
{
|
||||
addProperty(_isEnabled);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************************
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
@@ -69,7 +69,7 @@ void GuiOriginComponent::render() {
|
||||
bool hasChanged = ImGui::Combo("Origin", ¤tPosition, nodeNames.c_str());
|
||||
if (hasChanged) {
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.setPropertyValue('NavigationHandler.origin', '" +
|
||||
"openspace.setPropertyValue('NavigationHandler.Origin', '" +
|
||||
nodes[currentPosition]->name() + "');",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
|
||||
@@ -49,16 +49,43 @@ namespace {
|
||||
Render = 4,
|
||||
Total = 5
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SortingSelectionInfo = {
|
||||
"SortingSelection",
|
||||
"Sorting",
|
||||
"This value determines the sorting order of the performance measurements."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SceneGraphEnabledInfo = {
|
||||
"ShowSceneGraph",
|
||||
"Show Scene Graph Measurements",
|
||||
"If this value is enabled, the window showing the measurements for the scene "
|
||||
"graph values is visible."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo FunctionsEnabledInfo = {
|
||||
"ShowFunctions",
|
||||
"Show Function Measurements",
|
||||
"If this value is enabled, the window showing the measurements for the "
|
||||
"individual functions is visible."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OutputLogsInfo = {
|
||||
"OutputLogs",
|
||||
"Output Logs",
|
||||
"" // @TODO Missing documentation
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace::gui {
|
||||
|
||||
GuiPerformanceComponent::GuiPerformanceComponent()
|
||||
: GuiComponent("PerformanceComponent")
|
||||
, _sortingSelection("sortingSelection", "Sorting", -1, -1, 6)
|
||||
, _sceneGraphIsEnabled("showSceneGraph", "Show Scene Graph Measurements", false)
|
||||
, _functionsIsEnabled("showFunctions", "Show Function Measurements", false)
|
||||
, _outputLogs("outputLogs", "Output Logs", false)
|
||||
, _sortingSelection(SortingSelectionInfo, -1, -1, 6)
|
||||
, _sceneGraphIsEnabled(SceneGraphEnabledInfo, false)
|
||||
, _functionsIsEnabled(FunctionsEnabledInfo, false)
|
||||
, _outputLogs(OutputLogsInfo, false)
|
||||
{
|
||||
addProperty(_sortingSelection);
|
||||
|
||||
|
||||
@@ -42,7 +42,15 @@ using namespace properties;
|
||||
|
||||
void renderTooltip(Property* prop) {
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::SetTooltip(prop->fullyQualifiedIdentifier().c_str());
|
||||
ImGui::BeginTooltip();
|
||||
if (!prop->description().empty()) {
|
||||
ImGui::TextWrapped(prop->description().c_str());
|
||||
ImGui::Spacing();
|
||||
}
|
||||
ImGui::Text(
|
||||
(std::string("Identifier: ") + prop->fullyQualifiedIdentifier()).c_str()
|
||||
);
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,11 +41,8 @@
|
||||
#include "SpiceZpr.h"
|
||||
|
||||
namespace {
|
||||
const char* KeyVertexFile = "File";
|
||||
const char* KeyConstellationFile = "ConstellationFile";
|
||||
const char* KeyReferenceFrame = "ReferenceFrame";
|
||||
|
||||
|
||||
const char* DefaultReferenceFrame = "J2000";
|
||||
|
||||
float deg2rad(float deg) {
|
||||
@@ -55,6 +52,35 @@ namespace {
|
||||
// 360 degrees / 24h = 15 degrees/h
|
||||
return deg2rad(rightAscension * 15);
|
||||
}
|
||||
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo VertexInfo = {
|
||||
"File",
|
||||
"Vertex File Path",
|
||||
"The file pointed to with this value contains the vertex locations of the "
|
||||
"constellations."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ConstellationInfo = {
|
||||
"ConstellationFile",
|
||||
"Constellation File Path",
|
||||
"Specifies the file that contains the mapping between constellation "
|
||||
"abbreviations and full name of the constellation. If this value is empty, the "
|
||||
"abbreviations are used as the full names."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DistanceInfo = {
|
||||
"Distance",
|
||||
"Distance to the celestial sphere",
|
||||
"This value specifies the value to the celestial sphere in kilometers at which "
|
||||
"the constellations are projected."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SelectionInfo = {
|
||||
"ConstellationSelection",
|
||||
"Constellation Selection",
|
||||
"The constellations that are selected are displayed on the celestial sphere."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -66,19 +92,30 @@ documentation::Documentation RenderableConstellationBounds::Documentation() {
|
||||
"space_renderable_constellationbounds",
|
||||
{
|
||||
{
|
||||
KeyVertexFile,
|
||||
VertexInfo.identifier,
|
||||
new StringVerifier,
|
||||
"Specifies the file containing the bounds information about the "
|
||||
"constellation locations.",
|
||||
VertexInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyConstellationFile,
|
||||
ConstellationInfo.identifier,
|
||||
new StringVerifier,
|
||||
"Specifies the file that contains the mapping between constellation "
|
||||
"abbreviations and full name of the constellation. If the file is "
|
||||
"omitted, the abbreviations are used as the full names.",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
DistanceInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
DistanceInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
SelectionInfo.identifier,
|
||||
new StringListVerifier,
|
||||
SelectionInfo.description,
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -88,10 +125,10 @@ documentation::Documentation RenderableConstellationBounds::Documentation() {
|
||||
RenderableConstellationBounds::RenderableConstellationBounds(
|
||||
const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _vertexFilename("")
|
||||
, _constellationFilename("")
|
||||
, _distance("distance", "Distance to the celestial Sphere", 15.f, 0.f, 30.f)
|
||||
, _constellationSelection("constellationSelection", "Constellation Selection")
|
||||
, _vertexFilename(VertexInfo)
|
||||
, _constellationFilename(ConstellationInfo)
|
||||
, _distance(DistanceInfo, 15.f, 0.f, 30.f)
|
||||
, _constellationSelection(SelectionInfo)
|
||||
, _vao(0)
|
||||
, _vbo(0)
|
||||
{
|
||||
@@ -101,13 +138,26 @@ RenderableConstellationBounds::RenderableConstellationBounds(
|
||||
"RenderableConstellationBounds"
|
||||
);
|
||||
|
||||
_vertexFilename = dictionary.value<std::string>(KeyVertexFile);
|
||||
_vertexFilename.onChange([&](){
|
||||
loadVertexFile();
|
||||
});
|
||||
addProperty(_vertexFilename);
|
||||
_vertexFilename = dictionary.value<std::string>(VertexInfo.identifier);
|
||||
|
||||
if (dictionary.hasKey(KeyConstellationFile)) {
|
||||
_constellationFilename = dictionary.value<std::string>(KeyConstellationFile);
|
||||
_constellationFilename.onChange([&](){
|
||||
loadConstellationFile();
|
||||
});
|
||||
addProperty(_constellationFilename);
|
||||
if (dictionary.hasKey(ConstellationInfo.identifier)) {
|
||||
_constellationFilename = dictionary.value<std::string>(ConstellationInfo.identifier);
|
||||
}
|
||||
|
||||
if (dictionary.hasKey(DistanceInfo.identifier)) {
|
||||
_distance = static_cast<float>(dictionary.value<double>(DistanceInfo.identifier));
|
||||
}
|
||||
addProperty(_distance);
|
||||
|
||||
fillSelectionProperty();
|
||||
addProperty(_constellationSelection);
|
||||
_constellationSelection.onChange(
|
||||
[this]() { selectionPropertyHasChanged(); }
|
||||
@@ -115,20 +165,12 @@ RenderableConstellationBounds::RenderableConstellationBounds(
|
||||
}
|
||||
|
||||
bool RenderableConstellationBounds::initialize() {
|
||||
_program = OsEng.renderEngine().buildRenderProgram("ConstellationBounds",
|
||||
_program = OsEng.renderEngine().buildRenderProgram(
|
||||
"ConstellationBounds",
|
||||
"${MODULE_SPACE}/shaders/constellationbounds_vs.glsl",
|
||||
"${MODULE_SPACE}/shaders/constellationbounds_fs.glsl");
|
||||
"${MODULE_SPACE}/shaders/constellationbounds_fs.glsl"
|
||||
);
|
||||
|
||||
bool loadSuccess = loadVertexFile();
|
||||
if (!loadSuccess) {
|
||||
return false;
|
||||
}
|
||||
loadSuccess = loadConstellationFile();
|
||||
if (!loadSuccess) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fillSelectionProperty();
|
||||
|
||||
glGenVertexArrays(1, &_vao);
|
||||
glBindVertexArray(_vao);
|
||||
@@ -199,7 +241,7 @@ void RenderableConstellationBounds::render(const RenderData& data, RendererTasks
|
||||
}
|
||||
|
||||
bool RenderableConstellationBounds::loadVertexFile() {
|
||||
if (_vertexFilename.empty()) {
|
||||
if (_vertexFilename.value().empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -292,7 +334,7 @@ bool RenderableConstellationBounds::loadVertexFile() {
|
||||
}
|
||||
|
||||
bool RenderableConstellationBounds::loadConstellationFile() {
|
||||
if (_constellationFilename.empty()) {
|
||||
if (_constellationFilename.value().empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <openspace/properties/scalarproperty.h>
|
||||
#include <openspace/properties/selectionproperty.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <array>
|
||||
|
||||
@@ -93,8 +94,11 @@ private:
|
||||
*/
|
||||
void selectionPropertyHasChanged();
|
||||
|
||||
std::string _vertexFilename; ///< The filename containing the constellation bounds
|
||||
std::string _constellationFilename; ///< The file containing constellation names
|
||||
/// The filename containing the constellation bounds
|
||||
properties::StringProperty _vertexFilename;
|
||||
|
||||
/// The file containing constellation names
|
||||
properties::StringProperty _constellationFilename;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _program;
|
||||
|
||||
|
||||
@@ -64,7 +64,44 @@ namespace {
|
||||
const char* keyShadowSource = "Source";
|
||||
const char* keyShadowCaster = "Caster";
|
||||
const char* keyBody = "Body";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ColorTextureInfo = {
|
||||
"PlanetTexture",
|
||||
"Color Base Texture",
|
||||
"The path to the base color texture that is used on the planet prior to any "
|
||||
"image projection."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HeightTextureInfo = {
|
||||
"HeightMap",
|
||||
"Heightmap Texture",
|
||||
"The path to the height map texture that is used for the planet. If no height "
|
||||
"map is specified the planet does not use a height field."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo NightTextureInfo = {
|
||||
"NightTexture",
|
||||
"Night Texture",
|
||||
"The path to the night texture that is used for the part of the planet that is "
|
||||
"facing away from the Sun. If no night texture is loaded, the night side of the "
|
||||
"planet is rendered dark."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo HeightExaggerationInfo = {
|
||||
"HeightExaggeration",
|
||||
"Height Exaggeration",
|
||||
"This value determines the level of height exaggeration that is applied to a "
|
||||
"potential height field. A value of '0' inhibits the height field, whereas a "
|
||||
"value of '1' uses the measured height field."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo PerformShadingInfo = {
|
||||
"PerformShading",
|
||||
"Perform Shading",
|
||||
"If this value is enabled, the model will be shaded based on the relative "
|
||||
"location to the Sun. If this value is disabled, shading is disabled and the "
|
||||
"entire model is rendered brightly."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -89,19 +126,19 @@ documentation::Documentation RenderablePlanet::Documentation() {
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyColorTexture,
|
||||
KeyColorTexture, // @TODO Use ColorTextureInfo.identifier instead
|
||||
new StringVerifier,
|
||||
"Specifies the color texture that is used for this RenderablePlanet.",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyHeightTexture,
|
||||
KeyHeightTexture, // @TODO Use HeightTextureInfo.identifier instead
|
||||
new StringVerifier,
|
||||
"Specifies the height texture that is used for this RenderablePlanet.",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
KeyNightTexture,
|
||||
KeyNightTexture, // @TODO Use NightTextureInfo.identifier instead
|
||||
new StringVerifier,
|
||||
"Specifies the texture that is used for the night side of this "
|
||||
"RenderablePlanet.",
|
||||
@@ -114,6 +151,18 @@ documentation::Documentation RenderablePlanet::Documentation() {
|
||||
"this value is 'false', any existing night texture will not be used. "
|
||||
"This value defaults to 'true'.",
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
HeightExaggerationInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
HeightExaggerationInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
PerformShadingInfo.identifier,
|
||||
new BoolVerifier,
|
||||
PerformShadingInfo.description,
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -121,16 +170,15 @@ documentation::Documentation RenderablePlanet::Documentation() {
|
||||
|
||||
RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _colorTexturePath("colorTexture", "Color Texture")
|
||||
, _nightTexturePath("nightTexture", "Night Texture")
|
||||
, _heightMapTexturePath("heightMap", "Heightmap Texture")
|
||||
, _heightExaggeration("heightExaggeration", "Height Exaggeration", 1.f, 0.f, 10.f)
|
||||
, _performShading("performShading", "Perform Shading", true)
|
||||
, _colorTexturePath(ColorTextureInfo)
|
||||
, _nightTexturePath(NightTextureInfo)
|
||||
, _heightMapTexturePath(HeightTextureInfo)
|
||||
, _programObject(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _nightTexture(nullptr)
|
||||
, _heightMapTexture(nullptr)
|
||||
, _heightExaggeration(HeightExaggerationInfo, 1.f, 0.f, 10.f)
|
||||
, _geometry(nullptr)
|
||||
, _performShading(PerformShadingInfo, true)
|
||||
, _alpha(1.f)
|
||||
, _planetRadius(0.f)
|
||||
, _hasNightTexture(false)
|
||||
@@ -203,7 +251,16 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
|
||||
addProperty(_heightMapTexturePath);
|
||||
_heightMapTexturePath.onChange(loadTextureCallback);
|
||||
|
||||
if (dictionary.hasKey(HeightExaggerationInfo.identifier)) {
|
||||
_heightExaggeration = static_cast<float>(
|
||||
dictionary.value<double>(HeightExaggerationInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_heightExaggeration);
|
||||
|
||||
if (dictionary.hasKey(HeightExaggerationInfo.identifier)) {
|
||||
_performShading = dictionary.value<bool>(HeightExaggerationInfo.identifier);
|
||||
}
|
||||
addProperty(_performShading);
|
||||
|
||||
//================================================================
|
||||
|
||||
@@ -38,9 +38,42 @@
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
namespace {
|
||||
const char* KeyTexture = "Texture";
|
||||
const char* KeySize = "Size";
|
||||
const char* KeyOffset = "Offset";
|
||||
static const openspace::properties::Property::PropertyInfo TextureInfo = {
|
||||
"Texture",
|
||||
"Texture",
|
||||
"This value is the path to a texture on disk that contains a one-dimensional "
|
||||
"texture which is used for these rings."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SizeInfo = {
|
||||
"Size",
|
||||
"Size",
|
||||
"This value specifies the radius of the rings in meter."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo OffsetInfo = {
|
||||
"Offset",
|
||||
"Offset",
|
||||
"This value is used to limit the width of the rings.Each of the two values is a "
|
||||
"value between 0 and 1, where 0 is the center of the ring and 1 is the maximum "
|
||||
"extent at the radius. If this value is, for example {0.5, 1.0}, the ring is "
|
||||
"only shown between radius/2 and radius. It defaults to {0.0, 1.0}."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo NightFactorInfo = {
|
||||
"NightFactor",
|
||||
"Night Factor",
|
||||
"This value is a multiplicative factor that is applied to the side of the rings "
|
||||
"that is facing away from the Sun. If this value is equal to '1', no darkening "
|
||||
"of the night side occurs."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TransparencyInfo = {
|
||||
"Transparency",
|
||||
"Transparency",
|
||||
"This value determines the transparency of part of the rings depending on the "
|
||||
"color values. For this value v, the transparency is equal to length(color) / v."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -58,25 +91,33 @@ documentation::Documentation RenderableRings::Documentation() {
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyTexture,
|
||||
TextureInfo.identifier,
|
||||
new StringVerifier,
|
||||
"The one dimensional texture that is used for both sides of the ring.",
|
||||
TextureInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeySize,
|
||||
SizeInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
"The radius of the rings in meters.",
|
||||
SizeInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyOffset,
|
||||
OffsetInfo.identifier,
|
||||
new DoubleVector2Verifier,
|
||||
"The offset that is used to limit the width of the rings. Each of the "
|
||||
"two values is a value between 0 and 1, where 0 is the center of the "
|
||||
"ring and 1 is the maximum extent at the radius. If this value is, for "
|
||||
"example {0.5, 1.0}, the ring is only shown between radius/2 and radius. "
|
||||
"It defaults to {0.0, 1.0}.",
|
||||
OffsetInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
NightFactorInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
NightFactorInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
TransparencyInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
TransparencyInfo.description,
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
@@ -85,11 +126,11 @@ documentation::Documentation RenderableRings::Documentation() {
|
||||
|
||||
RenderableRings::RenderableRings(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _texturePath("texture", "Texture")
|
||||
, _size("size", "Size", 1.f, 0.f, std::pow(1.f, 25.f))
|
||||
, _offset("offset", "Offset", glm::vec2(0, 1.f), glm::vec2(0.f), glm::vec2(1.f))
|
||||
, _nightFactor("nightFactor", "Night Factor", 0.33f, 0.f, 1.f)
|
||||
, _transparency("transparency", "Transparency", 0.15f, 0.f, 1.f)
|
||||
, _texturePath(TextureInfo)
|
||||
, _size(SizeInfo, 1.f, 0.f, 1e25f)
|
||||
, _offset(OffsetInfo, glm::vec2(0.f, 1.f), glm::vec2(0.f), glm::vec2(1.f))
|
||||
, _nightFactor(NightFactorInfo, 0.33f, 0.f, 1.f)
|
||||
, _transparency(TransparencyInfo, 0.15f, 0.f, 1.f)
|
||||
, _shader(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _textureFile(nullptr)
|
||||
@@ -106,26 +147,37 @@ RenderableRings::RenderableRings(const ghoul::Dictionary& dictionary)
|
||||
"RenderableRings"
|
||||
);
|
||||
|
||||
_size = static_cast<float>(dictionary.value<double>(KeySize));
|
||||
_size = static_cast<float>(dictionary.value<double>(SizeInfo.identifier));
|
||||
setBoundingSphere(_size);
|
||||
addProperty(_size);
|
||||
_size.onChange([&]() { _planeIsDirty = true; });
|
||||
addProperty(_size);
|
||||
|
||||
_texturePath = absPath(dictionary.value<std::string>(KeyTexture));
|
||||
_texturePath = absPath(dictionary.value<std::string>(TextureInfo.identifier));
|
||||
_textureFile = std::make_unique<File>(_texturePath);
|
||||
|
||||
if (dictionary.hasKeyAndValue<glm::vec2>(KeyOffset)) {
|
||||
_offset = dictionary.value<glm::vec2>(KeyOffset);
|
||||
if (dictionary.hasKey(OffsetInfo.identifier)) {
|
||||
_offset = dictionary.value<glm::vec2>(OffsetInfo.identifier);
|
||||
}
|
||||
addProperty(_offset);
|
||||
|
||||
|
||||
_texturePath.onChange([&]() { loadTexture(); });
|
||||
addProperty(_texturePath);
|
||||
_texturePath.onChange([&](){ loadTexture(); });
|
||||
|
||||
_textureFile->setCallback([&](const File&) { _textureIsDirty = true; });
|
||||
|
||||
if (dictionary.hasKey(NightFactorInfo.identifier)) {
|
||||
_nightFactor = static_cast<float>(
|
||||
dictionary.value<double>(NightFactorInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_nightFactor);
|
||||
|
||||
if (dictionary.hasKey(TransparencyInfo.identifier)) {
|
||||
_transparency = static_cast<float>(
|
||||
dictionary.value<double>(TransparencyInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_transparency);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ namespace {
|
||||
const char* _loggerCat = "RenderableStars";
|
||||
|
||||
const char* KeyFile = "File";
|
||||
const char* KeyTexture = "Texture";
|
||||
const char* KeyColorMap = "ColorMap";
|
||||
|
||||
const int8_t CurrentCacheVersion = 1;
|
||||
|
||||
@@ -79,6 +77,48 @@ namespace {
|
||||
|
||||
float speed;
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo PsfTextureInfo = {
|
||||
"Texture",
|
||||
"Point Spread Function Texture",
|
||||
"The path to the texture that should be used as a point spread function for the "
|
||||
"stars."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ColorTextureInfo = {
|
||||
"ColorMap",
|
||||
"ColorBV Texture",
|
||||
"The path to the texture that is used to convert from the B-V value of the star "
|
||||
"to its color. The texture is used as a one dimensional lookup function."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ColorOptionInfo = {
|
||||
"ColorOption",
|
||||
"Color Option",
|
||||
"This value determines which quantity is used for determining the color of the "
|
||||
"stars."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo TransparencyInfo = {
|
||||
"Transparency",
|
||||
"Transparency",
|
||||
"This value is a multiplicative factor that is applied to the transparency of "
|
||||
"all stars."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo ScaleFactorInfo = {
|
||||
"ScaleFactor",
|
||||
"Scale Factor",
|
||||
"This value is used as a multiplicative factor that is applied to the apparent "
|
||||
"size of each star."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo MinBillboardSizeInfo = {
|
||||
"MinBillboardSize",
|
||||
"Min Billboard Size",
|
||||
"This value is used as a lower limit on the size of stars that are rendered. Any "
|
||||
"stars that have a smaller apparent size will be discarded entirely."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -103,20 +143,42 @@ documentation::Documentation RenderableStars::Documentation() {
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyTexture,
|
||||
PsfTextureInfo.identifier,
|
||||
new StringVerifier,
|
||||
"The path to the texture that should be used as a point spread function "
|
||||
"for the stars. The path is relative to the location of the .mod file "
|
||||
"and can contain file system token.",
|
||||
PsfTextureInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyColorMap,
|
||||
ColorTextureInfo.identifier,
|
||||
new StringVerifier,
|
||||
"The path to the texture that is used to convert from the B-V value of "
|
||||
"the star to its color. The texture is used as a one dimensional lookup "
|
||||
"function.",
|
||||
ColorTextureInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
ColorOptionInfo.identifier,
|
||||
new StringInListVerifier({
|
||||
"Color", "Velocity", "Speed"
|
||||
}),
|
||||
ColorOptionInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
TransparencyInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
TransparencyInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
ScaleFactorInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
ScaleFactorInfo.description,
|
||||
Optional::Yes
|
||||
},
|
||||
{
|
||||
MinBillboardSizeInfo.identifier,
|
||||
new DoubleVerifier,
|
||||
MinBillboardSizeInfo.description,
|
||||
Optional::Yes
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -125,21 +187,17 @@ documentation::Documentation RenderableStars::Documentation() {
|
||||
|
||||
RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _pointSpreadFunctionTexturePath("psfTexture", "Point Spread Function Texture")
|
||||
, _pointSpreadFunctionTexturePath(PsfTextureInfo)
|
||||
, _pointSpreadFunctionTexture(nullptr)
|
||||
, _pointSpreadFunctionTextureIsDirty(true)
|
||||
, _colorTexturePath("colorTexture", "ColorBV Texture")
|
||||
, _colorTexturePath(ColorTextureInfo)
|
||||
, _colorTexture(nullptr)
|
||||
, _colorTextureIsDirty(true)
|
||||
, _colorOption(
|
||||
"colorOption",
|
||||
"Color Option",
|
||||
properties::OptionProperty::DisplayType::Dropdown
|
||||
)
|
||||
, _colorOption(ColorOptionInfo, properties::OptionProperty::DisplayType::Dropdown)
|
||||
, _dataIsDirty(true)
|
||||
, _alphaValue("alphaValue", "Transparency", 1.f, 0.f, 1.f)
|
||||
, _scaleFactor("scaleFactor", "Scale Factor", 1.f, 0.f, 10.f)
|
||||
, _minBillboardSize("minBillboardSize", "Min Billboard Size", 1.f, 1.f, 100.f)
|
||||
, _alphaValue(TransparencyInfo, 1.f, 0.f, 1.f)
|
||||
, _scaleFactor(ScaleFactorInfo, 1.f, 0.f, 10.f)
|
||||
, _minBillboardSize(MinBillboardSizeInfo, 1.f, 1.f, 100.f)
|
||||
, _program(nullptr)
|
||||
, _speckFile("")
|
||||
, _nValuesPerStar(0)
|
||||
@@ -154,42 +212,74 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary)
|
||||
"RenderableStars"
|
||||
);
|
||||
|
||||
_pointSpreadFunctionTexturePath = absPath(dictionary.value<std::string>(KeyTexture));
|
||||
_pointSpreadFunctionTexturePath = absPath(dictionary.value<std::string>(
|
||||
PsfTextureInfo.identifier
|
||||
));
|
||||
_pointSpreadFunctionFile = std::make_unique<File>(_pointSpreadFunctionTexturePath);
|
||||
|
||||
_colorTexturePath = absPath(dictionary.value<std::string>(KeyColorMap));
|
||||
_colorTexturePath = absPath(dictionary.value<std::string>(
|
||||
ColorTextureInfo.identifier
|
||||
));
|
||||
_colorTextureFile = std::make_unique<File>(_colorTexturePath);
|
||||
|
||||
_speckFile = absPath(dictionary.value<std::string>(KeyFile));
|
||||
|
||||
//_colorOption.addOptions({
|
||||
// { ColorOption::Color, "Color" },
|
||||
// { ColorOption::Velocity, "Velocity" },
|
||||
// { ColorOption::Speed, "Speed" }
|
||||
//});
|
||||
_colorOption.addOption(ColorOption::Color, "Color");
|
||||
_colorOption.addOption(ColorOption::Velocity, "Velocity");
|
||||
_colorOption.addOption(ColorOption::Speed, "Speed");
|
||||
_colorOption.addOptions({
|
||||
{ ColorOption::Color, "Color" },
|
||||
{ ColorOption::Velocity, "Velocity" },
|
||||
{ ColorOption::Speed, "Speed" }
|
||||
});
|
||||
if (dictionary.hasKey(ColorOptionInfo.identifier)) {
|
||||
const std::string colorOption = dictionary.value<std::string>(
|
||||
ColorOptionInfo.identifier
|
||||
);
|
||||
if (colorOption == "Color") {
|
||||
_colorOption = ColorOption::Color;
|
||||
}
|
||||
else if (colorOption == "Velocity") {
|
||||
_colorOption = ColorOption::Velocity;
|
||||
}
|
||||
else {
|
||||
_colorOption = ColorOption::Speed;
|
||||
}
|
||||
}
|
||||
_colorOption.onChange([&] { _dataIsDirty = true; });
|
||||
addProperty(_colorOption);
|
||||
|
||||
_colorOption.onChange([&]{ _dataIsDirty = true;});
|
||||
|
||||
addProperty(_pointSpreadFunctionTexturePath);
|
||||
_pointSpreadFunctionTexturePath.onChange(
|
||||
[&]{ _pointSpreadFunctionTextureIsDirty = true; }
|
||||
);
|
||||
_pointSpreadFunctionFile->setCallback(
|
||||
[&](const File&) { _pointSpreadFunctionTextureIsDirty = true; }
|
||||
);
|
||||
addProperty(_pointSpreadFunctionTexturePath);
|
||||
|
||||
addProperty(_colorTexturePath);
|
||||
_colorTexturePath.onChange([&]{ _colorTextureIsDirty = true; });
|
||||
_colorTextureFile->setCallback(
|
||||
[&](const File&) { _colorTextureIsDirty = true; }
|
||||
);
|
||||
addProperty(_colorTexturePath);
|
||||
|
||||
if (dictionary.hasKey(TransparencyInfo.identifier)) {
|
||||
_alphaValue = static_cast<float>(
|
||||
dictionary.value<double>(TransparencyInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_alphaValue);
|
||||
|
||||
if (dictionary.hasKey(ScaleFactorInfo.identifier)) {
|
||||
_scaleFactor = static_cast<float>(
|
||||
dictionary.value<double>(ScaleFactorInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_scaleFactor);
|
||||
|
||||
if (dictionary.hasKey(MinBillboardSizeInfo.identifier)) {
|
||||
_minBillboardSize = static_cast<float>(
|
||||
dictionary.value<double>(MinBillboardSizeInfo.identifier)
|
||||
);
|
||||
}
|
||||
addProperty(_minBillboardSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,71 +23,100 @@
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/space/rendering/simplespheregeometry.h>
|
||||
#include <openspace/util/powerscaledsphere.h>
|
||||
|
||||
#include <openspace/documentation/verifier.h>
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/util/powerscaledsphere.h>
|
||||
|
||||
namespace {
|
||||
const char* _loggerCat = "SimpleSphereGeometry";
|
||||
|
||||
const char* keyRadius = "Radius";
|
||||
const char* keySegments = "Segments";
|
||||
static const openspace::properties::Property::PropertyInfo RadiusInfo = {
|
||||
"Radius",
|
||||
"Radius",
|
||||
"This value specifies the radius of this sphere in meters."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SegmentsInfo = {
|
||||
"Segments",
|
||||
"Segments",
|
||||
"This value specifies the number of segments that this sphere is split into."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace::planetgeometry {
|
||||
|
||||
documentation::Documentation SimpleSphereGeometry::Documentation() {
|
||||
using namespace documentation;
|
||||
return {
|
||||
"SimpleSphereGeometry",
|
||||
"space_geometry_simplesphere",
|
||||
{
|
||||
{
|
||||
RadiusInfo.identifier,
|
||||
new OrVerifier(
|
||||
new DoubleVerifier,
|
||||
new DoubleVector3Verifier
|
||||
),
|
||||
RadiusInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
SegmentsInfo.identifier,
|
||||
new IntVerifier,
|
||||
SegmentsInfo.description,
|
||||
Optional::No
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
SimpleSphereGeometry::SimpleSphereGeometry(const ghoul::Dictionary& dictionary)
|
||||
: PlanetGeometry()
|
||||
, _radius(
|
||||
"radius",
|
||||
"Radius",
|
||||
glm::vec3(1.f, 1.f, 1.f),
|
||||
glm::vec3(0.f, 0.f, 0.f),
|
||||
glm::vec3(std::pow(10.f, 20.f), std::pow(10.f, 20.f), std::pow(10.f, 20.f)))
|
||||
, _segments("segments", "Segments", 20, 1, 5000)
|
||||
, _radius(RadiusInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(std::pow(10.f, 20.f)))
|
||||
, _segments(SegmentsInfo, 20, 1, 5000)
|
||||
, _sphere(nullptr)
|
||||
{
|
||||
float sphereRadius = 0.f;
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
dictionary,
|
||||
"SimpleSphereGeometry"
|
||||
);
|
||||
|
||||
glm::vec3 ellipsoidRadius;
|
||||
if (dictionary.getValue(keyRadius, sphereRadius)) {
|
||||
_radius = { sphereRadius, sphereRadius, sphereRadius };
|
||||
} else if (dictionary.getValue(keyRadius, ellipsoidRadius)) {
|
||||
_radius = ellipsoidRadius;
|
||||
} else {
|
||||
LERROR("SimpleSphereGeometry did not provide a key '"
|
||||
<< keyRadius << "'");
|
||||
if (dictionary.hasKeyAndValue<double>(RadiusInfo.identifier)) {
|
||||
const float r = static_cast<float>(
|
||||
dictionary.value<double>(RadiusInfo.identifier)
|
||||
);
|
||||
_radius = { r, r, r };
|
||||
}
|
||||
else {
|
||||
_radius = dictionary.value<glm::vec3>(RadiusInfo.identifier);
|
||||
}
|
||||
|
||||
double segments = 0;
|
||||
if (dictionary.getValue(keySegments, segments)) {
|
||||
_segments = static_cast<int>(segments);
|
||||
} else {
|
||||
LERROR("SimpleSphereGeometry did not provide a key '"
|
||||
<< keySegments << "'");
|
||||
}
|
||||
_segments = static_cast<int>(dictionary.value<double>(SegmentsInfo.identifier));
|
||||
|
||||
// The shader need the radii values but they are not changeable runtime
|
||||
// TODO: Possibly add a scaling property @AA
|
||||
addProperty(_radius);
|
||||
// Changing the radius/scaling should affect the shader but not the geometry? @AA
|
||||
_radius.onChange(std::bind(&SimpleSphereGeometry::createSphere, this));
|
||||
_radius.onChange([&]() { createSphere(); });
|
||||
addProperty(_radius);
|
||||
|
||||
_segments.onChange([&]() { createSphere(); });
|
||||
addProperty(_segments);
|
||||
_segments.onChange(std::bind(&SimpleSphereGeometry::createSphere, this));
|
||||
}
|
||||
|
||||
SimpleSphereGeometry::~SimpleSphereGeometry() {
|
||||
}
|
||||
SimpleSphereGeometry::~SimpleSphereGeometry() {}
|
||||
|
||||
bool SimpleSphereGeometry::initialize(Renderable* parent)
|
||||
{
|
||||
bool SimpleSphereGeometry::initialize(Renderable* parent) {
|
||||
bool success = PlanetGeometry::initialize(parent);
|
||||
createSphere();
|
||||
return success;
|
||||
}
|
||||
|
||||
void SimpleSphereGeometry::deinitialize() {
|
||||
if (_sphere)
|
||||
delete _sphere;
|
||||
delete _sphere;
|
||||
_sphere = nullptr;
|
||||
}
|
||||
|
||||
@@ -95,13 +124,11 @@ void SimpleSphereGeometry::render() {
|
||||
_sphere->render();
|
||||
}
|
||||
|
||||
void SimpleSphereGeometry::createSphere(){
|
||||
void SimpleSphereGeometry::createSphere() {
|
||||
const glm::vec3 radius = _radius.value();
|
||||
_parent->setBoundingSphere(std::max(std::max(radius[0], radius[1]), radius[2]));
|
||||
|
||||
if(_sphere)
|
||||
delete _sphere;
|
||||
|
||||
delete _sphere;
|
||||
_sphere = new PowerScaledSphere(glm::vec4(radius, 0.0), _segments);
|
||||
_sphere->initialize();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace openspace {
|
||||
class PowerScaledSphere;
|
||||
} // namespace openspace
|
||||
|
||||
namespace openspace::documentation { struct Documentation; }
|
||||
|
||||
namespace openspace::planetgeometry {
|
||||
|
||||
class SimpleSphereGeometry : public PlanetGeometry {
|
||||
@@ -46,6 +48,8 @@ public:
|
||||
void deinitialize() override;
|
||||
void render() override;
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
private:
|
||||
void createSphere();
|
||||
|
||||
|
||||
@@ -32,9 +32,21 @@
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
namespace {
|
||||
const char* KeySourceFrame = "SourceFrame";
|
||||
const char* KeyDestinationFrame = "DestinationFrame";
|
||||
const char* KeyKernels = "Kernels";
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo SourceInfo = {
|
||||
"SourceFrame",
|
||||
"Source",
|
||||
"This value specifies the source frame that is used as the basis for the "
|
||||
"coordinate transformation. This has to be a valid SPICE name."
|
||||
};
|
||||
|
||||
static const openspace::properties::Property::PropertyInfo DestinationInfo = {
|
||||
"DestinationFrame",
|
||||
"Destination",
|
||||
"This value specifies the destination frame that is used for the coordinate "
|
||||
"transformation. This has to be a valid SPICE name."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -52,25 +64,21 @@ documentation::Documentation SpiceRotation::Documentation() {
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeySourceFrame,
|
||||
SourceInfo.identifier,
|
||||
new StringAnnotationVerifier("A valid SPICE NAIF name or integer"),
|
||||
"The source frame that is used as the basis for the coordinate "
|
||||
"transformation. This has to be a valid SPICE name.",
|
||||
SourceInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyDestinationFrame,
|
||||
DestinationInfo.identifier,
|
||||
new StringAnnotationVerifier("A valid SPICE NAIF name or integer"),
|
||||
"The destination frame that is used for the coordinate transformation. "
|
||||
"This has to be a valid SPICE name.",
|
||||
DestinationInfo.description,
|
||||
Optional::No
|
||||
},
|
||||
{
|
||||
KeyKernels,
|
||||
new OrVerifier(
|
||||
new TableVerifier({
|
||||
{ "*", new StringVerifier }
|
||||
}),
|
||||
new StringListVerifier,
|
||||
new StringVerifier
|
||||
),
|
||||
"A single kernel or list of kernels that this SpiceTranslation depends "
|
||||
@@ -83,8 +91,8 @@ documentation::Documentation SpiceRotation::Documentation() {
|
||||
}
|
||||
|
||||
SpiceRotation::SpiceRotation(const ghoul::Dictionary& dictionary)
|
||||
: _sourceFrame("source", "Source", "")
|
||||
, _destinationFrame("destination", "Destination", "")
|
||||
: _sourceFrame(SourceInfo) // @TODO Missing documentation
|
||||
, _destinationFrame(DestinationInfo)
|
||||
{
|
||||
documentation::testSpecificationAndThrow(
|
||||
Documentation(),
|
||||
@@ -92,8 +100,8 @@ SpiceRotation::SpiceRotation(const ghoul::Dictionary& dictionary)
|
||||
"SpiceRotation"
|
||||
);
|
||||
|
||||
_sourceFrame = dictionary.value<std::string>(KeySourceFrame);
|
||||
_destinationFrame = dictionary.value<std::string>(KeyDestinationFrame);
|
||||
_sourceFrame = dictionary.value<std::string>(SourceInfo.identifier);
|
||||
_destinationFrame = dictionary.value<std::string>(DestinationInfo.identifier);
|
||||
|
||||
if (dictionary.hasKeyAndValue<std::string>(KeyKernels)) {
|
||||
SpiceManager::ref().loadKernel(dictionary.value<std::string>(KeyKernels));
|
||||
|
||||
@@ -86,7 +86,8 @@ std::vector<documentation::Documentation> SpaceModule::documentations() const {
|
||||
RenderableStars::Documentation(),
|
||||
SpiceRotation::Documentation(),
|
||||
SpiceTranslation::Documentation(),
|
||||
planetgeometry::PlanetGeometry::Documentation()
|
||||
planetgeometry::PlanetGeometry::Documentation(),
|
||||
planetgeometry::SimpleSphereGeometry::Documentation()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user