summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-10-10 19:46:48 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2016-10-10 19:46:48 +0000
commit410e2f52e0041e695c5d5814bf67bb078b608ce3 (patch)
tree592525c28bd60b42f95805b80a495e8fd8d0263a
parent6af98f6a489ad4ed8542efd3377413c80f4bf1ef (diff)
parentf82880c7b8cff8419873a936ced956d20ba88933 (diff)
Merge "Merge branch '5.7' into 5.8" into refs/staging/5.8
-rw-r--r--examples/qt3d/audio-visualizer-qml/images/demotitle.pngbin20912 -> 7449 bytes
-rw-r--r--examples/qt3d/audio-visualizer-qml/images/songtitle.pngbin5764 -> 6181 bytes
-rw-r--r--examples/qt3d/basicshapes-cpp/main.cpp10
-rw-r--r--src/core/changes/qnodecreatedchange.cpp47
-rw-r--r--src/core/nodes/qentity.cpp4
-rw-r--r--src/core/nodes/qnode.cpp43
-rw-r--r--src/core/nodes/qnode_p.h2
-rw-r--r--src/extras/geometries/qtorusgeometry.cpp127
-rw-r--r--src/extras/geometries/qtorusgeometry_p.h1
-rw-r--r--src/extras/shaders/es2/light.inc.frag9
-rw-r--r--src/extras/shaders/gl3/gooch.frag3
-rw-r--r--src/input/backend/axissetting_p.h2
-rw-r--r--src/input/backend/qabstractphysicaldevicebackendnode.cpp5
-rw-r--r--src/input/frontend/qbuttonaxisinput.cpp4
-rw-r--r--src/input/frontend/qbuttonaxisinput_p.h2
-rw-r--r--src/quick3d/imports/core/plugins.qmltypes145
-rw-r--r--src/quick3d/imports/extras/plugins.qmltypes90
-rw-r--r--src/quick3d/imports/input/plugins.qmltypes42
-rw-r--r--src/quick3d/imports/logic/plugins.qmltypes3
-rw-r--r--src/quick3d/imports/render/plugins.qmltypes1246
-rw-r--r--src/quick3d/imports/scene3d/plugins.qmltypes2
-rw-r--r--src/render/backend/renderview.cpp3
-rw-r--r--src/render/framegraph/framegraphnode.cpp33
-rw-r--r--src/render/framegraph/framegraphnode_p.h2
-rw-r--r--src/render/frontend/qrendersettings.h2
-rw-r--r--src/render/materialsystem/shaderdata.cpp2
-rw-r--r--tests/auto/core/handlemanager/tst_handlemanager.cpp14
-rw-r--r--tests/auto/core/nodes/tst_nodes.cpp2
-rw-r--r--tests/auto/core/qframeallocator/tst_qframeallocator.cpp6
-rw-r--r--tests/auto/core/qtransform/tst_qtransform.cpp8
-rw-r--r--tests/auto/extras/common/common.pri6
-rw-r--r--tests/auto/extras/common/geometrytesthelper.h105
-rw-r--r--tests/auto/extras/extras.pro3
-rw-r--r--tests/auto/extras/qcuboidgeometry/qcuboidgeometry.pro2
-rw-r--r--tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp72
-rw-r--r--tests/auto/extras/qtorusgeometry/qtorusgeometry.pro12
-rw-r--r--tests/auto/extras/qtorusgeometry/tst_qtorusgeometry.cpp366
-rw-r--r--tests/auto/input/input.pro3
-rw-r--r--tests/auto/input/qabstractphysicaldevicebackendnode/qabstractphysicaldevicebackendnode.pro11
-rw-r--r--tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp246
-rw-r--r--tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp12
-rw-r--r--tests/auto/render/framegraphnode/tst_framegraphnode.cpp125
-rw-r--r--tests/auto/render/qray3d/tst_qray3d.cpp8
-rw-r--r--tests/auto/render/raycasting/tst_raycasting.cpp2
-rw-r--r--tests/auto/render/triangleboundingvolume/tst_triangleboundingvolume.cpp2
-rw-r--r--tests/manual/dynamicscene-cpp/examplescene.cpp2
-rw-r--r--tools/qgltf/qgltf.cpp118
-rw-r--r--tools/qgltf/qgltf.pro3
48 files changed, 2565 insertions, 392 deletions
diff --git a/examples/qt3d/audio-visualizer-qml/images/demotitle.png b/examples/qt3d/audio-visualizer-qml/images/demotitle.png
index 58816784e..75c6c42bd 100644
--- a/examples/qt3d/audio-visualizer-qml/images/demotitle.png
+++ b/examples/qt3d/audio-visualizer-qml/images/demotitle.png
Binary files differ
diff --git a/examples/qt3d/audio-visualizer-qml/images/songtitle.png b/examples/qt3d/audio-visualizer-qml/images/songtitle.png
index 2a9961093..84efe533a 100644
--- a/examples/qt3d/audio-visualizer-qml/images/songtitle.png
+++ b/examples/qt3d/audio-visualizer-qml/images/songtitle.png
Binary files differ
diff --git a/examples/qt3d/basicshapes-cpp/main.cpp b/examples/qt3d/basicshapes-cpp/main.cpp
index b4b01ff30..fffb83a20 100644
--- a/examples/qt3d/basicshapes-cpp/main.cpp
+++ b/examples/qt3d/basicshapes-cpp/main.cpp
@@ -73,6 +73,7 @@
#include <Qt3DRender/qtexture.h>
#include <Qt3DRender/qrenderpass.h>
#include <Qt3DRender/qsceneloader.h>
+#include <Qt3DRender/qpointlight.h>
#include <Qt3DCore/qtransform.h>
#include <Qt3DCore/qaspectengine.h>
@@ -116,6 +117,15 @@ int main(int argc, char **argv)
cameraEntity->setUpVector(QVector3D(0, 1, 0));
cameraEntity->setViewCenter(QVector3D(0, 0, 0));
+ Qt3DCore::QEntity *lightEntity = new Qt3DCore::QEntity(rootEntity);
+ Qt3DRender::QPointLight *light = new Qt3DRender::QPointLight(lightEntity);
+ light->setColor("white");
+ light->setIntensity(1);
+ lightEntity->addComponent(light);
+ Qt3DCore::QTransform *lightTransform = new Qt3DCore::QTransform(lightEntity);
+ lightTransform->setTranslation(cameraEntity->position());
+ lightEntity->addComponent(lightTransform);
+
// For camera controls
Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(rootEntity);
camController->setCamera(cameraEntity);
diff --git a/src/core/changes/qnodecreatedchange.cpp b/src/core/changes/qnodecreatedchange.cpp
index 891d21986..06e85fbfc 100644
--- a/src/core/changes/qnodecreatedchange.cpp
+++ b/src/core/changes/qnodecreatedchange.cpp
@@ -37,59 +37,16 @@
#include "qnodecreatedchange.h"
#include "qnodecreatedchange_p.h"
#include <Qt3DCore/qnode.h>
-#include <QtCore/qmetaobject.h>
-#include <QtCore/private/qmetaobject_p.h>
+#include <Qt3DCore/private/qnode_p.h>
QT_BEGIN_NAMESPACE
-namespace {
-
-/*! \internal */
-inline const QMetaObjectPrivate *priv(const uint* data)
-{
- return reinterpret_cast<const QMetaObjectPrivate*>(data);
-}
-
-/*! \internal */
-inline bool isDynamicMetaObject(const QMetaObject *mo)
-{
- return (priv(mo->d.data)->flags & DynamicMetaObject);
-}
-
-/*!
- * \internal
- *
- * Find the most derived metaobject that doesn't have a dynamic
- * metaobject farther up the chain.
- * TODO: Add support to QMetaObject to explicitly say if it's a dynamic
- * or static metaobject so we don't need this logic
- */
-const QMetaObject *findStaticMetaObject(const QMetaObject *metaObject)
-{
- const QMetaObject *lastStaticMetaobject = nullptr;
- auto mo = metaObject;
- while (mo) {
- const bool dynamicMetaObject = isDynamicMetaObject(mo);
- if (dynamicMetaObject)
- lastStaticMetaobject = nullptr;
-
- if (!dynamicMetaObject && !lastStaticMetaobject)
- lastStaticMetaobject = mo;
-
- mo = mo->superClass();
- }
- Q_ASSERT(lastStaticMetaobject);
- return lastStaticMetaobject;
-}
-
-}
-
namespace Qt3DCore {
QNodeCreatedChangeBasePrivate::QNodeCreatedChangeBasePrivate(const QNode *node)
: QSceneChangePrivate()
, m_parentId(node->parentNode() ? node->parentNode()->id() : QNodeId())
- , m_metaObject(findStaticMetaObject(node->metaObject()))
+ , m_metaObject(QNodePrivate::findStaticMetaObject(node->metaObject()))
, m_nodeEnabled(node->isEnabled())
{
}
diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp
index ea3523c0c..b28898c60 100644
--- a/src/core/nodes/qentity.cpp
+++ b/src/core/nodes/qentity.cpp
@@ -232,8 +232,8 @@ QNodeCreatedChangeBasePtr QEntity::createNodeCreationChange() const
data.parentEntityId = parentEntity() ? parentEntity()->id() : Qt3DCore::QNodeId();
data.componentIdsAndTypes.reserve(d->m_components.size());
const QComponentVector &components = d->m_components;
- for (const auto &c : components) {
- const auto idAndType = QNodeIdTypePair(c->id(), c->metaObject());
+ for (QComponent *c : components) {
+ const auto idAndType = QNodeIdTypePair(c->id(), QNodePrivate::findStaticMetaObject(c->metaObject()));
data.componentIdsAndTypes.push_back(idAndType);
}
diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp
index f0df147ab..8dbcb295a 100644
--- a/src/core/nodes/qnode.cpp
+++ b/src/core/nodes/qnode.cpp
@@ -54,6 +54,7 @@
#include <QChildEvent>
#include <QMetaObject>
#include <QMetaProperty>
+#include <QtCore/private/qmetaobject_p.h>
#include <Qt3DCore/QComponent>
#include <Qt3DCore/private/corelogging_p.h>
#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
@@ -793,6 +794,48 @@ QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const
return QNodeCreatedChangeBasePtr::create(this);
}
+namespace {
+
+/*! \internal */
+inline const QMetaObjectPrivate *priv(const uint* data)
+{
+ return reinterpret_cast<const QMetaObjectPrivate*>(data);
+}
+
+/*! \internal */
+inline bool isDynamicMetaObject(const QMetaObject *mo)
+{
+ return (priv(mo->d.data)->flags & DynamicMetaObject);
+}
+
+} // anonymous
+
+/*!
+ * \internal
+ *
+ * Find the most derived metaobject that doesn't have a dynamic
+ * metaobject farther up the chain.
+ * TODO: Add support to QMetaObject to explicitly say if it's a dynamic
+ * or static metaobject so we don't need this logic
+ */
+const QMetaObject *QNodePrivate::findStaticMetaObject(const QMetaObject *metaObject)
+{
+ const QMetaObject *lastStaticMetaobject = nullptr;
+ auto mo = metaObject;
+ while (mo) {
+ const bool dynamicMetaObject = isDynamicMetaObject(mo);
+ if (dynamicMetaObject)
+ lastStaticMetaobject = nullptr;
+
+ if (!dynamicMetaObject && !lastStaticMetaobject)
+ lastStaticMetaobject = mo;
+
+ mo = mo->superClass();
+ }
+ Q_ASSERT(lastStaticMetaobject);
+ return lastStaticMetaobject;
+}
+
} // namespace Qt3DCore
QT_END_NAMESPACE
diff --git a/src/core/nodes/qnode_p.h b/src/core/nodes/qnode_p.h
index 56a54a8ae..dec114084 100644
--- a/src/core/nodes/qnode_p.h
+++ b/src/core/nodes/qnode_p.h
@@ -130,6 +130,8 @@ public:
QObject::disconnect(m_destructionConnections.take(node));
}
+ static const QMetaObject *findStaticMetaObject(const QMetaObject *metaObject);
+
private:
void notifyCreationChange();
void notifyDestructionChangesAndRemoveFromScene();
diff --git a/src/extras/geometries/qtorusgeometry.cpp b/src/extras/geometries/qtorusgeometry.cpp
index 801281110..ebc944e72 100644
--- a/src/extras/geometries/qtorusgeometry.cpp
+++ b/src/extras/geometries/qtorusgeometry.cpp
@@ -44,6 +44,7 @@
#include <Qt3DRender/qattribute.h>
#include <qmath.h>
#include <QVector3D>
+#include <QVector4D>
QT_BEGIN_NAMESPACE
@@ -53,30 +54,47 @@ namespace Qt3DExtras {
namespace {
+int vertexCount(int requestedRings, int requestedSlices)
+{
+ return (requestedRings + 1) * (requestedSlices + 1);
+}
+
+int triangleCount(int requestedRings, int requestedSlices)
+{
+ return 2 * requestedRings * requestedSlices;
+}
+
QByteArray createTorusVertexData(double radius, double minorRadius,
- int rings, int sides)
+ int rings, int slices)
{
- const int nVerts = sides * (rings + 1);
+ // The additional side and ring compared to what the user asked
+ // for is because we also need to ensure proper texture coordinate
+ // wrapping at the seams. Without this the last ring and side would
+ // interpolate the texture coordinates from ~0.9x back down to 0
+ // (the starting value at the first ring). So we insert an extra
+ // ring and side with the same positions as the first ring and side
+ // but with texture coordinates of 1 (compared to 0).
+ const int nVerts = vertexCount(rings, slices);
QByteArray bufferBytes;
- // vec3 pos, vec2 texCoord, vec3 normal
- const quint32 elementSize = 3 + 2 + 3;
+ // vec3 pos, vec2 texCoord, vec3 normal, vec4 tangent
+ const quint32 elementSize = 3 + 2 + 3 + 4;
const quint32 stride = elementSize * sizeof(float);
bufferBytes.resize(stride * nVerts);
float* fptr = reinterpret_cast<float*>(bufferBytes.data());
- const float ringFactor = (M_PI * 2) / static_cast<float>( rings );
- const float sideFactor = (M_PI * 2) / static_cast<float>( sides );
+ const float ringFactor = (M_PI * 2) / static_cast<float>(rings);
+ const float sliceFactor = (M_PI * 2) / static_cast<float>(slices);
for (int ring = 0; ring <= rings; ++ring) {
const float u = ring * ringFactor;
- const float cu = qCos( u );
- const float su = qSin( u );
+ const float cu = qCos(u);
+ const float su = qSin(u);
- for (int side = 0; side < sides; ++side) {
- const float v = side * sideFactor;
- const float cv = qCos( v );
- const float sv = qSin( v );
+ for (int slice = 0; slice <= slices; ++slice) {
+ const float v = slice * sliceFactor;
+ const float cv = qCos(v + M_PI);
+ const float sv = qSin(v);
const float r = (radius + minorRadius * cv);
*fptr++ = r * cu;
@@ -86,37 +104,45 @@ QByteArray createTorusVertexData(double radius, double minorRadius,
*fptr++ = u / (M_PI * 2);
*fptr++ = v / (M_PI * 2);
- QVector3D n(cv * cu * r, cv * su * r, sv * r);
+ QVector3D n(cv * cu, cv * su, sv);
n.normalize();
*fptr++ = n.x();
*fptr++ = n.y();
*fptr++ = n.z();
+
+ QVector4D t(-su, cu, 0.0f, 1.0f);
+ t.normalize();
+ *fptr++ = t.x();
+ *fptr++ = t.y();
+ *fptr++ = t.z();
+ *fptr++ = t.w();
}
}
return bufferBytes;
}
-QByteArray createTorusIndexData(int rings, int sides)
+QByteArray createTorusIndexData(int requestedRings, int requestedSlices)
{
- QByteArray indexBytes;
- int faces = (sides * 2) * rings; // two tris per side, for all rings
- int indices = faces * 3;
+ const int slices = requestedSlices + 1;
+ int triangles = triangleCount(requestedRings, requestedSlices);
+ int indices = triangles * 3;
Q_ASSERT(indices < 65536);
+ QByteArray indexBytes;
indexBytes.resize(indices * sizeof(quint16));
quint16* indexPtr = reinterpret_cast<quint16*>(indexBytes.data());
- for (int ring = 0; ring < rings; ++ring) {
- const int ringStart = ring * sides;
- const int nextRingStart = (ring + 1) * sides;
- for (int side = 0; side < sides; ++side) {
- const int nextSide = (side + 1) % sides;
- *indexPtr++ = (ringStart + side);
- *indexPtr++ = (nextRingStart + side);
- *indexPtr++ = (nextRingStart + nextSide);
- *indexPtr++ = ringStart + side;
- *indexPtr++ = nextRingStart + nextSide;
- *indexPtr++ = (ringStart + nextSide);
+ for (int ring = 0; ring < requestedRings; ++ring) {
+ const int ringStart = ring * slices;
+ const int nextRingStart = (ring + 1) * slices;
+ for (int slice = 0; slice < requestedSlices; ++slice) {
+ const int nextSlice = (slice + 1) % slices;
+ *indexPtr++ = ringStart + slice;
+ *indexPtr++ = ringStart + nextSlice;
+ *indexPtr++ = nextRingStart + slice;
+ *indexPtr++ = ringStart + nextSlice;
+ *indexPtr++ = nextRingStart + nextSlice;
+ *indexPtr++ = nextRingStart + slice;
}
}
@@ -130,7 +156,7 @@ class TorusVertexDataFunctor : public QBufferDataGenerator
public:
TorusVertexDataFunctor(int rings, int slices, float radius, float minorRadius)
: m_rings(rings)
- , m_sides(slices)
+ , m_slices(slices)
, m_radius(radius)
, m_minorRadius(minorRadius)
{
@@ -138,7 +164,7 @@ public:
QByteArray operator ()() Q_DECL_OVERRIDE
{
- return createTorusVertexData(m_radius, m_minorRadius, m_rings, m_sides);
+ return createTorusVertexData(m_radius, m_minorRadius, m_rings, m_slices);
}
bool operator ==(const QBufferDataGenerator &other) const Q_DECL_OVERRIDE
@@ -146,7 +172,7 @@ public:
const TorusVertexDataFunctor *otherFunctor = functor_cast<TorusVertexDataFunctor>(&other);
if (otherFunctor != nullptr)
return (otherFunctor->m_rings == m_rings &&
- otherFunctor->m_sides == m_sides &&
+ otherFunctor->m_slices == m_slices &&
otherFunctor->m_radius == m_radius &&
otherFunctor->m_minorRadius == m_minorRadius);
return false;
@@ -156,7 +182,7 @@ public:
private:
int m_rings;
- int m_sides;
+ int m_slices;
float m_radius;
float m_minorRadius;
};
@@ -166,13 +192,13 @@ class TorusIndexDataFunctor : public QBufferDataGenerator
public:
TorusIndexDataFunctor(int rings, int slices)
: m_rings(rings)
- , m_sides(slices)
+ , m_slices(slices)
{
}
QByteArray operator ()() Q_DECL_OVERRIDE
{
- return createTorusIndexData(m_rings, m_sides);
+ return createTorusIndexData(m_rings, m_slices);
}
bool operator ==(const QBufferDataGenerator &other) const Q_DECL_OVERRIDE
@@ -180,7 +206,7 @@ public:
const TorusIndexDataFunctor *otherFunctor = functor_cast<TorusIndexDataFunctor>(&other);
if (otherFunctor != nullptr)
return (otherFunctor->m_rings == m_rings &&
- otherFunctor->m_sides == m_sides);
+ otherFunctor->m_slices == m_slices);
return false;
}
@@ -188,7 +214,7 @@ public:
private:
int m_rings;
- int m_sides;
+ int m_slices;
};
QTorusGeometryPrivate::QTorusGeometryPrivate()
@@ -200,6 +226,7 @@ QTorusGeometryPrivate::QTorusGeometryPrivate()
, m_positionAttribute(nullptr)
, m_normalAttribute(nullptr)
, m_texCoordAttribute(nullptr)
+ , m_tangentAttribute(nullptr)
, m_indexAttribute(nullptr)
, m_vertexBuffer(nullptr)
, m_indexBuffer(nullptr)
@@ -212,14 +239,15 @@ void QTorusGeometryPrivate::init()
m_positionAttribute = new QAttribute(q);
m_normalAttribute = new QAttribute(q);
m_texCoordAttribute = new QAttribute(q);
+ m_tangentAttribute = new QAttribute(q);
m_indexAttribute = new QAttribute(q);
m_vertexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::VertexBuffer, q);
m_indexBuffer = new Qt3DRender::QBuffer(Qt3DRender::QBuffer::IndexBuffer, q);
- // vec3 pos, vec2 tex, vec3 normal
- const quint32 elementSize = 3 + 2 + 3;
+ // vec3 pos, vec2 tex, vec3 normal, vec4 tangent
+ const quint32 elementSize = 3 + 2 + 3 + 4;
const quint32 stride = elementSize * sizeof(float);
- const int nVerts = (m_slices + 1) * (m_rings + 1);
- const int faces = (m_slices * 2) * m_rings;
+ const int nVerts = vertexCount(m_rings, m_slices);
+ const int triangles = triangleCount(m_rings, m_slices);
m_positionAttribute->setName(QAttribute::defaultPositionAttributeName());
m_positionAttribute->setVertexBaseType(QAttribute::Float);
@@ -247,11 +275,20 @@ void QTorusGeometryPrivate::init()
m_normalAttribute->setByteOffset(5 * sizeof(float));
m_normalAttribute->setCount(nVerts);
+ m_tangentAttribute->setName(QAttribute::defaultTangentAttributeName());
+ m_tangentAttribute->setDataType(QAttribute::Float);
+ m_tangentAttribute->setDataSize(4);
+ m_tangentAttribute->setAttributeType(QAttribute::VertexAttribute);
+ m_tangentAttribute->setBuffer(m_vertexBuffer);
+ m_tangentAttribute->setByteStride(stride);
+ m_tangentAttribute->setByteOffset(8 * sizeof(float));
+ m_tangentAttribute->setCount(nVerts);
+
m_indexAttribute->setAttributeType(QAttribute::IndexAttribute);
m_indexAttribute->setVertexBaseType(QAttribute::UnsignedShort);
m_indexAttribute->setBuffer(m_indexBuffer);
- m_indexAttribute->setCount(faces * 3);
+ m_indexAttribute->setCount(triangles * 3);
m_vertexBuffer->setDataGenerator(QSharedPointer<TorusVertexDataFunctor>::create(m_rings, m_slices, m_radius, m_minorRadius));
m_indexBuffer->setDataGenerator(QSharedPointer<TorusIndexDataFunctor>::create(m_rings, m_slices));
@@ -259,6 +296,7 @@ void QTorusGeometryPrivate::init()
q->addAttribute(m_positionAttribute);
q->addAttribute(m_texCoordAttribute);
q->addAttribute(m_normalAttribute);
+ q->addAttribute(m_tangentAttribute);
q->addAttribute(m_indexAttribute);
}
@@ -365,7 +403,7 @@ QTorusGeometry::~QTorusGeometry()
void QTorusGeometry::updateVertices()
{
Q_D(QTorusGeometry);
- const int nVerts = d->m_slices * (d->m_rings + 1);
+ const int nVerts = vertexCount(d->m_rings, d->m_slices);
d->m_positionAttribute->setCount(nVerts);
d->m_texCoordAttribute->setCount(nVerts);
d->m_normalAttribute->setCount(nVerts);
@@ -378,10 +416,9 @@ void QTorusGeometry::updateVertices()
void QTorusGeometry::updateIndices()
{
Q_D(QTorusGeometry);
- const int faces = (d->m_slices * 2) * d->m_rings;
- d->m_indexAttribute->setCount(faces * 3);
+ const int triangles = triangleCount(d->m_rings, d->m_slices);
+ d->m_indexAttribute->setCount(triangles * 3);
d->m_indexBuffer->setDataGenerator(QSharedPointer<TorusIndexDataFunctor>::create(d->m_rings, d->m_slices));
-
}
void QTorusGeometry::setRings(int rings)
diff --git a/src/extras/geometries/qtorusgeometry_p.h b/src/extras/geometries/qtorusgeometry_p.h
index b4bcbde9f..7506a95ac 100644
--- a/src/extras/geometries/qtorusgeometry_p.h
+++ b/src/extras/geometries/qtorusgeometry_p.h
@@ -77,6 +77,7 @@ public:
Qt3DRender::QAttribute *m_positionAttribute;
Qt3DRender::QAttribute *m_normalAttribute;
Qt3DRender::QAttribute *m_texCoordAttribute;
+ Qt3DRender::QAttribute *m_tangentAttribute;
Qt3DRender::QAttribute *m_indexAttribute;
Qt3DRender::QBuffer *m_vertexBuffer;
Qt3DRender::QBuffer *m_indexBuffer;
diff --git a/src/extras/shaders/es2/light.inc.frag b/src/extras/shaders/es2/light.inc.frag
index 42a25003d..02660f008 100644
--- a/src/extras/shaders/es2/light.inc.frag
+++ b/src/extras/shaders/es2/light.inc.frag
@@ -25,9 +25,8 @@ void adsModelNormalMapped(const in FP vec3 vpos, const in FP vec3 vnormal, const
FP vec3 n = normalize( vnormal );
- int i;
FP vec3 s, ts;
- for (i = 0; i < lightCount; ++i) {
+ for (int i = 0; i < lightCount; ++i) {
FP float att = 1.0;
if ( lights[i].type != TYPE_DIRECTIONAL ) {
s = lights[i].position - vpos;
@@ -75,9 +74,8 @@ void adsModel(const in FP vec3 vpos, const in FP vec3 vnormal, const in FP vec3
FP vec3 n = normalize( vnormal );
- int i;
FP vec3 s;
- for (i = 0; i < lightCount; ++i) {
+ for (int i = 0; i < lightCount; ++i) {
FP float att = 1.0;
if ( lights[i].type != TYPE_DIRECTIONAL ) {
s = lights[i].position - vpos;
@@ -115,9 +113,8 @@ void adModel(const in FP vec3 vpos, const in FP vec3 vnormal, out FP vec3 diffus
FP vec3 n = normalize( vnormal );
- int i;
FP vec3 s;
- for (i = 0; i < lightCount; ++i) {
+ for (int i = 0; i < lightCount; ++i) {
FP float att = 1.0;
if ( lights[i].type != TYPE_DIRECTIONAL ) {
s = lights[i].position - vpos;
diff --git a/src/extras/shaders/gl3/gooch.frag b/src/extras/shaders/gl3/gooch.frag
index 1beab1c01..168a862f8 100644
--- a/src/extras/shaders/gl3/gooch.frag
+++ b/src/extras/shaders/gl3/gooch.frag
@@ -28,8 +28,7 @@ vec3 goochModel( const in vec3 pos, const in vec3 n )
vec3 kwarm = clamp(kyellow + beta * kd, 0.0, 1.0);
vec3 result = vec3(0.0);
- int i;
- for (i = 0; i < lightCount; ++i) {
+ for (int i = 0; i < lightCount; ++i) {
// Calculate the vector from the light to the fragment
vec3 s = normalize( vec3( lights[i].position ) - pos );
diff --git a/src/input/backend/axissetting_p.h b/src/input/backend/axissetting_p.h
index cd4959d69..190312bd8 100644
--- a/src/input/backend/axissetting_p.h
+++ b/src/input/backend/axissetting_p.h
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DInput {
namespace Input {
-class AxisSetting : public Qt3DCore::QBackendNode
+class Q_AUTOTEST_EXPORT AxisSetting : public Qt3DCore::QBackendNode
{
public:
AxisSetting();
diff --git a/src/input/backend/qabstractphysicaldevicebackendnode.cpp b/src/input/backend/qabstractphysicaldevicebackendnode.cpp
index 86e55ec04..45f228e1a 100644
--- a/src/input/backend/qabstractphysicaldevicebackendnode.cpp
+++ b/src/input/backend/qabstractphysicaldevicebackendnode.cpp
@@ -101,8 +101,10 @@ void QAbstractPhysicalDeviceBackendNodePrivate::removeAxisSetting(Qt3DCore::QNod
{
QVector<Input::AxisIdSetting>::iterator it;
for (it = m_axisSettings.begin(); it != m_axisSettings.end(); ++it) {
- if (it->m_axisSettingsId == axisSettingsId)
+ if (it->m_axisSettingsId == axisSettingsId) {
m_axisSettings.erase(it);
+ break;
+ }
}
}
@@ -224,7 +226,6 @@ void QAbstractPhysicalDeviceBackendNode::setInputAspect(QInputAspect *aspect)
QInputAspect *QAbstractPhysicalDeviceBackendNode::inputAspect() const
{
Q_D(const QAbstractPhysicalDeviceBackendNode);
- Q_ASSERT_X(d->m_inputAspect, "QAbstractPhysicalDeviceBackendNode::inputAspect()" , "No input aspect set");
return d->m_inputAspect;
}
diff --git a/src/input/frontend/qbuttonaxisinput.cpp b/src/input/frontend/qbuttonaxisinput.cpp
index 6d95ad187..aaf1b6a1c 100644
--- a/src/input/frontend/qbuttonaxisinput.cpp
+++ b/src/input/frontend/qbuttonaxisinput.cpp
@@ -65,6 +65,8 @@ namespace Qt3DInput {
*/
/*!
\qmlproperty real ButtonAxisInput::scale
+ Specifies how the axis output value is scaled. No scaling is applied by default
+ so it defaults to 1.
*/
/*!
@@ -97,6 +99,8 @@ QButtonAxisInput::~QButtonAxisInput()
/*!
\property QButtonAxisInput::scale
+ Specifies how the axis output value is scaled. No scaling is applied by default
+ so it defaults to 1.
*/
void QButtonAxisInput::setScale(float scale)
{
diff --git a/src/input/frontend/qbuttonaxisinput_p.h b/src/input/frontend/qbuttonaxisinput_p.h
index e56e58575..849498f06 100644
--- a/src/input/frontend/qbuttonaxisinput_p.h
+++ b/src/input/frontend/qbuttonaxisinput_p.h
@@ -62,7 +62,7 @@ class QButtonAxisInputPrivate : public QAbstractAxisInputPrivate
public:
QButtonAxisInputPrivate()
: QAbstractAxisInputPrivate()
- , m_scale(0.0f)
+ , m_scale(1.0f)
, m_acceleration(-1.0f)
, m_deceleration(-1.0f)
{}
diff --git a/src/quick3d/imports/core/plugins.qmltypes b/src/quick3d/imports/core/plugins.qmltypes
index 310bfe93e..ed06f8e0c 100644
--- a/src/quick3d/imports/core/plugins.qmltypes
+++ b/src/quick3d/imports/core/plugins.qmltypes
@@ -7,7 +7,7 @@ import QtQuick.tooling 1.2
// 'qmlplugindump -nonrelocatable Qt3D.Core 2.0'
Module {
- dependencies: ["QtQuick 2.0"]
+ dependencies: ["QtQuick 2.7"]
Component {
name: "Qt3DCore::QComponent"
prototype: "Qt3DCore::QNode"
@@ -35,6 +35,7 @@ Module {
name: "enabledChanged"
Parameter { name: "enabled"; type: "bool" }
}
+ Signal { name: "nodeDestroyed" }
Method {
name: "setParent"
Parameter { name: "parent"; type: "QNode"; isPointer: true }
@@ -46,10 +47,127 @@ Module {
}
Component {
name: "Qt3DCore::QTransform"
- defaultProperty: "data"
- prototype: "Qt3DCore::QTransform"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Core/Transform 2.0"]
+ Property { name: "matrix"; type: "QMatrix4x4" }
+ Property { name: "scale"; type: "float" }
+ Property { name: "scale3D"; type: "QVector3D" }
+ Property { name: "rotation"; type: "QQuaternion" }
+ Property { name: "translation"; type: "QVector3D" }
+ Property { name: "rotationX"; type: "float" }
+ Property { name: "rotationY"; type: "float" }
+ Property { name: "rotationZ"; type: "float" }
+ Signal {
+ name: "scaleChanged"
+ Parameter { name: "scale"; type: "float" }
+ }
+ Signal {
+ name: "scale3DChanged"
+ Parameter { name: "scale"; type: "QVector3D" }
+ }
+ Signal {
+ name: "rotationChanged"
+ Parameter { name: "rotation"; type: "QQuaternion" }
+ }
+ Signal {
+ name: "translationChanged"
+ Parameter { name: "translation"; type: "QVector3D" }
+ }
+ Signal {
+ name: "rotationXChanged"
+ Parameter { name: "rotationX"; type: "float" }
+ }
+ Signal {
+ name: "rotationYChanged"
+ Parameter { name: "rotationY"; type: "float" }
+ }
+ Signal {
+ name: "rotationZChanged"
+ Parameter { name: "rotationZ"; type: "float" }
+ }
+ Method {
+ name: "setScale"
+ Parameter { name: "scale"; type: "float" }
+ }
+ Method {
+ name: "setScale3D"
+ Parameter { name: "scale"; type: "QVector3D" }
+ }
+ Method {
+ name: "setRotation"
+ Parameter { name: "rotation"; type: "QQuaternion" }
+ }
+ Method {
+ name: "setTranslation"
+ Parameter { name: "translation"; type: "QVector3D" }
+ }
+ Method {
+ name: "setMatrix"
+ Parameter { name: "matrix"; type: "QMatrix4x4" }
+ }
+ Method {
+ name: "setRotationX"
+ Parameter { name: "rotationX"; type: "float" }
+ }
+ Method {
+ name: "setRotationY"
+ Parameter { name: "rotationY"; type: "float" }
+ }
+ Method {
+ name: "setRotationZ"
+ Parameter { name: "rotationZ"; type: "float" }
+ }
+ Method {
+ name: "fromAxisAndAngle"
+ type: "QQuaternion"
+ Parameter { name: "axis"; type: "QVector3D" }
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "fromAxisAndAngle"
+ type: "QQuaternion"
+ Parameter { name: "x"; type: "float" }
+ Parameter { name: "y"; type: "float" }
+ Parameter { name: "z"; type: "float" }
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "fromAxesAndAngles"
+ type: "QQuaternion"
+ Parameter { name: "axis1"; type: "QVector3D" }
+ Parameter { name: "angle1"; type: "float" }
+ Parameter { name: "axis2"; type: "QVector3D" }
+ Parameter { name: "angle2"; type: "float" }
+ }
+ Method {
+ name: "fromAxesAndAngles"
+ type: "QQuaternion"
+ Parameter { name: "axis1"; type: "QVector3D" }
+ Parameter { name: "angle1"; type: "float" }
+ Parameter { name: "axis2"; type: "QVector3D" }
+ Parameter { name: "angle2"; type: "float" }
+ Parameter { name: "axis3"; type: "QVector3D" }
+ Parameter { name: "angle3"; type: "float" }
+ }
+ Method {
+ name: "fromEulerAngles"
+ type: "QQuaternion"
+ Parameter { name: "eulerAngles"; type: "QVector3D" }
+ }
+ Method {
+ name: "fromEulerAngles"
+ type: "QQuaternion"
+ Parameter { name: "pitch"; type: "float" }
+ Parameter { name: "yaw"; type: "float" }
+ Parameter { name: "roll"; type: "float" }
+ }
+ Method {
+ name: "rotateAround"
+ type: "QMatrix4x4"
+ Parameter { name: "point"; type: "QVector3D" }
+ Parameter { name: "angle"; type: "float" }
+ Parameter { name: "axis"; type: "QVector3D" }
+ }
}
Component {
name: "Qt3DCore::Quick::QQuaternionAnimation"
@@ -112,8 +230,10 @@ Module {
Component {
name: "Qt3DCore::Quick::Quick3DEntityLoader"
defaultProperty: "data"
- prototype: "Qt3DCore::Quick::Quick3DEntityLoader"
- Property { name: "components"; type: "Qt3DCore::QComponent"; isList: true; isReadonly: true }
+ prototype: "Qt3DCore::QEntity"
+ exports: ["Qt3D.Core/EntityLoader 2.0"]
+ Property { name: "entity"; type: "Qt3DCore::QEntity"; isPointer: true; isReadonly: true }
+ Property { name: "source"; type: "QUrl" }
}
Component {
name: "Qt3DCore::Quick::Quick3DNode"
@@ -128,8 +248,13 @@ Module {
Component {
name: "Qt3DCore::Quick::Quick3DNodeInstantiator"
defaultProperty: "delegate"
- prototype: "Qt3DCore::Quick::Quick3DNodeInstantiator"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ 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 }
}
}
diff --git a/src/quick3d/imports/extras/plugins.qmltypes b/src/quick3d/imports/extras/plugins.qmltypes
index d30b2591a..6a7e1203d 100644
--- a/src/quick3d/imports/extras/plugins.qmltypes
+++ b/src/quick3d/imports/extras/plugins.qmltypes
@@ -762,6 +762,14 @@ Module {
name: "setBoundingVolumePositionAttribute"
Parameter { name: "boundingVolumePositionAttribute"; type: "QAttribute"; isPointer: true }
}
+ Method {
+ name: "addAttribute"
+ Parameter { name: "attribute"; type: "Qt3DRender::QAttribute"; isPointer: true }
+ }
+ Method {
+ name: "removeAttribute"
+ Parameter { name: "attribute"; type: "Qt3DRender::QAttribute"; isPointer: true }
+ }
}
Component {
name: "Qt3DRender::QGeometryRenderer"
@@ -787,6 +795,7 @@ Module {
Property { name: "vertexCount"; type: "int" }
Property { name: "indexOffset"; type: "int" }
Property { name: "firstInstance"; type: "int" }
+ Property { name: "firstVertex"; type: "int" }
Property { name: "restartIndexValue"; type: "int" }
Property { name: "verticesPerPatch"; type: "int" }
Property { name: "primitiveRestartEnabled"; type: "bool" }
@@ -809,6 +818,10 @@ Module {
Parameter { name: "firstInstance"; type: "int" }
}
Signal {
+ name: "firstVertexChanged"
+ Parameter { name: "firstVertex"; type: "int" }
+ }
+ Signal {
name: "restartIndexValueChanged"
Parameter { name: "restartIndexValue"; type: "int" }
}
@@ -845,6 +858,10 @@ Module {
Parameter { name: "firstInstance"; type: "int" }
}
Method {
+ name: "setFirstVertex"
+ Parameter { name: "firstVertex"; type: "int" }
+ }
+ Method {
name: "setRestartIndexValue"
Parameter { name: "index"; type: "int" }
}
@@ -866,6 +883,35 @@ Module {
}
}
Component {
+ prototype: "Qt3DCore::QNode"
+ name: "Qt3D.Extras/DefaultAlphaEffect 2.0"
+ exports: ["Qt3D.Extras/DefaultAlphaEffect 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "vertexES"; type: "string" }
+ Property { name: "fragmentES"; type: "string" }
+ Property { name: "vertex"; type: "string" }
+ Property { name: "fragment"; type: "string" }
+ Property { name: "sourceRgbArg"; type: "int" }
+ Property { name: "destinationRgbArg"; type: "int" }
+ Property { name: "sourceAlphaArg"; type: "int" }
+ Property { name: "destinationAlphaArg"; type: "int" }
+ Property { name: "blendFunctionArg"; type: "int" }
+ }
+ Component {
+ prototype: "Qt3DCore::QNode"
+ name: "Qt3D.Extras/DefaultEffect 2.0"
+ exports: ["Qt3D.Extras/DefaultEffect 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "vertexES"; type: "string" }
+ Property { name: "fragmentES"; type: "string" }
+ Property { name: "vertex"; type: "string" }
+ Property { name: "fragment"; type: "string" }
+ }
+ Component {
prototype: "Qt3DCore::QComponent"
name: "Qt3D.Extras/DiffuseMapMaterial 2.0"
exports: ["Qt3D.Extras/DiffuseMapMaterial 2.0"]
@@ -919,6 +965,8 @@ Module {
Property { name: "camera"; type: "Qt3DRender::QCamera"; isPointer: true }
Property { name: "linearSpeed"; type: "double" }
Property { name: "lookSpeed"; type: "double" }
+ Property { name: "acceleration"; type: "double" }
+ Property { name: "deceleration"; type: "double" }
}
Component {
prototype: "Qt3DCore::QNode"
@@ -957,6 +1005,18 @@ Module {
}
}
Component {
+ prototype: "Qt3DCore::QNode"
+ name: "Qt3D.Extras/NormalDiffuseMapAlphaEffect 2.0"
+ exports: ["Qt3D.Extras/NormalDiffuseMapAlphaEffect 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "vertexES"; type: "string" }
+ Property { name: "fragmentES"; type: "string" }
+ Property { name: "vertex"; type: "string" }
+ Property { name: "fragment"; type: "string" }
+ }
+ Component {
prototype: "Qt3DCore::QComponent"
name: "Qt3D.Extras/NormalDiffuseMapAlphaMaterial 2.0"
exports: ["Qt3D.Extras/NormalDiffuseMapAlphaMaterial 2.0"]
@@ -1027,8 +1087,8 @@ Module {
}
Component {
prototype: "Qt3DCore::QNode"
- name: "Qt3D.Extras/OrbitController 2.0"
- exports: ["Qt3D.Extras/OrbitController 2.0"]
+ name: "Qt3D.Extras/OrbitCameraController 2.0"
+ exports: ["Qt3D.Extras/OrbitCameraController 2.0"]
exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "data"
@@ -1078,6 +1138,11 @@ Module {
Property { name: "specular"; type: "QColor" }
Property { name: "shininess"; type: "double" }
Property { name: "alpha"; type: "double" }
+ Property { name: "sourceRgbArg"; type: "int" }
+ Property { name: "destinationRgbArg"; type: "int" }
+ Property { name: "sourceAlphaArg"; type: "int" }
+ Property { name: "destinationAlphaArg"; type: "int" }
+ Property { name: "blendFunctionArg"; type: "int" }
Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
Signal {
name: "effectChanged"
@@ -1110,15 +1175,22 @@ Module {
}
}
Component {
- prototype: "Qt3DCore::QNode"
- name: "Qt3D.Extras/SkyboxEntity 2.0"
- exports: ["Qt3D.Extras/SkyboxEntity 2.0"]
+ prototype: "Qt3DCore::QComponent"
+ name: "Qt3D.Extras/TextureMaterial 2.0"
+ exports: ["Qt3D.Extras/TextureMaterial 2.0"]
exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "data"
- Property { name: "baseName"; type: "string" }
- Property { name: "extension"; type: "string" }
- Property { name: "skyboxTexture"; type: "Qt3DRender::QTextureCubeMap"; isPointer: true }
- Property { name: "cameraPosition"; type: "QVector3D" }
+ Property { name: "texture"; type: "Qt3DRender::QTexture2D"; isPointer: true }
+ Property { name: "textureOffset"; type: "QVector2D" }
+ Property { name: "effect"; type: "Qt3DRender::QEffect"; isPointer: true }
+ Signal {
+ name: "effectChanged"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
+ Method {
+ name: "setEffect"
+ Parameter { name: "effect"; type: "QEffect"; isPointer: true }
+ }
}
}
diff --git a/src/quick3d/imports/input/plugins.qmltypes b/src/quick3d/imports/input/plugins.qmltypes
index 68ff9fe32..860ab4d68 100644
--- a/src/quick3d/imports/input/plugins.qmltypes
+++ b/src/quick3d/imports/input/plugins.qmltypes
@@ -7,7 +7,7 @@ import QtQuick.tooling 1.2
// 'qmlplugindump -nonrelocatable Qt3D.Input 2.0'
Module {
- dependencies: ["QtQuick 2.0"]
+ dependencies: ["QtQuick 2.7"]
Component {
name: "Qt3DCore::QComponent"
prototype: "Qt3DCore::QNode"
@@ -34,6 +34,7 @@ Module {
name: "enabledChanged"
Parameter { name: "enabled"; type: "bool" }
}
+ Signal { name: "nodeDestroyed" }
Method {
name: "setParent"
Parameter { name: "parent"; type: "QNode"; isPointer: true }
@@ -100,7 +101,6 @@ 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 }
}
@@ -262,8 +262,8 @@ Module {
}
Component {
name: "Qt3DInput::QGamepadInput"
- prototype: "Qt3DInput::QAbstractPhysicalDevice"
- Property { name: "deviceId"; type: "int" }
+ prototype: "Qt3DInput::QGamepadInput"
+ Property { name: "axisSettings"; type: "Qt3DInput::QAxisSetting"; isList: true; isReadonly: true }
}
Component {
name: "Qt3DInput::QInputChord"
@@ -336,8 +336,18 @@ Module {
}
Component {
name: "Qt3DInput::QKeyboardDevice"
- prototype: "Qt3DInput::QKeyboardDevice"
- Property { name: "axisSettings"; type: "Qt3DInput::QAxisSetting"; isList: true; isReadonly: true }
+ prototype: "Qt3DInput::QAbstractPhysicalDevice"
+ exports: ["Qt3D.Input/KeyboardDevice 2.0"]
+ Property {
+ name: "activeInput"
+ type: "Qt3DInput::QKeyboardHandler"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal {
+ name: "activeInputChanged"
+ Parameter { name: "activeInput"; type: "QKeyboardHandler"; isPointer: true }
+ }
}
Component {
name: "Qt3DInput::QKeyboardHandler"
@@ -526,8 +536,24 @@ Module {
Component { name: "Qt3DInput::QLogicalDevice"; prototype: "Qt3DCore::QComponent" }
Component {
name: "Qt3DInput::QMouseDevice"
- prototype: "Qt3DInput::QMouseDevice"
- Property { name: "axisSettings"; type: "Qt3DInput::QAxisSetting"; isList: true; isReadonly: true }
+ prototype: "Qt3DInput::QAbstractPhysicalDevice"
+ exports: ["Qt3D.Input/MouseDevice 2.0"]
+ Enum {
+ name: "Axis"
+ values: {
+ "X": 0,
+ "Y": 1
+ }
+ }
+ Property { name: "sensitivity"; type: "float" }
+ Signal {
+ name: "sensitivityChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ Method {
+ name: "setSensitivity"
+ Parameter { name: "value"; type: "float" }
+ }
}
Component {
name: "Qt3DInput::QMouseEvent"
diff --git a/src/quick3d/imports/logic/plugins.qmltypes b/src/quick3d/imports/logic/plugins.qmltypes
index 036ca96f3..0c0ccc847 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.0"]
+ dependencies: ["QtQuick 2.7"]
Component {
name: "Qt3DCore::QComponent"
prototype: "Qt3DCore::QNode"
@@ -34,6 +34,7 @@ Module {
name: "enabledChanged"
Parameter { name: "enabled"; type: "bool" }
}
+ Signal { name: "nodeDestroyed" }
Method {
name: "setParent"
Parameter { name: "parent"; type: "QNode"; isPointer: true }
diff --git a/src/quick3d/imports/render/plugins.qmltypes b/src/quick3d/imports/render/plugins.qmltypes
index af491af6c..a6528daed 100644
--- a/src/quick3d/imports/render/plugins.qmltypes
+++ b/src/quick3d/imports/render/plugins.qmltypes
@@ -7,7 +7,7 @@ import QtQuick.tooling 1.2
// 'qmlplugindump -nonrelocatable Qt3D.Render 2.0'
Module {
- dependencies: ["Qt3D.Core 2.0"]
+ dependencies: ["QtQuick 2.7"]
Component {
name: "QWindow"
prototype: "QObject"
@@ -171,22 +171,380 @@ Module {
Method { name: "requestUpdate"; revision: 3 }
}
Component {
- name: "Qt3DRender::QAbstractLight"
+ name: "Qt3DCore::QComponent"
+ prototype: "Qt3DCore::QNode"
+ Property { name: "isShareable"; type: "bool" }
+ Signal {
+ name: "shareableChanged"
+ Parameter { name: "isShareable"; type: "bool" }
+ }
+ Method {
+ name: "setShareable"
+ Parameter { name: "isShareable"; type: "bool" }
+ }
+ }
+ 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: "Qt3DCore::Quick::Quick3DNode"
defaultProperty: "data"
- prototype: "Qt3DRender::QAbstractLight"
+ prototype: "Qt3DRender::QCameraSelector"
+ exports: ["Qt3D.Render/CameraSelector 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
}
Component {
+ name: "Qt3DRender::QAbstractLight"
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Render/Light 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Type"
+ values: {
+ "PointLight": 0,
+ "DirectionalLight": 1,
+ "SpotLight": 2
+ }
+ }
+ Property { name: "type"; type: "Type"; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "intensity"; type: "float" }
+ Signal {
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "intensityChanged"
+ Parameter { name: "intensity"; type: "float" }
+ }
+ Method {
+ name: "setColor"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Method {
+ name: "setIntensity"
+ Parameter { name: "intensity"; type: "float" }
+ }
+ }
+ Component {
name: "Qt3DRender::QAbstractTexture"
- defaultProperty: "data"
- prototype: "Qt3DRender::QAbstractTexture"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/Texture 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Status"
+ values: {
+ "None": 0,
+ "Loading": 1,
+ "Ready": 2,
+ "Error": 3
+ }
+ }
+ Enum {
+ name: "Target"
+ values: {
+ "TargetAutomatic": 0,
+ "Target1D": 3552,
+ "Target1DArray": 35864,
+ "Target2D": 3553,
+ "Target2DArray": 35866,
+ "Target3D": 32879,
+ "TargetCubeMap": 34067,
+ "TargetCubeMapArray": 36873,
+ "Target2DMultisample": 37120,
+ "Target2DMultisampleArray": 37122,
+ "TargetRectangle": 34037,
+ "TargetBuffer": 35882
+ }
+ }
+ Enum {
+ name: "TextureFormat"
+ values: {
+ "NoFormat": 0,
+ "Automatic": 1,
+ "R8_UNorm": 33321,
+ "RG8_UNorm": 33323,
+ "RGB8_UNorm": 32849,
+ "RGBA8_UNorm": 32856,
+ "R16_UNorm": 33322,
+ "RG16_UNorm": 33324,
+ "RGB16_UNorm": 32852,
+ "RGBA16_UNorm": 32859,
+ "R8_SNorm": 36756,
+ "RG8_SNorm": 36757,
+ "RGB8_SNorm": 36758,
+ "RGBA8_SNorm": 36759,
+ "R16_SNorm": 36760,
+ "RG16_SNorm": 36761,
+ "RGB16_SNorm": 36762,
+ "RGBA16_SNorm": 36763,
+ "R8U": 33330,
+ "RG8U": 33336,
+ "RGB8U": 36221,
+ "RGBA8U": 36220,
+ "R16U": 33332,
+ "RG16U": 33338,
+ "RGB16U": 36215,
+ "RGBA16U": 36214,
+ "R32U": 33334,
+ "RG32U": 33340,
+ "RGB32U": 36209,
+ "RGBA32U": 36208,
+ "R8I": 33329,
+ "RG8I": 33335,
+ "RGB8I": 36239,
+ "RGBA8I": 36238,
+ "R16I": 33331,
+ "RG16I": 33337,
+ "RGB16I": 36233,
+ "RGBA16I": 36232,
+ "R32I": 33333,
+ "RG32I": 33339,
+ "RGB32I": 36227,
+ "RGBA32I": 36226,
+ "R16F": 33325,
+ "RG16F": 33327,
+ "RGB16F": 34843,
+ "RGBA16F": 34842,
+ "R32F": 33326,
+ "RG32F": 33328,
+ "RGB32F": 34837,
+ "RGBA32F": 34836,
+ "RGB9E5": 35901,
+ "RG11B10F": 35898,
+ "RG3B2": 10768,
+ "R5G6B5": 36194,
+ "RGB5A1": 32855,
+ "RGBA4": 32854,
+ "RGB10A2": 36975,
+ "D16": 33189,
+ "D24": 33190,
+ "D24S8": 35056,
+ "D32": 33191,
+ "D32F": 36012,
+ "D32FS8X24": 36013,
+ "RGB_DXT1": 33776,
+ "RGBA_DXT1": 33777,
+ "RGBA_DXT3": 33778,
+ "RGBA_DXT5": 33779,
+ "R_ATI1N_UNorm": 36283,
+ "R_ATI1N_SNorm": 36284,
+ "RG_ATI2N_UNorm": 36285,
+ "RG_ATI2N_SNorm": 36286,
+ "RGB_BP_UNSIGNED_FLOAT": 36495,
+ "RGB_BP_SIGNED_FLOAT": 36494,
+ "RGB_BP_UNorm": 36492,
+ "R11_EAC_UNorm": 37488,
+ "R11_EAC_SNorm": 37489,
+ "RG11_EAC_UNorm": 37490,
+ "RG11_EAC_SNorm": 37491,
+ "RGB8_ETC2": 37492,
+ "SRGB8_ETC2": 37493,
+ "RGB8_PunchThrough_Alpha1_ETC2": 37494,
+ "SRGB8_PunchThrough_Alpha1_ETC2": 37495,
+ "RGBA8_ETC2_EAC": 37496,
+ "SRGB8_Alpha8_ETC2_EAC": 37497,
+ "RGB8_ETC1": 36196,
+ "SRGB8": 35905,
+ "SRGB8_Alpha8": 35907,
+ "SRGB_DXT1": 35916,
+ "SRGB_Alpha_DXT1": 35917,
+ "SRGB_Alpha_DXT3": 35918,
+ "SRGB_Alpha_DXT5": 35919,
+ "SRGB_BP_UNorm": 36493,
+ "DepthFormat": 6402,
+ "AlphaFormat": 6406,
+ "RGBFormat": 6407,
+ "RGBAFormat": 6408,
+ "LuminanceFormat": 6409,
+ "LuminanceAlphaFormat": 6410
+ }
+ }
+ Enum {
+ name: "Filter"
+ values: {
+ "Nearest": 9728,
+ "Linear": 9729,
+ "NearestMipMapNearest": 9984,
+ "NearestMipMapLinear": 9986,
+ "LinearMipMapNearest": 9985,
+ "LinearMipMapLinear": 9987
+ }
+ }
+ Enum {
+ name: "CubeMapFace"
+ values: {
+ "CubeMapPositiveX": 34069,
+ "CubeMapNegativeX": 34070,
+ "CubeMapPositiveY": 34071,
+ "CubeMapNegativeY": 34072,
+ "CubeMapPositiveZ": 34073,
+ "CubeMapNegativeZ": 34074
+ }
+ }
+ Enum {
+ name: "ComparisonFunction"
+ values: {
+ "CompareLessEqual": 515,
+ "CompareGreaterEqual": 518,
+ "CompareLess": 513,
+ "CompareGreater": 516,
+ "CompareEqual": 514,
+ "CommpareNotEqual": 517,
+ "CompareAlways": 519,
+ "CompareNever": 512
+ }
+ }
+ Enum {
+ name: "ComparisonMode"
+ values: {
+ "CompareRefToTexture": 34894,
+ "CompareNone": 0
+ }
+ }
+ Property { name: "target"; type: "Target"; isReadonly: true }
+ Property { name: "format"; type: "TextureFormat" }
+ Property { name: "generateMipMaps"; type: "bool" }
+ Property {
+ name: "wrapMode"
+ type: "Qt3DRender::QTextureWrapMode"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "status"; type: "Status"; isReadonly: true }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Property { name: "depth"; type: "int" }
+ Property { name: "magnificationFilter"; type: "Filter" }
+ Property { name: "minificationFilter"; type: "Filter" }
+ Property { name: "maximumAnisotropy"; type: "float" }
+ Property { name: "comparisonFunction"; type: "ComparisonFunction" }
+ Property { name: "comparisonMode"; type: "ComparisonMode" }
+ Property { name: "layers"; type: "int" }
+ Signal {
+ name: "formatChanged"
+ Parameter { name: "format"; type: "TextureFormat" }
+ }
+ Signal {
+ name: "statusChanged"
+ Parameter { name: "status"; type: "Status" }
+ }
+ Signal {
+ name: "generateMipMapsChanged"
+ Parameter { name: "generateMipMaps"; type: "bool" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "width"; type: "int" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "height"; type: "int" }
+ }
+ Signal {
+ name: "depthChanged"
+ Parameter { name: "depth"; type: "int" }
+ }
+ Signal {
+ name: "magnificationFilterChanged"
+ Parameter { name: "magnificationFilter"; type: "Filter" }
+ }
+ Signal {
+ name: "minificationFilterChanged"
+ Parameter { name: "minificationFilter"; type: "Filter" }
+ }
+ Signal {
+ name: "maximumAnisotropyChanged"
+ Parameter { name: "maximumAnisotropy"; type: "float" }
+ }
+ Signal {
+ name: "comparisonFunctionChanged"
+ Parameter { name: "comparisonFunction"; type: "ComparisonFunction" }
+ }
+ Signal {
+ name: "comparisonModeChanged"
+ Parameter { name: "comparisonMode"; type: "ComparisonMode" }
+ }
+ Signal {
+ name: "layersChanged"
+ Parameter { name: "layers"; type: "int" }
+ }
+ Method {
+ name: "setFormat"
+ Parameter { name: "format"; type: "TextureFormat" }
+ }
+ Method {
+ name: "setGenerateMipMaps"
+ Parameter { name: "gen"; type: "bool" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "width"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "height"; type: "int" }
+ }
+ Method {
+ name: "setDepth"
+ Parameter { name: "depth"; type: "int" }
+ }
+ Method {
+ name: "setMinificationFilter"
+ Parameter { name: "f"; type: "Filter" }
+ }
+ Method {
+ name: "setMagnificationFilter"
+ Parameter { name: "f"; type: "Filter" }
+ }
+ Method {
+ name: "setMaximumAnisotropy"
+ Parameter { name: "anisotropy"; type: "float" }
+ }
+ Method {
+ name: "setComparisonFunction"
+ Parameter { name: "function"; type: "ComparisonFunction" }
+ }
+ Method {
+ name: "setComparisonMode"
+ Parameter { name: "mode"; type: "ComparisonMode" }
+ }
+ Method {
+ name: "setLayers"
+ Parameter { name: "layers"; type: "int" }
+ }
}
Component {
name: "Qt3DRender::QAbstractTextureImage"
prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/QAbstractTextureImage 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
Property { name: "mipLevel"; type: "int" }
Property { name: "layer"; type: "int" }
Property { name: "face"; type: "Qt3DRender::QAbstractTexture::CubeMapFace" }
@@ -215,10 +573,17 @@ Module {
Parameter { name: "face"; type: "QAbstractTexture::CubeMapFace" }
}
}
- Component { name: "Qt3DRender::QAlphaCoverage"; prototype: "Qt3DRender::QRenderState" }
+ Component {
+ name: "Qt3DRender::QAlphaCoverage"
+ prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/AlphaCoverage 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
Component {
name: "Qt3DRender::QAlphaTest"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/AlphaTest 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "AlphaFunction"
values: {
@@ -253,14 +618,122 @@ Module {
}
Component {
name: "Qt3DRender::QAttribute"
- defaultProperty: "data"
- prototype: "Qt3DRender::QAttribute"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/Attribute 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "AttributeType"
+ values: {
+ "VertexAttribute": 0,
+ "IndexAttribute": 1
+ }
+ }
+ Enum {
+ name: "VertexBaseType"
+ values: {
+ "Byte": 0,
+ "UnsignedByte": 1,
+ "Short": 2,
+ "UnsignedShort": 3,
+ "Int": 4,
+ "UnsignedInt": 5,
+ "HalfFloat": 6,
+ "Float": 7,
+ "Double": 8
+ }
+ }
+ Property { name: "buffer"; type: "Qt3DRender::QBuffer"; isPointer: true }
+ Property { name: "name"; type: "string" }
+ Property { name: "vertexBaseType"; type: "VertexBaseType" }
+ Property { name: "vertexSize"; type: "uint" }
+ Property { name: "count"; type: "uint" }
+ Property { name: "byteStride"; type: "uint" }
+ Property { name: "byteOffset"; type: "uint" }
+ Property { name: "divisor"; type: "uint" }
+ Property { name: "attributeType"; type: "AttributeType" }
+ Signal {
+ name: "bufferChanged"
+ Parameter { name: "buffer"; type: "QBuffer"; isPointer: true }
+ }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "name"; type: "string" }
+ }
+ Signal {
+ name: "dataTypeChanged"
+ Parameter { name: "vertexBaseType"; type: "VertexBaseType" }
+ }
+ Signal {
+ name: "dataSizeChanged"
+ Parameter { name: "vertexSize"; type: "uint" }
+ }
+ Signal {
+ name: "countChanged"
+ Parameter { name: "count"; type: "uint" }
+ }
+ Signal {
+ name: "byteStrideChanged"
+ Parameter { name: "byteStride"; type: "uint" }
+ }
+ Signal {
+ name: "byteOffsetChanged"
+ Parameter { name: "byteOffset"; type: "uint" }
+ }
+ Signal {
+ name: "divisorChanged"
+ Parameter { name: "divisor"; type: "uint" }
+ }
+ Signal {
+ name: "attributeTypeChanged"
+ Parameter { name: "attributeType"; type: "AttributeType" }
+ }
+ Method {
+ name: "setBuffer"
+ Parameter { name: "buffer"; type: "QBuffer"; isPointer: true }
+ }
+ Method {
+ name: "setName"
+ Parameter { name: "name"; type: "string" }
+ }
+ Method {
+ name: "setDataType"
+ Parameter { name: "type"; type: "VertexBaseType" }
+ }
+ Method {
+ name: "setDataSize"
+ Parameter { name: "size"; type: "uint" }
+ }
+ Method {
+ name: "setCount"
+ Parameter { name: "count"; type: "uint" }
+ }
+ Method {
+ name: "setByteStride"
+ Parameter { name: "byteStride"; type: "uint" }
+ }
+ Method {
+ name: "setByteOffset"
+ Parameter { name: "byteOffset"; type: "uint" }
+ }
+ Method {
+ name: "setDivisor"
+ Parameter { name: "divisor"; type: "uint" }
+ }
+ Method {
+ name: "setAttributeType"
+ Parameter { name: "attributeType"; type: "AttributeType" }
+ }
+ Method { name: "defaultPositionAttributeName"; type: "string" }
+ Method { name: "defaultNormalAttributeName"; type: "string" }
+ Method { name: "defaultColorAttributeName"; type: "string" }
+ Method { name: "defaultTextureCoordinateAttributeName"; type: "string" }
+ Method { name: "defaultTangentAttributeName"; type: "string" }
}
Component {
name: "Qt3DRender::QBlendEquation"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/BlendEquation 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "BlendFunction"
values: {
@@ -284,6 +757,8 @@ Module {
Component {
name: "Qt3DRender::QBlendEquationArguments"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/BlendEquationArguments 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Blending"
values: {
@@ -432,13 +907,226 @@ Module {
}
Component {
name: "Qt3DRender::QCamera"
- defaultProperty: "data"
- prototype: "Qt3DRender::QCamera"
- Property { name: "components"; type: "Qt3DCore::QComponent"; isList: true; isReadonly: true }
+ prototype: "Qt3DCore::QEntity"
+ exports: ["Qt3D.Render/Camera 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "CameraTranslationOption"
+ values: {
+ "TranslateViewCenter": 0,
+ "DontTranslateViewCenter": 1
+ }
+ }
+ Property { name: "projectionType"; type: "Qt3DRender::QCameraLens::ProjectionType" }
+ Property { name: "nearPlane"; type: "float" }
+ Property { name: "farPlane"; type: "float" }
+ Property { name: "fieldOfView"; type: "float" }
+ Property { name: "aspectRatio"; type: "float" }
+ Property { name: "left"; type: "float" }
+ Property { name: "right"; type: "float" }
+ Property { name: "bottom"; type: "float" }
+ Property { name: "top"; type: "float" }
+ Property { name: "projectionMatrix"; type: "QMatrix4x4" }
+ Property { name: "position"; type: "QVector3D" }
+ Property { name: "upVector"; type: "QVector3D" }
+ Property { name: "viewCenter"; type: "QVector3D" }
+ Property { name: "viewVector"; type: "QVector3D"; isReadonly: true }
+ Property { name: "viewMatrix"; type: "QMatrix4x4"; isReadonly: true }
+ Signal {
+ name: "projectionTypeChanged"
+ Parameter { name: "projectionType"; type: "QCameraLens::ProjectionType" }
+ }
+ Signal {
+ name: "nearPlaneChanged"
+ Parameter { name: "nearPlane"; type: "float" }
+ }
+ Signal {
+ name: "farPlaneChanged"
+ Parameter { name: "farPlane"; type: "float" }
+ }
+ Signal {
+ name: "fieldOfViewChanged"
+ Parameter { name: "fieldOfView"; type: "float" }
+ }
+ Signal {
+ name: "aspectRatioChanged"
+ Parameter { name: "aspectRatio"; type: "float" }
+ }
+ Signal {
+ name: "leftChanged"
+ Parameter { name: "left"; type: "float" }
+ }
+ Signal {
+ name: "rightChanged"
+ Parameter { name: "right"; type: "float" }
+ }
+ Signal {
+ name: "bottomChanged"
+ Parameter { name: "bottom"; type: "float" }
+ }
+ Signal {
+ name: "topChanged"
+ Parameter { name: "top"; type: "float" }
+ }
+ Signal {
+ name: "projectionMatrixChanged"
+ Parameter { name: "projectionMatrix"; type: "QMatrix4x4" }
+ }
+ Signal {
+ name: "positionChanged"
+ Parameter { name: "position"; type: "QVector3D" }
+ }
+ Signal {
+ name: "upVectorChanged"
+ Parameter { name: "upVector"; type: "QVector3D" }
+ }
+ Signal {
+ name: "viewCenterChanged"
+ Parameter { name: "viewCenter"; type: "QVector3D" }
+ }
+ Signal {
+ name: "viewVectorChanged"
+ Parameter { name: "viewVector"; type: "QVector3D" }
+ }
+ Method {
+ name: "setProjectionType"
+ Parameter { name: "type"; type: "QCameraLens::ProjectionType" }
+ }
+ Method {
+ name: "setNearPlane"
+ Parameter { name: "nearPlane"; type: "float" }
+ }
+ Method {
+ name: "setFarPlane"
+ Parameter { name: "farPlane"; type: "float" }
+ }
+ Method {
+ name: "setFieldOfView"
+ Parameter { name: "fieldOfView"; type: "float" }
+ }
+ Method {
+ name: "setAspectRatio"
+ Parameter { name: "aspectRatio"; type: "float" }
+ }
+ Method {
+ name: "setLeft"
+ Parameter { name: "left"; type: "float" }
+ }
+ Method {
+ name: "setRight"
+ Parameter { name: "right"; type: "float" }
+ }
+ Method {
+ name: "setBottom"
+ Parameter { name: "bottom"; type: "float" }
+ }
+ Method {
+ name: "setTop"
+ Parameter { name: "top"; type: "float" }
+ }
+ Method {
+ name: "setProjectionMatrix"
+ Parameter { name: "projectionMatrix"; type: "QMatrix4x4" }
+ }
+ Method {
+ name: "setPosition"
+ Parameter { name: "position"; type: "QVector3D" }
+ }
+ Method {
+ name: "setUpVector"
+ Parameter { name: "upVector"; type: "QVector3D" }
+ }
+ Method {
+ name: "setViewCenter"
+ Parameter { name: "viewCenter"; type: "QVector3D" }
+ }
+ Method {
+ name: "tiltRotation"
+ type: "QQuaternion"
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "panRotation"
+ type: "QQuaternion"
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "rollRotation"
+ type: "QQuaternion"
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "rotation"
+ type: "QQuaternion"
+ Parameter { name: "angle"; type: "float" }
+ Parameter { name: "axis"; type: "QVector3D" }
+ }
+ Method {
+ name: "translate"
+ Parameter { name: "vLocal"; type: "QVector3D" }
+ Parameter { name: "option"; type: "CameraTranslationOption" }
+ }
+ Method {
+ name: "translate"
+ Parameter { name: "vLocal"; type: "QVector3D" }
+ }
+ Method {
+ name: "translateWorld"
+ Parameter { name: "vWorld"; type: "QVector3D" }
+ Parameter { name: "option"; type: "CameraTranslationOption" }
+ }
+ Method {
+ name: "translateWorld"
+ Parameter { name: "vWorld"; type: "QVector3D" }
+ }
+ Method {
+ name: "tilt"
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "pan"
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "pan"
+ Parameter { name: "angle"; type: "float" }
+ Parameter { name: "axis"; type: "QVector3D" }
+ }
+ Method {
+ name: "roll"
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "tiltAboutViewCenter"
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "panAboutViewCenter"
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "panAboutViewCenter"
+ Parameter { name: "angle"; type: "float" }
+ Parameter { name: "axis"; type: "QVector3D" }
+ }
+ Method {
+ name: "rollAboutViewCenter"
+ Parameter { name: "angle"; type: "float" }
+ }
+ Method {
+ name: "rotate"
+ Parameter { name: "q"; type: "QQuaternion" }
+ }
+ Method {
+ name: "rotateAboutViewCenter"
+ Parameter { name: "q"; type: "QQuaternion" }
+ }
}
Component {
name: "Qt3DRender::QCameraLens"
prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Render/CameraLens 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "ProjectionType"
values: {
@@ -555,6 +1243,8 @@ Module {
Component {
name: "Qt3DRender::QClearBuffers"
prototype: "Qt3DRender::QFrameGraphNode"
+ exports: ["Qt3D.Render/ClearBuffers 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "BufferType"
values: {
@@ -572,6 +1262,7 @@ Module {
Property { name: "clearColor"; type: "QColor" }
Property { name: "clearDepthValue"; type: "float" }
Property { name: "clearStencilValue"; type: "int" }
+ Property { name: "colorBuffer"; type: "Qt3DRender::QRenderTargetOutput"; isPointer: true }
Signal {
name: "buffersChanged"
Parameter { name: "buffers"; type: "BufferType" }
@@ -588,6 +1279,10 @@ Module {
name: "clearStencilValueChanged"
Parameter { name: "clearStencilValue"; type: "int" }
}
+ Signal {
+ name: "colorBufferChanged"
+ Parameter { name: "buffer"; type: "QRenderTargetOutput"; isPointer: true }
+ }
Method {
name: "setBuffers"
Parameter { name: "buffers"; type: "BufferType" }
@@ -604,17 +1299,49 @@ Module {
name: "setClearStencilValue"
Parameter { name: "clearStencilValue"; type: "int" }
}
+ Method {
+ name: "setColorBuffer"
+ Parameter { name: "buffer"; type: "QRenderTargetOutput"; isPointer: true }
+ }
}
Component {
name: "Qt3DRender::QClipPlane"
- defaultProperty: "data"
- prototype: "Qt3DRender::QClipPlane"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/ClipPlane 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "planeIndex"; type: "int" }
+ Property { name: "normal"; type: "QVector3D" }
+ Property { name: "distance"; type: "float" }
+ Signal {
+ name: "planeIndexChanged"
+ Parameter { name: "planeIndex"; type: "int" }
+ }
+ Signal {
+ name: "normalChanged"
+ Parameter { name: "normal"; type: "QVector3D" }
+ }
+ Signal {
+ name: "distanceChanged"
+ Parameter { name: "distance"; type: "float" }
+ }
+ Method {
+ name: "setPlaneIndex"
+ Parameter { type: "int" }
+ }
+ Method {
+ name: "setNormal"
+ Parameter { type: "QVector3D" }
+ }
+ Method {
+ name: "setDistance"
+ Parameter { type: "float" }
+ }
}
Component {
name: "Qt3DRender::QColorMask"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/ColorMask 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "redMasked"; type: "bool" }
Property { name: "greenMasked"; type: "bool" }
Property { name: "blueMasked"; type: "bool" }
@@ -654,14 +1381,30 @@ Module {
}
Component {
name: "Qt3DRender::QComputeCommand"
- defaultProperty: "data"
- prototype: "Qt3DRender::QComputeCommand"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Render/ComputeCommand 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "workGroupX"; type: "int" }
+ Property { name: "workGroupY"; type: "int" }
+ Property { name: "workGroupZ"; type: "int" }
+ Method {
+ name: "setWorkGroupX"
+ Parameter { name: "workGroupX"; type: "int" }
+ }
+ Method {
+ name: "setWorkGroupY"
+ Parameter { name: "workGroupY"; type: "int" }
+ }
+ Method {
+ name: "setWorkGroupZ"
+ Parameter { name: "workGroupZ"; type: "int" }
+ }
}
Component {
name: "Qt3DRender::QCullFace"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/CullFace 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "CullingMode"
values: {
@@ -684,6 +1427,8 @@ Module {
Component {
name: "Qt3DRender::QDepthTest"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/DepthTest 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "DepthFunction"
values: {
@@ -709,23 +1454,52 @@ Module {
}
Component {
name: "Qt3DRender::QDirectionalLight"
- defaultProperty: "data"
- prototype: "Qt3DRender::QDirectionalLight"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QAbstractLight"
+ exports: ["Qt3D.Render/DirectionalLight 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "worldDirection"; type: "QVector3D" }
+ Signal {
+ name: "worldDirectionChanged"
+ Parameter { name: "worldDirection"; type: "QVector3D" }
+ }
+ Method {
+ name: "setWorldDirection"
+ Parameter { name: "worldDirection"; type: "QVector3D" }
+ }
}
Component {
name: "Qt3DRender::QDispatchCompute"
- defaultProperty: "data"
- prototype: "Qt3DRender::QDispatchCompute"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QFrameGraphNode"
+ exports: ["Qt3D.Render/DispatchCompute 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "workGroupX"; type: "int" }
+ Property { name: "workGroupY"; type: "int" }
+ Property { name: "workGroupZ"; type: "int" }
+ Method {
+ name: "setWorkGroupX"
+ Parameter { name: "workGroupX"; type: "int" }
+ }
+ Method {
+ name: "setWorkGroupY"
+ Parameter { name: "workGroupY"; type: "int" }
+ }
+ Method {
+ name: "setWorkGroupZ"
+ Parameter { name: "workGroupZ"; type: "int" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QDithering"
+ prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/Dithering 2.0"]
+ exportMetaObjectRevisions: [0]
}
- Component { name: "Qt3DRender::QDithering"; prototype: "Qt3DRender::QRenderState" }
Component { name: "Qt3DRender::QEffect"; prototype: "Qt3DCore::QNode" }
Component {
name: "Qt3DRender::QFilterKey"
prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/FilterKey 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "value"; type: "QVariant" }
Property { name: "name"; type: "string" }
Signal {
@@ -745,10 +1519,18 @@ Module {
Parameter { name: "customType"; type: "string" }
}
}
- Component { name: "Qt3DRender::QFrameGraphNode"; prototype: "Qt3DCore::QNode" }
+ Component {
+ name: "Qt3DRender::QFrameGraphNode"
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/FrameGraphNode 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ }
Component {
name: "Qt3DRender::QFrontFace"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/FrontFace 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "WindingDirection"
values: {
@@ -766,7 +1548,12 @@ Module {
Parameter { name: "direction"; type: "WindingDirection" }
}
}
- Component { name: "Qt3DRender::QFrustumCulling"; prototype: "Qt3DRender::QFrameGraphNode" }
+ Component {
+ name: "Qt3DRender::QFrustumCulling"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ exports: ["Qt3D.Render/FrustumCulling 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
Component {
name: "Qt3DRender::QGeometry"
prototype: "Qt3DCore::QNode"
@@ -783,10 +1570,20 @@ Module {
name: "setBoundingVolumePositionAttribute"
Parameter { name: "boundingVolumePositionAttribute"; type: "QAttribute"; isPointer: true }
}
+ Method {
+ name: "addAttribute"
+ Parameter { name: "attribute"; type: "Qt3DRender::QAttribute"; isPointer: true }
+ }
+ Method {
+ name: "removeAttribute"
+ Parameter { name: "attribute"; type: "Qt3DRender::QAttribute"; isPointer: true }
+ }
}
Component {
name: "Qt3DRender::QGeometryRenderer"
prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Render/GeometryRenderer 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "PrimitiveType"
values: {
@@ -808,6 +1605,7 @@ Module {
Property { name: "vertexCount"; type: "int" }
Property { name: "indexOffset"; type: "int" }
Property { name: "firstInstance"; type: "int" }
+ Property { name: "firstVertex"; type: "int" }
Property { name: "restartIndexValue"; type: "int" }
Property { name: "verticesPerPatch"; type: "int" }
Property { name: "primitiveRestartEnabled"; type: "bool" }
@@ -830,6 +1628,10 @@ Module {
Parameter { name: "firstInstance"; type: "int" }
}
Signal {
+ name: "firstVertexChanged"
+ Parameter { name: "firstVertex"; type: "int" }
+ }
+ Signal {
name: "restartIndexValueChanged"
Parameter { name: "restartIndexValue"; type: "int" }
}
@@ -866,6 +1668,10 @@ Module {
Parameter { name: "firstInstance"; type: "int" }
}
Method {
+ name: "setFirstVertex"
+ Parameter { name: "firstVertex"; type: "int" }
+ }
+ Method {
name: "setRestartIndexValue"
Parameter { name: "index"; type: "int" }
}
@@ -914,11 +1720,11 @@ Module {
Property { name: "vendor"; type: "string" }
Signal {
name: "apiChanged"
- Parameter { name: "api"; type: "Api" }
+ Parameter { name: "api"; type: "Qt3DRender::QGraphicsApiFilter::Api" }
}
Signal {
name: "profileChanged"
- Parameter { name: "profile"; type: "OpenGLProfile" }
+ Parameter { name: "profile"; type: "Qt3DRender::QGraphicsApiFilter::OpenGLProfile" }
}
Signal {
name: "minorVersionChanged"
@@ -964,18 +1770,11 @@ Module {
}
Component {
name: "Qt3DRender::QLayer"
- defaultProperty: "data"
- prototype: "Qt3DRender::QLayer"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
- }
- Component {
- name: "Qt3DRender::QLayerFilter"
- defaultProperty: "data"
- prototype: "Qt3DRender::QLayerFilter"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Render/Layer 2.0"]
+ exportMetaObjectRevisions: [0]
}
+ Component { name: "Qt3DRender::QLayerFilter"; prototype: "Qt3DRender::QFrameGraphNode" }
Component {
name: "Qt3DRender::QMaterial"
prototype: "Qt3DCore::QComponent"
@@ -992,6 +1791,8 @@ Module {
Component {
name: "Qt3DRender::QMesh"
prototype: "Qt3DRender::QGeometryRenderer"
+ exports: ["Qt3D.Render/Mesh 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "source"; type: "QUrl" }
Property { name: "meshName"; type: "string" }
Signal {
@@ -1014,28 +1815,97 @@ Module {
Component {
name: "Qt3DRender::QMultiSampleAntiAliasing"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/MultiSampleAntiAliasing 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "Qt3DRender::QNoDepthMask"
- defaultProperty: "data"
- prototype: "Qt3DRender::QNoDepthMask"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/NoDepthMask 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "Qt3DRender::QNoDraw"
+ prototype: "Qt3DRender::QFrameGraphNode"
+ exports: ["Qt3D.Render/NoDraw 2.0"]
+ exportMetaObjectRevisions: [0]
}
- Component { name: "Qt3DRender::QNoDraw"; prototype: "Qt3DRender::QFrameGraphNode" }
Component {
name: "Qt3DRender::QObjectPicker"
- defaultProperty: "data"
- prototype: "Qt3DRender::QObjectPicker"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Render/ObjectPicker 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "hoverEnabled"; type: "bool" }
+ Property { name: "dragEnabled"; type: "bool" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "containsMouse"; type: "bool"; isReadonly: true }
+ Signal {
+ name: "pressed"
+ Parameter { name: "pick"; type: "Qt3DRender::QPickEvent"; isPointer: true }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "pick"; type: "Qt3DRender::QPickEvent"; isPointer: true }
+ }
+ Signal {
+ name: "clicked"
+ Parameter { name: "pick"; type: "Qt3DRender::QPickEvent"; isPointer: true }
+ }
+ Signal {
+ name: "moved"
+ Parameter { name: "pick"; type: "Qt3DRender::QPickEvent"; isPointer: true }
+ }
+ Signal { name: "entered" }
+ Signal { name: "exited" }
+ Signal {
+ name: "hoverEnabledChanged"
+ Parameter { name: "hoverEnabled"; type: "bool" }
+ }
+ Signal {
+ name: "dragEnabledChanged"
+ Parameter { name: "dragEnabled"; type: "bool" }
+ }
+ Signal {
+ name: "pressedChanged"
+ Parameter { name: "pressed"; type: "bool" }
+ }
+ Signal {
+ name: "containsMouseChanged"
+ Parameter { name: "containsMouse"; type: "bool" }
+ }
+ Method {
+ name: "setHoverEnabled"
+ Parameter { name: "hoverEnabled"; type: "bool" }
+ }
+ Method {
+ name: "setDragEnabled"
+ Parameter { name: "dragEnabled"; type: "bool" }
+ }
}
Component {
name: "Qt3DRender::QParameter"
- defaultProperty: "data"
- prototype: "Qt3DRender::QParameter"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/QParameter 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Property { name: "name"; type: "string" }
+ Property { name: "value"; type: "QVariant" }
+ Signal {
+ name: "valueChanged"
+ Parameter { name: "value"; type: "QVariant" }
+ }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "name"; type: "string" }
+ }
+ Method {
+ name: "setName"
+ Parameter { name: "name"; type: "string" }
+ }
+ Method {
+ name: "setValue"
+ Parameter { name: "dv"; type: "QVariant" }
+ }
}
Component {
name: "Qt3DRender::QPickEvent"
@@ -1060,6 +1930,8 @@ Module {
Component {
name: "Qt3DRender::QPickingSettings"
prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/PickingSettings 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "PickMethod"
values: {
@@ -1095,21 +1967,73 @@ Module {
}
Component {
name: "Qt3DRender::QPointLight"
- defaultProperty: "data"
- prototype: "Qt3DRender::QPointLight"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QAbstractLight"
+ exports: ["Qt3D.Render/PointLight 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "constantAttenuation"; type: "float" }
+ Property { name: "linearAttenuation"; type: "float" }
+ Property { name: "quadraticAttenuation"; type: "float" }
+ Signal {
+ name: "constantAttenuationChanged"
+ Parameter { name: "constantAttenuation"; type: "float" }
+ }
+ Signal {
+ name: "linearAttenuationChanged"
+ Parameter { name: "linearAttenuation"; type: "float" }
+ }
+ Signal {
+ name: "quadraticAttenuationChanged"
+ Parameter { name: "quadraticAttenuation"; type: "float" }
+ }
+ Method {
+ name: "setConstantAttenuation"
+ Parameter { name: "value"; type: "float" }
+ }
+ Method {
+ name: "setLinearAttenuation"
+ Parameter { name: "value"; type: "float" }
+ }
+ Method {
+ name: "setQuadraticAttenuation"
+ Parameter { name: "value"; type: "float" }
+ }
}
Component {
name: "Qt3DRender::QPointSize"
- defaultProperty: "data"
- prototype: "Qt3DRender::QPointSize"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/PointSize 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "SizeMode"
+ values: {
+ "Fixed": 0,
+ "Programmable": 1
+ }
+ }
+ Property { name: "sizeMode"; type: "SizeMode" }
+ Property { name: "value"; type: "float" }
+ Signal {
+ name: "sizeModeChanged"
+ Parameter { name: "sizeMode"; type: "SizeMode" }
+ }
+ Signal {
+ name: "valueChanged"
+ Parameter { name: "value"; type: "float" }
+ }
+ Method {
+ name: "setSizeMode"
+ Parameter { name: "sizeMode"; type: "SizeMode" }
+ }
+ Method {
+ name: "setValue"
+ Parameter { name: "value"; type: "float" }
+ }
}
Component {
name: "Qt3DRender::QPolygonOffset"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/PolygonOffset 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "scaleFactor"; type: "float" }
Property { name: "depthSteps"; type: "float" }
Signal {
@@ -1146,23 +2070,84 @@ Module {
Component {
name: "Qt3DRender::QRenderSettings"
defaultProperty: "activeFrameGraph"
- prototype: "Qt3DRender::QRenderSettings"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Render/RenderSettings 2.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "RenderPolicy"
+ values: {
+ "OnDemand": 0,
+ "Always": 1
+ }
+ }
+ Property {
+ name: "pickingSettings"
+ type: "Qt3DRender::QPickingSettings"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "renderPolicy"; type: "RenderPolicy" }
+ Property { name: "activeFrameGraph"; type: "Qt3DRender::QFrameGraphNode"; isPointer: true }
+ Signal {
+ name: "activeFrameGraphChanged"
+ Parameter { name: "activeFrameGraph"; type: "QFrameGraphNode"; isPointer: true }
+ }
+ Signal {
+ name: "renderPolicyChanged"
+ Parameter { name: "renderPolicy"; type: "RenderPolicy" }
+ }
+ Method {
+ name: "setActiveFrameGraph"
+ Parameter { name: "activeFrameGraph"; type: "QFrameGraphNode"; isPointer: true }
+ }
+ Method {
+ name: "setRenderPolicy"
+ Parameter { name: "renderPolicy"; type: "RenderPolicy" }
+ }
+ }
+ Component {
+ name: "Qt3DRender::QRenderState"
+ prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/RenderState 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
}
- Component { name: "Qt3DRender::QRenderState"; prototype: "Qt3DCore::QNode" }
Component { name: "Qt3DRender::QRenderStateSet"; prototype: "Qt3DRender::QFrameGraphNode" }
Component {
name: "Qt3DRender::QRenderSurfaceSelector"
- defaultProperty: "data"
- prototype: "Qt3DRender::QRenderSurfaceSelector"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QFrameGraphNode"
+ exports: ["Qt3D.Render/RenderSurfaceSelector 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "surface"; type: "QObject"; isPointer: true }
+ Property { name: "externalRenderTargetSize"; type: "QSize"; isReadonly: true }
+ Property { name: "surfacePixelRatio"; type: "float" }
+ Signal {
+ name: "surfaceChanged"
+ Parameter { name: "surface"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "externalRenderTargetSizeChanged"
+ Parameter { name: "size"; type: "QSize" }
+ }
+ Signal {
+ name: "surfacePixelRatioChanged"
+ Parameter { name: "ratio"; type: "float" }
+ }
+ Method {
+ name: "setSurface"
+ Parameter { name: "surfaceObject"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "setSurfacePixelRatio"
+ Parameter { name: "ratio"; type: "float" }
+ }
}
Component { name: "Qt3DRender::QRenderTarget"; prototype: "Qt3DCore::QComponent" }
Component {
name: "Qt3DRender::QRenderTargetOutput"
prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/RenderTargetOutput 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "AttachmentPoint"
values: {
@@ -1279,22 +2264,64 @@ Module {
}
Component {
name: "Qt3DRender::QScissorTest"
- defaultProperty: "data"
- prototype: "Qt3DRender::QScissorTest"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/ScissorTest 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "left"; type: "int" }
+ Property { name: "bottom"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Signal {
+ name: "leftChanged"
+ Parameter { name: "left"; type: "int" }
+ }
+ Signal {
+ name: "bottomChanged"
+ Parameter { name: "bottom"; type: "int" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "width"; type: "int" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "height"; type: "int" }
+ }
+ Method {
+ name: "setLeft"
+ Parameter { name: "left"; type: "int" }
+ }
+ Method {
+ name: "setBottom"
+ Parameter { name: "bottom"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "width"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "height"; type: "int" }
+ }
}
Component {
name: "Qt3DRender::QSeamlessCubemap"
- defaultProperty: "data"
- prototype: "Qt3DRender::QSeamlessCubemap"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/SeamlessCubemap 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "Qt3DRender::QShaderData"
+ prototype: "Qt3DCore::QComponent"
+ exports: ["Qt3D.Render/QShaderData 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
}
- Component { name: "Qt3DRender::QShaderData"; prototype: "Qt3DCore::QComponent" }
Component {
name: "Qt3DRender::QShaderProgram"
prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/ShaderProgram 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "ShaderType"
values: {
@@ -1369,6 +2396,8 @@ Module {
Component {
name: "Qt3DRender::QSortPolicy"
prototype: "Qt3DRender::QFrameGraphNode"
+ exports: ["Qt3D.Render/SortPolicy 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "SortType"
values: {
@@ -1398,6 +2427,8 @@ Module {
Component {
name: "Qt3DRender::QSpotLight"
prototype: "Qt3DRender::QAbstractLight"
+ exports: ["Qt3D.Render/SpotLight 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "constantAttenuation"; type: "float" }
Property { name: "linearAttenuation"; type: "float" }
Property { name: "quadraticAttenuation"; type: "float" }
@@ -1447,6 +2478,8 @@ Module {
Component {
name: "Qt3DRender::QStencilMask"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/StencilMask 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "frontOutputMask"; type: "uint" }
Property { name: "backOutputMask"; type: "uint" }
Signal {
@@ -1469,6 +2502,8 @@ Module {
Component {
name: "Qt3DRender::QStencilOperation"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/StencilOperation 2.0"]
+ exportMetaObjectRevisions: [0]
Property {
name: "front"
type: "Qt3DRender::QStencilOperationArguments"
@@ -1545,6 +2580,8 @@ Module {
Component {
name: "Qt3DRender::QStencilTest"
prototype: "Qt3DRender::QRenderState"
+ exports: ["Qt3D.Render/StencilTest 2.0"]
+ exportMetaObjectRevisions: [0]
Property {
name: "front"
type: "Qt3DRender::QStencilTestArguments"
@@ -1651,6 +2688,8 @@ Module {
Component {
name: "Qt3DRender::QTextureImage"
prototype: "Qt3DRender::QAbstractTextureImage"
+ exports: ["Qt3D.Render/TextureImage 2.0"]
+ exportMetaObjectRevisions: [0]
Enum {
name: "Status"
values: {
@@ -1746,7 +2785,6 @@ Module {
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DBuffer"
- defaultProperty: "data"
prototype: "Qt3DRender::QBuffer"
exports: ["Qt3D.Render/Buffer 2.0"]
exportMetaObjectRevisions: [0]
@@ -1756,7 +2794,6 @@ Module {
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DEffect"
- defaultProperty: "data"
prototype: "Qt3DRender::QEffect"
exports: ["Qt3D.Render/Effect 2.0"]
exportMetaObjectRevisions: [0]
@@ -1772,8 +2809,14 @@ Module {
Property { name: "attributes"; type: "Qt3DRender::QAttribute"; isList: true; isReadonly: true }
}
Component {
+ name: "Qt3DRender::Render::Quick::Quick3DLayerFilter"
+ prototype: "Qt3DRender::QLayerFilter"
+ exports: ["Qt3D.Render/LayerFilter 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "layers"; type: "Qt3DRender::QLayer"; isList: true; isReadonly: true }
+ }
+ Component {
name: "Qt3DRender::Render::Quick::Quick3DMaterial"
- defaultProperty: "data"
prototype: "Qt3DRender::QMaterial"
exports: ["Qt3D.Render/Material 2.0"]
exportMetaObjectRevisions: [0]
@@ -1781,14 +2824,12 @@ Module {
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DParameter"
- defaultProperty: "data"
- prototype: "Qt3DRender::Render::Quick::Quick3DParameter"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QParameter"
+ exports: ["Qt3D.Render/Parameter 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DRenderPass"
- defaultProperty: "data"
prototype: "Qt3DRender::QRenderPass"
exports: ["Qt3D.Render/RenderPass 2.0"]
exportMetaObjectRevisions: [0]
@@ -1803,7 +2844,6 @@ Module {
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DRenderPassFilter"
- defaultProperty: "data"
prototype: "Qt3DRender::QRenderPassFilter"
exports: ["Qt3D.Render/RenderPassFilter 2.0"]
exportMetaObjectRevisions: [0]
@@ -1812,7 +2852,6 @@ Module {
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DRenderTargetOutput"
- defaultProperty: "data"
prototype: "Qt3DRender::QRenderTarget"
exports: ["Qt3D.Render/RenderTarget 2.0"]
exportMetaObjectRevisions: [0]
@@ -1825,7 +2864,6 @@ Module {
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DRenderTargetSelector"
- defaultProperty: "data"
prototype: "Qt3DRender::QRenderTargetSelector"
exports: ["Qt3D.Render/RenderTargetSelector 2.0"]
exportMetaObjectRevisions: [0]
@@ -1833,27 +2871,26 @@ Module {
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DScene"
- defaultProperty: "data"
prototype: "Qt3DRender::QSceneLoader"
exports: ["Qt3D.Render/SceneLoader 2.0"]
exportMetaObjectRevisions: [0]
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DShaderData"
- defaultProperty: "data"
- prototype: "Qt3DRender::Render::Quick::Quick3DShaderData"
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "childNodes"; type: "Qt3DCore::QNode"; isList: true; isReadonly: true }
+ prototype: "Qt3DRender::QShaderData"
+ exports: ["Qt3D.Render/ShaderData 2.0"]
+ exportMetaObjectRevisions: [0]
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DShaderDataArray"
defaultProperty: "values"
prototype: "Qt3DCore::QNode"
+ exports: ["Qt3D.Render/ShaderDataArray 2.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "values"; type: "Qt3DRender::QShaderData"; isList: true; isReadonly: true }
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DStateSet"
- defaultProperty: "data"
prototype: "Qt3DRender::QRenderStateSet"
exports: ["Qt3D.Render/RenderStateSet 2.0"]
exportMetaObjectRevisions: [0]
@@ -1866,7 +2903,6 @@ Module {
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DTechnique"
- defaultProperty: "data"
prototype: "Qt3DRender::QTechnique"
exports: ["Qt3D.Render/Technique 2.0"]
exportMetaObjectRevisions: [0]
@@ -1876,7 +2912,6 @@ Module {
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DTechniqueFilter"
- defaultProperty: "data"
prototype: "Qt3DRender::QTechniqueFilter"
exports: ["Qt3D.Render/TechniqueFilter 2.0"]
exportMetaObjectRevisions: [0]
@@ -1886,7 +2921,7 @@ Module {
Component {
name: "Qt3DRender::Render::Quick::Quick3DTextureExtension"
defaultProperty: "textureImages"
- prototype: "Qt3DRender::QTexture1D"
+ prototype: "Qt3DRender::QTextureLoader"
exports: [
"Qt3D.Render/Texture1D 2.0",
"Qt3D.Render/Texture1DArray 2.0",
@@ -1911,7 +2946,6 @@ Module {
}
Component {
name: "Qt3DRender::Render::Quick::Quick3DViewport"
- defaultProperty: "data"
prototype: "Qt3DRender::QViewport"
exports: ["Qt3D.Render/Viewport 2.0"]
exportMetaObjectRevisions: [0]
diff --git a/src/quick3d/imports/scene3d/plugins.qmltypes b/src/quick3d/imports/scene3d/plugins.qmltypes
index da56b97ea..46df37093 100644
--- a/src/quick3d/imports/scene3d/plugins.qmltypes
+++ b/src/quick3d/imports/scene3d/plugins.qmltypes
@@ -7,7 +7,7 @@ import QtQuick.tooling 1.2
// 'qmlplugindump -nonrelocatable QtQuick.Scene3D 2.0'
Module {
- dependencies: ["QtQuick 2.0"]
+ dependencies: ["QtQuick 2.7"]
Component {
name: "Qt3DRender::Scene3DItem"
defaultProperty: "entity"
diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp
index db8d0bf1c..7e9b695ed 100644
--- a/src/render/backend/renderview.cpp
+++ b/src/render/backend/renderview.cpp
@@ -833,6 +833,9 @@ void RenderView::setShaderAndUniforms(RenderCommand *command, RenderPass *rPass,
Entity *lightEntity = lightSource.entity;
const QVector3D worldPos = lightEntity->worldBoundingVolume()->center();
for (Light *light : lightSource.lights) {
+ if (!light->isEnabled())
+ continue;
+
ShaderData *shaderData = m_manager->shaderDataManager()->lookupResource(light->shaderData());
if (!shaderData)
continue;
diff --git a/src/render/framegraph/framegraphnode.cpp b/src/render/framegraph/framegraphnode.cpp
index 5d1df3a8c..dcf3cfacc 100644
--- a/src/render/framegraph/framegraphnode.cpp
+++ b/src/render/framegraph/framegraphnode.cpp
@@ -40,6 +40,8 @@
#include "framegraphnode_p.h"
#include <Qt3DRender/private/renderer_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
QT_BEGIN_NAMESPACE
@@ -84,6 +86,12 @@ FrameGraphManager *FrameGraphNode::manager() const
void FrameGraphNode::setParentId(Qt3DCore::QNodeId parentId)
{
if (m_parentId != parentId) {
+ // We already had a parent, tell it to abandon us
+ if (!m_parentId.isNull()) {
+ FrameGraphNode *parent = m_manager->lookupNode(m_parentId);
+ if (parent != nullptr)
+ parent->m_childrenIds.removeAll(peerId());
+ }
m_parentId = parentId;
FrameGraphNode *parent = m_manager->lookupNode(m_parentId);
if (parent != nullptr && !parent->m_childrenIds.contains(peerId()))
@@ -141,6 +149,31 @@ QVector<FrameGraphNode *> FrameGraphNode::children() const
return children;
}
+void FrameGraphNode::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+{
+ switch (e->type()) {
+
+ case Qt3DCore::PropertyValueAdded: {
+ Qt3DCore::QPropertyNodeAddedChangePtr change = qSharedPointerCast<Qt3DCore::QPropertyNodeAddedChange>(e);
+ if (change->metaObject()->inherits(&QFrameGraphNode::staticMetaObject))
+ appendChildId(change->addedNodeId());
+ break;
+ }
+
+ case Qt3DCore::PropertyValueRemoved: {
+ Qt3DCore::QPropertyNodeRemovedChangePtr change = qSharedPointerCast<Qt3DCore::QPropertyNodeRemovedChange>(e);
+ if (change->metaObject()->inherits(&QFrameGraphNode::staticMetaObject))
+ removeChildId(change->removedNodeId());
+ break;
+ }
+ default:
+ break;
+ }
+
+ markDirty(AbstractRenderer::AllDirty);
+ BackendNode::sceneChangeEvent(e);
+}
+
} // namespace Render
} // namespace Qt3DRender
diff --git a/src/render/framegraph/framegraphnode_p.h b/src/render/framegraph/framegraphnode_p.h
index c6e58823b..a29fb8070 100644
--- a/src/render/framegraph/framegraphnode_p.h
+++ b/src/render/framegraph/framegraphnode_p.h
@@ -107,6 +107,8 @@ public:
FrameGraphNode *parent() const;
QVector<FrameGraphNode *> children() const;
+ void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) Q_DECL_OVERRIDE;
+
protected:
FrameGraphNode(FrameGraphNodeType nodeType, QBackendNode::Mode mode = QBackendNode::ReadOnly);
void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_OVERRIDE;
diff --git a/src/render/frontend/qrendersettings.h b/src/render/frontend/qrendersettings.h
index 68e8f8d7f..3d32dda6b 100644
--- a/src/render/frontend/qrendersettings.h
+++ b/src/render/frontend/qrendersettings.h
@@ -55,7 +55,7 @@ class QT3DRENDERSHARED_EXPORT QRenderSettings : public Qt3DCore::QComponent
{
Q_OBJECT
- Q_PROPERTY(QPickingSettings* pickingSettings READ pickingSettings CONSTANT)
+ Q_PROPERTY(Qt3DRender::QPickingSettings* pickingSettings READ pickingSettings CONSTANT)
Q_PROPERTY(RenderPolicy renderPolicy READ renderPolicy WRITE setRenderPolicy NOTIFY renderPolicyChanged)
Q_PROPERTY(Qt3DRender::QFrameGraphNode *activeFrameGraph READ activeFrameGraph WRITE setActiveFrameGraph NOTIFY activeFrameGraphChanged)
Q_CLASSINFO("DefaultProperty", "activeFrameGraph")
diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp
index e7c8a1c37..fec1e66ac 100644
--- a/src/render/materialsystem/shaderdata.cpp
+++ b/src/render/materialsystem/shaderdata.cpp
@@ -113,7 +113,7 @@ void ShaderData::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
const QHash<QString, QVariant>::iterator end = m_originalProperties.end();
while (it != end) {
- if (static_cast<QMetaType::Type>(it.value().type()) == QMetaType::QVector3D) {
+ if (it.value().type() == QVariant::Vector3D) {
// if there is a matching QShaderData::TransformType propertyTransformed
QVariant value = m_originalProperties.value(it.key() + QLatin1String("Transformed"));
// if that's the case, we apply a space transformation to the property
diff --git a/tests/auto/core/handlemanager/tst_handlemanager.cpp b/tests/auto/core/handlemanager/tst_handlemanager.cpp
index 3198b54a9..f4879a3df 100644
--- a/tests/auto/core/handlemanager/tst_handlemanager.cpp
+++ b/tests/auto/core/handlemanager/tst_handlemanager.cpp
@@ -75,7 +75,7 @@ void tst_HandleManager::correctPointer()
{
// GIVEN
Qt3DCore::QHandleManager<SimpleResource> manager;
- SimpleResource *p1 = (SimpleResource *)0xdeadbeef;
+ SimpleResource *p1 = (SimpleResource *)(quintptr)0xdeadbeef;
// WHEN
const Handle h = manager.acquire(p1);
@@ -93,9 +93,9 @@ void tst_HandleManager::correctPointers()
// GIVEN
Qt3DCore::QHandleManager<SimpleResource> manager;
SimpleResource *p[3];
- p[0] = (SimpleResource *)0xdeadbeef;
- p[1] = (SimpleResource *)0x11111111;
- p[2] = (SimpleResource *)0x22222222;
+ p[0] = (SimpleResource *)(quintptr)0xdeadbeef;
+ p[1] = (SimpleResource *)(quintptr)0x11111111;
+ p[2] = (SimpleResource *)(quintptr)0x22222222;
// WHEN
for (int i = 0; i < 3; ++i) {
@@ -211,7 +211,7 @@ void tst_HandleManager::resetRemovesAllEntries()
// WHEN
for (int i = 0; i < 100; ++i) {
- SimpleResource *p = (SimpleResource *) 0xdead0000 + i;
+ SimpleResource *p = (SimpleResource *)(quintptr)(0xdead0000 + i);
const Handle h = manager.acquire(p);
bool ok = false;
@@ -240,7 +240,7 @@ void tst_HandleManager::maximumEntries()
// WHEN
for (int i = 0; i < (int)Handle::maxIndex(); ++i) {
- SimpleResource *p = (SimpleResource *) 0xdead0000 + i;
+ SimpleResource *p = (SimpleResource *)(quintptr)(0xdead0000 + i);
const Handle h = manager.acquire(p);
bool ok = false;
@@ -264,7 +264,7 @@ void tst_HandleManager::checkNoCounterOverflow()
// GIVEN
const int indexBits = 16;
Qt3DCore::QHandleManager<SimpleResource, indexBits> manager;
- SimpleResource *p = (SimpleResource *) 0xdead0000;
+ SimpleResource *p = (SimpleResource *)(quintptr)0xdead0000;
Qt3DCore::QHandle<SimpleResource, indexBits> h = manager.acquire(p);
// THEN
diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp
index 695a93640..c221c5115 100644
--- a/tests/auto/core/nodes/tst_nodes.cpp
+++ b/tests/auto/core/nodes/tst_nodes.cpp
@@ -130,7 +130,7 @@ public:
void sceneChangeEventWithLock(const Qt3DCore::QSceneChangeList &e) Q_DECL_OVERRIDE
{
- for (uint i = 0, m = e.size(); i < m; ++i) {
+ for (size_t i = 0, m = e.size(); i < m; ++i) {
events << ChangeRecord(e.at(i), false);
}
}
diff --git a/tests/auto/core/qframeallocator/tst_qframeallocator.cpp b/tests/auto/core/qframeallocator/tst_qframeallocator.cpp
index 76d4d15ce..a098792ee 100644
--- a/tests/auto/core/qframeallocator/tst_qframeallocator.cpp
+++ b/tests/auto/core/qframeallocator/tst_qframeallocator.cpp
@@ -294,8 +294,8 @@ void tst_QFrameAllocator::containsCheckQFrameChunk()
ptrs << c.allocate(16);
}
- QVERIFY(!c.contains((void *)0xffffffff, 16));
- QVERIFY(!c2.contains((void *)0xffffffff, 16));
+ QVERIFY(!c.contains((void *)(quintptr)0xffffffff, 16));
+ QVERIFY(!c2.contains((void *)(quintptr)0xffffffff, 16));
QVERIFY(c.contains(ptrs.first(), 16));
QVERIFY(!c2.contains(ptrs.first(), 16));
QVERIFY(c.contains(ptrs.last(), 16));
@@ -305,7 +305,7 @@ void tst_QFrameAllocator::containsCheckQFrameChunk()
ptrs << c2.allocate(16);
}
- QVERIFY(!c.contains((void *)0xffffffff, 16));
+ QVERIFY(!c.contains((void *)(quintptr)0xffffffff, 16));
QVERIFY(!c.contains(ptrs.last(), 16));
QVERIFY(c.contains(ptrs.first(), 16));
QVERIFY(c2.contains(ptrs.last(), 16));
diff --git a/tests/auto/core/qtransform/tst_qtransform.cpp b/tests/auto/core/qtransform/tst_qtransform.cpp
index ee63255b8..f5527ebf5 100644
--- a/tests/auto/core/qtransform/tst_qtransform.cpp
+++ b/tests/auto/core/qtransform/tst_qtransform.cpp
@@ -66,15 +66,15 @@ private Q_SLOTS:
QTest::newRow("defaultConstructed") << defaultConstructed;
Qt3DCore::QTransform *matrixPropertySet = new Qt3DCore::QTransform();
- matrixPropertySet->setMatrix(Qt3DCore::QTransform::rotateAround(QVector3D(0.1877, 0.6868, 0.3884), 45.0, QVector3D(0, 0, 1)));
+ matrixPropertySet->setMatrix(Qt3DCore::QTransform::rotateAround(QVector3D(0.1877f, 0.6868f, 0.3884f), 45.0f, QVector3D(0.0f, 0.0f, 1.0f)));
QTest::newRow("matrixPropertySet") << matrixPropertySet;
Qt3DCore::QTransform *translationSet = new Qt3DCore::QTransform();
- translationSet->setTranslation(QVector3D(0.1877, 0.6868, 0.3884));
+ translationSet->setTranslation(QVector3D(0.1877f, 0.6868f, 0.3884f));
QTest::newRow("translationSet") << translationSet;
Qt3DCore::QTransform *scaleSet = new Qt3DCore::QTransform();
- scaleSet->setScale3D(QVector3D(0.1, 0.6, 0.3));
+ scaleSet->setScale3D(QVector3D(0.1f, 0.6f, 0.3f));
QTest::newRow("scaleSet") << scaleSet;
Qt3DCore::QTransform *rotationSet = new Qt3DCore::QTransform();
@@ -326,7 +326,7 @@ private Q_SLOTS:
// GIVEN
Qt3DCore::QTransform t;
Qt3DCore::QTransform t2;
- QMatrix4x4 m = Qt3DCore::QTransform::rotateAround(QVector3D(0.1877, 0.6868, 0.3884), 45.0, QVector3D(0, 0, 1));
+ QMatrix4x4 m = Qt3DCore::QTransform::rotateAround(QVector3D(0.1877f, 0.6868f, 0.3884f), 45.0f, QVector3D(0.0f, 0.0f, 1.0f));
// WHEN
t.setMatrix(m);
diff --git a/tests/auto/extras/common/common.pri b/tests/auto/extras/common/common.pri
new file mode 100644
index 000000000..4f73c65b5
--- /dev/null
+++ b/tests/auto/extras/common/common.pri
@@ -0,0 +1,6 @@
+HEADERS += \
+ $$PWD/geometrytesthelper.h
+
+INCLUDEPATH += $$PWD
+
+QT += core-private 3drender
diff --git a/tests/auto/extras/common/geometrytesthelper.h b/tests/auto/extras/common/geometrytesthelper.h
new file mode 100644
index 000000000..48e674cd9
--- /dev/null
+++ b/tests/auto/extras/common/geometrytesthelper.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GEOMETRYTESTHELPER_H
+#define GEOMETRYTESTHELPER_H
+
+#include <Qt3DRender/qattribute.h>
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DRender/qgeometry.h>
+
+inline void generateGeometry(Qt3DRender::QGeometry &geometry)
+{
+ // Get all attributes
+ const QVector<Qt3DRender::QAttribute *> attributes = geometry.attributes();
+
+ // Get all unique data generators from the buffers referenced by the attributes
+ QHash<Qt3DRender::QBufferDataGeneratorPtr, Qt3DRender::QBuffer *> dataGenerators;
+ for (const auto attribute : attributes) {
+ const auto dataGenerator = attribute->buffer()->dataGenerator();
+ if (!dataGenerators.contains(dataGenerator))
+ dataGenerators.insert(dataGenerator, attribute->buffer());
+ }
+
+ // Generate data for each buffer
+ const auto end = dataGenerators.end();
+ for (auto it = dataGenerators.begin(); it != end; ++it) {
+ Qt3DRender::QBufferDataGeneratorPtr dataGenerator = it.key();
+ const QByteArray data = (*dataGenerator)();
+
+ Qt3DRender::QBuffer *buffer = it.value();
+ buffer->setData(data);
+ }
+}
+
+template<typename IndexType>
+IndexType extractIndexData(Qt3DRender::QAttribute *attribute, int index)
+{
+ // Get the raw data
+ const IndexType *typedData = reinterpret_cast<const IndexType *>(attribute->buffer()->data().constData());
+
+ // Offset into the data taking stride and offset into account
+ const IndexType indexValue = *(typedData + index);
+ return indexValue;
+}
+
+template<typename VertexType, typename IndexType>
+VertexType extractVertexData(Qt3DRender::QAttribute *attribute, IndexType index)
+{
+ // Get the raw data
+ const char *rawData = attribute->buffer()->data().constData();
+
+ // Offset into the data taking stride and offset into account
+ const char *vertexData = rawData + (index * attribute->byteStride() + attribute->byteOffset());
+
+ // Construct vertex from the typed data
+ VertexType vertex;
+ const Qt3DRender::QAttribute::VertexBaseType type = attribute->vertexBaseType();
+ switch (type)
+ {
+ case Qt3DRender::QAttribute::Float: {
+ const float *typedVertexData = reinterpret_cast<const float *>(vertexData);
+ const int components = attribute->vertexSize();
+ for (int i = 0; i < components; ++i)
+ vertex[i] = typedVertexData[i];
+ break;
+
+ // TODO: Handle other types as needed
+ }
+
+ default:
+ qWarning() << "Unhandled type";
+ Q_UNREACHABLE();
+ break;
+ }
+
+ return vertex;
+}
+
+#endif // GEOMETRYTESTHELPER_H
diff --git a/tests/auto/extras/extras.pro b/tests/auto/extras/extras.pro
index 3bba4d37b..381924d7b 100644
--- a/tests/auto/extras/extras.pro
+++ b/tests/auto/extras/extras.pro
@@ -1,4 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = \
- qcuboidgeometry
+ qcuboidgeometry \
+ qtorusgeometry
diff --git a/tests/auto/extras/qcuboidgeometry/qcuboidgeometry.pro b/tests/auto/extras/qcuboidgeometry/qcuboidgeometry.pro
index 7208f1c7b..1e55fffad 100644
--- a/tests/auto/extras/qcuboidgeometry/qcuboidgeometry.pro
+++ b/tests/auto/extras/qcuboidgeometry/qcuboidgeometry.pro
@@ -8,3 +8,5 @@ CONFIG += testcase
SOURCES += \
tst_qcuboidgeometry.cpp
+
+include(../common/common.pri)
diff --git a/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp b/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp
index fa1657732..973a1d613 100644
--- a/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp
+++ b/tests/auto/extras/qcuboidgeometry/tst_qcuboidgeometry.cpp
@@ -40,77 +40,7 @@
#include <QtCore/qsharedpointer.h>
#include <QSignalSpy>
-namespace {
-
-void generateGeometry(Qt3DRender::QGeometry &geometry)
-{
- // Get all attributes
- const QVector<Qt3DRender::QAttribute *> attributes = geometry.attributes();
-
- // Get all unique data generators from the buffers referenced by the attributes
- QHash<Qt3DRender::QBufferDataGeneratorPtr, Qt3DRender::QBuffer *> dataGenerators;
- for (const auto attribute : attributes) {
- const auto dataGenerator = attribute->buffer()->dataGenerator();
- if (!dataGenerators.contains(dataGenerator))
- dataGenerators.insert(dataGenerator, attribute->buffer());
- }
-
- // Generate data for each buffer
- const auto end = dataGenerators.end();
- for (auto it = dataGenerators.begin(); it != end; ++it) {
- Qt3DRender::QBufferDataGeneratorPtr dataGenerator = it.key();
- const QByteArray data = (*dataGenerator)();
-
- Qt3DRender::QBuffer *buffer = it.value();
- buffer->setData(data);
- }
-}
-
-template<typename IndexType>
-IndexType extractIndexData(Qt3DRender::QAttribute *attribute, int index)
-{
- // Get the raw data
- const IndexType *typedData = reinterpret_cast<const IndexType *>(attribute->buffer()->data().constData());
-
- // Offset into the data taking stride and offset into account
- const IndexType indexValue = *(typedData + index);
- return indexValue;
-}
-
-template<typename VertexType, typename IndexType>
-VertexType extractVertexData(Qt3DRender::QAttribute *attribute, IndexType index)
-{
- // Get the raw data
- const char *rawData = attribute->buffer()->data().constData();
-
- // Offset into the data taking stride and offset into account
- const char *vertexData = rawData + (index * attribute->byteStride() + attribute->byteOffset());
-
- // Construct vertex from the typed data
- VertexType vertex;
- const Qt3DRender::QAttribute::VertexBaseType type = attribute->vertexBaseType();
- switch (type)
- {
- case Qt3DRender::QAttribute::Float: {
- const float *typedVertexData = reinterpret_cast<const float *>(vertexData);
- const int components = attribute->vertexSize();
- for (int i = 0; i < components; ++i)
- vertex[i] = typedVertexData[i];
- break;
-
- // TODO: Handle other types as needed
- }
-
- default:
- qWarning() << "Unhandled type";
- Q_UNREACHABLE();
- break;
- }
-
- return vertex;
-}
-
-}
+#include "geometrytesthelper.h"
class tst_QCuboidGeometry : public QObject
{
diff --git a/tests/auto/extras/qtorusgeometry/qtorusgeometry.pro b/tests/auto/extras/qtorusgeometry/qtorusgeometry.pro
new file mode 100644
index 000000000..e20e447dc
--- /dev/null
+++ b/tests/auto/extras/qtorusgeometry/qtorusgeometry.pro
@@ -0,0 +1,12 @@
+TEMPLATE = app
+
+TARGET = tst_qtorusgeometry
+
+QT += 3dextras testlib
+
+CONFIG += testcase
+
+SOURCES += \
+ tst_qtorusgeometry.cpp
+
+include(../common/common.pri)
diff --git a/tests/auto/extras/qtorusgeometry/tst_qtorusgeometry.cpp b/tests/auto/extras/qtorusgeometry/tst_qtorusgeometry.cpp
new file mode 100644
index 000000000..28fe76ae9
--- /dev/null
+++ b/tests/auto/extras/qtorusgeometry/tst_qtorusgeometry.cpp
@@ -0,0 +1,366 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <QObject>
+#include <Qt3DExtras/qtorusgeometry.h>
+#include <Qt3DRender/qattribute.h>
+#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/qbufferdatagenerator.h>
+#include <QtGui/qopenglcontext.h>
+#include <QtGui/qvector2d.h>
+#include <QtGui/qvector3d.h>
+#include <QtGui/qvector4d.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qsharedpointer.h>
+#include <QSignalSpy>
+#include <qmath.h>
+
+#include "geometrytesthelper.h"
+
+class tst_QTorusGeometry : public QObject
+{
+ Q_OBJECT
+private Q_SLOTS:
+ void defaultConstruction()
+ {
+ // WHEN
+ Qt3DExtras::QTorusGeometry geometry;
+
+ // THEN
+ QCOMPARE(geometry.rings(), 16);
+ QCOMPARE(geometry.slices(), 16);
+ QCOMPARE(geometry.radius(), 1.0f);
+ QCOMPARE(geometry.minorRadius(), 1.0f);
+ QVERIFY(geometry.positionAttribute() != nullptr);
+ QCOMPARE(geometry.positionAttribute()->name(), Qt3DRender::QAttribute::defaultPositionAttributeName());
+ QVERIFY(geometry.normalAttribute() != nullptr);
+ QCOMPARE(geometry.normalAttribute()->name(), Qt3DRender::QAttribute::defaultNormalAttributeName());
+ QVERIFY(geometry.texCoordAttribute() != nullptr);
+ QCOMPARE(geometry.texCoordAttribute()->name(), Qt3DRender::QAttribute::defaultTextureCoordinateAttributeName());
+ // TODO: Expose tangent attribute in Qt 5.8 and see below
+// QVERIFY(geometry.tangentAttribute() != nullptr);
+// QCOMPARE(geometry.tangentAttribute()->name(), Qt3DRender::QAttribute::defaultTangentAttributeName());
+ QVERIFY(geometry.indexAttribute() != nullptr);
+ }
+
+ void properties()
+ {
+ // GIVEN
+ Qt3DExtras::QTorusGeometry geometry;
+
+ {
+ // WHEN
+ QSignalSpy spy(&geometry, SIGNAL(ringsChanged(int)));
+ const int newValue = 20;
+ geometry.setRings(newValue);
+
+ // THEN
+ QCOMPARE(geometry.rings(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ geometry.setRings(newValue);
+
+ // THEN
+ QCOMPARE(geometry.rings(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
+
+ {
+ // WHEN
+ QSignalSpy spy(&geometry, SIGNAL(slicesChanged(int)));
+ const int newValue = 2.0f;
+ geometry.setSlices(newValue);
+
+ // THEN
+ QCOMPARE(geometry.slices(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ geometry.setSlices(newValue);
+
+ // THEN
+ QCOMPARE(geometry.slices(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
+
+ {
+ // WHEN
+ QSignalSpy spy(&geometry, SIGNAL(radiusChanged(float)));
+ const float newValue = 2.0f;
+ geometry.setRadius(newValue);
+
+ // THEN
+ QCOMPARE(geometry.radius(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ geometry.setRadius(newValue);
+
+ // THEN
+ QCOMPARE(geometry.radius(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
+
+ {
+ // WHEN
+ QSignalSpy spy(&geometry, SIGNAL(minorRadiusChanged(float)));
+ const float newValue = 0.25f;
+ geometry.setMinorRadius(newValue);
+
+ // THEN
+ QCOMPARE(geometry.minorRadius(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ geometry.setMinorRadius(newValue);
+
+ // THEN
+ QCOMPARE(geometry.minorRadius(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
+ }
+
+ void generatedGeometryShouldBeConsistent_data()
+ {
+ QTest::addColumn<int>("rings");
+ QTest::addColumn<int>("slices");
+ QTest::addColumn<float>("radius");
+ QTest::addColumn<float>("minorRadius");
+ QTest::addColumn<int>("triangleIndex");
+ QTest::addColumn<QVector<quint16>>("indices");
+ QTest::addColumn<QVector<QVector3D>>("positions");
+ QTest::addColumn<QVector<QVector3D>>("normals");
+ QTest::addColumn<QVector<QVector2D>>("texCoords");
+ QTest::addColumn<QVector<QVector4D>>("tangents");
+
+ {
+ // Torus properties
+ const int rings = 8;
+ const int slices = 8;
+ const float radius = 2.0f;
+ const float minorRadius = 0.5f;
+
+ // Angular factors for the vertices:
+ // u iterates around the major radius
+ // v iterates around the minor radius (around each ring)
+ const float du = float(2.0 * M_PI / rings);
+ const float dv = float(2.0 * M_PI / slices);
+ const float u0 = 0.0f;
+ const float u1 = du;
+ const float v0 = 0.0f;
+ const float v1 = dv;
+
+ const float cosu0 = float(qCos(u0));
+ const float sinu0 = float(qSin(u0));
+ const float cosu1 = float(qCos(u1));
+ const float sinu1 = float(qSin(u1));
+
+ const float cosv0 = float(qCos(v0 + M_PI)); // Seam is on inner edge
+ const float sinv0 = float(qSin(v0));
+ const float cosv1 = float(qCos(v1 + M_PI));
+ const float sinv1 = float(qSin(v1));
+
+ // The triangle and indices
+ const int triangleIndex = 0;
+ const auto indices = (QVector<quint16>() << 0 << 1 << 9);
+
+ // Calculate attributes for vertices A, B, and C of the triangle
+ const float rA = radius + minorRadius * cosv0;
+ const float rB = radius + minorRadius * cosv1;
+ const float rC = radius + minorRadius * cosv0;
+
+ const auto posA = QVector3D(rA * cosu0, rA * sinu0, minorRadius * sinv0);
+ const auto posB = QVector3D(rB * cosu0, rB * sinu0, minorRadius * sinv1);
+ const auto posC = QVector3D(rC * cosu1, rC * sinu1, minorRadius * sinv0);
+ const auto positions = (QVector<QVector3D>() << posA << posB << posC);
+
+ const auto nA = QVector3D(cosv0 * cosu0, cosv0 * sinu0, sinv0).normalized();
+ const auto nB = QVector3D(cosv1 * cosu0, cosv1 * sinu0, sinv1).normalized();
+ const auto nC = QVector3D(cosv0 * cosu1, cosv0 * sinu1, sinv0).normalized();
+ const auto normals = (QVector<QVector3D>() << nA << nB << nC);
+
+ const auto tcA = QVector2D(u0, v0) / float(2.0 * M_PI);
+ const auto tcB = QVector2D(u0, v1) / float(2.0 * M_PI);
+ const auto tcC = QVector2D(u1, v0) / float(2.0 * M_PI);
+ const auto texCoords = (QVector<QVector2D>() << tcA << tcB << tcC);
+
+ const auto tA = QVector4D(-sinu0, cosu0, 0.0f, 1.0f);
+ const auto tB = QVector4D(-sinu0, cosu0, 0.0f, 1.0f);
+ const auto tC = QVector4D(-sinu1, cosu1, 0.0f, 1.0f);
+ const auto tangents = (QVector<QVector4D>() << tA << tB << tC);
+
+ // Add the row
+ QTest::newRow("8rings_8slices_firstTriangle")
+ << rings << slices << radius << minorRadius
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+
+ {
+ // Note: The vertices used in this test case are different than the
+ // ones above. So, we cannot abstract this into a function easily.
+ // Here we use the 2nd triangle in a rectangular face, the test above
+ // uses the first triangle in the rectangular face.
+
+ // Torus properties
+ const int rings = 8;
+ const int slices = 8;
+ const float radius = 2.0f;
+ const float minorRadius = 0.5f;
+
+ // Angular factors for the vertices:
+ // u iterates around the major radius
+ // v iterates around the minor radius (around each ring)
+ const float du = float(2.0 * M_PI / rings);
+ const float dv = float(2.0 * M_PI / slices);
+ const float u0 = 7.0f * du;
+ const float u1 = float(2.0 * M_PI);
+ const float v0 = 7.0f * dv;
+ const float v1 = float(2.0 * M_PI);
+
+ const float cosu0 = float(qCos(u0));
+ const float sinu0 = float(qSin(u0));
+ const float cosu1 = float(qCos(u1));
+ const float sinu1 = float(qSin(u1));
+
+ const float cosv0 = float(qCos(v0 + M_PI)); // Seam is on inner edge
+ const float sinv0 = float(qSin(v0));
+ const float cosv1 = float(qCos(v1 + M_PI));
+ const float sinv1 = float(qSin(v1));
+
+ // The triangle and indices
+ const int triangleIndex = 127;
+ const auto indices = (QVector<quint16>() << 71 << 80 << 79);
+
+ // Calculate attributes for vertices A, B, and C of the triangle
+ const float rA = radius + minorRadius * cosv1;
+ const float rB = radius + minorRadius * cosv1;
+ const float rC = radius + minorRadius * cosv0;
+
+ const auto posA = QVector3D(rA * cosu0, rA * sinu0, minorRadius * sinv1);
+ const auto posB = QVector3D(rB * cosu1, rB * sinu1, minorRadius * sinv1);
+ const auto posC = QVector3D(rC * cosu1, rC * sinu1, minorRadius * sinv0);
+ const auto positions = (QVector<QVector3D>() << posA << posB << posC);
+
+ const auto nA = QVector3D(cosv1 * cosu0, cosv1 * sinu0, sinv1).normalized();
+ const auto nB = QVector3D(cosv1 * cosu1, cosv1 * sinu1, sinv1).normalized();
+ const auto nC = QVector3D(cosv0 * cosu1, cosv0 * sinu1, sinv0).normalized();
+ const auto normals = (QVector<QVector3D>() << nA << nB << nC);
+
+ const auto tcA = QVector2D(u0, v1) / float(2.0 * M_PI);
+ const auto tcB = QVector2D(u1, v1) / float(2.0 * M_PI);
+ const auto tcC = QVector2D(u1, v0) / float(2.0 * M_PI);
+ const auto texCoords = (QVector<QVector2D>() << tcA << tcB << tcC);
+
+ const auto tA = QVector4D(-sinu0, cosu1, 0.0f, 1.0f);
+ const auto tB = QVector4D(-sinu1, cosu1, 0.0f, 1.0f);
+ const auto tC = QVector4D(-sinu1, cosu1, 0.0f, 1.0f);
+ const auto tangents = (QVector<QVector4D>() << tA << tB << tC);
+
+ // Add the row
+ QTest::newRow("8rings_8slices_lastTriangle")
+ << rings << slices << radius << minorRadius
+ << triangleIndex
+ << indices << positions << normals << texCoords << tangents;
+ }
+ }
+
+ void generatedGeometryShouldBeConsistent()
+ {
+ // GIVEN
+ Qt3DExtras::QTorusGeometry geometry;
+ const QVector<Qt3DRender::QAttribute *> attributes = geometry.attributes();
+ Qt3DRender::QAttribute *positionAttribute = geometry.positionAttribute();
+ Qt3DRender::QAttribute *normalAttribute = geometry.normalAttribute();
+ Qt3DRender::QAttribute *texCoordAttribute = geometry.texCoordAttribute();
+// Qt3DRender::QAttribute *tangentAttribute = geometry.tangentAttribute();
+ Qt3DRender::QAttribute *indexAttribute = geometry.indexAttribute();
+
+ // WHEN
+ QFETCH(int, rings);
+ QFETCH(int, slices);
+ QFETCH(float, radius);
+ QFETCH(float, minorRadius);
+ geometry.setRings(rings);
+ geometry.setSlices(slices);
+ geometry.setRadius(radius);
+ geometry.setMinorRadius(minorRadius);
+
+ generateGeometry(geometry);
+
+ // THEN
+
+ // Check buffer of each attribute is valid and actually has some data
+ for (const auto &attribute : attributes) {
+ Qt3DRender::QBuffer *buffer = attribute->buffer();
+ QVERIFY(buffer != nullptr);
+ QVERIFY(buffer->data().size() != 0);
+ }
+
+ // Check some data in the buffers
+
+ // Check specific indices and vertex attributes of triangle under test
+ QFETCH(int, triangleIndex);
+ QFETCH(QVector<quint16>, indices);
+ QFETCH(QVector<QVector3D>, positions);
+ QFETCH(QVector<QVector3D>, normals);
+ QFETCH(QVector<QVector2D>, texCoords);
+// QFETCH(QVector<QVector4D>, tangents);
+
+ int i = 0;
+ for (auto index : indices) {
+ const auto testIndex = extractIndexData<quint16>(indexAttribute, 3 * triangleIndex + i);
+ QCOMPARE(testIndex, indices.at(i));
+
+ const auto position = extractVertexData<QVector3D, quint32>(positionAttribute, index);
+ QVERIFY(qFuzzyCompare(position, positions.at(i)));
+
+ const auto normal = extractVertexData<QVector3D, quint32>(normalAttribute, index);
+ QVERIFY(qFuzzyCompare(normal, normals.at(i)));
+
+ const auto texCoord = extractVertexData<QVector2D, quint32>(texCoordAttribute, index);
+ QVERIFY(qFuzzyCompare(texCoord, texCoords.at(i)));
+
+// const auto tangent = extractVertexData<QVector4D, quint32>(tangentAttribute, index);
+// QVERIFY(qFuzzyCompare(tangent, tangents.at(i)));
+
+ ++i;
+ }
+ }
+};
+
+
+QTEST_APPLESS_MAIN(tst_QTorusGeometry)
+
+#include "tst_qtorusgeometry.moc"
diff --git a/tests/auto/input/input.pro b/tests/auto/input/input.pro
index 05668c036..cf0af12cb 100644
--- a/tests/auto/input/input.pro
+++ b/tests/auto/input/input.pro
@@ -19,5 +19,6 @@ qtConfig(private_tests) {
keyboardhandler \
qaxisaccumulator \
inputsequence \
- inputchord
+ inputchord \
+ qabstractphysicaldevicebackendnode
}
diff --git a/tests/auto/input/qabstractphysicaldevicebackendnode/qabstractphysicaldevicebackendnode.pro b/tests/auto/input/qabstractphysicaldevicebackendnode/qabstractphysicaldevicebackendnode.pro
new file mode 100644
index 000000000..dc1734c41
--- /dev/null
+++ b/tests/auto/input/qabstractphysicaldevicebackendnode/qabstractphysicaldevicebackendnode.pro
@@ -0,0 +1,11 @@
+TEMPLATE = app
+
+TARGET = tst_qabstractphysicaldevicebackendnode
+
+QT += 3dcore 3dcore-private 3dinput 3dinput-private testlib
+
+CONFIG += testcase
+
+SOURCES += tst_qabstractphysicaldevicebackendnode.cpp
+
+include(../commons/commons.pri)
diff --git a/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp b/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp
new file mode 100644
index 000000000..0cf37fe95
--- /dev/null
+++ b/tests/auto/input/qabstractphysicaldevicebackendnode/tst_qabstractphysicaldevicebackendnode.cpp
@@ -0,0 +1,246 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QTest>
+#include <Qt3DInput/private/qabstractphysicaldevicebackendnode_p.h>
+#include <Qt3DInput/private/qabstractphysicaldevicebackendnode_p_p.h>
+#include <Qt3DInput/private/inputhandler_p.h>
+#include <Qt3DInput/qaxissetting.h>
+#include <Qt3DInput/qinputaspect.h>
+#include <Qt3DInput/private/qinputaspect_p.h>
+#include <Qt3DInput/private/inputmanagers_p.h>
+#include <Qt3DInput/private/axissetting_p.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertyupdatedchange.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include "testdevice.h"
+
+class TestPhysicalDeviceBackendNode : public Qt3DInput::QAbstractPhysicalDeviceBackendNode
+{
+public:
+ TestPhysicalDeviceBackendNode(Qt3DCore::QBackendNode::Mode mode = Qt3DCore::QBackendNode::ReadOnly)
+ : Qt3DInput::QAbstractPhysicalDeviceBackendNode(mode)
+ {}
+
+ float axisValue(int axisIdentifier) const Q_DECL_OVERRIDE
+ {
+ if (axisIdentifier == 883)
+ return 883.0f;
+ return 0.0f;
+ }
+
+ bool isButtonPressed(int buttonIdentifier) const Q_DECL_OVERRIDE
+ {
+ if (buttonIdentifier == 454)
+ return true;
+ return false;
+ }
+
+};
+
+class tst_QAbstractPhysicalDeviceBackendNode : public Qt3DCore::QBackendNodeTester
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ void checkInitialState()
+ {
+ // GIVEN
+ TestPhysicalDeviceBackendNode backendQAbstractPhysicalDeviceBackendNode;
+
+ // THEN
+ QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.isEnabled(), false);
+ QVERIFY(backendQAbstractPhysicalDeviceBackendNode.inputAspect() == nullptr);
+ QVERIFY(backendQAbstractPhysicalDeviceBackendNode.peerId().isNull());
+ }
+
+ void checkAxisValue()
+ {
+ // GIVEN
+ TestPhysicalDeviceBackendNode backendQAbstractPhysicalDeviceBackendNode;
+
+ // WHEN
+ float axisValue = backendQAbstractPhysicalDeviceBackendNode.axisValue(883);
+ // THEN
+ QCOMPARE(axisValue, 883.0f);
+
+ // WHEN
+ axisValue = backendQAbstractPhysicalDeviceBackendNode.axisValue(454);
+ // THEN
+ QCOMPARE(axisValue, 0.0f);
+ }
+
+ void checkButtonPressed()
+ {
+ // GIVEN
+ TestPhysicalDeviceBackendNode backendQAbstractPhysicalDeviceBackendNode;
+
+ // WHEN
+ bool buttonPressed = backendQAbstractPhysicalDeviceBackendNode.isButtonPressed(883);
+ // THEN
+ QCOMPARE(buttonPressed, false);
+
+ // WHEN
+ buttonPressed = backendQAbstractPhysicalDeviceBackendNode.isButtonPressed(454);
+ // THEN
+ QCOMPARE(buttonPressed, true);
+ }
+
+ void checkCleanupState()
+ {
+ // GIVEN
+ TestPhysicalDeviceBackendNode backendQAbstractPhysicalDeviceBackendNode;
+ Qt3DInput::QInputAspect aspect;
+
+ // WHEN
+ backendQAbstractPhysicalDeviceBackendNode.setEnabled(true);
+ backendQAbstractPhysicalDeviceBackendNode.setInputAspect(&aspect);
+
+ // THEN
+ QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.inputAspect(), &aspect);
+
+ // WHEN
+ backendQAbstractPhysicalDeviceBackendNode.cleanup();
+
+ // THEN
+ QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.isEnabled(), false);
+ QVERIFY(backendQAbstractPhysicalDeviceBackendNode.inputAspect() == nullptr);
+ }
+
+ void checkInitializeFromPeer()
+ {
+ // GIVEN
+ TestDevice physicalDeviceNode;
+
+ {
+ // WHEN
+ TestPhysicalDeviceBackendNode backendQAbstractPhysicalDeviceBackendNode;
+ simulateInitialization(&physicalDeviceNode, &backendQAbstractPhysicalDeviceBackendNode);
+
+ // THEN
+ QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.isEnabled(), true);
+ QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.peerId(), physicalDeviceNode.id());
+ }
+ {
+ // WHEN
+ TestPhysicalDeviceBackendNode backendQAbstractPhysicalDeviceBackendNode;
+ physicalDeviceNode.setEnabled(false);
+ simulateInitialization(&physicalDeviceNode, &backendQAbstractPhysicalDeviceBackendNode);
+
+ // THEN
+ QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.peerId(), physicalDeviceNode.id());
+ QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.isEnabled(), false);
+ }
+ }
+
+ void checkSceneChangeEvents()
+ {
+ // GIVEN
+ TestPhysicalDeviceBackendNode backendQAbstractPhysicalDeviceBackendNode;
+ Qt3DInput::QInputAspect aspect;
+ backendQAbstractPhysicalDeviceBackendNode.setInputAspect(&aspect);
+
+ {
+ // WHEN
+ const bool newValue = false;
+ const auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId());
+ change->setPropertyName("enabled");
+ change->setValue(newValue);
+ backendQAbstractPhysicalDeviceBackendNode.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendQAbstractPhysicalDeviceBackendNode.isEnabled(), newValue);
+ }
+
+ {
+ Qt3DInput::QAxisSetting settings1;
+ Qt3DInput::QAxisSetting settings2;
+
+ settings1.setAxes(QVector<int>() << 883);
+ settings2.setAxes(QVector<int>() << 454);
+ Qt3DInput::QAbstractPhysicalDeviceBackendNodePrivate *priv = static_cast<Qt3DInput::QAbstractPhysicalDeviceBackendNodePrivate *>(
+ Qt3DCore::QBackendNodePrivate::get(&backendQAbstractPhysicalDeviceBackendNode));
+
+ // Create backend resource
+ {
+ Qt3DInput::QInputAspectPrivate *aspectPrivate = static_cast<Qt3DInput::QInputAspectPrivate *>(Qt3DCore::QAbstractAspectPrivate::get(&aspect));
+ Qt3DInput::Input::InputHandler *handler = aspectPrivate->m_inputHandler.data();
+ Qt3DInput::Input::AxisSetting *backendSetting1 = handler->axisSettingManager()->getOrCreateResource(settings1.id());
+ Qt3DInput::Input::AxisSetting *backendSetting2 = handler->axisSettingManager()->getOrCreateResource(settings2.id());
+ simulateInitialization(&settings1, backendSetting1);
+ simulateInitialization(&settings2, backendSetting2);
+ }
+
+ // Adding AxisSettings
+ {
+ // WHEN
+ auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &settings1);
+ change->setPropertyName("axisSettings");
+ backendQAbstractPhysicalDeviceBackendNode.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(priv->m_axisSettings.size(), 1);
+
+ // WHEN
+ change = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &settings2);
+ change->setPropertyName("axisSettings");
+ backendQAbstractPhysicalDeviceBackendNode.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(priv->m_axisSettings.size(), 2);
+ }
+ // Removing AxisSettings
+ {
+ // WHEN
+ auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &settings1);
+ change->setPropertyName("axisSettings");
+ backendQAbstractPhysicalDeviceBackendNode.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(priv->m_axisSettings.size(), 1);
+
+ // WHEN
+ change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &settings2);
+ change->setPropertyName("axisSettings");
+ backendQAbstractPhysicalDeviceBackendNode.sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(priv->m_axisSettings.size(), 0);
+ }
+
+ }
+ }
+
+};
+
+QTEST_MAIN(tst_QAbstractPhysicalDeviceBackendNode)
+
+#include "tst_qabstractphysicaldevicebackendnode.moc"
diff --git a/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp b/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp
index 1a0459958..618c75d42 100644
--- a/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp
+++ b/tests/auto/input/qbuttonaxisinput/tst_qbuttonaxisinput.cpp
@@ -49,6 +49,18 @@ public:
}
private Q_SLOTS:
+ void shouldHaveDefaultState()
+ {
+ // GIVEN
+ Qt3DInput::QButtonAxisInput axisInput;
+
+ // THEN
+ QVERIFY(axisInput.buttons().isEmpty());
+ QCOMPARE(axisInput.scale(), 1.0f);
+ QCOMPARE(axisInput.acceleration(), -1.0f);
+ QCOMPARE(axisInput.deceleration(), -1.0f);
+ }
+
void checkCloning_data()
{
QTest::addColumn<Qt3DInput::QButtonAxisInput *>("axisInput");
diff --git a/tests/auto/render/framegraphnode/tst_framegraphnode.cpp b/tests/auto/render/framegraphnode/tst_framegraphnode.cpp
index f3f3dbff1..07ff4c0d9 100644
--- a/tests/auto/render/framegraphnode/tst_framegraphnode.cpp
+++ b/tests/auto/render/framegraphnode/tst_framegraphnode.cpp
@@ -29,6 +29,11 @@
#include <Qt3DRender/private/framegraphnode_p.h>
#include <QtTest/QTest>
#include <Qt3DRender/private/managers_p.h>
+#include <Qt3DRender/private/nodemanagers_p.h>
+#include <Qt3DCore/qpropertynodeaddedchange.h>
+#include <Qt3DCore/qpropertynoderemovedchange.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+#include "testrenderer.h"
class MyFrameGraphNode : public Qt3DRender::Render::FrameGraphNode
{
@@ -37,9 +42,15 @@ public:
{
FrameGraphNode::setEnabled(enabled);
}
+};
-protected:
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) Q_DECL_FINAL {}
+class MyQFrameGraphNode : public Qt3DRender::QFrameGraphNode
+{
+ Q_OBJECT
+public:
+ MyQFrameGraphNode(Qt3DCore::QNode *parent = nullptr)
+ : Qt3DRender::QFrameGraphNode(parent)
+ {}
};
class tst_FrameGraphNode : public QObject
@@ -167,8 +178,116 @@ private Q_SLOTS:
QCOMPARE(parent1->childrenIds().count(), 0);
QCOMPARE(parent1->children().count(), parent1->childrenIds().count());
}
+
+ void checkSetParent()
+ {
+ // GIVEN
+ QScopedPointer<Qt3DRender::Render::FrameGraphManager> manager(new Qt3DRender::Render::FrameGraphManager());
+ const Qt3DCore::QNodeId parent1Id = Qt3DCore::QNodeId::createId();
+ const Qt3DCore::QNodeId parent2Id = Qt3DCore::QNodeId::createId();
+ const Qt3DCore::QNodeId childId = Qt3DCore::QNodeId::createId();
+
+ Qt3DRender::Render::FrameGraphNode *parent1 = new MyFrameGraphNode();
+ Qt3DRender::Render::FrameGraphNode *parent2 = new MyFrameGraphNode();
+ Qt3DRender::Render::FrameGraphNode *child = new MyFrameGraphNode();
+
+ setIdInternal(parent1, parent1Id);
+ setIdInternal(parent2, parent2Id);
+ setIdInternal(child, childId);
+
+ manager->appendNode(parent1Id, parent1);
+ manager->appendNode(parent2Id, parent2);
+ manager->appendNode(childId, child);
+
+ parent1->setFrameGraphManager(manager.data());
+ parent2->setFrameGraphManager(manager.data());
+ child->setFrameGraphManager(manager.data());
+
+ // THEN
+ QCOMPARE(parent1->peerId(), parent1Id);
+ QCOMPARE(parent2->peerId(), parent2Id);
+ QCOMPARE(child->peerId(), childId);
+
+ QVERIFY(child->parentId().isNull());
+ QCOMPARE(parent1->childrenIds().size(), 0);
+ QCOMPARE(parent2->childrenIds().size(), 0);
+
+ // WHEN
+ child->setParentId(parent1Id);
+
+ // THEN
+ QCOMPARE(child->parentId(), parent1Id);
+ QCOMPARE(parent1->childrenIds().size(), 1);
+ QCOMPARE(parent2->childrenIds().size(), 0);
+
+ // WHEN
+ child->setParentId(parent2Id);
+
+ // THEN
+ QCOMPARE(child->parentId(), parent2Id);
+ QCOMPARE(parent1->childrenIds().size(), 0);
+ QCOMPARE(parent2->childrenIds().size(), 1);
+
+ // WHEN
+ child->setParentId(Qt3DCore::QNodeId());
+
+ // THEN
+ QVERIFY(child->parentId().isNull());
+ QCOMPARE(parent1->childrenIds().size(), 0);
+ QCOMPARE(parent2->childrenIds().size(), 0);
+ }
+
+ void checkSceneChangeEvents()
+ {
+ // GIVEN
+ const Qt3DCore::QNodeId fgNode1Id = Qt3DCore::QNodeId::createId();
+
+ Qt3DRender::Render::FrameGraphNode *backendFGNode = new MyFrameGraphNode();
+ Qt3DRender::QFrameGraphNode *frontendFGChild = new MyQFrameGraphNode();
+ Qt3DRender::Render::FrameGraphNode *backendFGChild = new MyFrameGraphNode();
+
+ QScopedPointer<Qt3DRender::Render::FrameGraphManager> manager(new Qt3DRender::Render::FrameGraphManager());
+
+ TestRenderer renderer;
+
+ backendFGNode->setRenderer(&renderer);
+
+ setIdInternal(backendFGNode, fgNode1Id);
+ setIdInternal(backendFGChild, frontendFGChild->id());
+
+ manager->appendNode(fgNode1Id, backendFGNode);
+ manager->appendNode(frontendFGChild->id(), backendFGChild);
+
+ backendFGNode->setFrameGraphManager(manager.data());
+ backendFGChild->setFrameGraphManager(manager.data());
+
+
+ // To geneate the type_info in the QNodePrivate of frontendFGChild
+ Qt3DCore::QNodeCreatedChangeGenerator generator(frontendFGChild);
+
+ QCOMPARE(backendFGNode->childrenIds().size(), 0);
+
+ {
+ // WHEN
+ const auto change = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), frontendFGChild);
+ backendFGNode->sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendFGNode->childrenIds().size(), 1);
+ QCOMPARE(backendFGNode->childrenIds().first(), frontendFGChild->id());
+ }
+ {
+ // WHEN
+ const auto change = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), frontendFGChild);
+ backendFGNode->sceneChangeEvent(change);
+
+ // THEN
+ QCOMPARE(backendFGNode->childrenIds().size(), 0);
+ }
+ }
+
};
-QTEST_APPLESS_MAIN(tst_FrameGraphNode)
+QTEST_MAIN(tst_FrameGraphNode)
#include "tst_framegraphnode.moc"
diff --git a/tests/auto/render/qray3d/tst_qray3d.cpp b/tests/auto/render/qray3d/tst_qray3d.cpp
index 6297f1c73..d01156832 100644
--- a/tests/auto/render/qray3d/tst_qray3d.cpp
+++ b/tests/auto/render/qray3d/tst_qray3d.cpp
@@ -238,10 +238,10 @@ void tst_QRay3D::point()
QFETCH(QVector3D, point_on_line_pos_0_6);
QFETCH(QVector3D, point_on_line_neg_7_2);
Qt3DRender::QRay3D line(point, direction);
- QVERIFY(fuzzyCompare(line.point(0.6), point_on_line_pos_0_6));
- QVERIFY(fuzzyCompare(line.point(-7.2), point_on_line_neg_7_2));
- QVERIFY(fuzzyCompare(line.projectedDistance(point_on_line_pos_0_6), 0.6));
- QVERIFY(fuzzyCompare(line.projectedDistance(point_on_line_neg_7_2), -7.2));
+ QVERIFY(fuzzyCompare(line.point(0.6f), point_on_line_pos_0_6));
+ QVERIFY(fuzzyCompare(line.point(-7.2f), point_on_line_neg_7_2));
+ QVERIFY(fuzzyCompare(line.projectedDistance(point_on_line_pos_0_6), 0.6f));
+ QVERIFY(fuzzyCompare(line.projectedDistance(point_on_line_neg_7_2), -7.2f));
}
void tst_QRay3D::contains_point_data()
diff --git a/tests/auto/render/raycasting/tst_raycasting.cpp b/tests/auto/render/raycasting/tst_raycasting.cpp
index 04274f67a..49341a4c5 100644
--- a/tests/auto/render/raycasting/tst_raycasting.cpp
+++ b/tests/auto/render/raycasting/tst_raycasting.cpp
@@ -313,7 +313,7 @@ void tst_RayCasting::mousePicking()
Qt3DRender::QCamera camera;
camera.setProjectionType(QCameraLens::PerspectiveProjection);
camera.setFieldOfView(45.0f);
- camera.setAspectRatio(800.0/600.0f);
+ camera.setAspectRatio(800.0f/600.0f);
camera.setNearPlane(0.1f);
camera.setFarPlane(1000.0f);
camera.setPosition(QVector3D(0.0f, 0.0f, -40.0f));
diff --git a/tests/auto/render/triangleboundingvolume/tst_triangleboundingvolume.cpp b/tests/auto/render/triangleboundingvolume/tst_triangleboundingvolume.cpp
index ea9ccc2f5..9ffc26973 100644
--- a/tests/auto/render/triangleboundingvolume/tst_triangleboundingvolume.cpp
+++ b/tests/auto/render/triangleboundingvolume/tst_triangleboundingvolume.cpp
@@ -104,7 +104,7 @@ private Q_SLOTS:
Qt3DRender::QCamera camera;
camera.setProjectionType(Qt3DRender::QCameraLens::PerspectiveProjection);
camera.setFieldOfView(45.0f);
- camera.setAspectRatio(800.0/600.0f);
+ camera.setAspectRatio(800.0f/600.0f);
camera.setNearPlane(0.1f);
camera.setFarPlane(1000.0f);
camera.setPosition(QVector3D(0.0f, 0.0f, 40.0f));
diff --git a/tests/manual/dynamicscene-cpp/examplescene.cpp b/tests/manual/dynamicscene-cpp/examplescene.cpp
index b11e2f54a..0ec2294a7 100644
--- a/tests/manual/dynamicscene-cpp/examplescene.cpp
+++ b/tests/manual/dynamicscene-cpp/examplescene.cpp
@@ -73,7 +73,7 @@ ExampleScene::~ExampleScene()
void ExampleScene::updateScene()
{
for (int i = 0; i < m_entities.size(); ++i) {
- const bool visible = (i % 2) ^ m_even;
+ const bool visible = (i % 2) ^ static_cast<int>(m_even);
m_entities[i]->setParent(visible ? this : nullptr);
}
m_even = !m_even;
diff --git a/tools/qgltf/qgltf.cpp b/tools/qgltf/qgltf.cpp
index b57ea8df2..a26fc487c 100644
--- a/tools/qgltf/qgltf.cpp
+++ b/tools/qgltf/qgltf.cpp
@@ -373,7 +373,7 @@ void Importer::delNode(Importer::Node *n)
{
if (!n)
return;
- foreach (Importer::Node *c, n->children)
+ for (Importer::Node *c : qAsConst(n->children))
delNode(c);
delete n;
}
@@ -398,10 +398,10 @@ const Importer::Node *Importer::rootNode() const
bool Importer::allMeshesForMaterialHaveTangents(uint materialIndex) const
{
- foreach (const MeshInfo &mi, m_meshInfo) {
+ for (const MeshInfo &mi : m_meshInfo) {
if (mi.materialIndex == materialIndex) {
bool hasTangents = false;
- foreach (const MeshInfo::Accessor &acc, mi.accessors) {
+ for (const MeshInfo::Accessor &acc : mi.accessors) {
if (acc.usage == QStringLiteral("TANGENT")) {
hasTangents = true;
break;
@@ -417,8 +417,8 @@ bool Importer::allMeshesForMaterialHaveTangents(uint materialIndex) const
QVector<Importer::MeshInfo::BufferView> Importer::bufferViews() const
{
QVector<Importer::MeshInfo::BufferView> bv;
- foreach (const MeshInfo &mi, m_meshInfo) {
- foreach (const MeshInfo::BufferView &v, mi.views)
+ for (const MeshInfo &mi : m_meshInfo) {
+ for (const MeshInfo::BufferView &v : mi.views)
bv << v;
}
return bv;
@@ -427,8 +427,8 @@ QVector<Importer::MeshInfo::BufferView> Importer::bufferViews() const
QVector<Importer::MeshInfo::Accessor> Importer::accessors() const
{
QVector<Importer::MeshInfo::Accessor> acc;
- foreach (const MeshInfo &mi, m_meshInfo) {
- foreach (const MeshInfo::Accessor &a, mi.accessors)
+ for (const MeshInfo &mi : m_meshInfo) {
+ for (const MeshInfo::Accessor &a : mi.accessors)
acc << a;
}
return acc;
@@ -476,7 +476,7 @@ QVector<Importer::AnimationInfo> Importer::animations() const
const Importer::Node *Importer::findNode(const Node *root, const QString &originalName) const
{
- foreach (const Node *c, root->children) {
+ for (const Node *c : root->children) {
if (c->name == originalName)
return c;
const Node *cn = findNode(c, originalName);
@@ -881,10 +881,10 @@ void AssimpImporter::buildBuffer()
if (!opts.interleave)
qDebug() << " non-interleaved layout";
QStringList sl;
- foreach (const MeshInfo::BufferView &bv, meshInfo.views) sl << bv.name;
+ for (const MeshInfo::BufferView &bv : qAsConst(meshInfo.views)) sl << bv.name;
qDebug() << " buffer views:" << sl;
sl.clear();
- foreach (const MeshInfo::Accessor &acc, meshInfo.accessors) sl << acc.name;
+ for (const MeshInfo::Accessor &acc : qAsConst(meshInfo.accessors)) sl << acc.name;
qDebug() << " accessors:" << sl;
qDebug() << " material: #" << meshInfo.materialIndex;
}
@@ -1138,7 +1138,7 @@ void AssimpImporter::parseAnimations()
m_animations << animInfo;
if (opts.showLog) {
- foreach (const KeyFrame &kf, keyFrames) {
+ for (const KeyFrame &kf : qAsConst(keyFrames)) {
QString msg;
QTextStream s(&msg);
s << " @ " << kf.t;
@@ -1185,7 +1185,7 @@ bool Exporter::nodeIsUseful(const Importer::Node *n) const
if (!n->meshes.isEmpty() || m_importer->cameraInfo().contains(n->name))
return true;
- foreach (const Importer::Node *c, n->children) {
+ for (const Importer::Node *c : n->children) {
if (nodeIsUseful(c))
return true;
}
@@ -1195,7 +1195,8 @@ bool Exporter::nodeIsUseful(const Importer::Node *n) const
void Exporter::copyExternalTextures(const QString &inputFilename)
{
- foreach (const QString &textureFilename, m_importer->externalTextures()) {
+ const auto textureFilenames = m_importer->externalTextures();
+ for (const QString &textureFilename : textureFilenames) {
const QString dst = opts.outDir + textureFilename;
m_files.insert(QFileInfo(dst).fileName());
// External textures need copying only when output dir was specified.
@@ -1213,7 +1214,8 @@ void Exporter::copyExternalTextures(const QString &inputFilename)
void Exporter::exportEmbeddedTextures()
{
#ifdef HAS_QIMAGE
- foreach (const Importer::EmbeddedTextureInfo &embTex, m_importer->embeddedTextures()) {
+ const auto embeddedTextures = m_importer->embeddedTextures();
+ for (const Importer::EmbeddedTextureInfo &embTex : embeddedTextures) {
QString fn = opts.outDir + embTex.name;
m_files.insert(QFileInfo(fn).fileName());
if (opts.showLog)
@@ -1228,13 +1230,16 @@ void Exporter::compressTextures()
if (opts.texComp != Options::ETC1)
return;
+ const auto textureFilenames = m_importer->externalTextures();
+ const auto embeddedTextures = m_importer->embeddedTextures();
QStringList imageList;
- foreach (const QString &textureFilename, m_importer->externalTextures())
+ imageList.reserve(textureFilenames.size() + embeddedTextures.size());
+ for (const QString &textureFilename : textureFilenames)
imageList << opts.outDir + textureFilename;
- foreach (const Importer::EmbeddedTextureInfo &embTex, m_importer->embeddedTextures())
+ for (const Importer::EmbeddedTextureInfo &embTex : embeddedTextures)
imageList << opts.outDir + embTex.name;
- foreach (const QString &filename, imageList) {
+ for (const QString &filename : qAsConst(imageList)) {
if (QFileInfo(filename).suffix().toLower() != QStringLiteral("png"))
continue;
QByteArray cmd = QByteArrayLiteral("etc1tool ");
@@ -1720,7 +1725,7 @@ QString GltfExporter::exportNode(const Importer::Node *n, QJsonObject &nodes)
QJsonObject node;
node["name"] = n->name;
QJsonArray children;
- foreach (const Importer::Node *c, n->children) {
+ for (const Importer::Node *c : n->children) {
if (nodeIsUseful(c))
children << exportNode(c, nodes);
}
@@ -1898,19 +1903,19 @@ void GltfExporter::exportMaterials(QJsonObject &materials, QHash<QString, QStrin
void GltfExporter::writeShader(const QString &src, const QString &dst, const QVector<QPair<QByteArray, QByteArray> > &substTab)
{
- for (size_t i = 0; i < sizeof(shaders) / sizeof(Shader); ++i) {
+ for (const Shader shader : shaders) {
QByteArray name = src.toUtf8();
- if (!qstrcmp(shaders[i].name, name.constData())) {
+ if (!qstrcmp(shader.name, name.constData())) {
QString outfn = opts.outDir + dst;
QFile outf(outfn);
if (outf.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
m_files.insert(QFileInfo(outf.fileName()).fileName());
if (opts.showLog)
qDebug() << "Writing" << outfn;
- foreach (const QString &s, QString::fromUtf8(shaders[i].text).split('\n')) {
- QString line = s;
- for (int i = 0; i < substTab.count(); ++i)
- line.replace(substTab[i].first, substTab[i].second);
+ const auto lines = QString::fromUtf8(shader.text).split('\n');
+ for (QString line : lines) {
+ for (const auto &subst : substTab)
+ line.replace(subst.first, subst.second);
line += QStringLiteral("\n");
outf.write(line.toUtf8());
}
@@ -1923,7 +1928,7 @@ void GltfExporter::writeShader(const QString &src, const QString &dst, const QVe
void GltfExporter::exportParameter(QJsonObject &dst, const QVector<ProgramInfo::Param> &params)
{
- foreach (const ProgramInfo::Param &param, params) {
+ for (const ProgramInfo::Param &param : params) {
QJsonObject parameter;
parameter["type"] = int(param.type);
if (!param.semantic.isEmpty())
@@ -1951,7 +1956,7 @@ void GltfExporter::exportTechniques(QJsonObject &obj, const QString &basename)
QJsonObject shaders;
QHash<QString, QString> shaderMap;
- foreach (ProgramInfo *prog, m_usedPrograms) {
+ for (ProgramInfo *prog : qAsConst(m_usedPrograms)) {
QString newName;
if (!shaderMap.contains(prog->vertShader)) {
QJsonObject vertexShader;
@@ -2001,47 +2006,51 @@ void GltfExporter::exportTechniques(QJsonObject &obj, const QString &basename)
obj["shaders"] = shaders;
QJsonObject programs;
- QHash<ProgramInfo *, ProgramNames> programMap;
- foreach (ProgramInfo *prog, m_usedPrograms) {
+ QHash<const ProgramInfo *, ProgramNames> programMap;
+ for (const ProgramInfo *prog : qAsConst(m_usedPrograms)) {
QJsonObject program;
program["vertexShader"] = shaderMap[prog->vertShader];
program["fragmentShader"] = shaderMap[prog->fragShader];
QJsonArray attrs;
- foreach (const ProgramInfo::Param &param, prog->attributes)
+ for (const ProgramInfo::Param &param : prog->attributes) {
attrs << param.nameInShader;
+ }
program["attributes"] = attrs;
QString programName = newProgramName();
programMap[prog].name = programName;
programs[programMap[prog].name] = program;
if (opts.genCore) {
- program["vertexShader"] = shaderMap[QString(prog->vertShader + QStringLiteral("_core"))];
- program["fragmentShader"] = shaderMap[QString(prog->fragShader + QStringLiteral("_core"))];
+ program["vertexShader"] = shaderMap[QString(prog->vertShader + QLatin1String("_core"))];
+ program["fragmentShader"] = shaderMap[QString(prog->fragShader + QLatin1String("_core"))];
QJsonArray attrs;
- foreach (const ProgramInfo::Param &param, prog->attributes)
+ for (const ProgramInfo::Param &param : prog->attributes) {
attrs << param.nameInShader;
+ }
program["attributes"] = attrs;
- programMap[prog].coreName = programName + QStringLiteral("_core");
+ programMap[prog].coreName = programName + QLatin1String("_core");
programs[programMap[prog].coreName] = program;
}
}
obj["programs"] = programs;
QJsonObject techniques;
- foreach (const TechniqueInfo &techniqueInfo, m_techniques) {
+ for (const TechniqueInfo &techniqueInfo : qAsConst(m_techniques)) {
QJsonObject technique;
QJsonObject parameters;
- ProgramInfo *prog = techniqueInfo.prog;
+ const ProgramInfo *prog = techniqueInfo.prog;
exportParameter(parameters, prog->attributes);
exportParameter(parameters, prog->uniforms);
technique["parameters"] = parameters;
technique["program"] = programMap[prog].name;
QJsonObject progAttrs;
- foreach (const ProgramInfo::Param &param, prog->attributes)
+ for (const ProgramInfo::Param &param : prog->attributes) {
progAttrs[param.nameInShader] = param.name;
+ }
technique["attributes"] = progAttrs;
QJsonObject progUniforms;
- foreach (const ProgramInfo::Param &param, prog->uniforms)
+ for (const ProgramInfo::Param &param : prog->uniforms) {
progUniforms[param.nameInShader] = param.name;
+ }
technique["uniforms"] = progUniforms;
QJsonObject states;
QJsonArray enabledStates;
@@ -2074,7 +2083,8 @@ void GltfExporter::exportAnimations(QJsonObject &obj,
QVector<Importer::MeshInfo::BufferView> &bvList,
QVector<Importer::MeshInfo::Accessor> &accList)
{
- if (m_importer->animations().isEmpty()) {
+ const auto animationInfos = m_importer->animations();
+ if (animationInfos.empty()) {
obj["animations"] = QJsonObject();
return;
}
@@ -2083,7 +2093,7 @@ void GltfExporter::exportAnimations(QJsonObject &obj,
QByteArray extraData;
int sz = 0;
- foreach (const Importer::AnimationInfo &ai, m_importer->animations())
+ for (const Importer::AnimationInfo &ai : animationInfos)
sz += ai.keyFrames.count() * (1 + 3 + 4 + 3) * sizeof(float);
extraData.resize(sz);
@@ -2091,7 +2101,7 @@ void GltfExporter::exportAnimations(QJsonObject &obj,
float *p = base;
QJsonObject animations;
- foreach (const Importer::AnimationInfo &ai, m_importer->animations()) {
+ for (const Importer::AnimationInfo &ai : animationInfos) {
QJsonObject animation;
animation["name"] = ai.name;
animation["count"] = ai.keyFrames.count();
@@ -2157,7 +2167,7 @@ void GltfExporter::exportAnimations(QJsonObject &obj,
acc.componentType = GLT_FLOAT;
acc.type = QStringLiteral("SCALAR");
acc.offset = uint((p - base) * sizeof(float));
- foreach (const Importer::KeyFrame &kf, ai.keyFrames)
+ for (const Importer::KeyFrame &kf : ai.keyFrames)
*p++ = kf.t;
parameters["TIME"] = acc.name;
accList << acc;
@@ -2168,7 +2178,7 @@ void GltfExporter::exportAnimations(QJsonObject &obj,
acc.type = QStringLiteral("VEC3");
acc.offset = uint((p - base) * sizeof(float));
QVector<float> lastV;
- foreach (const Importer::KeyFrame &kf, ai.keyFrames) {
+ for (const Importer::KeyFrame &kf : ai.keyFrames) {
const QVector<float> *v = kf.transValid ? &kf.trans : &lastV;
*p++ = v->at(0);
*p++ = v->at(1);
@@ -2185,7 +2195,7 @@ void GltfExporter::exportAnimations(QJsonObject &obj,
acc.type = QStringLiteral("VEC4");
acc.offset = uint((p - base) * sizeof(float));
QVector<float> lastV;
- foreach (const Importer::KeyFrame &kf, ai.keyFrames) {
+ for (const Importer::KeyFrame &kf : ai.keyFrames) {
const QVector<float> *v = kf.rotValid ? &kf.rot : &lastV;
*p++ = v->at(1); // x
*p++ = v->at(2); // y
@@ -2203,7 +2213,7 @@ void GltfExporter::exportAnimations(QJsonObject &obj,
acc.type = QStringLiteral("VEC3");
acc.offset = uint((p - base) * sizeof(float));
QVector<float> lastV;
- foreach (const Importer::KeyFrame &kf, ai.keyFrames) {
+ for (const Importer::KeyFrame &kf : ai.keyFrames) {
const QVector<float> *v = kf.scaleValid ? &kf.scale : &lastV;
*p++ = v->at(0);
*p++ = v->at(1);
@@ -2302,7 +2312,7 @@ void GltfExporter::save(const QString &inputFilename)
m_obj["buffers"] = buffers;
QJsonObject bufferViews;
- foreach (const Importer::MeshInfo::BufferView &bv, bvList) {
+ for (const Importer::MeshInfo::BufferView &bv : qAsConst(bvList)) {
QJsonObject bufferView;
bufferView["buffer"] = bufList[bv.bufIndex].name;
bufferView["byteLength"] = int(bv.length);
@@ -2314,7 +2324,7 @@ void GltfExporter::save(const QString &inputFilename)
m_obj["bufferViews"] = bufferViews;
QJsonObject accessors;
- foreach (const Importer::MeshInfo::Accessor &acc, accList) {
+ for (const Importer::MeshInfo::Accessor &acc : qAsConst(accList)) {
QJsonObject accessor;
accessor["bufferView"] = acc.bufferView;
accessor["byteOffset"] = int(acc.offset);
@@ -2332,14 +2342,14 @@ void GltfExporter::save(const QString &inputFilename)
QJsonObject meshes;
for (uint i = 0; i < m_importer->meshCount(); ++i) {
- Importer::MeshInfo meshInfo = m_importer->meshInfo(i);
+ const Importer::MeshInfo meshInfo = m_importer->meshInfo(i);
QJsonObject mesh;
mesh["name"] = meshInfo.originalName;
QJsonArray prims;
QJsonObject prim;
prim["mode"] = 4; // triangles
QJsonObject attrs;
- foreach (const Importer::MeshInfo::Accessor &acc, meshInfo.accessors) {
+ for (const Importer::MeshInfo::Accessor &acc : meshInfo.accessors) {
if (acc.usage != QStringLiteral("INDEX"))
attrs[acc.usage] = acc.name;
else
@@ -2354,7 +2364,8 @@ void GltfExporter::save(const QString &inputFilename)
m_obj["meshes"] = meshes;
QJsonObject cameras;
- foreach (const Importer::CameraInfo &camInfo, m_importer->cameraInfo()) {
+ const auto cameraInfos = m_importer->cameraInfo();
+ for (const Importer::CameraInfo &camInfo : cameraInfos) {
QJsonObject camera;
QJsonObject persp;
persp["aspect_ratio"] = camInfo.aspectRatio;
@@ -2369,7 +2380,7 @@ void GltfExporter::save(const QString &inputFilename)
QJsonArray sceneNodes;
QJsonObject nodes;
- foreach (const Importer::Node *n, m_importer->rootNode()->children) {
+ for (const Importer::Node *n : qAsConst(m_importer->rootNode()->children)) {
if (nodeIsUseful(n))
sceneNodes << exportNode(n, nodes);
}
@@ -2459,7 +2470,7 @@ void GltfExporter::save(const QString &inputFilename)
QByteArray pre = "<RCC><qresource prefix=\"/models\">\n";
QByteArray post = "</qresource></RCC>\n";
f.write(pre);
- foreach (const QString &file,m_files) {
+ for (const QString &file : qAsConst(m_files)) {
QString line = QString(QStringLiteral(" <file>%1</file>\n")).arg(file);
f.write(line.toUtf8());
}
@@ -2539,12 +2550,13 @@ int main(int argc, char **argv)
QDir().mkpath(opts.outDir);
}
- if (cmdLine.positionalArguments().isEmpty())
+ const auto fileNames = cmdLine.positionalArguments();
+ if (fileNames.isEmpty())
cmdLine.showHelp();
AssimpImporter importer;
GltfExporter exporter(&importer);
- foreach (const QString &fn, cmdLine.positionalArguments()) {
+ for (const QString &fn : fileNames) {
if (!importer.load(fn)) {
qWarning() << "Failed to import" << fn;
continue;
diff --git a/tools/qgltf/qgltf.pro b/tools/qgltf/qgltf.pro
index a61607204..a19f2e91c 100644
--- a/tools/qgltf/qgltf.pro
+++ b/tools/qgltf/qgltf.pro
@@ -1,6 +1,9 @@
option(host_build)
!cross_compile:load(qt_build_paths)
+# Qt3D is free of Q_FOREACH - make sure it stays that way:
+DEFINES *= QT_NO_FOREACH
+
SOURCES = qgltf.cpp
include(../../src/3rdparty/assimp/assimp_dependency.pri)