diff --git a/.gitignore b/.gitignore index 1a29a2e..6621c00 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f7d690..9e99ae7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/lib/camera3d.cpp b/lib/camera3d.cpp index 2b18326..fde5e22 100644 --- a/lib/camera3d.cpp +++ b/lib/camera3d.cpp @@ -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; } diff --git a/lib/camera3d.h b/lib/camera3d.h index 0ce21b4..632b883 100644 --- a/lib/camera3d.h +++ b/lib/camera3d.h @@ -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 ## diff --git a/lib/input.cpp b/lib/input.cpp index a90e930..9aa5b67 100644 --- a/lib/input.cpp +++ b/lib/input.cpp @@ -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 ## diff --git a/lib/input.h b/lib/input.h index c2cf7d0..cf6f44c 100644 --- a/lib/input.h +++ b/lib/input.h @@ -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 ## diff --git a/lib/mainwidget.cpp b/lib/mainwidget.cpp index c135da0..dc4ab83 100644 --- a/lib/mainwidget.cpp +++ b/lib/mainwidget.cpp @@ -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 ## ##############################################################################*/ diff --git a/lib/mainwidget.h b/lib/mainwidget.h index 7a34360..10093a7 100644 --- a/lib/mainwidget.h +++ b/lib/mainwidget.h @@ -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 ## ##############################################################################*/ diff --git a/lib/mesh.cpp b/lib/mesh.cpp index 0fa8e7c..5dab145 100644 --- a/lib/mesh.cpp +++ b/lib/mesh.cpp @@ -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 ## diff --git a/lib/mesh.h b/lib/mesh.h index 0720d49..49db0c2 100644 --- a/lib/mesh.h +++ b/lib/mesh.h @@ -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 ## diff --git a/lib/meshrenderer.cpp b/lib/meshrenderer.cpp index 25a6ce3..f18849a 100644 --- a/lib/meshrenderer.cpp +++ b/lib/meshrenderer.cpp @@ -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 ## diff --git a/lib/meshrenderer.h b/lib/meshrenderer.h index cf146c4..a295fa2 100644 --- a/lib/meshrenderer.h +++ b/lib/meshrenderer.h @@ -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 ## diff --git a/lib/model.cpp b/lib/model.cpp index 54258c1..2151fc5 100644 --- a/lib/model.cpp +++ b/lib/model.cpp @@ -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 ## ## ## diff --git a/lib/model.h b/lib/model.h index ee06306..47c5124 100644 --- a/lib/model.h +++ b/lib/model.h @@ -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 ## ## ## diff --git a/lib/object.cpp b/lib/object.cpp index 36367bb..463b0aa 100644 --- a/lib/object.cpp +++ b/lib/object.cpp @@ -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 ## diff --git a/lib/object.h b/lib/object.h index 7af76a9..c48b62e 100644 --- a/lib/object.h +++ b/lib/object.h @@ -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 ## diff --git a/lib/scene.cpp b/lib/scene.cpp index 97ecfee..ce972eb 100644 --- a/lib/scene.cpp +++ b/lib/scene.cpp @@ -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 ## diff --git a/lib/scene.h b/lib/scene.h index e4c6b0d..8d5964d 100644 --- a/lib/scene.h +++ b/lib/scene.h @@ -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 ## diff --git a/lib/skybox.cpp b/lib/skybox.cpp index 322a679..87aa163 100644 --- a/lib/skybox.cpp +++ b/lib/skybox.cpp @@ -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 ## diff --git a/lib/skybox.h b/lib/skybox.h index 8a67a3d..83ab04d 100644 --- a/lib/skybox.h +++ b/lib/skybox.h @@ -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 ## diff --git a/lib/texture.cpp b/lib/texture.cpp index 4a240b7..3b7cb39 100644 --- a/lib/texture.cpp +++ b/lib/texture.cpp @@ -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"; diff --git a/lib/texture.h b/lib/texture.h index adb8824..bf41dbf 100644 --- a/lib/texture.h +++ b/lib/texture.h @@ -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 ## diff --git a/lib/transform3D.cpp b/lib/transform3D.cpp index af36375..7fc4b50 100644 --- a/lib/transform3D.cpp +++ b/lib/transform3D.cpp @@ -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 ## ## ## diff --git a/lib/transform3D.h b/lib/transform3D.h index 05011f7..2ce6c74 100644 --- a/lib/transform3D.h +++ b/lib/transform3D.h @@ -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 ## ## ##