From 38338725b9f5f7dee5c2ce6b9c6d1847e6b83cf5 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sun, 26 Nov 2017 14:57:26 -0500 Subject: [PATCH] Strict coding style adherence --- apps/Launcher/syncwidget.h | 10 ++++-- include/openspace/rendering/loadingscreen.h | 2 +- include/openspace/scene/scene.h | 2 +- .../util/blockplaneintersectiongeometry.h | 3 +- .../openspace/util/powerscaledcoordinate.h | 5 +-- include/openspace/util/powerscaledsphere.h | 2 +- modules/base/rendering/renderabletrailorbit.h | 4 +-- .../base/rendering/screenspacedashboard.cpp | 5 ++- modules/base/rendering/screenspacedashboard.h | 4 +-- modules/base/rotation/fixedrotation.cpp | 1 - .../rendering/layer/layermanager.h | 3 +- .../tile/tileprovider/tileproviderbylevel.cpp | 2 +- modules/imgui/include/gui.h | 1 - modules/imgui/src/gui.cpp | 6 +++- modules/imgui/src/renderproperties.cpp | 2 +- .../rendering/renderablefov.h | 6 ++-- modules/touch/src/touchinteraction.cpp | 2 +- src/engine/openspaceengine.cpp | 5 +-- src/properties/matrix/mat4x3property.cpp | 4 +-- src/properties/scalar/ushortproperty.cpp | 2 +- src/rendering/loadingscreen.cpp | 31 +++++++++---------- src/scene/sceneloader.cpp | 2 +- support/coding/check_style_guide.py | 2 +- 23 files changed, 58 insertions(+), 48 deletions(-) diff --git a/apps/Launcher/syncwidget.h b/apps/Launcher/syncwidget.h index ec7eb88adb..2d55635ce3 100644 --- a/apps/Launcher/syncwidget.h +++ b/apps/Launcher/syncwidget.h @@ -94,7 +94,10 @@ private: void clear(); QStringList selectedScenes() const; - void handleFileFutureAddition(const std::vector>& futures); + void handleFileFutureAddition( + const std::vector>& + futures + ); void handleDirectFiles(); void handleFileRequest(); @@ -116,7 +119,10 @@ private: std::set _filesDownloading; std::vector> _futures; - std::map, InfoWidget*> _futureInfoWidgetMap; + std::map< + std::shared_ptr, + InfoWidget* + > _futureInfoWidgetMap; std::vector> _futuresToAdd; std::atomic_flag _mutex; diff --git a/include/openspace/rendering/loadingscreen.h b/include/openspace/rendering/loadingscreen.h index 1b6ca397c8..1ae6525a85 100644 --- a/include/openspace/rendering/loadingscreen.h +++ b/include/openspace/rendering/loadingscreen.h @@ -41,7 +41,7 @@ namespace ghoul::fontrendering { namespace ghoul::opengl { class ProgramObject; - class Texture; + class Texture; } // namespace ghoul::opengl namespace openspace { diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index 2f61a0675a..291e524603 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -73,7 +73,7 @@ public: * Initalizes the SceneGraph */ void initialize(); - + /** * Initializes the OpenGL part of the SceneGraph */ diff --git a/include/openspace/util/blockplaneintersectiongeometry.h b/include/openspace/util/blockplaneintersectiongeometry.h index c861cb8835..65407362bf 100644 --- a/include/openspace/util/blockplaneintersectiongeometry.h +++ b/include/openspace/util/blockplaneintersectiongeometry.h @@ -35,7 +35,8 @@ namespace openspace { class BlockPlaneIntersectionGeometry { public: // initializers - BlockPlaneIntersectionGeometry(glm::vec3 blockSize, glm::vec3 planeNormal, float planeDistance); + BlockPlaneIntersectionGeometry(glm::vec3 blockSize, glm::vec3 planeNormal, + float planeDistance); ~BlockPlaneIntersectionGeometry(); bool initialize(); diff --git a/include/openspace/util/powerscaledcoordinate.h b/include/openspace/util/powerscaledcoordinate.h index 568fe788b1..c3a3ff3962 100644 --- a/include/openspace/util/powerscaledcoordinate.h +++ b/include/openspace/util/powerscaledcoordinate.h @@ -48,10 +48,11 @@ public: // Sets the power scaled coordinates with w = 0 PowerScaledCoordinate(glm::vec3 v); - static PowerScaledCoordinate CreatePowerScaledCoordinate(double d1, double d2, double d3); + static PowerScaledCoordinate CreatePowerScaledCoordinate(double d1, double d2, + double d3); // get functions - // return the full, unmodified PSC + // return the full, unmodified PSC const glm::vec4& vec4() const; // returns the rescaled, "normal" coordinates diff --git a/include/openspace/util/powerscaledsphere.h b/include/openspace/util/powerscaledsphere.h index c7ad591436..0992642a09 100644 --- a/include/openspace/util/powerscaledsphere.h +++ b/include/openspace/util/powerscaledsphere.h @@ -35,7 +35,7 @@ namespace openspace { class PowerScaledSphere { public: // initializers - PowerScaledSphere(const PowerScaledScalar& radius, + PowerScaledSphere(const PowerScaledScalar& radius, int segments = 8); PowerScaledSphere(glm::vec3 radius, int segments); diff --git a/modules/base/rendering/renderabletrailorbit.h b/modules/base/rendering/renderabletrailorbit.h index a76caf4edc..d15fad2d6b 100644 --- a/modules/base/rendering/renderabletrailorbit.h +++ b/modules/base/rendering/renderabletrailorbit.h @@ -47,12 +47,12 @@ namespace documentation { struct Documentation; } class RenderableTrailOrbit : public RenderableTrail { public: explicit RenderableTrailOrbit(const ghoul::Dictionary& dictionary); - + void initializeGL() override; void deinitializeGL() override; void update(const UpdateData& data) override; - + static documentation::Documentation Documentation(); private: diff --git a/modules/base/rendering/screenspacedashboard.cpp b/modules/base/rendering/screenspacedashboard.cpp index c85f148c27..215f3f0fe3 100644 --- a/modules/base/rendering/screenspacedashboard.cpp +++ b/modules/base/rendering/screenspacedashboard.cpp @@ -164,7 +164,10 @@ bool ScreenSpaceDashboard::deinitializeGL() { } bool ScreenSpaceDashboard::isReady() const { - return (_fontRenderer != nullptr) && (_fontDate != nullptr) && (_fontInfo != nullptr) && ScreenSpaceFramebuffer::isReady(); + return (_fontRenderer != nullptr) && + (_fontDate != nullptr) && + (_fontInfo != nullptr) && + ScreenSpaceFramebuffer::isReady(); } void ScreenSpaceDashboard::update() { diff --git a/modules/base/rendering/screenspacedashboard.h b/modules/base/rendering/screenspacedashboard.h index 39184e354f..fe2b3e6c23 100644 --- a/modules/base/rendering/screenspacedashboard.h +++ b/modules/base/rendering/screenspacedashboard.h @@ -40,7 +40,7 @@ class ScreenSpaceDashboard: public ScreenSpaceFramebuffer { public: ScreenSpaceDashboard(const ghoul::Dictionary& dictionary); ~ScreenSpaceDashboard(); - + bool initializeGL() override; bool deinitializeGL() override; @@ -51,7 +51,7 @@ public: private: std::unique_ptr _fontRenderer; - + std::shared_ptr _fontDate; std::shared_ptr _fontInfo; }; diff --git a/modules/base/rotation/fixedrotation.cpp b/modules/base/rotation/fixedrotation.cpp index 4719adbfee..5a46894823 100644 --- a/modules/base/rotation/fixedrotation.cpp +++ b/modules/base/rotation/fixedrotation.cpp @@ -355,7 +355,6 @@ FixedRotation::FixedRotation(const ghoul::Dictionary& dictionary) break; } }; - _xAxis.type.addOptions({ { Axis::Type::Object, "Object" }, diff --git a/modules/globebrowsing/rendering/layer/layermanager.h b/modules/globebrowsing/rendering/layer/layermanager.h index 1ffbbeb334..a1e9780f52 100644 --- a/modules/globebrowsing/rendering/layer/layermanager.h +++ b/modules/globebrowsing/rendering/layer/layermanager.h @@ -48,7 +48,8 @@ public: void initialize(); void deinitialize(); - std::shared_ptr addLayer(layergroupid::GroupID groupId, ghoul::Dictionary layerDict); + std::shared_ptr addLayer(layergroupid::GroupID groupId, + ghoul::Dictionary layerDict); void deleteLayer(layergroupid::GroupID groupId, std::string layerName); const LayerGroup& layerGroup(size_t groupId); diff --git a/modules/globebrowsing/tile/tileprovider/tileproviderbylevel.cpp b/modules/globebrowsing/tile/tileprovider/tileproviderbylevel.cpp index aa0899328d..da3cc5fdb3 100644 --- a/modules/globebrowsing/tile/tileprovider/tileproviderbylevel.cpp +++ b/modules/globebrowsing/tile/tileprovider/tileproviderbylevel.cpp @@ -129,7 +129,7 @@ bool TileProviderByLevel::deinitialize() { for (const std::shared_ptr& tp : _levelTileProviders) { success &= tp->deinitialize(); } - + return TileProvider::deinitialize() && success; } diff --git a/modules/imgui/include/gui.h b/modules/imgui/include/gui.h index a56452433d..7d89e05550 100644 --- a/modules/imgui/include/gui.h +++ b/modules/imgui/include/gui.h @@ -94,7 +94,6 @@ private: properties::Property::Visibility _currentVisibility; - std::vector _contexts; }; diff --git a/modules/imgui/src/gui.cpp b/modules/imgui/src/gui.cpp index ab19072f11..49541bce94 100644 --- a/modules/imgui/src/gui.cpp +++ b/modules/imgui/src/gui.cpp @@ -483,7 +483,11 @@ void GUI::initializeGL() { //_contexts[i] = ImGui::CreateContext(); ImGui::SetCurrentContext(_contexts[i]); - ImGui::GetIO().Fonts->GetTexDataAsRGBA32(&pngData, &textureSize.x, &textureSize.y); + ImGui::GetIO().Fonts->GetTexDataAsRGBA32( + &pngData, + &textureSize.x, + &textureSize.y + ); } _fontTexture = std::make_unique( pngData, diff --git a/modules/imgui/src/renderproperties.cpp b/modules/imgui/src/renderproperties.cpp index 2c8074d342..9900b9e06e 100644 --- a/modules/imgui/src/renderproperties.cpp +++ b/modules/imgui/src/renderproperties.cpp @@ -667,7 +667,7 @@ void renderDMat2Property(Property* prop, const std::string& ownerName, isRegular ); } - + ImGui::PopID(); } diff --git a/modules/spacecraftinstruments/rendering/renderablefov.h b/modules/spacecraftinstruments/rendering/renderablefov.h index 8d0c39a32c..d5cedb1483 100644 --- a/modules/spacecraftinstruments/rendering/renderablefov.h +++ b/modules/spacecraftinstruments/rendering/renderablefov.h @@ -48,7 +48,7 @@ namespace documentation { struct Documentation; } class RenderableFov : public Renderable { public: RenderableFov(const ghoul::Dictionary& dictionary); - + void initializeGL() override; void deinitializeGL() override; @@ -56,7 +56,7 @@ public: void render(const RenderData& data, RendererTasks& rendererTask) override; void update(const UpdateData& data) override; - + static documentation::Documentation Documentation(); private: @@ -153,7 +153,7 @@ private: properties::Vec4Property square; // Color for the orthogonal square } _colors; }; - + } // namespace openspace #endif // __OPENSPACE_MODULE_SPACECRAFTINSTRUMENTS___RENDERABLEFOV___H__ diff --git a/modules/touch/src/touchinteraction.cpp b/modules/touch/src/touchinteraction.cpp index 17287d7e3b..2a1eea319c 100644 --- a/modules/touch/src/touchinteraction.cpp +++ b/modules/touch/src/touchinteraction.cpp @@ -385,7 +385,7 @@ void TouchInteraction::directControl(const std::vector& list) { { // Orbit (global rotation) dvec3 eulerAngles(q[1], q[0], 0); dquat rotationDiffCamSpace = dquat(eulerAngles); - + dvec3 centerToCamera = camPos - centerPos; dquat rotationDiffWorldSpace = diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 204548280f..9eeacc42e8 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -611,7 +611,6 @@ void OpenSpaceEngine::loadScene(const std::string& scenePath) { if (configurationManager().hasKey(kProgress)) { showProgressbar = configurationManager().value(kProgress); } - _loadingScreen = std::make_unique( LoadingScreen::ShowMessage(showMessage), @@ -679,8 +678,6 @@ void OpenSpaceEngine::loadScene(const std::string& scenePath) { initializeFinished = true; }); - - // While the SceneGraphNodes initialize themselves, we can hand over control to the // Loading screen rendering @@ -693,7 +690,7 @@ void OpenSpaceEngine::loadScene(const std::string& scenePath) { t.join(); // It's okay to delete it since the last rendered image will remain on screen _loadingScreen = nullptr; - + if (errorWhileLoading) { return; } diff --git a/src/properties/matrix/mat4x3property.cpp b/src/properties/matrix/mat4x3property.cpp index b3202cebb0..85b3d73e3f 100644 --- a/src/properties/matrix/mat4x3property.cpp +++ b/src/properties/matrix/mat4x3property.cpp @@ -31,7 +31,7 @@ #include namespace { - + glm::mat4x3 fromLuaConversion(lua_State* state, bool& success) { glm::mat4x3 result; int number = 1; @@ -106,7 +106,7 @@ bool toStringConversion(std::string& outValue, glm::mat4x3 inValue) { return true; } -} // namespace +} // namespace namespace openspace::properties { diff --git a/src/properties/scalar/ushortproperty.cpp b/src/properties/scalar/ushortproperty.cpp index bec7cdd73e..3d0287a4dc 100644 --- a/src/properties/scalar/ushortproperty.cpp +++ b/src/properties/scalar/ushortproperty.cpp @@ -30,7 +30,7 @@ #include namespace { - + unsigned short fromLuaConversion(lua_State* state, bool& success) { success = (lua_isnumber(state, -1) == 1); if (success) { diff --git a/src/rendering/loadingscreen.cpp b/src/rendering/loadingscreen.cpp index e1a14f7e32..077b0a7f5d 100644 --- a/src/rendering/loadingscreen.cpp +++ b/src/rendering/loadingscreen.cpp @@ -77,7 +77,7 @@ namespace { { lhsLl -= glm::vec2(ItemStandoffDistance / 2.f); lhsUr += glm::vec2(ItemStandoffDistance / 2.f); - + rhsLl -= glm::vec2(ItemStandoffDistance / 2.f); rhsUr += glm::vec2(ItemStandoffDistance / 2.f); @@ -149,7 +149,7 @@ LoadingScreen::LoadingScreen(ShowMessage showMessage, ShowNodeNames showNodeName absPath("${OPENSPACE_DATA}/openspace-logo.png") ); _logoTexture->uploadTexture(); - + glGenVertexArrays(1, &_logo.vao); glBindVertexArray(_logo.vao); glGenBuffers(1, &_logo.vbo); @@ -216,7 +216,7 @@ LoadingScreen::LoadingScreen(ShowMessage showMessage, ShowNodeNames showNodeName LoadingScreen::~LoadingScreen() { _logoTexture = nullptr; - + _loadingFont = nullptr; _messageFont = nullptr; _itemFont = nullptr; @@ -234,7 +234,7 @@ LoadingScreen::~LoadingScreen() { void LoadingScreen::render() { // We have to recalculate the positions here because we will not be informed about a // window size change - + const glm::vec2 dpiScaling = OsEng.windowWrapper().dpiScaling(); const glm::ivec2 res = glm::vec2(OsEng.windowWrapper().currentWindowResolution()) / dpiScaling; @@ -304,16 +304,14 @@ void LoadingScreen::render() { ProgressbarSize.x, ProgressbarSize.y * screenAspectRatio }; - + glm::vec2 progressbarLl = { ProgressbarCenter.x - progressbarSize.x, ProgressbarCenter.y - progressbarSize.y - }; glm::vec2 progressbarUr = { ProgressbarCenter.x + progressbarSize.x , ProgressbarCenter.y + progressbarSize.y - }; if (_showProgressbar) { @@ -321,14 +319,14 @@ void LoadingScreen::render() { // Depending on the progress, we only want to draw the progress bar to a mixture // of the lowerleft and upper right extent - + float progress = _nItems != 0 ? static_cast(_iProgress) / static_cast(_nItems) : 0.f; glm::vec2 ur = progressbarUr; ur.x = glm::mix(progressbarLl.x, progressbarUr.x, progress); - + GLfloat dataFill[] = { progressbarLl.x, progressbarLl.y, ur.x, ur.y, @@ -471,7 +469,7 @@ void LoadingScreen::render() { for (Item& item : _items) { if (!item.hasLocation) { // Compute a new location - + FR::BoundingBoxInformation b = renderer.boundingBox( *_itemFont, "%s", @@ -500,7 +498,6 @@ void LoadingScreen::render() { ur = ll + b.boundingBox; // Test against logo and text - bool logoOverlap = rectOverlaps( ndcToScreen(logoLl, res), ndcToScreen(logoUr, res), ll, ur @@ -528,7 +525,6 @@ void LoadingScreen::render() { continue; } - // Test against all other boxes bool overlap = false; for (const Item& j : _items) { @@ -569,11 +565,14 @@ void LoadingScreen::render() { return glm::vec4(1.f); } }(); - - if (item.status == ItemStatus::Finished) { - auto t = std::chrono::duration_cast(now - item.finishedTime); - color.a = 1.f - static_cast(t.count()) / static_cast(TTL.count()); + if (item.status == ItemStatus::Finished) { + auto t = std::chrono::duration_cast( + now - item.finishedTime + ); + + color.a = 1.f - static_cast(t.count()) / + static_cast(TTL.count()); } #ifdef LOADINGSCREEN_DEBUGGING diff --git a/src/scene/sceneloader.cpp b/src/scene/sceneloader.cpp index a132f8425f..9cde4d7430 100644 --- a/src/scene/sceneloader.cpp +++ b/src/scene/sceneloader.cpp @@ -145,7 +145,7 @@ std::unique_ptr SceneLoader::loadScene(const std::string& path) { std::unique_ptr rootNode = std::make_unique(); rootNode->setName(SceneGraphNode::RootNodeName); scene->setRoot(std::move(rootNode)); - + OsEng.loadingScreen().updateItem( SceneGraphNode::RootNodeName, LoadingScreen::ItemStatus::Started diff --git a/support/coding/check_style_guide.py b/support/coding/check_style_guide.py index a2c73df3b7..afba3b036d 100644 --- a/support/coding/check_style_guide.py +++ b/support/coding/check_style_guide.py @@ -338,7 +338,7 @@ def check_empty_character_at_end(lines): if not is_strict_mode: return '' - index = [i + 1 for i, s in enumerate(lines) if len(s) > 1 and s[-2] == ' '] + index = [i + 1 for i, s in enumerate(lines) if len(s) > 1 and s[-2] == ' ' and not s.strip() == ''] if len(index) > 0: return index else: