Compare commits
3 Commits
f78e41dc76
...
d7fe2c0fc2
Author | SHA1 | Date |
---|---|---|
Shaun Reed | d7fe2c0fc2 | |
Shaun Reed | ebb597dae6 | |
Shaun Reed | ab60994203 |
|
@ -6,40 +6,21 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build-Qtk:
|
Ubuntu:
|
||||||
strategy:
|
runs-on: ubuntu-latest
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest]
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
CMAKE_PARAMS: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.3.1/gcc_64/
|
|
||||||
- os: macos-latest
|
|
||||||
CMAKE_PARAMS: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.3.1/gcc_64/ -DASSIMP_NEW_INTERFACE=on
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v2
|
uses: jurplel/install-qt-action@v2
|
||||||
with:
|
with:
|
||||||
version: '6.3.1'
|
version: '6.2.3'
|
||||||
|
|
||||||
- name: Install Assimp Linux
|
- name: Install Assimp
|
||||||
if: matrix.os == 'ubuntu-latest'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
sudo apt install libassimp-dev -y
|
sudo apt install libassimp-dev -y
|
||||||
|
|
||||||
- name: Install Assimp MacOS
|
|
||||||
if: matrix.os == 'macos-latest'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
brew install assimp
|
|
||||||
|
|
||||||
- name: Build Qtk
|
- name: Build Qtk
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake .. ${{ matrix.CMAKE_PARAMS }} && cmake --build .
|
cmake .. -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.2.3/gcc_64/ && cmake --build .
|
|
@ -27,25 +27,27 @@ if (NOT Qt6_FOUND)
|
||||||
message(FATAL_ERROR "Specify path to Qt6 with `cmake -DCMAKE_PREFIX_PATH=/path/to/Qt/6.x.x/gcc_64 -S /path/to/qtk -B /path/to/qtk/build && cmake --build /path/to/qtk/build -j $(nprocs)`")
|
message(FATAL_ERROR "Specify path to Qt6 with `cmake -DCMAKE_PREFIX_PATH=/path/to/Qt/6.x.x/gcc_64 -S /path/to/qtk -B /path/to/qtk/build && cmake --build /path/to/qtk/build -j $(nprocs)`")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Add our Qt resources.qrc file to our application
|
||||||
|
set(SOURCES app/main.cpp)
|
||||||
|
qt6_add_big_resources(SOURCES resources.qrc)
|
||||||
|
|
||||||
|
add_executable(qtk ${SOURCES})
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# External Libraries
|
# External Libraries
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# https://github.com/assimp/assimp/commit/6ac8279977c3a54118551e549d77329497116f66
|
# https://github.com/assimp/assimp/commit/6ac8279977c3a54118551e549d77329497116f66
|
||||||
find_package(assimp REQUIRED)
|
find_package(assimp REQUIRED)
|
||||||
option(ASSIMP_NEW_INTERFACE "Use assimp::assimp as target instead of assimp" OFF)
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Custom Libraries
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# Mainwidget
|
||||||
include(GenerateExportHeader)
|
include(GenerateExportHeader)
|
||||||
|
add_library(main-widget SHARED
|
||||||
################################################################################
|
|
||||||
# Final Application
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
# Add our Qt resources.qrc file to our application
|
|
||||||
set(SOURCES app/main.cpp)
|
|
||||||
qt6_add_big_resources(SOURCES resources.qrc)
|
|
||||||
qt_add_executable(qtk ${SOURCES})
|
|
||||||
|
|
||||||
set(SOURCES
|
|
||||||
src/mainwidget.cpp src/mainwidget.h
|
src/mainwidget.cpp src/mainwidget.h
|
||||||
src/mainwindow.cpp src/mainwindow.h src/mainwindow.ui
|
src/mainwindow.cpp src/mainwindow.h src/mainwindow.ui
|
||||||
src/input.cpp src/input.h
|
src/input.cpp src/input.h
|
||||||
|
@ -60,28 +62,21 @@ set(SOURCES
|
||||||
src/scene.cpp src/scene.h
|
src/scene.cpp src/scene.h
|
||||||
src/resourcemanager.cpp src/resourcemanager.h
|
src/resourcemanager.cpp src/resourcemanager.h
|
||||||
)
|
)
|
||||||
qt_add_library(main-widget STATIC ${SOURCES})
|
|
||||||
|
|
||||||
target_include_directories(main-widget PUBLIC src/)
|
target_include_directories(main-widget PUBLIC src/)
|
||||||
if(ASSIMP_NEW_INTERFACE)
|
target_link_libraries(main-widget PRIVATE assimp)
|
||||||
target_link_libraries(main-widget PRIVATE assimp::assimp)
|
target_link_libraries(main-widget PUBLIC Qt${QT_VERSION_MAJOR}::OpenGLWidgets)
|
||||||
else()
|
|
||||||
target_link_libraries(main-widget PRIVATE assimp)
|
|
||||||
endif()
|
|
||||||
target_link_libraries(main-widget PUBLIC Qt6::OpenGLWidgets)
|
|
||||||
if(WIN32)
|
|
||||||
find_package(OpenGL REQUIRED)
|
|
||||||
target_link_libraries(main-widget PUBLIC OpenGL::GL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(qtk PUBLIC main-widget)
|
################################################################################
|
||||||
|
# Final Application
|
||||||
|
################################################################################
|
||||||
|
|
||||||
# Link qtk executable to main main-widget library
|
# Link qtk executable to main main-widget library
|
||||||
|
target_link_libraries(qtk PUBLIC main-widget)
|
||||||
|
|
||||||
set_target_properties(qtk PROPERTIES
|
set_target_properties(qtk PROPERTIES
|
||||||
WIN32_EXECUTABLE TRUE
|
WIN32_EXECUTABLE TRUE
|
||||||
MACOSX_BUNDLE TRUE
|
MACOSX_BUNDLE TRUE
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
generate_export_header(main-widget)
|
generate_export_header(main-widget)
|
||||||
|
|
|
@ -31,8 +31,6 @@ Model * Model::getInstance(const char * name)
|
||||||
|
|
||||||
void ModelMesh::initMesh(const char * vert, const char * frag)
|
void ModelMesh::initMesh(const char * vert, const char * frag)
|
||||||
{
|
{
|
||||||
initializeOpenGLFunctions();
|
|
||||||
|
|
||||||
// Create VAO, VBO, EBO
|
// Create VAO, VBO, EBO
|
||||||
mVAO->create();
|
mVAO->create();
|
||||||
mVBO->create();
|
mVBO->create();
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <QOpenGLShaderProgram>
|
#include <QOpenGLShaderProgram>
|
||||||
#include <QOpenGLTexture>
|
#include <QOpenGLTexture>
|
||||||
#include <QOpenGLVertexArrayObject>
|
#include <QOpenGLVertexArrayObject>
|
||||||
#include <QOpenGLFunctions>
|
|
||||||
|
|
||||||
// Assimp
|
// Assimp
|
||||||
#include <assimp/Importer.hpp>
|
#include <assimp/Importer.hpp>
|
||||||
|
@ -45,7 +44,7 @@ struct ModelTexture {
|
||||||
|
|
||||||
class Model;
|
class Model;
|
||||||
|
|
||||||
class ModelMesh : protected QOpenGLFunctions {
|
class ModelMesh {
|
||||||
public:
|
public:
|
||||||
friend Model;
|
friend Model;
|
||||||
typedef std::vector<ModelVertex> Vertices;
|
typedef std::vector<ModelVertex> Vertices;
|
||||||
|
|
|
@ -7,18 +7,7 @@
|
||||||
##############################################################################*/
|
##############################################################################*/
|
||||||
|
|
||||||
#include "resourcemanager.h"
|
#include "resourcemanager.h"
|
||||||
#include <algorithm>
|
|
||||||
#include <string>
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
static std::string nixPath(std::string path)
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_WINDOWS
|
|
||||||
std::replace(path.begin(), path.end(), '\\', '/');
|
|
||||||
#endif
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string RM::resourcesDir =
|
std::string RM::resourcesDir =
|
||||||
std::string(__FILE__).substr(0, nixPath(__FILE__).find("src/"))
|
std::string(__FILE__).substr(0, std::string(__FILE__).find("src/"))
|
||||||
+ "resources/";
|
+ "resources/";
|
||||||
|
|
|
@ -69,8 +69,6 @@ void Skybox::draw()
|
||||||
|
|
||||||
void Skybox::init()
|
void Skybox::init()
|
||||||
{
|
{
|
||||||
initializeOpenGLFunctions();
|
|
||||||
|
|
||||||
// Set up shader program
|
// Set up shader program
|
||||||
mProgram.create();
|
mProgram.create();
|
||||||
mProgram.addShaderFromSourceFile(QOpenGLShader::Vertex, ":/skybox.vert");
|
mProgram.addShaderFromSourceFile(QOpenGLShader::Vertex, ":/skybox.vert");
|
||||||
|
|
|
@ -13,13 +13,12 @@
|
||||||
#include <QOpenGLShaderProgram>
|
#include <QOpenGLShaderProgram>
|
||||||
#include <QOpenGLTexture>
|
#include <QOpenGLTexture>
|
||||||
#include <QOpenGLVertexArrayObject>
|
#include <QOpenGLVertexArrayObject>
|
||||||
#include <QOpenGLFunctions>
|
|
||||||
|
|
||||||
#include <camera3d.h>
|
#include <camera3d.h>
|
||||||
#include <mesh.h>
|
#include <mesh.h>
|
||||||
|
|
||||||
|
|
||||||
class Skybox : protected QOpenGLFunctions {
|
class Skybox {
|
||||||
public:
|
public:
|
||||||
// Delegate this constructor to use default skybox images
|
// Delegate this constructor to use default skybox images
|
||||||
// + This allows creating a skybox with no arguments ( auto s = new Skybox; )
|
// + This allows creating a skybox with no arguments ( auto s = new Skybox; )
|
||||||
|
|
Loading…
Reference in New Issue