Format and more CI
This commit is contained in:
parent
be69d2d242
commit
b0e123e6dd
|
@ -8,7 +8,7 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
Qtk:
|
Qtk:
|
||||||
env:
|
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:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -138,7 +138,7 @@ jobs:
|
||||||
|
|
||||||
Qtk-Library:
|
Qtk-Library:
|
||||||
env:
|
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:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -176,7 +176,7 @@ jobs:
|
||||||
- name: Build Qtk Library (Windows)
|
- name: Build Qtk Library (Windows)
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake --build build/ --config Release
|
run: cmake --build build/ --config Release --target qtk_library
|
||||||
|
|
||||||
# OSX / Linux
|
# OSX / Linux
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ jobs:
|
||||||
|
|
||||||
Qtk-Plugins:
|
Qtk-Plugins:
|
||||||
env:
|
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:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
|
|
@ -21,8 +21,8 @@ jobs:
|
||||||
|
|
||||||
- name: Build Qtk
|
- name: Build Qtk
|
||||||
run: |
|
run: |
|
||||||
cmake -B build -DQTK_UPDATE_SUBMODULES=OFF -DQTK_ENABLE_CCACHE=OFF
|
cmake -B build -DQTK_SUBMODULES=OFF -DQTK_CCACHE=OFF -DQTK_PLUGINS=OFF -DQTK_GUI=ON
|
||||||
cmake --build build
|
cmake --build build --target qtk_gui -- -j $(nproc)
|
||||||
|
|
||||||
- uses: cpp-linter/cpp-linter-action@v2
|
- uses: cpp-linter/cpp-linter-action@v2
|
||||||
id: linter
|
id: linter
|
||||||
|
|
|
@ -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.
|
This will reformat all the code in the repository.
|
||||||
|
|
||||||
```bash
|
```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).
|
`clang-format` can be run with git integration (or CLion if you prefer).
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
using namespace Qtk;
|
using namespace Qtk;
|
||||||
|
|
||||||
ExampleScene::ExampleScene(Qtk::Scene *scene) : Qtk::SceneInterface(scene) {
|
ExampleScene::ExampleScene(Qtk::Scene * scene) : Qtk::SceneInterface(scene) {
|
||||||
setSceneName("Example Scene");
|
setSceneName("Example Scene");
|
||||||
getCamera().getTransform().setTranslation(-8.0f, 0.0f, 10.0f);
|
getCamera().getTransform().setTranslation(-8.0f, 0.0f, 10.0f);
|
||||||
getCamera().getTransform().setRotation(-5.0f, 0.0f, 1.0f, 0.0f);
|
getCamera().getTransform().setRotation(-5.0f, 0.0f, 1.0f, 0.0f);
|
||||||
|
@ -24,8 +24,8 @@ void ExampleScene::init() {
|
||||||
setSkybox(skybox);
|
setSkybox(skybox);
|
||||||
|
|
||||||
auto spartan = new Model(
|
auto spartan = new Model(
|
||||||
"spartan", std::string(QTK_EXAMPLE_SOURCE_DIR) +
|
"spartan", std::string(QTK_EXAMPLE_SOURCE_DIR)
|
||||||
"/../resources/models/spartan/spartan.obj");
|
+ "/../resources/models/spartan/spartan.obj");
|
||||||
addObject(spartan);
|
addObject(spartan);
|
||||||
spartan->getTransform().setTranslation(-4.0f, 0.0f, 0.0f);
|
spartan->getTransform().setTranslation(-4.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
|
|
@ -49,9 +49,9 @@ namespace Qtk {
|
||||||
* @param fragmentShader Optional path to custom fragment shader.
|
* @param fragmentShader Optional path to custom fragment shader.
|
||||||
*/
|
*/
|
||||||
inline Model(
|
inline Model(
|
||||||
const char *name, const char *path,
|
const char * name, const char * path,
|
||||||
const char *vertexShader = ":/shaders/model-basic.vert",
|
const char * vertexShader = ":/shaders/model-basic.vert",
|
||||||
const char *fragmentShader = ":/shaders/model-basic.frag") :
|
const char * fragmentShader = ":/shaders/model-basic.frag") :
|
||||||
Object(name, QTK_MODEL),
|
Object(name, QTK_MODEL),
|
||||||
mModelPath(path), mVertexShader(vertexShader),
|
mModelPath(path), mVertexShader(vertexShader),
|
||||||
mFragmentShader(fragmentShader) {
|
mFragmentShader(fragmentShader) {
|
||||||
|
@ -62,7 +62,8 @@ namespace Qtk {
|
||||||
std::string name, std::string path,
|
std::string name, std::string path,
|
||||||
std::string vertexShader = ":/shaders/model-basic.vert",
|
std::string vertexShader = ":/shaders/model-basic.vert",
|
||||||
std::string fragmentShader = ":/shaders/model-basic.frag") :
|
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()) {}
|
fragmentShader.c_str()) {}
|
||||||
|
|
||||||
inline ~Model() override { mManager.remove(getName().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.
|
* @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
|
* Flip a texture associated with this model
|
||||||
|
@ -91,7 +92,7 @@ namespace Qtk {
|
||||||
* @param flipY Flip the texture along the Y axis
|
* @param flipY Flip the texture along the Y axis
|
||||||
*/
|
*/
|
||||||
void flipTexture(
|
void flipTexture(
|
||||||
const std::string &fileName, bool flipX = false, bool flipY = true);
|
const std::string & fileName, bool flipX = false, bool flipY = true);
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Setters
|
* Setters
|
||||||
|
@ -104,9 +105,9 @@ namespace Qtk {
|
||||||
* @param location The uniform location
|
* @param location The uniform location
|
||||||
* @param value The value to assign to the uniform
|
* @param value The value to assign to the uniform
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template <typename T>
|
||||||
inline void setUniform(const char *location, T value) {
|
inline void setUniform(const char * location, T value) {
|
||||||
for (auto &mesh: mMeshes) {
|
for(auto & mesh : mMeshes) {
|
||||||
mesh.mProgram->bind();
|
mesh.mProgram->bind();
|
||||||
mesh.mProgram->setUniformValue(location, value);
|
mesh.mProgram->setUniformValue(location, value);
|
||||||
mesh.mProgram->release();
|
mesh.mProgram->release();
|
||||||
|
@ -124,12 +125,12 @@ namespace Qtk {
|
||||||
* @param name The name of the model to load as it was constructed.
|
* @param name The name of the model to load as it was constructed.
|
||||||
* @return Pointer to the model stored within the scene.
|
* @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.
|
* @return Transform3D attached to this Model.
|
||||||
*/
|
*/
|
||||||
inline Transform3D &getTransform() { return mTransform; }
|
inline Transform3D & getTransform() { return mTransform; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -148,7 +149,7 @@ namespace Qtk {
|
||||||
* @param path Absolute path to a model in .obj or another format accepted
|
* @param path Absolute path to a model in .obj or another format accepted
|
||||||
* by assimp.
|
* by assimp.
|
||||||
*/
|
*/
|
||||||
void loadModel(const std::string &path);
|
void loadModel(const std::string & path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process a node in the model's geometry using Assimp.
|
* Process a node in the model's geometry using Assimp.
|
||||||
|
@ -156,7 +157,7 @@ namespace Qtk {
|
||||||
* @param node The Assimp node to process.
|
* @param node The Assimp node to process.
|
||||||
* @param scene The Assimp scene for the loaded model.
|
* @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.
|
* Process a mesh within a node using Assimp.
|
||||||
|
@ -165,7 +166,7 @@ namespace Qtk {
|
||||||
* @param scene The Assimp scene for the loaded model.
|
* @param scene The Assimp scene for the loaded model.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ModelMesh processMesh(aiMesh *mesh, const aiScene *scene);
|
ModelMesh processMesh(aiMesh * mesh, const aiScene * scene);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a collection of material texture using Assimp.
|
* Load a collection of material texture using Assimp.
|
||||||
|
@ -180,7 +181,7 @@ namespace Qtk {
|
||||||
* @return Collection of all textures for a single ModelMesh.
|
* @return Collection of all textures for a single ModelMesh.
|
||||||
*/
|
*/
|
||||||
ModelMesh::Textures loadMaterialTextures(
|
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.
|
* Sorts each mesh in the Model based on distance from the camera.
|
||||||
|
@ -198,11 +199,11 @@ namespace Qtk {
|
||||||
static ModelManager mManager;
|
static ModelManager mManager;
|
||||||
|
|
||||||
/** Container to store N loaded textures for this model. */
|
/** Container to store N loaded textures for this model. */
|
||||||
ModelMesh::Textures mTexturesLoaded{};
|
ModelMesh::Textures mTexturesLoaded {};
|
||||||
/** Container to store N loaded meshes for this model. */
|
/** 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. */
|
/** 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. */
|
/** File names for shaders and 3D model on disk. */
|
||||||
std::string mVertexShader, mFragmentShader, mModelPath;
|
std::string mVertexShader, mFragmentShader, mModelPath;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue