From 86bb19d81c2c0e8a33da0d3b92ad1846211eea18 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 7 Dec 2020 23:43:05 +0100 Subject: [PATCH] Feature/warnings (#1425) * Remove MSVC, GCC, Clang compiler warnings * Remove cppcheck warnings --- .../include/profile/deltatimesdialog.h | 2 +- .../include/profile/keybindingsdialog.h | 2 +- .../include/profile/marknodesdialog.h | 2 +- .../launcher/include/profile/modulesdialog.h | 2 +- .../launcher/include/profile/profileedit.h | 2 +- .../include/profile/propertiesdialog.h | 2 +- .../ext/launcher/src/filesystemaccess.cpp | 9 ++- .../ext/launcher/src/profile/assetsdialog.cpp | 7 +-- .../launcher/src/profile/assettreeitem.cpp | 16 ++--- .../ext/launcher/src/profile/cameradialog.cpp | 2 +- .../launcher/src/profile/deltatimesdialog.cpp | 16 ++--- .../src/profile/keybindingsdialog.cpp | 4 +- .../launcher/src/profile/marknodesdialog.cpp | 4 +- .../ext/launcher/src/profile/profileedit.cpp | 6 +- apps/OpenSpace/ext/sgct | 2 +- ext/ghoul | 2 +- include/openspace/network/messagestructures.h | 14 +++-- include/openspace/util/httprequest.h | 3 - include/openspace/util/syncbuffer.h | 5 ++ include/openspace/util/syncbuffer.inl | 7 ++- .../rendering/atmospheredeferredcaster.cpp | 2 +- .../rendering/renderableatmosphere.cpp | 2 +- .../dashboarditemparallelconnection.cpp | 2 - .../rendering/grids/renderableradialgrid.cpp | 1 - modules/base/rendering/renderablenodeline.cpp | 6 +- modules/base/rendering/renderableplane.cpp | 2 +- modules/base/rendering/renderabletrail.cpp | 7 ++- .../rendering/renderableplanescloud.cpp | 10 +--- modules/exoplanets/exoplanetshelper.h | 9 ++- .../rendering/renderableorbitdisc.cpp | 6 +- .../tasks/exoplanetsdatapreparationtask.cpp | 7 ++- modules/fitsfilereader/CMakeLists.txt | 6 +- modules/fitsfilereader/src/fitsfilereader.cpp | 2 +- .../gaia/rendering/renderablegaiastars.cpp | 18 +++--- modules/gaia/tasks/readfilejob.cpp | 2 +- modules/galaxy/rendering/renderablegalaxy.cpp | 14 ++--- modules/globebrowsing/globebrowsingmodule.cpp | 15 +++-- modules/globebrowsing/src/basictypes.h | 6 +- .../src/globelabelscomponent.cpp | 2 - modules/globebrowsing/src/layer.cpp | 12 ++-- .../globebrowsing/src/rawtiledatareader.cpp | 40 ++++++------- modules/globebrowsing/src/renderableglobe.cpp | 30 ++++------ modules/globebrowsing/src/shadowcomponent.cpp | 4 +- modules/globebrowsing/src/tileprovider.cpp | 28 ++++----- .../globebrowsing/src/tiletextureinitdata.cpp | 8 +-- modules/globebrowsing/src/timequantizer.cpp | 28 +++------ modules/globebrowsing/src/timequantizer.h | 7 --- modules/imgui/src/gui.cpp | 4 +- modules/imgui/src/guigibscomponent.cpp | 2 +- modules/imgui/src/guimemorycomponent.cpp | 2 +- modules/imgui/src/guispacetimecomponent.cpp | 4 +- .../src/topics/flightcontrollertopic.cpp | 11 ---- .../rendering/renderableorbitalkepler.cpp | 11 ++-- .../space/rendering/renderableorbitalkepler.h | 1 - .../space/rendering/renderablesatellites.cpp | 1 - .../space/rendering/renderablesatellites.h | 2 +- .../space/rendering/renderablesmallbody.cpp | 41 +++++++------ modules/space/rendering/renderablesmallbody.h | 5 -- modules/space/rendering/renderablestars.cpp | 2 +- .../dashboard/dashboarditeminstruments.cpp | 2 - .../rendering/renderablemodelprojection.cpp | 2 - .../util/hongkangparser.cpp | 16 +++-- .../util/projectioncomponent.cpp | 2 +- modules/sync/tasks/syncassettask.cpp | 1 - modules/volume/rawvolume.inl | 7 +-- src/CMakeLists.txt | 4 +- src/documentation/documentationengine.cpp | 8 +-- src/documentation/verifier.cpp | 54 ++++++++--------- src/interaction/externinteraction.cpp | 29 --------- src/interaction/interactionmonitor.cpp | 2 - src/interaction/navigationhandler.cpp | 28 ++++----- src/interaction/navigationhandler_lua.inl | 16 ++--- src/interaction/orbitalnavigator.cpp | 7 --- src/interaction/scriptcamerastates.cpp | 5 -- src/interaction/sessionrecording.cpp | 18 +++--- .../tasks/convertrecfileversiontask.cpp | 2 +- .../tasks/convertrecformattask.cpp | 3 +- src/network/parallelserver.cpp | 6 -- src/properties/propertyowner.cpp | 2 +- src/rendering/dashboard.cpp | 2 +- src/rendering/helper.cpp | 16 ++--- src/rendering/luaconsole.cpp | 2 +- src/rendering/renderengine.cpp | 29 ++++----- src/rendering/screenspacerenderable.cpp | 27 ++++----- src/scene/assetloader.cpp | 6 +- src/scene/profile.cpp | 2 - src/scene/scene_lua.inl | 10 ++-- src/util/blockplaneintersectiongeometry.cpp | 2 +- src/util/keys.cpp | 4 -- src/util/syncbuffer.cpp | 30 +++++++++- src/util/timemanager.cpp | 10 ++-- src/util/touch.cpp | 14 ++--- support/cppcheck/suppressions.txt | 4 +- tests/test_latlonpatch.cpp | 60 +++++++++---------- 94 files changed, 392 insertions(+), 511 deletions(-) diff --git a/apps/OpenSpace/ext/launcher/include/profile/deltatimesdialog.h b/apps/OpenSpace/ext/launcher/include/profile/deltatimesdialog.h index 3d192af852..2dae14f531 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/deltatimesdialog.h +++ b/apps/OpenSpace/ext/launcher/include/profile/deltatimesdialog.h @@ -61,7 +61,7 @@ public: * * \param evt #QKeyEvent object for the key press event */ - void keyPressEvent(QKeyEvent* evt); + virtual void keyPressEvent(QKeyEvent* evt) override; private slots: diff --git a/apps/OpenSpace/ext/launcher/include/profile/keybindingsdialog.h b/apps/OpenSpace/ext/launcher/include/profile/keybindingsdialog.h index 2bc01477ca..42d9a0e162 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/keybindingsdialog.h +++ b/apps/OpenSpace/ext/launcher/include/profile/keybindingsdialog.h @@ -56,7 +56,7 @@ public: * * \param evt #QKeyEvent object for the key press event */ - void keyPressEvent(QKeyEvent* evt); + virtual void keyPressEvent(QKeyEvent* evt) override; private slots: void listItemSelected(); diff --git a/apps/OpenSpace/ext/launcher/include/profile/marknodesdialog.h b/apps/OpenSpace/ext/launcher/include/profile/marknodesdialog.h index eae3617543..9c0ec0bd5a 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/marknodesdialog.h +++ b/apps/OpenSpace/ext/launcher/include/profile/marknodesdialog.h @@ -51,7 +51,7 @@ public: * * \param evt #QKeyEvent object for the key press event */ - void keyPressEvent(QKeyEvent* evt); + void keyPressEvent(QKeyEvent* evt) override; private slots: void listItemSelected(); diff --git a/apps/OpenSpace/ext/launcher/include/profile/modulesdialog.h b/apps/OpenSpace/ext/launcher/include/profile/modulesdialog.h index c2c419528f..c15e95ccb7 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/modulesdialog.h +++ b/apps/OpenSpace/ext/launcher/include/profile/modulesdialog.h @@ -52,7 +52,7 @@ public: * * \param evt #QKeyEvent object for the key press event */ - void keyPressEvent(QKeyEvent* evt); + virtual void keyPressEvent(QKeyEvent* evt) override; private slots: void listItemSelected(); diff --git a/apps/OpenSpace/ext/launcher/include/profile/profileedit.h b/apps/OpenSpace/ext/launcher/include/profile/profileedit.h index d8de4c4ab9..6ad0ea05be 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/profileedit.h +++ b/apps/OpenSpace/ext/launcher/include/profile/profileedit.h @@ -75,7 +75,7 @@ public: * * \param evt #QKeyEvent object for the key press event */ - void keyPressEvent(QKeyEvent* evt); + virtual void keyPressEvent(QKeyEvent* evt) override; private slots: void duplicateProfile(); diff --git a/apps/OpenSpace/ext/launcher/include/profile/propertiesdialog.h b/apps/OpenSpace/ext/launcher/include/profile/propertiesdialog.h index ac13ed474e..a04e4cf2e7 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/propertiesdialog.h +++ b/apps/OpenSpace/ext/launcher/include/profile/propertiesdialog.h @@ -53,7 +53,7 @@ public: * * \param evt #QKeyEvent object for the key press event */ - void keyPressEvent(QKeyEvent* evt); + virtual void keyPressEvent(QKeyEvent* evt) override; private slots: void listItemSelected(); diff --git a/apps/OpenSpace/ext/launcher/src/filesystemaccess.cpp b/apps/OpenSpace/ext/launcher/src/filesystemaccess.cpp index f0a98ce58d..91489868f1 100644 --- a/apps/OpenSpace/ext/launcher/src/filesystemaccess.cpp +++ b/apps/OpenSpace/ext/launcher/src/filesystemaccess.cpp @@ -56,14 +56,13 @@ void FileSystemAccess::parseChildDirElements(QFileInfo fileInfo, std::string spa QFileInfoList fileList = dir.entryInfoList(_fileFilterOptions); for (int i = 0; i < fileList.size(); i++) { - QFileInfo fileInfo = fileList[i]; - std::string res = space + fileInfo.fileName().toStdString(); + QFileInfo fi = fileList[i]; + std::string res = space + fi.fileName().toStdString(); - if (fileInfo.isDir()) { + if (fi.isDir()) { if (level != 0 || (level == 0 && isApprovedPath(res))) { dirNames.push_back(res); - parseChildDirElements(fileInfo, (space + " "), level + 1, dirNames, - output); + parseChildDirElements(fi, (space + " "), level + 1, dirNames, output); } } else { diff --git a/apps/OpenSpace/ext/launcher/src/profile/assetsdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/assetsdialog.cpp index e8d99b617c..d0cf730c76 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/assetsdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/assetsdialog.cpp @@ -207,12 +207,9 @@ QString AssetsDialog::createTextSummary() { return ""; } QString summary; - for (int i = 0; i < summaryItems.size(); ++i) { + for (size_t i = 0; i < summaryItems.size(); ++i) { bool existsInFilesystem = summaryItems.at(i)->doesExistInFilesystem(); - constexpr const char* ExistsFormat = "{}
"; - constexpr const char* NotExistsFormat = "{}
"; - std::string s = existsInFilesystem ? fmt::format("{}
", summaryPaths.at(i)) : fmt::format("{}
", summaryPaths.at(i)); @@ -233,6 +230,6 @@ void AssetsDialog::parseSelections() { accept(); } -void AssetsDialog::selected(const QModelIndex& sel) { +void AssetsDialog::selected(const QModelIndex&) { _summary->setText(createTextSummary()); } diff --git a/apps/OpenSpace/ext/launcher/src/profile/assettreeitem.cpp b/apps/OpenSpace/ext/launcher/src/profile/assettreeitem.cpp index 199a755fb1..7ad1f07e09 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/assettreeitem.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/assettreeitem.cpp @@ -55,7 +55,7 @@ int AssetTreeItem::row() const { _parentItem->_childItems.cend(), this ); - return std::distance(_parentItem->_childItems.cbegin(), it); + return static_cast(std::distance(_parentItem->_childItems.cbegin(), it)); } else { return 0; @@ -63,11 +63,11 @@ int AssetTreeItem::row() const { } int AssetTreeItem::columnCount() const { - return _itemData.size(); + return static_cast(_itemData.size()); } QVariant AssetTreeItem::data(int column) const { - if (column < 0 || column >= _itemData.size()) { + if (column < 0 || column >= static_cast(_itemData.size())) { return QVariant(); } else { @@ -76,7 +76,7 @@ QVariant AssetTreeItem::data(int column) const { } bool AssetTreeItem::setData(int column, const QVariant& value) { - if (column < 0 || column >= _itemData.size()) { + if (column < 0 || column >= static_cast(_itemData.size())) { return false; } @@ -112,11 +112,11 @@ bool AssetTreeItem::doesExistInFilesystem() const { } QString AssetTreeItem::name() const { - return QString(data(0).toString()); + return data(0).toString(); } bool AssetTreeItem::insertChildren(int position, int count, int columns) { - if (position < 0 || position > _childItems.size()) { + if (position < 0 || position > static_cast(_childItems.size())) { return false; } @@ -130,7 +130,7 @@ bool AssetTreeItem::insertChildren(int position, int count, int columns) { } bool AssetTreeItem::removeChildren(int position, int count) { - if (position < 0 || position + count > _childItems.size()) { + if (position < 0 || position + count > static_cast(_childItems.size())) { return false; } @@ -143,7 +143,7 @@ bool AssetTreeItem::removeChildren(int position, int count) { } bool AssetTreeItem::insertColumns(int position, int columns) { - if (position < 0 || position > _itemData.size()) { + if (position < 0 || position > static_cast(_itemData.size())) { return false; } diff --git a/apps/OpenSpace/ext/launcher/src/profile/cameradialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/cameradialog.cpp index 206549e1f3..ce586a449f 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/cameradialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/cameradialog.cpp @@ -308,7 +308,7 @@ bool CameraDialog::areRequiredFormsFilledAndValid() { allFormsOk = false; addErrorMsg("Position Z is empty"); } - int upVectorCount = 0; + const bool hasUpX = !_navState.upX->text().isEmpty(); const bool hasUpY = !_navState.upY->text().isEmpty(); const bool hasUpZ = !_navState.upZ->text().isEmpty(); diff --git a/apps/OpenSpace/ext/launcher/src/profile/deltatimesdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/deltatimesdialog.cpp index 8beac8fb1d..b78a132443 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/deltatimesdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/deltatimesdialog.cpp @@ -75,7 +75,7 @@ namespace { break; } } - return checkForTimeDescription(i, value); + return checkForTimeDescription(static_cast(i), value); } } // namespace @@ -230,8 +230,8 @@ void DeltaTimesDialog::listItemSelected() { void DeltaTimesDialog::setLabelForKey(int index, bool editMode, std::string color) { std::string labelS = "Set Simulation Time Increment for key"; - if (index >= _data.size()) { - index = _data.size() - 1; + if (index >= static_cast(_data.size())) { + index = static_cast(_data.size()) - 1; } if (editMode) { labelS += " '" + createSummaryForDeltaTime(index, false) + "':"; @@ -242,14 +242,14 @@ void DeltaTimesDialog::setLabelForKey(int index, bool editMode, std::string colo } void DeltaTimesDialog::valueChanged(const QString& text) { - if (_seconds->text().isEmpty()) { + if (text.isEmpty()) { _errorMsg->setText(""); } else { - int value = _seconds->text().toDouble(); + int value = text.toDouble(); if (value != 0) { _value->setText(QString::fromStdString( - timeDescription(_seconds->text().toDouble())) + timeDescription(text.toDouble())) ); _errorMsg->setText(""); } @@ -358,14 +358,14 @@ void DeltaTimesDialog::parseSelections() { if ((_data.size() == 1) && (_data.at(0) == 0)) { _data.clear(); } - int finalNonzeroIndex = _data.size() - 1; + int finalNonzeroIndex = static_cast(_data.size()) - 1; for (; finalNonzeroIndex >= 0; --finalNonzeroIndex) { if (_data.at(finalNonzeroIndex) != 0) { break; } } std::vector tempDt; - for (size_t i = 0; i < (finalNonzeroIndex + 1); ++i) { + for (int i = 0; i < (finalNonzeroIndex + 1); ++i) { tempDt.push_back(_data[i]); } _profile.setDeltaTimes(tempDt); diff --git a/apps/OpenSpace/ext/launcher/src/profile/keybindingsdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/keybindingsdialog.cpp index 2201d728ba..df51a77bf6 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/keybindingsdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/keybindingsdialog.cpp @@ -323,7 +323,7 @@ void KeybindingsDialog::keySelected(int index) { int KeybindingsDialog::indexInKeyMapping(std::vector& mapVector, int keyInt) { const auto it = std::find(mapVector.cbegin(), mapVector.cend(), keyInt); - return std::distance(mapVector.cbegin(), it); + return static_cast(std::distance(mapVector.cbegin(), it)); } bool KeybindingsDialog::isLineEmpty(int index) { @@ -338,8 +338,6 @@ bool KeybindingsDialog::isLineEmpty(int index) { } void KeybindingsDialog::listItemAdded() { - int currentListSize = _list->count(); - _data.push_back(BlankKey); _list->addItem(new QListWidgetItem(" (Enter details below & click 'Save')")); // Scroll down to that blank line highlighted diff --git a/apps/OpenSpace/ext/launcher/src/profile/marknodesdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/marknodesdialog.cpp index 604827f837..ce4c6d58dc 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/marknodesdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/marknodesdialog.cpp @@ -112,7 +112,7 @@ void MarkNodesDialog::listItemAdded() { std::string itemToAdd = _newNode->text().toStdString(); const auto it = std::find(_data.cbegin(), _data.cend(), itemToAdd); if (it != _data.end()) { - _list->setCurrentRow(std::distance(_data.cbegin(), it)); + _list->setCurrentRow(static_cast(std::distance(_data.cbegin(), it))); } else { _data.push_back(itemToAdd); @@ -131,7 +131,7 @@ void MarkNodesDialog::listItemRemove() { QListWidgetItem* item = _list->currentItem(); int index = _list->row(item); - if (index < 0 || index >= _markedNodesListItems.size()) { + if (index < 0 || index >= static_cast(_markedNodesListItems.size())) { return; } diff --git a/apps/OpenSpace/ext/launcher/src/profile/profileedit.cpp b/apps/OpenSpace/ext/launcher/src/profile/profileedit.cpp index 46e7a8d942..3141d8f9c3 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/profileedit.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/profileedit.cpp @@ -50,7 +50,7 @@ using namespace openspace; namespace { - QString labelText(int size, QString title) { + QString labelText(size_t size, QString title) { QString label; if (size > 0) { label = title + " (" + QString::number(size) + ")"; @@ -98,9 +98,9 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string& profileName, const std::vector& readOnlyProfiles, QWidget* parent) : QDialog(parent) + , _profile(profile) , _assetBasePath(std::move(assetBasePath)) , _profileBasePath(std::move(profileBasePath)) - , _profile(profile) , _readOnlyProfiles(readOnlyProfiles) { setWindowTitle("Profile Editor"); @@ -373,7 +373,7 @@ void ProfileEdit::duplicateProfile() { // will remove the suffix here first profile = profile.substr(0, it); } - catch (const std::invalid_argument& e) { + catch (const std::invalid_argument&) { // If this exception is thrown, we did find a separator character but the // substring afterwards was not a number, so the user just added a separator // by themselves. In this case we don't do anything diff --git a/apps/OpenSpace/ext/sgct b/apps/OpenSpace/ext/sgct index e1a110f866..4a3882d46c 160000 --- a/apps/OpenSpace/ext/sgct +++ b/apps/OpenSpace/ext/sgct @@ -1 +1 @@ -Subproject commit e1a110f866afef2b2539100bf02893982b9eb304 +Subproject commit 4a3882d46cbcaec9675396e9d61bcb985c055323 diff --git a/ext/ghoul b/ext/ghoul index 37045760b0..4ca4101a7a 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 37045760b03bc0d8cac8e52c22c0d10a791ec16f +Subproject commit 4ca4101a7a12fc029ace1a2b47702733c9cb2a02 diff --git a/include/openspace/network/messagestructures.h b/include/openspace/network/messagestructures.h index 8db45e0fda..5d19824f83 100644 --- a/include/openspace/network/messagestructures.h +++ b/include/openspace/network/messagestructures.h @@ -114,12 +114,12 @@ struct CameraKeyframe { // Position size = sizeof(_position); - std::memcpy(&_position, buffer.data() + offset, size); + std::memcpy(glm::value_ptr(_position), buffer.data() + offset, size); offset += size; // Orientation size = sizeof(_rotation); - std::memcpy(&_rotation, buffer.data() + offset, size); + std::memcpy(glm::value_ptr(_rotation), buffer.data() + offset, size); offset += size; // Follow focus node rotation? @@ -150,8 +150,14 @@ struct CameraKeyframe { }; void write(std::ostream& out) const { - out.write(reinterpret_cast(&_position), sizeof(_position)); - out.write(reinterpret_cast(&_rotation), sizeof(_rotation)); + out.write( + reinterpret_cast(glm::value_ptr(_position)), + sizeof(_position) + ); + out.write( + reinterpret_cast(glm::value_ptr(_rotation)), + sizeof(_rotation) + ); // Write follow focus node rotation? out.write( diff --git a/include/openspace/util/httprequest.h b/include/openspace/util/httprequest.h index fa08dd4c65..1cbade7885 100644 --- a/include/openspace/util/httprequest.h +++ b/include/openspace/util/httprequest.h @@ -184,7 +184,6 @@ class AsyncHttpDownload : public virtual HttpDownload { public: AsyncHttpDownload(std::string url); AsyncHttpDownload(AsyncHttpDownload&& d); - AsyncHttpDownload& operator=(AsyncHttpDownload&&) = default; virtual ~AsyncHttpDownload() = default; void start(HttpRequest::RequestOptions opt); void cancel(); @@ -210,8 +209,6 @@ public: HttpFileDownload() = default; HttpFileDownload(std::string destination, Overwrite = Overwrite::No); - HttpFileDownload(HttpFileDownload&& d) = default; - HttpFileDownload& operator=(HttpFileDownload&&) = default; virtual ~HttpFileDownload() = default; const std::string& destination() const; diff --git a/include/openspace/util/syncbuffer.h b/include/openspace/util/syncbuffer.h index c73d05270c..58c55981fc 100644 --- a/include/openspace/util/syncbuffer.h +++ b/include/openspace/util/syncbuffer.h @@ -25,6 +25,7 @@ #ifndef __OPENSPACE_CORE___SYNCBUFFER___H__ #define __OPENSPACE_CORE___SYNCBUFFER___H__ +#include #include #include #include @@ -48,6 +49,10 @@ public: T decode(); void decode(std::string& s); + void decode(glm::quat& value); + void decode(glm::dquat& value); + void decode(glm::vec3& value); + void decode(glm::dvec3& value); template void decode(T& value); diff --git a/include/openspace/util/syncbuffer.inl b/include/openspace/util/syncbuffer.inl index fcac31e1e5..3414ed687e 100644 --- a/include/openspace/util/syncbuffer.inl +++ b/include/openspace/util/syncbuffer.inl @@ -23,6 +23,7 @@ ****************************************************************************************/ #include +#include #include namespace openspace { @@ -36,7 +37,7 @@ void SyncBuffer::encode(const T& v) { _dataStream.resize(anticpatedBufferSize); } - memcpy(_dataStream.data() + _encodeOffset, &v, size); + std::memcpy(_dataStream.data() + _encodeOffset, &v, size); _encodeOffset += size; } @@ -45,7 +46,7 @@ T SyncBuffer::decode() { const size_t size = sizeof(T); ghoul_assert(_decodeOffset + size < _n, ""); T value; - memcpy(&value, _dataStream.data() + _decodeOffset, size); + std::memcpy(&value, _dataStream.data() + _decodeOffset, size); _decodeOffset += size; return value; } @@ -54,7 +55,7 @@ template void SyncBuffer::decode(T& value) { const size_t size = sizeof(T); ghoul_assert(_decodeOffset + size < _n, ""); - memcpy(&value, _dataStream.data() + _decodeOffset, size); + std::memcpy(&value, _dataStream.data() + _decodeOffset, size); _decodeOffset += size; } diff --git a/modules/atmosphere/rendering/atmospheredeferredcaster.cpp b/modules/atmosphere/rendering/atmospheredeferredcaster.cpp index 54dfbaa48e..00d9cd476a 100644 --- a/modules/atmosphere/rendering/atmospheredeferredcaster.cpp +++ b/modules/atmosphere/rendering/atmospheredeferredcaster.cpp @@ -1377,7 +1377,7 @@ void AtmosphereDeferredcaster::step3DTexture( shaderProg->setUniform("dhdH", dminT, dH, dminG, dh); } - shaderProg->setUniform("layer", static_cast(layer)); + shaderProg->setUniform("layer", layer); } void AtmosphereDeferredcaster::saveTextureToPPMFile(GLenum color_buffer_attachment, diff --git a/modules/atmosphere/rendering/renderableatmosphere.cpp b/modules/atmosphere/rendering/renderableatmosphere.cpp index 776c38032a..c4de1f58a9 100644 --- a/modules/atmosphere/rendering/renderableatmosphere.cpp +++ b/modules/atmosphere/rendering/renderableatmosphere.cpp @@ -713,7 +713,7 @@ glm::dmat4 RenderableAtmosphere::computeModelTransformMatrix( // scale the planet to appropriate size since the planet is a unit sphere return glm::translate(glm::dmat4(1.0), transformData.translation) * // Translation glm::dmat4(transformData.rotation) * // Spice rotation - glm::dmat4(glm::scale(glm::dmat4(1.0), glm::dvec3(transformData.scale))); + glm::scale(glm::dmat4(1.0), glm::dvec3(transformData.scale)); } void RenderableAtmosphere::render(const RenderData& data, RendererTasks& renderTask) { diff --git a/modules/base/dashboard/dashboarditemparallelconnection.cpp b/modules/base/dashboard/dashboarditemparallelconnection.cpp index 8f23e4928d..f2612c6641 100644 --- a/modules/base/dashboard/dashboarditemparallelconnection.cpp +++ b/modules/base/dashboard/dashboarditemparallelconnection.cpp @@ -204,11 +204,9 @@ glm::vec2 DashboardItemParallelConnection::size() const { connectionInfo += "\n"; if (nClients > 2) { - std::string c = std::to_string(nClients - 1); connectionInfo += fmt::format(Plural, nClients); } else if (nClients == 2) { - std::string c = std::to_string(nClients - 1); connectionInfo += fmt::format(Singular, nClients - 1); } else if (nClients == 1) { diff --git a/modules/base/rendering/grids/renderableradialgrid.cpp b/modules/base/rendering/grids/renderableradialgrid.cpp index 73c0f5ed25..cc7e030e80 100644 --- a/modules/base/rendering/grids/renderableradialgrid.cpp +++ b/modules/base/rendering/grids/renderableradialgrid.cpp @@ -324,7 +324,6 @@ void RenderableRadialGrid::update(const UpdateData&) { // Lines const int nLines = _gridSegments.value()[1]; const int nVertices = 2 * nLines; - const float fsegments = static_cast(nLines); _lines.varray.clear(); _lines.varray.reserve(nVertices); diff --git a/modules/base/rendering/renderablenodeline.cpp b/modules/base/rendering/renderablenodeline.cpp index fe875fd7df..68bfd4d0da 100644 --- a/modules/base/rendering/renderablenodeline.cpp +++ b/modules/base/rendering/renderablenodeline.cpp @@ -124,10 +124,10 @@ documentation::Documentation RenderableNodeLine::Documentation() { RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary) : Renderable(dictionary) - , _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f)) - , _lineWidth(LineWidthInfo, 2.f, 1.f, 20.f) , _start(StartNodeInfo, Root) , _end(EndNodeInfo, Root) + , _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f)) + , _lineWidth(LineWidthInfo, 2.f, 1.f, 20.f) { documentation::testSpecificationAndThrow( Documentation(), @@ -249,8 +249,6 @@ void RenderableNodeLine::updateVertexData() { _vertexArray.push_back(static_cast(_endPos.y)); _vertexArray.push_back(static_cast(_endPos.z)); - _vertexArray; - bindGL(); glBufferData( GL_ARRAY_BUFFER, diff --git a/modules/base/rendering/renderableplane.cpp b/modules/base/rendering/renderableplane.cpp index 93202d9578..fd0ee7eac7 100644 --- a/modules/base/rendering/renderableplane.cpp +++ b/modules/base/rendering/renderableplane.cpp @@ -102,9 +102,9 @@ documentation::Documentation RenderablePlane::Documentation() { RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary) : Renderable(dictionary) + , _blendMode(BlendModeInfo, properties::OptionProperty::DisplayType::Dropdown) , _billboard(BillboardInfo, false) , _size(SizeInfo, 10.f, 0.f, 1e25f) - , _blendMode(BlendModeInfo, properties::OptionProperty::DisplayType::Dropdown) { documentation::testSpecificationAndThrow( Documentation(), diff --git a/modules/base/rendering/renderabletrail.cpp b/modules/base/rendering/renderabletrail.cpp index 9484b0dd24..928872c451 100644 --- a/modules/base/rendering/renderabletrail.cpp +++ b/modules/base/rendering/renderabletrail.cpp @@ -346,11 +346,12 @@ void RenderableTrail::internalRender(bool renderLines, bool renderPoints, data.camera.combinedViewMatrix() * modelTransform * info._localTransform ); - const int sorting = [](RenderInformation::VertexSorting sorting) { - switch (sorting) { + const int sorting = [](RenderInformation::VertexSorting s) { + switch (s) { case RenderInformation::VertexSorting::NewestFirst: return 0; case RenderInformation::VertexSorting::OldestFirst: return 1; - case RenderInformation::VertexSorting::NoSorting: return 2; + case RenderInformation::VertexSorting::NoSorting: return 2; + default: throw ghoul::MissingCaseException(); } }(info.sorting); diff --git a/modules/digitaluniverse/rendering/renderableplanescloud.cpp b/modules/digitaluniverse/rendering/renderableplanescloud.cpp index a1d80e4503..5ad3c26ae7 100644 --- a/modules/digitaluniverse/rendering/renderableplanescloud.cpp +++ b/modules/digitaluniverse/rendering/renderableplanescloud.cpp @@ -635,8 +635,8 @@ void RenderablePlanesCloud::renderLabels(const RenderData& data, ghoul::fontrendering::FontRenderer::ProjectedLabelsInformation labelInfo; labelInfo.orthoRight = orthoRight; labelInfo.orthoUp = orthoUp; - labelInfo.minSize = static_cast(_textMinSize); - labelInfo.maxSize = static_cast(_textMaxSize); + labelInfo.minSize = _textMinSize; + labelInfo.maxSize = _textMaxSize; labelInfo.cameraPos = data.camera.positionVec3(); labelInfo.cameraLookUp = data.camera.lookUpVectorWorldSpace(); labelInfo.renderType = _renderOption; @@ -992,7 +992,6 @@ bool RenderablePlanesCloud::readSpeckFile() { glm::vec3 u(0.f); glm::vec3 v(0.f); - int textureIndex = 0; std::vector values(_nValuesPerAstronomicalObject); @@ -1022,11 +1021,6 @@ bool RenderablePlanesCloud::readSpeckFile() { break; } } - - // JCC: This should be moved to the RenderablePlanesCloud: - if (i == _textureVariableIndex) { - textureIndex = static_cast(values[i]); - } } _fullData.insert(_fullData.end(), values.begin(), values.end()); diff --git a/modules/exoplanets/exoplanetshelper.h b/modules/exoplanets/exoplanetshelper.h index 476cd781bd..6b24ee6afd 100644 --- a/modules/exoplanets/exoplanetshelper.h +++ b/modules/exoplanets/exoplanetshelper.h @@ -61,9 +61,12 @@ struct Exoplanet { double tt; // Epoch of transit center in HJD-2440000 float ttUpper; // Upper uncertainty of epoch of transit center float ttLower; // Lower uncertainty of epoch of transit center - float positionX; // Star position's X-coordinate in parsec - float positionY; // Star position's Y-coordinate in parsec - float positionZ; // Star position's Z-coordinate in parsec + // Star position's X-coordinate in parsec + float positionX = std::numeric_limits::quiet_NaN(); + // Star position's Y-coordinate in parsec + float positionY = std::numeric_limits::quiet_NaN(); + // Star position's Z-coordinate in parsec + float positionZ = std::numeric_limits::quiet_NaN(); }; // Convert csv-file specific names to the corresponding name in the speck data file diff --git a/modules/exoplanets/rendering/renderableorbitdisc.cpp b/modules/exoplanets/rendering/renderableorbitdisc.cpp index 216d8c16fa..319b78b3b0 100644 --- a/modules/exoplanets/rendering/renderableorbitdisc.cpp +++ b/modules/exoplanets/rendering/renderableorbitdisc.cpp @@ -130,7 +130,9 @@ RenderableOrbitDisc::RenderableOrbitDisc(const ghoul::Dictionary& dictionary) addProperty(_offset); _size = static_cast(dictionary.value(SizeInfo.identifier)); - _size = _size + (_offset.value().y * distanceconstants::AstronomicalUnit); + _size = static_cast( + _size + (_offset.value().y * distanceconstants::AstronomicalUnit) + ); setBoundingSphere(_size); _size.onChange([&]() { _planeIsDirty = true; }); addProperty(_size); @@ -233,7 +235,7 @@ void RenderableOrbitDisc::render(const RenderData& data, RendererTasks&) { global::renderEngine->openglStateCache().resetPolygonAndClippingState(); } -void RenderableOrbitDisc::update(const UpdateData& data) { +void RenderableOrbitDisc::update(const UpdateData&) { if (_shader->isDirty()) { _shader->rebuildFromFile(); _uniformCache.modelViewProjection = _shader->uniformLocation( diff --git a/modules/exoplanets/tasks/exoplanetsdatapreparationtask.cpp b/modules/exoplanets/tasks/exoplanetsdatapreparationtask.cpp index c1bb2ff2d6..a7ec330972 100644 --- a/modules/exoplanets/tasks/exoplanetsdatapreparationtask.cpp +++ b/modules/exoplanets/tasks/exoplanetsdatapreparationtask.cpp @@ -373,11 +373,14 @@ float ExoplanetsDataPreparationTask::bvFromTeff(float teff) { float bv = 0.f; float bvUpper = 0.f; float bvLower = 0.f; - float teffLower, teffUpper; - std::string row, teffString, bvString; + float teffLower; + float teffUpper; + std::string row; while (getline(teffToBvFile, row)) { std::istringstream lineStream(row); + std::string teffString; getline(lineStream, teffString, ','); + std::string bvString; getline(lineStream, bvString); float teffCurrent = std::stof(teffString.c_str(), nullptr); diff --git a/modules/fitsfilereader/CMakeLists.txt b/modules/fitsfilereader/CMakeLists.txt index bea007310d..a95eebce93 100644 --- a/modules/fitsfilereader/CMakeLists.txt +++ b/modules/fitsfilereader/CMakeLists.txt @@ -59,10 +59,8 @@ add_subdirectory(${CCFITS_ROOT_DIR}) set_folder_location(CCfits "External") set(CCfits_BUILD_SHARED_LIBS OFF) -if (GHOUL_DISABLE_EXTERNAL_WARNINGS) - disable_external_warnings(cfitsio) - disable_external_warnings(CCfits) -endif () +disable_external_warnings(cfitsio) +disable_external_warnings(CCfits) target_include_directories(${MODULE_NAME} SYSTEM PUBLIC ${INCLUDES_FOR_TARGET}) target_link_libraries(${MODULE_NAME} PRIVATE CCfits) diff --git a/modules/fitsfilereader/src/fitsfilereader.cpp b/modules/fitsfilereader/src/fitsfilereader.cpp index f35a51aa9f..8d978d718a 100644 --- a/modules/fitsfilereader/src/fitsfilereader.cpp +++ b/modules/fitsfilereader/src/fitsfilereader.cpp @@ -325,7 +325,7 @@ std::vector FitsFileReader::readFitsFile(std::string filePath, int& nValu values[idx++] = tycho_v_err[i % nStars]; // Read extra columns, if any. This will slow down the sorting tremendously! - for (size_t col = defaultCols; col < nColumnsRead; ++col) { + for (int col = defaultCols; col < nColumnsRead; ++col) { std::vector vecData = std::move(tableContent[allColumnNames[col]]); values[idx++] = vecData[i]; } diff --git a/modules/gaia/rendering/renderablegaiastars.cpp b/modules/gaia/rendering/renderablegaiastars.cpp index ff10f2a3f1..d4c1f2a0de 100644 --- a/modules/gaia/rendering/renderablegaiastars.cpp +++ b/modules/gaia/rendering/renderablegaiastars.cpp @@ -503,12 +503,6 @@ documentation::Documentation RenderableGaiaStars::Documentation() { RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary) : Renderable(dictionary) , _filePath(FilePathInfo) - , _fileReaderOption( - FileReaderOptionInfo, - properties::OptionProperty::DisplayType::Dropdown - ) - , _renderOption(RenderOptionInfo, properties::OptionProperty::DisplayType::Dropdown) - , _shaderOption(ShaderOptionInfo, properties::OptionProperty::DisplayType::Dropdown) , _pointSpreadFunctionTexturePath(PsfTextureInfo) , _colorTexturePath(ColorTextureInfo) , _luminosityMultiplier(LuminosityMultiplierInfo, 35.f, 1.f, 1000.f) @@ -522,8 +516,6 @@ RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary) , _additionalNodes(AdditionalNodesInfo, glm::ivec2(1), glm::ivec2(0), glm::ivec2(4)) , _tmPointPixelWeightThreshold(TmPointPxThresholdInfo, 0.001f, 0.000001f, 0.01f) , _lodPixelThreshold(LodPixelThresholdInfo, 250.f, 0.f, 5000.f) - , _maxGpuMemoryPercent(MaxGpuMemoryPercentInfo, 0.45f, 0.f, 1.f) - , _maxCpuMemoryPercent(MaxCpuMemoryPercentInfo, 0.5f, 0.f, 1.f) , _posXThreshold(FilterPosXInfo, glm::vec2(0.f), glm::vec2(-10.f), glm::vec2(10.f)) , _posYThreshold(FilterPosYInfo, glm::vec2(0.f), glm::vec2(-10.f), glm::vec2(10.f)) , _posZThreshold(FilterPosZInfo, glm::vec2(0.f), glm::vec2(-10.f), glm::vec2(10.f)) @@ -533,9 +525,17 @@ RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary) , _firstRow(FirstRowInfo, 0, 0, 2539913) // DR1-max: 2539913 , _lastRow(LastRowInfo, 0, 0, 2539913) , _columnNamesList(ColumnNamesInfo) + , _fileReaderOption( + FileReaderOptionInfo, + properties::OptionProperty::DisplayType::Dropdown + ) + , _renderOption(RenderOptionInfo, properties::OptionProperty::DisplayType::Dropdown) + , _shaderOption(ShaderOptionInfo, properties::OptionProperty::DisplayType::Dropdown) , _nRenderedStars(NumRenderedStarsInfo, 0, 0, 2000000000) // 2 Billion stars , _cpuRamBudgetProperty(CpuRamBudgetInfo, 0.f, 0.f, 1.f) , _gpuStreamBudgetProperty(GpuStreamBudgetInfo, 0.f, 0.f, 1.f) + , _maxGpuMemoryPercent(MaxGpuMemoryPercentInfo, 0.45f, 0.f, 1.f) + , _maxCpuMemoryPercent(MaxCpuMemoryPercentInfo, 0.5f, 0.f, 1.f) , _reportGlErrors(ReportGlErrorsInfo, false) , _accumulatedIndices(1, 0) { @@ -1142,7 +1142,7 @@ void RenderableGaiaStars::render(const RenderData& data, RendererTasks&) { glm::dmat4 model = glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * glm::dmat4(data.modelTransform.rotation) * - glm::dmat4(glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale))); + glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale)); float viewScaling = data.camera.scaling(); glm::dmat4 view = data.camera.combinedViewMatrix(); diff --git a/modules/gaia/tasks/readfilejob.cpp b/modules/gaia/tasks/readfilejob.cpp index ac15d85d87..bf116931d7 100644 --- a/modules/gaia/tasks/readfilejob.cpp +++ b/modules/gaia/tasks/readfilejob.cpp @@ -39,11 +39,11 @@ ReadFileJob::ReadFileJob(std::string filePath, std::vector allColum int firstRow, int lastRow, size_t nDefaultCols, int nValuesPerStar, std::shared_ptr fitsReader) : _inFilePath(std::move(filePath)) - , _allColumns(std::move(allColumns)) , _firstRow(firstRow) , _lastRow(lastRow) , _nDefaultCols(nDefaultCols) , _nValuesPerStar(nValuesPerStar) + , _allColumns(std::move(allColumns)) , _fitsFileReader(std::move(fitsReader)) , _octants(8) {} diff --git a/modules/galaxy/rendering/renderablegalaxy.cpp b/modules/galaxy/rendering/renderablegalaxy.cpp index 34cf343446..acda52d1f1 100644 --- a/modules/galaxy/rendering/renderablegalaxy.cpp +++ b/modules/galaxy/rendering/renderablegalaxy.cpp @@ -52,12 +52,6 @@ namespace { constexpr int8_t CurrentCacheVersion = 1; - constexpr const char* GlslRaycastPath = - "${MODULE_GALAXY}/shaders/galaxyraycast.glsl"; - constexpr const char* GlslBoundsVsPath = - "${MODULE_GALAXY}/shaders/raycasterbounds_vs.glsl"; - constexpr const char* GlslBoundsFsPath = - "${MODULE_GALAXY}/shaders/raycasterbounds_fs.glsl"; constexpr const char* _loggerCat = "Renderable Galaxy"; constexpr const std::array UniformNamesPoints = { @@ -157,13 +151,13 @@ namespace { ); fileStream.write(reinterpret_cast(&nPoints), sizeof(int64_t)); fileStream.write(reinterpret_cast(&pointsRatio), sizeof(float)); - uint64_t nPositions = static_cast(positions.size()); + uint64_t nPositions = positions.size(); fileStream.write(reinterpret_cast(&nPositions), sizeof(uint64_t)); fileStream.write( reinterpret_cast(positions.data()), positions.size() * sizeof(glm::vec3) ); - uint64_t nColors = static_cast(colors.size()); + uint64_t nColors = colors.size(); fileStream.write(reinterpret_cast(&nColors), sizeof(uint64_t)); fileStream.write( reinterpret_cast(colors.data()), @@ -685,7 +679,7 @@ void RenderableGalaxy::renderPoints(const RenderData& data) { glm::dmat4 modelMatrix = glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * glm::dmat4(data.modelTransform.rotation) * rotMatrix * - glm::dmat4(glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale))); + glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale)); glm::dmat4 projectionMatrix = glm::dmat4(data.camera.projectionMatrix()); @@ -760,7 +754,7 @@ void RenderableGalaxy::renderBillboards(const RenderData& data) { glm::dmat4 modelMatrix = glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * glm::dmat4(data.modelTransform.rotation) * rotMatrix * - glm::dmat4(glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale))); + glm::scale(glm::dmat4(1.0), data.modelTransform.scale); glm::dmat4 projectionMatrix = glm::dmat4(data.camera.projectionMatrix()); diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index 6a36997952..1c49f7ae5e 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -452,7 +452,13 @@ std::vector GlobeBrowsingModule::documentations() void GlobeBrowsingModule::goToChunk(const globebrowsing::RenderableGlobe& globe, int x, int y, int level) { - goToChunk(globe, globebrowsing::TileIndex(x, y, level), glm::vec2(0.5f, 0.5f), true); + ghoul_assert(level < std::numeric_limits::max(), "Level way too big"); + goToChunk( + globe, + globebrowsing::TileIndex(x, y, static_cast(level)), + glm::vec2(0.5f, 0.5f), + true + ); } void GlobeBrowsingModule::goToGeo(const globebrowsing::RenderableGlobe& globe, @@ -528,10 +534,6 @@ void GlobeBrowsingModule::goToChunk(const globebrowsing::RenderableGlobe& globe, cameraPositionModelSpace ); - const Geodetic2 geo2 = globe.ellipsoid().cartesianToGeodetic2( - posHandle.centerToReferenceSurface - ); - const double altitude = glm::length( cameraPositionModelSpace - posHandle.centerToReferenceSurface ); @@ -595,9 +597,6 @@ glm::dquat GlobeBrowsingModule::lookDownCameraRotation( { using namespace globebrowsing; - // Camera is described in world space - const glm::dmat4 modelTransform = globe.modelTransform(); - // Lookup vector const glm::dvec3 positionModelSpace = globe.ellipsoid().cartesianSurfacePosition( geo2 diff --git a/modules/globebrowsing/src/basictypes.h b/modules/globebrowsing/src/basictypes.h index 049ce3d8ed..fa6499db1c 100644 --- a/modules/globebrowsing/src/basictypes.h +++ b/modules/globebrowsing/src/basictypes.h @@ -89,8 +89,8 @@ enum Quad { struct TileDepthTransform { - float scale; - float offset; + float scale = 1.f; + float offset = 0.f; }; @@ -104,7 +104,7 @@ struct TileMetaData { std::array maxValues; std::array minValues; std::array hasMissingData; - uint8_t nValues; + uint8_t nValues = 0; }; diff --git a/modules/globebrowsing/src/globelabelscomponent.cpp b/modules/globebrowsing/src/globelabelscomponent.cpp index 045b98cbb5..08e3c19a05 100644 --- a/modules/globebrowsing/src/globelabelscomponent.cpp +++ b/modules/globebrowsing/src/globelabelscomponent.cpp @@ -696,8 +696,6 @@ void GlobeLabelsComponent::renderLabels(const RenderData& data, _labelsOpacity * fadeInVariable ); - glm::dvec4 cameraUpVecWorld = glm::dvec4(data.camera.lookUpVectorWorldSpace(), 0.0); - glm::dmat4 VP = glm::dmat4(data.camera.sgctInternal.projectionMatrix()) * data.camera.combinedViewMatrix(); diff --git a/modules/globebrowsing/src/layer.cpp b/modules/globebrowsing/src/layer.cpp index cb84f810ed..fc65e5501e 100644 --- a/modules/globebrowsing/src/layer.cpp +++ b/modules/globebrowsing/src/layer.cpp @@ -225,9 +225,9 @@ Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict, , _enabled(EnabledInfo, false) , _reset(ResetInfo) , _remove(RemoveInfo) + , _guiDescription(GuiDescriptionInfo) , _solidColor(ColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f)) , _layerGroupId(id) - , _guiDescription(GuiDescriptionInfo) { documentation::testSpecificationAndThrow(Documentation(), layerDict, "Layer"); @@ -412,9 +412,9 @@ ChunkTilePile Layer::chunkTilePile(const TileIndex& tileIndex, int pileSize) con ChunkTilePile chunkTilePile; std::fill(chunkTilePile.begin(), chunkTilePile.end(), std::nullopt); for (int i = 0; i < pileSize; ++i) { - chunkTilePile[i] = ChunkTile { - Tile(), TileUvTransform { { 0, 0 }, { 1, 1 } } - }; + ChunkTile tile; + tile.uvTransform = TileUvTransform{ { 0, 0 }, { 1, 1 } }; + chunkTilePile[i] = tile; } return chunkTilePile; } @@ -517,9 +517,7 @@ void Layer::initializeBasedOnType(layergroupid::TypeID id, ghoul::Dictionary ini std::string name = initDict.value(KeyName); LDEBUG("Initializing tile provider for layer: '" + name + "'"); } - _tileProvider = std::unique_ptr( - tileprovider::createFromDictionary(id, std::move(initDict)) - ); + _tileProvider = tileprovider::createFromDictionary(id, std::move(initDict)); break; } case layergroupid::TypeID::SolidColor: { diff --git a/modules/globebrowsing/src/rawtiledatareader.cpp b/modules/globebrowsing/src/rawtiledatareader.cpp index bbbee1d771..540fbc9795 100644 --- a/modules/globebrowsing/src/rawtiledatareader.cpp +++ b/modules/globebrowsing/src/rawtiledatareader.cpp @@ -197,25 +197,25 @@ int calculateTileLevelDifference(GDALDataset* dataset, int minimumPixelSize) { * Example: Side = left and pos = 16: * start.x = 16 and keep the size the same */ -void alignPixelRegion(PixelRegion& pr, Side side, int pos) { +void alignPixelRegion(PixelRegion& pixelRegion, Side side, int pos) { switch (side) { case Side::Left: - pr.start.x = pos; + pixelRegion.start.x = pos; break; case Side::Top: - pr.start.y = pos; + pixelRegion.start.y = pos; break; case Side::Right: - pr.start.x = pos - pr.numPixels.x; + pixelRegion.start.x = pos - pixelRegion.numPixels.x; break; case Side::Bottom: - pr.start.y = pos - pr.numPixels.y; + pixelRegion.start.y = pos - pixelRegion.numPixels.y; break; } } -PixelRegion globalCut(PixelRegion& pr, Side side, int p) { - const bool lineIntersect = [pr, side, p]() { +PixelRegion globalCut(PixelRegion& pixelRegion, Side side, int p) { + const bool lineIntersect = [pr = pixelRegion, side, p]() { switch (side) { case Side::Left: case Side::Right: @@ -232,8 +232,8 @@ PixelRegion globalCut(PixelRegion& pr, Side side, int p) { return PixelRegion(); } - auto setSide = [](PixelRegion& pr, Side side, int pos) { - switch (side) { + auto setSide = [](PixelRegion& pr, Side s, int pos) { + switch (s) { case Side::Left: pr.numPixels.x += (pr.start.x - pos); pr.start.x = pos; @@ -251,35 +251,35 @@ PixelRegion globalCut(PixelRegion& pr, Side side, int p) { } }; - PixelRegion cutOff(pr); + PixelRegion cutOff(pixelRegion); int cutSize = 0; switch (side) { case Side::Left: - setSide(pr, Side::Left, p); + setSide(pixelRegion, Side::Left, p); setSide(cutOff, Side::Right, p - cutSize); break; case Side::Top: - setSide(pr, Side::Top, p); + setSide(pixelRegion, Side::Top, p); setSide(cutOff, Side::Bottom, p - cutSize); break; case Side::Right: - setSide(pr, Side::Right, p); + setSide(pixelRegion, Side::Right, p); setSide(cutOff, Side::Left, p + cutSize); break; case Side::Bottom: - setSide(pr, Side::Bottom, p); + setSide(pixelRegion, Side::Bottom, p); setSide(cutOff, Side::Top, p + cutSize); break; } return cutOff; } -int edge(const PixelRegion& pr, Side side) { +int edge(const PixelRegion& pixelRegion, Side side) { switch (side) { - case Side::Left: return pr.start.x; - case Side::Top: return pr.start.y; - case Side::Right: return pr.start.x + pr.numPixels.x; - case Side::Bottom: return pr.start.y + pr.numPixels.y; + case Side::Left: return pixelRegion.start.x; + case Side::Top: return pixelRegion.start.y; + case Side::Right: return pixelRegion.start.x + pixelRegion.numPixels.x; + case Side::Bottom: return pixelRegion.start.y + pixelRegion.numPixels.y; default: throw ghoul::MissingCaseException(); } } @@ -650,7 +650,7 @@ RawTile RawTileDataReader::readTileData(TileIndex tileIndex) const { for (const MemoryLocation& ml : NoDataAvailableData) { std::byte* ptr = rawTile.imageData.get(); - if (ml.offset >= numBytes || ptr[ml.offset] != ml.value) { + if (ml.offset >= static_cast(numBytes) || ptr[ml.offset] != ml.value) { // Bail out as early as possible break; } diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index d4c47cf3e1..2c6b10e237 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -1140,14 +1140,6 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, modelViewProjectionTransform ); - const bool hasNightLayers = !_layerManager.layerGroup( - layergroupid::GroupID::NightLayers - ).activeLayers().empty(); - - const bool hasWaterLayer = !_layerManager.layerGroup( - layergroupid::GroupID::WaterMasks - ).activeLayers().empty(); - _globalRenderer.program->setUniform("modelViewTransform", modelViewTransform); const bool hasHeightLayer = !_layerManager.layerGroup( @@ -1224,7 +1216,7 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, int localCount = 0; auto traversal = [](const Chunk& node, std::vector& global, - int& globalCount, std::vector& local, int& localCount, int cutoff, + int& iGlobal, std::vector& local, int& iLocal, int cutoff, std::vector& traversalMemory) { ZoneScopedN("traversal") @@ -1239,12 +1231,12 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, if (isLeaf(*n) && n->isVisible) { if (n->tileIndex.level < cutoff) { - global[globalCount] = n; - ++globalCount; + global[iGlobal] = n; + ++iGlobal; } else { - local[localCount] = n; - ++localCount; + local[iLocal] = n; + ++iLocal; } } @@ -1316,7 +1308,8 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, // After certain number of iterations(_debugProperties.dynamicLodIterationCount) of // unavailable/available data in a row, we assume that a change could be made. const int iterCount = _debugProperties.dynamicLodIterationCount; - const bool exceededIterations = _iterationsOfUnavailableData > iterCount; + const bool exceededIterations = + static_cast(_iterationsOfUnavailableData) > iterCount; const float clf = _generalProperties.currentLodScaleFactor; const float clfMin = _generalProperties.currentLodScaleFactor.minValue(); const float targetLod = _generalProperties.targetLodScaleFactor; @@ -1327,7 +1320,9 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, _iterationsOfUnavailableData = 0; _lodScaleFactorDirty = true; } // Make 2 times the iterations with available data to move it up again - else if (_iterationsOfAvailableData > (iterCount * 2) && clf < targetLod) { + else if (static_cast(_iterationsOfAvailableData) > + (iterCount * 2) && clf < targetLod) + { _generalProperties.currentLodScaleFactor = _generalProperties.currentLodScaleFactor + 0.1f; _iterationsOfAvailableData = 0; @@ -1966,7 +1961,8 @@ float RenderableGlobe::getHeight(const glm::dvec3& position) const { const int x = static_cast(floor(xIndexSpace)); const int y = static_cast(floor(yIndexSpace)); - const TileIndex tileIndex(x, y, chunkLevel); + ghoul_assert(chunkLevel < std::numeric_limits::max(), "Too high level"); + const TileIndex tileIndex(x, y, static_cast(chunkLevel)); const GeodeticPatch patch = GeodeticPatch(tileIndex); const Geodetic2 northEast = patch.corner(Quad::NORTH_EAST); @@ -2401,7 +2397,7 @@ int RenderableGlobe::desiredLevelByAvailableTileData(const Chunk& chunk) const { ////////////////////////////////////////////////////////////////////////////////////////// bool RenderableGlobe::isCullableByFrustum(const Chunk& chunk, - const RenderData& renderData, + const RenderData&, const glm::dmat4& mvp) const { ZoneScoped diff --git a/modules/globebrowsing/src/shadowcomponent.cpp b/modules/globebrowsing/src/shadowcomponent.cpp index b9615037cb..ab84f32c50 100644 --- a/modules/globebrowsing/src/shadowcomponent.cpp +++ b/modules/globebrowsing/src/shadowcomponent.cpp @@ -298,7 +298,7 @@ RenderData ShadowComponent::begin(const RenderData& data) { //matrix[14] = -glm::dot(cameraZ, lightPosition); - _lightCamera = std::move(std::unique_ptr(new Camera(data.camera))); + _lightCamera = std::make_unique(data.camera); _lightCamera->setPositionVec3(lightPosition); _lightCamera->setRotation(glm::dquat(glm::inverse(cameraRotationMatrix))); //======================================================================= @@ -512,7 +512,7 @@ void ShadowComponent::updateDepthTexture() { 0, GL_DEPTH_COMPONENT, GL_FLOAT, - 0 + nullptr ); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); diff --git a/modules/globebrowsing/src/tileprovider.cpp b/modules/globebrowsing/src/tileprovider.cpp index a8fa393b0e..a0d6e1b267 100644 --- a/modules/globebrowsing/src/tileprovider.cpp +++ b/modules/globebrowsing/src/tileprovider.cpp @@ -629,9 +629,9 @@ SingleImageProvider::SingleImageProvider(const ghoul::Dictionary& dictionary) -TextTileProvider::TextTileProvider(TileTextureInitData initData, size_t fontSize) - : initData(std::move(initData)) - , fontSize(fontSize) +TextTileProvider::TextTileProvider(TileTextureInitData initData_, size_t fontSize_) + : initData(std::move(initData_)) + , fontSize(fontSize_) { ZoneScoped @@ -715,9 +715,11 @@ TileProviderByIndex::TileProviderByIndex(const ghoul::Dictionary& dictionary) { constexpr const char* KeyY = "Y"; int level = static_cast(tileIndexDict.value(KeyLevel)); + ghoul_assert(level < std::numeric_limits::max(), "Level too large"); int x = static_cast(tileIndexDict.value(KeyX)); int y = static_cast(tileIndexDict.value(KeyY)); - const TileIndex tileIndex(x, y, level); + + const TileIndex tileIndex(x, y, static_cast(level)); layergroupid::TypeID providerTypeID = layergroupid::TypeID::DefaultTileLayer; if (defaultProviderDict.hasKeyAndValue("Type")) { @@ -783,9 +785,7 @@ TileProviderByLevel::TileProviderByLevel(const ghoul::Dictionary& dictionary) { typeID = layergroupid::TypeID::DefaultTileLayer; } - std::unique_ptr tp = std::unique_ptr( - createFromDictionary(typeID, providerDict) - ); + std::unique_ptr tp = createFromDictionary(typeID, providerDict); std::string provId = providerDict.value("Identifier"); tp->setIdentifier(provId); @@ -845,14 +845,14 @@ bool initialize(TileProvider& tp) { ghoul_assert(!tp.isInitialized, "TileProvider can only be initialized once."); - if (TileProvider::NumTileProviders > std::numeric_limits::max()) { + if (TileProvider::NumTileProviders > std::numeric_limits::max() - 1) { LERRORC( "TileProvider", "Number of tile providers exceeds 65535. Something will break soon" ); TileProvider::NumTileProviders = 0; } - tp.uniqueIdentifier = TileProvider::NumTileProviders++; + tp.uniqueIdentifier = static_cast(TileProvider::NumTileProviders++); if (TileProvider::NumTileProviders == std::numeric_limits::max()) { --TileProvider::NumTileProviders; return false; @@ -1411,15 +1411,15 @@ ChunkTile chunkTile(TileProvider& tp, TileIndex tileIndex, int parents, int maxP ghoul_assert(tp.isInitialized, "TileProvider was not initialized."); - auto ascendToParent = [](TileIndex& tileIndex, TileUvTransform& uv) { + auto ascendToParent = [](TileIndex& ti, TileUvTransform& uv) { uv.uvOffset *= 0.5; uv.uvScale *= 0.5; - uv.uvOffset += tileIndex.positionRelativeParent(); + uv.uvOffset += ti.positionRelativeParent(); - tileIndex.x /= 2; - tileIndex.y /= 2; - tileIndex.level--; + ti.x /= 2; + ti.y /= 2; + ti.level--; }; TileUvTransform uvTransform = { glm::vec2(0.f, 0.f), glm::vec2(1.f, 1.f) }; diff --git a/modules/globebrowsing/src/tiletextureinitdata.cpp b/modules/globebrowsing/src/tiletextureinitdata.cpp index a77e92bcc3..afdd8fff2a 100644 --- a/modules/globebrowsing/src/tiletextureinitdata.cpp +++ b/modules/globebrowsing/src/tiletextureinitdata.cpp @@ -186,18 +186,18 @@ TileTextureInitData::TileTextureInitData(size_t width, size_t height, GLenum typ TileTextureInitData TileTextureInitData::operator=(const TileTextureInitData& rhs) { if (this == &rhs) { - return TileTextureInitData(*this); + return *this; } - return TileTextureInitData(rhs); + return rhs; } TileTextureInitData TileTextureInitData::operator=(TileTextureInitData&& rhs) { if (this == &rhs) { - return TileTextureInitData(*this); + return *this; } - return TileTextureInitData(rhs); + return rhs; } } // namespace openspace::globebrowsing diff --git a/modules/globebrowsing/src/timequantizer.cpp b/modules/globebrowsing/src/timequantizer.cpp index 64aab1b640..fd03fda9f0 100644 --- a/modules/globebrowsing/src/timequantizer.cpp +++ b/modules/globebrowsing/src/timequantizer.cpp @@ -148,7 +148,7 @@ std::string_view RangedTime::end() const { DateTime::DateTime(std::string_view initDateTime) { setTime(initDateTime); -}; +} void DateTime::setTime(std::string_view input) { // Indices into an ISO8601 YYYY-MM-ddTHH:mm:ss string @@ -172,7 +172,7 @@ std::string DateTime::ISO8601() const { "{:0>4}-{:0>2}-{:0>2}T{:0>2}:{:0>2}:{:0>2}", _year, _month, _day, _hour, _minute, _second ); -}; +} double DateTime::J2000() const { char Buffer[20]; @@ -185,15 +185,6 @@ double DateTime::J2000() const { return Time::convertTime(Buffer); } -void DateTime::operator=(DateTime& src) { - _year = src.year(); - _month = src.month(); - _day = src.day(); - _hour = src.hour(); - _minute = src.minute(); - _second = src.second(); -} - int DateTime::increment(int value, char unit, double error, double resolution) { unsigned int nIncrements = std::abs(static_cast(error / resolution)); if (nIncrements == 0) { @@ -259,30 +250,26 @@ void DateTime::decrementOnce(int value, char unit) { if (singleDecrement(_minute, value, 0, 59)) { break; } - // else fall-through if underflow... - + [[ fallthrough ]]; case 'h': if (singleDecrement(_hour, value, 0, 23)) { break; } - // else fall-through if underflow... - + [[ fallthrough ]]; case 'd': if (singleDecrement(_day, value, 1, monthSize(_month == 1 ? 12 : _month - 1, _year))) { break; } - // else fall-through if underflow... - + [[ fallthrough ]]; case 'M': inBounds = singleDecrement(_month, value, 1, 12); _day = std::clamp(_day, 1, monthSize(_month, _year)); if (inBounds) { break; } - // else fall-through if underflow... - + [[ fallthrough ]]; case 'y': _year -= value; break; @@ -417,7 +404,7 @@ void TimeQuantizer::verifyResolutionRestrictions(const int value, const char uni } break; case 'h': - if (!(value >= 1 && value <= 4 || value == 6 || value == 12)) { + if (!((value >= 1 && value <= 4) || value == 6 || value == 12)) { throw ghoul::RuntimeError(fmt::format( "Invalid resolution count of {} for (h)our option. Valid counts are " "1, 2, 3, 4, 6, or 12", value @@ -631,7 +618,6 @@ std::vector TimeQuantizer::quantized(Time& start, Time& end) { static_cast(delta) % static_cast(_resolution) == 0, "Quantization error" ); - const int nSteps = static_cast(delta / _resolution); std::vector result; DateTime itr = s; diff --git a/modules/globebrowsing/src/timequantizer.h b/modules/globebrowsing/src/timequantizer.h index b940c8fe43..c89daa027e 100644 --- a/modules/globebrowsing/src/timequantizer.h +++ b/modules/globebrowsing/src/timequantizer.h @@ -131,13 +131,6 @@ public: */ void setTime(std::string_view input); - /* - * Used to deep-copy from another DateTime instance - * - * \params src the DateTime object to copy from - */ - void operator=(DateTime& src); - /* * Get the date/time value in ISO8601 format * diff --git a/modules/imgui/src/gui.cpp b/modules/imgui/src/gui.cpp index 85868ef5c3..5de1a683b0 100644 --- a/modules/imgui/src/gui.cpp +++ b/modules/imgui/src/gui.cpp @@ -512,7 +512,7 @@ void GUI::endFrame() { glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData( GL_ARRAY_BUFFER, - static_cast(cmdList->VtxBuffer.size() * sizeof(ImDrawVert)), + cmdList->VtxBuffer.size() * sizeof(ImDrawVert), reinterpret_cast(&cmdList->VtxBuffer.front()), GL_STREAM_DRAW ); @@ -520,7 +520,7 @@ void GUI::endFrame() { glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboElements); glBufferData( GL_ELEMENT_ARRAY_BUFFER, - static_cast(cmdList->IdxBuffer.size() * sizeof(ImDrawIdx)), + cmdList->IdxBuffer.size() * sizeof(ImDrawIdx), reinterpret_cast(&cmdList->IdxBuffer.front()), GL_STREAM_DRAW ); diff --git a/modules/imgui/src/guigibscomponent.cpp b/modules/imgui/src/guigibscomponent.cpp index 779cf00de6..124dca04d1 100644 --- a/modules/imgui/src/guigibscomponent.cpp +++ b/modules/imgui/src/guigibscomponent.cpp @@ -28,7 +28,7 @@ #include #include #include -#pragma optimize ("", off) + namespace { const ImVec2 WindowSize = ImVec2(350, 500); } // namespace diff --git a/modules/imgui/src/guimemorycomponent.cpp b/modules/imgui/src/guimemorycomponent.cpp index 04a6e6f6a4..8aac5b0d9a 100644 --- a/modules/imgui/src/guimemorycomponent.cpp +++ b/modules/imgui/src/guimemorycomponent.cpp @@ -39,7 +39,7 @@ namespace { for (size_t i = 0; i < occupancies.size(); ++i) { ImGui::Text( " %i: %i/%i (%.2f/%.2f kiB)", - i, + static_cast(i), occupancies[i], p._bucketSize, occupancies[i] / 1024.f, diff --git a/modules/imgui/src/guispacetimecomponent.cpp b/modules/imgui/src/guispacetimecomponent.cpp index 2508abef96..b02c32cbb4 100644 --- a/modules/imgui/src/guispacetimecomponent.cpp +++ b/modules/imgui/src/guispacetimecomponent.cpp @@ -393,7 +393,7 @@ void GuiSpaceTimeComponent::render() { // value to the new unit _deltaTime = static_cast( - convertTime(dt, TimeUnit::Second, static_cast(_deltaTimeUnit)) + convertTime(dt, TimeUnit::Second, _deltaTimeUnit) ); } } @@ -461,7 +461,7 @@ void GuiSpaceTimeComponent::render() { const double newDeltaTime = convertTime( _deltaTime + _accelerationDelta * global::windowDelegate->deltaTime() * 10, - static_cast(_deltaTimeUnit), + _deltaTimeUnit, TimeUnit::Second ); diff --git a/modules/server/src/topics/flightcontrollertopic.cpp b/modules/server/src/topics/flightcontrollertopic.cpp index ed95e9df7b..29e7504b80 100644 --- a/modules/server/src/topics/flightcontrollertopic.cpp +++ b/modules/server/src/topics/flightcontrollertopic.cpp @@ -47,8 +47,6 @@ #include namespace { - constexpr const char* BasePathToken = "${BASE}"; - enum class Command { Connect = 0, Disconnect, @@ -90,12 +88,7 @@ namespace { constexpr const char* AutopilotEngagedKey = "engaged"; constexpr const char* AutopilotInputKey = "autopilotInput"; - constexpr const char* FlightControllerType = "flightcontroller"; - // Friction JSON Keys - constexpr const char* FrictionEngagedKey = "engaged"; - constexpr const char* FrictionPropertyUri = - "NavigationHandler.OrbitalNavigator.Friction"; constexpr const char* FrictionRotationKey = "rotation"; constexpr const char* FrictionZoomKey = "zoom"; constexpr const char* FrictionRollKey = "roll"; @@ -104,7 +97,6 @@ namespace { constexpr const char* RollFriction = "Friction.RollFriction"; // Friction Lua Keys - constexpr const char* LuaKey = "lua"; constexpr const char* LuaScript = "script"; constexpr const char* OrbitX = "orbitX"; @@ -148,9 +140,6 @@ namespace { { Friction, Command::Friction }, { Lua, Command::Lua } }); - - const int Axes = 10; - } // namespace using nlohmann::json; diff --git a/modules/space/rendering/renderableorbitalkepler.cpp b/modules/space/rendering/renderableorbitalkepler.cpp index 8b438ead27..5c2ef5427f 100644 --- a/modules/space/rendering/renderableorbitalkepler.cpp +++ b/modules/space/rendering/renderableorbitalkepler.cpp @@ -46,9 +46,6 @@ namespace { constexpr const char* ProgramName = "OrbitalKepler"; - constexpr const char* _loggerCat = "OrbitalKepler"; - constexpr const char* KeyFile = "Path"; - constexpr const char* KeyLineNum = "LineNumber"; // Fragile! Keep in sync with documentation const std::map RenderBinConversion = { @@ -366,11 +363,11 @@ double RenderableOrbitalKepler::epochFromYMDdSubstring(const std::string& epochS RenderableOrbitalKepler::RenderableOrbitalKepler(const ghoul::Dictionary& dict) : Renderable(dict) - , _segmentQuality(SegmentQualityInfo, 2, 1, 10) - , _path(PathInfo) , _upperLimit(UpperLimitInfo, 1000, 1, 1000000) + , _segmentQuality(SegmentQualityInfo, 2, 1, 10) , _startRenderIdx(StartRenderIdxInfo, 0, 0, 1) , _sizeRender(RenderSizeInfo, 1, 1, 2) + , _path(PathInfo) { documentation::testSpecificationAndThrow( Documentation(), @@ -525,13 +522,13 @@ void RenderableOrbitalKepler::updateBuffers() { size_t nVerticesTotal = 0; int numOrbits = static_cast(_data.size()); - for (size_t i = 0; i < numOrbits; ++i) { + for (int i = 0; i < numOrbits; ++i) { nVerticesTotal += _segmentSize[i] + 1; } _vertexBufferData.resize(nVerticesTotal); size_t vertexBufIdx = 0; - for (size_t orbitIdx = 0; orbitIdx < numOrbits; ++orbitIdx) { + for (int orbitIdx = 0; orbitIdx < numOrbits; ++orbitIdx) { const KeplerParameters& orbit = _data[orbitIdx]; _keplerTranslator.setKeplerElements( diff --git a/modules/space/rendering/renderableorbitalkepler.h b/modules/space/rendering/renderableorbitalkepler.h index 42c6a45848..5390af1a44 100644 --- a/modules/space/rendering/renderableorbitalkepler.h +++ b/modules/space/rendering/renderableorbitalkepler.h @@ -120,7 +120,6 @@ private: GLuint _vertexArray; GLuint _vertexBuffer; - GLuint _indexBuffer; void updateBuffers(); diff --git a/modules/space/rendering/renderablesatellites.cpp b/modules/space/rendering/renderablesatellites.cpp index f3c667a197..fc1d6ec66a 100644 --- a/modules/space/rendering/renderablesatellites.cpp +++ b/modules/space/rendering/renderablesatellites.cpp @@ -45,7 +45,6 @@ #include namespace { - constexpr const char* ProgramName = "RenderableSatellites"; constexpr const char* _loggerCat = "Satellites"; static const openspace::properties::Property::PropertyInfo PathInfo = { diff --git a/modules/space/rendering/renderablesatellites.h b/modules/space/rendering/renderablesatellites.h index d6e9112ecb..669b335f3d 100644 --- a/modules/space/rendering/renderablesatellites.h +++ b/modules/space/rendering/renderablesatellites.h @@ -41,7 +41,7 @@ namespace openspace { class RenderableSatellites : public RenderableOrbitalKepler { public: RenderableSatellites(const ghoul::Dictionary& dictionary); - void readDataFile(const std::string& filename); + virtual void readDataFile(const std::string& filename) override; static documentation::Documentation Documentation(); void initializeFileReading(); diff --git a/modules/space/rendering/renderablesmallbody.cpp b/modules/space/rendering/renderablesmallbody.cpp index 24666a385f..1ce88f70bd 100644 --- a/modules/space/rendering/renderablesmallbody.cpp +++ b/modules/space/rendering/renderablesmallbody.cpp @@ -46,7 +46,6 @@ #include namespace { - constexpr const char* ProgramName = "RenderableSmallBody"; constexpr const char* _loggerCat = "SmallSolarSystemBody"; static const openspace::properties::Property::PropertyInfo PathInfo = { @@ -85,6 +84,26 @@ namespace { "Upper limit on the number of objects for this renderable, regardless of " "how many objects are contained in the data file" }; + + double importAngleValue(const std::string& angle) { + if (angle.empty()) { + return 0.0; + } + + double output = std::stod(angle); + output = std::fmod(output, 360.0); + if (output < 0.0) { + output += 360.0; + } + return output; + } + + std::string& formatObjectName(std::string& name) { + const std::string trimChars = "\t\n\v\f\r\" "; + name.erase(0, name.find_first_not_of(trimChars)); + name.erase(name.find_last_not_of(trimChars) + 1); + return name; + } } // namespace namespace openspace { @@ -398,24 +417,4 @@ void RenderableSmallBody::readOrbitalParamsFromThisLine(bool firstDataLine, ); } -static double importAngleValue(const std::string& angle) { - if (angle.empty()) { - return 0.0; - } - - double output = std::stod(angle); - output = std::fmod(output, 360.0); - if (output < 0.0) { - output += 360.0; - } - return output; -} - -static std::string& formatObjectName(std::string& name) { - const std::string trimChars = "\t\n\v\f\r\" "; - name.erase(0, name.find_first_not_of(trimChars)); - name.erase(name.find_last_not_of(trimChars) + 1); - return name; -} - } // namespace openspace diff --git a/modules/space/rendering/renderablesmallbody.h b/modules/space/rendering/renderablesmallbody.h index 6a68bb7e3e..5b47599e7f 100644 --- a/modules/space/rendering/renderablesmallbody.h +++ b/modules/space/rendering/renderablesmallbody.h @@ -38,8 +38,6 @@ namespace openspace { -static double importAngleValue(const std::string& angle); - class RenderableSmallBody : public RenderableOrbitalKepler { public: RenderableSmallBody(const ghoul::Dictionary& dictionary); @@ -59,9 +57,6 @@ private: std::vector _indexBufferData; }; -static double importAngleValue(const std::string& angle); -static std::string& formatObjectName(std::string& name); - } // namespace openspace #endif // __OPENSPACE_MODULE_SPACE___RENDERABLESMALLBODY___H__ diff --git a/modules/space/rendering/renderablestars.cpp b/modules/space/rendering/renderablestars.cpp index e3a5987a08..2219305f85 100644 --- a/modules/space/rendering/renderablestars.cpp +++ b/modules/space/rendering/renderablestars.cpp @@ -991,7 +991,7 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) { glm::dmat4 modelMatrix = glm::translate(glm::dmat4(1.0), data.modelTransform.translation) * glm::dmat4(data.modelTransform.rotation) * - glm::dmat4(glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale))); + glm::scale(glm::dmat4(1.0), data.modelTransform.scale); glm::dmat4 projectionMatrix = glm::dmat4(data.camera.projectionMatrix()); diff --git a/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp b/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp index e3a8f2d171..c389cd4ddb 100644 --- a/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp +++ b/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp @@ -275,7 +275,6 @@ void DashboardItemInstruments::render(glm::vec2& penPosition) { sequencer.activeInstruments(currentTime); glm::vec4 firing(0.58f - t, 1.f - t, 1.f - t, 1.f); - glm::vec4 notFiring(0.5f, 0.5f, 0.5f, 1.f); RenderFont( *_font, @@ -334,7 +333,6 @@ glm::vec2 DashboardItemInstruments::size() const { if (remaining > 0) { - using FR = ghoul::fontrendering::FontRenderer; std::string progress = progressToStr(25, t); size = addToBoundingbox( diff --git a/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp b/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp index 8d5c76a77e..25b3a38e60 100644 --- a/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp @@ -43,8 +43,6 @@ #include namespace { - constexpr const char* _loggerCat = "RenderableModelProjection"; - constexpr const char* keyGeometry = "Geometry"; constexpr const char* keyProjection = "Projection"; constexpr const char* keyBoundingSphereRadius = "BoundingSphereRadius"; diff --git a/modules/spacecraftinstruments/util/hongkangparser.cpp b/modules/spacecraftinstruments/util/hongkangparser.cpp index db387a547d..0d2ae2f198 100644 --- a/modules/spacecraftinstruments/util/hongkangparser.cpp +++ b/modules/spacecraftinstruments/util/hongkangparser.cpp @@ -161,9 +161,6 @@ bool HongKangParser::create() { std::string previousCamera; double captureStart = -1.0; - double captureStop = -1.0; - double scanStart = -1.0; - double scanStop = -1.0; std::string cameraTarget = "VOID"; std::string scannerTarget = "VOID"; @@ -220,7 +217,7 @@ bool HongKangParser::create() { _subsetMap[image.target]._range.include(time); } if (it->second->decoderType() == "SCANNER") { // SCANNER START - scanStart = time; + double scanStart = time; InstrumentDecoder* scanner = static_cast( it->second.get() @@ -235,7 +232,10 @@ bool HongKangParser::create() { getline(file, linePeek); if (linePeek.find(endNominal) != std::string::npos) { met = linePeek.substr(25, 9); - scanStop = ephemerisTimeFromMissionElapsedTime(met, _metRef); + double scanStop = ephemerisTimeFromMissionElapsedTime( + met, + _metRef + ); scannerTarget = findPlaybookSpecifiedTarget(line); TimeRange scanRange = { scanStart, scanStop }; @@ -264,10 +264,8 @@ bool HongKangParser::create() { // we have reached the end of a scan or consecutive capture // sequence! if (captureStart != -1) { - // end of capture sequence for camera, store end time of this - // sequence - captureStop = time; - TimeRange cameraRange = { captureStart, captureStop }; + // end of capture sequence for camera, store end time of this sequence + TimeRange cameraRange = { captureStart, time }; ghoul_assert(cameraRange.isDefined(), "Invalid time range!"); _instrumentTimes.emplace_back(previousCamera, cameraRange); captureStart = -1; diff --git a/modules/spacecraftinstruments/util/projectioncomponent.cpp b/modules/spacecraftinstruments/util/projectioncomponent.cpp index 847a45523c..efc015676a 100644 --- a/modules/spacecraftinstruments/util/projectioncomponent.cpp +++ b/modules/spacecraftinstruments/util/projectioncomponent.cpp @@ -1021,7 +1021,7 @@ std::shared_ptr ProjectionComponent::loadProjectionTextu ); texture->setFilter(Texture::FilterMode::LinearMipMap); } - return std::move(texture); + return texture; } bool ProjectionComponent::generateProjectionLayerTexture(const glm::ivec2& size) { diff --git a/modules/sync/tasks/syncassettask.cpp b/modules/sync/tasks/syncassettask.cpp index 5b69d7df55..87031d5462 100644 --- a/modules/sync/tasks/syncassettask.cpp +++ b/modules/sync/tasks/syncassettask.cpp @@ -45,7 +45,6 @@ namespace { constexpr const char* KeyAsset = "Asset"; - constexpr const char* _loggerCat = "SyncAssetTask"; constexpr std::chrono::milliseconds ProgressPollInterval(200); } // namespace diff --git a/modules/volume/rawvolume.inl b/modules/volume/rawvolume.inl index 5f95eee40f..4973d4a2da 100644 --- a/modules/volume/rawvolume.inl +++ b/modules/volume/rawvolume.inl @@ -48,11 +48,8 @@ void RawVolume::setDimensions(const glm::uvec3& dimensions) { template size_t RawVolume::nCells() const { - return static_cast( - static_cast(_dimensions.x) * - static_cast(_dimensions.y) * - static_cast(_dimensions.z) - ); + return static_cast(_dimensions.x) * static_cast(_dimensions.y) * + static_cast(_dimensions.z); } template diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 71d71e97be..dd9966703f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -440,9 +440,9 @@ target_include_directories(openspace-core PUBLIC # In order to be able to include module files ${OPENSPACE_BASE_DIR} # In order to use the date library - ${OPENSPACE_BASE_DIR}/ext/date/include + SYSTEM ${OPENSPACE_BASE_DIR}/ext/date/include # In order to use the nlohmann JSON library - ${OPENSPACE_BASE_DIR}/ext + SYSTEM ${OPENSPACE_BASE_DIR}/ext # In order to be able to include the module_registration file ${CMAKE_BINARY_DIR}/_generated/include ) diff --git a/src/documentation/documentationengine.cpp b/src/documentation/documentationengine.cpp index 174fa7f05a..53e7d973f1 100644 --- a/src/documentation/documentationengine.cpp +++ b/src/documentation/documentationengine.cpp @@ -46,13 +46,11 @@ namespace openspace::documentation { DocumentationEngine* DocumentationEngine::_instance = nullptr; DocumentationEngine::DuplicateDocumentationException::DuplicateDocumentationException( - Documentation documentation) + Documentation doc) : ghoul::RuntimeError(fmt::format( - "Duplicate Documentation with name '{}' and id '{}'", - documentation.name, - documentation.id + "Duplicate Documentation with name '{}' and id '{}'",doc.name, doc.id )) - , documentation(std::move(documentation)) + , documentation(std::move(doc)) {} DocumentationEngine::DocumentationEngine() diff --git a/src/documentation/verifier.cpp b/src/documentation/verifier.cpp index e1809f3bab..63751bdb66 100644 --- a/src/documentation/verifier.cpp +++ b/src/documentation/verifier.cpp @@ -292,9 +292,9 @@ std::string ReferencingVerifier::documentation() const { return "Referencing Documentation: '" + identifier + "'"; } -AndVerifier::AndVerifier(const std::vector values) { - ghoul_assert(!values.empty(), "values must not be empty"); - for (Verifier* v : values) { +AndVerifier::AndVerifier(const std::vector values_) { + ghoul_assert(!values_.empty(), "values must not be empty"); + for (Verifier* v : values_) { this->values.push_back(std::shared_ptr(v)); } } @@ -304,8 +304,8 @@ TestResult AndVerifier::operator()(const ghoul::Dictionary& dictionary, { std::vector res(values.size()); std::transform( - values.begin(), - values.end(), + values.cbegin(), + values.cend(), res.begin(), [dictionary, key](const std::shared_ptr& v) { return v->operator()(dictionary, key); @@ -313,9 +313,9 @@ TestResult AndVerifier::operator()(const ghoul::Dictionary& dictionary, ); const bool success = std::all_of( - res.begin(), - res.end(), - [](const TestResult& res) { return res.success; } + res.cbegin(), + res.cend(), + std::mem_fn(&TestResult::success) ); if (success) { @@ -330,10 +330,10 @@ std::string AndVerifier::type() const { // Dirty hack to get an "and " inserted before the last element std::vector types(values.size() - 1); std::transform( - values.begin(), - values.end() - 1, + values.cbegin(), + values.cend() - 1, types.begin(), - [](const std::shared_ptr& v) { return v->type(); } + std::mem_fn(&Verifier::type) ); types.push_back(std::string("and ") + values.back()->type()); @@ -344,19 +344,19 @@ std::string AndVerifier::documentation() const { // Dirty hack to get an "and " inserted before the last element std::vector documentations(values.size() - 1); std::transform( - values.begin(), - values.end() - 1, + values.cbegin(), + values.cend() - 1, documentations.begin(), - [](const std::shared_ptr& v) { return v->documentation(); } + std::mem_fn(&Verifier::documentation) ); documentations.push_back(std::string("and ") + values.back()->documentation()); return ghoul::join(documentations, ", "); } -OrVerifier::OrVerifier(const std::vector values) { - ghoul_assert(!values.empty(), "values must not be empty"); - for (Verifier* v : values) { +OrVerifier::OrVerifier(const std::vector values_) { + ghoul_assert(!values_.empty(), "values must not be empty"); + for (Verifier* v : values_) { this->values.push_back(std::shared_ptr(v)); } } @@ -366,8 +366,8 @@ TestResult OrVerifier::operator()(const ghoul::Dictionary& dictionary, { std::vector res(values.size()); std::transform( - values.begin(), - values.end(), + values.cbegin(), + values.cend(), res.begin(), [dictionary, key](const std::shared_ptr& v) { return v->operator()(dictionary, key); @@ -375,8 +375,8 @@ TestResult OrVerifier::operator()(const ghoul::Dictionary& dictionary, ); const bool success = std::any_of( - res.begin(), - res.end(), + res.cbegin(), + res.cend(), [](const TestResult& res) { return res.success; } ); @@ -392,10 +392,10 @@ std::string OrVerifier::type() const { // Dirty hack to get an "or " inserted before the last element std::vector types(values.size() - 1); std::transform( - values.begin(), - values.end() - 1, + values.cbegin(), + values.cend() - 1, types.begin(), - [](const std::shared_ptr& v) { return v->type(); } + std::mem_fn(&Verifier::type) ); types.push_back(std::string("or ") + values.back()->type()); @@ -406,10 +406,10 @@ std::string OrVerifier::documentation() const { // Dirty hack to get an "or " inserted before the last element std::vector documentations(values.size() - 1); std::transform( - values.begin(), - values.end() - 1, + values.cbegin(), + values.cend() - 1, documentations.begin(), - [](const std::shared_ptr& v) { return v->documentation(); } + std::mem_fn(&Verifier::documentation) ); documentations.push_back(std::string("or ") + values.back()->documentation()); diff --git a/src/interaction/externinteraction.cpp b/src/interaction/externinteraction.cpp index bb4641017b..8bef0341aa 100644 --- a/src/interaction/externinteraction.cpp +++ b/src/interaction/externinteraction.cpp @@ -39,35 +39,6 @@ #include -namespace { - constexpr const uint32_t ProtocolVersion = 3; - constexpr const size_t MaxLatencyDiffs = 64; - - constexpr openspace::properties::Property::PropertyInfo BufferTimeInfo = { - "BufferTime", - "Buffer Time", - "" // @TODO Missing documentation - }; - - constexpr openspace::properties::Property::PropertyInfo TimeKeyFrameInfo = { - "TimeKeyframeInterval", - "Time keyframe interval", - "" // @TODO Missing documentation - }; - - constexpr openspace::properties::Property::PropertyInfo CameraKeyFrameInfo = { - "CameraKeyframeInterval", - "Camera Keyframe interval", - "" // @TODO Missing documentation - }; - - constexpr openspace::properties::Property::PropertyInfo TimeToleranceInfo = { - "TimeTolerance", - "Time tolerance", - "" // @TODO Missing documentation - }; -} // namespace - namespace openspace { ExternInteraction::ExternInteraction() diff --git a/src/interaction/interactionmonitor.cpp b/src/interaction/interactionmonitor.cpp index 2b88c7bcc0..fa5b01bb83 100644 --- a/src/interaction/interactionmonitor.cpp +++ b/src/interaction/interactionmonitor.cpp @@ -29,8 +29,6 @@ #include namespace { - constexpr const char* _loggerCat = "InteractionMonitor"; - constexpr openspace::properties::Property::PropertyInfo IdleTimeInfo = { "IdleTime", "Idle Time", diff --git a/src/interaction/navigationhandler.cpp b/src/interaction/navigationhandler.cpp index 700dc8d06d..ba2151a27f 100644 --- a/src/interaction/navigationhandler.cpp +++ b/src/interaction/navigationhandler.cpp @@ -138,19 +138,19 @@ NavigationHandler::NavigationState::NavigationState(const ghoul::Dictionary& dic } } -NavigationHandler::NavigationState::NavigationState(std::string anchor, std::string aim, - std::string referenceFrame, - glm::dvec3 position, - std::optional up, - double yaw, - double pitch) - : anchor(std::move(anchor)) - , aim(std::move(aim)) - , referenceFrame(std::move(referenceFrame)) - , position(std::move(position)) - , up(std::move(up)) - , yaw(yaw) - , pitch(pitch) +NavigationHandler::NavigationState::NavigationState(std::string anchor_, std::string aim_, + std::string referenceFrame_, + glm::dvec3 position_, + std::optional up_, + double yaw_, + double pitch_) + : anchor(std::move(anchor_)) + , aim(std::move(aim_)) + , referenceFrame(std::move(referenceFrame_)) + , position(std::move(position_)) + , up(std::move(up_)) + , yaw(yaw_) + , pitch(pitch_) {} NavigationHandler::NavigationHandler() @@ -295,7 +295,7 @@ void NavigationHandler::applyNavigationState(const NavigationHandler::Navigation } const glm::dvec3 cameraPositionWorld = anchorWorldPosition + - glm::dvec3(referenceFrameTransform * glm::dvec4(ns.position, 1.0)); + referenceFrameTransform * glm::dvec4(ns.position, 1.0); glm::dvec3 up = ns.up.has_value() ? glm::normalize(referenceFrameTransform * *ns.up) : diff --git a/src/interaction/navigationhandler_lua.inl b/src/interaction/navigationhandler_lua.inl index 4ccb59d75c..4e6db5e561 100644 --- a/src/interaction/navigationhandler_lua.inl +++ b/src/interaction/navigationhandler_lua.inl @@ -73,14 +73,14 @@ int getNavigationState(lua_State* L) { lua_settop(L, 0); - const auto pushVector = [](lua_State* L, const glm::dvec3& v) { - lua_newtable(L); - ghoul::lua::push(L, 1, v.x); - lua_rawset(L, -3); - ghoul::lua::push(L, 2, v.y); - lua_rawset(L, -3); - ghoul::lua::push(L, 3, v.z); - lua_rawset(L, -3); + const auto pushVector = [](lua_State* s, const glm::dvec3& v) { + lua_newtable(s); + ghoul::lua::push(s, 1, v.x); + lua_rawset(s, -3); + ghoul::lua::push(s, 2, v.y); + lua_rawset(s, -3); + ghoul::lua::push(s, 3, v.z); + lua_rawset(s, -3); }; lua_newtable(L); diff --git a/src/interaction/orbitalnavigator.cpp b/src/interaction/orbitalnavigator.cpp index 06c54aecae..a1c34a91d1 100644 --- a/src/interaction/orbitalnavigator.cpp +++ b/src/interaction/orbitalnavigator.cpp @@ -103,13 +103,6 @@ namespace { "the sensitivity is the less impact a mouse motion will have." }; - constexpr openspace::properties::Property::PropertyInfo JoystickEnabledInfo = { - "JoystickEnabled", - "Joystick Control Enabled", - "If this is selected, a connected joystick will be used as an optional input " - "device. If this is deselected, any joystick input will be ignored" - }; - constexpr openspace::properties::Property::PropertyInfo JoystickSensitivityInfo = { "JoystickSensitivity", "Joystick Sensitivity", diff --git a/src/interaction/scriptcamerastates.cpp b/src/interaction/scriptcamerastates.cpp index e9e01b81dc..b76bcf64c9 100644 --- a/src/interaction/scriptcamerastates.cpp +++ b/src/interaction/scriptcamerastates.cpp @@ -26,11 +26,6 @@ #include -namespace { - const double SENSITIVITY_ADJUSTMENT_INCREASE = 8.0; - const double SENSITIVITY_ADJUSTMENT_DECREASE = 0.5; -} - namespace openspace::interaction { ScriptCameraStates::ScriptCameraStates() : CameraInteractionStates(1.0, 1.0) {} diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index 4e5b9d8a93..5e35d79081 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -301,7 +301,8 @@ bool SessionRecording::startPlayback(std::string& filename, LERROR("Unknown data type in header (should be Ascii or Binary)"); cleanUpPlayback(); } - std::string throwawayNewlineChar = readHeaderElement(_playbackFile, 1); + // throwaway newline character + readHeaderElement(_playbackFile, 1); if (_recordingDataMode == DataMode::Binary) { //Close & re-open the file, starting from the beginning, and do dummy read @@ -704,7 +705,7 @@ void SessionRecording::preSynchronization() { if (_state != _lastState) { using K = const CallbackHandle; using V = StateChangeCallback; - for (const std::pair& it : _stateChangeCallbacks) { + for (const std::pair& it : _stateChangeCallbacks) { it.second(); } } @@ -754,9 +755,8 @@ bool SessionRecording::playbackAddEntriesToTimeline() { if (_recordingDataMode == DataMode::Binary) { unsigned char frameType; - bool fileReadOk = true; - while (parsingStatusOk && fileReadOk) { + while (parsingStatusOk) { frameType = readFromPlayback(_playbackFile); // Check if have reached EOF if (!_playbackFile) { @@ -764,7 +764,6 @@ bool SessionRecording::playbackAddEntriesToTimeline() { "Finished parsing {} entries from playback file {}", _playbackLineNum - 1, _playbackFilename )); - fileReadOk = false; break; } if (frameType == HeaderCameraBinary) { @@ -1768,9 +1767,8 @@ SessionRecording::DataMode SessionRecording::readModeFromHeader(std::string file mode = DataMode::Binary; } else { - LERROR("Unknown data type in header (should be Ascii or Binary)"); + throw ConversionError("Unknown data type in header (should be Ascii or Binary)"); } - inputFile.close(); return mode; } @@ -1917,9 +1915,8 @@ bool SessionRecording::convertEntries(std::string& inFilename, if (mode == DataMode::Binary) { unsigned char frameType; - bool fileReadOk = true; - while (conversionStatusOk && fileReadOk) { + while (conversionStatusOk) { frameType = readFromPlayback(inStream); // Check if have reached EOF if (!inStream) { @@ -1927,7 +1924,6 @@ bool SessionRecording::convertEntries(std::string& inFilename, "Finished converting {} entries from playback file {}", lineNum - 1, inFilename )); - fileReadOk = false; break; } if (frameType == HeaderCameraBinary) { @@ -2051,7 +2047,7 @@ std::string SessionRecording::getLegacyConversionResult(std::string filename, in } std::string SessionRecording_legacy_0085::getLegacyConversionResult(std::string filename, - int depth) + int) { //This method is overriden in each legacy subclass, but does nothing in this instance // as the oldest supported legacy version. diff --git a/src/interaction/tasks/convertrecfileversiontask.cpp b/src/interaction/tasks/convertrecfileversiontask.cpp index 2d444445a5..c8d8bb5e87 100644 --- a/src/interaction/tasks/convertrecfileversiontask.cpp +++ b/src/interaction/tasks/convertrecfileversiontask.cpp @@ -77,7 +77,7 @@ std::string ConvertRecFileVersionTask::description() { return description; } -void ConvertRecFileVersionTask::perform(const Task::ProgressCallback& progressCallback) { +void ConvertRecFileVersionTask::perform(const Task::ProgressCallback&) { convert(); } diff --git a/src/interaction/tasks/convertrecformattask.cpp b/src/interaction/tasks/convertrecformattask.cpp index 9132449df0..da61a4bdbe 100644 --- a/src/interaction/tasks/convertrecformattask.cpp +++ b/src/interaction/tasks/convertrecformattask.cpp @@ -85,7 +85,7 @@ std::string ConvertRecFormatTask::description() { return description; } -void ConvertRecFormatTask::perform(const Task::ProgressCallback& progressCallback) { +void ConvertRecFormatTask::perform(const Task::ProgressCallback&) { convert(); } @@ -248,7 +248,6 @@ void ConvertRecFormatTask::convertToBinary() { char tmpType = SessionRecording::DataFormatBinaryTag; _oFile.write(&tmpType, 1); _oFile.write("\n", 1); - size_t idx = 0; while (std::getline(_iFile, lineContents)) { lineNum++; diff --git a/src/network/parallelserver.cpp b/src/network/parallelserver.cpp index a52caeb410..3994cfea35 100644 --- a/src/network/parallelserver.cpp +++ b/src/network/parallelserver.cpp @@ -259,12 +259,6 @@ void ParallelServer::handleHostshipRequest(std::shared_ptr peer, void ParallelServer::handleHostshipResignation(Peer& peer) { LINFO(fmt::format("Connection {} wants to resign its hostship", peer.id)); - size_t oldHostPeerId = 0; - { - std::lock_guard lock(_hostInfoMutex); - oldHostPeerId = _hostPeerId; - } - setToClient(peer); LINFO(fmt::format("Connection {} resigned as host", peer.id)); diff --git a/src/properties/propertyowner.cpp b/src/properties/propertyowner.cpp index 0b0be17ca6..4d307297bf 100644 --- a/src/properties/propertyowner.cpp +++ b/src/properties/propertyowner.cpp @@ -142,7 +142,7 @@ namespace { buf.push_back('}'); //return json.str(); - }; + } } // namespace namespace openspace::properties { diff --git a/src/rendering/dashboard.cpp b/src/rendering/dashboard.cpp index 43bc3bb4c5..eafbd18e46 100644 --- a/src/rendering/dashboard.cpp +++ b/src/rendering/dashboard.cpp @@ -143,7 +143,7 @@ void Dashboard::render(glm::vec2& penPosition) { glm::vec2 Dashboard::getStartPositionOffset() { return _startPositionOffset.value(); -}; +} scripting::LuaLibrary Dashboard::luaLibrary() { return { diff --git a/src/rendering/helper.cpp b/src/rendering/helper.cpp index 3fa5195b0d..fd9afbf9c2 100644 --- a/src/rendering/helper.cpp +++ b/src/rendering/helper.cpp @@ -204,12 +204,12 @@ void initialize() { glBindVertexArray(vertexObjects.square.vao); glBindBuffer(GL_ARRAY_BUFFER, vertexObjects.square.vbo); - struct Vertex { + struct VertexXYUVRGBA { GLfloat xy[2]; GLfloat uv[2]; GLfloat rgba[4]; }; - Vertex data[] = { + VertexXYUVRGBA data[] = { // 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, @@ -219,16 +219,16 @@ void initialize() { 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 }; - glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(Vertex), data, GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(VertexXYUVRGBA), data, GL_STATIC_DRAW); glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), nullptr); + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(VertexXYUVRGBA), nullptr); glEnableVertexAttribArray(1); - glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), - reinterpret_cast(offsetof(Vertex, uv))); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(VertexXYUVRGBA), + reinterpret_cast(offsetof(VertexXYUVRGBA, uv))); glEnableVertexAttribArray(2); - glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), - reinterpret_cast(offsetof(Vertex, rgba))); + glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, sizeof(VertexXYUVRGBA), + reinterpret_cast(offsetof(VertexXYUVRGBA, rgba))); glBindVertexArray(0); // diff --git a/src/rendering/luaconsole.cpp b/src/rendering/luaconsole.cpp index 441abc583b..f7b992552b 100644 --- a/src/rendering/luaconsole.cpp +++ b/src/rendering/luaconsole.cpp @@ -590,7 +590,7 @@ void LuaConsole::charCallback(unsigned int codepoint, return; } - addToCommand(std::string(1, static_cast(codepoint))); + addToCommand(std::string(1, static_cast(codepoint))); } void LuaConsole::update() { diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index afc0022b02..e6727a4db8 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -87,15 +87,6 @@ namespace { constexpr const char* KeyFontMono = "Mono"; constexpr const char* KeyFontLight = "Light"; - constexpr openspace::properties::Property::PropertyInfo PerformanceInfo = { - "PerformanceMeasurements", - "Performance Measurements", - "If this value is enabled, detailed performance measurements about the updates " - "and rendering of the scene graph nodes are collected each frame. These values " - "provide some information about the impact of individual nodes on the overall " - "performance." - }; - constexpr openspace::properties::Property::PropertyInfo ShowOverlaySlavesInfo = { "ShowOverlayOnSlaves", "Show Overlay Information on Slaves", @@ -283,7 +274,7 @@ RenderEngine::RenderEngine() , _hue(HueInfo, 0.f, 0.f, 360.f) , _saturation(SaturationInfo, 1.f, 0.0f, 2.f) , _value(ValueInfo, 1.f, 0.f, 2.f) - , _framerateLimit(FramerateLimitInfo, 0.f, 0.f, 500.f) + , _framerateLimit(FramerateLimitInfo, 0, 0, 500) , _horizFieldOfView(HorizFieldOfViewInfo, 80.f, 1.f, 179.f) , _globalRotation( GlobalRotationInfo, @@ -714,12 +705,12 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat std::string fn = std::to_string(_frameNumber); WindowDelegate::Frustum frustum = global::windowDelegate->frustumMode(); - std::string fr = [](WindowDelegate::Frustum frustum) -> std::string { - switch (frustum) { - case WindowDelegate::Frustum::Mono: return ""; - case WindowDelegate::Frustum::LeftEye: return "(left)"; + std::string fr = [](WindowDelegate::Frustum f) -> std::string { + switch (f) { + case WindowDelegate::Frustum::Mono: return ""; + case WindowDelegate::Frustum::LeftEye: return "(left)"; case WindowDelegate::Frustum::RightEye: return "(right)"; - default: throw std::logic_error("Unhandled case label"); + default: throw ghoul::MissingCaseException(); } }(frustum); @@ -727,9 +718,10 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat std::string dt = std::to_string(global::windowDelegate->deltaTime()); std::string avgDt = std::to_string(global::windowDelegate->averageDeltaTime()); - std::string res = "Frame: " + fn + ' ' + fr + '\n' + - "Swap group frame: " + sgFn + '\n' + - "Dt: " + dt + '\n' + "Avg Dt: " + avgDt; + std::string res = fmt::format( + "Frame: {} {}\nSwap group frame: {}\nDt: {}\nAvg Dt: {}", + fn, fr, sgFn, dt, avgDt + ); RenderFont(*_fontFrameInfo, penPosition, res); } @@ -848,7 +840,6 @@ void RenderEngine::renderEndscreen() { glm::vec2(global::windowDelegate->currentSubwindowSize()) / dpiScaling; glViewport(0, 0, res.x, res.y); - using FR = ghoul::fontrendering::FontRenderer; const glm::vec2 size = _fontDate->boundingBox("Shutting down"); glm::vec2 penPosition = glm::vec2( fontResolution().x / 2 - size.x / 2, diff --git a/src/rendering/screenspacerenderable.cpp b/src/rendering/screenspacerenderable.cpp index c354a81eb4..c70ceee700 100644 --- a/src/rendering/screenspacerenderable.cpp +++ b/src/rendering/screenspacerenderable.cpp @@ -316,16 +316,16 @@ std::unique_ptr ScreenSpaceRenderable::createFromDictiona } std::string ScreenSpaceRenderable::makeUniqueIdentifier(std::string name) { - std::vector r = + std::vector rs = global::renderEngine->screenSpaceRenderables(); - auto nameTaken = [&r](const std::string& name) { - bool nameTaken = std::any_of( - r.begin(), - r.end(), - [&name](ScreenSpaceRenderable* r) { return r->identifier() == name; } + auto nameTaken = [&rs](const std::string& n) { + const bool taken = std::any_of( + rs.cbegin(), + rs.cend(), + [&n](ScreenSpaceRenderable* r) { return r->identifier() == n; } ); - return nameTaken; + return taken; }; std::string baseName = name; @@ -428,15 +428,12 @@ ScreenSpaceRenderable::ScreenSpaceRenderable(const ghoul::Dictionary& dictionary } if (dictionary.hasKey(UsePerspectiveProjectionInfo.identifier)) { - _usePerspectiveProjection = static_cast( - dictionary.value(UsePerspectiveProjectionInfo.identifier) - ); + _usePerspectiveProjection = + dictionary.value(UsePerspectiveProjectionInfo.identifier); } if (dictionary.hasKey(FaceCameraInfo.identifier)) { - _faceCamera = static_cast( - dictionary.value(FaceCameraInfo.identifier) - ); + _faceCamera = dictionary.value(FaceCameraInfo.identifier); } if (dictionary.hasKeyAndValue(KeyTag)) { @@ -543,9 +540,7 @@ void ScreenSpaceRenderable::createShaders() { } glm::mat4 ScreenSpaceRenderable::scaleMatrix() { - glm::vec2 resolution = global::windowDelegate->currentDrawBufferResolution(); - - //to scale the plane + // to scale the plane float textureRatio = static_cast(_objectSize.y) / static_cast(_objectSize.x); diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index ee8d509ef9..e9386d1c22 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -308,7 +308,7 @@ bool AssetLoader::loadAsset(Asset* asset) { if (metaDict.hasKey(MetaInformationIdentifiers)) { ghoul::Dictionary iddict = metaDict.value(MetaInformationIdentifiers); - for (int i = 1; i <= iddict.size(); ++i) { + for (size_t i = 1; i <= iddict.size(); ++i) { std::string key = std::to_string(i); std::string identifier = iddict.value(key); meta.identifiers.push_back(identifier); @@ -333,7 +333,7 @@ void AssetLoader::unloadAsset(Asset* asset) { } _onDeinitializationFunctionRefs[asset].clear(); - for (const std::pair>& it : + for (std::pair> it : _onDependencyInitializationFunctionRefs[asset]) { for (int ref : it.second) { @@ -342,7 +342,7 @@ void AssetLoader::unloadAsset(Asset* asset) { } _onDependencyInitializationFunctionRefs.erase(asset); - for (const std::pair>& it : + for (std::pair> it : _onDependencyDeinitializationFunctionRefs[asset]) { for (int ref : it.second) { diff --git a/src/scene/profile.cpp b/src/scene/profile.cpp index b612cc8612..ed0065975d 100644 --- a/src/scene/profile.cpp +++ b/src/scene/profile.cpp @@ -40,8 +40,6 @@ namespace openspace { namespace { - constexpr const char* _loggerCat = "Profile"; - // Helper structs for the visitor pattern of the std::variant template struct overloaded : Ts... { using Ts::operator()...; }; template overloaded(Ts...) -> overloaded; diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index a822d94dd4..4e6c766067 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -640,16 +640,16 @@ int removeSceneGraphNodesFromRegex(lua_State* L) { // Add all the children std::function&)> markNode = - [&markNode](SceneGraphNode* node, std::vector& markedList) + [&markNode](SceneGraphNode* node, std::vector& marked) { std::vector children = node->children(); for (SceneGraphNode* child : children) { - markNode(child, markedList); + markNode(child, marked); } - auto it = std::find(markedList.begin(), markedList.end(), node); - if (it == markedList.end()) { - markedList.push_back(node); + const auto it = std::find(marked.cbegin(), marked.cend(), node); + if (it == marked.end()) { + marked.push_back(node); } }; for (SceneGraphNode* node : markedList) { diff --git a/src/util/blockplaneintersectiongeometry.cpp b/src/util/blockplaneintersectiongeometry.cpp index b2e6dd4d0c..31ff0e4b64 100644 --- a/src/util/blockplaneintersectiongeometry.cpp +++ b/src/util/blockplaneintersectiongeometry.cpp @@ -155,7 +155,7 @@ void BlockPlaneIntersectionGeometry::updateVertices() { ); glEnableVertexAttribArray(0); - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), 0); + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), nullptr); glBindVertexArray(0); } diff --git a/src/util/keys.cpp b/src/util/keys.cpp index a868be79a7..a01f7316fd 100644 --- a/src/util/keys.cpp +++ b/src/util/keys.cpp @@ -32,10 +32,6 @@ #include #include -namespace { - constexpr const char* _loggerCat = "Keys"; -} // namespace - namespace openspace { bool hasKeyModifier(KeyAction lhs, KeyAction rhs) { diff --git a/src/util/syncbuffer.cpp b/src/util/syncbuffer.cpp index edb19f7123..8f1fbc3211 100644 --- a/src/util/syncbuffer.cpp +++ b/src/util/syncbuffer.cpp @@ -42,7 +42,7 @@ void SyncBuffer::encode(const std::string& s) { int32_t anticpatedBufferSize = static_cast( _encodeOffset + (sizeof(char) * s.size()) + sizeof(int32_t) ); - if (anticpatedBufferSize >= _n) { + if (anticpatedBufferSize >= static_cast(_n)) { _dataStream.resize(anticpatedBufferSize); } @@ -79,6 +79,34 @@ void SyncBuffer::decode(std::string& s) { s = decode(); } +void SyncBuffer::decode(glm::quat& value) { + const size_t size = sizeof(glm::quat); + ghoul_assert(_decodeOffset + size < _n, ""); + std::memcpy(glm::value_ptr(value), _dataStream.data() + _decodeOffset, size); + _decodeOffset += size; +} + +void SyncBuffer::decode(glm::dquat& value) { + const size_t size = sizeof(glm::dquat); + ghoul_assert(_decodeOffset + size < _n, ""); + std::memcpy(glm::value_ptr(value), _dataStream.data() + _decodeOffset, size); + _decodeOffset += size; +} + +void SyncBuffer::decode(glm::vec3& value) { + const size_t size = sizeof(glm::vec3); + ghoul_assert(_decodeOffset + size < _n, ""); + std::memcpy(glm::value_ptr(value), _dataStream.data() + _decodeOffset, size); + _decodeOffset += size; +} + +void SyncBuffer::decode(glm::dvec3& value) { + const size_t size = sizeof(glm::dvec3); + ghoul_assert(_decodeOffset + size < _n, ""); + std::memcpy(glm::value_ptr(value), _dataStream.data() + _decodeOffset, size); + _decodeOffset += size; +} + void SyncBuffer::setData(std::vector data) { _dataStream = std::move(data); } diff --git a/src/util/timemanager.cpp b/src/util/timemanager.cpp index d9a9b526c8..7cbf5b878f 100644 --- a/src/util/timemanager.cpp +++ b/src/util/timemanager.cpp @@ -148,7 +148,7 @@ void TimeManager::preSynchronization(double dt) { ZoneScopedN("newTime != _lastTime") using K = const CallbackHandle; using V = TimeChangeCallback; - for (const std::pair& it : _timeChangeCallbacks) { + for (const std::pair& it : _timeChangeCallbacks) { ZoneScopedN("tcc") it.second(); } @@ -160,7 +160,7 @@ void TimeManager::preSynchronization(double dt) { ZoneScopedN("delta time changed") using K = const CallbackHandle; using V = TimeChangeCallback; - for (const std::pair& it : _deltaTimeChangeCallbacks) { + for (const std::pair& it : _deltaTimeChangeCallbacks) { ZoneScopedN("dtcc") it.second(); } @@ -168,7 +168,7 @@ void TimeManager::preSynchronization(double dt) { if (_deltaTimeStepsChanged) { using K = const CallbackHandle; using V = TimeChangeCallback; - for (const std::pair& it : _deltaTimeStepsChangeCallbacks) { + for (const std::pair& it : _deltaTimeStepsChangeCallbacks) { it.second(); } } @@ -176,7 +176,7 @@ void TimeManager::preSynchronization(double dt) { ZoneScopedN("timeline changed") using K = const CallbackHandle; using V = TimeChangeCallback; - for (const std::pair& it : _timelineChangeCallbacks) { + for (const std::pair& it : _timelineChangeCallbacks) { ZoneScopedN("tlcc") it.second(); } @@ -256,7 +256,7 @@ void TimeManager::progressTime(double dt) { using K = const CallbackHandle; using V = TimeChangeCallback; - for (const std::pair& it : _timeJumpCallbacks) { + for (const std::pair& it : _timeJumpCallbacks) { it.second(); } return; diff --git a/src/util/touch.cpp b/src/util/touch.cpp index 0c3d7ce7c1..0484c5e1dc 100644 --- a/src/util/touch.cpp +++ b/src/util/touch.cpp @@ -30,13 +30,13 @@ namespace openspace { -TouchInput::TouchInput(size_t touchDeviceId, size_t fingerId, float x, float y, - double timestamp) - : touchDeviceId(touchDeviceId) - , fingerId(fingerId) - , x(x) - , y(y) - , timestamp(timestamp) +TouchInput::TouchInput(size_t touchDeviceId_, size_t fingerId_, float x_, float y_, + double timestamp_) + : touchDeviceId(touchDeviceId_) + , fingerId(fingerId_) + , x(x_) + , y(y_) + , timestamp(timestamp_) {} glm::vec2 TouchInput::screenCoordinates(glm::vec2 resolution) const { diff --git a/support/cppcheck/suppressions.txt b/support/cppcheck/suppressions.txt index 0fbf1a7945..cfe9971764 100644 --- a/support/cppcheck/suppressions.txt +++ b/support/cppcheck/suppressions.txt @@ -1,7 +1,5 @@ // This is not a memleak because the placement new operator does not // actually create any memory that could leak -//memleak:src/performance/performancemanager.cpp - - missingInclude noExplicitConstructor +useStlAlgorithm diff --git a/tests/test_latlonpatch.cpp b/tests/test_latlonpatch.cpp index df459ec25c..2554045cd2 100644 --- a/tests/test_latlonpatch.cpp +++ b/tests/test_latlonpatch.cpp @@ -71,72 +71,72 @@ TEST_CASE("LatLonPatch: Find Closest Corner 2", "[latlonpatch]") { } TEST_CASE("LatLonPatch: Spherical Clamp 1", "[latlonpatch]") { - using namespace openspace::globebrowsing; + //using namespace openspace::globebrowsing; - GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); + //GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); - // inside patch latitude-wise, east of patch longitude-wise - Geodetic2 point { glm::pi() / 6.0, glm::pi() / 4.0 - 0.01 }; + //// inside patch latitude-wise, east of patch longitude-wise + //Geodetic2 point { glm::pi() / 6.0, glm::pi() / 4.0 - 0.01 }; - Geodetic2 clampedPoint = patch.closestPoint(point); - Geodetic2 neCorner = patch.corner(NORTH_EAST); + //Geodetic2 clampedPoint = patch.closestPoint(point); + //Geodetic2 neCorner = patch.corner(NORTH_EAST); //REQUIRE(clampedPoint.lat == neCorner.lat); //REQUIRE(clampedPoint.lon == neCorner.lon); } TEST_CASE("LatLonPatch: Spherical Clamp 2", "[latlonpatch]") { - using namespace openspace::globebrowsing; + //using namespace openspace::globebrowsing; - GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); + //GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); - // inside patch latitude-wise, west of patch longitude-wise - Geodetic2 point { glm::pi() / 6.0, glm::pi() / 4.0 + 0.01 }; + //// inside patch latitude-wise, west of patch longitude-wise + //Geodetic2 point { glm::pi() / 6.0, glm::pi() / 4.0 + 0.01 }; - Geodetic2 clampedPoint = patch.closestPoint(point); - Geodetic2 nwCorner = patch.corner(NORTH_WEST); + //Geodetic2 clampedPoint = patch.closestPoint(point); + //Geodetic2 nwCorner = patch.corner(NORTH_WEST); //REQUIRE(clampedPoint.lat == nwCorner.lat); //REQUIRE(clampedPoint.lon == nwCorner.lon); } TEST_CASE("LatLonPatch: Spherical Clamp 3", "[latlonpatch]") { - using namespace openspace::globebrowsing; + //using namespace openspace::globebrowsing; - GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); + //GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); - // North east of patch - Geodetic2 point { glm::pi() / 3.0, glm::pi() / 4.0 - 0.01 }; + //// North east of patch + //Geodetic2 point { glm::pi() / 3.0, glm::pi() / 4.0 - 0.01 }; - Geodetic2 clampedPoint = patch.closestPoint(point); - Geodetic2 neCorner = patch.corner(NORTH_EAST); + //Geodetic2 clampedPoint = patch.closestPoint(point); + //Geodetic2 neCorner = patch.corner(NORTH_EAST); //REQUIRE(clampedPoint.lat == neCorner.lat); //REQUIRE(clampedPoint.lon == neCorner.lon); } TEST_CASE("LatLonPatch: Spherical Clamp 4", "[latlonpatch]") { - using namespace openspace::globebrowsing; + //using namespace openspace::globebrowsing; - GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); + //GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); - // South east of patch - Geodetic2 point { -glm::pi() / 3.0, glm::pi() / 4.0 - 0.01 }; + //// South east of patch + //Geodetic2 point { -glm::pi() / 3.0, glm::pi() / 4.0 - 0.01 }; - Geodetic2 clampedPoint = patch.closestPoint(point); - Geodetic2 seCorner = patch.corner(SOUTH_EAST); + //Geodetic2 clampedPoint = patch.closestPoint(point); + //Geodetic2 seCorner = patch.corner(SOUTH_EAST); //REQUIRE(clampedPoint.lat == seCorner.lat); //REQUIRE(clampedPoint.lon == seCorner.lon); } TEST_CASE("LatLonPatch: Spherical Clamp 5", "[latlonpatch]") { - using namespace openspace::globebrowsing; + //using namespace openspace::globebrowsing; - GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); + //GeodeticPatch patch(0, 0, glm::pi() / 4.f, glm::pi() / 4.f); - // South west of patch - Geodetic2 point { -glm::pi() / 3.0, 3 * glm::pi() / 4.0 + 0.01 }; + //// South west of patch + //Geodetic2 point { -glm::pi() / 3.0, 3 * glm::pi() / 4.0 + 0.01 }; - Geodetic2 clampedPoint = patch.closestPoint(point); - Geodetic2 swCorner = patch.corner(SOUTH_WEST); + //Geodetic2 clampedPoint = patch.closestPoint(point); + //Geodetic2 swCorner = patch.corner(SOUTH_WEST); //REQUIRE(clampedPoint.lat == swCorner.lat); //REQUIRE(clampedPoint.lon == swCorner.lon); }