Tidy and format

This commit is contained in:
Shaun Reed 2022-11-24 16:01:38 -05:00
parent 42970781db
commit 76afaeaf70
11 changed files with 34 additions and 37 deletions

View File

@ -1,5 +1,7 @@
# Generated from CLion Inspection settings
---
HeaderFilterRegex: "*.h"
UseColor: true
Checks: '-*,
bugprone-argument-comment,
bugprone-assert-side-effect,
@ -61,18 +63,15 @@ cert-msc50-cpp,
cert-msc51-cpp,
cert-str34-c,
cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-narrowing-conversions,
cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-slicing,
google-default-arguments,
google-explicit-constructor,
google-runtime-operator,
hicpp-exception-baseclass,
hicpp-multiway-paths-covered,
misc-misplaced-const,
misc-new-delete-overloads,
misc-no-recursion,
misc-non-copyable-objects,
misc-throw-by-value-catch-by-reference,
misc-unconventional-assign-operator,
@ -125,7 +124,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,

View File

@ -84,9 +84,7 @@ If you're using CLion, the `.clang-format` configuration will be picked up by CL
cd qtk
# Build
cmake -B build && cmake --build build
cd build
# Run clang-tidy from within build directory
clang-tidy --fix --fix-errors --config-file=../.clang-tidy ../src/*.cpp ../src/*.h ../app/*.cpp ../app/*.h
clang-tidy -p build/ --fix --config-file=.clang-tidy src/*.cpp src/*.h app/*.cpp app/*.h
```
Last we need to run `clang-format`, this can be done with the command directly.

View File

@ -23,7 +23,7 @@ class QTK_WIDGET_EXPORT MainWindow
private:
Ui::MainWindow * ui {};
std::unordered_map<std::string, Qtk::Scene *> mScenes;
std::unordered_map<std::string, Qtk::Scene *> mScenes {};
};
#endif // MAINWINDOW_H

View File

@ -48,8 +48,8 @@ namespace Qtk {
protected:
Skybox * mSkybox {};
std::vector<MeshRenderer *> mMeshes;
std::vector<Model *> mModels;
std::vector<MeshRenderer *> mMeshes {};
std::vector<Model *> mModels {};
};
} // namespace Qtk

View File

@ -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

View File

@ -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 {

View File

@ -122,8 +122,8 @@ namespace Qtk {
private:
static MeshManager sInstances;
int mDrawType;
std::string mVertexShader, mFragmentShader;
int mDrawType {};
std::string mVertexShader {}, mFragmentShader {};
};
} // namespace Qtk

View File

@ -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<ModelMesh> mMeshes;
std::string mDirectory;
ModelMesh::Textures mTexturesLoaded {};
std::vector<ModelMesh> mMeshes {};
std::string mDirectory {};
const char *mVertexShader, *mFragmentShader, *mName;
};
} // namespace Qtk

View File

@ -18,6 +18,7 @@
#include <camera3d.h>
#include <mesh.h>
#include <qtkapi.h>
#include <texture.h>
namespace Qtk {
class QTKAPI Skybox : protected QOpenGLFunctions {
@ -40,8 +41,8 @@ namespace Qtk {
private:
void init();
Vertices mVertices;
Indices mIndices;
Vertices mVertices {};
Indices mIndices {};
QOpenGLShaderProgram mProgram;
QOpenGLVertexArrayObject mVAO;

View File

@ -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<QImage> faceTextures = {std::move(right), std::move(top),
std::move(front), std::move(left),

View File

@ -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(