diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 0000000000..10993db4e4 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,73 @@ +cff-version: 1.2.0 +message: "If you use this software, please cite it as below." +authors: +- family-names: "Bock" + given-names: "Alexander" + orcid: "https://orcid.org/0000-0002-2849-6146" +- family-names: "Axelsson" + given-names: "Emil" +- family-names: "Costa" + given-names: "Jonathas" + orcid: "https://orcid.org/0000-0002-5008-5685" +- family-names: "Payne" + given-names: "Gene" + orcid: "https://orcid.org/0000-0001-8022-4781" +- family-names: "Acinapura" + given-names: "Micah" +- family-names: "Trakinski" + given-names: "Vivian" +- family-names: "Emmart" + given-names: "Carter" +- family-names: "Silva" + given-names: "Claudio" + orcid: "https://orcid.org/0000-0003-2452-2295" +- family-names: "Hansen" + given-names: "Charles" + orcid: "https://orcid.org/0000-0002-8480-2152" +- family-names: "Ynnerman" + given-names: "Anders" + orcid: "https://orcid.org/0000-0002-9466-9826" +title: "OpenSpace" +version: 0.18.2 +doi: 10.1109/TVCG.2019.2934259 +date-released: 2022-12-24 +url: "https://github.com/OpenSpace/OpenSpace" +preferred-citation: + scope: "If you use this software, please cite it as below" + type: article + authors: + - family-names: "Bock" + given-names: "Alexander" + orcid: "https://orcid.org/0000-0002-2849-6146" + - family-names: "Axelsson" + given-names: "Emil" + - family-names: "Costa" + given-names: "Jonathas" + orcid: "https://orcid.org/0000-0002-5008-5685" + - family-names: "Payne" + given-names: "Gene" + orcid: "https://orcid.org/0000-0001-8022-4781" + - family-names: "Acinapura" + given-names: "Micah" + - family-names: "Trakinski" + given-names: "Vivian" + - family-names: "Emmart" + given-names: "Carter" + - family-names: "Silva" + given-names: "Claudio" + orcid: "https://orcid.org/0000-0003-2452-2295" + - family-names: "Hansen" + given-names: "Charles" + orcid: "https://orcid.org/0000-0002-8480-2152" + - family-names: "Ynnerman" + given-names: "Anders" + orcid: "https://orcid.org/0000-0002-9466-9826" + doi: 10.1109/TVCG.2019.2934259 + journal: "IEEE Transactions on Visualization and Computer Graphics" + month: 1 + start: 633 + end: 642 + title: "OpenSpace: A System for Astrographics" + issue: 1 + volume: 26 + year: 2020 diff --git a/CMakeLists.txt b/CMakeLists.txt index e83d3ae6fb..c35dfa48b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,9 +28,9 @@ cmake_policy(SET CMP0120 NEW) project(OpenSpace) set(OPENSPACE_VERSION_MAJOR 0) -set(OPENSPACE_VERSION_MINOR 18) +set(OPENSPACE_VERSION_MINOR 19) set(OPENSPACE_VERSION_PATCH 0) -set(OPENSPACE_VERSION_STRING "Beta-11") +set(OPENSPACE_VERSION_STRING "") set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}") set(OPENSPACE_CMAKE_EXT_DIR "${OPENSPACE_BASE_DIR}/support/cmake") diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index e38b6a04d6..f8489b2b7a 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -27,7 +27,7 @@ Project maintainers have the right and responsibility to remove, edit, or reject This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at alexander.bock@me.com or vivian@amnh.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at alex@openspaceproject.com or vivian@amnh.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. diff --git a/apps/OpenSpace/ext/launcher/include/profile/scriptlogdialog.h b/apps/OpenSpace/ext/launcher/include/profile/scriptlogdialog.h index 90bf8cb5aa..c8a1218647 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/scriptlogdialog.h +++ b/apps/OpenSpace/ext/launcher/include/profile/scriptlogdialog.h @@ -50,6 +50,7 @@ private: QListWidget* _scriptlogList = nullptr; QLineEdit* _filter = nullptr; QPushButton* _reloadFile = nullptr; + std::string _scriptLogFile; std::vector _scripts; }; diff --git a/apps/OpenSpace/ext/launcher/include/sgctedit/monitorbox.h b/apps/OpenSpace/ext/launcher/include/sgctedit/monitorbox.h index b60f7eb525..c8f080fc24 100644 --- a/apps/OpenSpace/ext/launcher/include/sgctedit/monitorbox.h +++ b/apps/OpenSpace/ext/launcher/include/sgctedit/monitorbox.h @@ -81,10 +81,10 @@ private: std::vector _monitorDimensionsScaled; std::array _windowRendering = { - QRectF{ 0.f, 0.f, 0.f, 0.f }, - QRectF{ 0.f, 0.f, 0.f, 0.f }, - QRectF{ 0.f, 0.f, 0.f, 0.f }, - QRectF{ 0.f, 0.f, 0.f, 0.f } + QRectF(0.f, 0.f, 0.f, 0.f), + QRectF(0.f, 0.f, 0.f, 0.f), + QRectF(0.f, 0.f, 0.f, 0.f), + QRectF(0.f, 0.f, 0.f, 0.f) }; int _nWindows = 1; const std::array _colorsForWindows; diff --git a/apps/OpenSpace/ext/launcher/include/sgctedit/settingswidget.h b/apps/OpenSpace/ext/launcher/include/sgctedit/settingswidget.h index f9d1105a87..1ff9fd8578 100644 --- a/apps/OpenSpace/ext/launcher/include/sgctedit/settingswidget.h +++ b/apps/OpenSpace/ext/launcher/include/sgctedit/settingswidget.h @@ -63,7 +63,7 @@ public: bool showUiOnFirstWindow() const; private: - sgct::quat _orientationValue = { 0.f, 0.f, 0.f, 0.f }; + sgct::quat _orientationValue = sgct::quat(0.f, 0.f, 0.f, 0.f); QCheckBox* _checkBoxVsync = nullptr; QCheckBox* _showUiOnFirstWindow = nullptr; }; diff --git a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp index cb8a736fc3..9c428b52e0 100644 --- a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp +++ b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp @@ -158,7 +158,7 @@ namespace { std::ofstream outFile; try { outFile.open(path, std::ofstream::out); - sgct::config::GeneratorVersion genEntry = { + sgct::config::GeneratorVersion genEntry = sgct::config::GeneratorVersion{ "OpenSpace", OPENSPACE_VERSION_MAJOR, OPENSPACE_VERSION_MINOR diff --git a/apps/OpenSpace/ext/launcher/src/profile/actiondialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/actiondialog.cpp index c9207ea2f2..14c3174cbe 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/actiondialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/actiondialog.cpp @@ -594,7 +594,11 @@ void ActionDialog::actionSaved() { action->name = _actionWidgets.name->text().toStdString(); - action->guiPath = _actionWidgets.guiPath->text().toStdString(); + std::string guiPath = _actionWidgets.guiPath->text().toStdString(); + if (!guiPath.starts_with('/')) { + guiPath = "/" + guiPath; + } + action->guiPath = guiPath; action->documentation = _actionWidgets.documentation->text().toStdString(); action->isLocal = _actionWidgets.isLocal->isChecked(); action->script = _actionWidgets.script->toPlainText().toStdString(); diff --git a/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp b/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp index d071b87c36..467a61437c 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/assettreemodel.cpp @@ -156,7 +156,10 @@ void AssetTreeModel::importModelData(const std::string& assetBasePath, std::string assetList = assets.useQtFileSystemModelToTraverseDir(assetBasePath); assetList += assets.useQtFileSystemModelToTraverseDir(userAssetBasePath, true); std::istringstream iss(assetList); - ImportElement rootElem = { "", 0, false }; + ImportElement rootElem = { + .line = "", + .level = 0, + }; if (importGetNextLine(rootElem, iss)) { importInsertItem(iss, _rootItem.get(), rootElem, 0); diff --git a/apps/OpenSpace/ext/launcher/src/profile/cameradialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/cameradialog.cpp index 09f697fec9..fdcf33ea8d 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/cameradialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/cameradialog.cpp @@ -384,11 +384,11 @@ void CameraDialog::approved() { !_navState.upY->text().isEmpty() && !_navState.upZ->text().isEmpty()) { - glm::dvec3 u = { + glm::dvec3 u = glm::dvec3( _navState.upX->text().toDouble(), _navState.upY->text().toDouble(), _navState.upZ->text().toDouble() - }; + ); nav.up = u; } else { diff --git a/apps/OpenSpace/ext/launcher/src/profile/modulesdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/modulesdialog.cpp index 954ba9a9fd..cd345d04f4 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/modulesdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/modulesdialog.cpp @@ -37,7 +37,11 @@ using namespace openspace; namespace { - const Profile::Module Blank = { "", "", "" }; + const Profile::Module Blank = { + .name = "", + .loadedInstruction = std::nullopt, + .notLoadedInstruction = std::nullopt + }; } // namespace ModulesDialog::ModulesDialog(QWidget* parent, diff --git a/apps/OpenSpace/ext/launcher/src/profile/profileedit.cpp b/apps/OpenSpace/ext/launcher/src/profile/profileedit.cpp index 072d3a3017..da72404dc5 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/profileedit.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/profileedit.cpp @@ -184,9 +184,8 @@ void ProfileEdit::createWidgets(const std::string& profileName) { QGridLayout* container = new QGridLayout; container->setColumnStretch(1, 1); - _keybindingsLabel = new QLabel("Keybindings"); + _keybindingsLabel = new QLabel("Actions & Keybindings"); _keybindingsLabel->setObjectName("heading"); - _keybindingsLabel->setWordWrap(true); container->addWidget(_keybindingsLabel, 0, 0); QPushButton* keybindingsProperties = new QPushButton("Edit"); @@ -345,7 +344,9 @@ void ProfileEdit::initSummaryTextForEachCategory() { QString::fromStdString(summarizeProperties(_profile.properties)) ); - _keybindingsLabel->setText(labelText(_profile.keybindings.size(), "Keybindings")); + _keybindingsLabel->setText( + labelText(_profile.keybindings.size(), "Actions & Keybindings") + ); _keybindingsEdit->setText(QString::fromStdString( summarizeKeybindings(_profile.keybindings, _profile.actions) )); diff --git a/apps/OpenSpace/ext/launcher/src/profile/scriptlogdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/scriptlogdialog.cpp index 6fa2c04a54..0089fd518d 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/scriptlogdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/scriptlogdialog.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -41,6 +42,7 @@ ScriptlogDialog::ScriptlogDialog(QWidget* parent) : QDialog(parent) + , _scriptLogFile(openspace::global::configuration->scriptLog) { setWindowTitle("Scriptlog"); createWidgets(); @@ -63,10 +65,31 @@ void ScriptlogDialog::createWidgets() { QGridLayout* layout = new QGridLayout(this); { QLabel* heading = new QLabel(QString::fromStdString(fmt::format( - "Choose commands from \"{}\"", openspace::global::configuration->scriptLog + "Choose commands from \"{}\"", _scriptLogFile ))); heading->setObjectName("heading"); layout->addWidget(heading, 0, 0, 1, 2); + + QPushButton* open = new QPushButton; + open->setIcon(open->style()->standardIcon(QStyle::SP_FileIcon)); + connect( + open, &QPushButton::clicked, + [this, heading]() { + QString file = QFileDialog::getOpenFileName( + this, + "Select log file", + "", + "*.txt" + ); + _scriptLogFile = file.toStdString(); + + heading->setText(QString::fromStdString(fmt::format( + "Choose commands from \"{}\"", _scriptLogFile + ))); + loadScriptFile(); + } + ); + layout->addWidget(open, 0, 1, Qt::AlignRight); } _filter = new QLineEdit; @@ -100,7 +123,9 @@ void ScriptlogDialog::createWidgets() { } void ScriptlogDialog::loadScriptFile() { - std::string log = absPath(openspace::global::configuration->scriptLog).string(); + _scripts.clear(); + + std::string log = absPath(_scriptLogFile).string(); QFile file(QString::fromStdString(log)); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { QTextStream in(&file); diff --git a/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp b/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp index d214a22b7b..0f420d9de1 100644 --- a/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp +++ b/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp @@ -49,7 +49,8 @@ void DisplayWindowUnion::createWidgets(int nMaxWindows, { // Add all window controls (some will be hidden from GUI initially) for (int i = 0; i < nMaxWindows; ++i) { - const int monitorNumForThisWindow = (nMaxWindows > 3 && i >= 2) ? 1 : 0; + const int monitorNumForThisWindow = + (monitorResolutions.size() > 1 && i >= 2) ? 1 : 0; WindowControl* ctrl = new WindowControl( monitorNumForThisWindow, diff --git a/apps/OpenSpace/ext/launcher/src/sgctedit/monitorbox.cpp b/apps/OpenSpace/ext/launcher/src/sgctedit/monitorbox.cpp index f7e46f4fd2..ebb1b80c0c 100644 --- a/apps/OpenSpace/ext/launcher/src/sgctedit/monitorbox.cpp +++ b/apps/OpenSpace/ext/launcher/src/sgctedit/monitorbox.cpp @@ -31,7 +31,7 @@ namespace { constexpr int WindowOpacity = 170; QRectF computeUnion(const std::vector& monitorResolutions) { - QRectF res = { 0.f, 0.f, 0.f, 0.f }; + QRectF res = QRectF(0.f, 0.f, 0.f, 0.f); for (const QRect& m : monitorResolutions) { res |= m; } @@ -145,12 +145,12 @@ void MonitorBox::paintEvent(QPaintEvent*) { void MonitorBox::windowDimensionsChanged(unsigned int mIdx, unsigned int wIdx, const QRectF& newDimensions) { - _windowRendering[wIdx] = { + _windowRendering[wIdx] = QRectF( _monitorDimensionsScaled[mIdx].x() + newDimensions.left() * _monitorScaleFactor, _monitorDimensionsScaled[mIdx].y() + newDimensions.top() * _monitorScaleFactor, newDimensions.width() * _monitorScaleFactor, newDimensions.height() * _monitorScaleFactor - }; + ); update(); } diff --git a/apps/OpenSpace/ext/launcher/src/sgctedit/sgctedit.cpp b/apps/OpenSpace/ext/launcher/src/sgctedit/sgctedit.cpp index d7388833b3..f4ec6f5888 100644 --- a/apps/OpenSpace/ext/launcher/src/sgctedit/sgctedit.cpp +++ b/apps/OpenSpace/ext/launcher/src/sgctedit/sgctedit.cpp @@ -39,7 +39,7 @@ #include namespace { - constexpr QRect MonitorWidgetSize = { 0, 0, 500, 500 }; + constexpr QRect MonitorWidgetSize = QRect(0, 0, 500, 500); constexpr int MaxNumberWindows = 4; // Returns true if the windows are not ordered correctly. 'Correct' in this means that @@ -48,10 +48,10 @@ namespace { // https://github.com/OpenSpace/OpenSpace/issues/507 // is fixed bool hasWindowIssues(const sgct::config::Cluster& cluster) { - sgct::ivec2 size = { + sgct::ivec2 size = sgct::ivec2( std::numeric_limits::max(), std::numeric_limits::max() - }; + ); for (const sgct::config::Window& window : cluster.nodes.front().windows) { if (window.size.x <= size.x && window.size.y <= size.y) { size = window.size; @@ -96,7 +96,7 @@ void SgctEdit::createWidgets(const std::vector& monitorSizes) { QBoxLayout* layout = new QVBoxLayout(this); layout->setSizeConstraint(QLayout::SetFixedSize); - sgct::quat orientation = { 0.f, 0.f, 0.f, 0.f }; + sgct::quat orientation = sgct::quat(0.f, 0.f, 0.f, 0.f); if (_cluster.scene.has_value() && _cluster.scene->orientation.has_value()) { orientation = *_cluster.scene->orientation; } @@ -283,7 +283,7 @@ sgct::config::Cluster SgctEdit::generateConfiguration() const { sgct::config::User user; user.eyeSeparation = 0.065f; - user.position = { 0.f, 0.f, 4.f }; + user.position = sgct::vec3(0.f, 0.f, 4.f); cluster.users = { user }; return cluster; diff --git a/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp b/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp index 88e8cb24d1..b1bdd0b3ae 100644 --- a/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp +++ b/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp @@ -52,10 +52,10 @@ namespace { }; constexpr std::array DefaultWindowSizes = { - QRectF{ 50.f, 50.f, 1280.f, 720.f }, - QRectF{ 150.f, 150.f, 1280.f, 720.f }, - QRectF{ 50.f, 50.f, 1280.f, 720.f }, - QRectF{ 150.f, 150.f, 1280.f, 720.f } + QRectF(50.f, 50.f, 1280.f, 720.f), + QRectF(150.f, 150.f, 1280.f, 720.f), + QRectF(50.f, 50.f, 1280.f, 720.f), + QRectF(150.f, 150.f, 1280.f, 720.f) }; constexpr int LineEditWidthFixedWindowSize = 50; @@ -707,17 +707,17 @@ sgct::config::Projections WindowControl::generateProjectionInformation() const { sgct::config::Window WindowControl::generateWindowInformation() const { sgct::config::Window window; - window.size = { _sizeX->text().toInt(), _sizeY->text().toInt() }; + window.size = sgct::ivec2(_sizeX->text().toInt(), _sizeY->text().toInt()); QRect resolution = _monitorResolutions[_monitor->currentIndex()]; - window.pos = { + window.pos = sgct::ivec2( resolution.x() + _offsetX->text().toInt(), resolution.y() + _offsetY->text().toInt() - }; + ); sgct::config::Viewport vp; vp.isTracked = true; - vp.position = { 0.f, 0.f }; - vp.size = { 1.f, 1.f }; + vp.position = sgct::vec2(0.f, 0.f); + vp.size = sgct::vec2(1.f, 1.f); vp.projection = generateProjectionInformation(); window.viewports.push_back(vp); diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index ad7ac43b19..65ba2fd03b 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit ad7ac43b194ea2178d4fa509f899f3928d3cbec5 +Subproject commit 65ba2fd03b48b337aeaff1443eeda65a51a1dcf6 diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index cd3c7d166d..d012932ca5 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -1108,7 +1109,7 @@ int main(int argc, char* argv[]) { "current working directory" )); - parser.addCommand(std::make_unique>( + parser.addCommand(std::make_unique>( commandlineArguments.configurationOverride, "--config", "-c", "Provides the ability to pass arbitrary Lua code to the application that will be " "evaluated after the configuration file has been loaded but before the other " @@ -1181,10 +1182,14 @@ int main(int argc, char* argv[]) { // Loading configuration from disk LDEBUG("Loading configuration from disk"); + std::string override; + for (const std::string& arg : commandlineArguments.configurationOverride) { + override += arg + ";"; + } *global::configuration = configuration::loadConfigurationFromFile( configurationFilePath.string(), size, - commandlineArguments.configurationOverride + override ); // Determining SGCT configuration file diff --git a/data/assets/base.asset b/data/assets/base.asset index ba2735a083..5d304ca709 100644 --- a/data/assets/base.asset +++ b/data/assets/base.asset @@ -4,10 +4,6 @@ asset.require("./base_blank") --- Modules and component settings -asset.require("modules/exoplanets/exoplanets") -asset.require("modules/skybrowser/skybrowser") - -- Specifying which other assets should be loaded in this scene asset.require("scene/solarsystem/sun/sun") asset.require("scene/solarsystem/sun/glare") diff --git a/data/assets/base_blank.asset b/data/assets/base_blank.asset index ddd8ebe9ed..00611bc658 100644 --- a/data/assets/base_blank.asset +++ b/data/assets/base_blank.asset @@ -1,7 +1,5 @@ -- This is a blank scene that that just sets up the default menus/dasboard/keys, etc. -local propertyHelper = asset.require("util/property_helper") - -- Specifying which other assets should be loaded in this scene asset.require("spice/base") @@ -18,6 +16,11 @@ asset.require("util/dpiscaling") -- Load the images required for the launcher to show up asset.require("util/launcher_images") +-- Modules and component settings +asset.require("modules/exoplanets/exoplanets") +asset.require("modules/skybrowser/skybrowser") + + asset.onInitialize(function () webGui.setCefRoute("onscreen") openspace.setDefaultGuiSorting() diff --git a/data/assets/customization/localbookmarks.csv b/data/assets/customization/localbookmarks.csv index 138adef2cf..d12976e610 100644 --- a/data/assets/customization/localbookmarks.csv +++ b/data/assets/customization/localbookmarks.csv @@ -1,2 +1,2 @@ Group (optional),Name (required),Globe (optional),Lat (required if globe),Lon (required if globe),Altitude (optional if globe),x (required if not globe),y (required if not globe),z (required if not globe),Scale (optional),LineWidth (optional) -NASA,Kenedy Space Center,Earth,28.6658276,-80.70282839,,,,,, +NASA,Kennedy Space Center,Earth,28.6658276,-80.70282839,,,,,, diff --git a/data/assets/educational/scale/eiffeltower.asset b/data/assets/educational/scale/eiffeltower.asset index 226a41b6d5..097da8f3b5 100644 --- a/data/assets/educational/scale/eiffeltower.asset +++ b/data/assets/educational/scale/eiffeltower.asset @@ -65,12 +65,36 @@ local updatePositionAction = { IsLocal = false } +local resetPositionAction = { + Identifier = "os.reset_eiffel_tower", + Name = "Reset Eiffel Tower position", + Command = [[ + -- same position as above + local lat = 48.85824 + local lon = 2.29448 + local globe = ']] .. earthAsset.Earth.Identifier .. [[' + openspace.setParent('eiffelTower', globe) + openspace.setPropertyValueSingle('Scene.eiffelTower.Translation.Globe', globe); + openspace.setPropertyValueSingle('Scene.eiffelTower.Translation.Latitude', lat); + openspace.setPropertyValueSingle('Scene.eiffelTower.Translation.Longitude', lon); + openspace.setPropertyValueSingle('Scene.eiffelTower.Rotation.Globe', globe); + openspace.setPropertyValueSingle('Scene.eiffelTower.Rotation.Latitude', lat); + openspace.setPropertyValueSingle('Scene.eiffelTower.Rotation.Longitude', lon); + ]], + Documentation = "Updates the Eiffel Tower position based on the globe location of the camera", + GuiPath = "/Scale Objects", + IsLocal = false +} + + asset.onInitialize(function() openspace.addSceneGraphNode(eiffelTower) openspace.action.registerAction(updatePositionAction) + openspace.action.registerAction(resetPositionAction) end) asset.onDeinitialize(function() + openspace.action.removeAction(resetPositionAction) openspace.action.removeAction(updatePositionAction) openspace.removeSceneGraphNode(eiffelTower) end) diff --git a/data/assets/examples/dashboarditems.asset b/data/assets/examples/dashboarditems.asset index 045e0d21f7..a5216dbb19 100644 --- a/data/assets/examples/dashboarditems.asset +++ b/data/assets/examples/dashboarditems.asset @@ -58,6 +58,11 @@ local elapsed_time = { ReferenceTime = "2022-10-12 12:00:00" } +local input_state = { + Type = "DashboardItemInputState", + Identifier = "InputState" +} + asset.onInitialize(function() openspace.dashboard.addDashboardItem(angle) openspace.dashboard.addDashboardItem(date) @@ -68,9 +73,11 @@ asset.onInitialize(function() openspace.dashboard.addDashboardItem(mission) openspace.dashboard.addDashboardItem(property_value) openspace.dashboard.addDashboardItem(elapsed_time) + openspace.dashboard.addDashboardItem(input_state) end) asset.onDeinitialize(function() + openspace.dashboard.removeDashboardItem(input_state) openspace.dashboard.removeDashboardItem(elapsed_time) openspace.dashboard.removeDashboardItem(property_value) openspace.dashboard.removeDashboardItem(mission) diff --git a/data/assets/global/localbookmarks.asset b/data/assets/global/localbookmarks.asset index 9800bb4bbc..781614d7da 100644 --- a/data/assets/global/localbookmarks.asset +++ b/data/assets/global/localbookmarks.asset @@ -5,13 +5,15 @@ local nodes = bookmarkHelper.getBookmarks("Local Bookmarks", "${ASSETS}/customiz asset.onInitialize(function() for _, n in ipairs(nodes) do - openspace.addSceneGraphNode(n) + pcall(openspace.addSceneGraphNode, n) end end) asset.onDeinitialize(function() for _, n in ipairs(nodes) do - openspace.removeSceneGraphNode(n) + if openspace.hasSceneGraphNode(n.Identifier) then + openspace.removeSceneGraphNode(n) + end end end) diff --git a/data/assets/scene/digitaluniverse/grids.asset b/data/assets/scene/digitaluniverse/grids.asset index 1ad5e83126..97ae62244f 100644 --- a/data/assets/scene/digitaluniverse/grids.asset +++ b/data/assets/scene/digitaluniverse/grids.asset @@ -17,9 +17,10 @@ local speck = asset.syncedResource({ Name = "Grids Speck Files", Type = "HttpSynchronization", Identifier = "digitaluniverse_grids_speck", - Version = 2 + Version = 3 }) +local lightHour = 1.0792528488E12 local lightDay = 2.59020684E13 local lightMonth = 7.771E14 local lightYear = 9.4605284E15 @@ -236,6 +237,37 @@ local galacticLabels = { } } +local plane1lh = { + Identifier = "1lhGrid", + Parent = transforms.SolarSystemBarycenter.Name, + Transform = { + Rotation = { + Type = "StaticRotation", + Rotation = eclipticRotationMatrix + } + }, + Renderable = { + Type = "RenderableGrid", + Enabled = false, + Labels = { + File = speck .. "1lh.label", + Color = { 0.0, 0.2, 0.5 }, + Size = 9.5, + MinMaxSize = { 0, 30 }, + Unit = "Km" + }, + Opacity = 0.4, + Color = { 0.1, 0.5, 0.6 }, + LineWidth = 2.0, + Segments = { 20, 20 }, + Size = { 2*lightHour, 2*lightHour } + }, + GUI = { + Name = "1lh Grid", + Path = "/Other/Grids" + } +} + local plane1ld = { Identifier = "1ldGrid", Parent = transforms.SolarSystemBarycenter.Name, @@ -585,7 +617,7 @@ local plane20Gly = { local nodes = { radio, oort, ecliptic, eclipticLabels, equatorial, equatorialLabels, - galactic, galacticLabels, plane1ld, plane1lm, plane1ly, plane10ly, + galactic, galacticLabels, plane1lh, plane1ld, plane1lm, plane1ly, plane10ly, plane100ly, plane1kly, plane10kly, plane100kly, plane1Mly, plane10Mly, plane100Mly, plane20Gly } diff --git a/data/assets/scene/digitaluniverse/milkyway.asset b/data/assets/scene/digitaluniverse/milkyway.asset index 93c9efb353..4f17197c00 100644 --- a/data/assets/scene/digitaluniverse/milkyway.asset +++ b/data/assets/scene/digitaluniverse/milkyway.asset @@ -31,7 +31,7 @@ local plane = { }, GUI = { Name = "Milky Way Galaxy Image", - Path = "/Universe/Galaxies", + Path = "/Milky Way", Description = [[Census: 1 image. DU Version 2.2.
The exterior view of the Milky Way is simply a two-dimensional image. The image is that of NGC 1232, a galaxy thought to resemble our Milky Way. The image has been properly sized diff --git a/data/assets/scene/digitaluniverse/milkyway_arm_labels.asset b/data/assets/scene/digitaluniverse/milkyway_arm_labels.asset index be5978a829..5346301b1b 100644 --- a/data/assets/scene/digitaluniverse/milkyway_arm_labels.asset +++ b/data/assets/scene/digitaluniverse/milkyway_arm_labels.asset @@ -31,7 +31,7 @@ local plane = { }, GUI = { Name = "Milky Way Arms Labels", - Path = "/Universe/Galaxies", + Path = "/Milky Way", Description = [[Census: 1 image. DU Version: 1.2. This image contains labels for the Milky Way's spiral arms. We label them in this manner ("hard coding" the labels into an image rather than having native labels) so that they can retain diff --git a/data/assets/scene/milkyway/gaia/apogee.asset b/data/assets/scene/milkyway/gaia/apogee.asset index f36e400df5..bec4709de4 100644 --- a/data/assets/scene/milkyway/gaia/apogee.asset +++ b/data/assets/scene/milkyway/gaia/apogee.asset @@ -34,7 +34,7 @@ local gaia_abundance_apogee = { ColorRange = { { -0.8, 0.6 } }, -- ShapeTexture = textures .. "disc.png", ColorMap = colormaps .. "colorbv.cmap", - OtherDataColorMap = colormaps .. "RainbowGradient.cmap", + OtherDataColorMap = colormaps .. "rainbowgradient.cmap", StaticFilter = -9999, StaticFilterReplacement = 0.0, DataMapping = { diff --git a/data/assets/scene/milkyway/gaia/gaia_dr2_download_stars.asset b/data/assets/scene/milkyway/gaia/gaia_dr2_download_stars.asset index b83394f81e..357723674f 100644 --- a/data/assets/scene/milkyway/gaia/gaia_dr2_download_stars.asset +++ b/data/assets/scene/milkyway/gaia/gaia_dr2_download_stars.asset @@ -5,12 +5,16 @@ local gaia618Destination = asset.syncedResource({ Name = "Gaia DR2 618M Octree", Type = "HttpSynchronization", Identifier = "gaia_stars_618M_octree", - Version = 1 + Version = 1, + Unzip = { + UnzipFiles = true, + Destination = "data" + } }) local gaia618DestinationExtracted = gaia618Destination .. "data"; -- Download the full DR2 dataset with 24 values per star (preprocessed with theReadFitsTask (gaia_read.task) into 8 binary files). --- From these files new subsets can be created with the ConstructOctreeTask (gaia_octree.task). +-- From these files new subsets can be created with the ConstructOctreeTask (gaia_octree.task). -- Total size of download is 151 GB. local gaiaFull = asset.syncedResource({ Name = "Gaia DR2 Full Raw", @@ -19,13 +23,6 @@ local gaiaFull = asset.syncedResource({ Version = 1 }) -asset.onInitialize(function() - if not openspace.directoryExists(gaia618DestinationExtracted) then - openspace.printInfo("Extracted Gaia dataset") - openspace.unzipFile(gaia618Destination .. "DR2_full_Octree[50kSPN,500dist]_50,50.zip", gaia618DestinationExtracted, true) - end -end) - asset.export("GaiaDR2_618M", gaia618DestinationExtracted) asset.export("GaiaFullDataset", gaiaFull) diff --git a/data/assets/scene/milkyway/gaia/galah.asset b/data/assets/scene/milkyway/gaia/galah.asset index 1b00d53a21..aa879fae3b 100644 --- a/data/assets/scene/milkyway/gaia/galah.asset +++ b/data/assets/scene/milkyway/gaia/galah.asset @@ -33,7 +33,7 @@ local gaia_abundance_galah = { ColorOption = "Other Data", OtherData = "FeH", ColorMap = colormaps .. "colorbv.cmap", - OtherDataColorMap = colormaps .. "RainbowGradient.cmap", + OtherDataColorMap = colormaps .. "rainbowgradient.cmap", ColorRange = { { -0.8, 0.6 } }, StaticFilter = -9999, StaticFilterReplacement = 0.0, diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/charon/charon.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/charon/charon.asset index 39f60d681e..bb1fcc84a0 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/charon/charon.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/charon/charon.asset @@ -50,11 +50,38 @@ local Charon = { } } +local CharonLabel = { + Identifier = "CharonLabel", + Parent = Charon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Charon", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 250.0, 500.0 }, + FadeWidths = { 150.0, 250.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Charon Label", + Path = "/Solar System/Dwarf Planets/Pluto/Moons", + Description = "Label for Pluto's moon Charon" + } +} + asset.onInitialize(function() openspace.addSceneGraphNode(Charon) + openspace.addSceneGraphNode(CharonLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(CharonLabel) openspace.removeSceneGraphNode(Charon) end) diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/hydra.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/hydra.asset index 7a3f994a6a..f78c88fe79 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/hydra.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/hydra.asset @@ -52,12 +52,39 @@ local HydraTrail = { } } +local HydraLabel = { + Identifier = "HydraLabel", + Parent = Hydra.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Hydra", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 250.0, 1000.0 }, + FadeWidths = { 150.0, 500.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = "Cheron Label", + Path = "/Solar System/Dwarf Planets/Pluto/Moons", + Description = "Label for Pluto's moon Hydra" + } +} + asset.onInitialize(function() openspace.addSceneGraphNode(Hydra) openspace.addSceneGraphNode(HydraTrail) + openspace.addSceneGraphNode(HydraLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(HydraLabel) openspace.removeSceneGraphNode(HydraTrail) openspace.removeSceneGraphNode(Hydra) end) diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/kerberos.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/kerberos.asset index 1d9adb8736..b10d3575c3 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/kerberos.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/kerberos.asset @@ -51,12 +51,39 @@ local KerberosTrail = { } } +local KerberosLabel = { + Identifier = "KerberosLabel", + Parent = Kerberos.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Kerberos", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 250.0, 1000.0 }, + FadeWidths = { 150.0, 500.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = "Cheron Label", + Path = "/Solar System/Dwarf Planets/Pluto/Moons", + Description = "Label for Pluto's moon Kerberos" + } +} + asset.onInitialize(function() openspace.addSceneGraphNode(Kerberos) openspace.addSceneGraphNode(KerberosTrail) + openspace.addSceneGraphNode(KerberosLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(KerberosLabel) openspace.removeSceneGraphNode(KerberosTrail) openspace.removeSceneGraphNode(Kerberos) end) diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/nix.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/nix.asset index a1f1715e1d..928ae5b498 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/nix.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/nix.asset @@ -51,12 +51,39 @@ local NixTrail = { } } +local NixLabel = { + Identifier = "NixLabel", + Parent = Nix.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Nix", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 250.0, 1000.0 }, + FadeWidths = { 150.0, 500.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = "Cheron Label", + Path = "/Solar System/Dwarf Planets/Pluto/Moons", + Description = "Label for Pluto's moon Nix" + } +} + asset.onInitialize(function() openspace.addSceneGraphNode(Nix) openspace.addSceneGraphNode(NixTrail) + openspace.addSceneGraphNode(NixLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(NixLabel) openspace.removeSceneGraphNode(NixTrail) openspace.removeSceneGraphNode(Nix) end) diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/styx.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/styx.asset index 9503ffd8e2..0e7f122c95 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/styx.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/minor/styx.asset @@ -50,12 +50,39 @@ local StyxTrail = { } } +local StyxLabel = { + Identifier = "StyxLabel", + Parent = Styx.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Styx", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 250.0, 1000.0 }, + FadeWidths = { 150.0, 500.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = "Cheron Label", + Path = "/Solar System/Dwarf Planets/Pluto/Moons", + Description = "Label for Pluto's moon Styx" + } +} + asset.onInitialize(function() openspace.addSceneGraphNode(Styx) openspace.addSceneGraphNode(StyxTrail) + openspace.addSceneGraphNode(StyxLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(StyxLabel) openspace.removeSceneGraphNode(StyxTrail) openspace.removeSceneGraphNode(Styx) end) diff --git a/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset b/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset index 6489f9b3f9..f9a8c5e4eb 100644 --- a/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset +++ b/data/assets/scene/solarsystem/dwarf_planets/pluto/pluto.asset @@ -57,10 +57,14 @@ local PlutoLabel = { Type = "RenderableLabel", Text = "Pluto", FontSize = 70.0, - Size = 9.05, + Size = 9.10, MinMaxSize = { 1, 100 }, BlendMode = "Additive", - OrientationOption = "Camera View Direction" + OrientationOption = "Camera View Direction", + EnableFading = true, + FadeUnit = "au", + FadeDistances = { 2.0, 120.0 }, + FadeWidths = { 1.0, 150.0 } }, Tag = { "solarsystem_labels" }, GUI = { diff --git a/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_batsrus.asset b/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_batsrus.asset index b472140ac4..d64a2cdacf 100644 --- a/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_batsrus.asset +++ b/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_batsrus.asset @@ -12,9 +12,16 @@ local fieldlineData = asset.syncedResource({ Name = "Fieldlines Data BATSRUS", Type = "HttpSynchronization", Identifier = "sun_earth_event_july_2012-batsrus", - Version = 1 + Version = 1, + UnzipFiles = true }) +local unzippedDataDestination = { + openClosed = fieldlineData .. "magnetic_fieldlines-open_closed", + velocityFlow = fieldlineData .. "velocity_flowlines-upstream", + asherStatic = fieldlineData .. "ashers_static_seeds" +} + local loop = { Documentation = "Sets time to start of data, sets higher delta time and loops back from start, when at end of data", GuiPath = "2012July", @@ -30,12 +37,6 @@ local batsrusCurrentColorTable = transferFunctions .. "batsrus_current2.txt" local batsrusVelocityColorTable = transferFunctions .. "batsrus_velocity.txt" local batsrusTopologyColorTable = transferFunctions .. "batsrus_topology.txt" -local unzippedDataDestination = { - openClosed = fieldlineData .. "magnetic_fieldlines-open_closed", - velocityFlow = fieldlineData .. "velocity_flowlines-upstream", - asherStatic = fieldlineData .. "ashers_static_seeds" -} - local colorRanges = { { 0, 100000000 }, { 0, 60 }, @@ -131,19 +132,6 @@ local BatsrusAsherStaticSeedsFlowLines = { asset.onInitialize(function () openspace.action.registerAction(loop) - if not openspace.directoryExists(unzippedDataDestination.openClosed) then - openspace.printInfo("Extracting " .. "Fieldlines from Batsrus model of 2012 event") - openspace.unzipFile(fieldlineData .. "magnetic_fieldlines-open_closed.zip", unzippedDataDestination.openClosed, true) - end - if not openspace.directoryExists(unzippedDataDestination.velocityFlow) then - openspace.printInfo("Extracting " .. "Fieldlines from Batsrus model of 2012 event") - openspace.unzipFile(fieldlineData .. "velocity_flowlines-upstream.zip", unzippedDataDestination.velocityFlow, true) - end - if not openspace.directoryExists(unzippedDataDestination.asherStatic) then - openspace.printInfo("Extracting " .. "Fieldlines from Batsrus model of 2012 event") - openspace.unzipFile(fieldlineData .. "ashers_static_seeds.zip", unzippedDataDestination.asherStatic, true) - end - openspace.addSceneGraphNode(BatsrusJ12OpenClosed) openspace.addSceneGraphNode(BatsrusJ12FlowLines) openspace.addSceneGraphNode(BatsrusAsherStaticSeedsFlowLines) diff --git a/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_enlil.asset b/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_enlil.asset index 65ffe33a0b..879251595a 100644 --- a/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_enlil.asset +++ b/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_enlil.asset @@ -8,11 +8,12 @@ local transferFunctions = asset.syncedResource({ Version = 1 }) -local fieldlineData = asset.syncedResource({ +local fieldlineData = asset.syncedResource({ Name = "Fieldlines Data ENLIL", Type = "HttpSynchronization", Identifier = "sun_earth_event_july_2012-enlil", - Version = 1 + Version = 1, + UnzipFiles = true }) local loop = { @@ -187,31 +188,6 @@ local ENLILStereoA = { asset.onInitialize(function () openspace.action.registerAction(loop) - if not openspace.directoryExists(unzippedDataDestination.EqPlane011AU1) then - openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event") - openspace.unzipFile(fieldlineData .. "011AU_eq_plane_1.zip", unzippedDataDestination.EqPlane011AU1, true) - end - if not openspace.directoryExists(unzippedDataDestination.EqPlane011AU2) then - openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event") - openspace.unzipFile(fieldlineData .. "011AU_eq_plane_2.zip", unzippedDataDestination.EqPlane011AU2, true) - end - if not openspace.directoryExists(unzippedDataDestination.Lat4011AU1) then - openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event") - openspace.unzipFile(fieldlineData .. "011AU_lat4_1.zip", unzippedDataDestination.Lat4011AU1, true) - end - if not openspace.directoryExists(unzippedDataDestination.Lat4011AU2) then - openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event") - openspace.unzipFile(fieldlineData .. "011AU_lat4_2.zip", unzippedDataDestination.Lat4011AU2, true) - end - if not openspace.directoryExists(unzippedDataDestination.Earth) then - openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event") - openspace.unzipFile(fieldlineData .. "earth.zip", unzippedDataDestination.Earth, true) - end - if not openspace.directoryExists(unzippedDataDestination.StereoA) then - openspace.printInfo("Extracting " .. "Fieldlines from ENLIL model of 2012 event") - openspace.unzipFile(fieldlineData .. "stereoa.zip", unzippedDataDestination.StereoA, true) - end - openspace.addSceneGraphNode(ENLILSliceEqPlane11AU1) openspace.addSceneGraphNode(ENLILSliceEqPlane11AU2) openspace.addSceneGraphNode(ENLILSliceLat411AU1) diff --git a/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_pfss.asset b/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_pfss.asset index fd3305fc0d..3a7119b376 100644 --- a/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_pfss.asset +++ b/data/assets/scene/solarsystem/heliosphere/2012/sun_earth_2012_fieldlines_pfss.asset @@ -11,7 +11,8 @@ local fieldlineData = asset.syncedResource({ Name = "Fieldlines Data PFSS", Type = "HttpSynchronization", Identifier = "sun_earth_event_july_2012-pfss", - Version = 1 + Version = 1, + UnzipFiles = true }) local darkenSun = { @@ -64,11 +65,6 @@ local PFSS = { asset.onInitialize(function () openspace.action.registerAction(darkenSun) - if not openspace.directoryExists(PFSSPaths.SolarSoft) then - openspace.printInfo("Extracting " .. "Fieldlines from PFSS model of 2012 event") - openspace.unzipFile(fieldlineData .. "leilas_solar_soft.zip", PFSSPaths.SolarSoft, true) - end - openspace.addSceneGraphNode(PFSS) -- openspace.setPropertyValueSingle("Scene.FL_PFSS.Renderable.FlowEnabled", true) diff --git a/data/assets/scene/solarsystem/missions/rosetta/67p.asset b/data/assets/scene/solarsystem/missions/rosetta/67p.asset index da18a50436..b548f18445 100644 --- a/data/assets/scene/solarsystem/missions/rosetta/67p.asset +++ b/data/assets/scene/solarsystem/missions/rosetta/67p.asset @@ -20,10 +20,11 @@ local images = asset.syncedResource({ Name = "Rosetta Images", Type = "HttpSynchronization", Identifier = "rosettaimages", - Version = 2 + Version = 2, + UnzipFiles = true }) -local imagesDestination = images .. "images" +local imagesDestination = images .. "images_v1_v2" local Barycenter = { Identifier = "67PBarycenter", @@ -70,7 +71,7 @@ local Comet67P = { Spice = { "ROS_NAVCAM-A" } } }, - Target = { + Target = { Read = { "TARGET_NAME", "INSTRUMENT_HOST_NAME", @@ -130,15 +131,6 @@ local Trail67P = { } } -asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting Rosetta images") - openspace.unzipFile(images .. "images_v1_v2.zip", imagesDestination, true) - end -end) - - - asset.onInitialize(function() openspace.addSceneGraphNode(Barycenter) openspace.addSceneGraphNode(Comet67P) diff --git a/data/assets/scene/solarsystem/planets/earth/default_layers.asset b/data/assets/scene/solarsystem/planets/earth/default_layers.asset index a92d9f2ca4..812ff4446f 100644 --- a/data/assets/scene/solarsystem/planets/earth/default_layers.asset +++ b/data/assets/scene/solarsystem/planets/earth/default_layers.asset @@ -2,7 +2,6 @@ asset.require("./layers/colorlayers/blue_marble", false) asset.require("./layers/colorlayers/esri_viirs_combo", true) asset.require("./layers/colorlayers/esri_world_imagery", false) -asset.require("./layers/colorlayers/esri_imagery_world_2D", false) asset.require("./layers/colorlayers/viirs_snpp_temporal", false) asset.require("./layers/colorlayers/aqua_modis_temporal", false) asset.require("./layers/colorlayers/terra_modis_temporal", false) @@ -10,7 +9,6 @@ asset.require("./layers/colorlayers/bmng_utah", false) asset.require("./layers/colorlayers/bmng_sweden", false) asset.require("./layers/colorlayers/amsr2_gcom_w1_sea_ice_concentration_temporal", false) asset.require("./layers/colorlayers/modis_terra_chlorophyll_a_temporal", false) -asset.require("./layers/colorlayers/ghrsst_l4_g1sst_sea_surface_temperature_temporal", false) asset.require("./layers/colorlayers/ghrsst_l4_mur_sea_surface_temperature_temporal", false) -- Height layers diff --git a/data/assets/scene/solarsystem/planets/earth/earth.asset b/data/assets/scene/solarsystem/planets/earth/earth.asset index 3c94a4a630..a34c21e45f 100644 --- a/data/assets/scene/solarsystem/planets/earth/earth.asset +++ b/data/assets/scene/solarsystem/planets/earth/earth.asset @@ -56,14 +56,14 @@ local EarthLabel = { Type = "RenderableLabel", Text = "Earth", FontSize = 70.0, - Size = 8.77, - MinMaxSize = { 1, 100 }, + Size = 8.50, + MinMaxSize = { 1, 50 }, OrientationOption = "Camera View Direction", BlendMode = "Additive", EnableFading = true, FadeUnit = "au", - FadeDistances = { 1.5, 15.0 }, - FadeWidths = { 1.0, 25.0 } + FadeDistances = { 1.5, 30.0 }, + FadeWidths = { 1.0, 40.0 } }, Tag = { "solarsystem_labels" }, GUI = { diff --git a/data/assets/scene/solarsystem/planets/earth/grids.asset b/data/assets/scene/solarsystem/planets/earth/grids.asset new file mode 100644 index 0000000000..5ad7739003 --- /dev/null +++ b/data/assets/scene/solarsystem/planets/earth/grids.asset @@ -0,0 +1,88 @@ +local transforms = asset.require("./transforms") + +local eclipticRotationMatrix = { + -0.05487554, 0.4941095, -0.8676661, + -0.9938214 , -0.1109906, -0.0003515167, + -0.09647644, 0.8622859, 0.4971472 +} + +local lightSecond = 299792458 +local lightMinute = 1.798754748E10 + +local plane1lsec = { + Identifier = "1lsecGrid", + Transform = { + Rotation = { + Type = "StaticRotation", + Rotation = eclipticRotationMatrix + }, + Translation = { + Type = "SpiceTranslation", + Target = "EARTH BARYCENTER", + Observer = "SSB" + } + }, + Renderable = { + Type = "RenderableGrid", + Enabled = false, + Opacity = 0.4, + Color = { 0.1, 0.5, 0.6 }, + LineWidth = 2.0, + Segments = { 20, 20 }, + Size = { 2*lightSecond, 2*lightSecond } + }, + GUI = { + Name = "1lsec Grid", + Path = "/Solar System/Planets/Earth" + } +} + +local plane1lmin = { + Identifier = "1lminGrid", + Transform = { + Rotation = { + Type = "StaticRotation", + Rotation = eclipticRotationMatrix + }, + Translation = { + Type = "SpiceTranslation", + Target = "EARTH BARYCENTER", + Observer = "SSB" + } + }, + Renderable = { + Type = "RenderableGrid", + Enabled = false, + Opacity = 0.4, + Color = { 0.1, 0.5, 0.6 }, + LineWidth = 2.0, + Segments = { 20, 20 }, + Size = { 2*lightMinute, 2*lightMinute } + }, + GUI = { + Name = "1lmin Grid", + Path = "/Solar System/Planets/Earth" + } +} + +asset.onInitialize(function() + openspace.addSceneGraphNode(plane1lsec) + openspace.addSceneGraphNode(plane1lmin) +end) + +asset.onDeinitialize(function() + openspace.removeSceneGraphNode(plane1lmin) + openspace.removeSceneGraphNode(plane1lsec) +end) + +asset.export(plane1lsec) +asset.export(plane1lmin) + + +asset.meta = { + Name = "Earth Grid", + Version = "1.0", + Description = [[Grids that are useful to show distances around Earth]], + Author = "OpenSpace Team", + License = "MIT license" +} diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_imagery_world_2D.asset b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_imagery_world_2D.asset deleted file mode 100644 index 4fca4e1ccc..0000000000 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_imagery_world_2D.asset +++ /dev/null @@ -1,38 +0,0 @@ -local globeIdentifier = asset.require("../../earth").Earth.Identifier - -local layer = { - Identifier = "ESRI_Imagery_World_2D", - Name = "ESRI Imagery World 2D", - Enabled = asset.enabled, - FilePath = asset.localResource("esri_imagery_world_2D.wms"), - Description = [[This map presents low-resolution imagery for the world and - high-resolution imagery for the United States and other metropolitan areas around - the world. The map includes NASA Blue Marble: Next Generation 500m resolution - imagery at small scales (above 1:1,000,000), i-cubed 15m eSAT imagery at - medium-to-large scales (down to 1:70,000) for the world, and USGS 15m Landsat - imagery for Antarctica. It also includes 1m i-cubed Nationwide Select imagery for - the continental United States, and GeoEye IKONOS 1m resolution imagery for Hawaii, - parts of Alaska, and several hundred metropolitan areas around the world. - (Description from URL)]], -} - -asset.onInitialize(function() - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) -end) - -asset.onDeinitialize(function() - openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer) -end) - -asset.export("layer", layer) - - - -asset.meta = { - Name = "ESRI Imagery World 2D", - Version = "1.1", - Description = "Older 2D imager map layer for Earth. This layer is hosted by ESRI", - Author = "ESRI", - URL = "https://www.arcgis.com/home/item.html?id=21b4ba14d9e5472d97afcbb819f7368e", - License = "Esri Master License Agreement" -} diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_imagery_world_2D.wms b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_imagery_world_2D.wms deleted file mode 100644 index ed9f9b6905..0000000000 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_imagery_world_2D.wms +++ /dev/null @@ -1,17 +0,0 @@ - - - http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/tile/${z}/${y}/${x} - - - 15 - 2 - 1 - top - - EPSG:4326 - 512 - 512 - 3 - 5 - 5 - diff --git a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_g1sst_sea_surface_temperature_temporal.asset b/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_g1sst_sea_surface_temperature_temporal.asset deleted file mode 100644 index 9bd2aba398..0000000000 --- a/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/ghrsst_l4_g1sst_sea_surface_temperature_temporal.asset +++ /dev/null @@ -1,46 +0,0 @@ -local globeIdentifier = asset.require("../../earth").Earth.Identifier - -local layer = { - Identifier = "GHRSST_L4_G1SST_Sea_Surface_Temperature_Temporal", - Name = "GHRSST L4 G1SST Sea Surface Temperature (Temporal)", - Enabled = asset.enabled, - Type = "TemporalTileLayer", - Mode = "Prototyped", - Prototyped = { - Time = { - Start = "2010-06-21", - End = "2019-12-08" - }, - TemporalResolution = "1d", - TimeFormat = "YYYY-MM-DD", - Prototype = openspace.globebrowsing.createTemporalGibsGdalXml( - "GHRSST_L4_G1SST_Sea_Surface_Temperature", - "1km", - "png" - ) - }, - Description = [[Temporal coverage: 21 June 2010 - 08 December 2019. The imagery - resolution is 1 km, and the temporal resolution is daily]], - Author = "NASA EOSDIS Global Imagery Browse Services" -} - -asset.onInitialize(function() - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) -end) - -asset.onDeinitialize(function() - openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer) -end) - -asset.export("layer", layer) - - - -asset.meta = { - Name = "GHRSST L4 MUR Sea Surface Temperature (Temporal)", - Version = "1.1", - Description = "GIBS hosted layer", - Author = "NASA EOSDIS Global Imagery Browse Services", - URL = "https://earthdata.nasa.gov/eosdis/science-system-description/eosdis-components/gibs", - License = "NASA" -} diff --git a/data/assets/scene/solarsystem/planets/earth/moon/moon.asset b/data/assets/scene/solarsystem/planets/earth/moon/moon.asset index d199cf365b..d2f6ff416d 100644 --- a/data/assets/scene/solarsystem/planets/earth/moon/moon.asset +++ b/data/assets/scene/solarsystem/planets/earth/moon/moon.asset @@ -56,11 +56,39 @@ local Moon = { } } +local MoonLabel = { + Identifier = "MoonLabel", + Parent = Moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Moon", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 40 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.4, 10.0 }, + FadeWidths = { 0.1, 10.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Moon Label", + Path = "/Solar System/Planets/Earth/Moon", + Description = "Label for Earth's Moon" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Moon) + openspace.addSceneGraphNode(MoonLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(MoonLabel) openspace.removeSceneGraphNode(Moon) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2000_carbon_monoxide.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2000_carbon_monoxide.asset index 7af26e1795..bb2b4858f3 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2000_carbon_monoxide.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2000_carbon_monoxide.asset @@ -19,17 +19,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "1024", Description = Description } @@ -44,11 +43,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "1024.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2004_ir_hurricane.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2004_ir_hurricane.asset index 17ded1f6a1..f1dff71e2f 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2004_ir_hurricane.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2004_ir_hurricane.asset @@ -19,11 +19,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -31,7 +30,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "cylir_%Y%m%d_%H%M.jpg" @@ -40,11 +39,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2005_hurricane-grayir.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2005_hurricane-grayir.asset index fbcb85af6f..aba44b0628 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2005_hurricane-grayir.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2005_hurricane-grayir.asset @@ -15,11 +15,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -27,7 +27,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "ir_combined_%Y%m%d_%H%M.jpg" @@ -36,27 +36,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-4.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-5.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-6.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-7.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-8.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-9.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-10.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-11.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-12.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-13.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-14.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-15.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-16.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-17.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2005_hurricane-wvsst.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2005_hurricane-wvsst.asset index 79c90ca903..bc2d528355 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2005_hurricane-wvsst.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/2005_hurricane-wvsst.asset @@ -15,11 +15,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -27,7 +26,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "GI-WV-%y%j-%H%M.jpg" @@ -36,11 +35,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_blackcarbon.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_blackcarbon.asset index 84389d5ae9..eb241306d9 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_blackcarbon.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_blackcarbon.asset @@ -23,17 +23,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048_png", Description = Description } @@ -48,11 +47,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048_png.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_blackcarbon_and_sulfate.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_blackcarbon_and_sulfate.asset index 8a7ac3c32a..ecbb32888b 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_blackcarbon_and_sulfate.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_blackcarbon_and_sulfate.asset @@ -23,17 +23,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048_png", Description = Description } @@ -48,11 +47,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048_png.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar); end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_sulfate.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_sulfate.asset index a9ea2b7ff8..fb664c9cf6 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_sulfate.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aerosol_sulfate.asset @@ -23,17 +23,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048_png", Description = Description } @@ -48,11 +47,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048_png.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/airtraffic.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/airtraffic.asset index 49d9debbaa..ec194a78e3 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/airtraffic.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/airtraffic.asset @@ -18,28 +18,21 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "images", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-3.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/all_sats.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/all_sats.asset index 301da9640a..174f57e5be 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/all_sats.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/all_sats.asset @@ -23,26 +23,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aqua_swath.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aqua_swath.asset index 344fa32c28..5b80b36783 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aqua_swath.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/aqua_swath.asset @@ -22,29 +22,21 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "images", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-4.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/carbonflux.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/carbonflux.asset index f2ebf764d2..950b1daf4a 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/carbonflux.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/carbonflux.asset @@ -21,26 +21,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2160", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2160.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/co_gmd.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/co_gmd.asset index 6984ab053c..ec79ecde4f 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/co_gmd.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/co_gmd.asset @@ -22,11 +22,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -34,7 +34,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "co_field_extended_%Y%m%d%H%M.png" @@ -54,16 +54,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "3600-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "3600-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "3600-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "3600-4.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "3600-5.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "3600-6.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fim_chem.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fim_chem.asset index 859e72322b..4114ccf02a 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fim_chem.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fim_chem.asset @@ -18,17 +18,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "composite", Description = Description } @@ -43,11 +42,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "composite.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fossil_fuel.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fossil_fuel.asset index bbe8ef5659..3af8fcc1f5 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fossil_fuel.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fossil_fuel.asset @@ -25,11 +25,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -37,7 +36,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "3100", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "%Y%m%d_fossil.png" @@ -56,11 +55,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "3100.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fukushima.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fukushima.asset index 7ca6db9f51..93b5c48b1d 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fukushima.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/fukushima.asset @@ -17,17 +17,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2054", Description = Description } @@ -42,11 +41,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2054.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/geo_sat.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/geo_sat.asset index 959e92104a..ea649d5083 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/geo_sat.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/geo_sat.asset @@ -21,26 +21,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/geo_scan.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/geo_scan.asset index 487326c916..a85e3ac642 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/geo_scan.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/geo_scan.asset @@ -21,26 +21,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/giss_temp_anom.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/giss_temp_anom.asset index 8ea792b000..d79df07034 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/giss_temp_anom.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/giss_temp_anom.asset @@ -14,17 +14,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2012", Description = Description } @@ -39,11 +38,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2012.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/globe-insolation.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/globe-insolation.asset index e4bdbaccba..1850480c67 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/globe-insolation.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/globe-insolation.asset @@ -17,11 +17,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -29,7 +28,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "1440", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "CERES_INSOL_M_%Y-%m.PNG" @@ -49,11 +48,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "1440.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/globe-rainfall.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/globe-rainfall.asset index 88c23bfea6..8bc1159d17 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/globe-rainfall.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/globe-rainfall.asset @@ -17,11 +17,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -29,7 +28,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "1440", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "TRMM_3B43M_%Y-%m.PNG" @@ -49,11 +48,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "1440.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/harvey-clouds_precip.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/harvey-clouds_precip.asset index 4c2997756a..54bb95eaaa 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/harvey-clouds_precip.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/harvey-clouds_precip.asset @@ -17,11 +17,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -29,7 +28,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "combined_image_%Y%m%d_%H%M.jpg" @@ -57,11 +56,6 @@ local colorbar_snow = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar_rain) openspace.addScreenSpaceRenderable(colorbar_snow) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/hurricane_season_2017.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/hurricane_season_2017.asset index 37a49fdc14..248062de86 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/hurricane_season_2017.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/hurricane_season_2017.asset @@ -20,11 +20,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -32,7 +32,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "linear_rgb_cyl_%Y%m%d_%H%M.jpg" @@ -41,14 +41,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-4.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/hurricane_season_2017_wvsst.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/hurricane_season_2017_wvsst.asset index c04b51bf35..86304ec6c8 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/hurricane_season_2017_wvsst.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/hurricane_season_2017_wvsst.asset @@ -20,11 +20,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -32,7 +31,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "wvsst-%y%j-%H.jpg" @@ -41,11 +40,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/isaac.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/isaac.asset index 031f589cca..cf1ce51565 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/isaac.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/isaac.asset @@ -18,7 +18,8 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) local radarDestination = syncedDirectory .. "radar" @@ -53,16 +54,6 @@ local layer_sat = { } asset.onInitialize(function() - if not openspace.directoryExists(radarDestination) then - openspace.printInfo("Extracting " .. Name .. " Radar") - openspace.unzipFile(syncedDirectory .. "radar.zip", radarDestination, true) - end - - if not openspace.directoryExists(satDestination) then - openspace.printInfo("Extracting " .. Name .. " Sat") - openspace.unzipFile(syncedDirectory .. "sat.zip", satDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_radar) openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_sat) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/land_temp.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/land_temp.asset index 8cbbda2744..187fb0a5de 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/land_temp.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/land_temp.asset @@ -17,11 +17,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -29,7 +28,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "cyl_%Y_%m.jpg" @@ -38,11 +37,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/ltg_vaisala.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/ltg_vaisala.asset index 600921d83b..1af3e30986 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/ltg_vaisala.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/ltg_vaisala.asset @@ -22,11 +22,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -34,7 +33,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2160", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "%Y_%m-1.png" @@ -54,11 +53,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2160.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nasa_sats.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nasa_sats.asset index dab84eb9cc..a613108f15 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nasa_sats.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nasa_sats.asset @@ -20,26 +20,21 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-carbon.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-carbon.asset index efdf5da97f..bfe46e141b 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-carbon.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-carbon.asset @@ -17,17 +17,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } @@ -43,11 +42,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-chem.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-chem.asset index cf60320943..7795309db1 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-chem.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-chem.asset @@ -17,11 +17,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -29,7 +29,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "chem_%Y-%m-%d_%H-%M.png" @@ -48,36 +48,6 @@ local legend = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4000-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-4.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-5.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-6.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-7.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-8.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-9.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-10.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-11.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-12.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-13.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-14.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-15.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-16.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-17.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-18.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-19.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-20.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-21.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-22.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-23.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-24.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-25.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-26.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(legend) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-winds.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-winds.asset index dae59b5af0..fc01a8fca4 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-winds.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/nccs_models-winds.asset @@ -17,11 +17,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -29,7 +29,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "winds_%Y-%m-%d_%H-%M.png" @@ -38,36 +38,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4000-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-4.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-5.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-6.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-7.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-8.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-9.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-10.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-11.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-12.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-13.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-14.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-15.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-16.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-17.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-18.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-19.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-20.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-21.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-22.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-23.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-24.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-25.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4000-26.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/no2_omsi.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/no2_omsi.asset index 41b267cacc..bb3b05422b 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/no2_omsi.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/no2_omsi.asset @@ -18,11 +18,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -30,7 +29,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2880", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "NO2monthlymean_%Y%m.png" @@ -49,11 +48,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2880.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/pclim.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/pclim.asset index f9e19f22e8..37622bc66c 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/pclim.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/pclim.asset @@ -15,17 +15,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "raw", Description = Description } @@ -40,11 +39,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "raw.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/poes_sat.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/poes_sat.asset index aeac12056c..734b2e1056 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/poes_sat.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/poes_sat.asset @@ -18,11 +18,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -30,7 +29,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "poes_cover_%Y%j%H%M.jpg" @@ -39,11 +38,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-antarctic.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-antarctic.asset index 133d6e668d..1edd0805c4 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-antarctic.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-antarctic.asset @@ -29,17 +29,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } @@ -55,11 +54,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-elnino.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-elnino.asset index ecbcd2b59b..217006ca80 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-elnino.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-elnino.asset @@ -29,17 +29,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } @@ -55,11 +54,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-hurricane.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-hurricane.asset index c28b4e7658..f04f2c0f7a 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-hurricane.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/reanalysis-hurricane.asset @@ -29,17 +29,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048_png", Description = Description } @@ -55,11 +54,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048_png.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/sandy.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/sandy.asset index 2a82899eac..e299abd1e4 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/sandy.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/sandy.asset @@ -13,11 +13,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -25,7 +24,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "linear_rgb_cyl_%Y%m%d_%H%M.jpg" @@ -34,11 +33,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/sunsync_sat.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/sunsync_sat.asset index ab563ae299..0d209090b8 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/sunsync_sat.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/sunsync_sat.asset @@ -18,11 +18,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -30,7 +29,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "sunsync_%Y%j%H%M.jpg" @@ -39,11 +38,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/temp_anom.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/temp_anom.asset index 66427a29ff..34eb1f46be 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/temp_anom.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/temp_anom.asset @@ -21,11 +21,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -33,7 +32,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096_new", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "ANOM.yearly.%Y.color.png" @@ -53,11 +52,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096_new.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/typhoon_haiyan-wvsst.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/typhoon_haiyan-wvsst.asset index 5b2e6097ef..da4470c343 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/typhoon_haiyan-wvsst.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/typhoon_haiyan-wvsst.asset @@ -15,17 +15,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } @@ -38,11 +37,6 @@ local track = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", track) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/typhoon_haiyan.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/typhoon_haiyan.asset index 6f86b1b3ff..a68a83c6b2 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/typhoon_haiyan.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/typhoon_haiyan.asset @@ -15,11 +15,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -27,7 +26,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "linear_rgb_cyl_%Y%m%d_%H%M.jpg" @@ -44,11 +43,6 @@ local track = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", track) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/volcano_ash.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/volcano_ash.asset index fe1bb42efe..d0f55350f4 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/volcano_ash.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/atmosphere/volcano_ash.asset @@ -21,26 +21,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2992", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2992.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/birds.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/birds.asset index 5329f988e4..93b124ce9f 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/birds.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/birds.asset @@ -15,17 +15,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "birds", Description = Description } @@ -40,11 +39,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "birds.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-blue_marble_topo.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-blue_marble_topo.asset index ab4d833181..b09748ae78 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-blue_marble_topo.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-blue_marble_topo.asset @@ -16,11 +16,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -28,7 +27,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "5400", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "world.%Y%m.3x5400x2700.jpg" @@ -37,11 +36,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "5400.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-blue_marble_topo_bathy.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-blue_marble_topo_bathy.asset index 8088450677..415e6fe533 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-blue_marble_topo_bathy.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-blue_marble_topo_bathy.asset @@ -16,11 +16,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -28,7 +27,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "5400", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "world.topo.bathy.%Y%m.3x5400x2700.jpg" @@ -37,11 +36,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "5400.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-nightlights.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-nightlights.asset index d9cd63d453..f3a39fec25 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-nightlights.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-nightlights.asset @@ -22,31 +22,21 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "images", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-4.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-5.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-6.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-seasonal_blue_marble.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-seasonal_blue_marble.asset index 12f561159a..28c7a33ee1 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-seasonal_blue_marble.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/blue_marble-seasonal_blue_marble.asset @@ -17,11 +17,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -29,7 +28,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "world%Y%jx4kx2k.jpg" @@ -38,11 +37,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-global.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-global.asset index ab2a765a58..41c74dfb12 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-global.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-global.asset @@ -15,25 +15,19 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer_images = { Identifier = Identifier, Name = Name, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_images) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-mississippi.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-mississippi.asset index 64914979dc..304b944e92 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-mississippi.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-mississippi.asset @@ -15,26 +15,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-yangtze.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-yangtze.asset index 007f0cb78d..94f821bc31 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-yangtze.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/dams-yangtze.asset @@ -15,26 +15,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-06z_only.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-06z_only.asset index 0f18bfa9da..6ec4e40dcf 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-06z_only.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-06z_only.asset @@ -17,11 +17,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -29,7 +28,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "daynite_%Y%j%H%M.jpg" @@ -38,11 +37,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-full_year.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-full_year.asset index 1c2c9c6b18..bd8bf08784 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-full_year.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-full_year.asset @@ -17,11 +17,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -29,7 +29,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "daynite_%Y%j%H%M.jpg" @@ -38,13 +38,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "2048-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "2048-3.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-oneday.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-oneday.asset index faef9a24cb..2f683d0290 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-oneday.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/day_night-oneday.asset @@ -17,26 +17,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earthquake-1980_1995_quakes.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earthquake-1980_1995_quakes.asset index 6d90ee58c8..8546c329ff 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earthquake-1980_1995_quakes.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earthquake-1980_1995_quakes.asset @@ -24,17 +24,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "1024", Description = Description } @@ -72,11 +71,6 @@ local quakebar_combined = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "1024.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(legend) openspace.addScreenSpaceRenderable(quakebar) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earthquakes_and_eruptions.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earthquakes_and_eruptions.asset index fc107e4c5c..4317e62749 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earthquakes_and_eruptions.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earthquakes_and_eruptions.asset @@ -17,17 +17,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -42,11 +41,6 @@ local legend = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(legend) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earths_magnetism_magnetic_lines.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earths_magnetism_magnetic_lines.asset index 3d72539e6d..5f00be7b5f 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earths_magnetism_magnetic_lines.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earths_magnetism_magnetic_lines.asset @@ -22,11 +22,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -34,7 +33,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "%Y.png" @@ -43,11 +42,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earths_magnetism_magnets.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earths_magnetism_magnets.asset index 1b55868ee8..2b8ca3b2a3 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earths_magnetism_magnets.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/earths_magnetism_magnets.asset @@ -22,11 +22,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -34,7 +33,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "%Y.png" @@ -43,11 +42,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/fire.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/fire.asset index 632e29d266..ed5ae36e9b 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/fire.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/fire.asset @@ -20,11 +20,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -32,7 +31,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "firemap.%Y%j-%Y%j.4096x2048.png" @@ -41,11 +40,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/fire_veg.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/fire_veg.asset index b2ab9d82f2..b8c4b83d86 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/fire_veg.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/fire_veg.asset @@ -19,17 +19,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } @@ -54,11 +53,6 @@ local colorbar_veg = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar_fire) openspace.addScreenSpaceRenderable(colorbar_veg) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/global_vegetation.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/global_vegetation.asset index 288a8105b3..ceacbfb3a3 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/global_vegetation.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/global_vegetation.asset @@ -16,10 +16,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images/" +local imagesDestination = syncedDirectory .. "4096" local colorbarDestination = syncedDirectory .. "colorbar/" local background1layer = { @@ -65,16 +66,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name .. " Images") - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - - if not openspace.directoryExists(colorbarDestination) then - openspace.printInfo("Extracting " .. Name .. " Colorbar") - openspace.unzipFile(syncedDirectory .. "colorbar.zip", colorbarDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", background1layer) openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", background2layer) openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/hot_topo.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/hot_topo.asset index 0ef301c115..7765a7a5f5 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/hot_topo.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/hot_topo.asset @@ -23,29 +23,21 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "images", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-4.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/irsat_nightlights.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/irsat_nightlights.asset index 3e6a9ba483..713dbb4134 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/irsat_nightlights.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/irsat_nightlights.asset @@ -17,26 +17,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/japan_quake.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/japan_quake.asset index b7b754190d..c778c7ee0a 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/japan_quake.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/japan_quake.asset @@ -17,17 +17,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } @@ -42,11 +41,6 @@ local legend = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(legend) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/koppen_climate-koppen_1901_2100.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/koppen_climate-koppen_1901_2100.asset index 5bd6447901..f4e66c7e4b 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/koppen_climate-koppen_1901_2100.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/koppen_climate-koppen_1901_2100.asset @@ -17,17 +17,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -53,11 +52,6 @@ local legend1 = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(legend) openspace.addScreenSpaceRenderable(legend1) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_cover-animation.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_cover-animation.asset index b057b71768..f1075852b4 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_cover-animation.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_cover-animation.asset @@ -22,17 +22,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "3600", Description = Description } @@ -48,11 +47,6 @@ local label = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "3600.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(label) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_cover-slideshow.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_cover-slideshow.asset index 2d0c160537..d2cb3939b5 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_cover-slideshow.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_cover-slideshow.asset @@ -22,7 +22,8 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) local labelsDestination = syncedDirectory .. "labels/" @@ -71,11 +72,6 @@ local labels = { } asset.onInitialize(function() - if not openspace.directoryExists(labelsDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "labels.zip", labelsDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) for _,v in ipairs(labels) do diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_ratio.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_ratio.asset index 2018d1c049..14c252b305 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_ratio.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/land_ratio.asset @@ -12,26 +12,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/magnetic_declination.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/magnetic_declination.asset index d6e8cf82d3..cdb09e2f87 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/magnetic_declination.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/magnetic_declination.asset @@ -16,11 +16,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -28,7 +27,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- @TODO: This dataset is not using equirectangular projection, so it will look -- strange on the planet right now @@ -45,11 +44,6 @@ asset.onInitialize(function() "will look strange when projected onto the spherical Earth" ) - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/paleo_map.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/paleo_map.asset index 94065a393a..75375705a7 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/paleo_map.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/paleo_map.asset @@ -21,10 +21,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" +local imagesDestination = syncedDirectory .. "3600" local layers_names = { "Map01a_PALEOMAP_PaleoAtlas_000", @@ -144,11 +145,6 @@ local legend = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "3600.zip", imagesDestination, true) - end - for i,v in ipairs(layers) do openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", v) end diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/plate_movement.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/plate_movement.asset index 2d34fc16bc..9c6e5b4ff3 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/plate_movement.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/plate_movement.asset @@ -24,17 +24,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -51,11 +50,6 @@ local age_scale = { asset.onInitialize(function () - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(age_scale) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/river_discharge_2010.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/river_discharge_2010.asset index 16705873b9..c43add6891 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/river_discharge_2010.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/river_discharge_2010.asset @@ -15,17 +15,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -41,11 +40,6 @@ local colorbar = { asset.onInitialize(function () - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/seismic_waves-1994northridge.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/seismic_waves-1994northridge.asset index c5b9847191..2c7185c9ff 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/seismic_waves-1994northridge.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/seismic_waves-1994northridge.asset @@ -18,10 +18,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" +local imagesDestination = syncedDirectory .. "2048" local pipsDestination = syncedDirectory .. "pips" local layer_base = { @@ -58,16 +59,6 @@ local pips = { } asset.onInitialize(function () - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name .. " Images") - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - - if not openspace.directoryExists(pipsDestination) then - openspace.printInfo("Extracting " .. Name .. " Pips") - openspace.unzipFile(syncedDirectory .. "pips.zip", pipsDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_base) openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_stations) openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer_images) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/surface_temperature.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/surface_temperature.asset index 65367f7370..32cb8d89ab 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/surface_temperature.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/land/surface_temperature.asset @@ -18,17 +18,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -55,11 +54,6 @@ local colorbar2 = { } asset.onInitialize(function () - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) openspace.addScreenSpaceRenderable(colorbar2) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/bm10000.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/bm10000.asset index 26122d2887..0d288e5553 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/bm10000.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/bm10000.asset @@ -40,26 +40,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/gfdl_seaice.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/gfdl_seaice.asset index fe9dcb5ff9..c4f15e3f43 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/gfdl_seaice.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/gfdl_seaice.asset @@ -23,17 +23,17 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "images", Description = Description } @@ -48,13 +48,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-3.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-ccsm-a1b.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-ccsm-a1b.asset index cc9848d9c3..f201debe91 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-ccsm-a1b.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-ccsm-a1b.asset @@ -20,17 +20,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4095", Description = Description } @@ -47,11 +46,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4095.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-ccsm-b1.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-ccsm-b1.asset index dcc1ed6590..1f23bcfeb7 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-ccsm-b1.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-ccsm-b1.asset @@ -20,17 +20,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4095", Description = Description } @@ -47,11 +46,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4095.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-gfdl-a1b.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-gfdl-a1b.asset index d8c9be216e..3a70c3e9e1 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-gfdl-a1b.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-gfdl-a1b.asset @@ -20,17 +20,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4095", Description = Description } @@ -47,11 +46,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4095.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-gfdl-b1.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-gfdl-b1.asset index 8177afaf90..2117986946 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-gfdl-b1.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-gfdl-b1.asset @@ -20,17 +20,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4095", Description = Description } @@ -47,11 +46,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4095.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-had-a1b.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-had-a1b.asset index df194e5d5b..d4a430bebb 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-had-a1b.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-had-a1b.asset @@ -20,17 +20,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4095", Description = Description } @@ -47,11 +46,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4095.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-had-b1.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-had-b1.asset index 623bfcd31e..af34b58ce0 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-had-b1.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ipcc_temp-had-b1.asset @@ -20,17 +20,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4095", Description = Description } @@ -47,11 +46,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4095.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga26.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga26.asset index ebec3e4f25..4fbebf94f8 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga26.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga26.asset @@ -12,11 +12,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -24,7 +23,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "GA26.yearly.%Y.color.png" @@ -44,11 +43,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga45.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga45.asset index 4f9068f7d7..6a6e80255b 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga45.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga45.asset @@ -12,11 +12,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -24,7 +23,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "GA45.yearly.%Y.color.png" @@ -44,11 +43,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga60.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga60.asset index af36426261..8c3ae46b11 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga60.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga60.asset @@ -12,11 +12,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -24,7 +23,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "GA60.yearly.%Y.color.png" @@ -44,11 +43,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga85.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga85.asset index 4ed7ed7a82..7d3693fe06 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga85.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/rcp-ga85.asset @@ -12,11 +12,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -24,7 +23,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "GA85.yearly.%Y.color.png" @@ -44,11 +43,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ukmet-a1b.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ukmet-a1b.asset index 438aa10e9c..813080144f 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ukmet-a1b.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ukmet-a1b.asset @@ -22,11 +22,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -34,7 +33,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2100", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "000_%Y_1_A1B_HQ.png" @@ -53,11 +52,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2100.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ukmet-e1.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ukmet-e1.asset index 96fc5cb29c..44629cb2c6 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ukmet-e1.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/models/ukmet-e1.asset @@ -21,11 +21,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -33,7 +32,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2100", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "000_%Y_1_E1_HQ.png" @@ -52,11 +51,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2100.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/2009_ice_animation.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/2009_ice_animation.asset index 21aba0f031..57d612c5c5 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/2009_ice_animation.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/2009_ice_animation.asset @@ -21,17 +21,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -66,11 +65,6 @@ local colorbar_2009_iceconcentration = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar_2007_2009) openspace.addScreenSpaceRenderable(colorbar_2008_minimum) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/animal_tracking.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/animal_tracking.asset index 5f6f49541e..c0db0daade 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/animal_tracking.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/animal_tracking.asset @@ -18,11 +18,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -30,7 +29,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "TOPPMOVIE.%Y-%m-%d.png" @@ -49,11 +48,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/argo_buoy_tracks.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/argo_buoy_tracks.asset index 63a38c129c..931edc6763 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/argo_buoy_tracks.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/argo_buoy_tracks.asset @@ -20,17 +20,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -45,11 +44,6 @@ local buoy = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(buoy) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/argo_buoy_waterfall.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/argo_buoy_waterfall.asset index 202540b1dc..9068118a45 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/argo_buoy_waterfall.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/argo_buoy_waterfall.asset @@ -20,26 +20,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/atl_turtle.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/atl_turtle.asset index 70e3d2ec52..570157016e 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/atl_turtle.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/atl_turtle.asset @@ -20,11 +20,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -32,7 +31,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "turtle-migration-%y%j-%H%M.jpg" @@ -41,11 +40,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/chlorophyll_model.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/chlorophyll_model.asset index b27f5cca80..0b738716d2 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/chlorophyll_model.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/chlorophyll_model.asset @@ -20,17 +20,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "3232", Description = Description } @@ -47,11 +46,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "3232.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ecco2_sst-gray_land.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ecco2_sst-gray_land.asset index 9e88eb4d52..bdc3683ca3 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ecco2_sst-gray_land.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ecco2_sst-gray_land.asset @@ -22,17 +22,17 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "images", Description = Description } @@ -47,17 +47,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-4.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-5.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-6.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-7.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ecco2_sst-veg_land.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ecco2_sst-veg_land.asset index 810642faba..b82f17f143 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ecco2_sst-veg_land.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ecco2_sst-veg_land.asset @@ -22,17 +22,17 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "images", Description = Description } @@ -47,19 +47,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-4.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-5.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-6.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-7.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-8.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-9.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/gfdl_sst-black_background.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/gfdl_sst-black_background.asset index 304b2298a0..780d52d8a9 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/gfdl_sst-black_background.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/gfdl_sst-black_background.asset @@ -16,11 +16,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -28,7 +28,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "GFDL_CM2p4_SSTctl_%Y.png" @@ -48,12 +48,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048_png-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "2048_png-2.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/gfdl_sst-land_background.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/gfdl_sst-land_background.asset index b432810438..b0319d9fb3 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/gfdl_sst-land_background.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/gfdl_sst-land_background.asset @@ -16,11 +16,11 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -28,7 +28,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "GFDL_CM2p4_SSTctl_%Y.png" @@ -48,14 +48,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048_png-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "2048_png-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "2048_png-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "2048_png-4.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/greenland_melt.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/greenland_melt.asset index 1e8ca9a876..d9682f9efb 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/greenland_melt.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/greenland_melt.asset @@ -20,11 +20,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -32,7 +31,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "dav19_%Y.jpg" @@ -41,11 +40,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/japan_tsunami_waves.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/japan_tsunami_waves.asset index 6e134e579e..b82e4f6d04 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/japan_tsunami_waves.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/japan_tsunami_waves.asset @@ -23,26 +23,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/loggerheadseaturtletracks.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/loggerheadseaturtletracks.asset index 43f99a0d21..0db5e13cbb 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/loggerheadseaturtletracks.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/loggerheadseaturtletracks.asset @@ -20,26 +20,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/mexico_turtles_947293.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/mexico_turtles_947293.asset index 6186d46d25..41c1ae1585 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/mexico_turtles_947293.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/mexico_turtles_947293.asset @@ -19,11 +19,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -31,7 +30,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "NOAA-turtle-S947293-%y%j-%H%M.jpg" @@ -40,11 +39,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/mexico_turtles_958002.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/mexico_turtles_958002.asset index 5c0aeb1f1f..d0d97a48c9 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/mexico_turtles_958002.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/mexico_turtles_958002.asset @@ -19,11 +19,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -31,7 +30,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "NOAA-turtle-S958002-%y%j-%H%M.jpg" @@ -40,11 +39,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/modis_sst.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/modis_sst.asset index b5d890a9a0..bae9167481 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/modis_sst.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/modis_sst.asset @@ -18,26 +18,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/nasa_speed.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/nasa_speed.asset index 91e7c5012b..22b3d502be 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/nasa_speed.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/nasa_speed.asset @@ -18,26 +18,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4000", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4000.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/nasa_sst.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/nasa_sst.asset index d82b4d5e4e..2acb9ecbc1 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/nasa_sst.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/nasa_sst.asset @@ -16,26 +16,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4000", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4000.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-co2_flux.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-co2_flux.asset index 8fca9fb50e..a7d415ecf9 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-co2_flux.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-co2_flux.asset @@ -15,11 +15,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, @@ -28,7 +27,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "CO2F.yearly.%Y.color.png" @@ -47,11 +46,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "images.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-ph.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-ph.asset index 97c28ec6de..243c092d3f 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-ph.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-ph.asset @@ -18,11 +18,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -30,7 +29,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "ACID.yearly.%Y.color.png" @@ -49,11 +48,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "images.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-saturation.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-saturation.asset index d97a124c31..3564726ea0 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-saturation.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_acid-saturation.asset @@ -23,11 +23,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -35,7 +34,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "images", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "ARAG.yearly.%Y.color.png" @@ -62,11 +61,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "images.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", reefs) openspace.addScreenSpaceRenderable(colorbar) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_depths_temp.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_depths_temp.asset index 2697673efb..27412e8b7d 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_depths_temp.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_depths_temp.asset @@ -18,11 +18,12 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" -local imagesByDepthDestination = syncedDirectory .. "bydepth" +local imagesDestination = syncedDirectory .. "4096" +local imagesByDepthDestination = syncedDirectory .. "4096_by_depth" local layer = { Identifier = Identifier, @@ -53,16 +54,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - - if not openspace.directoryExists(imagesByDepthDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096_by_depth.zip", imagesByDepthDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_drain-gray.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_drain-gray.asset index d261ebaf04..5b26039281 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_drain-gray.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/ocean_drain-gray.asset @@ -16,26 +16,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/pac_turtle.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/pac_turtle.asset index 435ad94e1c..0a07d9bbd9 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/pac_turtle.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/pac_turtle.asset @@ -18,11 +18,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -30,7 +29,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "pac-turtle-migration-%y%j-%H%M.jpg" @@ -39,11 +38,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/phytoplankton.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/phytoplankton.asset index 6ae998bea9..a9e41ea914 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/phytoplankton.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/phytoplankton.asset @@ -22,17 +22,17 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "images", Description = Description } @@ -47,17 +47,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-3.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-4.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-5.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-6.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-7.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/pr_tsunami.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/pr_tsunami.asset index 8e4d61a4c4..0e1764b50d 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/pr_tsunami.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/pr_tsunami.asset @@ -19,26 +19,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sea_level.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sea_level.asset index f01ce6ea49..a14298c2c2 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sea_level.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sea_level.asset @@ -24,26 +24,20 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4000", Description = Description } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4000.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sea_surface_height_anomaly.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sea_surface_height_anomaly.asset index 4db3e77319..0c9a8fb74c 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sea_surface_height_anomaly.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sea_surface_height_anomaly.asset @@ -19,17 +19,17 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "images", Description = Description } @@ -45,13 +45,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "8192-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "8192-2.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "8192-3.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seaice_monthly.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seaice_monthly.asset index 5fd156abd1..09fc36f549 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seaice_monthly.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seaice_monthly.asset @@ -18,11 +18,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -30,7 +29,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "sibt1850_seaice_extent_%Y%M%H_sos.png" @@ -39,11 +38,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-land_background.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-land_background.asset index 109122f344..86d5b8dd7d 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-land_background.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-land_background.asset @@ -13,17 +13,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -38,11 +37,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-no_holes.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-no_holes.asset index 3a5d47d741..8cbed7808b 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-no_holes.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-no_holes.asset @@ -14,17 +14,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "2048", Description = Description } @@ -39,11 +38,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-polar_holes.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-polar_holes.asset index 2401d7cbb9..97f5ceb458 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-polar_holes.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/seawifs-polar_holes.asset @@ -14,17 +14,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4320_png", Description = Description } @@ -39,11 +38,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4320_png.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/shark.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/shark.asset index 9a67e649bc..65565f084d 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/shark.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/shark.asset @@ -19,11 +19,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -31,7 +30,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "2048", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "shark-migration-%y%j-%H%M.jpg" @@ -40,11 +39,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "2048.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sss.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sss.asset index 5778b346dc..3cd8b360a4 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sss.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sss.asset @@ -17,17 +17,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -42,11 +41,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sst_1980_1999.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sst_1980_1999.asset index 8e030e7386..23619d282f 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sst_1980_1999.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/sst_1980_1999.asset @@ -19,11 +19,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -31,7 +30,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "cyl_%Y_%m_%d.jpg" @@ -40,11 +39,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vector_winds.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vector_winds.asset index 8d5ad10920..70bd6a1fc2 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vector_winds.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vector_winds.asset @@ -19,17 +19,17 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true, + UnzipFilesDestination = "images" }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "images", Description = Description } @@ -44,12 +44,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096-1.zip", imagesDestination, true) - openspace.unzipFile(syncedDirectory .. "4096-2.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vent_discoveries_animation.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vent_discoveries_animation.asset index 82643e8ae9..717a67efea 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vent_discoveries_animation.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vent_discoveries_animation.asset @@ -16,11 +16,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -28,7 +27,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "new", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "vents_%Y.png" @@ -37,11 +36,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "new.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vorticity.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vorticity.asset index 8790ea411b..7589c4164b 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vorticity.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/vorticity.asset @@ -17,17 +17,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "frames", Description = Description } @@ -42,11 +41,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "frames.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_2012.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_2012.asset index b1c99ce719..0a57ed360d 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_2012.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_2012.asset @@ -14,17 +14,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -39,11 +38,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_katrina.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_katrina.asset index 80408cf903..25ea12e63a 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_katrina.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_katrina.asset @@ -16,17 +16,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -41,11 +40,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_sandy.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_sandy.asset index fededbb87b..9a4bf42a56 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_sandy.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_height_sandy.asset @@ -16,17 +16,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -41,11 +40,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_power_2012.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_power_2012.asset index 393de3b8d7..e2659c7b0e 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_power_2012.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/waves-wave_power_2012.asset @@ -14,17 +14,16 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, Enabled = asset.enabled, Type = "ImageSequenceTileLayer", - FolderPath = imagesDestination, + FolderPath = syncedDirectory .. "4096", Description = Description } @@ -39,11 +38,6 @@ local colorbar = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) openspace.addScreenSpaceRenderable(colorbar) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/weeklyseaice-10day_seaice.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/weeklyseaice-10day_seaice.asset index 867f64e106..db42698543 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/weeklyseaice-10day_seaice.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/weeklyseaice-10day_seaice.asset @@ -20,11 +20,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -32,7 +31,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096_png", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "nt_monthext_%Y%m%d-%Y%m%d_n07_sos.png" @@ -41,11 +40,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096_png.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/weeklyseaice-sept_seaice.asset b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/weeklyseaice-sept_seaice.asset index f3e75f2327..adb39f8b5e 100644 --- a/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/weeklyseaice-sept_seaice.asset +++ b/data/assets/scene/solarsystem/planets/earth/noaa-sos/oceans/weeklyseaice-sept_seaice.asset @@ -28,11 +28,10 @@ local syncedDirectory = asset.syncedResource({ Name = Name, Type = "HttpSynchronization", Identifier = Identifier, - Version = 1 + Version = 1, + UnzipFiles = true }) -local imagesDestination = syncedDirectory .. "images" - local layer = { Identifier = Identifier, Name = Name, @@ -40,7 +39,7 @@ local layer = { Type = "TemporalTileLayer", Mode = "Folder", Folder = { - Folder = imagesDestination, + Folder = syncedDirectory .. "4096", -- See https://en.cppreference.com/w/cpp/io/manip/get_time for an explanation of the -- time formatting string Format = "nt_monthext_%Y%m%d-%Y%m%d_n07_sos.png" @@ -49,11 +48,6 @@ local layer = { } asset.onInitialize(function() - if not openspace.directoryExists(imagesDestination) then - openspace.printInfo("Extracting " .. Name) - openspace.unzipFile(syncedDirectory .. "4096.zip", imagesDestination, true) - end - openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer) end) diff --git a/data/assets/scene/solarsystem/planets/jupiter/callisto/callisto.asset b/data/assets/scene/solarsystem/planets/jupiter/callisto/callisto.asset index 478552b38b..6f038f0fa0 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/callisto/callisto.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/callisto/callisto.asset @@ -52,11 +52,38 @@ local Callisto = { } } +local CallistoLabel = { + Identifier = "CallistoLabel", + Parent = Callisto.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Callisto", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 40 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.0, 10.0 }, + FadeWidths = { 0.5, 10.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Callisto Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon Callisto" + } +} + asset.onInitialize(function() openspace.addSceneGraphNode(Callisto) + openspace.addSceneGraphNode(CallistoLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(CallistoLabel) openspace.removeSceneGraphNode(Callisto) end) diff --git a/data/assets/scene/solarsystem/planets/jupiter/europa/europa.asset b/data/assets/scene/solarsystem/planets/jupiter/europa/europa.asset index b380c5626e..002cce3765 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/europa/europa.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/europa/europa.asset @@ -51,11 +51,38 @@ local Europa = { } } +local EuropaLabel = { + Identifier = "EuropaLabel", + Parent = Europa.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Europa", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 40 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.0, 10.0 }, + FadeWidths = { 0.5, 10.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Europa Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon Europa" + } +} + asset.onInitialize(function() openspace.addSceneGraphNode(Europa) + openspace.addSceneGraphNode(EuropaLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(EuropaLabel) openspace.removeSceneGraphNode(Europa) end) diff --git a/data/assets/scene/solarsystem/planets/jupiter/ganymede/ganymede.asset b/data/assets/scene/solarsystem/planets/jupiter/ganymede/ganymede.asset index c10a19156b..40fad40f2c 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/ganymede/ganymede.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/ganymede/ganymede.asset @@ -51,11 +51,39 @@ local Ganymede = { } } +local GanymedeLabel = { + Identifier = "GanymedeLabel", + Parent = Ganymede.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Ganymede", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 40 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.0, 10.0 }, + FadeWidths = { 0.5, 10.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Ganymede Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon Ganymede" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Ganymede) + openspace.addSceneGraphNode(GanymedeLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(GanymedeLabel) openspace.removeSceneGraphNode(Ganymede) end) diff --git a/data/assets/scene/solarsystem/planets/jupiter/io/io.asset b/data/assets/scene/solarsystem/planets/jupiter/io/io.asset index 2818bd060d..ff28967ee9 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/io/io.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/io/io.asset @@ -51,11 +51,40 @@ local Io = { } } + +local IoLabel = { + Identifier = "IoLabel", + Parent = Io.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Io", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 40 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.0, 10.0 }, + FadeWidths = { 0.5, 10.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Io Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon Io" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Io) + openspace.addSceneGraphNode(IoLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(IoLabel) openspace.removeSceneGraphNode(Io) end) diff --git a/data/assets/scene/solarsystem/planets/jupiter/jupiter.asset b/data/assets/scene/solarsystem/planets/jupiter/jupiter.asset index 2a3cbb7392..c01e8ca6ef 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/jupiter.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/jupiter.asset @@ -48,10 +48,14 @@ local JupiterLabel = { Type = "RenderableLabel", Text = "Jupiter", FontSize = 70.0, - Size = 8.77, - MinMaxSize = { 1, 100 }, + Size = 8.75, + MinMaxSize = { 1, 50 }, OrientationOption = "Camera View Direction", - BlendMode = "Additive" + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "au", + FadeDistances = { 3.0, 40.0 }, + FadeWidths = { 1.0, 60.0 } }, Tag = { "solarsystem_labels" }, GUI = { diff --git a/data/assets/scene/solarsystem/planets/jupiter/minor/ananke_group.asset b/data/assets/scene/solarsystem/planets/jupiter/minor/ananke_group.asset index bf1ad9950d..57b1e28372 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/minor/ananke_group.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/minor/ananke_group.asset @@ -207,22 +207,62 @@ local anankeGroup = { } } +-- Generate all moon labels +local moon_labels = {} + +for i, moon in ipairs(anankeGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.1, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.5, 90.0 }, + FadeWidths = { 0.5, 90.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon " .. moonName .. " (Ananke group)" + } + } +end + + local nodes = proceduralGlobes.createGlobes(anankeGroup) asset.onInitialize(function() - for i, node in ipairs(nodes) do + for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end end) -for i, node in ipairs(nodes) do - asset.export( node) +for _, node in ipairs(nodes) do + asset.export(node) end diff --git a/data/assets/scene/solarsystem/planets/jupiter/minor/carme_group.asset b/data/assets/scene/solarsystem/planets/jupiter/minor/carme_group.asset index 99b971a635..0a39412b0d 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/minor/carme_group.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/minor/carme_group.asset @@ -275,21 +275,63 @@ local carmeGroup = { } } + +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs(carmeGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.1, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 2.0, 125.0 }, + FadeWidths = { 0.5, 50.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon " .. moonName .. " (Carme group)" + } + } +end + + + local nodes = proceduralGlobes.createGlobes(carmeGroup) asset.onInitialize(function() - for i, node in ipairs(nodes) do + for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end end) -for i, node in ipairs(nodes) do +for _, node in ipairs(nodes) do asset.export(node) end diff --git a/data/assets/scene/solarsystem/planets/jupiter/minor/carpo_group.asset b/data/assets/scene/solarsystem/planets/jupiter/minor/carpo_group.asset index 2be789af96..dfd8d7d069 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/minor/carpo_group.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/minor/carpo_group.asset @@ -35,21 +35,87 @@ local carpoGroup = { } } +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs(carpoGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.1, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.0, 100.0 }, + FadeWidths = { 0.0, 100.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon " .. moonName .. " (Carpo group)" + } + } + + -- 'Hacky' solution to case where the main label gets culled on approach due to its onscreen size. + -- We need the size of the original label to be big as it needs to be legible from long distances when focusing on Jupiter. + moon_labels[i+1] = { + Identifier = moon.Identifier .. "LabelNear", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 5.5, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.2, 1.0 }, + FadeWidths = { 0.1, 0.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label (Near)", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Transitional Label for close-range viewing of " .. moonName .. " (Carpo group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(carpoGroup) -asset.onInitialize(function() - for i, node in ipairs(nodes) do +asset.onInitialize(function() + for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end end) -for i, node in ipairs(nodes) do +for _, node in ipairs(nodes) do asset.export(node) end diff --git a/data/assets/scene/solarsystem/planets/jupiter/minor/himalia_group.asset b/data/assets/scene/solarsystem/planets/jupiter/minor/himalia_group.asset index 4882ede8e7..5a4ce45db9 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/minor/himalia_group.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/minor/himalia_group.asset @@ -104,21 +104,60 @@ local himaliaGroup = { } } +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs(himaliaGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.1, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.0, 120.0 }, + FadeWidths = { 1.0, 120.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon " .. moonName .. " (Himalia group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(himaliaGroup) asset.onInitialize(function() - for i, node in ipairs(nodes) do + for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end end) -for i, node in ipairs(nodes) do +for _, node in ipairs(nodes) do asset.export(node) end diff --git a/data/assets/scene/solarsystem/planets/jupiter/minor/inner_group.asset b/data/assets/scene/solarsystem/planets/jupiter/minor/inner_group.asset index d5029a8329..22ba7c7df1 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/minor/inner_group.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/minor/inner_group.asset @@ -86,21 +86,64 @@ local innerMoons = { } } +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs(innerMoons) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 50.0, + Size = 5.6, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.1, 3.0 }, + FadeWidths = { 0.1, 3.0 }, + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon " .. moonName .. " (inner group)" + } + } +end + + local nodes = proceduralGlobes.createGlobes(innerMoons) + asset.onInitialize(function() - for i, node in ipairs(nodes) do + for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) + asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end end) -for i, node in ipairs(nodes) do + +for _, node in ipairs(nodes) do asset.export(node) end diff --git a/data/assets/scene/solarsystem/planets/jupiter/minor/other_groups.asset b/data/assets/scene/solarsystem/planets/jupiter/minor/other_groups.asset index 8d20858b11..d47e7cb08d 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/minor/other_groups.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/minor/other_groups.asset @@ -162,21 +162,61 @@ local otherGroups = { } } +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs(otherGroups) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.1, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.0, 150.0 }, + FadeWidths = { 1.0, 50.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon " .. moonName .. " (other groups)" + } + } +end + + local nodes = proceduralGlobes.createGlobes(otherGroups) asset.onInitialize(function() - for i, node in ipairs(nodes) do + for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end end) -for i, node in ipairs(nodes) do +for _, node in ipairs(nodes) do asset.export(node) end diff --git a/data/assets/scene/solarsystem/planets/jupiter/minor/pasiphae_group.asset b/data/assets/scene/solarsystem/planets/jupiter/minor/pasiphae_group.asset index 450391d773..6e78f38342 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/minor/pasiphae_group.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/minor/pasiphae_group.asset @@ -350,8 +350,7 @@ local pasiphaeGroup = { Identifier = parentIdentifier, Spice = parentSpice }, - -- sic: The Identifier in the SPICE kernel is wrong - Spice = "MAGACLITE", + Spice = "MEGACLITE", Radii = { 5000, 5000, 5000 }, Tags = tags, TrailTags = trailTags, @@ -364,21 +363,61 @@ local pasiphaeGroup = { } } +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs(pasiphaeGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.1, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.5, 140.0 }, + FadeWidths = { 0.5, 50.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon " .. moonName .. " (Pasiphae group)" + } + } +end + + local nodes = proceduralGlobes.createGlobes(pasiphaeGroup) asset.onInitialize(function() - for i, node in ipairs(nodes) do + for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end end) -for i, node in ipairs(nodes) do +for _, node in ipairs(nodes) do asset.export(node) end diff --git a/data/assets/scene/solarsystem/planets/jupiter/minor/themisto_group.asset b/data/assets/scene/solarsystem/planets/jupiter/minor/themisto_group.asset index c68b1c4518..1442f47a6f 100644 --- a/data/assets/scene/solarsystem/planets/jupiter/minor/themisto_group.asset +++ b/data/assets/scene/solarsystem/planets/jupiter/minor/themisto_group.asset @@ -34,21 +34,60 @@ local themistoGroup = { } } +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs(themistoGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.1, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.5, 120.0 }, + FadeWidths = { 0.5, 50.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Jupiter/Moons", + Description = "Label for Jupiter's moon " .. moonName .. " (Themisto group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(themistoGroup) asset.onInitialize(function() - for i, node in ipairs(nodes) do + for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end end) -for i, node in ipairs(nodes) do +for _, node in ipairs(nodes) do asset.export(node) end diff --git a/data/assets/scene/solarsystem/planets/mars/mars.asset b/data/assets/scene/solarsystem/planets/mars/mars.asset index 3ddce078d8..0ba2b7f20b 100644 --- a/data/assets/scene/solarsystem/planets/mars/mars.asset +++ b/data/assets/scene/solarsystem/planets/mars/mars.asset @@ -61,8 +61,8 @@ local MarsLabel = { Type = "RenderableLabel", Text = "Mars", FontSize = 70.0, - Size = 8.66, - MinMaxSize = { 1, 100 }, + Size = 8.50, + MinMaxSize = { 1, 50 }, OrientationOption = "Camera View Direction", BlendMode = "Additive", TransformationMatrix = { @@ -71,6 +71,10 @@ local MarsLabel = { 0.0, 0.0, 1.0, 1.0E7, 0.0, 0.0, 0.0, 1.0 }, + EnableFading = true, + FadeUnit = "au", + FadeDistances = { 1.5, 40.0 }, + FadeWidths = { 1.0, 50.0 } }, Tag = { "solarsystem_labels" }, GUI = { diff --git a/data/assets/scene/solarsystem/planets/mars/moons/deimos.asset b/data/assets/scene/solarsystem/planets/mars/moons/deimos.asset index e8606c2b28..7ef7f8f2ac 100644 --- a/data/assets/scene/solarsystem/planets/mars/moons/deimos.asset +++ b/data/assets/scene/solarsystem/planets/mars/moons/deimos.asset @@ -19,6 +19,7 @@ local kernels = asset.syncedResource({ local Deimos = { Identifier = "Deimos", Parent = transforms.MarsBarycenter.Identifier, + InteractionSphere = 8000, Transform = { Rotation = { Type = "SpiceRotation", @@ -76,12 +77,41 @@ local DeimosTrail = { } } + +local DeimosLabel = { + Identifier = "DeimosLabel", + Parent = Deimos.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Deimos", + FontSize = 70.0, + Size = 5.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 50.0, 1000.0 }, + FadeWidths = { 50.0, 2000.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Deimos Label", + Path = "/Solar System/Planets/Mars/Moons", + Description = "Label for Mars' moon Deimos" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Deimos) openspace.addSceneGraphNode(DeimosTrail) + openspace.addSceneGraphNode(DeimosLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(DeimosLabel) openspace.removeSceneGraphNode(DeimosTrail) openspace.removeSceneGraphNode(Deimos) end) diff --git a/data/assets/scene/solarsystem/planets/mars/moons/phobos.asset b/data/assets/scene/solarsystem/planets/mars/moons/phobos.asset index 36ccd2ce04..4189cc20ee 100644 --- a/data/assets/scene/solarsystem/planets/mars/moons/phobos.asset +++ b/data/assets/scene/solarsystem/planets/mars/moons/phobos.asset @@ -20,6 +20,7 @@ local kernels = asset.syncedResource({ local Phobos = { Identifier = "Phobos", Parent = transforms.MarsBarycenter.Identifier, + InteractionSphere = 15000, Transform = { Rotation = { Type = "SpiceRotation", @@ -78,12 +79,39 @@ local PhobosTrail = { } } +local PhobosLabel = { + Identifier = "PhobosLabel", + Parent = Phobos.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Phobos", + FontSize = 70.0, + Size = 5.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 30.0, 1000.0 }, + FadeWidths = { 30.0, 2000.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Phobos Label", + Path = "/Solar System/Planets/Mars/Moons", + Description = "Label for Mars' moon Phobos" + } +} + asset.onInitialize(function() openspace.addSceneGraphNode(Phobos) openspace.addSceneGraphNode(PhobosTrail) + openspace.addSceneGraphNode(PhobosLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(PhobosLabel) openspace.removeSceneGraphNode(PhobosTrail) openspace.removeSceneGraphNode(Phobos) end) diff --git a/data/assets/scene/solarsystem/planets/mercury/mercury.asset b/data/assets/scene/solarsystem/planets/mercury/mercury.asset index 63c091d29a..ca5e1e7def 100644 --- a/data/assets/scene/solarsystem/planets/mercury/mercury.asset +++ b/data/assets/scene/solarsystem/planets/mercury/mercury.asset @@ -59,10 +59,14 @@ local MercuryLabel = { Type = "RenderableLabel", Text = "Mercury", FontSize = 70.0, - Size = 8.46, - MinMaxSize = { 1, 100 }, + Size = 8.5, + MinMaxSize = { 1, 40 }, OrientationOption = "Camera View Direction", - BlendMode = "Additive" + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "au", + FadeDistances = { 1.5, 20.0 }, + FadeWidths = { 1.0, 30.0 } }, Tag = { "solarsystem_labels" }, GUI = { diff --git a/data/assets/scene/solarsystem/planets/neptune/inner_moons.asset b/data/assets/scene/solarsystem/planets/neptune/inner_moons.asset index 43c6cac40c..93d166d2de 100644 --- a/data/assets/scene/solarsystem/planets/neptune/inner_moons.asset +++ b/data/assets/scene/solarsystem/planets/neptune/inner_moons.asset @@ -141,15 +141,56 @@ local innerMoons = { } } + +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs(innerMoons) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 50.0, + Size = 5.2, + MinMaxSize = { 1, 20 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 100, 800.0 }, + FadeWidths = { 100, 1200.0 }, + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Neptune/Moons", + Description = "Label for Neptune's moon " .. moonName .. " (inner group)" + } + } +end + + local nodes = proceduralGlobes.createGlobes(innerMoons) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/neptune/irregular_prograde_moons.asset b/data/assets/scene/solarsystem/planets/neptune/irregular_prograde_moons.asset index 36f5767898..bc869449b7 100644 --- a/data/assets/scene/solarsystem/planets/neptune/irregular_prograde_moons.asset +++ b/data/assets/scene/solarsystem/planets/neptune/irregular_prograde_moons.asset @@ -72,15 +72,56 @@ local irregularProgradeMoons = { } } + +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs(irregularProgradeMoons) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.4, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1, 250.0 }, + FadeWidths = { 1, 250.0 }, + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Neptune/Moons", + Description = "Label for Neptune's moon " .. moonName .. " (Irregular prograde group)" + } + } +end + + local nodes = proceduralGlobes.createGlobes(irregularProgradeMoons) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/neptune/irregular_retrograde_moons.asset b/data/assets/scene/solarsystem/planets/neptune/irregular_retrograde_moons.asset index 7787921565..3285c26633 100644 --- a/data/assets/scene/solarsystem/planets/neptune/irregular_retrograde_moons.asset +++ b/data/assets/scene/solarsystem/planets/neptune/irregular_retrograde_moons.asset @@ -71,15 +71,55 @@ local irregularRetrogradeMoons = { } } + +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs(irregularRetrogradeMoons) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.4, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1, 250.0 }, + FadeWidths = { 1, 250.0 }, + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Neptune/Moons", + Description = "Label for Neptune's moon " .. moonName .. " (Irregular retrograde group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(irregularRetrogradeMoons) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/neptune/neptune.asset b/data/assets/scene/solarsystem/planets/neptune/neptune.asset index 7923ea756b..917cbe7439 100644 --- a/data/assets/scene/solarsystem/planets/neptune/neptune.asset +++ b/data/assets/scene/solarsystem/planets/neptune/neptune.asset @@ -39,10 +39,14 @@ local NeptuneLabel = { Type = "RenderableLabel", Text = "Neptune", FontSize = 70.0, - Size = 8.96, - MinMaxSize = { 1, 100 }, + Size = 9.0, + MinMaxSize = { 1, 80 }, OrientationOption = "Camera View Direction", - BlendMode = "Additive" + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "au", + FadeDistances = { 6.0, 120.0 }, + FadeWidths = { 2.0, 150.0 } }, Tag = { "solarsystem_labels" }, GUI = { diff --git a/data/assets/scene/solarsystem/planets/neptune/triton.asset b/data/assets/scene/solarsystem/planets/neptune/triton.asset index a50931e456..0f63edb6c8 100644 --- a/data/assets/scene/solarsystem/planets/neptune/triton.asset +++ b/data/assets/scene/solarsystem/planets/neptune/triton.asset @@ -22,15 +22,56 @@ local Triton = { Kernels = kernel } + +-- Generate labels for each moon +local moon_labels = {} + +for i, moon in ipairs({ Triton }) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 50.0, + Size = 7.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1, 15.0 }, + FadeWidths = { 1, 15.0 }, + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Neptune/Moons", + Description = "Label for Neptune's moon " .. moonName + } + } +end + + local nodes = proceduralGlobes.createGlobes({ Triton }) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moonlabel in ipairs(moon_labels) do + openspace.addSceneGraphNode(moonlabel) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/saturn/dione/dione.asset b/data/assets/scene/solarsystem/planets/saturn/dione/dione.asset index 4ae53e83bd..5a2baed2ee 100644 --- a/data/assets/scene/solarsystem/planets/saturn/dione/dione.asset +++ b/data/assets/scene/solarsystem/planets/saturn/dione/dione.asset @@ -49,11 +49,40 @@ local Dione = { } } + +local DioneLabel = { + Identifier = "DioneLabel", + Parent = Dione.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Dione", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.3, 10.0 }, + FadeWidths = { 0.15, 10.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Dione Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon Dione" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Dione) + openspace.addSceneGraphNode(DioneLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(DioneLabel) openspace.removeSceneGraphNode(Dione) end) diff --git a/data/assets/scene/solarsystem/planets/saturn/enceladus/enceladus.asset b/data/assets/scene/solarsystem/planets/saturn/enceladus/enceladus.asset index 305c42fcf4..4035fe53f5 100644 --- a/data/assets/scene/solarsystem/planets/saturn/enceladus/enceladus.asset +++ b/data/assets/scene/solarsystem/planets/saturn/enceladus/enceladus.asset @@ -51,11 +51,40 @@ local Enceladus = { } } + +local EnceladusLabel = { + Identifier = "EnceladusLabel", + Parent = Enceladus.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Enceladus", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.3, 10.0 }, + FadeWidths = { 0.15, 10.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Enceladus Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon Enceladus" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Enceladus) + openspace.addSceneGraphNode(EnceladusLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(EnceladusLabel) openspace.removeSceneGraphNode(Enceladus) end) diff --git a/data/assets/scene/solarsystem/planets/saturn/hyperion/hyperion.asset b/data/assets/scene/solarsystem/planets/saturn/hyperion/hyperion.asset index 71a141f4d6..9df51d793f 100644 --- a/data/assets/scene/solarsystem/planets/saturn/hyperion/hyperion.asset +++ b/data/assets/scene/solarsystem/planets/saturn/hyperion/hyperion.asset @@ -50,11 +50,40 @@ local Hyperion = { } } + +local HyperionLabel = { + Identifier = "HyperionLabel", + Parent = Hyperion.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Hyperion", + FontSize = 70.0, + Size = 6.2, + MinMaxSize = { 1, 35 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.5, 20.0 }, + FadeWidths = { 0.3, 20.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Hyperion Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon Hyperion" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Hyperion) + openspace.addSceneGraphNode(HyperionLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(HyperionLabel) openspace.removeSceneGraphNode(Hyperion) end) diff --git a/data/assets/scene/solarsystem/planets/saturn/iapetus/iapetus.asset b/data/assets/scene/solarsystem/planets/saturn/iapetus/iapetus.asset index 1a9de8c9d5..a841b2e21f 100644 --- a/data/assets/scene/solarsystem/planets/saturn/iapetus/iapetus.asset +++ b/data/assets/scene/solarsystem/planets/saturn/iapetus/iapetus.asset @@ -51,11 +51,39 @@ local Iapetus = { } } +local IapetusLabel = { + Identifier = "IapetusLabel", + Parent = Iapetus.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Iapetus", + FontSize = 70.0, + Size = 6.2, + MinMaxSize = { 1, 35 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.5, 20.0 }, + FadeWidths = { 0.3, 20.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Iapetus Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon Iapetus" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Iapetus) + openspace.addSceneGraphNode(IapetusLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(IapetusLabel) openspace.removeSceneGraphNode(Iapetus) end) diff --git a/data/assets/scene/solarsystem/planets/saturn/mimas/mimas.asset b/data/assets/scene/solarsystem/planets/saturn/mimas/mimas.asset index dab85a414e..1c63b5c0ef 100644 --- a/data/assets/scene/solarsystem/planets/saturn/mimas/mimas.asset +++ b/data/assets/scene/solarsystem/planets/saturn/mimas/mimas.asset @@ -51,11 +51,40 @@ local Mimas = { } } + +local MimasLabel = { + Identifier = "MimasLabel", + Parent = Mimas.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Mimas", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.3, 10.0 }, + FadeWidths = { 0.15, 10.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Mimas Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon Mimas" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Mimas) + openspace.addSceneGraphNode(MimasLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(MimasLabel) openspace.removeSceneGraphNode(Mimas) end) diff --git a/data/assets/scene/solarsystem/planets/saturn/minor/gallic_group.asset b/data/assets/scene/solarsystem/planets/saturn/minor/gallic_group.asset index 93e00706fb..4484d53c4a 100644 --- a/data/assets/scene/solarsystem/planets/saturn/minor/gallic_group.asset +++ b/data/assets/scene/solarsystem/planets/saturn/minor/gallic_group.asset @@ -86,15 +86,54 @@ local gallicGroup = { } } +-- Generate all moon labels +local moon_labels = {} + +for i, moon in ipairs(gallicGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.1, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.25, 90.0 }, + FadeWidths = { 0.25, 90.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon " .. moonName .. " (Gallic group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(gallicGroup) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moon in ipairs(moon_labels) do + openspace.addSceneGraphNode(moon) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/saturn/minor/inuit_group.asset b/data/assets/scene/solarsystem/planets/saturn/minor/inuit_group.asset index 3ef106ffca..56b7ed7418 100644 --- a/data/assets/scene/solarsystem/planets/saturn/minor/inuit_group.asset +++ b/data/assets/scene/solarsystem/planets/saturn/minor/inuit_group.asset @@ -103,15 +103,54 @@ local inuitGroup = { } } +-- Generate all moon labels +local moon_labels = {} + +for i, moon in ipairs(inuitGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.1, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.25, 90.0 }, + FadeWidths = { 0.25, 90.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon " .. moonName .. " (Inuit group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(inuitGroup) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moon in ipairs(moon_labels) do + openspace.addSceneGraphNode(moon) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/saturn/minor/norse_group.asset b/data/assets/scene/solarsystem/planets/saturn/minor/norse_group.asset index 8d8a19bcf4..afc11e0075 100644 --- a/data/assets/scene/solarsystem/planets/saturn/minor/norse_group.asset +++ b/data/assets/scene/solarsystem/planets/saturn/minor/norse_group.asset @@ -521,15 +521,54 @@ local norseGroup = { } } +-- Generate all moon labels +local moon_labels = {} + +for i, moon in ipairs(norseGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.1, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 1.25, 90.0 }, + FadeWidths = { 0.25, 90.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon " .. moonName .. " (Norse group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(norseGroup) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moon in ipairs(moon_labels) do + openspace.addSceneGraphNode(moon) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/saturn/minor/other_group.asset b/data/assets/scene/solarsystem/planets/saturn/minor/other_group.asset index e26228cffe..19d44eba00 100644 --- a/data/assets/scene/solarsystem/planets/saturn/minor/other_group.asset +++ b/data/assets/scene/solarsystem/planets/saturn/minor/other_group.asset @@ -156,15 +156,54 @@ local otherGroup = { } } +-- Generate all moon labels +local moon_labels = {} + +for i, moon in ipairs(otherGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 5.5, + MinMaxSize = { 1, 20 }, + OrientationOption = "Camera View Direction", + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 250.0, 1500.0 }, + FadeWidths = { 100.0, 1500.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon " .. moonName .. " (other group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(otherGroup) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moon in ipairs(moon_labels) do + openspace.addSceneGraphNode(moon) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/saturn/minor/shepherd_group.asset b/data/assets/scene/solarsystem/planets/saturn/minor/shepherd_group.asset index 1a87863197..df41cfe6ac 100644 --- a/data/assets/scene/solarsystem/planets/saturn/minor/shepherd_group.asset +++ b/data/assets/scene/solarsystem/planets/saturn/minor/shepherd_group.asset @@ -147,15 +147,54 @@ local shepherdGroup = { } } +-- Generate all moon labels +local moon_labels = {} + +for i, moon in ipairs(shepherdGroup) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 5.5, + MinMaxSize = { 1, 20 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 75.0, 1000.0 }, + FadeWidths = { 25.0, 800.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon " .. moonName .. " (Shepherd group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(shepherdGroup) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moon in ipairs(moon_labels) do + openspace.addSceneGraphNode(moon) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/saturn/rhea/rhea.asset b/data/assets/scene/solarsystem/planets/saturn/rhea/rhea.asset index 228d383dad..b1b441fa04 100644 --- a/data/assets/scene/solarsystem/planets/saturn/rhea/rhea.asset +++ b/data/assets/scene/solarsystem/planets/saturn/rhea/rhea.asset @@ -51,11 +51,40 @@ local Rhea = { } } + +local RheaLabel = { + Identifier = "RheaLabel", + Parent = Rhea.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Rhea", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.3, 10.0 }, + FadeWidths = { 0.15, 10.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Rhea Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon Rhea" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Rhea) + openspace.addSceneGraphNode(RheaLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(RheaLabel) openspace.removeSceneGraphNode(Rhea) end) diff --git a/data/assets/scene/solarsystem/planets/saturn/saturn.asset b/data/assets/scene/solarsystem/planets/saturn/saturn.asset index b3deadb06a..7c0d914a74 100644 --- a/data/assets/scene/solarsystem/planets/saturn/saturn.asset +++ b/data/assets/scene/solarsystem/planets/saturn/saturn.asset @@ -67,10 +67,14 @@ local SaturnLabel = { Type = "RenderableLabel", Text = "Saturn", FontSize = 70.0, - Size = 8.85, - MinMaxSize = { 1, 100 }, + Size = 8.9, + MinMaxSize = { 1, 60 }, BlendMode = "Additive", - OrientationOption = "Camera View Direction" + OrientationOption = "Camera View Direction", + EnableFading = true, + FadeUnit = "au", + FadeDistances = { 2.5, 80.0 }, + FadeWidths = { 1.0, 100.0 } }, Tag = { "solarsystem_labels" }, GUI = { diff --git a/data/assets/scene/solarsystem/planets/saturn/tethys/tethys.asset b/data/assets/scene/solarsystem/planets/saturn/tethys/tethys.asset index 49cf57b96b..78f5825189 100644 --- a/data/assets/scene/solarsystem/planets/saturn/tethys/tethys.asset +++ b/data/assets/scene/solarsystem/planets/saturn/tethys/tethys.asset @@ -49,11 +49,40 @@ local Tethys = { } } + +local TethysLabel = { + Identifier = "TethysLabel", + Parent = Tethys.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Tethys", + FontSize = 70.0, + Size = 6.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.3, 10.0 }, + FadeWidths = { 0.15, 10.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Tethys Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon Tethys" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Tethys) + openspace.addSceneGraphNode(TethysLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(TethysLabel) openspace.removeSceneGraphNode(Tethys) end) diff --git a/data/assets/scene/solarsystem/planets/saturn/titan/titan.asset b/data/assets/scene/solarsystem/planets/saturn/titan/titan.asset index b28dda5c94..6cddd13b22 100644 --- a/data/assets/scene/solarsystem/planets/saturn/titan/titan.asset +++ b/data/assets/scene/solarsystem/planets/saturn/titan/titan.asset @@ -51,11 +51,40 @@ local Titan = { } } + +local TitanLabel = { + Identifier = "TitanLabel", + Parent = Titan.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = "Titan", + FontSize = 70.0, + Size = 6.2, + MinMaxSize = { 1, 35 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 0.5, 20.0 }, + FadeWidths = { 0.3, 20.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = "Titan Label", + Path = "/Solar System/Planets/Saturn/Moons", + Description = "Label for Saturn's moon Titan" + } +} + + asset.onInitialize(function() openspace.addSceneGraphNode(Titan) + openspace.addSceneGraphNode(TitanLabel) end) asset.onDeinitialize(function() + openspace.removeSceneGraphNode(TitanLabel) openspace.removeSceneGraphNode(Titan) end) diff --git a/data/assets/scene/solarsystem/planets/uranus/inner_moons.asset b/data/assets/scene/solarsystem/planets/uranus/inner_moons.asset index 82d0a96fd3..80d1fad724 100644 --- a/data/assets/scene/solarsystem/planets/uranus/inner_moons.asset +++ b/data/assets/scene/solarsystem/planets/uranus/inner_moons.asset @@ -241,15 +241,54 @@ local innerMoons = { } } +-- Generate all moon labels +local moon_labels = {} + +for i, moon in ipairs(innerMoons) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 5.5, + MinMaxSize = { 1, 17 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 100.0, 500.0 }, + FadeWidths = { 25.0, 500.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Uranus/Moons", + Description = "Label for Uranus' moon " .. moonName .. " (inner group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(innerMoons) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moon in ipairs(moon_labels) do + openspace.addSceneGraphNode(moon) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/uranus/irregular_prograde_moons.asset b/data/assets/scene/solarsystem/planets/uranus/irregular_prograde_moons.asset index 0d8ef7bade..ba6a20856f 100644 --- a/data/assets/scene/solarsystem/planets/uranus/irregular_prograde_moons.asset +++ b/data/assets/scene/solarsystem/planets/uranus/irregular_prograde_moons.asset @@ -35,15 +35,55 @@ local irregularMoons = { } } +--Generate all moon labels +local moon_labels = {} + +for i, moon in ipairs(irregularMoons) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 2.0, 80.0 }, + FadeWidths = { 1.0, 40.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Uranus/Moons", + Description = "Label for Uranus' moon " .. moonName .. " (Irregular prograde group)" + } + } +end + + local nodes = proceduralGlobes.createGlobes(irregularMoons) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moon in ipairs(moon_labels) do + openspace.addSceneGraphNode(moon) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/uranus/irregular_retrograde_moons.asset b/data/assets/scene/solarsystem/planets/uranus/irregular_retrograde_moons.asset index 05cffeb539..c3a57042ce 100644 --- a/data/assets/scene/solarsystem/planets/uranus/irregular_retrograde_moons.asset +++ b/data/assets/scene/solarsystem/planets/uranus/irregular_retrograde_moons.asset @@ -154,15 +154,54 @@ local irregularMoons = { } } +-- Generate all moon labels +local moon_labels = {} + +for i, moon in ipairs(irregularMoons) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 7.0, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Gm", + FadeDistances = { 2.0, 80.0 }, + FadeWidths = { 1.0, 40.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "minor_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Uranus/Moons", + Description = "Label for Uranus' moon " .. moonName .. " (Irregular retrograde group)" + } + } +end + local nodes = proceduralGlobes.createGlobes(irregularMoons) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moon in ipairs(moon_labels) do + openspace.addSceneGraphNode(moon) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/uranus/major_moons.asset b/data/assets/scene/solarsystem/planets/uranus/major_moons.asset index 10119fa76f..cc39438f0a 100644 --- a/data/assets/scene/solarsystem/planets/uranus/major_moons.asset +++ b/data/assets/scene/solarsystem/planets/uranus/major_moons.asset @@ -99,15 +99,54 @@ local majorMoons = { } } +-- Generate all moon labels +local moon_labels = {} + +for i, moon in ipairs(majorMoons) do + local moonName = moon.GUI.Name or moon.Identifier + moon_labels[i] = { + Identifier = moon.Identifier .. "Label", + Parent = moon.Identifier, + Renderable = { + Enabled = false, + Type = "RenderableLabel", + Text = moonName, + FontSize = 70.0, + Size = 5.9, + MinMaxSize = { 1, 25 }, + OrientationOption = "Camera View Direction", + BlendMode = "Normal", + EnableFading = true, + FadeUnit = "Mm", + FadeDistances = { 175.0, 4000.0 }, + FadeWidths = { 35.0, 2000.0 } + }, + Tag = { "solarsystem_labels", "moon_labels", "major_moon_labels" }, + GUI = { + Name = moonName .. " Label", + Path = "/Solar System/Planets/Uranus/Moons", + Description = "Label for Uranus' moon " .. moonName .. " (Major moon)" + } + } +end + local nodes = proceduralGlobes.createGlobes(majorMoons) asset.onInitialize(function() for _, node in ipairs(nodes) do openspace.addSceneGraphNode(node) end + + for _, moon in ipairs(moon_labels) do + openspace.addSceneGraphNode(moon) + end end) asset.onDeinitialize(function() + for i = #moon_labels, 1, -1 do + openspace.removeSceneGraphNode(moon_labels[i]) + end + for i = #nodes, 1, -1 do openspace.removeSceneGraphNode(nodes[i]) end diff --git a/data/assets/scene/solarsystem/planets/uranus/uranus.asset b/data/assets/scene/solarsystem/planets/uranus/uranus.asset index 1256804acf..58370d57f2 100644 --- a/data/assets/scene/solarsystem/planets/uranus/uranus.asset +++ b/data/assets/scene/solarsystem/planets/uranus/uranus.asset @@ -39,10 +39,14 @@ local UranusLabel = { Type = "RenderableLabel", Text = "Uranus", FontSize = 70.0, - Size = 8.86, - MinMaxSize = { 1, 100 }, + Size = 9.0, + MinMaxSize = { 1, 80 }, OrientationOption = "Camera View Direction", - BlendMode = "Additive" + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "au", + FadeDistances = { 2.5, 100.0 }, + FadeWidths = { 1.0, 120.0 } }, Tag = { "solarsystem_labels" }, GUI = { diff --git a/data/assets/scene/solarsystem/planets/venus/venus.asset b/data/assets/scene/solarsystem/planets/venus/venus.asset index 285f6587f3..4ec5f82398 100644 --- a/data/assets/scene/solarsystem/planets/venus/venus.asset +++ b/data/assets/scene/solarsystem/planets/venus/venus.asset @@ -64,10 +64,14 @@ local VenusLabel = { Type = "RenderableLabel", Text = "Venus", FontSize = 70.0, - Size = 8.54, - MinMaxSize = { 1, 100 }, + Size = 8.5, + MinMaxSize = { 1, 40 }, OrientationOption = "Camera View Direction", - BlendMode = "Additive" + BlendMode = "Additive", + EnableFading = true, + FadeUnit = "au", + FadeDistances = { 1.5, 25.0 }, + FadeWidths = { 1.0, 35.0 } }, Tag = { "solarsystem_labels" }, GUI = { diff --git a/data/assets/util/joysticks/ps4.asset b/data/assets/util/joysticks/ps4.asset index 58441ee338..770f138fcd 100644 --- a/data/assets/util/joysticks/ps4.asset +++ b/data/assets/util/joysticks/ps4.asset @@ -182,7 +182,7 @@ asset.onInitialize(function() name, controller.Square, [[ - -- <-- Copy paste your custum script here + -- <-- Copy paste your custom script here ]], "" -- <-- Description of your custom script here (optional) ) @@ -192,7 +192,7 @@ asset.onInitialize(function() name, controller.Share, [[ - -- <-- Copy paste your custum script here + -- <-- Copy paste your custom script here ]], "" -- <-- Description of your custom script here (optional) ) @@ -202,7 +202,7 @@ asset.onInitialize(function() name, controller.LeftStickButton, [[ - -- <-- Copy paste your custum script here + -- <-- Copy paste your custom script here ]], "" -- <-- Description of your custom script here (optional) ) @@ -212,7 +212,7 @@ asset.onInitialize(function() name, controller.PS, [[ - -- <-- Copy paste your custum script here + -- <-- Copy paste your custom script here ]], "" -- <-- Description of your custom script here (optional) ) diff --git a/data/assets/util/joysticks/xbox-wireless.asset b/data/assets/util/joysticks/xbox-wireless.asset index c6d3a087df..0c98947505 100644 --- a/data/assets/util/joysticks/xbox-wireless.asset +++ b/data/assets/util/joysticks/xbox-wireless.asset @@ -180,7 +180,7 @@ asset.onInitialize(function() name, controller.X, [[ - -- <-- Copy paste your custum script here + -- <-- Copy paste your custom script here ]], "" -- <-- Description of your custom script here (optional) ) @@ -190,7 +190,7 @@ asset.onInitialize(function() name, controller.LeftStickButton, [[ - -- <-- Copy paste your custum script here + -- <-- Copy paste your custom script here ]], "" -- <-- Description of your custom script here (optional) ) diff --git a/data/assets/util/joysticks/xbox.asset b/data/assets/util/joysticks/xbox.asset index e1e93600fb..03685efbfe 100644 --- a/data/assets/util/joysticks/xbox.asset +++ b/data/assets/util/joysticks/xbox.asset @@ -180,7 +180,7 @@ asset.onInitialize(function() name, controller.X, [[ - -- <-- Copy paste your custum script here + -- <-- Copy paste your custom script here ]], "" -- <-- Description of your custom script here (optional) ) @@ -190,7 +190,7 @@ asset.onInitialize(function() name, controller.LeftStickButton, [[ - -- <-- Copy paste your custum script here + -- <-- Copy paste your custom script here ]], "" -- <-- Description of your custom script here (optional) ) diff --git a/data/assets/util/webgui.asset b/data/assets/util/webgui.asset index 3a087a8a41..1e5501383a 100644 --- a/data/assets/util/webgui.asset +++ b/data/assets/util/webgui.asset @@ -3,7 +3,7 @@ asset.require("./static_server") local guiCustomization = asset.require("customization/gui") -- Select which commit hashes to use for the frontend and backend -local frontendHash = "748c523b158be5a63d6907b054909c1ac53818d0" +local frontendHash = "5011a84942cee1567565a4be250501f4453f26a2" local dataProvider = "data.openspaceproject.com/files/webgui" local frontend = asset.syncedResource({ @@ -72,7 +72,7 @@ asset.onDeinitialize(function () end) function setCefRoute(route) - local port = 4680 + local port = openspace.getPropertyValue("Modules.WebGui.Port") -- As a developer, you can manually serve the webgui from port 4690 -- with the command `npm start` in the web gui repository if guiCustomization.webguiDevelopmentMode then @@ -90,7 +90,6 @@ asset.export("setCefRoute", setCefRoute) asset.meta = { Name = "WebGUI", Version = "0.1", - Description = "insert CEF rant", Author = "OpenSpace Team", URL = "http://openspaceproject.com", License = "MIT license" diff --git a/ext/ghoul b/ext/ghoul index 50846bc21a..21115932ce 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 50846bc21aa087c0843c6f3107200680dda8c3e2 +Subproject commit 21115932cebd960d289f75a463c21aacee4041e5 diff --git a/include/openspace/documentation/verifier.h b/include/openspace/documentation/verifier.h index c0cdcf57c2..5e90b29ea2 100644 --- a/include/openspace/documentation/verifier.h +++ b/include/openspace/documentation/verifier.h @@ -174,6 +174,8 @@ private: * refers to an existing file on disk. */ struct FileVerifier : public StringVerifier { + FileVerifier(); + TestResult operator()(const ghoul::Dictionary& dict, const std::string& key) const override; @@ -185,6 +187,8 @@ struct FileVerifier : public StringVerifier { * refers to an existing directory on disk. */ struct DirectoryVerifier : public StringVerifier { + DirectoryVerifier(); + TestResult operator()(const ghoul::Dictionary& dict, const std::string& key) const override; @@ -196,6 +200,8 @@ struct DirectoryVerifier : public StringVerifier { * a valid date time */ struct DateTimeVerifier : public StringVerifier { + DateTimeVerifier(); + TestResult operator()(const ghoul::Dictionary& dict, const std::string& key) const override; diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index 5a9a1b0033..74a0607bb5 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -64,7 +64,7 @@ struct ShutdownInformation { struct CommandlineArguments { std::string configurationName; - std::string configurationOverride; + std::vector configurationOverride; }; class OpenSpaceEngine : public properties::PropertyOwner { diff --git a/include/openspace/interaction/action.h b/include/openspace/interaction/action.h index 6cec2296d6..af46d8c787 100644 --- a/include/openspace/interaction/action.h +++ b/include/openspace/interaction/action.h @@ -57,7 +57,7 @@ struct Action { /// This variable defines a subdivision of where this action is placed in a user /// interface. The individual path components are separated by '/' with a leading '/' /// for the root path - std::string guiPath; + std::string guiPath = "/"; /// If this value is set to `Yes`, the execution of this action is synchronized to /// other OpenSpace instances, for example other nodes in a cluster environment, or diff --git a/include/openspace/navigation/navigationhandler.h b/include/openspace/navigation/navigationhandler.h index dd4ca1d04f..4981274e08 100644 --- a/include/openspace/navigation/navigationhandler.h +++ b/include/openspace/navigation/navigationhandler.h @@ -91,6 +91,8 @@ public: void keyboardCallback(Key key, KeyModifier modifier, KeyAction action); bool disabledKeybindings() const; + bool disabledMouse() const; + bool disabledJoystick() const; void mouseButtonCallback(MouseButton button, MouseAction action); void mousePositionCallback(double x, double y); diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index 69907001e1..6eeb092db7 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -84,12 +85,6 @@ public: Scene(std::unique_ptr initializer); virtual ~Scene() override; - /** - * Clear the scene graph, - * i.e. set the root node to nullptr and deallocate all scene graph nodes. - */ - void clear(); - /** * Attach node to the root */ @@ -182,12 +177,16 @@ public: * \param prop The property that should be called to update itself every frame until * \p durationSeconds seconds have passed * \param durationSeconds The number of seconds that the interpolation will run for + * \param postScript A Lua script that will be executed when the interpolation + * finishes + * \param easingFunction A function that determines who the interpolation occurs * * \pre \p prop must not be \c nullptr * \pre \p durationSeconds must be positive and not 0 * \post A new interpolation record exists for \p that is not expired */ void addPropertyInterpolation(properties::Property* prop, float durationSeconds, + std::string postScript = "", ghoul::EasingFunction easingFunction = ghoul::EasingFunction::Linear); /** @@ -259,6 +258,13 @@ public: std::vector propertiesMatchingRegex( std::string propertyString); + /** + * Returns a list of all unique tags that are used in the currently loaded scene. + * + * \return A list of all unique tags that are used in the currently loaded scene. + */ + std::vector allTags(); + private: /** * Accepts string version of a property value from a profile, converts it to the @@ -339,6 +345,8 @@ private: properties::Property* prop; std::chrono::time_point beginTime; float durationSeconds; + std::string postScript; + ghoul::EasingFunc easingFunction; bool isExpired = false; }; diff --git a/include/openspace/util/spicemanager.h b/include/openspace/util/spicemanager.h index f345115fa3..b7b4724de1 100644 --- a/include/openspace/util/spicemanager.h +++ b/include/openspace/util/spicemanager.h @@ -557,6 +557,12 @@ public: ephemerisTime, format )); } + + if (outBuf[0] == '*') { + // The conversion failed and we need to use et2utc + constexpr int SecondsPrecision = 3; + et2utc_c(ephemerisTime, "C", SecondsPrecision, bufferSize, outBuf); + } } std::string dateFromEphemerisTime(double ephemerisTime, const char* format); diff --git a/modules/base/CMakeLists.txt b/modules/base/CMakeLists.txt index a19b4f83b1..220360e2a9 100644 --- a/modules/base/CMakeLists.txt +++ b/modules/base/CMakeLists.txt @@ -30,6 +30,7 @@ set(HEADER_FILES dashboard/dashboarditemdistance.h dashboard/dashboarditemelapsedtime.h dashboard/dashboarditemframerate.h + dashboard/dashboarditeminputstate.h dashboard/dashboarditemmission.h dashboard/dashboarditemparallelconnection.h dashboard/dashboarditempropertyvalue.h @@ -85,6 +86,7 @@ set(SOURCE_FILES dashboard/dashboarditemdistance.cpp dashboard/dashboarditemelapsedtime.cpp dashboard/dashboarditemframerate.cpp + dashboard/dashboarditeminputstate.cpp dashboard/dashboarditemmission.cpp dashboard/dashboarditemparallelconnection.cpp dashboard/dashboarditempropertyvalue.cpp diff --git a/modules/base/basemodule.cpp b/modules/base/basemodule.cpp index 984c568940..7b8ef29316 100644 --- a/modules/base/basemodule.cpp +++ b/modules/base/basemodule.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -109,6 +110,7 @@ void BaseModule::internalInitialize(const ghoul::Dictionary&) { fDashboard->registerClass("DashboardItemDistance"); fDashboard->registerClass("DashboardItemElapsedTime"); fDashboard->registerClass("DashboardItemFramerate"); + fDashboard->registerClass("DashboardItemInputState"); fDashboard->registerClass("DashboardItemMission"); fDashboard->registerClass( "DashboardItemParallelConnection" diff --git a/modules/base/dashboard/dashboarditemdistance.cpp b/modules/base/dashboard/dashboarditemdistance.cpp index df869afcc2..733b528dcb 100644 --- a/modules/base/dashboard/dashboarditemdistance.cpp +++ b/modules/base/dashboard/dashboarditemdistance.cpp @@ -354,7 +354,7 @@ void DashboardItemDistance::render(glm::vec2& penPosition) { else { const DistanceUnit unit = static_cast(_requestedUnit.value()); const double convertedD = convertMeters(d, unit); - dist = { convertedD, nameForDistanceUnit(unit, convertedD != 1.0) }; + dist = std::pair(convertedD, nameForDistanceUnit(unit, convertedD != 1.0)); } std::fill(_buffer.begin(), _buffer.end(), char(0)); @@ -385,7 +385,7 @@ glm::vec2 DashboardItemDistance::size() const { else { DistanceUnit unit = static_cast(_requestedUnit.value()); double convertedD = convertMeters(d, unit); - dist = { convertedD, nameForDistanceUnit(unit, convertedD != 1.0) }; + dist = std::pair(convertedD, nameForDistanceUnit(unit, convertedD != 1.0)); } return _font->boundingBox( diff --git a/modules/base/dashboard/dashboarditeminputstate.cpp b/modules/base/dashboard/dashboarditeminputstate.cpp new file mode 100644 index 0000000000..956cbb5ea7 --- /dev/null +++ b/modules/base/dashboard/dashboarditeminputstate.cpp @@ -0,0 +1,223 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2023 * + * * + * 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 + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + constexpr openspace::properties::Property::PropertyInfo ShowWhenEnabledInfo = { + "ShowWhenEnabled", + "Show when enabled", + "Show text when the input is enabled" + }; + + constexpr openspace::properties::Property::PropertyInfo ShowWhenDisabledInfo = { + "ShowWhenDisabled", + "Show when disabled", + "Show text when the input is disabled" + }; + + constexpr openspace::properties::Property::PropertyInfo ShowKeyboardInfo = { + "ShowKeyboard", + "Show Keyboard information", + "Display the state of the keyboard input" + }; + + constexpr openspace::properties::Property::PropertyInfo ShowMouseInfo = { + "ShowMouse", + "Show Mouse information", + "Display the state of the mouse input" + }; + + constexpr openspace::properties::Property::PropertyInfo ShowJoystickInfo = { + "ShowJoystick", + "Show Joystick information", + "Display the state of the joystick input" + }; + + struct [[codegen::Dictionary(DashboardItemPropertyValue)]] Parameters { + // [[codegen::verbatim(ShowWhenEnabledInfo.description)]] + std::optional showWhenEnabled; + + // [[codegen::verbatim(ShowWhenDisabledInfo.description)]] + std::optional showWhenDisabled; + + // [[codegen::verbatim(ShowKeyboardInfo.description)]] + std::optional showKeyboard; + + // [[codegen::verbatim(ShowMouseInfo.description)]] + std::optional showMouse; + + // [[codegen::verbatim(ShowJoystickInfo.description)]] + std::optional showJoystick; + }; +#include "dashboarditeminputstate_codegen.cpp" +} // namespace + +namespace openspace { + +documentation::Documentation DashboardItemInputState::Documentation() { + return codegen::doc( + "base_dashboarditem_inputstate", + DashboardTextItem::Documentation() + ); +} + +DashboardItemInputState::DashboardItemInputState(const ghoul::Dictionary& dictionary) + : DashboardTextItem(dictionary) + , _showWhenEnabled(ShowWhenEnabledInfo, true) + , _showWhenDisabled(ShowWhenDisabledInfo, true) + , _showKeyboard(ShowKeyboardInfo, true) + , _showMouse(ShowMouseInfo, true) + , _showJoystick(ShowJoystickInfo, true) +{ + const Parameters p = codegen::bake(dictionary); + + _showWhenEnabled = p.showWhenEnabled.value_or(_showWhenEnabled); + addProperty(_showWhenEnabled); + + _showWhenDisabled = p.showWhenDisabled.value_or(_showWhenDisabled); + addProperty(_showWhenDisabled); + + _showKeyboard = p.showKeyboard.value_or(_showKeyboard); + addProperty(_showKeyboard); + + _showMouse = p.showMouse.value_or(_showMouse); + addProperty(_showMouse); + + _showJoystick = p.showJoystick.value_or(_showJoystick); + addProperty(_showJoystick); +} + +void DashboardItemInputState::render(glm::vec2& penPosition) { + ZoneScoped + + std::vector text; + if (_showKeyboard) { + if (global::navigationHandler->disabledKeybindings()) { + if (_showWhenDisabled) { + text.push_back("Keyboard shortcuts disabled"); + } + } + else { + if (_showWhenEnabled) { + text.push_back("Keyboard shortcuts enabled"); + } + } + } + + if (_showMouse) { + if (global::navigationHandler->disabledMouse()) { + if (_showWhenDisabled) { + text.push_back("Mouse input disabled"); + } + } + else { + if (_showWhenEnabled) { + text.push_back("Mouse input enabled"); + } + } + } + + if (_showJoystick) { + if (global::navigationHandler->disabledJoystick()) { + if (_showWhenDisabled) { + text.push_back("Joystick input disabled"); + } + } + else { + if (_showWhenEnabled) { + text.push_back("Joystick input enabled"); + } + } + } + + if (!text.empty()) { + std::string t = ghoul::join(std::move(text), "\n"); + RenderFont(*_font, penPosition, t); + penPosition.y -= _font->height(); + } +} + +glm::vec2 DashboardItemInputState::size() const { + ZoneScoped + + std::vector text; + if (_showKeyboard) { + if (global::navigationHandler->disabledKeybindings()) { + if (_showWhenDisabled) { + text.push_back("Keyboard shortcuts disabled"); + } + } + else { + if (_showWhenEnabled) { + text.push_back("Keyboard shortcuts enabled"); + } + } + } + + if (_showMouse) { + if (global::navigationHandler->disabledMouse()) { + if (_showWhenDisabled) { + text.push_back("Mouse input disabled"); + } + } + else { + if (_showWhenEnabled) { + text.push_back("Mouse input disabled"); + } + } + } + + if (_showJoystick) { + if (global::navigationHandler->disabledJoystick()) { + if (_showWhenDisabled) { + text.push_back("Joystick input disabled"); + } + } + else { + if (_showWhenEnabled) { + text.push_back("Joystick input disabled"); + } + } + } + + if (!text.empty()) { + std::string t = ghoul::join(std::move(text), "\n"); + return _font->boundingBox(t); + } + else { + return glm::vec2(0.f, 0.f); + } +} + +} // namespace openspace diff --git a/modules/base/dashboard/dashboarditeminputstate.h b/modules/base/dashboard/dashboarditeminputstate.h new file mode 100644 index 0000000000..b49b21709e --- /dev/null +++ b/modules/base/dashboard/dashboarditeminputstate.h @@ -0,0 +1,59 @@ +/***************************************************************************************** + * * + * OpenSpace * + * * + * Copyright (c) 2014-2023 * + * * + * 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___DASHBOARDITEMINPUTSTATE___H__ +#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMINPUTSTATE___H__ + +#include + +#include + +namespace openspace { + +namespace properties { class Property; } +namespace documentation { struct Documentation; } + +class DashboardItemInputState : public DashboardTextItem { +public: + DashboardItemInputState(const ghoul::Dictionary& dictionary); + ~DashboardItemInputState() override = default; + + void render(glm::vec2& penPosition) override; + + glm::vec2 size() const override; + + static documentation::Documentation Documentation(); + +private: + properties::BoolProperty _showWhenEnabled; + properties::BoolProperty _showWhenDisabled; + + properties::BoolProperty _showKeyboard; + properties::BoolProperty _showMouse; + properties::BoolProperty _showJoystick; +}; + +} // namespace openspace + +#endif // __OPENSPACE_MODULE_BASE___DASHBOARDITEMINPUTSTATE___H__ diff --git a/modules/base/dashboard/dashboarditemsimulationincrement.cpp b/modules/base/dashboard/dashboarditemsimulationincrement.cpp index 10f950819d..d70db523b4 100644 --- a/modules/base/dashboard/dashboarditemsimulationincrement.cpp +++ b/modules/base/dashboard/dashboarditemsimulationincrement.cpp @@ -167,17 +167,17 @@ void DashboardItemSimulationIncrement::render(glm::vec2& penPosition) { const TimeUnit unit = static_cast(_requestedUnit.value()); const double convTarget = convertTime(targetDt, TimeUnit::Second, unit); - targetDeltaTime = { + targetDeltaTime = std::pair( convTarget, std::string(nameForTimeUnit(unit, convTarget != 1.0)) - }; + ); if (targetDt != currentDt) { const double convCurrent = convertTime(currentDt, TimeUnit::Second, unit); - currentDeltaTime = { + currentDeltaTime = std::pair( convCurrent, std::string(nameForTimeUnit(unit, convCurrent != 1.0)) - }; + ); } } @@ -225,10 +225,10 @@ glm::vec2 DashboardItemSimulationIncrement::size() const { else { TimeUnit unit = static_cast(_requestedUnit.value()); double convertedT = convertTime(t, TimeUnit::Second, unit); - deltaTime = { + deltaTime = std::pair( convertedT, std::string(nameForTimeUnit(unit, convertedT != 1.0)) - }; + ); } return _font->boundingBox( diff --git a/modules/base/dashboard/dashboarditemvelocity.cpp b/modules/base/dashboard/dashboarditemvelocity.cpp index b749d439e5..c5e3e86168 100644 --- a/modules/base/dashboard/dashboarditemvelocity.cpp +++ b/modules/base/dashboard/dashboarditemvelocity.cpp @@ -137,7 +137,7 @@ void DashboardItemVelocity::render(glm::vec2& penPosition) { else { const DistanceUnit unit = static_cast(_requestedUnit.value()); const double convertedD = convertMeters(speedPerSecond, unit); - dist = { convertedD, nameForDistanceUnit(unit, convertedD != 1.0) }; + dist = std::pair(convertedD, nameForDistanceUnit(unit, convertedD != 1.0)); } RenderFont( @@ -163,7 +163,7 @@ glm::vec2 DashboardItemVelocity::size() const { else { DistanceUnit unit = static_cast(_requestedUnit.value()); double convertedD = convertMeters(d, unit); - dist = { convertedD, nameForDistanceUnit(unit, convertedD != 1.0) }; + dist = std::pair(convertedD, nameForDistanceUnit(unit, convertedD != 1.0)); } return _font->boundingBox( diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index 16fcddda97..434e02d217 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -62,12 +62,6 @@ namespace { { "Color Adding", ColorAddingBlending } }; - constexpr openspace::properties::Property::PropertyInfo EnableAnimationInfo = { - "EnableAnimation", - "Enable Animation", - "Enable or disable the animation for the model if it has any" - }; - constexpr std::array UniformNames = { "opacity", "nLightSources", "lightDirectionsViewSpace", "lightIntensities", "modelViewTransform", "normalTransform", "projectionTransform", @@ -75,6 +69,12 @@ namespace { "specularIntensity", "opacityBlending" }; + constexpr openspace::properties::Property::PropertyInfo EnableAnimationInfo = { + "EnableAnimation", + "Enable Animation", + "Enable or disable the animation for the model if it has any" + }; + constexpr openspace::properties::Property::PropertyInfo AmbientIntensityInfo = { "AmbientIntensity", "Ambient Intensity", diff --git a/modules/base/rendering/renderablenodeline.cpp b/modules/base/rendering/renderablenodeline.cpp index 982b53a82a..4a86ec7d79 100644 --- a/modules/base/rendering/renderablenodeline.cpp +++ b/modules/base/rendering/renderablenodeline.cpp @@ -42,15 +42,15 @@ namespace { constexpr openspace::properties::Property::PropertyInfo StartNodeInfo = { "StartNode", "Start Node", - "The identifier of the node the line starts from. " - "Defaults to 'Root' if not specified. " + "The identifier of the node the line starts from. Defaults to 'Root' if not " + "specified." }; constexpr openspace::properties::Property::PropertyInfo EndNodeInfo = { "EndNode", "End Node", - "The identifier of the node the line ends at. " - "Defaults to 'Root' if not specified. " + "The identifier of the node the line ends at. Defaults to 'Root' if not " + "specified." }; constexpr openspace::properties::Property::PropertyInfo LineColorInfo = { diff --git a/modules/base/rendering/renderableplane.cpp b/modules/base/rendering/renderableplane.cpp index 120a3b4d95..9eff195a2e 100644 --- a/modules/base/rendering/renderableplane.cpp +++ b/modules/base/rendering/renderableplane.cpp @@ -79,8 +79,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo MultiplyColorInfo = { "MultiplyColor", "Multiply Color", - "If set, the plane's texture is multiplied with this color. " - "Useful for applying a color grayscale images" + "If set, the plane's texture is multiplied with this color. Useful for applying " + "a color grayscale images" }; struct [[codegen::Dictionary(RenderablePlane)]] Parameters { diff --git a/modules/base/rendering/renderableprism.cpp b/modules/base/rendering/renderableprism.cpp index 564cb69681..4ec8fa306f 100644 --- a/modules/base/rendering/renderableprism.cpp +++ b/modules/base/rendering/renderableprism.cpp @@ -49,9 +49,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo LinesInfo = { "NumLines", "Number of Lines", - "The number of lines connecting the two shapes of the prism. " - "They will be evenly distributed around the bounding circle that makes " - "up the shape of the prism" + "The number of lines connecting the two shapes of the prism. They will be evenly " + "distributed around the bounding circle that makes up the shape of the prism" }; constexpr openspace::properties::Property::PropertyInfo RadiusInfo = { @@ -63,8 +62,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo BaseRadiusInfo = { "BaseRadius", "Base Radius", - "The radius of the base of the prism's shape, in meters. By default it is " - "given the same radius as the outer shape" + "The radius of the base of the prism's shape, in meters. By default it is given " + "the same radius as the outer shape" }; constexpr openspace::properties::Property::PropertyInfo LineWidthInfo = { diff --git a/modules/base/rendering/renderabletrail.cpp b/modules/base/rendering/renderabletrail.cpp index b84ed5157e..608709fb9c 100644 --- a/modules/base/rendering/renderabletrail.cpp +++ b/modules/base/rendering/renderabletrail.cpp @@ -117,7 +117,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo RenderingModeInfo = { "Rendering", "Rendering Mode", - "Determines how the trail should be rendered to the screen.If 'Lines' is " + "Determines how the trail should be rendered to the screen. If 'Lines' is " "selected, only the line part is visible, if 'Points' is selected, only the " "corresponding points (and subpoints) are shown. 'Lines+Points' shows both parts" }; diff --git a/modules/base/rendering/renderabletrailtrajectory.cpp b/modules/base/rendering/renderabletrailtrajectory.cpp index 3f876a5be6..8799a98c06 100644 --- a/modules/base/rendering/renderabletrailtrajectory.cpp +++ b/modules/base/rendering/renderabletrailtrajectory.cpp @@ -240,9 +240,11 @@ void RenderableTrailTrajectory::update(const UpdateData& data) { // If we are inside the valid time, we additionally want to draw a line from the last // correct point to the current location of the object - if (data.time.j2000Seconds() >= _start && + if (data.time.j2000Seconds() > _start && data.time.j2000Seconds() <= _end && !_renderFullTrail) { + ghoul_assert(_primaryRenderInformation.count > 0, "No vertices available"); + // Copy the last valid location glm::dvec3 v0( _vertexArray[_primaryRenderInformation.count - 1].x, diff --git a/modules/base/rendering/screenspacedashboard.cpp b/modules/base/rendering/screenspacedashboard.cpp index 2225beda35..35a5bdc657 100644 --- a/modules/base/rendering/screenspacedashboard.cpp +++ b/modules/base/rendering/screenspacedashboard.cpp @@ -119,7 +119,7 @@ bool ScreenSpaceDashboard::isReady() const { void ScreenSpaceDashboard::update() { if (global::windowDelegate->windowHasResized()) { const glm::ivec2 size = global::windowDelegate->currentDrawBufferResolution(); - _size = { 0.f, 0.f, size.x, size.y }; + _size = glm::vec4(0.f, 0.f, size.x, size.y); createFramebuffer(); } } diff --git a/modules/base/rendering/screenspaceimagelocal.cpp b/modules/base/rendering/screenspaceimagelocal.cpp index 0c16b436f9..7b302a9068 100644 --- a/modules/base/rendering/screenspaceimagelocal.cpp +++ b/modules/base/rendering/screenspaceimagelocal.cpp @@ -124,6 +124,10 @@ void ScreenSpaceImageLocal::update() { // image is only RGB glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if (texture->format() == ghoul::opengl::Texture::Format::Red) { + texture->setSwizzleMask({ GL_RED, GL_RED, GL_RED, GL_ONE }); + } + texture->uploadTexture(); texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); texture->purgeFromRAM(); diff --git a/modules/base/rendering/screenspaceimageonline.cpp b/modules/base/rendering/screenspaceimageonline.cpp index 7620f14629..c5cb15a5e1 100644 --- a/modules/base/rendering/screenspaceimageonline.cpp +++ b/modules/base/rendering/screenspaceimageonline.cpp @@ -127,6 +127,10 @@ void ScreenSpaceImageOnline::update() { // image is only RGB glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if (texture->format() == ghoul::opengl::Texture::Format::Red) { + texture->setSwizzleMask({ GL_RED, GL_RED, GL_RED, GL_ONE }); + } + texture->uploadTexture(); texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); texture->purgeFromRAM(); diff --git a/modules/base/rotation/fixedrotation.cpp b/modules/base/rotation/fixedrotation.cpp index d12cafd58a..480c41816f 100644 --- a/modules/base/rotation/fixedrotation.cpp +++ b/modules/base/rotation/fixedrotation.cpp @@ -469,7 +469,7 @@ bool FixedRotation::initialize() { } // No need to hold on to the data - _constructorDictionary = {}; + _constructorDictionary = ghoul::Dictionary(); return res; } diff --git a/modules/base/timeframe/timeframeunion.cpp b/modules/base/timeframe/timeframeunion.cpp index bb2f1315be..1e7c12b301 100644 --- a/modules/base/timeframe/timeframeunion.cpp +++ b/modules/base/timeframe/timeframeunion.cpp @@ -34,9 +34,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo TimeFramesInfo = { "TimeFrames", "Time Frames", - "A vector of time frames to combine into one. " - "The time frame is active when any of the contained time frames are, " - "but not in gaps between contained time frames" + "A vector of time frames to combine into one. The time frame is active when any " + "of the contained time frames are, but not in gaps between contained time frames" }; struct [[codegen::Dictionary(TimeFrameUnion)]] Parameters { diff --git a/modules/debugging/debuggingmodule_lua.inl b/modules/debugging/debuggingmodule_lua.inl index 6dac57ec39..febff86860 100644 --- a/modules/debugging/debuggingmodule_lua.inl +++ b/modules/debugging/debuggingmodule_lua.inl @@ -28,8 +28,8 @@ constexpr const char RenderedPathIdentifier[] = "CurrentCameraPath"; constexpr const char RenderedPointsIdentifier[] = "CurrentPathControlPoints"; constexpr const char DebuggingGuiPath[] = "/Debugging"; -constexpr glm::vec3 PathColor = { 1.0, 1.0, 0.0 }; -constexpr glm::vec3 OrientationLineColor = { 0.0, 1.0, 1.0 }; +constexpr glm::vec3 PathColor = glm::vec3(1.0, 1.0, 0.0); +constexpr glm::vec3 OrientationLineColor = glm::vec3(0.0, 1.0, 1.0); // Conver the input string to a format that is valid as an identifier std::string makeIdentifier(std::string s) { diff --git a/modules/debugging/rendering/debugrenderer.h b/modules/debugging/rendering/debugrenderer.h index 8fdaccf292..b0132ec3ce 100644 --- a/modules/debugging/rendering/debugrenderer.h +++ b/modules/debugging/rendering/debugrenderer.h @@ -68,7 +68,7 @@ public: * Render the vector of clipping space points in the specified mode and color. */ void renderVertices(const Vertices& clippingSpacePoints, GLenum mode, - const glm::vec4& color = { 1.f, 0.f, 0.f, 1.f }) const; + const glm::vec4& color = glm::vec4(1.f, 0.f, 0.f, 1.f)) const; /** * Takes a vector of exactly 8 vertices, i.e. corner points in a box. @@ -84,7 +84,7 @@ public: * */ void renderBoxFaces(const Vertices& clippingSpaceBoxCorners, - const glm::vec4& rgba = { 1.f, 0.f, 0.f, 1.f }) const; + const glm::vec4& rgba = glm::vec4(1.f, 0.f, 0.f, 1.f)) const; /** * Takes a vector of exactly 8 vertices, i.e. corner points in a box. @@ -100,7 +100,7 @@ public: * */ void renderBoxEdges(const Vertices& clippingSpaceBoxCorners, - const glm::vec4& rgba = { 1.f, 0.f, 0.f, 1.f }) const; + const glm::vec4& rgba = glm::vec4(1.f, 0.f, 0.f, 1.f)) const; /** * Takes a vector of exactly 8 vertices, i.e. corner points in a box. @@ -116,7 +116,7 @@ public: * */ void renderNiceBox(const Vertices& clippingSpaceBoxCorners, - const glm::vec4& rgba = { 1.f, 0.f, 0.f, 0.3f }) const; + const glm::vec4& rgba = glm::vec4(1.f, 0.f, 0.f, 0.3f)) const; /** * Input arguments: @@ -126,7 +126,7 @@ public: * 3. RGBA rgba Color to draw the view frustum with */ void renderCameraFrustum(const RenderData& data, const Camera& otherCamera, - const glm::vec4& rgba = { 1.f, 1.f, 1.f, 0.3f }) const; + const glm::vec4& rgba = glm::vec4(1.f, 1.f, 1.f, 0.3f)) const; protected: std::unique_ptr _programObject; diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp index 57e61eac44..8918d2f34e 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp @@ -135,15 +135,15 @@ namespace { constexpr openspace::properties::Property::PropertyInfo SizeOptionInfo = { "SizeOption", "Size Option Variable", - "This value determines which paramenter (datavar) is used for scaling " - "of the astronomical objects" + "This value determines which paramenter (datavar) is used for scaling of the " + "astronomical objects" }; constexpr openspace::properties::Property::PropertyInfo RenderOptionInfo = { "RenderOption", "Render Option", - "Option wether the billboards should face the camera or not. Used for " - "non-linear display envierments such as fisheye." + "Option wether the billboards should face the camera or not. Used for non-linear " + "display envierments such as fisheye." }; constexpr openspace::properties::Property::PropertyInfo FadeInDistancesInfo = { diff --git a/modules/exoplanets/exoplanetsmodule.cpp b/modules/exoplanets/exoplanetsmodule.cpp index 5e8adff39d..d7c9aa84cd 100644 --- a/modules/exoplanets/exoplanetsmodule.cpp +++ b/modules/exoplanets/exoplanetsmodule.cpp @@ -113,8 +113,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ShowHabitableZoneInfo = { "ShowHabitableZone", "Show Habitable Zone", - "If true, the habitable zone disc is enabled per default when an " - "exoplanet system is created" + "If true, the habitable zone disc is enabled per default when an exoplanet " + "system is created" }; constexpr openspace::properties::Property::PropertyInfo UseOptimisticZoneInfo = { @@ -275,7 +275,7 @@ float ExoplanetsModule::habitableZoneOpacity() const { void ExoplanetsModule::internalInitialize(const ghoul::Dictionary& dict) { const Parameters p = codegen::bake(dict); - _enabled = p.enabled.value_or(true); + _enabled = p.enabled.value_or(_enabled); if (p.dataFolder.has_value()) { _exoplanetsDataFolder = p.dataFolder.value().string(); diff --git a/modules/exoplanets/rendering/renderableorbitdisc.cpp b/modules/exoplanets/rendering/renderableorbitdisc.cpp index b96a3f0aa6..e26be37267 100644 --- a/modules/exoplanets/rendering/renderableorbitdisc.cpp +++ b/modules/exoplanets/rendering/renderableorbitdisc.cpp @@ -77,8 +77,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo MultiplyColorInfo = { "MultiplyColor", "Multiply Color", - "If set, the disc's texture is multiplied with this color. " - "Useful for applying a color grayscale images" + "If set, the disc's texture is multiplied with this color. Useful for applying a " + "color grayscale images" }; struct [[codegen::Dictionary(RenderableOrbitDisc)]] Parameters { diff --git a/modules/fitsfilereader/src/fitsfilereader.cpp b/modules/fitsfilereader/src/fitsfilereader.cpp index 63cd6ad1d2..1ac6ed09a8 100644 --- a/modules/fitsfilereader/src/fitsfilereader.cpp +++ b/modules/fitsfilereader/src/fitsfilereader.cpp @@ -174,10 +174,10 @@ std::shared_ptr> FitsFileReader::readTable(const std::filesystem::p // Create TableData object of table contents. TableData loadedTable = { - std::move(contents), - static_cast(table.rows()), - table.getRowsize(), - table.name() + .contents = std::move(contents), + .readRows = static_cast(table.rows()), + .optimalRowsize = table.getRowsize(), + .name = table.name() }; return std::make_shared>(loadedTable); @@ -660,7 +660,11 @@ const std::shared_ptr> FitsFileReader::readImageInternal(ExtHDU& im try { std::valarray contents; image.read(contents); - ImageData im = { std::move(contents), image.axis(0), image.axis(1) }; + ImageData im = { + .contents = std::move(contents), + .width = image.axis(0), + .height = image.axis(1) + }; return std::make_shared>(im); } catch (const FitsException& e){ LERROR("Could not read FITS image EXTHDU. " + e.message()); @@ -673,7 +677,11 @@ const std::shared_ptr> FitsFileReader::readImageInternal(PHDU& imag try { std::valarray contents; image.read(contents); - ImageData im = { std::move(contents), image.axis(0), image.axis(1) }; + ImageData im = { + .contents = std::move(contents), + .width = image.axis(0), + .height = image.axis(1) + }; return std::make_shared>(im); } catch (const FitsException& e){ LERROR("Could not read FITS image PHDU. " + e.message()); diff --git a/modules/gaia/gaiamodule.cpp b/modules/gaia/gaiamodule.cpp index cbd1ef62cd..6120886dae 100644 --- a/modules/gaia/gaiamodule.cpp +++ b/modules/gaia/gaiamodule.cpp @@ -62,12 +62,12 @@ std::vector GaiaModule::documentations() const { } scripting::LuaLibrary GaiaModule::luaLibrary() const { - scripting::LuaLibrary res; - res.name = "gaia"; - res.scripts = { - absPath("${MODULE_GAIA}/scripts/filtering.lua") + return { + .name = "gaia", + .scripts = { + absPath("${MODULE_GAIA}/scripts/filtering.lua") + } }; - return res; } } // namespace openspace diff --git a/modules/gaia/rendering/renderablegaiastars.cpp b/modules/gaia/rendering/renderablegaiastars.cpp index 7957e28979..ccea1a00bf 100644 --- a/modules/gaia/rendering/renderablegaiastars.cpp +++ b/modules/gaia/rendering/renderablegaiastars.cpp @@ -116,9 +116,9 @@ namespace { constexpr openspace::properties::Property::PropertyInfo CutOffThresholdInfo = { "CutOffThreshold", "Cut Off Threshold", - "Set threshold for when to cut off star rendering. " - "Stars closer than this threshold are given full opacity. " - "Farther away, stars dim proportionally to the 4-logarithm of their distance" + "Set threshold for when to cut off star rendering. Stars closer than this " + "threshold are given full opacity. Farther away, stars dim proportionally to the " + "4-logarithm of their distance" }; constexpr openspace::properties::Property::PropertyInfo SharpnessInfo = { @@ -136,8 +136,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo CloseUpBoostDistInfo = { "CloseUpBoostDist", "Close-Up Boost Distance [pc]", - "Set the distance where stars starts to increase in size. Unit is Parsec" - "[Works only with billboards]" + "Set the distance where stars starts to increase in size. Unit is Parsec [Works " + "only with billboards]" }; constexpr openspace::properties::Property::PropertyInfo TmPointFilterSizeInfo = { @@ -182,8 +182,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo FirstRowInfo = { "FirstRow", "First Row to Read", - "Defines the first row that will be read from the specified FITS file" - "No need to define if data already has been processed. [Works only with " + "Defines the first row that will be read from the specified FITS file No need to " + "define if data already has been processed. [Works only with " "FileReaderOption::Fits]" }; @@ -198,9 +198,9 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ColumnNamesInfo = { "ColumnNames", "Column Names", - "A list of strings with the names of all the columns that are to be " - "read from the specified FITS file. No need to define if data already " - "has been processed. [Works only with FileReaderOption::Fits]" + "A list of strings with the names of all the columns that are to be read from " + "the specified FITS file. No need to define if data already has been processed. " + "[Works only with FileReaderOption::Fits]" }; constexpr openspace::properties::Property::PropertyInfo NumRenderedStarsInfo = { @@ -212,8 +212,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo CpuRamBudgetInfo = { "CpuRamBudget", "CPU RAM Budget", - "Current remaining budget (bytes) on the CPU RAM for loading more node data " - "files" + "Current remaining budget (bytes) on the CPU RAM for loading more node data files" }; constexpr openspace::properties::Property::PropertyInfo GpuStreamBudgetInfo = { @@ -246,51 +245,50 @@ namespace { constexpr openspace::properties::Property::PropertyInfo FilterPosXInfo = { "FilterPosX", "PosX Threshold", - "If defined then only stars with Position X values between [min, max] " - "will be rendered (if min is set to 0.0 it is read as -Inf, " - "if max is set to 0.0 it is read as +Inf). Measured in kiloParsec" + "If defined then only stars with Position X values between [min, max] will be " + "rendered (if min is set to 0.0 it is read as -Inf, if max is set to 0.0 it is " + "read as +Inf). Measured in kiloParsec" }; constexpr openspace::properties::Property::PropertyInfo FilterPosYInfo = { "FilterPosY", "PosY Threshold", - "If defined then only stars with Position Y values between [min, max] " - "will be rendered (if min is set to 0.0 it is read as -Inf, " - "if max is set to 0.0 it is read as +Inf). Measured in kiloParsec" + "If defined then only stars with Position Y values between [min, max] will be " + "rendered (if min is set to 0.0 it is read as -Inf, if max is set to 0.0 it is " + "read as +Inf). Measured in kiloParsec" }; constexpr openspace::properties::Property::PropertyInfo FilterPosZInfo = { "FilterPosZ", "PosZ Threshold", - "If defined then only stars with Position Z values between [min, max] " - "will be rendered (if min is set to 0.0 it is read as -Inf, " - "if max is set to 0.0 it is read as +Inf). Measured in kiloParsec" + "If defined then only stars with Position Z values between [min, max] will be " + "rendered (if min is set to 0.0 it is read as -Inf, if max is set to 0.0 it is " + "read as +Inf). Measured in kiloParsec" }; constexpr openspace::properties::Property::PropertyInfo FilterGMagInfo = { "FilterGMag", "GMag Threshold", - "If defined then only stars with G mean magnitude values between [min, max] " - "will be rendered (if min is set to 20.0 it is read as -Inf, " - "if max is set to 20.0 it is read as +Inf). If min = max then all values " - "equal min|max will be filtered away" + "If defined then only stars with G mean magnitude values between [min, max] will " + "be rendered (if min is set to 20.0 it is read as -Inf, if max is set to 20.0 it " + "is read as +Inf). If min = max then all values equal min|max will be filtered " + "away" }; constexpr openspace::properties::Property::PropertyInfo FilterBpRpInfo = { "FilterBpRp", "Bp-Rp Threshold", - "If defined then only stars with Bp-Rp color values between [min, max] " - "will be rendered (if min is set to 0.0 it is read as -Inf, " - "if max is set to 0.0 it is read as +Inf). If min = max then all values " - "equal min|max will be filtered away" + "If defined then only stars with Bp-Rp color values between [min, max] will be " + "rendered (if min is set to 0.0 it is read as -Inf, if max is set to 0.0 it is " + "read as +Inf). If min = max then all values equal min|max will be filtered away" }; constexpr openspace::properties::Property::PropertyInfo FilterDistInfo = { "FilterDist", "Dist Threshold", - "If defined then only stars with Distances values between [min, max] " - "will be rendered (if min is set to 0.0 it is read as -Inf, " - "if max is set to 0.0 it is read as +Inf). Measured in kParsec" + "If defined then only stars with Distances values between [min, max] will be " + "rendered (if min is set to 0.0 it is read as -Inf, if max is set to 0.0 it is " + "read as +Inf). Measured in kParsec" }; constexpr openspace::properties::Property::PropertyInfo ReportGlErrorsInfo = { diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index 11be3f2ae7..f353633f99 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -128,7 +128,6 @@ namespace { "The maximum size of the MemoryAwareTileCache, on the CPU and GPU" }; - openspace::GlobeBrowsingModule::Capabilities parseSubDatasets(char** subDatasets, int nSubdatasets) { @@ -393,7 +392,7 @@ glm::vec3 GlobeBrowsingModule::cartesianCoordinatesFromGeo( using namespace globebrowsing; const Geodetic3 pos = { - { glm::radians(latitude), glm::radians(longitude) }, + { .lat = glm::radians(latitude), .lon = glm::radians(longitude) }, altitude }; @@ -452,8 +451,8 @@ void GlobeBrowsingModule::goToChunk(const globebrowsing::RenderableGlobe& globe, positionOnPatch.lat *= uv.y; positionOnPatch.lon *= uv.x; const Geodetic2 pointPosition = { - corner.lat + positionOnPatch.lat, - corner.lon + positionOnPatch.lon + .lat = corner.lat + positionOnPatch.lat, + .lon = corner.lon + positionOnPatch.lon }; // Compute altitude @@ -689,29 +688,28 @@ uint64_t GlobeBrowsingModule::wmsCacheSize() const { } scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const { - scripting::LuaLibrary res; - res.name = "globebrowsing"; - res.functions = { - codegen::lua::AddLayer, - codegen::lua::DeleteLayer, - codegen::lua::GetLayers, - codegen::lua::MoveLayer, - codegen::lua::GoToChunk, - codegen::lua::GoToGeo, - // @TODO (2021-06-23, emmbr) Combine with the above function when the camera - // paths work really well close to surfaces - codegen::lua::FlyToGeo, - codegen::lua::GetLocalPositionFromGeo, - codegen::lua::GetGeoPositionForCamera, - codegen::lua::LoadWMSCapabilities, - codegen::lua::RemoveWMSServer, - codegen::lua::CapabilitiesWMS + return { + .name = "globebrowsing", + .functions = { + codegen::lua::AddLayer, + codegen::lua::DeleteLayer, + codegen::lua::GetLayers, + codegen::lua::MoveLayer, + codegen::lua::GoToChunk, + codegen::lua::GoToGeo, + // @TODO (2021-06-23, emmbr) Combine with the above function when the camera + // paths work really well close to surfaces + codegen::lua::FlyToGeo, + codegen::lua::GetLocalPositionFromGeo, + codegen::lua::GetGeoPositionForCamera, + codegen::lua::LoadWMSCapabilities, + codegen::lua::RemoveWMSServer, + codegen::lua::CapabilitiesWMS + }, + .scripts = { + absPath("${MODULE_GLOBEBROWSING}/scripts/layer_support.lua") + } }; - res.scripts = { - absPath("${MODULE_GLOBEBROWSING}/scripts/layer_support.lua") - }; - - return res; } } // namespace openspace diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl index 679c5cae42..7320e0cf6d 100644 --- a/modules/globebrowsing/globebrowsingmodule_lua.inl +++ b/modules/globebrowsing/globebrowsingmodule_lua.inl @@ -151,24 +151,26 @@ namespace { * Rearranges the order of a single layer on a globe. The first parameter is the * identifier of the globe, the second parameter specifies the name of the layer group, * the third parameter is the original position of the layer that should be moved and the - * last parameter is the new position in the list. The first position in the list has - * index 0, and the last position is given by the number of layers minus one. The new - * position may be -1 to place the layer at the top or any number bigger than the number - * of layers to place it at the bottom. + * last parameter is the new position in the list. The third and fourth parameters can + * also acccept names, in which case these refer to identifiers of the layer to be moved. + * If the last parameter is a name, the source layer is moved below that destination + * layer. The first position in the list has index 0, and the last position is given by + * the number of layers minus one. */ -[[codegen::luawrap]] void moveLayer(std::string globeIdentifier, std::string layer, - int oldPosition, int newPosition) +[[codegen::luawrap]] void moveLayer(std::string globeIdentifier, std::string layerGroup, + std::variant source, + std::variant destination) { using namespace openspace; using namespace globebrowsing; - if (oldPosition == newPosition) { + if (source == destination) { return; } SceneGraphNode* n = sceneGraphNode(globeIdentifier); if (!n) { - throw ghoul::lua::LuaError("Unknown globe name: " + globeIdentifier); + throw ghoul::lua::LuaError(fmt::format("Unknown globe: {}", globeIdentifier)); } RenderableGlobe* globe = dynamic_cast(n->renderable()); @@ -176,13 +178,62 @@ namespace { throw ghoul::lua::LuaError("Identifier must be a RenderableGlobe"); } - layers::Group::ID group = ghoul::from_string(layer); + layers::Group::ID group = ghoul::from_string(layerGroup); if (group == layers::Group::ID::Unknown) { - throw ghoul::lua::LuaError("Unknown layer groupd: " + layer); + throw ghoul::lua::LuaError(fmt::format("Unknown layer group: {}", layerGroup)); + } + + LayerGroup& lg = globe->layerManager().layerGroup(group); + if (std::holds_alternative(source) && std::holds_alternative(destination)) { + // Short circut here, no need to get the layers + lg.moveLayer(std::get(source), std::get(destination)); + return; } - LayerGroup& lg = globe->layerManager().layerGroup(group); - lg.moveLayer(oldPosition, newPosition); + std::vector layers = lg.layers(); + + int sourceIdx = 0; + if (std::holds_alternative(source)) { + sourceIdx = std::get(source); + } + else { + auto it = std::find_if( + layers.cbegin(), layers.cend(), + [s = std::get(source)](Layer* l) { + return l->identifier() == s; + } + ); + if (it == layers.cend()) { + throw ghoul::lua::LuaError(fmt::format( + "Could not find source layer '{}'", std::get(source) + )); + } + + sourceIdx = static_cast(std::distance(layers.cbegin(), it)); + } + + int destinationIdx = 0; + if (std::holds_alternative(destination)) { + destinationIdx = std::get(destination); + } + else { + auto it = std::find_if( + layers.cbegin(), layers.cend(), + [d = std::get(destination)](Layer* l) { + return l->identifier() == d; + } + ); + if (it == layers.cend()) { + throw ghoul::lua::LuaError(fmt::format( + "Could not find destination layer '{}'", std::get(source) + )); + } + + // +1 since we want to move the layer _below_ the specified layer + destinationIdx = static_cast(std::distance(layers.cbegin(), it)); + } + + lg.moveLayer(sourceIdx, destinationIdx); } /** diff --git a/modules/globebrowsing/src/dashboarditemglobelocation.cpp b/modules/globebrowsing/src/dashboarditemglobelocation.cpp index f4819cdb87..fe0780c6c4 100644 --- a/modules/globebrowsing/src/dashboarditemglobelocation.cpp +++ b/modules/globebrowsing/src/dashboarditemglobelocation.cpp @@ -42,19 +42,6 @@ #include namespace { - constexpr openspace::properties::Property::PropertyInfo FontNameInfo = { - "FontName", - "Font Name", - "This value is the name of the font that is used. It can either refer to an " - "internal name registered previously, or it can refer to a path that is used" - }; - - constexpr openspace::properties::Property::PropertyInfo FontSizeInfo = { - "FontSize", - "Font Size", - "This value determines the size of the font that is used to render the date" - }; - constexpr openspace::properties::Property::PropertyInfo DisplayFormatInfo = { "DisplayFormat", "Display Format", @@ -68,12 +55,6 @@ namespace { }; struct [[codegen::Dictionary(DashboardItemGlobeLocation)]] Parameters { - // [[codegen::verbatim(FontNameInfo.description)]] - std::optional fontName; - - // [[codegen::verbatim(FontSizeInfo.description)]] - std::optional fontSize; - enum class DisplayFormat { DecimalDegrees, DegreeMinuteSeconds @@ -91,32 +72,20 @@ namespace { namespace openspace { documentation::Documentation DashboardItemGlobeLocation::Documentation() { - return codegen::doc("globebrowsing_dashboarditem_globelocation"); + return codegen::doc( + "globebrowsing_dashboarditem_globelocation", + DashboardTextItem::Documentation() + ); } DashboardItemGlobeLocation::DashboardItemGlobeLocation( const ghoul::Dictionary& dictionary) - : DashboardItem(dictionary) - , _fontName(FontNameInfo, "Mono") - , _fontSize(FontSizeInfo, 10.f, 10.f, 144.f, 1.f) + : DashboardTextItem(dictionary) , _displayFormat(DisplayFormatInfo) , _significantDigits(SignificantDigitsInfo, 4, 1, 12) - , _font(global::fontManager->font("Mono", 10)) { const Parameters p = codegen::bake(dictionary); - _fontName = p.fontName.value_or(_fontName); - _fontName.onChange([this]() { - _font = global::fontManager->font(_fontName, _fontSize); - }); - addProperty(_fontName); - - _fontSize = p.fontSize.value_or(_fontSize); - _fontSize.onChange([this]() { - _font = global::fontManager->font(_fontName, _fontSize); - }); - addProperty(_fontSize); - auto updateFormatString = [this]() { switch (_displayFormat.value()) { case static_cast(DisplayFormat::DecimalDegrees): diff --git a/modules/globebrowsing/src/dashboarditemglobelocation.h b/modules/globebrowsing/src/dashboarditemglobelocation.h index 5ab06ea357..c73a7efe11 100644 --- a/modules/globebrowsing/src/dashboarditemglobelocation.h +++ b/modules/globebrowsing/src/dashboarditemglobelocation.h @@ -25,20 +25,18 @@ #ifndef __OPENSPACE_MODULE_GLOBEBROWSING___DASHBOARDITEMGLOBELOCATION___H__ #define __OPENSPACE_MODULE_GLOBEBROWSING___DASHBOARDITEMGLOBELOCATION___H__ -#include +#include #include #include #include #include -namespace ghoul::fontrendering { class Font; } - namespace openspace { namespace documentation { struct Documentation; } -class DashboardItemGlobeLocation : public DashboardItem { +class DashboardItemGlobeLocation : public DashboardTextItem { public: DashboardItemGlobeLocation(const ghoul::Dictionary& dictionary); ~DashboardItemGlobeLocation() override = default; @@ -55,13 +53,9 @@ private: DegreeMinuteSeconds }; - properties::StringProperty _fontName; - properties::FloatProperty _fontSize; - properties::OptionProperty _displayFormat; properties::IntProperty _significantDigits; - std::shared_ptr _font; std::string _formatString; std::vector _buffer; }; diff --git a/modules/globebrowsing/src/ellipsoid.cpp b/modules/globebrowsing/src/ellipsoid.cpp index 1e7f701cec..76ecc160dd 100644 --- a/modules/globebrowsing/src/ellipsoid.cpp +++ b/modules/globebrowsing/src/ellipsoid.cpp @@ -133,8 +133,8 @@ double Ellipsoid::greatCircleDistance(const Geodetic2& p1, const Geodetic2& p2) ); const Geodetic2 pMid = { - (p1.lat + p2.lat) / 2.0, - (p1.lon + p2.lon) / 2.0 + .lat = (p1.lat + p2.lat) / 2.0, + .lon = (p1.lon + p2.lon) / 2.0 }; const glm::dvec3 centralNormal = cartesianSurfacePosition(pMid); diff --git a/modules/globebrowsing/src/geodeticpatch.cpp b/modules/globebrowsing/src/geodeticpatch.cpp index d5d9189729..7d8167f8dd 100644 --- a/modules/globebrowsing/src/geodeticpatch.cpp +++ b/modules/globebrowsing/src/geodeticpatch.cpp @@ -132,8 +132,8 @@ double GeodeticPatch::maxLon() const { bool GeodeticPatch::contains(const Geodetic2& p) const { const Geodetic2 diff = { - _center.lat - p.lat, - _center.lon - p.lon + .lat = _center.lat - p.lat, + .lon = _center.lon - p.lon }; return glm::abs(diff.lat) <= _halfSize.lat && glm::abs(diff.lon) <= _halfSize.lon; } @@ -166,8 +166,8 @@ Geodetic2 GeodeticPatch::clamp(const Geodetic2& p) const { Geodetic2 GeodeticPatch::closestCorner(const Geodetic2& p) const { // LatLon vector from patch center to the point const Geodetic2 centerToPoint = { - p.lat - _center.lat, - p.lon - _center.lon + .lat = p.lat - _center.lat, + .lon = p.lon - _center.lon }; // Normalize the difference angles to be centered around 0. diff --git a/modules/globebrowsing/src/globerotation.cpp b/modules/globebrowsing/src/globerotation.cpp index 14dd58d221..be621a2642 100644 --- a/modules/globebrowsing/src/globerotation.cpp +++ b/modules/globebrowsing/src/globerotation.cpp @@ -232,11 +232,11 @@ glm::dmat3 GlobeRotation::matrix(const UpdateData&) const { zAxis = glm::normalize(zAxis); const glm::dvec3 xAxis = glm::normalize(glm::cross(yAxis, zAxis)); - const glm::dmat3 mat = { + const glm::dmat3 mat = glm::dmat3( xAxis.x, xAxis.y, xAxis.z, yAxis.x, yAxis.y, yAxis.z, zAxis.x, zAxis.y, zAxis.z - }; + ); const glm::dquat q = glm::angleAxis(glm::radians(_angle.value()), yAxis); _matrix = glm::toMat3(q) * mat; diff --git a/modules/globebrowsing/src/globetranslation.cpp b/modules/globebrowsing/src/globetranslation.cpp index eec25236ca..ded1ec46aa 100644 --- a/modules/globebrowsing/src/globetranslation.cpp +++ b/modules/globebrowsing/src/globetranslation.cpp @@ -61,10 +61,9 @@ namespace { constexpr openspace::properties::Property::PropertyInfo AltitudeInfo = { "Altitude", "Altitude", - "The altitude in meters. " - "If the 'UseHeightmap' property is 'true', this is an offset from the actual " - "surface of the globe. If not, this is an offset from the reference ellipsoid." - "The default value is 0.0" + "The altitude in meters. If the 'UseHeightmap' property is 'true', this is an " + "offset from the actual surface of the globe. If not, this is an offset from the " + "reference ellipsoid. The default value is 0.0" }; constexpr openspace::properties::Property::PropertyInfo UseHeightmapInfo = { diff --git a/modules/globebrowsing/src/layergroupid.h b/modules/globebrowsing/src/layergroupid.h index eed9b05ae8..2feb9b1a2a 100644 --- a/modules/globebrowsing/src/layergroupid.h +++ b/modules/globebrowsing/src/layergroupid.h @@ -47,11 +47,31 @@ struct Group { }; constexpr std::array Groups = { - Group{ Group::ID::HeightLayers, "HeightLayers", "Height Layers" }, - Group{ Group::ID::ColorLayers, "ColorLayers", "Color Layers" }, - Group{ Group::ID::Overlays, "Overlays", "Overlays" }, - Group{ Group::ID::NightLayers, "NightLayers", "Night Layers" }, - Group{ Group::ID::WaterMasks, "WaterMasks", "Water Masks" } + Group { + .id = Group::ID::HeightLayers, + .identifier = "HeightLayers", + .name = "Height Layers" + }, + Group { + .id = Group::ID::ColorLayers, + .identifier = "ColorLayers", + .name = "Color Layers" + }, + Group { + .id = Group::ID::Overlays, + .identifier = "Overlays", + .name = "Overlays" + }, + Group { + .id = Group::ID::NightLayers, + .identifier = "NightLayers", + .name = "Night Layers" + }, + Group { + .id = Group::ID::WaterMasks, + .identifier = "WaterMasks", + .name = "Water Masks" + } }; @@ -76,16 +96,46 @@ struct Layer { }; constexpr std::array Layers = { - Layer{ Layer::ID::DefaultTileLayer, "DefaultTileLayer" }, - Layer{ Layer::ID::SingleImageTileLayer, "SingleImageTileLayer" }, - Layer{ Layer::ID::ImageSequenceTileLayer, "ImageSequenceTileLayer" }, - Layer{ Layer::ID::SizeReferenceTileLayer, "SizeReferenceTileLayer" }, - Layer{ Layer::ID::TemporalTileLayer, "TemporalTileLayer" }, - Layer{ Layer::ID::TileIndexTileLayer, "TileIndexTileLayer" }, - Layer{ Layer::ID::ByIndexTileLayer, "ByIndexTileLayer" }, - Layer{ Layer::ID::ByLevelTileLayer, "ByLevelTileLayer" }, - Layer{ Layer::ID::SolidColor, "SolidColor" }, - Layer{ Layer::ID::SpoutImageTileLayer, "SpoutImageTileLayer" } + Layer { + .id = Layer::ID::DefaultTileLayer, + .identifier = "DefaultTileLayer" + }, + Layer { + .id = Layer::ID::SingleImageTileLayer, + .identifier = "SingleImageTileLayer" + }, + Layer { + .id = Layer::ID::ImageSequenceTileLayer, + .identifier = "ImageSequenceTileLayer" + }, + Layer { + .id = Layer::ID::SizeReferenceTileLayer, + .identifier = "SizeReferenceTileLayer" + }, + Layer { + .id = Layer::ID::TemporalTileLayer, + .identifier = "TemporalTileLayer" + }, + Layer { + .id = Layer::ID::TileIndexTileLayer, + .identifier = "TileIndexTileLayer" + }, + Layer { + .id = Layer::ID::ByIndexTileLayer, + .identifier = "ByIndexTileLayer" + }, + Layer { + .id = Layer::ID::ByLevelTileLayer, + .identifier = "ByLevelTileLayer" + }, + Layer { + .id = Layer::ID::SolidColor, + .identifier = "SolidColor" + }, + Layer { + .id = Layer::ID::SpoutImageTileLayer, + .identifier = "SpoutImageTileLayer" + } }; @@ -102,9 +152,18 @@ struct Adjustment { }; constexpr std::array Adjustments = { - Adjustment{ Adjustment::ID::None, "None" }, - Adjustment{ Adjustment::ID::ChromaKey, "ChromaKey" }, - Adjustment{ Adjustment::ID::TransferFunction, "TransferFunction" } + Adjustment { + .id = Adjustment::ID::None, + .identifier = "None" + }, + Adjustment { + .id = Adjustment::ID::ChromaKey, + .identifier = "ChromaKey" + }, + Adjustment { + .id = Adjustment::ID::TransferFunction, + .identifier = "TransferFunction" + } }; @@ -123,11 +182,11 @@ struct Blend { }; constexpr std::array Blends = { - Blend{ Blend::ID::Normal, "Normal" }, - Blend{ Blend::ID::Multiply, "Multiply" }, - Blend{ Blend::ID::Add, "Add" }, - Blend{ Blend::ID::Subtract, "Subtract" }, - Blend{ Blend::ID::Color, "Color" } + Blend { .id = Blend::ID::Normal, .identifier = "Normal" }, + Blend { .id = Blend::ID::Multiply, .identifier = "Multiply" }, + Blend { .id = Blend::ID::Add, .identifier = "Add" }, + Blend { .id = Blend::ID::Subtract, .identifier = "Subtract" }, + Blend { .id = Blend::ID::Color, .identifier = "Color" } }; } // namespace openspace::globebrowsing::layers diff --git a/modules/globebrowsing/src/rawtile.h b/modules/globebrowsing/src/rawtile.h index 09be69e9fc..8014ed0ca0 100644 --- a/modules/globebrowsing/src/rawtile.h +++ b/modules/globebrowsing/src/rawtile.h @@ -50,7 +50,7 @@ struct RawTile { std::unique_ptr imageData; TileMetaData tileMetaData; std::optional textureInitData; - TileIndex tileIndex = { 0, 0, 0 }; + TileIndex tileIndex = TileIndex(0, 0, 0); ReadError error = ReadError::None; GLuint pbo = 0; }; diff --git a/modules/globebrowsing/src/rawtiledatareader.cpp b/modules/globebrowsing/src/rawtiledatareader.cpp index fb751278e0..9f156b5e66 100644 --- a/modules/globebrowsing/src/rawtiledatareader.cpp +++ b/modules/globebrowsing/src/rawtiledatareader.cpp @@ -69,51 +69,51 @@ struct MemoryLocation { // The memory locations are grouped to be mostly cache-aligned constexpr std::array NoDataAvailableData = { - MemoryLocation{ 296380, std::byte(205) }, - MemoryLocation{ 296381, std::byte(205) }, - MemoryLocation{ 296382, std::byte(205) }, - MemoryLocation{ 296383, std::byte(255) }, - MemoryLocation{ 296384, std::byte(224) }, - MemoryLocation{ 296385, std::byte(224) }, - MemoryLocation{ 296386, std::byte(224) }, - MemoryLocation{ 296387, std::byte(255) }, - MemoryLocation{ 296388, std::byte(244) }, - MemoryLocation{ 296389, std::byte(244) }, - MemoryLocation{ 296390, std::byte(244) }, - MemoryLocation{ 296391, std::byte(255) }, + MemoryLocation { .offset = 296380, .value = std::byte(205) }, + MemoryLocation { .offset = 296381, .value = std::byte(205) }, + MemoryLocation { .offset = 296382, .value = std::byte(205) }, + MemoryLocation { .offset = 296383, .value = std::byte(255) }, + MemoryLocation { .offset = 296384, .value = std::byte(224) }, + MemoryLocation { .offset = 296385, .value = std::byte(224) }, + MemoryLocation { .offset = 296386, .value = std::byte(224) }, + MemoryLocation { .offset = 296387, .value = std::byte(255) }, + MemoryLocation { .offset = 296388, .value = std::byte(244) }, + MemoryLocation { .offset = 296389, .value = std::byte(244) }, + MemoryLocation { .offset = 296390, .value = std::byte(244) }, + MemoryLocation { .offset = 296391, .value = std::byte(255) }, - MemoryLocation{ 269840, std::byte(209) }, - MemoryLocation{ 269841, std::byte(209) }, - MemoryLocation{ 269842, std::byte(209) }, - MemoryLocation{ 269844, std::byte(203) }, - MemoryLocation{ 269845, std::byte(203) }, - MemoryLocation{ 269846, std::byte(203) }, - MemoryLocation{ 269852, std::byte(221) }, - MemoryLocation{ 269853, std::byte(221) }, - MemoryLocation{ 269854, std::byte(221) }, - MemoryLocation{ 269856, std::byte(225) }, - MemoryLocation{ 269857, std::byte(225) }, - MemoryLocation{ 269858, std::byte(225) }, - MemoryLocation{ 269860, std::byte(218) }, - MemoryLocation{ 269861, std::byte(218) }, + MemoryLocation { .offset = 269840, .value = std::byte(209) }, + MemoryLocation { .offset = 269841, .value = std::byte(209) }, + MemoryLocation { .offset = 269842, .value = std::byte(209) }, + MemoryLocation { .offset = 269844, .value = std::byte(203) }, + MemoryLocation { .offset = 269845, .value = std::byte(203) }, + MemoryLocation { .offset = 269846, .value = std::byte(203) }, + MemoryLocation { .offset = 269852, .value = std::byte(221) }, + MemoryLocation { .offset = 269853, .value = std::byte(221) }, + MemoryLocation { .offset = 269854, .value = std::byte(221) }, + MemoryLocation { .offset = 269856, .value = std::byte(225) }, + MemoryLocation { .offset = 269857, .value = std::byte(225) }, + MemoryLocation { .offset = 269858, .value = std::byte(225) }, + MemoryLocation { .offset = 269860, .value = std::byte(218) }, + MemoryLocation { .offset = 269861, .value = std::byte(218) }, - MemoryLocation{ 240349, std::byte(203) }, - MemoryLocation{ 240350, std::byte(203) }, - MemoryLocation{ 240352, std::byte(205) }, - MemoryLocation{ 240353, std::byte(204) }, - MemoryLocation{ 240354, std::byte(205) }, + MemoryLocation { .offset = 240349, .value = std::byte(203) }, + MemoryLocation { .offset = 240350, .value = std::byte(203) }, + MemoryLocation { .offset = 240352, .value = std::byte(205) }, + MemoryLocation { .offset = 240353, .value = std::byte(204) }, + MemoryLocation { .offset = 240354, .value = std::byte(205) }, - MemoryLocation{ 0, std::byte(204) }, - MemoryLocation{ 7, std::byte(255) }, - MemoryLocation{ 520, std::byte(204) }, - MemoryLocation{ 880, std::byte(204) }, - MemoryLocation{ 883, std::byte(255) }, - MemoryLocation{ 91686, std::byte(204) }, - MemoryLocation{ 372486, std::byte(204) }, - MemoryLocation{ 670483, std::byte(255) }, - MemoryLocation{ 231684, std::byte(202) }, - MemoryLocation{ 232092, std::byte(202) }, - MemoryLocation{ 235921, std::byte(203) }, + MemoryLocation { .offset = 0, .value = std::byte(204) }, + MemoryLocation { .offset = 7, .value = std::byte(255) }, + MemoryLocation { .offset = 520, .value = std::byte(204) }, + MemoryLocation { .offset = 880, .value = std::byte(204) }, + MemoryLocation { .offset = 883, .value = std::byte(255) }, + MemoryLocation { .offset = 91686, .value = std::byte(204) }, + MemoryLocation { .offset = 372486, .value = std::byte(204) }, + MemoryLocation { .offset = 670483, .value = std::byte(255) }, + MemoryLocation { .offset = 231684, .value = std::byte(202) }, + MemoryLocation { .offset = 232092, .value = std::byte(202) }, + MemoryLocation { .offset = 235921, .value = std::byte(203) }, }; enum class Side { @@ -304,10 +304,10 @@ bool isInside(const PixelRegion& lhs, const PixelRegion& rhs) { } IODescription cutIODescription(IODescription& io, Side side, int pos) { - glm::dvec2 ratio = { + glm::dvec2 ratio = glm::dvec2( io.write.region.numPixels.x / static_cast(io.read.region.numPixels.x), io.write.region.numPixels.y / static_cast(io.read.region.numPixels.y) - }; + ); IODescription whatCameOff = io; whatCameOff.read.region = globalCut(io.read.region, side, pos); @@ -785,13 +785,14 @@ IODescription RawTileDataReader::ioDescription(const TileIndex& tileIndex) const io.write.region.numPixels = _initData.dimensions; io.read.overview = 0; - io.read.fullRegion.start = { 0, 0 }; - io.read.fullRegion.numPixels = { _rasterXSize, _rasterYSize }; + io.read.fullRegion.start = glm::ivec2(0, 0); + io.read.fullRegion.numPixels = glm::ivec2(_rasterXSize, _rasterYSize); // For correct sampling in dataset, we need to pad the texture tile - PixelRegion scaledPadding; - scaledPadding.start = _initData.tilePixelStartOffset; - scaledPadding.numPixels = _initData.tilePixelSizeDifference; + PixelRegion scaledPadding = { + .start = _initData.tilePixelStartOffset, + .numPixels = _initData.tilePixelSizeDifference + }; const double scale = static_cast(io.read.region.numPixels.x) / static_cast(io.write.region.numPixels.x); diff --git a/modules/globebrowsing/src/rawtiledatareader.h b/modules/globebrowsing/src/rawtiledatareader.h index b935ad2b20..c58ea2da80 100644 --- a/modules/globebrowsing/src/rawtiledatareader.h +++ b/modules/globebrowsing/src/rawtiledatareader.h @@ -98,7 +98,7 @@ private: const TileTextureInitData _initData; const PerformPreprocessing _preprocess; - TileDepthTransform _depthTransform = { 0.f, 0.f }; + TileDepthTransform _depthTransform = { .scale = 0.f, .offset = 0.f }; mutable std::mutex _datasetLock; }; diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index 1713b94505..89c2b8c908 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -190,15 +190,15 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ZFightingPercentageInfo = { "ZFightingPercentage", "Z-Fighting Percentage", - "The percentage of the correct distance to the surface being shadowed. " - "Possible values: [0.0, 1.0]" + "The percentage of the correct distance to the surface being shadowed. Possible " + "values: [0.0, 1.0]" }; constexpr openspace::properties::Property::PropertyInfo NumberShadowSamplesInfo = { "NumberShadowSamples", "Number of Shadow Samples", - "The number of samples used during shadow mapping calculation " - "(Percentage Closer Filtering)" + "The number of samples used during shadow mapping calculation (Percentage Closer " + "Filtering)" }; constexpr openspace::properties::Property::PropertyInfo TargetLodScaleFactorInfo = { @@ -1875,13 +1875,13 @@ float RenderableGlobe::getHeight(const glm::dvec3& position) const { const Geodetic2 southWest = patch.corner(Quad::SOUTH_WEST); const Geodetic2 geoDiffPatch = { - northEast.lat - southWest.lat, - northEast.lon - southWest.lon + .lat = northEast.lat - southWest.lat, + .lon = northEast.lon - southWest.lon }; const Geodetic2 geoDiffPoint = { - geodeticPosition.lat - southWest.lat, - geodeticPosition.lon - southWest.lon + .lat = geodeticPosition.lat - southWest.lat, + .lon = geodeticPosition.lon - southWest.lon }; const glm::vec2 patchUV = glm::vec2( geoDiffPoint.lon / geoDiffPatch.lon, diff --git a/modules/globebrowsing/src/tileprovider/defaulttileprovider.cpp b/modules/globebrowsing/src/tileprovider/defaulttileprovider.cpp index c499bbf767..61a190908f 100644 --- a/modules/globebrowsing/src/tileprovider/defaulttileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider/defaulttileprovider.cpp @@ -135,7 +135,10 @@ Tile DefaultTileProvider::tile(const TileIndex& tileIndex) { if (tileIndex.level > maxLevel()) { return Tile{ nullptr, std::nullopt, Tile::Status::OutOfRange }; } - const cache::ProviderTileKey key = { tileIndex, uniqueIdentifier }; + const cache::ProviderTileKey key = { + .tileIndex = tileIndex, + .providerID = uniqueIdentifier + }; cache::MemoryAwareTileCache* tileCache = global::moduleEngine->module()->tileCache(); Tile tile = tileCache->get(key); @@ -154,7 +157,10 @@ Tile::Status DefaultTileProvider::tileStatus(const TileIndex& index) { return Tile::Status::OutOfRange; } - const cache::ProviderTileKey key = { index, uniqueIdentifier }; + const cache::ProviderTileKey key = { + .tileIndex = index, + .providerID = uniqueIdentifier + }; cache::MemoryAwareTileCache* tileCache = global::moduleEngine->module()->tileCache(); return tileCache->get(key).status; @@ -171,7 +177,10 @@ void DefaultTileProvider::update() { std::optional tile = _asyncTextureDataProvider->popFinishedRawTile(); if (tile) { - const cache::ProviderTileKey key = { tile->tileIndex, uniqueIdentifier }; + const cache::ProviderTileKey key = { + .tileIndex = tile->tileIndex, + .providerID = uniqueIdentifier + }; cache::MemoryAwareTileCache* tileCache = global::moduleEngine->module()->tileCache(); ghoul_assert(!tileCache->exist(key), "Tile must not be existing in cache"); diff --git a/modules/globebrowsing/src/tileprovider/sizereferencetileprovider.cpp b/modules/globebrowsing/src/tileprovider/sizereferencetileprovider.cpp index bd71538b67..9d911b321c 100644 --- a/modules/globebrowsing/src/tileprovider/sizereferencetileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider/sizereferencetileprovider.cpp @@ -94,12 +94,12 @@ Tile SizeReferenceTileProvider::tile(const TileIndex& tileIndex) { } std::string text = fmt::format(" {:.0f} {:s}", tileLongitudalLength, unit); - glm::vec2 textPosition = { + glm::vec2 textPosition = glm::vec2( 0.f, aboveEquator ? fontSize / 2.f : initData.dimensions.y - 3.f * fontSize / 2.f - }; + ); return TextTileProvider::renderTile(tileIndex, text, textPosition, glm::vec4(1.f)); } diff --git a/modules/globebrowsing/src/tileprovider/tileprovider.cpp b/modules/globebrowsing/src/tileprovider/tileprovider.cpp index 8d6d17c85d..abdb8c77b2 100644 --- a/modules/globebrowsing/src/tileprovider/tileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider/tileprovider.cpp @@ -169,7 +169,10 @@ ChunkTile TileProvider::chunkTile(TileIndex tileIndex, int parents, int maxParen ti.level--; }; - TileUvTransform uvTransform = { glm::vec2(0.f, 0.f), glm::vec2(1.f, 1.f) }; + TileUvTransform uvTransform = { + .uvOffset = glm::vec2(0.f, 0.f), + .uvScale = glm::vec2(1.f, 1.f) + }; // Step 1. Traverse 0 or more parents up the chunkTree as requested by the caller for (int i = 0; i < parents && tileIndex.level > 1; i++) { @@ -221,8 +224,8 @@ ChunkTilePile TileProvider::chunkTilePile(TileIndex tileIndex, int pileSize) { if (i == 0) { // First iteration chunkTilePile[i]->tile = DefaultTile; - chunkTilePile[i]->uvTransform.uvOffset = { 0.f, 0.f }; - chunkTilePile[i]->uvTransform.uvScale = { 1.f, 1.f }; + chunkTilePile[i]->uvTransform.uvOffset = glm::vec2(0.f, 0.f); + chunkTilePile[i]->uvTransform.uvScale = glm::vec2(1.f, 1.f); } else { // We are iterating through the array one-by-one, so we are guaranteed diff --git a/modules/imgui/imguimodule.cpp b/modules/imgui/imguimodule.cpp index 676bc403a7..a7c178bf1a 100644 --- a/modules/imgui/imguimodule.cpp +++ b/modules/imgui/imguimodule.cpp @@ -322,13 +322,13 @@ void ImGUIModule::internalInitializeGL() { ); ImGuiStyle& style = ImGui::GetStyle(); - style.WindowPadding = { 4.f, 4.f }; + style.WindowPadding = ImVec2(4.f, 4.f); style.WindowRounding = 0.f; - style.FramePadding = { 3.f, 3.f }; + style.FramePadding = ImVec2(3.f, 3.f); style.FrameRounding = 0.f; - style.ItemSpacing = { 3.f, 2.f }; - style.ItemInnerSpacing = { 3.f, 2.f }; - style.TouchExtraPadding = { 1.f, 1.f }; + style.ItemSpacing = ImVec2(3.f, 2.f); + style.ItemInnerSpacing = ImVec2(3.f, 2.f); + style.TouchExtraPadding = ImVec2(1.f, 1.f); style.IndentSpacing = 15.f; style.ScrollbarSize = 10.f; style.ScrollbarRounding = 0.f; @@ -713,7 +713,7 @@ bool ImGUIModule::touchDetectedCallback(TouchInput input) { return false; } if (_validTouchStates.empty()) { - io.MousePos = { windowPos.x, windowPos.y }; + io.MousePos = ImVec2(windowPos.x, windowPos.y); io.MouseClicked[0] = true; } _validTouchStates.push_back(input); diff --git a/modules/imgui/src/renderproperties.cpp b/modules/imgui/src/renderproperties.cpp index 3e3d14db7d..2fa228cf55 100644 --- a/modules/imgui/src/renderproperties.cpp +++ b/modules/imgui/src/renderproperties.cpp @@ -695,16 +695,16 @@ void renderDMat2Property(Property* prop, const std::string& ownerName, ImGui::Text("%s", name.c_str()); glm::mat2 value = glm::dmat2(*p); - glm::dvec2 minValues = { + glm::dvec2 minValues = glm::dvec2( glm::compMin(p->minValue()[0]), glm::compMin(p->minValue()[1]) - }; + ); float min = static_cast(glm::compMin(minValues)); - glm::dvec2 maxValues = { + glm::dvec2 maxValues = glm::dvec2( glm::compMax(p->maxValue()[0]), glm::compMax(p->maxValue()[1]) - }; + ); float max = static_cast(glm::compMax(maxValues)); bool changed = false; @@ -747,18 +747,18 @@ void renderDMat3Property(Property* prop, const std::string& ownerName, ImGui::Text("%s", name.c_str()); glm::mat3 value = glm::dmat3(*p); - glm::dvec3 minValues = { + glm::dvec3 minValues = glm::dvec3( glm::compMin(p->minValue()[0]), glm::compMin(p->minValue()[1]), glm::compMin(p->minValue()[2]) - }; + ); float min = static_cast(glm::compMin(minValues)); - glm::dvec3 maxValues = { + glm::dvec3 maxValues = glm::dvec3( glm::compMax(p->maxValue()[0]), glm::compMax(p->maxValue()[1]), glm::compMax(p->maxValue()[2]) - }; + ); float max = static_cast(glm::compMax(maxValues)); bool changed = false; @@ -809,20 +809,20 @@ void renderDMat4Property(Property* prop, const std::string& ownerName, ImGui::Text("%s", name.c_str()); glm::mat4 value = glm::dmat4(*p); - glm::dvec4 minValues = { + glm::dvec4 minValues = glm::dvec4( glm::compMin(p->minValue()[0]), glm::compMin(p->minValue()[1]), glm::compMin(p->minValue()[2]), glm::compMin(p->minValue()[3]) - }; + ); float min = static_cast(glm::compMin(minValues)); - glm::dvec4 maxValues = { + glm::dvec4 maxValues = glm::dvec4( glm::compMax(p->maxValue()[0]), glm::compMax(p->maxValue()[1]), glm::compMax(p->maxValue()[2]), glm::compMax(p->maxValue()[3]) - }; + ); float max = static_cast(glm::compMax(maxValues)); bool changed = false; diff --git a/modules/iswa/rendering/datacygnet.cpp b/modules/iswa/rendering/datacygnet.cpp index 3f061e5c57..d645c0b665 100644 --- a/modules/iswa/rendering/datacygnet.cpp +++ b/modules/iswa/rendering/datacygnet.cpp @@ -80,7 +80,6 @@ namespace { "Transfer Functions", "" // @TODO Missing documentation }; - } // namespace namespace openspace { diff --git a/modules/iswa/rendering/iswabasegroup.cpp b/modules/iswa/rendering/iswabasegroup.cpp index 6f03de65f8..7897a4edc7 100644 --- a/modules/iswa/rendering/iswabasegroup.cpp +++ b/modules/iswa/rendering/iswabasegroup.cpp @@ -48,7 +48,6 @@ namespace { "Delete", "" // @TODO Missing documentation }; - } // namespace namespace openspace { diff --git a/modules/iswa/rendering/iswadatagroup.cpp b/modules/iswa/rendering/iswadatagroup.cpp index dd4ea00d58..3d87cf7f98 100644 --- a/modules/iswa/rendering/iswadatagroup.cpp +++ b/modules/iswa/rendering/iswadatagroup.cpp @@ -79,7 +79,6 @@ namespace { "Data Options", "" // @TODO Missing documentation }; - } // namespace namespace openspace{ diff --git a/modules/kameleon/src/kameleonwrapper.cpp b/modules/kameleon/src/kameleonwrapper.cpp index ff614e3a78..d1515b89af 100644 --- a/modules/kameleon/src/kameleonwrapper.cpp +++ b/modules/kameleon/src/kameleonwrapper.cpp @@ -136,29 +136,29 @@ bool KameleonWrapper::open(const std::string& filename) { LDEBUG(fmt::format("y: {}", _yCoordVar)); LDEBUG(fmt::format("z: {}", _zCoordVar)); - _min = { + _min = glm::vec3( _model->getVariableAttribute(_xCoordVar, "actual_min").getAttributeFloat(), _model->getVariableAttribute(_yCoordVar, "actual_min").getAttributeFloat(), _model->getVariableAttribute(_zCoordVar, "actual_min").getAttributeFloat() - }; + ); - _max = { + _max = glm::vec3( _model->getVariableAttribute(_xCoordVar, "actual_max").getAttributeFloat(), _model->getVariableAttribute(_yCoordVar, "actual_max").getAttributeFloat(), _model->getVariableAttribute(_zCoordVar, "actual_max").getAttributeFloat() - }; + ); - _validMin = { + _validMin = glm::vec3( _model->getVariableAttribute(_xCoordVar, "valid_min").getAttributeFloat(), _model->getVariableAttribute(_yCoordVar, "valid_min").getAttributeFloat(), _model->getVariableAttribute(_zCoordVar, "valid_min").getAttributeFloat() - }; + ); - _validMax = { + _validMax = glm::vec3( _model->getVariableAttribute(_xCoordVar, "valid_max").getAttributeFloat(), _model->getVariableAttribute(_yCoordVar, "valid_max").getAttributeFloat(), _model->getVariableAttribute(_zCoordVar, "valid_max").getAttributeFloat() - }; + ); return true; } @@ -700,11 +700,11 @@ glm::vec3 KameleonWrapper::modelBarycenterOffset() const { return glm::vec3(0.f); } - glm::vec3 offset = { + glm::vec3 offset = glm::vec3( _min.x + (std::abs(_min.x) + std::abs(_max.x)) / 2.f, _min.y + (std::abs(_min.y) + std::abs(_max.y)) / 2.f, _min.z + (std::abs(_min.z) + std::abs(_max.z)) / 2.f - }; + ); return offset; } @@ -725,11 +725,11 @@ glm::vec3 KameleonWrapper::modelScale() const { return glm::vec3(1.f); } - glm::vec3 scale = { + glm::vec3 scale = glm::vec3( _max.x - _min.x, _max.y - _min.y, _max.z - _min.z - }; + ); return scale; } @@ -907,57 +907,57 @@ KameleonWrapper::TraceLine KameleonWrapper::traceLorentzTrajectory( trajectory.push_back(pos); // Calculate new position with Lorentz force quation and Runge-Kutta 4th order - glm::vec3 B = { + glm::vec3 B = glm::vec3( _interpolator->interpolate(bxID, pos.x, pos.y, pos.z), _interpolator->interpolate(byID, pos.x, pos.y, pos.z), _interpolator->interpolate(bzID, pos.x, pos.y, pos.z) - }; + ); - glm::vec3 E = { + glm::vec3 E = glm::vec3( _interpolator->interpolate(jxID, pos.x, pos.y, pos.z), _interpolator->interpolate(jyID, pos.x, pos.y, pos.z), _interpolator->interpolate(jzID, pos.x, pos.y, pos.z) - }; + ); const glm::vec3 k1 = glm::normalize(eCharge * (E + glm::cross(v0, B))); const glm::vec3 k1Pos = pos + step / 2.f * v0 + step * step / 8.f * k1; - B = { + B = glm::vec3( _interpolator->interpolate(bxID, k1Pos.x, k1Pos.y, k1Pos.z), _interpolator->interpolate(byID, k1Pos.x, k1Pos.y, k1Pos.z), _interpolator->interpolate(bzID, k1Pos.x, k1Pos.y, k1Pos.z) - }; - E = { + ); + E = glm::vec3( _interpolator->interpolate(jxID, k1Pos.x, k1Pos.y, k1Pos.z), _interpolator->interpolate(jyID, k1Pos.x, k1Pos.y, k1Pos.z), _interpolator->interpolate(jzID, k1Pos.x, k1Pos.y, k1Pos.z) - }; + ); const glm::vec3 v1 = v0 + step / 2.f * k1; const glm::vec3 k2 = glm::normalize(eCharge * (E + glm::cross(v1, B))); - B = { + B = glm::vec3( _interpolator->interpolate(bxID, k1Pos.x, k1Pos.y, k1Pos.z), _interpolator->interpolate(byID, k1Pos.x, k1Pos.y, k1Pos.z), _interpolator->interpolate(bzID, k1Pos.x, k1Pos.y, k1Pos.z) - }; - E = { + ); + E = glm::vec3( _interpolator->interpolate(jxID, k1Pos.x, k1Pos.y, k1Pos.z), _interpolator->interpolate(jyID, k1Pos.x, k1Pos.y, k1Pos.z), _interpolator->interpolate(jzID, k1Pos.x, k1Pos.y, k1Pos.z) - }; + ); const glm::vec3 v2 = v0 + step / 2.f * k2; const glm::vec3 k3 = glm::normalize(eCharge * (E + glm::cross(v2, B))); const glm::vec3 k3Pos = pos + step * v0 + step * step / 2.f * k1; - B = { + B = glm::vec3( _interpolator->interpolate(bxID, k3Pos.x, k3Pos.y, k3Pos.z), _interpolator->interpolate(byID, k3Pos.x, k3Pos.y, k3Pos.z), _interpolator->interpolate(bzID, k3Pos.x, k3Pos.y, k3Pos.z) - }; - E = { + ); + E = glm::vec3( _interpolator->interpolate(jxID, k3Pos.x, k3Pos.y, k3Pos.z), _interpolator->interpolate(jyID, k3Pos.x, k3Pos.y, k3Pos.z), _interpolator->interpolate(jzID, k3Pos.x, k3Pos.y, k3Pos.z) - }; + ); const glm::vec3 v3 = v0 + step * k3; const glm::vec3 k4 = glm::normalize(eCharge * (E + glm::cross(v3, B))); diff --git a/modules/server/src/serverinterface.cpp b/modules/server/src/serverinterface.cpp index f4913ce9fc..7e6db61faa 100644 --- a/modules/server/src/serverinterface.cpp +++ b/modules/server/src/serverinterface.cpp @@ -64,20 +64,20 @@ namespace { constexpr openspace::properties::Property::PropertyInfo AllowAddressesInfo = { "AllowAddresses", "Allow Addresses", - "Ip addresses or domains that should always be allowed access to this interface" + "IP addresses or domains that should always be allowed access to this interface" }; constexpr openspace::properties::Property::PropertyInfo RequirePasswordAddressesInfo = { "RequirePasswordAddresses", "Require Password Addresses", - "Ip addresses or domains that should be allowed access if they provide a password" + "IP addresses or domains that should be allowed access if they provide a password" }; constexpr openspace::properties::Property::PropertyInfo DenyAddressesInfo = { "DenyAddresses", "Deny Addresses", - "Ip addresses or domains that should never be allowed access to this interface" + "IP addresses or domains that should never be allowed access to this interface" }; constexpr openspace::properties::Property::PropertyInfo PasswordInfo = { @@ -85,7 +85,7 @@ namespace { "Password", "Password for connecting to this interface" }; -} +} // namespace namespace openspace { diff --git a/modules/server/src/topics/shortcuttopic.cpp b/modules/server/src/topics/shortcuttopic.cpp index 5c1231682f..e6dd498704 100644 --- a/modules/server/src/topics/shortcuttopic.cpp +++ b/modules/server/src/topics/shortcuttopic.cpp @@ -39,7 +39,21 @@ bool ShortcutTopic::isDone() const { std::vector ShortcutTopic::shortcutsJson() const { std::vector json; - for (const interaction::Action& action : global::actionManager->actions()) { + std::vector actions = global::actionManager->actions(); + std::sort( + actions.begin(), + actions.end(), + [](const interaction::Action& lhs, const interaction::Action& rhs) { + if (!lhs.name.empty() && !rhs.name.empty()) { + return lhs.name < rhs.name; + } + else { + return lhs.identifier < rhs.identifier; + } + } + ); + + for (const interaction::Action& action : actions) { nlohmann::json shortcutJson = { { "identifier", action.identifier }, { "name", action.name }, diff --git a/modules/skybrowser/include/browser.h b/modules/skybrowser/include/browser.h index c3412a4480..297b71414b 100644 --- a/modules/skybrowser/include/browser.h +++ b/modules/skybrowser/include/browser.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #ifdef _MSC_VER #pragma warning (push) @@ -74,17 +74,17 @@ public: void updateBrowserSize(); void reload(); - glm::vec2 browserPixelDimensions() const; + void setRatio(float ratio); float browserRatio() const; - void setCallbackDimensions(const std::function& function); protected: - properties::Vec2Property _browserDimensions; + properties::IVec2Property _browserDimensions; properties::StringProperty _url; properties::TriggerProperty _reload; std::unique_ptr _texture; + void updateBrowserDimensions(); void executeJavascript(const std::string& script) const; bool _isUrlDirty = false; diff --git a/modules/skybrowser/include/screenspaceskybrowser.h b/modules/skybrowser/include/screenspaceskybrowser.h index b7528a06e6..2c96e2574f 100644 --- a/modules/skybrowser/include/screenspaceskybrowser.h +++ b/modules/skybrowser/include/screenspaceskybrowser.h @@ -52,7 +52,6 @@ public: double setVerticalFovWithScroll(float scroll); void setOpacity(float opacity); - void setRatio(float ratio); void setIdInBrowser() const; void setIsInitialized(bool isInitialized); @@ -77,13 +76,11 @@ private: // Flags bool _isSyncedWithWwt = false; - bool _textureDimensionsIsDirty = false; - bool _ratioIsDirty = false; - bool _radiusIsDirty = false; bool _isInitialized = false; + bool _radiusIsDirty = false; int _borderRadiusTimer = -1; - float _ratio = 1.f; + float _lastTextureQuality = 1.f; }; } // namespace openspace diff --git a/modules/skybrowser/include/targetbrowserpair.h b/modules/skybrowser/include/targetbrowserpair.h index c2c76654d7..de3e2f75d2 100644 --- a/modules/skybrowser/include/targetbrowserpair.h +++ b/modules/skybrowser/include/targetbrowserpair.h @@ -111,6 +111,7 @@ private: skybrowser::Animation _targetAnimation = skybrowser::Animation(glm::dvec3(0.0), glm::dvec3(0.0), 0.0); bool _targetIsAnimating = false; + bool _fovIsAnimating = false; // Dragging glm::dvec3 _startTargetPosition = glm::dvec3(0.0); diff --git a/modules/skybrowser/skybrowsermodule.cpp b/modules/skybrowser/skybrowsermodule.cpp index ef1d2593a7..0601015ed9 100644 --- a/modules/skybrowser/skybrowsermodule.cpp +++ b/modules/skybrowser/skybrowsermodule.cpp @@ -237,7 +237,7 @@ SkyBrowserModule::SkyBrowserModule() void SkyBrowserModule::internalInitialize(const ghoul::Dictionary& dict) { const Parameters p = codegen::bake(dict); - _enabled = p.enabled.value_or(true); + _enabled = p.enabled.value_or(_enabled); _allowCameraRotation = p.allowCameraRotation.value_or(_allowCameraRotation); _cameraRotationSpeed = p.cameraRotSpeed.value_or(_cameraRotationSpeed); _targetAnimationSpeed = p.targetSpeed.value_or(_targetAnimationSpeed); diff --git a/modules/skybrowser/src/browser.cpp b/modules/skybrowser/src/browser.cpp index e419aa7801..206fcfeca7 100644 --- a/modules/skybrowser/src/browser.cpp +++ b/modules/skybrowser/src/browser.cpp @@ -55,6 +55,9 @@ namespace { }; struct [[codegen::Dictionary(Browser)]] Parameters { + // [[codegen::verbatim(DimensionsInfo.description)]] + std::optional dimensions; + // [[codegen::verbatim(UrlInfo.description)]] std::optional url; @@ -78,7 +81,7 @@ void Browser::RenderHandler::setTexture(GLuint t) { Browser::Browser(const ghoul::Dictionary& dictionary) : _browserDimensions( DimensionsInfo, - global::windowDelegate->currentSubwindowSize(), + glm::vec2(1000.f), glm::vec2(10.f), glm::vec2(3000.f) ) @@ -90,7 +93,9 @@ Browser::Browser(const ghoul::Dictionary& dictionary) _url = p.url.value_or(_url); _url.onChange([this]() { _isUrlDirty = true; }); + _browserDimensions = p.dimensions.value_or(_browserDimensions); _browserDimensions.onChange([this]() { _isDimensionsDirty = true; }); + _reload.onChange([this]() { _shouldReload = true; }); // Create browser and render handler @@ -119,6 +124,9 @@ void Browser::initializeGL() { _browserInstance->initialize(); _browserInstance->loadUrl(_url); + // Update the dimensions upon initialization. Do this with flag as it affects + // derived classes as well + _isDimensionsDirty = true; } void Browser::deinitializeGL() { @@ -153,11 +161,7 @@ void Browser::update() { } if (_isDimensionsDirty) { - glm::vec2 dim = _browserDimensions; - if (dim.x > 0 && dim.y > 0) { - _browserInstance->reshape(dim); - _isDimensionsDirty = false; - } + updateBrowserDimensions(); } if (_shouldReload) { @@ -170,10 +174,6 @@ bool Browser::isReady() const { return _texture.get(); } -glm::vec2 Browser::browserPixelDimensions() const { - return _browserDimensions; -} - // Updates the browser size to match the size of the texture void Browser::updateBrowserSize() { _browserDimensions = _texture->dimensions(); @@ -183,15 +183,26 @@ void Browser::reload() { _reload.set(true); } +void Browser::setRatio(float ratio) { + float relativeRatio = ratio / browserRatio(); + float newX = static_cast(_browserDimensions.value().x) * relativeRatio; + glm::ivec2 newDims = { static_cast(floor(newX)), _browserDimensions.value().y }; + _browserDimensions = newDims; + _isDimensionsDirty = true; +} + float Browser::browserRatio() const { return static_cast(_texture->dimensions().x) / static_cast(_texture->dimensions().y); } -void Browser::setCallbackDimensions(const std::function& func) { - _browserDimensions.onChange([&]() { - func(_browserDimensions.value()); - }); +void Browser::updateBrowserDimensions() { + glm::ivec2 dim = _browserDimensions; + if (dim.x > 0 && dim.y > 0) { + _texture->setDimensions(glm::uvec3(_browserDimensions.value(), 1)); + _browserInstance->reshape(dim); + _isDimensionsDirty = false; + } } void Browser::executeJavascript(const std::string& script) const { diff --git a/modules/skybrowser/src/renderableskytarget.cpp b/modules/skybrowser/src/renderableskytarget.cpp index a4c891db5e..ffafd90740 100644 --- a/modules/skybrowser/src/renderableskytarget.cpp +++ b/modules/skybrowser/src/renderableskytarget.cpp @@ -58,7 +58,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo RectangleThresholdInfo = { "RectangleThreshold", "Rectangle Threshold", - "When the field of view is larger than the rectangle threshold, a rectangle will" + "When the field of view is larger than the rectangle threshold, a rectangle will " "be rendered in the target" }; @@ -188,7 +188,7 @@ void RenderableSkyTarget::render(const RenderData& data, RendererTasks&) { ZoneScoped const bool showRectangle = _verticalFov > _showRectangleThreshold; - glm::vec4 color = { glm::vec3(_borderColor) / 255.f, 1.0 }; + glm::vec4 color = glm::vec4(glm::vec3(_borderColor) / 255.f, 1.0); _shader->activate(); _shader->setUniform("opacity", opacity()); diff --git a/modules/skybrowser/src/screenspaceskybrowser.cpp b/modules/skybrowser/src/screenspaceskybrowser.cpp index 62c9669ebb..7b76684f3e 100644 --- a/modules/skybrowser/src/screenspaceskybrowser.cpp +++ b/modules/skybrowser/src/screenspaceskybrowser.cpp @@ -105,7 +105,7 @@ documentation::Documentation ScreenSpaceSkyBrowser::Documentation() { ScreenSpaceSkyBrowser::ScreenSpaceSkyBrowser(const ghoul::Dictionary& dictionary) : ScreenSpaceRenderable(dictionary) , WwtCommunicator(dictionary) - , _textureQuality(TextureQualityInfo, 0.5f, 0.25f, 1.f) + , _textureQuality(TextureQualityInfo, 1.f, 0.25f, 1.f) , _isHidden(IsHiddenInfo, true) { _identifier = makeUniqueIdentifier(_identifier); @@ -122,17 +122,12 @@ ScreenSpaceSkyBrowser::ScreenSpaceSkyBrowser(const ghoul::Dictionary& dictionary addProperty(_textureQuality); addProperty(_verticalFov); - _textureQuality.onChange([this]() { _textureDimensionsIsDirty = true; }); + _textureQuality.onChange([this]() { _isDimensionsDirty = true; }); if (global::windowDelegate->isMaster()) { _borderColor = randomBorderColor(); } - _scale.onChange([this]() { - updateTextureResolution(); - _borderRadiusTimer = 0; - }); - _useRadiusAzimuthElevation.onChange( [this]() { std::for_each( @@ -160,7 +155,6 @@ ScreenSpaceSkyBrowser::~ScreenSpaceSkyBrowser() { bool ScreenSpaceSkyBrowser::initializeGL() { WwtCommunicator::initializeGL(); ScreenSpaceRenderable::initializeGL(); - updateTextureResolution(); return true; } @@ -192,19 +186,18 @@ void ScreenSpaceSkyBrowser::setIsInitialized(bool isInitialized) { } void ScreenSpaceSkyBrowser::updateTextureResolution() { - // Scale texture depending on the height of the window - // Set texture size to the actual pixel size it covers - glm::vec2 pixels = glm::vec2(global::windowDelegate->currentSubwindowSize()); + // Check if texture quality has changed. If it has, adjust accordingly + if (abs(_textureQuality.value() - _lastTextureQuality) > glm::epsilon()) { + float diffTextureQuality = _textureQuality / _lastTextureQuality; + glm::vec2 newRes = glm::vec2(_browserDimensions.value()) * diffTextureQuality; + _browserDimensions = glm::ivec2(newRes); + _lastTextureQuality = _textureQuality.value(); + } + _objectSize = glm::ivec3(_browserDimensions.value(), 1); - // If the scale is 1, it covers half the window. Hence multiplication with 2 - float newResY = pixels.y * 2.f * _scale; - float newResX = newResY * _ratio; - glm::vec2 newSize = glm::vec2(newResX , newResY) * _textureQuality.value(); - - _browserDimensions = glm::ivec2(newSize); - _texture->setDimensions(glm::ivec3(newSize, 1)); - _objectSize = glm::ivec3(_texture->dimensions()); + // The radius has to be updated when the texture resolution has changed _radiusIsDirty = true; + _borderRadiusTimer = 0; } void ScreenSpaceSkyBrowser::addDisplayCopy(const glm::vec3& raePosition, int nCopies) { @@ -313,16 +306,9 @@ void ScreenSpaceSkyBrowser::render() { } void ScreenSpaceSkyBrowser::update() { - // Texture of window is 1x1 when minimized - bool isWindow = global::windowDelegate->currentSubwindowSize() != glm::ivec2(1); - bool isWindowResized = global::windowDelegate->windowHasResized(); - if ((isWindowResized && isWindow) || _textureDimensionsIsDirty) { + // Check for dirty flags + if (_isDimensionsDirty) { updateTextureResolution(); - _textureDimensionsIsDirty = false; - } - if (_ratioIsDirty) { - updateTextureResolution(); - _ratioIsDirty = false; } if (_shouldReload) { _isInitialized = false; @@ -369,11 +355,6 @@ void ScreenSpaceSkyBrowser::setOpacity(float opacity) { _opacity = opacity; } -void ScreenSpaceSkyBrowser::setRatio(float ratio) { - _ratio = ratio; - _ratioIsDirty = true; -} - float ScreenSpaceSkyBrowser::opacity() const { return _opacity; } diff --git a/modules/skybrowser/src/targetbrowserpair.cpp b/modules/skybrowser/src/targetbrowserpair.cpp index e72311d49f..df6bec6ba5 100644 --- a/modules/skybrowser/src/targetbrowserpair.cpp +++ b/modules/skybrowser/src/targetbrowserpair.cpp @@ -293,11 +293,18 @@ void TargetBrowserPair::incrementallyAnimateToCoordinate() { aimTargetGalactic(_targetNode->identifier(), _targetAnimation.newValue()); _fovAnimation.start(); _targetIsAnimating = false; + _fovIsAnimating = true; } + // After the target has animated to its position, animate the field of view if (_fovAnimation.isAnimating()) { _browser->setVerticalFov(_fovAnimation.newValue()); _targetRenderable->setVerticalFov(_browser->verticalFov()); } + else if (!_fovAnimation.isAnimating() && _fovIsAnimating) { + // Set the finished field of view + setVerticalFov(_fovAnimation.newValue()); + _fovIsAnimating = false; + } } void TargetBrowserPair::startFading(float goal, float fadeTime) { diff --git a/modules/space/kepler.cpp b/modules/space/kepler.cpp index d1059826be..3f88c558e5 100644 --- a/modules/space/kepler.cpp +++ b/modules/space/kepler.cpp @@ -93,38 +93,38 @@ namespace { } }; - constexpr const LeapSecond LeapEpoch = { 2000, 1 }; + constexpr const LeapSecond LeapEpoch = { .year = 2000, .dayOfYear = 1 }; // List taken from: https://www.ietf.org/timezones/data/leap-seconds.list constexpr const std::array LeapSeconds = { - LeapSecond{ 1972, 1 }, - LeapSecond{ 1972, 183 }, - LeapSecond{ 1973, 1 }, - LeapSecond{ 1974, 1 }, - LeapSecond{ 1975, 1 }, - LeapSecond{ 1976, 1 }, - LeapSecond{ 1977, 1 }, - LeapSecond{ 1978, 1 }, - LeapSecond{ 1979, 1 }, - LeapSecond{ 1980, 1 }, - LeapSecond{ 1981, 182 }, - LeapSecond{ 1982, 182 }, - LeapSecond{ 1983, 182 }, - LeapSecond{ 1985, 182 }, - LeapSecond{ 1988, 1 }, - LeapSecond{ 1990, 1 }, - LeapSecond{ 1991, 1 }, - LeapSecond{ 1992, 183 }, - LeapSecond{ 1993, 182 }, - LeapSecond{ 1994, 182 }, - LeapSecond{ 1996, 1 }, - LeapSecond{ 1997, 182 }, - LeapSecond{ 1999, 1 }, - LeapSecond{ 2006, 1 }, - LeapSecond{ 2009, 1 }, - LeapSecond{ 2012, 183 }, - LeapSecond{ 2015, 182 }, - LeapSecond{ 2017, 1 } + LeapSecond { .year = 1972, .dayOfYear = 1 }, + LeapSecond { .year = 1972, .dayOfYear = 183 }, + LeapSecond { .year = 1973, .dayOfYear = 1 }, + LeapSecond { .year = 1974, .dayOfYear = 1 }, + LeapSecond { .year = 1975, .dayOfYear = 1 }, + LeapSecond { .year = 1976, .dayOfYear = 1 }, + LeapSecond { .year = 1977, .dayOfYear = 1 }, + LeapSecond { .year = 1978, .dayOfYear = 1 }, + LeapSecond { .year = 1979, .dayOfYear = 1 }, + LeapSecond { .year = 1980, .dayOfYear = 1 }, + LeapSecond { .year = 1981, .dayOfYear = 182 }, + LeapSecond { .year = 1982, .dayOfYear = 182 }, + LeapSecond { .year = 1983, .dayOfYear = 182 }, + LeapSecond { .year = 1985, .dayOfYear = 182 }, + LeapSecond { .year = 1988, .dayOfYear = 1 }, + LeapSecond { .year = 1990, .dayOfYear = 1 }, + LeapSecond { .year = 1991, .dayOfYear = 1 }, + LeapSecond { .year = 1992, .dayOfYear = 183 }, + LeapSecond { .year = 1993, .dayOfYear = 182 }, + LeapSecond { .year = 1994, .dayOfYear = 182 }, + LeapSecond { .year = 1996, .dayOfYear = 1 }, + LeapSecond { .year = 1997, .dayOfYear = 182 }, + LeapSecond { .year = 1999, .dayOfYear = 1 }, + LeapSecond { .year = 2006, .dayOfYear = 1 }, + LeapSecond { .year = 2009, .dayOfYear = 1 }, + LeapSecond { .year = 2012, .dayOfYear = 183 }, + LeapSecond { .year = 2015, .dayOfYear = 182 }, + LeapSecond { .year = 2017, .dayOfYear = 1 } }; // Get the position of the last leap second before the desired date LeapSecond date{ year, dayOfYear }; diff --git a/modules/space/labelscomponent.cpp b/modules/space/labelscomponent.cpp index 521fd42a9c..973c575ba3 100644 --- a/modules/space/labelscomponent.cpp +++ b/modules/space/labelscomponent.cpp @@ -85,9 +85,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo FaceCameraInfo = { "FaceCamera", "Face Camera", - "If enabled, the labels will be rotated to face the camera. " - "For non-linear display rendering (for example fisheye) this should be set to " - "false." + "If enabled, the labels will be rotated to face the camera. For non-linear " + "display rendering (for example fisheye) this should be set to false." }; struct [[codegen::Dictionary(LabelsComponent)]] Parameters { diff --git a/modules/space/rendering/renderableconstellationlines.cpp b/modules/space/rendering/renderableconstellationlines.cpp index 9ee55c0f04..2efe096ab1 100644 --- a/modules/space/rendering/renderableconstellationlines.cpp +++ b/modules/space/rendering/renderableconstellationlines.cpp @@ -68,8 +68,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ColorsInfo = { "Colors", "Constellation Colors", - "The defined colors for the constellations to be rendered. " - "There can be several groups of constellaitons that can have distinct colors." + "The defined colors for the constellations to be rendered. There can be several " + "groups of constellaitons that can have distinct colors." }; struct [[codegen::Dictionary(RenderableConstellationLines)]] Parameters { diff --git a/modules/space/rendering/renderableconstellationsbase.cpp b/modules/space/rendering/renderableconstellationsbase.cpp index 5dee713578..f782b8f3df 100644 --- a/modules/space/rendering/renderableconstellationsbase.cpp +++ b/modules/space/rendering/renderableconstellationsbase.cpp @@ -63,8 +63,7 @@ namespace { "The constellations that are selected are displayed on the celestial sphere" }; - static const openspace::properties::PropertyOwner::PropertyOwnerInfo LabelsInfo = - { + const static openspace::properties::PropertyOwner::PropertyOwnerInfo LabelsInfo = { "Labels", "Labels", "The labels for the constellations" diff --git a/modules/space/rendering/renderablefluxnodes.cpp b/modules/space/rendering/renderablefluxnodes.cpp index 61593dafa9..e63f5c4dd4 100644 --- a/modules/space/rendering/renderablefluxnodes.cpp +++ b/modules/space/rendering/renderablefluxnodes.cpp @@ -63,8 +63,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 = { @@ -194,8 +194,8 @@ namespace { CameraPerspectiveEnabledInfo = { "CameraPerspectiveEnabled", "Use Camera perspective", - "Camera perspective changes the size of the nodes dependent on the " - "distance from camera" + "Camera perspective changes the size of the nodes dependent on the distance from " + "camera" }; constexpr openspace::properties::Property::PropertyInfo DrawingCirclesInfo = { @@ -214,15 +214,14 @@ namespace { "RenderingGaussianAlphaFilter", "Alpha by Gaussian", "Using fragment shader to draw nodes with Gaussian filter for alpha value" - }; constexpr openspace::properties::Property::PropertyInfo PerspectiveDistanceFactorInfo = { "PerspectiveDistanceFactor", "Perspective Distance factor", - "This value decides how far away the camera must be to start " - "impacting the node size" + "This value decides how far away the camera must be to start impacting the node " + "size" }; constexpr openspace::properties::Property::PropertyInfo MinMaxNodeSizeInfo = { diff --git a/modules/space/rendering/renderablehabitablezone.cpp b/modules/space/rendering/renderablehabitablezone.cpp index 2afcc70da1..62f4e5046a 100644 --- a/modules/space/rendering/renderablehabitablezone.cpp +++ b/modules/space/rendering/renderablehabitablezone.cpp @@ -68,7 +68,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo KopparapuTeffIntervalInfo = { "KopparapuTeffInterval", - "Kopparapu TEFF" , + "Kopparapu TEFF", "The effective temperature interval for which Kopparapu's formula is used for " "the habitable zone computation. For stars with temperatures outside the range, " "a simpler method by Tom E. Harris is used. This method only uses the star " diff --git a/modules/space/rendering/renderableorbitalkepler.cpp b/modules/space/rendering/renderableorbitalkepler.cpp index 167e46f3ef..6bde01ef0e 100644 --- a/modules/space/rendering/renderableorbitalkepler.cpp +++ b/modules/space/rendering/renderableorbitalkepler.cpp @@ -77,7 +77,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo TrailFadeInfo = { "TrailFade", "Trail Fade", - "This value determines how fast the trail fades and is an appearance property. " + "This value determines how fast the trail fades and is an appearance property." }; constexpr openspace::properties::Property::PropertyInfo StartRenderIdxInfo = { diff --git a/modules/space/rendering/renderablestars.cpp b/modules/space/rendering/renderablestars.cpp index b473af5707..0c55c86114 100644 --- a/modules/space/rendering/renderablestars.cpp +++ b/modules/space/rendering/renderablestars.cpp @@ -242,9 +242,9 @@ namespace { constexpr openspace::properties::Property::PropertyInfo MagnitudeExponentInfo = { "MagnitudeExponent", "Magnitude Exponent", - "Adjust star magnitude by 10^MagnitudeExponent. " - "Stars closer than this distance are given full opacity. " - "Farther away, stars dim proportionally to the logarithm of their distance" + "Adjust star magnitude by 10^MagnitudeExponent. Stars closer than this distance " + "are given full opacity. Farther away, stars dim proportionally to the " + "logarithm of their distance" }; constexpr openspace::properties::Property::PropertyInfo RenderMethodOptionInfo = { @@ -301,7 +301,7 @@ namespace { }; constexpr openspace::properties::Property::PropertyInfo BrightnessPercentInfo = { - "BrightnessPercen", + "BrightnessPercent", "App Brightness Contribution", "App Brightness Contribution" }; diff --git a/modules/space/rendering/renderabletravelspeed.cpp b/modules/space/rendering/renderabletravelspeed.cpp index e424044afa..8813c15a4d 100644 --- a/modules/space/rendering/renderabletravelspeed.cpp +++ b/modules/space/rendering/renderabletravelspeed.cpp @@ -37,7 +37,7 @@ #include namespace { - constexpr std::array UniformNames = {"lineColor", "opacity"}; + constexpr std::array UniformNames = { "lineColor", "opacity" }; constexpr openspace::properties::Property::PropertyInfo SpeedInfo = { "TravelSpeed", @@ -90,10 +90,10 @@ namespace { std::optional lineWidth; // [[codegen::verbatim(IndicatorLengthInfo.description)]] - std::optional indicatorLength; + std::optional indicatorLength; // [[codegen::verbatim(FadeLengthInfo.description)]] - std::optional fadeLength; + std::optional fadeLength; }; #include "renderabletravelspeed_codegen.cpp" } // namespace @@ -113,8 +113,8 @@ RenderableTravelSpeed::RenderableTravelSpeed(const ghoul::Dictionary& dictionary 1.0, distanceconstants::LightSecond ) - , _indicatorLength(IndicatorLengthInfo, 1, 1, 360) - , _fadeLength(FadeLengthInfo, 1, 0, 360) + , _indicatorLength(IndicatorLengthInfo, 1.f, 0.f, 360.f) + , _fadeLength(FadeLengthInfo, 1.f, 0.f, 360.f) , _lineWidth(LineWidthInfo, 2.f, 1.f, 20.f) , _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f)) { diff --git a/modules/space/rendering/renderabletravelspeed.h b/modules/space/rendering/renderabletravelspeed.h index 84d09ade87..e2a62b0a54 100644 --- a/modules/space/rendering/renderabletravelspeed.h +++ b/modules/space/rendering/renderabletravelspeed.h @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -62,8 +63,8 @@ private: properties::StringProperty _targetName; SceneGraphNode* _targetNode = nullptr; properties::DoubleProperty _travelSpeed; - properties::IntProperty _indicatorLength; - properties::IntProperty _fadeLength; + properties::FloatProperty _indicatorLength; + properties::FloatProperty _fadeLength; properties::FloatProperty _lineWidth; properties::Vec3Property _lineColor; diff --git a/modules/space/translation/keplertranslation.cpp b/modules/space/translation/keplertranslation.cpp index 7aacf36986..c6d7e1c94f 100644 --- a/modules/space/translation/keplertranslation.cpp +++ b/modules/space/translation/keplertranslation.cpp @@ -258,11 +258,11 @@ glm::dvec3 KeplerTranslation::position(const UpdateData& data) const { const double e = eccentricAnomaly(meanAnomaly); // Use the eccentric anomaly to compute the actual location - const glm::dvec3 p = { + const glm::dvec3 p = glm::dvec3( _semiMajorAxis * 1000.0 * (cos(e) - _eccentricity), _semiMajorAxis * 1000.0 * sin(e) * sqrt(1.0 - _eccentricity * _eccentricity), 0.0 - }; + ); return _orbitPlaneRotation * p; } @@ -278,9 +278,9 @@ void KeplerTranslation::computeOrbitPlane() const { // inclination // 3. Around the new z axis to place the closest approach to the correct location - const glm::vec3 ascendingNodeAxisRot = { 0.f, 0.f, 1.f }; - const glm::vec3 inclinationAxisRot = { 1.f, 0.f, 0.f }; - const glm::vec3 argPeriapsisAxisRot = { 0.f, 0.f, 1.f }; + const glm::vec3 ascendingNodeAxisRot = glm::vec3(0.f, 0.f, 1.f); + const glm::vec3 inclinationAxisRot = glm::vec3(1.f, 0.f, 0.f); + const glm::vec3 argPeriapsisAxisRot = glm::vec3(0.f, 0.f, 1.f); const double asc = glm::radians(_ascendingNode.value()); const double inc = glm::radians(_inclination.value()); diff --git a/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp b/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp index aa75f1c4f5..a2559daee9 100644 --- a/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp +++ b/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp @@ -148,7 +148,7 @@ void DashboardItemInstruments::render(glm::vec2& penPosition) { // If the remaining time is below 5 minutes, we switch over to seconds display if (remaining < 5 * 60) { - remainingConv = { remaining, "seconds" }; + remainingConv = std::pair(remaining, "seconds"); } const int Size = 25; diff --git a/modules/spacecraftinstruments/rendering/renderablefov.cpp b/modules/spacecraftinstruments/rendering/renderablefov.cpp index a34e2574a9..018846e1c0 100644 --- a/modules/spacecraftinstruments/rendering/renderablefov.cpp +++ b/modules/spacecraftinstruments/rendering/renderablefov.cpp @@ -480,7 +480,10 @@ void RenderableFov::computeIntercepts(double time, const std::string& target, // Regardless of what happens next, the position of every second element is going // to be the same. Only the color attribute might change - first = { { 0.f, 0.f, 0.f }, RenderInformation::VertexColorTypeDefaultStart}; + first = { + .position = { 0.f, 0.f, 0.f }, + .color = RenderInformation::VertexColorTypeDefaultStart + }; if (!isInFov) { // If the target is not in the field of view, we don't need to perform any @@ -488,9 +491,8 @@ void RenderableFov::computeIntercepts(double time, const std::string& target, const glm::vec3 o = orthogonalProjection(bound, time, target); second = { - { o.x, o.y, o.z }, - // This had a different color (0.4) before ---abock - RenderInformation::VertexColorTypeDefaultEnd + .position = { o.x, o.y, o.z }, + .color = RenderInformation::VertexColorTypeDefaultEnd }; } else { @@ -531,16 +533,16 @@ void RenderableFov::computeIntercepts(double time, const std::string& target, srfVec *= _standOffDistance; second = { - { srfVec.x, srfVec.y, srfVec.z }, - RenderInformation::VertexColorTypeIntersectionEnd + .position = { srfVec.x, srfVec.y, srfVec.z }, + .color = RenderInformation::VertexColorTypeIntersectionEnd }; } else { // This point did not intersect the target though others did const glm::vec3 o = orthogonalProjection(bound, time, target); second = { - { o.x, o.y, o.z }, - RenderInformation::VertexColorTypeInFieldOfView + .position = { o.x, o.y, o.z }, + .color = RenderInformation::VertexColorTypeInFieldOfView }; } } @@ -626,15 +628,15 @@ void RenderableFov::computeIntercepts(double time, const std::string& target, if (intercepts(tBound)) { const glm::vec3 icpt = interceptVector(tBound); _orthogonalPlane.data[indexForBounds(i) + m] = { - { icpt.x, icpt.y, icpt.z }, - RenderInformation::VertexColorTypeSquare + .position = { icpt.x, icpt.y, icpt.z }, + .color = RenderInformation::VertexColorTypeSquare }; } else { const glm::vec3 o = orthogonalProjection(tBound, time, target); _orthogonalPlane.data[indexForBounds(i) + m] = { - { o.x, o.y, o.z }, - RenderInformation::VertexColorTypeSquare + .position = { o.x, o.y, o.z }, + .color = RenderInformation::VertexColorTypeSquare }; } } diff --git a/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp b/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp index 59b66db510..bd4730c157 100644 --- a/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderableplanetprojection.cpp @@ -256,15 +256,6 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary& _meridianShift = p.meridianShift.value_or(_meridianShift); addProperty(_meridianShift); - // @TODO (abock, 2021-03-26) Poking into the Geometry dictionary is not really - // optimal as we don't have local control over how the dictionary is checked. We - // should instead ask the geometry whether it has a radius or not - double radius = std::pow(10.0, 9.0); - if (dict.hasValue(KeyRadius)) { - radius = dict.value(KeyRadius); - } - setBoundingSphere(radius); - addPropertySubOwner(_projectionComponent); _heightExaggeration.setExponent(3.f); @@ -291,6 +282,7 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary& else { _radius = std::get(p.radius); } + setBoundingSphere(glm::compMax(_radius.value())); _radius.onChange([&]() { createSphere(); }); addProperty(_radius); diff --git a/modules/spacecraftinstruments/util/hongkangparser.cpp b/modules/spacecraftinstruments/util/hongkangparser.cpp index 13789c585a..f895523c67 100644 --- a/modules/spacecraftinstruments/util/hongkangparser.cpp +++ b/modules/spacecraftinstruments/util/hongkangparser.cpp @@ -197,12 +197,12 @@ bool HongKangParser::create() { // fill image Image image = { - TimeRange(time, time + Exposure), - _defaultCaptureImage.string(), - std::move(cameraSpiceID), - cameraTarget, - true, - false + .timeRange = TimeRange(time, time + Exposure), + .path = _defaultCaptureImage.string(), + .activeInstruments = std::move(cameraSpiceID), + .target = cameraTarget, + .isPlaceholder = true, + .projected = false }; // IFF spacecraft has decided to switch target, store in target @@ -239,18 +239,18 @@ bool HongKangParser::create() { ); std::string scannerTarget = findPlaybookSpecifiedTarget(line); - TimeRange scanRange = { scanStart, scanStop }; + TimeRange scanRange = TimeRange(scanStart, scanStop); ghoul_assert(scanRange.isDefined(), "Invalid time range"); _instrumentTimes.emplace_back(it->first, scanRange); // store individual image Image image = { - scanRange, - _defaultCaptureImage.string(), - it->second->translations(), - cameraTarget, - true, - false + .timeRange = scanRange, + .path = _defaultCaptureImage.string(), + .activeInstruments = it->second->translations(), + .target = cameraTarget, + .isPlaceholder = true, + .projected = false }; _subsetMap[scannerTarget]._subset.push_back(std::move(image)); _subsetMap[scannerTarget]._range.include(scanStart); @@ -265,7 +265,7 @@ bool HongKangParser::create() { // we have reached the end of a scan or consecutive capture sequence if (captureStart != -1) { // end of capture sequence for camera, store end time of this sequence - TimeRange cameraRange = { captureStart, time }; + TimeRange cameraRange = TimeRange(captureStart, time); ghoul_assert(cameraRange.isDefined(), "Invalid time range"); _instrumentTimes.emplace_back(previousCamera, cameraRange); captureStart = -1; diff --git a/modules/spacecraftinstruments/util/instrumenttimesparser.cpp b/modules/spacecraftinstruments/util/instrumenttimesparser.cpp index 70160af00a..eb3395aaa7 100644 --- a/modules/spacecraftinstruments/util/instrumenttimesparser.cpp +++ b/modules/spacecraftinstruments/util/instrumenttimesparser.cpp @@ -127,12 +127,12 @@ bool InstrumentTimesParser::create() { _captureProgression.push_back(tr.start); Image image = { - tr, - std::string(), - { instrumentID }, - _target, - true, - false + .timeRange = tr, + .path = std::string(), + .activeInstruments = { instrumentID }, + .target = _target, + .isPlaceholder = true, + .projected = false }; _subsetMap[_target]._subset.push_back(std::move(image)); } diff --git a/modules/spacecraftinstruments/util/labelparser.cpp b/modules/spacecraftinstruments/util/labelparser.cpp index 4a63cf47a8..68a0cbc75f 100644 --- a/modules/spacecraftinstruments/util/labelparser.cpp +++ b/modules/spacecraftinstruments/util/labelparser.cpp @@ -58,13 +58,10 @@ LabelParser::LabelParser(std::string fileName, const ghoul::Dictionary& dictiona if (decoderStr == "Instrument") { // for each playbook call -> create a Decoder object for (std::string_view key : typeDict.keys()) { - std::string currentKey = fmt::format("{}.{}", decoderStr, key); - - if (!dictionary.hasValue(currentKey)) { + if (!typeDict.hasValue(key)) { continue; } - ghoul::Dictionary decoderDict = - dictionary.value(currentKey); + ghoul::Dictionary decoderDict = typeDict.value(key); std::unique_ptr decoder = Decoder::createFromDictionary( decoderDict, @@ -274,12 +271,12 @@ bool LabelParser::create() { spiceInstrument.push_back(_instrumentID); Image image = { - TimeRange(startTime, stopTime), - imagePath, - spiceInstrument, - _target, - false, - false + .timeRange = TimeRange(startTime, stopTime), + .path = imagePath, + .activeInstruments = spiceInstrument, + .target = _target, + .isPlaceholder = false, + .projected = false }; _subsetMap[image.target]._subset.push_back(image); diff --git a/modules/sync/syncs/httpsynchronization.cpp b/modules/sync/syncs/httpsynchronization.cpp index d103aec7de..49065125c1 100644 --- a/modules/sync/syncs/httpsynchronization.cpp +++ b/modules/sync/syncs/httpsynchronization.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,16 @@ namespace { // The version of this resource that should be requested int version; + + // Determines whether .zip files that are downloaded should automatically be + // unzipped. If this value is not specified, no unzipping is performed + std::optional unzipFiles; + + // The destination for the unzipping. If this value is specified, all zip files + // contained in the synchronization will be unzipped into the same specified + // folder. If this value is specified, but 'unzipFiles' is false, no extaction + // will be performed + std::optional unzipFilesDestination; }; #include "httpsynchronization_codegen.cpp" } // namespace @@ -63,6 +74,10 @@ HttpSynchronization::HttpSynchronization(const ghoul::Dictionary& dict, _identifier = p.identifier; _version = p.version; + _unzipFiles = p.unzipFiles.value_or(_unzipFiles); + if (p.unzipFilesDestination.has_value()) { + _unzipFilesDestination = *p.unzipFilesDestination; + } } HttpSynchronization::~HttpSynchronization() { @@ -233,6 +248,33 @@ bool HttpSynchronization::trySyncFromUrl(std::string listUrl) { LERROR(fmt::format("Error renaming {} to {}", tempName, originalName)); failed = true; } + + if (_unzipFiles && originalName.extension() == ".zip") { + std::string source = originalName.string(); + std::string dest = + _unzipFilesDestination.has_value() ? + (originalName.parent_path() / *_unzipFilesDestination).string() : + originalName.replace_extension().string();; + + struct zip_t* z = zip_open(source.c_str(), 0, 'r'); + const bool is64 = zip_is64(z); + zip_close(z); + + if (is64) { + LERROR(fmt::format( + "Error while unzipping {}: Zip64 archives are not supported", source + )); + continue; + } + + int ret = zip_extract(source.c_str(), dest.c_str(), nullptr, nullptr); + if (ret != 0) { + LERROR(fmt::format("Error {} while unzipping {}", ret, source)); + continue; + } + + std::filesystem::remove(source); + } } if (failed) { for (const std::unique_ptr& d : downloads) { diff --git a/modules/sync/syncs/httpsynchronization.h b/modules/sync/syncs/httpsynchronization.h index b0a2754b5c..75d10f8f2b 100644 --- a/modules/sync/syncs/httpsynchronization.h +++ b/modules/sync/syncs/httpsynchronization.h @@ -28,6 +28,7 @@ #include #include +#include #include namespace openspace { @@ -101,6 +102,9 @@ private: /// The file version for the requested files int _version = -1; + bool _unzipFiles = false; + std::optional _unzipFilesDestination = std::nullopt; + // The list of all repositories that we'll try to sync from const std::vector _syncRepositories; diff --git a/modules/sync/syncs/urlsynchronization.cpp b/modules/sync/syncs/urlsynchronization.cpp index 9808aa2211..d481d1ae2f 100644 --- a/modules/sync/syncs/urlsynchronization.cpp +++ b/modules/sync/syncs/urlsynchronization.cpp @@ -146,7 +146,13 @@ void UrlSynchronization::start() { for (const std::string& url : _urls) { if (_filename.empty() || _urls.size() > 1) { - std::string name = std::filesystem::path(url).filename().string(); + std::filesystem::path fn = std::filesystem::path(url).filename(); + if (fn.empty() && url.back() == '/') { + // If the user provided a path that ends in / the `filename` will + // result in an empty path with causes the downloading to fail + fn = std::filesystem::path(url).parent_path().filename(); + } + std::string name = fn.string(); // We can not create filenames with question marks name.erase(std::remove(name.begin(), name.end(), '?'), name.end()); diff --git a/modules/touch/include/touchinteraction.h b/modules/touch/include/touchinteraction.h index d6bd98c36a..b492bbb5d6 100644 --- a/modules/touch/include/touchinteraction.h +++ b/modules/touch/include/touchinteraction.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -67,9 +68,16 @@ public: TouchInteraction(); // for interpretInteraction() - enum Type { ROT = 0, PINCH, PAN, ROLL, PICK, ZOOM_OUT }; + enum Type { + ROTATION = 0, + PINCH, + PAN, + ROLL, + PICK, + ZOOM_OUT + }; - // Stores the velocity in all 6DOF + // Stores the velocity in all 6 DOF struct VelocityStates { glm::dvec2 orbit = glm::dvec2(0.0); double zoom = 0.0; @@ -146,7 +154,7 @@ private: void decelerate(double dt); // Resets all properties that can be changed in the GUI to default - void resetToDefault(); + void resetPropertiesToDefault(); Camera* _camera = nullptr; @@ -156,7 +164,7 @@ private: properties::BoolProperty _touchActive; properties::BoolProperty _disableZoom; properties::BoolProperty _disableRoll; - properties::BoolProperty _reset; + properties::TriggerProperty _reset; properties::IntProperty _maxTapTime; properties::IntProperty _deceleratesPerSecond; properties::FloatProperty _touchScreenSize; @@ -194,7 +202,7 @@ private: int pinchConsecCt = 0; double pinchConsecZoomFactor = 0; - //int stepVelUpdate = 0; + int stepVelUpdate = 0; #endif std::array _pinchInputs; // Class variables diff --git a/modules/touch/src/directinputsolver.cpp b/modules/touch/src/directinputsolver.cpp index 2b5bc05b92..b0665ce5da 100644 --- a/modules/touch/src/directinputsolver.cpp +++ b/modules/touch/src/directinputsolver.cpp @@ -229,12 +229,12 @@ bool DirectInputSolver::solve(const std::vector& list, } FunctionData fData = { - selectedPoints, - screenPoints, - _nDof, - &camera, - selectedBodies.at(0).node, - _lmstat + .selectedPoints = selectedPoints, + .screenPoints = screenPoints, + .nDOF = _nDof, + .camera = &camera, + .node = selectedBodies.at(0).node, + .stats = _lmstat }; void* dataPtr = reinterpret_cast(&fData); diff --git a/modules/touch/src/touchinteraction.cpp b/modules/touch/src/touchinteraction.cpp index 226e276c35..dcce4ae840 100644 --- a/modules/touch/src/touchinteraction.cpp +++ b/modules/touch/src/touchinteraction.cpp @@ -77,7 +77,10 @@ namespace { constexpr openspace::properties::Property::PropertyInfo UnitTestInfo = { "UnitTest", "Take a unit test saving the LM data into file", - "" // @TODO Missing documentation + "LM - least-squares minimization using Levenberg-Marquardt algorithm." + "Used to find a new camera state from touch points when doing direct " + "manipulation", + openspace::properties::Property::Visibility::Developer }; constexpr openspace::properties::Property::PropertyInfo DisableZoomInfo = { @@ -243,7 +246,7 @@ namespace { "Zoom In Limit", "The minimum distance from the anchor that you are allowed to navigate to. " "Its purpose is to limit zooming in on a node. If this value is not set it " - "defaults to the surface of the current anchor. " + "defaults to the surface of the current anchor." }; // Compute coefficient of decay based on current frametime; if frametime has been @@ -268,16 +271,16 @@ TouchInteraction::TouchInteraction() , _touchActive(EventsInfo, false) , _disableZoom(DisableZoomInfo, false) , _disableRoll(DisableRollInfo, false) - , _reset(SetDefaultInfo, false) + , _reset(SetDefaultInfo) , _maxTapTime(MaxTapTimeInfo, 300, 10, 1000) , _deceleratesPerSecond(DecelatesPerSecondInfo, 240, 60, 300) , _touchScreenSize(TouchScreenSizeInfo, 55.0f, 5.5f, 150.0f) - , _tapZoomFactor(TapZoomFactorInfo, 0.2f, 0.f, 0.5f) + , _tapZoomFactor(TapZoomFactorInfo, 0.2f, 0.f, 0.5f, 0.01f) , _pinchZoomFactor(PinchZoomFactorInfo, 0.01f, 0.f, 0.2f) , _nodeRadiusThreshold(DirectManipulationInfo, 0.2f, 0.0f, 1.0f) - , _rollAngleThreshold(RollThresholdInfo, 0.025f, 0.f, 0.05f) - , _orbitSpeedThreshold(OrbitSpinningThreshold, 0.005f, 0.f, 0.01f) - , _spinSensitivity(SpinningSensitivityInfo, 0.25f, 0.f, 2.f) + , _rollAngleThreshold(RollThresholdInfo, 0.025f, 0.f, 0.05f, 0.001f) + , _orbitSpeedThreshold(OrbitSpinningThreshold, 0.005f, 0.f, 0.01f, 0.0001f) + , _spinSensitivity(SpinningSensitivityInfo, 0.25f, 0.f, 2.f, 0.01f) , _zoomSensitivityExponential(ZoomSensitivityExpInfo, 1.03f, 1.0f, 1.1f) , _zoomSensitivityProportionalDist(ZoomSensitivityPropInfo, 11.f, 5.f, 50.f) , _zoomSensitivityDistanceThreshold( @@ -286,7 +289,7 @@ TouchInteraction::TouchInteraction() 0.01f, 0.25f ) - , _zoomBoundarySphereMultiplier(ZoomBoundarySphereMultiplierInfo, 1.001f, 1.f, 1.01f) + , _zoomBoundarySphereMultiplier(ZoomBoundarySphereMultiplierInfo, 1.001f, 0.01f, 10000.0f) , _zoomInLimit(ZoomInLimitInfo, -1.0, 0.0, std::numeric_limits::max()) , _zoomOutLimit( ZoomOutLimitInfo, @@ -294,15 +297,15 @@ TouchInteraction::TouchInteraction() 1000.0, std::numeric_limits::max() ) - , _inputStillThreshold(InputSensitivityInfo, 0.0005f, 0.f, 0.001f) + , _inputStillThreshold(InputSensitivityInfo, 0.0005f, 0.f, 0.001f, 0.0001f) // used to void wrongly interpreted roll interactions - , _centroidStillThreshold(StationaryCentroidInfo, 0.0018f, 0.f, 0.01f) + , _centroidStillThreshold(StationaryCentroidInfo, 0.0018f, 0.f, 0.01f, 0.0001f) , _panEnabled(PanModeInfo, false) , _interpretPan(PanDeltaDistanceInfo, 0.015f, 0.f, 0.1f) , _slerpTime(SlerpTimeInfo, 3.f, 0.1f, 5.f) , _friction( FrictionInfo, - glm::vec4(0.025f, 0.025f, 0.02f, 0.02f), + glm::vec4(0.025f, 0.025f, 0.02f, 0.001f), glm::vec4(0.f), glm::vec4(0.2f) ) @@ -366,6 +369,10 @@ TouchInteraction::TouchInteraction() _time = std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ); + + _reset.onChange([&]() { + resetPropertiesToDefault(); + }); } void TouchInteraction::updateStateFromInput(const std::vector& list, @@ -389,6 +396,7 @@ void TouchInteraction::updateStateFromInput(const std::vector& high_resolution_clock::now().time_since_epoch() ); if ((timestamp - _time).count() < _maxTapTime) { + LINFO("Double tap!"); _doubleTap = true; _tap = false; } @@ -466,7 +474,7 @@ void TouchInteraction::directControl(const std::vector& list) LINFO("DirectControl"); #endif - // finds best transform values for the new camera state and stores them in par + // Find best transform values for the new camera state and store them in par std::vector par(6, 0.0); par[0] = _lastVel.orbit.x; // use _lastVel for orbit par[1] = _lastVel.orbit.y; @@ -474,7 +482,7 @@ void TouchInteraction::directControl(const std::vector& list) int nDof = _solver.nDof(); if (_lmSuccess && !_unitTest) { - // if good values were found set new camera state + // If good values were found set new camera state _vel.orbit = glm::dvec2(par.at(0), par.at(1)); if (nDof > 2) { if (!_disableZoom) { @@ -499,15 +507,18 @@ void TouchInteraction::directControl(const std::vector& list) } else { // prevents touch to infinitely be active (due to windows bridge case where event - // doesnt get consumed sometimes when LMA fails to converge) + // doesn't get consumed sometimes when LMA fails to converge) resetAfterInput(); } } void TouchInteraction::findSelectedNode(const std::vector& list) { // trim list to only contain visible nodes that make sense - std::string selectables[30] = { - "Sun", "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", + // @TODO (emmbr 2023-01-31) This hardcoded list should be removed and replaced by something + // else. Either a type of renderable that can always be directly manipulated, or a list + // that can be set in config/assets. Or both? + std::string selectables[31] = { + "Sun", "Mercury", "Venus", "Earth", "Mars", "Ceres", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto", "Moon", "Titan", "Rhea", "Mimas", "Iapetus", "Enceladus", "Dione", "Io", "Ganymede", "Europa", "Callisto", "NewHorizons", "Styx", "Nix", "Kerberos", "Hydra", "Charon", "Tethys", "OsirisRex", "Bennu" @@ -591,7 +602,7 @@ void TouchInteraction::findSelectedNode(const std::vector& lis const bool isVisibleX = (ndc.x >= -1.0 && ndc.x <= 1.0); const bool isVisibleY = (ndc.y >= -1.0 && ndc.y <= 1.0); if (isVisibleX && isVisibleY) { - glm::dvec2 cursor = { xCo, yCo }; + glm::dvec2 cursor = glm::dvec2(xCo, yCo); const double ndcDist = glm::length(ndc - cursor); // We either want to select the object if it's bounding sphere as been @@ -607,10 +618,10 @@ void TouchInteraction::findSelectedNode(const std::vector& lis "Picking candidate based on direct touch" ); #endif //#ifdef TOUCH_DEBUG_NODE_PICK_MESSAGES - currentlyPicked = { + currentlyPicked = std::pair( node, -std::numeric_limits::max() - }; + ); } else if (ndcDist <= _pickingRadiusMinimum) { // The node was considered due to minimum picking distance radius @@ -644,7 +655,7 @@ int TouchInteraction::interpretInteraction(const std::vector& const std::vector& lastProcessed) { glm::fvec2 lastCentroid = _centroid; - _centroid = { 0.f, 0.f }; + _centroid = glm::vec2(0.f, 0.f); for (const TouchInputHolder& inputHolder : list) { _centroid += glm::vec2( inputHolder.latestInput().x, @@ -672,7 +683,7 @@ int TouchInteraction::interpretInteraction(const std::vector& distInput = p; } // find the slowest moving finger - used in roll interpretation - double minDiff = 1000; + double minDiff = 1000.0; for (const TouchInputHolder& inputHolder : list) { const auto it = std::find_if( lastProcessed.cbegin(), @@ -707,12 +718,14 @@ int TouchInteraction::interpretInteraction(const std::vector& lastProcessed.end(), [&inputHolder](const TouchInput& input) { return inputHolder.holdsInput(input); - }); - double res = 0.0; + } + ); + double res = 0.0; float lastAngle = lastPoint.angleToPos(_centroid.x, _centroid.y); float currentAngle = inputHolder.latestInput().angleToPos(_centroid.x, _centroid.y); + if (lastAngle > currentAngle + 1.5 * glm::pi()) { res = currentAngle + (2.0 * glm::pi() - lastAngle); } @@ -722,6 +735,7 @@ int TouchInteraction::interpretInteraction(const std::vector& else { res = currentAngle - lastAngle; } + if (std::abs(res) < _rollAngleThreshold) { return 1000.0; } @@ -735,6 +749,7 @@ int TouchInteraction::interpretInteraction(const std::vector& _centroid, lastCentroid ) / list.size(); + #ifdef TOUCH_DEBUG_PROPERTIES _debugProperties.normalizedCentroidDistance = normalizedCentroidDistance; _debugProperties.rollOn = rollOn; @@ -748,7 +763,7 @@ int TouchInteraction::interpretInteraction(const std::vector& return PICK; } else if (list.size() == 1) { - return ROT; + return ROTATION; } else { float avgDistance = static_cast(std::abs(dist - lastDist)); @@ -787,13 +802,14 @@ void TouchInteraction::computeVelocities(const std::vector& li const int action = interpretInteraction(list, lastProcessed); const SceneGraphNode* anchor = global::navigationHandler->orbitalNavigator().anchorNode(); + if (!anchor) { return; } #ifdef TOUCH_DEBUG_PROPERTIES const std::map interactionNames = { - { ROT, "Rotation" }, + { ROTATION, "Rotation" }, { PINCH, "Pinch" }, { PAN, "Pan" }, { ROLL, "Roll" }, @@ -819,7 +835,7 @@ void TouchInteraction::computeVelocities(const std::vector& li const float aspectRatio = static_cast(windowSize.x) / static_cast(windowSize.y); switch (action) { - case ROT: { // add rotation velocity + case ROTATION: { // add rotation velocity _vel.orbit += glm::dvec2(inputHolder.speedX() * _sensitivity.orbit.x, inputHolder.speedY() * _sensitivity.orbit.y); @@ -1015,7 +1031,7 @@ void TouchInteraction::step(double dt, bool directTouch) { // rotations // To avoid problem with lookup in up direction const dmat4 lookAtMat = lookAt( - dvec3(0, 0, 0), + dvec3(0.0, 0.0, 0.0), directionToCenter, normalize(camDirection + lookUp) ); @@ -1034,7 +1050,7 @@ void TouchInteraction::step(double dt, bool directTouch) { } { // Panning (local rotation) - const dvec3 eulerAngles(_vel.pan.y * dt, _vel.pan.x * dt, 0); + const dvec3 eulerAngles(_vel.pan.y * dt, _vel.pan.x * dt, 0.0); const dquat rotationDiff = dquat(eulerAngles); localCamRot = localCamRot * rotationDiff; @@ -1046,7 +1062,7 @@ void TouchInteraction::step(double dt, bool directTouch) { } { // Orbit (global rotation) - const dvec3 eulerAngles(_vel.orbit.y * dt, _vel.orbit.x * dt, 0); + const dvec3 eulerAngles(_vel.orbit.y * dt, _vel.orbit.x * dt, 0.0); const dquat rotationDiffCamSpace = dquat(eulerAngles); const dquat rotationDiffWorldSpace = globalCamRot * rotationDiffCamSpace * @@ -1059,8 +1075,9 @@ void TouchInteraction::step(double dt, bool directTouch) { directionToCenter = normalize(-centerToCam); const dvec3 lookUpWhenFacingCenter = globalCamRot * dvec3(_camera->lookUpVectorCameraSpace()); + const dmat4 lookAtMatrix = lookAt( - dvec3(0, 0, 0), + dvec3(0.0, 0.0, 0.0), directionToCenter, lookUpWhenFacingCenter); globalCamRot = normalize(quat_cast(inverse(lookAtMatrix))); @@ -1105,7 +1122,7 @@ void TouchInteraction::step(double dt, bool directTouch) { } const double currentPosDistance = length(centerToCamera); - //Apply the velocity to update camera position + // Apply the velocity to update camera position double zoomVelocity = _vel.zoom; if (!directTouch) { const double distanceFromSurface = @@ -1168,6 +1185,9 @@ void TouchInteraction::step(double dt, bool directTouch) { _camera->setPositionVec3(camPos); _camera->setRotation(globalCamRot * localCamRot); + // Mark that a camera interaction happened + global::navigationHandler->orbitalNavigator().updateOnCameraInteraction(); + #ifdef TOUCH_DEBUG_PROPERTIES //Show velocity status every N frames if (++stepVelUpdate >= 60) { @@ -1183,9 +1203,6 @@ void TouchInteraction::step(double dt, bool directTouch) { _tap = false; _doubleTap = false; _zoomOutTap = false; - if (_reset) { - resetToDefault(); - } } } @@ -1252,11 +1269,10 @@ void TouchInteraction::resetAfterInput() { } // Reset all property values to default -void TouchInteraction::resetToDefault() { +void TouchInteraction::resetPropertiesToDefault() { _unitTest.set(false); _disableZoom.set(false); _disableRoll.set(false); - _reset.set(false); _maxTapTime.set(300); _deceleratesPerSecond.set(240); _touchScreenSize.set(55.0f); diff --git a/modules/touch/src/touchmarker.cpp b/modules/touch/src/touchmarker.cpp index 48f3af0155..e6401232e2 100644 --- a/modules/touch/src/touchmarker.cpp +++ b/modules/touch/src/touchmarker.cpp @@ -62,7 +62,6 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ColorInfo = { "MarkerColor", "Marker color", "" // @TODO Missing documentation }; - } // namespace namespace openspace { diff --git a/modules/touch/touchmodule.cpp b/modules/touch/touchmodule.cpp index 3ee6653058..dfa9ada612 100644 --- a/modules/touch/touchmodule.cpp +++ b/modules/touch/touchmodule.cpp @@ -37,133 +37,13 @@ using namespace TUIO; namespace { constexpr openspace::properties::Property::PropertyInfo TouchActiveInfo = { "TouchActive", - "True if we want to use touch input as 3d navigation", + "True if we want to use touch input as 3D navigation", "Use this if we want to turn on or off Touch input navigation. " - "Disabling this will reset all current touch inputs to the navigation. " + "Disabling this will reset all current touch inputs to the navigation." }; } namespace openspace { -bool TouchModule::processNewInput() { - // Get new input from listener - std::vector earInputs = _ear->takeInput(); - std::vector earRemovals = _ear->takeRemovals(); - - for(const TouchInput& input : earInputs) { - updateOrAddTouchInput(input); - } - for(const TouchInput& removal : earRemovals) { - removeTouchInput(removal); - } - - // Set touch property to active (to void mouse input, mainly for mtdev bridges) - _touch.touchActive(!_touchPoints.empty()); - - if (!_touchPoints.empty()) { - global::interactionMonitor->markInteraction(); - } - - // Erase old input id's that no longer exists - _lastTouchInputs.erase( - std::remove_if( - _lastTouchInputs.begin(), - _lastTouchInputs.end(), - [this](const TouchInput& input) { - return !std::any_of( - _touchPoints.cbegin(), - _touchPoints.cend(), - [&input](const TouchInputHolder& holder) { - return holder.holdsInput(input); - } - ); - } - ), - _lastTouchInputs.end() - ); - - if (_tap) { - _touch.tap(); - _tap = false; - return true; - } - - // Return true if we got new input - if (_touchPoints.size() == _lastTouchInputs.size() && - !_touchPoints.empty()) - { - bool newInput = true; - // go through list and check if the last registrered time is newer than the one in - // lastProcessed (last frame) - std::for_each( - _lastTouchInputs.begin(), - _lastTouchInputs.end(), - [this, &newInput](TouchInput& input) { - std::vector::iterator holder = std::find_if( - _touchPoints.begin(), - _touchPoints.end(), - [&input](const TouchInputHolder& inputHolder) { - return inputHolder.holdsInput(input); - } - ); - if (!holder->isMoving()) { - newInput = true; - } - }); - return newInput; - } - else { - return false; - } -} - -void TouchModule::clearInputs() { - for (const TouchInput& input : _deferredRemovals) { - for (TouchInputHolder& inputHolder : _touchPoints) { - if (inputHolder.holdsInput(input)) { - inputHolder = std::move(_touchPoints.back()); - _touchPoints.pop_back(); - break; - } - } - } - _deferredRemovals.clear(); -} - -void TouchModule::addTouchInput(TouchInput input) { - _touchPoints.emplace_back(input); -} - -void TouchModule::updateOrAddTouchInput(TouchInput input) { - for (TouchInputHolder& inputHolder : _touchPoints) { - if (inputHolder.holdsInput(input)){ - inputHolder.tryAddInput(input); - return; - } - } - _touchPoints.emplace_back(input); -} - -void TouchModule::removeTouchInput(TouchInput input) { - _deferredRemovals.emplace_back(input); - //Check for "tap" gesture: - for (TouchInputHolder& inputHolder : _touchPoints) { - if (inputHolder.holdsInput(input)) { - inputHolder.tryAddInput(input); - const double totalTime = inputHolder.gestureTime(); - const float totalDistance = inputHolder.gestureDistance(); - //Magic values taken from tuioear.cpp: - const bool isWithinTapTime = totalTime < 0.18; - const bool wasStationary = totalDistance < 0.0004f; - if (isWithinTapTime && wasStationary && _touchPoints.size() == 1 && - _deferredRemovals.size() == 1) - { - _tap = true; - } - return; - } - } -} - TouchModule::TouchModule() : OpenSpaceModule("Touch") , _touchActive(TouchActiveInfo, true) @@ -253,4 +133,124 @@ void TouchModule::internalInitialize(const ghoul::Dictionary& /*dictionary*/){ }); } +bool TouchModule::processNewInput() { + // Get new input from listener + std::vector earInputs = _ear->takeInput(); + std::vector earRemovals = _ear->takeRemovals(); + + for (const TouchInput& input : earInputs) { + updateOrAddTouchInput(input); + } + for (const TouchInput& removal : earRemovals) { + removeTouchInput(removal); + } + + // Set touch property to active (to void mouse input, mainly for mtdev bridges) + _touch.touchActive(!_touchPoints.empty()); + + if (!_touchPoints.empty()) { + global::interactionMonitor->markInteraction(); + } + + // Erase old input id's that no longer exists + _lastTouchInputs.erase( + std::remove_if( + _lastTouchInputs.begin(), + _lastTouchInputs.end(), + [this](const TouchInput& input) { + return !std::any_of( + _touchPoints.cbegin(), + _touchPoints.cend(), + [&input](const TouchInputHolder& holder) { + return holder.holdsInput(input); + } + ); + } + ), + _lastTouchInputs.end() + ); + + if (_tap) { + _touch.tap(); + _tap = false; + return true; + } + + // Return true if we got new input + if (_touchPoints.size() == _lastTouchInputs.size() && + !_touchPoints.empty()) + { + bool newInput = true; + // go through list and check if the last registrered time is newer than the one in + // lastProcessed (last frame) + std::for_each( + _lastTouchInputs.begin(), + _lastTouchInputs.end(), + [this, &newInput](TouchInput& input) { + std::vector::iterator holder = std::find_if( + _touchPoints.begin(), + _touchPoints.end(), + [&input](const TouchInputHolder& inputHolder) { + return inputHolder.holdsInput(input); + } + ); + if (!holder->isMoving()) { + newInput = true; + } + }); + return newInput; + } + else { + return false; + } +} + +void TouchModule::clearInputs() { + for (const TouchInput& input : _deferredRemovals) { + for (TouchInputHolder& inputHolder : _touchPoints) { + if (inputHolder.holdsInput(input)) { + inputHolder = std::move(_touchPoints.back()); + _touchPoints.pop_back(); + break; + } + } + } + _deferredRemovals.clear(); +} + +void TouchModule::addTouchInput(TouchInput input) { + _touchPoints.emplace_back(input); +} + +void TouchModule::updateOrAddTouchInput(TouchInput input) { + for (TouchInputHolder& inputHolder : _touchPoints) { + if (inputHolder.holdsInput(input)) { + inputHolder.tryAddInput(input); + return; + } + } + _touchPoints.emplace_back(input); +} + +void TouchModule::removeTouchInput(TouchInput input) { + _deferredRemovals.emplace_back(input); + // Check for "tap" gesture: + for (TouchInputHolder& inputHolder : _touchPoints) { + if (inputHolder.holdsInput(input)) { + inputHolder.tryAddInput(input); + const double totalTime = inputHolder.gestureTime(); + const float totalDistance = inputHolder.gestureDistance(); + // Magic values taken from tuioear.cpp: + const bool isWithinTapTime = totalTime < 0.18; + const bool wasStationary = totalDistance < 0.0004f; + if (isWithinTapTime && wasStationary && _touchPoints.size() == 1 && + _deferredRemovals.size() == 1) + { + _tap = true; + } + return; + } + } +} + } // namespace openspace diff --git a/modules/touch/touchmodule.h b/modules/touch/touchmodule.h index 740e60532c..d217cd4972 100644 --- a/modules/touch/touchmodule.h +++ b/modules/touch/touchmodule.h @@ -33,7 +33,7 @@ namespace openspace { - class TuioEar; +class TuioEar; #ifdef WIN32 class Win32TouchHook; diff --git a/modules/vislab/rendering/renderabledistancelabel.cpp b/modules/vislab/rendering/renderabledistancelabel.cpp index edd60ce4cd..071039b17d 100644 --- a/modules/vislab/rendering/renderabledistancelabel.cpp +++ b/modules/vislab/rendering/renderabledistancelabel.cpp @@ -47,7 +47,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo DistanceUnitInfo = { "DistanceUnit", "Distance Unit", - "Property to define the unit in which the distance should be displayed" + "Property to define the unit in which the distance should be displayed. " "Defaults to 'km' if not specified" }; diff --git a/modules/volume/transferfunctionhandler.cpp b/modules/volume/transferfunctionhandler.cpp index 0a1f7f981d..0e39e9de22 100644 --- a/modules/volume/transferfunctionhandler.cpp +++ b/modules/volume/transferfunctionhandler.cpp @@ -58,7 +58,7 @@ namespace { "Save Transfer Function", "Save your transfer function" }; -} +} // namespace namespace openspace::volume { diff --git a/modules/webbrowser/src/eventhandler.cpp b/modules/webbrowser/src/eventhandler.cpp index 0c4e4312dc..5d81cb3295 100644 --- a/modules/webbrowser/src/eventhandler.cpp +++ b/modules/webbrowser/src/eventhandler.cpp @@ -230,11 +230,11 @@ void EventHandler::initialize() { BrowserInstance::SingleClick ); #endif - _validTouchStates.emplace_back(input); - } - else { - _validTouchStates.emplace_back(input); } + + _validTouchStates.emplace_back(input); + + global::interactionMonitor->markInteraction(); return true; } ); @@ -269,6 +269,7 @@ void EventHandler::initialize() { _leftButton.down = true; _browserInstance->sendMouseMoveEvent(mouseEvent()); #endif // WIN32 + global::interactionMonitor->markInteraction(); return true; } else if (it != _validTouchStates.cend()) { diff --git a/modules/webgui/webguimodule.cpp b/modules/webgui/webguimodule.cpp index 9469c18f15..737a0dd8ae 100644 --- a/modules/webgui/webguimodule.cpp +++ b/modules/webgui/webguimodule.cpp @@ -98,10 +98,10 @@ namespace { struct [[codegen::Dictionary(WebGuiModule)]] Parameters { // [[codegen::verbatim(PortInfo.description)]] - std::optional port; + std::optional port [[codegen::key("HttpPort")]]; // [[codegen::verbatim(AddressInfo.description)]] - std::optional address; + std::string address; // [[codegen::verbatim(WebSocketInterfaceInfo.description)]] std::optional webSocketInterface; @@ -163,12 +163,7 @@ void WebGuiModule::internalInitialize(const ghoul::Dictionary& configuration) { const Parameters p = codegen::bake(configuration); _port = p.port.value_or(_port); - if (p.address.has_value()) { - _address = p.address.value(); - } - else { - _address = "192.168.1.8"; //global::windowDelegate - } + _address = p.address; _webSocketInterface = p.webSocketInterface.value_or(_webSocketInterface); auto startOrStop = [this]() { diff --git a/src/documentation/verifier.cpp b/src/documentation/verifier.cpp index dea3219304..dc52dcfbac 100644 --- a/src/documentation/verifier.cpp +++ b/src/documentation/verifier.cpp @@ -231,6 +231,8 @@ std::string StringVerifier::type() const { return "String"; } +FileVerifier::FileVerifier() : StringVerifier(true) {} + TestResult FileVerifier::operator()(const ghoul::Dictionary& dict, const std::string& key) const { @@ -255,6 +257,8 @@ std::string FileVerifier::type() const { return "File"; } +DirectoryVerifier::DirectoryVerifier() : StringVerifier(true) {} + TestResult DirectoryVerifier::operator()(const ghoul::Dictionary& dict, const std::string& key) const { @@ -279,6 +283,8 @@ std::string DirectoryVerifier::type() const { return "Directory"; } +DateTimeVerifier::DateTimeVerifier() : StringVerifier(true) {} + TestResult DateTimeVerifier::operator()(const ghoul::Dictionary& dict, const std::string& key) const { @@ -303,26 +309,6 @@ TestResult DateTimeVerifier::operator()(const ghoul::Dictionary& dict, off.explanation = "Not a valid format, should be: YYYY MM DD hh:mm:ss"; res.offenses.push_back(off); } - // then check if valid date - else { - // normalize e.g. 29/02/2013 would become 01/03/2013 - std::tm t_copy(t); - time_t when = mktime(&t_copy); - std::tm* norm = localtime(&when); - - // validate (is the normalized date still the same?): - if (norm->tm_mday != t.tm_mday && - norm->tm_mon != t.tm_mon && - norm->tm_year != t.tm_year) - { - res.success = false; - TestResult::Offense off; - off.offender = key; - off.reason = TestResult::Offense::Reason::Verification; - off.explanation = "Not a valid date"; - res.offenses.push_back(off); - } - } return res; } @@ -432,10 +418,10 @@ TestResult TemplateVerifier::operator()(const ghoul::Dictionary& dic if (dict.hasValue(key)) { glm::dvec2 value = dict.value(key); glm::dvec2 intPart; - glm::bvec2 isInt = { + glm::bvec2 isInt = glm::bvec2( modf(value.x, &intPart.x) == 0.0, modf(value.y, &intPart.y) == 0.0 - }; + ); if (isInt.x && isInt.y) { TestResult res; res.success = true; @@ -487,11 +473,11 @@ TestResult TemplateVerifier::operator()(const ghoul::Dictionary& dic if (dict.hasValue(key)) { glm::dvec3 value = dict.value(key); glm::dvec3 intPart; - glm::bvec3 isInt = { + glm::bvec3 isInt = glm::bvec3( modf(value.x, &intPart.x) == 0.0, modf(value.y, &intPart.y) == 0.0, modf(value.z, &intPart.z) == 0.0 - }; + ); if (isInt.x && isInt.y && isInt.z) { TestResult res; res.success = true; @@ -543,12 +529,12 @@ TestResult TemplateVerifier::operator()(const ghoul::Dictionary& dic if (dict.hasValue(key)) { glm::dvec4 value = dict.value(key); glm::dvec4 intPart; - glm::bvec4 isInt = { + glm::bvec4 isInt = glm::bvec4( modf(value.x, &intPart.x) == 0.0, modf(value.y, &intPart.y) == 0.0, modf(value.z, &intPart.z) == 0.0, modf(value.w, &intPart.w) == 0.0 - }; + ); if (isInt.x && isInt.y && isInt.z && isInt.w) { TestResult res; res.success = true; diff --git a/src/engine/downloadmanager.cpp b/src/engine/downloadmanager.cpp index d3f0f0ab00..7c05e3cb07 100644 --- a/src/engine/downloadmanager.cpp +++ b/src/engine/downloadmanager.cpp @@ -172,9 +172,9 @@ std::shared_ptr DownloadManager::downloadFile( } ProgressInformation p = { - future, - std::chrono::system_clock::now(), - &progressCb + .future = future, + .startTime = std::chrono::system_clock::now(), + .callback = &progressCb }; #if LIBCURL_VERSION_NUM >= 0x072000 // xferinfo was introduced in 7.32.0, if a lower curl version is used the diff --git a/src/engine/moduleengine.cpp b/src/engine/moduleengine.cpp index e52cd63a7b..7e559ec041 100644 --- a/src/engine/moduleengine.cpp +++ b/src/engine/moduleengine.cpp @@ -171,7 +171,7 @@ std::vector ModuleEngine::modules() const { } ghoul::systemcapabilities::Version ModuleEngine::requiredOpenGLVersion() const { - ghoul::systemcapabilities::Version version = { 0, 0, 0 }; + ghoul::systemcapabilities::Version version = { .major = 0, .minor = 0, .release = 0 }; for (const std::unique_ptr& m : _modules) { version = std::max(version, m->requiredOpenGLVersion()); diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 1611ca1f6b..e8a3eee090 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -486,7 +486,11 @@ void OpenSpaceEngine::initializeGL() { bool debugActive = global::configuration->openGLDebugContext.isActive; // Debug output is not available before 4.3 - const ghoul::systemcapabilities::Version minVersion = { 4, 3, 0 }; + const ghoul::systemcapabilities::Version minVersion = { + .major = 4, + .minor = 3, + .release = 0 + }; if (debugActive && OpenGLCap.openGLVersion() < minVersion) { LINFO("OpenGL Debug context requested, but insufficient version available"); debugActive = false; @@ -685,20 +689,6 @@ void OpenSpaceEngine::loadAssets() { global::windowDelegate->setBarrier(true); }; - if (_scene) { - ZoneScopedN("Reset scene") - - global::syncEngine->removeSyncables(global::timeManager->syncables()); - if (_scene && _scene->camera()) { - global::syncEngine->removeSyncables(_scene->camera()->syncables()); - } - global::renderEngine->setScene(nullptr); - global::renderEngine->setCamera(nullptr); - global::navigationHandler->setCamera(nullptr); - _scene->clear(); - global::rootPropertyOwner->removePropertySubOwner(_scene.get()); - } - std::unique_ptr sceneInitializer; if (global::configuration->useMultithreadedInitialization) { unsigned int nAvailableThreads = std::min( @@ -1372,6 +1362,18 @@ void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction actio return; } + // We need to do this check before the callback functions as we would otherwise + // immediately cancel a shutdown if someone pressed the ESC key. Similar argument for + // only checking for the Press action. Since the 'Press' of ESC will trigger the + // shutdown, the 'Release' in some frame later would cancel it immediately again + if (action == KeyAction::Press && _shutdown.inShutdown) { + _shutdown.inShutdown = false; + global::eventEngine->publishEvent( + events::EventApplicationShutdown::State::Aborted + ); + return; + } + using F = global::callback::KeyboardCallback; for (const F& func : *global::callback::keyboard) { const bool isConsumed = func(key, mod, action, isGuiWindow); @@ -1411,6 +1413,13 @@ void OpenSpaceEngine::charCallback(unsigned int codepoint, KeyModifier modifier, global::luaConsole->charCallback(codepoint, modifier); global::interactionMonitor->markInteraction(); + + if (_shutdown.inShutdown) { + _shutdown.inShutdown = false; + global::eventEngine->publishEvent( + events::EventApplicationShutdown::State::Aborted + ); + } } void OpenSpaceEngine::mouseButtonCallback(MouseButton button, MouseAction action, @@ -1451,6 +1460,13 @@ void OpenSpaceEngine::mouseButtonCallback(MouseButton button, MouseAction action global::navigationHandler->mouseButtonCallback(button, action); global::interactionMonitor->markInteraction(); + + if (_shutdown.inShutdown) { + _shutdown.inShutdown = false; + global::eventEngine->publishEvent( + events::EventApplicationShutdown::State::Aborted + ); + } } void OpenSpaceEngine::mousePositionCallback(double x, double y, IsGuiWindow isGuiWindow) { diff --git a/src/interaction/actionmanager_lua.inl b/src/interaction/actionmanager_lua.inl index adbf195cc6..4a10d51ae9 100644 --- a/src/interaction/actionmanager_lua.inl +++ b/src/interaction/actionmanager_lua.inl @@ -22,6 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include + namespace { // Checks if the passed identifier corresponds to an action. @@ -69,6 +71,27 @@ namespace { global::actionManager->removeAction(identifier); } +struct [[codegen::Dictionary(Action)]] Action { + // The identifier under which the action is registered + std::string identifier; + + // The Lua script that is to be executed when the action is triggered + std::string command; + + // The user-facing name of the action + std::optional name; + + // A documentation that explains what the action does + std::optional documentation; + + // The path in the GUI under which the action is shown to the user. If the value is + // not provided, the default value is / + std::optional guiPath; + + // Determines whether the provided command will be executed locally or will be sent to + // connected computers in a cluster or parallel connection environment + std::optional isLocal; +}; /** * Registers a new action. The first argument is the identifier which cannot have been * used to register a previous action before, the second argument is the Lua command that @@ -78,47 +101,26 @@ namespace { * whether the action should be executed locally (= false) or remotely (= true, the * default). */ -[[codegen::luawrap]] void registerAction(ghoul::Dictionary action) { +[[codegen::luawrap]] void registerAction(Action action) { using namespace openspace; - if (!action.hasValue("Identifier")) { - throw ghoul::lua::LuaError("Identifier must to provided to register action"); - } - std::string identifier = action.value("Identifier"); - if (global::actionManager->hasAction(identifier)) { - throw ghoul::lua::LuaError( - fmt::format("Action for identifier '{}' already existed", identifier) - ); - } - if (global::actionManager->hasAction(identifier)) { - throw ghoul::lua::LuaError( - fmt::format("Identifier '{}' for action already registered", identifier) - ); - } - - if (!action.hasValue("Command")) { - throw ghoul::lua::LuaError( - fmt::format( - "Identifier '{}' does not provide a Lua command to execute", identifier - ) - ); + if (global::actionManager->hasAction(action.identifier)) { + throw ghoul::lua::LuaError(fmt::format( + "Identifier '{}' for action already registered", action.identifier + )); } interaction::Action a; - a.identifier = std::move(identifier); - a.command = action.value("Command"); - if (action.hasValue("Name")) { - a.name = action.value("Name"); + a.identifier = std::move(action.identifier); + a.command = std::move(action.command); + a.name = action.name.value_or(a.name); + a.documentation = action.documentation.value_or(a.documentation); + a.guiPath = action.guiPath.value_or(a.guiPath); + if (!a.guiPath.starts_with('/')) { + throw ghoul::RuntimeError("Action's GuiPath must start with /"); } - if (action.hasValue("Documentation")) { - a.documentation = action.value("Documentation"); - } - if (action.hasValue("GuiPath")) { - a.guiPath = action.value("GuiPath"); - } - if (action.hasValue("IsLocal")) { - bool value = action.value("IsLocal"); - a.synchronization = interaction::Action::IsSynchronized(value); + if (action.isLocal.has_value()) { + a.synchronization = interaction::Action::IsSynchronized(*action.isLocal); } global::actionManager->registerAction(std::move(a)); } diff --git a/src/interaction/joystickcamerastates.cpp b/src/interaction/joystickcamerastates.cpp index 98f6b424b9..8970fe73f3 100644 --- a/src/interaction/joystickcamerastates.cpp +++ b/src/interaction/joystickcamerastates.cpp @@ -54,11 +54,11 @@ void JoystickCameraStates::updateStateFromInput( return; } - std::pair globalRotation = { false, glm::dvec2(0.0) }; - std::pair zoom = { false, 0.0 }; - std::pair localRoll = { false, glm::dvec2(0.0) }; - std::pair globalRoll = { false, glm::dvec2(0.0) }; - std::pair localRotation = { false, glm::dvec2(0.0) }; + std::pair globalRotation = std::pair(false, glm::dvec2(0.0)); + std::pair zoom = std::pair(false, 0.0); + std::pair localRoll = std::pair(false, glm::dvec2(0.0)); + std::pair globalRoll = std::pair(false, glm::dvec2(0.0)); + std::pair localRotation = std::pair(false, glm::dvec2(0.0)); for (const JoystickInputState& joystickInputState : joystickInputStates) { if (joystickInputState.name.empty()) { diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index c38db60768..f43eca5b69 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -66,8 +66,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo RenderPlaybackInfo = { "RenderInfo", "Render Playback Information", - "If enabled, information about a currently played back session " - "recording is rendering to screen" + "If enabled, information about a currently played back session recording is " + "rendering to screen" }; constexpr openspace::properties::Property::PropertyInfo IgnoreRecordedScaleInfo = { @@ -231,9 +231,9 @@ bool SessionRecording::startRecording(const std::string& filename) { // Record the current delta time as the first property to save in the file. // This needs to be saved as a baseline whether or not it changes during recording _timestamps3RecordStarted = { - _timestampRecordStarted, - 0.0, - global::timeManager->time().j2000Seconds() + .timeOs = _timestampRecordStarted, + .timeRec = 0.0, + .timeSim = global::timeManager->time().j2000Seconds() }; recordCurrentTimePauseState(); diff --git a/src/interaction/websocketcamerastates.cpp b/src/interaction/websocketcamerastates.cpp index b1afae9c10..5315b104da 100644 --- a/src/interaction/websocketcamerastates.cpp +++ b/src/interaction/websocketcamerastates.cpp @@ -42,11 +42,11 @@ void WebsocketCameraStates::updateStateFromInput( const WebsocketInputStates& websocketInputStates, double deltaTime) { - std::pair globalRotation = { false, glm::dvec2(0.0) }; - std::pair zoom = { false, 0.0 }; - std::pair localRoll = { false, glm::dvec2(0.0) }; - std::pair globalRoll = { false, glm::dvec2(0.0) }; - std::pair localRotation = { false, glm::dvec2(0.0) }; + std::pair globalRotation = std::pair(false, glm::dvec2(0.0)); + std::pair zoom = std::pair(false, 0.0); + std::pair localRoll = std::pair(false, glm::dvec2(0.0)); + std::pair globalRoll = std::pair(false, glm::dvec2(0.0)); + std::pair localRotation = std::pair(false, glm::dvec2(0.0)); if (!websocketInputStates.empty()) { for (int i = 0; i < WebsocketInputState::MaxAxes; ++i) { diff --git a/src/navigation/navigationhandler.cpp b/src/navigation/navigationhandler.cpp index 62ee264656..d99b34f0c3 100644 --- a/src/navigation/navigationhandler.cpp +++ b/src/navigation/navigationhandler.cpp @@ -380,6 +380,14 @@ bool NavigationHandler::disabledKeybindings() const { return _disableKeybindings; } +bool NavigationHandler::disabledMouse() const { + return _disableMouseInputs; +} + +bool NavigationHandler::disabledJoystick() const { + return _disableJoystickInputs; +} + NavigationState NavigationHandler::navigationState() const { const SceneGraphNode* referenceFrame = _orbitalNavigator.followingAnchorRotation() ? _orbitalNavigator.anchorNode() : @@ -631,7 +639,10 @@ scripting::LuaLibrary NavigationHandler::luaLibrary() { codegen::lua::TriggerIdleBehavior, codegen::lua::ListAllJoysticks, codegen::lua::TargetNextInterestingAnchor, - codegen::lua::TargetPreviousInterestingAnchor + codegen::lua::TargetPreviousInterestingAnchor, + codegen::lua::DistanceToFocus, + codegen::lua::DistanceToFocusBoundingSphere, + codegen::lua::DistanceToFocusInteractionSphere } }; } diff --git a/src/navigation/navigationhandler_lua.inl b/src/navigation/navigationhandler_lua.inl index d0ecac7b54..e9fa215803 100644 --- a/src/navigation/navigationhandler_lua.inl +++ b/src/navigation/navigationhandler_lua.inl @@ -70,17 +70,6 @@ namespace { [[codegen::luawrap]] void setNavigationState(ghoul::Dictionary navigationState) { using namespace openspace; - documentation::TestResult r = documentation::testSpecification( - interaction::NavigationState::Documentation(), - navigationState - ); - - if (!r.success) { - throw ghoul::lua::LuaError( - fmt::format("Could not set camera state: {}", ghoul::to_string(r)) - ); - } - global::navigationHandler->setNavigationStateNextFrame( interaction::NavigationState(navigationState) ); @@ -406,6 +395,46 @@ joystickAxis(std::string joystickName, int axis) return global::navigationHandler->listAllJoysticks(); } +/** + * Returns the distance in meters to the current focus node + */ +[[codegen::luawrap]] double distanceToFocus() { + using namespace openspace; + + const SceneGraphNode * focus = global::navigationHandler->anchorNode(); + Camera * camera = global::navigationHandler->camera(); + + return glm::distance(camera->positionVec3(), focus->worldPosition()); +} + +/** + * Returns the distance in meters to the current focus node's bounding sphere + */ +[[codegen::luawrap]] double distanceToFocusBoundingSphere() { + using namespace openspace; + + const SceneGraphNode* focus = global::navigationHandler->anchorNode(); + Camera* camera = global::navigationHandler->camera(); + + double distance = glm::distance(camera->positionVec3(), focus->worldPosition()); + + return distance - focus->boundingSphere(); +} + +/** + * Returns the distance in meters to the current focus node's interaction sphere + */ +[[codegen::luawrap]] double distanceToFocusInteractionSphere() { + using namespace openspace; + + const SceneGraphNode* focus = global::navigationHandler->anchorNode(); + Camera* camera = global::navigationHandler->camera(); + + double distance = glm::distance(camera->positionVec3(), focus->worldPosition()); + + return distance - focus->interactionSphere(); +} + #include "navigationhandler_lua_codegen.cpp" } // namespace diff --git a/src/navigation/orbitalnavigator.cpp b/src/navigation/orbitalnavigator.cpp index 4ebbd0bed0..276f02c0a4 100644 --- a/src/navigation/orbitalnavigator.cpp +++ b/src/navigation/orbitalnavigator.cpp @@ -50,16 +50,15 @@ namespace { "Anchor", "Anchor", "The name of the scene graph node that is the origin of the camera interaction. " - "The camera follows, orbits and dollies towards this node. " - "Any scene graph node can be the anchor node" + "The camera follows, orbits and dollies towards this node. Any scene graph node " + "can be the anchor node" }; constexpr openspace::properties::Property::PropertyInfo AimInfo = { "Aim", "Aim", - "The name of the scene graph node that is the aim of the camera. " - "The camera direction is relative to the vector from the camera position " - "to this node" + "The name of the scene graph node that is the aim of the camera. The camera " + "direction is relative to the vector from the camera position to this node" }; constexpr openspace::properties::Property::PropertyInfo RetargetAnchorInfo = { @@ -158,8 +157,8 @@ namespace { { "StereoInterpolationTime", "Stereo Interpolation Time", - "The time to interpolate to a new stereoscopic depth " - "when the anchor node is changed, in seconds" + "The time to interpolate to a new stereoscopic depth when the anchor node is " + "changed, in seconds" }; constexpr openspace::properties::Property::PropertyInfo @@ -167,8 +166,8 @@ namespace { { "RetargetAnchorInterpolationTime", "Retarget Interpolation Time", - "The time to interpolate the camera rotation " - "when the anchor or aim node is changed, in seconds" + "The time to interpolate the camera rotation when the anchor or aim node is " + "changed, in seconds" }; constexpr openspace::properties::Property::PropertyInfo FollowRotationInterpTimeInfo = @@ -201,8 +200,8 @@ namespace { { "StaticViewScaleExponent", "Static View Scale Exponent", - "Statically scale the world by 10^StaticViewScaleExponent. " - "Only used if UseAdaptiveStereoscopicDepthInfo is set to false" + "Statically scale the world by 10^StaticViewScaleExponent. Only used if " + "UseAdaptiveStereoscopicDepthInfo is set to false" }; constexpr openspace::properties::Property::PropertyInfo @@ -210,9 +209,9 @@ namespace { { "StereoscopicDepthOfFocusSurface", "Stereoscopic Depth of the Surface in Focus", - "Set the stereoscopically perceived distance (in meters) to the closest " - "point out of the surface of the anchor and the center of the aim node. " - "Only used if UseAdaptiveStereoscopicDepthInfo is set to true" + "Set the stereoscopically perceived distance (in meters) to the closest point " + "out of the surface of the anchor and the center of the aim node. Only used if " + "UseAdaptiveStereoscopicDepthInfo is set to true" }; constexpr openspace::properties::Property::PropertyInfo ApplyIdleBehaviorInfo = { @@ -234,8 +233,8 @@ namespace { { "ShouldTriggerWhenIdle", "Should Trigger When Idle", - "If true, the chosen idle behavior will trigger automatically after " - "a certain time (see 'IdleWaitTime' property)" + "If true, the chosen idle behavior will trigger automatically after a certain " + "time (see 'IdleWaitTime' property)" }; constexpr openspace::properties::Property::PropertyInfo IdleWaitTimeInfo = { @@ -590,8 +589,8 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) { glm::dvec3(0.0); CameraPose pose = { - _camera->positionVec3() + anchorDisplacement, - _camera->rotationQuaternion() + .position = _camera->positionVec3() + anchorDisplacement, + .rotation = _camera->rotationQuaternion() }; const bool hasPreviousPositions = @@ -603,10 +602,10 @@ void OrbitalNavigator::updateCameraStateFromStates(double deltaTime) { const glm::dvec3 cameraToAnchor = *_previousAnchorNodePosition - prevCameraPosition; - Displacement anchorToAim = { + Displacement anchorToAim = Displacement( *_previousAimNodePosition - *_previousAnchorNodePosition, aimPos - anchorPos - }; + ); anchorToAim = interpolateRetargetAim( deltaTime, diff --git a/src/navigation/pathnavigator_lua.inl b/src/navigation/pathnavigator_lua.inl index eb618126e2..e58816f612 100644 --- a/src/navigation/pathnavigator_lua.inl +++ b/src/navigation/pathnavigator_lua.inl @@ -27,8 +27,7 @@ namespace { // Returns true if a camera path is currently running, and false otherwise. [[codegen::luawrap]] bool isFlying() { using namespace openspace; - bool hasFinished = global::navigationHandler->pathNavigator().hasFinished(); - return !hasFinished; + return global::openSpaceEngine->currentMode() == OpenSpaceEngine::Mode::CameraPath; } // Continue playing a paused camera path. diff --git a/src/navigation/waypoint.cpp b/src/navigation/waypoint.cpp index 73b6a27570..2a4c81235a 100644 --- a/src/navigation/waypoint.cpp +++ b/src/navigation/waypoint.cpp @@ -42,7 +42,7 @@ namespace openspace::interaction { Waypoint::Waypoint(const glm::dvec3& pos, const glm::dquat& rot, const std::string& ref) : _nodeIdentifier(ref) { - _pose = { pos, rot }; + _pose = { .position = pos, .rotation = rot }; const SceneGraphNode* node = sceneGraphNode(_nodeIdentifier); if (!node) { diff --git a/src/properties/optionproperty.cpp b/src/properties/optionproperty.cpp index 49dc6d39c1..ba0a38e95b 100644 --- a/src/properties/optionproperty.cpp +++ b/src/properties/optionproperty.cpp @@ -59,7 +59,7 @@ const std::vector& OptionProperty::options() const { } void OptionProperty::addOption(int value, std::string desc) { - Option option = { std::move(value), std::move(desc) }; + Option option = { .value = std::move(value), .description = std::move(desc) }; for (const Option& o : _options) { if (o.value == option.value) { diff --git a/src/properties/propertyowner.cpp b/src/properties/propertyowner.cpp index 04c828ad7e..3b4e780f42 100644 --- a/src/properties/propertyowner.cpp +++ b/src/properties/propertyowner.cpp @@ -377,15 +377,9 @@ void PropertyOwner::removePropertySubOwner(openspace::properties::PropertyOwner& } void PropertyOwner::setIdentifier(std::string identifier) { - ghoul_precondition( - _identifier.find_first_of("\t\n ") == std::string::npos, - "Identifier must not contain any whitespaces" - ); - ghoul_precondition( - _identifier.find_first_of('.') == std::string::npos, - "Identifier must not contain any dots" - ); - + if (identifier.find_first_of(". \t\n") != std::string::npos) { + throw ghoul::RuntimeError("Identifier must not contain any dots or whitespaces"); + } _identifier = std::move(identifier); } diff --git a/src/rendering/dashboarditem.cpp b/src/rendering/dashboarditem.cpp index ad9f2aee07..801e045516 100644 --- a/src/rendering/dashboarditem.cpp +++ b/src/rendering/dashboarditem.cpp @@ -40,25 +40,11 @@ namespace { "If this value is set to 'true' this dashboard item is shown in the dashboard" }; - constexpr openspace::properties::Property::PropertyInfo IdentifierInfo = { - "Identifier", - "Identifier", - "" - }; - - constexpr openspace::properties::Property::PropertyInfo GuiNameInfo = { - "GuiName", - "Gui Name", - "" - }; - struct [[codegen::Dictionary(DashboardItem)]] Parameters { std::string type; - // [[codegen::verbatim(IdentifierInfo.description)]] std::string identifier; - // [[codegen::verbatim(GuiNameInfo.description)]] std::optional guiName; }; #include "dashboarditem_codegen.cpp" diff --git a/src/rendering/framebufferrenderer.cpp b/src/rendering/framebufferrenderer.cpp index c4abee51fc..aec9577c4e 100644 --- a/src/rendering/framebufferrenderer.cpp +++ b/src/rendering/framebufferrenderer.cpp @@ -51,7 +51,7 @@ namespace { constexpr std::string_view _loggerCat = "FramebufferRenderer"; - constexpr glm::vec4 PosBufferClearVal = { 1e32, 1e32, 1e32, 1.f }; + constexpr glm::vec4 PosBufferClearVal = glm::vec4(1e32, 1e32, 1e32, 1.f); constexpr std::array HDRUniformNames = { "hdrFeedingTexture", "blackoutFactor", "hdrExposure", "gamma", @@ -964,7 +964,7 @@ void FramebufferRenderer::updateRaycastData() { for (VolumeRaycaster* raycaster : raycasters) { ZoneScopedN("raycaster") - RaycastData data = { nextId++, "Helper" }; + RaycastData data = { .id = nextId++, .namespaceName = "Helper" }; const std::string& vsPath = raycaster->boundsVertexShaderPath(); std::string fsPath = raycaster->boundsFragmentShaderPath(); @@ -1033,7 +1033,7 @@ void FramebufferRenderer::updateDeferredcastData() { global::deferredcasterManager->deferredcasters(); int nextId = 0; for (Deferredcaster* caster : deferredcasters) { - DeferredcastData data = { nextId++, "HELPER" }; + DeferredcastData data = { .id = nextId++, .namespaceName = "HELPER" }; std::filesystem::path vsPath = caster->deferredcastVSPath(); std::filesystem::path fsPath = caster->deferredcastFSPath(); @@ -1133,10 +1133,9 @@ void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFac Time time = global::timeManager->time(); RenderData data = { - *camera, - std::move(time), - 0, - {} + .camera = *camera, + .time = std::move(time), + .renderBinMask = 0 }; RendererTasks tasks; diff --git a/src/rendering/loadingscreen.cpp b/src/rendering/loadingscreen.cpp index 32af36dcdc..3b081b05da 100644 --- a/src/rendering/loadingscreen.cpp +++ b/src/rendering/loadingscreen.cpp @@ -174,10 +174,10 @@ void LoadingScreen::render() { ghoul::fontrendering::FontRenderer::defaultRenderer().setFramebufferSize(res); - const glm::vec2 size = { + const glm::vec2 size = glm::vec2( LogoSize.x, LogoSize.y * textureAspectRatio * screenAspectRatio - }; + ); // // Clear background @@ -204,10 +204,10 @@ void LoadingScreen::render() { // // Render progress bar // - const glm::vec2 progressbarSize = { + const glm::vec2 progressbarSize = glm::vec2( ProgressbarSize.x, ProgressbarSize.y * screenAspectRatio - }; + ); if (_showProgressbar) { const float progress = _nItems != 0 ? @@ -300,17 +300,17 @@ void LoadingScreen::render() { std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); - const glm::vec2 logoLl = { LogoCenter.x - size.x, LogoCenter.y - size.y }; - const glm::vec2 logoUr = { LogoCenter.x + size.x, LogoCenter.y + size.y }; + const glm::vec2 logoLl = glm::vec2(LogoCenter.x - size.x, LogoCenter.y - size.y); + const glm::vec2 logoUr = glm::vec2(LogoCenter.x + size.x, LogoCenter.y + size.y); - const glm::vec2 progressbarLl = { + const glm::vec2 progressbarLl = glm::vec2( ProgressbarCenter.x - progressbarSize.x, ProgressbarCenter.y - progressbarSize.y - }; - const glm::vec2 progressbarUr = { + ); + const glm::vec2 progressbarUr = glm::vec2( ProgressbarCenter.x + progressbarSize.x , ProgressbarCenter.y + progressbarSize.y - }; + ); for (Item& item : _items) { if (!item.hasLocation) { @@ -333,7 +333,7 @@ void LoadingScreen::render() { static_cast(res.y - b.y - 15) ); - ll = { distX(_randomEngine), distY(_randomEngine) }; + ll = glm::vec2(distX(_randomEngine), distY(_randomEngine)); ur = ll + b; // Test against logo and text @@ -553,17 +553,12 @@ void LoadingScreen::updateItem(const std::string& itemIdentifier, // We are not computing the location in here since doing it this way might stall // the main thread while trying to find a position for the new item Item item = { - itemIdentifier, - itemName, - ItemStatus::Started, - std::move(progressInfo), - false, -#ifdef LOADINGSCREEN_DEBUGGING - false, -#endif // LOADINGSCREEN_DEBUGGING - {}, - {}, - std::chrono::system_clock::from_time_t(0) + .identifier = itemIdentifier, + .name = itemName, + .status = ItemStatus::Started, + .progress = std::move(progressInfo), + .hasLocation = false, + .finishedTime = std::chrono::system_clock::from_time_t(0) }; if (newStatus == ItemStatus::Finished) { diff --git a/src/rendering/luaconsole.cpp b/src/rendering/luaconsole.cpp index a326e7c278..307c28dba3 100644 --- a/src/rendering/luaconsole.cpp +++ b/src/rendering/luaconsole.cpp @@ -528,7 +528,11 @@ bool LuaConsole::keyboardCallback(Key key, KeyModifier modifier, KeyAction actio // We only want to remove the autocomplete info if we just // entered the 'default' openspace namespace if (command.substr(0, pos + 1) == "openspace.") { - _autoCompleteInfo = { NoAutoComplete, false, "" }; + _autoCompleteInfo = { + .lastIndex = NoAutoComplete, + .hasInitialValue = false, + .initialValue = "" + }; } } } @@ -542,7 +546,11 @@ bool LuaConsole::keyboardCallback(Key key, KeyModifier modifier, KeyAction actio // If any other key is pressed, we want to remove our previous findings // The special case for Shift is necessary as we want to allow Shift+TAB if (!modifierShift) { - _autoCompleteInfo = { NoAutoComplete, false, "" }; + _autoCompleteInfo = { + .lastIndex = NoAutoComplete, + .hasInitialValue = false, + .initialValue = "" + }; } } diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index dd5d486229..231240b0f1 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -111,7 +111,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ShowCameraInfo = { "ShowCamera", "Shows information about the current camera state, such as friction", - "This value determines whether the information about the current camrea state is " + "This value determines whether the information about the current camera state is " "shown on the screen" }; @@ -174,31 +174,31 @@ namespace { constexpr openspace::properties::Property::PropertyInfo ScreenSpaceRotationInfo = { "ScreenSpaceRotation", "Screen Space Rotation", - "Applies a rotation to all screen space renderables. " - "Defined using pitch, yaw, roll in radians" + "Applies a rotation to all screen space renderables. Defined using pitch, yaw, " + "roll in radians" }; constexpr openspace::properties::Property::PropertyInfo MasterRotationInfo = { "MasterRotation", "Master Rotation", - "Applies a view rotation for only the master node, defined using " - "pitch, yaw, roll in radians. This can be used to compensate the master view " - "direction for tilted display systems in clustered immersive environments" + "Applies a view rotation for only the master node, defined using pitch, yaw, " + "roll in radians.This can be used to compensate the master view direction for " + "tilted display systems in clustered immersive environments" }; constexpr openspace::properties::Property::PropertyInfo DisableHDRPipelineInfo = { "DisableHDRPipeline", "Disable HDR Rendering", - "If this value is enabled, the rendering will disable the HDR color handling " - "and the LDR color pipeline will be used. Be aware of possible over exposure " - "in the final colors" + "If this value is enabled, the rendering will disable the HDR color handling and " + "the LDR color pipeline will be used. Be aware of possible over exposure in the " + "final colors" }; constexpr openspace::properties::Property::PropertyInfo HDRExposureInfo = { "HDRExposure", "HDR Exposure", - "This value determines the amount of light per unit area reaching the " - "equivalent of an electronic image sensor" + "This value determines the amount of light per unit area reaching the equivalent " + "of an electronic image sensor" }; constexpr openspace::properties::Property::PropertyInfo GammaInfo = { @@ -1144,12 +1144,12 @@ void RenderEngine::renderCameraInformation() { using FR = ghoul::fontrendering::FontRenderer; - _cameraButtonLocations.rotation = { + _cameraButtonLocations.rotation = glm::ivec4( fontResolution().x - rotationBox.x - XSeparation, fontResolution().y - penPosY, rotationBox.x, rotationBox.y - }; + ); FR::defaultRenderer().render( *_fontCameraInfo, glm::vec2(fontResolution().x - rotationBox.x - XSeparation, penPosY), @@ -1160,12 +1160,12 @@ void RenderEngine::renderCameraInformation() { const glm::vec2 zoomBox = _fontCameraInfo->boundingBox("Zoom"); - _cameraButtonLocations.zoom = { + _cameraButtonLocations.zoom = glm::ivec4( fontResolution().x - zoomBox.x - XSeparation, fontResolution().y - penPosY, zoomBox.x, zoomBox.y - }; + ); FR::defaultRenderer().render( *_fontCameraInfo, glm::vec2(fontResolution().x - zoomBox.x - XSeparation, penPosY), @@ -1176,12 +1176,12 @@ void RenderEngine::renderCameraInformation() { const glm::vec2 rollBox = _fontCameraInfo->boundingBox("Roll"); - _cameraButtonLocations.roll = { + _cameraButtonLocations.roll = glm::ivec4( fontResolution().x - rollBox.x - XSeparation, fontResolution().y - penPosY, rollBox.x, rollBox.y - }; + ); FR::defaultRenderer().render( *_fontCameraInfo, glm::vec2(fontResolution().x - rollBox.x - XSeparation, penPosY), diff --git a/src/rendering/screenspacerenderable.cpp b/src/rendering/screenspacerenderable.cpp index 323242cc02..d6607c9857 100644 --- a/src/rendering/screenspacerenderable.cpp +++ b/src/rendering/screenspacerenderable.cpp @@ -105,8 +105,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo MultiplyColorInfo = { "MultiplyColor", "Multiply Color", - "If set, the plane's texture is multiplied with this color. " - "Useful for applying a color grayscale images" + "If set, the plane's texture is multiplied with this color. Useful for applying " + "a color grayscale images" }; constexpr openspace::properties::Property::PropertyInfo BackgroundColorInfo = { diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index 5cc0bb8d02..6c3d14caef 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -108,7 +108,18 @@ Scene::Scene(std::unique_ptr initializer) } Scene::~Scene() { - clear(); + LINFO("Clearing current scene graph"); + for (SceneGraphNode* node : _topologicallySortedNodes) { + if (node->identifier() == "Root") { + continue; + } + // There might still be scene graph nodes around that weren't removed by the asset + // manager as they would have been added manually by the user. This also serves as + // a backstop for assets that forgot to implement the onDeinitialize functions + node->deinitializeGL(); + node->deinitialize(); + } + _rootDummy.clearChildren(); _rootDummy.setScene(nullptr); } @@ -309,11 +320,6 @@ void Scene::render(const RenderData& data, RendererTasks& tasks) { } } -void Scene::clear() { - LINFO("Clearing current scene graph"); - _rootDummy.clearChildren(); -} - const std::unordered_map& Scene::nodesByIdentifier() const { return _nodesByIdentifier; } @@ -433,6 +439,7 @@ std::chrono::steady_clock::time_point Scene::currentTimeForInterpolation() { } void Scene::addPropertyInterpolation(properties::Property* prop, float durationSeconds, + std::string postScript, ghoul::EasingFunction easingFunction) { ghoul_precondition(prop != nullptr, "prop must not be nullptr"); @@ -459,6 +466,7 @@ void Scene::addPropertyInterpolation(properties::Property* prop, float durationS if (info.prop == prop) { info.beginTime = now; info.durationSeconds = durationSeconds; + info.postScript = std::move(postScript), info.easingFunction = func; // If we found it, we can break since we make sure that each property is only // represented once in this @@ -467,12 +475,12 @@ void Scene::addPropertyInterpolation(properties::Property* prop, float durationS } PropertyInterpolationInfo i = { - prop, - now, - durationSeconds, - func + .prop = prop, + .beginTime = now, + .durationSeconds = durationSeconds, + .postScript = std::move(postScript), + .easingFunction = func }; - _propertyInterpolationInfos.push_back(std::move(i)); } @@ -507,13 +515,12 @@ void Scene::updateInterpolations() { steady_clock::time_point now = currentTimeForInterpolation(); // First, let's update the properties for (PropertyInterpolationInfo& i : _propertyInterpolationInfos) { - long long usPassed = duration_cast( - now - i.beginTime - ).count(); + long long us = + duration_cast(now - i.beginTime).count(); const float t = glm::clamp( static_cast( - static_cast(usPassed) / + static_cast(us) / static_cast(i.durationSeconds * 1000000) ), 0.f, @@ -531,6 +538,13 @@ void Scene::updateInterpolations() { i.isExpired = (t == 1.f); if (i.isExpired) { + if (!i.postScript.empty()) { + global::scriptEngine->queueScript( + std::move(i.postScript), + scripting::ScriptEngine::RemoteScripting::No + ); + } + global::eventEngine->publishEvent(i.prop); } } @@ -578,7 +592,8 @@ void Scene::setPropertiesFromProfile(const Profile& p) { allProperties(), 0.0, groupName, - ghoul::EasingFunction::Linear + ghoul::EasingFunction::Linear, + "" ); // Clear lua state stack lua_settop(L, 0); @@ -748,13 +763,23 @@ std::vector Scene::propertiesMatchingRegex( return findMatchesInAllProperties(propertyString, allProperties(), ""); } +std::vector Scene::allTags() { + std::set result; + for (SceneGraphNode* node : _topologicallySortedNodes) { + const std::vector& tags = node->tags(); + result.insert(tags.begin(), tags.end()); + } + + return std::vector(result.begin(), result.end()); +} + scripting::LuaLibrary Scene::luaLibrary() { return { "", { { "setPropertyValue", - &luascriptfunctions::propertySetValue, + &luascriptfunctions::propertySetValue, {}, "", "Sets all property(s) identified by the URI (with potential wildcards) " @@ -766,20 +791,16 @@ scripting::LuaLibrary Scene::luaLibrary() { "function if a 'duration' has been specified. If 'duration' is 0, this " "parameter value is ignored. Otherwise, it can be one of many supported " "easing functions. See easing.h for available functions. The fifth " - "argument must be either empty, 'regex', or 'single'. If the fifth" - "argument is empty (the default), the URI is interpreted using a " - "wildcard in which '*' is expanded to '(.*)' and bracketed components " - "'{ }' are interpreted as group tag names. Then, the passed value will " - "be set on all properties that fit the regex + group name combination. " - "If the fifth argument is 'regex' neither the '*' expansion, nor the " - "group tag expansion is performed and the first argument is used as an " - "ECMAScript style regular expression that matches against the fully " - "qualified IDs of properties. If the fifth argument is 'single' no " - "substitutions are performed and exactly 0 or 1 properties are changed" + "argument is another Lua script that will be executed when the " + "interpolation provided in parameter 3 finishes.\n" + "The URI is interpreted using a wildcard in which '*' is expanded to " + "'(.*)' and bracketed components '{ }' are interpreted as group tag " + "names. Then, the passed value will be set on all properties that fit " + "the regex + group name combination." }, { "setPropertyValueSingle", - &luascriptfunctions::propertySetValueSingle, + &luascriptfunctions::propertySetValue, {}, "", "Sets the property identified by the URI in the first argument. The " @@ -791,7 +812,9 @@ scripting::LuaLibrary Scene::luaLibrary() { "specified. If 'duration' is 0, this parameter value is ignored. " "Otherwise, it has to be 'linear', 'easein', 'easeout', or 'easeinout'. " "This is the same as calling the setValue method and passing 'single' as " - "the fourth argument to setPropertyValue" + "the fourth argument to setPropertyValue. The fifth argument is another " + "Lua script that will be executed when the interpolation provided in " + "parameter 3 finishes." }, { "getPropertyValue", diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index e9c90aa96b..0b3701aeb9 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -196,7 +196,8 @@ void applyRegularExpression(lua_State* L, const std::string& regex, const std::vector& properties, double interpolationDuration, const std::string& groupName, - ghoul::EasingFunction easingFunction) + ghoul::EasingFunction easingFunction, + std::string postScript) { using namespace openspace; using ghoul::lua::errorLocation; @@ -244,6 +245,7 @@ void applyRegularExpression(lua_State* L, const std::string& regex, global::renderEngine->scene()->addPropertyInterpolation( prop, static_cast(interpolationDuration), + std::move(postScript), easingFunction ); } @@ -283,7 +285,7 @@ namespace openspace::luascriptfunctions { int setPropertyCallSingle(properties::Property& prop, const std::string& uri, lua_State* L, double duration, - ghoul::EasingFunction easingFunction) + ghoul::EasingFunction easingFunction, std::string postScript) { using ghoul::lua::errorLocation; using ghoul::lua::luaTypeToString; @@ -313,6 +315,7 @@ int setPropertyCallSingle(properties::Property& prop, const std::string& uri, global::renderEngine->scene()->addPropertyInterpolation( &prop, static_cast(duration), + std::move(postScript), easingFunction ); } @@ -320,50 +323,69 @@ int setPropertyCallSingle(properties::Property& prop, const std::string& uri, return 0; } +template int propertySetValue(lua_State* L) { - ghoul::lua::checkArgumentsAndThrow(L, { 2, 5 }, "lua::property_setValue"); + int nParameters = ghoul::lua::checkArgumentsAndThrow( + L, + { 2, 6 }, + "lua::property_setValue" + ); defer { lua_settop(L, 0); }; std::string uriOrRegex = ghoul::lua::value(L, 1, ghoul::lua::PopValue::No); - std::string optimization; double interpolationDuration = 0.0; std::string easingMethodName; ghoul::EasingFunction easingMethod = ghoul::EasingFunction::Linear; + std::string postScript; + + // Extracting the parameters. These are the options that we have: + // 1. + // 2. + // 3. + // 4. + + if (nParameters >= 3) { + // Later functions expect the value to be at the last position on the stack + lua_pushvalue(L, 2); - if (lua_gettop(L) >= 3) { if (ghoul::lua::hasValue(L, 3)) { interpolationDuration = ghoul::lua::value(L, 3, ghoul::lua::PopValue::No); } else { - optimization = ghoul::lua::value(L, 3, ghoul::lua::PopValue::No); + std::string msg = fmt::format( + "Unexpected type {} in argument 3", + ghoul::lua::luaTypeToString(lua_type(L, 3)) + ); + return ghoul::lua::luaError(L, msg); } - - if (lua_gettop(L) >= 4) { - if (ghoul::lua::hasValue(L, 4)) { - interpolationDuration = - ghoul::lua::value(L, 4, ghoul::lua::PopValue::No); - } - else { - easingMethodName = - ghoul::lua::value(L, 4, ghoul::lua::PopValue::No); - } - } - - if (lua_gettop(L) == 5) { - optimization = ghoul::lua::value(L, 5, ghoul::lua::PopValue::No); - } - - // Later functions expect the value to be at the last position on the stack - lua_pushvalue(L, 2); } - - if ((interpolationDuration == 0.0) && !easingMethodName.empty()) { - LWARNINGC( - "property_setValue", - "Easing method specified while interpolation duration is equal to 0" - ); + if (nParameters >= 4) { + if (ghoul::lua::hasValue(L, 4)) { + easingMethodName = + ghoul::lua::value(L, 4, ghoul::lua::PopValue::No); + } + else { + std::string msg = fmt::format( + "Unexpected type {} in argument 4", + ghoul::lua::luaTypeToString(lua_type(L, 4)) + ); + return ghoul::lua::luaError(L, msg); + } + } + if (nParameters == 5) { + if (ghoul::lua::hasValue(L, 5)) { + postScript = + ghoul::lua::value(L, 5, ghoul::lua::PopValue::No); + } + else { + std::string msg = fmt::format( + "Unexpected type {} in argument 5", + ghoul::lua::luaTypeToString(lua_type(L, 5)) + ); + return ghoul::lua::luaError(L, msg); + } } if (!easingMethodName.empty()) { @@ -379,34 +401,7 @@ int propertySetValue(lua_State* L) { } } - if (optimization.empty()) { - std::string groupName; - if (doesUriContainGroupTag(uriOrRegex, groupName)) { - // Remove group name from start of regex and replace with '*' - uriOrRegex = removeGroupNameFromUri(uriOrRegex); - } - - applyRegularExpression( - L, - uriOrRegex, - allProperties(), - interpolationDuration, - groupName, - easingMethod - ); - return 0; - } - else if (optimization == "regex") { - applyRegularExpression( - L, - uriOrRegex, - allProperties(), - interpolationDuration, - "", - easingMethod - ); - } - else if (optimization == "single") { + if (optimization) { properties::Property* prop = property(uriOrRegex); if (!prop) { LERRORC( @@ -423,34 +418,30 @@ int propertySetValue(lua_State* L) { uriOrRegex, L, interpolationDuration, - easingMethod + easingMethod, + std::move(postScript) ); } else { - LERRORC( - "lua::propertySetValue", - fmt::format( - "{}: Unexpected optimization '{}'", - ghoul::lua::errorLocation(L), optimization - ) + std::string groupName; + if (doesUriContainGroupTag(uriOrRegex, groupName)) { + // Remove group name from start of regex and replace with '*' + uriOrRegex = removeGroupNameFromUri(uriOrRegex); + } + + applyRegularExpression( + L, + uriOrRegex, + allProperties(), + interpolationDuration, + groupName, + easingMethod, + std::move(postScript) ); } return 0; } -int propertySetValueSingle(lua_State* L) { - const int n = lua_gettop(L); - if (n == 3) { - // If we pass three arguments, the third one is the interpolation factor and the - // user did not specify an easing factor, so we have to add that manually before - // adding the single optimization - ghoul::lua::push(L, ghoul::nameForEasingFunction(ghoul::EasingFunction::Linear)); - } - - ghoul::lua::push(L, "single"); - return propertySetValue(L); -} - int propertyGetValue(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::propertyGetValue"); const std::string uri = ghoul::lua::value(L); @@ -961,7 +952,7 @@ void createCustomProperty(openspace::properties::Property::PropertyInfo info, std::optional onChange) { T* p = new T(info); - if (onChange.has_value()) { + if (onChange.has_value() && !onChange->empty()) { p->onChange( [p, script = *onChange]() { using namespace ghoul::lua; @@ -976,12 +967,63 @@ void createCustomProperty(openspace::properties::Property::PropertyInfo info, openspace::global::userPropertyOwner->addProperty(p); } -[[codegen::luawrap]] void addCustomProperty(std::string identifier, std::string type, +enum class [[codegen::enum]] CustomPropertyType { + DMat2Property, + DMat3Property, + DMat4Property, + Mat2Property, + Mat3Property, + Mat4Property, + BoolProperty, + DoubleProperty, + FloatProperty, + IntProperty, + StringProperty, + StringListProperty, + LongProperty, + ShortProperty, + UShortProperty, + UIntProperty, + ULongProperty, + DVec2Property, + DVec3Property, + DVec4Property, + IVec2Property, + IVec3Property, + IVec4Property, + UVec2Property, + UVec3Property, + UVec4Property, + Vec2Property, + Vec3Property, + Vec4Property +}; + +/** + * Creates a new property that lives in the `UserProperty` group. + * + * \param identifier The identifier that is going to be used for the new property + * \param type The type of the property, has to be one of "DMat2Property", + * "DMat3Property", "DMat4Property", "Mat2Property", "Mat3Property", + * "Mat4Property", "BoolProperty", "DoubleProperty", "FloatProperty", + * "IntProperty", "StringProperty", "StringListProperty", "LongProperty", + * "ShortProperty", "UIntProperty", "ULongProperty", "DVec2Property", + * "DVec3Property", "DVec4Property", "IVec2Property", "IVec3Property", + * "IVec4Property", "UVec2Property", "UVec3Property", "UVec4Property", + * "Vec2Property", "Vec3Property", "Vec4Property" + * \param guiName The name that the property uses in the user interface. If this value is + * not provided, the `identifier` is used instead + * \param description A description what the property is used for + * \param onChange A Lua script that will be executed whenever the property changes + */ +[[codegen::luawrap]] void addCustomProperty(std::string identifier, + CustomPropertyType type, std::optional guiName, std::optional description, std::optional onChange) { using namespace openspace; + using namespace openspace::properties; if (identifier.empty()) { throw ghoul::lua::LuaError("Identifier must not empty"); @@ -1005,92 +1047,101 @@ void createCustomProperty(openspace::properties::Property::PropertyInfo info, guiName->c_str() : identifier.c_str(); - properties::Property::PropertyInfo info = { + Property::PropertyInfo info = { identifier.c_str(), gui, description.has_value() ? description->c_str() : "" }; - if (type == "DMat2Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "DMat3Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "DMat4Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "Mat2Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "Mat3Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "Mat4Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "BoolProperty") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "DoubleProperty") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "FloatProperty") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "IntProperty") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "LongProperty") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "ShortProperty") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "UIntProperty") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "ULongProperty") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "UShortProperty") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "DVec2Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "DVec3Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "DVec4Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "IVec2Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "IVec3Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "IVec4Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "UVec2Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "UVec3Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "UVec4Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "Vec2Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "Vec3Property") { - createCustomProperty(info, std::move(onChange)); - } - else if (type == "Vec4Property") { - createCustomProperty(info, std::move(onChange)); + switch (type) { + case CustomPropertyType::DMat2Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::DMat3Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::DMat4Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::Mat2Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::Mat3Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::Mat4Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::BoolProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::DoubleProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::FloatProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::IntProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::StringProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::StringListProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::LongProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::ShortProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::UIntProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::ULongProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::UShortProperty: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::DVec2Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::DVec3Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::DVec4Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::IVec2Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::IVec3Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::IVec4Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::UVec2Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::UVec3Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::UVec4Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::Vec2Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::Vec3Property: + createCustomProperty(info, std::move(onChange)); + return; + case CustomPropertyType::Vec4Property: + createCustomProperty(info, std::move(onChange)); + return; } + throw std::runtime_error("Missing case label"); } [[codegen::luawrap]] void removeCustomProperty(std::string identifier) { diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index e30fc64ada..44abce2c67 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -81,8 +81,8 @@ namespace { constexpr openspace::properties::Property::PropertyInfo VisibilityDistanceInfo = { "VisibilityDistance", "VisibilityDistance", - "The distace in world coordinates between node and camera " - "at which the screenspace object will become visible", + "The distace in world coordinates between node and camera at which the " + "screenspace object will become visible", openspace::properties::Property::Visibility::Hidden }; @@ -101,10 +101,9 @@ namespace { "InteractionSphere", "Interaction Sphere", "The minimum radius that the camera is allowed to get close to this scene graph " - "node. This value is " - "only used as an override to the bounding sphere calculated by the Renderable, " - "if present. If this value is -1, the Renderable's computed interaction sphere " - "is used", + "node. This value is only used as an override to the bounding sphere calculated " + "by the Renderable, if present. If this value is -1, the Renderable's computed " + "interaction sphere is used", openspace::properties::Property::Visibility::Developer }; @@ -125,32 +124,31 @@ namespace { constexpr openspace::properties::Property::PropertyInfo GuiPathInfo = { "GuiPath", "Gui Path", - "This is the path for the scene graph node in the gui " - "example: /Solar System/Planets/Earth", + "This is the path for the scene graph node in the gui example: " + "/Solar System/Planets/Earth", openspace::properties::Property::Visibility::Hidden }; constexpr openspace::properties::Property::PropertyInfo GuiNameInfo = { "GuiName", "Gui Name", - "This is the name for the scene graph node in the gui " - "example: Earth", + "This is the name for the scene graph node in the gui. Example: Earth", openspace::properties::Property::Visibility::Hidden }; constexpr openspace::properties::Property::PropertyInfo GuiDescriptionInfo = { "GuiDescription", "Gui Description", - "This is the description for the scene graph node to be shown in the gui " - "example: Earth is a special place", + "This is the description for the scene graph node to be shown in the gui. " + "Example: Earth is a special place", openspace::properties::Property::Visibility::Hidden }; constexpr openspace::properties::Property::PropertyInfo GuiHiddenInfo = { "GuiHidden", "Gui Hidden", - "This represents if the scene graph node should be shown in the gui " - "example: false", + "This represents if the scene graph node should be shown in the gui. " + "Example: false", openspace::properties::Property::Visibility::Hidden }; @@ -303,24 +301,27 @@ ghoul::mm_unique_ptr SceneGraphNode::createFromDictionary( if (p.gui->name.has_value()) { result->setGuiName(*p.gui->name); result->_guiDisplayName = result->guiName(); - result->addProperty(result->_guiDisplayName); } + result->addProperty(result->_guiDisplayName); if (p.gui->description.has_value()) { result->setDescription(*p.gui->description); result->_guiDescription = result->description(); - result->addProperty(result->_guiDescription); } + result->addProperty(result->_guiDescription); if (p.gui->hidden.has_value()) { result->_guiHidden = *p.gui->hidden; - result->addProperty(result->_guiHidden); } + result->addProperty(result->_guiHidden); if (p.gui->path.has_value()) { + if (!p.gui->path->starts_with('/')) { + throw ghoul::RuntimeError("GuiPath must start with /"); + } result->_guiPath = *p.gui->path; - result->addProperty(result->_guiPath); } + result->addProperty(result->_guiPath); } result->_boundingSphere = p.boundingSphere.value_or(result->_boundingSphere); @@ -486,8 +487,8 @@ ghoul::opengl::ProgramObject* SceneGraphNode::_debugSphereProgram = nullptr; SceneGraphNode::SceneGraphNode() : properties::PropertyOwner({ "" }) - , _guiHidden(GuiHiddenInfo) - , _guiPath(GuiPathInfo) + , _guiHidden(GuiHiddenInfo, false) + , _guiPath(GuiPathInfo, "/") , _guiDisplayName(GuiNameInfo) , _guiDescription(GuiDescriptionInfo) , _transform { @@ -729,10 +730,14 @@ void SceneGraphNode::render(const RenderData& data, RendererTasks& tasks) { TracyGpuZone("Render") RenderData newData = { - data.camera, - data.time, - data.renderBinMask, - { _worldPositionCached, _worldRotationCached, _worldScaleCached } + .camera = data.camera, + .time = data.time, + .renderBinMask = data.renderBinMask, + .modelTransform = { + .translation = _worldPositionCached, + .rotation = _worldRotationCached, + .scale = _worldScaleCached + } }; _renderable->render(newData, tasks); diff --git a/src/scripting/scriptengine.cpp b/src/scripting/scriptengine.cpp index c149bc6618..03fae5f5ab 100644 --- a/src/scripting/scriptengine.cpp +++ b/src/scripting/scriptengine.cpp @@ -673,8 +673,8 @@ void ScriptEngine::addBaseLibrary() { ZoneScoped LuaLibrary lib = { - "", - { + .name = "", + .functions = { { "printTrace", &luascriptfunctions::printTrace, diff --git a/src/util/keys.cpp b/src/util/keys.cpp index 5a50a6266d..6533d59360 100644 --- a/src/util/keys.cpp +++ b/src/util/keys.cpp @@ -36,6 +36,11 @@ namespace openspace { KeyWithModifier stringToKey(std::string str) { std::vector tokens = ghoul::tokenizeString(str, '+'); + // "Keypad +" will tokenize into "Keypad " + "" + if (tokens.size() == 2 && tokens[0] == "Keypad " && tokens[1].empty()) { + tokens = { std::string("Keypad +") }; + } + std::vector originalTokens = tokens; for (std::string& t : tokens) { std::transform( diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index 5027a62432..f07d1cbb0c 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -588,16 +588,23 @@ double SpiceManager::ephemerisTimeFromDate(const char* timeString) const { std::string SpiceManager::dateFromEphemerisTime(double ephemerisTime, const char* format) { - char Buffer[128]; - std::memset(Buffer, char(0), 128); + constexpr int BufferSize = 128; + char Buffer[BufferSize]; + std::memset(Buffer, char(0), BufferSize); - timout_c(ephemerisTime, format, 128, Buffer); + timout_c(ephemerisTime, format, BufferSize, Buffer); if (failed_c()) { throwSpiceError(fmt::format( "Error converting ephemeris time '{}' to date with format '{}'", ephemerisTime, format )); } + if (Buffer[0] == '*') { + // The conversion failed and we need to use et2utc + constexpr int SecondsPrecision = 3; + et2utc_c(ephemerisTime, "C", SecondsPrecision, BufferSize, Buffer); + } + return std::string(Buffer); } diff --git a/src/util/timemanager.cpp b/src/util/timemanager.cpp index c5d406c7fe..1aafa8977d 100644 --- a/src/util/timemanager.cpp +++ b/src/util/timemanager.cpp @@ -125,8 +125,18 @@ void TimeManager::interpolateTime(double targetTime, double durationSeconds) { const double now = currentApplicationTimeForInterpolation(); const bool pause = isPaused(); - const TimeKeyframeData current = { time(), deltaTime(), false, false }; - const TimeKeyframeData next = { Time(targetTime), targetDeltaTime(), pause, false }; + const TimeKeyframeData current = { + .time = time(), + .delta = deltaTime(), + .pause = false, + .jump = false + }; + const TimeKeyframeData next = { + .time = Time(targetTime), + .delta = targetDeltaTime(), + .pause = pause, + .jump = false + }; clearKeyframes(); addKeyframe(now, current); @@ -748,8 +758,18 @@ void TimeManager::interpolateDeltaTime(double newDeltaTime, double interpolation time().j2000Seconds() + (_deltaTime + newDeltaTime) * 0.5 * interpolationDuration ); - TimeKeyframeData currentKeyframe = { time(), _deltaTime, false, false }; - TimeKeyframeData futureKeyframe = { newTime, newDeltaTime, false, false }; + TimeKeyframeData currentKeyframe = { + .time = time(), + .delta = _deltaTime, + .pause = false, + .jump = false + }; + TimeKeyframeData futureKeyframe = { + .time = newTime, + .delta = newDeltaTime, + .pause = false, + .jump = false + }; _targetDeltaTime = newDeltaTime; @@ -854,8 +874,18 @@ void TimeManager::interpolatePause(bool pause, double interpolationDuration) { time().j2000Seconds() + (_deltaTime + targetDelta) * 0.5 * interpolationDuration ); - TimeKeyframeData currentKeyframe = { time(), _deltaTime, false, false }; - TimeKeyframeData futureKeyframe = { newTime, _targetDeltaTime, pause, false }; + TimeKeyframeData currentKeyframe = { + .time = time(), + .delta = _deltaTime, + .pause = false, + .jump = false + }; + TimeKeyframeData futureKeyframe = { + .time = newTime, + .delta = _targetDeltaTime, + .pause = pause, + .jump = false + }; _timePaused = pause; double now = isPlayingBackSessionRecording() ? diff --git a/src/util/transformationmanager.cpp b/src/util/transformationmanager.cpp index 574178f0d1..549c51262d 100644 --- a/src/util/transformationmanager.cpp +++ b/src/util/transformationmanager.cpp @@ -93,9 +93,9 @@ glm::dmat3 TransformationManager::kameleonTransformationMatrix( [[maybe_unused]] double ephemerisTime) const { #ifdef OPENSPACE_MODULE_KAMELEON_ENABLED - ccmc::Position in0 = {1.f, 0.f, 0.f}; - ccmc::Position in1 = {0.f, 1.f, 0.f}; - ccmc::Position in2 = {0.f, 0.f, 1.f}; + ccmc::Position in0 = ccmc::Position(1.f, 0.f, 0.f); + ccmc::Position in1 = ccmc::Position(0.f, 1.f, 0.f); + ccmc::Position in2 = ccmc::Position(0.f, 0.f, 1.f); ccmc::Position out0; ccmc::Position out1; diff --git a/support/coding/codegen b/support/coding/codegen index 4414749c9b..107f662bff 160000 --- a/support/coding/codegen +++ b/support/coding/codegen @@ -1 +1 @@ -Subproject commit 4414749c9bc1920ae6c554567498b2ae4f812d0b +Subproject commit 107f662bffb90aca6fcc4e97e34834352838ec94 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6361a26c61..06c09091a0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -53,13 +53,8 @@ add_executable( set_openspace_compile_settings(OpenSpaceTest) -target_include_directories(OpenSpaceTest - PUBLIC - "${GHOUL_BASE_DIR}/ext/catch2/single_include" - "${OPENSPACE_BASE_DIR}" -) target_compile_definitions(OpenSpaceTest PUBLIC "GHL_THROW_ON_ASSERT") -target_link_libraries(OpenSpaceTest PUBLIC openspace-core) +target_link_libraries(OpenSpaceTest PUBLIC Catch2 openspace-core) foreach (library_name ${all_enabled_modules}) get_target_property(library_type ${library_name} TYPE) diff --git a/tests/main.cpp b/tests/main.cpp index 844cead108..0da1022ff9 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -22,8 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#define CATCH_CONFIG_RUNNER -#include "catch2/catch.hpp" +#include #include #include diff --git a/tests/property/test_property_listproperties.cpp b/tests/property/test_property_listproperties.cpp index 19d55f8997..d2eb8d680e 100644 --- a/tests/property/test_property_listproperties.cpp +++ b/tests/property/test_property_listproperties.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include #include diff --git a/tests/property/test_property_optionproperty.cpp b/tests/property/test_property_optionproperty.cpp index 19b469d5fd..bf4dfb8245 100644 --- a/tests/property/test_property_optionproperty.cpp +++ b/tests/property/test_property_optionproperty.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include diff --git a/tests/property/test_property_selectionproperty.cpp b/tests/property/test_property_selectionproperty.cpp index 3bd5a5ace2..4e0e22a35d 100644 --- a/tests/property/test_property_selectionproperty.cpp +++ b/tests/property/test_property_selectionproperty.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include #include @@ -208,7 +208,7 @@ TEST_CASE("SelectionProperty: Value From Copying Variable", "[selectionproperty] openspace::properties::SelectionProperty p({ "id", "gui", "desc" }); p.setOptions({ "a", "b", "c" }); - p = { "a", "b" }; + p = std::set{ "a", "b" }; CHECK(p.value() == std::set{ "a", "b" }); } @@ -217,10 +217,10 @@ TEST_CASE("SelectionProperty: Re-set Options After Selection", "[selectionproper openspace::properties::SelectionProperty p({ "id", "gui", "desc" }); p.setOptions({ "a", "b", "c" }); - p = { "a", "b" }; + p = std::set{ "a", "b" }; - p.setOptions({ "a", "c", "d" }); // b no longer included - // => should be removed from selection + p.setOptions(std::vector{ "a", "c", "d" }); // b no longer included + // => should be removed CHECK(p.value() == std::set{ "a" }); } diff --git a/tests/regression/517.cpp b/tests/regression/517.cpp index 8a2ca7be12..7cb2cd189b 100644 --- a/tests/regression/517.cpp +++ b/tests/regression/517.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include diff --git a/tests/test_assetloader.cpp b/tests/test_assetloader.cpp index 845b8fced4..a3a783418d 100644 --- a/tests/test_assetloader.cpp +++ b/tests/test_assetloader.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include #include diff --git a/tests/test_concurrentqueue.cpp b/tests/test_concurrentqueue.cpp index 4b85000f2a..a8cbd1fcf0 100644 --- a/tests/test_concurrentqueue.cpp +++ b/tests/test_concurrentqueue.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include diff --git a/tests/test_configuration.cpp b/tests/test_configuration.cpp index dfb198778f..01cd0b8839 100644 --- a/tests/test_configuration.cpp +++ b/tests/test_configuration.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include #include diff --git a/tests/test_distanceconversion.cpp b/tests/test_distanceconversion.cpp index ef38e7c824..98fe07da54 100644 --- a/tests/test_distanceconversion.cpp +++ b/tests/test_distanceconversion.cpp @@ -22,7 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include +#include #include #include @@ -34,76 +35,76 @@ TEST_CASE("DistanceConversion: Convert to meters", "[distanceconversion]") { double res; res = convertDistance(unit, DistanceUnit::Nanometer, DistanceUnit::Meter); - CHECK(res == Approx(1e-9)); + CHECK(res == Catch::Approx(1e-9)); res = convertDistance(unit, DistanceUnit::Micrometer, DistanceUnit::Meter); - CHECK(res == Approx(1e-6)); + CHECK(res == Catch::Approx(1e-6)); res = convertDistance(unit, DistanceUnit::Millimeter, DistanceUnit::Meter); - CHECK(res == Approx(1e-3)); + CHECK(res == Catch::Approx(1e-3)); res = convertDistance(unit, DistanceUnit::Centimeter, DistanceUnit::Meter); - CHECK(res == Approx(1e-2)); + CHECK(res == Catch::Approx(1e-2)); res = convertDistance(unit, DistanceUnit::Decimeter, DistanceUnit::Meter); - CHECK(res == Approx(1e-1)); + CHECK(res == Catch::Approx(1e-1)); res = convertDistance(unit, DistanceUnit::Meter, DistanceUnit::Meter); - CHECK(res == Approx(1.0)); + CHECK(res == Catch::Approx(1.0)); res = convertDistance(unit, DistanceUnit::Kilometer, DistanceUnit::Meter); - CHECK(res == Approx(1000.0)); + CHECK(res == Catch::Approx(1000.0)); res = convertDistance(unit, DistanceUnit::AU, DistanceUnit::Meter); - CHECK(res == Approx(1.495978707E11)); + CHECK(res == Catch::Approx(1.495978707E11)); res = convertDistance(unit, DistanceUnit::Lighthour, DistanceUnit::Meter); - CHECK(res == Approx(1.0799921E12)); + CHECK(res == Catch::Approx(1.0799921E12)); res = convertDistance(unit, DistanceUnit::Lightday, DistanceUnit::Meter); - CHECK(res == Approx(2.591981E13)); + CHECK(res == Catch::Approx(2.591981E13)); res = convertDistance(unit, DistanceUnit::Lightmonth, DistanceUnit::Meter); - CHECK(res == Approx(7.8839421E14)); + CHECK(res == Catch::Approx(7.8839421E14)); res = convertDistance(unit, DistanceUnit::Lightyear, DistanceUnit::Meter); - CHECK(res == Approx(9.4607304725808E15)); + CHECK(res == Catch::Approx(9.4607304725808E15)); res = convertDistance(unit, DistanceUnit::Parsec, DistanceUnit::Meter); - CHECK(res == Approx(3.0856776E16)); + CHECK(res == Catch::Approx(3.0856776E16)); res = convertDistance(unit, DistanceUnit::Kiloparsec, DistanceUnit::Meter); - CHECK(res == Approx(1e3 * 3.0856776E16)); + CHECK(res == Catch::Approx(1e3 * 3.0856776E16)); res = convertDistance(unit, DistanceUnit::Megaparsec, DistanceUnit::Meter); - CHECK(res == Approx(1e6 * 3.0856776E16)); + CHECK(res == Catch::Approx(1e6 * 3.0856776E16)); res = convertDistance(unit, DistanceUnit::Gigaparsec, DistanceUnit::Meter); - CHECK(res == Approx(1e9 * 3.0856776E16)); + CHECK(res == Catch::Approx(1e9 * 3.0856776E16)); res = convertDistance(unit, DistanceUnit::Thou, DistanceUnit::Meter); - CHECK(res == Approx(1e-3 * 0.0254)); + CHECK(res == Catch::Approx(1e-3 * 0.0254)); res = convertDistance(unit, DistanceUnit::Inch, DistanceUnit::Meter); - CHECK(res == Approx(0.0254)); + CHECK(res == Catch::Approx(0.0254)); res = convertDistance(unit, DistanceUnit::Foot, DistanceUnit::Meter); - CHECK(res == Approx(0.3048)); + CHECK(res == Catch::Approx(0.3048)); res = convertDistance(unit, DistanceUnit::Yard, DistanceUnit::Meter); - CHECK(res == Approx(0.9144)); + CHECK(res == Catch::Approx(0.9144)); res = convertDistance(unit, DistanceUnit::Chain, DistanceUnit::Meter); - CHECK(res == Approx(20.1168)); + CHECK(res == Catch::Approx(20.1168)); res = convertDistance(unit, DistanceUnit::Furlong, DistanceUnit::Meter); - CHECK(res == Approx(10.0 * 20.1168)); + CHECK(res == Catch::Approx(10.0 * 20.1168)); res = convertDistance(unit, DistanceUnit::Mile, DistanceUnit::Meter); - CHECK(res == Approx(1609.344)); + CHECK(res == Catch::Approx(1609.344)); res = convertDistance(unit, DistanceUnit::League, DistanceUnit::Meter); - CHECK(res == Approx(3.0 * 1609.344)); + CHECK(res == Catch::Approx(3.0 * 1609.344)); } TEST_CASE("DistanceConversion: Convert from meters", "[distanceconversion]") { @@ -111,76 +112,76 @@ TEST_CASE("DistanceConversion: Convert from meters", "[distanceconversion]") { double res; res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Nanometer); - CHECK(res == Approx(meters / 1e-9)); + CHECK(res == Catch::Approx(meters / 1e-9)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Micrometer); - CHECK(res == Approx(meters / 1e-6)); + CHECK(res == Catch::Approx(meters / 1e-6)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Millimeter); - CHECK(res == Approx(meters / 1e-3)); + CHECK(res == Catch::Approx(meters / 1e-3)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Centimeter); - CHECK(res == Approx(meters / 1e-2)); + CHECK(res == Catch::Approx(meters / 1e-2)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Decimeter); - CHECK(res == Approx(meters / 1e-1)); + CHECK(res == Catch::Approx(meters / 1e-1)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Meter); - CHECK(res == Approx(1.0)); + CHECK(res == Catch::Approx(1.0)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Kilometer); - CHECK(res == Approx(meters / 1000.0)); + CHECK(res == Catch::Approx(meters / 1000.0)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::AU); - CHECK(res == Approx(meters / 1.495978707E11)); + CHECK(res == Catch::Approx(meters / 1.495978707E11)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Lighthour); - CHECK(res == Approx(meters / 1.0799921E12)); + CHECK(res == Catch::Approx(meters / 1.0799921E12)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Lightday); - CHECK(res == Approx(meters / 2.591981E13)); + CHECK(res == Catch::Approx(meters / 2.591981E13)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Lightmonth); - CHECK(res == Approx(meters / 7.8839421E14)); + CHECK(res == Catch::Approx(meters / 7.8839421E14)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Lightyear); - CHECK(res == Approx(meters / 9.4607304725808E15)); + CHECK(res == Catch::Approx(meters / 9.4607304725808E15)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Parsec); - CHECK(res == Approx(meters / 3.0856776E16)); + CHECK(res == Catch::Approx(meters / 3.0856776E16)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Kiloparsec); - CHECK(res == Approx(meters / (1e3 * 3.0856776E16))); + CHECK(res == Catch::Approx(meters / (1e3 * 3.0856776E16))); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Megaparsec); - CHECK(res == Approx(meters / (1e6 * 3.0856776E16))); + CHECK(res == Catch::Approx(meters / (1e6 * 3.0856776E16))); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Gigaparsec); - CHECK(res == Approx(meters / (1e9 * 3.0856776E16))); + CHECK(res == Catch::Approx(meters / (1e9 * 3.0856776E16))); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Thou); - CHECK(res == Approx(meters / (1e-3 * 0.0254))); + CHECK(res == Catch::Approx(meters / (1e-3 * 0.0254))); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Inch); - CHECK(res == Approx(meters / 0.0254)); + CHECK(res == Catch::Approx(meters / 0.0254)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Foot); - CHECK(res == Approx(meters / 0.3048)); + CHECK(res == Catch::Approx(meters / 0.3048)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Yard); - CHECK(res == Approx(meters / 0.9144)); + CHECK(res == Catch::Approx(meters / 0.9144)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Chain); - CHECK(res == Approx(meters / 20.1168)); + CHECK(res == Catch::Approx(meters / 20.1168)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Furlong); - CHECK(res == Approx(meters / (10.0 * 20.1168))); + CHECK(res == Catch::Approx(meters / (10.0 * 20.1168))); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::Mile); - CHECK(res == Approx(meters / 1609.344)); + CHECK(res == Catch::Approx(meters / 1609.344)); res = convertDistance(meters, DistanceUnit::Meter, DistanceUnit::League); - CHECK(res == Approx(meters / (3.0 * 1609.344))); + CHECK(res == Catch::Approx(meters / (3.0 * 1609.344))); } TEST_CASE("DistanceConversion: Cross conversion", "[distanceconversion]") { @@ -188,71 +189,71 @@ TEST_CASE("DistanceConversion: Cross conversion", "[distanceconversion]") { double res; res = convertDistance(unit, DistanceUnit::Nanometer, DistanceUnit::Kilometer); - CHECK(res == Approx(1e-12)); + CHECK(res == Catch::Approx(1e-12)); res = convertDistance(unit, DistanceUnit::Micrometer, DistanceUnit::Decimeter); - CHECK(res == Approx(1e-5)); + CHECK(res == Catch::Approx(1e-5)); res = convertDistance(unit, DistanceUnit::Millimeter, DistanceUnit::Nanometer); - CHECK(res == Approx(1e6)); + CHECK(res == Catch::Approx(1e6)); res = convertDistance(unit, DistanceUnit::Centimeter, DistanceUnit::Micrometer); - CHECK(res == Approx(1e4)); + CHECK(res == Catch::Approx(1e4)); res = convertDistance(unit, DistanceUnit::Decimeter, DistanceUnit::Millimeter); - CHECK(res == Approx(1e2)); + CHECK(res == Catch::Approx(1e2)); res = convertDistance(unit, DistanceUnit::Kilometer, DistanceUnit::Centimeter); - CHECK(res == Approx(1e5)); + CHECK(res == Catch::Approx(1e5)); res = convertDistance(unit, DistanceUnit::AU, DistanceUnit::Parsec); - CHECK(res == Approx(4.84813681e-6)); + CHECK(res == Catch::Approx(4.84813681e-6)); res = convertDistance(unit, DistanceUnit::Lighthour, DistanceUnit::Lightmonth); - CHECK(res == Approx(1.36986305e-3)); + CHECK(res == Catch::Approx(1.36986305e-3)); res = convertDistance(unit, DistanceUnit::Lightday, DistanceUnit::Kiloparsec); - CHECK(res == Approx(8.40003829e-7)); + CHECK(res == Catch::Approx(8.40003829e-7)); res = convertDistance(unit, DistanceUnit::Lightmonth, DistanceUnit::Lightday); - CHECK(res == Approx(30.4166662487)); + CHECK(res == Catch::Approx(30.4166662487)); res = convertDistance(unit, DistanceUnit::Lightyear, DistanceUnit::Gigaparsec); - CHECK(res == Approx(3.0660139e-10)); + CHECK(res == Catch::Approx(3.0660139e-10)); res = convertDistance(unit, DistanceUnit::Parsec, DistanceUnit::Lightyear); - CHECK(res == Approx(3.26156379673)); + CHECK(res == Catch::Approx(3.26156379673)); res = convertDistance(unit, DistanceUnit::Kiloparsec, DistanceUnit::AU); - CHECK(res == Approx(2.06264806E8)); + CHECK(res == Catch::Approx(2.06264806E8)); res = convertDistance(unit, DistanceUnit::Megaparsec, DistanceUnit::Lighthour); - CHECK(res == Approx(2.85712978826E10)); + CHECK(res == Catch::Approx(2.85712978826E10)); res = convertDistance(unit, DistanceUnit::Gigaparsec, DistanceUnit::Megaparsec); - CHECK(res == Approx(1e3)); + CHECK(res == Catch::Approx(1e3)); res = convertDistance(unit, DistanceUnit::Thou, DistanceUnit::Yard); - CHECK(res == Approx(2.77777778e-5)); + CHECK(res == Catch::Approx(2.77777778e-5)); res = convertDistance(unit, DistanceUnit::Inch, DistanceUnit::Foot); - CHECK(res == Approx(8.33333333e-2)); + CHECK(res == Catch::Approx(8.33333333e-2)); res = convertDistance(unit, DistanceUnit::Foot, DistanceUnit::Mile); - CHECK(res == Approx(1.89393939e-4)); + CHECK(res == Catch::Approx(1.89393939e-4)); res = convertDistance(unit, DistanceUnit::Yard, DistanceUnit::Chain); - CHECK(res == Approx(4.54545455e-2)); + CHECK(res == Catch::Approx(4.54545455e-2)); res = convertDistance(unit, DistanceUnit::Chain, DistanceUnit::League); - CHECK(res == Approx(4.16666666e-3)); + CHECK(res == Catch::Approx(4.16666666e-3)); res = convertDistance(unit, DistanceUnit::Furlong, DistanceUnit::Thou); - CHECK(res == Approx(7.92E6)); + CHECK(res == Catch::Approx(7.92E6)); res = convertDistance(unit, DistanceUnit::Mile, DistanceUnit::Inch); - CHECK(res == Approx(6.3360E4)); + CHECK(res == Catch::Approx(6.3360E4)); res = convertDistance(unit, DistanceUnit::League, DistanceUnit::Furlong); - CHECK(res == Approx(24.0)); + CHECK(res == Catch::Approx(24.0)); } diff --git a/tests/test_documentation.cpp b/tests/test_documentation.cpp index e73fc664ad..66702f9789 100644 --- a/tests/test_documentation.cpp +++ b/tests/test_documentation.cpp @@ -22,11 +22,12 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include #include #include +#include #include #include @@ -56,6 +57,21 @@ TEST_CASE("Documentation: Constructor", "[documentation]") { new StringVerifier, Optional::No ); + doc.entries.emplace_back( + "FileVerifier", + new FileVerifier, + Optional::No + ); + doc.entries.emplace_back( + "DirectoryVerifier", + new DirectoryVerifier, + Optional::No + ); + doc.entries.emplace_back( + "DateTimeVerifier", + new DateTimeVerifier, + Optional::No + ); doc.entries.emplace_back( "TableVerifier", new TableVerifier, @@ -263,6 +279,9 @@ TEST_CASE("Documentation: Initializer Constructor", "[documentation]") { {"DoubleVerifier", new DoubleVerifier, Optional::No }, {"IntVerifier", new IntVerifier, Optional::No }, {"StringVerifier", new StringVerifier, Optional::No }, + {"FileVerifier", new FileVerifier, Optional::No }, + {"DirectoryVerifier", new DirectoryVerifier, Optional::No }, + {"DateTimeVerifier", new DateTimeVerifier, Optional::No }, {"TableVerifier", new TableVerifier, Optional::No }, // Operator Verifiers @@ -330,10 +349,9 @@ TEST_CASE("Documentation: BoolVerifier", "[documentation]") { CHECK(positiveRes.success); CHECK(positiveRes.offenses.empty()); - ghoul::Dictionary negative; - negative.setValue("Bool", 0); - - TestResult negativeRes = testSpecification(doc, negative); + ghoul::Dictionary negativeType; + negativeType.setValue("Bool", 0); + TestResult negativeRes = testSpecification(doc, negativeType); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); CHECK(negativeRes.offenses[0].offender == "Bool"); @@ -363,10 +381,9 @@ TEST_CASE("Documentation: DoubleVerifier", "[documentation]") { CHECK(positiveRes.success); CHECK(positiveRes.offenses.empty()); - ghoul::Dictionary negative; - negative.setValue("Double", 0); - - TestResult negativeRes = testSpecification(doc, negative); + ghoul::Dictionary negativeType; + negativeType.setValue("Double", 0); + TestResult negativeRes = testSpecification(doc, negativeType); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); CHECK(negativeRes.offenses[0].offender == "Double"); @@ -400,10 +417,9 @@ TEST_CASE("Documentation: IntVerifier", "[documentation]") { CHECK(positiveRes.success); CHECK(positiveRes.offenses.empty()); - ghoul::Dictionary negative; - negative.setValue("Int", 0.1); - - TestResult negativeRes = testSpecification(doc, negative); + ghoul::Dictionary negativeType; + negativeType.setValue("Int", 0.1); + TestResult negativeRes = testSpecification(doc, negativeType); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); CHECK(negativeRes.offenses[0].offender == "Int"); @@ -432,9 +448,9 @@ TEST_CASE("Documentation: StringVerifier", "[documentation]") { CHECK(positiveRes.success); CHECK(positiveRes.offenses.empty()); - ghoul::Dictionary negative; - negative.setValue("String", 0); - TestResult negativeRes = testSpecification(doc, negative); + ghoul::Dictionary negativeType; + negativeType.setValue("String", 0); + TestResult negativeRes = testSpecification(doc, negativeType); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); CHECK(negativeRes.offenses[0].offender == "String"); @@ -449,6 +465,123 @@ TEST_CASE("Documentation: StringVerifier", "[documentation]") { CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); } +TEST_CASE("Documentation: FileVerifier", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc { + {{ "File", new FileVerifier, Optional::No }} + }; + + ghoul::Dictionary positive; + positive.setValue("File", absPath("${TESTDIR}/verifier/dummyfile.txt").string()); + TestResult positiveRes = testSpecification(doc, positive); + CHECK(positiveRes.success); + CHECK(positiveRes.offenses.empty()); + + ghoul::Dictionary negative404; + negative404.setValue("File", absPath("${TESTDIR}/verifier/404.txt").string()); + TestResult negativeRes = testSpecification(doc, negative404); + CHECK(!negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + CHECK(negativeRes.offenses[0].offender == "File"); + CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); + + ghoul::Dictionary negativeType; + negativeType.setValue("File", 0); + negativeRes = testSpecification(doc, negativeType); + CHECK_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + CHECK(negativeRes.offenses[0].offender == "File"); + CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeExist; + negativeExist.setValue("File2", ""s); + negativeRes = testSpecification(doc, negativeExist); + CHECK_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + CHECK(negativeRes.offenses[0].offender == "File"); + CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: DirectoryVerifier", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc{ + {{ "Dir", new DirectoryVerifier, Optional::No }} + }; + + ghoul::Dictionary positive; + positive.setValue("Dir", absPath("${TESTDIR}/verifier").string()); + TestResult positiveRes = testSpecification(doc, positive); + CHECK(positiveRes.success); + CHECK(positiveRes.offenses.empty()); + + ghoul::Dictionary negative404; + negative404.setValue("Dir", absPath("${TESTDIR}/verifier404").string()); + TestResult negativeRes = testSpecification(doc, negative404); + CHECK(!negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + CHECK(negativeRes.offenses[0].offender == "Dir"); + CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); + + ghoul::Dictionary negativeType; + negativeType.setValue("Dir", 0); + negativeRes = testSpecification(doc, negativeType); + CHECK_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + CHECK(negativeRes.offenses[0].offender == "Dir"); + CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeExist; + negativeExist.setValue("Dir2", ""s); + negativeRes = testSpecification(doc, negativeExist); + CHECK_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + CHECK(negativeRes.offenses[0].offender == "Dir"); + CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + +TEST_CASE("Documentation: DateTimeVerifier", "[documentation]") { + using namespace openspace::documentation; + using namespace std::string_literals; + + Documentation doc{ + {{ "DateTime", new DateTimeVerifier, Optional::No }} + }; + + ghoul::Dictionary positive; + positive.setValue("DateTime", "1969 07 20 20:17:00"s); + TestResult positiveRes = testSpecification(doc, positive); + CHECK(positiveRes.success); + CHECK(positiveRes.offenses.empty()); + + ghoul::Dictionary negative404; + negative404.setValue("DateTime", "abc"s); + TestResult negativeRes = testSpecification(doc, negative404); + CHECK(!negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + CHECK(negativeRes.offenses[0].offender == "DateTime"); + CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::Verification); + + ghoul::Dictionary negativeType; + negativeType.setValue("DateTime", 0); + negativeRes = testSpecification(doc, negativeType); + CHECK_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + CHECK(negativeRes.offenses[0].offender == "DateTime"); + CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); + + ghoul::Dictionary negativeExist; + negativeExist.setValue("DateTime2", ""s); + negativeRes = testSpecification(doc, negativeExist); + CHECK_FALSE(negativeRes.success); + REQUIRE(negativeRes.offenses.size() == 1); + CHECK(negativeRes.offenses[0].offender == "DateTime"); + CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::MissingKey); +} + TEST_CASE("Documentation: TableVerifierType", "[documentation]") { using namespace openspace::documentation; @@ -462,9 +595,9 @@ TEST_CASE("Documentation: TableVerifierType", "[documentation]") { CHECK(positiveRes.success); CHECK(positiveRes.offenses.empty()); - ghoul::Dictionary negative; - negative.setValue("Table", 0); - TestResult negativeRes = testSpecification(doc, negative); + ghoul::Dictionary negativeType; + negativeType.setValue("Table", 0); + TestResult negativeRes = testSpecification(doc, negativeType); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); CHECK(negativeRes.offenses[0].offender == "Table"); @@ -499,9 +632,9 @@ TEST_CASE("Documentation: StringListVerifierType", "[documentation]") { CHECK(positiveRes.success); CHECK(positiveRes.offenses.empty()); - ghoul::Dictionary negative; - negative.setValue("StringList", 0); - TestResult negativeRes = testSpecification(doc, negative); + ghoul::Dictionary negativeType; + negativeType.setValue("StringList", 0); + TestResult negativeRes = testSpecification(doc, negativeType); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); CHECK(negativeRes.offenses[0].offender == "StringList"); @@ -551,9 +684,9 @@ TEST_CASE("Documentation: IntListVerifierType", "[documentation]") { CHECK(positiveRes.success); CHECK(positiveRes.offenses.empty()); - ghoul::Dictionary negative; - negative.setValue("IntList", 0); - TestResult negativeRes = testSpecification(doc, negative); + ghoul::Dictionary negativeType; + negativeType.setValue("IntList", 0); + TestResult negativeRes = testSpecification(doc, negativeType); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); CHECK(negativeRes.offenses[0].offender == "IntList"); @@ -606,25 +739,25 @@ TEST_CASE("Documentation: MixedVerifiers", "[documentation]") { CHECK(positiveRes.success); CHECK(positiveRes.offenses.empty()); - ghoul::Dictionary negative1; - negative1.setValue("Bool", true); - negative1.setValue("Double", 1); - negative1.setValue("Int", 0); - negative1.setValue("String", ""s); - negative1.setValue("Table", ghoul::Dictionary()); - TestResult negativeRes = testSpecification(doc, negative1); + ghoul::Dictionary negativeType1; + negativeType1.setValue("Bool", true); + negativeType1.setValue("Double", 1); + negativeType1.setValue("Int", 0); + negativeType1.setValue("String", ""s); + negativeType1.setValue("Table", ghoul::Dictionary()); + TestResult negativeRes = testSpecification(doc, negativeType1); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); CHECK(negativeRes.offenses[0].offender == "Double"); CHECK(negativeRes.offenses[0].reason == TestResult::Offense::Reason::WrongType); - ghoul::Dictionary negative2; - negative2.setValue("Bool", true); - negative2.setValue("Double", 0.0); - negative2.setValue("Int", ""s); - negative2.setValue("String", 1); - negative2.setValue("Table", ghoul::Dictionary()); - negativeRes = testSpecification(doc, negative2); + ghoul::Dictionary negativeType2; + negativeType2.setValue("Bool", true); + negativeType2.setValue("Double", 0.0); + negativeType2.setValue("Int", ""s); + negativeType2.setValue("String", 1); + negativeType2.setValue("Table", ghoul::Dictionary()); + negativeRes = testSpecification(doc, negativeType2); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 2); CHECK(negativeRes.offenses[0].offender == "Int"); diff --git a/tests/test_horizons.cpp b/tests/test_horizons.cpp index c5a70ee113..2d97b5ed3b 100644 --- a/tests/test_horizons.cpp +++ b/tests/test_horizons.cpp @@ -22,7 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include +#include #include #include @@ -123,22 +124,22 @@ void testReadingHorizons(HorizonsType type, std::filesystem::path filePath, std::vector data = result.data; REQUIRE(data.size() == 3); - CHECK(data[0].time == Approx(t0)); - CHECK(data[0].position.x == Approx(x0)); - CHECK(data[0].position.y == Approx(y0)); - CHECK(data[0].position.z == Approx(z0)); + CHECK(data[0].time == Catch::Approx(t0)); + CHECK(data[0].position.x == Catch::Approx(x0)); + CHECK(data[0].position.y == Catch::Approx(y0)); + CHECK(data[0].position.z == Catch::Approx(z0)); - CHECK(data[1].time == Approx(t1)); - CHECK(data[1].position.x == Approx(x1)); - CHECK(data[1].position.y == Approx(y1)); - CHECK(data[1].position.z == Approx(z1)); + CHECK(data[1].time == Catch::Approx(t1)); + CHECK(data[1].position.x == Catch::Approx(x1)); + CHECK(data[1].position.y == Catch::Approx(y1)); + CHECK(data[1].position.z == Catch::Approx(z1)); - CHECK(data[2].time == Approx(t2)); - CHECK(data[2].position.x == Approx(x2)); - CHECK(data[2].position.y == Approx(y2)); - CHECK(data[2].position.z == Approx(z2)); + CHECK(data[2].time == Catch::Approx(t2)); + CHECK(data[2].position.x == Catch::Approx(x2)); + CHECK(data[2].position.y == Catch::Approx(y2)); + CHECK(data[2].position.z == Catch::Approx(z2)); // Clean up openspace::SpiceManager::ref().unloadKernel(kernel.string()); diff --git a/tests/test_iswamanager.cpp b/tests/test_iswamanager.cpp index cec926f432..f6a5dbb97a 100644 --- a/tests/test_iswamanager.cpp +++ b/tests/test_iswamanager.cpp @@ -24,7 +24,7 @@ #ifdef OPENSPACE_MODULE_ISWA_ENABLED -#include "catch2/catch.hpp" +#include #include #include diff --git a/tests/test_jsonformatting.cpp b/tests/test_jsonformatting.cpp index 3caca0b87a..cd3d97b28d 100644 --- a/tests/test_jsonformatting.cpp +++ b/tests/test_jsonformatting.cpp @@ -22,7 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include +#include #include #include diff --git a/tests/test_latlonpatch.cpp b/tests/test_latlonpatch.cpp index 185585d4ee..6b95778f35 100644 --- a/tests/test_latlonpatch.cpp +++ b/tests/test_latlonpatch.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include #include diff --git a/tests/test_lrucache.cpp b/tests/test_lrucache.cpp index 235444c587..05355ea0fb 100644 --- a/tests/test_lrucache.cpp +++ b/tests/test_lrucache.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include #include diff --git a/tests/test_lua_createsinglecolorimage.cpp b/tests/test_lua_createsinglecolorimage.cpp index ed4b943dc0..1f65021d13 100644 --- a/tests/test_lua_createsinglecolorimage.cpp +++ b/tests/test_lua_createsinglecolorimage.cpp @@ -22,7 +22,9 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include +#include +#include #include #include @@ -42,7 +44,7 @@ TEST_CASE("CreateSingleColorImage: Create image and check return value", CHECK_THAT( path.string(), - Catch::Matchers::Contains("colorFile.ppm") + Catch::Matchers::ContainsSubstring("colorFile.ppm") ); } @@ -54,7 +56,7 @@ TEST_CASE("CreateSingleColorImage: Faulty color value (invalid values)", "notCreatedColorFile", glm::dvec3(255.0, 0.0, 0.0) ).string(), - Catch::Matchers::Contains( + Catch::Matchers::Equals( "Invalid color. Expected three double values {r, g, b} in range 0 to 1" ) ); diff --git a/tests/test_profile.cpp b/tests/test_profile.cpp index 53f800df41..c201093fdc 100644 --- a/tests/test_profile.cpp +++ b/tests/test_profile.cpp @@ -22,7 +22,9 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include +#include +#include #include #include @@ -1036,7 +1038,7 @@ TEST_CASE("(Error) Version: Missing value 'major'", "[profile]") { "${TESTDIR}/profile/error/version/missing_major.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'version.major' field is missing") + Catch::Matchers::Equals("(profile) 'version.major' field is missing") ); } @@ -1045,7 +1047,7 @@ TEST_CASE("(Error) Version: Missing value 'minor'", "[profile]") { "${TESTDIR}/profile/error/version/missing_minor.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'version.minor' field is missing") + Catch::Matchers::Equals("(profile) 'version.minor' field is missing") ); } @@ -1054,7 +1056,7 @@ TEST_CASE("(Error) Version: Wrong type 'major'", "[profile]") { "${TESTDIR}/profile/error/version/wrongtype_major.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'version.major' must be a number") + Catch::Matchers::Equals("(profile) 'version.major' must be a number") ); } @@ -1063,7 +1065,7 @@ TEST_CASE("(Error) Version: Wrong type 'minor'", "[profile]") { "${TESTDIR}/profile/error/version/wrongtype_minor.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'version.minor' must be a number") + Catch::Matchers::Equals("(profile) 'version.minor' must be a number") ); } @@ -1072,7 +1074,7 @@ TEST_CASE("(Error) Version: Wrong type 'major' and 'minor'", "[profile]") { "${TESTDIR}/profile/error/version/wrongtype_major_minor.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'version.major' must be a number") + Catch::Matchers::Equals("(profile) 'version.major' must be a number") ); } @@ -1086,7 +1088,7 @@ TEST_CASE("(Error) Module: Missing value 'name'", "[profile]") { "${TESTDIR}/profile/error/module/missing_name.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'module.name' field is missing") + Catch::Matchers::Equals("(profile) 'module.name' field is missing") ); } @@ -1095,7 +1097,7 @@ TEST_CASE("(Error) Module: Wrong type 'name'", "[profile]") { "${TESTDIR}/profile/error/module/wrongtype_name.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'module.name' must be a string") + Catch::Matchers::Equals("(profile) 'module.name' must be a string") ); } @@ -1104,7 +1106,7 @@ TEST_CASE("(Error) Module: Wrong type 'loadedInstruction'", "[profile]") { "${TESTDIR}/profile/error/module/wrongtype_loadedInstruction.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'module.loadedInstruction' must be a string") + Catch::Matchers::Equals("(profile) 'module.loadedInstruction' must be a string") ); } @@ -1113,7 +1115,7 @@ TEST_CASE("(Error) Module: Wrong type 'notLoadedInstruction'", "[profile]") { "${TESTDIR}/profile/error/module/wrongtype_notLoadedInstruction.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'module.notLoadedInstruction' must be a string") + Catch::Matchers::Equals("(profile) 'module.notLoadedInstruction' must be a string") ); } @@ -1126,7 +1128,7 @@ TEST_CASE("(Error) Property: Missing value 'name'", "[profile]") { "${TESTDIR}/profile/error/property/missing_name.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'property.name' field is missing") + Catch::Matchers::Equals("(profile) 'property.name' field is missing") ); } @@ -1135,7 +1137,7 @@ TEST_CASE("(Error) Property: Missing value 'value'", "[profile]") { "${TESTDIR}/profile/error/property/missing_value.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'property.value' field is missing") + Catch::Matchers::Equals("(profile) 'property.value' field is missing") ); } @@ -1144,7 +1146,7 @@ TEST_CASE("(Error) Property: Missing value 'name' and 'value'", "[profile]") { "${TESTDIR}/profile/error/property/missing_name_value.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'property.name' field is missing") + Catch::Matchers::Equals("(profile) 'property.name' field is missing") ); } @@ -1153,7 +1155,7 @@ TEST_CASE("(Error) Property: Wrong value 'type'", "[profile]") { "${TESTDIR}/profile/error/property/wrongvalue_type.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("Unknown property set type") + Catch::Matchers::Equals("(profile) Unknown property set type") ); } @@ -1162,7 +1164,7 @@ TEST_CASE("(Error) Property: Wrong type 'name'", "[profile]") { "${TESTDIR}/profile/error/property/wrongtype_name.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'property.name' must be a string") + Catch::Matchers::Equals("(profile) 'property.name' must be a string") ); } @@ -1171,7 +1173,7 @@ TEST_CASE("(Error) Property: Wrong type 'value'", "[profile]") { "${TESTDIR}/profile/error/property/wrongtype_value.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'property.value' must be a string") + Catch::Matchers::Equals("(profile) 'property.value' must be a string") ); } @@ -1184,7 +1186,7 @@ TEST_CASE("(Error) Keybinding: Missing value 'key'", "[profile]") { "${TESTDIR}/profile/error/keybinding/missing_key.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'keybinding.key' field is missing") + Catch::Matchers::Equals("(profile) 'keybinding.key' field is missing") ); } @@ -1193,7 +1195,7 @@ TEST_CASE("(Error) Keybinding: Missing value 'documentation'", "[profile]") { "${TESTDIR}/profile/error/keybinding/missing_documentation.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'keybinding.documentation' field is missing") + Catch::Matchers::Equals("(profile) 'keybinding.documentation' field is missing") ); } @@ -1202,7 +1204,7 @@ TEST_CASE("(Error) Keybinding: Missing value 'name'", "[profile]") { "${TESTDIR}/profile/error/keybinding/missing_name.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'keybinding.name' field is missing") + Catch::Matchers::Equals("(profile) 'keybinding.name' field is missing") ); } @@ -1211,7 +1213,7 @@ TEST_CASE("(Error) Keybinding: Missing value 'gui_path'", "[profile]") { "${TESTDIR}/profile/error/keybinding/missing_guipath.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'keybinding.gui_path' field is missing") + Catch::Matchers::Equals("(profile) 'keybinding.gui_path' field is missing") ); } @@ -1220,7 +1222,7 @@ TEST_CASE("(Error) Keybinding: Missing value 'is_local'", "[profile]") { "${TESTDIR}/profile/error/keybinding/missing_islocal.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'keybinding.is_local' field is missing") + Catch::Matchers::Equals("(profile) 'keybinding.is_local' field is missing") ); } @@ -1229,7 +1231,7 @@ TEST_CASE("(Error) Keybinding: Wrong value 'key'", "[profile]") { "${TESTDIR}/profile/error/keybinding/wrongvalue_key.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("Could not find key for 'F50'") + Catch::Matchers::Equals("Could not find key for 'F50'") ); } @@ -1238,7 +1240,7 @@ TEST_CASE("(Error) Keybinding: Wrong value 'key, modifier'", "[profile]") { "${TESTDIR}/profile/error/keybinding/wrongvalue_modifier.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("Unknown modifier key 'KEYKEY'") + Catch::Matchers::Equals("Unknown modifier key 'KEYKEY'") ); } @@ -1247,7 +1249,7 @@ TEST_CASE("(Error) Keybinding: Wrong type 'documentation'", "[profile]") { "${TESTDIR}/profile/error/keybinding/wrongtype_documentation.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'keybinding.documentation' must be a string") + Catch::Matchers::Equals("(profile) 'keybinding.documentation' must be a string") ); } @@ -1256,7 +1258,7 @@ TEST_CASE("(Error) Keybinding: Wrong type 'gui_path'", "[profile]") { "${TESTDIR}/profile/error/keybinding/wrongtype_guipath.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'keybinding.gui_path' must be a string") + Catch::Matchers::Equals("(profile) 'keybinding.gui_path' must be a string") ); } @@ -1265,7 +1267,7 @@ TEST_CASE("(Error) Keybinding: Wrong type 'is_local'", "[profile]") { "${TESTDIR}/profile/error/keybinding/wrongtype_islocal.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'keybinding.is_local' must be a boolean") + Catch::Matchers::Equals("(profile) 'keybinding.is_local' must be a boolean") ); } @@ -1274,7 +1276,7 @@ TEST_CASE("(Error) Keybinding: Wrong type 'name'", "[profile]") { "${TESTDIR}/profile/error/keybinding/wrongtype_name.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'keybinding.name' must be a string") + Catch::Matchers::Equals("(profile) 'keybinding.name' must be a string") ); } @@ -1283,7 +1285,7 @@ TEST_CASE("(Error) Keybinding: Wrong type 'script'", "[profile]") { "${TESTDIR}/profile/error/keybinding/wrongtype_script.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'keybinding.script' must be a string") + Catch::Matchers::Equals("(profile) 'keybinding.script' must be a string") ); } @@ -1296,7 +1298,7 @@ TEST_CASE("(Error) Time: Wrong value 'type'", "[profile]") { "${TESTDIR}/profile/error/time/wrongvalue_type.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("Unknown time type") + Catch::Matchers::Equals("(profile) Unknown time type") ); } @@ -1305,7 +1307,7 @@ TEST_CASE("(Error) Time (absolute): Missing value 'type'", "[profile]") { "${TESTDIR}/profile/error/time/missing_type.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'time.type' field is missing") + Catch::Matchers::Equals("(profile) 'time.type' field is missing") ); } @@ -1314,7 +1316,7 @@ TEST_CASE("(Error) Time (relative): Missing value 'value'", "[profile]") { "${TESTDIR}/profile/error/time/relative_missing_value.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'time.value' field is missing") + Catch::Matchers::Equals("(profile) 'time.value' field is missing") ); } @@ -1326,7 +1328,7 @@ TEST_CASE("(Error) Deltatimes: Wrong type", "[profile]") { "${TESTDIR}/profile/error/deltatimes/wrongtype_value.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("type must be number, but is string") + Catch::Matchers::ContainsSubstring("type must be number, but is string") ); } @@ -1338,7 +1340,7 @@ TEST_CASE("(Error) Camera: Wrong value 'type'", "[profile]") { "${TESTDIR}/profile/error/camera/wrongvalue_type.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("Unknown camera type") + Catch::Matchers::Equals("(profile) Unknown camera type") ); } @@ -1347,7 +1349,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'anchor'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_missing_anchor.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.anchor' field is missing") + Catch::Matchers::Equals("(profile) 'camera.anchor' field is missing") ); } @@ -1356,7 +1358,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'frame'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_missing_frame.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.frame' field is missing") + Catch::Matchers::Equals("(profile) 'camera.frame' field is missing") ); } @@ -1365,7 +1367,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'position'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_missing_position.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.position' field is missing") + Catch::Matchers::Equals("(profile) 'camera.position' field is missing") ); } @@ -1374,7 +1376,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'anchor'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_anchor.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.anchor' must be a string") + Catch::Matchers::Equals("(profile) 'camera.anchor' must be a string") ); } @@ -1383,7 +1385,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'aim'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_aim.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.aim' must be a string") + Catch::Matchers::Equals("(profile) 'camera.aim' must be a string") ); } @@ -1392,7 +1394,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'frame'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_frame.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.frame' must be a string") + Catch::Matchers::Equals("(profile) 'camera.frame' must be a string") ); } @@ -1401,7 +1403,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'position'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_position.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.position' must be an object") + Catch::Matchers::Equals("(profile) 'camera.position' must be an object") ); } @@ -1410,7 +1412,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'position.x'", "[profile]") "${TESTDIR}/profile/error/camera/navstate_missing_position_x.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.position.x' field is missing") + Catch::Matchers::Equals("(profile) 'camera.position.x' field is missing") ); } @@ -1419,7 +1421,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'position.x'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_position_x.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.position.x' must be a number") + Catch::Matchers::Equals("(profile) 'camera.position.x' must be a number") ); } @@ -1428,7 +1430,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'position.y'", "[profile]") "${TESTDIR}/profile/error/camera/navstate_missing_position_y.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.position.y' field is missing") + Catch::Matchers::Equals("(profile) 'camera.position.y' field is missing") ); } @@ -1437,7 +1439,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'position.y'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_position_y.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.position.y' must be a number") + Catch::Matchers::Equals("(profile) 'camera.position.y' must be a number") ); } @@ -1446,7 +1448,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'position.z'", "[profile]") "${TESTDIR}/profile/error/camera/navstate_missing_position_z.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.position.z' field is missing") + Catch::Matchers::Equals("(profile) 'camera.position.z' field is missing") ); } @@ -1455,7 +1457,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'position.z'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_position_z.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.position.z' must be a number") + Catch::Matchers::Equals("(profile) 'camera.position.z' must be a number") ); } @@ -1464,7 +1466,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'up'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_up.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.up' must be an object") + Catch::Matchers::Equals("(profile) 'camera.up' must be an object") ); } @@ -1473,7 +1475,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'up.x'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_missing_up_x.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.up.x' field is missing") + Catch::Matchers::Equals("(profile) 'camera.up.x' field is missing") ); } @@ -1482,7 +1484,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'up.x'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_up_x.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.up.x' must be a number") + Catch::Matchers::Equals("(profile) 'camera.up.x' must be a number") ); } @@ -1491,7 +1493,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'up.y'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_missing_up_y.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.up.y' field is missing") + Catch::Matchers::Equals("(profile) 'camera.up.y' field is missing") ); } @@ -1500,7 +1502,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'up.y'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_up_y.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.up.y' must be a number") + Catch::Matchers::Equals("(profile) 'camera.up.y' must be a number") ); } @@ -1509,7 +1511,7 @@ TEST_CASE("(Error) Camera (NavState): Missing value 'up.z'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_missing_up_z.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.up.z' field is missing") + Catch::Matchers::Equals("(profile) 'camera.up.z' field is missing") ); } @@ -1518,7 +1520,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'up.z'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_up_z.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.up.z' must be a number") + Catch::Matchers::Equals("(profile) 'camera.up.z' must be a number") ); } @@ -1527,7 +1529,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'yaw'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_yaw.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.yaw' must be a number") + Catch::Matchers::Equals("(profile) 'camera.yaw' must be a number") ); } @@ -1536,7 +1538,7 @@ TEST_CASE("(Error) Camera (NavState): Wrong type 'pitch'", "[profile]") { "${TESTDIR}/profile/error/camera/navstate_wrongtype_pitch.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("camera.pitch' must be a number") + Catch::Matchers::Equals("(profile) 'camera.pitch' must be a number") ); } @@ -1545,7 +1547,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Missing value 'anchor'", "[profile]") { "${TESTDIR}/profile/error/camera/gotogeo_missing_anchor.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.anchor' field is missing") + Catch::Matchers::Equals("(profile) 'camera.anchor' field is missing") ); } @@ -1554,7 +1556,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Missing value 'latitude'", "[profile]") { "${TESTDIR}/profile/error/camera/gotogeo_missing_latitude.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.latitude' field is missing") + Catch::Matchers::Equals("(profile) 'camera.latitude' field is missing") ); } @@ -1563,7 +1565,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Missing value 'longitude'", "[profile]") { "${TESTDIR}/profile/error/camera/gotogeo_missing_longitude.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.longitude' field is missing") + Catch::Matchers::Equals("(profile) 'camera.longitude' field is missing") ); } @@ -1572,7 +1574,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Wrong type 'anchor'", "[profile]") { "${TESTDIR}/profile/error/camera/gotogeo_wrongtype_anchor.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.anchor' must be a string") + Catch::Matchers::Equals("(profile) 'camera.anchor' must be a string") ); } @@ -1581,7 +1583,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Wrong type 'latitude'", "[profile]") { "${TESTDIR}/profile/error/camera/gotogeo_wrongtype_latitude.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.latitude' must be a number") + Catch::Matchers::Equals("(profile) 'camera.latitude' must be a number") ); } @@ -1590,7 +1592,7 @@ TEST_CASE("(Error) Camera (GoToGeo): Wrong type 'longitude'", "[profile]") { "${TESTDIR}/profile/error/camera/gotogeo_wrongtype_longitude.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.longitude' must be a number") + Catch::Matchers::Equals("(profile) 'camera.longitude' must be a number") ); } @@ -1599,6 +1601,6 @@ TEST_CASE("(Error) Camera (GoToGeo): Wrong type 'altitude'", "[profile]") { "${TESTDIR}/profile/error/camera/gotogeo_wrongtype_altitude.profile"; CHECK_THROWS_WITH( loadProfile(absPath(TestFile)), - Catch::Matchers::Contains("'camera.altitude' must be a number") + Catch::Matchers::Equals("(profile) 'camera.altitude' must be a number") ); } diff --git a/tests/test_rawvolumeio.cpp b/tests/test_rawvolumeio.cpp index e3134f780b..7f390c52a2 100644 --- a/tests/test_rawvolumeio.cpp +++ b/tests/test_rawvolumeio.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include #include diff --git a/tests/test_scriptscheduler.cpp b/tests/test_scriptscheduler.cpp index f5f17146c9..2dbcac374a 100644 --- a/tests/test_scriptscheduler.cpp +++ b/tests/test_scriptscheduler.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include #include diff --git a/tests/test_spicemanager.cpp b/tests/test_spicemanager.cpp index 180d1da253..981b1d455a 100644 --- a/tests/test_spicemanager.cpp +++ b/tests/test_spicemanager.cpp @@ -22,7 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include +#include #include #include @@ -332,9 +333,9 @@ TEST_CASE("SpiceManager: Get Target Position", "[spicemanager]") { ); }() ); - CHECK(pos[0] == Approx(targetPosition[0])); - CHECK(pos[1] == Approx(targetPosition[1])); - CHECK(pos[2] == Approx(targetPosition[2])); + CHECK(pos[0] == Catch::Approx(targetPosition[0])); + CHECK(pos[1] == Catch::Approx(targetPosition[1])); + CHECK(pos[2] == Catch::Approx(targetPosition[2])); openspace::SpiceManager::deinitialize(); } @@ -365,8 +366,8 @@ TEST_CASE("SpiceManager: Get Target State", "[spicemanager]") { // x,y,z for (int i = 0; i < 3; i++){ - CHECK(state[i] == Approx(res.position[i])); - CHECK(state[i+3] == Approx(res.velocity[i])); + CHECK(state[i] == Catch::Approx(res.position[i])); + CHECK(state[i+3] == Catch::Approx(res.velocity[i])); } openspace::SpiceManager::deinitialize(); @@ -395,7 +396,7 @@ TEST_CASE("SpiceManager: Transform matrix", "[spicemanager]") { // check for matrix consistency for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { - CHECK(referenceMatrix[i][j] == Approx(stateMatrix[i * 6 + j])); + CHECK(referenceMatrix[i][j] == Catch::Approx(stateMatrix[i * 6 + j])); } } @@ -429,7 +430,7 @@ TEST_CASE("SpiceManager: Get Position Transform Matrix", "[spicemanager]") { // check for matrix consistency for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { - CHECK(referenceMatrix[i][j] == Approx(positionMatrix[j][i])); + CHECK(referenceMatrix[i][j] == Catch::Approx(positionMatrix[j][i])); } } @@ -453,7 +454,7 @@ TEST_CASE("SpiceManager: Get Position Transform Matrix", "[spicemanager]") { position = positionMatrix * position; // check transformed values match for (int i = 0; i < 3; i++) { - CHECK(position[i] == Approx(state_t[i])); + CHECK(position[i] == Catch::Approx(state_t[i])); } openspace::SpiceManager::deinitialize(); @@ -489,7 +490,7 @@ TEST_CASE("SpiceManager: Get Field Of View", "[spicemanager]") { for (size_t i = 0; i < res.bounds.size(); i++) { for (size_t j = 0; j < 3; j++) { CHECK( - bounds_ref[i][j] == Approx(res.bounds[i][static_cast(j)]) + bounds_ref[i][j] == Catch::Approx(res.bounds[i][static_cast(j)]) ); } } diff --git a/tests/test_timeconversion.cpp b/tests/test_timeconversion.cpp index b892c1926c..9931326327 100644 --- a/tests/test_timeconversion.cpp +++ b/tests/test_timeconversion.cpp @@ -22,7 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include +#include #include @@ -134,92 +135,92 @@ TEST_CASE("TimeConversion: Simplify Time Round", "[timeconversion]") { TEST_CASE("TimeConversion: Simplify Time Fractional", "[timeconversion]") { { std::pair p = simplifyTime(32e-10, false); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "nanoseconds"); } { std::pair p = simplifyTime(32e-10, true); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "nanosecond"); } { std::pair p = simplifyTime(32e-7, false); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "microseconds"); } { std::pair p = simplifyTime(32e-7, true); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "microsecond"); } { std::pair p = simplifyTime(32e-4, false); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "milliseconds"); } { std::pair p = simplifyTime(32e-4, true); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "millisecond"); } { std::pair p = simplifyTime(3.2, false); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "seconds"); } { std::pair p = simplifyTime(3.2, true); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "second"); } { std::pair p = simplifyTime(192.0, false); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "minutes"); } { std::pair p = simplifyTime(192.0, true); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "minute"); } { std::pair p = simplifyTime(11520.0, false); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "hours"); } { std::pair p = simplifyTime(11520.0, true); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "hour"); } { std::pair p = simplifyTime(276480.0, false); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "days"); } { std::pair p = simplifyTime(276480.0, true); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "day"); } { std::pair p = simplifyTime(8415187.2, false); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "months"); } { std::pair p = simplifyTime(8415187.2, true); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "month"); } { std::pair p = simplifyTime(100982246.4, false); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "years"); } { std::pair p = simplifyTime(100982246.4, true); - CHECK(Approx(p.first) == 3.2); + CHECK(Catch::Approx(p.first) == 3.2); CHECK(p.second == "year"); } } @@ -351,37 +352,37 @@ TEST_CASE("TimeConversion: Split Time Fractional", "[timeconversion]") { { std::vector> p = splitTime(32e-10, false); REQUIRE(p.size() == 1); - CHECK(Approx(p[0].first) == 3.2); + CHECK(Catch::Approx(p[0].first) == 3.2); CHECK(p[0].second == "nanoseconds"); } { std::vector> p = splitTime(32e-10, true); REQUIRE(p.size() == 1); - CHECK(Approx(p[0].first) == 3.2); + CHECK(Catch::Approx(p[0].first) == 3.2); CHECK(p[0].second == "nanosecond"); } { std::vector> p = splitTime(32e-7, false); REQUIRE(p.size() == 2); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "microseconds"); - CHECK(Approx(p[1].first) == 200.0); + CHECK(Catch::Approx(p[1].first) == 200.0); CHECK(p[1].second == "nanoseconds"); } { std::vector> p = splitTime(32e-7, true); REQUIRE(p.size() == 2); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "microsecond"); - CHECK(Approx(p[1].first) == 200.0); + CHECK(Catch::Approx(p[1].first) == 200.0); CHECK(p[1].second == "nanosecond"); } { std::vector> p = splitTime(32e-4, false); REQUIRE(p.size() == 3); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "milliseconds"); - CHECK(Approx(p[1].first) == 200.0); + CHECK(Catch::Approx(p[1].first) == 200.0); CHECK(p[1].second == "microseconds"); // This is some floating point inaccuracy CHECK(p[2].first < 1e-3); @@ -390,9 +391,9 @@ TEST_CASE("TimeConversion: Split Time Fractional", "[timeconversion]") { { std::vector> p = splitTime(32e-4, true); REQUIRE(p.size() == 3); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "millisecond"); - CHECK(Approx(p[1].first) == 200.0); + CHECK(Catch::Approx(p[1].first) == 200.0); CHECK(p[1].second == "microsecond"); // This is some floating point inaccuracy CHECK(p[2].first < 1e-3); @@ -401,9 +402,9 @@ TEST_CASE("TimeConversion: Split Time Fractional", "[timeconversion]") { { std::vector> p = splitTime(3.2, false); REQUIRE(p.size() == 3); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "seconds"); - CHECK(Approx(p[1].first) == 200.0); + CHECK(Catch::Approx(p[1].first) == 200.0); CHECK(p[1].second == "milliseconds"); // This is some floating point inaccuracy CHECK(p[2].first < 1e-3); @@ -412,9 +413,9 @@ TEST_CASE("TimeConversion: Split Time Fractional", "[timeconversion]") { { std::vector> p = splitTime(3.2, true); REQUIRE(p.size() == 3); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "second"); - CHECK(Approx(p[1].first) == 200.0); + CHECK(Catch::Approx(p[1].first) == 200.0); CHECK(p[1].second == "millisecond"); // This is some floating point inaccuracy CHECK(p[2].first < 1e-3); @@ -423,145 +424,145 @@ TEST_CASE("TimeConversion: Split Time Fractional", "[timeconversion]") { { std::vector> p = splitTime(192.0, false); REQUIRE(p.size() == 2); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "minutes"); - CHECK(Approx(p[1].first) == 12.0); + CHECK(Catch::Approx(p[1].first) == 12.0); CHECK(p[1].second == "seconds"); } { std::vector> p = splitTime(192.0, true); REQUIRE(p.size() == 2); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "minute"); - CHECK(Approx(p[1].first) == 12.0); + CHECK(Catch::Approx(p[1].first) == 12.0); CHECK(p[1].second == "second"); } { std::vector> p = splitTime(11520.0, false); REQUIRE(p.size() == 2); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "hours"); - CHECK(Approx(p[1].first) == 12.0); + CHECK(Catch::Approx(p[1].first) == 12.0); CHECK(p[1].second == "minutes"); } { std::vector> p = splitTime(11520.0, true); REQUIRE(p.size() == 2); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "hour"); - CHECK(Approx(p[1].first) == 12.0); + CHECK(Catch::Approx(p[1].first) == 12.0); CHECK(p[1].second == "minute"); } { std::vector> p = splitTime(276480.0, false); REQUIRE(p.size() == 3); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "days"); - CHECK(Approx(p[1].first) == 4); + CHECK(Catch::Approx(p[1].first) == 4); CHECK(p[1].second == "hours"); - CHECK(Approx(p[2].first) == 48); + CHECK(Catch::Approx(p[2].first) == 48); CHECK(p[2].second == "minutes"); } { std::vector> p = splitTime(276480.0, true); REQUIRE(p.size() == 3); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "day"); - CHECK(Approx(p[1].first) == 4); + CHECK(Catch::Approx(p[1].first) == 4); CHECK(p[1].second == "hour"); - CHECK(Approx(p[2].first) == 48); + CHECK(Catch::Approx(p[2].first) == 48); CHECK(p[2].second == "minute"); } { std::vector> p = splitTime(8414838.0, false); REQUIRE(p.size() == 3); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "months"); - CHECK(Approx(p[1].first) == 6.0); + CHECK(Catch::Approx(p[1].first) == 6.0); CHECK(p[1].second == "days"); - CHECK(Approx(p[2].first) == 2.0); + CHECK(Catch::Approx(p[2].first) == 2.0); CHECK(p[2].second == "hours"); } { std::vector> p = splitTime(8414838.0, true); REQUIRE(p.size() == 3); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "month"); - CHECK(Approx(p[1].first) == 6.0); + CHECK(Catch::Approx(p[1].first) == 6.0); CHECK(p[1].second == "day"); - CHECK(Approx(p[2].first) == 2.0); + CHECK(Catch::Approx(p[2].first) == 2.0); CHECK(p[2].second == "hour"); } { std::vector> p = splitTime(100981548.0, false); REQUIRE(p.size() == 4); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "years"); - CHECK(Approx(p[1].first) == 2.0); + CHECK(Catch::Approx(p[1].first) == 2.0); CHECK(p[1].second == "months"); - CHECK(Approx(p[2].first) == 12.0); + CHECK(Catch::Approx(p[2].first) == 12.0); CHECK(p[2].second == "days"); - CHECK(Approx(p[3].first) == 4.0); + CHECK(Catch::Approx(p[3].first) == 4.0); CHECK(p[3].second == "hours"); } { std::vector> p = splitTime(100981548.0, true); REQUIRE(p.size() == 4); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "year"); - CHECK(Approx(p[1].first) == 2.0); + CHECK(Catch::Approx(p[1].first) == 2.0); CHECK(p[1].second == "month"); - CHECK(Approx(p[2].first) == 12.0); + CHECK(Catch::Approx(p[2].first) == 12.0); CHECK(p[2].second == "day"); - CHECK(Approx(p[3].first) == 4.0); + CHECK(Catch::Approx(p[3].first) == 4.0); CHECK(p[3].second == "hour"); } { std::vector> p = splitTime(100981676.388, false); REQUIRE(p.size() == 9); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "years"); - CHECK(Approx(p[1].first) == 2.0); + CHECK(Catch::Approx(p[1].first) == 2.0); CHECK(p[1].second == "months"); - CHECK(Approx(p[2].first) == 12.0); + CHECK(Catch::Approx(p[2].first) == 12.0); CHECK(p[2].second == "days"); - CHECK(Approx(p[3].first) == 4.0); + CHECK(Catch::Approx(p[3].first) == 4.0); CHECK(p[3].second == "hours"); - CHECK(Approx(p[4].first) == 2.0); + CHECK(Catch::Approx(p[4].first) == 2.0); CHECK(p[4].second == "minutes"); - CHECK(Approx(p[5].first) == 8.0); + CHECK(Catch::Approx(p[5].first) == 8.0); CHECK(p[5].second == "seconds"); - CHECK(Approx(p[6].first) == 387.0); + CHECK(Catch::Approx(p[6].first) == 387.0); CHECK(p[6].second == "milliseconds"); - CHECK(Approx(p[7].first) == 999.0); + CHECK(Catch::Approx(p[7].first) == 999.0); CHECK(p[7].second == "microseconds"); - CHECK(Approx(p[8].first) == 996.54293059); + CHECK(Catch::Approx(p[8].first) == 996.54293059); CHECK(p[8].second == "nanoseconds"); } { std::vector> p = splitTime(100981676.388, true); REQUIRE(p.size() == 9); - CHECK(Approx(p[0].first) == 3.0); + CHECK(Catch::Approx(p[0].first) == 3.0); CHECK(p[0].second == "year"); - CHECK(Approx(p[1].first) == 2.0); + CHECK(Catch::Approx(p[1].first) == 2.0); CHECK(p[1].second == "month"); - CHECK(Approx(p[2].first) == 12.0); + CHECK(Catch::Approx(p[2].first) == 12.0); CHECK(p[2].second == "day"); - CHECK(Approx(p[3].first) == 4.0); + CHECK(Catch::Approx(p[3].first) == 4.0); CHECK(p[3].second == "hour"); - CHECK(Approx(p[4].first) == 2.0); + CHECK(Catch::Approx(p[4].first) == 2.0); CHECK(p[4].second == "minute"); - CHECK(Approx(p[5].first) == 8.0); + CHECK(Catch::Approx(p[5].first) == 8.0); CHECK(p[5].second == "second"); - CHECK(Approx(p[6].first) == 387.0); + CHECK(Catch::Approx(p[6].first) == 387.0); CHECK(p[6].second == "millisecond"); - CHECK(Approx(p[7].first) == 999.0); + CHECK(Catch::Approx(p[7].first) == 999.0); CHECK(p[7].second == "microsecond"); - CHECK(Approx(p[8].first) == 996.54293059); + CHECK(Catch::Approx(p[8].first) == 996.54293059); CHECK(p[8].second == "nanosecond"); } } diff --git a/tests/test_timeline.cpp b/tests/test_timeline.cpp index 492be167e4..5e770cae5d 100644 --- a/tests/test_timeline.cpp +++ b/tests/test_timeline.cpp @@ -22,7 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include +#include #include #include @@ -42,13 +43,13 @@ TEST_CASE("TimeLine: Query Keyframes", "[timeline]") { REQUIRE(timeline.nKeyframes() == 2); - CHECK(timeline.firstKeyframeAfter(0.0)->data == Approx(1.f)); - CHECK(timeline.firstKeyframeAfter(0.0, false)->data == Approx(1.f)); - CHECK(timeline.firstKeyframeAfter(0.0, true)->data == Approx(0.f)); + CHECK(timeline.firstKeyframeAfter(0.0)->data == Catch::Approx(1.f)); + CHECK(timeline.firstKeyframeAfter(0.0, false)->data == Catch::Approx(1.f)); + CHECK(timeline.firstKeyframeAfter(0.0, true)->data == Catch::Approx(0.f)); - CHECK(timeline.lastKeyframeBefore(1.0)->data == Approx(0.f)); - CHECK(timeline.lastKeyframeBefore(1.0, false)->data == Approx(0.f)); - CHECK(timeline.lastKeyframeBefore(1.0, true)->data == Approx(1.f)); + CHECK(timeline.lastKeyframeBefore(1.0)->data == Catch::Approx(0.f)); + CHECK(timeline.lastKeyframeBefore(1.0, false)->data == Catch::Approx(0.f)); + CHECK(timeline.lastKeyframeBefore(1.0, true)->data == Catch::Approx(1.f)); } TEST_CASE("TimeLine: Remove Keyframes", "[timeline]") { diff --git a/tests/test_timequantizer.cpp b/tests/test_timequantizer.cpp index b4868e585f..2a83989100 100644 --- a/tests/test_timequantizer.cpp +++ b/tests/test_timequantizer.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include "catch2/catch.hpp" +#include #include "modules/globebrowsing/src/timequantizer.h" #include diff --git a/tests/verifier/dummyfile.txt b/tests/verifier/dummyfile.txt new file mode 100644 index 0000000000..e69de29bb2