Merge branch 'master' into satellite_asset

This commit is contained in:
Alexander Bock
2018-03-14 13:30:09 -04:00
257 changed files with 4113 additions and 3119 deletions

4
Jenkinsfile vendored
View File

@@ -45,7 +45,7 @@ stage('Build') {
node('windows') {
timeout(time: 90, unit: 'MINUTES') {
// We specify the workspace directory manually to reduce the path length and thus try to avoid MSB3491 on Visual Studio
ws("C:/J/O/${env.BRANCH_NAME}") {
ws("C:/J/O/${env.BRANCH_NAME}/${env.BUILD_ID}") {
deleteDir()
checkout scm
bat '''
@@ -54,7 +54,7 @@ stage('Build') {
cd build
cmake -G "Visual Studio 15 2017 Win64" .. ''' +
flags + ''' ..
msbuild.exe OpenSpace.sln /nologo /verbosity:minimal /m:4 /p:Configuration=Debug
msbuild.exe OpenSpace.sln /nologo /verbosity:minimal /p:Configuration=Debug /target:OpenSpace
'''
}
}

View File

@@ -43,7 +43,7 @@
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/stacktrace.h>
#include <fmt/format.h>
#include <ghoul/fmt.h>
#include <Windows.h>
#include <shellapi.h>
@@ -104,7 +104,7 @@ LONG WINAPI generateMiniDump(EXCEPTION_POINTERS* exceptionPointers) {
GetCurrentThreadId()
);
LINFO("Creating dump file: " << dumpFile);
LINFO(fmt::format("Creating dump file: {}", dumpFile));
HANDLE hDumpFile = CreateFile(
dumpFile.c_str(),
@@ -310,7 +310,7 @@ void mainInitFunc() {
#endif // OPENSPACE_HAS_SPOUT
}
std::string k = openspace::ConfigurationManager::KeyScreenshotUseDate;
std::string screenshotPath = "${SCREENSHOTS}";
std::string screenshotNames = "OpenSpace";
@@ -320,19 +320,16 @@ void mainInitFunc() {
char mbstr[100];
strftime(mbstr, sizeof(mbstr), "%Y-%m-%d-%H-%M", nowTime);
screenshotPath += "/" + std::string(mbstr);
std::string p = absPath(screenshotPath);
if (!FileSys.directoryExists(p)) {
FileSys.createDirectory(p);
}
}
FileSys.registerPathToken("${THIS_SCREENSHOT_PATH}", screenshotPath);
for (size_t i = 0; i < nWindows; ++i) {
sgct_core::ScreenCapture* cpt0 =
SgctEngine->getWindowPtr(i)->getScreenCapturePointer(0);
sgct_core::ScreenCapture* cpt1 =
SgctEngine->getWindowPtr(i)->getScreenCapturePointer(1);
if (cpt0) {
cpt0->setPathAndFileName(
absPath(screenshotPath),
@@ -559,7 +556,9 @@ int main_main(int argc, char** argv) {
catch (const ghoul::RuntimeError& e) {
// Write out all of the information about the exception and flush the logs
LFATALC(e.component, e.message);
LogMgr.flushLogs();
if (ghoul::logging::LogManager::isInitialized()) {
LogMgr.flushLogs();
}
return EXIT_FAILURE;
}
catch (const ghoul::AssertionException& e) {
@@ -570,12 +569,16 @@ int main_main(int argc, char** argv) {
}
catch (const std::exception& e) {
LFATALC("Exception", e.what());
LogMgr.flushLogs();
if (ghoul::logging::LogManager::isInitialized()) {
LogMgr.flushLogs();
}
return EXIT_FAILURE;
}
catch (...) {
LFATALC("Exception", "Unknown exception");
LogMgr.flushLogs();
if (ghoul::logging::LogManager::isInitialized()) {
LogMgr.flushLogs();
}
return EXIT_FAILURE;
}
@@ -583,7 +586,9 @@ int main_main(int argc, char** argv) {
return EXIT_SUCCESS;
}
LINFO("Detected OpenGL version: " << glVersion.first << "." << glVersion.second);
LINFO(fmt::format(
"Detected OpenGL version: {}.{}", glVersion.first, glVersion.second
));
// Create sgct engine c arguments
int newArgc = static_cast<int>(sgctArguments.size());

View File

@@ -52,8 +52,11 @@ int main(int argc, char** argv) {
Task& task = *tasks[i].get();
LINFOC(
"Sync",
"Synchronizing scene " << (i + 1) << " out of " <<
tasks.size() << ": " << task.description()
fmt::format(
"Synchronizing scene {} out of {}: {}",
i + 1, tasks.size(),
task.description()
)
);
ProgressBar progressBar(100);
task.perform([&progressBar](float progress) {

View File

@@ -83,15 +83,14 @@ void performTasks(const std::string& path) {
LINFO("Task queue has 1 item");
}
else {
LINFO("Task queue has " << tasks.size() << " items");
LINFO(fmt::format("Task queue has {} items", tasks.size()));
}
for (size_t i = 0; i < tasks.size(); i++) {
Task& task = *tasks[i].get();
LINFO(
"Performing task " << (i + 1) << " out of " <<
tasks.size() << ": " << task.description()
);
LINFO(fmt::format(
"Performing task {} out of {}: {}", i + 1, tasks.size(), task.description()
));
ProgressBar progressBar(100);
auto onProgress = [&progressBar](float progress) {
progressBar.print(static_cast<int>(progress * 100.f));
@@ -135,7 +134,7 @@ int main(int argc, char** argv) {
// If no task file was specified in as argument, run in CLI mode.
LINFO("Task root: " << absPath("${TASKS}"));
LINFO(fmt::format("Task root: {}", absPath("${TASKS}")));
FileSys.setCurrentDirectory(ghoul::filesystem::Directory(absPath("${TASKS}")));
std::cout << "TASK > ";

View File

@@ -17,7 +17,7 @@ local vrt_folders = {
-- tl;dr: Specify CTX folders first, then HiRISE
-- example: 'C:/OpenSpace/GlobeBrowsingData/Mars/CTX'
'',
''
'',
},
Moon = {
-- Add folders here whose contents will be automatically added to the Moon globe
@@ -25,7 +25,6 @@ local vrt_folders = {
-- if areas overlap, images from the lower results will overwrite the images from former
-- results
-- example: 'C:/OpenSpace/GlobeBrowsingData/Moon'
'',
''
}
}

View File

@@ -1,5 +1,6 @@
local assetHelper = asset.require('util/asset_helper')
local sceneHelper = asset.require('util/scene_helper')
local propertyHelper = asset.require('util/property_helper')
-- Specifying which other assets should be loaded in this scene
asset.require('spice/base')
@@ -19,37 +20,37 @@ asset.request('customization/globebrowsing')
local Keybindings = {
{
Key = "s",
Command = sceneHelper.property.invert('Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.Enabled') ..
sceneHelper.property.invert('Earth.RenderableGlobe.PerformShading') ..
sceneHelper.property.invert('Earth.RenderableGlobe.Atmosphere') ..
sceneHelper.property.invert('Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.Enabled'),
Command = propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.Enabled') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.PerformShading') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.Atmosphere') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.Enabled'),
Documentation = "Toggle night texture, shading, atmosphere, and water for Earth.",
Local = false
},
{
Key = "b",
Command = sceneHelper.property.invert('MilkyWay.renderable.Enabled') ..
sceneHelper.property.invert('Stars.renderable.Enabled'),
Command = propertyHelper.invert('Scene.MilkyWay.renderable.Enabled') ..
propertyHelper.invert('Scene.Stars.renderable.Enabled'),
Documentation = "Toggle background (Stars and Milkyway).",
Local = false
},
{
Key = "g",
Command = sceneHelper.property.invert('MilkyWay.renderable.Enabled') ..
sceneHelper.property.invert('Stars.renderable.Enabled') ..
sceneHelper.property.invert('Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.Enabled') ..
sceneHelper.property.invert('Earth.RenderableGlobe.PerformShading') ..
sceneHelper.property.invert('Mars.RenderableGlobe.PerformShading') ..
sceneHelper.property.invert('Earth.RenderableGlobe.Atmosphere') ..
sceneHelper.property.invert('Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.Enabled') ..
sceneHelper.property.invert('Moon.RenderableGlobe.Enabled') ..
sceneHelper.property.invert('Sun.renderable.Enabled'),
Command = propertyHelper.invert('Scene.MilkyWay.renderable.Enabled') ..
propertyHelper.invert('Scene.Stars.renderable.Enabled') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.NightLayers.Earth at Night 2012.Enabled') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.PerformShading') ..
propertyHelper.invert('Scene.Mars.RenderableGlobe.PerformShading') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.Atmosphere') ..
propertyHelper.invert('Scene.Earth.RenderableGlobe.Layers.WaterMasks.MODIS_Water_Mask.Enabled') ..
propertyHelper.invert('Scene.Moon.RenderableGlobe.Enabled') ..
propertyHelper.invert('Scene.Sun.renderable.Enabled'),
Documentation = "Toogles background and shading mode on the Earth and Mars alongside visibility of the Moon and the Sun",
Local = false
},
{
Key = "h",
Command = "openspace.setPropertyValue('*Trail.renderable.Enabled', false)",
Command = "openspace.setPropertyValue('Scene.*Trail.renderable.Enabled', false)",
Documentation = "Disables visibility of the trails",
Local = false
},
@@ -72,11 +73,10 @@ asset.onInitialize(function ()
"Earth", "Mars", "Moon"
})
openspace.addVirtualProperty(
"BoolProperty",
"Show Trails",
"*Trail.renderable.Enabled",
"Scene.*Trail.renderable.Enabled",
"Disable or enable all trails of the scene at the same time",
true,
nil,

View File

@@ -3,15 +3,15 @@
local assetHelper = asset.require("util/asset_helper")
asset.syncedResource({
Type = "UrlSynchronization",
Name = "Example Single",
Type = "UrlSynchronization",
Identifier = "example_single",
Url = "http://celestrak.com/NORAD/elements/geo.txt"
})
asset.syncedResource({
Type = "UrlSynchronization",
Name = "Example Multiple",
Type = "UrlSynchronization",
Identifier = "example_multiple",
Url = {
"http://celestrak.com/NORAD/elements/stations.txt",
@@ -20,14 +20,23 @@ asset.syncedResource({
})
asset.syncedResource({
Type = "UrlSynchronization",
Name = "Example Large",
Type = "UrlSynchronization",
Identifier = "example_large",
Url = "http://ipv4.download.thinkbroadband.com/100MB.zip"
Url = "http://ipv4.download.thinkbroadband.com/100MB.zip",
Override = true
})
asset.syncedResource({
Name = "Example Medium",
Type = "UrlSynchronization",
Identifier = "example_medium",
Url = "http://ipv4.download.thinkbroadband.com/5MB.zip",
Override = true
})
asset.syncedResource({
Name = "Example No ident",
Type = "UrlSynchronization",
Url = "http://ipv4.download.thinkbroadband.com/5MB.zip"
})

View File

@@ -1,5 +1,7 @@
local assetHelper = asset.require('util/asset_helper')
local sceneHelper = asset.require('util/scene_helper')
local propertyHelper = asset.require('util/property_helper')
local renderableHelper = asset.require('util/renderable_helper')
-- Specifying which other assets should be loaded in this scene
asset.require('spice/base')
@@ -34,94 +36,94 @@ local Keybindings = {
},
{
Key = "F8",
Command = "openspace.setPropertyValue('Pluto.renderable.ProjectionComponent.ClearAllProjections', true);" ..
"openspace.setPropertyValue('Charon.renderable.ProjectionComponent.ClearAllProjections', true);",
Command = "openspace.setPropertyValue('Scene.Pluto.renderable.ProjectionComponent.ClearAllProjections', true);" ..
"openspace.setPropertyValue('Scene.Charon.renderable.ProjectionComponent.ClearAllProjections', true);",
Documentation = "Removes all image projections from Pluto and Charon.",
Local = false
},
{
Key = "F9",
Command = "openspace.time.setTime('2015-07-14T09:00:00.00');" ..
"openspace.setPropertyValue('Pluto.renderable.ClearAllProjections', true);" ..
"openspace.setPropertyValue('Charon.renderable.ClearAllProjections', true);",
"openspace.setPropertyValue('Scene.Pluto.renderable.ClearAllProjections', true);" ..
"openspace.setPropertyValue('Scene.Charon.renderable.ClearAllProjections', true);",
Documentation = "Jumps to the 14th of July 2015 at 0900 UTC and clears all projections.",
Local = false
},
{
Key = "KP_8",
Command = sceneHelper.property.increment('Pluto.renderable.HeightExaggeration', 5000000),
Command = propertyHelper.increment('Scene.Pluto.renderable.HeightExaggeration', 5000000),
Documentation = "Increases the height map exaggeration on Pluto.",
Local = false
},
{
Key = "KP_2",
Command = sceneHelper.property.decrement('Pluto.renderable.HeightExaggeration', 5000000),
Command = propertyHelper.decrement('Scene.Pluto.renderable.HeightExaggeration', 5000000),
Documentation = "Decreases the height map exaggeration on Pluto.",
Local = false
},
{
Key = "KP_9",
Command = sceneHelper.property.increment('Charon.renderable.HeightExaggeration', 5000000),
Command = propertyHelper.increment('Scene.Charon.renderable.HeightExaggeration', 5000000),
Documentation = "Increases the height map exaggeration on Charon.",
Local = false
},
{
Key = "KP_3",
Command = sceneHelper.property.decrement('Charon.renderable.HeightExaggeration', 5000000),
Command = propertyHelper.decrement('Scene.Charon.renderable.HeightExaggeration', 5000000),
Documentation = "Decreases the height map exaggeration on Charon.",
Local = false
},
{
Key = "q",
Command = sceneHelper.property.invert('SunMarker.renderable.Enabled'),
Command = propertyHelper.invert('Scene.SunMarker.renderable.Enabled'),
Documentation = "Toggles the visibility of the text marking the location of the Sun.",
Local = false
},
{
Key = "e",
Command = sceneHelper.property.invert('EarthMarker.renderable.Enabled'),
Command = propertyHelper.invert('Scene.EarthMarker.renderable.Enabled'),
Documentation = "Toggles the visibility of the text marking the location of the Earth.",
Local = false
},
{
Key = "o",
Command = sceneHelper.property.invert('PlutoTrail.renderable.Enabled'),
Command = propertyHelper.invert('Scene.PlutoTrail.renderable.Enabled'),
Documentation = "Toggles the visibility of the trail behind Pluto.",
Local = false
},
{
Key = "j",
Command = sceneHelper.renderable.toggle('PlutoText') .. sceneHelper.renderable.toggle('CharonText') ..
sceneHelper.renderable.toggle('HydraText') .. sceneHelper.renderable.toggle('NixText') ..
sceneHelper.renderable.toggle('KerberosText') .. sceneHelper.renderable.toggle('StyxText'),
Command = renderableHelper.toggle('Scene.PlutoText') .. renderableHelper.toggle('Scene.CharonText') ..
renderableHelper.toggle('Scene.HydraText') .. renderableHelper.toggle('Scene.NixText') ..
renderableHelper.toggle('Scene.KerberosText') .. renderableHelper.toggle('Scene.StyxText'),
Documentation = "Toggles the visibility of the text labels of Pluto, Charon, Hydra, Nix, Kerberos, and Styx.",
Local = false
},
{
Key = "l",
Command = sceneHelper.property.invert('Labels.renderable.Enabled'),
Command = propertyHelper.invert('Scene.Labels.renderable.Enabled'),
Documentation = "Toggles the visibility of the labels for the New Horizons instruments.",
Local = false
},
{
Key = "m",
Command = sceneHelper.property.invert('NH_LORRI.renderable.SolidDraw') ..
sceneHelper.property.invert('NH_RALPH_LEISA.renderable.SolidDraw') ..
sceneHelper.property.invert('NH_RALPH_MVIC_PAN1.renderable.SolidDraw') ..
sceneHelper.property.invert('NH_RALPH_MVIC_PAN2.renderable.SolidDraw') ..
sceneHelper.property.invert('NH_RALPH_MVIC_RED.renderable.SolidDraw') ..
sceneHelper.property.invert('NH_RALPH_MVIC_BLUE.renderable.SolidDraw') ..
sceneHelper.property.invert('NH_RALPH_MVIC_FT.renderable.SolidDraw') ..
sceneHelper.property.invert('NH_RALPH_MVIC_METHANE.renderable.SolidDraw') ..
sceneHelper.property.invert('NH_RALPH_MVIC_NIR.renderable.SolidDraw') ..
sceneHelper.property.invert('NH_ALICE_AIRGLOW.renderable.SolidDraw') ..
sceneHelper.property.invert('NH_ALICE_SOC.renderable.SolidDraw'),
Command = propertyHelper.invert('Scene.NH_LORRI.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_LEISA.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN1.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_PAN2.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_RED.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_BLUE.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_FT.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_METHANE.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_RALPH_MVIC_NIR.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_ALICE_AIRGLOW.renderable.SolidDraw') ..
propertyHelper.invert('Scene.NH_ALICE_SOC.renderable.SolidDraw'),
Documentation = "Draws the instrument field of views in a solid color or as lines.",
Local = false
},
{
Key = "t",
Command = sceneHelper.renderable.toggle('PlutoShadow') .. sceneHelper.renderable.toggle('CharonShadow'),
Command = renderableHelper.toggle('Scene.PlutoShadow') .. renderableHelper.toggle('Scene.CharonShadow'),
Documentation = "Toggles the visibility of the shadow visualization of Pluto and Charon.",
Local = false
}

View File

@@ -1,5 +1,6 @@
local assetHelper = asset.require('util/asset_helper')
local sceneHelper = asset.require('util/scene_helper')
local propertyHelper = asset.require('util/property_helper')
-- Specifying which other assets should be loaded in this scene
asset.require('spice/base')
@@ -64,13 +65,13 @@ local Keybindings = {
},
{
Key = "q",
Command = sceneHelper.property.invert('SunMarker.renderable.Enabled'),
Command = propertyHelper.invert('Scene.SunMarker.renderable.Enabled'),
Documentation = "Toggles the visibility of the text marking the location of the Sun.",
Local = false
},
{
Key = "e",
Command = sceneHelper.property.invert('EarthMarker.renderable.Enabled'),
Command = propertyHelper.invert('Scene.EarthMarker.renderable.Enabled'),
Documentation = "Toggles the visibility of the text marking the location of the Earth.",
Local = false
}

View File

@@ -1,5 +1,7 @@
local assetHelper = asset.require('util/asset_helper')
local sceneHelper = asset.require('util/scene_helper')
local propertyHelper = asset.require('util/property_helper')
local renderableHelper = asset.require('util/renderable_helper')
-- Specifying which other assets should be loaded in this scene
asset.require('spice/base')
@@ -41,38 +43,38 @@ local Keybindings = {
},
{
Key = "F8",
Command = "openspace.setPropertyValue('67P.renderable.ProjectionComponent.clearAllProjections', true)",
Command = "openspace.setPropertyValue('Scene.67P.renderable.ProjectionComponent.clearAllProjections', true)",
Documentation = "Removes all image projections from 67P.",
Local = false
},
{
Key = "q",
Command = sceneHelper.property.invert('SunMarker.renderable.Enabled'),
Command = propertyHelper.invert('Scene.SunMarker.renderable.Enabled'),
Documentation = "Toggles the visibility of the text marking the location of the Sun.",
Local = false
},
{
Key = "e",
Command = helper.renderable.toggle('JupiterTrail') .. helper.renderable.toggle('SaturnTrail') ..
helper.renderable.toggle('UranusTrail') .. helper.renderable.toggle('NeptuneTrail'),
Command = renderableHelper.toggle('Scene.JupiterTrail') .. renderableHelper.toggle('Scene.SaturnTrail') ..
renderableHelper.toggle('Scene.UranusTrail') .. renderableHelper.toggle('Scene.NeptuneTrail'),
Documentation = "Toggles the visibility of all trails further from the Sun than 67P.",
Local = false
},
{
Key = "i",
Command = sceneHelper.renderable.toggle('ImagePlaneRosetta'),
Command = renderableHelper.toggle('Scene.ImagePlaneRosetta'),
Documentation = "Toggles the visibility of the free floating image plane.",
Local = false
},
{
Key = "f",
Command = sceneHelper.renderable.toggle('PhilaeTrail'),
Command = renderableHelper.toggle('Scene.PhilaeTrail'),
Documentation = "Toggles the visibility of Philae's trail.",
Local = false
},
{
Key = "p",
Command = sceneHelper.property.invert('67P.renderable.ProjectionComponent.performProjection'),
Command = propertyHelper.invert('Scene.67P.renderable.ProjectionComponent.performProjection'),
Documentation = "Enables or disables the image projection on 67P.",
Local = false
}
@@ -129,7 +131,7 @@ asset.onInitialize(function ()
Rotation = { -0.106166, 0.981574, -0.084545, 0.134513 },
})
openspace.setPropertyValue('67P.renderable.PerformShading', false);
openspace.setPropertyValue('Scene.67P.renderable.PerformShading', false);
end)
asset.onDeinitialize(function ()

View File

@@ -23,7 +23,7 @@ local wmap = {
Enabled = false,
Size = 3975.41417036064E23,
Segments = 80,
Alpha = 0.5,
Opacity = 0.5,
Texture = textures .. "/wmap_ilc_7yr_v4_200uK_RGB_sos.png",
Orientation = "Inside/Outside",
FadeInThreshould = 8E26
@@ -39,7 +39,7 @@ local cbe = {
Enabled = false,
Size = 3975.41417036064E23,
Segments = 80,
Alpha = 0.5,
Opacity = 0.5,
Texture = textures .. "/COBErect.png",
Orientation = "Inside/Outside",
FadeInThreshould = 8E26
@@ -54,7 +54,7 @@ local planck = {
Enabled = false,
Size = 3975.41417036064E23,
Segments = 80,
Alpha = 0.3,
Opacity = 0.3,
Texture = textures .. "/cmb4k.jpg",
Orientation = "Inside/Outside",
FadeInThreshould = 8E26

View File

@@ -29,7 +29,7 @@ local sphere = {
Type = "RenderableSphere",
Size = 9.2E20,
Segments = 40,
Alpha = 0.4,
Opacity = 0.4,
Texture = sphereTextures .. "/DarkUniverse_mellinger_4k.jpg",
Orientation = "Inside/Outside",
FadeOutThreshould = 0.25

View File

@@ -15,7 +15,7 @@ local object = {
Type = "RenderableSphere",
Size = 9.2E20,
Segments = 40,
Alpha = 0.4,
Opacity = 0.4,
Texture = textures .. "/eso0932a_blend.png",
Orientation = "Inside/Outside",
FadeOutThreshould = 0.01

View File

@@ -2,19 +2,15 @@ asset.request('./bennu')
asset.request('./model')
asset.request('./trail')
asset.require('./script_schedule')
local mission = asset.localResource('osirisrex.mission')
local missionName
local scriptSchedule = asset.localResource("scheduled_scripts.lua")
asset.onInitialize(function()
missionName = openspace.loadMission(mission)
openspace.scriptScheduler.loadFile(scriptSchedule)
end)
asset.onDeinitialize(function()
openspace.unloadMission(missionName)
-- openspace.scriptScheduler.unloadFile
end)

View File

@@ -1,14 +0,0 @@
dofile(openspace.absPath("${SCRIPTS}/common.lua"))
return {
helper.scheduledScript.setEnabled("2016 SEP 08 23:05:00", "OsirisRexTrailSolarSystem", false),
helper.scheduledScript.setEnabled("2016 SEP 08 23:05:00", "OsirisRexTrailBennu", false),
helper.scheduledScript.reversible.setEnabled("2016 SEP 08 23:05:01", "OsirisRexTrailEarth", true),
helper.scheduledScript.reversible.setEnabled("2016 SEP 09 00:00:00", "OsirisRexTrailSolarSystem", true),
helper.scheduledScript.reversible.setEnabled("2016 SEP 09 02:00:00", "OsirisRexTrailEarth", false),
helper.scheduledScript.reversible.setEnabled("2018 OCT 11 00:00:00", "OsirisRexTrailBennu", true),
helper.scheduledScript.reversible.setEnabled("2018 OCT 15 00:00:00", "OsirisRexTrailSolarSystem", false),
helper.scheduledScript.reversible.setEnabled("2019 AUG 01 00:00:00", "OsirisRexTrailSolarSystem", true),
helper.scheduledScript.reversible.setEnabled("2019 AUG 01 00:00:00", "OsirisRexTrailBennu", false),
}

View File

@@ -0,0 +1,18 @@
local scriptSchedulerHelper = asset.require('util/script_scheduler_helper')
asset.onInitialize(function ()
scriptSchedulerHelper.scheduleRenderableEnabled("2016 SEP 08 23:05:00", "OsirisRexTrailSolarSystem", false)
scriptSchedulerHelper.scheduleRenderableEnabled("2016 SEP 08 23:05:00", "OsirisRexTrailBennu", false)
scriptSchedulerHelper.scheduleRenderableEnabledReversable("2016 SEP 08 23:05:01", "OsirisRexTrailEarth", true)
scriptSchedulerHelper.scheduleRenderableEnabledReversable("2016 SEP 09 00:00:00", "OsirisRexTrailSolarSystem", true)
scriptSchedulerHelper.scheduleRenderableEnabledReversable("2016 SEP 09 02:00:00", "OsirisRexTrailEarth", false)
scriptSchedulerHelper.scheduleRenderableEnabledReversable("2018 OCT 11 00:00:00", "OsirisRexTrailBennu", true)
scriptSchedulerHelper.scheduleRenderableEnabledReversable("2018 OCT 15 00:00:00", "OsirisRexTrailSolarSystem", false)
scriptSchedulerHelper.scheduleRenderableEnabledReversable("2019 AUG 01 00:00:00", "OsirisRexTrailSolarSystem", true)
scriptSchedulerHelper.scheduleRenderableEnabledReversable("2019 AUG 01 00:00:00", "OsirisRexTrailBennu", false)
end)
asset.onDeinitialize(function ()
openspace.scriptScheduler.clear()
end)

View File

@@ -16,6 +16,7 @@ local Earth = {
Type = "RenderableGlobe",
Radii = earthEllipsoid,
SegmentsPerPatch = 64,
PerformShading = false,
Layers = {
ColorLayers = {
{
@@ -145,20 +146,10 @@ local Earth = {
Name = "Earth at Night 2012",
FilePath = mapServiceConfigsPath .. "/GIBS/night/VIIRS_CityLights_2012.wms",
Enabled = true,
Settings = {
Opacity = 1.0,
Gamma = 1.5,
Multiplier = 15.0
},
Fallback = {
Name = "Earth Night",
FilePath = texturesPath .. "/earth_night.jpg",
Enabled = true,
Settings = {
Opacity = 1.0,
Gamma = 1.5,
Multiplier = 15.0
},
Enabled = true,
}
},
{

View File

@@ -93,7 +93,6 @@ local requestAll = function (asset, directory)
return End=='' or string.sub(String,-string.len(End))==End
end
-- directory = asset.localResource('') .. directory
local files = openspace.walkDirectoryFiles(asset.localResource('') .. directory, true)
for _, file in pairs(files) do
if file:ends('.asset') then

View File

@@ -1,23 +1,24 @@
local helper = asset.require('./scene_helper')
local sceneHelper = asset.require('./scene_helper')
local propertyHelper = asset.require('./property_helper')
local Keybindings = {
{
Key = "F2",
Command =
[[local b = openspace.getPropertyValue('Global Properties.ImGUI.Main.Properties.Enabled');
local c = openspace.getPropertyValue('Global Properties.ImGUI.Main.IsHidden');
openspace.setPropertyValue('Global Properties.ImGUI.*.Enabled', false);
[[local b = openspace.getPropertyValue('Modules.ImGUI.Main.Scene Properties.Enabled');
local c = openspace.getPropertyValue('Modules.ImGUI.Main.IsHidden');
openspace.setPropertyValue('Modules.ImGUI.*.Enabled', false);
if b and c then
-- This can happen if the main properties window is enabled, the main gui is enabled
-- and then closed again. So the main properties window is enabled, but also all
-- windows are hidden
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.IsHidden', false);
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Properties.Enabled', true);
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Space/Time.Enabled', true);
openspace.setPropertyValueSingle('Modules.ImGUI.Main.IsHidden', false);
openspace.setPropertyValueSingle('Modules.ImGUI.Main.Scene Properties.Enabled', true);
openspace.setPropertyValueSingle('Modules.ImGUI.Main.Space/Time.Enabled', true);
else
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Properties.Enabled', not b);
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Space/Time.Enabled', not b);
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.IsHidden', b);
openspace.setPropertyValueSingle('Modules.ImGUI.Main.Scene Properties.Enabled', not b);
openspace.setPropertyValueSingle('Modules.ImGUI.Main.Space/Time.Enabled', not b);
openspace.setPropertyValueSingle('Modules.ImGUI.Main.IsHidden', b);
end]],
Documentation = "Shows or hides the properties window",
Local = true
@@ -25,15 +26,15 @@ end]],
{
Key = "F3",
Command =
[[local b = openspace.getPropertyValue('Global Properties.ImGUI.Main.Enabled');
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.Enabled', not b);
openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.IsHidden', b);]],
[[local b = openspace.getPropertyValue('Modules.ImGUI.Main.Enabled');
openspace.setPropertyValueSingle('Modules.ImGUI.Main.Enabled', not b);
openspace.setPropertyValueSingle('Modules.ImGUI.Main.IsHidden', b);]],
Documentation = "Shows or hides the entire user interface",
Local = true
},
{
Key = "F4",
Command = helper.property.invert("RenderEngine.PerformanceMeasurements"),
Command = propertyHelper.invert("RenderEngine.PerformanceMeasurements"),
Documentation = "Toogles performance measurements that shows rendering time informations.",
Local = true
},
@@ -57,19 +58,19 @@ openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.IsHidden', b);]],
},
{
Key = "f",
Command = helper.property.invert('NavigationHandler.OrbitalNavigator.Friction.RotationalFriction'),
Command = propertyHelper.invert('NavigationHandler.OrbitalNavigator.Friction.RotationalFriction'),
Documentation = "Toggles the rotational friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely.",
Local = false
},
{
Key = "Shift+f",
Command = helper.property.invert('NavigationHandler.OrbitalNavigator.Friction.ZoomFriction'),
Command = propertyHelper.invert('NavigationHandler.OrbitalNavigator.Friction.ZoomFriction'),
Documentation = "Toggles the zoom friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely.",
Local = false
},
{
Key = "Ctrl+f",
Command = helper.property.invert('NavigationHandler.OrbitalNavigator.Friction.RollFriction'),
Command = propertyHelper.invert('NavigationHandler.OrbitalNavigator.Friction.RollFriction'),
Documentation = "Toggles the roll friction of the camera. If it is disabled, the camera rolls around its own axis indefinitely.",
Local = false
},
@@ -84,9 +85,9 @@ openspace.setPropertyValueSingle('Global Properties.ImGUI.Main.IsHidden', b);]],
local DeltaTimeKeys
asset.onInitialize(function()
Keys = helper.bindKeys(Keybindings)
Keys = sceneHelper.bindKeys(Keybindings)
DeltaTimeKeys = helper.setDeltaTimeKeys({
DeltaTimeKeys = sceneHelper.setDeltaTimeKeys({
-- 1 2 3 4 5 6 7 8 9 0
--------------------------------------------------------------------------------------------------------------------------
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
@@ -102,8 +103,8 @@ asset.onInitialize(function()
end)
asset.onDeinitialize(function ()
helper.unbindKeys(Keybindings)
helper.unbindKeys(DeltaTimeKeys)
sceneHelper.unbindKeys(Keybindings)
sceneHelper.unbindKeys(DeltaTimeKeys)
end)
asset.export("DefaultKeybindings", Keybindings)

View File

@@ -0,0 +1,21 @@
-- Function that returns the string that inverts the fully qualified boolean property 'property'
local invert = function(prop)
local escaped_property = "'" .. prop .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", not openspace.getPropertyValue(" .. escaped_property .. "));"
end
-- Function that returns the string that increments the 'property' by the 'value'
local increment = function(prop, value)
local v = value or 1
local escaped_property = "'" .. prop .. "'"
return "openspace.setPropertyValue(" .. escaped_property .. ", openspace.getPropertyValue(" .. escaped_property .. ") + " .. v .. ");"
end
-- Function that returns the string that decrements the 'property' by the 'value'
local decrement = function(prop, value)
return increment(prop, -value)
end
asset.export('invert', invert)
asset.export('increment', increment)
asset.export('decrement', decrement)

View File

@@ -0,0 +1,15 @@
local propertyHelper = asset.require('./property_helper')
-- Function that returns the string that enables/disables the renderable 'renderable'
local toggle = function(renderable)
return propertyHelper.invert(renderable .. ".renderable.Enabled")
end
-- Function that returns the string that sets the enabled property of <renderable> to <enabled>
local setEnabled = function(renderable, enabled)
return "openspace.setPropertyValue('" .. renderable .. ".renderable.Enabled', " .. (enabled and "true" or "false") .. ");";
end
asset.export('toggle', toggle)
asset.export('setEnabled', setEnabled)

View File

@@ -52,11 +52,3 @@ local setDeltaTimeKeys = function(t)
return result
end
asset.export("setDeltaTimeKeys", setDeltaTimeKeys)
-----------------------------------------------------------------
dofile(openspace.absPath("${SCRIPTS}/common.lua"))
asset.export("property", helper.property)
asset.export("renderable", helper.renderable)
asset.export("scheduledScript", helper.scheduledScript)

View File

@@ -0,0 +1,24 @@
local renderableHelper = asset.require('./renderable_helper')
-- Function that schedules scripts setting the enabled property
-- of <renderable> to <enabled> at time <time>.
local scheduleRenderableEnabled = function(time, renderable, enabled)
openspace.scriptScheduler.loadScheduledScript(
time,
renderableHelper.setEnabled(renderable, enabled)
)
end
-- Function that schedules scripts setting the enabled property
-- of <renderable> to <enabled> when time <time> is passed
-- and inverts it if time is passed in reversed order.
local scheduleRenderableEnabledReversable = function(time, renderable, enabled)
openspace.scriptScheduler.loadScheduledScript(
time,
renderableHelper.setEnabled(renderable, enabled),
renderableHelper.setEnabled(renderable, not enabled)
)
end
asset.export('scheduleRenderableEnabledReversable', scheduleRenderableEnabledReversable)
asset.export('scheduleRenderableEnabled', scheduleRenderableEnabled)

4
data/web/common/base.js Normal file
View File

@@ -0,0 +1,4 @@
function parseJson(elementId) {
var jsonElement = document.getElementById(elementId);
return JSON.parse(jsonElement.innerHTML);
}

View File

@@ -8,25 +8,40 @@
.documentation-item {
background-color: #f4f4f4;
border-left: 2px solid #888;
border-left: 6px solid;
padding-left: 10px;
padding-top: 5px;
padding-right: 5px;
margin-bottom: 5px;
}
.documentation-item .documentation-item {
border-left: 2px solid #f00;
background-color: #fff;
}
.documentation-item .documentation-item .documentation-item {
border-left: 2px solid #080;
.item-level-1 {
border-color: #343C47;
background-color: #f4f4f4;
}
.documentation-item .documentation-item .documentation-item .documentation-item {
border-left: 2px solid #00f;
.item-level-2 {
border-color: #505760;
background-color: #fff;
}
.item-level-3 {
border-color: #5E6C7C;
background-color: #f4f4f4;
}
.item-level-4 {
border-color: #537399;
background-color: #fff;
}
.item-level-5 {
border-color: #2569BA;
background-color: #f4f4f4;
}
.item-level-6 {
border-color: #208AE2;
background-color: #fff;
}
@@ -69,16 +84,15 @@
font-size: 0.8em;
}
/*!
* Start Bootstrap - Simple Sidebar (http://startbootstrap.com/)
* Copyright 2013-2016 Start Bootstrap
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE)
*/
body {
overflow-x: hidden;
}
body {
overflow-x: hidden;
}
/* Toggle Styles */

View File

@@ -1,5 +1,5 @@
{{#each entries}}
<div class="documentation-item">
<div class="documentation-item item-level-{{level name}}">
<div class="row">
<div class="col-lg-12">
<p>

View File

@@ -18,6 +18,19 @@ window.onload = function () {
return identifier;
});
Handlebars.registerHelper('level', function(options, context) {
var data = context.data;
var level = 0;
while (data = data._parent) {
if (data.key !== undefined) {
++level;
}
}
return level;
});
documentation.sort(function (a, b) {
return a.name < b.name ? -1 : (a.name > b.name ? 1 : 0);
});

View File

@@ -1,5 +1,5 @@
{{#each classes}}
<div class="documentation-item">
<div class="documentation-item item-level-{{level name}}">
<div class="row">
<div class="col-lg-12">
<p>

View File

@@ -18,6 +18,19 @@ window.onload = function () {
return identifier;
});
Handlebars.registerHelper('level', function(options, context) {
var data = context.data;
var level = 0;
while (data = data._parent) {
if (data.key !== undefined) {
++level;
}
}
return level;
});
factories.sort(function (a, b) {
return a.name < b.name ? -1 : (a.name > b.name ? 1 : 0);
});

View File

@@ -15,6 +15,19 @@ window.onload = function () {
return identifier;
});
Handlebars.registerHelper('level', function(options, context) {
var data = context.data;
var level = 0;
while (data = data._parent) {
if (data.key !== undefined) {
++level;
}
}
return level;
});
var dataElement = document.getElementById('data');
var data = JSON.parse(dataElement.innerHTML);

View File

@@ -1,11 +1,11 @@
<div class="documentation-item {{#if remoteScripting}}remote-scripting{{else}}local-scripting{{/if}}">
<div class="documentation-item item-level-{{level name}} {{#if remoteScripting}}remote-scripting{{else}}local-scripting{{/if}}">
<div class="row">
<div class="col-lg-12">
<p>
<a href="#{{urlify key}}" name="{{urlify key}}">
<span class="documentation-key">{{key}}</span> <span class="documentation-type">{{#if remoteScripting}}Remote scripting{{else}}Local scripting{{/if}}</span>
</a>
<p>{{script}}</p>
<p><code>{{script}}</code></p>
<p>{{documentation}}</p>
</p>
</div>

View File

@@ -18,6 +18,19 @@ window.onload = function () {
return identifier;
});
Handlebars.registerHelper('level', function(options, context) {
var data = context.data;
var level = 0;
while (data = data._parent) {
if (data.key !== undefined) {
++level;
}
}
return level;
});
keybindings.sort(function (a, b) {
return a.key < b.key ? -1 : (a.key > b.key ? 1 : 0);
});

View File

@@ -18,6 +18,19 @@ window.onload = function () {
return identifier;
});
Handlebars.registerHelper('level', function(options, context) {
var data = context.data;
var level = 0;
while (data = data._parent) {
if (data.key !== undefined) {
++level;
}
}
return level;
});
scripting.sort(function (a, b) {
return a.library < b.library ? -1 : (a.library > b.library ? 1 : 0);
});

View File

@@ -1,5 +1,5 @@
{{#each functions}}
<div class="documentation-item">
<div class="documentation-item item-level-{{level name}}">
<div class="row">
<div class="col-lg-12">
<p>

View File

@@ -3,7 +3,7 @@
<ul class="sidebar-nav">
<li class="sidebar-brand">
<a href="#">
OpenSpace Scene Properties
OpenSpace Properties
</a>
</li>
{{#each propertyOwners}}
@@ -28,8 +28,6 @@
{{/each}}
{{#each propertyOwners}}
{{> propertyOwner}}
{{else}}
<p>{{name}} has no property owners</p>
{{/each}}
</div>
</div>

View File

@@ -1,4 +1,4 @@
<div class="documentation-item">
<div class="documentation-item item-level-{{level name}}">
<div class="row">
<div class="col-lg-12" title="{{guiName}}">
<p>
@@ -7,7 +7,8 @@
<span class="documentation-key">{{id}}</span>
</a>
</p>
<p class="documentation-description">{{fullyQualifiedId}}
<p class="documentation-description">
<code>{{fullyQualifiedId}}</code>
<a class="documentation-small" onclick="copyTextToClipboard('{{fullyQualifiedId}}')">copy</a>
</p>
<p class="documentation-documentation">{{description}}</p>

View File

@@ -1,4 +1,4 @@
<div class="documentation-item">
<div class="documentation-item item-level-{{level name}}">
<div class="row">
<div class="col-lg-12">
<p>

View File

@@ -46,6 +46,19 @@ window.onload = function () {
return identifier;
});
Handlebars.registerHelper('level', function(options, context) {
var data = context.data;
var level = 0;
while (data = data._parent) {
if (data.key !== undefined) {
++level;
}
}
return level;
});
propertyOwners.sort(function (a, b) {
return a.name < b.name ? -1 : (a.name > b.name ? 1 : 0);
});

View File

@@ -18,6 +18,19 @@ window.onload = function () {
return identifier;
});
Handlebars.registerHelper('level', function(options, context) {
var data = context.data;
var level = 0;
while (data = data._parent) {
if (data.key !== undefined) {
++level;
}
}
return level;
});
var data = {
sceneLicenses: sceneLicenses,
version: version

View File

@@ -42,135 +42,196 @@ namespace documentation { struct Documentation; }
class ConfigurationManager : public ghoul::Dictionary {
public:
/// The key that stores the subdirectory containing all predefined path tokens
static const std::string KeyPaths;
static constexpr const char* KeyPaths = "Paths";
/// The key that stores the location to the cache directory used to store all the
/// permanent and non-permanent cached files
static const std::string KeyCache;
static constexpr const char* KeyCachePath = "Paths.CACHE";
/// The key that stores the main directory for fonts
static const std::string KeyFonts;
static constexpr const char* KeyFonts = "Fonts";
/// The key that stores the location of the SGCT configuration file that is used on
/// application launch
static const std::string KeyConfigSgct;
static constexpr const char* KeyConfigSgct = "SGCTConfig";
/// The key that defines a list of scripts for global customization that get executed
/// regardless of which scene is loaded
static const std::string KeyGlobalCustomizationScripts;
static constexpr const char* KeyGlobalCustomizationScripts =
"GlobalCustomizationScripts";
/// The part of the key that defines the type
static const std::string PartType;
// static constexpr const char* PartType = "Type";
/// The part of the key that defines the file
static const std::string PartFile;
// static constexpr const char* PartFile = "File";
/// The key that stores the Lua documentation
static const std::string KeyLuaDocumentation;
static constexpr const char* KeyLuaDocumentation = "LuaDocumentation";
/// The key that stores the scripting log
static const std::string KeyScriptLog;
/// The key that stores the Property documentation
static const std::string KeyPropertyDocumentation;
static constexpr const char* KeyScriptLog = "ScriptLog";
/// The key that stores the Scene Property documentation
static constexpr const char* KeyScenePropertyDocumentation =
"ScenePropertyDocumentation";
/// The key that stores the Root Property documentation
static constexpr const char* KeyPropertyDocumentation = "PropertyDocumentation";
/// The key that stores the keyboard bindings that should be stored
static const std::string KeyKeyboardShortcuts;
static constexpr const char* KeyKeyboardShortcuts = "KeyboardShortcuts";
/// The key that stores the main documentation
static const std::string KeyDocumentation;
static constexpr const char* KeyDocumentation = "Documentation";
/// The key that stores the factory documentation values
static const std::string KeyFactoryDocumentation;
static constexpr const char* KeyFactoryDocumentation = "FactoryDocumentation";
/// The key that stores the location of the asset file that is initially loaded
static const std::string KeyConfigAsset;
static constexpr const char* KeyConfigAsset = "Asset";
/// The key that stores the scene license documentation values
static const std::string KeySceneLicenseDocumentation;
/// The key that stores the subdirectory containing a list of all startup scripts to
/// be executed on application start before the scene file is loaded
static const std::string KeyStartupScript;
/// The key that stores the subdirectory containing a list of all settings scripts to
/// be executed on application start and after the scene file is loaded
static const std::string KeySettingsScript;
static constexpr const char* KeySceneLicenseDocumentation = "LicenseDocumentation";
/// The key that stores the settings for determining log-related settings
static const std::string KeyLogging;
static constexpr const char* KeyLogging = "Logging";
/// The key that stores the directory for Logging
static const std::string PartLogDir;
static constexpr const char* LoggingDirectory = "Logging.LogDir";
static constexpr const char* PartLogDir = "LogDir";
/// The key that stores the desired LogLevel for the whole application
/// \sa ghoul::logging::LogManager
static const std::string PartLogLevel;
static constexpr const char* KeyLoggingLogLevel = "Logging.LogLevel";
static constexpr const char* PartLogLevel = "LogLevel";
/// The key that stores whether the log should be immediately flushed after a n
/// \sa ghoul::logging::LogManager
static const std::string PartImmediateFlush;
static constexpr const char* KeyLoggingImmediateFlush = "Logging.ImmediateFlush";
static constexpr const char* PartImmediateFlush = "ImmediateFlush";
/// The key for prefixing PerformanceMeasurement logfiles
static const std::string PartLogPerformancePrefix;
static constexpr const char* LoggingPerformancePrefix = "Logging.PerformancePrefix";
static constexpr const char* PartLogPerformancePrefix = "PerformancePrefix";
/// The key that stores a subdirectory with a description for additional
/// ghoul::logging::Log%s to be created
/// \sa LogFactory
static const std::string PartLogs;
static constexpr const char* KeyLoggingLogs = "Logging.Logs";
static constexpr const char* PartLogs = "Logs";
/// The key that stores whether a log should be appended to or should be overwritten
static const std::string PartAppend;
static constexpr const char* PartAppend = "Append";
/// The key that stores the verbosity (None, Minimal, Default, Full) of the system
/// capabilities components
static const std::string PartCapabilitiesVerbosity;
static constexpr const char* PartCapabilitiesVerbosity = "CapabilitiesVerbosity";
/// The key that stores the settings for determining Launcher-related settings
static const std::string KeyLauncher;
static constexpr const char* KeyLauncher = "Launcher";
/// The full key that stores the verbosity of the system capabilities component
static const std::string KeyCapabilitiesVerbosity;
static constexpr const char* KeyCapabilitiesVerbosity =
"Logging.CapabilitiesVerbosity";
/// The key that stores the time (in seconds) that the application will wait before
/// shutting down after the shutdown call is made
static const std::string KeyShutdownCountdown;
static constexpr const char* KeyShutdownCountdown = "ShutdownCountdown";
/// The key that stores whether the onscreen text should be scaled to the window size
/// or the window resolution
static const std::string KeyOnScreenTextScaling;
static constexpr const char* KeyOnScreenTextScaling = "OnScreenTextScaling";
/// The key that stores whether the master node should perform rendering just function
/// as a pure manager
static const std::string KeyDisableMasterRendering;
static constexpr const char* KeyDisableMasterRendering = "DisableRenderingOnMaster";
/// The key that stores whether the master node should apply the scene transformation
static const std::string KeyDisableSceneOnMaster;
static constexpr const char* KeyDisableSceneOnMaster = "DisableSceneOnMaster";
/// The key that stores the switch for enabling/disabling the rendering on a master
/// computer
static const std::string KeyRenderingMethod;
static constexpr const char* KeyRenderingMethod = "RenderingMethod";
/// The key that determines whether a new cache folder is used for each scene file
static const std::string KeyPerSceneCache;
static constexpr const char* KeyPerSceneCache = "PerSceneCache";
/// The key that stores the http proxy settings for the downloadmanager
static const std::string KeyHttpProxy;
static constexpr const char* KeyHttpProxy = "HttpProxy";
/// The key that stores the address of the http proxy
static const std::string PartHttpProxyAddress;
static constexpr const char* PartHttpProxyAddress = "Address";
/// The key that stores the port of the http proxy
static const std::string PartHttpProxyPort;
static constexpr const char* PartHttpProxyPort = "Port";
/// The key that stores the authentication method of the http proxy
static const std::string PartHttpProxyAuthentication;
static constexpr const char* PartHttpProxyAuthentication = "Authentication";
/// Key that stores the username to use for authentication to access the http proxy
static const std::string PartHttpProxyUser;
static constexpr const char* PartHttpProxyUser = "User";
/// Key that stores the password to use for authentication to access the http proxy
static const std::string PartHttpProxyPassword;
static constexpr const char* PartHttpProxyPassword = "Password";
/// The key that stores the dictionary containing information about debug contexts
static const std::string KeyOpenGLDebugContext;
static constexpr const char* KeyOpenGLDebugContext = "OpenGLDebugContext";
/// The part of the key storing whether an OpenGL Debug context should be created
static const std::string PartActivate;
static constexpr const char* PartActivate = "Activate";
/// The part of the key storing whether the debug callbacks are performed synchronous
static const std::string PartSynchronous;
static constexpr const char* PartSynchronous = "Synchronous";
/// The part of the key storing a list of identifiers that should be filtered out
static const std::string PartFilterIdentifier;
static constexpr const char* PartFilterIdentifier = "FilterIdentifier";
/// The part of the key that stores the source of the ignored identifier
static const std::string PartFilterIdentifierSource;
static constexpr const char* PartFilterIdentifierSource = "Source";
/// The part of the key that stores the type of the ignored identifier
static const std::string PartFilterIdentifierType;
static constexpr const char* PartFilterIdentifierType = "Type";
/// The part of the key that stores the identifier of the ignored identifier
static const std::string PartFilterIdentifierIdentifier;
static constexpr const char* PartFilterIdentifierIdentifier = "Identifier";
/// The part of the key storing a list of severities that should be filtered out
static const std::string PartFilterSeverity;
static constexpr const char* PartFilterSeverity = "PartFilterSeverity";
/// The part of the key storing whether the OpenGL state should be checked each call
static const std::string KeyCheckOpenGLState;
static constexpr const char* KeyCheckOpenGLState = "CheckOpenGLState";
/// The part of the key storing whether each OpenGL call should be logged
static const std::string KeyLogEachOpenGLCall;
static constexpr const char* KeyLogEachOpenGLCall = "LogEachOpenGLCall";
/// This key determines whether the scene graph nodes should initialized multithreaded
static const std::string KeyUseMultithreadedInitialization;
static constexpr const char* KeyUseMultithreadedInitialization =
"UseMultithreadedInitialization";
/// The key under which all of the loading settings are grouped
static const std::string KeyLoadingScreen;
static constexpr const char* KeyLoadingScreen = "LoadingScreen";
/// The part of the key storing whether the loading screen should display the message
/// about current status
static const std::string PartShowMessage;
static constexpr const char* KeyLoadingScreenShowMessage =
"LoadingScreen.ShowMessage";
static constexpr const char* PartShowMessage = "ShowMessage";
/// The part of the key storing whether the loading screen should display node names
static const std::string PartShowNodeNames;
static constexpr const char* KeyLoadingScreenShowNodeNames =
"LoadingScreen.ShowNodeNames";
static constexpr const char* PartShowNodeNames = "ShowNodeNames";
/// The part of the key storing whether the loading screen should contain a progress
/// bar
static const std::string PartShowProgressbar;
static constexpr const char* KeyLoadingScreenShowProgressbar =
"LoadingScreen.ShowProgressbar";
static constexpr const char* PartShowProgressbar = "ShowProgressbar";
/// The key used to specify module specific configurations
static const std::string KeyModuleConfigurations;
static constexpr const char* KeyModuleConfigurations = "ModuleConfigurations";
/// The key used to specify whether screenshots should contain the current date
static const std::string KeyScreenshotUseDate;
static constexpr const char* KeyScreenshotUseDate = "ScreenshotUseDate";
/**
@@ -200,6 +261,7 @@ public:
*/
void loadFromFile(const std::string& filename);
static documentation::Documentation Documentation();
};

View File

@@ -28,6 +28,7 @@
#include <memory>
#include <vector>
#include <openspace/properties/propertyowner.h>
#include <openspace/util/openspacemodule.h>
#include <ghoul/misc/assert.h>
@@ -47,8 +48,10 @@ namespace scripting { struct LuaLibrary; }
* Additional OpenSpaceModule%s can be registered with the #registerModule function, which
* will internally call the OpenSpaceModule::initialize method.
*/
class ModuleEngine {
class ModuleEngine : public properties::PropertyOwner {
public:
ModuleEngine();
/**
* Registers all of the OpenSpaceModule%s which are created by the CMake configuration
* and stored in the <code>moduleregistration.h</code> file. For all of those modules

View File

@@ -55,7 +55,6 @@ class ParallelConnection;
class RenderEngine;
class Scene;
class SyncEngine;
class SettingsEngine;
class TimeManager;
class VirtualPropertyManager;
class WindowWrapper;
@@ -131,12 +130,12 @@ public:
NetworkEngine& networkEngine();
ParallelConnection& parallelConnection();
RenderEngine& renderEngine();
SettingsEngine& settingsEngine();
TimeManager& timeManager();
WindowWrapper& windowWrapper();
ghoul::fontrendering::FontManager& fontManager();
interaction::NavigationHandler& navigationHandler();
interaction::KeyBindingManager& keyBindingManager();
properties::PropertyOwner& rootPropertyOwner();
properties::PropertyOwner& globalPropertyOwner();
scripting::ScriptEngine& scriptEngine();
scripting::ScriptScheduler& scriptScheduler();
@@ -215,7 +214,6 @@ private:
std::unique_ptr<NetworkEngine> _networkEngine;
std::unique_ptr<ParallelConnection> _parallelConnection;
std::unique_ptr<RenderEngine> _renderEngine;
std::unique_ptr<SettingsEngine> _settingsEngine;
std::unique_ptr<SyncEngine> _syncEngine;
std::unique_ptr<TimeManager> _timeManager;
std::unique_ptr<WindowWrapper> _windowWrapper;
@@ -229,7 +227,8 @@ private:
std::unique_ptr<VirtualPropertyManager> _virtualPropertyManager;
// Others
std::unique_ptr<properties::PropertyOwner> _globalPropertyNamespace;
std::unique_ptr<properties::PropertyOwner> _rootPropertyOwner;
std::unique_ptr<properties::PropertyOwner> _globalPropertyOwner;
std::unique_ptr<LoadingScreen> _loadingScreen;

View File

@@ -1,54 +0,0 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE___SETTINGSENGINE___H__
#define __OPENSPACE_CORE___SETTINGSENGINE___H__
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <vector>
namespace openspace {
class OpenSpaceModule;
class SettingsEngine : public properties::PropertyOwner {
public:
SettingsEngine();
void initialize();
void setModules(const std::vector<OpenSpaceModule*>& modules);
private:
properties::OptionProperty _scenes;
};
} // namespace openspace
#endif // __OPENSPACE_CORE___SETTINGSENGINE___H__

View File

@@ -64,6 +64,15 @@ public:
using TemplateProperty<T>::operator=;
void setInterpolationTarget(ghoul::any value) override;
void setLuaInterpolationTarget(lua_State* state) override;
void setStringInterpolationTarget(std::string value) override;
void interpolateValue(float t,
ghoul::EasingFunc<float> easingFunc = nullptr) override;
protected:
static const std::string MinimumValueKey;
static const std::string MaximumValueKey;
@@ -76,6 +85,9 @@ protected:
T _maximumValue;
T _stepping;
float _exponent;
T _interpolationStart;
T _interpolationEnd;
};
} // namespace openspace::properties

View File

@@ -395,4 +395,62 @@ std::string NumericalProperty<T>::generateAdditionalDescription() const {
return result;
}
template <typename T>
void NumericalProperty<T>::setInterpolationTarget(ghoul::any value) {
try {
T v = ghoul::any_cast<T>(std::move(value));
_interpolationStart = TemplateProperty<T>::_value;
_interpolationEnd = std::move(v);
}
catch (ghoul::bad_any_cast&) {
LERRORC(
"TemplateProperty",
fmt::format(
"Illegal cast from '{}' to '{}'",
value.type().name(),
typeid(T).name()
)
);
}
}
template <typename T>
void NumericalProperty<T>::setLuaInterpolationTarget(lua_State* state) {
bool success = false;
T thisValue = PropertyDelegate<NumericalProperty<T>>::template fromLuaValue<T>(
state,
success
);
if (success) {
_interpolationStart = TemplateProperty<T>::_value;
_interpolationEnd = std::move(thisValue);
}
}
template <typename T>
void NumericalProperty<T>::setStringInterpolationTarget(std::string value) {
bool success = false;
T thisValue = PropertyDelegate<NumericalProperty<T>>::template fromString<T>(
value,
success
);
if (success) {
_interpolationStart = TemplateProperty<T>::_value;
_interpolationEnd = std::move(thisValue);
}
}
template <typename T>
void NumericalProperty<T>::interpolateValue(float t,
ghoul::EasingFunc<float> easingFunction)
{
if (easingFunction) {
t = easingFunction(t);
}
TemplateProperty<T>::setValue(static_cast<T>(
glm::mix(_interpolationStart, _interpolationEnd, t)
));
}
} // namespace openspace::properties

View File

@@ -28,6 +28,7 @@
#include <openspace/properties/propertydelegate.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/misc/easing.h>
#include <functional>
#include <string>
@@ -364,6 +365,15 @@ public:
*/
const ghoul::Dictionary& metaData() const;
/// Interpolation methods
virtual void setInterpolationTarget(ghoul::any value);
virtual void setLuaInterpolationTarget(lua_State* state);
virtual void setStringInterpolationTarget(std::string value);
virtual void interpolateValue(float t,
ghoul::EasingFunc<float> easingFunction = nullptr);
protected:
static const char* IdentifierKey;
static const char* NameKey;

View File

@@ -25,6 +25,8 @@
#ifndef __OPENSPACE_CORE___PROPERTYOWNER___H__
#define __OPENSPACE_CORE___PROPERTYOWNER___H__
#include <openspace/documentation/documentationgenerator.h>
#include <map>
#include <string>
#include <vector>
@@ -47,7 +49,7 @@ class Property;
* URI contains separators (<code>.</code>), the first name before the separator will be
* used as a subOwner's name and the search will proceed recursively.
*/
class PropertyOwner {
class PropertyOwner : public DocumentationGenerator {
public:
/// The separator that is used while accessing the properties and/or sub-owners
static const char URISeparator = '.';
@@ -238,6 +240,8 @@ public:
void removeTag(const std::string& tag);
private:
std::string generateJson() const override;
/// The name of this PropertyOwner
std::string _name;
/// The description for this PropertyOwner

View File

@@ -23,6 +23,7 @@
****************************************************************************************/
#include <ghoul/logging/logmanager.h>
#include <ghoul/fmt.h>
namespace openspace::properties {
@@ -202,8 +203,14 @@ void TemplateProperty<T>::set(ghoul::any value) {
}
}
catch (ghoul::bad_any_cast&) {
LERRORC("TemplateProperty", "Illegal cast from '" << value.type().name()
<< "' to '" << typeid(T).name() << "'");
LERRORC(
"TemplateProperty",
fmt::format(
"Illegal cast from '{}' to '{}'",
value.type().name(),
typeid(T).name()
)
);
}
}

View File

@@ -27,10 +27,9 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/rendering/dashboarditem.h>
#include <ghoul/glm.h>
#include <memory>
#include <vector>
@@ -59,6 +58,8 @@ public:
static scripting::LuaLibrary luaLibrary();
private:
properties::BoolProperty _isEnabled;
std::vector<std::unique_ptr<DashboardItem>> _items;
};

View File

@@ -28,6 +28,7 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
namespace ghoul { class Dictionary; }
namespace ghoul::opengl {
@@ -99,6 +100,9 @@ public:
protected:
properties::BoolProperty _enabled;
properties::FloatProperty _opacity;
void registerUpdateRenderBinFromOpacity();
private:
RenderBin _renderBin;

View File

@@ -25,21 +25,21 @@
#ifndef __OPENSPACE_CORE___SCENE___H__
#define __OPENSPACE_CORE___SCENE___H__
#include <openspace/documentation/documentationgenerator.h>
#include <openspace/properties/propertyowner.h>
#include <vector>
#include <unordered_map>
#include <set>
#include <mutex>
#include <openspace/scene/scenegraphnode.h>
#include <openspace/scene/sceneinitializer.h>
#include <openspace/scene/scenegraphnode.h>
#include <openspace/scene/scenelicense.h>
#include <openspace/scene/scenelicensewriter.h>
#include <openspace/scripting/scriptengine.h>
#include <openspace/util/camera.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/misc/easing.h>
#include <ghoul/opengl/programobject.h>
namespace ghoul { class Dictionary; }
@@ -50,9 +50,10 @@ namespace documentation { struct Documentation; }
// Notifications:
// SceneGraphFinishedLoading
class Scene : public DocumentationGenerator {
class Scene
: public properties::PropertyOwner
{
public:
using UpdateDependencies = ghoul::Boolean;
struct InvalidSceneError : ghoul::RuntimeError {
@@ -171,6 +172,47 @@ public:
*/
bool isInitializing() const;
/**
* Adds an interpolation request for the passed \p prop that will run for
* \p durationSeconds seconds. Every time the #updateInterpolations method is called
* the Property will be notified that it has to update itself using the stored
* interpolation values. If an interpolation record already exists for the passed
* \p prop, the previous record will be overwritten and the remaining time of the old
* interpolation is ignored.
*
* \param prop The property that should be called to update itself every frame until
* \p durationSeconds seconds have passed
* \param durationSeconds The number of seconds that the interpolation will run for
*
* \pre \p prop must not be \c nullptr
* \pre \p durationSeconds must be positive and not 0
* \post A new interpolation record exists for \p that is not expired
*/
void addInterpolation(properties::Property* prop, float durationSeconds,
ghoul::EasingFunction easingFunction = ghoul::EasingFunction::Linear);
/**
* Removes the passed \p prop from the list of Property%s that are update each time
* the #updateInterpolations method is called
*
* \param prop The Property that should not longer be updated
*
* \pre \prop must not be nullptr
* \post No interpolation record exists for \p prop
*/
void removeInterpolation(properties::Property* prop);
/**
* Informs all Property%s with active interpolations about applying a new update tick
* using the Property::interpolateValue method, passing a parameter \c t which is \c 0
* if no time has passed between the #addInterpolation method and \c 1 if an amount of
* time equal to the requested interpolation time has passed. The parameter \c t is
* updated with a resolution of 1 microsecond, which means that if this function is
* called twice within 1 microsecond, the passed parameter \c t might be the same for
* both calls
*/
void updateInterpolations();
/**
* Returns the Lua library that contains all Lua functions available to change the
* scene graph. The functions contained are
@@ -182,8 +224,6 @@ public:
static scripting::LuaLibrary luaLibrary();
private:
std::string generateJson() const override;
/**
* Update dependencies.
*/
@@ -204,6 +244,15 @@ private:
std::mutex _programUpdateLock;
std::set<ghoul::opengl::ProgramObject*> _programsToUpdate;
std::vector<std::unique_ptr<ghoul::opengl::ProgramObject>> _programs;
struct InterpolationInfo {
properties::Property* prop;
std::chrono::time_point<std::chrono::steady_clock> beginTime;
float durationSeconds;
ghoul::EasingFunc<float> easingFunction;
bool isExpired = false;
};
std::vector<InterpolationInfo> _interpolationInfos;
};
} // namespace openspace

View File

@@ -48,7 +48,7 @@ public:
private:
void updateVertices();
std::vector<float> _vertices;
bool _initialized;
// bool _initialized;
GLuint _vaoId;
GLuint _vBufferId;
glm::vec3 _size;

View File

@@ -229,6 +229,8 @@ public:
HttpFileDownload(HttpFileDownload&& d) = default;
virtual ~HttpFileDownload() = default;
const std::string& destination() const;
protected:
bool initDownload() override;
bool deinitDownload() override;

View File

@@ -331,9 +331,12 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
sourceArray.emplace_back(sourceName, sourceRadius);
}
else {
LWARNING("No Radius value expecified for Shadow Source Name "
<< sourceName << " from " << name
<< " planet.\nDisabling shadows for this planet.");
LWARNING(fmt::format(
"No Radius value expecified for Shadow Source Name '{}' from "
"'{}' planet. Disabling shadows for this planet.",
sourceName,
name
));
disableShadows = true;
break;
}
@@ -357,9 +360,12 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
casterArray.emplace_back(casterName, casterRadius);
}
else {
LWARNING("No Radius value expecified for Shadow Caster Name "
<< casterName << " from " << name
<< " planet.\nDisabling shadows for this planet.");
LWARNING(fmt::format(
"No Radius value expecified for Shadow Caster Name '{}' from "
"'{}' planet. Disabling shadows for this planet.",
casterName,
name
));
disableShadows = true;
break;
}
@@ -391,14 +397,20 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
if (success) {
if (!atmosphereDictionary.getValue(keyAtmosphereRadius, _atmosphereRadius)) {
errorReadingAtmosphereData = true;
LWARNING("No Atmosphere Radius value expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet.");
LWARNINGC(
name,
"No Atmosphere Radius value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
if (!atmosphereDictionary.getValue(keyPlanetRadius, _atmospherePlanetRadius)) {
errorReadingAtmosphereData = true;
LWARNING("No Planet Radius value expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet.");
LWARNINGC(
name,
"No Planet Radius value expecified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
if (!atmosphereDictionary.getValue(
@@ -406,10 +418,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
_planetAverageGroundReflectance))
{
errorReadingAtmosphereData = true;
LWARNING(
"No Average Atmosphere Ground Reflectance value expecified for "
"Atmosphere Effects of " << name << " planet.\nDisabling atmosphere "
"effects for this planet."
LWARNINGC(
name,
"No Average Atmosphere Ground Reflectance value specified for "
"Atmosphere Effects. Disabling atmosphere effects for this planet."
);
}
@@ -418,10 +430,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
_planetGroundRadianceEmittion))
{
errorReadingAtmosphereData = true;
LWARNING(
"No Ground Radiance Emitted percentage value expecified for Atmosphere "
"Effects of " << name << " planet.\nDisabling atmosphere effects for "
"this planet."
LWARNINGC(
name,
"No Ground Radiance Emitted percentage value specified for Atmosphere "
"Effects. Disabling atmosphere effects for this planet."
);
}
@@ -441,10 +453,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
_rayleighScatteringCoeff))
{
errorReadingAtmosphereData = true;
LWARNING(
"No Rayleigh Scattering parameters expecified for Atmosphere Effects "
"of " << name << " planet.\nDisabling atmosphere effects for this "
"planet."
LWARNINGC(
name,
"No Rayleigh Scattering parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
@@ -453,16 +465,20 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
_rayleighHeightScale))
{
errorReadingAtmosphereData = true;
LWARNING(
"No Rayleigh Height Scale value expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Rayleigh Height Scale value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
}
else {
errorReadingAtmosphereData = true;
LWARNING("No Rayleigh parameters expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet.");
LWARNINGC(
name,
"No Rayleigh parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
ghoul::Dictionary ozoneDictionary;
@@ -489,41 +505,46 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
if (success) {
if (!mieDictionary.getValue(keyMieHeightScale, _mieHeightScale)) {
errorReadingAtmosphereData = true;
LWARNING(
"No Mie Height Scale value expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Mie Height Scale value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
if (!mieDictionary.getValue("Coefficients.Scattering", _mieScatteringCoeff)) {
errorReadingAtmosphereData = true;
LWARNING(
"No Mie Scattering parameters expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Mie Scattering parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
if (!mieDictionary.getValue("Coefficients.Extinction", _mieExtinctionCoeff)) {
errorReadingAtmosphereData = true;
LWARNING(
"No Mie Extinction parameters expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Mie Extinction parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
if (!mieDictionary.getValue(keyMiePhaseConstant, _miePhaseConstant)) {
errorReadingAtmosphereData = true;
LWARNING(
"No Mie Phase Constant value expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Mie Phase Constant value specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
}
else {
errorReadingAtmosphereData = true;
LWARNING(
"No Mie parameters expecified for Atmosphere Effects of "
<< name << " planet.\nDisabling atmosphere effects for this planet."
LWARNINGC(
name,
"No Mie parameters specified for Atmosphere Effects. "
"Disabling atmosphere effects for this planet."
);
}
@@ -531,7 +552,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
success = atmosphereDictionary.getValue(keyImage, ImageDictionary);
if (success) {
if (ImageDictionary.getValue(keyToneMappingOp, _preCalculatedTexturesScale)) {
LDEBUG("Atmosphere Texture Scaled to " << _preCalculatedTexturesScale);
LDEBUG(fmt::format(
"Atmosphere Texture Scaled to {}",
_preCalculatedTexturesScale
));
}
}
@@ -539,7 +563,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
success = atmosphereDictionary.getValue(keyATMDebug, debugDictionary);
if (success) {
if (debugDictionary.getValue(keyTextureScale, _preCalculatedTexturesScale)) {
LDEBUG("Atmosphere Texture Scaled to " << _preCalculatedTexturesScale);
LDEBUG(fmt::format(
"Atmosphere Texture Scaled to {}",
_preCalculatedTexturesScale
));
}
if (debugDictionary.getValue(keySaveTextures, _saveCalculationsToTexture)) {

View File

@@ -64,8 +64,6 @@
#include <modules/base/scale/luascale.h>
#include <modules/base/scale/staticscale.h>
#include <ghoul/filesystem/filesystem>
namespace openspace {
BaseModule::BaseModule() : OpenSpaceModule(BaseModule::Name) {}

View File

@@ -33,6 +33,7 @@
#include <openspace/scene/scenegraphnode.h>
#include <openspace/util/camera.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -173,7 +174,7 @@ documentation::Documentation DashboardItemAngle::Documentation() {
}
DashboardItemAngle::DashboardItemAngle(ghoul::Dictionary dictionary)
: DashboardItem("Distance")
: DashboardItem("Angle")
, _fontName(FontNameInfo, KeyFontMono)
, _fontSize(FontSizeInfo, DefaultFontSize, 6.f, 144.f, 1.f)
, _source{

View File

@@ -29,6 +29,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/util/timemanager.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>

View File

@@ -34,6 +34,7 @@
#include <openspace/util/camera.h>
#include <openspace/util/distanceconversion.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>

View File

@@ -29,6 +29,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>

View File

@@ -31,6 +31,7 @@
#include <openspace/mission/missionmanager.h>
#include <openspace/util/timemanager.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>

View File

@@ -33,6 +33,7 @@
#include <openspace/util/camera.h>
#include <openspace/util/distanceconversion.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>

View File

@@ -30,6 +30,7 @@
#include <openspace/util/timeconversion.h>
#include <openspace/util/timemanager.h>
#include <ghoul/font/font.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -191,7 +192,7 @@ void DashboardItemSimulationIncrement::render(glm::vec2& penPosition) {
double convertedT = convertTime(t, TimeUnit::Second, unit);
deltaTime = { convertedT, nameForTimeUnit(unit, convertedT != 1.0) };
}
penPosition.y -= _font->height();
RenderFont(
*_font,

View File

@@ -29,6 +29,7 @@
#include <openspace/util/factorymanager.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/misc/invariants.h>
@@ -208,7 +209,11 @@ bool ModelGeometry::loadObj(const std::string& filename) {
const bool hasCachedFile = FileSys.fileExists(cachedFile);
if (hasCachedFile) {
LINFO("Cached file '" << cachedFile << "' used for file '" << filename << "'");
LINFO(fmt::format(
"Cached file '{}' used for file '{}",
cachedFile,
filename
));
const bool success = loadCachedFile(cachedFile);
if (success) {
@@ -221,12 +226,14 @@ bool ModelGeometry::loadObj(const std::string& filename) {
// file for the next run
}
else {
LINFO(
"Cached file '" << cachedFile << "' for file '" << filename << "' not found"
);
LINFO(fmt::format(
"Cached file '{}' for file '{}' not found",
cachedFile,
filename
));
}
LINFO("Loading Model file '" << filename << "'");
LINFO(fmt::format("Loading Model file '{}'", filename));
const bool modelSuccess = loadModel(filename);
if (!modelSuccess) {
@@ -262,7 +269,7 @@ bool ModelGeometry::saveCachedFile(const std::string& filename) {
return fileStream.good();
}
else {
LERROR("Error opening file '" << filename << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", filename));
return false;
}
}
@@ -284,7 +291,10 @@ bool ModelGeometry::loadCachedFile(const std::string& filename) {
fileStream.read(reinterpret_cast<char*>(&iSize), sizeof(int64_t));
if (vSize == 0 || iSize == 0) {
LERROR("Error opening file '" << filename << "' for loading cache file");
LERROR(fmt::format(
"Error opening file '{}' for loading cache file",
filename
));
return false;
}
@@ -300,7 +310,10 @@ bool ModelGeometry::loadCachedFile(const std::string& filename) {
return fileStream.good();
}
else {
LERROR("Error opening file '" << filename << "' for loading cache file");
LERROR(fmt::format(
"Error opening file '{}' for loading cache file",
filename
));
return false;
}
}

View File

@@ -123,6 +123,10 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary)
"RenderableModel"
);
addProperty(_opacity);
registerUpdateRenderBinFromOpacity();
if (dictionary.hasKey(KeyGeometry)) {
std::string name = dictionary.value<std::string>(SceneGraphNode::KeyName);
ghoul::Dictionary dict = dictionary.value<ghoul::Dictionary>(KeyGeometry);
@@ -163,6 +167,7 @@ void RenderableModel::initializeGL() {
absPath("${MODULE_BASE}/shaders/model_fs.glsl")
);
_uniformCache.opacity = _programObject->uniformLocation("opacity");
_uniformCache.directionToSunViewSpace = _programObject->uniformLocation(
"directionToSunViewSpace"
);
@@ -176,6 +181,8 @@ void RenderableModel::initializeGL() {
"performShading"
);
_uniformCache.texture = _programObject->uniformLocation("texture1");
loadTexture();
_geometry->initialize(this);
@@ -197,6 +204,8 @@ void RenderableModel::deinitializeGL() {
void RenderableModel::render(const RenderData& data, RendererTasks&) {
_programObject->activate();
_programObject->setUniform(_uniformCache.opacity, _opacity);
// Model transform and view transform needs to be in double precision
glm::dmat4 modelTransform =
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
@@ -244,6 +253,7 @@ void RenderableModel::update(const UpdateData&) {
if (_programObject->isDirty()) {
_programObject->rebuildFromFile();
_uniformCache.opacity = _programObject->uniformLocation("opacity");
_uniformCache.directionToSunViewSpace = _programObject->uniformLocation(
"directionToSunViewSpace"
);
@@ -273,7 +283,7 @@ void RenderableModel::loadTexture() {
if (_texture) {
LDEBUGC(
"RenderableModel",
"Loaded texture from '" << absPath(_colorTexturePath) << "'"
fmt::format("Loaded texture from '{}'", absPath(_colorTexturePath))
);
_texture->uploadTexture();
_texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap);

View File

@@ -74,8 +74,8 @@ private:
properties::Mat3Property _modelTransform;
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
UniformCache(directionToSunViewSpace, modelViewTransform, projectionTransform,
performShading, texture) _uniformCache;
UniformCache(opacity, directionToSunViewSpace, modelViewTransform,
projectionTransform, performShading, texture) _uniformCache;
std::unique_ptr<ghoul::opengl::Texture> _texture;

View File

@@ -31,7 +31,7 @@
#include <openspace/scene/scenegraphnode.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/misc/defer.h>
#include <ghoul/opengl/programobject.h>
@@ -111,6 +111,9 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
"RenderablePlane"
);
addProperty(_opacity);
registerUpdateRenderBinFromOpacity();
_size = static_cast<float>(dictionary.value<double>(SizeInfo.identifier));
if (dictionary.hasKey(BillboardInfo.identifier)) {
@@ -185,6 +188,8 @@ void RenderablePlane::deinitializeGL() {
void RenderablePlane::render(const RenderData& data, RendererTasks&) {
_shader->activate();
_shader->setUniform("opacity", _opacity);
// Model transform and view transform needs to be in double precision
const glm::dmat4 rotationTransform = _billboard ?
glm::inverse(glm::dmat4(data.camera.viewRotationMatrix())) :

View File

@@ -96,7 +96,6 @@ void RenderablePlaneImageLocal::deinitializeGL() {
RenderablePlane::deinitializeGL();
}
void RenderablePlaneImageLocal::bindTexture() {
_texture->bind();
}
@@ -118,7 +117,7 @@ void RenderablePlaneImageLocal::loadTexture() {
if (texture) {
LDEBUGC(
"RenderablePlane",
"Loaded texture from '" << absPath(_texturePath) << "'"
fmt::format("Loaded texture from '{}'", absPath(_texturePath))
);
texture->uploadTexture();

View File

@@ -62,7 +62,8 @@ documentation::Documentation RenderablePlaneImageOnline::Documentation() {
};
}
RenderablePlaneImageOnline::RenderablePlaneImageOnline(const ghoul::Dictionary& dictionary)
RenderablePlaneImageOnline::RenderablePlaneImageOnline(
const ghoul::Dictionary& dictionary)
: RenderablePlane(dictionary)
, _texturePath(TextureInfo)
, _texture(nullptr)
@@ -117,7 +118,7 @@ void RenderablePlaneImageOnline::update(const UpdateData&) {
if (imageFile.corrupted) {
LERRORC(
"ScreenSpaceImageOnline",
"Error loading image from URL '" << _texturePath << "'"
fmt::format("Error loading image from URL '{}'", _texturePath)
);
return;
}

View File

@@ -71,13 +71,6 @@ namespace {
"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."
};
static const openspace::properties::Property::PropertyInfo FadeOutThreshouldInfo = {
"FadeOutThreshould",
"Fade-Out Threshould",
@@ -131,12 +124,6 @@ documentation::Documentation RenderableSphere::Documentation() {
Optional::Yes,
OrientationInfo.description
},
{
TransparencyInfo.identifier,
new DoubleInRangeVerifier(0.0, 1.0),
Optional::Yes,
TransparencyInfo.description
},
{
FadeOutThreshouldInfo.identifier,
new DoubleInRangeVerifier(0.0, 1.0),
@@ -166,7 +153,6 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
, _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)
, _disableFadeInDistance(DisableFadeInOuInfo, true)
, _fadeOutThreshold(-1.0)
, _fadeInThreshold(0.0)
@@ -181,6 +167,9 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
"RenderableSphere"
);
addProperty(_opacity);
registerUpdateRenderBinFromOpacity();
_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));
@@ -217,21 +206,6 @@ 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(); });
@@ -252,7 +226,6 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
_disableFadeInDistance.set(false);
addProperty(_disableFadeInDistance);
}
}
bool RenderableSphere::isReady() const {
@@ -272,6 +245,11 @@ void RenderableSphere::initializeGL() {
absPath("${MODULE_BASE}/shaders/sphere_fs.glsl")
);
_uniformCache.opacity = _shader->uniformLocation("opacity");
_uniformCache.viewProjection = _shader->uniformLocation("ViewProjection");
_uniformCache.modelTransform = _shader->uniformLocation("ModelTransform");
_uniformCache.texture = _shader->uniformLocation("texture1");
loadTexture();
}
@@ -294,12 +272,12 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
_shader->activate();
_shader->setIgnoreUniformLocationError(IgnoreError::Yes);
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
_shader->setUniform("ModelTransform", transform);
_shader->setUniform(_uniformCache.viewProjection, data.camera.viewProjectionMatrix());
_shader->setUniform(_uniformCache.modelTransform, transform);
setPscUniforms(*_shader.get(), data.camera, data.position);
float adjustedTransparency = _transparency;
float adjustedTransparency = _opacity;
if (_fadeInThreshold > 0.0) {
double distCamera = glm::length(data.camera.positionVec3());
@@ -323,16 +301,16 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
}
// Performance wise
if (adjustedTransparency < 0.01) {
if (adjustedTransparency < 0.01f) {
return;
}
_shader->setUniform("alpha", adjustedTransparency);
_shader->setUniform(_uniformCache.opacity, _opacity);
ghoul::opengl::TextureUnit unit;
unit.activate();
_texture->bind();
_shader->setUniform("texture1", unit);
_shader->setUniform(_uniformCache.texture, unit);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
@@ -366,6 +344,11 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
void RenderableSphere::update(const UpdateData&) {
if (_shader->isDirty()) {
_shader->rebuildFromFile();
_uniformCache.opacity = _shader->uniformLocation("opacity");
_uniformCache.viewProjection = _shader->uniformLocation("ViewProjection");
_uniformCache.modelTransform = _shader->uniformLocation("ModelTransform");
_uniformCache.texture = _shader->uniformLocation("texture1");
}
if (_sphereIsDirty) {
@@ -386,7 +369,7 @@ void RenderableSphere::loadTexture() {
if (texture) {
LDEBUGC(
"RenderableSphere",
"Loaded texture from '" << absPath(_texturePath) << "'"
fmt::format("Loaded texture from '{}'", absPath(_texturePath))
);
texture->uploadTexture();

View File

@@ -31,6 +31,7 @@
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/scalar/intproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <ghoul/opengl/uniformcache.h>
namespace ghoul::opengl {
class ProgramObject;
@@ -68,8 +69,6 @@ private:
properties::FloatProperty _size;
properties::IntProperty _segments;
properties::FloatProperty _transparency;
properties::BoolProperty _disableFadeInDistance;
float _fadeOutThreshold;
@@ -80,6 +79,9 @@ private:
std::unique_ptr<PowerScaledSphere> _sphere;
UniformCache(opacity, viewProjection, modelTransform, texture) _uniformCache;
bool _sphereIsDirty;
};

View File

@@ -137,6 +137,9 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio
"RenderableSphericalGrid"
);
addProperty(_opacity);
registerUpdateRenderBinFromOpacity();
if (dictionary.hasKey(GridMatrixInfo.identifier)) {
_gridMatrix = dictionary.value<glm::dmat4>(GridMatrixInfo.identifier);
}
@@ -210,6 +213,8 @@ void RenderableSphericalGrid::deinitializeGL() {
void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){
_gridProgram->activate();
_gridProgram->setUniform("opacity", _opacity);
glm::dmat4 modelTransform =
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * // Translation
glm::dmat4(data.modelTransform.rotation) * // Spice rotation

View File

@@ -169,6 +169,9 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
, _renderingModes(RenderingModeInfo, properties::OptionProperty::DisplayType::Dropdown
)
{
addProperty(_opacity);
registerUpdateRenderBinFromOpacity();
_translation = Translation::createFromDictionary(
dictionary.value<ghoul::Dictionary>(KeyTranslation)
);
@@ -226,6 +229,7 @@ void RenderableTrail::initializeGL() {
absPath("${MODULE_BASE}/shaders/renderabletrail_fs.glsl")
);
_uniformCache.opacity = _programObject->uniformLocation("opacity");
_uniformCache.modelView = _programObject->uniformLocation("modelViewTransform");
_uniformCache.projection = _programObject->uniformLocation("projectionTransform");
_uniformCache.color = _programObject->uniformLocation("color");
@@ -255,6 +259,7 @@ bool RenderableTrail::isReady() const {
void RenderableTrail::render(const RenderData& data, RendererTasks&) {
_programObject->activate();
_programObject->setUniform(_uniformCache.opacity, _opacity);
glm::dmat4 modelTransform =
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *

View File

@@ -160,8 +160,8 @@ private:
/// Program object used to render the data stored in RenderInformation
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
UniformCache(modelView, projection, color, useLineFade, lineFade, vertexSorting,
idOffset, nVertices, stride, pointSize, renderPhase) _uniformCache;
UniformCache(opacity, modelView, projection, color, useLineFade, lineFade,
vertexSorting, idOffset, nVertices, stride, pointSize, renderPhase) _uniformCache;
};
} // namespace openspace

View File

@@ -213,7 +213,8 @@ void RenderableTrailOrbit::update(const UpdateData& data) {
// 3
if (!report.permanentPointsNeedUpdate) {
if (report.floatingPointNeedsUpdate) {
// If no other values have been touched, we only need to upload the floating value
// If no other values have been touched, we only need to upload the
// floating value
glBufferSubData(
GL_ARRAY_BUFFER,
_primaryRenderInformation.first * sizeof(TrailVBOLayout),

View File

@@ -94,7 +94,7 @@ int addDashboardItemToScreenSpace(lua_State* L) {
}
dash->dashboard().addDashboardItem(DashboardItem::createFromDictionary(d));
lua_settop(L, 0);
return 0;
}

View File

@@ -33,7 +33,7 @@
#include <ghoul/opengl/programobject.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/opengl/textureconversion.h>
namespace {

View File

@@ -31,9 +31,9 @@
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/opengl/programobject.h>
namespace {
constexpr const char* KeyName = "Name";
@@ -124,7 +124,7 @@ void ScreenSpaceImageOnline::update() {
if (imageFile.corrupted) {
LERRORC(
"ScreenSpaceImageOnline",
"Error loading image from URL '" << _texturePath << "'"
fmt::format("Error loading image from URL '{}'", _texturePath)
);
return;
}

View File

@@ -29,6 +29,7 @@
#include <openspace/scene/scenegraphnode.h>
#include <openspace/query/query.h>
#include <ghoul/fmt.h>
#include <ghoul/misc/assert.h>
namespace {
@@ -550,8 +551,11 @@ glm::dmat3 FixedRotation::matrix(const Time&) const {
{
LWARNINGC(
"FixedRotation",
"Dangerously collinear vectors detected: " <<
"x: " << x << " y: " << y << " z: " << z
fmt::format("Dangerously collinear vectors detected: x ({}) y ({}) z ({})",
x,
y,
z
)
);
return glm::dmat3();
}

View File

@@ -105,7 +105,7 @@ glm::dmat3 LuaRotation::matrix(const Time& time) const {
if (!isFunction) {
LERRORC(
"LuaRotation",
"Script '" << _luaScriptFile << "' does not have a function 'rotation'"
fmt::format("Script '{}' does nto have a function 'rotation'", _luaScriptFile)
);
return glm::dmat3(1.0);
}
@@ -128,7 +128,7 @@ glm::dmat3 LuaRotation::matrix(const Time& time) const {
if (success != 0) {
LERRORC(
"LuaScale",
"Error executing 'rotation': " << lua_tostring(_state, -1)
fmt::format("Error executing 'rotation': {}", lua_tostring(_state, -1))
);
}

View File

@@ -96,7 +96,7 @@ double LuaScale::scaleValue(const Time& time) const {
if (!isFunction) {
LERRORC(
"LuaScale",
"Script '" << _luaScriptFile << "' does not have a function 'scale'"
fmt::format("Script '{}' does not have a function 'scale'", _luaScriptFile)
);
return 0.0;
}
@@ -119,7 +119,7 @@ double LuaScale::scaleValue(const Time& time) const {
if (success != 0) {
LERRORC(
"LuaScale",
"Error executing 'scale': " << lua_tostring(_state, -1)
fmt::format("Error executing 'scale': {}", lua_tostring(_state, -1))
);
}

View File

@@ -29,10 +29,12 @@ in float vs_screenSpaceDepth;
in vec4 vs_positionViewSpace;
uniform vec4 gridColor;
uniform float opacity;
Fragment getFragment() {
Fragment frag;
frag.color = gridColor;
frag.color.a *= opacity;
frag.depth = vs_screenSpaceDepth;
frag.gPosition = vs_positionViewSpace;
frag.gNormal = vec4(0.0, 0.0, 0.0, 1.0);

View File

@@ -28,11 +28,11 @@ in vec2 vs_st;
in vec3 vs_normalViewSpace;
in vec4 vs_positionCameraSpace;
in float vs_screenSpaceDepth;
in vec3 vs_normalObjSpace;
uniform bool performShading = true;
uniform vec3 directionToSunViewSpace;
uniform sampler2D texture1;
uniform float opacity = 1.0;
const vec3 SpecularAlbedo = vec3(1.0);
@@ -69,10 +69,10 @@ Fragment getFragment() {
frag.color.rgb = diffuseAlbedo;
}
frag.color.a = 1.0;
frag.color.a = opacity;
frag.depth = vs_screenSpaceDepth;
frag.gPosition = vs_positionCameraSpace;
frag.gNormal = vec4(vs_normalObjSpace, 1.0);
frag.gNormal = vec4(vs_normalViewSpace, 1.0);
return frag;

View File

@@ -34,7 +34,6 @@ out vec2 vs_st;
out vec3 vs_normalViewSpace;
out float vs_screenSpaceDepth;
out vec4 vs_positionCameraSpace;
out vec3 vs_normalObjSpace;
uniform mat4 modelViewTransform;
uniform mat4 projectionTransform;

View File

@@ -31,6 +31,7 @@ in vec3 vs_gNormal;
uniform sampler2D texture1;
uniform bool additiveBlending;
uniform float opacity = 1.0;
Fragment getFragment() {
@@ -42,6 +43,7 @@ Fragment getFragment() {
frag.color = texture(texture1, vec2(1 - vs_st.s, vs_st.t));
}
frag.color.a *= opacity;
if (frag.color.a == 0.0) {
discard;
}

View File

@@ -30,6 +30,7 @@ in float fade;
uniform vec3 color;
uniform int renderPhase;
uniform float opacity = 1.0;
// Fragile! Keep in sync with RenderableTrail::render::RenderPhase
#define RenderPhaseLines 0
@@ -40,7 +41,7 @@ uniform int renderPhase;
Fragment getFragment() {
Fragment frag;
frag.color = vec4(color * fade, fade);
frag.color = vec4(color * fade, fade * opacity);
frag.depth = vs_positionScreenSpace.w;
frag.blend = BLEND_MODE_ADDITIVE;

View File

@@ -31,7 +31,7 @@ in vec4 vs_gPosition;
uniform float time;
uniform sampler2D texture1;
uniform float alpha;
uniform float opacity;
Fragment getFragment() {
@@ -42,7 +42,7 @@ Fragment getFragment() {
texCoord.t = 1 - texCoord.y;
Fragment frag;
frag.color = texture(texture1, texCoord) * vec4(1.0, 1.0, 1.0, alpha);
frag.color = texture(texture1, texCoord) * vec4(1.0, 1.0, 1.0, opacity);
frag.depth = pscDepth(position);
// G-Buffer

View File

@@ -28,6 +28,7 @@
#include <openspace/documentation/verifier.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/fmt.h>
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/lua/lua_helper.h>
#include <ghoul/filesystem/filesystem.h>
@@ -107,7 +108,10 @@ glm::dvec3 LuaTranslation::position(const Time& time) const {
if (!isFunction) {
LERRORC(
"LuaScale",
"Script '" << _luaScriptFile << "' does not have a function 'translation'"
fmt::format(
"Script '{}' does not have a function 'translation'",
_luaScriptFile
)
);
return glm::dvec3(0.0);
}
@@ -130,7 +134,10 @@ glm::dvec3 LuaTranslation::position(const Time& time) const {
if (success != 0) {
LERRORC(
"LuaScale",
"Error executing 'translation': " << lua_tostring(_state, -1)
fmt::format(
"Error executing 'translation': {}",
lua_tostring(_state, -1)
)
);
}

View File

@@ -33,7 +33,7 @@
#include <openspace/rendering/renderengine.h>
#include <modules/spacecraftinstruments/rendering/renderableplanetprojection.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>

View File

@@ -36,7 +36,7 @@
#include <modules/digitaluniverse/rendering/renderableplanescloud.h>
#include <modules/digitaluniverse/rendering/renderabledumeshes.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
namespace openspace {

View File

@@ -30,7 +30,8 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
@@ -729,7 +730,7 @@ void RenderableBillboardsCloud::renderBillboards(const RenderData& data,
"screenSize",
glm::vec2(OsEng.renderEngine().renderingResolution())
);
_program->setUniform(_uniformCache.modelViewProjection, projMatrix * modelViewMatrix);
_program->setUniform(
_uniformCache.cameraPos,
@@ -807,8 +808,6 @@ void RenderableBillboardsCloud::renderLabels(const RenderData& data,
const glm::dvec3& orthoUp,
float fadeInVariable)
{
RenderEngine& renderEngine = OsEng.renderEngine();
float scale = 0.0;
switch (_unit) {
case Meter:
@@ -993,11 +992,11 @@ void RenderableBillboardsCloud::update(const UpdateData&) {
if (_vao == 0) {
glGenVertexArrays(1, &_vao);
LDEBUG("Generating Vertex Array id '" << _vao << "'");
LDEBUG(fmt::format("Generating Vertex Array id '{}'", _vao));
}
if (_vbo == 0) {
glGenBuffers(1, &_vbo);
LDEBUG("Generating Vertex Buffer Object id '" << _vbo << "'");
LDEBUG(fmt::format("Generating Vertex Buffer Object id '{}'", _vbo));
}
glBindVertexArray(_vao);
@@ -1062,7 +1061,10 @@ void RenderableBillboardsCloud::update(const UpdateData&) {
absPath(_spriteTexturePath)
);
if (_spriteTexture) {
LINFO("Loaded texture from '" << absPath(_spriteTexturePath) << "'");
LINFO(fmt::format(
"Loaded texture from '{}'",
absPath(_spriteTexturePath)
));
_spriteTexture->uploadTexture();
}
_spriteTexture->setFilter(
@@ -1115,10 +1117,11 @@ bool RenderableBillboardsCloud::loadSpeckData() {
bool hasCachedFile = FileSys.fileExists(cachedFile);
if (hasCachedFile) {
LINFO(
"Cached file '" << cachedFile << "' used for Speck file '" <<
_file << "'"
);
LINFO(fmt::format(
"Cached file '{}' used for Speck file '{}'",
cachedFile,
_file
));
success = loadCachedFile(cachedFile);
if (success) {
@@ -1131,9 +1134,9 @@ bool RenderableBillboardsCloud::loadSpeckData() {
}
}
else {
LINFO("Cache for Speck file '" << _file << "' not found");
LINFO(fmt::format("Cache for Speck file '{}' not found", _file));
}
LINFO("Loading Speck file '" << _file << "'");
LINFO(fmt::format("Loading Speck file '{}'", _file));
success = readSpeckFile();
if (!success) {
@@ -1159,10 +1162,11 @@ bool RenderableBillboardsCloud::loadLabelData() {
}
bool hasCachedFile = FileSys.fileExists(cachedFile);
if (hasCachedFile) {
LINFO(
"Cached file '" << cachedFile << "' used for Label file '" <<
labelFile << "'"
);
LINFO(fmt::format(
"Cached file '{}' used for Label file '{}'",
cachedFile,
labelFile
));
success &= loadCachedFile(cachedFile);
if (!success) {
@@ -1172,8 +1176,8 @@ bool RenderableBillboardsCloud::loadLabelData() {
}
}
else {
LINFO("Cache for Label file '" << labelFile << "' not found");
LINFO("Loading Label file '" << labelFile << "'");
LINFO(fmt::format("Cache for Label file '{}' not found", labelFile));
LINFO(fmt::format("Loading Label file '{}'", labelFile));
success &= readLabelFile();
if (!success) {
@@ -1190,7 +1194,7 @@ bool RenderableBillboardsCloud::readSpeckFile() {
std::string _file = _speckFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Speck file '" << _file << "'");
LERROR(fmt::format("Failed to open Speck file '{}'", _file));
return false;
}
@@ -1280,7 +1284,7 @@ bool RenderableBillboardsCloud::readColorMapFile() {
std::string _file = _colorMapFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Color Map file '" << _file << "'");
LERROR(fmt::format("Failed to open Color Map file '{}'", _file));
return false;
}
@@ -1329,7 +1333,7 @@ bool RenderableBillboardsCloud::readLabelFile() {
std::string _file = _labelFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Label file '" << _file << "'");
LERROR(fmt::format("Failed to open Label file '{}'", _file));
return false;
}
@@ -1464,7 +1468,7 @@ bool RenderableBillboardsCloud::loadCachedFile(const std::string& file) {
return success;
}
else {
LERROR("Error opening file '" << file << "' for loading cache file");
LERROR(fmt::format("Error opening file '{}' for loading cache file", file));
return false;
}
}
@@ -1516,7 +1520,7 @@ bool RenderableBillboardsCloud::saveCachedFile(const std::string& file) const {
return success;
}
else {
LERROR("Error opening file '" << file << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", file));
return false;
}
}

View File

@@ -30,7 +30,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
@@ -644,7 +644,7 @@ bool RenderableDUMeshes::loadData() {
// else
// {
// LINFO("Cache for Speck file '" << _file << "' not found");
LINFO("Loading Speck file '" << _file << "'");
LINFO(fmt::format("Loading Speck file '{}'", _file));
success = readSpeckFile();
if (!success) {
@@ -679,7 +679,7 @@ bool RenderableDUMeshes::loadData() {
// }
// else {
// LINFO("Cache for Label file '" << labelFile << "' not found");
LINFO("Loading Label file '" << labelFile << "'");
LINFO(fmt::format("Loading Label file '{}'", labelFile));
success &= readLabelFile();
if (!success) {
@@ -696,7 +696,7 @@ bool RenderableDUMeshes::readSpeckFile() {
std::string _file = _speckFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Speck file '" << _file << "'");
LERROR(fmt::format("Failed to open Speck file '{}'", _file));
return false;
}
@@ -820,7 +820,7 @@ bool RenderableDUMeshes::readLabelFile() {
std::string _file = _labelFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Label file '" << _file << "'");
LERROR(fmt::format("Failed to open Label file '{}'", _file));
return false;
}
@@ -933,7 +933,7 @@ bool RenderableDUMeshes::loadCachedFile(const std::string& file) {
return success;
}
else {
LERROR("Error opening file '" << file << "' for loading cache file");
LERROR(fmt::format("Error opening file '{}' for loading cache file", file));
return false;
}
}
@@ -966,7 +966,7 @@ bool RenderableDUMeshes::saveCachedFile(const std::string& file) const {
return success;
}
else {
LERROR("Error opening file '" << file << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", file));
return false;
}
}

View File

@@ -30,7 +30,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
@@ -869,7 +869,7 @@ bool RenderablePlanesCloud::loadData() {
// else
// {
// LINFO("Cache for Speck file '" << _file << "' not found");
LINFO("Loading Speck file '" << _file << "'");
LINFO(fmt::format("Loading Speck file '{}'", _file));
success = readSpeckFile();
if (!success) {
@@ -905,7 +905,7 @@ bool RenderablePlanesCloud::loadData() {
// else
// {
// LINFO("Cache for Label file '" << labelFile << "' not found");
LINFO("Loading Label file '" << labelFile << "'");
LINFO(fmt::format("Loading Label file '{}'", labelFile));
success &= readLabelFile();
if (!success) {
@@ -928,7 +928,7 @@ bool RenderablePlanesCloud::loadTextures() {
if (p.second) {
LINFOC(
"RenderablePlanesCloud",
"Loaded texture from '" << pair.second << "'"
fmt::format("Loaded texture from '{}'", pair.second)
);
auto it = p.first;
it->second->uploadTexture();
@@ -946,7 +946,7 @@ bool RenderablePlanesCloud::readSpeckFile() {
std::string _file = _speckFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Speck file '" << _file << "'");
LERROR(fmt::format("Failed to open Speck file '{}'", _file));
return false;
}
@@ -1117,7 +1117,7 @@ bool RenderablePlanesCloud::readLabelFile() {
std::string _file = _labelFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Label file '" << _file << "'");
LERROR(fmt::format("Failed to open Label file '{}'", _file));
return false;
}
@@ -1228,7 +1228,7 @@ bool RenderablePlanesCloud::loadCachedFile(const std::string& file) {
return success;
}
else {
LERROR("Error opening file '" << file << "' for loading cache file");
LERROR(fmt::format("Error opening file '{}' for loading cache file", file));
return false;
}
}
@@ -1261,7 +1261,7 @@ bool RenderablePlanesCloud::saveCachedFile(const std::string& file) const {
return success;
}
else {
LERROR("Error opening file '" << file << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", file));
return false;
}
}

View File

@@ -30,7 +30,8 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/templatefactory.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
@@ -369,11 +370,9 @@ void RenderablePoints::update(const UpdateData&) {
if (_vao == 0) {
glGenVertexArrays(1, &_vao);
LDEBUG("Generating Vertex Array id '" << _vao << "'");
}
if (_vbo == 0) {
glGenBuffers(1, &_vbo);
LDEBUG("Generating Vertex Buffer Object id '" << _vbo << "'");
}
glBindVertexArray(_vao);
@@ -436,7 +435,10 @@ void RenderablePoints::update(const UpdateData&) {
absPath(_spriteTexturePath)
);
if (_spriteTexture) {
LDEBUG("Loaded texture from '" << absPath(_spriteTexturePath) << "'");
LDEBUG(fmt::format(
"Loaded texture from '{}'",
absPath(_spriteTexturePath)
));
_spriteTexture->uploadTexture();
}
_spriteTexture->setFilter(
@@ -462,9 +464,11 @@ bool RenderablePoints::loadData() {
bool hasCachedFile = FileSys.fileExists(cachedFile);
if (hasCachedFile) {
LINFO(
"Cached file '" << cachedFile << "' used for Speck file '" << _file << "'"
);
LINFO(fmt::format(
"Cached file '{}' used for Speck file '{}'",
cachedFile,
_file
));
bool success = loadCachedFile(cachedFile);
if (success) {
@@ -480,9 +484,9 @@ bool RenderablePoints::loadData() {
}
}
else {
LINFO("Cache for Speck file '" << _file << "' not found");
LINFO(fmt::format("Cache for Speck file '{}' not found", _file));
}
LINFO("Loading Speck file '" << _file << "'");
LINFO(fmt::format("Loading Speck file '{}'", _file));
bool success = readSpeckFile();
if (!success) {
@@ -503,7 +507,7 @@ bool RenderablePoints::readSpeckFile() {
std::string _file = _speckFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Speck file '" << _file << "'");
LERROR(fmt::format("Failed to open Speck file '{}'", _file));
return false;
}
@@ -571,7 +575,7 @@ bool RenderablePoints::readColorMapFile() {
std::string _file = _colorMapFile;
std::ifstream file(_file);
if (!file.good()) {
LERROR("Failed to open Color Map file '" << _file << "'");
LERROR(fmt::format("Failed to open Color Map file '{}'", _file));
return false;
}
@@ -643,7 +647,10 @@ bool RenderablePoints::loadCachedFile(const std::string& file) {
return success;
}
else {
LERROR("Error opening file '" << file << "' for loading cache file");
LERROR(fmt::format(
"Error opening file '{}' for loading cache file",
file
));
return false;
}
}
@@ -676,7 +683,7 @@ bool RenderablePoints::saveCachedFile(const std::string& file) const {
return success;
}
else {
LERROR("Error opening file '" << file << "' for save cache file");
LERROR(fmt::format("Error opening file '{}' for save cache file", file));
return false;
}
}

View File

@@ -136,20 +136,17 @@ RenderableFieldlines::RenderableFieldlines(const ghoul::Dictionary& dictionary)
bool success = dictionary.getValue(keyVectorField, _vectorFieldInfo);
if (!success) {
LERROR("Renderable does not contain a key for '" <<
keyVectorField << "'");
LERROR(fmt::format("Renderable does not contain a key for '{}'", keyVectorField));
}
success = dictionary.getValue(keyFieldlines, _fieldlineInfo);
if (!success) {
LERROR("Renderable does not contain a key for '" <<
keyFieldlines << "'");
LERROR(fmt::format("Renderable does not contain a key for '{}'", keyFieldlines));
}
success = dictionary.getValue(keySeedPoints, _seedPointsInfo);
if (!success) {
LERROR("Renderable does not contain a key for '" <<
keySeedPoints << "'");
LERROR(fmt::format("Renderable does not contain a key for '{}", keySeedPoints));
}
// @TODO a non-magic number perhaps ---abock
@@ -320,7 +317,7 @@ void RenderableFieldlines::update(const UpdateData&) {
fieldlines[j].end()
);
}
LDEBUG("Number of vertices : " << vertexData.size());
LDEBUG(fmt::format("Number of vertices: {}", vertexData.size()));
if (_fieldlineVAO == 0) {
glGenVertexArrays(1, &_fieldlineVAO);
@@ -358,7 +355,7 @@ void RenderableFieldlines::update(const UpdateData&) {
GL_FLOAT,
GL_FALSE,
sizeof(LinePoint),
(void*)(sizeof(glm::vec3))
reinterpret_cast<void*>(sizeof(glm::vec3))
);
glBindBuffer(GL_ARRAY_BUFFER, 0);
@@ -383,13 +380,14 @@ void RenderableFieldlines::loadSeedPoints() {
}
void RenderableFieldlines::loadSeedPointsFromFile() {
LINFO("Reading seed points from file '" << _seedPointSourceFile.value() << "'");
LINFO(fmt::format("Reading seed points from '{}'", _seedPointSourceFile.value()));
std::ifstream seedFile(_seedPointSourceFile);
if (!seedFile.good())
LERROR(
"Could not open seed points file '" << _seedPointSourceFile.value() << "'"
);
LERROR(fmt::format(
"Could not open seed points file '{}'",
_seedPointSourceFile.value()
));
else {
std::string line;
glm::vec3 point;
@@ -419,8 +417,11 @@ std::vector<RenderableFieldlines::Line> RenderableFieldlines::generateFieldlines
std::string type;
bool success = _vectorFieldInfo.getValue(keyVectorFieldType, type);
if (!success) {
LERROR(keyVectorField << " does not contain a '" <<
keyVectorFieldType << "' key");
LERROR(fmt::format(
"{} does not contain a '{}' key",
keyVectorField,
keyVectorFieldType
));
return {};
}
@@ -428,8 +429,11 @@ std::vector<RenderableFieldlines::Line> RenderableFieldlines::generateFieldlines
return generateFieldlinesVolumeKameleon();
}
else {
LERROR(keyVectorField << "." << keyVectorFieldType <<
" does not name a valid type");
LERROR(fmt::format(
"{}.{} does not name a valid type",
keyVectorField,
keyVectorFieldType
));
return {};
}
}
@@ -440,14 +444,14 @@ RenderableFieldlines::generateFieldlinesVolumeKameleon()
std::string model;
bool success = _vectorFieldInfo.getValue(keyVectorFieldVolumeModel, model);
if (!success) {
LERROR(keyVectorField << " does not name a model");
LERROR(fmt::format("{} does not name a model", keyVectorField));
return {};
}
std::string fileName;
success = _vectorFieldInfo.getValue(keyVectorFieldFile, fileName);
if (!success) {
LERROR(keyVectorField << " does not name a file");
LERROR(fmt::format("{} does not name a file", keyVectorField));
return {};
}
fileName = absPath(fileName);
@@ -456,8 +460,12 @@ RenderableFieldlines::generateFieldlinesVolumeKameleon()
if (model != vectorFieldKameleonModelBATSRUS) {
//modelType = KameleonWrapper::Model::BATSRUS;
//else {
LERROR(keyVectorField << "." << keyVectorFieldVolumeModel << " model '" <<
model << "' not supported");
LERROR(fmt::format(
"{}.{} model '{}' not supported",
keyVectorField,
keyVectorFieldVolumeModel,
model
));
return {};
}
@@ -475,7 +483,7 @@ RenderableFieldlines::generateFieldlinesVolumeKameleon()
(_vectorFieldInfo.value<std::string>(v1) == vectorFieldKameleonVariableLorentz);
if (!threeVariables && !lorentzForce) {
LERROR(keyVectorField << " does not name variables");
LERROR(fmt::format("'{}' does not name variables", keyVectorField));
return {};
}

View File

@@ -34,7 +34,6 @@ source_group("Header Files" FILES ${HEADER_FILES})
set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefieldlinessequence.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefieldlinessequencesetup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/util/fieldlinesstate.cpp
${CMAKE_CURRENT_SOURCE_DIR}/util/commons.cpp
${CMAKE_CURRENT_SOURCE_DIR}/util/kameleonfieldlinehelper.cpp

View File

@@ -24,19 +24,40 @@
#include <modules/fieldlinessequence/fieldlinessequencemodule.h>
#include <modules/fieldlinessequence/rendering/renderablefieldlinessequence.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderable.h>
#include <openspace/util/factorymanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/assert.h>
#include <fstream>
#include <modules/fieldlinessequence/rendering/renderablefieldlinessequence.h>
namespace {
constexpr const char* DefaultTransferfunctionSource =
R"(
width 5
lower 0.0
upper 1.0
mappingkey 0.0 0 0 0 255
mappingkey 0.25 255 0 0 255
mappingkey 0.5 255 140 0 255
mappingkey 0.75 255 255 0 255
mappingkey 1.0 255 255 255 255
)";
} // namespace
namespace openspace {
std::string FieldlinesSequenceModule::DefaultTransferFunctionFile = "";
FieldlinesSequenceModule::FieldlinesSequenceModule()
: OpenSpaceModule("FieldlinesSequence")
{}
: OpenSpaceModule(Name)
{
DefaultTransferFunctionFile = absPath("${TEMPORARY}/default_transfer_function.txt");
std::ofstream file(DefaultTransferFunctionFile);
file << DefaultTransferfunctionSource;
}
void FieldlinesSequenceModule::internalInitialize(const ghoul::Dictionary&) {
auto factory = FactoryManager::ref().factory<Renderable>();

View File

@@ -31,8 +31,12 @@ namespace openspace {
class FieldlinesSequenceModule : public OpenSpaceModule {
public:
constexpr static const char* Name = "FieldlinesSequence";
FieldlinesSequenceModule();
static std::string DefaultTransferFunctionFile;
private:
void internalInitialize(const ghoul::Dictionary&) override;
};

View File

@@ -27,21 +27,17 @@
#include <openspace/rendering/renderable.h>
#include <modules/fieldlinessequence/util/fieldlinesstate.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/scalar/intproperty.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/triggerproperty.h>
#include <openspace/properties/scalar/intproperty.h>
#include <openspace/properties/vector/vec2property.h>
#include <openspace/properties/vector/vec4property.h>
#include <openspace/rendering/transferfunction.h>
#include <modules/fieldlinessequence/util/fieldlinesstate.h>
#include <atomic>
namespace {
enum class SourceFileType;
}
namespace { enum class SourceFileType; }
namespace openspace {
@@ -49,17 +45,18 @@ class RenderableFieldlinesSequence : public Renderable {
public:
RenderableFieldlinesSequence(const ghoul::Dictionary& dictionary);
void initialize() override;
void deinitialize() override;
void initializeGL() override;
void deinitializeGL() override;
bool isReady() const override;
void render(const RenderData& data, RendererTasks& rendererTask) override;
void update(const UpdateData& data) override;
private:
// ------------------------------------- ENUMS -------------------------------------//
// Used to determine if lines should be colored UNIFORMLY or by an extraQuantity
enum ColorMethod : int {
enum class ColorMethod : int {
Uniform = 0,
ByQuantity
};
@@ -71,8 +68,6 @@ private:
// Used for 'runtime-states'. True when loading a new state from disk on another
// thread.
std::atomic<bool> _isLoadingStateFromDisk { false};
// If initialization proved successful
bool _isReady = false;
// False => states are stored in RAM (using 'in-RAM-states'), True => states are
// loaded from disk during runtime (using 'runtime-states')
bool _loadingStatesDynamically = false;
@@ -123,7 +118,7 @@ private:
std::unique_ptr<FieldlinesState> _newState;
std::unique_ptr<ghoul::opengl::ProgramObject> _shaderProgram;
// Transfer function used to color lines when _pColorMethod is set to BY_QUANTITY
std::shared_ptr<TransferFunction> _transferFunction;
std::unique_ptr<TransferFunction> _transferFunction;
// ------------------------------------ VECTORS ----------------------------------- //
// Paths to color tables. One for each 'extraQuantity'
@@ -225,9 +220,8 @@ private:
bool prepareForOsflsStreaming();
// ------------------------- FUNCTIONS USED DURING RUNTIME ------------------------ //
inline bool isWithinSequenceInterval(const double currentTime) const;
void readNewState(const std::string& filePath);
void updateActiveTriggerTimeIndex(const double currentTime);
void updateActiveTriggerTimeIndex(double currentTime);
void updateVertexPositionBuffer();
void updateVertexColorBuffer();
void updateVertexMaskingBuffer();

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