Format and more CI

This commit is contained in:
Shaun Reed 2023-04-02 12:31:23 -04:00
parent be69d2d242
commit b0e123e6dd
5 changed files with 164 additions and 163 deletions

View File

@ -8,7 +8,7 @@ on:
jobs:
Qtk:
env:
CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=ON -DQTK_LIBRARY=ON -DQTK_PLUGINS=OFF -DQTK_EXAMPLE=ON
CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=ON -DQTK_PLUGINS=OFF -DQTK_EXAMPLE=ON
strategy:
fail-fast: false
matrix:
@ -138,7 +138,7 @@ jobs:
Qtk-Library:
env:
CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=OFF -DQTK_LIBRARY=ON -DQTK_PLUGINS=OFF -DQTK_EXAMPLE=OFF
CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=OFF -DQTK_PLUGINS=OFF -DQTK_EXAMPLE=OFF
strategy:
fail-fast: false
matrix:
@ -176,7 +176,7 @@ jobs:
- name: Build Qtk Library (Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: cmake --build build/ --config Release
run: cmake --build build/ --config Release --target qtk_library
# OSX / Linux
@ -254,7 +254,7 @@ jobs:
Qtk-Plugins:
env:
CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=OFF -DQTK_LIBRARY=OFF -DQTK_PLUGINS=ON -DQTK_EXAMPLE=OFF
CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=OFF -DQTK_PLUGINS=ON -DQTK_EXAMPLE=OFF
strategy:
fail-fast: false
matrix:

View File

@ -21,8 +21,8 @@ jobs:
- name: Build Qtk
run: |
cmake -B build -DQTK_UPDATE_SUBMODULES=OFF -DQTK_ENABLE_CCACHE=OFF
cmake --build build
cmake -B build -DQTK_SUBMODULES=OFF -DQTK_CCACHE=OFF -DQTK_PLUGINS=OFF -DQTK_GUI=ON
cmake --build build --target qtk_gui -- -j $(nproc)
- uses: cpp-linter/cpp-linter-action@v2
id: linter

View File

@ -241,7 +241,7 @@ Last we need to run `clang-format`, this can be done with the command directly.
This will reformat all the code in the repository.
```bash
clang-format -i --style=file:.clang-format src/*.cpp src/*.h app/*.cpp app/*.h
clang-format -i --style=file:.clang-format src/app/*.cpp src/app/*.h src/qtk/*.cpp src/qtk/*.h example-app/*.cpp example-app/*.h
```
`clang-format` can be run with git integration (or CLion if you prefer).

View File

@ -11,7 +11,7 @@
using namespace Qtk;
ExampleScene::ExampleScene(Qtk::Scene *scene) : Qtk::SceneInterface(scene) {
ExampleScene::ExampleScene(Qtk::Scene * scene) : Qtk::SceneInterface(scene) {
setSceneName("Example Scene");
getCamera().getTransform().setTranslation(-8.0f, 0.0f, 10.0f);
getCamera().getTransform().setRotation(-5.0f, 0.0f, 1.0f, 0.0f);
@ -24,8 +24,8 @@ void ExampleScene::init() {
setSkybox(skybox);
auto spartan = new Model(
"spartan", std::string(QTK_EXAMPLE_SOURCE_DIR) +
"/../resources/models/spartan/spartan.obj");
"spartan", std::string(QTK_EXAMPLE_SOURCE_DIR)
+ "/../resources/models/spartan/spartan.obj");
addObject(spartan);
spartan->getTransform().setTranslation(-4.0f, 0.0f, 0.0f);

View File

@ -49,9 +49,9 @@ namespace Qtk {
* @param fragmentShader Optional path to custom fragment shader.
*/
inline Model(
const char *name, const char *path,
const char *vertexShader = ":/shaders/model-basic.vert",
const char *fragmentShader = ":/shaders/model-basic.frag") :
const char * name, const char * path,
const char * vertexShader = ":/shaders/model-basic.vert",
const char * fragmentShader = ":/shaders/model-basic.frag") :
Object(name, QTK_MODEL),
mModelPath(path), mVertexShader(vertexShader),
mFragmentShader(fragmentShader) {
@ -62,7 +62,8 @@ namespace Qtk {
std::string name, std::string path,
std::string vertexShader = ":/shaders/model-basic.vert",
std::string fragmentShader = ":/shaders/model-basic.frag") :
Model(name.c_str(), path.c_str(), vertexShader.c_str(),
Model(
name.c_str(), path.c_str(), vertexShader.c_str(),
fragmentShader.c_str()) {}
inline ~Model() override { mManager.remove(getName().c_str()); }
@ -81,7 +82,7 @@ namespace Qtk {
*
* @param shader Shader program to use to draw the model.
*/
void draw(QOpenGLShaderProgram &shader);
void draw(QOpenGLShaderProgram & shader);
/**
* Flip a texture associated with this model
@ -91,7 +92,7 @@ namespace Qtk {
* @param flipY Flip the texture along the Y axis
*/
void flipTexture(
const std::string &fileName, bool flipX = false, bool flipY = true);
const std::string & fileName, bool flipX = false, bool flipY = true);
/*************************************************************************
* Setters
@ -104,9 +105,9 @@ namespace Qtk {
* @param location The uniform location
* @param value The value to assign to the uniform
*/
template<typename T>
inline void setUniform(const char *location, T value) {
for (auto &mesh: mMeshes) {
template <typename T>
inline void setUniform(const char * location, T value) {
for(auto & mesh : mMeshes) {
mesh.mProgram->bind();
mesh.mProgram->setUniformValue(location, value);
mesh.mProgram->release();
@ -124,12 +125,12 @@ namespace Qtk {
* @param name The name of the model to load as it was constructed.
* @return Pointer to the model stored within the scene.
*/
[[nodiscard]] static Model *getInstance(const char *name);
[[nodiscard]] static Model * getInstance(const char * name);
/**
* @return Transform3D attached to this Model.
*/
inline Transform3D &getTransform() { return mTransform; }
inline Transform3D & getTransform() { return mTransform; }
private:
/*************************************************************************
@ -148,7 +149,7 @@ namespace Qtk {
* @param path Absolute path to a model in .obj or another format accepted
* by assimp.
*/
void loadModel(const std::string &path);
void loadModel(const std::string & path);
/**
* Process a node in the model's geometry using Assimp.
@ -156,7 +157,7 @@ namespace Qtk {
* @param node The Assimp node to process.
* @param scene The Assimp scene for the loaded model.
*/
void processNode(aiNode *node, const aiScene *scene);
void processNode(aiNode * node, const aiScene * scene);
/**
* Process a mesh within a node using Assimp.
@ -165,7 +166,7 @@ namespace Qtk {
* @param scene The Assimp scene for the loaded model.
* @return
*/
ModelMesh processMesh(aiMesh *mesh, const aiScene *scene);
ModelMesh processMesh(aiMesh * mesh, const aiScene * scene);
/**
* Load a collection of material texture using Assimp.
@ -180,7 +181,7 @@ namespace Qtk {
* @return Collection of all textures for a single ModelMesh.
*/
ModelMesh::Textures loadMaterialTextures(
aiMaterial *mat, aiTextureType type, const std::string &typeName);
aiMaterial * mat, aiTextureType type, const std::string & typeName);
/**
* Sorts each mesh in the Model based on distance from the camera.
@ -198,11 +199,11 @@ namespace Qtk {
static ModelManager mManager;
/** Container to store N loaded textures for this model. */
ModelMesh::Textures mTexturesLoaded{};
ModelMesh::Textures mTexturesLoaded {};
/** Container to store N loaded meshes for this model. */
std::vector<ModelMesh> mMeshes{};
std::vector<ModelMesh> mMeshes {};
/** The directory this model and it's textures are stored. */
std::string mDirectory{};
std::string mDirectory {};
/** File names for shaders and 3D model on disk. */
std::string mVertexShader, mFragmentShader, mModelPath;
};