diff --git a/data/assets/scene/solarsystem/heliosphere/bastille_day/magnetogram_textures.asset b/data/assets/scene/solarsystem/heliosphere/bastille_day/magnetogram_textures.asset index 05f3de2637..b2d5f45c02 100644 --- a/data/assets/scene/solarsystem/heliosphere/bastille_day/magnetogram_textures.asset +++ b/data/assets/scene/solarsystem/heliosphere/bastille_day/magnetogram_textures.asset @@ -8,27 +8,30 @@ local magnetograms = openspace.walkDirectoryFiles(magnetogramDirectory); local switch_color_layer = { Identifier = "magnetogram_texture.switch_color_layer", Name = "Next sun texture", - Command = "local textureList = openspace.globebrowsing.getLayers('Sun', 'ColorLayers');" .. - "if (textureIndex == -1) then " .. - "textureIndex = 2;" .. - "end;" .. - "textureIndex = textureIndex + 1;" .. - "if (textureIndex >= #textureList) then " .. - "textureIndex = 0;" .. - "end;" .. - "openspace.setPropertyValue(\"Scene.Sun.Renderable.Layers.ColorLayers.*.Enabled\", false);" .. - "if (textureIndex == 0) then " .. - "openspace.setPropertyValueSingle(\"Scene.Sun.Renderable.Layers.ColorLayers.Texture.Enabled\", true);" .. - "else " .. - "str = \"Scene.Sun.Renderable.Layers.ColorLayers.magnetogram-\" .. textureIndex .. \".Enabled\";" .. - "openspace.setPropertyValueSingle(str, true);" .. - "end;", + Command = [[ + local textureList = openspace.globebrowsing.getLayers('Sun', 'ColorLayers'); + if (textureIndex == -1) then + textureIndex = 2; + end; + textureIndex = textureIndex + 1; + if (textureIndex >= #textureList) then + textureIndex = 0; + end + openspace.setPropertyValue("Scene.Sun.Renderable.Layers.ColorLayers.*.Enabled", false); + if (textureIndex == 0) then + openspace.setPropertyValueSingle("Scene.Sun.Renderable.Layers.ColorLayers.Texture.Enabled", true); + else + str = "Scene.Sun.Renderable.Layers.ColorLayers.magnetogram-" .. textureIndex .. ".Enabled"; + openspace.setPropertyValueSingle(str, true); + end; + ]], Documentation = "Display next sun texture in list of textures", GuiPath = "/Bastille-Day", IsLocal = false } asset.onInitialize(function () + rawset(_G, "textureIndex", -1) for i, imagename in ipairs(magnetograms) do openspace.globebrowsing.addLayer( 'Sun', diff --git a/data/profiles/bastille-day.profile b/data/profiles/bastille-day.profile index 0c56fd526a..2943dd9031 100644 --- a/data/profiles/bastille-day.profile +++ b/data/profiles/bastille-day.profile @@ -1,9 +1,9 @@ { "actions": [ { - "documentation": "Restart button to start of CME", + "documentation": "Reset button to start of CME", "gui_path": "/Bastille-Day", - "identifier": "profile.keybind.1", + "identifier": "bastille-day.reset_loops", "is_local": false, "name": "Reset button. Start of CME, no loop", "script": "openspace.time.setTime('2000-JUL-14 10:03:00.00');openspace.scriptScheduler.clear();" @@ -11,7 +11,7 @@ { "documentation": "New loop: Restarts time at 10:03 and stops at 10:16, sets delta time to 2 min/ second (120 seconds/ second)", "gui_path": "/Bastille-Day", - "identifier": "profile.keybind.2", + "identifier": "bastille-day.short_loop", "is_local": false, "name": "Loop 10:03 - 10:16, at 2 min/ second", "script": "openspace.scriptScheduler.clear();openspace.time.setDeltaTime(120);openspace.time.setTime('2000-JUL-14 10:03:00.00');EndtimeShortLoop = \"2000 JUL 14 10:16:00\";StarttimescriptSlowLoop = \"openspace.time.setTime('2000 JUL 14 10:03:00')\";openspace.scriptScheduler.loadScheduledScript(EndtimeShortLoop, StarttimescriptSlowLoop);" @@ -19,7 +19,7 @@ { "documentation": "New loop: Restarts time at 10:03 and stops at 11:00, delta time to 4 min/ second (240 seconds/ second)", "gui_path": "/Bastille-Day", - "identifier": "profile.keybind.3", + "identifier": "bastille-day.standard_loop", "is_local": false, "name": "Loop 10:03 - 11:00, at 4 min/ second", "script": "StarttimescriptSlowLoop = \"openspace.time.setTime('2000 JUL 14 10:03:00')\";openspace.scriptScheduler.clear();openspace.time.setDeltaTime(240);openspace.time.setTime('2000-JUL-14 10:03:00.00');openspace.scriptScheduler.loadScheduledScript('2000 JUL 14 11:00:00', StarttimescriptSlowLoop);" @@ -27,7 +27,7 @@ { "documentation": "Fast loop: Starts from 10:03 and sets delta time to 15 min/ second (900 seconds/ second)", "gui_path": "/Bastille-Day", - "identifier": "profile.keybind.4", + "identifier": "bastille-day.fast_loop", "is_local": false, "name": "Loop 10:03 - 12.00, at 15 min/ second", "script": "openspace.scriptScheduler.clear();openspace.time.setDeltaTime(900);openspace.time.setTime('2000-JUL-14 10:03:00.00');StarttimescriptSlowLoop = \"openspace.time.setTime('2000 JUL 14 10:03:00')\";openspace.scriptScheduler.loadScheduledScript('2000 JUL 14 12:00:00', StarttimescriptSlowLoop);" @@ -35,15 +35,12 @@ { "documentation": "Long loop: Restarts time at 09:30 and stops at 11:50, delta time to 4 min/ second (240 seconds/ second)", "gui_path": "/Bastille-Day", - "identifier": "profile.keybind.5", + "identifier": "bastille-day.long_loop", "is_local": false, "name": "Loop 09:30 - 11:50, at 4 min/ second", "script": "openspace.scriptScheduler.clear();openspace.time.setDeltaTime(240);openspace.time.setTime('2000-JUL-14 09:30:00.00');StarttimescriptLongLoop = \"openspace.time.setTime('2000 JUL 14 09:30:00')\";openspace.scriptScheduler.loadScheduledScript('2000 JUL 14 11:50:00', StarttimescriptLongLoop);" } ], - "additional_scripts": [ - "rawset(_G, \"textureIndex\", -1)" - ], "assets": [ "base", "dashboard/default_dashboard", @@ -92,23 +89,23 @@ ], "keybindings": [ { - "action": "profile.keybind.1", + "action": "bastille-day.reset_loops", "key": "R" }, { - "action": "profile.keybind.2", + "action": "bastille-day.short_loop", "key": "CTRL+1" }, { - "action": "profile.keybind.3", + "action": "bastille-day.standard_loop", "key": "CTRL+2" }, { - "action": "profile.keybind.4", + "action": "bastille-day.fast_loop", "key": "CTRL+3" }, { - "action": "profile.keybind.5", + "action": "bastille-day.long_loop", "key": "CTRL+4" }, { diff --git a/modules/base/rendering/renderabletimevaryingsphere.cpp b/modules/base/rendering/renderabletimevaryingsphere.cpp index 62659c5054..eb1f824b0f 100644 --- a/modules/base/rendering/renderabletimevaryingsphere.cpp +++ b/modules/base/rendering/renderabletimevaryingsphere.cpp @@ -182,8 +182,8 @@ RenderableTimeVaryingSphere::RenderableTimeVaryingSphere( , _useAdditiveBlending(UseAdditiveBlendingInfo, false) , _disableFadeInDistance(DisableFadeInOutInfo, true) , _backgroundRendering(BackgroundInfo, false) - , _fadeInThreshold(FadeInThresholdInfo, -1.f, 0.f, 1.f) - , _fadeOutThreshold(FadeOutThresholdInfo, -1.f, 0.f, 1.f) + , _fadeInThreshold(FadeInThresholdInfo, -1.f, -1.f, 1.f) + , _fadeOutThreshold(FadeOutThresholdInfo, -1.f, -1.f, 1.f) { const Parameters p = codegen::bake(dictionary); @@ -220,7 +220,7 @@ RenderableTimeVaryingSphere::RenderableTimeVaryingSphere( } addProperty(_orientation); - _size.setViewOption(properties::Property::ViewOptions::MinMaxRange); + _size.setExponent(20.f); _size.onChange([this]() { setBoundingSphere(_size); _sphereIsDirty = true; @@ -431,23 +431,22 @@ void RenderableTimeVaryingSphere::extractMandatoryInfoFromSourceFolder() { } // Extract all file paths from the provided folder _files.clear(); - //_sourceFiles.clear(); namespace fs = std::filesystem; for (const fs::directory_entry& e : fs::directory_iterator(sourceFolder)) { - if (e.is_regular_file()) { - - std::string filePath = e.path().string(); - double time = extractTriggerTimeFromFileName(filePath); - std::unique_ptr t = - ghoul::io::TextureReader::ref().loadTexture(filePath); - - t->setInternalFormat(GL_COMPRESSED_RGBA); - t->uploadTexture(); - t->setFilter(ghoul::opengl::Texture::FilterMode::Linear); - t->purgeFromRAM(); - - _files.push_back({ filePath, time, std::move(t) }); + if (!e.is_regular_file()) { + continue; } + std::string filePath = e.path().string(); + double time = extractTriggerTimeFromFileName(filePath); + std::unique_ptr t = + ghoul::io::TextureReader::ref().loadTexture(filePath); + + t->setInternalFormat(GL_COMPRESSED_RGBA); + t->uploadTexture(); + t->setFilter(ghoul::opengl::Texture::FilterMode::Linear); + t->purgeFromRAM(); + + _files.push_back({ filePath, time, std::move(t) }); } std::sort( @@ -485,7 +484,6 @@ void RenderableTimeVaryingSphere::update(const UpdateData& data) { { updateActiveTriggerTimeIndex(currentTime); _sphereIsDirty = true; - } // else {we're still in same state as previous frame (no changes needed)} } else { @@ -499,8 +497,9 @@ void RenderableTimeVaryingSphere::update(const UpdateData& data) { _sphereIsDirty = false; } } - // Extract J2000 time from file names - // Requires files to be named as such: 'YYYY-MM-DDTHH-MM-SS-XXX.png' + +// Extract J2000 time from file names +// Requires files to be named as such: 'YYYY-MM-DDTHH-MM-SS-XXX.png' double extractTriggerTimeFromFileName(const std::string& filePath) { // Extract the filename from the path (without extension) std::string timeString = std::filesystem::path(filePath).stem().string(); diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp index 93f0ca4d1c..1754dc85dc 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,7 @@ namespace { "Quantity used to color lines if the 'By Quantity' color method is selected." }; constexpr openspace::properties::Property::PropertyInfo ColorMinMaxInfo = { - "ColorQuantityMin", + "ColorQuantityMinMax", "ColorTable Min Value", "Value to map to the lowest and highest end of the color table." }; @@ -155,8 +156,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo LineWidthInfo = { "LineWidth", "Line Width", - "This value specifies the line width of the field lines if the " - "selected rendering method includes lines." + "This value specifies the line width of the fieldlines" }; constexpr openspace::properties::Property::PropertyInfo TimeJumpButtonInfo = { "TimeJumpToStart", @@ -173,7 +173,7 @@ namespace { // Input file type. Should be cdf, json or osfls SourceFileType inputFileType; - // Should be path to folder containing the input files + // Path to folder containing the input files std::filesystem::path sourceFolder [[codegen::directory()]]; // Path to a .txt file containing seed points. Mandatory if CDF as input. @@ -183,24 +183,22 @@ namespace { // Currently supports: batsrus, enlil & pfss std::optional simulationModel; - //sim mod - //std::optional model; - // Extra variables such as rho, p or t std::optional> extraVariables; // Which variable in CDF file to trace. b is default for fieldline std::optional tracingVariable; - // 1.f is default, assuming meters as input. // Convert the models distance unit, ex. AU for Enlil, to meters. // Can be used during runtime to scale domain limits. + // 1.f is default, assuming meters as input. std::optional scaleToMeters; - // If False (default) => Load in initializing step and store in RAM + // Set to true if you are streaming data during runtime std::optional loadAtRuntime; - // Values should be paths to .txt files + // A list of paths to transferfunction .txt files containing color tables + // used for colorizing the fieldlines according to different parameters std::optional> colorTablePaths; // [[codegen::verbatim(ColorMethodInfo.description)]] @@ -209,10 +207,12 @@ namespace { // [[codegen::verbatim(ColorQuantityInfo.description)]] std::optional colorQuantity; - // Values should be entered as {X, Y}, where X & Y are numbers + // List of ranges for which their corresponding parameters values will be + // colorized by. Should be entered as {min value, max value} per range std::optional> colorTableRanges; - // Enables Flow + // Enables flow, showing the direction, but not accurate speed, that particles + // would be traveling std::optional flowEnabled; // [[codegen::verbatim(MaskingEnabledInfo.description)]] @@ -221,7 +221,8 @@ namespace { // [[codegen::verbatim(MaskingQuantityInfo.description)]] std::optional maskingQuantity; - // Values should be entered as {{X, Y},{X, Y}} where X & Y are numbers + // List of ranges for which their corresponding parameters values will be + // masked by. Should be entered as {min value, max value} per range std::optional> maskingRanges; // Value should be path to folder where states are saved. Specifying this @@ -229,7 +230,7 @@ namespace { // (JSON/CDF input => osfls output & oslfs input => JSON output) std::optional outputFolder; - // Line width of line + // [[codegen::verbatim(LineWidthInfo.description)]] std::optional lineWidth; // If data sets parameter start_time differ from start of run, @@ -385,7 +386,6 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence( _lineWidth = p.lineWidth.value_or(_lineWidth); _manualTimeOffset = p.manualTimeOffset.value_or(_manualTimeOffset); _modelStr = p.simulationModel.value_or(_modelStr); - //thismodel = p.model.value_or(thismodel); _seedPointDirectory = p.seedPointDirectory.value_or(_seedPointDirectory); _maskingEnabled = p.maskingEnabled.value_or(_maskingEnabled); _maskingQuantityTemp = p.maskingQuantity.value_or(_maskingQuantityTemp); @@ -519,12 +519,10 @@ fls::Model stringToModel(std::string str) { [](char c) { return static_cast(::tolower(c)); } ); return fls::stringToModel(str); - } bool RenderableFieldlinesSequence::loadJsonStatesIntoRAM() { fls::Model model = stringToModel(_modelStr); - //fls::Model model = thismodel; if (model == fls::Model::Invalid) { return false; } @@ -597,12 +595,14 @@ void RenderableFieldlinesSequence::setupProperties() { } // Add Properties to the groups + _colorUniform.setViewOption(properties::Property::ViewOptions::Color); _colorGroup.addProperty(_colorUniform); _domainGroup.addProperty(_domainX); _domainGroup.addProperty(_domainY); _domainGroup.addProperty(_domainZ); _domainGroup.addProperty(_domainR); _flowGroup.addProperty(_flowReversed); + _flowColor.setViewOption(properties::Property::ViewOptions::Color); _flowGroup.addProperty(_flowColor); _flowGroup.addProperty(_flowParticleSize); _flowGroup.addProperty(_flowParticleSpacing); @@ -814,7 +814,7 @@ std::unordered_map> for (const fs::directory_entry& spFile : fs::directory_iterator(filePath)) { std::string seedFilePath = spFile.path().string(); if (!spFile.is_regular_file() || - seedFilePath.substr(seedFilePath.find_last_of('.')+1) != "txt") + seedFilePath.substr(seedFilePath.find_last_of('.') + 1) != "txt") { continue; } @@ -1004,8 +1004,9 @@ void RenderableFieldlinesSequence::render(const RenderData& data, RendererTasks& _shaderProgram->deactivate(); if (additiveBlending) { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDepthMask(true); + // Restores OpenGL Rendering State + global::renderEngine->openglStateCache().resetBlendState(); + global::renderEngine->openglStateCache().resetDepthState(); } } diff --git a/modules/kameleon/src/kameleonhelper.cpp b/modules/kameleon/src/kameleonhelper.cpp index b117753c9c..97bc812100 100644 --- a/modules/kameleon/src/kameleonhelper.cpp +++ b/modules/kameleon/src/kameleonhelper.cpp @@ -114,11 +114,11 @@ double getTime(ccmc::Kameleon* kameleon, double manualOffset) { } else if (kameleon->doesAttributeExist("tim_obsdate_cal")) { seqStartStr = - kameleon->getGlobalAttribute("tim_obsdate_cal").getAttributeString(); + kameleon->getGlobalAttribute("tim_obsdate_cal").getAttributeString(); } else if (kameleon->doesAttributeExist("tim_crstart_cal")) { seqStartStr = - kameleon->getGlobalAttribute("tim_crstart_cal").getAttributeString(); + kameleon->getGlobalAttribute("tim_crstart_cal").getAttributeString(); } else { LWARNING( diff --git a/modules/space/rendering/renderablefluxnodes.cpp b/modules/space/rendering/renderablefluxnodes.cpp index bf0472dc25..30cd6018eb 100644 --- a/modules/space/rendering/renderablefluxnodes.cpp +++ b/modules/space/rendering/renderablefluxnodes.cpp @@ -48,10 +48,8 @@ #include namespace { - // log category constexpr const char* _loggerCat = "RenderableFluxNodes"; - //streamColor, nodeSize, nodeSizeLargerFlux, thresholdFlux, constexpr const std::array UniformNames = { "streamColor", "nodeSize", "proximityNodesSize", "thresholdFlux", "colorMode", "filterLower", "filterUpper", "scalingMode", @@ -67,8 +65,8 @@ namespace { "GoesEnergy", "GOES Energy", "Select which energy bin you want to show. GOES = Geostationary Operational " - "Environmental Satellites Emin01 is values > 10 Mev, " - "Default is Emin03 where values > 100 Mev." + "Environmental Satellites. Emin01 is values > 10 MeV, " + "Default is Emin03 where values > 100 MeV." }; constexpr openspace::properties::Property::PropertyInfo ColorModeInfo = { "ColorMode", @@ -89,7 +87,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo NodeSizeInfo = { "NodeSize", "Size of nodes", - "Change the size of the nodes" + "Change the size of the rendered points of the nodes" }; constexpr openspace::properties::Property::PropertyInfo ThresholdFluxInfo = { "ThresholdFlux", diff --git a/modules/space/rendering/renderabletravelspeed.h b/modules/space/rendering/renderabletravelspeed.h index b89d3ba1f9..3ac18de100 100644 --- a/modules/space/rendering/renderabletravelspeed.h +++ b/modules/space/rendering/renderabletravelspeed.h @@ -27,8 +27,8 @@ #include -#include #include +#include #include namespace openspace { diff --git a/modules/space/shaders/fluxnodes_vs.glsl b/modules/space/shaders/fluxnodes_vs.glsl index 2a3728552e..e112c5bda0 100644 --- a/modules/space/shaders/fluxnodes_vs.glsl +++ b/modules/space/shaders/fluxnodes_vs.glsl @@ -148,8 +148,7 @@ bool checkIfSkipVertex() { return false; } -void whatToDoIfCloseToEarth() { - float maxdist = 10000000000.0 * perspectiveDistanceFactor; +void setEarthProximitySettings() { float distancevec = distance(earthPos, in_position.xyz); vs_closeToEarth = 0.0; @@ -206,7 +205,7 @@ void main() { else if (colorMode == uniformColor){ vs_color = streamColor; } - whatToDoIfCloseToEarth(); + setEarthProximitySettings(); } else { vs_color = vec4(0.0); diff --git a/modules/volume/rendering/renderabletimevaryingvolume.cpp b/modules/volume/rendering/renderabletimevaryingvolume.cpp index 46ffc7e187..fabc33c927 100644 --- a/modules/volume/rendering/renderabletimevaryingvolume.cpp +++ b/modules/volume/rendering/renderabletimevaryingvolume.cpp @@ -119,7 +119,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo rUpperBoundInfo = { "RUpperBound", "Radius upper bound", - "Limit the volumes radiues." + "Limit the volume's radius" }; struct [[codegen::Dictionary(RenderableTimeVaryingVolume)]] Parameters {