summaryrefslogtreecommitdiffstats
path: root/src/render/geometry/qbuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/geometry/qbuffer.cpp')
-rw-r--r--src/render/geometry/qbuffer.cpp40
1 files changed, 34 insertions, 6 deletions
diff --git a/src/render/geometry/qbuffer.cpp b/src/render/geometry/qbuffer.cpp
index 0d3be8fdd..b978e0e0b 100644
--- a/src/render/geometry/qbuffer.cpp
+++ b/src/render/geometry/qbuffer.cpp
@@ -42,6 +42,7 @@
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DCore/qpropertyupdatedchange.h>
+
QT_BEGIN_NAMESPACE
using namespace Qt3DCore;
@@ -50,8 +51,10 @@ namespace Qt3DRender {
QBufferPrivate::QBufferPrivate()
: QNodePrivate()
+ , m_type(QBuffer::VertexBuffer)
, m_usage(QBuffer::StaticDraw)
, m_syncData(false)
+ , m_access(QBuffer::Write)
{
}
@@ -189,7 +192,8 @@ QBufferPrivate::QBufferPrivate()
/*!
\fn Qt3DRender::QBufferDataGenerator::operator ==(const QBufferDataGenerator &other) const
- Should be reimplemented to return true when two generators are identical,
+ Should be reimplemented to return true when two generators (the one you are
+ comparing against and the \a other generator) are identical,
false otherwise.
\note The renderer uses this comparison to decide whether data for a buffer
@@ -270,11 +274,19 @@ QBuffer::~QBuffer()
*/
void QBuffer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
- QPropertyUpdatedChangePtr e = qSharedPointerCast<QPropertyUpdatedChange>(change);
- if (e->type() == PropertyUpdated && e->propertyName() == QByteArrayLiteral("data")) {
- const bool blocked = blockNotifications(true);
- setData(e->value().toByteArray());
- blockNotifications(blocked);
+ if (change->type() == PropertyUpdated) {
+ QPropertyUpdatedChangePtr e = qSharedPointerCast<QPropertyUpdatedChange>(change);
+ const QByteArray propertyName = e->propertyName();
+ if (propertyName == QByteArrayLiteral("data")) {
+ const bool blocked = blockNotifications(true);
+ setData(e->value().toByteArray());
+ blockNotifications(blocked);
+ } else if (propertyName == QByteArrayLiteral("downloadedData")) {
+ const bool blocked = blockNotifications(true);
+ setData(e->value().toByteArray());
+ blockNotifications(blocked);
+ Q_EMIT dataAvailable();
+ }
}
}
@@ -400,12 +412,27 @@ void QBuffer::setSyncData(bool syncData)
}
}
+void QBuffer::setAccessType(QBuffer::AccessType access)
+{
+ Q_D(QBuffer);
+ if (d->m_access != access) {
+ d->m_access = access;
+ Q_EMIT accessTypeChanged(access);
+ }
+}
+
bool QBuffer::isSyncData() const
{
Q_D(const QBuffer);
return d->m_syncData;
}
+QBuffer::AccessType QBuffer::accessType() const
+{
+ Q_D(const QBuffer);
+ return d->m_access;
+}
+
void QBuffer::setType(QBuffer::BufferType type)
{
Q_D(QBuffer);
@@ -425,6 +452,7 @@ Qt3DCore::QNodeCreatedChangeBasePtr QBuffer::createNodeCreationChange() const
data.usage = d->m_usage;
data.functor = d->m_functor;
data.syncData = d->m_syncData;
+ data.access = d->m_access;
return creationChange;
}