From ee689a96450b1a8535a8fc5cdfe376538921a85a Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Thu, 24 Nov 2022 16:01:38 -0500 Subject: [PATCH] Tidy and format --- .clang-tidy | 1 - app/mainwindow.h | 2 +- src/abstractscene.h | 4 ++-- src/mainwidget.h | 8 ++++---- src/mesh.h | 10 +++++----- src/meshrenderer.h | 4 ++-- src/model.h | 20 ++++++++++---------- src/skybox.h | 4 ++-- src/texture.cpp | 4 ++-- src/texture.h | 4 ++-- 10 files changed, 30 insertions(+), 31 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 1e58a98..008a01e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -125,7 +125,6 @@ portability-simd-intrinsics, readability-avoid-const-params-in-decls, readability-const-return-type, readability-container-size-empty, -readability-convert-member-functions-to-static, readability-delete-null-pointer, readability-deleted-default, readability-inconsistent-declaration-parameter-name, diff --git a/app/mainwindow.h b/app/mainwindow.h index 8e1cd90..c389295 100644 --- a/app/mainwindow.h +++ b/app/mainwindow.h @@ -23,7 +23,7 @@ class QTK_WIDGET_EXPORT MainWindow private: Ui::MainWindow * ui {}; - std::unordered_map mScenes; + std::unordered_map mScenes {}; }; #endif // MAINWINDOW_H diff --git a/src/abstractscene.h b/src/abstractscene.h index fb5d761..8e27178 100644 --- a/src/abstractscene.h +++ b/src/abstractscene.h @@ -48,8 +48,8 @@ namespace Qtk { protected: Skybox * mSkybox {}; - std::vector mMeshes; - std::vector mModels; + std::vector mMeshes {}; + std::vector mModels {}; }; } // namespace Qtk diff --git a/src/mainwidget.h b/src/mainwidget.h index eb83a85..589b852 100644 --- a/src/mainwidget.h +++ b/src/mainwidget.h @@ -55,10 +55,10 @@ class MainWidget : public QOpenGLWidget, protected QOpenGLFunctions { // Protected Helpers protected: - void keyPressEvent(QKeyEvent * event); - void keyReleaseEvent(QKeyEvent * event); - void mousePressEvent(QMouseEvent * event); - void mouseReleaseEvent(QMouseEvent * event); + void keyPressEvent(QKeyEvent * event) override; + void keyReleaseEvent(QKeyEvent * event) override; + void mousePressEvent(QMouseEvent * event) override; + void mouseReleaseEvent(QMouseEvent * event) override; private: // Private helpers diff --git a/src/mesh.h b/src/mesh.h index cd6a9e8..a411fef 100644 --- a/src/mesh.h +++ b/src/mesh.h @@ -124,11 +124,11 @@ namespace Qtk { protected: DrawMode mDrawMode; - Vertices mVertices; - Colors mColors; - Indices mIndices; - TexCoords mTexCoords; - Normals mNormals; + Vertices mVertices {}; + Colors mColors {}; + Indices mIndices {}; + TexCoords mTexCoords {}; + Normals mNormals {}; }; struct Shape : public ShapeBase { diff --git a/src/meshrenderer.h b/src/meshrenderer.h index db5d2e2..f33a2d6 100644 --- a/src/meshrenderer.h +++ b/src/meshrenderer.h @@ -122,8 +122,8 @@ namespace Qtk { private: static MeshManager sInstances; - int mDrawType; - std::string mVertexShader, mFragmentShader; + int mDrawType {}; + std::string mVertexShader {}, mFragmentShader {}; }; } // namespace Qtk diff --git a/src/model.h b/src/model.h index d0a8258..432add0 100644 --- a/src/model.h +++ b/src/model.h @@ -37,10 +37,10 @@ namespace Qtk { }; struct QTKAPI ModelTexture { - GLuint mID; - QOpenGLTexture * mTexture; - std::string mType; - std::string mPath; + GLuint mID {}; + QOpenGLTexture * mTexture {}; + std::string mType {}; + std::string mPath {}; }; class Model; @@ -82,9 +82,9 @@ namespace Qtk { void draw(QOpenGLShaderProgram & shader); // ModelMesh Public Members - Vertices mVertices; - Indices mIndices; - Textures mTextures; + Vertices mVertices {}; + Indices mIndices {}; + Textures mTextures {}; Transform3D mTransform; }; @@ -136,9 +136,9 @@ namespace Qtk { // Model Private Members - ModelMesh::Textures mTexturesLoaded; - std::vector mMeshes; - std::string mDirectory; + ModelMesh::Textures mTexturesLoaded {}; + std::vector mMeshes {}; + std::string mDirectory {}; const char *mVertexShader, *mFragmentShader, *mName; }; } // namespace Qtk diff --git a/src/skybox.h b/src/skybox.h index d206951..d315a70 100644 --- a/src/skybox.h +++ b/src/skybox.h @@ -40,8 +40,8 @@ namespace Qtk { private: void init(); - Vertices mVertices; - Indices mIndices; + Vertices mVertices {}; + Indices mIndices {}; QOpenGLShaderProgram mProgram; QOpenGLVertexArrayObject mVAO; diff --git a/src/texture.cpp b/src/texture.cpp index ac05a26..72e4b06 100644 --- a/src/texture.cpp +++ b/src/texture.cpp @@ -55,8 +55,8 @@ QOpenGLTexture * OpenGLTextureFactory::initCubeMap( } QOpenGLTexture * OpenGLTextureFactory::initCubeMap( - QImage right, QImage top, QImage front, QImage left, QImage bottom, - QImage back) { + const QImage & right, const QImage & top, const QImage & front, + const QImage & left, const QImage & bottom, const QImage & back) { auto texture = new QOpenGLTexture(QOpenGLTexture::TargetCubeMap); std::vector faceTextures = {std::move(right), std::move(top), std::move(front), std::move(left), diff --git a/src/texture.h b/src/texture.h index 2758fd6..acf3464 100644 --- a/src/texture.h +++ b/src/texture.h @@ -29,8 +29,8 @@ namespace Qtk { // Cube maps static QOpenGLTexture * initCubeMap( - QImage right, QImage top, QImage front, QImage left, QImage bottom, - QImage back); + const QImage & right, const QImage & top, const QImage & front, + const QImage & left, const QImage & bottom, const QImage & back); // Overloads for cube map initialization static QOpenGLTexture * initCubeMap(const char * tile); static QOpenGLTexture * initCubeMap(