diff --git a/.gitmodules b/.gitmodules index 68bba6a41a..4fb7924109 100644 --- a/.gitmodules +++ b/.gitmodules @@ -50,3 +50,6 @@ [submodule "ext/json"] path = ext/json url = https://github.com/nlohmann/json +[submodule "support/cmake/common-compile-settings"] + path = support/cmake/common-compile-settings + url = https://github.com/OpenSpace/common-compile-settings diff --git a/CMakeLists.txt b/CMakeLists.txt index f6079ff825..d0338cada2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,28 +98,6 @@ option(OPENSPACE_HAVE_TESTS "Activate the OpenSpace unit tests" ON) if (MSVC) option(OPENSPACE_BREAK_ON_FLOATING_POINT_EXCEPTION "Raise exceptions when encountering Inf's or Nan's in floating point numbers" OFF) - - option(OPENSPACE_OPTIMIZATION_ENABLE_AVX "Enable AVX instruction set for compilation" OFF) - option(OPENSPACE_OPTIMIZATION_ENABLE_AVX2 "Enable AVX2 instruction set for compilation" OFF) - option(OPENSPACE_OPTIMIZATION_ENABLE_AVX512 "Enable AVX2 instruction set for compilation" OFF) - option(OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS "Enable other optimizations, like LTCG, intrinsics, etc") - - if (OPENSPACE_OPTIMIZATION_ENABLE_AVX AND OPENSPACE_OPTIMIZATION_ENABLE_AVX2) - message(FATAL_ERROR "Cannot enable AVX and AVX2 instructions simultaneously") - endif () - - if (OPENSPACE_OPTIMIZATION_ENABLE_AVX AND OPENSPACE_OPTIMIZATION_ENABLE_AVX512) - message(FATAL_ERROR "Cannot enable AVX and AVX512 instructions simultaneously") - endif () - - if (OPENSPACE_OPTIMIZATION_ENABLE_AVX2 AND OPENSPACE_OPTIMIZATION_ENABLE_AVX512) - message(FATAL_ERROR "Cannot enable AVX2 and AVX512 instructions simultaneously") - endif () - - set(GHOUL_OPTIMIZATION_ENABLE_AVX ${OPENSPACE_OPTIMIZATION_ENABLE_AVX} CACHE BOOL "" FORCE) - set(GHOUL_OPTIMIZATION_ENABLE_AVX2 ${OPENSPACE_OPTIMIZATION_ENABLE_AVX2} CACHE BOOL "" FORCE) - set(GHOUL_OPTIMIZATION_ENABLE_AVX512 ${OPENSPACE_OPTIMIZATION_ENABLE_AVX512} CACHE BOOL "" FORCE) - set(GHOUL_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS ${OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS} CACHE BOOL "" FORCE) endif () if (UNIX AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang") diff --git a/apps/OpenSpace/ext/launcher/include/profile/assettreemodel.h b/apps/OpenSpace/ext/launcher/include/profile/assettreemodel.h index f8a8b903b0..7409a34a31 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/assettreemodel.h +++ b/apps/OpenSpace/ext/launcher/include/profile/assettreemodel.h @@ -146,7 +146,7 @@ public: * structure. * * \param assetBasePath The base path where to find all assets - * \param assetBasePath The base path where to find user assets + * \param userAssetBasePath The base path where to find user assets */ void importModelData(const std::string& assetBasePath, const std::string& userAssetBasePath); diff --git a/apps/OpenSpace/ext/launcher/include/profile/profileedit.h b/apps/OpenSpace/ext/launcher/include/profile/profileedit.h index 3aa007bfa9..59dfa6ae69 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/profileedit.h +++ b/apps/OpenSpace/ext/launcher/include/profile/profileedit.h @@ -47,8 +47,6 @@ public: * \param profileName The name of the profile to create * \param assetBasePath The path to the folder where the assets live * \param userAssetBasePath The path to the folder where the user assets live - * \param builtInProfileBasePath The path to the folder in which the built-in profiles - * live * \param profileBasePath The path to the folder in which all profiles live * \param parent Pointer to parent Qt widget */ diff --git a/apps/OpenSpace/ext/launcher/include/sgctedit/displaywindowunion.h b/apps/OpenSpace/ext/launcher/include/sgctedit/displaywindowunion.h index 4321736b1a..53d3f9f54a 100644 --- a/apps/OpenSpace/ext/launcher/include/sgctedit/displaywindowunion.h +++ b/apps/OpenSpace/ext/launcher/include/sgctedit/displaywindowunion.h @@ -42,12 +42,10 @@ public: * Constructor for DisplayWindowUnion class, which manages the overall control layout * including monitorBox, multiple WindowControl columns, and additional controls. * - * \param monitorSizeList A vector containing QRect objects containing pixel dims of - * each monitor + * \param monitorResolutions A vector containing QRect objects containing pixel dims + * of each monitor * \param nMaxWindows The maximum number of windows allowed (depends on the number of * monitors in the system) - * \param resetToDefault If set to true, all display and window settings will be - * initialized to their default values * \param parent The parent to which this widget belongs */ DisplayWindowUnion(const std::vector& monitorResolutions, diff --git a/apps/OpenSpace/ext/launcher/include/sgctedit/monitorbox.h b/apps/OpenSpace/ext/launcher/include/sgctedit/monitorbox.h index ce0b3281c1..5347e9c88e 100644 --- a/apps/OpenSpace/ext/launcher/include/sgctedit/monitorbox.h +++ b/apps/OpenSpace/ext/launcher/include/sgctedit/monitorbox.h @@ -39,8 +39,8 @@ public: * relative position and size, and window(s) that they contain. * * \param widgetSize The size of the display widget in pixels - * \param monitorResolution A vector containing each monitor's maximum display size in - * pixels + * \param monitorResolutions A vector containing each monitor's maximum display size + * in pixels * \param parent The parent which to which this MonitorBox belongs */ MonitorBox(QRect widgetSize, const std::vector& monitorResolutions, diff --git a/apps/OpenSpace/ext/launcher/include/sgctedit/windowcontrol.h b/apps/OpenSpace/ext/launcher/include/sgctedit/windowcontrol.h index cc53ebc80c..fccf2d45cc 100644 --- a/apps/OpenSpace/ext/launcher/include/sgctedit/windowcontrol.h +++ b/apps/OpenSpace/ext/launcher/include/sgctedit/windowcontrol.h @@ -69,7 +69,10 @@ public: /** * Sets the window dimensions. * - * \param newDims The x, y dimensions to set the window to + * \param x The x coordinate to set the window to + * \param y The y coordinate to set the window to + * \param width The width to set the window to + * \param height The height to set the window to */ void setDimensions(int x, int y, int width, int height); @@ -128,7 +131,8 @@ public: * \param quality The value for number of vertical lines of resolution. This will be * compared against the QualityValues array in order to set the correct * combobox index - * \tilt The tilt of the fisheye in degrees + * \param tilt The tilt of the fisheye in degrees + * \param fov Set the field-of-view of the fisheye */ void setProjectionFisheye(int quality, float tilt, float fov); diff --git a/apps/OpenSpace/ext/launcher/src/notificationwindow.cpp b/apps/OpenSpace/ext/launcher/src/notificationwindow.cpp index 02c4420488..b154cf8d75 100644 --- a/apps/OpenSpace/ext/launcher/src/notificationwindow.cpp +++ b/apps/OpenSpace/ext/launcher/src/notificationwindow.cpp @@ -156,8 +156,8 @@ NotificationWindow::NotificationWindow(QWidget* parent) } // 1. Get the downloaded data - const std::vector& data = _request->downloadedData(); - std::string notificationText = std::string(data.begin(), data.end()); + const std::vector& d = _request->downloadedData(); + std::string notificationText = std::string(d.begin(), d.end()); // 2. Parse the retrieved data into entries std::vector entries = parseEntries(notificationText); diff --git a/apps/OpenSpace/ext/launcher/src/profile/horizonsdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/horizonsdialog.cpp index edc387af6b..ac71422aea 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/horizonsdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/horizonsdialog.cpp @@ -62,8 +62,7 @@ namespace { constexpr std::string_view Years = "calendar years"; constexpr std::string_view Unitless = "equal intervals (unitless)"; - BooleanType(IsDirty); - void styleLabel(QLabel* label, IsDirty isDirty) { + void styleLabel(QLabel* label, bool isDirty) { const std::string newStyle = isDirty ? "error" : "normal"; label->setObjectName(QString::fromStdString(newStyle)); label->style()->unpolish(label); @@ -126,7 +125,7 @@ void HorizonsDialog::typeOnChange(int index) { } else { QMessageBox::critical(this, "Error", "Invalid Horizons type"); - styleLabel(_typeLabel, IsDirty::Yes); + styleLabel(_typeLabel, true); } } @@ -390,7 +389,7 @@ bool HorizonsDialog::isValidInput() { if (_fileEdit->text().isEmpty()) { QMessageBox::critical(this, "Error", "File path not selected"); _fileEdit->setFocus(); - styleLabel(_fileLabel, IsDirty::Yes); + styleLabel(_fileLabel, true); return false; } @@ -400,14 +399,14 @@ bool HorizonsDialog::isValidInput() { { QMessageBox::critical(this, "Error", "Target not selected"); _targetEdit->setFocus(); - styleLabel(_targetLabel, IsDirty::Yes); + styleLabel(_targetLabel, true); return false; } if (_targetEdit->text().toStdString().find_first_of("¤<>§£´¨€") != std::string::npos) { QMessageBox::critical(this, "Error", "Target includes illegal characters"); _targetEdit->setFocus(); - styleLabel(_targetLabel, IsDirty::Yes); + styleLabel(_targetLabel, true); return false; } @@ -417,14 +416,14 @@ bool HorizonsDialog::isValidInput() { { QMessageBox::critical(this, "Error", "Observer not selected"); _centerEdit->setFocus(); - styleLabel(_centerLabel, IsDirty::Yes); + styleLabel(_centerLabel, true); return false; } if (_centerEdit->text().toStdString().find_first_of("¤<>§£´¨€") != std::string::npos) { QMessageBox::critical(this, "Error", "Observer includes illegal characters"); _centerEdit->setFocus(); - styleLabel(_centerLabel, IsDirty::Yes); + styleLabel(_centerLabel, true); return false; } @@ -433,7 +432,7 @@ bool HorizonsDialog::isValidInput() { if (_stepEdit->text().isEmpty()) { QMessageBox::critical(this, "Error", "Step size is not selected"); _stepEdit->setFocus(); - styleLabel(_stepLabel, IsDirty::Yes); + styleLabel(_stepLabel, true); return false; } // Numerical @@ -448,7 +447,7 @@ bool HorizonsDialog::isValidInput() { )) ); _stepEdit->setFocus(); - styleLabel(_stepLabel, IsDirty::Yes); + styleLabel(_stepLabel, true); return false; } // In the case of arcseconds range is different @@ -460,7 +459,7 @@ bool HorizonsDialog::isValidInput() { "Angular step size needs to be in range 60 to 3600" ); _stepEdit->setFocus(); - styleLabel(_stepLabel, IsDirty::Yes); + styleLabel(_stepLabel, true); return false; } } @@ -474,7 +473,7 @@ bool HorizonsDialog::isValidInput() { std::numeric_limits::max() ))); _stepEdit->setFocus(); - styleLabel(_stepLabel, IsDirty::Yes); + styleLabel(_stepLabel, true); return false; } return true; @@ -706,13 +705,13 @@ bool HorizonsDialog::handleRequest() { } // Clean all widgets - styleLabel(_typeLabel, IsDirty::No); - styleLabel(_fileLabel, IsDirty::No); - styleLabel(_targetLabel, IsDirty::No); - styleLabel(_centerLabel, IsDirty::No); - styleLabel(_startLabel, IsDirty::No); - styleLabel(_endLabel, IsDirty::No); - styleLabel(_stepLabel, IsDirty::No); + styleLabel(_typeLabel, false); + styleLabel(_fileLabel, false); + styleLabel(_targetLabel, false); + styleLabel(_centerLabel, false); + styleLabel(_startLabel, false); + styleLabel(_endLabel, false); + styleLabel(_stepLabel, false); _importTimeButton->hide(); _validTimeRange = std::pair(); @@ -771,7 +770,7 @@ std::string HorizonsDialog::constructUrl() { } else { QMessageBox::critical(this, "Error", "Invalid Horizons type"); - styleLabel(_typeLabel, IsDirty::Yes); + styleLabel(_typeLabel, true); return ""; } @@ -838,7 +837,7 @@ std::string HorizonsDialog::constructUrl() { } else { QMessageBox::critical(this, "Error", "Invalid time unit type"); - styleLabel(_stepLabel, IsDirty::Yes); + styleLabel(_stepLabel, true); return ""; } @@ -907,11 +906,11 @@ openspace::HorizonsFile HorizonsDialog::handleAnswer(nlohmann::json& answer) { "Error", "File already exist, try another file path" ); - styleLabel(_fileLabel, IsDirty::Yes); + styleLabel(_fileLabel, true); return openspace::HorizonsFile(); default: QMessageBox::critical(this, "Error", "Invalid answer"); - styleLabel(_fileLabel, IsDirty::Yes); + styleLabel(_fileLabel, true); return openspace::HorizonsFile(); } } @@ -958,9 +957,9 @@ bool HorizonsDialog::handleResult(openspace::HorizonsResultCode& result) { _timeTypeCombo->currentText().toStdString() ); appendLog(msg, HorizonsDialog::LogLevel::Error); - styleLabel(_startLabel, IsDirty::Yes); - styleLabel(_endLabel, IsDirty::Yes); - styleLabel(_stepLabel, IsDirty::Yes); + styleLabel(_startLabel, true); + styleLabel(_endLabel, true); + styleLabel(_stepLabel, true); std::filesystem::remove(_horizonsFile.file()); break; @@ -970,7 +969,7 @@ bool HorizonsDialog::handleResult(openspace::HorizonsResultCode& result) { "Step size is too big, exceeds available time span for target", HorizonsDialog::LogLevel::Error ); - styleLabel(_stepLabel, IsDirty::Yes); + styleLabel(_stepLabel, true); std::filesystem::remove(_horizonsFile.file()); break; @@ -979,8 +978,8 @@ bool HorizonsDialog::handleResult(openspace::HorizonsResultCode& result) { "Time range is outside the valid range for target '{}'", _targetName ); appendLog(msg, HorizonsDialog::LogLevel::Error); - styleLabel(_startLabel, IsDirty::Yes); - styleLabel(_endLabel, IsDirty::Yes); + styleLabel(_startLabel, true); + styleLabel(_endLabel, true); _validTimeRange = readTimeRange(); if (_validTimeRange.first.empty() || _validTimeRange.second.empty()) { @@ -1012,7 +1011,7 @@ bool HorizonsDialog::handleResult(openspace::HorizonsResultCode& result) { _observerName ); appendLog(msg, HorizonsDialog::LogLevel::Info); - styleLabel(_centerLabel, IsDirty::Yes); + styleLabel(_centerLabel, true); std::filesystem::remove(_horizonsFile.file()); break; @@ -1023,8 +1022,8 @@ bool HorizonsDialog::handleResult(openspace::HorizonsResultCode& result) { "observer for the current target", _observerName, _targetName ); appendLog(msg, HorizonsDialog::LogLevel::Error); - styleLabel(_targetLabel, IsDirty::Yes); - styleLabel(_centerLabel, IsDirty::Yes); + styleLabel(_targetLabel, true); + styleLabel(_centerLabel, true); std::filesystem::remove(_horizonsFile.file()); break; @@ -1053,7 +1052,7 @@ bool HorizonsDialog::handleResult(openspace::HorizonsResultCode& result) { "for alternatives", _observerName ); appendLog(msg, HorizonsDialog::LogLevel::Info); - styleLabel(_centerLabel, IsDirty::Yes); + styleLabel(_centerLabel, true); const std::vector matchingstations = _horizonsFile.parseMatches( @@ -1096,7 +1095,7 @@ bool HorizonsDialog::handleResult(openspace::HorizonsResultCode& result) { "Horizons command 'NEWS'", _targetName ); appendLog(msg, HorizonsDialog::LogLevel::Info); - styleLabel(_targetLabel, IsDirty::Yes); + styleLabel(_targetLabel, true); std::filesystem::remove(_horizonsFile.file()); break; @@ -1106,7 +1105,7 @@ bool HorizonsDialog::handleResult(openspace::HorizonsResultCode& result) { "Multiple matches were found for observer '{}'", _observerName ); appendLog(msg, HorizonsDialog::LogLevel::Warning); - styleLabel(_centerLabel, IsDirty::Yes); + styleLabel(_centerLabel, true); const std::vector matchingObservers = _horizonsFile.parseMatches("Name", "matches", ">MATCH NAME<"); @@ -1144,7 +1143,7 @@ bool HorizonsDialog::handleResult(openspace::HorizonsResultCode& result) { "Try to use '{}*' as target to search for possible matches", _targetName ); appendLog(msg, HorizonsDialog::LogLevel::Info); - styleLabel(_targetLabel, IsDirty::Yes); + styleLabel(_targetLabel, true); std::filesystem::remove(_horizonsFile.file()); break; @@ -1165,7 +1164,7 @@ bool HorizonsDialog::handleResult(openspace::HorizonsResultCode& result) { "Multiple matches were found for target '{}'", _targetName ); appendLog(msg, HorizonsDialog::LogLevel::Warning); - styleLabel(_targetLabel, IsDirty::Yes); + styleLabel(_targetLabel, true); const std::vector matchingTargets = _horizonsFile.parseMatches("Name", "matches", ">MATCH NAME<"); diff --git a/apps/OpenSpace/ext/launcher/src/profile/propertiesdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/propertiesdialog.cpp index 59ff2ebcd0..168953a12a 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/propertiesdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/propertiesdialog.cpp @@ -418,7 +418,6 @@ void PropertiesDialog::selectLineFromScriptLog() { if (value[0] == '\'') { value[0] = '"'; } - const QChar end = value[value.size() - 1]; if (value[value.size() - 1] == '\'') { value[value.size() - 1] = '"'; } diff --git a/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp b/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp index 6981cdd60a..87da6cdc2a 100644 --- a/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp +++ b/apps/OpenSpace/ext/launcher/src/sgctedit/displaywindowunion.cpp @@ -113,7 +113,7 @@ DisplayWindowUnion::DisplayWindowUnion(const std::vector& monitorResoluti void DisplayWindowUnion::initialize(const std::vector& monitorSizeList, const sgct::config::Cluster& cluster) { - for (int i = 0; i < cluster.nodes.front().windows.size(); i++) { + for (size_t i = 0; i < cluster.nodes.front().windows.size(); i++) { addWindow(); } diff --git a/apps/OpenSpace/ext/launcher/src/sgctedit/monitorbox.cpp b/apps/OpenSpace/ext/launcher/src/sgctedit/monitorbox.cpp index e5f0af53fc..95eb18c98a 100644 --- a/apps/OpenSpace/ext/launcher/src/sgctedit/monitorbox.cpp +++ b/apps/OpenSpace/ext/launcher/src/sgctedit/monitorbox.cpp @@ -43,14 +43,16 @@ MonitorBox::MonitorBox(QRect widgetSize, const std::vector& monitorResolu // // Set the size of the widget according to the aspect ratio of the total size - const float aspectRatio = monitorArrangement.width() / monitorArrangement.height(); - if (aspectRatio > 1.f) { + const double aspectRatio = monitorArrangement.width() / monitorArrangement.height(); + if (aspectRatio > 1.0) { const float borderMargin = 2.f * MarginFractionWidgetSize * widgetSize.width(); - widgetSize.setHeight(widgetSize.width() / aspectRatio + borderMargin); + const double height = widgetSize.width() / aspectRatio + borderMargin; + widgetSize.setHeight(static_cast(height)); } else { const float borderMargin = 2.f * MarginFractionWidgetSize * widgetSize.height(); - widgetSize.setWidth(widgetSize.height() * aspectRatio + borderMargin); + const double width = widgetSize.height() * aspectRatio + borderMargin; + widgetSize.setWidth(static_cast(width)); } setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); setFixedSize(widgetSize.width(), widgetSize.height()); @@ -59,15 +61,16 @@ MonitorBox::MonitorBox(QRect widgetSize, const std::vector& monitorResolu // Map monitor resolution to widget coordinates const float margin = size().width() * MarginFractionWidgetSize; const float virtualWidth = size().width() * (1.f - MarginFractionWidgetSize * 2.f); - _monitorScaleFactor = virtualWidth / monitorArrangement.width(); + _monitorScaleFactor = static_cast(virtualWidth / monitorArrangement.width()); - const float newHeight = virtualWidth / aspectRatio; + const double newHeight = virtualWidth / aspectRatio; for (const QRect& res : monitorResolutions) { - const float x = margin + (res.x() - monitorArrangement.x()) * _monitorScaleFactor; - const float y = margin + (size().height() - newHeight - margin) / 4.f + + const double x = + margin + (res.x() - monitorArrangement.x()) * _monitorScaleFactor; + const double y = margin + (size().height() - newHeight - margin) / 4.f + (res.y() - monitorArrangement.y()) * _monitorScaleFactor; - const float width = res.width() * _monitorScaleFactor; - const float height = res.height() * _monitorScaleFactor; + const double width = res.width() * _monitorScaleFactor; + const double height = res.height() * _monitorScaleFactor; _monitorDimensionsScaled.emplace_back(x, y, width, height); } } diff --git a/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp b/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp index de4c3a18e8..deddf743ef 100644 --- a/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp +++ b/apps/OpenSpace/ext/launcher/src/sgctedit/windowcontrol.cpp @@ -735,8 +735,8 @@ void WindowControl::resetToDefaults() { const float newHeight = _monitorResolutions[PrimaryMonitorIdx].height() * IdealScaleVerticalLines; const float newWidth = newHeight * IdealAspectRatio; - _windowDimensions.setHeight(newHeight); - _windowDimensions.setWidth(newWidth); + _windowDimensions.setHeight(static_cast(newHeight)); + _windowDimensions.setWidth(static_cast(newWidth)); _sizeX->setValue(static_cast(newWidth)); _sizeY->setValue(static_cast(newHeight)); @@ -878,9 +878,9 @@ void WindowControl::generateWindowInformation(sgct::config::Window& window) cons // The negative values for left & down are due to SGCT's convention sgct::config::PlanarProjection projection; - projection.fov.right = fovH / 2.0; + projection.fov.right = static_cast(fovH / 2.0); projection.fov.left = -projection.fov.right; - projection.fov.up = fovV / 2.0; + projection.fov.up = static_cast(fovV / 2.0); projection.fov.down = -projection.fov.up; vp.projection = projection; break; @@ -951,11 +951,11 @@ void WindowControl::updateWindowCount(int newWindowCount) { void WindowControl::onSizeXChanged(int newValue) { _windowDimensions.setWidth(newValue); if (_aspectRatioLocked) { - const int updatedHeight = _windowDimensions.width() / _aspectRatioSize; + const double updatedHeight = _windowDimensions.width() / _aspectRatioSize; _sizeY->blockSignals(true); - _sizeY->setValue(updatedHeight); + _sizeY->setValue(static_cast(updatedHeight)); _sizeY->blockSignals(false); - _windowDimensions.setHeight(updatedHeight); + _windowDimensions.setHeight(static_cast(updatedHeight)); } emit windowChanged(_monitor->currentIndex(), _windowIndex, _windowDimensions); if (_fovLocked) { @@ -966,11 +966,11 @@ void WindowControl::onSizeXChanged(int newValue) { void WindowControl::onSizeYChanged(int newValue) { _windowDimensions.setHeight(newValue); if (_aspectRatioLocked) { - const int updatedWidth = _windowDimensions.height() * _aspectRatioSize; + const double updatedWidth = _windowDimensions.height() * _aspectRatioSize; _sizeX->blockSignals(true); - _sizeX->setValue(updatedWidth); + _sizeX->setValue(static_cast(updatedWidth)); _sizeX->blockSignals(false); - _windowDimensions.setWidth(updatedWidth); + _windowDimensions.setWidth(static_cast(updatedWidth)); } emit windowChanged(_monitor->currentIndex(), _windowIndex, _windowDimensions); if (_fovLocked) { @@ -979,14 +979,14 @@ void WindowControl::onSizeYChanged(int newValue) { } void WindowControl::onOffsetXChanged(int newValue) { - const float prevWidth = _windowDimensions.width(); + const int prevWidth = _windowDimensions.width(); _windowDimensions.setX(newValue); _windowDimensions.setWidth(prevWidth); emit windowChanged(_monitor->currentIndex(), _windowIndex, _windowDimensions); } void WindowControl::onOffsetYChanged(int newValue) { - const float prevHeight = _windowDimensions.height(); + const int prevHeight = _windowDimensions.height(); _windowDimensions.setY(newValue); _windowDimensions.setHeight(prevHeight); emit windowChanged(_monitor->currentIndex(), _windowIndex, _windowDimensions); diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index 020c3b2a90..42e20582b4 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit 020c3b2a90eb492fc80e7d9eb445825b83dca71b +Subproject commit 42e20582b4300d38fdcc94cc904f6961ed11e0ec diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index cd5aa8a720..e67e09c6bc 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -977,7 +977,7 @@ void setSgctDelegateFunctions() { sgctDelegate.nWindows = []() { ZoneScoped; - return static_cast(Engine::instance().windows().size()); + return Engine::instance().windows().size(); }; sgctDelegate.currentWindowId = []() { ZoneScoped; @@ -989,11 +989,10 @@ void setSgctDelegateFunctions() { return Engine::instance().windows().front()->id(); }; - sgctDelegate.nameForWindow = [](int windowIdx) { + sgctDelegate.nameForWindow = [](size_t windowIdx) { ZoneScoped; ghoul_assert( - windowIdx >= 0 && windowIdx < Engine::instance().windows().size(), "Invalid window index" ); @@ -1004,21 +1003,19 @@ void setSgctDelegateFunctions() { return glfwGetProcAddress(func); }; - sgctDelegate.horizFieldOfView = [](int windowIdx) { + sgctDelegate.horizFieldOfView = [](size_t windowIdx) { ZoneScoped; ghoul_assert( - windowIdx >= 0 && windowIdx < Engine::instance().windows().size(), "Invalid window index" ); return Engine::instance().windows()[windowIdx]->horizFieldOfViewDegrees(); }; - sgctDelegate.setHorizFieldOfView = [](int windowIdx, float hFovDeg) { + sgctDelegate.setHorizFieldOfView = [](size_t windowIdx, float hFovDeg) { ZoneScoped; ghoul_assert( - windowIdx >= 0 && windowIdx < Engine::instance().windows().size(), "Invalid window index" ); diff --git a/ext/ghoul b/ext/ghoul index bc84a731de..14918ca45f 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit bc84a731ded32e8a8472b589f5f508c4f2aebe05 +Subproject commit 14918ca45fe3f6b2ee3d90514d96241466b1e456 diff --git a/include/openspace/data/dataloader.h b/include/openspace/data/dataloader.h index 1641802767..c0f22cc7de 100644 --- a/include/openspace/data/dataloader.h +++ b/include/openspace/data/dataloader.h @@ -75,7 +75,7 @@ struct Dataset { int index(std::string_view variableName) const; bool normalizeVariable(std::string_view variableName); - glm::vec2 findValueRange(int variableIndex) const; + glm::vec2 findValueRange(size_t variableIndex) const; glm::vec2 findValueRange(std::string_view variableName) const; }; diff --git a/include/openspace/documentation/documentation.h b/include/openspace/documentation/documentation.h index e57e7ff262..a511febd2e 100644 --- a/include/openspace/documentation/documentation.h +++ b/include/openspace/documentation/documentation.h @@ -111,7 +111,7 @@ struct TestResult { * a specification violation. This class contains the TestResult that would have otherwise * be returned in a call to #testSpecification. */ -struct SpecificationError : public ghoul::RuntimeError { +struct SpecificationError final : public ghoul::RuntimeError { /** * Creates the SpecificationError exception instance. * diff --git a/include/openspace/documentation/verifier.h b/include/openspace/documentation/verifier.h index 7a02a2cf06..ce5610db4c 100644 --- a/include/openspace/documentation/verifier.h +++ b/include/openspace/documentation/verifier.h @@ -265,7 +265,7 @@ public: * value is not provided, any number (including 0) is allowed */ explicit TableVerifier(std::vector documentationEntries = {}, - std::optional nEntries = std::nullopt); + std::optional nEntries = std::nullopt); /** * Checks whether the \p key%'s value is a table (= ghoul::Dictionary) and (if @@ -288,7 +288,7 @@ public: /// The documentations passed in the constructor std::vector documentations; - std::optional count; + std::optional count; }; /** diff --git a/include/openspace/engine/windowdelegate.h b/include/openspace/engine/windowdelegate.h index b71809cd4f..131bdb50a6 100644 --- a/include/openspace/engine/windowdelegate.h +++ b/include/openspace/engine/windowdelegate.h @@ -94,17 +94,17 @@ struct WindowDelegate { void (*swapBuffer)() = []() {}; - int (*nWindows)() = []() { return 0; }; + size_t (*nWindows)() = []() { return size_t(0); }; int (*currentWindowId)() = []() { return 0; }; int (*firstWindowId)() = []() { return 0; }; - std::string (*nameForWindow)(int windowIdx) = [](int) { return std::string(); }; + std::string (*nameForWindow)(size_t windowIdx) = [](size_t) { return std::string(); }; - float (*horizFieldOfView)(int windowIdx) = [](int) { return 0.f; }; + float (*horizFieldOfView)(size_t windowIdx) = [](size_t) { return 0.f; }; - void (*setHorizFieldOfView)(int windowIdx, float hFovDeg) = [](int, float) {}; + void (*setHorizFieldOfView)(size_t windowIdx, float hFovDeg) = [](size_t, float) {}; void* (*getNativeWindowHandle)(size_t windowIndex) = [](size_t) -> void* { return nullptr; diff --git a/include/openspace/interaction/sessionrecording.h b/include/openspace/interaction/sessionrecording.h index 4603fc2c55..2eee114608 100644 --- a/include/openspace/interaction/sessionrecording.h +++ b/include/openspace/interaction/sessionrecording.h @@ -42,17 +42,17 @@ enum class DataMode { struct SessionRecording { struct Entry { - auto operator<=>(const SessionRecording::Entry&) const = default; - using Camera = KeyframeNavigator::CameraPose; using Script = std::string; + bool operator==(const Entry&) const noexcept = default; + double timestamp = 0.0; double simulationTime = 0.0; std::variant value; }; - auto operator<=>(const SessionRecording&) const = default; + bool operator==(const SessionRecording&) const noexcept = default; std::vector entries; diff --git a/include/openspace/interaction/sessionrecordinghandler.h b/include/openspace/interaction/sessionrecordinghandler.h index a3cc99fba9..1e2114a21d 100644 --- a/include/openspace/interaction/sessionrecordinghandler.h +++ b/include/openspace/interaction/sessionrecordinghandler.h @@ -96,8 +96,6 @@ public: * Starts a recording session, which will save data to the provided filename according * to the data format specified, and will continue until recording is stopped using * stopRecording() method. - * - * \return `true` if recording to file starts without errors */ void startRecording(); @@ -119,16 +117,16 @@ public: /** * Starts a playback session, which can run in one of three different time modes. * - * \param filename File containing recorded keyframes to play back. The file path is - * relative to the base recordings directory specified in the config - * file by the RECORDINGS variable - * \param timeMode Which of the 3 time modes to use for time reference during + * \param timeline The session recording timeline that should be played back * \param loop If true then the file will playback in loop mode, continuously looping * back to the beginning until it is manually stopped * \param shouldWaitForFinishedTiles If true, the playback will wait for tiles to be * finished before progressing to the next frame. This value is only used when * `enableTakeScreenShotDuringPlayback` was called before. Otherwise this value * will be ignored + * \param saveScreenshotFps If this value is specified, screenshots will be taken at + * the provided framerate. If the value is not specified, no screenshots will + * be taken */ void startPlayback(SessionRecording timeline, bool loop, bool shouldWaitForFinishedTiles, std::optional saveScreenshotFps); @@ -214,7 +212,7 @@ public: /** * Removes the callback for notification of playback state change. * - * \param callback Function handle for the callback + * \param handle Function handle for the callback */ void removeStateChangeCallback(CallbackHandle handle); diff --git a/include/openspace/navigation/keyframenavigator.h b/include/openspace/navigation/keyframenavigator.h index fd979f5a83..dd946f3125 100644 --- a/include/openspace/navigation/keyframenavigator.h +++ b/include/openspace/navigation/keyframenavigator.h @@ -49,15 +49,15 @@ public: BooleanType(Inclusive); struct CameraPose { + CameraPose() = default; + CameraPose(datamessagestructures::CameraKeyframe&& kf); + bool operator==(const CameraPose&) const noexcept = default; + glm::dvec3 position = glm::dvec3(0.0); glm::quat rotation = glm::quat(0.f, 0.f, 0.f, 0.f); std::string focusNode; float scale = 1.f; bool followFocusNodeRotation = false; - - CameraPose() = default; - CameraPose(datamessagestructures::CameraKeyframe&& kf); - auto operator<=>(const CameraPose&) const = default; }; /** @@ -67,9 +67,9 @@ public: * * \param camera A reference to the camera object to have its pose updated * \param ignoreFutureKeyframes `true` if only past keyframes are to be used - * \return true only if a new future keyframe is available to set camera pose */ void updateCamera(Camera& camera, bool ignoreFutureKeyframes); + static void updateCamera(Camera* camera, const CameraPose& prevPose, const CameraPose& nextPose, double t, bool ignoreFutureKeyframes); diff --git a/include/openspace/navigation/pathcurve.h b/include/openspace/navigation/pathcurve.h index f379f24304..3b5e312b2f 100644 --- a/include/openspace/navigation/pathcurve.h +++ b/include/openspace/navigation/pathcurve.h @@ -35,11 +35,11 @@ class Waypoint; class PathCurve { public: - struct InsufficientPrecisionError : public ghoul::RuntimeError { + struct InsufficientPrecisionError final : public ghoul::RuntimeError { explicit InsufficientPrecisionError(std::string error); }; - struct TooShortPathError : public ghoul::RuntimeError { + struct TooShortPathError final : public ghoul::RuntimeError { explicit TooShortPathError(std::string error); }; diff --git a/include/openspace/network/messagestructures.h b/include/openspace/network/messagestructures.h index 408114e528..f763dbc994 100644 --- a/include/openspace/network/messagestructures.h +++ b/include/openspace/network/messagestructures.h @@ -381,10 +381,6 @@ struct TimeTimeline { struct ScriptMessage { ScriptMessage() = default; - ScriptMessage(const std::vector& buffer) { - deserialize(buffer); - } - virtual ~ScriptMessage() {} std::string _script; double _timestamp = 0.0; @@ -444,8 +440,8 @@ struct ScriptMessage { ss << _script; } - virtual void read(std::istream* in) { - uint32_t strLen; + void read(std::istream* in) { + uint32_t strLen = 0; //Read string length from file in->read(reinterpret_cast(&strLen), sizeof(strLen)); //Read back full string diff --git a/include/openspace/network/parallelconnection.h b/include/openspace/network/parallelconnection.h index 14637306b0..1eebac617c 100644 --- a/include/openspace/network/parallelconnection.h +++ b/include/openspace/network/parallelconnection.h @@ -68,7 +68,7 @@ public: std::vector content; }; - class ConnectionLostError : public ghoul::RuntimeError { + class ConnectionLostError final : public ghoul::RuntimeError { public: explicit ConnectionLostError(bool shouldLogError_ = true); diff --git a/include/openspace/properties/property.h b/include/openspace/properties/property.h index 76b16cf5cd..54c646f3e9 100644 --- a/include/openspace/properties/property.h +++ b/include/openspace/properties/property.h @@ -97,21 +97,21 @@ public: * argument for the struct initialization. */ constexpr PropertyInfo(const char* ident, const char* gui, const char* desc, - NeedsConfirmation needsConfirmation = NeedsConfirmation::No) + NeedsConfirmation needsConfirmation_ = NeedsConfirmation::No) : identifier(ident) , guiName(gui) , description(desc) - , needsConfirmation(needsConfirmation) + , needsConfirmation(needsConfirmation_) {} constexpr PropertyInfo(const char* ident, const char* gui, const char* desc, Visibility vis, - NeedsConfirmation needsConfirmation = NeedsConfirmation::No) + NeedsConfirmation needsConfirmation_ = NeedsConfirmation::No) : identifier(ident) , guiName(gui) , description(desc) , visibility(vis) - , needsConfirmation(needsConfirmation) + , needsConfirmation(needsConfirmation_) {} /// The unique identifier that is part of the fully qualified URI of this Property @@ -170,6 +170,8 @@ public: */ virtual ~Property(); + Property(Property&&) noexcept = default; + /** * This method returns the class name of the Property. The method is used by the * TemplateFactory to create new instances of Propertys. The returned value is almost @@ -195,7 +197,6 @@ public: * no-op. * * \param state The Lua state to which the value will be encoded - * \return `true` if the encoding succeeded, `false` otherwise */ virtual void getLuaValue(lua_State* state) const = 0; diff --git a/include/openspace/properties/propertyowner.h b/include/openspace/properties/propertyowner.h index bc34bfdea7..77d4e6bdd9 100644 --- a/include/openspace/properties/propertyowner.h +++ b/include/openspace/properties/propertyowner.h @@ -67,7 +67,7 @@ public: * \pre The \p info 's #PropertyOwnerInfo::identifier must not contain any whitespaces * \pre The \p info 's #PropertyOwnerInfo::identifier must not contain any `.` */ - PropertyOwner(PropertyOwnerInfo info); + explicit PropertyOwner(PropertyOwnerInfo info); /** * The destructor will remove all Propertys and PropertyOwners it owns along with diff --git a/include/openspace/rendering/colormappingcomponent.h b/include/openspace/rendering/colormappingcomponent.h index 0a08bf2fa4..456309be56 100644 --- a/include/openspace/rendering/colormappingcomponent.h +++ b/include/openspace/rendering/colormappingcomponent.h @@ -46,9 +46,9 @@ namespace documentation { struct Documentation; } * like the color map file itself (converted to a texture), colors to use for missing * values and the available data columns and value ranges. * - * @TODO Also provide a small shader snippet that can be included in fragment shaders - * that use this color mapping. As well as a set of uniforms? Now every - * renderable needs to handle this separately. (emmbr, 2023-10-13) + * \todo Also provide a small shader snippet that can be included in fragment shaders that + * use this color mapping. As well as a set of uniforms? Now every renderable needs to + * handle this separately. (emmbr, 2023-10-13) */ class ColorMappingComponent : public properties::PropertyOwner { public: diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index 579dd5b9e8..d1e2ceb207 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -206,7 +206,7 @@ private: std::chrono::high_resolution_clock::time_point _lastFrameTime; struct Window : properties::PropertyOwner { - Window(PropertyOwnerInfo info, int id); + Window(PropertyOwnerInfo info, size_t id); properties::FloatProperty horizFieldOfView; }; diff --git a/include/openspace/scene/profile.h b/include/openspace/scene/profile.h index 6fc9c2af8a..df2d79baf8 100644 --- a/include/openspace/scene/profile.h +++ b/include/openspace/scene/profile.h @@ -43,7 +43,7 @@ namespace scripting { struct LuaLibrary; } class Profile { public: - struct ParsingError : public ghoul::RuntimeError { + struct ParsingError final : public ghoul::RuntimeError { enum class Severity { Info, Warning, Error }; ParsingError(Severity severity_, std::string msg); @@ -56,14 +56,14 @@ public: int major = 0; int minor = 0; - auto operator<=>(const Version&) const = default; + bool operator==(const Version&) const noexcept = default; }; struct Module { std::string name; std::optional loadedInstruction; std::optional notLoadedInstruction; - auto operator<=>(const Module&) const = default; + bool operator==(const Module&) const noexcept = default; }; struct Meta { std::optional name; @@ -73,7 +73,7 @@ public: std::optional url; std::optional license; - auto operator<=>(const Meta&) const = default; + bool operator==(const Meta&) const noexcept = default; }; struct Property { @@ -86,7 +86,7 @@ public: std::string name; std::string value; - auto operator<=>(const Property&) const = default; + bool operator==(const Property&) const noexcept = default; }; struct Action { @@ -97,14 +97,14 @@ public: bool isLocal = false; std::string script; - auto operator<=>(const Action&) const = default; + bool operator==(const Action&) const = default; }; struct Keybinding { KeyWithModifier key; std::string action; - auto operator<=>(const Keybinding&) const = default; + bool operator==(const Keybinding&) const noexcept = default; }; struct Time { @@ -117,7 +117,7 @@ public: std::string value; bool startPaused = false; - auto operator<=>(const Time&) const = default; + bool operator==(const Time&) const noexcept = default; }; struct CameraGoToNode { @@ -126,7 +126,7 @@ public: std::string anchor; std::optional height; - auto operator<=>(const CameraGoToNode&) const = default; + bool operator==(const CameraGoToNode&) const noexcept = default; }; struct CameraNavState { @@ -140,7 +140,7 @@ public: std::optional yaw; std::optional pitch; - auto operator<=>(const CameraNavState&) const = default; + bool operator==(const CameraNavState&) const noexcept = default; }; struct CameraGoToGeo { @@ -151,7 +151,7 @@ public: double longitude = 0.0; std::optional altitude; - auto operator<=>(const CameraGoToGeo&) const = default; + bool operator==(const CameraGoToGeo&) const noexcept = default; }; using CameraType = std::variant; @@ -160,7 +160,7 @@ public: explicit Profile(const std::filesystem::path& path); std::string serialize() const; - auto operator<=>(const Profile&) const = default; + bool operator==(const Profile&) const noexcept = default; /** * Saves all current settings, starting from the profile that was loaded at startup, diff --git a/include/openspace/util/coordinateconversion.h b/include/openspace/util/coordinateconversion.h index 59749abc37..42b557dbee 100644 --- a/include/openspace/util/coordinateconversion.h +++ b/include/openspace/util/coordinateconversion.h @@ -54,7 +54,9 @@ glm::dvec2 icrsToDecimalDegrees(const std::string& ra, const std::string& dec); * Converts from galactic cartesian coordinates to ICRS decimal degrees coordinates * and distance. * - * \param x, y, z X, Y, and Z coordinates + * \param x The x coordinate + * \param y The y coordinate + * \param z The z coordinate * \return A vector with the ra and dec decimal degrees in degrees and distance */ glm::dvec3 galacticCartesianToIcrs(double x, double y, double z); diff --git a/include/openspace/util/factorymanager.h b/include/openspace/util/factorymanager.h index dde02993eb..71a97266ff 100644 --- a/include/openspace/util/factorymanager.h +++ b/include/openspace/util/factorymanager.h @@ -47,7 +47,7 @@ public: * This exception is thrown if the ghoul::TemplateFactory could not be found in the * #factory method. */ - struct FactoryNotFoundError : public ghoul::RuntimeError { + struct FactoryNotFoundError final : public ghoul::RuntimeError { /** * Constructor for FactoryNotFoundError, the \p type is a human-readable (-ish) * type descriptor for the type `T` for the TemplateFactory that could @@ -99,7 +99,7 @@ public: /** * Adds the passed \p factory to the FactoryManager. Factories may only be added once. * - * \tparam Factory The type for which a factory should be created and added + * \tparam T The type for which a factory should be created and added * \param name A user-readable name for the registered factory * * \pre \p name must not be empty diff --git a/include/openspace/util/spicemanager.h b/include/openspace/util/spicemanager.h index 69c1197fbc..3128e5c4c4 100644 --- a/include/openspace/util/spicemanager.h +++ b/include/openspace/util/spicemanager.h @@ -69,7 +69,7 @@ public: using TransformMatrix = std::array; using KernelHandle = unsigned int; - struct SpiceException : public ghoul::RuntimeError { + struct SpiceException final : public ghoul::RuntimeError { explicit SpiceException(std::string msg); }; diff --git a/include/openspace/util/timerange.h b/include/openspace/util/timerange.h index a742f17e2e..b909edef79 100644 --- a/include/openspace/util/timerange.h +++ b/include/openspace/util/timerange.h @@ -46,7 +46,7 @@ struct TimeRange { TimeRange(double startTime, double endTime); /** - * Throws exception if unable to parse the provided \class ghoul::Dictionary. + * Throws exception if unable to parse the provided ghoul::Dictionary. */ explicit TimeRange(const ghoul::Dictionary& dict); diff --git a/modules/audio/CMakeLists.txt b/modules/audio/CMakeLists.txt index 5548bd9403..93cc01e6b0 100644 --- a/modules/audio/CMakeLists.txt +++ b/modules/audio/CMakeLists.txt @@ -56,5 +56,12 @@ add_subdirectory(ext/soloud/contrib SYSTEM) # Unfortunately, the soloud cmake tarket doesn't set the include directories correctly target_include_directories(openspace-module-audio SYSTEM PRIVATE ext/soloud/include) target_link_libraries(openspace-module-audio PRIVATE soloud) + +if (MSVC) + target_compile_options(soloud PRIVATE "/W0") +else () + target_compile_options(soloud PRIVATE "-w") +endif () + set_property(TARGET soloud PROPERTY FOLDER "External") end_dependency("SoLoud") diff --git a/modules/audio/audiomodule_lua.inl b/modules/audio/audiomodule_lua.inl index ea98bbaad1..2f54c348c1 100644 --- a/modules/audio/audiomodule_lua.inl +++ b/modules/audio/audiomodule_lua.inl @@ -36,8 +36,8 @@ namespace { * * \param path The audio file that should be played * \param identifier The name for the sound that is used to refer to the sound - * \param loop If `Yes` then the song will be played in a loop until the program is closed - * or the playing is stopped through the #stopAudio function + * \param shouldLoop If `Yes` then the song will be played in a loop until the program is + * closed or the playing is stopped through the #stopAudio function */ [[codegen::luawrap]] void playAudio(std::filesystem::path path, std::string identifier, bool shouldLoop = true) @@ -64,8 +64,8 @@ namespace { * \param path The audio file that should be played * \param identifier The name for the sound that is used to refer to the sound * \param position The position of the audio file in the 3D environment - * \param loop If `Yes` then the song will be played in a loop until the program is closed - * or the playing is stopped through the #stopAudio function + * \param shouldLoop If `Yes` then the song will be played in a loop until the program is + * closed or the playing is stopped through the #stopAudio function */ [[codegen::luawrap]] void playAudio3d(std::filesystem::path path, std::string identifier, glm::vec3 position, bool shouldLoop = true) @@ -193,8 +193,8 @@ namespace { * through the #playAudio or #playAudio3d functions. * * \param identifier The identifier to the track that should be stopped - * \param loop If `Yes` then the song will be played in a loop until the program is closed - * or the playing is stopped through the #stopAudio function + * \param shouldLoop If `Yes` then the song will be played in a loop until the program is + * closed or the playing is stopped through the #stopAudio function */ [[codegen::luawrap]] void setLooping(std::string identifier, bool shouldLoop) { using namespace openspace; @@ -223,7 +223,7 @@ namespace { * controls whether the volume change should be immediately (if it is 0) or over how many * seconds it should change. The default is for it to change over 500 ms. * - * \param handle The handle to the track whose volume should be changed + * \param identifier The identifier to the track whose volume should be changed * \param volume The new volume level. Must be greater or equal to 0 * \param fade How much time the fade from the current volume to the new volume should * take @@ -239,6 +239,7 @@ namespace { * Returns the volume for the track referred to by the \p handle. The number returned will * be greater or equal to 0. * + * \param identifier The identifier to the track whose volume should be returned * \return The volume for the track referred to by the \p handle, which will be * greater or equal to 0 */ @@ -253,7 +254,8 @@ namespace { * \p identifier must be a name for a sound that was started through the #playAudio3d * function. * - * \param handle A valid handle for a track started through the #playAudio3d function + * \param identifier A valid identifier for a track started through the #playAudio3d + * function * \param position The new position from which the track originates */ [[codegen::luawrap]] void set3dSourcePosition(std::string identifier, @@ -336,18 +338,20 @@ namespace { * \param channel The channel whose speaker's position should be changed * \param position The new position for the speaker */ -[[codegen::luawrap]] void setSpeakerPosition(int handle, glm::vec3 position) { +[[codegen::luawrap]] void setSpeakerPosition(int channel, glm::vec3 position) { using namespace openspace; - global::moduleEngine->module()->setSpeakerPosition(handle, position); + global::moduleEngine->module()->setSpeakerPosition(channel, position); } /** * Returns the position for the speaker of the provided \p channel. + * + * \param channel The channel for which the position should be returned * \return The position for the speaker of the provided \p channel */ -[[codegen::luawrap]] glm::vec3 speakerPosition(int handle) { +[[codegen::luawrap]] glm::vec3 speakerPosition(int channel) { using namespace openspace; - return global::moduleEngine->module()->speakerPosition(handle); + return global::moduleEngine->module()->speakerPosition(channel); } #include "audiomodule_lua_codegen.cpp" diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index f32b187f54..6f0c8fa8d9 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -831,7 +831,7 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) { case ColorAddingBlending: glBlendFunc(GL_SRC_COLOR, GL_DST_COLOR); break; - }; + } if (!_enableDepthTest) { glDisable(GL_DEPTH_TEST); diff --git a/modules/base/rendering/renderablenodearrow.cpp b/modules/base/rendering/renderablenodearrow.cpp index 6393a8fe94..246b8effa5 100644 --- a/modules/base/rendering/renderablenodearrow.cpp +++ b/modules/base/rendering/renderablenodearrow.cpp @@ -449,7 +449,7 @@ void RenderableNodeArrow::updateShapeTransforms(const RenderData& data) { // Create transformation matrices to reshape to size and position _cylinderTranslation = glm::translate(glm::dmat4(1.0), startPos); const glm::dvec3 cylinderScale = glm::dvec3( - s * glm::dvec4(_width, _width, cylinderLength, 0.0) + s * glm::dvec4(_width.value(), _width.value(), cylinderLength, 0.0) ); _cylinderScale = glm::scale(glm::dmat4(1.0), cylinderScale); diff --git a/modules/base/rendering/renderableplaneimagelocal.cpp b/modules/base/rendering/renderableplaneimagelocal.cpp index ea19d5c5d7..e888be7d61 100644 --- a/modules/base/rendering/renderableplaneimagelocal.cpp +++ b/modules/base/rendering/renderableplaneimagelocal.cpp @@ -160,7 +160,7 @@ void RenderablePlaneImageLocal::loadTexture() { _texture = BaseModule::TextureManager.request( std::to_string(hash), - [path = _texturePath]() -> std::unique_ptr { + [path = _texturePath.value()]() -> std::unique_ptr { std::unique_ptr texture = ghoul::io::TextureReader::ref().loadTexture(absPath(path), 2); diff --git a/modules/base/rendering/renderablesphere.cpp b/modules/base/rendering/renderablesphere.cpp index 479246258b..55fd09d239 100644 --- a/modules/base/rendering/renderablesphere.cpp +++ b/modules/base/rendering/renderablesphere.cpp @@ -466,7 +466,7 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) { case ColorAddingBlending: glBlendFunc(GL_SRC_COLOR, GL_DST_COLOR); break; - }; + } if (_disableDepth) { glDepthMask(GL_FALSE); diff --git a/modules/base/rendering/renderabletrailorbit.cpp b/modules/base/rendering/renderabletrailorbit.cpp index 7b3c9e3a5b..87f7e77aff 100644 --- a/modules/base/rendering/renderabletrailorbit.cpp +++ b/modules/base/rendering/renderabletrailorbit.cpp @@ -351,12 +351,12 @@ RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails( // If we would need to generate more new points than there are total points in the // array, it is faster to regenerate the entire array - if (nNewPoints >= _resolution) { + if (nNewPoints >= static_cast(_resolution)) { fullSweep(data.time.j2000Seconds()); return { false, true, UpdateReport::All }; } - for (int i = 0; i < nNewPoints; i++) { + for (uint64_t i = 0; i < nNewPoints; i++) { _lastPointTime += secondsPerPoint; // Get the new permanent point and write it into the (previously) floating diff --git a/modules/base/rendering/screenspaceinsetblackout.cpp b/modules/base/rendering/screenspaceinsetblackout.cpp index 583dc15236..5553d2d61d 100644 --- a/modules/base/rendering/screenspaceinsetblackout.cpp +++ b/modules/base/rendering/screenspaceinsetblackout.cpp @@ -40,7 +40,7 @@ namespace { constexpr glm::uvec2 BlackoutTextureSize = glm::uvec2(3840, 2160); - void checkCornerSpecification(std::vector corners) { + void checkCornerSpecification(const std::vector& corners) { if (corners.size() != 4) { openspace::documentation::TestResult res; res.success = false; @@ -78,13 +78,14 @@ namespace { for (int i = 0; i < numberOfSegments; i++) { for (int s = 0; s < Subdivisions; s++) { float tValue = stepSize * s; - splineData.push_back(ghoul::interpolateCatmullRom( + glm::vec2 value = ghoul::interpolateCatmullRom( tValue, *(controlPoints.begin() + i + 0), *(controlPoints.begin() + i + 1), *(controlPoints.begin() + i + 2), *(controlPoints.begin() + i + 3) - )); + ); + splineData.push_back(std::move(value)); } } return splineData; @@ -97,14 +98,13 @@ namespace { } } - std::string formatLine(std::string id, const std::vector& data) - { + std::string formatLine(std::string_view id, const std::vector& data) { if (data.empty()) { return ""; } std::string str = std::format("{} = {{ ", id); - for (int i = 0; i < data.size(); ++i) { + for (size_t i = 0; i < data.size(); ++i) { std::string xVal = std::format("{}", data[i].x); std::string yVal = std::format("{}", data[i].y); xVal += (xVal.find(".") == std::string::npos) ? ".0" : ""; @@ -294,7 +294,7 @@ ScreenSpaceInsetBlackout::BlackoutShape::Spline::Spline(std::vector& base = baseString; // Generate all Point objects and add them to GUI - for (int i = 0; i < data.size(); i++) { + for (size_t i = 0; i < data.size(); i++) { points.push_back(std::make_unique( data[i], std::format("Point{}Position", i), @@ -317,8 +317,8 @@ ScreenSpaceInsetBlackout::BlackoutShape::Spline::Spline(std::vector& addProperty(addButton); // Add options used when inserting a new point - for (int i = 0; i < points.size() + 1; i++) { - addSelector.addOption(i, std::format("At position #{}", i + 1)); + for (size_t i = 0; i < points.size() + 1; i++) { + addSelector.addOption(static_cast(i), std::format("At position #{}", i + 1)); } // Only add controls for removing a point if there are any points that can be removed @@ -329,8 +329,11 @@ ScreenSpaceInsetBlackout::BlackoutShape::Spline::Spline(std::vector& }); addProperty(removeSelector); addProperty(removeButton); - for (int i = 0; i < points.size(); i++) { - removeSelector.addOption(i, std::format("Point #{}", i + 1)); + for (size_t i = 0; i < points.size(); i++) { + removeSelector.addOption( + static_cast(i), + std::format("Point #{}", i + 1) + ); } } } @@ -475,7 +478,7 @@ void ScreenSpaceInsetBlackout::BlackoutShape::checkAndUpdateGUI() { // Remove GUI elements so that we can add them in correct order again if (updatePropertyTree) { std::vector subs = propertySubOwners(); - for (int i = 0; i < subs.size(); i++) { + for (size_t i = 0; i < subs.size(); i++) { removePropertySubOwner(subs[i]); } addPropertySubOwner(*corners); diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.cpp b/modules/digitaluniverse/rendering/renderabledumeshes.cpp index 57a3f82dc3..fdefdbb6ca 100644 --- a/modules/digitaluniverse/rendering/renderabledumeshes.cpp +++ b/modules/digitaluniverse/rendering/renderabledumeshes.cpp @@ -377,7 +377,7 @@ void RenderableDUMeshes::renderLabels(const RenderData& data, .cameraLookUp = data.camera.lookUpVectorWorldSpace() }; - const glm::vec4 textColor = glm::vec4(glm::vec3(_textColor), _textOpacity); + const glm::vec4 textColor = glm::vec4(glm::vec3(_textColor), _textOpacity.value()); for (const dataloader::Labelset::Entry& e : _labelset.entries) { glm::vec3 scaledPos(e.position); diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp index d38ca7ea2c..12b327e4f9 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp @@ -601,7 +601,9 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence( if (p.colorTableRanges.has_value()) { _colorTableRanges = *p.colorTableRanges; - if (_colorTableRanges.size() > _colorQuantityTemp && _colorQuantityTemp >= 0) { + if (_colorQuantityTemp < static_cast(_colorTableRanges.size()) && + _colorQuantityTemp >= 0) + { _selectedColorRange = _colorTableRanges[_colorQuantityTemp]; } else { @@ -639,7 +641,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence( // Note that we do not need to set _selectedColorRange in the constructor, due to // this onChange being declared before firstupdate() function that sets // _colorQuantity. - if (_colorTableRanges.size() > _colorQuantity) { + if (_colorQuantity < static_cast(_colorTableRanges.size())) { _selectedColorRange = _colorTableRanges[_colorQuantity]; } // If fewer data ranges are given than there are parameters in the data, use the @@ -650,7 +652,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence( _selectedColorRange = _colorTableRanges[0]; } - if (_colorTablePaths.size() > _colorQuantity) { + if (_colorQuantity < static_cast(_colorTablePaths.size())) { _colorTablePath = _colorTablePaths[_colorQuantity].string(); } else { @@ -660,7 +662,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence( // This is to save the changes done in the gui for when you switch between options _selectedColorRange.onChange([this]() { - if (_colorTableRanges.size() > _colorQuantity) { + if (_colorQuantity < static_cast(_colorTableRanges.size())) { _colorTableRanges[_colorQuantity] = _selectedColorRange; } }); @@ -680,7 +682,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence( _maskingQuantity.onChange([this]() { _shouldUpdateMaskingBuffer = true; - if (_maskingRanges.size() > _maskingQuantity) { + if (_maskingQuantity < static_cast(_maskingRanges.size())) { _selectedMaskingRange = _maskingRanges[_maskingQuantity]; } else if (!_maskingRanges.empty()) { @@ -692,7 +694,7 @@ RenderableFieldlinesSequence::RenderableFieldlinesSequence( }); _selectedMaskingRange.onChange([this]() { - if (_maskingRanges.size() > _maskingQuantity) { + if (_maskingQuantity < static_cast(_maskingRanges.size())) { _maskingRanges[_maskingQuantity] = _selectedMaskingRange; } }); @@ -1034,14 +1036,14 @@ void RenderableFieldlinesSequence::firstUpdate() { const std::vector& extraNamesVec = file->state.extraQuantityNames(); - for (int i = 0; i < quantities.size(); ++i) { - _colorQuantity.addOption(i, extraNamesVec[i]); - _maskingQuantity.addOption(i, extraNamesVec[i]); + for (size_t i = 0; i < quantities.size(); ++i) { + _colorQuantity.addOption(static_cast(i), extraNamesVec[i]); + _maskingQuantity.addOption(static_cast(i), extraNamesVec[i]); } _colorQuantity = _colorQuantityTemp; _maskingQuantity = _maskingQuantityTemp; - if (_colorTablePaths.size() > _colorQuantity) { + if (_colorQuantity < static_cast(_colorTablePaths.size())) { _colorTablePath = _colorTablePaths[_colorQuantity].string(); } else { @@ -1106,7 +1108,8 @@ void RenderableFieldlinesSequence::update(const UpdateData& data) { currentTime < _files[_activeIndex].timestamp || // if currentTime >= next timestamp, it means that we stepped forward to a // time represented by another state - (nextIndex < _files.size() && currentTime >= _files[nextIndex].timestamp) || + (nextIndex < static_cast(_files.size()) && + currentTime >= _files[nextIndex].timestamp) || // The case when we jumped passed last file. where nextIndex is not < file.size() currentTime >= _files[_activeIndex].timestamp) { diff --git a/modules/fieldlinessequence/util/fieldlinesstate.cpp b/modules/fieldlinessequence/util/fieldlinesstate.cpp index b3a4870e33..094f8a09bf 100644 --- a/modules/fieldlinessequence/util/fieldlinesstate.cpp +++ b/modules/fieldlinessequence/util/fieldlinesstate.cpp @@ -50,9 +50,12 @@ void FieldlinesState::convertLatLonToCartesian(float scale) { const float r = p.x * scale; const float lat = glm::radians(p.y); const float lon = glm::radians(p.z); - const float rCosLat = r * cos(lat); - p = glm::vec3(rCosLat * cos(lon), rCosLat* sin(lon), r * sin(lat)); + p = glm::vec3( + r * std::cos(lat) * std::cos(lon), + r * std::cos(lat) * std::sin(lon), + r * std::sin(lat) + ); } } @@ -418,10 +421,6 @@ void FieldlinesState::setTriggerTime(double t) { // If index is out of scope an empty vector is returned and the referenced bool is false. std::vector FieldlinesState::extraQuantity(size_t index, bool& isSuccessful) const { - if (index == -1) { - isSuccessful = false; - return std::vector(); - } if (index < _extraQuantities.size()) { isSuccessful = true; return _extraQuantities[index]; diff --git a/modules/fitsfilereader/ext/CCfits b/modules/fitsfilereader/ext/CCfits index d9f9811b3e..3e3ca65a67 160000 --- a/modules/fitsfilereader/ext/CCfits +++ b/modules/fitsfilereader/ext/CCfits @@ -1 +1 @@ -Subproject commit d9f9811b3ef639d4d185385dc9b6cefe7f722c59 +Subproject commit 3e3ca65a670818f0e2acd63da125a389e913291b diff --git a/modules/fitsfilereader/include/fitsfilereader.h b/modules/fitsfilereader/include/fitsfilereader.h index ad486fbbb6..613bd900ca 100644 --- a/modules/fitsfilereader/include/fitsfilereader.h +++ b/modules/fitsfilereader/include/fitsfilereader.h @@ -114,6 +114,9 @@ private: mutable std::mutex _mutex; }; +extern template std::shared_ptr> FitsFileReader::readTable( + const std::filesystem::path&, const std::vector&, int, int, int, bool); + } // namespace openspace #endif // __OPENSPACE_MODULE_FITSFILEREADER___FITSFILEREADER___H__ diff --git a/modules/fitsfilereader/include/renderabletimevaryingfitssphere.h b/modules/fitsfilereader/include/renderabletimevaryingfitssphere.h index 9edfca0c6b..dbe899896a 100644 --- a/modules/fitsfilereader/include/renderabletimevaryingfitssphere.h +++ b/modules/fitsfilereader/include/renderabletimevaryingfitssphere.h @@ -109,7 +109,6 @@ private: bool _renderForever = true; bool _inInterval = false; - bool _isLoadingStateFromDisk = false; // DynamicFileSequenceDownloader downloads and updates the renderable with // data downloaded from the web std::unique_ptr _dynamicFileDownloader; diff --git a/modules/fitsfilereader/src/fitsfilereader.cpp b/modules/fitsfilereader/src/fitsfilereader.cpp index a3aeb79c91..799d991122 100644 --- a/modules/fitsfilereader/src/fitsfilereader.cpp +++ b/modules/fitsfilereader/src/fitsfilereader.cpp @@ -185,7 +185,7 @@ std::shared_ptr> FitsFileReader::readTable(const std::filesystem::p return std::make_shared>(std::move(loadedTable)); } } - catch (FitsException& e) { + catch (const FitsException& e) { LERROR(std::format( "Could not read FITS table from file '{}'. Make sure it's not an image file", e.message() @@ -693,4 +693,7 @@ std::shared_ptr> FitsFileReader::readImageInternal(PHDU& image) { return nullptr; } +template std::shared_ptr> FitsFileReader::readTable( + const std::filesystem::path&, const std::vector&, int, int, int, bool); + } // namespace openspace diff --git a/modules/fitsfilereader/src/renderabletimevaryingfitssphere.cpp b/modules/fitsfilereader/src/renderabletimevaryingfitssphere.cpp index 45247dd6f9..4874e1721b 100644 --- a/modules/fitsfilereader/src/renderabletimevaryingfitssphere.cpp +++ b/modules/fitsfilereader/src/renderabletimevaryingfitssphere.cpp @@ -626,7 +626,7 @@ void RenderableTimeVaryingFitsSphere::updateDynamicDownloading(double currentTim if (isInInterval && _activeTriggerTimeIndex != -1 && - _activeTriggerTimeIndex < _files.size()) + _activeTriggerTimeIndex < static_cast(_files.size())) { _firstUpdate = false; loadTexture(); diff --git a/modules/fitsfilereader/src/wsafitshelper.cpp b/modules/fitsfilereader/src/wsafitshelper.cpp index c7f334cd67..492484901d 100644 --- a/modules/fitsfilereader/src/wsafitshelper.cpp +++ b/modules/fitsfilereader/src/wsafitshelper.cpp @@ -43,7 +43,7 @@ std::unique_ptr loadTextureFromFits( std::unique_ptr file = std::make_unique(path.string(), Read, true); if (!file.get()) { LERROR(std::format( - "Failed to open, therefor removing file {}", path.string() + "Failed to open, therefore removing file {}", path.string() )); std::filesystem::remove(path); return nullptr; @@ -51,20 +51,28 @@ std::unique_ptr loadTextureFromFits( // Convert fits path with fits-file-reader functions const std::shared_ptr> fitsValues = readImageInternal(file->pHDU()); - int layerSize = fitsValues->width * fitsValues->height; + const int layerSize = fitsValues->width * fitsValues->height; - int nLayers = static_cast(fitsValues->contents.size()) / layerSize; - if (layerIndex > nLayers -1) { + const int nLayers = static_cast(fitsValues->contents.size()) / layerSize; + if (static_cast(layerIndex) >= nLayers) { LERROR( "Chosen layer in fits file is not supported. Index too high. " "First layer chosen instead" ); layerIndex = 0; + return nullptr; } std::valarray layerValues = fitsValues->contents[std::slice(layerIndex*layerSize, layerSize, 1)]; + if (layerValues.size() == 0) { + LERROR(std::format( + "Failed to load {} as no layers were available", path.string() + )); + return nullptr; + } + float* imageData = new float[layerValues.size()]; std::vector rgbLayers; for (size_t i = 0; i < layerValues.size(); i++) { diff --git a/modules/gaia/rendering/renderablegaiastars.cpp b/modules/gaia/rendering/renderablegaiastars.cpp index ecbb04f9b7..9284921129 100644 --- a/modules/gaia/rendering/renderablegaiastars.cpp +++ b/modules/gaia/rendering/renderablegaiastars.cpp @@ -1013,7 +1013,7 @@ void RenderableGaiaStars::render(const RenderData& data, RendererTasks&) { // Update vector with accumulated indices. for (const auto& [offset, subData] : updateData) { - if (offset >= _accumulatedIndices.size() - 1) { + if (offset >= static_cast(_accumulatedIndices.size()) - 1) { // @TODO(2023-03-08, alebo) We want to redo the whole rendering pipeline // anyway, so right now we just bail out early if we get an invalid index // that would trigger a crash diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index b3bc627443..11fbeff462 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -179,6 +179,12 @@ begin_dependency("GEOS") add_subdirectory(ext/geos SYSTEM) target_link_libraries(openspace-module-globebrowsing PRIVATE geos) +if (MSVC) + target_compile_options(geos PRIVATE "/W0") +else () + target_compile_options(geos PRIVATE "-w") +endif () + set_property(TARGET geos PROPERTY FOLDER "External") set_property(TARGET geos_c PROPERTY FOLDER "External") set_property(TARGET ryu PROPERTY FOLDER "External") diff --git a/modules/globebrowsing/src/geojson/geojsoncomponent.cpp b/modules/globebrowsing/src/geojson/geojsoncomponent.cpp index ce525284fd..715a5f3dd0 100644 --- a/modules/globebrowsing/src/geojson/geojsoncomponent.cpp +++ b/modules/globebrowsing/src/geojson/geojsoncomponent.cpp @@ -563,7 +563,7 @@ void GeoJsonComponent::update() { return; } - const glm::vec3 offsets = glm::vec3(_latLongOffset.value(), _heightOffset); + const glm::vec3 offsets = glm::vec3(_latLongOffset.value(), _heightOffset.value()); for (size_t i = 0; i < _geometryFeatures.size(); i++) { if (!_features[i]->enabled) { diff --git a/modules/globebrowsing/src/geojson/globegeometryfeature.cpp b/modules/globebrowsing/src/geojson/globegeometryfeature.cpp index cfa22849f7..8c1470b364 100644 --- a/modules/globebrowsing/src/geojson/globegeometryfeature.cpp +++ b/modules/globebrowsing/src/geojson/globegeometryfeature.cpp @@ -263,7 +263,7 @@ void GlobeGeometryFeature::createFromSingleGeosGeometry(const geos::geom::Geomet geo->getCentroid(centroid); Geodetic3 geoCentroid = geometryhelper::coordsToGeodetic({ centroid }).front(); _heightUpdateReferencePoints.push_back(std::move(geoCentroid)); -; + std::vector envelopeGeoCoords = geometryhelper::geometryCoordsAsGeoVector(geo->getEnvelope().get()); @@ -569,7 +569,7 @@ std::vector> GlobeGeometryFeature::createLineGeometry() { ); const auto addLinePos = [&vertices, &positions](const glm::vec3& pos) { - vertices.push_back({ pos.x, pos.y, pos.z, 0.f, 0.f, 0.f }); + vertices.push_back({ { pos.x, pos.y, pos.z }, { 0.f, 0.f, 0.f } }); positions.push_back(pos); }; @@ -651,11 +651,13 @@ void GlobeGeometryFeature::createPointGeometry() { // Normal is the out direction const glm::vec3 normal = glm::normalize(vf); - vertices.push_back({ vf.x, vf.y, vf.z, normal.x, normal.y, normal.z }); + vertices.push_back({ + { vf.x, vf.y, vf.z }, { normal.x, normal.y, normal.z } + }); // Lines from center of the globe out to the point - extrudedLineVertices.push_back({ 0.f, 0.f, 0.f, 0.f, 0.f, 0.f }); - extrudedLineVertices.push_back({ vf.x, vf.y, vf.z, 0.f, 0.f, 0.f }); + extrudedLineVertices.push_back({ { 0.f, 0.f, 0.f }, { 0.f, 0.f, 0.f } }); + extrudedLineVertices.push_back({ { vf.x, vf.y, vf.z }, { 0.f, 0.f, 0.f } }); } vertices.shrink_to_fit(); @@ -746,9 +748,9 @@ void GlobeGeometryFeature::createPolygonGeometry() { else { // Just add a triangle consisting of the three vertices const glm::vec3 n = -glm::normalize(glm::cross(v1 - v0, v2 - v0)); - polyVertices.push_back({ v0.x, v0.y, v0.z, n.x, n.y, n.z }); - polyVertices.push_back({ v1.x, v1.y, v1.z, n.x, n.y, n.z }); - polyVertices.push_back({ v2.x, v2.y, v2.z, n.x, n.y, n.z }); + polyVertices.push_back({ { v0.x, v0.y, v0.z }, { n.x, n.y, n.z } }); + polyVertices.push_back({ { v1.x, v1.y, v1.z }, { n.x, n.y, n.z } }); + polyVertices.push_back({ { v2.x, v2.y, v2.z }, { n.x, n.y, n.z } }); } } } diff --git a/modules/globebrowsing/src/geojson/globegeometryhelper.cpp b/modules/globebrowsing/src/geojson/globegeometryhelper.cpp index 14e93fc81c..f7819bebe9 100644 --- a/modules/globebrowsing/src/geojson/globegeometryhelper.cpp +++ b/modules/globebrowsing/src/geojson/globegeometryhelper.cpp @@ -118,9 +118,12 @@ createExtrudedGeometryVertices(const std::vector>& edgeVe const glm::vec3 n = glm::vec3( glm::normalize(glm::cross(v1 - vOrigin, v0 - vOrigin)) ); - vertices.push_back({ vOrigin.x, vOrigin.y, vOrigin.z, n.x, n.y, n.z }); - vertices.push_back({ v1.x, v1.y, v1.z, n.x, n.y, n.z }); - vertices.push_back({ v0.x, v0.y, v0.z, n.x, n.y, n.z }); + vertices.push_back({ + { vOrigin.x, vOrigin.y, vOrigin.z }, + { n.x, n.y, n.z } + }); + vertices.push_back({ { v1.x, v1.y, v1.z }, { n.x, n.y, n.z } }); + vertices.push_back({ { v0.x, v0.y, v0.z }, { n.x, n.y, n.z } }); } // Inner boundary else { @@ -128,9 +131,12 @@ createExtrudedGeometryVertices(const std::vector>& edgeVe const glm::vec3 n = glm::normalize( glm::cross(v0 - vOrigin, v1 - vOrigin) ); - vertices.push_back({ vOrigin.x, vOrigin.y, vOrigin.z, n.x, n.y, n.z }); - vertices.push_back({ v0.x, v0.y, v0.z, n.x, n.y, n.z }); - vertices.push_back({ v1.x, v1.y, v1.z, n.x, n.y, n.z }); + vertices.push_back({ + { vOrigin.x, vOrigin.y, vOrigin.z }, + { n.x, n.y, n.z } + }); + vertices.push_back({ { v0.x, v0.y, v0.z }, { n.x, n.y, n.z } }); + vertices.push_back({ { v1.x, v1.y, v1.z }, { n.x, n.y, n.z } }); } // TODO: Fix faulty triangle directions and draw triangles with correct @@ -341,7 +347,7 @@ subdivideTriangle(const glm::vec3& v0, const glm::vec3& v1, const glm::vec3& v2, const glm::vec3 v = geometryhelper::computeOffsetedModelCoordinate(geodetic, globe, 0.f, 0.f); - vertices.push_back({ v.x, v.y, v.z, 0.f, 0.f, 0.f }); + vertices.push_back({ { v.x, v.y, v.z }, { 0.f, 0.f, 0.f } }); // Every third set of coordinates is a triangle => update normal of previous // triangle vertices diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index 91291b387e..8a97a66d4b 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -859,7 +859,7 @@ bool RenderableGlobe::isReady() const { return true; } -void RenderableGlobe::render(const RenderData& data, RendererTasks& rendererTask) { +void RenderableGlobe::render(const RenderData& data, RendererTasks&) { const double distanceToCamera = glm::distance( data.camera.positionVec3(), data.modelTransform.translation @@ -883,14 +883,14 @@ void RenderableGlobe::render(const RenderData& data, RendererTasks& rendererTask // Render from light source point of view // (Rings are skipped because the shadow is drawn directly onto the globe) - renderChunks(lightRenderData, rendererTask, {}, true); + renderChunks(lightRenderData, true); glEnable(GL_BLEND); _shadowComponent->end(); // Render again from original point of view - renderChunks(data, rendererTask, _shadowComponent->shadowMapData()); + renderChunks(data); if (_ringsComponent && _ringsComponent->isEnabled() && _ringsComponent->isVisible()) { @@ -898,7 +898,7 @@ void RenderableGlobe::render(const RenderData& data, RendererTasks& rendererTask } } else { - renderChunks(data, rendererTask); + renderChunks(data); if (_ringsComponent && _ringsComponent->isEnabled() && _ringsComponent->isVisible()) { @@ -1069,10 +1069,7 @@ void RenderableGlobe::invalidateShader() { // Rendering code ////////////////////////////////////////////////////////////////////////////////////////// -void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, - const ShadowComponent::ShadowMapData& shadowData, - bool renderGeomOnly) -{ +void RenderableGlobe::renderChunks(const RenderData& data, bool renderGeomOnly) { ZoneScoped; if (_layerManagerDirty) [[unlikely]] { @@ -1356,7 +1353,7 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, // Render all chunks that want to be rendered globally _globalRenderer.program->activate(); for (int i = 0; i < globalCount; i++) { - renderChunkGlobally(*_globalChunkBuffer[i], data, shadowData, renderGeomOnly); + renderChunkGlobally(*_globalChunkBuffer[i], data, renderGeomOnly); } _globalRenderer.program->deactivate(); @@ -1364,7 +1361,7 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, // Render all chunks that need to be rendered locally _localRenderer.program->activate(); for (int i = 0; i < localCount; i++) { - renderChunkLocally(*_localChunkBuffer[i], data, shadowData, renderGeomOnly); + renderChunkLocally(*_localChunkBuffer[i], data, renderGeomOnly); } _localRenderer.program->deactivate(); @@ -1398,7 +1395,6 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, } void RenderableGlobe::renderChunkGlobally(const Chunk& chunk, const RenderData& data, - const ShadowComponent::ShadowMapData& shadowData, bool renderGeomOnly) { ZoneScoped; @@ -1475,7 +1471,7 @@ void RenderableGlobe::renderChunkGlobally(const Chunk& chunk, const RenderData& } program.setUniform("textureOffset", _ringsComponent->textureOffset()); - program.setUniform("ringSize", (float)_ringsComponent->size()); + program.setUniform("ringSize", static_cast(_ringsComponent->size())); } } @@ -1494,7 +1490,6 @@ void RenderableGlobe::renderChunkGlobally(const Chunk& chunk, const RenderData& } void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& data, - const ShadowComponent::ShadowMapData& shadowData, bool renderGeomOnly) { ZoneScoped; @@ -1592,7 +1587,7 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d } // Shadow Mapping - if (_shadowMappingProperties.shadowMapping && shadowData.shadowDepthTexture != 0) { + if (_shadowMappingProperties.shadowMapping) { // Bind ring textures for direct projection when rings component is available if (_ringsComponent && _ringsComponent->isEnabled()) { ghoul::opengl::TextureUnit ringTextureColorUnit; @@ -1611,7 +1606,7 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d } program.setUniform("textureOffset", _ringsComponent->textureOffset()); - program.setUniform("ringSize", (float)_ringsComponent->size()); + program.setUniform("ringSize", static_cast(_ringsComponent->size())); } } diff --git a/modules/globebrowsing/src/renderableglobe.h b/modules/globebrowsing/src/renderableglobe.h index 3473c593af..d89fe4c17c 100644 --- a/modules/globebrowsing/src/renderableglobe.h +++ b/modules/globebrowsing/src/renderableglobe.h @@ -155,15 +155,13 @@ private: * * The height can be negative if the height map contains negative values. * - * \param `position` is the position of a point that gets geodetically projected on + * \param position This is the position of a point that gets geodetically projected on * the reference ellipsoid. `position` must be in Cartesian model space * \return The height from the reference ellipsoid to the globe surface */ float getHeight(const glm::dvec3& position) const; - void renderChunks(const RenderData& data, RendererTasks& rendererTask, - const ShadowComponent::ShadowMapData& shadowData = {}, bool renderGeomOnly = false - ); + void renderChunks(const RenderData& data, bool renderGeomOnly = false); /** * Chunks can be rendered either globally or locally. Global rendering is performed @@ -174,7 +172,7 @@ private: * lead to jagging. We only render global chunks for lower chunk levels. */ void renderChunkGlobally(const Chunk& chunk, const RenderData& data, - const ShadowComponent::ShadowMapData& shadowData = {}, bool renderGeomOnly = false + bool renderGeomOnly = false ); /** @@ -189,7 +187,7 @@ private: * higher chunk levels. */ void renderChunkLocally(const Chunk& chunk, const RenderData& data, - const ShadowComponent::ShadowMapData& shadowData = {}, bool renderGeomOnly = false + bool renderGeomOnly = false ); void debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp, diff --git a/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp b/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp index 359b43399c..d2d6677ba9 100644 --- a/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider/temporaltileprovider.cpp @@ -454,7 +454,7 @@ DefaultTileProvider* TemporalTileProvider::retrieveTileProvider(const Time& t) { } default: throw ghoul::MissingCaseException(); - }; + } }(); DefaultTileProvider tileProvider = createTileProvider(timeStr); diff --git a/modules/imgui/CMakeLists.txt b/modules/imgui/CMakeLists.txt index 20563f770f..e01ee545f8 100644 --- a/modules/imgui/CMakeLists.txt +++ b/modules/imgui/CMakeLists.txt @@ -76,4 +76,5 @@ create_new_module( add_subdirectory(ext/imgui SYSTEM) target_link_libraries(${imgui_module} PUBLIC Imgui) +disable_compiler_warnings(Imgui) set_target_properties(Imgui PROPERTIES FOLDER "External") diff --git a/modules/imgui/imguimodule.cpp b/modules/imgui/imguimodule.cpp index 95fc40fede..0a8b117a68 100644 --- a/modules/imgui/imguimodule.cpp +++ b/modules/imgui/imguimodule.cpp @@ -300,10 +300,10 @@ void ImGUIModule::internalInitializeGL() { strcpy(_iniFileBuffer.data(), file.c_str()); #endif - const int nWindows = global::windowDelegate->nWindows(); + const size_t nWindows = global::windowDelegate->nWindows(); _contexts.resize(nWindows); - for (int i = 0; i < nWindows; i++) { + for (size_t i = 0; i < nWindows; i++) { _contexts[i] = ImGui::CreateContext(); ImGui::SetCurrentContext(_contexts[i]); @@ -406,7 +406,7 @@ void ImGUIModule::internalInitializeGL() { { unsigned char* texData = nullptr; glm::ivec2 texSize = glm::ivec2(0, 0); - for (int i = 0; i < nWindows; i++) { + for (size_t i = 0; i < nWindows; i++) { ImGui::SetCurrentContext(_contexts[i]); ImGui::GetIO().Fonts->GetTexDataAsRGBA32(&texData, &texSize.x, &texSize.y); @@ -420,7 +420,7 @@ void ImGUIModule::internalInitializeGL() { _fontTexture->setDataOwnership(ghoul::opengl::Texture::TakeOwnership::No); _fontTexture->uploadTexture(); } - for (int i = 0; i < nWindows; i++) { + for (size_t i = 0; i < nWindows; i++) { const uintptr_t texture = static_cast(*_fontTexture); ImGui::SetCurrentContext(_contexts[i]); ImGui::GetIO().Fonts->TexID = reinterpret_cast(texture); diff --git a/modules/kameleon/src/kameleonwrapper.cpp b/modules/kameleon/src/kameleonwrapper.cpp index cc0cd75a74..fb2cab3676 100644 --- a/modules/kameleon/src/kameleonwrapper.cpp +++ b/modules/kameleon/src/kameleonwrapper.cpp @@ -731,7 +731,7 @@ glm::vec4 KameleonWrapper::modelScaleScaled() const { } else if (units[0] == "m" && units[1] == "radian" && units[2] == "radian") { // For spherical coordinate systems the radius is in meter - scale.w = -log10(1.f / _max.x); + scale.w = -std::log10(1.f / _max.x); } return scale; @@ -1074,7 +1074,7 @@ std::vector KameleonWrapper::variables() const { int numVariables = _model->getNumberOfVariables(); for (int i = 0; i < numVariables; i++) { - variableNames.push_back(_model->getVariableName(i));; + variableNames.push_back(_model->getVariableName(i)); } return variableNames; } diff --git a/modules/multiresvolume/rendering/renderablemultiresvolume.cpp b/modules/multiresvolume/rendering/renderablemultiresvolume.cpp index 2ed9ada2b2..430a15133a 100644 --- a/modules/multiresvolume/rendering/renderablemultiresvolume.cpp +++ b/modules/multiresvolume/rendering/renderablemultiresvolume.cpp @@ -345,24 +345,12 @@ void RenderableMultiresVolume::initializeGL() { constexpr unsigned int MaxInitialBudget = 2048; int initialBudget = std::min(MaxInitialBudget, maxNumBricks); - _currentTime = properties::IntProperty( - CurrentTimeInfo, - 0, - 0, - _tsp->header().numTimesteps - 1 - ); - _memoryBudget = properties::IntProperty( - MemoryBudgetInfo, - initialBudget, - 0, - maxNumBricks - ); - _streamingBudget = properties::IntProperty( - StreamingBudgetInfo, - initialBudget, - 0, - maxNumBricks - ); + _currentTime.setMaxValue(_tsp->header().numTimesteps - 1); + _memoryBudget = initialBudget; + _memoryBudget.setMaxValue(maxNumBricks); + _streamingBudget = initialBudget; + _streamingBudget.setMaxValue(maxNumBricks); + addProperty(_currentTime); addProperty(_memoryBudget); addProperty(_streamingBudget); diff --git a/modules/server/src/connection.cpp b/modules/server/src/connection.cpp index bf3b248a41..6dfc99363b 100644 --- a/modules/server/src/connection.cpp +++ b/modules/server/src/connection.cpp @@ -76,7 +76,7 @@ Connection::Connection(std::unique_ptr s, std::string address _topicFactory.registerClass( "authorize", - [password](bool, const ghoul::Dictionary&, ghoul::MemoryPoolBase* pool) { + [password](bool, const ghoul::Dictionary&, pmr::memory_resource* pool) { if (pool) { void* ptr = pool->allocate(sizeof(AuthorizationTopic)); return new (ptr) AuthorizationTopic(password); diff --git a/modules/server/src/topics/missiontopic.cpp b/modules/server/src/topics/missiontopic.cpp index fe82dbbd36..6011bdf496 100644 --- a/modules/server/src/topics/missiontopic.cpp +++ b/modules/server/src/topics/missiontopic.cpp @@ -81,7 +81,7 @@ nlohmann::json MissionTopic::createPhaseJson(const MissionPhase& phase) const { }; if (date.description.has_value()) { - jsonDate["description"] = *date.description;; + jsonDate["description"] = *date.description; } if (date.image.has_value()) { jsonDate["image"] = *date.image; diff --git a/modules/server/src/topics/sessionrecordingtopic.cpp b/modules/server/src/topics/sessionrecordingtopic.cpp index edbeac3f15..0b95bf9082 100644 --- a/modules/server/src/topics/sessionrecordingtopic.cpp +++ b/modules/server/src/topics/sessionrecordingtopic.cpp @@ -132,7 +132,7 @@ void SessionRecordingTopic::sendJsonData() { break; } stateJson[StateKey] = stateString; - }; + } if (_sendFiles) { stateJson[FilesKey] = global::sessionRecordingHandler->playbackList(); } diff --git a/modules/skybrowser/include/utility.h b/modules/skybrowser/include/utility.h index 5f40cb77f0..38fcf78926 100644 --- a/modules/skybrowser/include/utility.h +++ b/modules/skybrowser/include/utility.h @@ -27,6 +27,7 @@ #include #include +#include #include namespace openspace::skybrowser { @@ -225,8 +226,46 @@ public: return timeLeft && _isStarted; } - T newValue() const; - glm::dmat4 rotationMatrix(); + T newValue() const { + if (!isAnimating()) { + return _goal; + } + + if constexpr (std::is_same_v) { + const double percentage = percentageSpent(); + const double diff = (_goal - _start) * ghoul::exponentialEaseOut(percentage); + return _start + diff; + } + else if constexpr (std::is_same_v) { + const glm::dmat4 rotMat = skybrowser::incrementalAnimationMatrix( + glm::normalize(_start), + glm::normalize(_goal), + ghoul::exponentialEaseOut(percentageSpent()) + ); + // Rotate direction + return glm::dvec3(rotMat * glm::dvec4(_start, 1.0)); + } + else { + static_assert(sizeof(T) == 0, "Unimplemented"); + } + } + + glm::dmat4 rotationMatrix() { + if (!isAnimating()) { + return glm::dmat4(1.0); + } + + const double percentage = ghoul::sineEaseInOut(percentageSpent()); + const double increment = percentage - _lastPercentage; + _lastPercentage = percentage; + + glm::dmat4 rotMat = skybrowser::incrementalAnimationMatrix( + glm::normalize(_start), + glm::normalize(_goal), + increment + ); + return rotMat; + } private: std::chrono::duration timeSpent() const { diff --git a/modules/skybrowser/src/utility.cpp b/modules/skybrowser/src/utility.cpp index 7334d4bb7b..eff7639ab4 100644 --- a/modules/skybrowser/src/utility.cpp +++ b/modules/skybrowser/src/utility.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -233,48 +232,4 @@ double sizeFromFov(double fov, const glm::dvec3& worldPosition) { return opposite; } -template <> -double Animation::newValue() const { - if (!isAnimating()) { - return _goal; - } - else { - const double percentage = percentageSpent(); - const double diff = (_goal - _start) * ghoul::exponentialEaseOut(percentage); - return _start + diff; - } -} - -template <> -glm::dmat4 Animation::rotationMatrix() { - if (!isAnimating()) { - return glm::dmat4(1.0); - } - - const double percentage = ghoul::sineEaseInOut(percentageSpent()); - const double increment = percentage - _lastPercentage; - _lastPercentage = percentage; - - glm::dmat4 rotMat = skybrowser::incrementalAnimationMatrix( - glm::normalize(_start), - glm::normalize(_goal), - increment - ); - return rotMat; -} - -template <> -glm::dvec3 Animation::newValue() const { - if (!isAnimating()) { - return _goal; - } - const glm::dmat4 rotMat = skybrowser::incrementalAnimationMatrix( - glm::normalize(_start), - glm::normalize(_goal), - ghoul::exponentialEaseOut(percentageSpent()) - ); - // Rotate direction - return glm::dvec3(rotMat * glm::dvec4(_start, 1.0));; -} - } // namespace openspace::skybrowser diff --git a/modules/space/kepler.cpp b/modules/space/kepler.cpp index b7818ec76c..bb78dfe37a 100644 --- a/modules/space/kepler.cpp +++ b/modules/space/kepler.cpp @@ -425,7 +425,7 @@ namespace { throw ghoul::RuntimeError(std::format( "Illformed packed date. Illegal year marker. {}", packedDate )); - }; + } }(packedDate[0]); auto yearRes = scn::scan(packedDate.substr(1, 2), "{}"); diff --git a/modules/space/kepler.h b/modules/space/kepler.h index 0970937d0a..f79ff64fcf 100644 --- a/modules/space/kepler.h +++ b/modules/space/kepler.h @@ -101,10 +101,10 @@ std::vector readMpcFile(const std::filesystem::path& file); * The different formats that the readFile function is capable of loading. */ enum class Format { - TLE, //< Two-line elements - OMM, //< Orbit Mean-Elements Message - SBDB, //< Small-Body Database - MPC //< Minor Planet Center + TLE, ///< Two-line elements + OMM, ///< Orbit Mean-Elements Message + SBDB, ///< Small-Body Database + MPC ///< Minor Planet Center }; /** * Reads the object information from the provided file. diff --git a/modules/space/rendering/renderablehabitablezone.cpp b/modules/space/rendering/renderablehabitablezone.cpp index a708a41fba..f967921946 100644 --- a/modules/space/rendering/renderablehabitablezone.cpp +++ b/modules/space/rendering/renderablehabitablezone.cpp @@ -197,7 +197,7 @@ void RenderableHabitableZone::computeZone() { // Compute the coservative bounds normalized by the size of the disc, i.e. in [0, 1] _conservativeBounds = glm::vec2(innerConservative, outerConservative); - _conservativeBounds /= _size; + _conservativeBounds /= _size.value(); } glm::dvec4 RenderableHabitableZone::computeKopparapuZoneBoundaries(float teff, diff --git a/modules/space/rendering/renderableorbitalkepler.cpp b/modules/space/rendering/renderableorbitalkepler.cpp index 9aa3300c9a..d836143c50 100644 --- a/modules/space/rendering/renderableorbitalkepler.cpp +++ b/modules/space/rendering/renderableorbitalkepler.cpp @@ -533,7 +533,7 @@ void RenderableOrbitalKepler::render(const RenderData& data, RendererTasks&) { ); // Because we want the property to work similar to the planet trails - const float fade = pow( + const float fade = std::pow( _appearance.trailFade.maxValue() - _appearance.trailFade, 2.f ); _trailProgram->setUniform(_uniformTrailCache.trailFadeExponent, fade); @@ -709,7 +709,7 @@ void RenderableOrbitalKepler::updateBuffers() { void RenderableOrbitalKepler::calculateSegmentsForPoints(const RenderData& data) { int startVertexIndex = 0; - for (int i = 0; i < _segmentSizeRaw.size(); i++) { + for (size_t i = 0; i < _segmentSizeRaw.size(); i++) { // Check how far along the trail we are const kepler::Parameters& orbit = _parameters[i]; const double nRevs = (data.time.j2000Seconds() - orbit.epoch) / orbit.period; @@ -727,12 +727,15 @@ void RenderableOrbitalKepler::calculateSegmentsForPoints(const RenderData& data) } void RenderableOrbitalKepler::calculateSegmentsForTrails(const RenderData& data) { - const float fade = pow(_appearance.trailFade.maxValue() - _appearance.trailFade, 2.f); - const float threshold = 1.f - pow(0.05f, 1.f / fade); + const float fade = std::pow( + _appearance.trailFade.maxValue() - _appearance.trailFade, + 2.f + ); + const float threshold = 1.f - std::pow(0.05f, 1.f / fade); int nTotalTrailParts = 0; int startVertexIndex = 0; - for (int i = 0; i < _segmentSizeRaw.size(); i++) { + for (size_t i = 0; i < _segmentSizeRaw.size(); i++) { // Check how far along the trail we are const kepler::Parameters& orbit = _parameters[i]; const double nRevs = (data.time.j2000Seconds() - orbit.epoch) / orbit.period; diff --git a/modules/space/translation/keplertranslation.cpp b/modules/space/translation/keplertranslation.cpp index 5b0d6984b9..5155c88a9d 100644 --- a/modules/space/translation/keplertranslation.cpp +++ b/modules/space/translation/keplertranslation.cpp @@ -31,7 +31,7 @@ #include namespace { - struct RangeError : public ghoul::RuntimeError { + struct RangeError final : public ghoul::RuntimeError { explicit RangeError(std::string off) : ghoul::RuntimeError( std::format("Value '{}' out of range", off), diff --git a/modules/spacecraftinstruments/rendering/renderablefov.cpp b/modules/spacecraftinstruments/rendering/renderablefov.cpp index 0a90015014..c2bc254852 100644 --- a/modules/spacecraftinstruments/rendering/renderablefov.cpp +++ b/modules/spacecraftinstruments/rendering/renderablefov.cpp @@ -561,7 +561,7 @@ void RenderableFov::computeIntercepts(double time, const std::string& target, glm::vec3 srfVec = r.surfaceVector * 1000.0; // Standoff distance, we would otherwise end up *exactly* on the surface - srfVec *= _standOffDistance; + srfVec *= _standOffDistance.value(); second = { .position = { srfVec.x, srfVec.y, srfVec.z }, diff --git a/modules/spacecraftinstruments/rendering/renderableshadowcylinder.cpp b/modules/spacecraftinstruments/rendering/renderableshadowcylinder.cpp index c1922d5961..596103090b 100644 --- a/modules/spacecraftinstruments/rendering/renderableshadowcylinder.cpp +++ b/modules/spacecraftinstruments/rendering/renderableshadowcylinder.cpp @@ -334,7 +334,7 @@ void RenderableShadowCylinder::createCylinder(double time) { vecLightSource = glm::inverse(_stateMatrix) * vecLightSource; - vecLightSource *= _shadowLength; + vecLightSource *= _shadowLength.value(); _vertices.clear(); for (const glm::vec3& v : terminatorPoints) { diff --git a/modules/spacecraftinstruments/util/labelparser.cpp b/modules/spacecraftinstruments/util/labelparser.cpp index cc049d4177..651097c8c7 100644 --- a/modules/spacecraftinstruments/util/labelparser.cpp +++ b/modules/spacecraftinstruments/util/labelparser.cpp @@ -108,7 +108,7 @@ LabelParser::LabelParser(std::filesystem::path fileName, // insert decoder to map - this will be used in the parser to determine // behavioral characteristics of each instrument _fileTranslation[std::string(key)] = std::move(decoder); - }; + } } } } diff --git a/modules/spacecraftinstruments/util/targetdecoder.cpp b/modules/spacecraftinstruments/util/targetdecoder.cpp index c11c34e8e6..528d97b69c 100644 --- a/modules/spacecraftinstruments/util/targetdecoder.cpp +++ b/modules/spacecraftinstruments/util/targetdecoder.cpp @@ -33,7 +33,7 @@ TargetDecoder::TargetDecoder(const ghoul::Dictionary& dictionary) { for (size_t i = 0; i < _names.size(); i++) { const std::string key = std::to_string(i + 1); if (dictionary.hasKey(key) && dictionary.hasValue(key)) { - _names[i] = dictionary.value(key);; + _names[i] = dictionary.value(key); } } } diff --git a/modules/statemachine/include/state.h b/modules/statemachine/include/state.h index a4cd2c7519..3c979e3756 100644 --- a/modules/statemachine/include/state.h +++ b/modules/statemachine/include/state.h @@ -35,7 +35,6 @@ namespace documentation { struct Documentation; } class State { public: explicit State(const ghoul::Dictionary& dictionary); - ~State() = default; void enter() const; void exit() const; diff --git a/modules/statemachine/include/transition.h b/modules/statemachine/include/transition.h index f261b53435..aef4cf6dfe 100644 --- a/modules/statemachine/include/transition.h +++ b/modules/statemachine/include/transition.h @@ -35,7 +35,6 @@ namespace documentation { struct Documentation; } class Transition { public: explicit Transition(const ghoul::Dictionary& dictionary); - ~Transition() = default; const std::string& from() const; const std::string& to() const; diff --git a/modules/sync/syncmodule.cpp b/modules/sync/syncmodule.cpp index 1c133a1b82..5e6bb89488 100644 --- a/modules/sync/syncmodule.cpp +++ b/modules/sync/syncmodule.cpp @@ -81,7 +81,7 @@ void SyncModule::internalInitialize(const ghoul::Dictionary& configuration) { fSynchronization->registerClass( "HttpSynchronization", - [this](bool, const ghoul::Dictionary& dictionary, ghoul::MemoryPoolBase* pool) { + [this](bool, const ghoul::Dictionary& dictionary, pmr::memory_resource* pool) { if (pool) { void* ptr = pool->allocate(sizeof(HttpSynchronization)); return new (ptr) HttpSynchronization( @@ -102,7 +102,7 @@ void SyncModule::internalInitialize(const ghoul::Dictionary& configuration) { fSynchronization->registerClass( "UrlSynchronization", - [this](bool, const ghoul::Dictionary& dictionary, ghoul::MemoryPoolBase* pool) { + [this](bool, const ghoul::Dictionary& dictionary, pmr::memory_resource* pool) { if (pool) { void* ptr = pool->allocate(sizeof(UrlSynchronization)); return new (ptr) UrlSynchronization(dictionary, _synchronizationRoot); diff --git a/modules/touch/src/touchinteraction.cpp b/modules/touch/src/touchinteraction.cpp index 222358602d..358ebf015e 100644 --- a/modules/touch/src/touchinteraction.cpp +++ b/modules/touch/src/touchinteraction.cpp @@ -1065,7 +1065,8 @@ void TouchInteraction::step(double dt, bool directTouch) { // should make the touch interaction tap into the orbitalnavigator and let that // do the updating of the camera, instead of handling them separately. Then we // would keep them in sync and avoid duplicated camera updating code. - auto orbitalNavigator = global::navigationHandler->orbitalNavigator(); + interaction::OrbitalNavigator& orbitalNavigator = + global::navigationHandler->orbitalNavigator(); camPos = orbitalNavigator.pushToSurfaceOfAnchor(camPos); // @TODO (emmbr, 2023-02-08) with the line above, the ZoomInLimit might not be diff --git a/modules/volume/rendering/volumeclipplane.h b/modules/volume/rendering/volumeclipplane.h index 352d932690..a587077618 100644 --- a/modules/volume/rendering/volumeclipplane.h +++ b/modules/volume/rendering/volumeclipplane.h @@ -37,7 +37,6 @@ namespace openspace::volume { class VolumeClipPlane : public properties::PropertyOwner { public: explicit VolumeClipPlane(const ghoul::Dictionary& dictionary); - ~VolumeClipPlane() override = default; glm::vec3 normal() const; glm::vec2 offsets() const; diff --git a/modules/webbrowser/CMakeLists.txt b/modules/webbrowser/CMakeLists.txt index d2b813f27d..b9f519f297 100644 --- a/modules/webbrowser/CMakeLists.txt +++ b/modules/webbrowser/CMakeLists.txt @@ -231,7 +231,7 @@ else() add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper) # Logical target used to link the libcef library. add_cef_logical_target("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}") - target_link_libraries(${CEF_HELPER_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) + target_link_libraries(${CEF_HELPER_TARGET} PRIVATE libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS}) if (OS_WINDOWS) # Add the custom manifest files to the executable. add_windows_cef_manifest("${CEF_TARGET_OUT_DIR}" "${WEBBROWSER_MODULE_PATH}" "${CEF_HELPER_TARGET}" "exe") diff --git a/modules/webbrowser/include/eventhandler.h b/modules/webbrowser/include/eventhandler.h index 67865c8818..64883291b9 100644 --- a/modules/webbrowser/include/eventhandler.h +++ b/modules/webbrowser/include/eventhandler.h @@ -94,14 +94,8 @@ private: */ CefTouchEvent touchEvent(const TouchInput& input, const cef_touch_event_type_t eventType) const; -#endif +#endif // WIN32 - /** - * Find the CEF key event to use for a given action. - * - * \param action - * \return - */ cef_key_event_type_t keyEventType(KeyAction action); BrowserInstance* _browserInstance = nullptr; diff --git a/modules/webbrowser/src/eventhandler.cpp b/modules/webbrowser/src/eventhandler.cpp index a09f6fcb16..106e931f24 100644 --- a/modules/webbrowser/src/eventhandler.cpp +++ b/modules/webbrowser/src/eventhandler.cpp @@ -41,8 +41,8 @@ namespace { * Map from GLFW key codes to windows key codes, supported by JS and CEF. * See http://keycode.info/ for lookup * - * \param key - * \return the key code, if mapped or the GLFW key code + * \param key The key that we need to make + * \return The key code, if mapped or the GLFW key code */ int mapFromGlfwToWindows(openspace::Key key) { switch (key) { diff --git a/src/data/csvloader.cpp b/src/data/csvloader.cpp index 3ca1593383..d5eee722c9 100644 --- a/src/data/csvloader.cpp +++ b/src/data/csvloader.cpp @@ -88,11 +88,11 @@ Dataset loadCsvFile(std::filesystem::path filePath, std::optional s // First row is the column names const std::vector& columns = rows.front(); - int xColumn = -1; - int yColumn = -1; - int zColumn = -1; - int nameColumn = -1; - int textureColumn = -1; + std::optional xColumn; + std::optional yColumn; + std::optional zColumn; + std::optional nameColumn; + std::optional textureColumn; int nDataColumns = 0; const bool hasExcludeColumns = specs.has_value() && specs->hasExcludeColumns(); @@ -106,17 +106,17 @@ Dataset loadCsvFile(std::filesystem::path filePath, std::optional s if (isPositionColumn(col, specs)) { if (isColumnX(col, specs)) { - xColumn = static_cast(i); + xColumn = i; } if (isColumnY(col, specs)) { - yColumn = static_cast(i); + yColumn = i; } if (isColumnZ(col, specs)) { - zColumn = static_cast(i); + zColumn = i; } } else if (isNameColumn(col, specs)) { - nameColumn = static_cast(i); + nameColumn = i; } else if (hasExcludeColumns && specs->isExcludeColumn(col)) { skipColumns.push_back(i); @@ -126,7 +126,7 @@ Dataset loadCsvFile(std::filesystem::path filePath, std::optional s // Note that the texture column is also a regular column. Just save the index if (isTextureColumn(col, specs)) { res.textureDataIndex = nDataColumns; - textureColumn = static_cast(i); + textureColumn = i; } res.variables.push_back({ @@ -164,7 +164,7 @@ Dataset loadCsvFile(std::filesystem::path filePath, std::optional s )); } - if (xColumn < 0 || yColumn < 0 || zColumn < 0) { + if (!xColumn.has_value() || !yColumn.has_value() || !zColumn.has_value()) { // One or more position columns weren't read LERROR(std::format( "Error loading data file '{}'. Missing X, Y or Z position column", filePath @@ -197,16 +197,16 @@ Dataset loadCsvFile(std::filesystem::path filePath, std::optional s // For now, all values are converted to float const float value = readFloatData(strValue); - if (i == xColumn) { + if (xColumn.has_value() && i == *xColumn) { entry.position.x = value; } - else if (i == yColumn) { + else if (yColumn.has_value() && i == *yColumn) { entry.position.y = value; } - else if (i == zColumn) { + else if (zColumn.has_value() && i == *zColumn) { entry.position.z = value; } - else if (i == nameColumn) { + else if (nameColumn.has_value() && i == *nameColumn) { // Note that were we use the original stirng value, rather than the // converted one entry.comment = strValue; @@ -215,7 +215,7 @@ Dataset loadCsvFile(std::filesystem::path filePath, std::optional s entry.data.push_back(value); } - if (i == textureColumn) { + if (textureColumn.has_value() && i == *textureColumn) { uniqueTextureIndicesInData.emplace(static_cast(value)); } } diff --git a/src/data/dataloader.cpp b/src/data/dataloader.cpp index 24f890613d..ac286aaae0 100644 --- a/src/data/dataloader.cpp +++ b/src/data/dataloader.cpp @@ -268,7 +268,7 @@ std::optional loadCachedFile(const std::filesystem::path& path) { // data entries // commentIdx is the running index into the total comment buffer - int commentIdx = 0; + size_t commentIdx = 0; int valuesIdx = 0; for (Dataset::Entry& e : result.entries) { e.data.resize(nValues); @@ -287,7 +287,7 @@ std::optional loadCachedFile(const std::filesystem::path& path) { std::memcpy(e.comment->data(), &commentBuffer[commentIdx], e.comment->size()); // and then advance the index - commentIdx += static_cast(e.comment->size()); + commentIdx += e.comment->size(); } } @@ -741,7 +741,7 @@ bool Dataset::normalizeVariable(std::string_view variableName) { return true; } -glm::vec2 Dataset::findValueRange(int variableIndex) const { +glm::vec2 Dataset::findValueRange(size_t variableIndex) const { if (entries.empty()) { // Can't find range if there are no entries return glm::vec2(0.f); diff --git a/src/documentation/verifier.cpp b/src/documentation/verifier.cpp index da5e713fd9..3de9213361 100644 --- a/src/documentation/verifier.cpp +++ b/src/documentation/verifier.cpp @@ -644,7 +644,7 @@ TestResult TemplateVerifier::operator()(const ghoul::Dictionary& dic } TableVerifier::TableVerifier(std::vector documentationEntries, - std::optional nEntries) + std::optional nEntries) : documentations(std::move(documentationEntries)) , count(nEntries) {} diff --git a/src/engine/openspaceengine_lua.inl b/src/engine/openspaceengine_lua.inl index 6f54f91d33..1713edf81c 100644 --- a/src/engine/openspaceengine_lua.inl +++ b/src/engine/openspaceengine_lua.inl @@ -207,12 +207,12 @@ namespace { * in that location will be overwritten * \param base64Data The base64 encoded data that should be saved to the provided file */ -[[codegen::luawrap]] void saveBase64File(std::filesystem::path filepath, +[[codegen::luawrap]] void saveBase64File(std::filesystem::path filePath, std::string base64Data) { std::vector data = ghoul::decodeBase64(base64Data); - std::ofstream file = std::ofstream(filepath, std::ofstream::binary); + std::ofstream file = std::ofstream(filePath, std::ofstream::binary); file.write(reinterpret_cast(data.data()), data.size()); } diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index cbab33bb6b..9edd16aefe 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -36,7 +36,7 @@ namespace { using namespace openspace::interaction; - class LoadingError : public ghoul::RuntimeError { + class LoadingError final : public ghoul::RuntimeError { public: LoadingError(std::string error_, std::filesystem::path file_, int entry_) : ghoul::RuntimeError( @@ -628,7 +628,7 @@ SessionRecording loadSessionRecording(const std::filesystem::path& filename) { } sessionRecording.entries.push_back(std::move(*entry)); - }; + } ghoul_assert( std::is_sorted( diff --git a/src/interaction/sessionrecordinghandler.cpp b/src/interaction/sessionrecordinghandler.cpp index 0719a2e9ae..585df6a6fd 100644 --- a/src/interaction/sessionrecordinghandler.cpp +++ b/src/interaction/sessionrecordinghandler.cpp @@ -54,9 +54,9 @@ namespace { template struct overloaded : Ts... { using Ts::operator()...; }; template overloaded(Ts...) -> overloaded; - struct SessionRecordingError : public ghoul::RuntimeError { - explicit SessionRecordingError(std::string message) - : ghoul::RuntimeError(std::move(message), "SessionRecording") + struct SessionRecordingError final : public ghoul::RuntimeError { + explicit SessionRecordingError(std::string msg) + : ghoul::RuntimeError(std::move(msg), "SessionRecording") {} }; diff --git a/src/mission/missionmanager.cpp b/src/mission/missionmanager.cpp index 34b06b1d18..1d5cc61f23 100644 --- a/src/mission/missionmanager.cpp +++ b/src/mission/missionmanager.cpp @@ -35,9 +35,9 @@ #include "missionmanager_lua.inl" namespace { - struct MissionManagerException : public ghoul::RuntimeError { - explicit MissionManagerException(std::string message) - : ghoul::RuntimeError(std::move(message), "MissionManager") + struct MissionManagerException final : public ghoul::RuntimeError { + explicit MissionManagerException(std::string msg) + : ghoul::RuntimeError(std::move(msg), "MissionManager") {} }; } // namespace diff --git a/src/rendering/helper.cpp b/src/rendering/helper.cpp index 6585687506..fbd6bd3890 100644 --- a/src/rendering/helper.cpp +++ b/src/rendering/helper.cpp @@ -225,13 +225,13 @@ void initialize() { }; constexpr std::array Vtx = { // X Y U V R G B A - -1.f, -1.f, 0.f, 0.f, 1.f, 1.f, 1.f, 1.f, - -1.f, 1.f, 0.f, 1.f, 1.f, 1.f, 1.f, 1.f, - 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, + VertexXYUVRGBA{ { -1.f, -1.f }, { 0.f, 0.f }, { 1.f, 1.f, 1.f, 1.f } }, + VertexXYUVRGBA{ { -1.f, 1.f }, { 0.f, 1.f }, { 1.f, 1.f, 1.f, 1.f } }, + VertexXYUVRGBA{ { 1.f, 1.f }, { 1.f, 1.f }, { 1.f, 1.f, 1.f, 1.f } }, - -1.f, -1.f, 0.f, 0.f, 1.f, 1.f, 1.f, 1.f, - 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, - 1.f, -1.f, 1.f, 0.f, 1.f, 1.f, 1.f, 1.f + VertexXYUVRGBA{ { -1.f, -1.f }, { 0.f, 0.f }, { 1.f, 1.f, 1.f, 1.f } }, + VertexXYUVRGBA{ { 1.f, 1.f }, { 1.f, 1.f }, { 1.f, 1.f, 1.f, 1.f } }, + VertexXYUVRGBA{ { 1.f, -1.f }, { 1.f, 0.f }, { 1.f, 1.f, 1.f, 1.f } } }; glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(VertexXYUVRGBA), Vtx.data(), GL_STATIC_DRAW); @@ -527,7 +527,7 @@ Vertex computeCircleVertex(int i, int nSegments, float radius, const float u = std::cos(theta); const float v = std::sin(theta); - return { x, y, z, u, v, color.r, color.g, color.b, color.a }; + return { { x, y, z }, { u, v }, { color.r, color.g, color.b, color.a } }; } std::vector createRing(int nSegments, float radius, const glm::vec4& colors) { diff --git a/src/rendering/labelscomponent.cpp b/src/rendering/labelscomponent.cpp index 0828fefd13..6fd53130e7 100644 --- a/src/rendering/labelscomponent.cpp +++ b/src/rendering/labelscomponent.cpp @@ -308,7 +308,7 @@ void LabelsComponent::render(const RenderData& data, labelInfo.cameraLookUp = data.camera.lookUpVectorWorldSpace(); labelInfo.renderType = renderOption; labelInfo.mvpMatrix = modelViewProjectionMatrix; - labelInfo.scale = pow(10.f, _size); + labelInfo.scale = std::pow(10.f, _size); labelInfo.enableDepth = true; labelInfo.enableFalseDepth = false; diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 219359b849..8b626a75c5 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -298,7 +298,7 @@ namespace { namespace openspace { -RenderEngine::Window::Window(PropertyOwnerInfo info, int id) +RenderEngine::Window::Window(PropertyOwnerInfo info, size_t id) : properties::PropertyOwner(info) , horizFieldOfView(HorizFieldOfViewInfo, 80.f, 1.f, 179.f) { @@ -498,7 +498,7 @@ void RenderEngine::initializeGL() { LTRACE("RenderEngine::initializeGL(begin)"); - for (int i = 0; i < global::windowDelegate->nWindows(); i++) { + for (size_t i = 0; i < global::windowDelegate->nWindows(); i++) { std::string name = global::windowDelegate->nameForWindow(i); properties::PropertyOwner::PropertyOwnerInfo info = { .identifier = std::format("Window_{}", i), @@ -524,7 +524,7 @@ void RenderEngine::initializeGL() { global::windowDelegate->nWindows() == _windows.size(), "Invalid number of windows" ); - for (int i = 0; i < global::windowDelegate->nWindows(); i++) { + for (size_t i = 0; i < global::windowDelegate->nWindows(); i++) { _windows[i]->horizFieldOfView = global::windowDelegate->horizFieldOfView(i); } @@ -608,7 +608,7 @@ void RenderEngine::updateRenderer() { global::windowDelegate->nWindows() == _windows.size(), "Invalid number of windows" ); - for (int i = 0; i < global::windowDelegate->nWindows(); i++) { + for (size_t i = 0; i < global::windowDelegate->nWindows(); i++) { _windows[i]->horizFieldOfView = global::windowDelegate->horizFieldOfView(i); } } diff --git a/src/rendering/screenspacerenderable.cpp b/src/rendering/screenspacerenderable.cpp index 01bf9ac299..c6bf569c58 100644 --- a/src/rendering/screenspacerenderable.cpp +++ b/src/rendering/screenspacerenderable.cpp @@ -547,7 +547,7 @@ glm::mat4 ScreenSpaceRenderable::scaleMatrix() { glm::mat4 scale = glm::scale( glm::mat4(1.f), - glm::vec3(_scale, textureRatio*_scale, 1.f) + glm::vec3(_scale.value(), textureRatio * _scale, 1.f) ); return scale; @@ -724,9 +724,9 @@ glm::vec3 ScreenSpaceRenderable::sphericalToCartesian(glm::vec3 spherical) const // and phi is the azimuth. const glm::vec3 sanitized = sanitizeSphericalCoordinates(std::move(spherical)); - const float x = sanitized[0] * sin(sanitized[1]) * cos(sanitized[2]); - const float y = sanitized[0] * sin(sanitized[1]) * sin(sanitized[2]); - const float z = sanitized[0] * cos(sanitized[1]); + const float x = sanitized[0] * std::sin(sanitized[1]) * std::cos(sanitized[2]); + const float y = sanitized[0] * std::sin(sanitized[1]) * std::sin(sanitized[2]); + const float z = sanitized[0] * std::cos(sanitized[1]); // Now, convert rotate the coordinate system, so that z maps to y, // and y maps to -z. We want the pole to be in y instead of z. diff --git a/src/util/ellipsoid.cpp b/src/util/ellipsoid.cpp index cabead0eb0..f1a973fc33 100644 --- a/src/util/ellipsoid.cpp +++ b/src/util/ellipsoid.cpp @@ -147,7 +147,7 @@ double Ellipsoid::greatCircleDistance(const Geodetic2& p1, const Geodetic2& p2) Geodetic2 Ellipsoid::cartesianToGeodetic2(const glm::dvec3& p) const { const glm::dvec3 normal = geodeticSurfaceNormalForGeocentricallyProjectedPoint(p); - return glm::length(normal) ? + return glm::length(normal) != 0.0 ? Geodetic2 { std::asin(normal.z / glm::length(normal)), std::atan2(normal.y, normal.x) diff --git a/src/util/json_helper.cpp b/src/util/json_helper.cpp index e1c51cbc15..11c05d8655 100644 --- a/src/util/json_helper.cpp +++ b/src/util/json_helper.cpp @@ -123,7 +123,7 @@ ghoul::Dictionary jsonToDictionary(const nlohmann::json& json) { // We can't represent arrays with different types, so we have to use a // Dictionary for that instead ghoul::Dictionary subDict; - for (int i = 0; i < j.size(); i++) { + for (size_t i = 0; i < j.size(); i++) { const nlohmann::json& value = j[i]; // We add 1 to the key to make Lua happy :-/ addToDict(subDict, std::format("{}", i + 1), value); diff --git a/src/util/spicemanager_lua.inl b/src/util/spicemanager_lua.inl index e2d5938b67..17ba0c9dfc 100644 --- a/src/util/spicemanager_lua.inl +++ b/src/util/spicemanager_lua.inl @@ -199,7 +199,7 @@ namespace { } const size_t nElements = lines.size() / 3; - if (elementToExtract > nElements) { + if (elementToExtract > static_cast(nElements)) { throw ghoul::RuntimeError(std::format( "Error loading {}. Element number {} requested, but only {} found", tle, nElements, elementToExtract diff --git a/src/util/time_lua.inl b/src/util/time_lua.inl index 17ede3be35..2dfb3a4daa 100644 --- a/src/util/time_lua.inl +++ b/src/util/time_lua.inl @@ -279,7 +279,7 @@ namespace { * the TimeManager. */ [[codegen::luawrap]] void interpolateTime(std::variant time, - std::optional interpolationDutation) + std::optional interpolationDuration) { using namespace openspace; @@ -289,7 +289,7 @@ namespace { std::get(time); - double interp = interpolationDutation.value_or( + double interp = interpolationDuration.value_or( global::timeManager->defaultTimeInterpolationDuration() ); if (interp > 0) { diff --git a/support/cmake/common-compile-settings b/support/cmake/common-compile-settings new file mode 160000 index 0000000000..31de3bfe2e --- /dev/null +++ b/support/cmake/common-compile-settings @@ -0,0 +1 @@ +Subproject commit 31de3bfe2e1413baf4d674ddc69bb9edafad2ad7 diff --git a/support/cmake/module_definition.cmake b/support/cmake/module_definition.cmake index c799821237..7bac7597ba 100644 --- a/support/cmake/module_definition.cmake +++ b/support/cmake/module_definition.cmake @@ -146,3 +146,13 @@ function (handle_module_dependencies target_name module_name) endforeach () endif () endfunction () + + +# Disables compiler warnings for the provided library +function (disable_compiler_warnings target) + if (MSVC) + target_compile_options(${target} PRIVATE "/W0") + else () + target_compile_options(${target} PRIVATE "-w") + endif () +endfunction() diff --git a/support/cmake/set_openspace_compile_settings.cmake b/support/cmake/set_openspace_compile_settings.cmake index 94531cc2b2..d0643ec889 100644 --- a/support/cmake/set_openspace_compile_settings.cmake +++ b/support/cmake/set_openspace_compile_settings.cmake @@ -22,245 +22,15 @@ # OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # ########################################################################################## +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/support/cmake/common-compile-settings") +include(${PROJECT_SOURCE_DIR}/support/cmake/common-compile-settings/common-compile-settings.cmake) + function (set_openspace_compile_settings target) - # Switching to cxx_std_23 triggers a bug in Clang17 - # https://github.com/llvm/llvm-project/issues/61415 - target_compile_features(${target} PUBLIC cxx_std_20) + set_compile_settings(${target}) - set(MSVC_WARNINGS - "/MP" # Multi-threading support - "/W4" # Highest warning level - "/w44062" # missing case label - "/w44165" # 'HRESULT' is being converted to 'bool' - "/w44242" # conversion from 'type1' to 'type2', possible loss of data - "/w44254" # conversion from 'type1' to 'type2', possible loss of data - "/w44263" # member function does not override any base class virtual member function - "/w44265" # class has virtual functions, but destructor is not virtual - "/w44287" # unsigned/negative constant mismatch - "/w44289" # using for-loop variable outside of loop - "/w44296" # expression is always true/false - "/w44437" # dynamic_cast could fail in some contexts - "/w44545" # expression before comma evaluates to a function missing an argument list - "/w44547" # operator before comma has no effect - "/w44548" # operator before comma has no effect - "/w44549" # operator before comma has no effect - "/w44555" # expression has no effect; expected expression with side-effect - "/w44574" # 'identifier' is defined to be '0': did you mean to use '#if identifier'? - "/w44619" # #pragma warning: there is no warning number 'number' - "/w44643" # Forward declaring 'identifier' in namespace std is not permitted - "/w44800" # Implicit conversion from 'type' to bool. Possible information loss - "/w44822" # local class member function does not have a body - "/w44841" # non-standard extension used: compound member designator used in offsetof - "/w44842" # the result of 'offsetof' applied to a type using multiple inheritance is - # not guaranteed to be consistent between compiler releases - "/w44946" # reinterpret_cast used between related classes: 'class1' and 'class2' - "/w44986" # exception specification does not match previous declaration - "/w44987" # nonstandard extension used: 'throw (...)' - "/w45022" # multiple move constructors specified - "/w45023" # multiple move assignment operators specified - "/w45031" # #pragma warning(pop): likely mismatch, popping warning state pushed in - # different file - "/w45032" # detected #pragma warning(push) with no #pragma warning(pop) - "/w45038" # data member 'member1' will be initialized after data member 'member2' - "/w45041" # out-of-line definition for constexpr data is deprecated - "/w45042" # function declarations at block scope cannot be specified 'inline' - "/w45204" # virtual class has non-virtual trivial destructor - "/w45233" # explicit lambda capture 'identifier' is not used - "/w45340" # attribute is ignored in this syntactic position - "/w45243" # using incomplete class 'class-name' can cause potential one definition - # rule violation due to ABI limitation - "/w45245" # unreferenced function with internal linkage has been removed - "/w45249" # 'bitfield' of type 'enumeration_name' has named enumerators with values - # that cannot be represented in the given bit field width of - # 'bitfield_width'. - "/w45258" # explicit capture of 'symbol' is not required for this use - "/w45259" # explicit specialization requires 'template <>' - "/w45262" # implicit fall-through occurs here - "/w45263" # calling 'std::move' on a temporary object prevents copy elision - "/w45264" # 'const' variable is not used - "/w45266" # 'const' qualifier on return type has no effect - "/wd4127" # conditional expression is constant [raised by: websocketpp] - "/wd4201" # nonstandard extension used : nameless struct/union [raised by: GLM] - "/wd5030" # attribute 'attribute' is not recognized [raised by: codegen] - "/permissive-" - "/Zc:__cplusplus" # Correctly set the __cplusplus macro - ) - if (OPENSPACE_OPTIMIZATION_ENABLE_AVX) - set(MSVC_WARNINGS ${MSVC_WARNINGS} "/arch:AVX") - endif () - if (OPENSPACE_OPTIMIZATION_ENABLE_AVX2) - set(MSVC_WARNINGS ${MSVC_WARNINGS} "/arch:AVX2") - endif () - if (OPENSPACE_OPTIMIZATION_ENABLE_AVX512) - set(MSVC_WARNINGS ${MSVC_WARNINGS} "/arch:AVX512") - endif () - if (OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS) - set(MSVC_WARNINGS ${MSVC_WARNINGS} - "/Oi" # usage of intrinsic functions - "/GL" # Whole program optimization + if (GHOUL_ENABLE_EDIT_CONTINUE) + target_compile_options(${target} PRIVATE + "/ZI" # Edit and continue support ) - else () - if (GHOUL_ENABLE_EDIT_CONTINUE) - set(MSVC_WARNINGS ${MSVC_WARNINGS} - "/ZI" # Edit and continue support - ) - endif () - endif () - - set(CLANG_WARNINGS - "-Wall" - "-Wextra" - "-Wmost" - "-Wpedantic" - - "-Wabstract-vbase-init" - "-Walloca" - "-Wanon-enum-enum-conversion" - "-Warray-bounds-pointer-arithmetic" - "-Wassign-enum" - "-Wbad-function-cast" - "-Wbinary-literal" - "-Wbind-to-temporary-copy" - "-Wbitfield-constant-conversion" - "-Wbool-conversions" - "-Wcast-align" - "-Wcast-qual" - "-Wcomma" - "-Wconditional-uninitialized" - "-Wdate-time" - "-Wdeprecated-dynamic-exception-spec" - "-Wdeprecated-this-capture" - "-Wdivision-by-zero" - "-Wdtor-name" - "-Wduplicate-decl-specifier" - "-Wduplicate-enum" - "-Wduplicate-method-arg" - "-Wduplicate-method-match" - "-Wextra-semi" - "-Wfloat-overflow-conversion" - "-Wfloat-zero-conversion" - "-Wformat" - "-Wformat-non-iso" - "-Wformat-nonliteral" - "-Wformat-pedantic" - "-Wformat-type-confusion" - "-Wheader-hygiene" - "-Widiomatic-parentheses" - "-Wimplicit" - "-Wimplicit-fallthrough" - "-Wloop-analysis" - "-Wmain" - "-Wmethod-signatures" - "-Wmissing-noreturn" - "-Wmove" - "-Wnon-virtual-dtor" - "-Wold-style-cast" - "-Wpointer-arith" - "-Wpragmas" - "-Wrange-loop-analysis" - "-Wreorder" - "-Wshadow-all" - "-Wshift-sign-overflow" - "-Wshorten-64-to-32" - "-Wsometimes-uninitialized" - "-Wstring-conversion" - "-Wsuggest-destructor-override" - "-Wsuggest-override" - "-Wtautological-compare" - "-Wtautological-constant-in-range-compare" - "-Wtautological-constant-out-of-range-compare" - "-Wthread-safety" - "-Wtype-limits" - "-Wundef" - "-Wundefined-reinterpret-cast" - "-Wuninitialized-const-reference" - "-Wunneeded-internal-declaration" - "-Wunneeded-member-function" - "-Wunreachable-code" - "-Wunreachable-code-break" - "-Wunreachable-code-return" - "-Wunused" - "-Wunused-const-variable" - "-Wunused-exception-parameter" - "-Wunused-macros" - "-Wunused-result" - "-Wvariadic-macros" - "-Wvla" - "-Wzero-as-null-pointer-constant" - - "-Wno-attributes" - "-Wno-deprecated-enum-enum-conversion" - "-Wno-missing-braces" - "-Wno-missing-designated-field-initializers" - "-Wno-sign-compare" - "-Wno-suggest-destructor-override" - "-Wno-unknown-attributes" - - # This should be removed as soon as https://github.com/g-truc/glm/issues/1349 is - # addressed - "-Wno-defaulted-function-deleted" - ) - - - set(GCC_WARNINGS - "-ggdb" - "-Wall" - "-Wextra" - "-Wpedantic" - - "-Walloc-zero" - "-Wcast-qual" - "-Wdate-time" - "-Wduplicated-branches" - "-Wduplicated-cond" - "-Wformat" - "-Wlogical-op" - "-Wmain" - "-Wnon-virtual-dtor" - "-Wold-style-cast" - "-Woverloaded-virtual" - "-Wshadow" - "-Wsuggest-override" - "-Wtautological-compare" - "-Wtype-limits" - "-Wundef" - "-Wunused" - "-Wuninitialized" - "-Wvla" - "-Wzero-as-null-pointer-constant" - - "-Wno-attributes" - "-Wno-deprecated-copy" - "-Wno-deprecated-enum-enum-conversion" - "-Wno-float-equal" - "-Wno-long-long" - "-Wno-missing-field-initializers" - "-Wno-sign-compare" - "-Wno-unknown-attributes" - "-Wno-write-strings" - ) - - if (MSVC) - target_compile_options(${target} PRIVATE ${MSVC_WARNINGS}) - - # Boost as of 1.64 still uses unary_function unless we define this - target_compile_definitions(${target} - PRIVATE "_HAS_AUTO_PTR_ETC" - PUBLIC "_CRT_SECURE_NO_WARNINGS" - PRIVATE "NOMINMAX" - PRIVATE "WIN32_LEAN_AND_MEAN" - PRIVATE "VC_EXTRALEAN" - ) - elseif (NOT LINUX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") - # Apple has "deprecated" OpenGL and offers nothing but warnings instead - target_compile_definitions(${target} PRIVATE "GL_SILENCE_DEPRECATION") - - target_compile_options(${target} PRIVATE ${CLANG_WARNINGS}) - elseif (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") - target_compile_options(${target} PRIVATE ${CLANG_WARNINGS}) - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - target_compile_options(${target} PRIVATE ${GCC_WARNINGS}) - else () - message("Compiler not handled in set_openspace_compile_settings.cmake") endif () endfunction () diff --git a/support/coding/codegen b/support/coding/codegen index 881fc305be..b65fe7a1fe 160000 --- a/support/coding/codegen +++ b/support/coding/codegen @@ -1 +1 @@ -Subproject commit 881fc305bec99fd178315cacdd2a38919a2e3f23 +Subproject commit b65fe7a1fe85081f9b5df1dd9b3e3de886538ecc diff --git a/tests/test_documentation.cpp b/tests/test_documentation.cpp index 727f687cf5..2a83f37a64 100644 --- a/tests/test_documentation.cpp +++ b/tests/test_documentation.cpp @@ -87,14 +87,11 @@ TEST_CASE("Documentation: Constructor", "[documentation]") { doc.entries.emplace_back("IntListVerifier", new IntListVerifier); // Range Verifiers - doc.entries.emplace_back("InListDouble", new DoubleInRangeVerifier({ 0.0, 1.0 })); - doc.entries.emplace_back("InListInt", new IntInRangeVerifier({ 0, 1 })); + doc.entries.emplace_back("InListDouble", new DoubleInRangeVerifier(0.0, 1.0)); + doc.entries.emplace_back("InListInt", new IntInRangeVerifier(0, 1)); - doc.entries.emplace_back( - "NotInListDouble", - new DoubleNotInRangeVerifier({ 0.0, 1.0 }) - ); - doc.entries.emplace_back("NotInListInt", new IntNotInRangeVerifier({ 0, 1 })); + doc.entries.emplace_back("NotInListDouble", new DoubleNotInRangeVerifier(0.0, 1.0)); + doc.entries.emplace_back("NotInListInt", new IntNotInRangeVerifier(0, 1)); // Misc Verifiers doc.entries.emplace_back("AnnotationBool", new BoolAnnotationVerifier("Bool")); @@ -2063,7 +2060,7 @@ TEST_CASE("Documentation: Referencing", "[documentation]") { inner.setValue("a", 1); inner.setValue("b", 2.0); positive.setValue("Table", inner); - }; + } const TestResult positiveRes = testSpecification(doc, positive); CHECK(positiveRes.success); CHECK(positiveRes.offenses.empty()); @@ -2082,7 +2079,7 @@ TEST_CASE("Documentation: Referencing", "[documentation]") { inner.setValue("a", 1); inner.setValue("b", true); negative2.setValue("Table", inner); - }; + } negativeRes = testSpecification(doc, negative2); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2157,7 +2154,7 @@ TEST_CASE("Documentation: IntVector2Verifier", "[documentation]") { inner.setValue("1", true); inner.setValue("2", 1); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2192,7 +2189,7 @@ TEST_CASE("Documentation: DoubleVector2Verifier", "[documentation]") { inner.setValue("1", true); inner.setValue("2", 1.0); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2229,7 +2226,7 @@ TEST_CASE("Documentation: IntVector3Verifier", "[documentation]") { inner.setValue("2", 1); inner.setValue("3", "s"s); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2266,7 +2263,7 @@ TEST_CASE("Documentation: DoubleVector3Verifier", "[documentation]") { inner.setValue("2", 1.0); inner.setValue("3", "s"s); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2304,7 +2301,7 @@ TEST_CASE("Documentation: IntVector4Verifier", "[documentation]") { inner.setValue("3", "s"s); inner.setValue("4", 1); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2342,7 +2339,7 @@ TEST_CASE("Documentation: DoubleVector4Verifier", "[documentation]") { inner.setValue("3", "s"s); inner.setValue("4", 1); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2379,7 +2376,7 @@ TEST_CASE("Documentation: DoubleMatrix2x2Verifier", "[documentation]") { inner.setValue("2", 1.0); inner.setValue("3", "s"s); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2453,7 +2450,7 @@ TEST_CASE("Documentation: DoubleMatrix2x4Verifier", "[documentation]") { inner.setValue("2", 1.0); inner.setValue("3", "s"s); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2490,7 +2487,7 @@ TEST_CASE("Documentation: DoubleMatrix3x2Verifier", "[documentation]") { inner.setValue("2", 1.0); inner.setValue("3", "s"s); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2527,7 +2524,7 @@ TEST_CASE("Documentation: DoubleMatrix3x3Verifier", "[documentation]") { inner.setValue("2", 1.0); inner.setValue("3", "s"s); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2564,7 +2561,7 @@ TEST_CASE("Documentation: DoubleMatrix3x4Verifier", "[documentation]") { inner.setValue("2", 1.0); inner.setValue("3", "s"s); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2601,7 +2598,7 @@ TEST_CASE("Documentation: DoubleMatrix4x2Verifier", "[documentation]") { inner.setValue("2", 1.0); inner.setValue("3", "s"s); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2638,7 +2635,7 @@ TEST_CASE("Documentation: DoubleMatrix4x3Verifier", "[documentation]") { inner.setValue("2", 1.0); inner.setValue("3", "s"s); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2675,7 +2672,7 @@ TEST_CASE("Documentation: DoubleMatrix4x4Verifier", "[documentation]") { inner.setValue("2", 1.0); inner.setValue("3", "s"s); negative.setValue("a", inner); - }; + } TestResult negativeRes = testSpecification(doc, negative); CHECK_FALSE(negativeRes.success); REQUIRE(negativeRes.offenses.size() == 1); @@ -2735,10 +2732,10 @@ TEST_CASE("Documentation: Verifier Type Post Conditions", "[documentation]") { CHECK(!DoubleNotInListVerifier({ 0.0 }).type().empty()); CHECK(!StringNotInListVerifier({ ""s }).type().empty()); - CHECK(!IntInRangeVerifier({ 0, 1 }).type().empty()); - CHECK(!DoubleInRangeVerifier({ 0.0, 1.0 }).type().empty()); - CHECK(!IntNotInRangeVerifier({ 0, 1 }).type().empty()); - CHECK(!DoubleNotInRangeVerifier({ 0.0, 1.0 }).type().empty()); + CHECK(!IntInRangeVerifier(0, 1).type().empty()); + CHECK(!DoubleInRangeVerifier(0.0, 1.0).type().empty()); + CHECK(!IntNotInRangeVerifier(0, 1).type().empty()); + CHECK(!DoubleNotInRangeVerifier(0.0, 1.0).type().empty()); CHECK(!BoolAnnotationVerifier("A"s).type().empty()); CHECK(!IntAnnotationVerifier("A"s).type().empty());