Compare commits
4 Commits
0ef62ebfa5
...
gitea-ci
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e7058625d | |||
| 7a6cf0e487 | |||
|
|
d0c8316f79 | ||
| ad59d9149e |
331
.gitea/workflows/all-builds.yml
Normal file
331
.gitea/workflows/all-builds.yml
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
name: All Builds
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
QT_VERSION: 6.6.0
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Qtk:
|
||||||
|
env:
|
||||||
|
CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=ON -DQTK_PLUGINS=OFF -DQTK_EXAMPLE=ON
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
|
flags: -j $(nproc)
|
||||||
|
- os: windows-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=D:/a/qtk/qtk/Qt/$QT_VERSION/mingw81_64/ $CONFIG
|
||||||
|
flags: ''
|
||||||
|
- os: macos-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
|
flags: -j $(nproc)
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install Debian packaging dependencies
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
run: |
|
||||||
|
apt update -y
|
||||||
|
apt install libxcb-cursor0 python3 -y
|
||||||
|
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v2
|
||||||
|
with:
|
||||||
|
version: ${{ env.QT_VERSION }}
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
|
||||||
|
- name: Chocolatey Action
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
uses: crazy-max/ghaction-chocolatey@v2
|
||||||
|
with:
|
||||||
|
args: install pkgconfiglite --checksum e87b5ea3c9142256af60f2d5b917aa63b571e6a0 --checksum-type sha1
|
||||||
|
|
||||||
|
- name: Configure Qtk Application
|
||||||
|
shell: bash
|
||||||
|
run: cmake -B build/ ${{ matrix.cmake }}
|
||||||
|
|
||||||
|
- name: Build Qtk Application
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build build/ --config Release --target qtk_gui ${{ matrix.flags }}
|
||||||
|
|
||||||
|
- name: Build Qtk Example
|
||||||
|
if: matrix.os != 'windows-latest'
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build build/ --config Release --target qtk_example ${{ matrix.flags }}
|
||||||
|
|
||||||
|
# Packaging
|
||||||
|
|
||||||
|
- name: Install Qtk Application
|
||||||
|
shell: bash
|
||||||
|
run: cmake --install build/ --config Release --component qtk_gui
|
||||||
|
|
||||||
|
- name: Package Qtk Application
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build build/ --target package --config Release
|
||||||
|
|
||||||
|
- name: Package Qtk (DEB)
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
cpack -C Release -G DEB
|
||||||
|
|
||||||
|
- name: Upload package artifacts (DEB)
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: qtk-gui-${{ matrix.os }}
|
||||||
|
path: |
|
||||||
|
build/packages/*.deb
|
||||||
|
|
||||||
|
- name: Package Qtk (WIN)
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
cpack -C Release -G NSIS
|
||||||
|
|
||||||
|
- name: Upload package artifacts (WIN)
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: qtk-gui-${{ matrix.os }}
|
||||||
|
path: |
|
||||||
|
build/packages/*.exe
|
||||||
|
|
||||||
|
- name: Package Qtk (OSX)
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
cpack -C Release -G TGZ
|
||||||
|
|
||||||
|
- name: Upload package artifacts (OSX)
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: qtk-gui-${{ matrix.os }}
|
||||||
|
path: |
|
||||||
|
build/packages/*.tar.gz
|
||||||
|
|
||||||
|
- name: Upload Qtk install directory
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: qtk-gui-${{ matrix.os }}-install
|
||||||
|
path: install/*
|
||||||
|
|
||||||
|
# TODO: Enable after trimming resources.
|
||||||
|
# - name: Package Qtk Application Sources
|
||||||
|
# if: matrix.os != 'macos-latest'
|
||||||
|
# shell: bash
|
||||||
|
# run: |
|
||||||
|
# cmake --build build/ --target package_source
|
||||||
|
#
|
||||||
|
# - name: Upload package artifacts
|
||||||
|
# uses: actions/upload-artifact@v3
|
||||||
|
# with:
|
||||||
|
# name: qtk-${{ matrix.os }}-packages
|
||||||
|
# path: |
|
||||||
|
# build/packages/*
|
||||||
|
# !build/packages/_CPack_Packages/*
|
||||||
|
|
||||||
|
Qtk-Library:
|
||||||
|
env:
|
||||||
|
CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=OFF -DQTK_PLUGINS=OFF -DQTK_EXAMPLE=OFF
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
|
flags: -j $(nproc)
|
||||||
|
- os: windows-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=D:/a/qtk/qtk/Qt/$QT_VERSION/mingw81_64/ $CONFIG
|
||||||
|
flags: ''
|
||||||
|
- os: macos-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
|
flags: -j $(nproc)
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v2
|
||||||
|
with:
|
||||||
|
version: ${{ env.QT_VERSION }}
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
|
||||||
|
- name: Chocolatey Action
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
uses: crazy-max/ghaction-chocolatey@v2
|
||||||
|
with:
|
||||||
|
args: install pkgconfiglite --checksum e87b5ea3c9142256af60f2d5b917aa63b571e6a0 --checksum-type sha1
|
||||||
|
|
||||||
|
- name: Configure Qtk Library
|
||||||
|
shell: bash
|
||||||
|
run: cmake -B build/ ${{ matrix.cmake }}
|
||||||
|
|
||||||
|
- name: Build Qtk Library
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build build/ --config Release --target qtk_library -- ${{ matrix.flags }}
|
||||||
|
|
||||||
|
# Packaging
|
||||||
|
|
||||||
|
- name: Install Qtk Library
|
||||||
|
shell: bash
|
||||||
|
run: cmake --install build/ --config Release --prefix=$(pwd)/install --component qtk_library
|
||||||
|
|
||||||
|
- name: Package Qtk Library
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build build/ --target package --config Release
|
||||||
|
|
||||||
|
- name: Package Qtk Library (DEB)
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
cpack -C Release -G DEB
|
||||||
|
|
||||||
|
- name: Upload package artifacts (DEB)
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: libqtk-${{ matrix.os }}
|
||||||
|
path: |
|
||||||
|
build/packages/*.deb
|
||||||
|
|
||||||
|
- name: Package Qtk Library (WIN)
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
cpack -C Release -G NSIS
|
||||||
|
|
||||||
|
- name: Upload package artifacts (WIN)
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: qtk-${{ matrix.os }}
|
||||||
|
path: |
|
||||||
|
build/packages/*.exe
|
||||||
|
|
||||||
|
- name: Package Qtk Library (OSX)
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
cpack -C Release -G TGZ
|
||||||
|
|
||||||
|
- name: Upload package artifacts (OSX)
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: qtk-${{ matrix.os }}
|
||||||
|
path: |
|
||||||
|
build/packages/*.tar.gz
|
||||||
|
|
||||||
|
- name: Upload libqtk install
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: libqtk-${{ matrix.os }}-install
|
||||||
|
path: install/*
|
||||||
|
|
||||||
|
Qtk-Plugins:
|
||||||
|
env:
|
||||||
|
CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=OFF -DQTK_PLUGINS=ON -DQTK_EXAMPLE=OFF
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
|
flags: -j $(nproc)
|
||||||
|
- os: windows-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=D:/a/qtk/qtk/Qt/$QT_VERSION/mingw81_64/ $CONFIG
|
||||||
|
flags: ''
|
||||||
|
- os: macos-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
|
flags: -j $(nproc)
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v2
|
||||||
|
with:
|
||||||
|
version: ${{ env.QT_VERSION }}
|
||||||
|
|
||||||
|
- name: Chocolatey Action
|
||||||
|
if: matrix.os == 'windows-latest'
|
||||||
|
uses: crazy-max/ghaction-chocolatey@v2
|
||||||
|
with:
|
||||||
|
args: install pkgconfiglite --checksum e87b5ea3c9142256af60f2d5b917aa63b571e6a0 --checksum-type sha1
|
||||||
|
|
||||||
|
- name: Configure Qtk Plugins
|
||||||
|
shell: bash
|
||||||
|
run: cmake -B build/ ${{ matrix.cmake }}
|
||||||
|
|
||||||
|
- name: Build Qtk Plugins
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build build/ --config Release --target qtk_plugins -- ${{ matrix.flags }}
|
||||||
|
|
||||||
|
# Packaging
|
||||||
|
|
||||||
|
- name: Install Qtk Plugins
|
||||||
|
shell: bash
|
||||||
|
run: cmake --install build/ --config Release --component qtk_plugins
|
||||||
|
|
||||||
|
Qtk-Assimp-Targets:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, macos-latest]
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/
|
||||||
|
- os: macos-latest
|
||||||
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v2
|
||||||
|
with:
|
||||||
|
version: ${{ env.QT_VERSION }}
|
||||||
|
|
||||||
|
- name: Install Assimp MacOS
|
||||||
|
if: matrix.os == 'macos-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
brew install assimp
|
||||||
|
|
||||||
|
- name: Install Assimp Ubuntu
|
||||||
|
if: matrix.os == 'ubuntu-latest'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
apt install libassimp-dev
|
||||||
|
|
||||||
|
- name: Configure Qtk
|
||||||
|
shell: bash
|
||||||
|
run: cmake -B build/ ${{ matrix.cmake }} -DQTK_CCACHE=OFF -DQTK_ASSIMP_NEW_INTERFACE=ON
|
||||||
|
|
||||||
|
- name: Build Qtk
|
||||||
|
shell: bash
|
||||||
|
run: cmake --build build/ --config Release
|
||||||
76
.gitea/workflows/linting.yml
Normal file
76
.gitea/workflows/linting.yml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
name: Linting
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Tidy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install Assimp Ubuntu
|
||||||
|
run: |
|
||||||
|
python3 --version
|
||||||
|
|
||||||
|
- name: Install Assimp Ubuntu
|
||||||
|
run: |
|
||||||
|
apt update -y
|
||||||
|
apt install libassimp-dev -y
|
||||||
|
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v3
|
||||||
|
with:
|
||||||
|
version: '6.5.0'
|
||||||
|
|
||||||
|
- name: Build Qtk
|
||||||
|
run: |
|
||||||
|
cmake -B build -DQTK_SUBMODULES=OFF -DQTK_CCACHE=OFF -DQTK_PLUGINS=OFF -DQTK_GUI=ON
|
||||||
|
cmake --build build --target qtk_gui -- -j $(nproc)
|
||||||
|
|
||||||
|
- uses: cpp-linter/cpp-linter-action@v2
|
||||||
|
id: linter
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
# Use clang-tools 14
|
||||||
|
version: '14'
|
||||||
|
# Don't use clang-format with this action
|
||||||
|
# + Set to `file` to use .clang-format (Qtk formats with clang 15)
|
||||||
|
style: ''
|
||||||
|
# Use .clang-tidy file
|
||||||
|
tidy-checks: ''
|
||||||
|
# Check the entire repo for source files to tidy
|
||||||
|
files-changed-only: false
|
||||||
|
# Ignore qtk build and external assimp directories
|
||||||
|
ignore: '.github|build|extern/assimp/assimp'
|
||||||
|
# Point to compile_commands.json produced by build
|
||||||
|
database: 'build'
|
||||||
|
# Use thread comments as feedback
|
||||||
|
thread-comments: true
|
||||||
|
# Show file annotations on GH
|
||||||
|
file-annotations: true
|
||||||
|
|
||||||
|
- name: Fail CI if checks don't pass
|
||||||
|
if: steps.linter.outputs.checks-failed != 0
|
||||||
|
run: exit 1
|
||||||
|
|
||||||
|
Format:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
path:
|
||||||
|
- 'src'
|
||||||
|
- 'app'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup docker
|
||||||
|
uses: crazy-max/ghaction-setup-docker@v3
|
||||||
|
|
||||||
|
- name: clang-format Check
|
||||||
|
uses: jidicula/clang-format-action@v4.9.0
|
||||||
|
with:
|
||||||
|
clang-format-version: '15'
|
||||||
|
check-path: ${{ matrix.path }}
|
||||||
35
.github/workflows/all-builds.yml
vendored
35
.github/workflows/all-builds.yml
vendored
@@ -5,6 +5,9 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
QT_VERSION: 6.6.0
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Qtk:
|
Qtk:
|
||||||
env:
|
env:
|
||||||
@@ -15,13 +18,13 @@ jobs:
|
|||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.5.0/gcc_64/ $CONFIG
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
flags: -j $(nproc)
|
flags: -j $(nproc)
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=D:/a/qtk/qtk/Qt/6.5.0/mingw81_64/ $CONFIG
|
cmake: -DCMAKE_PREFIX_PATH=D:/a/qtk/qtk/Qt/$QT_VERSION/mingw81_64/ $CONFIG
|
||||||
flags: ''
|
flags: ''
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.5.0/gcc_64/ $CONFIG
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
flags: -j $(nproc)
|
flags: -j $(nproc)
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@@ -31,7 +34,7 @@ jobs:
|
|||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v2
|
uses: jurplel/install-qt-action@v2
|
||||||
with:
|
with:
|
||||||
version: '6.5.0'
|
version: ${{ env.QT_VERSION }}
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
|
|
||||||
@@ -145,13 +148,13 @@ jobs:
|
|||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.5.0/gcc_64/ $CONFIG
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
flags: -j $(nproc)
|
flags: -j $(nproc)
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=D:/a/qtk/qtk/Qt/6.5.0/mingw81_64/ $CONFIG
|
cmake: -DCMAKE_PREFIX_PATH=D:/a/qtk/qtk/Qt/$QT_VERSION/mingw81_64/ $CONFIG
|
||||||
flags: ''
|
flags: ''
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.5.0/gcc_64/ $CONFIG
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
flags: -j $(nproc)
|
flags: -j $(nproc)
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@@ -161,7 +164,7 @@ jobs:
|
|||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v2
|
uses: jurplel/install-qt-action@v2
|
||||||
with:
|
with:
|
||||||
version: '6.5.0'
|
version: ${{ env.QT_VERSION }}
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
|
|
||||||
@@ -250,13 +253,13 @@ jobs:
|
|||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.5.0/gcc_64/ $CONFIG
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
flags: -j $(nproc)
|
flags: -j $(nproc)
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=D:/a/qtk/qtk/Qt/6.5.0/mingw81_64/ $CONFIG
|
cmake: -DCMAKE_PREFIX_PATH=D:/a/qtk/qtk/Qt/$QT_VERSION/mingw81_64/ $CONFIG
|
||||||
flags: ''
|
flags: ''
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.5.0/gcc_64/ $CONFIG
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/ $CONFIG
|
||||||
flags: -j $(nproc)
|
flags: -j $(nproc)
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
@@ -266,7 +269,7 @@ jobs:
|
|||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v2
|
uses: jurplel/install-qt-action@v2
|
||||||
with:
|
with:
|
||||||
version: '6.5.0'
|
version: ${{ env.QT_VERSION }}
|
||||||
|
|
||||||
- name: Chocolatey Action
|
- name: Chocolatey Action
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
@@ -295,9 +298,9 @@ jobs:
|
|||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.5.0/gcc_64/
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/6.5.0/gcc_64/ -DASSIMP_NEW_INTERFACE=ON
|
cmake: -DCMAKE_PREFIX_PATH=/home/runner/work/qtk/Qt/$QT_VERSION/gcc_64/
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@@ -306,7 +309,7 @@ jobs:
|
|||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v2
|
uses: jurplel/install-qt-action@v2
|
||||||
with:
|
with:
|
||||||
version: '6.5.0'
|
version: ${{ env.QT_VERSION }}
|
||||||
|
|
||||||
- name: Install Assimp MacOS
|
- name: Install Assimp MacOS
|
||||||
if: matrix.os == 'macos-latest'
|
if: matrix.os == 'macos-latest'
|
||||||
@@ -322,7 +325,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Configure Qtk
|
- name: Configure Qtk
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cmake -B build/ ${{ matrix.cmake }} -DQTK_CCACHE=OFF
|
run: cmake -B build/ ${{ matrix.cmake }} -DQTK_CCACHE=OFF -DQTK_ASSIMP_NEW_INTERFACE=ON
|
||||||
|
|
||||||
- name: Build Qtk
|
- name: Build Qtk
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -84,17 +84,13 @@ endif ()
|
|||||||
set(QTK_RESOURCES "${CMAKE_SOURCE_DIR}/resources")
|
set(QTK_RESOURCES "${CMAKE_SOURCE_DIR}/resources")
|
||||||
set(QTK_OSX_ICONS ${CMAKE_SOURCE_DIR}/resources/icons/osx/kilroy.icns)
|
set(QTK_OSX_ICONS ${CMAKE_SOURCE_DIR}/resources/icons/osx/kilroy.icns)
|
||||||
|
|
||||||
# Print all QTK options and their values at the end of configuration.
|
|
||||||
get_cmake_property(VAR_NAMES VARIABLES)
|
|
||||||
list(FILTER VAR_NAMES INCLUDE REGEX "^Q[tT][kK]_.*$")
|
|
||||||
list(SORT VAR_NAMES)
|
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# External Dependencies
|
|
||||||
################################################################################
|
|
||||||
# Point CMAKE_PREFIX_PATH to Qt6 install directory
|
# Point CMAKE_PREFIX_PATH to Qt6 install directory
|
||||||
# If Qtk is built within Qt Creator this is not required.
|
# If Qtk is built within Qt Creator this is not required.
|
||||||
list(APPEND CMAKE_PREFIX_PATH "${QT_INSTALL_DIR}")
|
list(APPEND CMAKE_PREFIX_PATH "${QT_INSTALL_DIR}")
|
||||||
|
if (QTK_PREFIX_QTCREATOR)
|
||||||
|
# TODO: This might be a bit strange and needs more testing.
|
||||||
|
set(CMAKE_INSTALL_PREFIX "${QT_INSTALL_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(
|
set(
|
||||||
QT_CREATOR_DIR
|
QT_CREATOR_DIR
|
||||||
@@ -102,10 +98,11 @@ set(
|
|||||||
CACHE PATH "Qt Creator path used to install Qtk plugins for Qt Designer."
|
CACHE PATH "Qt Creator path used to install Qtk plugins for Qt Designer."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Print all QTK options and their values at the end of configuration.
|
||||||
# Print all QTK options and their values.
|
# We initialize this list here so that we can append to it as needed.
|
||||||
|
# All variables in this list will be printed at the end of configuration.
|
||||||
get_cmake_property(VAR_NAMES VARIABLES)
|
get_cmake_property(VAR_NAMES VARIABLES)
|
||||||
list(FILTER VAR_NAMES INCLUDE REGEX "^Q[tT][kK]_.*$")
|
list(FILTER VAR_NAMES INCLUDE REGEX "^[qQ][tT][kK]_.*$")
|
||||||
list(SORT VAR_NAMES)
|
list(SORT VAR_NAMES)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -148,6 +145,7 @@ set(
|
|||||||
CMAKE_PREFIX_PATH CMAKE_INSTALL_PREFIX QTK_PLUGIN_INSTALL_DIR QT6_INSTALL_PREFIX
|
CMAKE_PREFIX_PATH CMAKE_INSTALL_PREFIX QTK_PLUGIN_INSTALL_DIR QT6_INSTALL_PREFIX
|
||||||
QT_INSTALL_DIR
|
QT_INSTALL_DIR
|
||||||
)
|
)
|
||||||
|
# Add QT6_INSTALL_PLUGINS to VAR_NAMES so it is printed at end of configuration.
|
||||||
list(APPEND VAR_NAMES QT6_INSTALL_PLUGINS)
|
list(APPEND VAR_NAMES QT6_INSTALL_PLUGINS)
|
||||||
|
|
||||||
# Find Assimp.
|
# Find Assimp.
|
||||||
@@ -189,6 +187,8 @@ if(QTK_EXAMPLE)
|
|||||||
add_subdirectory(example-app EXCLUDE_FROM_ALL)
|
add_subdirectory(example-app EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Print all QTK options and their values at the end of configuration. This also
|
||||||
|
# prints any additional variables that we have added to VAR_NAMES and VAR_PATHS.
|
||||||
foreach(VAR_NAME IN LISTS VAR_NAMES VAR_PATHS)
|
foreach(VAR_NAME IN LISTS VAR_NAMES VAR_PATHS)
|
||||||
if(VAR_NAME IN_LIST VAR_PATHS)
|
if(VAR_NAME IN_LIST VAR_PATHS)
|
||||||
# Print absolute if variable is path
|
# Print absolute if variable is path
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -40,26 +40,26 @@ and [Qt Creator](https://github.com/qt-creator/qt-creator).
|
|||||||
Simply open the root `CMakeLists.txt` with either of these editors and
|
Simply open the root `CMakeLists.txt` with either of these editors and
|
||||||
configurations will be loaded.
|
configurations will be loaded.
|
||||||
|
|
||||||
This project has been ported to **Qt 6.5.0**, which is not yet available in
|
This project has been ported to **Qt 6.6.0**, which is not yet available in
|
||||||
Ubuntu apt repositories.
|
Ubuntu apt repositories.
|
||||||
To run this project, you will *need* to
|
To run this project, you will *need* to
|
||||||
install [Qt6 Open Source Binaries](https://www.qt.io/download-qt-installer) for
|
install [Qt6 Open Source Binaries](https://www.qt.io/download-qt-installer) for
|
||||||
your system, **version 6.5.0** or later.
|
your system, **version 6.6.0** or later.
|
||||||
Be sure to take note of the Qt6 installation directory, as we will need it to
|
Be sure to take note of the Qt6 installation directory, as we will need it to
|
||||||
correctly set our `CMAKE_PREFIX_PATH` in the next steps.
|
correctly set our `CMAKE_PREFIX_PATH` in the next steps.
|
||||||
|
|
||||||
If you are building on **Windows / Mac**, consider setting
|
If you are building on **Windows / Mac**, consider setting
|
||||||
the `-DASSIMP_NEW_INTERFACE` build flag.
|
the `-DQTK_ASSIMP_NEW_INTERFACE` cmake build option.
|
||||||
|
|
||||||
If the build is configured with all options enabled, we can subsequently install
|
If the build is configured with all options enabled, we can subsequently install
|
||||||
individual components as needed with cmake.
|
individual components as needed with cmake.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt update -y && sudo apt install libassimp-dev cmake build-essential git ccache libgl1-mesa-dev libglvnd-dev -y
|
sudo apt update -y && sudo apt install libassimp-dev cmake build-essential git ccache libgl1-mesa-dev libglvnd-dev zlib1g-dev -y
|
||||||
git clone https://github.com/shaunrd0/qtk
|
git clone https://github.com/shaunrd0/qtk
|
||||||
cd qtk
|
cd qtk
|
||||||
# Configure the build with all components enabled
|
# Configure the build with all components enabled
|
||||||
cmake -B build-all -DQTK_GUI=ON -DQTK_PLUGINS=ON -DQTK_EXAMPLE=ON -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64
|
cmake -B build-all -DQTK_GUI=ON -DQTK_PLUGINS=ON -DQTK_EXAMPLE=ON -DCMAKE_PREFIX_PATH=$HOME/Qt/6.6.0/gcc_64
|
||||||
# Build all targets
|
# Build all targets
|
||||||
cmake --build build-all/
|
cmake --build build-all/
|
||||||
````
|
````
|
||||||
@@ -75,7 +75,7 @@ Windows / Mac / Linux) and may be easier
|
|||||||
to configure.
|
to configure.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cmake -B build-all -DQTK_GUI=ON -DQTK_PLUGINS=ON -DQTK_EXAMPLE=ON -DQTK_SUBMODULES=ON -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64
|
cmake -B build-all -DQTK_GUI=ON -DQTK_PLUGINS=ON -DQTK_EXAMPLE=ON -DQTK_SUBMODULES=ON -DCMAKE_PREFIX_PATH=$HOME/Qt/6.6.0/gcc_64
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Qtk GUI
|
#### Qtk GUI
|
||||||
@@ -149,9 +149,9 @@ cmake --build build-all/ --target qtk_plugins -- -j $(nproc)
|
|||||||
# The path here should be initialized during build configuration, so no need for --prefix
|
# The path here should be initialized during build configuration, so no need for --prefix
|
||||||
cmake --install build-all/ --component qtk_plugins
|
cmake --install build-all/ --component qtk_plugins
|
||||||
-- Install configuration: "Release"
|
-- Install configuration: "Release"
|
||||||
-- Up-to-date: /home/shaun/Qt/6.5.0/gcc_64/../../Tools/QtCreator/lib/Qt/lib/libqtk_library.a
|
-- Up-to-date: /home/shaun/Qt/6.6.0/gcc_64/../../Tools/QtCreator/lib/Qt/lib/libqtk_library.a
|
||||||
-- Up-to-date: /home/shaun/Qt/6.5.0/gcc_64/../../Tools/QtCreator/lib/Qt/lib/libqtk_plugin_library.a
|
-- Up-to-date: /home/shaun/Qt/6.6.0/gcc_64/../../Tools/QtCreator/lib/Qt/lib/libqtk_plugin_library.a
|
||||||
-- Up-to-date: /home/shaun/Qt/6.5.0/gcc_64/../../Tools/QtCreator/lib/Qt/plugins/designer/libqtk_collection.so
|
-- Up-to-date: /home/shaun/Qt/6.6.0/gcc_64/../../Tools/QtCreator/lib/Qt/plugins/designer/libqtk_collection.so
|
||||||
```
|
```
|
||||||
|
|
||||||
To uninstall after a previous installation, we can run the following command
|
To uninstall after a previous installation, we can run the following command
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ void ExampleScene::init() {
|
|||||||
auto skybox = new Qtk::Skybox("Skybox");
|
auto skybox = new Qtk::Skybox("Skybox");
|
||||||
setSkybox(skybox);
|
setSkybox(skybox);
|
||||||
|
|
||||||
auto spartan = new Model(
|
std::string spartanPath = QTK_EXAMPLE_SOURCE_DIR;
|
||||||
"spartan", std::string(QTK_EXAMPLE_SOURCE_DIR)
|
spartanPath += "/resources/models/spartan/spartan.obj";
|
||||||
+ "/../resources/models/spartan/spartan.obj");
|
auto spartan = new Model("spartan", spartanPath.c_str());
|
||||||
addObject(spartan);
|
addObject(spartan);
|
||||||
spartan->getTransform().setTranslation(-4.0f, 0.0f, 0.0f);
|
spartan->getTransform().setTranslation(-4.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef QTK_RESOURCES_H_IN_H
|
#ifndef QTK_RESOURCES_H_IN_H
|
||||||
#define QTK_RESOURCES_H_IN_H
|
#define QTK_RESOURCES_H_IN_H
|
||||||
|
|
||||||
#define QTK_EXAMPLE_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@"
|
#define QTK_EXAMPLE_SOURCE_DIR "@CMAKE_SOURCE_DIR@"
|
||||||
|
|
||||||
#endif // QTK_RESOURCES_H_IN_H
|
#endif // QTK_RESOURCES_H_IN_H
|
||||||
|
|||||||
BIN
resources/images/plaster.png
Normal file
BIN
resources/images/plaster.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 MiB |
@@ -1,5 +1,6 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/textures">
|
<qresource prefix="/textures">
|
||||||
|
<file alias="plaster.png">images/plaster.png</file>
|
||||||
<file alias="crate.png">images/crate.png</file>
|
<file alias="crate.png">images/crate.png</file>
|
||||||
<file alias="stone.png">images/stone.png</file>
|
<file alias="stone.png">images/stone.png</file>
|
||||||
<file alias="wood.png">images/wood.png</file>
|
<file alias="wood.png">images/wood.png</file>
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ MainWindow::MainWindow(QWidget * parent) : QMainWindow(parent) {
|
|||||||
&Qtk::ToolBox::updateFocus);
|
&Qtk::ToolBox::updateFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Fix / use MainWindow in Qt Designer to add these dock widgets.
|
||||||
|
// For now we will add them manually, but we should be able to do this in the
|
||||||
|
// designer. At the moment if you edit the UI in designer the dock widget
|
||||||
|
// areas below will override the designer settings.
|
||||||
|
|
||||||
// Dock the toolbox widget to the main window.
|
// Dock the toolbox widget to the main window.
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, ui_->qtk__ToolBox);
|
addDockWidget(Qt::LeftDockWidgetArea, ui_->qtk__ToolBox);
|
||||||
// Add an option to toggle active widgets in the GUI's toolbar 'view' menu.
|
// Add an option to toggle active widgets in the GUI's toolbar 'view' menu.
|
||||||
@@ -82,7 +87,7 @@ Qtk::QtkWidget * MainWindow::getQtkWidget(const QString & name) {
|
|||||||
return views_[name];
|
return views_[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshScene(QString sceneName) {
|
void MainWindow::refreshScene(const QString & sceneName) {
|
||||||
// TODO: Select TreeView using sceneName>
|
// TODO: Select TreeView using sceneName
|
||||||
ui_->qtk__TreeView->updateView(getQtkWidget()->getScene());
|
ui_->qtk__TreeView->updateView(getQtkWidget()->getScene());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class MainWindow : public QMainWindow {
|
|||||||
* Trigger a refresh for widgets related to a scene that has been updated.
|
* Trigger a refresh for widgets related to a scene that has been updated.
|
||||||
* @param sceneName The name of the scene that has been modified.
|
* @param sceneName The name of the scene that has been modified.
|
||||||
*/
|
*/
|
||||||
void refreshScene(QString sceneName);
|
void refreshScene(const QString & sceneName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|||||||
@@ -37,10 +37,10 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>A custom widget tool tip.</string>
|
<string>Object details and configuration panel.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string>Custom widget what's this?</string>
|
<string>When an object is double-clicked in the TreeView for a scene, this panel will display relevant details and options.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -66,10 +66,10 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="Qtk::QtkWidget" name="qtk::QtkWidget">
|
<widget class="Qtk::QtkWidget" name="qtk::QtkWidget">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>A custom widget tool tip.</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string>Custom widget what's this?</string>
|
<string>Qtk scene view rendered using OpenGL.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -91,10 +91,10 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>A custom widget tool tip.</string>
|
<string>TreeView of objects within the current scene.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="whatsThis">
|
<property name="whatsThis">
|
||||||
<string>Custom widget what's this?</string>
|
<string>TreeView of objects within the current scene. Double-click to select an object and snap to it's position.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ void QtkWidget::initializeGL() {
|
|||||||
// Connect the frameSwapped signal to call the update() function
|
// Connect the frameSwapped signal to call the update() function
|
||||||
connect(this, SIGNAL(frameSwapped()), this, SLOT(update()));
|
connect(this, SIGNAL(frameSwapped()), this, SLOT(update()));
|
||||||
|
|
||||||
|
toggleConsole();
|
||||||
// Initialize OpenGL debug context
|
// Initialize OpenGL debug context
|
||||||
mDebugLogger = new QOpenGLDebugLogger(this);
|
mDebugLogger = new QOpenGLDebugLogger(this);
|
||||||
if(mDebugLogger->initialize()) {
|
if(mDebugLogger->initialize()) {
|
||||||
@@ -84,9 +85,6 @@ void QtkWidget::initializeGL() {
|
|||||||
connect(
|
connect(
|
||||||
mDebugLogger, SIGNAL(messageLogged(QOpenGLDebugMessage)), this,
|
mDebugLogger, SIGNAL(messageLogged(QOpenGLDebugMessage)), this,
|
||||||
SLOT(messageLogged(QOpenGLDebugMessage)));
|
SLOT(messageLogged(QOpenGLDebugMessage)));
|
||||||
// connect(
|
|
||||||
// mDebugLogger, SIGNAL(messageLogged(QOpenGLDebugMessage)),
|
|
||||||
// mConsole, SLOT(sendLog(QOpenGLDebugMessage)));
|
|
||||||
mDebugLogger->startLogging();
|
mDebugLogger->startLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,8 +155,8 @@ void QtkWidget::dragEnterEvent(QDragEnterEvent * event) {
|
|||||||
|
|
||||||
void QtkWidget::dropEvent(QDropEvent * event) {
|
void QtkWidget::dropEvent(QDropEvent * event) {
|
||||||
mConsole->sendLog(event->mimeData()->text());
|
mConsole->sendLog(event->mimeData()->text());
|
||||||
if(event->mimeData()->hasUrls()) {
|
|
||||||
auto urls = event->mimeData()->urls();
|
auto urls = event->mimeData()->urls();
|
||||||
|
if(!urls.isEmpty()) {
|
||||||
if(urls.size() > 1) {
|
if(urls.size() > 1) {
|
||||||
qDebug() << "Cannot accept drop of multiple files.";
|
qDebug() << "Cannot accept drop of multiple files.";
|
||||||
event->ignore();
|
event->ignore();
|
||||||
@@ -171,7 +169,7 @@ void QtkWidget::dropEvent(QDropEvent * event) {
|
|||||||
mScene->loadModel(url);
|
mScene->loadModel(url);
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Unsupported file type.";
|
qDebug() << "Unsupported file type: " + url.fileName() + "\n";
|
||||||
event->ignore();
|
event->ignore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ ToolBox::ToolBox(QWidget * parent) : QDockWidget(parent), ui(new Ui::ToolBox) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ToolBox::updateFocus(const QString & name) {
|
void ToolBox::updateFocus(const QString & name) {
|
||||||
qDebug() << "Called updateFocus on Toolbox.";
|
|
||||||
auto object =
|
auto object =
|
||||||
MainWindow::getMainWindow()->getQtkWidget()->getScene()->getObject(name);
|
MainWindow::getMainWindow()->getQtkWidget()->getScene()->getObject(name);
|
||||||
if(object != Q_NULLPTR) {
|
if(object != Q_NULLPTR) {
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ target_link_libraries(
|
|||||||
Qt6::Core Qt6::OpenGLWidgets Qt6::Widgets
|
Qt6::Core Qt6::OpenGLWidgets Qt6::Widgets
|
||||||
)
|
)
|
||||||
|
|
||||||
if(QTK_SUBMODULES OR NOT ASSIMP_NEW_INTERFACE)
|
if(QTK_SUBMODULES OR NOT QTK_ASSIMP_NEW_INTERFACE)
|
||||||
target_link_libraries(qtk_library PUBLIC assimp)
|
target_link_libraries(qtk_library PUBLIC assimp)
|
||||||
elseif(ASSIMP_NEW_INTERFACE)
|
elseif(QTK_ASSIMP_NEW_INTERFACE)
|
||||||
target_link_libraries(qtk_library PUBLIC assimp::assimp)
|
target_link_libraries(qtk_library PUBLIC assimp::assimp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void Model::flipTexture(const std::string & fileName, bool flipX, bool flipY) {
|
|||||||
texture.mTexture->destroy();
|
texture.mTexture->destroy();
|
||||||
texture.mTexture->create();
|
texture.mTexture->create();
|
||||||
texture.mTexture->setData(
|
texture.mTexture->setData(
|
||||||
*OpenGLTextureFactory::initImage(fullPath.c_str(), flipX, flipY));
|
OpenGLTextureFactory::initImage(fullPath.c_str(), flipX, flipY));
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,7 +238,7 @@ ModelMesh::Textures Model::loadMaterialTextures(
|
|||||||
// Add the texture to the textures container
|
// Add the texture to the textures container
|
||||||
textures.push_back(texture);
|
textures.push_back(texture);
|
||||||
// Add the texture to the loaded textures to avoid loading it twice
|
// Add the texture to the loaded textures to avoid loading it twice
|
||||||
mTexturesLoaded.push_back(texture);
|
mTexturesLoaded.push_back(textures.back());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ void ModelMesh::draw(QOpenGLShaderProgram & shader) {
|
|||||||
shader.setUniformValue((name + number).c_str(), i);
|
shader.setUniformValue((name + number).c_str(), i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always reset active texture to GL_TEXTURE0 before we draw.
|
||||||
|
// This is important for models with no textures.
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
// Draw the mesh
|
// Draw the mesh
|
||||||
glDrawElements(
|
glDrawElements(
|
||||||
GL_TRIANGLES, mIndices.size(), GL_UNSIGNED_INT, mIndices.data());
|
GL_TRIANGLES, mIndices.size(), GL_UNSIGNED_INT, mIndices.data());
|
||||||
@@ -62,7 +66,6 @@ void ModelMesh::draw(QOpenGLShaderProgram & shader) {
|
|||||||
}
|
}
|
||||||
shader.release();
|
shader.release();
|
||||||
mVAO->release();
|
mVAO->release();
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|||||||
@@ -30,6 +30,21 @@ namespace Qtk {
|
|||||||
* Struct to store model textures. 3D Models may have multiple.
|
* Struct to store model textures. 3D Models may have multiple.
|
||||||
*/
|
*/
|
||||||
struct QTKAPI ModelTexture {
|
struct QTKAPI ModelTexture {
|
||||||
|
ModelTexture() = default;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a ModelTexture.
|
||||||
|
*
|
||||||
|
* @param id Texture ID for this texture.
|
||||||
|
* @param type Type of texture in string format.
|
||||||
|
* @param path Path to the texture on disk.
|
||||||
|
*/
|
||||||
|
ModelTexture(const std::string & type, const std::string & path) :
|
||||||
|
mType(type), mPath(path) {
|
||||||
|
mTexture = OpenGLTextureFactory::initTexture(path.c_str());
|
||||||
|
mID = mTexture->textureId();
|
||||||
|
}
|
||||||
|
|
||||||
/** Texture ID for for this texture. */
|
/** Texture ID for for this texture. */
|
||||||
GLuint mID {};
|
GLuint mID {};
|
||||||
QOpenGLTexture * mTexture {};
|
QOpenGLTexture * mTexture {};
|
||||||
|
|||||||
@@ -17,17 +17,23 @@ using namespace Qtk;
|
|||||||
QtkIOStream::QtkIOStream(const char * pFile, const char * pMode) :
|
QtkIOStream::QtkIOStream(const char * pFile, const char * pMode) :
|
||||||
mFile(pFile) {
|
mFile(pFile) {
|
||||||
QString mode(pMode);
|
QString mode(pMode);
|
||||||
bool read = mode.contains('r');
|
bool open = false;
|
||||||
bool write = mode.contains('w');
|
if(mode == "w" || mode == "wb") {
|
||||||
if(read && write) {
|
open = mFile.open(QIODeviceBase::WriteOnly);
|
||||||
mFile.open(QIODevice::ReadWrite);
|
} else if(mode == "r" || mode == "rb") {
|
||||||
} else if(read) {
|
open = mFile.open(QIODeviceBase::ReadOnly);
|
||||||
mFile.open(QIODevice::ReadOnly);
|
} else if(mode == "wt") {
|
||||||
} else if(write) {
|
open = mFile.open(QIODeviceBase::WriteOnly | QIODeviceBase::Text);
|
||||||
mFile.open(QIODevice::WriteOnly);
|
} else if(mode == "rt") {
|
||||||
|
open = mFile.open(QIODeviceBase::ReadOnly | QIODeviceBase::Text);
|
||||||
} else {
|
} else {
|
||||||
|
open = false;
|
||||||
qDebug() << "[Qtk::QtkIOStream] Invalid file open mode: " << mode << "\n";
|
qDebug() << "[Qtk::QtkIOStream] Invalid file open mode: " << mode << "\n";
|
||||||
}
|
}
|
||||||
|
if(!open) {
|
||||||
|
qDebug() << "[Qtk::QtkIOStream] Could not open file: " << QString(pFile)
|
||||||
|
<< "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@@ -35,34 +41,24 @@ QtkIOStream::QtkIOStream(const char * pFile, const char * pMode) :
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
size_t QtkIOStream::Read(void * pvBuffer, size_t pSize, size_t pCount) {
|
size_t QtkIOStream::Read(void * pvBuffer, size_t pSize, size_t pCount) {
|
||||||
size_t read = 0;
|
qint64 readSize = mFile.read((char *)pvBuffer, pSize * pCount);
|
||||||
do {
|
|
||||||
auto readSize = mFile.read((char *)pvBuffer + read, pSize);
|
|
||||||
if(readSize < 0) {
|
if(readSize < 0) {
|
||||||
qDebug() << "[Qtk::QtkIOStream] Failed to read (" << pSize
|
qDebug() << "[Qtk::QtkIOStream] Failed to read (" << pSize
|
||||||
<< ") bytes from file at: " << mFile.filesystemFileName().c_str()
|
<< ") bytes from file at: " << mFile.filesystemFileName().c_str()
|
||||||
<< "\n";
|
<< "\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
read += readSize;
|
return readSize;
|
||||||
} while(pCount--);
|
|
||||||
return read;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t QtkIOStream::Write(const void * pvBuffer, size_t pSize, size_t pCount) {
|
size_t QtkIOStream::Write(const void * pvBuffer, size_t pSize, size_t pCount) {
|
||||||
size_t wrote = 0;
|
qint64 writeSize = mFile.write((char *)pvBuffer, pSize * pCount);
|
||||||
do {
|
|
||||||
auto writeSize = mFile.write((char *)pvBuffer + wrote, pSize);
|
|
||||||
if(writeSize < 0) {
|
if(writeSize < 0) {
|
||||||
qDebug() << "[Qtk::QtkIOStream] Failed to write buffer with size ("
|
qDebug() << "[Qtk::QtkIOStream] Failed to write buffer with size (" << pSize
|
||||||
<< pSize
|
<< ") to file at: " << mFile.filesystemFileName().c_str() << "\n";
|
||||||
<< ") to file at: " << mFile.filesystemFileName().c_str()
|
|
||||||
<< "\n";
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
wrote += writeSize;
|
return writeSize;
|
||||||
} while(pCount--);
|
|
||||||
return wrote;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aiReturn QtkIOStream::Seek(size_t pOffset, aiOrigin pOrigin) {
|
aiReturn QtkIOStream::Seek(size_t pOffset, aiOrigin pOrigin) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
##############################################################################*/
|
##############################################################################*/
|
||||||
|
|
||||||
#include "qtkiosystem.h"
|
#include "qtkiosystem.h"
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
using namespace Qtk;
|
using namespace Qtk;
|
||||||
|
|
||||||
@@ -19,15 +20,11 @@ bool QtkIOSystem::Exists(const char * pFile) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char QtkIOSystem::getOsSeparator() const {
|
char QtkIOSystem::getOsSeparator() const {
|
||||||
#ifndef _WIN32
|
return QDir::separator().toLatin1();
|
||||||
return '/';
|
|
||||||
#else
|
|
||||||
return '\\';
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Assimp::IOStream * QtkIOSystem::Open(const char * pFile, const char * pMode) {
|
Assimp::IOStream * QtkIOSystem::Open(const char * pFile, const char * pMode) {
|
||||||
if(!QFileInfo::exists(pFile)) {
|
if(!Exists(pFile)) {
|
||||||
qDebug() << "[Qtk::QtkIOSystem] failed to open file: " << pFile << "\n";
|
qDebug() << "[Qtk::QtkIOSystem] failed to open file: " << pFile << "\n";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <unordered_map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "camera3d.h"
|
#include "camera3d.h"
|
||||||
@@ -86,7 +87,7 @@ namespace Qtk {
|
|||||||
void loadModel(const std::string & name, const std::string & path) {
|
void loadModel(const std::string & name, const std::string & path) {
|
||||||
// Add the dropped model to the load queue.
|
// Add the dropped model to the load queue.
|
||||||
// This is consumed during rendering of the scene if not empty.
|
// This is consumed during rendering of the scene if not empty.
|
||||||
mModelLoadQueue.push({name, path});
|
mModelLoadQueue.emplace(name, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|||||||
@@ -9,19 +9,18 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
|
|
||||||
|
#include "app/qtkmainwindow.h"
|
||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
|
|
||||||
using namespace Qtk;
|
using namespace Qtk;
|
||||||
|
|
||||||
QImage * OpenGLTextureFactory::initImage(
|
QImage OpenGLTextureFactory::initImage(
|
||||||
const char * image, bool flipX, bool flipY) {
|
const char * image, bool flipX, bool flipY) {
|
||||||
// Qt6 limits loaded images to 256MB by default
|
// Qt6 limits loaded images to 256MB by default
|
||||||
QImageReader::setAllocationLimit(512);
|
QImageReader::setAllocationLimit(1024);
|
||||||
auto loadedImage = new QImage(QImage(image).mirrored(flipX, flipY));
|
auto loadedImage = QImage(image).mirrored(flipX, flipY);
|
||||||
if(loadedImage->isNull()) {
|
if(loadedImage.isNull()) {
|
||||||
qDebug() << "[Qtk::OpenGLTextureFactory] Error loading image: " << image
|
return defaultTexture();
|
||||||
<< "\nSupported types: " << QImageReader::supportedImageFormats();
|
|
||||||
return Q_NULLPTR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return loadedImage;
|
return loadedImage;
|
||||||
@@ -29,13 +28,12 @@ QImage * OpenGLTextureFactory::initImage(
|
|||||||
|
|
||||||
QOpenGLTexture * OpenGLTextureFactory::initTexture(
|
QOpenGLTexture * OpenGLTextureFactory::initTexture(
|
||||||
const char * texture, bool flipX, bool flipY) {
|
const char * texture, bool flipX, bool flipY) {
|
||||||
QImage * image = initImage(texture, flipX, flipY);
|
QImage image = initImage(texture, flipX, flipY);
|
||||||
auto newTexture = new QOpenGLTexture(QOpenGLTexture::Target2D);
|
auto newTexture = new QOpenGLTexture(QOpenGLTexture::Target2D);
|
||||||
newTexture->setData(*image);
|
newTexture->setData(image);
|
||||||
newTexture->setWrapMode(QOpenGLTexture::Repeat);
|
newTexture->setWrapMode(QOpenGLTexture::Repeat);
|
||||||
newTexture->setMinMagFilters(
|
newTexture->setMinMagFilters(
|
||||||
QOpenGLTexture::LinearMipMapLinear, QOpenGLTexture::Linear);
|
QOpenGLTexture::LinearMipMapLinear, QOpenGLTexture::Linear);
|
||||||
delete image;
|
|
||||||
return newTexture;
|
return newTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +69,7 @@ QOpenGLTexture * OpenGLTextureFactory::initCubeMap(
|
|||||||
QImage faceImage(faceTextures[i]);
|
QImage faceImage(faceTextures[i]);
|
||||||
if(faceImage.isNull()) {
|
if(faceImage.isNull()) {
|
||||||
qDebug() << "Error loading cube map image\n";
|
qDebug() << "Error loading cube map image\n";
|
||||||
|
faceImage = defaultTexture();
|
||||||
}
|
}
|
||||||
faceImage = faceImage.convertToFormat(QImage::Format_RGBA8888);
|
faceImage = faceImage.convertToFormat(QImage::Format_RGBA8888);
|
||||||
|
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ namespace Qtk {
|
|||||||
* Can be absolute or Qt resource path.
|
* Can be absolute or Qt resource path.
|
||||||
* @param flipX If true the image will be flipped on X axis.
|
* @param flipX If true the image will be flipped on X axis.
|
||||||
* @param flipY If true the image will be flipped on Y axis.
|
* @param flipY If true the image will be flipped on Y axis.
|
||||||
* @return Pointer to an initialized QImage object.
|
* @return QImage object.
|
||||||
*/
|
*/
|
||||||
static QImage * initImage(
|
static QImage initImage(
|
||||||
const char * image, bool flipX = false, bool flipY = false);
|
const char * image, bool flipX = false, bool flipY = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,6 +132,14 @@ namespace Qtk {
|
|||||||
const char * right, const char * top, const char * front,
|
const char * right, const char * top, const char * front,
|
||||||
const char * left, const char * bottom, const char * back);
|
const char * left, const char * bottom, const char * back);
|
||||||
|
|
||||||
|
/// The texture used in place of a missing texture.
|
||||||
|
static QImage defaultTexture() {
|
||||||
|
// Use plaster for default texture if image fails to load.
|
||||||
|
// This prevents segfaults when loading a texture that doesn't exist.
|
||||||
|
// TODO: Replace with a '?' texture to indicate missing texture.
|
||||||
|
return QImage(":/textures/plaster.png");
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Private ctor to prevent creating instances of this class
|
// Private ctor to prevent creating instances of this class
|
||||||
OpenGLTextureFactory() = default;
|
OpenGLTextureFactory() = default;
|
||||||
|
|||||||
Reference in New Issue
Block a user