Port project to Qt6
This commit is contained in:
parent
aebab76915
commit
22d6ac1b06
|
@ -15,6 +15,7 @@
|
|||
*.so.*
|
||||
*.dll
|
||||
*.dylib
|
||||
*.exe
|
||||
|
||||
# Qt-es
|
||||
object_script.*.Release
|
||||
|
@ -51,8 +52,67 @@ target_wrapper.*
|
|||
# QtCreator CMake
|
||||
CMakeLists.txt.user*
|
||||
|
||||
# QtCreator 4.8< compilation database
|
||||
# QtCreator 4.8< compilation database
|
||||
compile_commands.json
|
||||
|
||||
# QtCreator local machine specific files for imported projects
|
||||
*creator.user*
|
||||
|
||||
*~
|
||||
*.autosave
|
||||
*.core
|
||||
*.obj
|
||||
*.orig
|
||||
*.rej
|
||||
*_pch.h.cpp
|
||||
*_resource.rc
|
||||
.#*
|
||||
*.*#
|
||||
core
|
||||
!core/
|
||||
tags
|
||||
.DS_Store
|
||||
.directory
|
||||
*.debug
|
||||
Makefile*
|
||||
*.prl
|
||||
*.app
|
||||
moc_*.cpp
|
||||
ui_*.h
|
||||
qrc_*.cpp
|
||||
Thumbs.db
|
||||
*.res
|
||||
*.rc
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
|
||||
# qtcreator generated files
|
||||
*.pro.user*
|
||||
|
||||
# xemacs temporary files
|
||||
*.flc
|
||||
|
||||
# Vim temporary files
|
||||
.*.swp
|
||||
|
||||
# Visual Studio generated files
|
||||
*.ib_pdb_index
|
||||
*.idb
|
||||
*.ilk
|
||||
*.pdb
|
||||
*.sln
|
||||
*.suo
|
||||
*.vcproj
|
||||
*vcproj.*.*.user
|
||||
*.ncb
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.vcxproj
|
||||
*vcxproj.*
|
||||
|
||||
# MinGW generated files
|
||||
*.Debug
|
||||
*.Release
|
||||
|
||||
# Python byte code
|
||||
*.pyc
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
################################################################################
|
||||
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
|
||||
## ##
|
||||
## Project for working with OpenGL and Qt5 widgets ##
|
||||
## Project for working with OpenGL and Qt6 widgets ##
|
||||
################################################################################
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
|
@ -19,19 +19,18 @@ set(CMAKE_AUTORCC ON)
|
|||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Find all Qt package components required for this project
|
||||
find_package(Qt5 COMPONENTS Core LinguistTools Gui Widgets REQUIRED)
|
||||
#find_package(QT NAMES Qt6 COMPONENTS Widgets REQUIRED)
|
||||
find_package(Qt6 COMPONENTS Widgets OpenGLWidgets OpenGL REQUIRED)
|
||||
|
||||
# Add our Qt resources.qrc file to our application
|
||||
set(SOURCES app/main.cpp)
|
||||
qt5_add_resources(SOURCES resources.qrc)
|
||||
qt6_add_resources(SOURCES resources.qrc)
|
||||
|
||||
add_executable(
|
||||
qtk # Executable name
|
||||
${SOURCES} # Executable source code
|
||||
)
|
||||
|
||||
|
||||
################################################################################
|
||||
# External Libraries
|
||||
################################################################################
|
||||
|
@ -57,23 +56,24 @@ target_link_libraries(main-widget PRIVATE ${OPENGL_LIBRARIES})
|
|||
# Input
|
||||
add_library(input lib/input.cpp)
|
||||
target_include_directories(input PUBLIC lib/)
|
||||
target_link_libraries(input PUBLIC Qt5::Widgets)
|
||||
target_link_libraries(input PUBLIC Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
# Mesh
|
||||
add_library(mesh lib/mesh.cpp)
|
||||
target_include_directories(mesh PUBLIC lib/)
|
||||
target_link_libraries(mesh PUBLIC Qt5::Widgets)
|
||||
target_link_libraries(mesh PUBLIC Qt${QT_VERSION_MAJOR}::OpenGLWidgets)
|
||||
|
||||
# Texture
|
||||
add_library(texture lib/texture.cpp)
|
||||
target_include_directories(texture PUBLIC lib/)
|
||||
target_link_libraries(texture PUBLIC Qt5::Widgets)
|
||||
target_link_libraries(texture PUBLIC Qt${QT_VERSION_MAJOR}::OpenGLWidgets)
|
||||
|
||||
# Object
|
||||
add_library(object lib/object.cpp)
|
||||
target_include_directories(object PUBLIC lib/)
|
||||
target_link_libraries(object PUBLIC Qt5::Widgets)
|
||||
target_link_libraries(object INTERFACE mesh)
|
||||
target_link_libraries(object PUBLIC Qt${QT_VERSION_MAJOR}::OpenGL)
|
||||
target_link_libraries(object PUBLIC Qt${QT_VERSION_MAJOR}::OpenGLWidgets)
|
||||
|
||||
# MeshRenderer
|
||||
add_library(meshrenderer lib/meshrenderer.cpp)
|
||||
|
@ -84,25 +84,28 @@ target_link_libraries(meshrenderer PUBLIC object)
|
|||
add_library(camera3d lib/camera3d.cpp)
|
||||
target_include_directories(camera3d PUBLIC lib/)
|
||||
target_link_libraries(camera3d INTERFACE input)
|
||||
target_link_libraries(camera3d PUBLIC Qt5::Widgets)
|
||||
target_link_libraries(camera3d PUBLIC Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
# Skybox
|
||||
add_library(skybox lib/skybox.cpp)
|
||||
# Skybox needs Mesh, Camera3D, and Qt5::Widgets
|
||||
# Skybox needs Mesh, Camera3D, and Qt6::Widgets
|
||||
target_link_libraries(skybox PRIVATE mesh)
|
||||
target_link_libraries(skybox PRIVATE camera3d)
|
||||
target_link_libraries(skybox PUBLIC Qt${QT_VERSION_MAJOR}::OpenGLWidgets)
|
||||
|
||||
# Transform3D
|
||||
add_library(transform3d lib/transform3D.cpp)
|
||||
target_include_directories(transform3d PUBLIC lib/)
|
||||
target_link_libraries(transform3d PUBLIC Qt5::Widgets)
|
||||
target_link_libraries(transform3d PUBLIC Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
# Model
|
||||
add_library(model lib/model.cpp)
|
||||
target_include_directories(model PUBLIC lib/)
|
||||
target_link_libraries(model PRIVATE assimp)
|
||||
# Model library requires transform3d and Qt5::Widgets
|
||||
target_link_libraries(model PUBLIC Qt${QT_VERSION_MAJOR}::OpenGL)
|
||||
# Model library requires transform3d and Qt6::Widgets
|
||||
target_link_libraries(model PUBLIC transform3d)
|
||||
target_link_libraries(model PUBLIC Qt${QT_VERSION_MAJOR}::OpenGLWidgets)
|
||||
|
||||
# Scene
|
||||
add_library(scene lib/scene.cpp)
|
||||
|
@ -111,13 +114,13 @@ target_link_libraries(scene PUBLIC model)
|
|||
target_link_libraries(scene PUBLIC meshrenderer)
|
||||
target_link_libraries(scene PUBLIC skybox)
|
||||
target_link_libraries(scene PUBLIC texture)
|
||||
target_link_libraries(scene PUBLIC Qt${QT_VERSION_MAJOR}::OpenGLWidgets)
|
||||
|
||||
|
||||
################################################################################
|
||||
# Final Application
|
||||
################################################################################
|
||||
|
||||
#target_link_libraries(main-widget PRIVATE input)
|
||||
target_link_libraries(main-widget PRIVATE mesh)
|
||||
target_link_libraries(main-widget PUBLIC scene)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Fly camera class from tutorials followed at trentreed.net ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
@ -22,7 +22,8 @@ const QVector3D Camera3D::LocalRight(1.0f, 0.0f, 0.0f);
|
|||
const QMatrix4x4 & Camera3D::toMatrix()
|
||||
{
|
||||
mWorld.setToIdentity();
|
||||
mWorld.rotate(mTransform.rotation().conjugate());
|
||||
// Qt6 renamed QMatrix4x4::conjugate() to conjugated()
|
||||
mWorld.rotate(mTransform.rotation().conjugated());
|
||||
mWorld.translate(-mTransform.translation());
|
||||
return mWorld;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Fly camera class from tutorials followed at trentreed.net ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Input class from tutorials followed at trentreed.net ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Input class from tutorials followed at trentreed.net ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: Main window for Qt5 OpenGL widget application ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Main window for Qt6 OpenGL widget application ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################*/
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## About: Main window for Qt5 OpenGL widget application ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Main window for Qt6 OpenGL widget application ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
##############################################################################*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Collection of static mesh data for quick initialization ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Collection of static mesh data for quick initialization ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: MeshRenderer class for quick object creation and drawing ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: MeshRenderer class for quick object creation and drawing ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Model classes for importing with Assimp ##
|
||||
## From following tutorials on learnopengl.com ##
|
||||
## ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Model classes for importing with Assimp ##
|
||||
## From following tutorials on learnopengl.com ##
|
||||
## ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Object class for storing object data ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Object class for storing object data ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Classes for managing objects and data within a scene ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Classes for managing objects and data within a scene ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Skybox class using QtOpenGL ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Skybox class using QtOpenGL ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Texture class to help with texture and image initializations ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
@ -14,6 +14,8 @@
|
|||
|
||||
QImage * Texture::initImage(const char * image, bool flipX, bool flipY)
|
||||
{
|
||||
// Qt6 limits loaded images to 256MB by default
|
||||
QImageReader::setAllocationLimit(512);
|
||||
auto loadedImage = new QImage(QImage(image).mirrored(flipX, flipY));
|
||||
if (loadedImage->isNull()) {
|
||||
qDebug() << "Error loading image: " << image << "\n";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Texture class to help with texture and image initializations ##
|
||||
## ##
|
||||
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Transform3D class to represent object position in 3D space ##
|
||||
## From following tutorials at trentreed.net ##
|
||||
## ##
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*##############################################################################
|
||||
## Author: Shaun Reed ##
|
||||
## Legal: All Content (c) 2021 Shaun Reed, all rights reserved ##
|
||||
## Legal: All Content (c) 2022 Shaun Reed, all rights reserved ##
|
||||
## About: Transform3D class to represent object position in 3D space ##
|
||||
## From following tutorials at trentreed.net ##
|
||||
## ##
|
||||
|
|
Loading…
Reference in New Issue