summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2019-01-08 08:17:32 +0200
committerKari Oikarinen <kari.oikarinen@qt.io>2019-01-08 08:17:33 +0200
commitd12aced2ea1673a51429a4f0c34b72c9a6a766ae (patch)
treef47c2ebed8a5cdcbdc1549ae012cf2f2a5ddda54
parentf8483f866267db71ef338ee1600074896c9534b3 (diff)
parent9d61881e4bcaebd6f98e647163f1df6b5082a6a8 (diff)
Merge 5.12 into 5.12.1
-rw-r--r--.qmake.conf2
-rw-r--r--dist/changes-5.11.320
-rw-r--r--src/core/transforms/qskeletonloader.cpp1
-rw-r--r--src/plugins/geometryloaders/configure.pri28
-rw-r--r--src/quick3d/imports/scene3d/importsscene3d.pro1
-rw-r--r--src/quick3d/imports/scene3d/scene3ditem.cpp14
-rw-r--r--src/render/framegraph/qrendercapture.cpp3
-rw-r--r--src/render/jobs/abstractpickingjob.cpp11
-rw-r--r--src/render/lights/qenvironmentlight.cpp50
-rw-r--r--src/render/lights/qenvironmentlight.h2
-rw-r--r--src/render/lights/qenvironmentlight_p.h3
-rw-r--r--src/render/renderers/opengl/renderer/renderer.cpp3
-rw-r--r--src/render/texture/qtexture.cpp8
-rw-r--r--src/render/texture/qtexturedata.cpp2
-rw-r--r--src/render/texture/qtextureimagedata.cpp2
-rw-r--r--src/render/texture/texture_p.h2
-rw-r--r--src/src.pro1
-rw-r--r--tests/auto/render/qenvironmentlight/tst_qenvironmentlight.cpp98
-rw-r--r--tests/auto/render/qrendercapture/tst_qrendercapture.cpp19
-rw-r--r--tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp2
-rw-r--r--tests/auto/render/renderer/tst_renderer.cpp2
-rw-r--r--tests/auto/render/texture/tst_texture.cpp23
-rw-r--r--tests/manual/picking-qml/main.qml26
-rw-r--r--tests/manual/texture_property_updates/main.qml2
24 files changed, 284 insertions, 41 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 0bd995808..6bb20f26c 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -3,4 +3,4 @@ QT3D_BUILD_ROOT = $$shadowed($$PWD)
load(qt_build_config)
-MODULE_VERSION = 5.12.0
+MODULE_VERSION = 5.12.1
diff --git a/dist/changes-5.11.3 b/dist/changes-5.11.3
new file mode 100644
index 000000000..f71fa3412
--- /dev/null
+++ b/dist/changes-5.11.3
@@ -0,0 +1,20 @@
+Qt 5.11.3 is a bug-fix release. It maintains both forward and backward
+compatibility (source and binary) with Qt 5.11.0 through 5.11.2.
+
+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.11 series is binary compatible with the 5.10.x series.
+Applications compiled for 5.10 will continue to run with 5.11.
+
+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.
+
+ - This release contains only minor code improvements.
diff --git a/src/core/transforms/qskeletonloader.cpp b/src/core/transforms/qskeletonloader.cpp
index a917252d9..d5296ecc9 100644
--- a/src/core/transforms/qskeletonloader.cpp
+++ b/src/core/transforms/qskeletonloader.cpp
@@ -124,6 +124,7 @@ void QSkeletonLoaderPrivate::setStatus(QSkeletonLoader::Status status)
\property Qt3DCore::QSkeletonLoader::createJointsEnabled
\brief A boolean to indicate whether createJoints is enabled or not.
+*/
/*!
Constructs a new QSkeletonLoader with \a parent.
*/
diff --git a/src/plugins/geometryloaders/configure.pri b/src/plugins/geometryloaders/configure.pri
index c49c1be51..1e104f57e 100644
--- a/src/plugins/geometryloaders/configure.pri
+++ b/src/plugins/geometryloaders/configure.pri
@@ -1,29 +1,19 @@
defineTest(qtConfLibrary_fbx) {
- libs = $$eval($${1}.libs)
- includedir =
-
- libs_override = $$getenv(FBXSDK_LIBS)
- !isEmpty(libs_override) {
- libs = $${libs_override}
- }
+ libdir =
prefix = $$getenv(FBXSDK)
-
- unix:isEmpty(prefix) {
- libs += "-L/usr/local/lib"
- libs += "-L/usr/lib"
- }
-
!isEmpty(prefix) {
- includedir += $${prefix}/include
- !win32:libs += -L$${prefix}/lib
+ !qtConfResolvePathIncs($${1}.includedir, $${prefix}/include, $$2): \
+ return(false)
+ !win32: libdir += $${prefix}/lib
}
- $${1}.libs = $$val_escape(libs)
- $${1}.includedir = $$val_escape(includedir)
+ libs = $$getenv(FBXSDK_LIBS)
+ isEmpty(libs): \
+ libs = $$eval($${1}.libs)
- export($${1}.libs)
- export($${1}.includedir)
+ !qtConfResolvePathLibs($${1}.libs, $$libdir, $$libs): \
+ return(false)
return(true)
}
diff --git a/src/quick3d/imports/scene3d/importsscene3d.pro b/src/quick3d/imports/scene3d/importsscene3d.pro
index cf8d7cacf..a8ad8f417 100644
--- a/src/quick3d/imports/scene3d/importsscene3d.pro
+++ b/src/quick3d/imports/scene3d/importsscene3d.pro
@@ -7,6 +7,7 @@ QT += qml quick 3dcore 3drender 3drender-private
qtConfig(qt3d-input): QT += 3dinput
qtConfig(qt3d-logic): QT += 3dlogic
+qtConfig(qt3d-animation): QT += 3danimation
# Qt3D is free of Q_FOREACH - make sure it stays that way:
DEFINES += QT_NO_FOREACH
diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp
index ddb25777c..ffb1d9112 100644
--- a/src/quick3d/imports/scene3d/scene3ditem.cpp
+++ b/src/quick3d/imports/scene3d/scene3ditem.cpp
@@ -52,6 +52,10 @@
#include <Qt3DLogic/qlogicaspect.h>
#endif
+#if QT_CONFIG(qt3d_animation)
+#include <Qt3DAnimation/qanimationaspect.h>
+#endif
+
#include <Qt3DRender/QRenderAspect>
#include <Qt3DRender/qcamera.h>
#include <Qt3DRender/qrendersurfaceselector.h>
@@ -169,7 +173,15 @@ void Scene3DItem::setAspects(const QStringList &aspects)
m_aspectEngine->registerAspect(new Qt3DLogic::QLogicAspect);
continue;
#else
- qFatal("Scene3D requested the Qt 3D input aspect but Qt 3D wasn't configured to build the Qt 3D Input aspect");
+ qFatal("Scene3D requested the Qt 3D logic aspect but Qt 3D wasn't configured to build the Qt 3D Logic aspect");
+#endif
+ }
+ if (aspect == QLatin1String("animation")) {
+#if QT_CONFIG(qt3d_animation)
+ m_aspectEngine->registerAspect(new Qt3DAnimation::QAnimationAspect);
+ continue;
+#else
+ qFatal("Scene3D requested the Qt 3D animation aspect but Qt 3D wasn't configured to build the Qt 3D Animation aspect");
#endif
}
m_aspectEngine->registerAspect(aspect);
diff --git a/src/render/framegraph/qrendercapture.cpp b/src/render/framegraph/qrendercapture.cpp
index d5b6d63ae..5bda569f9 100644
--- a/src/render/framegraph/qrendercapture.cpp
+++ b/src/render/framegraph/qrendercapture.cpp
@@ -252,9 +252,6 @@ QRenderCapturePrivate::QRenderCapturePrivate()
*/
QRenderCapturePrivate::~QRenderCapturePrivate()
{
- Q_Q(QRenderCapture);
- for (QRenderCaptureReply *reply : qAsConst(m_waitingReplies))
- reply->disconnect(q);
}
/*!
diff --git a/src/render/jobs/abstractpickingjob.cpp b/src/render/jobs/abstractpickingjob.cpp
index ccb190cff..74e6a7f80 100644
--- a/src/render/jobs/abstractpickingjob.cpp
+++ b/src/render/jobs/abstractpickingjob.cpp
@@ -122,15 +122,22 @@ RayCasting::QRay3D AbstractPickingJob::rayForViewportAndCamera(const PickingUtil
const QPoint &pos) const
{
static RayCasting::QRay3D invalidRay({}, {}, 0.f);
+
+ if (!vca.area.isValid())
+ return invalidRay;
+
Matrix4x4 viewMatrix;
Matrix4x4 projectionMatrix;
Render::CameraLens::viewMatrixForCamera(m_manager->renderNodesManager(),
vca.cameraId,
viewMatrix,
projectionMatrix);
+ // Returns viewport rect in GL coordinates (y inverted)
const QRect viewport = windowViewport(vca.area, vca.viewport);
+ // In GL the y is inverted compared to Qt
+ const QPoint glCorrectPos = QPoint(pos.x(), vca.area.height() - pos.y());
- if (vca.area.isValid() && !viewport.contains(pos))
+ if (!viewport.contains(glCorrectPos))
return invalidRay;
if (vca.surface) {
QSurface *surface = nullptr;
@@ -148,8 +155,6 @@ RayCasting::QRay3D AbstractPickingJob::rayForViewportAndCamera(const PickingUtil
return invalidRay;
}
- // In GL the y is inverted compared to Qt
- const QPoint glCorrectPos = QPoint(pos.x(), vca.area.isValid() ? vca.area.height() - pos.y() : pos.y());
const auto ray = intersectionRay(glCorrectPos, viewMatrix, projectionMatrix, viewport);
return ray;
}
diff --git a/src/render/lights/qenvironmentlight.cpp b/src/render/lights/qenvironmentlight.cpp
index a094af7b2..866905fb6 100644
--- a/src/render/lights/qenvironmentlight.cpp
+++ b/src/render/lights/qenvironmentlight.cpp
@@ -40,6 +40,7 @@
#include "qenvironmentlight.h"
#include "qenvironmentlight_p.h"
#include "qabstracttexture.h"
+#include <QVector3D>
QT_BEGIN_NAMESPACE
@@ -65,6 +66,23 @@ QEnvironmentLightPrivate::~QEnvironmentLightPrivate()
{
}
+void QEnvironmentLightPrivate::_q_updateEnvMapsSize()
+{
+ QVector3D irradianceSize;
+ if (m_irradiance != nullptr)
+ irradianceSize = QVector3D(m_irradiance->width(),
+ m_irradiance->height(),
+ m_irradiance->depth());
+ m_shaderData->setProperty("irradianceSize", QVariant::fromValue(irradianceSize));
+
+ QVector3D specularSize;
+ if (m_specular != nullptr)
+ specularSize = QVector3D(m_specular->width(),
+ m_specular->height(),
+ m_specular->depth());
+ m_shaderData->setProperty("specularSize", QVariant::fromValue(specularSize));
+}
+
Qt3DCore::QNodeCreatedChangeBasePtr QEnvironmentLight::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QEnvironmentLightData>::create(this);
@@ -148,17 +166,26 @@ void QEnvironmentLight::setIrradiance(QAbstractTexture *i)
if (irradiance() == i)
return;
- if (irradiance())
- d->unregisterDestructionHelper(irradiance());
+ if (irradiance()) {
+ d->unregisterDestructionHelper(d->m_irradiance);
+ QObject::disconnect(d->m_irradiance, SIGNAL(widthChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ QObject::disconnect(d->m_irradiance, SIGNAL(heightChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ QObject::disconnect(d->m_irradiance, SIGNAL(depthChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ }
if (i && !i->parent())
i->setParent(this);
d->m_irradiance = i;
d->m_shaderData->setProperty("irradiance", QVariant::fromValue(i));
+ d->_q_updateEnvMapsSize();
- if (i)
+ if (i) {
d->registerDestructionHelper(i, &QEnvironmentLight::setIrradiance, i);
+ QObject::connect(d->m_irradiance, SIGNAL(widthChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ QObject::connect(d->m_irradiance, SIGNAL(heightChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ QObject::connect(d->m_irradiance, SIGNAL(depthChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ }
emit irradianceChanged(i);
}
@@ -169,17 +196,26 @@ void QEnvironmentLight::setSpecular(QAbstractTexture *s)
if (specular() == s)
return;
- if (irradiance())
- d->unregisterDestructionHelper(specular());
+ if (specular()) {
+ d->unregisterDestructionHelper(d->m_specular);
+ QObject::disconnect(d->m_specular, SIGNAL(widthChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ QObject::disconnect(d->m_specular, SIGNAL(heightChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ QObject::disconnect(d->m_specular, SIGNAL(depthChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ }
if (s && !s->parent())
s->setParent(this);
d->m_specular = s;
d->m_shaderData->setProperty("specular", QVariant::fromValue(s));
+ d->_q_updateEnvMapsSize();
- if (s)
+ if (s) {
d->registerDestructionHelper(s, &QEnvironmentLight::setSpecular, s);
+ QObject::connect(d->m_specular, SIGNAL(widthChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ QObject::connect(d->m_specular, SIGNAL(heightChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ QObject::connect(d->m_specular, SIGNAL(depthChanged(int)), this, SLOT(_q_updateEnvMapsSize()));
+ }
emit specularChanged(s);
}
@@ -187,3 +223,5 @@ void QEnvironmentLight::setSpecular(QAbstractTexture *s)
} // namespace Qt3DRender
QT_END_NAMESPACE
+
+#include "moc_qenvironmentlight.cpp"
diff --git a/src/render/lights/qenvironmentlight.h b/src/render/lights/qenvironmentlight.h
index c3d180233..995768d3c 100644
--- a/src/render/lights/qenvironmentlight.h
+++ b/src/render/lights/qenvironmentlight.h
@@ -77,6 +77,8 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QEnvironmentLight)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override;
+
+ Q_PRIVATE_SLOT(d_func(), void _q_updateEnvMapsSize())
};
} // namespace Qt3DRender
diff --git a/src/render/lights/qenvironmentlight_p.h b/src/render/lights/qenvironmentlight_p.h
index 02358dafc..f4fa97b5a 100644
--- a/src/render/lights/qenvironmentlight_p.h
+++ b/src/render/lights/qenvironmentlight_p.h
@@ -72,6 +72,9 @@ public:
QShaderData *m_shaderData;
QAbstractTexture *m_irradiance;
QAbstractTexture *m_specular;
+
+private:
+ void _q_updateEnvMapsSize();
};
struct QEnvironmentLightData
diff --git a/src/render/renderers/opengl/renderer/renderer.cpp b/src/render/renderers/opengl/renderer/renderer.cpp
index a1781d1b0..7ed766f8b 100644
--- a/src/render/renderers/opengl/renderer/renderer.cpp
+++ b/src/render/renderers/opengl/renderer/renderer.cpp
@@ -1679,7 +1679,8 @@ QVector<Qt3DCore::QAspectJobPtr> Renderer::renderBinJobs()
renderBinJobs.push_back(m_updateShaderDataTransformJob);
}
- if (dirtyBitsForFrame & AbstractRenderer::GeometryDirty) {
+ if (dirtyBitsForFrame & AbstractRenderer::GeometryDirty ||
+ dirtyBitsForFrame & AbstractRenderer::BuffersDirty) {
renderBinJobs.push_back(m_calculateBoundingVolumeJob);
renderBinJobs.push_back(m_updateMeshTriangleListJob);
}
diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp
index f7ee3f6df..029e47817 100644
--- a/src/render/texture/qtexture.cpp
+++ b/src/render/texture/qtexture.cpp
@@ -317,6 +317,12 @@ const struct FourCCFormat
{ DdsFourCC<'D','X','T','5'>::value, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RGBA_DXT5, QOpenGLTexture::NoPixelType, 16, true } },
{ DdsFourCC<'A','T','I','1'>::value, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::R_ATI1N_UNorm, QOpenGLTexture::NoPixelType, 8, true } },
{ DdsFourCC<'A','T','I','2'>::value, { QOpenGLTexture::NoSourceFormat, QOpenGLTexture::RG_ATI2N_UNorm, QOpenGLTexture::NoPixelType, 16, true } },
+{ /* DXGI_FORMAT_R16_FLOAT */ 111, { QOpenGLTexture::Red, QOpenGLTexture::R16F, QOpenGLTexture::Float16, 2, false } },
+{ /* DXGI_FORMAT_R16_FLOAT */ 112, { QOpenGLTexture::RG, QOpenGLTexture::RG16F, QOpenGLTexture::Float16, 4, false } },
+{ /* DXGI_FORMAT_R16G16B16A16_FLOAT */113, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA16F, QOpenGLTexture::Float16, 8, false } },
+{ /* DXGI_FORMAT_R32_FLOAT */ 114, { QOpenGLTexture::Red, QOpenGLTexture::R32F, QOpenGLTexture::Float32, 4, false } },
+{ /* DXGI_FORMAT_R32G32_FLOAT */ 115, { QOpenGLTexture::RG, QOpenGLTexture::RG32F, QOpenGLTexture::Float32, 8, false } },
+{ /* DXGI_FORMAT_R32G32B32A32_FLOAT */116, { QOpenGLTexture::RGBA, QOpenGLTexture::RGBA32F, QOpenGLTexture::Float32, 16, false } }
};
const struct DX10Format
@@ -1413,7 +1419,7 @@ QTextureFromSourceGenerator::QTextureFromSourceGenerator(QTextureLoader *texture
, m_mirrored()
, m_texture(textureId)
, m_engine(engine)
- , m_format(QAbstractTexture::RGBA8_UNorm)
+ , m_format(QAbstractTexture::NoFormat)
{
Q_ASSERT(textureLoader);
diff --git a/src/render/texture/qtexturedata.cpp b/src/render/texture/qtexturedata.cpp
index b7bb75242..ac4ca80c0 100644
--- a/src/render/texture/qtexturedata.cpp
+++ b/src/render/texture/qtexturedata.cpp
@@ -57,7 +57,7 @@ class QTextureDataPrivate
{
public:
QAbstractTexture::Target m_target;
- QAbstractTexture::TextureFormat m_format;
+ QAbstractTexture::TextureFormat m_format = QAbstractTexture::NoFormat;
int m_width = 0;
int m_height = 0;
int m_depth = 0;
diff --git a/src/render/texture/qtextureimagedata.cpp b/src/render/texture/qtextureimagedata.cpp
index c31f272a8..bf43a6e16 100644
--- a/src/render/texture/qtextureimagedata.cpp
+++ b/src/render/texture/qtextureimagedata.cpp
@@ -55,7 +55,7 @@ QTextureImageDataPrivate::QTextureImageDataPrivate()
, m_mipLevels(-1)
, m_blockSize(-1)
, m_target(QOpenGLTexture::Target2D)
- , m_format(QOpenGLTexture::RGBA8_UNorm)
+ , m_format(QOpenGLTexture::NoFormat)
, m_pixelFormat(QOpenGLTexture::RGBA)
, m_pixelType(QOpenGLTexture::UInt8)
, m_isCompressed(false)
diff --git a/src/render/texture/texture_p.h b/src/render/texture/texture_p.h
index 9e385cefe..86c49f695 100644
--- a/src/render/texture/texture_p.h
+++ b/src/render/texture/texture_p.h
@@ -84,7 +84,7 @@ struct TextureProperties
int mipLevels = 1;
int samples = 1;
QAbstractTexture::Target target = QAbstractTexture::Target2D;
- QAbstractTexture::TextureFormat format = QAbstractTexture::RGBA8_UNorm;
+ QAbstractTexture::TextureFormat format = QAbstractTexture::NoFormat;
bool generateMipMaps = false;
QAbstractTexture::Status status = QAbstractTexture::None;
diff --git a/src/src.pro b/src/src.pro
index c3c8d6291..853ae8fb5 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -147,6 +147,7 @@ qtHaveModule(quick) {
src_quick3d_imports_scene2d
}
qtConfig(qt3d-logic): src_quick3d_imports_scene3d.depends += src_logic
+ qtConfig(qt3d-animation): src_quick3d_imports_scene3d.depends += src_animation
}
qtConfig(qt3d-animation) {
SUBDIRS += \
diff --git a/tests/auto/render/qenvironmentlight/tst_qenvironmentlight.cpp b/tests/auto/render/qenvironmentlight/tst_qenvironmentlight.cpp
index 76b3603c9..97375b647 100644
--- a/tests/auto/render/qenvironmentlight/tst_qenvironmentlight.cpp
+++ b/tests/auto/render/qenvironmentlight/tst_qenvironmentlight.cpp
@@ -170,6 +170,55 @@ private Q_SLOTS:
}
{
auto texture = new Qt3DRender::QTexture2D(&light);
+ QSignalSpy spy(&light, &Qt3DRender::QEnvironmentLight::irradianceChanged);
+
+ // WHEN
+ light.setIrradiance(texture);
+
+ // THEN
+ QCOMPARE(light.irradiance(), texture);
+ QCOMPARE(shaderData->property("irradiance").value<Qt3DRender::QAbstractTexture*>(), texture);
+ QCOMPARE(shaderData->property("irradianceSize").value<QVector3D>(),
+ QVector3D(texture->width(), texture->height(), texture->depth()));
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.takeFirst().first().value<Qt3DRender::QAbstractTexture*>(), texture);
+
+ // WHEN
+ texture->setWidth(883);
+
+ // THEN
+ QCOMPARE(shaderData->property("irradianceSize").value<QVector3D>(),
+ QVector3D(883.0f, texture->height(), texture->depth()));
+
+ // WHEN
+ texture->setHeight(1340);
+
+ // THEN
+ QCOMPARE(shaderData->property("irradianceSize").value<QVector3D>(),
+ QVector3D(883.0f, 1340.0f, texture->depth()));
+
+ // WHEN
+ texture->setDepth(1584);
+
+ // THEN
+ QCOMPARE(shaderData->property("irradianceSize").value<QVector3D>(),
+ QVector3D(883.0f, 1340.0f, 1584.0f));
+
+ // WHEN
+ delete texture;
+
+ // THEN
+ QCOMPARE(light.irradiance(), nullptr);
+ QCOMPARE(shaderData->property("irradiance").value<Qt3DRender::QAbstractTexture*>(), nullptr);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.takeFirst().first().value<Qt3DRender::QAbstractTexture*>(), nullptr);
+
+ // THEN
+ QCOMPARE(shaderData->property("irradianceSize").value<QVector3D>(),
+ QVector3D());
+ }
+ {
+ auto texture = new Qt3DRender::QTexture2D(&light);
QSignalSpy spy(&light, &Qt3DRender::QEnvironmentLight::specularChanged);
// WHEN
@@ -242,6 +291,55 @@ private Q_SLOTS:
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.takeFirst().first().value<Qt3DRender::QAbstractTexture*>(), nullptr);
}
+ {
+ auto texture = new Qt3DRender::QTexture2D(&light);
+ QSignalSpy spy(&light, &Qt3DRender::QEnvironmentLight::specularChanged);
+
+ // WHEN
+ light.setSpecular(texture);
+
+ // THEN
+ QCOMPARE(light.specular(), texture);
+ QCOMPARE(shaderData->property("specular").value<Qt3DRender::QAbstractTexture*>(), texture);
+ QCOMPARE(shaderData->property("specularSize").value<QVector3D>(),
+ QVector3D(texture->width(), texture->height(), texture->depth()));
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.takeFirst().first().value<Qt3DRender::QAbstractTexture*>(), texture);
+
+ // WHEN
+ texture->setWidth(883);
+
+ // THEN
+ QCOMPARE(shaderData->property("specularSize").value<QVector3D>(),
+ QVector3D(883.0f, texture->height(), texture->depth()));
+
+ // WHEN
+ texture->setHeight(1340);
+
+ // THEN
+ QCOMPARE(shaderData->property("specularSize").value<QVector3D>(),
+ QVector3D(883.0f, 1340.0f, texture->depth()));
+
+ // WHEN
+ texture->setDepth(1584);
+
+ // THEN
+ QCOMPARE(shaderData->property("specularSize").value<QVector3D>(),
+ QVector3D(883.0f, 1340.0f, 1584.0f));
+
+ // WHEN
+ delete texture;
+
+ // THEN
+ QCOMPARE(light.specular(), nullptr);
+ QCOMPARE(shaderData->property("specular").value<Qt3DRender::QAbstractTexture*>(), nullptr);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.takeFirst().first().value<Qt3DRender::QAbstractTexture*>(), nullptr);
+
+ // THEN
+ QCOMPARE(shaderData->property("specularSize").value<QVector3D>(),
+ QVector3D());
+ }
}
void checkCreationData()
diff --git a/tests/auto/render/qrendercapture/tst_qrendercapture.cpp b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp
index b2144d500..2fab1e837 100644
--- a/tests/auto/render/qrendercapture/tst_qrendercapture.cpp
+++ b/tests/auto/render/qrendercapture/tst_qrendercapture.cpp
@@ -34,6 +34,8 @@
#include <Qt3DRender/QRenderCapture>
#include <Qt3DRender/private/qrendercapture_p.h>
+#include <QPointer>
+
#include "testpostmanarbiter.h"
class MyRenderCapture : public Qt3DRender::QRenderCapture
@@ -129,6 +131,23 @@ private Q_SLOTS:
// THEN
renderCapture->sceneChangeEvent(e); // Should not reset
}
+
+ void crashOnRenderCaptureDeletion()
+ {
+ // GIVEN
+ QScopedPointer<Qt3DRender::QRenderCapture> renderCapture(new Qt3DRender::QRenderCapture());
+ QPointer<Qt3DRender::QRenderCaptureReply> renderCaptureReply(renderCapture->requestCapture());
+
+ // THEN
+ QVERIFY(renderCaptureReply);
+
+ // WHEN
+ renderCapture.reset();
+
+ // THEN (Should not crash and delete reply)
+ QVERIFY(!renderCaptureReply);
+ }
+
};
QTEST_MAIN(tst_QRenderCapture)
diff --git a/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp b/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
index dec816a5e..ba0c9a9bf 100644
--- a/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
+++ b/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
@@ -55,7 +55,7 @@ private Q_SLOTS:
QCOMPARE(tid->layers(), -1);
QCOMPARE(tid->mipLevels(), -1);
QCOMPARE(tid->target(), QOpenGLTexture::Target2D);
- QCOMPARE(tid->format(), QOpenGLTexture::RGBA8_UNorm);
+ QCOMPARE(tid->format(), QOpenGLTexture::NoFormat);
QCOMPARE(tid->pixelFormat(), QOpenGLTexture::RGBA);
QCOMPARE(tid->pixelType(), QOpenGLTexture::UInt8);
QCOMPARE(tid->isCompressed(), false);
diff --git a/tests/auto/render/renderer/tst_renderer.cpp b/tests/auto/render/renderer/tst_renderer.cpp
index 9f6007181..98bf6cc07 100644
--- a/tests/auto/render/renderer/tst_renderer.cpp
+++ b/tests/auto/render/renderer/tst_renderer.cpp
@@ -171,6 +171,8 @@ private Q_SLOTS:
1 + // sendBufferCaptureJob
1 + // VAOGatherer
1 + // updateSkinningPaletteJob
+ 1 + // CalculateBoundingVolumeJob
+ 1 + // UpdateMeshTriangleListJob
1); // BufferGathererJob
renderer.clearDirtyBits(Qt3DRender::Render::AbstractRenderer::AllDirty);
diff --git a/tests/auto/render/texture/tst_texture.cpp b/tests/auto/render/texture/tst_texture.cpp
index 9876518e2..d64533732 100644
--- a/tests/auto/render/texture/tst_texture.cpp
+++ b/tests/auto/render/texture/tst_texture.cpp
@@ -72,12 +72,35 @@ private:
void checkPropertyMirroring();
private slots:
+ void checkDefaults();
void checkFrontendPropertyNotifications();
void checkPropertyMirroring();
void checkPropertyChanges();
void checkTextureImageBookeeping();
};
+void tst_RenderTexture::checkDefaults()
+{
+ Qt3DRender::Render::Texture backend;
+
+ QCOMPARE(backend.properties().format, Qt3DRender::QAbstractTexture::NoFormat);
+ QCOMPARE(backend.properties().width, 1);
+ QCOMPARE(backend.properties().height, 1);
+ QCOMPARE(backend.properties().depth, 1);
+ QCOMPARE(backend.properties().layers, 1);
+ QCOMPARE(backend.properties().mipLevels, 1);
+ QCOMPARE(backend.properties().samples, 1);
+ QCOMPARE(backend.properties().generateMipMaps, false);
+ QCOMPARE(backend.parameters().magnificationFilter, Qt3DRender::QAbstractTexture::Nearest);
+ QCOMPARE(backend.parameters().minificationFilter, Qt3DRender::QAbstractTexture::Nearest);
+ QCOMPARE(backend.parameters().wrapModeX, Qt3DRender::QTextureWrapMode::ClampToEdge);
+ QCOMPARE(backend.parameters().wrapModeY, Qt3DRender::QTextureWrapMode::ClampToEdge);
+ QCOMPARE(backend.parameters().wrapModeZ, Qt3DRender::QTextureWrapMode::ClampToEdge);
+ QCOMPARE(backend.parameters().maximumAnisotropy, 1.0f);
+ QCOMPARE(backend.parameters().comparisonFunction, Qt3DRender::QAbstractTexture::CompareLessEqual);
+ QCOMPARE(backend.parameters().comparisonMode, Qt3DRender::QAbstractTexture::CompareNone);
+}
+
void tst_RenderTexture::checkFrontendPropertyNotifications()
{
// GIVEN
diff --git a/tests/manual/picking-qml/main.qml b/tests/manual/picking-qml/main.qml
index c020d5817..5ca50be0b 100644
--- a/tests/manual/picking-qml/main.qml
+++ b/tests/manual/picking-qml/main.qml
@@ -79,7 +79,19 @@ Entity {
id: camera2
projectionType: CameraLens.PerspectiveProjection
fieldOfView: 45
- aspectRatio: _view.width * 0.5 / _view.height
+ aspectRatio: _view.width * 0.5 / (_view.height * 0.5)
+ nearPlane : 0.1
+ farPlane : 1000.0
+ position: Qt.vector3d( 40.0, 5.0, -20.0 )
+ upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
+ viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
+ }
+
+ Camera {
+ id: camera3
+ projectionType: CameraLens.PerspectiveProjection
+ fieldOfView: 45
+ aspectRatio: _view.width * 0.5 / (_view.height * 0.5)
nearPlane : 0.1
farPlane : 1000.0
position: Qt.vector3d( 40.0, 5.0, -20.0 )
@@ -113,7 +125,7 @@ Entity {
}
Viewport {
- normalizedRect: Qt.rect(0.5, 0.0, 0.5, 1.0)
+ normalizedRect: Qt.rect(0.5, 0.0, 0.5, 0.5)
CameraSelector {
camera: camera2
LayerFilter {
@@ -122,6 +134,16 @@ Entity {
}
}
}
+ Viewport {
+ normalizedRect: Qt.rect(0.5, 0.5, 0.5, 0.5)
+ CameraSelector {
+ camera: camera3
+ LayerFilter {
+ // To show Debug volumes
+ layers: [sceneRoot.contentLayer, sceneRoot.debugLayer]
+ }
+ }
+ }
}
}
},
diff --git a/tests/manual/texture_property_updates/main.qml b/tests/manual/texture_property_updates/main.qml
index ebefdc725..f1256c75b 100644
--- a/tests/manual/texture_property_updates/main.qml
+++ b/tests/manual/texture_property_updates/main.qml
@@ -91,12 +91,14 @@ QQ2.Item {
}
readonly property Texture texture3: Texture2D {
+ format: Texture.RGBA8_UNorm
textureImages: TextureImage {
source: textureSource
}
}
readonly property Texture texture4: Texture2D {
+ format: Texture.RGBA8_UNorm
textureImages: TextureImage {
source: textureSource
}