Merge branch 'master' into thesis/2025/black-hole

This commit is contained in:
Wilhelm Björkström
2025-05-08 16:47:37 +02:00
37 changed files with 379 additions and 40 deletions

View File

@@ -0,0 +1,9 @@
{
"data": [
[ "2024-05-10T00:00:00Z", 2.33 ],
[ "2024-05-10T03:00:00Z", 3 ],
[ "2024-05-10T06:00:00Z", 3 ],
[ "2024-05-10T09:00:00Z", 2.67 ],
[ "2024-05-10T12:00:00Z", 2.33 ]
]
}

View File

@@ -0,0 +1,16 @@
-- Basic
-- This example shows how to create a time-varying text dashboard item.
local Item = {
Type = "DashboardItemTimeVaryingText",
Identifier = "DashboardItemTimeVaryingText_Example",
DataFile = asset.resource("data/dummydata.json"),
}
asset.onInitialize(function()
openspace.dashboard.addDashboardItem(Item)
end)
asset.onDeinitialize(function()
openspace.dashboard.removeDashboardItem(Item)
end)

View File

@@ -0,0 +1,19 @@
-- Styled
-- This example shows how to create a time-varying text dashboard item.
-- It has a custom font size and text before the time varying text.
local Item = {
Type = "DashboardItemTimeVaryingText",
Identifier = "DashboardItemTimeVaryingText_Example-Styled",
DataFile = asset.resource("data/dummydata.json"),
FormatString = "Observed KP index: {}",
FontSize = 40
}
asset.onInitialize(function()
openspace.dashboard.addDashboardItem(Item)
end)
asset.onDeinitialize(function()
openspace.dashboard.removeDashboardItem(Item)
end)

View File

@@ -4,7 +4,7 @@ local guiCustomization = asset.require("customization/gui")
-- Select which commit hashes to use for the UI frontend
local frontendHash = "f899267b30691a10c8833c0afccc16976797d0fe"
local frontendHash = "8c454895b301ba2d9d1b845b5ba506d3f4c887b9"
-- The name of the file to download from the server
local file = "frontend.zip"

View File

@@ -59,7 +59,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "This profile shows approximately 936,000 asteroids from the JPL Horizons Small-Body Database (SBDB). Included in this profile (and defined on our wiki): Amor Asteroids, Apollo Asteroids, Aten Asteroids, Atira Asteroids, Centaur Asteroids, Chiron-Type Comets, Encke-Type Comets, Halley-Type Comets, Inner Main Asteroid Belt Asteroids, Jupiter Family Comets, Jupiter Trojan Asteroids, Main Asteroid Belt Asteroids, Mars-Crossing Asteroids, Outer Main Asteroid Belt Asteroids, Potentially Hazardous Asteroids (PHAs), and Trans-Neptunian Asteroids",
"description": "This profile shows approximately 936,000 asteroids from the JPL Horizons Small-Body Database (SBDB). Included in this profile (and defined on our wiki): Amor Asteroids, Apollo Asteroids, Aten Asteroids, Atira Asteroids, Centaur Asteroids, Chiron-Type Comets, Encke-Type Comets, Halley-Type Comets, Inner Main Asteroid Belt Asteroids, Jupiter Family Comets, Jupiter Trojan Asteroids, Main Asteroid Belt Asteroids, Mars-Crossing Asteroids, Outer Main Asteroid Belt Asteroids, Potentially Hazardous Asteroids (PHAs), and Trans-Neptunian Asteroids.",
"license": "MIT License",
"name": "Asteroids",
"url": "https://www.openspaceproject.com",

View File

@@ -59,7 +59,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "Default OpenSpace Profile. Adds Earth satellites not contained in other profiles",
"description": "Default OpenSpace Profile. Adds Earth satellites not contained in other profiles.",
"license": "MIT License",
"name": "Default",
"url": "https://www.openspaceproject.com",

View File

@@ -44,7 +44,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "OpenSpace profile to highlight solar eclipses on the Earth from 1900 to 2100",
"description": "OpenSpace profile to highlight solar eclipses on the Earth from 1900 to 2100.",
"license": "MIT License",
"name": "Default",
"url": "https://www.openspaceproject.com",

View File

@@ -82,7 +82,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "This profile contains all the apollo assets in openspace. Apollo 8,11,17 and some associated materials. ",
"description": "This profile contains all the apollo assets in openspace. Apollo 8,11,17 and some associated materials.",
"license": "MIT License",
"name": "Apollo",
"url": "https://www.openspaceproject.com",

View File

@@ -56,7 +56,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "Artemis Profile. Adds the Orion capsule (Artemis-1) model with an estimated trajectery",
"description": "Artemis Profile. Adds the Orion capsule (Artemis-1) model with an estimated trajectery.",
"license": "MIT License",
"name": "Artemis",
"url": "https://www.openspaceproject.com",

View File

@@ -43,7 +43,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "Default OpenSpace Profile. Adds Earth satellites not contained in other profiles",
"description": "Default OpenSpace Profile. Adds Earth satellites not contained in other profiles.",
"license": "MIT License",
"name": "Default",
"url": "https://www.openspaceproject.com",

View File

@@ -49,7 +49,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "work in progress profile for the dawn mission",
"description": "A work in progress profile for the dawn mission.",
"license": "MIT License",
"name": "Dawn",
"url": "https://www.openspaceproject.com",

View File

@@ -34,7 +34,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "This scene contains a new rendering method to show the massive ESA Gaia stars dataset. By default, it loads the few million stars of the Gaia DR2 that contain radial velocities",
"description": "This scene contains a new rendering method to show the massive ESA Gaia stars dataset. By default, it loads the few million stars of the Gaia DR2 that contain radial velocities.",
"license": "MIT License",
"name": "Gaia",
"url": "https://www.openspaceproject.com",

View File

@@ -50,7 +50,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "Juice profile that visualizes the currently best known trajectory for the JUICE mission the Jupiter and its moons. See https://sci.esa.int/documents/33960/35865/1567260128466-JUICE_Red_Book_i1.0.pdf for more information about the JUICE mission. Currently, only the Janus and NavCam instruments are included in this profile, but the other instruments are available for a custom profile. Some of these are not behaving correctly, which will be addressed later",
"description": "Juice profile that visualizes the currently best known trajectory for the JUICE mission the Jupiter and its moons. See https://sci.esa.int/documents/33960/35865/1567260128466-JUICE_Red_Book_i1.0.pdf for more information about the JUICE mission. Currently, only the Janus and NavCam instruments are included in this profile, but the other instruments are available for a custom profile. Some of these are not behaving correctly, which will be addressed later.",
"license": "MIT License",
"name": "Juice",
"url": "https://www.openspaceproject.com",

View File

@@ -48,7 +48,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "work in progress scene for juno",
"description": "A work in progress profile for Juno.",
"license": "MIT License",
"name": "Juno",
"url": "https://www.openspaceproject.com",

View File

@@ -122,7 +122,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "James Webb Space Telescope Profile. Adds the James Webb Space Telescope model with an estimated trajectery",
"description": "James Webb Space Telescope Profile. Adds the James Webb Space Telescope model with an estimated trajectory.",
"license": "MIT License",
"name": "James Webb Space Telescope",
"url": "https://www.openspaceproject.com",

View File

@@ -54,7 +54,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "This profile shows the landing of the NASA InSight lander on Mars. The final minutes of the approach are shown with the lander finishing on the surface of Mars. This profile also includes the landing trail and model for the Mars2020 rover Perseverence. ",
"description": "This profile shows the landing of the NASA InSight lander on Mars. The final minutes of the approach are shown with the lander finishing on the surface of Mars. This profile also includes the landing trail and model for the Mars2020 rover Perseverence.",
"license": "MIT License",
"name": "Mars",
"url": "https://www.openspaceproject.com",

View File

@@ -42,7 +42,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "This scene contains model and trajectory of the NASA MESSENGER spacecraft with craft pointing data from 2011-03 to 2011-06. In addition, a rendering of Mercury's magnetosphere based on data recorded by MESSENGER can be enabled and viewed around the planet. Along with the mission data, additional maps were added to Mercury showing mineral abundances on the surface and a multi-color mosaic from the MDIS instrument",
"description": "This scene contains model and trajectory of the NASA MESSENGER spacecraft with pointing data from 2011-03 to 2011-06. In addition, a rendering of Mercury's magnetosphere based on data recorded by MESSENGER can be enabled and viewed around the planet. Along with the mission data, additional maps were added to Mercury showing mineral abundances on the surface and a multi-color mosaic from the MDIS instrument.",
"license": "MIT License",
"name": "Messenger",
"url": "https://www.openspaceproject.com",

View File

@@ -125,7 +125,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "This profile shows the acquisition of NASA New Horizons' images of the Plutonian system in July 2015. The profile starts at around 10:00 on July 14th, around 10 minutes before a new image campaign starts. By selecting Pluto as the Origin and moving time faster, you can see the imprint of the instrument's field-of-view on the planetary surface and see the images being projected. A timer on the top left of the screen shows when the next image is being taken",
"description": "This profile shows the acquisition of NASA New Horizons' images of the Plutonian system in July 2015. The profile starts at around 10:00 on July 14th, around 10 minutes before a new image campaign starts. By selecting Pluto as the Origin and moving time faster, you can see the imprint of the instrument's field-of-view on the planetary surface and see the images being projected. A timer on the top left of the screen shows when the next image is being taken.",
"license": "MIT License",
"name": "New Horizons",
"url": "https://www.openspaceproject.com",

View File

@@ -77,7 +77,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "This profile demonstrates the entire lifetime of the NASA OSIRIS-REx spacecraft on its way to the asteroid Bennu and its subsequent journey back to Earth. The profile starts at Earth around the time of the spacecraft's launch and has information throughout the entire mission until its landing back on Earth in Utah. The models of OSIRIS-REx and Bennu are available, as well as a preliminary instrument timing, which uses the same image projection technique as employed in New Horizons and Rosetta",
"description": "This profile demonstrates the entire lifetime of the NASA OSIRIS-REx spacecraft on its way to the asteroid Bennu and its subsequent journey back to Earth. The profile starts at Earth around the time of the spacecraft's launch and has information throughout the entire mission until its landing back on Earth in Utah. The models of OSIRIS-REx and Bennu are available, as well as a preliminary instrument timing, which uses the same image projection technique as employed in New Horizons and Rosetta.",
"license": "MIT License",
"name": "Osiris-Rex",
"url": "https://www.openspaceproject.com",

View File

@@ -90,7 +90,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "The Rosetta scene shows the entire mission of ESA's Rosetta spacecraft around comet 67P, also known as Churyumov-Gerasimenko. The spacecraft's images are projected onto the comet and the separation of the Philae lander is visible as well",
"description": "The Rosetta scene shows the entire mission of ESA's Rosetta spacecraft around comet 67P, also known as Churyumov-Gerasimenko. The spacecraft's images are projected onto the comet and the separation of the Philae lander is visible as well.",
"license": "MIT License",
"name": "Rosetta",
"url": "https://www.openspaceproject.com",

View File

@@ -83,7 +83,7 @@
],
"meta": {
"author": "OpenSpace Team",
"description": "This scene contains the NASA Voyager 1 and Voyager 2 missions as they were launched from Earth in the 1970s and observed the gas giants in the Solar System. The spacecraft models are included and are pointed accurately throughout the mission. Position and orientation information are available until the second half of the 21st century",
"description": "This scene contains the NASA Voyager 1 and Voyager 2 missions as they were launched from Earth in the 1970s and observed the gas giants in the Solar System. The spacecraft models are included and are pointed accurately throughout the mission. Position and orientation information are available until the second half of the 21st century.",
"license": "MIT License",
"name": "Voyager",
"url": "https://www.openspaceproject.com",

View File

@@ -110,7 +110,7 @@
],
"meta": {
"author": "CCMC",
"description": "This profile is showing the Coronal mass ejection of the bastille day 2000-07-14. The profile is data intensive and will require a powerful GPU",
"description": "This profile is showing the Coronal mass ejection of the bastille day 2000-07-14. The profile is data intensive and will require a powerful GPU.",
"license": "MIT License",
"name": "Bastille day 2000",
"url": "https://www.openspaceproject.com",

View File

@@ -63,7 +63,7 @@
],
"meta": {
"author": "Community Coordinated Modeling Center, NASA Goddard",
"description": "This profile is showing several coronal mass ejection (CMEs) during July 2012, where the last one was incredible intense. Its strength was comparable to the most intense CME in recorded history, the Carrington Event of 1859, which caused damage to electric equipment world wide. Luckily this 2012 event missed earth. The event is modeled with ENLIL which spands across the solarsystem, from the Sun to Earth, Batsrus which is showing the interaction of the flow of the solar wind and Earths magnetosphere. There is also one time step of the PFSS model showing the Suns local magnetic structure",
"description": "This profile is showing several coronal mass ejection (CMEs) during July 2012, where the last one was incredible intense. Its strength was comparable to the most intense CME in recorded history, the Carrington Event of 1859, which caused damage to electric equipment world wide. Luckily this 2012 event missed earth. The event is modeled with ENLIL which spands across the solarsystem, from the Sun to Earth, Batsrus which is showing the interaction of the flow of the solar wind and Earths magnetosphere. There is also one time step of the PFSS model showing the Suns local magnetic structure.",
"license": "MIT License",
"name": "Solar storm 2012",
"url": "https://www.openspaceproject.com",

View File

@@ -38,6 +38,7 @@ set(HEADER_FILES
dashboard/dashboarditemsimulationincrement.h
dashboard/dashboarditemspacing.h
dashboard/dashboarditemtext.h
dashboard/dashboarditemtimevaryingtext.h
dashboard/dashboarditemvelocity.h
lightsource/cameralightsource.h
lightsource/scenegraphlightsource.h
@@ -112,6 +113,7 @@ set(SOURCE_FILES
dashboard/dashboarditemsimulationincrement.cpp
dashboard/dashboarditemspacing.cpp
dashboard/dashboarditemtext.cpp
dashboard/dashboarditemtimevaryingtext.cpp
dashboard/dashboarditemvelocity.cpp
lightsource/cameralightsource.cpp
lightsource/scenegraphlightsource.cpp

View File

@@ -37,6 +37,7 @@
#include <modules/base/dashboard/dashboarditemsimulationincrement.h>
#include <modules/base/dashboard/dashboarditemspacing.h>
#include <modules/base/dashboard/dashboarditemtext.h>
#include <modules/base/dashboard/dashboarditemtimevaryingtext.h>
#include <modules/base/dashboard/dashboarditemvelocity.h>
#include <modules/base/lightsource/cameralightsource.h>
#include <modules/base/lightsource/scenegraphlightsource.h>
@@ -145,6 +146,9 @@ void BaseModule::internalInitialize(const ghoul::Dictionary&) {
);
fDashboard->registerClass<DashboardItemSpacing>("DashboardItemSpacing");
fDashboard->registerClass<DashboardItemText>("DashboardItemText");
fDashboard->registerClass<DashboardItemTimeVaryingText>(
"DashboardItemTimeVaryingText"
);
fDashboard->registerClass<DashboardItemVelocity>("DashboardItemVelocity");
@@ -264,6 +268,7 @@ std::vector<documentation::Documentation> BaseModule::documentations() const {
DashboardItemSimulationIncrement::Documentation(),
DashboardItemSpacing::Documentation(),
DashboardItemText::Documentation(),
DashboardItemTimeVaryingText::Documentation(),
DashboardItemVelocity::Documentation(),
CameraLightSource::Documentation(),

View File

@@ -0,0 +1,186 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2025 *
* *
* 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. *
****************************************************************************************/
#include <modules/base/dashboard/dashboarditemtimevaryingtext.h>
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <openspace/engine/globals.h>
#include <openspace/json.h>
#include <openspace/util/timemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/logmanager.h>
#include <fstream>
namespace {
constexpr openspace::properties::Property::PropertyInfo FormatStringInfo = {
"FormatString",
"Format String",
"The format text describing how this dashboard item renders its text. This text "
"must contain exactly one {} which is a placeholder that will be replaced "
"with the values read from the file provided in `DataFile`",
openspace::properties::Property::Visibility::AdvancedUser
};
constexpr openspace::properties::Property::PropertyInfo DataFileInfo = {
"DataFile",
"Data File Path",
"The file path to the JSON data.",
openspace::properties::Property::Visibility::User
};
// This `DashboardItem` displays text based on the content of a provided data file. The
// value that is displayed depends on the current in-game simulation time.
// The JSON must contain a 'data' array with timestamp-value pairs. Example format:
// {\"data\": [[\"2024-05-10T00:00:00Z\", 2.33], [\"2024-05-10T03:00:00Z\", 3.0]]}
struct [[codegen::Dictionary(DashboardItemTimeVaryingText)]] Parameters {
// [[codegen::verbatim(FormatStringInfo.description)]]
std::optional<std::string> formatString;
// [[codegen::verbatim(DataFileInfo.description)]]
std::string dataFile;
};
#include "dashboarditemtimevaryingtext_codegen.cpp"
} // namespace
namespace openspace {
documentation::Documentation DashboardItemTimeVaryingText::Documentation() {
return codegen::doc<Parameters>(
"base_dashboarditem_timevaryingtext",
DashboardTextItem::Documentation()
);
}
DashboardItemTimeVaryingText::DashboardItemTimeVaryingText(
const ghoul::Dictionary& dictionary)
: DashboardTextItem(dictionary)
, _formatString(FormatStringInfo, "{}")
, _dataFile(DataFileInfo, "")
{
const Parameters p = codegen::bake<Parameters>(dictionary);
_formatString = p.formatString.value_or(_formatString);
addProperty(_formatString);
_dataFile = absPath(p.dataFile).string();
addProperty(_dataFile);
_dataFile.onChange([this]() {
loadDataFromJson(_dataFile);
});
loadDataFromJson(_dataFile);
}
void DashboardItemTimeVaryingText::update() {
if (_startTimes.empty()) {
_buffer.clear();
return;
}
double current = global::timeManager->time().j2000Seconds();
double first = _startTimes.front();
double last = _sequenceEndTime;
if (current >= first && current < last) {
int newIdx = updateActiveTriggerTimeIndex(current);
if (newIdx != _activeTriggerTimeIndex) {
_activeTriggerTimeIndex = newIdx;
double timeKey = _startTimes[_activeTriggerTimeIndex];
double value = _data[timeKey];
std::ostringstream oss;
oss << value;
std::string valueString = oss.str();
try {
_buffer = std::vformat(_formatString.value(),
std::make_format_args(valueString));
}
catch (const std::format_error&) {
LERRORC("DashboardItemTimeVaryingText", "Illegal format string");
}
}
}
else {
_activeTriggerTimeIndex = -1;
_buffer.clear();
}
}
void DashboardItemTimeVaryingText::loadDataFromJson(const std::string& filePath) {
std::ifstream file = std::ifstream(filePath);
if (!file.is_open()) {
throw ghoul::RuntimeError(std::format(
"Time varying text, '{}' is not a valid JSON file",
filePath
));
return;
}
nlohmann::json jsonData;
file >> jsonData;
if (jsonData.find("data") == jsonData.end()) {
throw ghoul::RuntimeError(std::format(
"Error loading JSON file. No 'data' was found in '{}'", filePath
));
}
_data.clear();
_startTimes.clear();
for (const nlohmann::json& item : jsonData["data"]) {
const std::string& timeString = item[0].get<std::string>();
double j2000Time = Time::convertTime(timeString);
double value = item[1].get<double>();
_data[j2000Time] = value;
_startTimes.push_back(j2000Time);
}
std::sort(_startTimes.begin(), _startTimes.end());
computeSequenceEndTime();
}
void DashboardItemTimeVaryingText::computeSequenceEndTime() {
if (_startTimes.size() > 1) {
double first = _startTimes.front();
double last = _startTimes.back();
double avgDuration = (last - first) / static_cast<double>(_startTimes.size() - 1);
// Extend end time so the last value remains visible for one more interval
_sequenceEndTime = last + avgDuration;
}
}
int DashboardItemTimeVaryingText::updateActiveTriggerTimeIndex(double currentTime) const {
auto it = std::upper_bound(_startTimes.begin(), _startTimes.end(), currentTime);
if (it != _startTimes.end()) {
if (it != _startTimes.begin()) {
return static_cast<int>(std::distance(_startTimes.begin(), it)) - 1;
}
return 0;
}
return static_cast<int>(_startTimes.size()) - 1;
}
}// namespace openspace

View File

@@ -0,0 +1,61 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2025 *
* *
* 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_MODULE_BASE___DASHBOARDITEMTIMEVARYINGTEXT___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMTIMEVARYINGTEXT___H__
#include <openspace/rendering/dashboardtextitem.h>
#include <openspace/properties/misc/stringproperty.h>
namespace openspace {
namespace documentation { struct Documentation; }
class DashboardItemTimeVaryingText : public DashboardTextItem {
public:
explicit DashboardItemTimeVaryingText(const ghoul::Dictionary& dictionary);
~DashboardItemTimeVaryingText() override = default;
void update() override;
static documentation::Documentation Documentation();
private:
void loadDataFromJson(const std::string& filePath);
void computeSequenceEndTime();
int updateActiveTriggerTimeIndex(double currentTime) const;
properties::StringProperty _formatString;
properties::StringProperty _dataFile;
std::unordered_map<double, double> _data;
std::vector<double> _startTimes;
int _activeTriggerTimeIndex = -1;
double _sequenceEndTime = 0.0;
};
} // namespace openspace
#endif // __OPENSPACE_MODULE_BASE___DASHBOARDITEMTIMEVARYINGTEXT___H__

View File

@@ -604,7 +604,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
, _debugProperties({
BoolProperty(ShowChunkEdgeInfo, false),
BoolProperty(LevelProjectedAreaInfo, true),
BoolProperty(ResetTileProviderInfo, false),
TriggerProperty(ResetTileProviderInfo),
BoolProperty(PerformFrustumCullingInfo, true),
IntProperty(ModelSpaceRenderingInfo, 14, 1, 22),
IntProperty(DynamicLodIterationCountInfo, 16, 4, 128)
@@ -728,6 +728,7 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
_debugPropertyOwner.addProperty(_debugProperties.showChunkEdges);
_debugPropertyOwner.addProperty(_debugProperties.levelByProjectedAreaElseDistance);
_debugProperties.resetTileProviders.onChange([&]() { _resetTileProviders = true; });
_debugPropertyOwner.addProperty(_debugProperties.resetTileProviders);
_debugPropertyOwner.addProperty(_debugProperties.performFrustumCulling);
_debugPropertyOwner.addProperty(_debugProperties.modelSpaceRenderingCutoffLevel);
@@ -998,9 +999,9 @@ void RenderableGlobe::update(const UpdateData& data) {
_cachedModelTransform = translation * rotation * scaling;
_cachedInverseModelTransform = glm::inverse(_cachedModelTransform);
if (_debugProperties.resetTileProviders) {
if (_resetTileProviders) [[unlikely]] {
_layerManager.reset();
_debugProperties.resetTileProviders = false;
_resetTileProviders = false;
}
if (_ringsComponent) {

View File

@@ -240,7 +240,7 @@ private:
struct {
properties::BoolProperty showChunkEdges;
properties::BoolProperty levelByProjectedAreaElseDistance;
properties::BoolProperty resetTileProviders;
properties::TriggerProperty resetTileProviders;
properties::BoolProperty performFrustumCulling;
properties::IntProperty modelSpaceRenderingCutoffLevel;
properties::IntProperty dynamicLodIterationCount;
@@ -300,6 +300,7 @@ private:
bool _nLayersIsDirty = true;
bool _allChunksAvailable = true;
bool _layerManagerDirty = true;
bool _resetTileProviders = false;
size_t _iterationsOfAvailableData = 0;
size_t _iterationsOfUnavailableData = 0;
Layer* _lastChangedLayer = nullptr;

View File

@@ -26,6 +26,7 @@
#include <modules/server/include/connection.h>
#include <modules/server/include/jsonconverters.h>
#include <openspace/engine/configuration.h>
#include <openspace/engine/globals.h>
#include <openspace/scene/profile.h>
@@ -36,13 +37,25 @@ bool ProfileTopic::isDone() const {
}
void ProfileTopic::handleJson(const nlohmann::json&) {
const std::string name = global::profile->meta->name.value_or("");
const nlohmann::json data = {
// @TODO (2025-04-30, emmbr) If we expose the json converters from profile.cpp, we
// could use those here instead and minimize the risk of getting the serialization of
// the data out of sync
nlohmann::json data = {
{ "uiPanelVisibility", global::profile->uiPanelVisibility },
{ "markNodes", global::profile->markNodes },
{ "name", name }
{ "filePath", global::configuration->profile }
};
if (global::profile->meta.has_value()) {
data["name"] = global::profile->meta->name.value_or("");
data["author"] = global::profile->meta->author.value_or("");
data["description"] = global::profile->meta->description.value_or("");
data["license"] = global::profile->meta->license.value_or("");
data["url"] = global::profile->meta->url.value_or("");
data["version"] = global::profile->meta->version.value_or("");
}
_connection->sendJson(wrappedPayload(data));
}

View File

@@ -33,9 +33,15 @@
function(set_current_cef_build_platform)
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(CEF_PLATFORM "macosx64" PARENT_SCOPE)
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
set(CEF_PLATFORM "macosarm64" PARENT_SCOPE)
else()
set(CEF_PLATFORM "macosx64" PARENT_SCOPE)
endif()
elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
if (CMAKE_SIZEOF_VOID_P MATCHES 8)
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64")
set(CEF_PLATFORM "linuxarm64" PARENT_SCOPE)
elseif (CMAKE_SIZEOF_VOID_P MATCHES 8)
set(CEF_PLATFORM "linux64" PARENT_SCOPE)
else ()
set(CEF_PLATFORM "linux32" PARENT_SCOPE)
@@ -52,7 +58,7 @@ endfunction ()
# Download the CEF binary distribution for |platform| and |version| to
# |download_dir|. The |CEF_ROOT| variable will be set in global scope pointing
# to the extracted location.
# Visit http://opensource.spotify.com/cefbuilds/index.html for the list of
# Visit https://cef-builds.spotifycdn.com/index.html for the list of
# supported platforms and versions.
function(download_cef platform version download_dir)

View File

@@ -57,6 +57,9 @@ CefHost::CefHost([[maybe_unused]] const std::string& helperLocation) {
settings.windowless_rendering_enabled = true;
attachDebugSettings(settings);
// cf. https://github.com/chromiumembedded/cef/issues/3685
settings.chrome_runtime = true;
#ifdef __APPLE__
// Load the CEF framework library at runtime instead of linking directly as required
// by the macOS sandbox implementation

View File

@@ -466,6 +466,17 @@ target_include_directories(openspace-core
target_link_libraries(openspace-core PUBLIC nlohmann_json)
if (UNIX)
# On Arch Linux, if you have the package `oneapi` installed, this influences including
# the <exception> header and causes the header /usr/include/oneapi/tbb/task_group.h be
# pulled in, causing a compile problem
target_compile_definitions(
openspace-core
PUBLIC "_GLIBCXX_USE_TBB_PAR_BACKEND=0"
PUBLIC "_PSTL_PAR_BACKEND_SERIAL"
)
endif ()
target_precompile_headers(openspace-core PRIVATE
<openspace/json.h>
<openspace/properties/numericalproperty.h>

View File

@@ -36,7 +36,11 @@ namespace {
namespace openspace {
Ellipsoid::Ellipsoid(glm::dvec3 radii) : _radii(std::move(radii)) {
updateInternalCache();
// If the radii is equal to 0, all of the calculations below fail and result in nan's
// being raised all over the place
if (glm::length(radii) > 0.0) {
updateInternalCache();
}
}
void Ellipsoid::updateInternalCache() {
@@ -90,7 +94,7 @@ glm::dvec3 Ellipsoid::geodeticSurfaceNormalForGeocentricallyProjectedPoint(
const glm::dvec3& p) const
{
const glm::dvec3 normal = p * _cached.oneOverRadiiSquared;
return glm::normalize(normal);
return glm::length(normal) > 0.0 ? glm::normalize(normal) : normal;
}
glm::dvec3 Ellipsoid::geodeticSurfaceNormal(const Geodetic2& geodetic2) const {
@@ -143,10 +147,12 @@ double Ellipsoid::greatCircleDistance(const Geodetic2& p1, const Geodetic2& p2)
Geodetic2 Ellipsoid::cartesianToGeodetic2(const glm::dvec3& p) const {
const glm::dvec3 normal = geodeticSurfaceNormalForGeocentricallyProjectedPoint(p);
return {
std::asin(normal.z / glm::length(normal)),
std::atan2(normal.y, normal.x)
};
return glm::length(normal) ?
Geodetic2 {
std::asin(normal.z / glm::length(normal)),
std::atan2(normal.y, normal.x)
} :
Geodetic2 { 0.0, 0.0 };
}
glm::dvec3 Ellipsoid::cartesianSurfacePosition(const Geodetic2& geodetic2) const {