diff --git a/data/assets/atmPaper.scene b/data/assets/atmPaper.scene new file mode 100644 index 0000000000..79a9a3955e --- /dev/null +++ b/data/assets/atmPaper.scene @@ -0,0 +1,128 @@ + +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') + +asset.require('scene/solarsystem/sun/sun') +asset.request('scene/solarsystem/planets/earth/earth') +asset.request('scene/solarsystem/planets/earth/atmosphere') +asset.request('scene/solarsystem/planets/earth/markers') +asset.request('scene/solarsystem/planets/earth/moon/moon') +asset.request('scene/solarsystem/planets/mars/mars') +asset.request('scene/solarsystem/planets/mars/atmosphere') +asset.require('scene/digitaluniverse/milkyway') +asset.require('scene/digitaluniverse/stars') +--assetHelper.requestAll(asset, 'scene/digitaluniverse') + + +-- Load default key bindings applicable to most scenes +asset.require('util/default_keybindings') +asset.require('util/default_dashboard') +asset.require('util/default_joystick') + +-- Load web gui +local webGui = asset.require('util/webgui') + +asset.request('customization/globebrowsing') + +-- Keybindings that are specific for this scene +local Keybindings = { + { + Key = "b", + Name = "Toggle background", + Command = propertyHelper.invert('Scene.MilkyWay.Renderable.Enabled') .. + propertyHelper.invert('Scene.Stars.Renderable.Enabled'), + Documentation = "Toggle background (Stars and Milkyway).", + GuiPath = "/Rendering", + Local = false + }, + { + Key = "g", + Name = "Toggle background/shading", + Command = propertyHelper.invert('Scene.MilkyWay.Renderable.Enabled') .. + propertyHelper.invert('Scene.Stars.Renderable.Enabled') .. + propertyHelper.invert('Scene.Earth.Renderable.Layers.NightLayers.Earth_at_Night_2012.Enabled') .. + propertyHelper.invert('Scene.EarthAtmosphere.Renderable.Enabled') .. + propertyHelper.invert('Scene.MarsAtmosphere.Renderable.Enabled') .. + propertyHelper.invert('Scene.Earth.Renderable.Layers.WaterMasks.MODIS_Water_Mask.Enabled') .. + propertyHelper.invert('Scene.Moon.Renderable.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", + GuiPath = "/Rendering", + Local = false + }, + { + Key = "h", + Name="Toggle Trails", + Command = "local list = openspace.getProperty('{planetTrail_solarSystem}.Renderable.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end\n" .. + "local moonlist = openspace.getProperty('{moonTrail_solarSystem}.Renderable.Enabled'); for _,v in pairs(moonlist) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end", + Documentation = "Toggles the visibility of planet and moon trails", + GuiPath = "/Rendering", + Local = false + }, + { + Key = "l", + Name = "Toggle planet labels", + Command = "local list = openspace.getProperty('{solarsystem_labels}.Renderable.Enabled'); for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end", + Documentation = "Turns on visibility for all solar system labels", + GuiPath = "/Rendering", + Local = false + }, + { + Key = "r", + Name = "Toggle Rendering Time Saving", + Command = propertyHelper.invert('Dashboard.Framerate.EnableFPSRecording'), + Documentation = "Toogles FPS Delta time saving", + GuiPath = "/Rendering", + Local = false + }, + { + Key = "m", + Name = "Toggle Marks Saving", + Command = propertyHelper.invert('Dashboard.Framerate.MarkPointInterest'), + Documentation = "Toogles Marks saving", + GuiPath = "/Rendering", + Local = false + } + +} + +asset.onInitialize(function () + webGui.setCefRoute("onscreen") + + sceneHelper.bindKeys(Keybindings) + openspace.setDefaultGuiSorting() + + openspace.globebrowsing.loadWMSServersFromFile( + openspace.absPath("${DATA}/globebrowsing_servers.lua") + ) +end) + +asset.onDeinitialize(function () + sceneHelper.unbindKeys(Keybindings) +end) + + + +local earthAsset = asset.require('scene/solarsystem/planets/earth/earth') +--asset.require('scene/solarsystem/planets/earth/satellites/satellites.asset') + + +asset.onInitialize(function () + local now = openspace.time.currentWallTime() + -- Jump back one day to be able to show complete weather data on Earth. + openspace.time.setTime(openspace.time.advancedTime(now, "-1d")) + + openspace.globebrowsing.goToGeo("Earth", 58.5877, 16.1924, 20000000) + + openspace.markInterestingNodes({ "Earth", "Mars", "Moon", "Sun" }) + + --openspace.setPropertyValue("{earth_satellites}.Renderable.Enabled", false) +end) + +asset.onDeinitialize(function () + openspace.removeInterestingNodes({ "Earth", "Mars", "Moon", "Sun" }) +end) diff --git a/modules/base/dashboard/dashboarditemframerate.cpp b/modules/base/dashboard/dashboarditemframerate.cpp index 7e7c31f59b..656842a2b5 100644 --- a/modules/base/dashboard/dashboarditemframerate.cpp +++ b/modules/base/dashboard/dashboarditemframerate.cpp @@ -32,6 +32,12 @@ #include #include + //JCC: Temp property to save the fps to a file +#include +#include +#include +#include + namespace { constexpr const char* KeyFontMono = "Mono"; constexpr const float DefaultFontSize = 10.f; @@ -178,12 +184,47 @@ documentation::Documentation DashboardItemFramerate::Documentation() { }; } +//JCC: Temp property to save the fps to a file +DashboardItemFramerate::~DashboardItemFramerate() +{ + _runThread = false; // bad, but is just for collecting the data + + std::string fpsFileS("fpsData.txt"), deltaTimeFileS("deltaTimeData.txt"), marksFileS("marksData.txt"); + std::fstream fpsFile, deltaTimeFile, marksFile; + + fpsFile.open(fpsFileS.c_str(), std::fstream::out); + deltaTimeFile.open(deltaTimeFileS.c_str(), std::fstream::out); + marksFile.open(marksFileS.c_str(), std::fstream::out); + + if (fpsFile.is_open() && deltaTimeFile.is_open() && marksFile.is_open()) { + + std::cout << "\nWriting FPS to file..."; + for (int i = 0; i < _currentFrameRecording; ++i) { + fpsFile << _fpsRecordings[i] << std::endl; + deltaTimeFile << _deltaTRecordings[i] << std::endl; + } + + for (int j = 0; j < _numberMarkedItems; ++j) { + marksFile << _markRecordings[j] << std::endl; + } + + fpsFile.close(); + deltaTimeFile.close(); + marksFile.close(); + + std::cout << "end!\n"; + } +} + DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictionary) : DashboardItem(dictionary) , _fontName(FontNameInfo, KeyFontMono) , _fontSize(FontSizeInfo, DefaultFontSize, 6.f, 144.f, 1.f) , _frametimeType(FrametimeInfo, properties::OptionProperty::DisplayType::Dropdown) , _clearCache(ClearCacheInfo) + //JCC: Temp property to save the fps to a file + , _enableFPSRecording({"EnableFPSRecording", "Enable FPS Recording", ""}, false) + , _markTimeRecording({"MarkPointInterest", "Mark Point of Interest", ""}, false) { documentation::testSpecificationAndThrow( Documentation(), @@ -261,9 +302,33 @@ DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictiona }); addProperty(_clearCache); + //JCC: Temp property to save the fps to a file + addProperty(_enableFPSRecording); + addProperty(_markTimeRecording); + _runThread = true; + _dataCollectingThread = std::thread([this] { this->threadFunction(); }); + _dataCollectingThread.detach(); + _font = global::fontManager.font(_fontName, _fontSize); } +//JCC: Temp property to save the fps to a file +void DashboardItemFramerate::threadFunction() { + while (_runThread) + { + std::this_thread::sleep_for(std::chrono::seconds(1)); + //std::cout << "One Second!" << std::endl; + if (_enableFPSRecording) { + float avgDeltaTime = openspace::global::windowDelegate.averageDeltaTime(); + _fpsRecordings[_currentFrameRecording] = 1.f / avgDeltaTime; + _deltaTRecordings[_currentFrameRecording++] = avgDeltaTime * 1000.f; + } + if (_markTimeRecording) { + _markRecordings[_numberMarkedItems++] = _currentFrameRecording; + } + } +} + void DashboardItemFramerate::render(glm::vec2& penPosition) { if (_shouldClearCache) { _minDeltaTimeCache = 1.0; diff --git a/modules/base/dashboard/dashboarditemframerate.h b/modules/base/dashboard/dashboarditemframerate.h index 2b1b8c2de9..e6b538b9fb 100644 --- a/modules/base/dashboard/dashboarditemframerate.h +++ b/modules/base/dashboard/dashboarditemframerate.h @@ -30,8 +30,12 @@ #include #include #include +#include #include +//JCC: Temp property to save the fps to a file +#include + namespace ghoul { class Dictionary; } namespace ghoul::fontrendering { class Font; } @@ -57,12 +61,29 @@ public: glm::vec2 size() const override; static documentation::Documentation Documentation(); + //JCC: Temp property to save the fps to a file + ~DashboardItemFramerate(); + + //JCC: Temp property to save the fps to a file + void threadFunction(); + private: properties::StringProperty _fontName; properties::FloatProperty _fontSize; properties::OptionProperty _frametimeType; properties::TriggerProperty _clearCache; + //JCC: Temp property to save the fps to a file + properties::BoolProperty _enableFPSRecording; + properties::BoolProperty _markTimeRecording; + int _markRecordings[100] = { -1 }; + float _fpsRecordings[1200] = { -1.f }; + float _deltaTRecordings[1200] = { -1.f }; + std::size_t _currentFrameRecording = 0; + int _numberMarkedItems = 0; + std::thread _dataCollectingThread; + bool _runThread = false; + std::shared_ptr _font; double _minDeltaTimeCache = 1.0; diff --git a/openspace.cfg b/openspace.cfg index 47df848530..73d1e141ae 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -6,10 +6,10 @@ -- occurs in a single window, a fisheye projection, or a dome cluster system -- A regular 1280x720 window -SGCTConfig = sgct.config.single{} +-- SGCTConfig = sgct.config.single{} -- A regular 1920x1080 window --- SGCTConfig = sgct.config.single{1920, 1080} +SGCTConfig = sgct.config.single{1920, 1080} -- A windowed 1920x1080 fullscreen -- SGCTConfig = sgct.config.single{1920, 1080, border=false, windowPos={0,0}} @@ -95,11 +95,11 @@ Paths = { ModuleConfigurations = { GlobeBrowsing = { - WMSCacheEnabled = false, + WMSCacheEnabled = true, -- OfflineMode = true, -- NoWarning = true, WMSCacheLocation = "${BASE}/cache_gdal", - WMSCacheSize = 1024, -- in megabytes PER DATASET + WMSCacheSize = 2048, -- in megabytes PER DATASET TileCacheSize = 2048 -- for all globes (CPU and GPU memory) }, Sync = {