diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2015-11-03 17:41:16 +0100 |
---|---|---|
committer | Andy Nichols <andy.nichols@theqtcompany.com> | 2015-11-16 09:17:17 +0000 |
commit | d7a466185516713bcb21beeb541f5ec701436b28 (patch) | |
tree | c362474d18945f6f97d9f88df676d184e0f6445f /src/render/geometry/qgeometry.cpp | |
parent | fd4feb449b5e97c32dc5d94ba2f96b8a5e9f4454 (diff) |
Add QBoundingVolumeSpecifier as a grouped property of QGeometry
Change-Id: Ica5d2a35e8e9113ed1c739d81cb1a86750365d24
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
Diffstat (limited to 'src/render/geometry/qgeometry.cpp')
-rw-r--r-- | src/render/geometry/qgeometry.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/render/geometry/qgeometry.cpp b/src/render/geometry/qgeometry.cpp index 64df80990..af76a6b5f 100644 --- a/src/render/geometry/qgeometry.cpp +++ b/src/render/geometry/qgeometry.cpp @@ -39,6 +39,7 @@ #include <private/qnode_p.h> #include <Qt3DCore/qabstractattribute.h> #include <Qt3DCore/qscenepropertychange.h> +#include <Qt3DRender/qboundingvolumespecifier.h> QT_BEGIN_NAMESPACE @@ -46,14 +47,33 @@ using namespace Qt3DCore; namespace Qt3DRender { +void QGeometryPrivate::_q_boundingVolumeSpecifierChanged() +{ + if (m_changeArbiter != Q_NULLPTR) { + QScenePropertyChangePtr change(new QScenePropertyChange(NodeUpdated, QSceneChange::Node, m_id)); + change->setPropertyName("boundingVolumeSpecifierPositionAttribute"); + Qt3DCore::QNodeId positionAttributeId; + if (m_boundingVolumeSpecifier.positionAttribute()) + positionAttributeId = m_boundingVolumeSpecifier.positionAttribute()->id(); + change->setValue(QVariant::fromValue(positionAttributeId)); + notifyObservers(change); + } +} + QGeometry::QGeometry(QNode *parent) : QNode(*new QGeometryPrivate(), parent) { + Q_D(QGeometry); + QObject::connect(&d->m_boundingVolumeSpecifier, SIGNAL(positionAttributeChanged()), + this, SLOT(_q_boundingVolumeSpecifierChanged())); } QGeometry::QGeometry(QGeometryPrivate &dd, QNode *parent) : QNode(dd, parent) { + Q_D(QGeometry); + QObject::connect(&d->m_boundingVolumeSpecifier, SIGNAL(positionAttributeChanged()), + this, SLOT(_q_boundingVolumeSpecifierChanged())); } QGeometry::~QGeometry() @@ -110,6 +130,12 @@ int QGeometry::verticesPerPatch() const return d->m_verticesPerPatch; } +QBoundingVolumeSpecifier *QGeometry::boundingVolumeSpecifier() +{ + Q_D(QGeometry); + return &d->m_boundingVolumeSpecifier; +} + QAttributeList QGeometry::attributes() const { Q_D(const QGeometry); @@ -123,8 +149,13 @@ void QGeometry::copy(const QNode *ref) d_func()->m_verticesPerPatch = geometry->d_func()->m_verticesPerPatch; Q_FOREACH (QAbstractAttribute *attribute, geometry->d_func()->m_attributes) d_func()->m_attributes.append(qobject_cast<QAbstractAttribute *>(QNode::clone(attribute))); + // Copy bounding volume specifier attribute + if (geometry->d_func()->m_boundingVolumeSpecifier.positionAttribute() != Q_NULLPTR) + d_func()->m_boundingVolumeSpecifier.setPositionAttribute(qobject_cast<QAbstractAttribute *>(QNode::clone(geometry->d_func()->m_boundingVolumeSpecifier.positionAttribute()))); } } // namespace Qt3DRender QT_END_NAMESPACE + +#include "moc_qgeometry.cpp" |