summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/animation/backend/animationclip_p.h2
-rw-r--r--src/animation/backend/animationutils.cpp2
-rw-r--r--src/animation/backend/buildblendtreesjob.cpp2
-rw-r--r--src/animation/backend/fcurve_p.h2
-rw-r--r--src/animation/frontend/qanimationcontroller.cpp4
-rw-r--r--src/animation/frontend/qanimationgroup.cpp2
-rw-r--r--src/animation/frontend/qkeyframeanimation.cpp2
-rw-r--r--src/animation/frontend/qmorphinganimation.cpp2
-rw-r--r--src/animation/frontend/qmorphtarget.cpp4
-rw-r--r--src/animation/frontend/qvertexblendanimation.cpp6
-rw-r--r--src/core/aspects/qaspectengine.cpp2
-rw-r--r--src/core/nodes/qbackendnode.cpp2
-rw-r--r--src/core/nodes/qnode.cpp18
-rw-r--r--src/core/qscene.cpp8
-rw-r--r--src/core/services/qabstractframeadvanceservice_p.h1
-rw-r--r--src/core/services/qeventfilterservice_p.h1
-rw-r--r--src/core/services/qopenglinformationservice_p.h1
-rw-r--r--src/core/services/qsysteminformationservice_p.h1
-rw-r--r--src/core/services/qtickclockservice_p.h1
-rw-r--r--src/doc/qt3d.qdocconf11
-rw-r--r--src/extras/defaults/qskyboxentity.cpp2
-rw-r--r--src/extras/geometries/qplanegeometry.cpp47
-rw-r--r--src/extras/geometries/qplanegeometry.h4
-rw-r--r--src/extras/geometries/qplanegeometry_p.h1
-rw-r--r--src/extras/geometries/qplanemesh.cpp24
-rw-r--r--src/extras/geometries/qplanemesh.h4
-rw-r--r--src/extras/shaders/es2/light.inc.frag310
-rw-r--r--src/extras/shaders/gl3/metalrough.frag112
-rw-r--r--src/extras/shaders/gl3/metalroughuniform.frag123
-rw-r--r--src/plugins/geometryloaders/default/objgeometryloader.cpp2
-rw-r--r--src/plugins/sceneparsers/assimp/assimpimporter.cpp6
-rw-r--r--src/plugins/sceneparsers/gltf/gltfimporter.cpp6
-rw-r--r--src/plugins/sceneparsers/gltfexport/gltfexporter.cpp46
-rw-r--r--src/quick3d/imports/animation/plugins.qmltypes670
-rw-r--r--src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp3
-rw-r--r--src/quick3d/imports/core/plugins.qmltypes82
-rw-r--r--src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp5
-rw-r--r--src/quick3d/imports/core/qt3dquick3dcoreplugin.h1
-rw-r--r--src/quick3d/imports/extras/plugins.qmltypes394
-rw-r--r--src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp2
-rw-r--r--src/quick3d/imports/input/plugins.qmltypes86
-rw-r--r--src/quick3d/imports/logic/plugins.qmltypes27
-rw-r--r--src/quick3d/imports/render/plugins.qmltypes438
-rw-r--r--src/quick3d/imports/scene3d/scene3ditem.cpp2
-rw-r--r--src/quick3d/imports/scene3d/scene3ditem_p.h2
-rw-r--r--src/quick3d/imports/scene3d/scene3drenderer.cpp18
-rw-r--r--src/quick3d/quick3d/qt3dquick_global.cpp7
-rw-r--r--src/quick3d/quick3d/qt3dquick_global_p.h1
-rw-r--r--src/quick3d/quick3danimation/items/items.pri6
-rw-r--r--src/quick3d/quick3danimation/items/quick3dvertexblendanimation.cpp104
-rw-r--r--src/quick3d/quick3danimation/items/quick3dvertexblendanimation_p.h93
-rw-r--r--src/quick3d/quick3dscene2d/items/qscene2d.cpp203
-rw-r--r--src/quick3d/quick3dscene2d/items/qscene2d.h22
-rw-r--r--src/quick3d/quick3dscene2d/items/qscene2d_p.h7
-rw-r--r--src/quick3d/quick3dscene2d/items/scene2d.cpp108
-rw-r--r--src/quick3d/quick3dscene2d/items/scene2d_p.h2
-rw-r--r--src/quick3d/quick3dscene2d/items/scene2dmanager.cpp141
-rw-r--r--src/quick3d/quick3dscene2d/items/scene2dmanager_p.h15
-rw-r--r--src/render/backend/platformsurfacefilter.cpp4
-rw-r--r--src/render/backend/renderviewbuilder.cpp28
-rw-r--r--src/render/framegraph/rendercapture.cpp2
-rw-r--r--src/render/framegraph/viewportnode.cpp2
-rw-r--r--src/render/frontend/qabstractfunctor.h8
-rw-r--r--src/render/frontend/qlevelofdetail.cpp2
-rw-r--r--src/render/frontend/qrenderaspect.cpp4
-rw-r--r--src/render/geometry/attribute.cpp2
-rw-r--r--src/render/geometry/buffer.cpp2
-rw-r--r--src/render/geometry/geometryrenderer.cpp2
-rw-r--r--src/render/raycasting/qabstractcollisionqueryservice_p.h1
-rw-r--r--src/render/texture/gltexture.cpp2
70 files changed, 2385 insertions, 874 deletions
diff --git a/src/animation/backend/animationclip_p.h b/src/animation/backend/animationclip_p.h
index 286ec38c0..7ff79c01a 100644
--- a/src/animation/backend/animationclip_p.h
+++ b/src/animation/backend/animationclip_p.h
@@ -127,7 +127,7 @@ inline QDebug operator<<(QDebug dbg, const AnimationClip &animationClip)
<< "Channels:" << endl;
const QVector<Channel> channels = animationClip.channels();
- for (const auto channel : channels) {
+ for (const auto &channel : channels) {
dbg << channel;
}
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp
index c9c7c29d4..1f675f271 100644
--- a/src/animation/backend/animationutils.cpp
+++ b/src/animation/backend/animationutils.cpp
@@ -197,7 +197,7 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime)
const QVector<Channel> &channels = clip->channels();
int i = 0;
for (const Channel &channel : channels) {
- for (const auto channelComponent : qAsConst(channel.channelComponents))
+ for (const auto &channelComponent : qAsConst(channel.channelComponents))
channelResults[i++] = channelComponent.fcurve.evaluateAtTime(localTime);
}
return channelResults;
diff --git a/src/animation/backend/buildblendtreesjob.cpp b/src/animation/backend/buildblendtreesjob.cpp
index ac95808bc..fe56099a2 100644
--- a/src/animation/backend/buildblendtreesjob.cpp
+++ b/src/animation/backend/buildblendtreesjob.cpp
@@ -63,7 +63,7 @@ void BuildBlendTreesJob::setBlendedClipAnimators(const QVector<HBlendedClipAnima
// We assume that the structure of blend node tree does not change once a BlendClipAnimator has been set to running
void BuildBlendTreesJob::run()
{
- for (const HBlendedClipAnimator blendedClipAnimatorHandle : m_blendedClipAnimatorHandles) {
+ for (const HBlendedClipAnimator blendedClipAnimatorHandle : qAsConst(m_blendedClipAnimatorHandles)) {
// Retrieve BlendTree node
BlendedClipAnimator *blendClipAnimator = m_handler->blendedClipAnimatorManager()->data(blendedClipAnimatorHandle);
Q_ASSERT(blendClipAnimator);
diff --git a/src/animation/backend/fcurve_p.h b/src/animation/backend/fcurve_p.h
index 7bc6ccccb..7ab1593d1 100644
--- a/src/animation/backend/fcurve_p.h
+++ b/src/animation/backend/fcurve_p.h
@@ -146,7 +146,7 @@ inline QDebug operator<<(QDebug dbg, const Channel &channel)
dbg << "Channel Name: " << channel.name << endl
<< "Channels:" << channel.channelComponents.size() << endl;
- for (const auto channelComponent : qAsConst(channel.channelComponents)) {
+ for (const auto &channelComponent : qAsConst(channel.channelComponents)) {
dbg << channelComponent;
}
return dbg;
diff --git a/src/animation/frontend/qanimationcontroller.cpp b/src/animation/frontend/qanimationcontroller.cpp
index 5df2c713a..d4c3c4005 100644
--- a/src/animation/frontend/qanimationcontroller.cpp
+++ b/src/animation/frontend/qanimationcontroller.cpp
@@ -182,7 +182,7 @@ float QAnimationControllerPrivate::scaledPosition(float position) const
QAnimationGroup *QAnimationControllerPrivate::findGroup(const QString &name)
{
- for (QAnimationGroup *g : m_animationGroups) {
+ for (QAnimationGroup *g : qAsConst(m_animationGroups)) {
if (g->name() == name)
return g;
}
@@ -211,7 +211,7 @@ void QAnimationControllerPrivate::extractAnimations()
}
void QAnimationControllerPrivate::clearAnimations()
{
- for (Qt3DAnimation::QAnimationGroup *a : m_animationGroups)
+ for (Qt3DAnimation::QAnimationGroup *a : qAsConst(m_animationGroups))
a->deleteLater();
m_animationGroups.clear();
m_activeAnimationGroup = 0;
diff --git a/src/animation/frontend/qanimationgroup.cpp b/src/animation/frontend/qanimationgroup.cpp
index 07d0fadc5..365745662 100644
--- a/src/animation/frontend/qanimationgroup.cpp
+++ b/src/animation/frontend/qanimationgroup.cpp
@@ -109,7 +109,7 @@ QAnimationGroupPrivate::QAnimationGroupPrivate()
void QAnimationGroupPrivate::updatePosition(float position)
{
m_position = position;
- for (QAbstractAnimation *aa : m_animations)
+ for (QAbstractAnimation *aa : qAsConst(m_animations))
aa->setPosition(position);
}
diff --git a/src/animation/frontend/qkeyframeanimation.cpp b/src/animation/frontend/qkeyframeanimation.cpp
index 19069a8ed..597b34cee 100644
--- a/src/animation/frontend/qkeyframeanimation.cpp
+++ b/src/animation/frontend/qkeyframeanimation.cpp
@@ -190,7 +190,7 @@ void QKeyframeAnimation::setFramePositions(const QVector<float> &positions)
d->m_minposition = d->m_framePositions.first();
d->m_maxposition = d->m_framePositions.last();
float lastPos = d->m_minposition;
- for (float p : d->m_framePositions) {
+ for (float p : qAsConst(d->m_framePositions)) {
if (p < lastPos || p > d->m_maxposition)
qWarning() << "positions not ordered correctly";
lastPos = p;
diff --git a/src/animation/frontend/qmorphinganimation.cpp b/src/animation/frontend/qmorphinganimation.cpp
index e8f440c45..3824b8d64 100644
--- a/src/animation/frontend/qmorphinganimation.cpp
+++ b/src/animation/frontend/qmorphinganimation.cpp
@@ -179,7 +179,7 @@ QMorphingAnimationPrivate::QMorphingAnimationPrivate()
QMorphingAnimationPrivate::~QMorphingAnimationPrivate()
{
- for (QVector<float> *weights : m_weights)
+ for (QVector<float> *weights : qAsConst(m_weights))
delete weights;
}
diff --git a/src/animation/frontend/qmorphtarget.cpp b/src/animation/frontend/qmorphtarget.cpp
index e16dd8698..9dc30b8ba 100644
--- a/src/animation/frontend/qmorphtarget.cpp
+++ b/src/animation/frontend/qmorphtarget.cpp
@@ -99,7 +99,7 @@ QMorphTargetPrivate::QMorphTargetPrivate()
void QMorphTargetPrivate::updateAttributeNames()
{
m_attributeNames.clear();
- for (const Qt3DRender::QAttribute *attr : m_targetAttributes)
+ for (const Qt3DRender::QAttribute *attr : qAsConst(m_targetAttributes))
m_attributeNames.push_back(attr->name());
}
@@ -148,7 +148,7 @@ void QMorphTarget::setAttributes(const QVector<Qt3DRender::QAttribute *> &attrib
void QMorphTarget::addAttribute(Qt3DRender::QAttribute *attribute)
{
Q_D(QMorphTarget);
- for (const Qt3DRender::QAttribute *attr : d->m_targetAttributes) {
+ for (const Qt3DRender::QAttribute *attr : qAsConst(d->m_targetAttributes)) {
if (attr->name() == attribute->name())
return;
}
diff --git a/src/animation/frontend/qvertexblendanimation.cpp b/src/animation/frontend/qvertexblendanimation.cpp
index efc36e45c..3ddd83bf0 100644
--- a/src/animation/frontend/qvertexblendanimation.cpp
+++ b/src/animation/frontend/qvertexblendanimation.cpp
@@ -125,7 +125,7 @@ namespace Qt3DAnimation {
\readonly
*/
/*!
- \qmlproperty VertexBlendAnimation::target
+ \qmlproperty GeometryRenderer VertexBlendAnimation::target
Holds the target GeometryRenderer the morphing animation is applied to.
*/
/*!
@@ -135,6 +135,10 @@ namespace Qt3DAnimation {
is usually same as the name of the parent entity of the target GeometryRenderer, but
does not have to be.
*/
+/*!
+ \qmlproperty list<MorphTarget> VertexBlendAnimation::morphTargets
+ Holds the list of \l {MorphTarget}{morph targets} added to the animation.
+*/
QVertexBlendAnimationPrivate::QVertexBlendAnimationPrivate()
: QAbstractAnimationPrivate(QAbstractAnimation::VertexBlendAnimation)
diff --git a/src/core/aspects/qaspectengine.cpp b/src/core/aspects/qaspectengine.cpp
index a3fda90b0..b9c9d2283 100644
--- a/src/core/aspects/qaspectengine.cpp
+++ b/src/core/aspects/qaspectengine.cpp
@@ -103,8 +103,8 @@ QAspectEnginePrivate::~QAspectEnginePrivate()
*/
void QAspectEnginePrivate::initNode(QNode *node)
{
- QNodePrivate::get(node)->setScene(m_scene);
m_scene->addObservable(node);
+ QNodePrivate::get(node)->setScene(m_scene);
}
void QAspectEnginePrivate::initEntity(QEntity *entity)
diff --git a/src/core/nodes/qbackendnode.cpp b/src/core/nodes/qbackendnode.cpp
index e3963b202..dc751cb93 100644
--- a/src/core/nodes/qbackendnode.cpp
+++ b/src/core/nodes/qbackendnode.cpp
@@ -233,7 +233,7 @@ void QBackendNode::sceneChangeEvent(const QSceneChangePtr &e)
switch (e->type()) {
case PropertyUpdated: {
if (propertyChange->propertyName() == QByteArrayLiteral("enabled"))
- d->m_enabled = propertyChange->value().value<bool>();
+ d->m_enabled = propertyChange->value().toBool();
break;
}
default:
diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp
index 42c8887ce..ce5e76a55 100644
--- a/src/core/nodes/qnode.cpp
+++ b/src/core/nodes/qnode.cpp
@@ -114,7 +114,7 @@ void QNodePrivate::notifyCreationChange()
Q_Q(QNode);
// Do nothing if we already have already sent a node creation change
// and not a subsequent node destroyed change.
- if (m_hasBackendNode)
+ if (m_hasBackendNode || !m_scene)
return;
QNodeCreatedChangeGenerator generator(q);
const auto creationChanges = generator.creationChanges();
@@ -305,7 +305,21 @@ void QNodePrivate::_q_setParentHelper(QNode *parent)
visitor.traverse(q, newParentNode->d_func(), &QNodePrivate::setSceneHelper);
}
- notifyCreationChange();
+ // We want to make sure that subTreeRoot is always created before
+ // child.
+ // Given a case such as below
+ // QEntity *subTreeRoot = new QEntity(someGlobalExisitingRoot)
+ // QEntity *child = new QEntity();
+ // child->setParent(subTreeRoot)
+ // We need to take into account that subTreeRoot needs to be
+ // created in the backend before the child.
+ // Therefore we only call notifyCreationChanges if the parent
+ // hasn't been created yet as we know that when the parent will be
+ // fully created, it will also send the changes for all of its
+ // children
+
+ if (QNodePrivate::get(newParentNode)->m_hasBackendNode)
+ notifyCreationChange();
}
// If we have a valid new parent, we let him know that we are its child
diff --git a/src/core/qscene.cpp b/src/core/qscene.cpp
index 33841574e..043b3f11b 100644
--- a/src/core/qscene.cpp
+++ b/src/core/qscene.cpp
@@ -222,7 +222,13 @@ bool QScene::hasEntityForComponent(QNodeId componentUuid, QNodeId entityUuid)
{
Q_D(QScene);
QReadLocker lock(&d->m_lock);
- return d->m_componentToEntities.values(componentUuid).contains(entityUuid);
+ auto it = d->m_componentToEntities.find(componentUuid);
+ while (it != d->m_componentToEntities.end() && it.key() == componentUuid) {
+ if (it.value() == entityUuid)
+ return true;
+ ++it;
+ }
+ return false;
}
QScene::NodePropertyTrackData QScene::lookupNodePropertyTrackData(QNodeId id) const
diff --git a/src/core/services/qabstractframeadvanceservice_p.h b/src/core/services/qabstractframeadvanceservice_p.h
index a5f635710..dac72a98d 100644
--- a/src/core/services/qabstractframeadvanceservice_p.h
+++ b/src/core/services/qabstractframeadvanceservice_p.h
@@ -64,6 +64,7 @@ class QAbstractFrameAdvanceServicePrivate;
class QT3DCORESHARED_EXPORT QAbstractFrameAdvanceService : public QAbstractServiceProvider
{
+ Q_OBJECT
public:
virtual qint64 waitForNextFrame() = 0;
virtual void start() = 0;
diff --git a/src/core/services/qeventfilterservice_p.h b/src/core/services/qeventfilterservice_p.h
index 5f779c9cd..58b87d9cc 100644
--- a/src/core/services/qeventfilterservice_p.h
+++ b/src/core/services/qeventfilterservice_p.h
@@ -63,6 +63,7 @@ class QEventFilterServicePrivate;
class QT3DCORESHARED_EXPORT QEventFilterService : public QAbstractServiceProvider
{
+ Q_OBJECT
public:
QEventFilterService();
~QEventFilterService();
diff --git a/src/core/services/qopenglinformationservice_p.h b/src/core/services/qopenglinformationservice_p.h
index c84c5ed10..2adf73307 100644
--- a/src/core/services/qopenglinformationservice_p.h
+++ b/src/core/services/qopenglinformationservice_p.h
@@ -65,6 +65,7 @@ class QOpenGLInformationServicePrivate;
class QT3DCORESHARED_EXPORT QOpenGLInformationService : public QAbstractServiceProvider
{
+ Q_OBJECT
public:
virtual QSurfaceFormat format() const = 0;
diff --git a/src/core/services/qsysteminformationservice_p.h b/src/core/services/qsysteminformationservice_p.h
index 0ab737817..01e976b77 100644
--- a/src/core/services/qsysteminformationservice_p.h
+++ b/src/core/services/qsysteminformationservice_p.h
@@ -64,6 +64,7 @@ class QSystemInformationServicePrivate;
class QT3DCORESHARED_EXPORT QSystemInformationService : public QAbstractServiceProvider
{
+ Q_OBJECT
public:
virtual QStringList aspectNames() const = 0;
virtual int threadPoolThreadCount() const = 0;
diff --git a/src/core/services/qtickclockservice_p.h b/src/core/services/qtickclockservice_p.h
index 53f3cf310..6f02643f4 100644
--- a/src/core/services/qtickclockservice_p.h
+++ b/src/core/services/qtickclockservice_p.h
@@ -61,6 +61,7 @@ class QTickClockServicePrivate;
class QTickClockService : public QAbstractFrameAdvanceService
{
+ Q_OBJECT
public:
QTickClockService();
~QTickClockService();
diff --git a/src/doc/qt3d.qdocconf b/src/doc/qt3d.qdocconf
index 8c1508fa4..7da047ced 100644
--- a/src/doc/qt3d.qdocconf
+++ b/src/doc/qt3d.qdocconf
@@ -80,7 +80,10 @@ imagedirs += images \
../../examples/qt3d/basicshapes-cpp/doc/images \
../../examples/qt3d/planets-qml/doc/images \
../../examples/qt3d/wireframe/doc/images \
- ../../examples/qt3d/audio-visualizer-qml/doc/images
+ ../../examples/qt3d/audio-visualizer-qml/doc/images \
+ ../../examples/qt3d/simplecustommaterial/doc/images \
+ ../../examples/qt3d/scene2d/doc/images \
+ ../../examples/qt3d/advancedcustommaterial/doc/images
Cpp.ignoretokens += QT3DINPUTSHARED_EXPORT \
QT3DCORESHARED_EXPORT \
@@ -95,8 +98,10 @@ Cpp.ignoretokens += QT3DINPUTSHARED_EXPORT \
Cpp.ignoredirectives += Q_DECLARE_LOGGING_CATEGORY
-manifestmeta.highlighted.names = "Qt3D/Qt 3D: Audio Visualizer Example" \
- "Qt3D/Qt 3D: Planets QML Example"
+manifestmeta.highlighted.names = \
+ "Qt3D/Qt 3D: Advanced custom material QML Example" \
+ "Qt3D/Qt 3D: Audio Visualizer Example" \
+ "Qt3D/Qt 3D: Planets QML Example"
manifestmeta.thumbnail.names += "Qt3D/Qt 3D: Deferred Renderer C++ Example"
diff --git a/src/extras/defaults/qskyboxentity.cpp b/src/extras/defaults/qskyboxentity.cpp
index ae3fa1087..3c7b0dd4e 100644
--- a/src/extras/defaults/qskyboxentity.cpp
+++ b/src/extras/defaults/qskyboxentity.cpp
@@ -138,10 +138,8 @@ void QSkyboxEntityPrivate::init()
m_gl3RenderPass->addRenderState(seamlessCubemap);
m_gl2RenderPass->addRenderState(cullFront);
m_gl2RenderPass->addRenderState(depthTest);
- m_gl2RenderPass->addRenderState(seamlessCubemap);
m_es2RenderPass->addRenderState(cullFront);
m_es2RenderPass->addRenderState(depthTest);
- m_es2RenderPass->addRenderState(seamlessCubemap);
m_gl3Technique->addRenderPass(m_gl3RenderPass);
m_gl2Technique->addRenderPass(m_gl2RenderPass);
diff --git a/src/extras/geometries/qplanegeometry.cpp b/src/extras/geometries/qplanegeometry.cpp
index f6eba9e61..14ddb25e6 100644
--- a/src/extras/geometries/qplanegeometry.cpp
+++ b/src/extras/geometries/qplanegeometry.cpp
@@ -54,7 +54,7 @@ namespace Qt3DExtras {
namespace {
-QByteArray createPlaneVertexData(float w, float h, const QSize &resolution)
+QByteArray createPlaneVertexData(float w, float h, const QSize &resolution, bool mirrored)
{
Q_ASSERT(w > 0.0f);
Q_ASSERT(h > 0.0f);
@@ -95,7 +95,7 @@ QByteArray createPlaneVertexData(float w, float h, const QSize &resolution)
// texture coordinates
*fptr++ = u;
- *fptr++ = v;
+ *fptr++ = mirrored ? 1.0f - v : v;
// normal
*fptr++ = 0.0f;
@@ -149,17 +149,18 @@ QByteArray createPlaneIndexData(const QSize &resolution)
class PlaneVertexBufferFunctor : public QBufferDataGenerator
{
public:
- explicit PlaneVertexBufferFunctor(float w, float h, const QSize &resolution)
+ explicit PlaneVertexBufferFunctor(float w, float h, const QSize &resolution, bool mirrored)
: m_width(w)
, m_height(h)
, m_resolution(resolution)
+ , m_mirrored(mirrored)
{}
~PlaneVertexBufferFunctor() {}
QByteArray operator()() Q_DECL_FINAL
{
- return createPlaneVertexData(m_width, m_height, m_resolution);
+ return createPlaneVertexData(m_width, m_height, m_resolution, m_mirrored);
}
bool operator ==(const QBufferDataGenerator &other) const Q_DECL_FINAL
@@ -168,7 +169,8 @@ public:
if (otherFunctor != nullptr)
return (otherFunctor->m_width == m_width &&
otherFunctor->m_height == m_height &&
- otherFunctor->m_resolution == m_resolution);
+ otherFunctor->m_resolution == m_resolution &&
+ otherFunctor->m_mirrored == m_mirrored);
return false;
}
@@ -178,6 +180,7 @@ public:
float m_width;
float m_height;
QSize m_resolution;
+ bool m_mirrored;
};
class PlaneIndexBufferFunctor : public QBufferDataGenerator
@@ -237,6 +240,13 @@ public:
*/
/*!
+ * \qmlproperty bool PlaneGeometry::mirrored
+ * \since 5.9
+ *
+ * Controls if the UV coordinates of the plane should be flipped vertically.
+ */
+
+/*!
* \qmlproperty Attribute PlaneGeometry::positionAttribute
*
* Holds the geometry position attribute.
@@ -318,7 +328,7 @@ void QPlaneGeometry::updateVertices()
d->m_normalAttribute->setCount(nVerts);
d->m_texCoordAttribute->setCount(nVerts);
d->m_tangentAttribute->setCount(nVerts);
- d->m_vertexBuffer->setDataGenerator(QSharedPointer<PlaneVertexBufferFunctor>::create(d->m_width, d->m_height, d->m_meshResolution));
+ d->m_vertexBuffer->setDataGenerator(QSharedPointer<PlaneVertexBufferFunctor>::create(d->m_width, d->m_height, d->m_meshResolution, d->m_mirrored));
}
/*!
@@ -365,6 +375,16 @@ void QPlaneGeometry::setHeight(float height)
emit heightChanged(height);
}
+void QPlaneGeometry::setMirrored(bool mirrored)
+{
+ Q_D(QPlaneGeometry);
+ if (mirrored == d->m_mirrored)
+ return;
+ d->m_mirrored = mirrored;
+ updateVertices();
+ emit mirroredChanged(mirrored);
+}
+
/*!
* \property QPlaneGeometry::resolution
*
@@ -399,6 +419,18 @@ float QPlaneGeometry::height() const
}
/*!
+ * \property QPlaneGeometry::mirrored
+ * \since 5.9
+ *
+ * Controls if the UV coordinates of the plane should be flipped vertically.
+ */
+bool QPlaneGeometry::mirrored() const
+{
+ Q_D(const QPlaneGeometry);
+ return d->m_mirrored;
+}
+
+/*!
* \property QPlaneGeometry::positionAttribute
*
* Holds the geometry position attribute.
@@ -458,6 +490,7 @@ QPlaneGeometryPrivate::QPlaneGeometryPrivate()
, m_width(1.0f)
, m_height(1.0f)
, m_meshResolution(QSize(2, 2))
+ , m_mirrored(false)
, m_positionAttribute(nullptr)
, m_normalAttribute(nullptr)
, m_texCoordAttribute(nullptr)
@@ -525,7 +558,7 @@ void QPlaneGeometryPrivate::init()
// Each primitive has 3 vertives
m_indexAttribute->setCount(faces * 3);
- m_vertexBuffer->setDataGenerator(QSharedPointer<PlaneVertexBufferFunctor>::create(m_width, m_height, m_meshResolution));
+ m_vertexBuffer->setDataGenerator(QSharedPointer<PlaneVertexBufferFunctor>::create(m_width, m_height, m_meshResolution, m_mirrored));
m_indexBuffer->setDataGenerator(QSharedPointer<PlaneIndexBufferFunctor>::create(m_meshResolution));
q->addAttribute(m_positionAttribute);
diff --git a/src/extras/geometries/qplanegeometry.h b/src/extras/geometries/qplanegeometry.h
index 694e04e82..4a4efe6eb 100644
--- a/src/extras/geometries/qplanegeometry.h
+++ b/src/extras/geometries/qplanegeometry.h
@@ -62,6 +62,7 @@ class QT3DEXTRASSHARED_EXPORT QPlaneGeometry : public Qt3DRender::QGeometry
Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)
Q_PROPERTY(float height READ height WRITE setHeight NOTIFY heightChanged)
Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged)
+ Q_PROPERTY(bool mirrored READ mirrored WRITE setMirrored NOTIFY mirroredChanged REVISION 9)
Q_PROPERTY(Qt3DRender::QAttribute *positionAttribute READ positionAttribute CONSTANT)
Q_PROPERTY(Qt3DRender::QAttribute *normalAttribute READ normalAttribute CONSTANT)
Q_PROPERTY(Qt3DRender::QAttribute *texCoordAttribute READ texCoordAttribute CONSTANT)
@@ -78,6 +79,7 @@ public:
QSize resolution() const;
float width() const;
float height() const;
+ bool mirrored() const;
Qt3DRender::QAttribute *positionAttribute() const;
Qt3DRender::QAttribute *normalAttribute() const;
@@ -89,11 +91,13 @@ public Q_SLOTS:
void setResolution(const QSize &resolution);
void setWidth(float width);
void setHeight(float height);
+ void setMirrored(bool mirrored);
Q_SIGNALS:
void resolutionChanged(const QSize &resolution);
void widthChanged(float width);
void heightChanged(float height);
+ void mirroredChanged(bool mirrored);
protected:
QPlaneGeometry(QPlaneGeometryPrivate &dd, QNode *parent = nullptr);
diff --git a/src/extras/geometries/qplanegeometry_p.h b/src/extras/geometries/qplanegeometry_p.h
index cfde6da1c..68d979895 100644
--- a/src/extras/geometries/qplanegeometry_p.h
+++ b/src/extras/geometries/qplanegeometry_p.h
@@ -75,6 +75,7 @@ public:
float m_width;
float m_height;
QSize m_meshResolution;
+ bool m_mirrored;
Qt3DRender::QAttribute *m_positionAttribute;
Qt3DRender::QAttribute *m_normalAttribute;
Qt3DRender::QAttribute *m_texCoordAttribute;
diff --git a/src/extras/geometries/qplanemesh.cpp b/src/extras/geometries/qplanemesh.cpp
index 5991c5397..4804df024 100644
--- a/src/extras/geometries/qplanemesh.cpp
+++ b/src/extras/geometries/qplanemesh.cpp
@@ -73,6 +73,13 @@ namespace Qt3DExtras {
*/
/*!
+ * \qmlproperty bool PlaneMesh::mirrored
+ * \since 5.9
+ *
+ * Controls if the UV coordinates of the plane should be flipped vertically.
+ */
+
+/*!
* \class Qt3DExtras::QPlaneMesh
* \inheaderfile Qt3DExtras/QPlaneMesh
* \inmodule Qt3DExtras
@@ -92,6 +99,7 @@ QPlaneMesh::QPlaneMesh(QNode *parent)
QObject::connect(geometry, &QPlaneGeometry::widthChanged, this, &QPlaneMesh::widthChanged);
QObject::connect(geometry, &QPlaneGeometry::heightChanged, this, &QPlaneMesh::heightChanged);
QObject::connect(geometry, &QPlaneGeometry::resolutionChanged, this, &QPlaneMesh::meshResolutionChanged);
+ QObject::connect(geometry, &QPlaneGeometry::mirroredChanged, this, &QPlaneMesh::mirroredChanged);
QGeometryRenderer::setGeometry(geometry);
}
@@ -147,6 +155,22 @@ QSize QPlaneMesh::meshResolution() const
return static_cast<QPlaneGeometry *>(geometry())->resolution();
}
+void QPlaneMesh::setMirrored(bool mirrored)
+{
+ static_cast<QPlaneGeometry *>(geometry())->setMirrored(mirrored);
+}
+
+/*!
+ * \property QPlaneMesh::mirrored
+ * \since 5.9
+ *
+ * Controls if the UV coordinates of the plane should be flipped vertically.
+ */
+bool QPlaneMesh::mirrored() const
+{
+ return static_cast<QPlaneGeometry *>(geometry())->mirrored();
+}
+
} // namespace Qt3DExtras
QT_END_NAMESPACE
diff --git a/src/extras/geometries/qplanemesh.h b/src/extras/geometries/qplanemesh.h
index d68774ca0..1cf2ae79e 100644
--- a/src/extras/geometries/qplanemesh.h
+++ b/src/extras/geometries/qplanemesh.h
@@ -54,6 +54,7 @@ class QT3DEXTRASSHARED_EXPORT QPlaneMesh : public Qt3DRender::QGeometryRenderer
Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)
Q_PROPERTY(float height READ height WRITE setHeight NOTIFY heightChanged)
Q_PROPERTY(QSize meshResolution READ meshResolution WRITE setMeshResolution NOTIFY meshResolutionChanged)
+ Q_PROPERTY(bool mirrored READ mirrored WRITE setMirrored NOTIFY mirroredChanged REVISION 9)
public:
explicit QPlaneMesh(Qt3DCore::QNode *parent = nullptr);
@@ -62,16 +63,19 @@ public:
float width() const;
float height() const;
QSize meshResolution() const;
+ bool mirrored() const;
public Q_SLOTS:
void setWidth(float width);
void setHeight(float height);
void setMeshResolution(const QSize &resolution);
+ void setMirrored(bool mirrored);
Q_SIGNALS:
void meshResolutionChanged(const QSize &meshResolution);
void widthChanged(float width);
void heightChanged(float height);
+ void mirroredChanged(bool mirrored);
private:
// As this is a default provided geometry renderer, no one should be able
diff --git a/src/extras/shaders/es2/light.inc.frag b/src/extras/shaders/es2/light.inc.frag
index 726340d7e..074af5799 100644
--- a/src/extras/shaders/es2/light.inc.frag
+++ b/src/extras/shaders/es2/light.inc.frag
@@ -14,215 +14,179 @@ struct Light {
uniform Light lights[MAX_LIGHTS];
uniform int lightCount;
-void addLightAdsModelNormalMapped(const in FP vec3 vpos,
- const in FP vec3 n,
- const in FP vec3 eye,
- const in FP float shininess,
- const in FP mat3 tangentMatrix,
- const in Light light,
- inout FP vec3 diffuseColor,
- inout FP vec3 specularColor)
-{
- FP vec3 snormal = normalize( vec3( tangentMatrix[0][2], tangentMatrix[1][2], tangentMatrix[2][2] ) );
-
- FP vec3 s, ts;
- FP float att = 1.0;
- if ( light.type != TYPE_DIRECTIONAL ) {
- s = light.position - vpos;
- if ( dot(snormal, s) < 0.0 )
- att = 0.0;
- else {
- ts = normalize( tangentMatrix * s );
- if (length( light.attenuation ) != 0.0) {
- FP float dist = length(s);
- att = 1.0 / (light.attenuation.x + light.attenuation.y * dist + light.attenuation.z * dist * dist);
- }
- s = normalize( s );
- if ( light.type == TYPE_SPOT ) {
- if ( degrees(acos(dot(-s, normalize(light.direction))) ) > light.cutOffAngle)
- att = 0.0;
- }
- }
- } else {
- if ( dot(snormal, -light.direction) > 0.0 )
- s = normalize( tangentMatrix * -light.direction );
- else
- att = 0.0;
- }
-
- FP float diffuse = max( dot( ts, n ), 0.0 );
-
- FP float specular = 0.0;
- if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
- FP vec3 r = reflect( -ts, n );
- FP vec3 v = normalize( tangentMatrix * ( eye - vpos ) );
- FP float normFactor = ( shininess + 2.0 ) / 2.0;
- specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
- }
-
- diffuseColor += att * light.intensity * diffuse * light.color;
- specularColor += att * light.intensity * specular * light.color;
-}
-
void adsModelNormalMapped(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3 eye, const in FP float shininess,
const in FP mat3 tangentMatrix,
out FP vec3 diffuseColor, out FP vec3 specularColor)
{
diffuseColor = vec3(0.0);
specularColor = vec3(0.0);
- if (lightCount < 1) return;
- FP vec3 n = normalize( vnormal );
- addLightAdsModelNormalMapped(vpos, n, eye, shininess, tangentMatrix, lights[0], diffuseColor, specularColor);
- if (lightCount < 2) return;
-
- addLightAdsModelNormalMapped(vpos, n, eye, shininess, tangentMatrix, lights[1], diffuseColor, specularColor);
- if (lightCount < 3) return;
-
- addLightAdsModelNormalMapped(vpos, n, eye, shininess, tangentMatrix, lights[2], diffuseColor, specularColor);
- if (lightCount < 4) return;
-
- addLightAdsModelNormalMapped(vpos, n, eye, shininess, tangentMatrix, lights[3], diffuseColor, specularColor);
- if (lightCount < 5) return;
-
- addLightAdsModelNormalMapped(vpos, n, eye, shininess, tangentMatrix, lights[4], diffuseColor, specularColor);
- if (lightCount < 6) return;
-
- addLightAdsModelNormalMapped(vpos, n, eye, shininess, tangentMatrix, lights[5], diffuseColor, specularColor);
- if (lightCount < 7) return;
-
- addLightAdsModelNormalMapped(vpos, n, eye, shininess, tangentMatrix, lights[6], diffuseColor, specularColor);
- if (lightCount < 8) return;
-
- addLightAdsModelNormalMapped(vpos, n, eye, shininess, tangentMatrix, lights[7], diffuseColor, specularColor);
-}
+ FP vec3 snormal = normalize( vec3( tangentMatrix[0][2], tangentMatrix[1][2], tangentMatrix[2][2] ) );
-void addLightAdsModel(const in FP vec3 vpos,
- const in FP vec3 n,
- const in FP vec3 eye,
- const in FP float shininess,
- const in Light light,
- inout FP vec3 diffuseColor,
- inout FP vec3 specularColor)
-{
- FP vec3 s;
+ FP vec3 n = normalize( vnormal );
- FP float att = 1.0;
- if ( light.type != TYPE_DIRECTIONAL ) {
- s = light.position - vpos;
- if (length( light.attenuation ) != 0.0) {
- FP float dist = length(s);
- att = 1.0 / (light.attenuation.x + light.attenuation.y * dist + light.attenuation.z * dist * dist);
- }
- s = normalize( s );
- if ( light.type == TYPE_SPOT ) {
- if ( degrees(acos(dot(-s, normalize(light.direction))) ) > light.cutOffAngle)
+ FP vec3 s, ts;
+ Light light;
+ for (int i = 0; i < lightCount; ++i) {
+ if (i == 0)
+ light = lights[0];
+ else if (i == 1)
+ light = lights[1];
+ else if (i == 2)
+ light = lights[2];
+ else if (i == 3)
+ light = lights[3];
+ else if (i == 4)
+ light = lights[4];
+ else if (i == 5)
+ light = lights[5];
+ else if (i == 6)
+ light = lights[6];
+ else if (i == 7)
+ light = lights[7];
+
+ FP float att = 1.0;
+ if ( light.type != TYPE_DIRECTIONAL ) {
+ s = light.position - vpos;
+ if ( dot(snormal, s) < 0.0 )
+ att = 0.0;
+ else {
+ ts = normalize( tangentMatrix * s );
+ if (length( light.attenuation ) != 0.0) {
+ FP float dist = length(s);
+ att = 1.0 / (light.attenuation.x + light.attenuation.y * dist + light.attenuation.z * dist * dist);
+ }
+ s = normalize( s );
+ if ( light.type == TYPE_SPOT ) {
+ if ( degrees(acos(dot(-s, normalize(light.direction))) ) > light.cutOffAngle)
+ att = 0.0;
+ }
+ }
+ } else {
+ if ( dot(snormal, -light.direction) > 0.0 )
+ s = normalize( tangentMatrix * -light.direction );
+ else
att = 0.0;
}
- } else {
- s = normalize( -light.direction );
- }
- FP float diffuse = max( dot( s, n ), 0.0 );
- FP float specular = 0.0;
+ FP float diffuse = max( dot( ts, n ), 0.0 );
- if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
- FP vec3 r = reflect( -s, n );
- FP vec3 v = normalize( eye - vpos );
- FP float normFactor = ( shininess + 2.0 ) / 2.0;
- specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
- }
+ FP float specular = 0.0;
+ if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
+ FP vec3 r = reflect( -ts, n );
+ FP vec3 v = normalize( tangentMatrix * ( eye - vpos ) );
+ FP float normFactor = ( shininess + 2.0 ) / 2.0;
+ specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
+ }
- diffuseColor += att * light.intensity * diffuse * light.color;
- specularColor += att * light.intensity * specular * light.color;
+ diffuseColor += att * light.intensity * diffuse * light.color;
+ specularColor += att * light.intensity * specular * light.color;
+ }
}
-
void adsModel(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3 eye, const in FP float shininess,
out FP vec3 diffuseColor, out FP vec3 specularColor)
{
diffuseColor = vec3(0.0);
specularColor = vec3(0.0);
- if (lightCount < 1) return;
FP vec3 n = normalize( vnormal );
- addLightAdsModel(vpos, n, eye, shininess, lights[0], diffuseColor, specularColor);
- if (lightCount < 2) return;
-
- addLightAdsModel(vpos, n, eye, shininess, lights[1], diffuseColor, specularColor);
- if (lightCount < 3) return;
-
- addLightAdsModel(vpos, n, eye, shininess, lights[2], diffuseColor, specularColor);
- if (lightCount < 4) return;
-
- addLightAdsModel(vpos, n, eye, shininess, lights[3], diffuseColor, specularColor);
- if (lightCount < 5) return;
-
- addLightAdsModel(vpos, n, eye, shininess, lights[4], diffuseColor, specularColor);
- if (lightCount < 6) return;
-
- addLightAdsModel(vpos, n, eye, shininess, lights[5], diffuseColor, specularColor);
- if (lightCount < 7) return;
- addLightAdsModel(vpos, n, eye, shininess, lights[6], diffuseColor, specularColor);
- if (lightCount < 8) return;
-
- addLightAdsModel(vpos, n, eye, shininess, lights[7], diffuseColor, specularColor);
-}
-
-void addLightAdModel(const in FP vec3 vpos,
- const in FP vec3 n,
- const in Light light,
- inout FP vec3 diffuseColor)
-{
FP vec3 s;
- FP float att = 1.0;
- if ( light.type != TYPE_DIRECTIONAL ) {
- s = light.position - vpos;
- if (length( light.attenuation ) != 0.0) {
- FP float dist = length(s);
- att = 1.0 / (light.attenuation.x + light.attenuation.y * dist + light.attenuation.z * dist * dist);
- }
- s = normalize( s );
- if ( light.type == TYPE_SPOT ) {
- if ( degrees(acos(dot(-s, normalize(light.direction))) ) > light.cutOffAngle)
- att = 0.0;
+ Light light;
+ for (int i = 0; i < lightCount; ++i) {
+ if (i == 0)
+ light = lights[0];
+ else if (i == 1)
+ light = lights[1];
+ else if (i == 2)
+ light = lights[2];
+ else if (i == 3)
+ light = lights[3];
+ else if (i == 4)
+ light = lights[4];
+ else if (i == 5)
+ light = lights[5];
+ else if (i == 6)
+ light = lights[6];
+ else if (i == 7)
+ light = lights[7];
+
+ FP float att = 1.0;
+ if ( light.type != TYPE_DIRECTIONAL ) {
+ s = light.position - vpos;
+ if (length( light.attenuation ) != 0.0) {
+ FP float dist = length(s);
+ att = 1.0 / (light.attenuation.x + light.attenuation.y * dist + light.attenuation.z * dist * dist);
+ }
+ s = normalize( s );
+ if ( light.type == TYPE_SPOT ) {
+ if ( degrees(acos(dot(-s, normalize(light.direction))) ) > light.cutOffAngle)
+ att = 0.0;
+ }
+ } else {
+ s = normalize( -light.direction );
}
- } else {
- s = normalize( -light.direction );
- }
- FP float diffuse = max( dot( s, n ), 0.0 );
+ FP float diffuse = max( dot( s, n ), 0.0 );
+
+ FP float specular = 0.0;
+ if (diffuse > 0.0 && shininess > 0.0 && att > 0.0) {
+ FP vec3 r = reflect( -s, n );
+ FP vec3 v = normalize( eye - vpos );
+ FP float normFactor = ( shininess + 2.0 ) / 2.0;
+ specular = normFactor * pow( max( dot( r, v ), 0.0 ), shininess );
+ }
- diffuseColor += att * light.intensity * diffuse * light.color;
+ diffuseColor += att * light.intensity * diffuse * light.color;
+ specularColor += att * light.intensity * specular * light.color;
+ }
}
void adModel(const in FP vec3 vpos, const in FP vec3 vnormal, out FP vec3 diffuseColor)
{
diffuseColor = vec3(0.0);
- if (lightCount < 1) return;
FP vec3 n = normalize( vnormal );
- addLightAdModel(vpos, n, lights[0], diffuseColor);
- if (lightCount < 2) return;
-
- addLightAdModel(vpos, n, lights[1], diffuseColor);
- if (lightCount < 3) return;
- addLightAdModel(vpos, n, lights[2], diffuseColor);
- if (lightCount < 4) return;
-
- addLightAdModel(vpos, n, lights[3], diffuseColor);
- if (lightCount < 5) return;
-
- addLightAdModel(vpos, n, lights[4], diffuseColor);
- if (lightCount < 6) return;
-
- addLightAdModel(vpos, n, lights[5], diffuseColor);
- if (lightCount < 7) return;
+ FP vec3 s;
+ Light light;
+ for (int i = 0; i < lightCount; ++i) {
+ if (i == 0)
+ light = lights[0];
+ else if (i == 1)
+ light = lights[1];
+ else if (i == 2)
+ light = lights[2];
+ else if (i == 3)
+ light = lights[3];
+ else if (i == 4)
+ light = lights[4];
+ else if (i == 5)
+ light = lights[5];
+ else if (i == 6)
+ light = lights[6];
+ else if (i == 7)
+ light = lights[7];
+
+ FP float att = 1.0;
+ if ( light.type != TYPE_DIRECTIONAL ) {
+ s = light.position - vpos;
+ if (length( light.attenuation ) != 0.0) {
+ FP float dist = length(s);
+ att = 1.0 / (light.attenuation.x + light.attenuation.y * dist + light.attenuation.z * dist * dist);
+ }
+ s = normalize( s );
+ if ( light.type == TYPE_SPOT ) {
+ if ( degrees(acos(dot(-s, normalize(light.direction))) ) > light.cutOffAngle)
+ att = 0.0;
+ }
+ } else {
+ s = normalize( -light.direction );
+ }
- addLightAdModel(vpos, n, lights[6], diffuseColor);
- if (lightCount < 8) return;
+ FP float diffuse = max( dot( s, n ), 0.0 );
- addLightAdModel(vpos, n, lights[7], diffuseColor);
+ diffuseColor += att * light.intensity * diffuse * light.color;
+ }
}
diff --git a/src/extras/shaders/gl3/metalrough.frag b/src/extras/shaders/gl3/metalrough.frag
index e1eb6bab2..7f2f3d20e 100644
--- a/src/extras/shaders/gl3/metalrough.frag
+++ b/src/extras/shaders/gl3/metalrough.frag
@@ -71,11 +71,6 @@ uniform sampler2D ambientOcclusionMap;
// User control parameters
uniform float metalFactor = 1.0;
-// Roughness -> mip level mapping
-uniform float maxT = 0.939824;
-uniform float mipLevels = 11.0;
-uniform float mipOffset = 5.0;
-
// Exposure correction
uniform float exposure = 0.0;
// Gamma correction
@@ -83,6 +78,25 @@ uniform float gamma = 2.2;
#pragma include light.inc.frag
+int mipLevelCount(const in samplerCube cube)
+{
+ int baseSize = textureSize(cube, 0).x;
+ int nMips = int(log2(float(baseSize>0 ? baseSize : 1))) + 1;
+ return nMips;
+}
+
+float remapRoughness(const in float roughness)
+{
+ // As per page 14 of
+ // http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+ // we remap the roughness to give a more perceptually linear response
+ // of "bluriness" as a function of the roughness specified by the user.
+ // r = roughness^2
+ const float maxSpecPower = 999999.0;
+ const float minRoughness = sqrt(2.0 / (maxSpecPower + 2));
+ return max(roughness * roughness, minRoughness);
+}
+
mat3 calcWorldSpaceToTangentSpaceMatrix(const in vec3 wNormal, const in vec4 wTangent)
{
// Make the tangent truly orthogonal to the normal by using Gram-Schmidt.
@@ -103,32 +117,42 @@ mat3 calcWorldSpaceToTangentSpaceMatrix(const in vec3 wNormal, const in vec4 wTa
return worldToTangentMatrix;
}
-float roughnessToMipLevel(float roughness)
+float alphaToMipLevel(float alpha)
{
- // HACK: Improve the roughness -> mip level mapping for roughness map from substace painter
- // TODO: Use mathematica or similar to improve this mapping more generally
- roughness = 0.75 + (1.7 * (roughness - 0.5));
- return (mipLevels - 1.0 - mipOffset) * (1.0 - (1.0 - roughness) / maxT);
+ float specPower = 2.0 / (alpha * alpha) - 2.0;
+
+ // We use the mip level calculation from Lys' default power drop, which in
+ // turn is a slight modification of that used in Marmoset Toolbag. See
+ // https://docs.knaldtech.com/doku.php?id=specular_lys for details.
+ // For now we assume a max specular power of 999999 which gives
+ // maxGlossiness = 1.
+ const float k0 = 0.00098;
+ const float k1 = 0.9921;
+ float glossiness = (pow(2.0, -10.0 / sqrt(specPower)) - k0) / k1;
+
+ // TODO: Optimize by doing this on CPU and set as
+ // uniform int envLight.specularMipLevels say (if present in shader).
+ // Lookup the number of mips in the specular envmap
+ int mipLevels = mipLevelCount(envLight.specular);
+
+ // Offset of smallest miplevel we should use (corresponds to specular
+ // power of 1). I.e. in the 32x32 sized mip.
+ const float mipOffset = 5.0;
+
+ // The final factor is really 1 - g / g_max but as mentioned above g_max
+ // is 1 by definition here so we can avoid the division. If we make the
+ // max specular power for the spec map configurable, this will need to
+ // be handled properly.
+ float mipLevel = (mipLevels - 1.0 - mipOffset) * (1.0 - glossiness);
+ return mipLevel;
}
-// Helper function to map from linear roughness value to non-linear alpha (shininess)
-float roughnessToAlpha(const in float roughness)
+float normalDistribution(const in vec3 n, const in vec3 h, const in float alpha)
{
- // Constants to control how to convert from roughness [0,1] to
- // shininess (alpha) [minAlpha, maxAlpha] using a power law with
- // a power of 1 / rho.
- const float minAlpha = 1.0;
- const float maxAlpha = 1024.0;
- const float rho = 3.0;
-
- return minAlpha + (maxAlpha - minAlpha) * (1.0 - pow(roughness, 1.0 / rho));
-}
-
-float normalDistribution(const in vec3 n, const in vec3 h, const in float roughness)
-{
- // Blinn-Phong approximation
- float alpha = roughnessToAlpha(roughness);
- return (alpha + 2.0) / (2.0 * 3.14159) * pow(max(dot(n, h), 0.0), alpha);
+ // Blinn-Phong approximation - see
+ // http://graphicrants.blogspot.co.uk/2013/08/specular-brdf-reference.html
+ float specPower = 2.0 / (alpha * alpha) - 2.0;
+ return (specPower + 2.0) / (2.0 * 3.14159) * pow(max(dot(n, h), 0.0), specPower);
}
vec3 fresnelFactor(const in vec3 color, const in float cosineFactor)
@@ -176,7 +200,7 @@ vec3 pbrModel(const in int lightIndex,
const in vec3 wView,
const in vec3 baseColor,
const in float metalness,
- const in float roughness,
+ const in float alpha,
const in float ambientOcclusion)
{
// Calculate some useful quantities
@@ -234,7 +258,7 @@ vec3 pbrModel(const in int lightIndex,
vec3 specularFactor = vec3(0.0);
if (sDotN > 0.0) {
specularFactor = specularModel(F0, sDotH, sDotN, vDotN, n, h);
- specularFactor *= normalDistribution(n, h, roughness);
+ specularFactor *= normalDistribution(n, h, alpha);
}
vec3 specularColor = lights[lightIndex].color;
vec3 specular = specularColor * specularFactor;
@@ -252,7 +276,7 @@ vec3 pbrIblModel(const in vec3 wNormal,
const in vec3 wView,
const in vec3 baseColor,
const in float metalness,
- const in float roughness,
+ const in float alpha,
const in float ambientOcclusion)
{
// Calculate reflection direction of view vector about surface normal
@@ -277,7 +301,26 @@ vec3 pbrIblModel(const in vec3 wNormal,
vec3 F0 = mix(dielectricColor, baseColor, metalness);
vec3 specularFactor = specularModel(F0, lDotH, lDotN, vDotN, n, h);
- float lod = roughnessToMipLevel(roughness);
+ float lod = alphaToMipLevel(alpha);
+//#define DEBUG_SPECULAR_LODS
+#ifdef DEBUG_SPECULAR_LODS
+ if (lod > 7.0)
+ return vec3(1.0, 0.0, 0.0);
+ else if (lod > 6.0)
+ return vec3(1.0, 0.333, 0.0);
+ else if (lod > 5.0)
+ return vec3(1.0, 1.0, 0.0);
+ else if (lod > 4.0)
+ return vec3(0.666, 1.0, 0.0);
+ else if (lod > 3.0)
+ return vec3(0.0, 1.0, 0.666);
+ else if (lod > 2.0)
+ return vec3(0.0, 0.666, 1.0);
+ else if (lod > 1.0)
+ return vec3(0.0, 0.0, 1.0);
+ else if (lod > 0.0)
+ return vec3(1.0, 0.0, 1.0);
+#endif
vec3 specularSkyColor = textureLod(envLight.specular, l, lod).rgb;
vec3 specular = specularSkyColor * specularFactor;
@@ -317,12 +360,15 @@ void main()
vec3 tNormal = 2.0 * texture(normalMap, texCoord).rgb - vec3(1.0);
vec3 wNormal = normalize(transpose(worldToTangentMatrix) * tNormal);
+ // Remap roughness for a perceptually more linear correspondence
+ float alpha = remapRoughness(roughness);
+
for (int i = 0; i < envLightCount; ++i) {
cLinear += pbrIblModel(wNormal,
wView,
baseColor,
metalness,
- roughness,
+ alpha,
ambientOcclusion);
}
@@ -333,7 +379,7 @@ void main()
wView,
baseColor.rgb,
metalness,
- roughness,
+ alpha,
ambientOcclusion);
}
diff --git a/src/extras/shaders/gl3/metalroughuniform.frag b/src/extras/shaders/gl3/metalroughuniform.frag
index cccd31b52..f4bad0a00 100644
--- a/src/extras/shaders/gl3/metalroughuniform.frag
+++ b/src/extras/shaders/gl3/metalroughuniform.frag
@@ -66,11 +66,6 @@ uniform vec4 baseColor;
uniform float metalness;
uniform float roughness;
-// Roughness -> mip level mapping
-uniform float maxT = 0.939824;
-uniform float mipLevels = 11.0;
-uniform float mipOffset = 5.0;
-
// Exposure correction
uniform float exposure = 0.0;
// Gamma correction
@@ -78,6 +73,25 @@ uniform float gamma = 2.2;
#pragma include light.inc.frag
+int mipLevelCount(const in samplerCube cube)
+{
+ int baseSize = textureSize(cube, 0).x;
+ int nMips = int(log2(float(baseSize>0 ? baseSize : 1))) + 1;
+ return nMips;
+}
+
+float remapRoughness(const in float roughness)
+{
+ // As per page 14 of
+ // http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+ // we remap the roughness to give a more perceptually linear response
+ // of "bluriness" as a function of the roughness specified by the user.
+ // r = roughness^2
+ const float maxSpecPower = 999999.0;
+ const float minRoughness = sqrt(2.0 / (maxSpecPower + 2));
+ return max(roughness * roughness, minRoughness);
+}
+
mat3 calcWorldSpaceToTangentSpaceMatrix(const in vec3 wNormal, const in vec4 wTangent)
{
// Make the tangent truly orthogonal to the normal by using Gram-Schmidt.
@@ -98,32 +112,42 @@ mat3 calcWorldSpaceToTangentSpaceMatrix(const in vec3 wNormal, const in vec4 wTa
return worldToTangentMatrix;
}
-float roughnessToMipLevel(float roughness)
-{
- // HACK: Improve the roughness -> mip level mapping for roughness map from substace painter
- // TODO: Use mathematica or similar to improve this mapping more generally
- roughness = 0.75 + (1.7 * (roughness - 0.5));
- return (mipLevels - 1.0 - mipOffset) * (1.0 - (1.0 - roughness) / maxT);
-}
-
-// Helper function to map from linear roughness value to non-linear alpha (shininess)
-float roughnessToAlpha(const in float roughness)
+float alphaToMipLevel(float alpha)
{
- // Constants to control how to convert from roughness [0,1] to
- // shininess (alpha) [minAlpha, maxAlpha] using a power law with
- // a power of 1 / rho.
- const float minAlpha = 1.0;
- const float maxAlpha = 1024.0;
- const float rho = 3.0;
-
- return minAlpha + (maxAlpha - minAlpha) * (1.0 - pow(roughness, 1.0 / rho));
+ float specPower = 2.0 / (alpha * alpha) - 2.0;
+
+ // We use the mip level calculation from Lys' default power drop, which in
+ // turn is a slight modification of that used in Marmoset Toolbag. See
+ // https://docs.knaldtech.com/doku.php?id=specular_lys for details.
+ // For now we assume a max specular power of 999999 which gives
+ // maxGlossiness = 1.
+ const float k0 = 0.00098;
+ const float k1 = 0.9921;
+ float glossiness = (pow(2.0, -10.0 / sqrt(specPower)) - k0) / k1;
+
+ // TODO: Optimize by doing this on CPU and set as
+ // uniform int envLight.specularMipLevels say (if present in shader).
+ // Lookup the number of mips in the specular envmap
+ int mipLevels = mipLevelCount(envLight.specular);
+
+ // Offset of smallest miplevel we should use (corresponds to specular
+ // power of 1). I.e. in the 32x32 sized mip.
+ const float mipOffset = 5.0;
+
+ // The final factor is really 1 - g / g_max but as mentioned above g_max
+ // is 1 by definition here so we can avoid the division. If we make the
+ // max specular power for the spec map configurable, this will need to
+ // be handled properly.
+ float mipLevel = (mipLevels - 1.0 - mipOffset) * (1.0 - glossiness);
+ return mipLevel;
}
-float normalDistribution(const in vec3 n, const in vec3 h, const in float roughness)
+float normalDistribution(const in vec3 n, const in vec3 h, const in float alpha)
{
- // Blinn-Phong approximation
- float alpha = roughnessToAlpha(roughness);
- return (alpha + 2.0) / (2.0 * 3.14159) * pow(max(dot(n, h), 0.0), alpha);
+ // Blinn-Phong approximation - see
+ // http://graphicrants.blogspot.co.uk/2013/08/specular-brdf-reference.html
+ float specPower = 2.0 / (alpha * alpha) - 2.0;
+ return (specPower + 2.0) / (2.0 * 3.14159) * pow(max(dot(n, h), 0.0), specPower);
}
vec3 fresnelFactor(const in vec3 color, const in float cosineFactor)
@@ -171,7 +195,7 @@ vec3 pbrModel(const in int lightIndex,
const in vec3 wView,
const in vec3 baseColor,
const in float metalness,
- const in float roughness)
+ const in float alpha)
{
// Calculate some useful quantities
vec3 n = wNormal;
@@ -228,7 +252,7 @@ vec3 pbrModel(const in int lightIndex,
vec3 specularFactor = vec3(0.0);
if (sDotN > 0.0) {
specularFactor = specularModel(F0, sDotH, sDotN, vDotN, n, h);
- specularFactor *= normalDistribution(n, h, roughness);
+ specularFactor *= normalDistribution(n, h, alpha);
}
vec3 specularColor = lights[lightIndex].color;
vec3 specular = specularColor * specularFactor;
@@ -241,7 +265,7 @@ vec3 pbrIblModel(const in vec3 wNormal,
const in vec3 wView,
const in vec3 baseColor,
const in float metalness,
- const in float roughness)
+ const in float alpha)
{
// Calculate reflection direction of view vector about surface normal
// vector in world space. This is used in the fragment shader to sample
@@ -265,7 +289,31 @@ vec3 pbrIblModel(const in vec3 wNormal,
vec3 F0 = mix(dielectricColor, baseColor, metalness);
vec3 specularFactor = specularModel(F0, lDotH, lDotN, vDotN, n, h);
- float lod = roughnessToMipLevel(roughness);
+ // As per page 14 of
+ // http://www.frostbite.com/wp-content/uploads/2014/11/course_notes_moving_frostbite_to_pbr.pdf
+ // we remap the roughness to give a more perceptually linear response
+ // of "bluriness" as a function of the roughness specified by the user.
+ // r = roughness^2
+ float lod = alphaToMipLevel(alpha);
+//#define DEBUG_SPECULAR_LODS
+#ifdef DEBUG_SPECULAR_LODS
+ if (lod > 7.0)
+ return vec3(1.0, 0.0, 0.0);
+ else if (lod > 6.0)
+ return vec3(1.0, 0.333, 0.0);
+ else if (lod > 5.0)
+ return vec3(1.0, 1.0, 0.0);
+ else if (lod > 4.0)
+ return vec3(0.666, 1.0, 0.0);
+ else if (lod > 3.0)
+ return vec3(0.0, 1.0, 0.666);
+ else if (lod > 2.0)
+ return vec3(0.0, 0.666, 1.0);
+ else if (lod > 1.0)
+ return vec3(0.0, 0.0, 1.0);
+ else if (lod > 0.0)
+ return vec3(1.0, 0.0, 1.0);
+#endif
vec3 specularSkyColor = textureLod(envLight.specular, l, lod).rgb;
vec3 specular = specularSkyColor * specularFactor;
@@ -287,23 +335,28 @@ void main()
{
vec3 cLinear = vec3(0.0);
+ // Remap roughness for a perceptually more linear correspondence
+ float alpha = remapRoughness(roughness);
+
+
+ vec3 wNormal = normalize(worldNormal);
vec3 worldView = normalize(eyePosition - worldPosition);
for (int i = 0; i < envLightCount; ++i) {
- cLinear += pbrIblModel(worldNormal,
+ cLinear += pbrIblModel(wNormal,
worldView,
baseColor.rgb,
metalness,
- roughness);
+ alpha);
}
for (int i = 0; i < lightCount; ++i) {
cLinear += pbrModel(i,
worldPosition,
- worldNormal,
+ wNormal,
worldView,
baseColor.rgb,
metalness,
- roughness);
+ alpha);
}
// Apply exposure correction
diff --git a/src/plugins/geometryloaders/default/objgeometryloader.cpp b/src/plugins/geometryloaders/default/objgeometryloader.cpp
index 9f31c7de6..b1fb1f931 100644
--- a/src/plugins/geometryloaders/default/objgeometryloader.cpp
+++ b/src/plugins/geometryloaders/default/objgeometryloader.cpp
@@ -231,7 +231,7 @@ bool ObjGeometryLoader::doLoad(QIODevice *ioDev, const QString &subMesh)
const int indexCount = faceIndexVector.size();
m_indices.clear();
m_indices.reserve(indexCount);
- for (const FaceIndices faceIndices : faceIndexVector) {
+ for (const FaceIndices faceIndices : qAsConst(faceIndexVector)) {
const unsigned int i = faceIndexMap.value(faceIndices);
m_indices.append(i);
}
diff --git a/src/plugins/sceneparsers/assimp/assimpimporter.cpp b/src/plugins/sceneparsers/assimp/assimpimporter.cpp
index 196e1d22f..d5fc113e3 100644
--- a/src/plugins/sceneparsers/assimp/assimpimporter.cpp
+++ b/src/plugins/sceneparsers/assimp/assimpimporter.cpp
@@ -443,7 +443,7 @@ Qt3DCore::QEntity *AssimpImporter::scene(const QString &id)
if (m_scene->m_animations.size() > 0) {
qWarning() << "No target found for " << m_scene->m_animations.size() << " animations!";
- for (Qt3DAnimation::QKeyframeAnimation *anim : m_scene->m_animations)
+ for (Qt3DAnimation::QKeyframeAnimation *anim : qAsConst(m_scene->m_animations))
delete anim;
m_scene->m_animations.clear();
}
@@ -505,7 +505,7 @@ Qt3DCore::QEntity *AssimpImporter::node(aiNode *node)
animations,
aiStringToQString(node->mName));
const auto morphTargetList = morphingAnimations.at(0)->morphTargetList();
- for (Qt3DAnimation::QMorphingAnimation *anim : animations) {
+ for (Qt3DAnimation::QMorphingAnimation *anim : qAsConst(animations)) {
anim->setParent(entityNode);
anim->setTarget(mesh);
anim->setMorphTargets(morphTargetList);
@@ -558,7 +558,7 @@ Qt3DCore::QEntity *AssimpImporter::node(aiNode *node)
animations,
aiStringToQString(node->mName));
- for (Qt3DAnimation::QKeyframeAnimation *anim : animations) {
+ for (Qt3DAnimation::QKeyframeAnimation *anim : qAsConst(animations)) {
anim->setTarget(transform);
anim->setParent(entityNode);
}
diff --git a/src/plugins/sceneparsers/gltf/gltfimporter.cpp b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
index 916589ffa..6f61d2ed9 100644
--- a/src/plugins/sceneparsers/gltf/gltfimporter.cpp
+++ b/src/plugins/sceneparsers/gltf/gltfimporter.cpp
@@ -1072,8 +1072,8 @@ void GLTFImporter::cleanup()
m_shaderPaths.clear();
delete_if_without_parent(m_programs);
m_programs.clear();
- for (auto params : m_techniqueParameters.values())
- delete_if_without_parent(params);
+ for (auto it = m_techniqueParameters.begin(); it != m_techniqueParameters.end(); ++it)
+ delete_if_without_parent(it.value());
m_techniqueParameters.clear();
delete_if_without_parent(m_techniques);
m_techniques.clear();
@@ -1546,7 +1546,7 @@ void GLTFImporter::processJSONExtensions(const QString &id, const QJsonObject &j
// level GLTF item.
if (id == KEY_COMMON_MAT) {
const auto lights = jsonObject.value(KEY_LIGHTS).toObject();
- for (auto lightKey : lights.keys()) {
+ for (const auto &lightKey : lights.keys()) {
const auto light = lights.value(lightKey).toObject();
auto lightType = light.value(KEY_TYPE).toString();
const auto lightValues = light.value(lightType).toObject();
diff --git a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp
index b2fd9ce5b..4b1d0fb40 100644
--- a/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp
+++ b/src/plugins/sceneparsers/gltfexport/gltfexporter.cpp
@@ -370,7 +370,7 @@ bool GLTFExporter::exportScene(QEntity *sceneRoot, const QString &outDir,
QFile::Permissions targetPermissions = gltfFile.permissions();
// Copy exported scene to actual export directory
- for (auto sourceFileStr : m_exportedFiles) {
+ for (const auto &sourceFileStr : m_exportedFiles) {
QFileInfo fiSource(m_exportDir + sourceFileStr);
QFileInfo fiDestination(finalExportDir + sourceFileStr);
if (fiDestination.exists()) {
@@ -524,7 +524,7 @@ void GLTFExporter::copyTextures()
void GLTFExporter::createShaders()
{
qCDebug(GLTFExporterLog, "Creating shaders...");
- for (auto si : m_shaderInfo) {
+ for (const auto &si : m_shaderInfo) {
const QString fileName = m_exportDir + si.uri;
QFile f(fileName);
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
@@ -940,11 +940,11 @@ void GLTFExporter::parseMeshes()
qCDebug(GLTFExporterLog, " Vertex buffer size (bytes): %i", vertexBuf.size());
qCDebug(GLTFExporterLog, " Index buffer size (bytes): %i", indexBuf.size());
QStringList sl;
- for (auto bv : meshInfo.views)
+ for (const auto &bv : meshInfo.views)
sl << bv.name;
qCDebug(GLTFExporterLog) << " buffer views:" << sl;
sl.clear();
- for (auto acc : meshInfo.accessors)
+ for (const auto &acc : meshInfo.accessors)
sl << acc.name;
qCDebug(GLTFExporterLog) << " accessors:" << sl;
qCDebug(GLTFExporterLog, " material: '%ls'",
@@ -1129,7 +1129,7 @@ QString GLTFExporter::addShaderInfo(QShaderProgram::ShaderType type, QByteArray
if (code.isEmpty())
return QString();
- for (auto si : m_shaderInfo) {
+ for (const auto &si : m_shaderInfo) {
if (si.type == QShaderProgram::Vertex && code == si.code)
return si.name;
}
@@ -1153,10 +1153,11 @@ bool GLTFExporter::saveScene()
QVector<MeshInfo::BufferView> bvList;
QVector<MeshInfo::Accessor> accList;
- for (auto mi : m_meshInfo.values()) {
- for (auto v : mi.views)
+ for (auto it = m_meshInfo.begin(); it != m_meshInfo.end(); ++it) {
+ auto &mi = it.value();
+ for (auto &v : mi.views)
bvList << v;
- for (auto acc : mi.accessors)
+ for (auto &acc : mi.accessors)
accList << acc;
}
@@ -1193,7 +1194,7 @@ bool GLTFExporter::saveScene()
m_obj["buffers"] = buffers;
QJsonObject bufferViews;
- for (auto bv : bvList) {
+ for (const auto &bv : bvList) {
QJsonObject bufferView;
bufferView["buffer"] = QStringLiteral("buf");
bufferView["byteLength"] = int(bv.length);
@@ -1206,7 +1207,7 @@ bool GLTFExporter::saveScene()
m_obj["bufferViews"] = bufferViews;
QJsonObject accessors;
- for (auto acc : accList) {
+ for (const auto &acc : accList) {
QJsonObject accessor;
accessor["bufferView"] = acc.bufferView;
accessor["byteOffset"] = int(acc.offset);
@@ -1220,7 +1221,8 @@ bool GLTFExporter::saveScene()
m_obj["accessors"] = accessors;
QJsonObject meshes;
- for (auto meshInfo : m_meshInfo.values()) {
+ for (auto it = m_meshInfo.begin(); it != m_meshInfo.end(); ++it) {
+ auto &meshInfo = it.value();
QJsonObject mesh;
mesh["name"] = meshInfo.originalName;
if (meshInfo.meshType != TypeNone) {
@@ -1234,7 +1236,7 @@ bool GLTFExporter::saveScene()
QJsonObject prim;
prim["mode"] = 4; // triangles
QJsonObject attrs;
- for (auto acc : meshInfo.accessors) {
+ for (const auto &acc : meshInfo.accessors) {
if (acc.usage != QStringLiteral("INDEX"))
attrs[acc.usage] = acc.name;
else
@@ -1251,7 +1253,8 @@ bool GLTFExporter::saveScene()
m_obj["meshes"] = meshes;
QJsonObject cameras;
- for (auto camInfo : m_cameraInfo.values()) {
+ for (auto it = m_cameraInfo.begin(); it != m_cameraInfo.end(); ++it) {
+ const auto &camInfo = it.value();
QJsonObject camera;
QJsonObject proj;
proj["znear"] = camInfo.znear;
@@ -1283,7 +1286,7 @@ bool GLTFExporter::saveScene()
if (m_rootNodeEmpty) {
// Don't export the root node if it is there just to group the scene, so we don't get
// an extra empty node when we import the scene back.
- for (auto c : m_rootNode->children)
+ for (auto c : qAsConst(m_rootNode->children))
sceneNodes << exportNodes(c, nodes);
} else {
sceneNodes << exportNodes(m_rootNode, nodes);
@@ -1305,7 +1308,8 @@ bool GLTFExporter::saveScene()
// Lights must be declared as extensions to the top-level glTF object
QJsonObject lights;
- for (auto lightInfo : m_lightInfo.values()) {
+ for (auto it = m_lightInfo.begin(); it != m_lightInfo.end(); ++it) {
+ const auto &lightInfo = it.value();
QJsonObject light;
QJsonObject lightDetails;
QString type;
@@ -1406,7 +1410,7 @@ bool GLTFExporter::saveScene()
if (!gFilter->vendor().isEmpty())
graphicsApiFilterObj["vendor"] = gFilter->vendor();
QJsonArray extensions;
- for (auto extName : gFilter->extensions())
+ for (const auto &extName : gFilter->extensions())
extensions << extName;
if (!extensions.isEmpty())
graphicsApiFilterObj["extensions"] = extensions;
@@ -1485,7 +1489,7 @@ bool GLTFExporter::saveScene()
// Save shaders for custom materials
QJsonObject shaders;
- for (auto si : m_shaderInfo) {
+ for (const auto &si : m_shaderInfo) {
QJsonObject shaderObj;
shaderObj["uri"] = si.uri;
shaders[si.name] = shaderObj;
@@ -1572,7 +1576,7 @@ bool GLTFExporter::saveScene()
QByteArray pre = "<RCC><qresource prefix=\"/gltf_res\">\n";
QByteArray post = "</qresource></RCC>\n";
f.write(pre);
- for (auto file : m_exportedFiles) {
+ for (const auto &file : qAsConst(m_exportedFiles)) {
QString line = QString(QStringLiteral(" <file>%1</file>\n")).arg(file);
f.write(line.toUtf8());
}
@@ -1594,7 +1598,7 @@ void GLTFExporter::delNode(GLTFExporter::Node *n)
{
if (!n)
return;
- for (auto *c : n->children)
+ for (auto *c : qAsConst(n->children))
delNode(c);
delete n;
}
@@ -1604,7 +1608,7 @@ QString GLTFExporter::exportNodes(GLTFExporter::Node *n, QJsonObject &nodes)
QJsonObject node;
node["name"] = n->name;
QJsonArray children;
- for (auto c : n->children)
+ for (auto c : qAsConst(n->children))
children << exportNodes(c, nodes);
node["children"] = children;
if (auto transform = m_transformMap.value(n))
@@ -2060,7 +2064,7 @@ void GLTFExporter::setVarToJSonObject(QJsonObject &jsObj, const QString &key, co
jsObj[key] = var.value<float>();
break;
case QMetaType::QSize:
- jsObj[key] = size2jsvec(var.value<QSize>());
+ jsObj[key] = size2jsvec(var.toSize());
break;
case QMetaType::QVector2D:
jsObj[key] = vec2jsvec(var.value<QVector2D>());
diff --git a/src/quick3d/imports/animation/plugins.qmltypes b/src/quick3d/imports/animation/plugins.qmltypes
new file mode 100644
index 000000000..08879ee52
--- /dev/null
+++ b/src/quick3d/imports/animation/plugins.qmltypes
@@ -0,0 +1,670 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable Qt3D.Animation 2.9'
+
+Module {
+ dependencies: ["QtQuick 2.8"]
+ Component {
+ name: "Qt3DAnimation::Animation::Quick::Quick3DChannelMapper"
+ defaultProperty: "mappings"
+ prototype: "Qt3DAnimation::QChannelMapper"
+ exports: ["Qt3D.Animation/ChannelMapper 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property {
+ name: "mappings"
+ type: "Qt3DAnimation::QChannelMapping"
+ isList: true
+ isReadonly: true
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QAbstractAnimation"
+ prototype: "QObject"
+ exports: ["Qt3D.Animation/AbstractAnimation 2.9"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "AnimationType"
+ values: {
+ "KeyframeAnimation": 1,
+ "MorphingAnimation": 2,
+ "VertexBlendAnimation": 3
+ }
+ }
+ Property { name: "animationName"; type: "string" }
+ Property { name: "animationType"; type: "QAbstractAnimation::AnimationType"; isReadonly: true }
+ Property { name: "position"; type: "float" }
+ Property { name: "duration"; type: "float"; isReadonly: true }
+ Signal {
+ name: "animationNameChanged"
+ Parameter { name: "name"; type: "string" }
+ }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "position"; type: "float" }
+ }
+ Signal {
+ name: "durationChanged"
+ Parameter { name: "duration"; type: "float" }
+ }
+ Method {
+ name: "setAnimationName"
+ Parameter { name: "name"; type: "string" }
+ }
+ Method {
+ name: "setPosition"
+ Parameter { name: "position"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QAbstractAnimationClip"
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Animation/AbstractAnimationClip 2.9"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "duration"; type: "float"; isReadonly: true }
+ Signal {
+ name: "durationChanged"
+ Parameter { name: "duration"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QAbstractClipAnimator"
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Animation/AbstractClipAnimator 2.9"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Loops"
+ values: {
+ "Infinite": -1
+ }
+ }
+ Property { name: "running"; type: "bool" }
+ Property { name: "loops"; type: "int" }
+ Property { name: "channelMapper"; type: "Qt3DAnimation::QChannelMapper"; isPointer: true }
+ Signal {
+ name: "runningChanged"
+ Parameter { name: "running"; type: "bool" }
+ }
+ Signal {
+ name: "channelMapperChanged"
+ Parameter { name: "channelMapper"; type: "Qt3DAnimation::QChannelMapper"; isPointer: true }
+ }
+ Signal {
+ name: "loopCountChanged"
+ Parameter { name: "loops"; type: "int" }
+ }
+ Method {
+ name: "setRunning"
+ Parameter { name: "running"; type: "bool" }
+ }
+ Method {
+ name: "setChannelMapper"
+ Parameter { name: "channelMapper"; type: "Qt3DAnimation::QChannelMapper"; isPointer: true }
+ }
+ Method {
+ name: "setLoopCount"
+ Parameter { name: "loops"; type: "int" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QAbstractClipBlendNode"
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Animation/AbstractClipBlendNode 2.9"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "Qt3DAnimation::QAdditiveClipBlend"
+ prototype: "Qt3DAnimation::QAbstractClipBlendNode"
+ exports: ["Qt3D.Animation/AdditiveClipBlend 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "baseClip"; type: "Qt3DAnimation::QAbstractClipBlendNode"; isPointer: true }
+ Property {
+ name: "additiveClip"
+ type: "Qt3DAnimation::QAbstractClipBlendNode"
+ isPointer: true
+ }
+ Property { name: "additiveFactor"; type: "float" }
+ Signal {
+ name: "additiveFactorChanged"
+ Parameter { name: "additiveFactor"; type: "float" }
+ }
+ Signal {
+ name: "baseClipChanged"
+ Parameter { name: "baseClip"; type: "Qt3DAnimation::QAbstractClipBlendNode"; isPointer: true }
+ }
+ Signal {
+ name: "additiveClipChanged"
+ Parameter {
+ name: "additiveClip"
+ type: "Qt3DAnimation::QAbstractClipBlendNode"
+ isPointer: true
+ }
+ }
+ Method {
+ name: "setAdditiveFactor"
+ Parameter { name: "additiveFactor"; type: "float" }
+ }
+ Method {
+ name: "setBaseClip"
+ Parameter { name: "baseClip"; type: "Qt3DAnimation::QAbstractClipBlendNode"; isPointer: true }
+ }
+ Method {
+ name: "setAdditiveClip"
+ Parameter {
+ name: "additiveClip"
+ type: "Qt3DAnimation::QAbstractClipBlendNode"
+ isPointer: true
+ }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QAnimationClip"
+ prototype: "Qt3DAnimation::QAbstractAnimationClip"
+ exports: ["Qt3D.Animation/AnimationClip 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "clipData"; type: "Qt3DAnimation::QAnimationClipData" }
+ Signal {
+ name: "clipDataChanged"
+ Parameter { name: "clipData"; type: "Qt3DAnimation::QAnimationClipData" }
+ }
+ Method {
+ name: "setClipData"
+ Parameter { name: "clipData"; type: "Qt3DAnimation::QAnimationClipData" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QAnimationClipLoader"
+ prototype: "Qt3DAnimation::QAbstractAnimationClip"
+ exports: ["Qt3D.Animation/AnimationClipLoader 2.9"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Status"
+ values: {
+ "NotReady": 0,
+ "Ready": 1,
+ "Error": 2
+ }
+ }
+ Property { name: "source"; type: "QUrl" }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Signal {
+ name: "sourceChanged"
+ Parameter { name: "source"; type: "QUrl" }
+ }
+ Signal {
+ name: "statusChanged"
+ Parameter { name: "status"; type: "Status" }
+ }
+ Method {
+ name: "setSource"
+ Parameter { name: "source"; type: "QUrl" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QAnimationController"
+ prototype: "QObject"
+ Property { name: "activeAnimationGroup"; type: "int" }
+ Property { name: "position"; type: "float" }
+ Property { name: "positionScale"; type: "float" }
+ Property { name: "positionOffset"; type: "float" }
+ Property { name: "entity"; type: "Qt3DCore::QEntity"; isPointer: true }
+ Property { name: "recursive"; type: "bool" }
+ Signal {
+ name: "activeAnimationGroupChanged"
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "position"; type: "float" }
+ }
+ Signal {
+ name: "positionScaleChanged"
+ Parameter { name: "scale"; type: "float" }
+ }
+ Signal {
+ name: "positionOffsetChanged"
+ Parameter { name: "offset"; type: "float" }
+ }
+ Signal {
+ name: "entityChanged"
+ Parameter { name: "entity"; type: "Qt3DCore::QEntity"; isPointer: true }
+ }
+ Signal {
+ name: "recursiveChanged"
+ Parameter { name: "recursive"; type: "bool" }
+ }
+ Method {
+ name: "setActiveAnimationGroup"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "setPosition"
+ Parameter { name: "position"; type: "float" }
+ }
+ Method {
+ name: "setPositionScale"
+ Parameter { name: "scale"; type: "float" }
+ }
+ Method {
+ name: "setPositionOffset"
+ Parameter { name: "offset"; type: "float" }
+ }
+ Method {
+ name: "setEntity"
+ Parameter { name: "entity"; type: "Qt3DCore::QEntity"; isPointer: true }
+ }
+ Method {
+ name: "setRecursive"
+ Parameter { name: "recursive"; type: "bool" }
+ }
+ Method {
+ name: "getAnimationIndex"
+ type: "int"
+ Parameter { name: "name"; type: "string" }
+ }
+ Method {
+ name: "getGroup"
+ type: "Qt3DAnimation::QAnimationGroup*"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QAnimationGroup"
+ prototype: "QObject"
+ Property { name: "name"; type: "string" }
+ Property { name: "position"; type: "float" }
+ Property { name: "duration"; type: "float"; isReadonly: true }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "name"; type: "string" }
+ }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "position"; type: "float" }
+ }
+ Signal {
+ name: "durationChanged"
+ Parameter { name: "duration"; type: "float" }
+ }
+ Method {
+ name: "setName"
+ Parameter { name: "name"; type: "string" }
+ }
+ Method {
+ name: "setPosition"
+ Parameter { name: "position"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QBlendedClipAnimator"
+ prototype: "Qt3DAnimation::QAbstractClipAnimator"
+ exports: ["Qt3D.Animation/BlendedClipAnimator 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "blendTree"; type: "Qt3DAnimation::QAbstractClipBlendNode"; isPointer: true }
+ Signal {
+ name: "blendTreeChanged"
+ Parameter { name: "blendTree"; type: "QAbstractClipBlendNode"; isPointer: true }
+ }
+ Method {
+ name: "setBlendTree"
+ Parameter { name: "blendTree"; type: "QAbstractClipBlendNode"; isPointer: true }
+ }
+ }
+ Component { name: "Qt3DAnimation::QChannelMapper"; prototype: "Qt3DCore::QNode" }
+ Component {
+ name: "Qt3DAnimation::QChannelMapping"
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Animation/ChannelMapping 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "channelName"; type: "string" }
+ Property { name: "target"; type: "Qt3DCore::QNode"; isPointer: true }
+ Property { name: "property"; type: "string" }
+ Signal {
+ name: "channelNameChanged"
+ Parameter { name: "channelName"; type: "string" }
+ }
+ Signal {
+ name: "targetChanged"
+ Parameter { name: "target"; type: "Qt3DCore::QNode"; isPointer: true }
+ }
+ Signal {
+ name: "propertyChanged"
+ Parameter { name: "property"; type: "string" }
+ }
+ Method {
+ name: "setChannelName"
+ Parameter { name: "channelName"; type: "string" }
+ }
+ Method {
+ name: "setTarget"
+ Parameter { name: "target"; type: "Qt3DCore::QNode"; isPointer: true }
+ }
+ Method {
+ name: "setProperty"
+ Parameter { name: "property"; type: "string" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QClipAnimator"
+ prototype: "Qt3DAnimation::QAbstractClipAnimator"
+ exports: ["Qt3D.Animation/ClipAnimator 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "clip"; type: "Qt3DAnimation::QAbstractAnimationClip"; isPointer: true }
+ Signal {
+ name: "clipChanged"
+ Parameter { name: "clip"; type: "Qt3DAnimation::QAbstractAnimationClip"; isPointer: true }
+ }
+ Method {
+ name: "setClip"
+ Parameter { name: "clip"; type: "Qt3DAnimation::QAbstractAnimationClip"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QClipBlendValue"
+ prototype: "Qt3DAnimation::QAbstractClipBlendNode"
+ exports: ["Qt3D.Animation/ClipBlendValue 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "clip"; type: "Qt3DAnimation::QAbstractAnimationClip"; isPointer: true }
+ Signal {
+ name: "clipChanged"
+ Parameter { name: "clip"; type: "Qt3DAnimation::QAbstractAnimationClip"; isPointer: true }
+ }
+ Method {
+ name: "setClip"
+ Parameter { name: "clip"; type: "Qt3DAnimation::QAbstractAnimationClip"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QKeyframeAnimation"
+ prototype: "Qt3DAnimation::QAbstractAnimation"
+ Enum {
+ name: "RepeatMode"
+ values: {
+ "None": 0,
+ "Constant": 1,
+ "Repeat": 2
+ }
+ }
+ Property { name: "framePositions"; type: "QVector<float>" }
+ Property { name: "target"; type: "Qt3DCore::QTransform"; isPointer: true }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Property { name: "targetName"; type: "string" }
+ Property { name: "startMode"; type: "QKeyframeAnimation::RepeatMode" }
+ Property { name: "endMode"; type: "QKeyframeAnimation::RepeatMode" }
+ Signal {
+ name: "framePositionsChanged"
+ Parameter { name: "positions"; type: "QVector<float>" }
+ }
+ Signal {
+ name: "targetChanged"
+ Parameter { name: "target"; type: "Qt3DCore::QTransform"; isPointer: true }
+ }
+ Signal {
+ name: "easingChanged"
+ Parameter { name: "easing"; type: "QEasingCurve" }
+ }
+ Signal {
+ name: "targetNameChanged"
+ Parameter { name: "name"; type: "string" }
+ }
+ Signal {
+ name: "startModeChanged"
+ Parameter { name: "startMode"; type: "QKeyframeAnimation::RepeatMode" }
+ }
+ Signal {
+ name: "endModeChanged"
+ Parameter { name: "endMode"; type: "QKeyframeAnimation::RepeatMode" }
+ }
+ Method {
+ name: "setFramePositions"
+ Parameter { name: "positions"; type: "QVector<float>" }
+ }
+ Method {
+ name: "setTarget"
+ Parameter { name: "target"; type: "Qt3DCore::QTransform"; isPointer: true }
+ }
+ Method {
+ name: "setEasing"
+ Parameter { name: "easing"; type: "QEasingCurve" }
+ }
+ Method {
+ name: "setTargetName"
+ Parameter { name: "name"; type: "string" }
+ }
+ Method {
+ name: "setStartMode"
+ Parameter { name: "mode"; type: "RepeatMode" }
+ }
+ Method {
+ name: "setEndMode"
+ Parameter { name: "mode"; type: "RepeatMode" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QLerpClipBlend"
+ prototype: "Qt3DAnimation::QAbstractClipBlendNode"
+ exports: ["Qt3D.Animation/LerpClipBlend 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "startClip"; type: "Qt3DAnimation::QAbstractClipBlendNode"; isPointer: true }
+ Property { name: "endClip"; type: "Qt3DAnimation::QAbstractClipBlendNode"; isPointer: true }
+ Property { name: "blendFactor"; type: "float" }
+ Signal {
+ name: "blendFactorChanged"
+ Parameter { name: "blendFactor"; type: "float" }
+ }
+ Signal {
+ name: "startClipChanged"
+ Parameter { name: "startClip"; type: "Qt3DAnimation::QAbstractClipBlendNode"; isPointer: true }
+ }
+ Signal {
+ name: "endClipChanged"
+ Parameter { name: "endClip"; type: "Qt3DAnimation::QAbstractClipBlendNode"; isPointer: true }
+ }
+ Method {
+ name: "setBlendFactor"
+ Parameter { name: "blendFactor"; type: "float" }
+ }
+ Method {
+ name: "setStartClip"
+ Parameter { name: "startClip"; type: "Qt3DAnimation::QAbstractClipBlendNode"; isPointer: true }
+ }
+ Method {
+ name: "setEndClip"
+ Parameter { name: "endClip"; type: "Qt3DAnimation::QAbstractClipBlendNode"; isPointer: true }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QMorphTarget"
+ prototype: "QObject"
+ Property { name: "attributeNames"; type: "QStringList"; isReadonly: true }
+ Signal {
+ name: "attributeNamesChanged"
+ Parameter { name: "attributeNames"; type: "QStringList" }
+ }
+ Method {
+ name: "fromGeometry"
+ type: "QMorphTarget*"
+ Parameter { name: "geometry"; type: "Qt3DRender::QGeometry"; isPointer: true }
+ Parameter { name: "attributes"; type: "QStringList" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::QMorphingAnimation"
+ prototype: "Qt3DAnimation::QAbstractAnimation"
+ Enum {
+ name: "Method"
+ values: {
+ "Normalized": 0,
+ "Relative": 1
+ }
+ }
+ Property { name: "targetPositions"; type: "QVector<float>" }
+ Property { name: "interpolator"; type: "float"; isReadonly: true }
+ Property { name: "target"; type: "Qt3DRender::QGeometryRenderer"; isPointer: true }
+ Property { name: "targetName"; type: "string" }
+ Property { name: "method"; type: "QMorphingAnimation::Method" }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Signal {
+ name: "targetPositionsChanged"
+ Parameter { name: "targetPositions"; type: "QVector<float>" }
+ }
+ Signal {
+ name: "interpolatorChanged"
+ Parameter { name: "interpolator"; type: "float" }
+ }
+ Signal {
+ name: "targetChanged"
+ Parameter { name: "target"; type: "Qt3DRender::QGeometryRenderer"; isPointer: true }
+ }
+ Signal {
+ name: "targetNameChanged"
+ Parameter { name: "name"; type: "string" }
+ }
+ Signal {
+ name: "methodChanged"
+ Parameter { name: "method"; type: "QMorphingAnimation::Method" }
+ }
+ Signal {
+ name: "easingChanged"
+ Parameter { name: "easing"; type: "QEasingCurve" }
+ }
+ Method {
+ name: "setTargetPositions"
+ Parameter { name: "targetPositions"; type: "QVector<float>" }
+ }
+ Method {
+ name: "setTarget"
+ Parameter { name: "target"; type: "Qt3DRender::QGeometryRenderer"; isPointer: true }
+ }
+ Method {
+ name: "setTargetName"
+ Parameter { name: "name"; type: "string" }
+ }
+ Method {
+ name: "setMethod"
+ Parameter { name: "method"; type: "QMorphingAnimation::Method" }
+ }
+ Method {
+ name: "setEasing"
+ Parameter { name: "easing"; type: "QEasingCurve" }
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::Quick::QQuick3DAnimationController"
+ prototype: "Qt3DAnimation::QAnimationController"
+ exports: ["Qt3D.Animation/AnimationController 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property {
+ name: "animationGroups"
+ type: "Qt3DAnimation::QAnimationGroup"
+ isList: true
+ isReadonly: true
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::Quick::QQuick3DAnimationGroup"
+ prototype: "Qt3DAnimation::QAnimationGroup"
+ exports: ["Qt3D.Animation/AnimationGroup 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property {
+ name: "animations"
+ type: "Qt3DAnimation::QAbstractAnimation"
+ isList: true
+ isReadonly: true
+ }
+ }
+ Component {
+ name: "Qt3DAnimation::Quick::QQuick3DKeyframeAnimation"
+ prototype: "Qt3DAnimation::QKeyframeAnimation"
+ exports: ["Qt3D.Animation/KeyframeAnimation 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "keyframes"; type: "Qt3DCore::QTransform"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DAnimation::Quick::QQuick3DMorphTarget"
+ prototype: "Qt3DAnimation::QMorphTarget"
+ exports: ["Qt3D.Animation/MorphTarget 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "attributes"; type: "Qt3DRender::QAttribute"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "Qt3DAnimation::Quick::QQuick3DMorphingAnimation"
+ prototype: "Qt3DAnimation::QMorphingAnimation"
+ exports: ["Qt3D.Animation/MorphingAnimation 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property {
+ name: "morphTargets"
+ type: "Qt3DAnimation::QMorphTarget"
+ isList: true
+ isReadonly: true
+ }
+ }
+ Component {
+ name: "Qt3DCore::QComponent"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "isShareable"; type: "bool" }
+ Signal {
+ name: "shareableChanged"
+ Parameter { name: "isShareable"; type: "bool" }
+ }
+ Signal {
+ name: "addedToEntity"
+ Parameter { name: "entity"; type: "QEntity"; isPointer: true }
+ }
+ Signal {
+ name: "removedFromEntity"
+ Parameter { name: "entity"; type: "QEntity"; isPointer: true }
+ }
+ Method {
+ name: "setShareable"
+ Parameter { name: "isShareable"; type: "bool" }
+ }
+ }
+ Component {
+ name: "Qt3DCore::QNode"
+ prototype: "QObject"
+ Enum {
+ name: "PropertyTrackingMode"
+ values: {
+ "TrackFinalValues": 0,
+ "DontTrackValues": 1,
+ "TrackAllValues": 2
+ }
+ }
+ Property { name: "parent"; type: "Qt3DCore::QNode"; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "defaultPropertyTrackingMode"; revision: 9; type: "PropertyTrackingMode" }
+ Signal {
+ name: "parentChanged"
+ Parameter { name: "parent"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "enabledChanged"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Signal {
+ name: "defaultPropertyTrackingModeChanged"
+ Parameter { name: "mode"; type: "PropertyTrackingMode" }
+ }
+ Signal { name: "nodeDestroyed" }
+ Method {
+ name: "setParent"
+ Parameter { name: "parent"; type: "QNode"; isPointer: true }
+ }
+ Method {
+ name: "setEnabled"
+ Parameter { name: "isEnabled"; type: "bool" }
+ }
+ Method {
+ name: "setDefaultPropertyTrackingMode"
+ Parameter { name: "mode"; type: "PropertyTrackingMode" }
+ }
+ }
+}
diff --git a/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp b/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp
index 87c137763..7feeaf84c 100644
--- a/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp
+++ b/src/quick3d/imports/animation/qt3dquick3danimationplugin.cpp
@@ -55,6 +55,7 @@
#include <Qt3DAnimation/qmorphinganimation.h>
#include <Qt3DAnimation/qanimationgroup.h>
#include <Qt3DAnimation/qmorphtarget.h>
+#include <Qt3DAnimation/qvertexblendanimation.h>
#include <Qt3DQuickAnimation/private/qt3dquickanimation_global_p.h>
#include <Qt3DQuickAnimation/private/quick3dchannelmapper_p.h>
@@ -63,6 +64,7 @@
#include <Qt3DQuickAnimation/private/quick3danimationcontroller_p.h>
#include <Qt3DQuickAnimation/private/quick3dmorphtarget_p.h>
#include <Qt3DQuickAnimation/private/quick3dmorphinganimation_p.h>
+#include <Qt3DQuickAnimation/private/quick3dvertexblendanimation_p.h>
QT_BEGIN_NAMESPACE
@@ -92,6 +94,7 @@ void Qt3DQuick3DAnimationPlugin::registerTypes(const char *uri)
qmlRegisterExtendedType<Qt3DAnimation::QAnimationController, Qt3DAnimation::Quick::QQuick3DAnimationController>(uri, 2, 9, "AnimationController");
qmlRegisterExtendedType<Qt3DAnimation::QMorphingAnimation, Qt3DAnimation::Quick::QQuick3DMorphingAnimation>(uri, 2, 9, "MorphingAnimation");
qmlRegisterExtendedType<Qt3DAnimation::QMorphTarget, Qt3DAnimation::Quick::QQuick3DMorphTarget>(uri, 2, 9, "MorphTarget");
+ qmlRegisterExtendedType<Qt3DAnimation::QVertexBlendAnimation, Qt3DAnimation::Quick::QQuick3DVertexBlendAnimation>(uri, 2, 9, "VertexBlendAnimation");
}
QT_END_NAMESPACE
diff --git a/src/quick3d/imports/core/plugins.qmltypes b/src/quick3d/imports/core/plugins.qmltypes
index ed06f8e0c..87cdac04c 100644
--- a/src/quick3d/imports/core/plugins.qmltypes
+++ b/src/quick3d/imports/core/plugins.qmltypes
@@ -4,29 +4,41 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt3D.Core 2.0'
+// 'qmlplugindump -nonrelocatable Qt3D.Core 2.9'
Module {
- dependencies: ["QtQuick 2.7"]
+ dependencies: ["QtQuick 2.8"]
Component {
name: "Qt3DCore::QComponent"
- prototype: "Qt3DCore::QNode"
- Property { name: "isShareable"; type: "bool" }
+ defaultProperty: "data"
+ prototype: "Qt3DCore::QComponent"
+ Property { name: "propertyTrackingOverrides"; type: "QJSValue" }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
Signal {
- name: "shareableChanged"
- Parameter { name: "isShareable"; type: "bool" }
+ name: "propertyTrackingOverridesChanged"
+ Parameter { name: "value"; type: "QJSValue" }
}
- Method {
- name: "setShareable"
- Parameter { name: "isShareable"; type: "bool" }
+ Signal {
+ name: "propertyTrackingOverridesChanged"
+ Parameter { name: "value"; type: "QJSValue" }
}
}
Component { name: "Qt3DCore::QEntity"; prototype: "Qt3DCore::QNode" }
Component {
name: "Qt3DCore::QNode"
prototype: "QObject"
+ Enum {
+ name: "PropertyTrackingMode"
+ values: {
+ "TrackFinalValues": 0,
+ "DontTrackValues": 1,
+ "TrackAllValues": 2
+ }
+ }
Property { name: "parent"; type: "Qt3DCore::QNode"; isPointer: true }
Property { name: "enabled"; type: "bool" }
+ Property { name: "defaultPropertyTrackingMode"; revision: 9; type: "PropertyTrackingMode" }
Signal {
name: "parentChanged"
Parameter { name: "parent"; type: "QObject"; isPointer: true }
@@ -35,6 +47,10 @@ Module {
name: "enabledChanged"
Parameter { name: "enabled"; type: "bool" }
}
+ Signal {
+ name: "defaultPropertyTrackingModeChanged"
+ Parameter { name: "mode"; type: "PropertyTrackingMode" }
+ }
Signal { name: "nodeDestroyed" }
Method {
name: "setParent"
@@ -44,11 +60,14 @@ Module {
name: "setEnabled"
Parameter { name: "isEnabled"; type: "bool" }
}
+ Method {
+ name: "setDefaultPropertyTrackingMode"
+ Parameter { name: "mode"; type: "PropertyTrackingMode" }
+ }
}
Component {
name: "Qt3DCore::QTransform"
prototype: "Qt3DCore::QComponent"
- exports: ["Qt3D.Core/Transform 2.0"]
Property { name: "matrix"; type: "QMatrix4x4" }
Property { name: "scale"; type: "float" }
Property { name: "scale3D"; type: "QVector3D" }
@@ -230,10 +249,8 @@ Module {
Component {
name: "Qt3DCore::Quick::Quick3DEntityLoader"
defaultProperty: "data"
- prototype: "Qt3DCore::QEntity"
- exports: ["Qt3D.Core/EntityLoader 2.0"]
- Property { name: "entity"; type: "Qt3DCore::QEntity"; isPointer: true; isReadonly: true }
- Property { name: "source"; type: "QUrl" }
+ prototype: "Qt3DCore::Quick::Quick3DEntityLoader"
+ Property { name: "components"; type: "Qt3DCore::QComponent"; isList: true; isReadonly: true }
}
Component {
name: "Qt3DCore::Quick::Quick3DNode"
@@ -248,13 +265,36 @@ Module {
Component {
name: "Qt3DCore::Quick::Quick3DNodeInstantiator"
defaultProperty: "delegate"
+ prototype: "Qt3DCore::Quick::Quick3DNodeInstantiator"
+ Property { name: "propertyTrackingOverrides"; type: "QJSValue" }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ Signal {
+ name: "propertyTrackingOverridesChanged"
+ Parameter { name: "value"; type: "QJSValue" }
+ }
+ Signal {
+ name: "propertyTrackingOverridesChanged"
+ Parameter { name: "value"; type: "QJSValue" }
+ }
+ }
+ Component {
+ name: "Qt3DCore::Quick::Quick3DNodeV9"
+ defaultProperty: "data"
prototype: "Qt3DCore::QNode"
- exports: ["Qt3D.Core/NodeInstantiator 2.0"]
- Property { name: "active"; type: "bool" }
- Property { name: "asynchronous"; type: "bool" }
- Property { name: "model"; type: "QVariant" }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "delegate"; type: "QQmlComponent" }
- Property { name: "object"; type: "QObject"; isReadonly: true }
+ exports: ["Qt3D.Core/Node 2.9"]
+ isCreatable: false
+ exportMetaObjectRevisions: [9]
+ Property { name: "propertyTrackingOverrides"; type: "QJSValue" }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ Signal {
+ name: "propertyTrackingOverridesChanged"
+ Parameter { name: "value"; type: "QJSValue" }
+ }
+ Signal {
+ name: "propertyTrackingOverridesChanged"
+ Parameter { name: "value"; type: "QJSValue" }
+ }
}
}
diff --git a/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp b/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp
index 6d2a78166..3ff63d9d9 100644
--- a/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp
+++ b/src/quick3d/imports/core/qt3dquick3dcoreplugin.cpp
@@ -71,4 +71,9 @@ void Qt3DQuick3DCorePlugin::registerTypes(const char *uri)
qmlRegisterExtendedUncreatableType<Qt3DCore::QNode, Qt3DCore::Quick::Quick3DNodeV9, 9>(uri, 2, 9, "Node", QStringLiteral("Node is a base class"));
}
+Qt3DQuick3DCorePlugin::~Qt3DQuick3DCorePlugin()
+{
+ Qt3DCore::Quick::Quick3D_uninitialize();
+}
+
QT_END_NAMESPACE
diff --git a/src/quick3d/imports/core/qt3dquick3dcoreplugin.h b/src/quick3d/imports/core/qt3dquick3dcoreplugin.h
index a9b215c4a..b0ef5947c 100644
--- a/src/quick3d/imports/core/qt3dquick3dcoreplugin.h
+++ b/src/quick3d/imports/core/qt3dquick3dcoreplugin.h
@@ -57,6 +57,7 @@ class Qt3DQuick3DCorePlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
Qt3DQuick3DCorePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); }
+ ~Qt3DQuick3DCorePlugin();
void registerTypes(const char *uri) Q_DECL_OVERRIDE;
};
diff --git a/src/quick3d/imports/extras/plugins.qmltypes b/src/quick3d/imports/extras/plugins.qmltypes
index cbe12c9ad..a623f385c 100644
--- a/src/quick3d/imports/extras/plugins.qmltypes
+++ b/src/quick3d/imports/extras/plugins.qmltypes
@@ -4,68 +4,30 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt3D.Extras 2.0'
+// 'qmlplugindump -nonrelocatable Qt3D.Extras 2.9'
Module {
- dependencies: []
- Component {
- name: "Qt3DCore::QComponent"
- prototype: "Qt3DCore::QNode"
- Property { name: "isShareable"; type: "bool" }
- Signal {
- name: "shareableChanged"
- Parameter { name: "isShareable"; type: "bool" }
- }
- Signal {
- name: "addedToEntity"
- Parameter { name: "entity"; type: "QEntity"; isPointer: true }
- }
- Signal {
- name: "removedFromEntity"
- Parameter { name: "entity"; type: "QEntity"; isPointer: true }
- }
- Method {
- name: "setShareable"
- Parameter { name: "isShareable"; type: "bool" }
- }
- }
+ dependencies: ["Qt3D.Logic 2.0"]
Component { name: "Qt3DCore::QEntity"; prototype: "Qt3DCore::QNode" }
Component {
- name: "Qt3DCore::QNode"
- prototype: "QObject"
- Property { name: "parent"; type: "Qt3DCore::QNode"; isPointer: true }
- Property { name: "enabled"; type: "bool" }
- Signal {
- name: "parentChanged"
- Parameter { name: "parent"; type: "QObject"; isPointer: true }
- }
- Signal {
- name: "enabledChanged"
- Parameter { name: "enabled"; type: "bool" }
- }
- Signal { name: "nodeDestroyed" }
- Method {
- name: "setParent"
- Parameter { name: "parent"; type: "QNode"; isPointer: true }
- }
- Method {
- name: "setEnabled"
- Parameter { name: "isEnabled"; type: "bool" }
- }
- }
- Component {
name: "Qt3DExtras::Extras::Quick::Quick3DLevelOfDetailLoader"
prototype: "Qt3DCore::QEntity"
- exports: ["Qt3D.Extras/LevelOfDetailLoader 2.2"]
+ exports: ["Qt3D.Extras/LevelOfDetailLoader 2.9"]
exportMetaObjectRevisions: [0]
Property { name: "sources"; type: "QVariantList" }
Property { name: "camera"; type: "Qt3DRender::QCamera"; isPointer: true }
Property { name: "currentIndex"; type: "int" }
Property { name: "thresholdType"; type: "Qt3DRender::QLevelOfDetail::ThresholdType" }
Property { name: "thresholds"; type: "QVector<qreal>" }
- Property { name: "volumeOverride"; type: "Qt3DRender::QBoundingSphere"; isPointer: true }
+ Property { name: "volumeOverride"; type: "Qt3DRender::QLevelOfDetailBoundingSphere" }
Property { name: "entity"; type: "QObject"; isReadonly: true; isPointer: true }
Property { name: "source"; type: "QUrl"; isReadonly: true }
+ Method {
+ name: "createBoundingSphere"
+ type: "Qt3DRender::QLevelOfDetailBoundingSphere"
+ Parameter { name: "center"; type: "QVector3D" }
+ Parameter { name: "radius"; type: "float" }
+ }
}
Component {
name: "Qt3DExtras::QConeGeometry"
@@ -590,6 +552,90 @@ Module {
}
}
Component {
+ name: "Qt3DExtras::QExtrudedTextGeometry"
+ prototype: "Qt3DRender::QGeometry"
+ exports: ["Qt3D.Extras/ExtrudedTextGeometry 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "extrusionLength"; type: "float" }
+ Property {
+ name: "positionAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "normalAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Property {
+ name: "indexAttribute"
+ type: "Qt3DRender::QAttribute"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal {
+ name: "textChanged"
+ Parameter { name: "text"; type: "string" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "depthChanged"
+ Parameter { name: "extrusionLength"; type: "float" }
+ }
+ Method {
+ name: "setText"
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "setFont"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Method {
+ name: "setDepth"
+ Parameter { name: "extrusionLength"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DExtras::QExtrudedTextMesh"
+ prototype: "Qt3DRender::QGeometryRenderer"
+ exports: ["Qt3D.Extras/ExtrudedTextMesh 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "depth"; type: "float" }
+ Signal {
+ name: "textChanged"
+ Parameter { name: "text"; type: "string" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "depthChanged"
+ Parameter { name: "depth"; type: "float" }
+ }
+ Method {
+ name: "setText"
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "setFont"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Method {
+ name: "setDepth"
+ Parameter { name: "depth"; type: "float" }
+ }
+ }
+ Component {
name: "Qt3DExtras::QFirstPersonCameraController"
prototype: "Qt3DCore::QEntity"
exports: ["Qt3D.Extras/FirstPersonCameraController 2.0"]
@@ -599,6 +645,14 @@ Module {
Property { name: "lookSpeed"; type: "float" }
Property { name: "acceleration"; type: "float" }
Property { name: "deceleration"; type: "float" }
+ Signal {
+ name: "accelerationChanged"
+ Parameter { name: "acceleration"; type: "float" }
+ }
+ Signal {
+ name: "decelerationChanged"
+ Parameter { name: "deceleration"; type: "float" }
+ }
}
Component {
name: "Qt3DExtras::QForwardRenderer"
@@ -612,6 +666,7 @@ Module {
Property { name: "camera"; type: "Qt3DCore::QEntity"; isPointer: true }
Property { name: "externalRenderTargetSize"; type: "QSize" }
Property { name: "frustumCulling"; type: "bool" }
+ Property { name: "gamma"; revision: 9; type: "float" }
Signal {
name: "viewportRectChanged"
Parameter { name: "viewportRect"; type: "QRectF" }
@@ -636,6 +691,10 @@ Module {
name: "frustumCullingEnabledChanged"
Parameter { name: "enabled"; type: "bool" }
}
+ Signal {
+ name: "gammaChanged"
+ Parameter { name: "gamma"; type: "float" }
+ }
Method {
name: "setViewportRect"
Parameter { name: "viewportRect"; type: "QRectF" }
@@ -660,6 +719,10 @@ Module {
name: "setFrustumCullingEnabled"
Parameter { name: "enabled"; type: "bool" }
}
+ Method {
+ name: "setGamma"
+ Parameter { name: "gamma"; type: "float" }
+ }
}
Component {
name: "Qt3DExtras::QGoochMaterial"
@@ -733,18 +796,11 @@ Module {
Component {
name: "Qt3DExtras::QMetalRoughMaterial"
prototype: "Qt3DRender::QMaterial"
- exports: ["Qt3D.Extras/MetalRoughMaterial 2.2"]
+ exports: ["Qt3D.Extras/MetalRoughMaterial 2.9"]
exportMetaObjectRevisions: [0]
Property { name: "baseColor"; type: "QColor" }
Property { name: "metalness"; type: "float" }
Property { name: "roughness"; type: "float" }
- Property {
- name: "environmentIrradiance"
- type: "Qt3DRender::QAbstractTexture"
- isPointer: true
- }
- Property { name: "environmentSpecular"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
- Property { name: "exposure"; type: "float" }
Signal {
name: "baseColorChanged"
Parameter { name: "baseColor"; type: "QColor" }
@@ -757,22 +813,6 @@ Module {
name: "roughnessChanged"
Parameter { name: "roughness"; type: "float" }
}
- Signal {
- name: "environmentIrradianceChanged"
- Parameter {
- name: "environmentIrradiance"
- type: "Qt3DRender::QAbstractTexture"
- isPointer: true
- }
- }
- Signal {
- name: "environmentSpecularChanged"
- Parameter { name: "environmentSpecular"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
- }
- Signal {
- name: "exposureChanged"
- Parameter { name: "exposure"; type: "float" }
- }
Method {
name: "setBaseColor"
Parameter { name: "baseColor"; type: "QColor" }
@@ -785,21 +825,56 @@ Module {
name: "setRoughness"
Parameter { name: "roughness"; type: "float" }
}
+ }
+ Component {
+ name: "Qt3DExtras::QMorphPhongMaterial"
+ prototype: "Qt3DRender::QMaterial"
+ exports: ["Qt3D.Extras/MorphPhongMaterial 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "ambient"; type: "QColor" }
+ Property { name: "diffuse"; type: "QColor" }
+ Property { name: "specular"; type: "QColor" }
+ Property { name: "shininess"; type: "float" }
+ Property { name: "interpolator"; type: "float" }
+ Signal {
+ name: "ambientChanged"
+ Parameter { name: "ambient"; type: "QColor" }
+ }
+ Signal {
+ name: "diffuseChanged"
+ Parameter { name: "diffuse"; type: "QColor" }
+ }
+ Signal {
+ name: "specularChanged"
+ Parameter { name: "specular"; type: "QColor" }
+ }
+ Signal {
+ name: "shininessChanged"
+ Parameter { name: "shininess"; type: "float" }
+ }
+ Signal {
+ name: "interpolatorChanged"
+ Parameter { name: "interpolator"; type: "float" }
+ }
Method {
- name: "setEnvironmentIrradiance"
- Parameter {
- name: "environmentIrradiance"
- type: "Qt3DRender::QAbstractTexture"
- isPointer: true
- }
+ name: "setAmbient"
+ Parameter { name: "ambient"; type: "QColor" }
+ }
+ Method {
+ name: "setDiffuse"
+ Parameter { name: "diffuse"; type: "QColor" }
}
Method {
- name: "setEnvironmentSpecular"
- Parameter { name: "environmentSpecular"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
+ name: "setSpecular"
+ Parameter { name: "specular"; type: "QColor" }
}
Method {
- name: "setExposure"
- Parameter { name: "exposure"; type: "float" }
+ name: "setShininess"
+ Parameter { name: "shininess"; type: "float" }
+ }
+ Method {
+ name: "setInterpolator"
+ Parameter { name: "interpolator"; type: "float" }
}
}
Component {
@@ -1194,6 +1269,7 @@ Module {
exportMetaObjectRevisions: [0]
Property { name: "baseName"; type: "string" }
Property { name: "extension"; type: "string" }
+ Property { name: "gammaCorrect"; revision: 9; type: "bool" }
Signal {
name: "baseNameChanged"
Parameter { name: "path"; type: "string" }
@@ -1202,6 +1278,22 @@ Module {
name: "extensionChanged"
Parameter { name: "extension"; type: "string" }
}
+ Signal {
+ name: "gammaCorrectEnabledChanged"
+ Parameter { name: "enabled"; type: "bool" }
+ }
+ Method {
+ name: "setBaseName"
+ Parameter { name: "path"; type: "string" }
+ }
+ Method {
+ name: "setExtension"
+ Parameter { name: "extension"; type: "string" }
+ }
+ Method {
+ name: "setGammaCorrectEnabled"
+ Parameter { name: "enabled"; type: "bool" }
+ }
}
Component {
name: "Qt3DExtras::QSphereGeometry"
@@ -1318,105 +1410,34 @@ Module {
}
}
Component {
- name: "Qt3DExtras::QText3DGeometry"
- prototype: "Qt3DRender::QGeometry"
- exports: ["Qt3D.Extras/Text3DGeometry 2.2"]
+ name: "Qt3DExtras::QText2DEntity"
+ prototype: "Qt3DCore::QEntity"
+ exports: ["Qt3D.Extras/Text2DEntity 2.9"]
exportMetaObjectRevisions: [0]
- Property { name: "text"; type: "string" }
Property { name: "font"; type: "QFont" }
- Property { name: "depth"; type: "float" }
- Property { name: "edgeSplitAngle"; type: "float" }
- Property {
- name: "positionAttribute"
- type: "Qt3DRender::QAttribute"
- isReadonly: true
- isPointer: true
- }
- Property {
- name: "normalAttribute"
- type: "Qt3DRender::QAttribute"
- isReadonly: true
- isPointer: true
- }
- Property {
- name: "indexAttribute"
- type: "Qt3DRender::QAttribute"
- isReadonly: true
- isPointer: true
- }
- Signal {
- name: "textChanged"
- Parameter { name: "text"; type: "string" }
- }
+ Property { name: "text"; type: "string" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "width"; type: "float" }
+ Property { name: "height"; type: "float" }
Signal {
name: "fontChanged"
Parameter { name: "font"; type: "QFont" }
}
Signal {
- name: "depthChanged"
- Parameter { name: "depth"; type: "float" }
- }
- Signal {
- name: "edgeSplitAngleChanged"
- Parameter { name: "edgeSplitAngle"; type: "float" }
- }
- Method {
- name: "setText"
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "setFont"
- Parameter { name: "font"; type: "QFont" }
- }
- Method {
- name: "setDepth"
- Parameter { name: "depth"; type: "float" }
- }
- Method {
- name: "setEdgeSplitAngle"
- Parameter { name: "edgeSplitAngle"; type: "float" }
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
}
- }
- Component {
- name: "Qt3DExtras::QText3DMesh"
- prototype: "Qt3DRender::QGeometryRenderer"
- exports: ["Qt3D.Extras/Text3DMesh 2.2"]
- exportMetaObjectRevisions: [0]
- Property { name: "text"; type: "string" }
- Property { name: "font"; type: "QFont" }
- Property { name: "depth"; type: "float" }
- Property { name: "edgeSplitAngle"; type: "float" }
Signal {
name: "textChanged"
Parameter { name: "text"; type: "string" }
}
Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "depthChanged"
- Parameter { name: "depth"; type: "float" }
+ name: "widthChanged"
+ Parameter { name: "width"; type: "float" }
}
Signal {
- name: "edgeSplitAngleChanged"
- Parameter { name: "edgeSplitAngle"; type: "float" }
- }
- Method {
- name: "setText"
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "setFont"
- Parameter { name: "font"; type: "QFont" }
- }
- Method {
- name: "setDepth"
- Parameter { name: "depth"; type: "float" }
- }
- Method {
- name: "setEdgeSplitAngle"
- Parameter { name: "edgeSplitAngle"; type: "float" }
+ name: "heightChanged"
+ Parameter { name: "height"; type: "float" }
}
}
Component {
@@ -1446,20 +1467,13 @@ Module {
Component {
name: "Qt3DExtras::QTexturedMetalRoughMaterial"
prototype: "Qt3DRender::QMaterial"
- exports: ["Qt3D.Extras/TexturedMetalRoughMaterial 2.2"]
+ exports: ["Qt3D.Extras/TexturedMetalRoughMaterial 2.9"]
exportMetaObjectRevisions: [0]
Property { name: "baseColor"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
Property { name: "metalness"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
Property { name: "roughness"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
Property { name: "ambientOcclusion"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
Property { name: "normal"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
- Property {
- name: "environmentIrradiance"
- type: "Qt3DRender::QAbstractTexture"
- isPointer: true
- }
- Property { name: "environmentSpecular"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
- Property { name: "exposure"; type: "float" }
Signal {
name: "baseColorChanged"
Parameter { name: "baseColor"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
@@ -1480,22 +1494,6 @@ Module {
name: "normalChanged"
Parameter { name: "normal"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
}
- Signal {
- name: "environmentIrradianceChanged"
- Parameter {
- name: "environmentIrradiance"
- type: "Qt3DRender::QAbstractTexture"
- isPointer: true
- }
- }
- Signal {
- name: "environmentSpecularChanged"
- Parameter { name: "environmentSpecular"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
- }
- Signal {
- name: "exposureChanged"
- Parameter { name: "exposure"; type: "float" }
- }
Method {
name: "setBaseColor"
Parameter { name: "baseColor"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
@@ -1516,22 +1514,6 @@ Module {
name: "setNormal"
Parameter { name: "normal"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
}
- Method {
- name: "setEnvironmentIrradiance"
- Parameter {
- name: "environmentIrradiance"
- type: "Qt3DRender::QAbstractTexture"
- isPointer: true
- }
- }
- Method {
- name: "setEnvironmentSpecular"
- Parameter { name: "environmentSpecular"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
- }
- Method {
- name: "setExposure"
- Parameter { name: "exposure"; type: "float" }
- }
}
Component {
name: "Qt3DExtras::QTorusGeometry"
diff --git a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
index 647eb003b..879b79294 100644
--- a/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
+++ b/src/quick3d/imports/extras/qt3dquick3dextrasplugin.cpp
@@ -116,7 +116,9 @@ void Qt3DQuick3DExtrasPlugin::registerTypes(const char *uri)
qmlRegisterType<Qt3DExtras::QCylinderMesh>(uri, 2, 0, "CylinderMesh");
qmlRegisterType<Qt3DExtras::QCylinderGeometry>(uri, 2, 0, "CylinderGeometry");
qmlRegisterType<Qt3DExtras::QPlaneMesh>(uri, 2, 0, "PlaneMesh");
+ qmlRegisterRevision<Qt3DExtras::QPlaneMesh, 9>(uri, 2, 9);
qmlRegisterType<Qt3DExtras::QPlaneGeometry>(uri, 2, 0, "PlaneGeometry");
+ qmlRegisterRevision<Qt3DExtras::QPlaneGeometry, 9>(uri, 2, 9);
qmlRegisterType<Qt3DExtras::QTorusMesh>(uri, 2, 0, "TorusMesh");
qmlRegisterType<Qt3DExtras::QTorusGeometry>(uri, 2, 0, "TorusGeometry");
qmlRegisterType<Qt3DExtras::QSphereMesh>(uri, 2, 0, "SphereMesh");
diff --git a/src/quick3d/imports/input/plugins.qmltypes b/src/quick3d/imports/input/plugins.qmltypes
index 860ab4d68..24655977e 100644
--- a/src/quick3d/imports/input/plugins.qmltypes
+++ b/src/quick3d/imports/input/plugins.qmltypes
@@ -4,10 +4,10 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt3D.Input 2.0'
+// 'qmlplugindump -nonrelocatable Qt3D.Input 2.1'
Module {
- dependencies: ["QtQuick 2.7"]
+ dependencies: ["QtQuick 2.8"]
Component {
name: "Qt3DCore::QComponent"
prototype: "Qt3DCore::QNode"
@@ -16,6 +16,14 @@ Module {
name: "shareableChanged"
Parameter { name: "isShareable"; type: "bool" }
}
+ Signal {
+ name: "addedToEntity"
+ Parameter { name: "entity"; type: "QEntity"; isPointer: true }
+ }
+ Signal {
+ name: "removedFromEntity"
+ Parameter { name: "entity"; type: "QEntity"; isPointer: true }
+ }
Method {
name: "setShareable"
Parameter { name: "isShareable"; type: "bool" }
@@ -24,8 +32,17 @@ Module {
Component {
name: "Qt3DCore::QNode"
prototype: "QObject"
+ Enum {
+ name: "PropertyTrackingMode"
+ values: {
+ "TrackFinalValues": 0,
+ "DontTrackValues": 1,
+ "TrackAllValues": 2
+ }
+ }
Property { name: "parent"; type: "Qt3DCore::QNode"; isPointer: true }
Property { name: "enabled"; type: "bool" }
+ Property { name: "defaultPropertyTrackingMode"; revision: 9; type: "PropertyTrackingMode" }
Signal {
name: "parentChanged"
Parameter { name: "parent"; type: "QObject"; isPointer: true }
@@ -34,6 +51,10 @@ Module {
name: "enabledChanged"
Parameter { name: "enabled"; type: "bool" }
}
+ Signal {
+ name: "defaultPropertyTrackingModeChanged"
+ Parameter { name: "mode"; type: "PropertyTrackingMode" }
+ }
Signal { name: "nodeDestroyed" }
Method {
name: "setParent"
@@ -43,6 +64,10 @@ Module {
name: "setEnabled"
Parameter { name: "isEnabled"; type: "bool" }
}
+ Method {
+ name: "setDefaultPropertyTrackingMode"
+ Parameter { name: "mode"; type: "PropertyTrackingMode" }
+ }
}
Component {
name: "Qt3DInput::Input::Quick::Quick3DAction"
@@ -101,6 +126,7 @@ Module {
name: "Qt3DInput::Input::Quick::Quick3DPhysicalDevice"
prototype: "Qt3DInput::QAbstractPhysicalDevice"
exports: ["Qt3D.Input/QAbstractPhysicalDevice 2.0"]
+ isCreatable: false
exportMetaObjectRevisions: [0]
Property { name: "axisSettings"; type: "Qt3DInput::QAxisSetting"; isList: true; isReadonly: true }
}
@@ -186,6 +212,56 @@ Module {
}
}
Component {
+ name: "Qt3DInput::QAxisAccumulator"
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Input/AxisAccumulator 2.1"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "SourceAxisType"
+ values: {
+ "Velocity": 0,
+ "Acceleration": 1
+ }
+ }
+ Property { name: "sourceAxis"; type: "Qt3DInput::QAxis"; isPointer: true }
+ Property { name: "sourceAxisType"; type: "SourceAxisType" }
+ Property { name: "scale"; type: "float" }
+ Property { name: "value"; type: "float"; isReadonly: true }
+ Property { name: "velocity"; type: "float"; isReadonly: true }
+ Signal {
+ name: "sourceAxisChanged"
+ Parameter { name: "sourceAxis"; type: "Qt3DInput::QAxis"; isPointer: true }
+ }
+ Signal {
+ name: "sourceAxisTypeChanged"
+ Parameter { name: "sourceAxisType"; type: "QAxisAccumulator::SourceAxisType" }
+ }
+ Signal {
+ name: "valueChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ Signal {
+ name: "velocityChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ Signal {
+ name: "scaleChanged"
+ Parameter { name: "scale"; type: "float" }
+ }
+ Method {
+ name: "setSourceAxis"
+ Parameter { name: "sourceAxis"; type: "Qt3DInput::QAxis"; isPointer: true }
+ }
+ Method {
+ name: "setSourceAxisType"
+ Parameter { name: "sourceAxisType"; type: "QAxisAccumulator::SourceAxisType" }
+ }
+ Method {
+ name: "setScale"
+ Parameter { name: "scale"; type: "float" }
+ }
+ }
+ Component {
name: "Qt3DInput::QAxisSetting"
prototype: "Qt3DCore::QNode"
exports: ["Qt3D.Input/AxisSetting 2.0"]
@@ -337,7 +413,6 @@ Module {
Component {
name: "Qt3DInput::QKeyboardDevice"
prototype: "Qt3DInput::QAbstractPhysicalDevice"
- exports: ["Qt3D.Input/KeyboardDevice 2.0"]
Property {
name: "activeInput"
type: "Qt3DInput::QKeyboardHandler"
@@ -537,12 +612,13 @@ Module {
Component {
name: "Qt3DInput::QMouseDevice"
prototype: "Qt3DInput::QAbstractPhysicalDevice"
- exports: ["Qt3D.Input/MouseDevice 2.0"]
Enum {
name: "Axis"
values: {
"X": 0,
- "Y": 1
+ "Y": 1,
+ "WheelX": 2,
+ "WheelY": 3
}
}
Property { name: "sensitivity"; type: "float" }
diff --git a/src/quick3d/imports/logic/plugins.qmltypes b/src/quick3d/imports/logic/plugins.qmltypes
index 0c0ccc847..61b67ca73 100644
--- a/src/quick3d/imports/logic/plugins.qmltypes
+++ b/src/quick3d/imports/logic/plugins.qmltypes
@@ -7,7 +7,7 @@ import QtQuick.tooling 1.2
// 'qmlplugindump -nonrelocatable Qt3D.Logic 2.0'
Module {
- dependencies: ["QtQuick 2.7"]
+ dependencies: ["QtQuick 2.8"]
Component {
name: "Qt3DCore::QComponent"
prototype: "Qt3DCore::QNode"
@@ -16,6 +16,14 @@ Module {
name: "shareableChanged"
Parameter { name: "isShareable"; type: "bool" }
}
+ Signal {
+ name: "addedToEntity"
+ Parameter { name: "entity"; type: "QEntity"; isPointer: true }
+ }
+ Signal {
+ name: "removedFromEntity"
+ Parameter { name: "entity"; type: "QEntity"; isPointer: true }
+ }
Method {
name: "setShareable"
Parameter { name: "isShareable"; type: "bool" }
@@ -24,8 +32,17 @@ Module {
Component {
name: "Qt3DCore::QNode"
prototype: "QObject"
+ Enum {
+ name: "PropertyTrackingMode"
+ values: {
+ "TrackFinalValues": 0,
+ "DontTrackValues": 1,
+ "TrackAllValues": 2
+ }
+ }
Property { name: "parent"; type: "Qt3DCore::QNode"; isPointer: true }
Property { name: "enabled"; type: "bool" }
+ Property { name: "defaultPropertyTrackingMode"; revision: 9; type: "PropertyTrackingMode" }
Signal {
name: "parentChanged"
Parameter { name: "parent"; type: "QObject"; isPointer: true }
@@ -34,6 +51,10 @@ Module {
name: "enabledChanged"
Parameter { name: "enabled"; type: "bool" }
}
+ Signal {
+ name: "defaultPropertyTrackingModeChanged"
+ Parameter { name: "mode"; type: "PropertyTrackingMode" }
+ }
Signal { name: "nodeDestroyed" }
Method {
name: "setParent"
@@ -43,6 +64,10 @@ Module {
name: "setEnabled"
Parameter { name: "isEnabled"; type: "bool" }
}
+ Method {
+ name: "setDefaultPropertyTrackingMode"
+ Parameter { name: "mode"; type: "PropertyTrackingMode" }
+ }
}
Component {
name: "Qt3DLogic::QFrameAction"
diff --git a/src/quick3d/imports/render/plugins.qmltypes b/src/quick3d/imports/render/plugins.qmltypes
index 9e6e5fe38..aa0272430 100644
--- a/src/quick3d/imports/render/plugins.qmltypes
+++ b/src/quick3d/imports/render/plugins.qmltypes
@@ -4,10 +4,10 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt3D.Render 2.0'
+// 'qmlplugindump -nonrelocatable Qt3D.Render 2.9'
Module {
- dependencies: ["QtQuick 2.7"]
+ dependencies: ["QtQuick 2.8"]
Component {
name: "QWindow"
prototype: "QObject"
@@ -25,6 +25,13 @@ Module {
"FullScreen": 5
}
}
+ Enum {
+ name: "AncestorMode"
+ values: {
+ "ExcludeTransients": 0,
+ "IncludeTransients": 1
+ }
+ }
Property { name: "title"; type: "string" }
Property { name: "modality"; type: "Qt::WindowModality" }
Property { name: "flags"; type: "Qt::WindowFlags" }
@@ -178,6 +185,14 @@ Module {
name: "shareableChanged"
Parameter { name: "isShareable"; type: "bool" }
}
+ Signal {
+ name: "addedToEntity"
+ Parameter { name: "entity"; type: "QEntity"; isPointer: true }
+ }
+ Signal {
+ name: "removedFromEntity"
+ Parameter { name: "entity"; type: "QEntity"; isPointer: true }
+ }
Method {
name: "setShareable"
Parameter { name: "isShareable"; type: "bool" }
@@ -187,8 +202,17 @@ Module {
Component {
name: "Qt3DCore::QNode"
prototype: "QObject"
+ Enum {
+ name: "PropertyTrackingMode"
+ values: {
+ "TrackFinalValues": 0,
+ "DontTrackValues": 1,
+ "TrackAllValues": 2
+ }
+ }
Property { name: "parent"; type: "Qt3DCore::QNode"; isPointer: true }
Property { name: "enabled"; type: "bool" }
+ Property { name: "defaultPropertyTrackingMode"; revision: 9; type: "PropertyTrackingMode" }
Signal {
name: "parentChanged"
Parameter { name: "parent"; type: "QObject"; isPointer: true }
@@ -197,6 +221,10 @@ Module {
name: "enabledChanged"
Parameter { name: "enabled"; type: "bool" }
}
+ Signal {
+ name: "defaultPropertyTrackingModeChanged"
+ Parameter { name: "mode"; type: "PropertyTrackingMode" }
+ }
Signal { name: "nodeDestroyed" }
Method {
name: "setParent"
@@ -206,6 +234,10 @@ Module {
name: "setEnabled"
Parameter { name: "isEnabled"; type: "bool" }
}
+ Method {
+ name: "setDefaultPropertyTrackingMode"
+ Parameter { name: "mode"; type: "PropertyTrackingMode" }
+ }
}
Component {
name: "Qt3DCore::Quick::Quick3DNode"
@@ -404,7 +436,8 @@ Module {
"CubeMapPositiveY": 34071,
"CubeMapNegativeY": 34072,
"CubeMapPositiveZ": 34073,
- "CubeMapNegativeZ": 34074
+ "CubeMapNegativeZ": 34074,
+ "AllFaces": 34075
}
}
Enum {
@@ -446,6 +479,7 @@ Module {
Property { name: "comparisonFunction"; type: "ComparisonFunction" }
Property { name: "comparisonMode"; type: "ComparisonMode" }
Property { name: "layers"; type: "int" }
+ Property { name: "samples"; type: "int" }
Signal {
name: "formatChanged"
Parameter { name: "format"; type: "TextureFormat" }
@@ -494,6 +528,10 @@ Module {
name: "layersChanged"
Parameter { name: "layers"; type: "int" }
}
+ Signal {
+ name: "samplesChanged"
+ Parameter { name: "samples"; type: "int" }
+ }
Method {
name: "setFormat"
Parameter { name: "format"; type: "TextureFormat" }
@@ -538,6 +576,10 @@ Module {
name: "setLayers"
Parameter { name: "layers"; type: "int" }
}
+ Method {
+ name: "setSamples"
+ Parameter { name: "samples"; type: "int" }
+ }
}
Component {
name: "Qt3DRender::QAbstractTextureImage"
@@ -625,7 +667,8 @@ Module {
name: "AttributeType"
values: {
"VertexAttribute": 0,
- "IndexAttribute": 1
+ "IndexAttribute": 1,
+ "DrawIndirectAttribute": 2
}
}
Enum {
@@ -651,6 +694,11 @@ Module {
Property { name: "byteOffset"; type: "uint" }
Property { name: "divisor"; type: "uint" }
Property { name: "attributeType"; type: "AttributeType" }
+ Property { name: "defaultPositionAttributeName"; type: "string"; isReadonly: true }
+ Property { name: "defaultNormalAttributeName"; type: "string"; isReadonly: true }
+ Property { name: "defaultColorAttributeName"; type: "string"; isReadonly: true }
+ Property { name: "defaultTextureCoordinateAttributeName"; type: "string"; isReadonly: true }
+ Property { name: "defaultTangentAttributeName"; type: "string"; isReadonly: true }
Signal {
name: "bufferChanged"
Parameter { name: "buffer"; type: "QBuffer"; isPointer: true }
@@ -660,6 +708,14 @@ Module {
Parameter { name: "name"; type: "string" }
}
Signal {
+ name: "vertexBaseTypeChanged"
+ Parameter { name: "vertexBaseType"; type: "VertexBaseType" }
+ }
+ Signal {
+ name: "vertexSizeChanged"
+ Parameter { name: "vertexSize"; type: "uint" }
+ }
+ Signal {
name: "dataTypeChanged"
Parameter { name: "vertexBaseType"; type: "VertexBaseType" }
}
@@ -696,6 +752,14 @@ Module {
Parameter { name: "name"; type: "string" }
}
Method {
+ name: "setVertexBaseType"
+ Parameter { name: "type"; type: "VertexBaseType" }
+ }
+ Method {
+ name: "setVertexSize"
+ Parameter { name: "size"; type: "uint" }
+ }
+ Method {
name: "setDataType"
Parameter { name: "type"; type: "VertexBaseType" }
}
@@ -780,7 +844,8 @@ Module {
"OneMinusConstantColor": 32770,
"OneMinusConstantAlpha": 32772,
"OneMinusSource1Alpha": 32773,
- "OneMinusSource1Color": 32774
+ "OneMinusSource1Color": 32774,
+ "OneMinusSource1Color0": 32774
}
}
Property { name: "sourceRgb"; type: "Blending" }
@@ -848,6 +913,9 @@ Module {
Component {
name: "Qt3DRender::QBuffer"
prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/BufferBase 2.0", "Qt3D.Render/BufferBase 2.9"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0, 9]
Enum {
name: "BufferType"
values: {
@@ -856,7 +924,8 @@ Module {
"PixelPackBuffer": 35051,
"PixelUnpackBuffer": 35052,
"UniformBuffer": 35345,
- "ShaderStorageBuffer": 37074
+ "ShaderStorageBuffer": 37074,
+ "DrawIndirectBuffer": 36671
}
}
Enum {
@@ -873,9 +942,18 @@ Module {
"DynamicCopy": 35050
}
}
+ Enum {
+ name: "AccessType"
+ values: {
+ "Write": 1,
+ "Read": 2,
+ "ReadWrite": 3
+ }
+ }
Property { name: "type"; type: "BufferType" }
Property { name: "usage"; type: "UsageType" }
Property { name: "syncData"; type: "bool" }
+ Property { name: "accessType"; revision: 9; type: "AccessType" }
Signal {
name: "dataChanged"
Parameter { name: "bytes"; type: "QByteArray" }
@@ -892,6 +970,11 @@ Module {
name: "syncDataChanged"
Parameter { name: "syncData"; type: "bool" }
}
+ Signal {
+ name: "accessTypeChanged"
+ Parameter { name: "access"; type: "AccessType" }
+ }
+ Signal { name: "dataAvailable" }
Method {
name: "setType"
Parameter { name: "type"; type: "BufferType" }
@@ -904,6 +987,21 @@ Module {
name: "setSyncData"
Parameter { name: "syncData"; type: "bool" }
}
+ Method {
+ name: "setAccessType"
+ Parameter { name: "access"; type: "AccessType" }
+ }
+ Method {
+ name: "updateData"
+ Parameter { name: "offset"; type: "int" }
+ Parameter { name: "bytes"; type: "QByteArray" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QBufferCapture"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ exports: ["Qt3D.Render/BufferCapture 2.9"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "Qt3DRender::QCamera"
@@ -927,6 +1025,7 @@ Module {
Property { name: "bottom"; type: "float" }
Property { name: "top"; type: "float" }
Property { name: "projectionMatrix"; type: "QMatrix4x4" }
+ Property { name: "exposure"; revision: 9; type: "float" }
Property { name: "position"; type: "QVector3D" }
Property { name: "upVector"; type: "QVector3D" }
Property { name: "viewCenter"; type: "QVector3D" }
@@ -973,6 +1072,10 @@ Module {
Parameter { name: "projectionMatrix"; type: "QMatrix4x4" }
}
Signal {
+ name: "exposureChanged"
+ Parameter { name: "exposure"; type: "float" }
+ }
+ Signal {
name: "positionChanged"
Parameter { name: "position"; type: "QVector3D" }
}
@@ -1029,6 +1132,10 @@ Module {
Parameter { name: "projectionMatrix"; type: "QMatrix4x4" }
}
Method {
+ name: "setExposure"
+ Parameter { name: "exposure"; type: "float" }
+ }
+ Method {
name: "setPosition"
Parameter { name: "position"; type: "QVector3D" }
}
@@ -1146,6 +1253,7 @@ Module {
Property { name: "bottom"; type: "float" }
Property { name: "top"; type: "float" }
Property { name: "projectionMatrix"; type: "QMatrix4x4" }
+ Property { name: "exposure"; revision: 9; type: "float" }
Signal {
name: "projectionTypeChanged"
Parameter { name: "projectionType"; type: "QCameraLens::ProjectionType" }
@@ -1186,6 +1294,10 @@ Module {
name: "projectionMatrixChanged"
Parameter { name: "projectionMatrix"; type: "QMatrix4x4" }
}
+ Signal {
+ name: "exposureChanged"
+ Parameter { name: "exposure"; type: "float" }
+ }
Method {
name: "setProjectionType"
Parameter { name: "projectionType"; type: "ProjectionType" }
@@ -1226,6 +1338,10 @@ Module {
name: "setProjectionMatrix"
Parameter { name: "projectionMatrix"; type: "QMatrix4x4" }
}
+ Method {
+ name: "setExposure"
+ Parameter { name: "exposure"; type: "float" }
+ }
}
Component {
name: "Qt3DRender::QCameraSelector"
@@ -1496,6 +1612,34 @@ Module {
}
Component { name: "Qt3DRender::QEffect"; prototype: "Qt3DCore::QNode" }
Component {
+ name: "Qt3DRender::QEnvironmentLight"
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Render/EnvironmentLight 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "irradiance"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
+ Property { name: "specular"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
+ Signal {
+ name: "irradianceChanged"
+ Parameter {
+ name: "environmentIrradiance"
+ type: "Qt3DRender::QAbstractTexture"
+ isPointer: true
+ }
+ }
+ Signal {
+ name: "specularChanged"
+ Parameter { name: "environmentSpecular"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
+ }
+ Method {
+ name: "setIrradiance"
+ Parameter { name: "irradiance"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
+ }
+ Method {
+ name: "setSpecular"
+ Parameter { name: "specular"; type: "Qt3DRender::QAbstractTexture"; isPointer: true }
+ }
+ }
+ Component {
name: "Qt3DRender::QFilterKey"
prototype: "Qt3DCore::QNode"
exports: ["Qt3D.Render/FilterKey 2.0"]
@@ -1523,7 +1667,6 @@ Module {
name: "Qt3DRender::QFrameGraphNode"
prototype: "Qt3DCore::QNode"
exports: ["Qt3D.Render/FrameGraphNode 2.0"]
- isCreatable: false
exportMetaObjectRevisions: [0]
}
Component {
@@ -1776,6 +1919,76 @@ Module {
}
Component { name: "Qt3DRender::QLayerFilter"; prototype: "Qt3DRender::QFrameGraphNode" }
Component {
+ name: "Qt3DRender::QLevelOfDetail"
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Render/LevelOfDetail 2.9"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "ThresholdType"
+ values: {
+ "DistanceToCameraThreshold": 0,
+ "ProjectedScreenPixelSizeThreshold": 1
+ }
+ }
+ Property { name: "camera"; type: "Qt3DRender::QCamera"; isPointer: true }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "thresholdType"; type: "ThresholdType" }
+ Property { name: "thresholds"; type: "QVector<qreal>" }
+ Property { name: "volumeOverride"; type: "Qt3DRender::QLevelOfDetailBoundingSphere" }
+ Signal {
+ name: "cameraChanged"
+ Parameter { name: "camera"; type: "QCamera"; isPointer: true }
+ }
+ Signal {
+ name: "currentIndexChanged"
+ Parameter { name: "currentIndex"; type: "int" }
+ }
+ Signal {
+ name: "thresholdTypeChanged"
+ Parameter { name: "thresholdType"; type: "ThresholdType" }
+ }
+ Signal {
+ name: "thresholdsChanged"
+ Parameter { name: "thresholds"; type: "QVector<qreal>" }
+ }
+ Signal {
+ name: "volumeOverrideChanged"
+ Parameter { name: "volumeOverride"; type: "QLevelOfDetailBoundingSphere" }
+ }
+ Method {
+ name: "setCamera"
+ Parameter { name: "camera"; type: "QCamera"; isPointer: true }
+ }
+ Method {
+ name: "setCurrentIndex"
+ Parameter { name: "currentIndex"; type: "int" }
+ }
+ Method {
+ name: "setThresholdType"
+ Parameter { name: "thresholdType"; type: "ThresholdType" }
+ }
+ Method {
+ name: "setThresholds"
+ Parameter { name: "thresholds"; type: "QVector<qreal>" }
+ }
+ Method {
+ name: "setVolumeOverride"
+ Parameter { name: "volumeOverride"; type: "QLevelOfDetailBoundingSphere" }
+ }
+ Method {
+ name: "createBoundingSphere"
+ type: "QLevelOfDetailBoundingSphere"
+ Parameter { name: "center"; type: "QVector3D" }
+ Parameter { name: "radius"; type: "float" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QLevelOfDetailSwitch"
+ prototype: "Qt3DRender::QLevelOfDetail"
+ exports: ["Qt3D.Render/LevelOfDetailSwitch 2.9"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
name: "Qt3DRender::QMaterial"
prototype: "Qt3DCore::QComponent"
Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
@@ -1789,6 +2002,39 @@ Module {
}
}
Component {
+ name: "Qt3DRender::QMemoryBarrier"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ Enum {
+ name: "Operation"
+ values: {
+ "None": 0,
+ "VertexAttributeArray": 1,
+ "ElementArray": 2,
+ "Uniform": 4,
+ "TextureFetch": 8,
+ "ShaderImageAccess": 16,
+ "Command": 32,
+ "PixelBuffer": 64,
+ "TextureUpdate": 128,
+ "BufferUpdate": 256,
+ "FrameBuffer": 512,
+ "TransformFeedback": 1024,
+ "AtomicCounter": 2048,
+ "ShaderStorage": 4096,
+ "QueryBuffer": 8192,
+ "All": -1
+ }
+ }
+ Signal {
+ name: "waitOperationsChanged"
+ Parameter { name: "barrierTypes"; type: "QMemoryBarrier::Operations" }
+ }
+ Method {
+ name: "setWaitOperations"
+ Parameter { name: "operations"; type: "QMemoryBarrier::Operations" }
+ }
+ }
+ Component {
name: "Qt3DRender::QMesh"
prototype: "Qt3DRender::QGeometryRenderer"
exports: ["Qt3D.Render/Mesh 2.0"]
@@ -1913,11 +2159,35 @@ Module {
exports: ["Qt3D.Render/PickEvent 2.0"]
isCreatable: false
exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Buttons"
+ values: {
+ "LeftButton": 1,
+ "RightButton": 2,
+ "MiddleButton": 4,
+ "BackButton": 8,
+ "NoButton": 0
+ }
+ }
+ Enum {
+ name: "Modifiers"
+ values: {
+ "NoModifier": 0,
+ "ShiftModifier": 33554432,
+ "ControlModifier": 67108864,
+ "AltModifier": 134217728,
+ "MetaModifier": 268435456,
+ "KeypadModifier": 536870912
+ }
+ }
Property { name: "accepted"; type: "bool" }
Property { name: "position"; type: "QPointF"; isReadonly: true }
Property { name: "distance"; type: "float"; isReadonly: true }
Property { name: "localIntersection"; type: "QVector3D"; isReadonly: true }
Property { name: "worldIntersection"; type: "QVector3D"; isReadonly: true }
+ Property { name: "button"; type: "Qt3DRender::QPickEvent::Buttons"; isReadonly: true }
+ Property { name: "buttons"; type: "int"; isReadonly: true }
+ Property { name: "modifiers"; type: "int"; isReadonly: true }
Signal {
name: "acceptedChanged"
Parameter { name: "accepted"; type: "bool" }
@@ -1946,8 +2216,17 @@ Module {
"AllPicks": 1
}
}
+ Enum {
+ name: "FaceOrientationPickingMode"
+ values: {
+ "FrontFace": 1,
+ "BackFace": 2,
+ "FrontAndBackFace": 3
+ }
+ }
Property { name: "pickMethod"; type: "PickMethod" }
Property { name: "pickResultMode"; type: "PickResultMode" }
+ Property { name: "faceOrientationPickingMode"; type: "FaceOrientationPickingMode" }
Signal {
name: "pickMethodChanged"
Parameter { name: "pickMethod"; type: "QPickingSettings::PickMethod" }
@@ -1956,6 +2235,13 @@ Module {
name: "pickResultModeChanged"
Parameter { name: "pickResult"; type: "QPickingSettings::PickResultMode" }
}
+ Signal {
+ name: "faceOrientationPickingModeChanged"
+ Parameter {
+ name: "faceOrientationPickingMode"
+ type: "QPickingSettings::FaceOrientationPickingMode"
+ }
+ }
Method {
name: "setPickMethod"
Parameter { name: "pickMethod"; type: "PickMethod" }
@@ -1964,6 +2250,10 @@ Module {
name: "setPickResultMode"
Parameter { name: "pickResultMode"; type: "PickResultMode" }
}
+ Method {
+ name: "setFaceOrientationPickingMode"
+ Parameter { name: "faceOrientationPickingMode"; type: "FaceOrientationPickingMode" }
+ }
}
Component {
name: "Qt3DRender::QPointLight"
@@ -2054,6 +2344,42 @@ Module {
}
}
Component {
+ name: "Qt3DRender::QRenderCapture"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ exports: ["Qt3D.Render/RenderCapture 2.1"]
+ exportMetaObjectRevisions: [0]
+ Method {
+ name: "requestCapture"
+ type: "Qt3DRender::QRenderCaptureReply*"
+ Parameter { name: "captureId"; type: "int" }
+ }
+ Method { name: "requestCapture"; revision: 9; type: "Qt3DRender::QRenderCaptureReply*" }
+ }
+ Component {
+ name: "Qt3DRender::QRenderCaptureReply"
+ prototype: "QObject"
+ exports: ["Qt3D.Render/RenderCaptureReply 2.1"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "image"; type: "QImage"; isReadonly: true }
+ Property { name: "captureId"; type: "int"; isReadonly: true }
+ Property { name: "complete"; type: "bool"; isReadonly: true }
+ Signal {
+ name: "completeChanged"
+ Parameter { name: "isComplete"; type: "bool" }
+ }
+ Signal { name: "completed" }
+ Method {
+ name: "saveImage"
+ type: "bool"
+ Parameter { name: "fileName"; type: "string" }
+ }
+ Method {
+ name: "saveToFile"
+ Parameter { name: "fileName"; type: "string" }
+ }
+ }
+ Component {
name: "Qt3DRender::QRenderPass"
prototype: "Qt3DCore::QNode"
Property { name: "shaderProgram"; type: "Qt3DRender::QShaderProgram"; isPointer: true }
@@ -2119,7 +2445,7 @@ Module {
exports: ["Qt3D.Render/RenderSurfaceSelector 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "surface"; type: "QObject"; isPointer: true }
- Property { name: "externalRenderTargetSize"; type: "QSize"; isReadonly: true }
+ Property { name: "externalRenderTargetSize"; type: "QSize" }
Property { name: "surfacePixelRatio"; type: "float" }
Signal {
name: "surfaceChanged"
@@ -2141,6 +2467,10 @@ Module {
name: "setSurfacePixelRatio"
Parameter { name: "ratio"; type: "float" }
}
+ Method {
+ name: "setExternalRenderTargetSize"
+ Parameter { name: "size"; type: "QSize" }
+ }
}
Component { name: "Qt3DRender::QRenderTarget"; prototype: "Qt3DCore::QComponent" }
Component {
@@ -2176,7 +2506,7 @@ Module {
Property { name: "texture"; type: "QAbstractTexture"; isPointer: true }
Property { name: "mipLevel"; type: "int" }
Property { name: "layer"; type: "int" }
- Property { name: "face"; type: "QAbstractTexture::CubeMapFace" }
+ Property { name: "face"; type: "Qt3DRender::QAbstractTexture::CubeMapFace" }
Signal {
name: "attachmentPointChanged"
Parameter { name: "attachmentPoint"; type: "AttachmentPoint" }
@@ -2243,6 +2573,17 @@ Module {
"Error": 3
}
}
+ Enum {
+ name: "ComponentType"
+ values: {
+ "UnknownComponent": 0,
+ "GeometryRendererComponent": 1,
+ "TransformComponent": 2,
+ "MaterialComponent": 3,
+ "LightComponent": 4,
+ "CameraLensComponent": 5
+ }
+ }
Property { name: "source"; type: "QUrl" }
Property { name: "status"; type: "Status"; isReadonly: true }
Signal {
@@ -2261,6 +2602,20 @@ Module {
name: "setStatus"
Parameter { name: "status"; type: "Status" }
}
+ Method {
+ name: "entity"
+ revision: 9
+ type: "Qt3DCore::QEntity*"
+ Parameter { name: "entityName"; type: "string" }
+ }
+ Method { name: "entityNames"; revision: 9; type: "QStringList" }
+ Method {
+ name: "component"
+ revision: 9
+ type: "Qt3DCore::QComponent*"
+ Parameter { name: "entityName"; type: "string" }
+ Parameter { name: "componentType"; type: "ComponentType" }
+ }
}
Component {
name: "Qt3DRender::QScissorTest"
@@ -2333,12 +2688,22 @@ Module {
"Compute": 5
}
}
+ Enum {
+ name: "Status"
+ values: {
+ "NotReady": 0,
+ "Ready": 1,
+ "Error": 2
+ }
+ }
Property { name: "vertexShaderCode"; type: "QByteArray" }
Property { name: "tessellationControlShaderCode"; type: "QByteArray" }
Property { name: "tessellationEvaluationShaderCode"; type: "QByteArray" }
Property { name: "geometryShaderCode"; type: "QByteArray" }
Property { name: "fragmentShaderCode"; type: "QByteArray" }
Property { name: "computeShaderCode"; type: "QByteArray" }
+ Property { name: "log"; revision: 9; type: "string"; isReadonly: true }
+ Property { name: "status"; revision: 9; type: "Status"; isReadonly: true }
Signal {
name: "vertexShaderCodeChanged"
Parameter { name: "vertexShaderCode"; type: "QByteArray" }
@@ -2363,6 +2728,14 @@ Module {
name: "computeShaderCodeChanged"
Parameter { name: "computeShaderCode"; type: "QByteArray" }
}
+ Signal {
+ name: "logChanged"
+ Parameter { name: "log"; type: "string" }
+ }
+ Signal {
+ name: "statusChanged"
+ Parameter { name: "status"; type: "Status" }
+ }
Method {
name: "setVertexShaderCode"
Parameter { name: "vertexShaderCode"; type: "QByteArray" }
@@ -2701,6 +3074,7 @@ Module {
}
Property { name: "source"; type: "QUrl" }
Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "mirrored"; type: "bool" }
Signal {
name: "sourceChanged"
Parameter { name: "source"; type: "QUrl" }
@@ -2709,23 +3083,40 @@ Module {
name: "statusChanged"
Parameter { name: "status"; type: "Status" }
}
+ Signal {
+ name: "mirroredChanged"
+ Parameter { name: "mirrored"; type: "bool" }
+ }
Method {
name: "setSource"
Parameter { name: "source"; type: "QUrl" }
}
+ Method {
+ name: "setMirrored"
+ Parameter { name: "mirrored"; type: "bool" }
+ }
}
Component {
name: "Qt3DRender::QTextureLoader"
prototype: "Qt3DRender::QAbstractTexture"
Property { name: "source"; type: "QUrl" }
+ Property { name: "mirrored"; type: "bool" }
Signal {
name: "sourceChanged"
Parameter { name: "source"; type: "QUrl" }
}
+ Signal {
+ name: "mirroredChanged"
+ Parameter { name: "mirrored"; type: "bool" }
+ }
Method {
name: "setSource"
Parameter { name: "source"; type: "QUrl" }
}
+ Method {
+ name: "setMirrored"
+ Parameter { name: "mirrored"; type: "bool" }
+ }
}
Component { name: "Qt3DRender::QTextureRectangle"; prototype: "Qt3DRender::QAbstractTexture" }
Component {
@@ -2774,14 +3165,23 @@ Module {
name: "Qt3DRender::QViewport"
prototype: "Qt3DRender::QFrameGraphNode"
Property { name: "normalizedRect"; type: "QRectF" }
+ Property { name: "gamma"; revision: 9; type: "float" }
Signal {
name: "normalizedRectChanged"
Parameter { name: "normalizedRect"; type: "QRectF" }
}
+ Signal {
+ name: "gammaChanged"
+ Parameter { name: "gamma"; type: "float" }
+ }
Method {
name: "setNormalizedRect"
Parameter { name: "normalizedRect"; type: "QRectF" }
}
+ Method {
+ name: "setGamma"
+ Parameter { name: "gamma"; type: "float" }
+ }
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DBuffer"
@@ -2790,7 +3190,16 @@ Module {
exportMetaObjectRevisions: [0]
Property { name: "data"; type: "QVariant" }
Signal { name: "bufferDataChanged" }
- Signal { name: "bufferDataChanged" }
+ Method {
+ name: "updateData"
+ Parameter { name: "offset"; type: "int" }
+ Parameter { name: "bytes"; type: "QVariant" }
+ }
+ Method {
+ name: "readBinaryFile"
+ type: "QVariant"
+ Parameter { name: "fileUrl"; type: "QUrl" }
+ }
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DEffect"
@@ -2823,6 +3232,13 @@ Module {
Property { name: "parameters"; type: "Qt3DRender::QParameter"; isList: true; isReadonly: true }
}
Component {
+ name: "Qt3DRender::Render::Quick::Quick3DMemoryBarrier"
+ prototype: "Qt3DRender::QMemoryBarrier"
+ exports: ["Qt3D.Render/MemoryBarrier 2.9"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "waitFor"; type: "int" }
+ }
+ Component {
name: "Qt3DRender::Render::Quick::Quick3DParameter"
prototype: "Qt3DRender::QParameter"
exports: ["Qt3D.Render/Parameter 2.0"]
@@ -2921,7 +3337,7 @@ Module {
Component {
name: "Qt3DRender::Render::Quick::Quick3DTextureExtension"
defaultProperty: "textureImages"
- prototype: "Qt3DRender::QTextureLoader"
+ prototype: "Qt3DRender::QTextureRectangle"
exports: [
"Qt3D.Render/Texture1D 2.0",
"Qt3D.Render/Texture1DArray 2.0",
diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp
index 6c285e133..c31f4aa97 100644
--- a/src/quick3d/imports/scene3d/scene3ditem.cpp
+++ b/src/quick3d/imports/scene3d/scene3ditem.cpp
@@ -223,7 +223,7 @@ void Scene3DItem::setWindowSurface(QObject *rootObject)
}
}
-void Scene3DItem::setItemArea(const QSize &area)
+void Scene3DItem::setItemArea(QSize area)
{
Qt3DRender::QRenderSurfaceSelector *surfaceSelector = Qt3DRender::QRenderSurfaceSelectorPrivate::find(m_entity);
if (surfaceSelector)
diff --git a/src/quick3d/imports/scene3d/scene3ditem_p.h b/src/quick3d/imports/scene3d/scene3ditem_p.h
index eb14645c3..e0ce3addc 100644
--- a/src/quick3d/imports/scene3d/scene3ditem_p.h
+++ b/src/quick3d/imports/scene3d/scene3ditem_p.h
@@ -88,7 +88,7 @@ public:
bool multisample() const;
void setMultisample(bool enable);
- void setItemArea(const QSize &area);
+ Q_INVOKABLE void setItemArea(QSize area);
bool isHoverEnabled() const;
enum CameraAspectRatioMode {
diff --git a/src/quick3d/imports/scene3d/scene3drenderer.cpp b/src/quick3d/imports/scene3d/scene3drenderer.cpp
index 88f3be3c1..b32191391 100644
--- a/src/quick3d/imports/scene3d/scene3drenderer.cpp
+++ b/src/quick3d/imports/scene3d/scene3drenderer.cpp
@@ -57,6 +57,17 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
+namespace {
+
+inline QMetaMethod setItemAreaMethod()
+{
+ const int idx = Scene3DItem::staticMetaObject.indexOfMethod("setItemArea(QSize)");
+ Q_ASSERT(idx != -1);
+ return Scene3DItem::staticMetaObject.method(idx);
+}
+
+} // anonymous
+
class ContextSaver
{
public:
@@ -250,8 +261,11 @@ void Scene3DRenderer::render()
const bool multisampleHasChanged = m_multisample != m_lastMultisample;
const bool forceRecreate = sizeHasChanged || multisampleHasChanged;
- if (sizeHasChanged)
- m_item->setItemArea(boundingRectSize);
+ if (sizeHasChanged) {
+ // We are in the QSGRenderThread (doing a direct call would result in a race)
+ static const QMetaMethod setItemArea = setItemAreaMethod();
+ setItemArea.invoke(m_item, Qt::QueuedConnection, Q_ARG(QSize, boundingRectSize));
+ }
// Rebuild FBO and textures if never created or a resize has occurred
if ((m_multisampledFBO.isNull() || forceRecreate) && m_multisample) {
diff --git a/src/quick3d/quick3d/qt3dquick_global.cpp b/src/quick3d/quick3d/qt3dquick_global.cpp
index ebf27e7ae..a98211991 100644
--- a/src/quick3d/quick3d/qt3dquick_global.cpp
+++ b/src/quick3d/quick3d/qt3dquick_global.cpp
@@ -659,9 +659,9 @@ public:
#undef ASSERT_VALID_SIZE
};
+static Quick3DValueTypeProvider valueTypeProvider;
static Quick3DValueTypeProvider *getValueTypeProvider()
{
- static Quick3DValueTypeProvider valueTypeProvider;
return &valueTypeProvider;
}
@@ -706,6 +706,11 @@ void Quick3D_initialize()
QQmlPrivate::qmlregister(QQmlPrivate::AutoParentRegistration, &autoparent);
}
+void Quick3D_uninitialize()
+{
+ QQml_removeValueTypeProvider(&valueTypeProvider);
+}
+
void Quick3D_registerType(const char *className, const char *quickName, int major, int minor)
{
QuickNodeFactory::instance()->registerType(className, quickName, major, minor);
diff --git a/src/quick3d/quick3d/qt3dquick_global_p.h b/src/quick3d/quick3d/qt3dquick_global_p.h
index d67209404..ffc603f91 100644
--- a/src/quick3d/quick3d/qt3dquick_global_p.h
+++ b/src/quick3d/quick3d/qt3dquick_global_p.h
@@ -62,6 +62,7 @@ namespace Qt3DCore {
namespace Quick {
QT3DQUICKSHARED_PRIVATE_EXPORT void Quick3D_initialize();
+QT3DQUICKSHARED_PRIVATE_EXPORT void Quick3D_uninitialize();
QT3DQUICKSHARED_PRIVATE_EXPORT void Quick3D_registerType(const char *className, const char *quickName, int major, int minor);
template<class T, class E> void registerExtendedType(const char *className, const char *quickName,
diff --git a/src/quick3d/quick3danimation/items/items.pri b/src/quick3d/quick3danimation/items/items.pri
index 3f19965b5..27adabbe4 100644
--- a/src/quick3d/quick3danimation/items/items.pri
+++ b/src/quick3d/quick3danimation/items/items.pri
@@ -4,7 +4,8 @@ SOURCES += \
$$PWD/quick3danimationgroup.cpp \
$$PWD/quick3dkeyframeanimation.cpp \
$$PWD/quick3dmorphinganimation.cpp \
- $$PWD/quick3dmorphtarget.cpp
+ $$PWD/quick3dmorphtarget.cpp \
+ $$PWD/quick3dvertexblendanimation.cpp
HEADERS += \
$$PWD/quick3dchannelmapper_p.h \
@@ -12,6 +13,7 @@ HEADERS += \
$$PWD/quick3danimationgroup_p.h \
$$PWD/quick3dkeyframeanimation_p.h \
$$PWD/quick3dmorphinganimation_p.h \
- $$PWD/quick3dmorphtarget_p.h
+ $$PWD/quick3dmorphtarget_p.h \
+ $$PWD/quick3dvertexblendanimation_p.h
INCLUDEPATH += $$PWD
diff --git a/src/quick3d/quick3danimation/items/quick3dvertexblendanimation.cpp b/src/quick3d/quick3danimation/items/quick3dvertexblendanimation.cpp
new file mode 100644
index 000000000..2dffb7858
--- /dev/null
+++ b/src/quick3d/quick3danimation/items/quick3dvertexblendanimation.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "quick3dvertexblendanimation_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+namespace Quick {
+
+QQuick3DVertexBlendAnimation::QQuick3DVertexBlendAnimation(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QQmlListProperty<Qt3DAnimation::QMorphTarget> QQuick3DVertexBlendAnimation::morphTargets()
+{
+ return QQmlListProperty<Qt3DAnimation::QMorphTarget>(this, 0,
+ &QQuick3DVertexBlendAnimation::appendMorphTarget,
+ &QQuick3DVertexBlendAnimation::morphTargetCount,
+ &QQuick3DVertexBlendAnimation::morphTargetAt,
+ &QQuick3DVertexBlendAnimation::clearMorphTargets);
+}
+
+void QQuick3DVertexBlendAnimation::appendMorphTarget(
+ QQmlListProperty<Qt3DAnimation::QMorphTarget> *list,
+ Qt3DAnimation::QMorphTarget *morphTarget)
+{
+ QQuick3DVertexBlendAnimation *animation
+ = qobject_cast<QQuick3DVertexBlendAnimation *>(list->object);
+ if (animation)
+ animation->parentVertexBlendAnimation()->addMorphTarget(morphTarget);
+}
+
+int QQuick3DVertexBlendAnimation::morphTargetCount(
+ QQmlListProperty<Qt3DAnimation::QMorphTarget> *list)
+{
+ QQuick3DVertexBlendAnimation *animation
+ = qobject_cast<QQuick3DVertexBlendAnimation *>(list->object);
+ if (animation)
+ return animation->parentVertexBlendAnimation()->morphTargetList().count();
+ return 0;
+}
+
+Qt3DAnimation::QMorphTarget *QQuick3DVertexBlendAnimation::morphTargetAt(
+ QQmlListProperty<Qt3DAnimation::QMorphTarget> *list,
+ int index)
+{
+ QQuick3DVertexBlendAnimation *animation
+ = qobject_cast<QQuick3DVertexBlendAnimation *>(list->object);
+ if (animation) {
+ return qobject_cast<Qt3DAnimation::QMorphTarget *>(
+ animation->parentVertexBlendAnimation()->morphTargetList().at(index));
+ }
+ return nullptr;
+}
+
+void QQuick3DVertexBlendAnimation::clearMorphTargets(QQmlListProperty<Qt3DAnimation::QMorphTarget> *list)
+{
+ QQuick3DVertexBlendAnimation *animation
+ = qobject_cast<QQuick3DVertexBlendAnimation *>(list->object);
+ if (animation) {
+ QVector<Qt3DAnimation::QMorphTarget *> emptyList;
+ animation->parentVertexBlendAnimation()->setMorphTargets(emptyList);
+ }
+}
+
+} // namespace Quick
+} // namespace Qt3DAnimation
+
+QT_END_NAMESPACE
diff --git a/src/quick3d/quick3danimation/items/quick3dvertexblendanimation_p.h b/src/quick3d/quick3danimation/items/quick3dvertexblendanimation_p.h
new file mode 100644
index 000000000..6be2d662f
--- /dev/null
+++ b/src/quick3d/quick3danimation/items/quick3dvertexblendanimation_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#ifndef QT3DANIMATION_QUICK_QUICK3DVERTEXBLENDANIMATION_P_H
+#define QT3DANIMATION_QUICK_QUICK3DVERTEXBLENDANIMATION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml/qqmllist.h>
+
+#include <Qt3DAnimation/qvertexblendanimation.h>
+
+#include <private/qt3dquickanimation_global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace Qt3DAnimation {
+namespace Quick {
+
+class QT3DQUICKANIMATIONSHARED_PRIVATE_EXPORT QQuick3DVertexBlendAnimation : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<Qt3DAnimation::QMorphTarget> morphTargets READ morphTargets)
+
+public:
+ QQuick3DVertexBlendAnimation(QObject *parent = nullptr);
+
+ inline QVertexBlendAnimation *parentVertexBlendAnimation() const
+ {
+ return qobject_cast<QVertexBlendAnimation *>(parent());
+ }
+
+ QQmlListProperty<Qt3DAnimation::QMorphTarget> morphTargets();
+
+private:
+
+ static void appendMorphTarget(QQmlListProperty<Qt3DAnimation::QMorphTarget> *list,
+ Qt3DAnimation::QMorphTarget *morphTarget);
+ static Qt3DAnimation::QMorphTarget *morphTargetAt(
+ QQmlListProperty<Qt3DAnimation::QMorphTarget> *list,
+ int index);
+ static int morphTargetCount(QQmlListProperty<Qt3DAnimation::QMorphTarget> *list);
+ static void clearMorphTargets(QQmlListProperty<Qt3DAnimation::QMorphTarget> *list);
+};
+
+} // namespace Quick
+} // namespace Qt3DAnimation
+
+QT_END_NAMESPACE
+
+#endif // QT3DANIMATION_QUICK_QUICK3DMORPHINGANIMATION_P_H
diff --git a/src/quick3d/quick3dscene2d/items/qscene2d.cpp b/src/quick3d/quick3dscene2d/items/qscene2d.cpp
index 3470ac9d8..52e2be094 100644
--- a/src/quick3d/quick3dscene2d/items/qscene2d.cpp
+++ b/src/quick3d/quick3dscene2d/items/qscene2d.cpp
@@ -59,21 +59,75 @@ namespace Quick {
\brief This class enables rendering qml into a texture, which then can be
used as a part of 3D scene.
- The component uses QQuickRenderControl to render the given QML source into an
+ This class uses QQuickRenderControl to render the given QQuickItem into an
offscreen surface, which is attached to a texture provided by the user. This allows the
component to directly render into the texture without intermediate copy and the user to
freely specify how the texture is used in the 3D scene.
+ The entities using the QScene2D can be associated with the class to enable interaction
+ with the item; if an entity has a QObjectPicker component, the pick events from that picker
+ are sent to the QScene2D and converted to mouse events and finally sent to the item.
+
\since 5.9
*/
/*!
\qmltype Scene2D
\inqmlmodule Qt3D.Scene2D
- \since
- \ingroup
+ \since 5.9
\instantiates Qt3DRender::Quick::QScene2D
- \brief Scene2D
+
+ \brief This type enables rendering qml into a texture, which then can be
+ used as a part of 3D scene.
+
+ This object uses RenderControl to render the given Item into an
+ offscreen surface, which is attached to a texture provided by the user. This allows the
+ component to directly render into the texture without intermediate copy and the user to
+ freely specify how the texture is used in the 3D scene.
+
+ The entities using the Scene2D can be associated with the type to enable interaction
+ with the item; if an entity has an ObjectPicker component, the pick events from that picker
+ are sent to the Scene2D and converted to mouse events and finally sent to the item.
+
+ Usage:
+ \qml
+ Entity {
+ id: sceneRoot
+
+ // specify Scene2D inside the entity hierarchy
+ Scene2D {
+ // specify output
+ output: RenderTargetOutput {
+ attachmentPoint: RenderTargetOutput.Color0
+ texture: Texture2D {
+ id: textureId
+ width: 1024
+ height: 1024
+ format: Texture.RGBA8_UNorm
+ }
+ }
+ // specify entities
+ entities: [entityId]
+
+ // specify rendered content
+ Rectangle {
+ color: "red"
+ }
+ }
+
+ Entity {
+ id: entityId
+
+ property Material material: TextureMaterial {
+ texture: textureId
+ }
+ property ObjectPicker picker: ObjectPicker {
+ hoverEnabled: true
+ dragEnabled: true
+ }
+ ...
+
+ \endqml
*/
/*!
@@ -91,18 +145,34 @@ namespace Quick {
*/
/*!
- \qmlproperty QUrl Qt3D.Render::Scene2D::source
- Holds the qml source url.
- */
-
-/*!
\qmlproperty enumeration Qt3D.Render::Scene2D::renderPolicy
Holds the render policy of this Scene2D.
+
+ \list
+ \li Continuous The Scene2D is rendering continuously. This is the default render policy.
+ \li SingleShot The Scene2D renders to the texture only once after which the resources
+ allocated for rendering are released.
+ \endlist
+ */
+/*!
+ \qmlproperty Item Qt3D.Render::Scene2D::item
+ Holds the Item, which is rendered by Scene2D to the texture.
*/
/*!
- \qmlproperty bool Qt3D.Render::Scene2D::loaded
- Holds whether the source has been loaded.
+ \qmlproperty bool Qt3D.Render::Scene2D::mouseEnabled
+ Holds whether mouse events are enabled for the rendered item. The mouse events are
+ generated from object picking events of the entities added to the Scene2D.
+ Mouse is enabled by default.
+
+ \note Events sent to items are delayed by one frame due to object picking
+ happening in the backend.
+ */
+/*!
+ \qmlproperty list<Entity> Qt3D.Render::Scene2D::entities
+ Holds the list of entities which are associated with the Scene2D object. If the
+ entities have ObjectPicker, the pick events from that entity are sent to Scene2D
+ and converted to mouse events.
*/
QScene2DPrivate::QScene2DPrivate()
@@ -118,6 +188,15 @@ QScene2DPrivate::~QScene2DPrivate()
delete m_renderManager;
}
+void QScene2DPrivate::setScene(Qt3DCore::QScene *scene)
+{
+ Q_Q(QScene2D);
+ QNodePrivate::setScene(scene);
+ const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(q->id());
+ change->setPropertyName("sceneInitialized");
+ notifyObservers(change);
+}
+
/*!
The constructor creates a new QScene2D instance with the specified \a parent.
@@ -125,58 +204,12 @@ QScene2DPrivate::~QScene2DPrivate()
QScene2D::QScene2D(Qt3DCore::QNode *parent)
: Qt3DCore::QNode(*new QScene2DPrivate, parent)
{
- Q_D(QScene2D);
- connect(d->m_renderManager, &Scene2DManager::onLoadedChanged,
- this, &QScene2D::sourceLoaded);
-}
-
-QScene2D::QScene2D(QQmlEngine *engine, Qt3DCore::QNode *parent)
- : Qt3DCore::QNode(*new QScene2DPrivate, parent)
-{
- Q_D(QScene2D);
- connect(d->m_renderManager, &Scene2DManager::onLoadedChanged,
- this, &QScene2D::sourceLoaded);
- d->m_renderManager->setEngine(engine);
-}
-
-QScene2D::~QScene2D()
-{
-}
-
-bool QScene2D::loaded() const
-{
- Q_D(const QScene2D);
- return d->m_renderManager->m_initialized;
}
/*!
- \property QScene2D::source
- \brief Specifies the url for the qml.
-
- This property specifies the url to the qml being rendered to the texture.
- The source must specify QQuickItem as a root. The item must specify width
- and height. The rendered qml is scaled to the texture size.
- The property can not be changed after the rendering has been initialized.
+ \property QScene2D::item
+ Holds the QQuickItem, which is rendered by QScene2D to the texture.
*/
-QUrl QScene2D::source() const
-{
- Q_D(const QScene2D);
- return d->m_renderManager->m_source;
-}
-
-void QScene2D::setSource(const QUrl &url)
-{
- Q_D(QScene2D);
- if (d->m_renderManager->m_initialized) {
- qWarning() << "Unable to set source after initialization.";
- return;
- }
- if (d->m_renderManager->m_source != url) {
- d->m_renderManager->setSource(url);
- emit sourceChanged(url);
- }
-}
-
QQuickItem* QScene2D::item() const
{
Q_D(const QScene2D);
@@ -250,46 +283,29 @@ Qt3DCore::QNodeCreatedChangeBasePtr QScene2D::createNodeCreationChange() const
data.output = d->m_output ? d->m_output->id() : Qt3DCore::QNodeId();
for (Qt3DCore::QEntity *e : d->m_entities)
data.entityIds.append(e->id());
+ data.mouseEnabled = d->m_renderManager->m_mouseEnabled;
return creationChange;
}
-bool QScene2D::event(QEvent *event)
-{
- Q_D(QScene2D);
- d->m_renderManager->forwardEvent(event);
- return true;
-}
-
-/*!
- Returns the qml engine used by the QScene2D.
- */
-QQmlEngine *QScene2D::engine() const
+bool QScene2D::isMouseEnabled() const
{
Q_D(const QScene2D);
- return d->m_renderManager->m_qmlEngine;
-}
-
-bool QScene2D::isGrabMouseEnabled() const
-{
- Q_D(const QScene2D);
- return d->m_renderManager->m_grabMouse;
+ return d->m_renderManager->m_mouseEnabled;
}
/*!
- \internal
+ Retrieve entities associated with the QScene2D.
*/
-void QScene2D::sourceLoaded()
-{
- emit loadedChanged(true);
-}
-
-
QVector<Qt3DCore::QEntity*> QScene2D::entities()
{
Q_D(const QScene2D);
return d->m_entities;
}
+/*!
+ Adds an \a entity to the the QScene2D object. If the entities have QObjectPicker,
+ the pick events from that entity are sent to QScene2D and converted to mouse events.
+*/
void QScene2D::addEntity(Qt3DCore::QEntity *entity)
{
Q_D(QScene2D);
@@ -306,6 +322,9 @@ void QScene2D::addEntity(Qt3DCore::QEntity *entity)
}
}
+/*!
+ Removes an \a entity from the the QScene2D object.
+*/
void QScene2D::removeEntity(Qt3DCore::QEntity *entity)
{
Q_D(QScene2D);
@@ -322,12 +341,20 @@ void QScene2D::removeEntity(Qt3DCore::QEntity *entity)
}
}
-void QScene2D::setGrabMouseEnabled(bool grab)
+/*!
+ \property QScene2D::mouseEnabled
+ Holds whether mouse events are enabled for the rendered item. The mouse events are
+ generated from object picking events of the entities added to the QScene2D.
+ Mouse is enabled by default.
+
+ \note Events are delayed by one frame due to object picking happening in the backend.
+ */
+void QScene2D::setMouseEnabled(bool enabled)
{
Q_D(QScene2D);
- if (d->m_renderManager->m_grabMouse != grab) {
- d->m_renderManager->m_grabMouse = grab;
- emit grabMouseChanged(grab);
+ if (d->m_renderManager->m_mouseEnabled != enabled) {
+ d->m_renderManager->m_mouseEnabled = enabled;
+ emit mouseEnabledChanged(enabled);
}
}
diff --git a/src/quick3d/quick3dscene2d/items/qscene2d.h b/src/quick3d/quick3dscene2d/items/qscene2d.h
index 2c982668a..73322a9e9 100644
--- a/src/quick3d/quick3dscene2d/items/qscene2d.h
+++ b/src/quick3d/quick3dscene2d/items/qscene2d.h
@@ -60,11 +60,9 @@ class QT3DQUICKSCENE2DSHARED_EXPORT QScene2D : public Qt3DCore::QNode
Q_OBJECT
Q_PROPERTY(Qt3DRender::QRenderTargetOutput *output READ output WRITE setOutput NOTIFY outputChanged)
- Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
Q_PROPERTY(QScene2D::RenderPolicy renderPolicy READ renderPolicy WRITE setRenderPolicy NOTIFY renderPolicyChanged)
- Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
Q_PROPERTY(QQuickItem *item READ item WRITE setItem NOTIFY itemChanged)
- Q_PROPERTY(bool grabMouse READ isGrabMouseEnabled WRITE setGrabMouseEnabled NOTIFY grabMouseChanged)
+ Q_PROPERTY(bool mouseEnabled READ isMouseEnabled WRITE setMouseEnabled NOTIFY mouseEnabledChanged)
Q_CLASSINFO("DefaultProperty", "item")
@@ -77,18 +75,11 @@ public:
Q_ENUM(RenderPolicy)
explicit QScene2D(Qt3DCore::QNode *parent = nullptr);
- QScene2D(QQmlEngine *engine, Qt3DCore::QNode *parent = nullptr);
- ~QScene2D();
Qt3DRender::QRenderTargetOutput *output() const;
- QUrl source() const;
- bool loaded() const;
QScene2D::RenderPolicy renderPolicy() const;
QQuickItem *item() const;
- QQmlEngine *engine() const;
- bool isGrabMouseEnabled() const;
-
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool isMouseEnabled() const;
QVector<Qt3DCore::QEntity *> entities();
void addEntity(Qt3DCore::QEntity *entity);
@@ -96,26 +87,21 @@ public:
public Q_SLOTS:
void setOutput(Qt3DRender::QRenderTargetOutput *output);
- void setSource(const QUrl &url);
void setRenderPolicy(QScene2D::RenderPolicy policy);
void setItem(QQuickItem *item);
- void setGrabMouseEnabled(bool grab);
+ void setMouseEnabled(bool enabled);
Q_SIGNALS:
void outputChanged(Qt3DRender::QRenderTargetOutput *output);
- void sourceChanged(const QUrl &url);
- void loadedChanged(bool loaded);
void renderPolicyChanged(QScene2D::RenderPolicy policy);
void itemChanged(QQuickItem *item);
- void grabMouseChanged(bool grab);
+ void mouseEnabledChanged(bool enabled);
protected:
Q_DECLARE_PRIVATE(QScene2D)
private:
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
-
- void sourceLoaded();
};
} // namespace Quick
diff --git a/src/quick3d/quick3dscene2d/items/qscene2d_p.h b/src/quick3d/quick3dscene2d/items/qscene2d_p.h
index e40d3d6a9..217058f5c 100644
--- a/src/quick3d/quick3dscene2d/items/qscene2d_p.h
+++ b/src/quick3d/quick3dscene2d/items/qscene2d_p.h
@@ -55,6 +55,10 @@
QT_BEGIN_NAMESPACE
+namespace Qt3DCore {
+class QScene;
+}
+
namespace Qt3DRender {
namespace Quick {
@@ -70,6 +74,8 @@ public:
QScene2DPrivate();
~QScene2DPrivate();
+ void setScene(Qt3DCore::QScene *scene) Q_DECL_OVERRIDE;
+
Scene2DManager *m_renderManager;
QMetaObject::Connection m_textureDestroyedConnection;
Qt3DRender::QRenderTargetOutput *m_output;
@@ -82,6 +88,7 @@ struct QScene2DData
Scene2DSharedObjectPtr sharedObject;
Qt3DCore::QNodeId output;
QVector<Qt3DCore::QNodeId> entityIds;
+ bool mouseEnabled;
};
} // namespace Quick
diff --git a/src/quick3d/quick3dscene2d/items/scene2d.cpp b/src/quick3d/quick3dscene2d/items/scene2d.cpp
index ded595b36..b0c58c6c5 100644
--- a/src/quick3d/quick3dscene2d/items/scene2d.cpp
+++ b/src/quick3d/quick3dscene2d/items/scene2d.cpp
@@ -118,6 +118,7 @@ Scene2D::Scene2D()
, m_rbo(0)
, m_initialized(false)
, m_renderInitialized(false)
+ , m_mouseEnabled(true)
, m_renderPolicy(Qt3DRender::Quick::QScene2D::Continuous)
{
renderThreadClientCount->fetchAndAddAcquire(1);
@@ -125,12 +126,7 @@ Scene2D::Scene2D()
Scene2D::~Scene2D()
{
- // this gets called from aspect thread. Wait for the render thread then delete it.
- // TODO: render thread deletion
-// if (m_renderThread) {
-// m_renderThread->wait(1000);
-// delete m_renderThread;
-// }
+ stopGrabbing();
}
void Scene2D::setOutput(Qt3DCore::QNodeId outputId)
@@ -177,6 +173,7 @@ void Scene2D::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &chan
setSharedObject(data.sharedObject);
setOutput(data.output);
m_entities = data.entityIds;
+ m_mouseEnabled = data.mouseEnabled;
}
void Scene2D::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
@@ -192,49 +189,42 @@ void Scene2D::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
} else if (propertyChange->propertyName() == QByteArrayLiteral("output")) {
Qt3DCore::QNodeId outputId = propertyChange->value().value<Qt3DCore::QNodeId>();
setOutput(outputId);
- } else if (propertyChange->propertyName() == QByteArrayLiteral("sharedObject")) {
- const Scene2DSharedObjectPtr sharedObject
- = propertyChange->value().value<Scene2DSharedObjectPtr>();
- setSharedObject(sharedObject);
} else if (propertyChange->propertyName() == QByteArrayLiteral("pressed")) {
QPickEventPtr ev = propertyChange->value().value<QPickEventPtr>();
handlePickEvent(QEvent::MouseButtonPress, ev);
} else if (propertyChange->propertyName() == QByteArrayLiteral("released")) {
QPickEventPtr ev = propertyChange->value().value<QPickEventPtr>();
handlePickEvent(QEvent::MouseButtonRelease, ev);
- } else if (propertyChange->propertyName() == QByteArrayLiteral("clicked")) {
- QPickEventPtr ev = propertyChange->value().value<QPickEventPtr>();
- handlePickEvent(QEvent::MouseButtonDblClick, ev);
} else if (propertyChange->propertyName() == QByteArrayLiteral("moved")) {
QPickEventPtr ev = propertyChange->value().value<QPickEventPtr>();
handlePickEvent(QEvent::MouseMove, ev);
- } else if (propertyChange->propertyName() == QByteArrayLiteral("grabMouse")) {
- if (propertyChange->value().toBool()) {
- startGrabbing();
- } else {
- stopGrabbing();
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("mouseEnabled")) {
+ m_mouseEnabled = propertyChange->value().toBool();
+ if (m_mouseEnabled && !m_cachedPickEvent.isNull()) {
+ handlePickEvent(QEvent::MouseButtonPress, m_cachedPickEvent);
+ m_cachedPickEvent.clear();
}
+ } else if (propertyChange->propertyName() == QByteArrayLiteral("sceneInitialized")) {
+ startGrabbing();
}
- /* TODO: handle these?
- else if (propertyChange->propertyName() == QByteArrayLiteral("entered")) {
-
- } else if (propertyChange->propertyName() == QByteArrayLiteral("exited")) {
-
- }*/
break;
}
case Qt3DCore::PropertyValueAdded: {
const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
- if (change->propertyName() == QByteArrayLiteral("entities"))
+ if (change->propertyName() == QByteArrayLiteral("entities")) {
m_entities.push_back(change->addedNodeId());
+ registerObjectPickerEvents(change->addedNodeId());
+ }
break;
}
case Qt3DCore::PropertyValueRemoved: {
const auto change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
- if (change->propertyName() == QByteArrayLiteral("entities"))
+ if (change->propertyName() == QByteArrayLiteral("entities")) {
m_entities.removeOne(change->removedNodeId());
+ unregisterObjectPickerEvents(change->removedNodeId());
+ }
break;
}
@@ -468,46 +458,54 @@ void Scene2D::unregisterObjectPickerEvents(Qt3DCore::QNodeId entityId)
void Scene2D::handlePickEvent(int type, const Qt3DRender::QPickEventPtr &ev)
{
- QPickTriangleEvent *pickTriangle = static_cast<QPickTriangleEvent *>(ev.data());
- Entity *entity = nullptr;
- if (!resourceAccessor()->accessResource(RenderBackendResourceAccessor::EntityHandle,
- QPickEventPrivate::get(pickTriangle)->m_entity,
- (void**)&entity, nullptr)) {
+ if (!isEnabled())
return;
- }
- CoordinateReader reader(renderer()->nodeManagers());
- if (reader.setGeometry(entity->renderComponent<GeometryRenderer>(),
- QAttribute::defaultTextureCoordinateAttributeName())) {
- QVector4D c0 = reader.getCoordinate(pickTriangle->vertex1Index());
- QVector4D c1 = reader.getCoordinate(pickTriangle->vertex2Index());
- QVector4D c2 = reader.getCoordinate(pickTriangle->vertex3Index());
- QVector4D ci = c0 * pickTriangle->uvw().x()
- + c1 * pickTriangle->uvw().y() + c2 * pickTriangle->uvw().z();
- ci.setW(1.0f);
-
- const QSize size = m_sharedObject->m_quickWindow->size();
- QPointF pos = QPointF(ci.x() * size.width(), ci.y() * size.height());
- QMouseEvent *mouseEvent
- = new QMouseEvent(static_cast<QEvent::Type>(type),
- pos, pos, pos,
- static_cast<Qt::MouseButton>(pickTriangle->button()),
- static_cast<Qt::MouseButtons>(pickTriangle->buttons()),
- static_cast<Qt::KeyboardModifiers>(pickTriangle->modifiers()),
- Qt::MouseEventSynthesizedByApplication);
-
- QCoreApplication::postEvent(m_sharedObject->m_quickWindow, mouseEvent);
+ if (m_mouseEnabled) {
+ QPickTriangleEvent *pickTriangle = static_cast<QPickTriangleEvent *>(ev.data());
+ Entity *entity = nullptr;
+ if (!resourceAccessor()->accessResource(RenderBackendResourceAccessor::EntityHandle,
+ QPickEventPrivate::get(pickTriangle)->m_entity,
+ (void**)&entity, nullptr)) {
+ return;
+ }
+ CoordinateReader reader(renderer()->nodeManagers());
+ if (reader.setGeometry(entity->renderComponent<GeometryRenderer>(),
+ QAttribute::defaultTextureCoordinateAttributeName())) {
+ QVector4D c0 = reader.getCoordinate(pickTriangle->vertex1Index());
+ QVector4D c1 = reader.getCoordinate(pickTriangle->vertex2Index());
+ QVector4D c2 = reader.getCoordinate(pickTriangle->vertex3Index());
+ QVector4D ci = c0 * pickTriangle->uvw().x()
+ + c1 * pickTriangle->uvw().y() + c2 * pickTriangle->uvw().z();
+ ci.setW(1.0f);
+
+ const QSize size = m_sharedObject->m_quickWindow->size();
+ QPointF pos = QPointF(ci.x() * size.width(), (1.0f - ci.y()) * size.height());
+ QMouseEvent *mouseEvent
+ = new QMouseEvent(static_cast<QEvent::Type>(type),
+ pos, pos, pos,
+ static_cast<Qt::MouseButton>(pickTriangle->button()),
+ static_cast<Qt::MouseButtons>(pickTriangle->buttons()),
+ static_cast<Qt::KeyboardModifiers>(pickTriangle->modifiers()),
+ Qt::MouseEventSynthesizedByApplication);
+
+ QCoreApplication::postEvent(m_sharedObject->m_quickWindow, mouseEvent);
+ }
+ } else if (type == QEvent::MouseButtonPress) {
+ m_cachedPickEvent = ev;
+ } else {
+ m_cachedPickEvent.clear();
}
}
void Scene2D::startGrabbing()
{
- for (Qt3DCore::QNodeId e : m_entities)
+ for (Qt3DCore::QNodeId e : qAsConst(m_entities))
registerObjectPickerEvents(e);
}
void Scene2D::stopGrabbing()
{
- for (Qt3DCore::QNodeId e : m_entities)
+ for (Qt3DCore::QNodeId e : qAsConst(m_entities))
unregisterObjectPickerEvents(e);
}
diff --git a/src/quick3d/quick3dscene2d/items/scene2d_p.h b/src/quick3d/quick3dscene2d/items/scene2d_p.h
index d2845d847..b42089306 100644
--- a/src/quick3d/quick3dscene2d/items/scene2d_p.h
+++ b/src/quick3d/quick3dscene2d/items/scene2d_p.h
@@ -119,8 +119,10 @@ public:
bool m_initialized;
bool m_renderInitialized;
+ bool m_mouseEnabled;
Qt3DRender::Quick::QScene2D::RenderPolicy m_renderPolicy;
QVector<Qt3DCore::QNodeId> m_entities;
+ Qt3DRender::QPickEventPtr m_cachedPickEvent;
};
} // Quick
diff --git a/src/quick3d/quick3dscene2d/items/scene2dmanager.cpp b/src/quick3d/quick3dscene2d/items/scene2dmanager.cpp
index f0d6a6e34..20c080dec 100644
--- a/src/quick3d/quick3dscene2d/items/scene2dmanager.cpp
+++ b/src/quick3d/quick3dscene2d/items/scene2dmanager.cpp
@@ -72,9 +72,7 @@ QWindow *RenderControl::renderWindow(QPoint *offset)
Constructs qml render manager.
*/
Scene2DManager::Scene2DManager(QScene2DPrivate *priv)
- : m_qmlEngine(nullptr)
- , m_qmlComponent(nullptr)
- , m_rootItem(nullptr)
+ : m_rootItem(nullptr)
, m_item(nullptr)
, m_priv(priv)
, m_sharedObject(new Scene2DSharedObject(this))
@@ -83,9 +81,7 @@ Scene2DManager::Scene2DManager(QScene2DPrivate *priv)
, m_initialized(false)
, m_renderSyncRequested(false)
, m_backendInitialized(false)
- , m_noSourceMode(false)
- , m_ownEngine(false)
- , m_grabMouse(false)
+ , m_mouseEnabled(true)
{
m_sharedObject->m_surface = new QOffscreenSurface;
m_sharedObject->m_surface->setFormat(QSurfaceFormat::defaultFormat());
@@ -135,38 +131,17 @@ void Scene2DManager::requestRenderSync()
void Scene2DManager::startIfInitialized()
{
- if (!m_initialized && m_backendInitialized) {
- if (m_source.isValid() && !m_noSourceMode) {
- // Create a QML engine.
- if (!m_qmlEngine) {
- m_qmlEngine = new QQmlEngine;
- if (!m_qmlEngine->incubationController()) {
- m_qmlEngine->setIncubationController(m_sharedObject->m_quickWindow
- ->incubationController());
- }
- }
-
- // create component
- m_ownEngine = true;
- m_qmlComponent = new QQmlComponent(m_qmlEngine, m_source);
- if (m_qmlComponent->isLoading()) {
- connect(m_qmlComponent, &QQmlComponent::statusChanged,
- this, &Scene2DManager::run);
- } else {
- run();
- }
- } else if (m_item != nullptr) {
- m_rootItem = m_item;
+ if (!m_initialized && m_backendInitialized && m_item != nullptr) {
+ m_rootItem = m_item;
- // Associate root item with the window.
- m_rootItem->setParentItem(m_sharedObject->m_quickWindow->contentItem());
+ // Associate root item with the window.
+ m_rootItem->setParentItem(m_sharedObject->m_quickWindow->contentItem());
- // Update window size.
- updateSizes();
+ // Update window size.
+ updateSizes();
- m_initialized = true;
- m_sharedObject->setInitialized();
- }
+ m_initialized = true;
+ m_sharedObject->setInitialized();
}
}
@@ -177,54 +152,9 @@ void Scene2DManager::stopAndClean()
m_sharedObject->requestQuit();
m_sharedObject->wait();
m_sharedObject->cleanup();
- if (m_ownEngine) {
- QObject::disconnect(m_connection);
- delete m_qmlEngine;
- }
- delete m_qmlComponent;
- m_qmlEngine = nullptr;
- m_qmlComponent = nullptr;
}
}
-void Scene2DManager::run()
-{
- disconnect(m_qmlComponent, &QQmlComponent::statusChanged, this, &Scene2DManager::run);
-
- if (m_qmlComponent->isError()) {
- QList<QQmlError> errorList = m_qmlComponent->errors();
- for (const QQmlError &error: errorList)
- qWarning() << error.url() << error.line() << error;
- return;
- }
-
- QObject *rootObject = m_qmlComponent->create();
- if (m_qmlComponent->isError()) {
- QList<QQmlError> errorList = m_qmlComponent->errors();
- for (const QQmlError &error: errorList)
- qWarning() << error.url() << error.line() << error;
- return;
- }
-
- m_rootItem = qobject_cast<QQuickItem *>(rootObject);
- if (!m_rootItem) {
- qWarning("QScene2D: Root item is not a QQuickItem.");
- delete rootObject;
- return;
- }
-
- // The root item is ready. Associate it with the window.
- m_rootItem->setParentItem(m_sharedObject->m_quickWindow->contentItem());
-
- // Update window size.
- updateSizes();
-
- m_initialized = true;
- m_sharedObject->setInitialized();
-
- emit onLoadedChanged();
-}
-
void Scene2DManager::updateSizes()
{
const int width = m_rootItem->width();
@@ -236,15 +166,8 @@ void Scene2DManager::updateSizes()
m_sharedObject->m_quickWindow->setGeometry(0, 0, width, height);
}
-void Scene2DManager::setSource(const QUrl &url)
-{
- m_source = url;
- startIfInitialized();
-}
-
void Scene2DManager::setItem(QQuickItem *item)
{
- m_noSourceMode = true;
m_item = item;
startIfInitialized();
}
@@ -302,33 +225,6 @@ bool Scene2DManager::event(QEvent *e)
return QObject::event(e);
}
-bool Scene2DManager::forwardEvent(QEvent *event)
-{
- switch (event->type()) {
-
- case QEvent::MouseMove:
- case QEvent::MouseButtonDblClick:
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonRelease: {
- QMouseEvent* me = static_cast<QMouseEvent *>(event);
- QPointF pos = me->localPos();
- pos = QPointF(pos.x() * m_rootItem->width(), pos.y() * m_rootItem->height());
- QMouseEvent nme = QMouseEvent(me->type(), pos, pos, pos, me->button(), me->buttons(),
- me->modifiers(), Qt::MouseEventSynthesizedByApplication);
- QCoreApplication::sendEvent(m_sharedObject->m_quickWindow, &nme);
- } break;
-
- case QEvent::KeyPress:
- case QEvent::KeyRelease: {
- QCoreApplication::sendEvent(m_sharedObject->m_quickWindow, event);
- } break;
-
- default:
- break;
- }
- return false;
-}
-
void Scene2DManager::doRenderSync()
{
QMutexLocker lock(&m_sharedObject->m_mutex);
@@ -346,23 +242,6 @@ void Scene2DManager::cleanup()
stopAndClean();
}
-void Scene2DManager::setEngine(QQmlEngine *engine)
-{
- m_qmlEngine = engine;
- m_ownEngine = false;
- if (engine) {
- m_connection = QObject::connect(engine, &QObject::destroyed,
- this, &Scene2DManager::engineDestroyed);
- }
-}
-
-void Scene2DManager::engineDestroyed()
-{
- QObject::disconnect(m_connection);
- m_qmlEngine = nullptr;
- m_ownEngine = false;
-}
-
} // namespace Quick
} // namespace Qt3DRender
diff --git a/src/quick3d/quick3dscene2d/items/scene2dmanager_p.h b/src/quick3d/quick3dscene2d/items/scene2dmanager_p.h
index d3c3a60a2..821616f47 100644
--- a/src/quick3d/quick3dscene2d/items/scene2dmanager_p.h
+++ b/src/quick3d/quick3dscene2d/items/scene2dmanager_p.h
@@ -75,46 +75,33 @@ public:
Scene2DManager(QScene2DPrivate *priv);
~Scene2DManager();
- QQmlEngine *m_qmlEngine;
- QQmlComponent *m_qmlComponent;
QQuickItem *m_rootItem;
QQuickItem *m_item;
QScene2DPrivate *m_priv;
QSharedPointer<Scene2DSharedObject> m_sharedObject;
- QUrl m_source;
Qt3DCore::QNodeId m_id;
- QMetaObject::Connection m_connection;
QScene2D::RenderPolicy m_renderPolicy;
bool m_requested;
bool m_initialized;
bool m_renderSyncRequested;
bool m_backendInitialized;
- bool m_noSourceMode;
- bool m_ownEngine;
- bool m_grabMouse;
+ bool m_mouseEnabled;
void requestRender();
void requestRenderSync();
void doRenderSync();
void startIfInitialized();
void stopAndClean();
- void run();
void updateSizes();
- void setSource(const QUrl &url);
void setItem(QQuickItem *item);
bool event(QEvent *e) Q_DECL_OVERRIDE;
- bool forwardEvent(QEvent *event);
-
- Q_SIGNAL void onLoadedChanged();
void cleanup();
- void setEngine(QQmlEngine *engine);
- void engineDestroyed();
};
} // namespace Quick
diff --git a/src/render/backend/platformsurfacefilter.cpp b/src/render/backend/platformsurfacefilter.cpp
index 891e30c44..7458f607d 100644
--- a/src/render/backend/platformsurfacefilter.cpp
+++ b/src/render/backend/platformsurfacefilter.cpp
@@ -107,6 +107,10 @@ bool PlatformSurfaceFilter::eventFilter(QObject *obj, QEvent *e)
// If we remove it, the call to isSurfaceValid will
// implicitely return false
PlatformSurfaceFilter::m_surfacesValidity.remove(m_surface);
+ if (m_obj) {
+ m_obj->removeEventFilter(this);
+ m_obj = nullptr;
+ }
break;
}
diff --git a/src/render/backend/renderviewbuilder.cpp b/src/render/backend/renderviewbuilder.cpp
index f1355d27e..f47c6f419 100644
--- a/src/render/backend/renderviewbuilder.cpp
+++ b/src/render/backend/renderviewbuilder.cpp
@@ -66,14 +66,14 @@ public:
RenderView *rv = m_renderViewJob->renderView();
int totalCommandCount = 0;
- for (const auto renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs))
+ for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs))
totalCommandCount += renderViewCommandBuilder->commands().size();
QVector<RenderCommand *> commands;
commands.reserve(totalCommandCount);
// Reduction
- for (const auto renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs))
+ for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs))
commands += std::move(renderViewCommandBuilder->commands());
rv->setCommands(commands);
@@ -139,13 +139,13 @@ public:
m_filterEntityByLayerJob->setLayers(rv->layerFilter());
// Material Parameter building
- for (const auto materialGatherer : qAsConst(m_materialGathererJobs)) {
+ for (const auto &materialGatherer : qAsConst(m_materialGathererJobs)) {
materialGatherer->setRenderPassFilter(const_cast<RenderPassFilter *>(rv->renderPassFilter()));
materialGatherer->setTechniqueFilter(const_cast<TechniqueFilter *>(rv->techniqueFilter()));
}
// Command builders
- for (const auto renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs))
+ for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs))
renderViewCommandBuilder->setRenderView(rv);
// Set whether frustum culling is enabled or not
@@ -188,8 +188,6 @@ public:
RenderView *rv = m_renderViewJob->renderView();
if (!rv->noDraw()) {
- // Set the light sources
- rv->setLightSources(std::move(m_lightGathererJob->lights()));
rv->setEnvironmentLight(m_lightGathererJob->takeEnvironmentLight());
// We sort the vector so that the removal can then be performed linearly
@@ -208,6 +206,14 @@ public:
QVector<Entity *> filteredEntities = m_filterEntityByLayerJob->filteredEntities();
RenderViewBuilder::removeEntitiesNotInSubset(renderableEntities, filteredEntities);
+ // Set the light sources, with layer filters applied.
+ QVector<LightSource> lightSources = m_lightGathererJob->lights();
+ for (int i = 0; i < lightSources.count(); ++i) {
+ if (!filteredEntities.contains(lightSources[i].entity))
+ lightSources.removeAt(i--);
+ }
+ rv->setLightSources(lightSources);
+
// Filter out frustum culled entity for drawable entities
if (isDraw && rv->frustumCulling())
RenderViewBuilder::removeEntitiesNotInSubset(renderableEntities, m_frustumCullingJob->visibleEntities());
@@ -225,7 +231,7 @@ public:
// Reduction
QHash<Qt3DCore::QNodeId, QVector<RenderPassParameterData>> params;
- for (const auto materialGatherer : qAsConst(m_materialGathererJobs))
+ for (const auto &materialGatherer : qAsConst(m_materialGathererJobs))
params.unite(materialGatherer->materialToPassAndParameter());
// Set all required data on the RenderView for final processing
rv->setMaterialParameterTable(std::move(params));
@@ -425,7 +431,7 @@ QVector<Qt3DCore::QAspectJobPtr> RenderViewBuilder::buildJobHierachy() const
m_filterEntityByLayerJob->addDependency(m_renderer->updateTreeEnabledJob());
m_syncRenderCommandBuildingJob->addDependency(m_syncRenderViewInitializationJob);
- for (const auto materialGatherer : qAsConst(m_materialGathererJobs)) {
+ for (const auto &materialGatherer : qAsConst(m_materialGathererJobs)) {
materialGatherer->addDependency(m_syncRenderViewInitializationJob);
materialGatherer->addDependency(m_renderer->filterCompatibleTechniqueJob());
m_syncRenderCommandBuildingJob->addDependency(materialGatherer);
@@ -436,7 +442,7 @@ QVector<Qt3DCore::QAspectJobPtr> RenderViewBuilder::buildJobHierachy() const
m_syncRenderCommandBuildingJob->addDependency(m_lightGathererJob);
m_syncRenderCommandBuildingJob->addDependency(m_frustumCullingJob);
- for (const auto renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) {
+ for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) {
renderViewCommandBuilder->addDependency(m_syncRenderCommandBuildingJob);
m_syncRenderViewCommandBuildersJob->addDependency(renderViewCommandBuilder);
}
@@ -458,13 +464,13 @@ QVector<Qt3DCore::QAspectJobPtr> RenderViewBuilder::buildJobHierachy() const
jobs.push_back(m_filterEntityByLayerJob); // Step 3
jobs.push_back(m_setClearDrawBufferIndexJob); // Step 3
- for (const auto materialGatherer : qAsConst(m_materialGathererJobs)) // Step3
+ for (const auto &materialGatherer : qAsConst(m_materialGathererJobs)) // Step3
jobs.push_back(materialGatherer);
jobs.push_back(m_frustumCullingJob); // Step 4
jobs.push_back(m_syncRenderCommandBuildingJob); // Step 4
- for (const auto renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) // Step 5
+ for (const auto &renderViewCommandBuilder : qAsConst(m_renderViewBuilderJobs)) // Step 5
jobs.push_back(renderViewCommandBuilder);
jobs.push_back(m_syncRenderViewCommandBuildersJob); // Step 6
diff --git a/src/render/framegraph/rendercapture.cpp b/src/render/framegraph/rendercapture.cpp
index 1d3117c0d..dea1cf565 100644
--- a/src/render/framegraph/rendercapture.cpp
+++ b/src/render/framegraph/rendercapture.cpp
@@ -92,7 +92,7 @@ void RenderCapture::sendRenderCaptures()
{
QMutexLocker lock(&m_mutex);
- for (const RenderCaptureDataPtr data : qAsConst(m_renderCaptureData)) {
+ for (const RenderCaptureDataPtr &data : qAsConst(m_renderCaptureData)) {
auto e = Qt3DCore::QPropertyUpdatedChangePtr::create(peerId());
e->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
e->setPropertyName("renderCaptureData");
diff --git a/src/render/framegraph/viewportnode.cpp b/src/render/framegraph/viewportnode.cpp
index c16a660b0..b68f7b55b 100644
--- a/src/render/framegraph/viewportnode.cpp
+++ b/src/render/framegraph/viewportnode.cpp
@@ -123,7 +123,7 @@ void ViewportNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
if (e->type() == PropertyUpdated) {
QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
if (propertyChange->propertyName() == QByteArrayLiteral("normalizedRect")) {
- QRectF normalizedRect = propertyChange->value().value<QRectF>();
+ QRectF normalizedRect = propertyChange->value().toRectF();
setXMin(normalizedRect.x());
setYMin(normalizedRect.y());
setXMax(normalizedRect.width());
diff --git a/src/render/frontend/qabstractfunctor.h b/src/render/frontend/qabstractfunctor.h
index c05c04743..95f6aee51 100644
--- a/src/render/frontend/qabstractfunctor.h
+++ b/src/render/frontend/qabstractfunctor.h
@@ -80,6 +80,14 @@ public:
virtual ~QAbstractFunctor();
virtual qintptr id() const = 0;
+ // TODO: Remove when moving a copy of this to Qt3DCore
+ template<class T>
+ const T *functor_cast(const QAbstractFunctor *other) const
+ {
+ if (other->id() == functorTypeId<T>())
+ return static_cast<const T *>(other);
+ return nullptr;
+ }
private:
Q_DISABLE_COPY(QAbstractFunctor)
};
diff --git a/src/render/frontend/qlevelofdetail.cpp b/src/render/frontend/qlevelofdetail.cpp
index 4d6b07d4b..03df4e6a8 100644
--- a/src/render/frontend/qlevelofdetail.cpp
+++ b/src/render/frontend/qlevelofdetail.cpp
@@ -413,7 +413,7 @@ void QLevelOfDetail::setThresholds(const QVector<qreal> &thresholds)
Q_D(QLevelOfDetail);
if (d->m_thresholds != thresholds) {
d->m_thresholds = thresholds;
- thresholdsChanged(d->m_thresholds);
+ emit thresholdsChanged(d->m_thresholds);
}
}
diff --git a/src/render/frontend/qrenderaspect.cpp b/src/render/frontend/qrenderaspect.cpp
index a135c34e4..1f88cb006 100644
--- a/src/render/frontend/qrenderaspect.cpp
+++ b/src/render/frontend/qrenderaspect.cpp
@@ -255,7 +255,7 @@ void QRenderAspectPrivate::registerBackendTypes()
q->registerBackendType<QObjectPicker>(QSharedPointer<Render::NodeFunctor<Render::ObjectPicker, Render::ObjectPickerManager> >::create(m_renderer));
// Plugins
- for (QString plugin : m_pluginConfig)
+ for (const QString &plugin : m_pluginConfig)
loadRenderPlugin(plugin);
}
@@ -595,7 +595,7 @@ void QRenderAspectPrivate::configurePlugin(const QString &plugin)
if (!m_pluginConfig.contains(plugin)) {
m_pluginConfig.append(plugin);
- for (QRenderAspectPrivate *instance : m_instances)
+ for (QRenderAspectPrivate *instance : qAsConst(m_instances))
instance->loadRenderPlugin(plugin);
}
}
diff --git a/src/render/geometry/attribute.cpp b/src/render/geometry/attribute.cpp
index 7e1ea79dd..6c8c0113a 100644
--- a/src/render/geometry/attribute.cpp
+++ b/src/render/geometry/attribute.cpp
@@ -108,7 +108,7 @@ void Attribute::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
QByteArray propertyName = propertyChange->propertyName();
if (propertyName == QByteArrayLiteral("name")) {
- m_name = propertyChange->value().value<QString>();
+ m_name = propertyChange->value().toString();
m_nameId = StringToInt::lookupId(m_name);
m_attributeDirty = true;
} else if (propertyName == QByteArrayLiteral("vertexBaseType")) {
diff --git a/src/render/geometry/buffer.cpp b/src/render/geometry/buffer.cpp
index 82dbbcc1b..55c86910f 100644
--- a/src/render/geometry/buffer.cpp
+++ b/src/render/geometry/buffer.cpp
@@ -151,7 +151,7 @@ void Buffer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
QPropertyUpdatedChangePtr propertyChange = qSharedPointerCast<QPropertyUpdatedChange>(e);
QByteArray propertyName = propertyChange->propertyName();
if (propertyName == QByteArrayLiteral("data")) {
- QByteArray newData = propertyChange->value().value<QByteArray>();
+ QByteArray newData = propertyChange->value().toByteArray();
bool dirty = m_data != newData;
m_bufferDirty |= dirty;
m_data = newData;
diff --git a/src/render/geometry/geometryrenderer.cpp b/src/render/geometry/geometryrenderer.cpp
index 54fe61831..4f5432e1d 100644
--- a/src/render/geometry/geometryrenderer.cpp
+++ b/src/render/geometry/geometryrenderer.cpp
@@ -153,7 +153,7 @@ void GeometryRenderer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
m_verticesPerPatch = propertyChange->value().value<int>();
m_dirty = true;
} else if (propertyName == QByteArrayLiteral("primitiveRestartEnabled")) {
- m_primitiveRestartEnabled = propertyChange->value().value<bool>();
+ m_primitiveRestartEnabled = propertyChange->value().toBool();
m_dirty = true;
} else if (propertyName == QByteArrayLiteral("primitiveType")) {
m_primitiveType = static_cast<QGeometryRenderer::PrimitiveType>(propertyChange->value().value<int>());
diff --git a/src/render/raycasting/qabstractcollisionqueryservice_p.h b/src/render/raycasting/qabstractcollisionqueryservice_p.h
index 806c33d5b..1c1261937 100644
--- a/src/render/raycasting/qabstractcollisionqueryservice_p.h
+++ b/src/render/raycasting/qabstractcollisionqueryservice_p.h
@@ -79,6 +79,7 @@ public:
class QT3DRENDERSHARED_EXPORT QAbstractCollisionQueryService : public Qt3DCore::QAbstractServiceProvider
{
+ Q_OBJECT
public:
enum QueryMode {
FirstHit,
diff --git a/src/render/texture/gltexture.cpp b/src/render/texture/gltexture.cpp
index a2e0dc5d0..606681bd5 100644
--- a/src/render/texture/gltexture.cpp
+++ b/src/render/texture/gltexture.cpp
@@ -188,6 +188,8 @@ QOpenGLTexture* GLTexture::getOrCreateGLTexture()
if (!m_gl) {
m_gl = buildGLTexture();
+ if (!m_gl)
+ return nullptr;
m_gl->allocateStorage();
if (!m_gl->isStorageAllocated()) {
qWarning() << Q_FUNC_INFO << "texture storage allocation failed";