From f83f68207d0c6126504f275d7c8f4d90f12fbcd8 Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Sun, 1 Jan 2023 23:33:39 -0500 Subject: [PATCH] Add fontawesome icons + Clean up resource prefixes --- resources.qrc | 81 --------- .../LICENSE.txt | 165 ++++++++++++++++++ .../svgs/brands/git-alt.svg | 1 + .../svgs/regular/floppy-disk.svg | 1 + .../svgs/regular/folder-open.svg | 1 + .../svgs/regular/trash-can.svg | 1 + .../svgs/solid/cube.svg | 1 + resources/resources.qrc | 55 ++++++ src/app/CMakeLists.txt | 2 +- src/app/examplescene.cpp | 54 +++--- src/app/qtkmainwindow.ui | 20 ++- src/qtk/CMakeLists.txt | 6 - src/qtk/meshrenderer.cpp | 4 +- src/qtk/model.h | 4 +- src/qtk/qtkapi.h | 2 +- src/qtk/skybox.cpp | 11 +- 16 files changed, 281 insertions(+), 128 deletions(-) delete mode 100644 resources.qrc create mode 100644 resources/fontawesome-free-6.2.1-desktop/LICENSE.txt create mode 100644 resources/fontawesome-free-6.2.1-desktop/svgs/brands/git-alt.svg create mode 100644 resources/fontawesome-free-6.2.1-desktop/svgs/regular/floppy-disk.svg create mode 100644 resources/fontawesome-free-6.2.1-desktop/svgs/regular/folder-open.svg create mode 100644 resources/fontawesome-free-6.2.1-desktop/svgs/regular/trash-can.svg create mode 100644 resources/fontawesome-free-6.2.1-desktop/svgs/solid/cube.svg create mode 100644 resources/resources.qrc diff --git a/resources.qrc b/resources.qrc deleted file mode 100644 index 1a7df0d..0000000 --- a/resources.qrc +++ /dev/null @@ -1,81 +0,0 @@ - - - - resources/shaders/fragment/model.frag - resources/shaders/vertex/model.vert - - resources/shaders/fragment/phong.frag - resources/shaders/vertex/phong.vert - - - - resources/shaders/fragment/solid.frag - resources/shaders/vertex/solid.vert - - - resources/shaders/fragment/solid-perspective.frag - resources/shaders/vertex/solid-perspective.vert - - - resources/shaders/fragment/multi-color.frag - resources/shaders/vertex/multi-color.vert - - - resources/shaders/fragment/rgb-normals.frag - resources/shaders/vertex/rgb-normals.vert - - - resources/shaders/fragment/texture-cubemap.frag - resources/shaders/vertex/texture-cubemap.vert - - - resources/shaders/fragment/texture2d.frag - resources/shaders/vertex/texture2d.vert - - - - resources/shaders/fragment/solid-ambient.frag - resources/shaders/vertex/solid-ambient.vert - - resources/shaders/fragment/solid-diffuse.frag - resources/shaders/vertex/solid-diffuse.vert - - resources/shaders/fragment/solid-specular.frag - resources/shaders/vertex/solid-specular.vert - - resources/shaders/fragment/solid-phong.frag - resources/shaders/vertex/solid-phong.vert - - - - resources/shaders/fragment/model-basic.frag - resources/shaders/vertex/model-basic.vert - - - resources/shaders/fragment/model-specular.frag - resources/shaders/vertex/model-specular.vert - - - resources/shaders/fragment/model-normals.frag - resources/shaders/vertex/model-normals.vert - - - - - resources/skybox/skybox.frag - resources/skybox/skybox.vert - - - - resources/images/crate.png - resources/images/stone.png - resources/images/wood.png - - resources/skybox/back.png - resources/skybox/bottom.png - resources/skybox/front.png - resources/skybox/left.png - resources/skybox/right.png - resources/skybox/top.png - - diff --git a/resources/fontawesome-free-6.2.1-desktop/LICENSE.txt b/resources/fontawesome-free-6.2.1-desktop/LICENSE.txt new file mode 100644 index 0000000..cc557ec --- /dev/null +++ b/resources/fontawesome-free-6.2.1-desktop/LICENSE.txt @@ -0,0 +1,165 @@ +Fonticons, Inc. (https://fontawesome.com) + +-------------------------------------------------------------------------------- + +Font Awesome Free License + +Font Awesome Free is free, open source, and GPL friendly. You can use it for +commercial projects, open source projects, or really almost whatever you want. +Full Font Awesome Free license: https://fontawesome.com/license/free. + +-------------------------------------------------------------------------------- + +# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/) + +The Font Awesome Free download is licensed under a Creative Commons +Attribution 4.0 International License and applies to all icons packaged +as SVG and JS file types. + +-------------------------------------------------------------------------------- + +# Fonts: SIL OFL 1.1 License + +In the Font Awesome Free download, the SIL OFL license applies to all icons +packaged as web and desktop font files. + +Copyright (c) 2022 Fonticons, Inc. (https://fontawesome.com) +with Reserved Font Name: "Font Awesome". + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + +SIL OPEN FONT LICENSE +Version 1.1 - 26 February 2007 + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting — in part or in whole — any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + +-------------------------------------------------------------------------------- + +# Code: MIT License (https://opensource.org/licenses/MIT) + +In the Font Awesome Free download, the MIT license applies to all non-font and +non-icon files. + +Copyright 2022 Fonticons, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in the +Software without restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +-------------------------------------------------------------------------------- + +# Attribution + +Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font +Awesome Free files already contain embedded comments with sufficient +attribution, so you shouldn't need to do anything additional when using these +files normally. + +We've kept attribution comments terse, so we ask that you do not actively work +to remove them from files, especially code. They're a great way for folks to +learn about Font Awesome. + +-------------------------------------------------------------------------------- + +# Brand Icons + +All brand icons are trademarks of their respective owners. The use of these +trademarks does not indicate endorsement of the trademark holder by Font +Awesome, nor vice versa. **Please do not use brand logos for any purpose except +to represent the company, product, or service to which they refer.** diff --git a/resources/fontawesome-free-6.2.1-desktop/svgs/brands/git-alt.svg b/resources/fontawesome-free-6.2.1-desktop/svgs/brands/git-alt.svg new file mode 100644 index 0000000..653f2e7 --- /dev/null +++ b/resources/fontawesome-free-6.2.1-desktop/svgs/brands/git-alt.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/fontawesome-free-6.2.1-desktop/svgs/regular/floppy-disk.svg b/resources/fontawesome-free-6.2.1-desktop/svgs/regular/floppy-disk.svg new file mode 100644 index 0000000..bd469f1 --- /dev/null +++ b/resources/fontawesome-free-6.2.1-desktop/svgs/regular/floppy-disk.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/fontawesome-free-6.2.1-desktop/svgs/regular/folder-open.svg b/resources/fontawesome-free-6.2.1-desktop/svgs/regular/folder-open.svg new file mode 100644 index 0000000..4f337f7 --- /dev/null +++ b/resources/fontawesome-free-6.2.1-desktop/svgs/regular/folder-open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/fontawesome-free-6.2.1-desktop/svgs/regular/trash-can.svg b/resources/fontawesome-free-6.2.1-desktop/svgs/regular/trash-can.svg new file mode 100644 index 0000000..c89d348 --- /dev/null +++ b/resources/fontawesome-free-6.2.1-desktop/svgs/regular/trash-can.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/fontawesome-free-6.2.1-desktop/svgs/solid/cube.svg b/resources/fontawesome-free-6.2.1-desktop/svgs/solid/cube.svg new file mode 100644 index 0000000..76203ca --- /dev/null +++ b/resources/fontawesome-free-6.2.1-desktop/svgs/solid/cube.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/resources.qrc b/resources/resources.qrc new file mode 100644 index 0000000..c48c6f3 --- /dev/null +++ b/resources/resources.qrc @@ -0,0 +1,55 @@ + + + images/crate.png + images/stone.png + images/wood.png + skybox/back.png + skybox/bottom.png + skybox/front.png + skybox/left.png + skybox/right.png + skybox/top.png + + + fontawesome-free-6.2.1-desktop/svgs/solid/cube.svg + fontawesome-free-6.2.1-desktop/svgs/regular/trash-can.svg + fontawesome-free-6.2.1-desktop/svgs/regular/folder-open.svg + fontawesome-free-6.2.1-desktop/svgs/regular/floppy-disk.svg + fontawesome-free-6.2.1-desktop/svgs/brands/git-alt.svg + icon.png + + + shaders/fragment/model.frag + shaders/vertex/model.vert + shaders/fragment/phong.frag + shaders/vertex/phong.vert + shaders/fragment/solid.frag + shaders/vertex/solid.vert + shaders/fragment/solid-perspective.frag + shaders/vertex/solid-perspective.vert + shaders/fragment/multi-color.frag + shaders/vertex/multi-color.vert + shaders/fragment/rgb-normals.frag + shaders/vertex/rgb-normals.vert + shaders/fragment/texture-cubemap.frag + shaders/vertex/texture-cubemap.vert + shaders/fragment/texture2d.frag + shaders/vertex/texture2d.vert + shaders/fragment/solid-ambient.frag + shaders/vertex/solid-ambient.vert + shaders/fragment/solid-diffuse.frag + shaders/vertex/solid-diffuse.vert + shaders/fragment/solid-specular.frag + shaders/vertex/solid-specular.vert + shaders/fragment/solid-phong.frag + shaders/vertex/solid-phong.vert + shaders/fragment/model-basic.frag + shaders/vertex/model-basic.vert + shaders/fragment/model-specular.frag + shaders/vertex/model-specular.vert + shaders/fragment/model-normals.frag + shaders/vertex/model-normals.vert + skybox/skybox.frag + skybox/skybox.vert + + diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 3c87bd1..50c79e0 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -69,7 +69,7 @@ set(QTK_APP_SOURCES qtkmainwindow.h main.cpp ) -qt6_add_resources(QTK_APP_SOURCES ${CMAKE_SOURCE_DIR}/resources.qrc) +qt6_add_resources(QTK_APP_SOURCES ${CMAKE_SOURCE_DIR}/resources/resources.qrc) configure_file( "resources.h.in" "${CMAKE_CURRENT_BINARY_DIR}/resources.h" diff --git a/src/app/examplescene.cpp b/src/app/examplescene.cpp index 627a3fc..45024ff 100644 --- a/src/app/examplescene.cpp +++ b/src/app/examplescene.cpp @@ -120,7 +120,8 @@ void ExampleScene::init() { // NOTE: You no longer need to manually bind shader program to set uniforms. // + You can still bind it if you want to for performance reasons. // + Qtk will only bind / release if the shader program is not already bound. - mTestPhong->setShaders(":/solid-phong.vert", ":/solid-phong.frag"); + mTestPhong->setShaders( + ":/shaders/solid-phong.vert", ":/shaders/solid-phong.frag"); // For example this would technically not be efficient, because each one of // these calls will bind, set, release. We could instead bind, set N uniforms, @@ -146,14 +147,16 @@ void ExampleScene::init() { /* Example of a cube with no lighting applied */ mesh = addObject(new Qtk::MeshRenderer("noLight", Cube(QTK_DRAW_ELEMENTS))); mesh->getTransform().setTranslation(5.0f, 0.0f, -2.0f); - mesh->setShaders(":/solid-perspective.vert", ":/solid-perspective.frag"); + mesh->setShaders( + ":/shaders/solid-perspective.vert", ":/shaders/solid-perspective.frag"); mesh->setUniform("uColor", QVector3D(0.0f, 0.25f, 0.0f)); // No light source needed for this lighting technique /* Initialize Ambient example cube */ mTestAmbient = new Qtk::MeshRenderer("ambient", Cube()); mTestAmbient->getTransform().setTranslation(7.0f, 0.0f, -2.0f); - mTestAmbient->setShaders(":/solid-ambient.vert", ":/solid-ambient.frag"); + mTestAmbient->setShaders( + ":/shaders/solid-ambient.vert", ":/shaders/solid-ambient.frag"); // Changing these uniform values will alter lighting effects. mTestAmbient->setUniform("uColor", QVector3D(0.0f, 0.25f, 0.0f)); mTestAmbient->setUniform("uLightColor", QVector3D(1.0f, 1.0f, 1.0f)); @@ -164,7 +167,8 @@ void ExampleScene::init() { /* Initialize Diffuse example cube */ mTestDiffuse = new Qtk::MeshRenderer("diffuse", Cube()); mTestDiffuse->getTransform().setTranslation(9.0f, 0.0f, -2.0f); - mTestDiffuse->setShaders(":/solid-diffuse.vert", ":/solid-diffuse.frag"); + mTestDiffuse->setShaders( + ":/shaders/solid-diffuse.vert", ":/shaders/solid-diffuse.frag"); mTestDiffuse->setUniform("uColor", QVector3D(0.0f, 0.25f, 0.0f)); mTestDiffuse->setUniform("uLightColor", QVector3D(1.0f, 1.0f, 1.0f)); mTestDiffuse->setUniform("uAmbientStrength", 0.2f); @@ -179,7 +183,8 @@ void ExampleScene::init() { /* Initialize Specular example cube */ mTestSpecular = new Qtk::MeshRenderer("specular", Cube()); mTestSpecular->getTransform().setTranslation(11.0f, 0.0f, -2.0f); - mTestSpecular->setShaders(":/solid-specular.vert", ":/solid-specular.frag"); + mTestSpecular->setShaders( + ":/shaders/solid-specular.vert", ":/shaders/solid-specular.frag"); mTestSpecular->setUniform("uColor", QVector3D(0.0f, 0.25f, 0.0f)); mTestSpecular->setUniform("uLightColor", QVector3D(1.0f, 1.0f, 1.0f)); mTestSpecular->setUniform("uAmbientStrength", 0.2f); @@ -197,7 +202,7 @@ void ExampleScene::init() { /* Test basic cube with phong.vert and phong.frag shaders */ mesh = addObject(new Qtk::MeshRenderer("testPhong", Cube(QTK_DRAW_ARRAYS))); mesh->getTransform().setTranslation(5.0f, 0.0f, 10.0f); - mesh->setShaders(":/phong.vert", ":/phong.frag"); + mesh->setShaders(":/shaders/phong.vert", ":/shaders/phong.frag"); // WARNING: Set color before reallocating normals. mesh->setColor(QVector3D(0.0f, 0.25f, 0.0f)); mesh->reallocateNormals(mesh->getNormals()); @@ -229,7 +234,7 @@ void ExampleScene::init() { /* Test alien Model with phong lighting and specular mapping. */ model = addObject(new Qtk::Model( "alienTest", PATH("/models/alien-hominid/alien.obj"), - ":/model-specular.vert", ":/model-specular.frag")); + ":/shaders/model-specular.vert", ":/shaders/model-specular.frag")); model->getTransform().setTranslation(3.0f, -1.0f, 10.0f); model->getTransform().scale(0.15f); model->setUniform("uMaterial.ambient", QVector3D(1.0f, 1.0f, 1.0f)); @@ -255,7 +260,7 @@ void ExampleScene::init() { /* Test spartan Model with phong lighting, specular and normal mapping. */ model = addObject(new Qtk::Model( "spartanTest", PATH("/models/spartan/spartan.obj"), - ":/model-normals.vert", ":/model-normals.frag")); + ":/shaders/model-normals.vert", ":/shaders/model-normals.frag")); model->getTransform().setTranslation(0.0f, -1.0f, 10.0f); model->getTransform().scale(2.0f); model->setUniform("uMaterial.ambient", QVector3D(1.0f, 1.0f, 1.0f)); @@ -285,22 +290,22 @@ void ExampleScene::init() { mesh = addObject( new Qtk::MeshRenderer("rgbNormalsCubeArraysTest", Cube(QTK_DRAW_ARRAYS))); mesh->getTransform().setTranslation(5.0f, 0.0f, 4.0f); - mesh->setShaders(":/rgb-normals.vert", ":/rgb-normals.frag"); + mesh->setShaders(":/shaders/rgb-normals.vert", ":/shaders/rgb-normals.frag"); mesh->reallocateNormals(mesh->getNormals()); // RGB Normals cube to show normals are correct with QTK_DRAW_ELEMENTS_NORMALS mesh = addObject(new Qtk::MeshRenderer( "rgbNormalsCubeElementsTest", Cube(QTK_DRAW_ELEMENTS_NORMALS))); mesh->getTransform().setTranslation(5.0f, 0.0f, 2.0f); - mesh->setShaders(":/rgb-normals.vert", ":/rgb-normals.frag"); + mesh->setShaders(":/shaders/rgb-normals.vert", ":/shaders/rgb-normals.frag"); mesh->reallocateNormals(mesh->getNormals()); Texture crateTexture; - crateTexture.setTexture(":/crate.png"); + crateTexture.setTexture(":/textures/crate.png"); Cube cube; auto * m = new MeshRenderer("Test Crate", Cube(QTK_DRAW_ARRAYS)); m->getTransform().setTranslation(0, 0, 13); - m->setShaders(":/texture2d.vert", ":/texture2d.frag"); + m->setShaders(":/shaders/texture2d.vert", ":/shaders/texture2d.frag"); m->setTexture(crateTexture); m->setUniform("uTexture", 0); m->reallocateTexCoords(cube.getTexCoords()); @@ -314,7 +319,7 @@ void ExampleScene::init() { mesh = addObject( new Qtk::MeshRenderer("uvCubeArraysTest", Cube(QTK_DRAW_ARRAYS))); mesh->getTransform().setTranslation(-3.0f, 0.0f, -2.0f); - mesh->setShaders(":/texture2d.vert", ":/texture2d.frag"); + mesh->setShaders(":/shaders/texture2d.vert", ":/shaders/texture2d.frag"); mesh->setTexture(crateTexture); mesh->setUniform("uTexture", 0); mesh->reallocateTexCoords(mesh->getTexCoords()); @@ -323,8 +328,8 @@ void ExampleScene::init() { mesh = addObject(new Qtk::MeshRenderer( "uvCubeElementsTest", Cube(QTK_DRAW_ELEMENTS_NORMALS))); mesh->getTransform().setTranslation(-1.7f, 0.0f, -2.0f); - mesh->setTexture(":/crate.png"); - mesh->setShaders(":/texture2d.vert", ":/texture2d.frag"); + mesh->setTexture(":/textures/crate.png"); + mesh->setShaders(":/shaders/texture2d.vert", ":/shaders/texture2d.frag"); mesh->bindShaders(); mesh->setUniform("uTexture", 0); mesh->reallocateNormals(mesh->getNormals()); @@ -338,8 +343,9 @@ void ExampleScene::init() { addObject(new Qtk::MeshRenderer("testCubeMap", Cube(QTK_DRAW_ELEMENTS))); mesh->getTransform().setTranslation(-3.0f, 1.0f, -2.0f); mesh->getTransform().setRotation(45.0f, 0.0f, 1.0f, 0.0f); - mesh->setShaders(":/texture-cubemap.vert", ":/texture-cubemap.frag"); - mesh->setCubeMap(":/crate.png"); + mesh->setShaders( + ":/shaders/texture-cubemap.vert", ":/shaders/texture-cubemap.frag"); + mesh->setCubeMap(":/textures/crate.png"); mesh->setUniform("uTexture", 0); mesh->reallocateTexCoords(mesh->getTexCoords()); @@ -348,30 +354,30 @@ void ExampleScene::init() { mesh = addObject(new Qtk::MeshRenderer("rgbNormalsCube", Cube(QTK_DRAW_ARRAYS))); mesh->getTransform().setTranslation(5.0f, 2.0f, -2.0f); - mesh->setShaders(":/rgb-normals.vert", ":/rgb-normals.frag"); + mesh->setShaders(":/shaders/rgb-normals.vert", ":/shaders/rgb-normals.frag"); mesh->reallocateNormals(mesh->getNormals()); // RGB Normals triangle to show normals are correct with QTK_DRAW_ARRAYS mesh = addObject(new Qtk::MeshRenderer( "rgbTriangleArraysTest", Triangle(QTK_DRAW_ARRAYS))); mesh->getTransform().setTranslation(7.0f, 0.0f, 2.0f); - mesh->setShaders(":/rgb-normals.vert", ":/rgb-normals.frag"); + mesh->setShaders(":/shaders/rgb-normals.vert", ":/shaders/rgb-normals.frag"); mesh->reallocateNormals(mesh->getNormals()); // RGB Normals triangle to show normals are correct with QTK_DRAW_ELEMENTS mesh = addObject(new Qtk::MeshRenderer( "rgbTriangleElementsTest", Triangle(QTK_DRAW_ELEMENTS_NORMALS))); mesh->getTransform().setTranslation(7.0f, 0.0f, 4.0f); - mesh->setShaders(":/rgb-normals.vert", ":/rgb-normals.frag"); + mesh->setShaders(":/shaders/rgb-normals.vert", ":/shaders/rgb-normals.frag"); mesh->reallocateNormals(mesh->getNormals()); // Test drawing triangle with glDrawArrays with texture coordinates mesh = addObject( new Qtk::MeshRenderer("testTriangleArraysUV", Triangle(QTK_DRAW_ARRAYS))); mesh->getTransform().setTranslation(-3.0f, 2.0f, -2.0f); - mesh->setShaders(":/texture2d.vert", ":/texture2d.frag"); + mesh->setShaders(":/shaders/texture2d.vert", ":/shaders/texture2d.frag"); - mesh->setTexture(":/crate.png"); + mesh->setTexture(":/textures/crate.png"); mesh->setUniform("uTexture", 0); mesh->reallocateTexCoords(mesh->getTexCoords()); @@ -379,8 +385,8 @@ void ExampleScene::init() { mesh = addObject(new Qtk::MeshRenderer( "testTriangleElementsUV", Triangle(QTK_DRAW_ELEMENTS_NORMALS))); mesh->getTransform().setTranslation(-2.5f, 0.0f, -1.0f); - mesh->setShaders(":/texture2d.vert", ":/texture2d.frag"); - mesh->setTexture(":/crate.png"); + mesh->setShaders(":/shaders/texture2d.vert", ":/shaders/texture2d.frag"); + mesh->setTexture(":/textures/crate.png"); mesh->setUniform("uTexture", 0); mesh->reallocateTexCoords(mesh->getTexCoords()); } diff --git a/src/app/qtkmainwindow.ui b/src/app/qtkmainwindow.ui index fc0c14b..7fef4f5 100644 --- a/src/app/qtkmainwindow.ui +++ b/src/app/qtkmainwindow.ui @@ -178,14 +178,18 @@ + + + :/icons/fontawesome-free-6.2.1-desktop/svgs/regular/folder-open.svg:/icons/fontawesome-free-6.2.1-desktop/svgs/regular/folder-open.svg + Open... - - :/icons/resources/fontawesome-free-6.2.1-desktop/svgs/regular/floppy-disk.svg:/icons/resources/fontawesome-free-6.2.1-desktop/svgs/regular/floppy-disk.svg + + :/icons/fontawesome-free-6.2.1-desktop/svgs/regular/floppy-disk.svg:/icons/fontawesome-free-6.2.1-desktop/svgs/regular/floppy-disk.svg Save @@ -211,8 +215,8 @@ - - :/icons/resources/fontawesome-free-6.2.1-desktop/svgs/solid/cube.svg:/icons/resources/fontawesome-free-6.2.1-desktop/svgs/solid/cube.svg + + :/icons/fontawesome-free-6.2.1-desktop/svgs/solid/cube.svg:/icons/fontawesome-free-6.2.1-desktop/svgs/solid/cube.svg Load Model @@ -223,8 +227,8 @@ - - :/icons/resources/fontawesome-free-6.2.1-desktop/svgs/regular/trash-can.svg:/icons/resources/fontawesome-free-6.2.1-desktop/svgs/regular/trash-can.svg + + :/icons/fontawesome-free-6.2.1-desktop/svgs/regular/trash-can.svg:/icons/fontawesome-free-6.2.1-desktop/svgs/regular/trash-can.svg Delete Object @@ -314,7 +318,9 @@ 1 - + + + actionExit diff --git a/src/qtk/CMakeLists.txt b/src/qtk/CMakeLists.txt index b28b111..7cd735c 100644 --- a/src/qtk/CMakeLists.txt +++ b/src/qtk/CMakeLists.txt @@ -5,12 +5,6 @@ ## All Content (c) 2023 Shaun Reed, all rights reserved ## ################################################################################ -# TODO: Provide option for linking MainWindow with plugin statically -# TODO: QtkWidget plugin should instantiate a ptr to DebugConsole and store it as a member. -# Then we can connect a signal from MainWindow for creating a console to QtkWidget -# When triggered QtkWidget slot will send signal to MainWindow -# MainWindow catches signal and runs slot to attach DebugConsole to MainWindow as QDockWidget -# TODO: Create a second repository for working on QtkApplication (MainWindow) ################################################################################ # Qtk Library ################################################################################ diff --git a/src/qtk/meshrenderer.cpp b/src/qtk/meshrenderer.cpp index d88bc01..b64e6d7 100644 --- a/src/qtk/meshrenderer.cpp +++ b/src/qtk/meshrenderer.cpp @@ -30,8 +30,8 @@ MeshRenderer::MeshRenderer(const char * name) : MeshRenderer(name, Cube(QTK_DRAW_ELEMENTS)) {} MeshRenderer::MeshRenderer(const char * name, const ShapeBase & shape) : - Object(name, shape, QTK_MESH), mVertexShader(":/multi-color.vert"), - mFragmentShader(":/multi-color.frag"), mDrawType(GL_TRIANGLES) { + Object(name, shape, QTK_MESH), mVertexShader(":/shaders/multi-color.vert"), + mFragmentShader(":/shaders/multi-color.frag"), mDrawType(GL_TRIANGLES) { mShape = Shape(shape); init(); sInstances.insert(name, this); diff --git a/src/qtk/model.h b/src/qtk/model.h index d3e74eb..641d220 100644 --- a/src/qtk/model.h +++ b/src/qtk/model.h @@ -50,8 +50,8 @@ namespace Qtk { */ inline Model( const char * name, const char * path, - const char * vertexShader = ":/model-basic.vert", - const char * fragmentShader = ":/model-basic.frag") : + const char * vertexShader = ":/shaders/model-basic.vert", + const char * fragmentShader = ":/shaders/model-basic.frag") : Object(name, QTK_MODEL), mModelPath(path), mVertexShader(vertexShader), mFragmentShader(fragmentShader) { diff --git a/src/qtk/qtkapi.h b/src/qtk/qtkapi.h index 5f52438..c69c11f 100644 --- a/src/qtk/qtkapi.h +++ b/src/qtk/qtkapi.h @@ -46,7 +46,7 @@ namespace Qtk { * @return Default icon to use for Qtk desktop application. */ static QIcon getIcon() { - return QIcon(":/icons/resources/icon.png"); + return QIcon(":/icons/icon.png"); } } // namespace Qtk diff --git a/src/qtk/skybox.cpp b/src/qtk/skybox.cpp index 8eb19cd..554283e 100644 --- a/src/qtk/skybox.cpp +++ b/src/qtk/skybox.cpp @@ -18,8 +18,9 @@ using namespace Qtk; Skybox::Skybox(const std::string & name) : Skybox( - ":/right.png", ":/top.png", ":/front.png", ":/left.png", ":/bottom.png", - ":/back.png", name) {} + ":/textures/skybox/right.png", ":/textures/skybox/top.png", + ":/textures/skybox/front.png", ":/textures/skybox/left.png", + ":/textures/skybox/bottom.png", ":/textures/skybox/back.png", name) {} Skybox::Skybox(QOpenGLTexture * cubeMap, const std::string & name) { mTexture.setTexture(cubeMap); @@ -77,8 +78,10 @@ void Skybox::init() { // Set up shader program mProgram.create(); - mProgram.addShaderFromSourceFile(QOpenGLShader::Vertex, ":/skybox.vert"); - mProgram.addShaderFromSourceFile(QOpenGLShader::Fragment, ":/skybox.frag"); + mProgram.addShaderFromSourceFile( + QOpenGLShader::Vertex, ":/shaders/skybox.vert"); + mProgram.addShaderFromSourceFile( + QOpenGLShader::Fragment, ":/shaders/skybox.frag"); mProgram.link(); mProgram.bind();