Merge branch 'master' into feature/PerformanceATMOnline

This commit is contained in:
Jonathas Costa
2018-03-07 19:07:45 -05:00
174 changed files with 1750 additions and 1352 deletions

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(),
@@ -320,13 +320,10 @@ 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);
@@ -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')
@@ -18,37 +19,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
},
@@ -75,7 +76,7 @@ asset.onInitialize(function ()
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

@@ -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

@@ -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

@@ -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

@@ -62,7 +62,9 @@ public:
static const std::string KeyLuaDocumentation;
/// The key that stores the scripting log
static const std::string KeyScriptLog;
/// The key that stores the Property documentation
/// The key that stores the Scene Property documentation
static const std::string KeyScenePropertyDocumentation;
/// The key that stores the Root Property documentation
static const std::string KeyPropertyDocumentation;
/// The key that stores the keyboard bindings that should be stored
static const std::string KeyKeyboardShortcuts;

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

@@ -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

@@ -25,8 +25,6 @@
#ifndef __OPENSPACE_CORE___SCENE___H__
#define __OPENSPACE_CORE___SCENE___H__
#include <openspace/documentation/documentationgenerator.h>
#include <vector>
#include <unordered_map>
#include <set>
@@ -40,6 +38,8 @@
#include <openspace/util/camera.h>
#include <openspace/util/updatestructures.h>
#include <openspace/properties/propertyowner.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 {
@@ -182,8 +183,6 @@ public:
static scripting::LuaLibrary luaLibrary();
private:
std::string generateJson() const override;
/**
* Update dependencies.
*/

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>

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>

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

@@ -273,7 +273,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

@@ -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>

View File

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

View File

@@ -117,7 +117,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

@@ -386,7 +386,7 @@ void RenderableSphere::loadTexture() {
if (texture) {
LDEBUGC(
"RenderableSphere",
"Loaded texture from '" << absPath(_texturePath) << "'"
fmt::format("Loaded texture from '{}'", absPath(_texturePath))
);
texture->uploadTexture();

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

@@ -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>
@@ -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);
@@ -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

@@ -213,8 +213,9 @@ namespace {
tmp = std::stof(input);
}
catch (const std::invalid_argument& ia) {
LWARNING("Invalid argument: " << ia.what() << ". '" << input <<
"' is NOT a valid number!");
LWARNING(fmt::format(
"Invalid argument: {}. '{}' is NOT a valid number", ia.what(), input
));
return backupValue;
}
return tmp;
@@ -364,8 +365,9 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
// ------------------- EXTRACT MANDATORY VALUES FROM DICTIONARY ------------------- //
std::string inputFileTypeString;
if (!_dictionary->getValue(KeyInputFileType, inputFileTypeString)) {
LERROR(_name << ": The field " << std::string(KeyInputFileType) << " is missing!");
return false;
LERROR(fmt::format(
"{}: The field {} is missing", _name, KeyInputFileType
));
}
else {
std::transform(
@@ -385,10 +387,10 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
sourceFileType = SourceFileType::Osfls;
}
else {
LERROR(
_name << ": " << inputFileTypeString << " is not a recognized " <<
KeyInputFileType
);
LERROR(fmt::format(
"{}: {} is not a recognized {}",
_name, inputFileTypeString, KeyInputFileType
));
sourceFileType = SourceFileType::Invalid;
return false;
}
@@ -396,7 +398,9 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
std::string sourceFolderPath;
if (!_dictionary->getValue(KeySourceFolder, sourceFolderPath)) {
LERROR(_name << ": The field " << std::string(KeySourceFolder) << " is missing!");
LERROR(fmt::format(
"{}: The field {} is missing", _name, KeySourceFolder
));
return false;
}
@@ -425,16 +429,17 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary(
}), _sourceFiles.end());
// Ensure that there are available and valid source files left
if (_sourceFiles.empty()) {
LERROR(
_name << ": " << sourceFolderPath << " contains no ." <<
inputFileTypeString << " files!"
);
LERROR(fmt::format(
"{}: {} contains no {} files",
_name, sourceFolderPath, inputFileTypeString
));
return false;
}
}
else {
LERROR(_name << ": FieldlinesSequence" << sourceFolderPath
<< " is not a valid directory!");
LERROR(fmt::format(
"{}: FieldlinesSequence {} is not a valid directory", _name, sourceFolderPath
));
return false;
}
@@ -451,10 +456,10 @@ void RenderableFieldlinesSequence::extractOptionalInfoFromDictionary(
outputFolderPath = absPath(outputFolderPath);
}
else {
LERROR(
_name << ": The specified output path: '" <<
outputFolderPath << "', does not exist!"
);
LERROR(fmt::format(
"{}: The specified output path: '{}', does not exist",
_name, outputFolderPath
));
outputFolderPath = "";
}
}
@@ -512,7 +517,9 @@ bool RenderableFieldlinesSequence::extractJsonInfoFromDictionary(fls::Model& mod
model = fls::stringToModel(modelStr);
}
else {
LERROR(_name << ": Must specify '" << KeyJsonSimulationModel << "'");
LERROR(fmt::format(
"{}: Must specify '{}'", _name, KeyJsonSimulationModel
));
return false;
}
@@ -521,8 +528,10 @@ bool RenderableFieldlinesSequence::extractJsonInfoFromDictionary(fls::Model& mod
_scalingFactor = scaleFactor;
}
else {
LWARNING(_name << ": Does not provide scalingFactor! " <<
"Assumes coordinates are already expressed in meters!");
LWARNING(fmt::format(
"{}: Does not provide scalingFactor. Assumes coordinates are in meters",
_name
));
}
return true;
}
@@ -573,7 +582,7 @@ void RenderableFieldlinesSequence::loadOsflsStatesIntoRAM(const std::string& out
}
}
else {
LWARNING("Failed to load state from: " << filePath);
LWARNING(fmt::format("Failed to load state from: {}", filePath));
}
}
}
@@ -584,8 +593,10 @@ void RenderableFieldlinesSequence::extractOsflsInfoFromDictionary() {
_loadingStatesDynamically = shouldLoadInRealtime;
}
else {
LWARNING(_name << ": " << KeyOslfsLoadAtRuntime <<
" isn't specified! States will be stored in RAM!");
LWARNING(fmt::format(
"{}: {} is not specified. States will be stored in RAM",
_name, KeyOslfsLoadAtRuntime
));
}
}
@@ -721,7 +732,9 @@ void RenderableFieldlinesSequence::definePropertyCallbackFunctions() {
_pFocusOnOriginBtn.onChange([this] {
SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(_name);
if (!node) {
LWARNING("Could not find a node in scenegraph called '" << _name << "'");
LWARNING(fmt::format(
"Could not find a node in scenegraph called '{}'", _name
));
return;
}
OsEng.navigationHandler().setFocusNode(node->parent());
@@ -868,20 +881,23 @@ bool RenderableFieldlinesSequence::extractCdfInfoFromDictionary(std::string& see
seedFilePath = absPath(seedFilePath);
}
else {
LERROR(_name << ": The specified seed point file: '" <<
seedFilePath << "', does not exist!");
LERROR(fmt::format(
"{}: The specified seed poitn file: '{}' does not exist",
_name, seedFilePath
));
return false;
}
}
else {
LERROR(_name << ": Must specify '" << KeyCdfSeedPointFile << "'");
LERROR(fmt::format("{}: Must specify '{}'", _name, KeyCdfSeedPointFile));
return false;
}
if (!_dictionary->getValue(KeyCdfTracingVariable, tracingVar)) {
tracingVar = "b"; // Magnetic field variable as default
LWARNING(_name << ": No '" << KeyCdfTracingVariable << "', using default: "
<< tracingVar);
LWARNING(fmt::format("{}: No '{}', using default '{}'",
_name, KeyCdfTracingVariable, tracingVar
));
}
ghoul::Dictionary extraQuantityNamesDictionary;
@@ -902,11 +918,11 @@ bool RenderableFieldlinesSequence::extractSeedPointsFromFile(const std::string&
std::ifstream seedFile(FileSys.relativePath(path));
if (!seedFile.good()) {
LERROR("Could not open seed points file '" << path << "'");
LERROR(fmt::format("Could not open seed points file '{}'", path));
return false;
}
LDEBUG("Reading seed points from file '" << path << "'");
LDEBUG(fmt::format("Reading seed points from file '{}'", path));
std::string line;
while (std::getline(seedFile, line)) {
glm::vec3 point;
@@ -918,7 +934,7 @@ bool RenderableFieldlinesSequence::extractSeedPointsFromFile(const std::string&
}
if (outVec.size() == 0) {
LERROR("Found no seed points in: " << path);
LERROR(fmt::format("Found no seed points in: {}", path));
return false;
}

View File

@@ -25,6 +25,7 @@
#include <modules/fieldlinessequence/util/fieldlinesstate.h>
#include <openspace/util/time.h>
#include <ghoul/fmt.h>
#include <ghoul/logging/logmanager.h>
#include <ext/json/json.hpp>
#include <fstream>
@@ -142,7 +143,7 @@ bool FieldlinesState::loadStateFromJson(const std::string& pathToJsonFile,
std::ifstream ifs(pathToJsonFile);
if (!ifs.is_open()) {
LERROR("FAILED TO OPEN FILE: " << pathToJsonFile);
LERROR(fmt::format("FAILED TO OPEN FILE: {}", pathToJsonFile));
return false;
}
@@ -254,7 +255,9 @@ void FieldlinesState::saveStateToOsfls(const std::string& absPath) {
std::ofstream ofs(absPath + fileName, std::ofstream::binary | std::ofstream::trunc);
if (!ofs.is_open()) {
LERROR("Failed to save state to binary file: " << absPath << fileName);
LERROR(fmt::format(
"Failed to save state to binary file: {}{}", absPath, fileName
));
return;
}
@@ -326,10 +329,12 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) {
const char* ext = ".json";
std::ofstream ofs(absPath + ext, std::ofstream::trunc);
if (!ofs.is_open()) {
LERROR("Failed to save state to json file at location: " << absPath << ext);
LERROR(fmt::format(
"Failed to save state to json file at location: {}{}", absPath, ext
));
return;
}
LINFO("Saving fieldline state to: " << absPath << ext );
LINFO(fmt::format("Saving fieldline state to: {}{}", absPath, ext));
json jColumns = { "x", "y", "z" };
for (const std::string& s : _extraQuantityNames) {
@@ -369,7 +374,7 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) {
const int indentationSpaces = 2;
ofs << std::setw(indentationSpaces) << jFile << std::endl;
LINFO("Saved fieldline state to: " << absPath << ext );
LINFO(fmt::format("Saved fieldline state to: {}{}", absPath, ext));
}
// Returns one of the extra quantity vectors, _extraQuantities[index].

View File

@@ -26,6 +26,7 @@
#include <modules/fieldlinessequence/util/commons.h>
#include <modules/fieldlinessequence/util/fieldlinesstate.h>
#include <ghoul/fmt.h>
#include <ghoul/logging/logmanager.h>
#include <memory>
@@ -151,8 +152,10 @@ bool addLinesToState(ccmc::Kameleon* kameleon, const std::vector<glm::vec3>& see
innerBoundaryLimit = 0.11f; // TODO specify in Lua?
break;
default:
LERROR("OpenSpace's fieldlines sequence currently only supports CDFs from "
<< "the BATSRUS and ENLIL models!");
LERROR(
"OpenSpace's fieldlines sequence currently only supports CDFs from the "
"BATSRUS and ENLIL models!"
);
return false;
}
@@ -302,14 +305,16 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
(model == fls::Model::Batsrus && (str == TAsPOverRho || str == "T" )))
{
LDEBUG("BATSRUS doesn't contain variable T for temperature. Trying to "
<< "calculate it using the ideal gas law: T = pressure/density");
"calculate it using the ideal gas law: T = pressure/density");
const std::string p = "p", r = "rho";
success = kameleon->doesVariableExist(p) && kameleon->loadVariable(p) &&
kameleon->doesVariableExist(r) && kameleon->loadVariable(r);
str = TAsPOverRho;
}
if (!success) {
LWARNING("Failed to load extra variable: '" << str << "'. Ignoring it!");
LWARNING(fmt::format(
"Failed to load extra variable: '{}'. Ignoring", str
));
extraScalarVars.erase(extraScalarVars.begin() + i);
--i;
} else {
@@ -346,9 +351,11 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
name = JParallelB;
}
if (!success) {
LWARNING("Failed to load at least one of the magnitude variables: "
<< s1 << ", " << s2 << " & " << s3
<< ". Removing ability to store corresponding magnitude!");
LWARNING(fmt::format(
"Failed to load at least one of the magnitude variables: {}, {}, {} "
"& {}. Removing ability to store corresponding magnitude",
s1, s2, s3
));
extraMagVars.erase(
extraMagVars.begin() + i,
extraMagVars.begin() + i + 3
@@ -361,9 +368,11 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
} else {
// WRONG NUMBER OF MAGNITUDE VARIABLES.. REMOVE ALL!
extraMagVars.clear();
LWARNING("Wrong number of variables provided for storing magnitudes. "
<< "Expects multiple of 3 but " << extraMagVars.size()
<< " are provided");
LWARNING(fmt::format(
"Wrong number of variables provided for storing magnitudes. Expects multiple "
"of 3 but {} are provided",
extraMagVars.size()
));
}
state.setExtraQuantityNames(std::move(extraQuantityNames));
}

View File

@@ -272,6 +272,14 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const {
"getGeoPosition",
&globebrowsing::luascriptfunctions::getGeoPosition,
{},
"name, latitude, longitude, altitude",
"Returns the specified surface position on the globe as three floating point "
"values"
},
{
"getGeoPositionForCamera",
&globebrowsing::luascriptfunctions::getGeoPositionForCamera,
{},
"void",
"Get geographic coordinates of the camera poosition in latitude, "
"longitude, and altitude"
@@ -348,6 +356,28 @@ void GlobeBrowsingModule::goToGeo(double latitude, double longitude,
);
}
glm::vec3 GlobeBrowsingModule::cartesianCoordinatesFromGeo(
globebrowsing::RenderableGlobe& globe,
double latitude, double longitude, double altitude)
{
using namespace globebrowsing;
Geodetic3 pos = {
{
Angle<double>::fromDegrees(latitude).asRadians(),
Angle<double>::fromDegrees(longitude).asRadians()
},
altitude
};
glm::dvec3 positionModelSpace = globe.ellipsoid().cartesianPosition(pos);
//glm::dmat4 modelTransform = globe.modelTransform();
//glm::dvec3 positionWorldSpace = glm::dvec3(modelTransform *
//glm::dvec4(positionModelSpace, 1.0));
return glm::vec3(positionModelSpace);
}
void GlobeBrowsingModule::goToChunk(Camera& camera, globebrowsing::TileIndex ti,
glm::vec2 uv, bool resetCameraDirection)
{
@@ -362,8 +392,9 @@ void GlobeBrowsingModule::goToChunk(Camera& camera, globebrowsing::TileIndex ti,
// Camera position in model space
glm::dvec3 camPos = camera.positionVec3();
glm::dmat4 inverseModelTransform = globe->inverseModelTransform();
glm::dvec3 cameraPositionModelSpace =
glm::dvec3(inverseModelTransform * glm::dvec4(camPos, 1));
glm::dvec3 cameraPositionModelSpace = glm::dvec3(
inverseModelTransform * glm::dvec4(camPos, 1)
);
GeodeticPatch patch(ti);
Geodetic2 corner = patch.getCorner(SOUTH_WEST);

View File

@@ -53,6 +53,9 @@ public:
void goToGeo(double latitude, double longitude);
void goToGeo(double latitude, double longitude, double altitude);
glm::vec3 cartesianCoordinatesFromGeo(globebrowsing::RenderableGlobe& globe,
double latitude, double longitude, double altitude);
globebrowsing::cache::MemoryAwareTileCache* tileCache();
scripting::LuaLibrary luaLibrary() const override;
globebrowsing::RenderableGlobe* castFocusNodeRenderableToGlobe();

View File

@@ -34,6 +34,7 @@
#include <openspace/rendering/renderable.h>
#include <openspace/scene/scene.h>
#include <openspace/scene/scenegraphnode.h>
#include <openspace/query/query.h>
namespace openspace::globebrowsing::luascriptfunctions {
@@ -175,7 +176,40 @@ int goToGeo(lua_State* L) {
}
int getGeoPosition(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::getGeoPosition");
ghoul::lua::checkArgumentsAndThrow(L, 4, "lua::getGeoPosition");
std::string name = luaL_checkstring(L, 1);
double latitude = lua_tonumber(L, 2);
double longitude = lua_tonumber(L, 3);
double altitude = lua_tonumber(L, 4);
lua_settop(L, 0);
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
SceneGraphNode* n = sceneGraphNode(name);
Renderable* r = n->renderable();
RenderableGlobe* g = dynamic_cast<RenderableGlobe*>(r);
if (!g) {
return luaL_error(L, "Name must be a RenderableGlobe");
}
GlobeBrowsingModule& mod = *(OsEng.moduleEngine().module<GlobeBrowsingModule>());
glm::vec3 pos = mod.cartesianCoordinatesFromGeo(
*g,
latitude,
longitude,
altitude
);
lua_pushnumber(L, pos.x);
lua_pushnumber(L, pos.y);
lua_pushnumber(L, pos.z);
return 3;
}
int getGeoPositionForCamera(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::getGeoPositionForCamera");
GlobeBrowsingModule* module = OsEng.moduleEngine().module<GlobeBrowsingModule>();
RenderableGlobe* globe = module->castFocusNodeRenderableToGlobe();

View File

@@ -65,14 +65,14 @@ namespace {
namespace openspace::globebrowsing {
void gdalErrorHandler(CPLErr eErrClass, int, const char *msg) {
void gdalErrorHandler(CPLErr eErrClass, int, const char* msg) {
if (GdalWrapper::ref().logGdalErrors()) {
switch (eErrClass) {
case CE_None: break;
case CE_Debug: LDEBUG ("GDAL " << msg); break;
case CE_Warning: LWARNING("GDAL " << msg); break;
case CE_Failure: LERROR ("GDAL " << msg); break;
case CE_Fatal: LFATAL ("GDAL " << msg); break;
case CE_Debug: LDEBUGC ("GDAL", msg); break;
case CE_Warning: LWARNINGC("GDAL", msg); break;
case CE_Failure: LERRORC ("GDAL", msg); break;
case CE_Fatal: LFATALC ("GDAL", msg); break;
}
}
}
@@ -188,12 +188,12 @@ void GdalWrapper::setGdalProxyConfiguration() {
if (success) {
std::string proxy = proxyAddress + ":" + proxyPort;
CPLSetConfigOption("GDAL_HTTP_PROXY", proxy.c_str());
LDEBUG("Using proxy server " << proxy);
LDEBUG(fmt::format("Using proxy server {}", proxy));
if (userAndPassword) {
std::string proxyUserPwd = proxyUser + ":" + proxyPassword;
CPLSetConfigOption("GDAL_HTTP_PROXYUSERPWD", proxyUserPwd.c_str());
CPLSetConfigOption("GDAL_HTTP_PROXYAUTH", proxyAuthString.c_str());
LDEBUG("Using authentication method: " << proxyAuthString);
LDEBUG(fmt::format("Using authentication method: {}", proxyAuthString));
}
} else {
LERROR("Invalid proxy settings for GDAL");

View File

@@ -47,7 +47,8 @@
#include <modules/globebrowsing/geometry/angle.h>
#include <float.h>
#include <ghoul/fmt.h>
#include <fmt/ostream.h>
#include <sstream>
#include <algorithm>
@@ -151,7 +152,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -180,7 +181,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
format.glFormat = GL_RED;
break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -210,7 +211,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -240,12 +241,15 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) {
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
default:
LERROR("Unknown number of channels for OpenGL texture: " << rasterCount);
LERROR(fmt::format(
"Unknown number of channels for OpenGL texture: {}",
rasterCount
));
throw ghoul::MissingCaseException();
}
return format;
@@ -281,7 +285,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -310,7 +314,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
format.glFormat = GL_RED;
break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -340,7 +344,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
@@ -370,12 +374,12 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType)
// format.glFormat = GL_RED;
// break;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
break;
default:
LERROR("Unknown number of channels for OpenGL texture: " << rasterCount);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
return format;
@@ -398,7 +402,7 @@ GLenum getOpenGLDataType(GDALDataType gdalType) {
case GDT_Float64:
return GL_DOUBLE;
default:
LERROR("GDAL data type unknown to OpenGL: " << gdalType);
LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType));
throw ghoul::MissingCaseException();
}
}
@@ -420,7 +424,7 @@ GDALDataType getGdalDataType(GLenum glType) {
case GL_DOUBLE:
return GDT_Float64;
default:
LERROR("OpenGL data type unknown to GDAL: " << glType);
LERROR(fmt::format("OpenGL data type unknown to GDAL: {}", glType));
throw ghoul::MissingCaseException();
}
}
@@ -441,7 +445,7 @@ size_t numberOfRasters(ghoul::opengl::Texture::Format format) {
return 4;
default: {
ghoul_assert(false, "Unknown format");
return 0;
throw ghoul::MissingCaseException();
}
}
}
@@ -526,7 +530,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_R16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::RG:
@@ -545,7 +549,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_RG16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::RGB:
@@ -564,7 +568,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_RGB16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::RGBA:
@@ -583,7 +587,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_RGBA16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::BGR:
@@ -602,7 +606,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_RGB16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
case ghoul::opengl::Texture::Format::BGRA:
@@ -621,16 +625,16 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) {
return GL_RGBA16F;
default:
ghoul_assert(false, "glType data type unknown");
LERROR("glType data type unknown: " << glType);
LERROR(fmt::format("glType data type unknown: {}", glType));
throw ghoul::MissingCaseException();
}
default:
LERROR(
"Unknown format for OpenGL texture: " <<
LERROR(fmt::format(
"Unknown format for OpenGL texture: {}",
static_cast<std::underlying_type_t<ghoul::opengl::Texture::Format>>(
format
)
);
));
throw ghoul::MissingCaseException();
}
}

View File

@@ -39,7 +39,7 @@
#include <openspace/engine/moduleengine.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/dictionary.h>
#include <ghoul/opengl/texture.h>
@@ -92,7 +92,7 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
double pixelSize = 0.0;
int tilePixelSize = 0;
if (dictionary.getValue<double>(KeyTilePixelSize, pixelSize)) {
LDEBUG("Default pixel size overridden: " << pixelSize);
LDEBUG(fmt::format("Default pixel size overridden: {}", pixelSize));
tilePixelSize = static_cast<int>(pixelSize);
}
@@ -106,7 +106,10 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
_performPreProcessing =
LayerManager::shouldPerformPreProcessingOnLayergroup(_layerGroupID);
if (dictionary.getValue<bool>(KeyPerformPreProcessing, _performPreProcessing)) {
LDEBUG("Default PerformPreProcessing overridden: " << _performPreProcessing);
LDEBUG(fmt::format(
"Default PerformPreProcessing overridden: {}",
_performPreProcessing
));
}
if (dictionary.hasKeyAndValue<double>(KeyPreCacheLevel)) {
@@ -241,7 +244,11 @@ void DefaultTileProvider::initAsyncTileDataReader(TileTextureInitData initData)
// Tiles are only available for levels 2 and higher.
if (_preCacheLevel >= 2) {
LDEBUG("Precaching '" << _filePath << "' with level '" << _preCacheLevel << "'");
LDEBUG(fmt::format(
"Precaching '{}' with level '{}'",
_filePath.value(),
_preCacheLevel
));
for (int level = 0; level <= _preCacheLevel; ++level) {
for (int x = 0; x <= level * 2; ++x) {
for (int y = 0; y <= level; ++y) {

View File

@@ -28,11 +28,12 @@
#include <modules/globebrowsing/tile/tileprovider/defaulttileprovider.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/logmanager.h>
#include "cpl_minixml.h"
#include <fmt/format.h>
#include <ghoul/fmt.h>
#include <fstream>
namespace {
@@ -105,7 +106,7 @@ bool TemporalTileProvider::initialize() {
bool success = TileProvider::initialize();
if (!_preCacheTimes.empty()) {
LINFO("Preloading: " << _filePath.value());
LINFO(fmt::format("Preloading: {}", _filePath.value()));
for (const Time& t : _preCacheTimes) {
getTileProvider(t);
}

View File

@@ -27,9 +27,9 @@
#include <modules/imgui/include/gui.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/settingsengine.h>
#include <openspace/engine/virtualpropertymanager.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/interaction/navigationhandler.h>
#include <openspace/interaction/luaconsole.h>
#include <openspace/network/parallelconnection.h>
@@ -67,7 +67,6 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[]() {
std::vector<properties::PropertyOwner*> res = {
&(OsEng.windowWrapper()),
&(OsEng.settingsEngine()),
&(OsEng.navigationHandler()),
&(OsEng.renderEngine()),
&(OsEng.parallelConnection()),
@@ -86,7 +85,15 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
}
);
gui._property.setSource(
gui._moduleProperty.setSource(
[]() {
std::vector<properties::PropertyOwner*> v;
v.push_back(&(OsEng.moduleEngine()));
return v;
}
);
gui._sceneProperty.setSource(
[]() {
const Scene* scene = OsEng.renderEngine().scene();
const std::vector<SceneGraphNode*>& nodes = scene ?
@@ -197,7 +204,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](Key key, KeyModifier mod, KeyAction action) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.keyCallback(key, mod, action);
}
@@ -211,7 +218,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](unsigned int codepoint, KeyModifier modifier) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.charCallback(codepoint, modifier);
}
@@ -225,7 +232,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](MouseButton button, MouseAction action) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.mouseButtonCallback(button, action);
}
@@ -239,7 +246,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
[&](double, double posY) -> bool {
// A list of all the windows that can show up by themselves
if (gui.isEnabled() || gui._performance.isEnabled() ||
gui._property.isEnabled())
gui._sceneProperty.isEnabled())
{
return gui.mouseWheelCallback(posY);
}

View File

@@ -75,9 +75,12 @@ public:
GuiGlobeBrowsingComponent _globeBrowsing;
#endif // GLOBEBROWSING_USE_GDAL
GuiPerformanceComponent _performance;
GuiPropertyComponent _globalProperty;
GuiPropertyComponent _property;
GuiPropertyComponent _sceneProperty;
GuiPropertyComponent _screenSpaceProperty;
GuiPropertyComponent _moduleProperty;
GuiPropertyComponent _virtualProperty;
GuiSpaceTimeComponent _spaceTime;
GuiMissionComponent _mission;

View File

@@ -51,7 +51,7 @@ const char* configurationFile = "imgui.ini";
//const char* GuiFont = "${FONTS}/ubuntu/Ubuntu-Regular.ttf";
const char* GuiFont = "${FONTS}/arimo/Arimo-Regular.ttf";
const float FontSize = 14.f;
const ImVec2 size = ImVec2(500, 500);
const ImVec2 Size = ImVec2(500, 500);
//GLuint fontTex = 0;
// A VBO max size of 0 will cause a lazy instantiation of the buffer
@@ -222,7 +222,7 @@ static void RenderDrawLists(ImDrawData* drawData) {
void addScreenSpaceRenderableLocal(std::string texturePath) {
if (!FileSys.fileExists(absPath(texturePath))) {
LWARNING("Could not find image '" << texturePath << "'");
LWARNING(fmt::format("Could not find image '{}'", texturePath));
return;
}
@@ -280,9 +280,10 @@ void CaptionText(const char* text) {
GUI::GUI()
: GuiComponent("Main")
, _globalProperty("Global")
, _property(
"Properties",
, _globalProperty("Global Properties")
, _moduleProperty("Module Properties")
, _sceneProperty(
"Scene Properties",
GuiPropertyComponent::UseTreeLayout::Yes
)
, _screenSpaceProperty("ScreenSpace Properties")
@@ -297,7 +298,8 @@ GUI::GUI()
addPropertySubOwner(_help);
addPropertySubOwner(_performance);
addPropertySubOwner(_globalProperty);
addPropertySubOwner(_property);
addPropertySubOwner(_moduleProperty);
addPropertySubOwner(_sceneProperty);
addPropertySubOwner(_screenSpaceProperty);
_featuredProperties.setEnabled(true);
addPropertySubOwner(_featuredProperties);
@@ -323,7 +325,8 @@ GUI::GUI()
#endif // GLOBEBROWSING_USE_GDAL
_performance.setShowHelpTooltip(_showHelpText);
_globalProperty.setShowHelpTooltip(_showHelpText);
_property.setShowHelpTooltip(_showHelpText);
_moduleProperty.setShowHelpTooltip(_showHelpText);
_sceneProperty.setShowHelpTooltip(_showHelpText);
_screenSpaceProperty.setShowHelpTooltip(_showHelpText);
_virtualProperty.setShowHelpTooltip(_showHelpText);
_spaceTime.setShowHelpTooltip(_showHelpText);
@@ -348,7 +351,8 @@ GUI::GUI()
#endif // GLOBEBROWSING_USE_GDAL
_performance.setShowHelpTooltipDelay(_helpTextDelay);
_globalProperty.setShowHelpTooltipDelay(_helpTextDelay);
_property.setShowHelpTooltipDelay(_helpTextDelay);
_moduleProperty.setShowHelpTooltipDelay(_helpTextDelay);
_sceneProperty.setShowHelpTooltipDelay(_helpTextDelay);
_screenSpaceProperty.setShowHelpTooltipDelay(_helpTextDelay);
_virtualProperty.setShowHelpTooltipDelay(_helpTextDelay);
_spaceTime.setShowHelpTooltipDelay(_helpTextDelay);
@@ -479,12 +483,14 @@ void GUI::initialize() {
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.44f, 0.63f, 1.00f, 0.35f);
style.Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
}
_property.initialize();
_property.setHasRegularProperties(true);
_sceneProperty.initialize();
_sceneProperty.setHasRegularProperties(true);
_screenSpaceProperty.initialize();
_screenSpaceProperty.setHasRegularProperties(true);
_globalProperty.initialize();
_globalProperty.setHasRegularProperties(true);
_moduleProperty.initialize();
_moduleProperty.setHasRegularProperties(true);
_featuredProperties.initialize();
_featuredProperties.setHasRegularProperties(true);
_virtualProperty.initialize();
@@ -518,6 +524,7 @@ void GUI::deinitialize() {
_help.deinitialize();
_performance.deinitialize();
_globalProperty.deinitialize();
_moduleProperty.deinitialize();
_featuredProperties.deinitialize();
_screenSpaceProperty.deinitialize();
_virtualProperty.deinitialize();
@@ -526,7 +533,7 @@ void GUI::deinitialize() {
#ifdef GLOBEBROWSING_USE_GDAL
_globeBrowsing.deinitialize();
#endif // GLOBEBROWSING_USE_GDAL
_property.deinitialize();
_sceneProperty.deinitialize();
delete iniFileBuffer;
}
@@ -614,9 +621,10 @@ void GUI::initializeGL() {
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
_property.initializeGL();
_sceneProperty.initializeGL();
_screenSpaceProperty.initializeGL();
_globalProperty.initializeGL();
_moduleProperty.initializeGL();
_featuredProperties.initializeGL();
_performance.initializeGL();
_help.initializeGL();
@@ -656,13 +664,14 @@ void GUI::deinitializeGL() {
_performance.deinitializeGL();
_featuredProperties.deinitializeGL();
_globalProperty.deinitializeGL();
_moduleProperty.deinitializeGL();
_screenSpaceProperty.deinitializeGL();
#ifdef GLOBEBROWSING_USE_GDAL
_globeBrowsing.deinitializeGL();
#endif // GLOBEBROWSING_USE_GDAL
_filePath.deinitializeGL();
_asset.deinitializeGL();
_property.deinitializeGL();
_sceneProperty.deinitializeGL();
}
void GUI::startFrame(float deltaTime, const glm::vec2& windowSize,
@@ -709,8 +718,11 @@ void GUI::endFrame() {
if (_globalProperty.isEnabled()) {
_globalProperty.render();
}
if (_property.isEnabled()) {
_property.render();
if (_moduleProperty.isEnabled()) {
_moduleProperty.render();
}
if (_sceneProperty.isEnabled()) {
_sceneProperty.render();
}
if (_screenSpaceProperty.isEnabled()) {
_screenSpaceProperty.render();
@@ -832,9 +844,9 @@ void GUI::render() {
_isCollapsed = ImGui::IsWindowCollapsed();
bool property = _property.isEnabled();
ImGui::Checkbox("Scene Graph Properties", &property);
_property.setEnabled(property);
bool sceneProperty = _sceneProperty.isEnabled();
ImGui::Checkbox("Scene Graph Properties", &sceneProperty);
_sceneProperty.setEnabled(sceneProperty);
bool screenSpaceProperty = _screenSpaceProperty.isEnabled();
ImGui::Checkbox("ScreenSpace Properties", &screenSpaceProperty);
@@ -848,6 +860,10 @@ void GUI::render() {
ImGui::Checkbox("Global Properties", &globalProperty);
_globalProperty.setEnabled(globalProperty);
bool moduleProperty = _moduleProperty.isEnabled();
ImGui::Checkbox("Module Properties", &moduleProperty);
_moduleProperty.setEnabled(moduleProperty);
bool spacetime = _spaceTime.isEnabled();
ImGui::Checkbox("Space/Time", &spacetime);
_spaceTime.setEnabled(spacetime);
@@ -961,7 +977,8 @@ void GUI::renderAndUpdatePropertyVisibility() {
_currentVisibility = static_cast<V>(t);
_globalProperty.setVisibility(_currentVisibility);
_property.setVisibility(_currentVisibility);
_moduleProperty.setVisibility(_currentVisibility);
_sceneProperty.setVisibility(_currentVisibility);
_screenSpaceProperty.setVisibility(_currentVisibility);
_virtualProperty.setVisibility(_currentVisibility);
_featuredProperties.setVisibility(_currentVisibility);

View File

@@ -42,7 +42,7 @@
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/misc/defer.h>
#include <fmt/format.h>
#include <ghoul/fmt.h>
#include <numeric>
@@ -242,7 +242,7 @@ void GuiGlobeBrowsingComponent::render() {
if (cap.empty()) {
LWARNINGC(
"GlobeBrowsingGUI",
"Unknown server: '" << _currentServer << "'"
fmt::format("Unknown server: '{}'", _currentServer)
);
}

View File

@@ -27,7 +27,7 @@
#include <modules/imgui/include/imgui_include.h>
namespace {
const ImVec2 size = ImVec2(350, 500);
const ImVec2 Size = ImVec2(350, 500);
} // namespace
namespace openspace::gui {
@@ -40,7 +40,7 @@ void GuiHelpComponent::render() {
ImGui::SetNextWindowCollapsed(_isCollapsed);
bool v = _isEnabled;
ImGui::Begin("Help", &v, size, 0.5f);
ImGui::Begin("Help", &v, Size, 0.5f);
_isEnabled = v;
_isCollapsed = ImGui::IsWindowCollapsed();
ImGui::ShowUserGuide();

View File

@@ -33,7 +33,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/scripting/scriptengine.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <modules/iswa/ext/json.h>

View File

@@ -32,7 +32,7 @@
#include <openspace/network/parallelconnection.h>
#include <openspace/network/messagestructures.h>
#include <fmt/format.h>
#include <ghoul/fmt.h>
#include <algorithm>
#include <numeric>

View File

@@ -33,7 +33,7 @@
#include <ghoul/misc/sharedmemory.h>
#include <fmt/format.h>
#include <ghoul/fmt.h>
#include <algorithm>
#include <numeric>

View File

@@ -35,7 +35,7 @@
#include <algorithm>
namespace {
const ImVec2 size = ImVec2(350, 500);
const ImVec2 Size = ImVec2(350, 500);
static const openspace::properties::Property::PropertyInfo UseTreeInfo = {
"TreeLayout",
@@ -252,7 +252,7 @@ void GuiPropertyComponent::render() {
ImGui::SetNextWindowCollapsed(_isCollapsed);
bool v = _isEnabled;
ImGui::Begin(name().c_str(), &v, size, 0.75f);
ImGui::Begin(name().c_str(), &v, Size, 0.75f);
_isEnabled = v;
_isCollapsed = ImGui::IsWindowCollapsed();

View File

@@ -111,12 +111,12 @@ void IswaKameleonGroup::registerProperties() {
}
void IswaKameleonGroup::readFieldlinePaths(std::string indexFile) {
LINFO("Reading seed points paths from file '" << indexFile << "'");
LINFO(fmt::format("Reading seed points paths from file '{}'", indexFile));
// Read the index file from disk
std::ifstream seedFile(indexFile);
if (!seedFile.good())
LERROR("Could not open seed points file '" << indexFile << "'");
LERROR(fmt::format("Could not open seed points file '{}'", indexFile));
else {
std::string line;
std::string fileContent;

View File

@@ -25,7 +25,7 @@
#include <fstream>
#include <modules/iswa/rendering/kameleonplane.h>
#include <modules/iswa/util/dataprocessorkameleon.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#ifdef __GNUC__
#pragma GCC diagnostic push
@@ -318,7 +318,7 @@ void KameleonPlane::updateFieldlineSeeds() {
}
void KameleonPlane::readFieldlinePaths(std::string indexFile) {
LINFO("Reading seed points paths from file '" << indexFile << "'");
LINFO(fmt::format("Reading seed points paths from file '{}'", indexFile));
if (_group) {
std::dynamic_pointer_cast<IswaKameleonGroup>(_group)->setFieldlineInfo(
indexFile,
@@ -330,7 +330,7 @@ void KameleonPlane::readFieldlinePaths(std::string indexFile) {
// Read the index file from disk
std::ifstream seedFile(indexFile);
if (!seedFile.good()) {
LERROR("Could not open seed points file '" << indexFile << "'");
LERROR(fmt::format("Could not open seed points file '{}'", indexFile));
}
else {
try {

View File

@@ -24,7 +24,7 @@
#include <modules/iswa/rendering/screenspacecygnet.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <openspace/util/time.h>
#include <modules/iswa/util/iswamanager.h>
#include <openspace/engine/openspaceengine.h>

View File

@@ -48,7 +48,9 @@ bool TextureCygnet::updateTexture() {
);
if (texture) {
LDEBUG("Loaded texture from image iswa cygnet with id: '" << _data->id << "'");
LDEBUG(fmt::format(
"Loaded texture from image iswa cygnet with id: '{}'", _data->id
));
texture->uploadTexture();
// Textures of planets looks much smoother with AnisotropicMipMap
texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap);

View File

@@ -24,6 +24,7 @@
#include <modules/iswa/util/dataprocessorkameleon.h>
//#include <algorithm>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/glm.h>

View File

@@ -38,7 +38,7 @@
#include <fstream>
#include <algorithm>
#include <ghoul/filesystem/filesystem>
#include <ghoul/filesystem/filesystem.h>
#include <modules/kameleon/include/kameleonwrapper.h>
#include <openspace/scene/scene.h>
#include <openspace/util/spicemanager.h>

View File

@@ -39,7 +39,7 @@
#endif // _MSC_VER
#include <ghoul/logging/logmanager.h>
#include <ghoul/fmt.h>
namespace {
std::string _loggerCat = "KameleonHelper";
@@ -57,14 +57,17 @@ std::unique_ptr<ccmc::Kameleon> createKameleonObject(const std::string& cdfFileP
// ---------------------------- CREATE KAMELEON OBJECT ---------------------------- //
std::unique_ptr<ccmc::Kameleon> kameleon = std::make_unique<ccmc::Kameleon>();
LDEBUG("\tOpening the cdf file: " << cdfFilePath);
LDEBUG(fmt::format("\tOpening the cdf file: {}", cdfFilePath));
long kamStatus = kameleon->open(cdfFilePath);
if (kamStatus != ccmc::FileReader::OK) {
LERROR("Failed to create a Kameleon Object from file: " << cdfFilePath);
LERROR(fmt::format(
"Failed to create a Kameleon Object from file: {}",
cdfFilePath
));
return nullptr;
}
LDEBUG("\tSuccessfully opened : " << cdfFilePath);
LDEBUG(fmt::format("\tSuccessfully opened: {}", cdfFilePath));
return kameleon;
}
@@ -123,8 +126,10 @@ double getTime(ccmc::Kameleon* kameleon) {
seqStartStr =
kameleon->getGlobalAttribute("tim_crstart_cal").getAttributeString();
} else {
LWARNING("No starting time attribute could be found in the .cdf file.\n\t" <<
"Starting time is set to 01.JAN.2000 12:00.");
LWARNING(
"No starting time attribute could be found in the .cdf file. Starting "
"time is set to 01.JAN.2000 12:00."
);
seqStartDbl = 0.0;
}
@@ -137,7 +142,7 @@ double getTime(ccmc::Kameleon* kameleon) {
Time::convertTime(
seqStartStr.substr(0, seqStartStr.length() - 2));
} else {
LWARNING("No starting time attribute could be found in the .cdf file.\n\t" <<
LWARNING("No starting time attribute could be found in the .cdf file."
"Starting time is set to 01.JAN.2000 12:00.");
seqStartDbl = 0.0;
}
@@ -154,7 +159,7 @@ double getTime(ccmc::Kameleon* kameleon) {
"time_physical_time").getAttributeFloat());
} else {
stateStartOffset = 0.0;
LWARNING("No time offset attribute could be found in the .cdf file.\n\t" <<
LWARNING("No time offset attribute could be found in the .cdf file."
"The current state starts the same time as the sequence!");
}

View File

@@ -26,6 +26,7 @@
//#include <openspace/util/progressbar.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#ifdef WIN32
@@ -50,6 +51,7 @@
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <ghoul/fmt.h>
#include <glm/gtx/rotate_vector.hpp>
@@ -127,9 +129,9 @@ bool KameleonWrapper::open(const std::string& filename) {
_gridType = getGridType(_xCoordVar, _yCoordVar, _zCoordVar);
_type = getModelType();
LDEBUG("x:" << _xCoordVar);
LDEBUG("y:" << _yCoordVar);
LDEBUG("z:" << _zCoordVar);
LDEBUG(fmt::format("x: {}", _xCoordVar));
LDEBUG(fmt::format("y: {}", _yCoordVar));
LDEBUG(fmt::format("z: {}", _zCoordVar));
_xMin =
_model->getVariableAttribute(_xCoordVar, "actual_min").getAttributeFloat();
@@ -165,18 +167,18 @@ bool KameleonWrapper::open(const std::string& filename) {
_zValidMax =
_model->getVariableAttribute(_zCoordVar, "valid_max").getAttributeFloat();
LDEBUG("_xMin: " << _xMin);
LDEBUG("_xMax: " << _xMax);
LDEBUG("_yMin: " << _yMin);
LDEBUG("_yMax: " << _yMax);
LDEBUG("_zMin: " << _zMin);
LDEBUG("_zMax: " << _zMax);
LDEBUG("_xValidMin: " << _xValidMin);
LDEBUG("_xValidMax: " << _xValidMax);
LDEBUG("_yValidMin: " << _yValidMin);
LDEBUG("_yValidMax: " << _yValidMax);
LDEBUG("_zValidMin: " << _zValidMin);
LDEBUG("_zValidMax: " << _zValidMax);
LDEBUG(fmt::format("_xMin: {}", _xMin));
LDEBUG(fmt::format("_xMax: {}", _xMax));
LDEBUG(fmt::format("_yMin: {}", _yMin));
LDEBUG(fmt::format("_yMax: {}", _yMax));
LDEBUG(fmt::format("_zMin: {}", _zMin));
LDEBUG(fmt::format("_zMax: {}", _zMax));
LDEBUG(fmt::format("_xValidMin: {}", _xValidMin));
LDEBUG(fmt::format("_xValidMax: {}", _xValidMax));
LDEBUG(fmt::format("_yValidMin: {}", _yValidMin));
LDEBUG(fmt::format("_yValidMax: {}", _yValidMax));
LDEBUG(fmt::format("_zValidMin: {}", _zValidMin));
LDEBUG(fmt::format("_zValidMax: {}", _zValidMax));
return true;
}
@@ -203,7 +205,7 @@ float* KameleonWrapper::getUniformSampledValues(
const glm::size3_t& outDimensions)
{
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
LINFO("Loading variable " << var << " from CDF data with a uniform sampling");
LINFO(fmt::format("Loading variable {} from CDF data with a uniform sampling", var));
unsigned int size = static_cast<unsigned int>(
outDimensions.x * outDimensions.y * outDimensions.z
@@ -218,8 +220,8 @@ float* KameleonWrapper::getUniformSampledValues(
double stepY = (_yMax-_yMin)/(static_cast<double>(outDimensions.y));
double stepZ = (_zMax-_zMin)/(static_cast<double>(outDimensions.z));
LDEBUG(var << "Min: " << varMin);
LDEBUG(var << "Max: " << varMax);
LDEBUG(fmt::format("{} Min: {}", var, varMin));
LDEBUG(fmt::format("{} Max: {}", var, varMax));
// HISTOGRAM
const int bins = 200;
@@ -348,7 +350,7 @@ float* KameleonWrapper::getUniformSampledValues(
// LDEBUG("====================");
break;
}
LDEBUG("histogram[" << i << "]: " << histogram[i]);
LDEBUG(fmt::format("histogram[{}]: {}", i, histogram[i]));
}
double dist = varMax - varMin;
@@ -362,10 +364,10 @@ float* KameleonWrapper::getUniformSampledValues(
data[i] = static_cast<float>(glm::clamp(normalizedVal, 0.0, 1.0));
if(data[i] < 0.0) {
LERROR("Datapoint " << i << " less than 0");
LERROR(fmt::format("Datapoint {} less than 0", i));
}
if(data[i] > 1.0) {
LERROR("Datapoint " << i << " more than 1");
LERROR(fmt::format("Datapoint {} more than 1", i));
}
}
@@ -384,7 +386,10 @@ float* KameleonWrapper::getUniformSliceValues(const std::string& var,
const float& slice)
{
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
LINFO("Loading variable " << var << " from CDF data with a uniform sampling");
LINFO(fmt::format(
"Loading variable {} from CDF data with a uniform sampling",
var
));
unsigned int size = static_cast<unsigned int>(
outDimensions.x * outDimensions.y * outDimensions.z
@@ -409,8 +414,8 @@ float* KameleonWrapper::getUniformSliceValues(const std::string& var,
double yDim = (!ySlice)? outDimensions.y-1 : 1.0;
double zDim = (!zSlice)? outDimensions.z-1 : 1.0;
LDEBUG(var << "Min: " << varMin);
LDEBUG(var << "Max: " << varMax);
LDEBUG(fmt::format("{} min: {}", var, varMin));
LDEBUG(fmt::format("{} max: {}", var, varMax));
//double maxValue = 0.0;
//double minValue = std::numeric_limits<double>::max();
@@ -513,10 +518,13 @@ float* KameleonWrapper::getUniformSampledVectorValues(const std::string& xVar,
const glm::size3_t& outDimensions)
{
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
LINFO(
"Loading variables " << xVar << " " << yVar << " " << zVar <<
" from CDF data with a uniform sampling"
);
LINFO(fmt::format(
"loading variables {} {} {} from CDF data with a uniform sampling",
xVar,
yVar,
zVar
));
int channels = 4;
unsigned int size = static_cast<unsigned int>(
@@ -590,10 +598,13 @@ KameleonWrapper::Fieldlines KameleonWrapper::getClassifiedFieldLines(
float stepSize )
{
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
LINFO(
"Creating " << seedPoints.size() << " fieldlines from variables " <<
xVar << " " << yVar << " " << zVar
);
LINFO(fmt::format(
"Creating {} fieldlines from variables {} {} {}",
seedPoints.size(),
xVar,
yVar,
zVar
));
std::vector<glm::vec3> fLine, bLine;
std::vector<std::vector<LinePoint> > fieldLines;
@@ -647,10 +658,13 @@ KameleonWrapper::Fieldlines KameleonWrapper::getFieldLines(const std::string& xV
const std::vector<glm::vec3>& seedPoints, float stepSize, const glm::vec4& color)
{
ghoul_assert(_model && _interpolator, "Model and interpolator must exist");
LINFO(
"Creating " << seedPoints.size() << " fieldlines from variables " <<
xVar << " " << yVar << " " << zVar
);
LINFO(fmt::format(
"Creating {} fieldlines from variables {} {} {}",
seedPoints.size(),
xVar,
yVar,
zVar
));
std::vector<glm::vec3> fLine, bLine;
Fieldlines fieldLines;
@@ -698,7 +712,7 @@ KameleonWrapper::Fieldlines KameleonWrapper::getFieldLines(const std::string& xV
KameleonWrapper::Fieldlines KameleonWrapper::getLorentzTrajectories(
const std::vector<glm::vec3>& seedPoints,const glm::vec4& /*color*/, float stepsize)
{
LINFO("Creating " << seedPoints.size() << " Lorentz force trajectories");
LINFO(fmt::format("Creating {} Lorentz force trajectories", seedPoints.size()));
Fieldlines trajectories;
std::vector<glm::vec3> plusTraj, minusTraj;
@@ -926,7 +940,7 @@ KameleonWrapper::TraceLine KameleonWrapper::traceCartesianFieldline(
++numSteps;
if (numSteps > maxSteps) {
LDEBUG("Max number of steps taken (" << maxSteps <<")");
LDEBUG(fmt::format("Max number of steps taken ({})", maxSteps));
break;
}
}
@@ -1031,7 +1045,7 @@ KameleonWrapper::TraceLine KameleonWrapper::traceLorentzTrajectory(
++numSteps;
if (numSteps > maxSteps) {
LDEBUG("Max number of steps taken (" << maxSteps <<")");
LDEBUG(fmt::format("Max number of steps taken ({})", maxSteps));
break;
}
}

View File

@@ -24,6 +24,7 @@
#include <modules/kameleonvolume/kameleonvolumereader.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/filesystem/file.h>
#include <ghoul/filesystem/filesystem.h>
#ifdef WIN32
@@ -43,6 +44,8 @@
#pragma warning (pop)
#endif // WIN32
#include <ghoul/fmt.h>
namespace {
constexpr const char* _loggerCat = "KameleonVolumeReader";
} // namespace
@@ -54,13 +57,13 @@ KameleonVolumeReader::KameleonVolumeReader(const std::string& path)
: _path(path)
{
if (!FileSys.fileExists(path)) {
LERROR(_path << " does not exist");
LERROR(fmt::format("'{}' does not exist", _path));
throw ghoul::FileNotFoundError(_path);
}
long status = _kameleon.open(_path);
if (status != ccmc::FileReader::OK) {
LERROR("Failed to open file " << _path << " with Kameleon");
LERROR(fmt::format("Failed to open file '{}' with Kameleon", _path));
throw ghoul::RuntimeError("Failed to open file: " + _path + " with Kameleon");
return;
}

View File

@@ -332,14 +332,13 @@ void RenderableKameleonVolume::updateRaycasterModelTransform() {
_raycaster->setModelTransform(modelTransform);
}
bool RenderableKameleonVolume::cachingEnabled() {
return _cache;
}
void RenderableKameleonVolume::load() {
if (!FileSys.fileExists(ghoul::filesystem::File(_sourcePath))) {
LERROR("File " << _sourcePath << " does not exist.");
LERROR(fmt::format("File '{}' does not exist.", _sourcePath.value()));
return;
}
if (!cachingEnabled()) {

View File

@@ -30,6 +30,7 @@
#include <iostream>
#include <fstream>
#include <ghoul/fmt.h>
namespace {
constexpr const char* _loggerCat = "BrickManager";
@@ -68,20 +69,29 @@ bool BrickManager::readHeader() {
_header = _tsp->header();
LDEBUG("Grid type: " << _header.gridType_);
LDEBUG("Original num timesteps: " << _header.numOrigTimesteps_);
LDEBUG("Num timesteps: " << _header.numTimesteps_);
LDEBUG("Brick dims: " << _header.xBrickDim_ << " " << _header.yBrickDim_ << " " << _header.zBrickDim_);
LDEBUG("Num bricks: " << _header.xNumBricks_ << " " << _header.yNumBricks_ << " " << _header.zNumBricks_);
LDEBUG("");
LDEBUG(fmt::format("Grid type: {}", _header.gridType_));
LDEBUG(fmt::format("Original num timesteps: {}", _header.numOrigTimesteps_));
LDEBUG(fmt::format("Num timesteps: {}", _header.numTimesteps_));
LDEBUG(fmt::format(
"Brick dims: {} {} {}",
_header.xBrickDim_,
_header.yBrickDim_,
_header.zBrickDim_
));
LDEBUG(fmt::format(
"Num bricks: {} {} {}",
_header.xNumBricks_,
_header.yNumBricks_,
_header.zNumBricks_
));
brickDim_ = _header.xBrickDim_;
numBricks_ = _header.xNumBricks_;
paddedBrickDim_ = brickDim_ + paddingWidth_ * 2;
atlasDim_ = paddedBrickDim_*numBricks_;
LDEBUG("Padded brick dim: " << paddedBrickDim_);
LDEBUG("Atlas dim: " << atlasDim_);
LDEBUG(fmt::format("Padded brick dim: {}", paddedBrickDim_));
LDEBUG(fmt::format("Atlas dim: {}", atlasDim_));
numBrickVals_ = paddedBrickDim_*paddedBrickDim_*paddedBrickDim_;
// Number of bricks per frame
@@ -92,11 +102,11 @@ bool BrickManager::readHeader() {
unsigned int numOTNodes = static_cast<unsigned int>((pow(8, numOTLevels) - 1) / 7);
unsigned int numBSTNodes = static_cast<unsigned int>(_header.numTimesteps_ * 2 - 1);
numBricksTree_ = numOTNodes * numBSTNodes;
LDEBUG("Num OT levels: " << numOTLevels);
LDEBUG("Num OT nodes: " << numOTNodes);
LDEBUG("Num BST nodes: " << numBSTNodes);
LDEBUG("Num bricks in tree: " << numBricksTree_);
LDEBUG("Num values per brick: " << numBrickVals_);
LDEBUG(fmt::format("Num OT levels: {}", numOTLevels));
LDEBUG(fmt::format("Num OT nodes: {}", numOTNodes));
LDEBUG(fmt::format("Num BST nodes: {}", numBSTNodes));
LDEBUG(fmt::format("Num bricks in tree: {}", numBricksTree_));
LDEBUG(fmt::format("Num values per brick: {}", numBrickVals_));
brickSize_ = sizeof(float)*numBrickVals_;
volumeSize_ = brickSize_*numBricksFrame_;
@@ -110,8 +120,8 @@ bool BrickManager::readHeader() {
if (fileSize != calcFileSize) {
LERROR("Sizes don't match");
LERROR("calculated file size: " << calcFileSize);
LERROR("file size: " << fileSize);
LERROR(fmt::format("Calculated file size: {}", calcFileSize));
LERROR(fmt::format("File size: {}", fileSize));
return false;
}

View File

@@ -33,6 +33,7 @@
#include <openspace/util/progressbar.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/fmt.h>
namespace {
constexpr const char* _loggerCat = "ErrorHistogramManager";
@@ -62,7 +63,7 @@ bool ErrorHistogramManager::buildHistograms(int numBins) {
_numInnerNodes = _tsp->numTotalNodes() - numOtLeaves * numBstLeaves;
_histograms = std::vector<Histogram>(_numInnerNodes);
LINFO("Build " << _numInnerNodes << " histograms with " << numBins << " bins each");
LINFO(fmt::format("Build {} histograms with {} bins each", _numInnerNodes, numBins));
// All TSP Leaves
int numOtNodes = _tsp->numOTNodes();

View File

@@ -33,6 +33,7 @@
#include <openspace/util/progressbar.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/fmt.h>
namespace {
constexpr const char* _loggerCat = "LocalErrorHistogramManager";
@@ -45,7 +46,7 @@ LocalErrorHistogramManager::LocalErrorHistogramManager(TSP* tsp) : _tsp(tsp) {}
LocalErrorHistogramManager::~LocalErrorHistogramManager() {}
bool LocalErrorHistogramManager::buildHistograms(int numBins) {
LINFO("Build histograms with " << numBins << " bins each");
LINFO(fmt::format("Build histograms with {} bins each", numBins));
_numBins = numBins;
_file = &(_tsp->file());
@@ -133,7 +134,12 @@ bool LocalErrorHistogramManager::buildFromOctreeChild(unsigned int bstOffset, un
if (it != _voxelCache.end()) {
childValues = it->second;
} else {
LERROR("Child " << childIndex << " visited without cache, " << bstOffset << ", " << octreeOffset);
LERROR(fmt::format(
"Child {} visited without cache, {}, {}",
childIndex,
bstOffset,
octreeOffset
));
return false;
}
}
@@ -147,7 +153,7 @@ bool LocalErrorHistogramManager::buildFromOctreeChild(unsigned int bstOffset, un
if (it != _voxelCache.end()) {
parentValues = it->second;
} else {
LERROR("Parent " << parentIndex << " visited without cache");
LERROR(fmt::format("Parent {} visited without cache", parentIndex));
return false;
}
}
@@ -218,7 +224,7 @@ bool LocalErrorHistogramManager::buildFromBstChild(unsigned int bstOffset, unsig
if (it != _voxelCache.end()) {
childValues = it->second;
} else {
LERROR("Child " << childIndex << " visited without cache");
LERROR(fmt::format("Child {} visited without cache", childIndex));
return false;
}
}
@@ -232,7 +238,7 @@ bool LocalErrorHistogramManager::buildFromBstChild(unsigned int bstOffset, unsig
if (it != _voxelCache.end()) {
parentValues = it->second;
} else {
LERROR("Parent " << parentIndex << " visited without cache");
LERROR(fmt::format("Parent {} visited without cache", parentIndex));
return false;
}
}

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