diff options
64 files changed, 274 insertions, 331 deletions
diff --git a/dist/changes-5.9.1 b/dist/changes-5.9.1 new file mode 100644 index 000000000..1b0374765 --- /dev/null +++ b/dist/changes-5.9.1 @@ -0,0 +1,36 @@ +Qt 5.9.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.9.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.9 series is binary compatible with the 5.8.x series. +Applications compiled for 5.8 will continue to run with 5.9. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +Render +------ + +- Render states now honor the enabled property + +Animation +--------- + +- Fix support for animating a QColor +- Support for linear interpolation in clip json +- Fix animation inifinite looping + +Quick3D +------- + +- Fixed memory leak in Quick3DNodeInstantiatorPrivate [QTBUG-61293] +- Fix nested NodeInstantiator use case diff --git a/examples/qt3d/planets-qml/images/nasa/uranusringcolortrans.png b/examples/qt3d/planets-qml/images/nasa/uranusringcolortrans.png Binary files differindex b0953dec5..b0953dec5 100755..100644 --- a/examples/qt3d/planets-qml/images/nasa/uranusringcolortrans.png +++ b/examples/qt3d/planets-qml/images/nasa/uranusringcolortrans.png diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/earthcloudmapcolortrans.png b/examples/qt3d/planets-qml/images/solarsystemscope/earthcloudmapcolortrans.png Binary files differindex 1aabde94e..1aabde94e 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/earthcloudmapcolortrans.png +++ b/examples/qt3d/planets-qml/images/solarsystemscope/earthcloudmapcolortrans.png diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/earthcloudmapspec.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/earthcloudmapspec.jpg Binary files differindex 254b6fb6c..254b6fb6c 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/earthcloudmapspec.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/earthcloudmapspec.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/earthmap2k.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/earthmap2k.jpg Binary files differindex e90540c83..e90540c83 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/earthmap2k.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/earthmap2k.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/earthnormal2k.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/earthnormal2k.jpg Binary files differindex 8215226fb..8215226fb 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/earthnormal2k.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/earthnormal2k.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/earthspec2k.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/earthspec2k.jpg Binary files differindex 8e2b3f6c1..8e2b3f6c1 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/earthspec2k.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/earthspec2k.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/galaxy_starfield.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/galaxy_starfield.jpg Binary files differindex 2be906a73..2be906a73 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/galaxy_starfield.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/galaxy_starfield.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/jupitermap.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/jupitermap.jpg Binary files differindex f5af80197..f5af80197 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/jupitermap.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/jupitermap.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/marsmap2k.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/marsmap2k.jpg Binary files differindex ea77177fb..ea77177fb 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/marsmap2k.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/marsmap2k.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/marsnormal2k.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/marsnormal2k.jpg Binary files differindex 44a2e2f9b..44a2e2f9b 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/marsnormal2k.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/marsnormal2k.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/mercurymap.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/mercurymap.jpg Binary files differindex f69e947c0..f69e947c0 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/mercurymap.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/mercurymap.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/mercurynormal.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/mercurynormal.jpg Binary files differindex 5e77923bf..5e77923bf 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/mercurynormal.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/mercurynormal.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/moonmap2k.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/moonmap2k.jpg Binary files differindex 0e0c20d0a..0e0c20d0a 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/moonmap2k.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/moonmap2k.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/moonnormal2k.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/moonnormal2k.jpg Binary files differindex 10797cf0a..10797cf0a 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/moonnormal2k.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/moonnormal2k.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/neptunemap.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/neptunemap.jpg Binary files differindex 250fce966..250fce966 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/neptunemap.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/neptunemap.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/saturnmap.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/saturnmap.jpg Binary files differindex 981bb36c9..981bb36c9 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/saturnmap.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/saturnmap.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/saturnringcolortrans.png b/examples/qt3d/planets-qml/images/solarsystemscope/saturnringcolortrans.png Binary files differindex aefd9f6c4..aefd9f6c4 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/saturnringcolortrans.png +++ b/examples/qt3d/planets-qml/images/solarsystemscope/saturnringcolortrans.png diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/sunmap.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/sunmap.jpg Binary files differindex 46f2ce8c1..46f2ce8c1 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/sunmap.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/sunmap.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/uranusmap.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/uranusmap.jpg Binary files differindex 96cea14be..96cea14be 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/uranusmap.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/uranusmap.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/venusmap.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/venusmap.jpg Binary files differindex 93bed3e47..93bed3e47 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/venusmap.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/venusmap.jpg diff --git a/examples/qt3d/planets-qml/images/solarsystemscope/venusnormal.jpg b/examples/qt3d/planets-qml/images/solarsystemscope/venusnormal.jpg Binary files differindex 0fc5ff703..0fc5ff703 100755..100644 --- a/examples/qt3d/planets-qml/images/solarsystemscope/venusnormal.jpg +++ b/examples/qt3d/planets-qml/images/solarsystemscope/venusnormal.jpg diff --git a/src/animation/backend/fcurve.cpp b/src/animation/backend/fcurve.cpp index 4a2cf30fd..4db5d2169 100644 --- a/src/animation/backend/fcurve.cpp +++ b/src/animation/backend/fcurve.cpp @@ -61,6 +61,8 @@ float FCurve::evaluateAtTime(float localTime) const } else { // Find keyframes that sandwich the requested localTime const int idx = m_rangeFinder.findLowerBound(localTime); + if (idx < 0) // only one keyframe + return m_keyframes.first().value; const float t0 = m_localTimes[idx]; const float t1 = m_localTimes[idx + 1]; diff --git a/src/animation/backend/findrunningclipanimatorsjob.cpp b/src/animation/backend/findrunningclipanimatorsjob.cpp index 80739a02b..a8349eb91 100644 --- a/src/animation/backend/findrunningclipanimatorsjob.cpp +++ b/src/animation/backend/findrunningclipanimatorsjob.cpp @@ -64,6 +64,7 @@ void FindRunningClipAnimatorsJob::run() ClipAnimatorManager *clipAnimatorManager = m_handler->clipAnimatorManager(); for (const auto clipAnimatorHandle : qAsConst(m_clipAnimatorHandles)) { ClipAnimator *clipAnimator = clipAnimatorManager->data(clipAnimatorHandle); + Q_ASSERT(clipAnimator); const bool canRun = clipAnimator->canRun(); m_handler->setClipAnimatorRunning(clipAnimatorHandle, canRun); diff --git a/src/animation/backend/functionrangefinder.cpp b/src/animation/backend/functionrangefinder.cpp index 168b835ad..8c0e30f4a 100644 --- a/src/animation/backend/functionrangefinder.cpp +++ b/src/animation/backend/functionrangefinder.cpp @@ -51,11 +51,12 @@ namespace Animation { interpolate for example. */ -/*! +/* \internal - \fn findLowerBound - Finds the lower bound index of a range that encloses the requested value. + int findLowerBound (float x) + + Finds the lower bound index of a range that encloses the requested value \a x. We use a technique which tries to be better than a simple bisection. Often when performing interpolations, subsequent points are correlated with earlier calls. diff --git a/src/animation/backend/handler.cpp b/src/animation/backend/handler.cpp index 04c46b40a..33bc8c9f4 100644 --- a/src/animation/backend/handler.cpp +++ b/src/animation/backend/handler.cpp @@ -140,6 +140,29 @@ void Handler::setBlendedClipAnimatorRunning(const HBlendedClipAnimator &handle, } } +// The vectors may get outdated when the application removes/deletes an +// animator component in the meantime. Recognize this. This should be +// relatively infrequent so in most cases the vectors will not change at all. +void Handler::cleanupHandleList(QVector<HClipAnimator> *animators) +{ + for (auto it = animators->begin(); it != animators->end(); ) { + if (!m_clipAnimatorManager->data(*it)) + animators->erase(it); + else + ++it; + } +} + +void Handler::cleanupHandleList(QVector<HBlendedClipAnimator> *animators) +{ + for (auto it = animators->begin(); it != animators->end(); ) { + if (!m_blendedClipAnimatorManager->data(*it)) + animators->erase(it); + else + ++it; + } +} + QVector<Qt3DCore::QAspectJobPtr> Handler::jobsToExecute(qint64 time) { // Store the simulation time so we can mark the start time of @@ -164,6 +187,7 @@ QVector<Qt3DCore::QAspectJobPtr> Handler::jobsToExecute(qint64 time) if (!m_dirtyClipAnimators.isEmpty()) { qCDebug(HandlerLogic) << "Added FindRunningClipAnimatorsJob"; m_findRunningClipAnimatorsJob->removeDependency(QWeakPointer<Qt3DCore::QAspectJob>()); + cleanupHandleList(&m_dirtyClipAnimators); m_findRunningClipAnimatorsJob->setDirtyClipAnimators(m_dirtyClipAnimators); jobs.push_back(m_findRunningClipAnimatorsJob); if (jobs.contains(m_loadAnimationClipJob)) @@ -182,6 +206,7 @@ QVector<Qt3DCore::QAspectJobPtr> Handler::jobsToExecute(qint64 time) // If there are any running ClipAnimators, evaluate them for the current // time and send property changes + cleanupHandleList(&m_runningClipAnimators); if (!m_runningClipAnimators.isEmpty()) { qCDebug(HandlerLogic) << "Added EvaluateClipAnimatorJobs"; @@ -209,6 +234,7 @@ QVector<Qt3DCore::QAspectJobPtr> Handler::jobsToExecute(qint64 time) } // BlendClipAnimator execution + cleanupHandleList(&m_runningBlendedClipAnimators); if (!m_runningBlendedClipAnimators.isEmpty()) { // Ensure we have a job per clip animator const int oldSize = m_evaluateBlendClipAnimatorJobs.size(); diff --git a/src/animation/backend/handler_p.h b/src/animation/backend/handler_p.h index 52892f9d0..97adfdc13 100644 --- a/src/animation/backend/handler_p.h +++ b/src/animation/backend/handler_p.h @@ -116,6 +116,9 @@ public: QVector<Qt3DCore::QAspectJobPtr> jobsToExecute(qint64 time); + void cleanupHandleList(QVector<HClipAnimator> *animators); + void cleanupHandleList(QVector<HBlendedClipAnimator> *animators); + private: QScopedPointer<AnimationClipLoaderManager> m_animationClipLoaderManager; QScopedPointer<ClipAnimatorManager> m_clipAnimatorManager; diff --git a/src/animation/frontend/qabstractclipanimator.cpp b/src/animation/frontend/qabstractclipanimator.cpp index c75b92d47..9484aea44 100644 --- a/src/animation/frontend/qabstractclipanimator.cpp +++ b/src/animation/frontend/qabstractclipanimator.cpp @@ -119,15 +119,14 @@ QAbstractClipAnimator::~QAbstractClipAnimator() } /*! - \qmlproperty bool running + \qmlproperty bool QAbstractClipAnimator::running This property holds whether the animation is currently running. */ /*! - \property running - - This property holds whether the animation is currently running. + \property QAbstractClipAnimator::isRunning + Returns a boolean indicating whether the animation is currently running. */ bool QAbstractClipAnimator::isRunning() const { @@ -136,18 +135,12 @@ bool QAbstractClipAnimator::isRunning() const } /*! - \property ChannelMapper channelMapper + \property ChannelMapper QAbstractClipAnimator::channelMapper This property holds the ChannelMapper that controls how the channels in the animation clip map onto the properties of the target objects. */ -/*! - \property channelMapper - - This property holds the QChannelMapper that controls how the channels in - the animation clip map onto the properties of the target objects. -*/ QChannelMapper *QAbstractClipAnimator::channelMapper() const { Q_D(const QAbstractClipAnimator); @@ -155,7 +148,7 @@ QChannelMapper *QAbstractClipAnimator::channelMapper() const } /*! - \qmlproperty int loops + \qmlproperty int QAbstractClipAnimator::loops This property holds the number of times the animation should play. @@ -166,11 +159,11 @@ QChannelMapper *QAbstractClipAnimator::channelMapper() const */ /*! - \property loops + \property int QAbstractClipAnimator::loopCount This property holds the number of times the animation should play. - By default, loops is 1: the animation will play through once and then stop. + The value is 1 by default: the animation will play through once and then stop. If set to QAbstractClipAnimator::Infinite, the animation will continuously repeat until it is explicitly stopped. diff --git a/src/animation/frontend/qadditiveclipblend.cpp b/src/animation/frontend/qadditiveclipblend.cpp index 58ef5e577..5cbd75af6 100644 --- a/src/animation/frontend/qadditiveclipblend.cpp +++ b/src/animation/frontend/qadditiveclipblend.cpp @@ -167,14 +167,14 @@ float QAdditiveClipBlend::additiveFactor() const /*! \qmlproperty AbstractClipBlendNode baseClip - This property holds the base animation clip. When the additiveFacgtor is zero the baseClip will + This property holds the base animation clip. When the additiveFactor is zero the \a baseClip will also be the resulting clip of this blend node. */ /*! - \property baseClip + \property QAdditiveClipBlend::baseClip - This property holds the base animation clip. When the additiveFacgtor is zero the baseClip will - also be the resulting clip of this blend node. + This property holds the base animation clip. When the additiveFactor + is zero the baseClip will also be the resulting clip of this blend node. */ QAbstractClipBlendNode *QAdditiveClipBlend::baseClip() const { @@ -189,7 +189,7 @@ QAbstractClipBlendNode *QAdditiveClipBlend::baseClip() const is controlled by the additiveFactor property. */ /*! - \property additiveClip + \property QAdditiveClipBlend::additiveClip This property holds the additive clip to be blended with the baseClip. The amount of blending is controlled by the additiveFactor property. diff --git a/src/animation/frontend/qblendedclipanimator.cpp b/src/animation/frontend/qblendedclipanimator.cpp index e6b127bf1..90d82a69f 100644 --- a/src/animation/frontend/qblendedclipanimator.cpp +++ b/src/animation/frontend/qblendedclipanimator.cpp @@ -274,7 +274,7 @@ QBlendedClipAnimator::~QBlendedClipAnimator() */ /*! - \property blendTree + \property QBlendedClipAnimator::blendTree This property holds the root of the animation blend tree that will be evaluated before being interpolated by the animator. diff --git a/src/animation/frontend/qclipanimator.cpp b/src/animation/frontend/qclipanimator.cpp index da6534d16..3359a70ea 100644 --- a/src/animation/frontend/qclipanimator.cpp +++ b/src/animation/frontend/qclipanimator.cpp @@ -73,7 +73,7 @@ QClipAnimatorPrivate::QClipAnimatorPrivate() The properties for controlling the animator are provided by the AbstractClipAnimator base class. - \sa AbstractClipAnimator, AbstractAnimationClip, ChannelMapper, BlendedClipAnimator + \sa {Qt3DAnimation::QAbstractClipAnimator}{AbstractClipAnimator}, {Qt3DAnimation::QAbstractAnimationClip}{AbstractAnimationClip}, {Qt3DAnimation::QChannelMapper}{ChannelMapper}, {Qt3DAnimation::QBlendedClipAnimator}{BlendedClipAnimator} */ /*! @@ -123,7 +123,7 @@ QClipAnimator::~QClipAnimator() */ /*! - \property clip + \property QClipAnimator::clip This property holds the animation clip which contains the key frame data to be played back. The key frame data can be specified in either a QAnimationClip or QAnimationClipLoader. diff --git a/src/extras/shaders/gl3/distancefieldtext.frag b/src/extras/shaders/gl3/distancefieldtext.frag index 4f0c9cac0..c53f3df55 100644 --- a/src/extras/shaders/gl3/distancefieldtext.frag +++ b/src/extras/shaders/gl3/distancefieldtext.frag @@ -1,4 +1,4 @@ -#version 150 core +#version 130 uniform sampler2D distanceFieldTexture; uniform float minAlpha; @@ -6,8 +6,8 @@ uniform float maxAlpha; uniform float textureSize; uniform vec4 color; -in vec3 position; in vec2 texCoord; +in float zValue; out vec4 fragColor; @@ -35,4 +35,5 @@ void main() float distVal = texture(distanceFieldTexture, texCoord).r; fragColor = color * smoothstep(minAlpha, maxAlpha, distVal); + gl_FragDepth = gl_FragCoord.z - zValue * 0.00001; } diff --git a/src/extras/shaders/gl3/distancefieldtext.vert b/src/extras/shaders/gl3/distancefieldtext.vert index 9bd2a0a90..74a48f426 100644 --- a/src/extras/shaders/gl3/distancefieldtext.vert +++ b/src/extras/shaders/gl3/distancefieldtext.vert @@ -1,10 +1,10 @@ -#version 150 core +#version 130 in vec3 vertexPosition; in vec2 vertexTexCoord; -out vec3 position; out vec2 texCoord; +out float zValue; uniform mat4 modelView; uniform mat4 mvp; @@ -12,8 +12,8 @@ uniform mat4 mvp; void main() { texCoord = vertexTexCoord; - position = vec3(modelView * vec4(vertexPosition, 1.0)); + zValue = vertexPosition.z; - gl_Position = mvp * vec4(vertexPosition, 1.0); + gl_Position = mvp * vec4(vertexPosition.xy, 0.0, 1.0); } diff --git a/src/extras/shaders/gl3/skybox.frag b/src/extras/shaders/gl3/skybox.frag index 931e20343..d8d23990f 100644 --- a/src/extras/shaders/gl3/skybox.frag +++ b/src/extras/shaders/gl3/skybox.frag @@ -1,4 +1,4 @@ -#version 140 +#version 130 in vec3 texCoord0; out vec4 fragColor; diff --git a/src/extras/shaders/gl3/skybox.vert b/src/extras/shaders/gl3/skybox.vert index b5b0c0617..a92303aa8 100644 --- a/src/extras/shaders/gl3/skybox.vert +++ b/src/extras/shaders/gl3/skybox.vert @@ -1,4 +1,4 @@ -#version 140 +#version 130 in vec3 vertexPosition; out vec3 texCoord0; diff --git a/src/extras/text/qtext2dentity.cpp b/src/extras/text/qtext2dentity.cpp index dbd4368bc..1dfd171cd 100644 --- a/src/extras/text/qtext2dentity.cpp +++ b/src/extras/text/qtext2dentity.cpp @@ -209,10 +209,10 @@ void QText2DEntityPrivate::setCurrentGlyphRuns(const QVector<QGlyphRun> &runs) texCoords.setWidth(texCoords.width() * insideRatio); } - data.vertex << x1 << y1 << 0.f << texCoords.left() << texCoords.bottom(); - data.vertex << x1 << y2 << 0.f << texCoords.left() << texCoords.top(); - data.vertex << x2 << y1 << 0.f << texCoords.right() << texCoords.bottom(); - data.vertex << x2 << y2 << 0.f << texCoords.right() << texCoords.top(); + data.vertex << x1 << y1 << i << texCoords.left() << texCoords.bottom(); + data.vertex << x1 << y2 << i << texCoords.left() << texCoords.top(); + data.vertex << x2 << y1 << i << texCoords.right() << texCoords.bottom(); + data.vertex << x2 << y2 << i << texCoords.right() << texCoords.top(); data.index << data.vertexCount << data.vertexCount+3 << data.vertexCount+1; data.index << data.vertexCount << data.vertexCount+2 << data.vertexCount+3; diff --git a/src/extras/text/qtextureatlas.cpp b/src/extras/text/qtextureatlas.cpp index 2b82010a6..bc29537da 100644 --- a/src/extras/text/qtextureatlas.cpp +++ b/src/extras/text/qtextureatlas.cpp @@ -54,6 +54,7 @@ namespace Qt3DExtras { QTextureAtlasData::QTextureAtlasData(int w, int h, QImage::Format fmt) : m_image(w, h, fmt) { + m_image.fill(0); } QTextureAtlasData::~QTextureAtlasData() @@ -94,27 +95,25 @@ QByteArray QTextureAtlasData::createUpdatedImageData() // copy image contents into texture image // use image border pixels to fill the padding region for (int y = alloc.top(); y <= alloc.bottom(); y++) { - const int ySrc = qBound(0, y - imgRect.top(), image.height()-1); - - const uchar *srcLine = image.scanLine(ySrc); - const uchar *srcLastPx = &srcLine[bpp * (image.width()-1)]; - uchar *dstLine = m_image.scanLine(y); uchar *dstPadL = &dstLine[bpp * alloc.left()]; uchar *dstPadR = &dstLine[bpp * imgRect.right()]; uchar *dstImg = &dstLine[bpp * imgRect.left()]; - // copy left and right padding pixels - for (int pad = 0; pad < padding; pad++) { - for (int px = 0; px < bpp; px++) { - dstPadL[bpp * pad + px] = srcLine[px]; - dstPadR[bpp * pad + px] = srcLastPx[px]; - } + // do padding with 0 in the upper/lower padding parts around the actual image + if (y < imgRect.top() || y > imgRect.bottom()) { + memset(dstPadL, 0, bpp * (imgRect.width() + 2 * padding)); + continue; } + // copy left and right padding pixels + memset(dstPadL, 0, bpp * padding); + memset(dstPadR, 0, bpp * padding); + // copy image scanline - memcpy(dstImg, srcLine, bpp * imgRect.width()); + const int ySrc = qBound(0, y - imgRect.top(), image.height()-1); + memcpy(dstImg, image.scanLine(ySrc), bpp * imgRect.width()); } } diff --git a/src/quick3d/imports/scene3d/scene3drenderer.cpp b/src/quick3d/imports/scene3d/scene3drenderer.cpp index b32191391..26e966f76 100644 --- a/src/quick3d/imports/scene3d/scene3drenderer.cpp +++ b/src/quick3d/imports/scene3d/scene3drenderer.cpp @@ -255,6 +255,10 @@ void Scene3DRenderer::render() ContextSaver saver; + // The OpenGL state may be dirty from the previous QtQuick nodes, so reset + // it here to give Qt3D the clean state it expects + window->resetOpenGLState(); + const QSize boundingRectSize = m_item->boundingRect().size().toSize(); const QSize currentSize = boundingRectSize * window->effectiveDevicePixelRatio(); const bool sizeHasChanged = currentSize != m_lastSize; diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp index 73cdbb6da..16e548062 100644 --- a/src/render/backend/renderview.cpp +++ b/src/render/backend/renderview.cpp @@ -146,6 +146,13 @@ static QRectF resolveViewport(const QRectF &fractionalViewport, const QSize &sur fractionalViewport.height() * surfaceSize.height()); } +static QMatrix4x4 getProjectionMatrix(const CameraLens *lens) +{ + if (!lens) + qWarning() << "[Qt3D Renderer] No Camera Lens found. Add a CameraSelector to your Frame Graph or make sure that no entities will be rendered."; + return lens ? lens->projection() : QMatrix4x4(); +} + UniformValue RenderView::standardUniformValue(RenderView::StandardUniform standardUniformType, const QMatrix4x4 &model) const { switch (standardUniformType) { @@ -154,11 +161,11 @@ UniformValue RenderView::standardUniformValue(RenderView::StandardUniform standa case ViewMatrix: return UniformValue(m_data.m_viewMatrix); case ProjectionMatrix: - return UniformValue(m_data.m_renderCameraLens->projection()); + return UniformValue(getProjectionMatrix(m_data.m_renderCameraLens)); case ModelViewMatrix: return UniformValue(m_data.m_viewMatrix * model); case ViewProjectionMatrix: - return UniformValue(m_data.m_renderCameraLens->projection() * m_data.m_viewMatrix); + return UniformValue(getProjectionMatrix(m_data.m_renderCameraLens) * m_data.m_viewMatrix); case ModelViewProjectionMatrix: return UniformValue(m_data.m_viewProjectionMatrix * model); case InverseModelMatrix: @@ -166,15 +173,12 @@ UniformValue RenderView::standardUniformValue(RenderView::StandardUniform standa case InverseViewMatrix: return UniformValue(m_data.m_viewMatrix.inverted()); case InverseProjectionMatrix: { - QMatrix4x4 projection; - if (m_data.m_renderCameraLens) - projection = m_data.m_renderCameraLens->projection(); - return UniformValue(projection.inverted()); + return UniformValue(getProjectionMatrix(m_data.m_renderCameraLens).inverted()); } case InverseModelViewMatrix: return UniformValue((m_data.m_viewMatrix * model).inverted()); case InverseViewProjectionMatrix: { - const QMatrix4x4 viewProjectionMatrix = m_data.m_renderCameraLens->projection() * m_data.m_viewMatrix; + const QMatrix4x4 viewProjectionMatrix = getProjectionMatrix(m_data.m_renderCameraLens) * m_data.m_viewMatrix; return UniformValue(viewProjectionMatrix.inverted()); } case InverseModelViewProjectionMatrix: @@ -194,7 +198,7 @@ UniformValue RenderView::standardUniformValue(RenderView::StandardUniform standa return UniformValue(viewportMatrix.inverted()); } case Exposure: - return UniformValue(m_data.m_renderCameraLens->exposure()); + return UniformValue(m_data.m_renderCameraLens ? m_data.m_renderCameraLens->exposure() : 0.0f); case Gamma: return UniformValue(m_gamma); case Time: diff --git a/src/render/framegraph/qrendercapture.cpp b/src/render/framegraph/qrendercapture.cpp index ff0a5c739..66c518506 100644 --- a/src/render/framegraph/qrendercapture.cpp +++ b/src/render/framegraph/qrendercapture.cpp @@ -41,6 +41,7 @@ #include <Qt3DRender/qframegraphnodecreatedchange.h> #include <QPointer> +#include <QMutexLocker> QT_BEGIN_NAMESPACE @@ -240,8 +241,19 @@ QRenderCapturePrivate::QRenderCapturePrivate() /*! * \internal */ +QRenderCapturePrivate::~QRenderCapturePrivate() +{ + Q_Q(QRenderCapture); + for (QRenderCaptureReply *reply : m_waitingReplies) + reply->disconnect(q); +} + +/*! + * \internal + */ QRenderCaptureReply *QRenderCapturePrivate::createReply(int captureId) { + QMutexLocker lock(&m_mutex); QRenderCaptureReply *reply = new QRenderCaptureReply(); reply->d_func()->m_captureId = captureId; m_waitingReplies.push_back(reply); @@ -254,6 +266,7 @@ QRenderCaptureReply *QRenderCapturePrivate::createReply(int captureId) QRenderCaptureReply *QRenderCapturePrivate::takeReply(int captureId) { QRenderCaptureReply *reply = nullptr; + QMutexLocker lock(&m_mutex); for (int i = 0; i < m_waitingReplies.size(); ++i) { if (m_waitingReplies[i]->d_func()->m_captureId == captureId) { reply = m_waitingReplies[i]; @@ -274,6 +287,15 @@ void QRenderCapturePrivate::setImage(QRenderCaptureReply *reply, const QImage &i } /*! + * \internal + */ +void QRenderCapturePrivate::replyDestroyed(QRenderCaptureReply *reply) +{ + QMutexLocker lock(&m_mutex); + m_waitingReplies.removeAll(reply); +} + +/*! * The constructor creates an instance with the specified \a parent. */ QRenderCapture::QRenderCapture(Qt3DCore::QNode *parent) @@ -293,6 +315,10 @@ QRenderCaptureReply *QRenderCapture::requestCapture(int captureId, const QRect & { Q_D(QRenderCapture); QRenderCaptureReply *reply = d->createReply(captureId); + reply->setParent(this); + QObject::connect(reply, &QObject::destroyed, this, [&, reply, d] (QObject *) { + d->replyDestroyed(reply); + }); Qt3DCore::QPropertyUpdatedChangePtr change(new Qt3DCore::QPropertyUpdatedChange(id())); change->setPropertyName(QByteArrayLiteral("renderCaptureRequest")); @@ -314,6 +340,10 @@ QRenderCaptureReply *QRenderCapture::requestCapture(const QRect &rect) Q_D(QRenderCapture); static int captureId = 1; QRenderCaptureReply *reply = d->createReply(captureId); + reply->setParent(this); + QObject::connect(reply, &QObject::destroyed, this, [&, reply, d] (QObject *) { + d->replyDestroyed(reply); + }); Qt3DCore::QPropertyUpdatedChangePtr change(new Qt3DCore::QPropertyUpdatedChange(id())); change->setPropertyName(QByteArrayLiteral("renderCaptureRequest")); diff --git a/src/render/framegraph/qrendercapture_p.h b/src/render/framegraph/qrendercapture_p.h index 3b045ae3b..4e509cc59 100644 --- a/src/render/framegraph/qrendercapture_p.h +++ b/src/render/framegraph/qrendercapture_p.h @@ -51,6 +51,8 @@ #include <Qt3DRender/qrendercapture.h> #include <Qt3DRender/private/qframegraphnode_p.h> +#include <QtCore/qmutex.h> + QT_BEGIN_NAMESPACE namespace Qt3DRender { @@ -59,11 +61,14 @@ class QRenderCapturePrivate : public QFrameGraphNodePrivate { public: QRenderCapturePrivate(); + ~QRenderCapturePrivate(); QVector<QRenderCaptureReply *> m_waitingReplies; + QMutex m_mutex; QRenderCaptureReply *createReply(int captureId); QRenderCaptureReply *takeReply(int captureId); void setImage(QRenderCaptureReply *reply, const QImage &image); + void replyDestroyed(QRenderCaptureReply *reply); Q_DECLARE_PUBLIC(QRenderCapture) }; diff --git a/src/render/framegraph/rendercapture.cpp b/src/render/framegraph/rendercapture.cpp index 188f3dbe6..d25a01b1f 100644 --- a/src/render/framegraph/rendercapture.cpp +++ b/src/render/framegraph/rendercapture.cpp @@ -59,6 +59,7 @@ void RenderCapture::requestCapture(const QRenderCaptureRequest &request) // called by render view initializer job bool RenderCapture::wasCaptureRequested() const { + QMutexLocker lock(&m_mutex); return m_requestedCaptures.size() > 0 && isEnabled(); } diff --git a/src/render/framegraph/rendercapture_p.h b/src/render/framegraph/rendercapture_p.h index cf650b64d..8c9f4a31d 100644 --- a/src/render/framegraph/rendercapture_p.h +++ b/src/render/framegraph/rendercapture_p.h @@ -75,7 +75,7 @@ private: QVector<QRenderCaptureRequest> m_requestedCaptures; QVector<RenderCaptureDataPtr> m_renderCaptureData; - QMutex m_mutex; + mutable QMutex m_mutex; }; } // Render diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp index 0798d6a0c..582d22b63 100644 --- a/src/render/graphicshelpers/graphicscontext.cpp +++ b/src/render/graphicshelpers/graphicscontext.cpp @@ -1828,8 +1828,11 @@ QImage GraphicsContext::readFramebuffer(const QRect &rect) GLint samples = 0; m_gl->functions()->glGetIntegerv(GL_SAMPLES, &samples); - if (samples > 0 && !m_glHelper->supportsFeature(GraphicsHelperInterface::BlitFramebuffer)) + if (samples > 0 && !m_glHelper->supportsFeature(GraphicsHelperInterface::BlitFramebuffer)) { + qWarning () << Q_FUNC_INFO << "Unable to capture multisampled framebuffer; " + "Required feature BlitFramebuffer is missing."; return img; + } img = QImage(rect.width(), rect.height(), imageFormat); @@ -1850,6 +1853,7 @@ QImage GraphicsContext::readFramebuffer(const QRect &rect) if (status != GL_FRAMEBUFFER_COMPLETE) { gl->glDeleteRenderbuffers(1, &rb); gl->glDeleteFramebuffers(1, &fbo); + qWarning () << Q_FUNC_INFO << "Copy-framebuffer not complete: " << status; return img; } diff --git a/src/render/materialsystem/qparameter.cpp b/src/render/materialsystem/qparameter.cpp index 2ca7d176b..64c672737 100644 --- a/src/render/materialsystem/qparameter.cpp +++ b/src/render/materialsystem/qparameter.cpp @@ -88,7 +88,7 @@ \endcode When it comes to texture support, the Parameter value should be set to the - appropriate Texture subclass that matches the sampler type of the shader + appropriate \l {Qt3DRender::QAbstractTexture}{Texture} subclass that matches the sampler type of the shader uniform. \code diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp index a8feccb77..26dfe4d1d 100644 --- a/src/render/texture/qtexture.cpp +++ b/src/render/texture/qtexture.cpp @@ -703,7 +703,7 @@ QTextureImageDataPtr TextureLoadingHelper::loadTextureData(const QUrl &url, bool if (!f.open(QIODevice::ReadOnly)) qWarning() << "Failed to open" << source; else - textureData = loadTextureData(&f, QFileInfo(source).suffix(), allow3D, mirrored); + textureData = loadTextureData(&f, QFileInfo(source).suffix().toLower(), allow3D, mirrored); } return textureData; } diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp index 153e3d29d..ddde50fc3 100644 --- a/tests/auto/animation/animationutils/tst_animationutils.cpp +++ b/tests/auto/animation/animationutils/tst_animationutils.cpp @@ -1665,6 +1665,34 @@ private Q_SLOTS: suffixes.clear(); expectedResults.clear(); } + + // color with and without offset + { + channel = Channel(); + channel.name = QLatin1String("Color"); + channel.channelComponents.resize(3); + channel.channelComponents[0].name = QLatin1String("Color R"); + channel.channelComponents[1].name = QLatin1String("Color G"); + channel.channelComponents[2].name = QLatin1String("Color B"); + + dataType = static_cast<int>(QVariant::Color); + offset = 0; + suffixes = (QVector<char>() << 'R' << 'G' << 'B'); + expectedResults = (QVector<int>() << 0 << 1 << 2); + + QTest::newRow("QColor Color, offset = 0") + << channel << dataType << offset << suffixes << expectedResults; + + expectedResults.clear(); + + offset = 10; + expectedResults = (QVector<int>() << 10 << 11 << 12); + QTest::newRow("QColor Color, offset = 10") + << channel << dataType << offset << suffixes << expectedResults; + + suffixes.clear(); + expectedResults.clear(); + } } void checkChannelComponentsToIndicesHelper() @@ -1751,6 +1779,32 @@ private Q_SLOTS: expectedResults.clear(); } + + // QColor + { + channel = Channel(); + channel.name = QLatin1String("Color"); + channel.channelComponents.resize(3); + channel.channelComponents[0].name = QLatin1String("Color R"); + channel.channelComponents[1].name = QLatin1String("Color G"); + channel.channelComponents[2].name = QLatin1String("Color B"); + + dataType = static_cast<int>(QVariant::Color); + offset = 0; + expectedResults = (QVector<int>() << 0 << 1 << 2); + + QTest::newRow("QColor Color, offset = 0") + << channel << dataType << offset << expectedResults; + + expectedResults.clear(); + + offset = 10; + expectedResults = (QVector<int>() << 10 << 11 << 12); + QTest::newRow("QColor Color, offset = 10") + << channel << dataType << offset << expectedResults; + + expectedResults.clear(); + } } void checkChannelComponentsToIndices() diff --git a/tests/auto/render/qrendercapture/tst_qrendercapture.cpp b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp index 0c5184021..830615a95 100644 --- a/tests/auto/render/qrendercapture/tst_qrendercapture.cpp +++ b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp @@ -108,6 +108,27 @@ private Q_SLOTS: QCOMPARE(reply->image().height(), 20); QCOMPARE(reply->image().format(), QImage::Format_ARGB32); } + + void checkRenderCaptureDestroy() + { + // GIVEN + QScopedPointer<MyRenderCapture> renderCapture(new MyRenderCapture()); + QScopedPointer<Qt3DRender::QRenderCaptureReply> reply(renderCapture->requestCapture()); + QImage img = QImage(20, 20, QImage::Format_ARGB32); + Qt3DRender::RenderCaptureDataPtr data = Qt3DRender::RenderCaptureDataPtr::create(); + data.data()->captureId = 2; + data.data()->image = img; + auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(renderCapture->id()); + e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll); + e->setPropertyName("renderCaptureData"); + e->setValue(QVariant::fromValue(data)); + + // WHEN + reply.reset(); + + // THEN + renderCapture->sceneChangeEvent(e); // Should not reset + } }; QTEST_MAIN(tst_QRenderCapture) diff --git a/tests/manual/deferred-renderer-cpp/final_gl2.frag b/tests/manual/deferred-renderer-cpp/final_gl2.frag index a1309112a..f6cc9e957 100644 --- a/tests/manual/deferred-renderer-cpp/final_gl2.frag +++ b/tests/manual/deferred-renderer-cpp/final_gl2.frag @@ -32,7 +32,7 @@ void main() vec3 pos = texture2D(position, texCoord).xyz; vec3 norm = texture2D(normal, texCoord).xyz; - vec3 lightColor; + vec3 lightColor = vec3(0.0); vec3 s; for (int i = 0; i < lightCount; ++i) { diff --git a/tests/manual/deferred-renderer-cpp/final_gl3.frag b/tests/manual/deferred-renderer-cpp/final_gl3.frag index d760e9844..9dc8754e1 100644 --- a/tests/manual/deferred-renderer-cpp/final_gl3.frag +++ b/tests/manual/deferred-renderer-cpp/final_gl3.frag @@ -34,7 +34,7 @@ void main() vec3 pos = texture(position, texCoord).xyz; vec3 norm = texture(normal, texCoord).xyz; - vec3 lightColor; + vec3 lightColor = vec3(0.0); vec3 s; for (int i = 0; i < lightCount; ++i) { diff --git a/tests/manual/deferred-renderer-cpp/gbuffer.cpp b/tests/manual/deferred-renderer-cpp/gbuffer.cpp index 984dbb1f2..d2d6c2aab 100644 --- a/tests/manual/deferred-renderer-cpp/gbuffer.cpp +++ b/tests/manual/deferred-renderer-cpp/gbuffer.cpp @@ -55,8 +55,10 @@ GBuffer::GBuffer(Qt3DCore::QNode *parent) { const Qt3DRender::QAbstractTexture::TextureFormat formats[AttachmentsCount] = { Qt3DRender::QAbstractTexture::RGBA32F, - Qt3DRender::QAbstractTexture::RGB32F, - Qt3DRender::QAbstractTexture::RGB16F, + // We use RGBA32F for the following two instead of a more fitting format because + // OpenGL vendors might not support other formats + Qt3DRender::QAbstractTexture::RGBA32F, + Qt3DRender::QAbstractTexture::RGBA32F, Qt3DRender::QAbstractTexture::D32F }; diff --git a/tests/manual/deferred-renderer-cpp/geometry_gl3.frag b/tests/manual/deferred-renderer-cpp/geometry_gl3.frag index 7d9c7d64e..101d55c60 100644 --- a/tests/manual/deferred-renderer-cpp/geometry_gl3.frag +++ b/tests/manual/deferred-renderer-cpp/geometry_gl3.frag @@ -5,12 +5,12 @@ in vec3 position0; in vec3 normal0; out vec4 color; -out vec3 position; -out vec3 normal; +out vec4 position; +out vec4 normal; void main() { color = color0; - position = position0; - normal = normal0; + position = vec4(position0, 0.0); + normal = vec4(normal0, 0.0); } diff --git a/tests/manual/deferred-renderer-qml/GBuffer.qml b/tests/manual/deferred-renderer-qml/GBuffer.qml index bf43c66b5..dc2857f32 100644 --- a/tests/manual/deferred-renderer-qml/GBuffer.qml +++ b/tests/manual/deferred-renderer-qml/GBuffer.qml @@ -84,9 +84,9 @@ RenderTarget { id : positionAttachment width : 1024 height : 1024 - // This texture format may not be supported by - // some OpenGL vendors when used as a color attachment - format : Texture.RGB32F + // We use RGBA32F here instead of a more fitting format because + // OpenGL vendors might not support other formats + format : Texture.RGBA32F generateMipMaps : false magnificationFilter : Texture.Linear minificationFilter : Texture.Linear @@ -103,9 +103,9 @@ RenderTarget { id : normalAttachment width : 1024 height : 1024 - // This texture format may not be supported by - // some OpenGL vendors when used as a color attachment - format : Texture.RGB16F + // We use RGBA32F here instead of a more fitting format because + // OpenGL vendors might not support other formats + format : Texture.RGBA32F generateMipMaps : false magnificationFilter : Texture.Linear minificationFilter : Texture.Linear diff --git a/tests/manual/deferred-renderer-qml/SceneEffect.qml b/tests/manual/deferred-renderer-qml/SceneEffect.qml index 5dbfdae63..3ec1983fe 100644 --- a/tests/manual/deferred-renderer-qml/SceneEffect.qml +++ b/tests/manual/deferred-renderer-qml/SceneEffect.qml @@ -92,14 +92,14 @@ Effect { in vec3 normal0; out vec4 color; - out vec3 position; - out vec3 normal; + out vec4 position; + out vec4 normal; void main() { color = color0; - position = position0; - normal = normal0; + position = vec4(position0, 0.0); + normal = vec4(normal0, 0.0); } " } diff --git a/tests/manual/deferred-renderer-qml/final_es2.frag b/tests/manual/deferred-renderer-qml/final_es2.frag index a1309112a..f6cc9e957 100644 --- a/tests/manual/deferred-renderer-qml/final_es2.frag +++ b/tests/manual/deferred-renderer-qml/final_es2.frag @@ -32,7 +32,7 @@ void main() vec3 pos = texture2D(position, texCoord).xyz; vec3 norm = texture2D(normal, texCoord).xyz; - vec3 lightColor; + vec3 lightColor = vec3(0.0); vec3 s; for (int i = 0; i < lightCount; ++i) { diff --git a/tests/manual/deferred-renderer-qml/final_gl3.frag b/tests/manual/deferred-renderer-qml/final_gl3.frag index d760e9844..9dc8754e1 100644 --- a/tests/manual/deferred-renderer-qml/final_gl3.frag +++ b/tests/manual/deferred-renderer-qml/final_gl3.frag @@ -34,7 +34,7 @@ void main() vec3 pos = texture(position, texCoord).xyz; vec3 norm = texture(normal, texCoord).xyz; - vec3 lightColor; + vec3 lightColor = vec3(0.0); vec3 s; for (int i = 0; i < lightCount; ++i) { diff --git a/tests/manual/render-qml-to-texture-qml/PlaneMaterial.qml b/tests/manual/render-qml-to-texture-qml/PlaneMaterial.qml deleted file mode 100644 index 6c65de9b3..000000000 --- a/tests/manual/render-qml-to-texture-qml/PlaneMaterial.qml +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import Qt3D.Core 2.0 -import Qt3D.Render 2.0 - -Material { - - property Texture2D texture - property vector2d textureScale: Qt.vector2d(1,-1) - property vector2d textureBias: Qt.vector2d(0, 1) - - parameters: [ - Parameter { name: "surfaceTexture"; value: texture }, - Parameter { name: "texCoordScale"; value: textureScale }, - Parameter { name: "texCoordBias"; value: textureBias } - ] - - effect: Effect { - FilterKey { - id: forward - name: "renderingStyle" - value: "forward" - } - - ShaderProgram { - id: gl2Es2Shader - vertexShaderCode: loadSource("qrc:/shaders/es2/texturing.vert") - fragmentShaderCode: loadSource("qrc:/shaders/es2/texturing.frag") - } - - ShaderProgram { - id: gl3Shader - vertexShaderCode: loadSource("qrc:/shaders/gl3/texturing.vert") - fragmentShaderCode: loadSource("qrc:/shaders/gl3/texturing.frag") - } - techniques: [ - // OpenGL 3.1 - Technique { - filterKeys: [ forward ] - graphicsApiFilter { - api: GraphicsApiFilter.OpenGL - profile: GraphicsApiFilter.CoreProfile - majorVersion: 3 - minorVersion: 1 - } - - renderPasses: RenderPass { - shaderProgram: gl3Shader - } - }, - - // OpenGL 2.1 - Technique { - filterKeys: [ forward ] - graphicsApiFilter { - api: GraphicsApiFilter.OpenGL - profile: GraphicsApiFilter.NoProfile - majorVersion: 2 - minorVersion: 0 - } - - renderPasses: RenderPass { - shaderProgram: gl2Es2Shader - } - }, - - // OpenGL ES 2 - Technique { - filterKeys: [ forward ] - graphicsApiFilter { - api: GraphicsApiFilter.OpenGLES - profile: GraphicsApiFilter.NoProfile - majorVersion: 2 - minorVersion: 0 - } - renderPasses: RenderPass { - shaderProgram: gl2Es2Shader - } - } - ] - } -} diff --git a/tests/manual/render-qml-to-texture-qml/main.qml b/tests/manual/render-qml-to-texture-qml/main.qml index 65a0a8783..38a0259ee 100644 --- a/tests/manual/render-qml-to-texture-qml/main.qml +++ b/tests/manual/render-qml-to-texture-qml/main.qml @@ -41,7 +41,7 @@ import QtQuick 2.0 as QQ2 import QtQuick.Scene3D 2.0 import QtQuick.Scene2D 2.9 import QtQuick.Window 2.0 as QW2 -import Qt3D.Extras 2.0 +import Qt3D.Extras 2.9 QQ2.Item { @@ -120,6 +120,7 @@ QQ2.Item { id: planeMesh width: 4 height: 4 + mirrored: true } Entity { @@ -131,7 +132,7 @@ QQ2.Item { rotation: fromAxisAndAngle(Qt.vector3d(1,0,0), 90) } - property Material material: PlaneMaterial { + property Material material: TextureMaterial { texture: offscreenTexture } diff --git a/tests/manual/render-qml-to-texture-qml/render-qml-to-texture-qml.pro b/tests/manual/render-qml-to-texture-qml/render-qml-to-texture-qml.pro index 23729957c..ad2c3d7dc 100644 --- a/tests/manual/render-qml-to-texture-qml/render-qml-to-texture-qml.pro +++ b/tests/manual/render-qml-to-texture-qml/render-qml-to-texture-qml.pro @@ -2,10 +2,6 @@ error( "Couldn't find the manual.pri file!" ) } -!include ( ../render-qml-to-texture/render-qml-to-texture.pri ) { - error( "Couldn't find the render-qml-to-texture.pri file!") -} - QT += 3dextras 3dcore 3drender 3dinput 3dquick qml quick SOURCES += main.cpp diff --git a/tests/manual/render-qml-to-texture-qml/render-qml-to-texture-qml.qrc b/tests/manual/render-qml-to-texture-qml/render-qml-to-texture-qml.qrc index 51ec4790c..cf03e7842 100644 --- a/tests/manual/render-qml-to-texture-qml/render-qml-to-texture-qml.qrc +++ b/tests/manual/render-qml-to-texture-qml/render-qml-to-texture-qml.qrc @@ -1,7 +1,6 @@ <RCC> <qresource prefix="/"> <file>main.qml</file> - <file>PlaneMaterial.qml</file> <file>InteractiveGui.qml</file> </qresource> </RCC> diff --git a/tests/manual/video-texture-qml/PlaneMaterial.qml b/tests/manual/video-texture-qml/PlaneMaterial.qml deleted file mode 100644 index 6c65de9b3..000000000 --- a/tests/manual/video-texture-qml/PlaneMaterial.qml +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import Qt3D.Core 2.0 -import Qt3D.Render 2.0 - -Material { - - property Texture2D texture - property vector2d textureScale: Qt.vector2d(1,-1) - property vector2d textureBias: Qt.vector2d(0, 1) - - parameters: [ - Parameter { name: "surfaceTexture"; value: texture }, - Parameter { name: "texCoordScale"; value: textureScale }, - Parameter { name: "texCoordBias"; value: textureBias } - ] - - effect: Effect { - FilterKey { - id: forward - name: "renderingStyle" - value: "forward" - } - - ShaderProgram { - id: gl2Es2Shader - vertexShaderCode: loadSource("qrc:/shaders/es2/texturing.vert") - fragmentShaderCode: loadSource("qrc:/shaders/es2/texturing.frag") - } - - ShaderProgram { - id: gl3Shader - vertexShaderCode: loadSource("qrc:/shaders/gl3/texturing.vert") - fragmentShaderCode: loadSource("qrc:/shaders/gl3/texturing.frag") - } - techniques: [ - // OpenGL 3.1 - Technique { - filterKeys: [ forward ] - graphicsApiFilter { - api: GraphicsApiFilter.OpenGL - profile: GraphicsApiFilter.CoreProfile - majorVersion: 3 - minorVersion: 1 - } - - renderPasses: RenderPass { - shaderProgram: gl3Shader - } - }, - - // OpenGL 2.1 - Technique { - filterKeys: [ forward ] - graphicsApiFilter { - api: GraphicsApiFilter.OpenGL - profile: GraphicsApiFilter.NoProfile - majorVersion: 2 - minorVersion: 0 - } - - renderPasses: RenderPass { - shaderProgram: gl2Es2Shader - } - }, - - // OpenGL ES 2 - Technique { - filterKeys: [ forward ] - graphicsApiFilter { - api: GraphicsApiFilter.OpenGLES - profile: GraphicsApiFilter.NoProfile - majorVersion: 2 - minorVersion: 0 - } - renderPasses: RenderPass { - shaderProgram: gl2Es2Shader - } - } - ] - } -} diff --git a/tests/manual/video-texture-qml/main.qml b/tests/manual/video-texture-qml/main.qml index 6a8dff3d5..93110ef2a 100644 --- a/tests/manual/video-texture-qml/main.qml +++ b/tests/manual/video-texture-qml/main.qml @@ -40,7 +40,7 @@ import Qt3D.Input 2.0 import QtQuick 2.2 as QQ2 import QtQuick.Scene2D 2.9 import QtQuick.Window 2.0 as QW2 -import Qt3D.Extras 2.0 +import Qt3D.Extras 2.9 import QtMultimedia 5.6 as QMM import QtQuick.Dialogs 1.0 @@ -121,7 +121,7 @@ Entity { translation: Qt.vector3d(0,0,0) } - property Material material: PlaneMaterial { + property Material material: TextureMaterial { texture: offscreenTexture } diff --git a/tests/manual/video-texture-qml/video-texture-qml.pro b/tests/manual/video-texture-qml/video-texture-qml.pro index 713ef8cfe..44da325aa 100644 --- a/tests/manual/video-texture-qml/video-texture-qml.pro +++ b/tests/manual/video-texture-qml/video-texture-qml.pro @@ -2,10 +2,6 @@ error( "Couldn't find the manual.pri file!" ) } -!include ( ../render-qml-to-texture/render-qml-to-texture.pri ) { - error( "Couldn't find the render-qml-to-texture.pri file!") -} - QT += 3dquickextras 3dcore 3drender 3dinput 3dquick qml quick 3dquickrender SOURCES += main.cpp @@ -16,6 +12,5 @@ RESOURCES += \ OTHER_FILES += \ main.qml -DISTFILES += \ - PlaneMaterial.qml +DISTFILES += diff --git a/tests/manual/video-texture-qml/video-texture-qml.qrc b/tests/manual/video-texture-qml/video-texture-qml.qrc index 6b2a1aef6..5f6483ac3 100644 --- a/tests/manual/video-texture-qml/video-texture-qml.qrc +++ b/tests/manual/video-texture-qml/video-texture-qml.qrc @@ -1,6 +1,5 @@ <RCC> <qresource prefix="/"> <file>main.qml</file> - <file>PlaneMaterial.qml</file> </qresource> </RCC> |