summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2021-01-11 12:13:48 +0100
committerPaul Lemire <paul.lemire@kdab.com>2021-02-01 09:20:47 +0100
commit7821344a885d0d9b6fd800375b2866278f99d85f (patch)
treefb931dbf23346fbe78341806f5ed2922f7aec6be /src
parent53c3d955bafe75936dd281d479fca9746f5a8990 (diff)
Minor fixes to compile against 5.15
Change-Id: Id9574cf23b9af29815d8452915cebfc380fd94d1 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/core.pri2
-rw-r--r--src/input/frontend/qkeyevent.h1
-rw-r--r--src/plugins/renderers/opengl/textures/gltexture.cpp4
-rw-r--r--src/plugins/renderers/rhi/rhi.pro6
-rw-r--r--src/plugins/sceneparsers/assimp/assimpimporter.cpp13
-rw-r--r--src/render/materialsystem/qshaderprogram.cpp5
-rw-r--r--src/render/shadergraph/qshadergenerator.cpp4
7 files changed, 30 insertions, 5 deletions
diff --git a/src/core/core.pri b/src/core/core.pri
index 6cf431164..1ff71d3fe 100644
--- a/src/core/core.pri
+++ b/src/core/core.pri
@@ -9,7 +9,7 @@ HEADERS += \
$$PWD/qt3dcore_global_p.h \
$$PWD/qurlhelper_p.h \
$$PWD/qscene_p.h \
- $$PWD/qabstractfrontendnodemanager.h
+ $$PWD/qabstractfrontendnodemanager_p.h
SOURCES += \
$$PWD/qtickclock.cpp \
diff --git a/src/input/frontend/qkeyevent.h b/src/input/frontend/qkeyevent.h
index 52be3b213..acc213b1e 100644
--- a/src/input/frontend/qkeyevent.h
+++ b/src/input/frontend/qkeyevent.h
@@ -43,6 +43,7 @@
#include <Qt3DInput/qt3dinput_global.h>
#include <QtCore/QObject>
#include <QtGui/QKeyEvent>
+#include <memory>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/renderers/opengl/textures/gltexture.cpp b/src/plugins/renderers/opengl/textures/gltexture.cpp
index 5f8dee4b4..6fcd19784 100644
--- a/src/plugins/renderers/opengl/textures/gltexture.cpp
+++ b/src/plugins/renderers/opengl/textures/gltexture.cpp
@@ -692,7 +692,11 @@ void GLTexture::introspectPropertiesFromSharedTextureId()
if (ctxGLVersion.first > 4 || (ctxGLVersion.first == 4 && ctxGLVersion.second >= 5)) {
// Only for GL 4.5+
#ifdef GL_TEXTURE_TARGET
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QOpenGLFunctions_4_5_Core *gl5 = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_4_5_Core>();
+#else
+ QOpenGLFunctions_4_5_Core *gl5 = ctx->versionFunctions<QOpenGLFunctions_4_5_Core>();
+#endif
if (gl5 != nullptr)
gl5->glGetTextureParameteriv(m_sharedTextureId, GL_TEXTURE_TARGET, reinterpret_cast<int *>(&m_properties.target));
#endif
diff --git a/src/plugins/renderers/rhi/rhi.pro b/src/plugins/renderers/rhi/rhi.pro
index 786749a71..a767223f4 100644
--- a/src/plugins/renderers/rhi/rhi.pro
+++ b/src/plugins/renderers/rhi/rhi.pro
@@ -4,7 +4,11 @@ PLUGIN_TYPE = renderers
PLUGIN_CLASS_NAME = RhiRendererPlugin
load(qt_plugin)
-QT += core-private gui-private 3dcore 3dcore-private 3drender 3drender-private shadertools shadertools-private
+QT += core-private gui-private 3dcore 3dcore-private 3drender 3drender-private
+
+greaterThan(QT_MAJOR_VERSION, 5) {
+ QT += shadertools shadertools-private
+}
# Qt3D is free of Q_FOREACH - make sure it stays that way:
DEFINES += QT_NO_FOREACH
diff --git a/src/plugins/sceneparsers/assimp/assimpimporter.cpp b/src/plugins/sceneparsers/assimp/assimpimporter.cpp
index 90cd378ae..1a775d888 100644
--- a/src/plugins/sceneparsers/assimp/assimpimporter.cpp
+++ b/src/plugins/sceneparsers/assimp/assimpimporter.cpp
@@ -845,7 +845,12 @@ QGeometryRenderer *AssimpImporter::loadMesh(uint meshIndex)
Qt3DAnimation::QMorphingAnimation *morphingAnimation
= new Qt3DAnimation::QMorphingAnimation(geometryRenderer);
QList<QString> names;
+
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QList<Qt3DAnimation::QMorphTarget *> targets;
+#else
+ QVector<Qt3DAnimation::QMorphTarget *> targets;
+#endif
uint voff = 0;
uint noff = 0;
uint tanoff = 0;
@@ -1162,7 +1167,11 @@ void AssimpImporter::loadAnimation(uint animationIndex)
aiMesh *mesh = m_scene->m_aiScene->mMeshes[targetNode->mMeshes[0]];
Qt3DAnimation::QMorphingAnimation *morphingAnimation = new Qt3DAnimation::QMorphingAnimation;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QList<float> positions;
+#else
+ QVector<float> positions;
+#endif
positions.resize(morphAnim->mNumKeys);
// set so that weights array is allocated to correct size in morphingAnimation
morphingAnimation->setTargetPositions(positions);
@@ -1170,7 +1179,11 @@ void AssimpImporter::loadAnimation(uint animationIndex)
aiMeshMorphKey &key = morphAnim->mKeys[j];
positions[j] = key.mTime * tickScale;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QList<float> weights;
+#else
+ QVector<float> weights;
+#endif
weights.resize(key.mNumValuesAndWeights);
for (int k = 0; k < weights.size(); k++) {
const unsigned int value = key.mValues[k];
diff --git a/src/render/materialsystem/qshaderprogram.cpp b/src/render/materialsystem/qshaderprogram.cpp
index 87545f5e0..6e1f8ddb7 100644
--- a/src/render/materialsystem/qshaderprogram.cpp
+++ b/src/render/materialsystem/qshaderprogram.cpp
@@ -877,9 +877,12 @@ QByteArray QShaderProgramPrivate::resolveAutoBindingIndices(const QByteArray &co
do {
matchStart = shaderCode.indexOf(regexp, matchStart);
if (matchStart != -1) {
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const auto match = regexp.match(QStringView{shaderCode}.mid(matchStart));
+#else
+ const auto match = regexp.match(shaderCode.mid(matchStart));
+#endif
const auto length = match.capturedLength(0);
-
shaderCode.replace(matchStart, length, replacement.arg(variable++));
}
} while (matchStart != -1);
diff --git a/src/render/shadergraph/qshadergenerator.cpp b/src/render/shadergraph/qshadergenerator.cpp
index ec280e908..21478e3ee 100644
--- a/src/render/shadergraph/qshadergenerator.cpp
+++ b/src/render/shadergraph/qshadergenerator.cpp
@@ -571,7 +571,7 @@ QByteArray QShaderGenerator::createShaderCode(const QStringList &enabledLayers)
// just use vertexPosition directly.
// The added benefit is when having arrays, we don't try to create
// mat4 v38 = skinningPalelette[100] which would be invalid
- QList<Variable> temporaryVariables;
+ std::vector<Variable> temporaryVariables;
// Reserve more than enough space to ensure no reallocation will take place
temporaryVariables.reserve(nodes.size() * 8);
@@ -580,7 +580,7 @@ QByteArray QShaderGenerator::createShaderCode(const QStringList &enabledLayers)
auto createVariable = [&] () -> Variable * {
Q_ASSERT(temporaryVariables.capacity() > 0);
temporaryVariables.resize(temporaryVariables.size() + 1);
- return &temporaryVariables.last();
+ return &temporaryVariables.back();
};
auto findVariable = [&] (const QString &name) -> Variable * {