summaryrefslogtreecommitdiffstats
path: root/src/render/materialsystem
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/materialsystem')
-rw-r--r--src/render/materialsystem/effect.cpp4
-rw-r--r--src/render/materialsystem/filterkey.cpp1
-rw-r--r--src/render/materialsystem/material.cpp4
-rw-r--r--src/render/materialsystem/parameter.cpp2
-rw-r--r--src/render/materialsystem/parameter_p.h1
-rw-r--r--src/render/materialsystem/qeffect.cpp8
-rw-r--r--src/render/materialsystem/qfilterkey.cpp1
-rw-r--r--src/render/materialsystem/qmaterial.cpp3
-rw-r--r--src/render/materialsystem/qparameter.cpp1
-rw-r--r--src/render/materialsystem/qrenderpass.cpp3
-rw-r--r--src/render/materialsystem/qtechnique.cpp4
-rw-r--r--src/render/materialsystem/qtechnique.h2
-rw-r--r--src/render/materialsystem/renderpass.cpp4
-rw-r--r--src/render/materialsystem/shaderbuilder.cpp2
-rw-r--r--src/render/materialsystem/shaderbuilder_p.h1
-rw-r--r--src/render/materialsystem/shaderdata.cpp241
-rw-r--r--src/render/materialsystem/shaderdata_p.h31
-rw-r--r--src/render/materialsystem/shaderimage.cpp1
-rw-r--r--src/render/materialsystem/technique.cpp3
19 files changed, 125 insertions, 192 deletions
diff --git a/src/render/materialsystem/effect.cpp b/src/render/materialsystem/effect.cpp
index 76036bd1f..035cf4746 100644
--- a/src/render/materialsystem/effect.cpp
+++ b/src/render/materialsystem/effect.cpp
@@ -43,10 +43,6 @@
#include <Qt3DRender/qparameter.h>
#include <Qt3DRender/private/qeffect_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
-#include <Qt3DCore/qpropertynodeaddedchange.h>
-#include <Qt3DCore/qpropertynoderemovedchange.h>
-
#include <QVariant>
#include <algorithm>
diff --git a/src/render/materialsystem/filterkey.cpp b/src/render/materialsystem/filterkey.cpp
index d51a06eec..e6c37b241 100644
--- a/src/render/materialsystem/filterkey.cpp
+++ b/src/render/materialsystem/filterkey.cpp
@@ -38,7 +38,6 @@
****************************************************************************/
#include "filterkey_p.h"
-#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/private/qfilterkey_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/render/materialsystem/material.cpp b/src/render/materialsystem/material.cpp
index 07764c207..6fda17ccd 100644
--- a/src/render/materialsystem/material.cpp
+++ b/src/render/materialsystem/material.cpp
@@ -46,10 +46,6 @@
#include "qeffect.h"
#include <Qt3DRender/private/qmaterial_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
-#include <Qt3DCore/qpropertynodeaddedchange.h>
-#include <Qt3DCore/qpropertynoderemovedchange.h>
-
using namespace Qt3DCore;
QT_BEGIN_NAMESPACE
diff --git a/src/render/materialsystem/parameter.cpp b/src/render/materialsystem/parameter.cpp
index d32e60a2d..3360aebef 100644
--- a/src/render/materialsystem/parameter.cpp
+++ b/src/render/materialsystem/parameter.cpp
@@ -38,7 +38,6 @@
****************************************************************************/
#include "parameter_p.h"
-#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/qparameter.h>
#include <Qt3DRender/private/qparameter_p.h>
#include <Qt3DRender/qtexture.h>
@@ -68,6 +67,7 @@ void Parameter::cleanup()
m_nameId = -1;
m_name.clear();
m_uniformValue = UniformValue();
+ m_backendValue = {};
}
void Parameter::syncFromFrontEnd(const QNode *frontEnd, bool firstTime)
diff --git a/src/render/materialsystem/parameter_p.h b/src/render/materialsystem/parameter_p.h
index 9deaa11f3..258834ff3 100644
--- a/src/render/materialsystem/parameter_p.h
+++ b/src/render/materialsystem/parameter_p.h
@@ -76,6 +76,7 @@ public:
QString name() const;
int nameId() const Q_DECL_NOTHROW { return m_nameId; }
const UniformValue &uniformValue() const { return m_uniformValue; }
+ QVariant backendValue() const { return m_backendValue; }
private:
QString m_name;
diff --git a/src/render/materialsystem/qeffect.cpp b/src/render/materialsystem/qeffect.cpp
index 35ac662fb..35f4d64a9 100644
--- a/src/render/materialsystem/qeffect.cpp
+++ b/src/render/materialsystem/qeffect.cpp
@@ -42,10 +42,6 @@
#include "qtechnique.h"
#include "qparameter.h"
-#include <Qt3DCore/qpropertyupdatedchange.h>
-#include <Qt3DCore/qpropertynodeaddedchange.h>
-#include <Qt3DCore/qpropertynoderemovedchange.h>
-
QT_BEGIN_NAMESPACE
using namespace Qt3DCore;
@@ -172,7 +168,7 @@ QEffect::QEffect(QEffectPrivate &dd, QNode *parent)
*/
/*!
- * Adds \a parameter to the effect. It sends a QPropertyNodeAddedChange to the backend.
+ * Adds \a parameter to the effect. It sends an update to the backend.
* The \a parameter will be used to set a corresponding uniform value in the shader used
* by this effect.
*/
@@ -219,7 +215,7 @@ QVector<QParameter *> QEffect::parameters() const
}
/*!
- * Adds a new technique \a t to the effect. It sends a QPropertyNodeAddedChange to the backend.
+ * Adds a new technique \a t to the effect. It sends an update to the backend.
*/
void QEffect::addTechnique(QTechnique *t)
{
diff --git a/src/render/materialsystem/qfilterkey.cpp b/src/render/materialsystem/qfilterkey.cpp
index 547c56d26..dc968400b 100644
--- a/src/render/materialsystem/qfilterkey.cpp
+++ b/src/render/materialsystem/qfilterkey.cpp
@@ -40,7 +40,6 @@
#include "qfilterkey.h"
#include "qfilterkey_p.h"
#include <private/qnode_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
diff --git a/src/render/materialsystem/qmaterial.cpp b/src/render/materialsystem/qmaterial.cpp
index db523a700..db286de6b 100644
--- a/src/render/materialsystem/qmaterial.cpp
+++ b/src/render/materialsystem/qmaterial.cpp
@@ -43,9 +43,6 @@
#include "qeffect.h"
#include <Qt3DRender/private/renderlogging_p.h>
#include "qparameter.h"
-#include <Qt3DCore/qpropertyupdatedchange.h>
-#include <Qt3DCore/qpropertynodeaddedchange.h>
-#include <Qt3DCore/qpropertynoderemovedchange.h>
/*!
\qmltype Material
diff --git a/src/render/materialsystem/qparameter.cpp b/src/render/materialsystem/qparameter.cpp
index afaf42158..77eda8c8e 100644
--- a/src/render/materialsystem/qparameter.cpp
+++ b/src/render/materialsystem/qparameter.cpp
@@ -40,7 +40,6 @@
#include "qparameter.h"
#include "qparameter_p.h"
#include <Qt3DRender/private/renderlogging_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/qtexture.h>
diff --git a/src/render/materialsystem/qrenderpass.cpp b/src/render/materialsystem/qrenderpass.cpp
index d0821c49c..e9dd50325 100644
--- a/src/render/materialsystem/qrenderpass.cpp
+++ b/src/render/materialsystem/qrenderpass.cpp
@@ -43,9 +43,6 @@
#include "qparameter.h"
#include "qfilterkey.h"
#include "qrenderstate.h"
-#include <Qt3DCore/qpropertyupdatedchange.h>
-#include <Qt3DCore/qpropertynodeaddedchange.h>
-#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <Qt3DCore/private/qnode_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/render/materialsystem/qtechnique.cpp b/src/render/materialsystem/qtechnique.cpp
index dadeb98bd..2b96aa285 100644
--- a/src/render/materialsystem/qtechnique.cpp
+++ b/src/render/materialsystem/qtechnique.cpp
@@ -41,9 +41,6 @@
#include "qtechnique_p.h"
#include "qparameter.h"
#include "qgraphicsapifilter.h"
-#include <Qt3DCore/qpropertyupdatedchange.h>
-#include <Qt3DCore/qpropertynodeaddedchange.h>
-#include <Qt3DCore/qpropertynoderemovedchange.h>
QT_BEGIN_NAMESPACE
@@ -376,7 +373,6 @@ QVector<QParameter *> QTechnique::parameters() const
return d->m_parameters;
}
-// TODO Qt 6 -> Remove
QGraphicsApiFilter *QTechnique::graphicsApiFilter()
{
Q_D(QTechnique);
diff --git a/src/render/materialsystem/qtechnique.h b/src/render/materialsystem/qtechnique.h
index f0c857c2b..b9887b6a2 100644
--- a/src/render/materialsystem/qtechnique.h
+++ b/src/render/materialsystem/qtechnique.h
@@ -76,7 +76,7 @@ public:
void removeRenderPass(QRenderPass *pass);
QVector<QRenderPass *> renderPasses() const;
- Q_DECL_DEPRECATED QGraphicsApiFilter *graphicsApiFilter();
+ QGraphicsApiFilter *graphicsApiFilter();
const QGraphicsApiFilter *graphicsApiFilter() const;
protected:
diff --git a/src/render/materialsystem/renderpass.cpp b/src/render/materialsystem/renderpass.cpp
index aaeca3bb4..19e2a427e 100644
--- a/src/render/materialsystem/renderpass.cpp
+++ b/src/render/materialsystem/renderpass.cpp
@@ -48,10 +48,6 @@
#include <Qt3DRender/private/renderstates_p.h>
#include <Qt3DRender/private/renderstateset_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
-#include <Qt3DCore/qpropertynodeaddedchange.h>
-#include <Qt3DCore/qpropertynoderemovedchange.h>
-
#include <algorithm>
QT_BEGIN_NAMESPACE
diff --git a/src/render/materialsystem/shaderbuilder.cpp b/src/render/materialsystem/shaderbuilder.cpp
index b80a66a50..6116ca56b 100644
--- a/src/render/materialsystem/shaderbuilder.cpp
+++ b/src/render/materialsystem/shaderbuilder.cpp
@@ -39,6 +39,8 @@
#include "shaderbuilder_p.h"
+#include <Qt3DCore/qpropertyupdatedchange.h>
+
#include <Qt3DRender/private/qshaderprogrambuilder_p.h>
#include <Qt3DRender/qshaderprogram.h>
#include <Qt3DRender/private/qshaderprogram_p.h>
diff --git a/src/render/materialsystem/shaderbuilder_p.h b/src/render/materialsystem/shaderbuilder_p.h
index 12234bb6c..6b92d3114 100644
--- a/src/render/materialsystem/shaderbuilder_p.h
+++ b/src/render/materialsystem/shaderbuilder_p.h
@@ -53,7 +53,6 @@
#include <Qt3DRender/private/backendnode_p.h>
#include <Qt3DRender/private/qgraphicsapifilter_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
QT_BEGIN_NAMESPACE
diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp
index 130333898..34d4641e9 100644
--- a/src/render/materialsystem/shaderdata.cpp
+++ b/src/render/materialsystem/shaderdata.cpp
@@ -64,8 +64,6 @@ const int qNodeIdTypeId = qMetaTypeId<Qt3DCore::QNodeId>();
}
-QVector<Qt3DCore::QNodeId> ShaderData::m_updatedShaderData;
-
ShaderData::ShaderData()
: m_managers(nullptr)
{
@@ -80,51 +78,82 @@ void ShaderData::setManagers(NodeManagers *managers)
m_managers = managers;
}
-void ShaderData::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
+void ShaderData::syncFromFrontEnd(const QNode *frontEnd, bool firstTime)
{
- const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QShaderDataData>>(change);
- const QShaderDataData &data = typedChange->data;
-
- m_propertyReader = data.propertyReader;
-
- for (const QPair<QByteArray, QVariant> &entry : data.properties) {
- if (entry.first == QByteArrayLiteral("data") ||
- entry.first == QByteArrayLiteral("childNodes")) // We don't handle default Node properties
- continue;
- const QVariant &propertyValue = entry.second;
- const QString propertyName = QString::fromLatin1(entry.first);
-
- m_originalProperties.insert(propertyName, propertyValue);
-
- // We check if the property is a QNodeId or QVector<QNodeId> so that we can
- // check nested QShaderData for update
- if (propertyValue.userType() == qNodeIdTypeId) {
- m_nestedShaderDataProperties.insert(propertyName, propertyValue);
- } else if (propertyValue.userType() == QMetaType::QVariantList) {
- QVariantList list = propertyValue.value<QVariantList>();
- if (list.count() > 0 && list.at(0).userType() == qNodeIdTypeId)
- m_nestedShaderDataProperties.insert(propertyName, propertyValue);
- }
- }
+ const QShaderData *node = qobject_cast<const QShaderData *>(frontEnd);
+ if (!node)
+ return;
+ BackendNode::syncFromFrontEnd(frontEnd, firstTime);
+
+ if (firstTime) {
+ m_propertyReader = node->propertyReader();
+
+ const QMetaObject *metaObj = node->metaObject();
+ const int propertyOffset = QShaderData::staticMetaObject.propertyOffset();
+ const int propertyCount = metaObj->propertyCount();
+ // Dynamic properties names
+ const auto dynamicPropertyNames = node->dynamicPropertyNames();
- // We look for transformed properties once the complete hash of
- // originalProperties is available
- QHash<QString, QVariant>::iterator it = m_originalProperties.begin();
- const QHash<QString, QVariant>::iterator end = m_originalProperties.end();
-
- while (it != end) {
- 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
- if (value.isValid() && value.type() == QVariant::Int)
- m_transformedProperties.insert(it.key(), static_cast<TransformType>(value.toInt()));
+ QVector<QString> propertyNames;
+ propertyNames.reserve(propertyCount - propertyOffset + dynamicPropertyNames.size());
+
+ // Statiically defined properties
+ for (int i = propertyOffset; i < propertyCount; ++i) {
+ const QMetaProperty pro = metaObj->property(i);
+ if (pro.isWritable())
+ propertyNames.push_back(QString::fromLatin1(pro.name()));
+ }
+ // Dynamic properties
+ for (const QByteArray &propertyName : dynamicPropertyNames)
+ propertyNames.push_back(QString::fromLatin1(propertyName));
+
+ for (const QString &propertyName : propertyNames) {
+ if (propertyName == QStringLiteral("data") ||
+ propertyName == QStringLiteral("childNodes")) // We don't handle default Node properties
+ continue;
+
+ const QVariant &propertyValue = m_propertyReader->readProperty(node->property(propertyName.toLatin1()));
+ bool isNested = false;
+ bool isTransformed = false;
+
+ // We check if the property is a QNodeId
+ isNested = (propertyValue.userType() == qNodeIdTypeId);
+ // We check if QVector<QNodeId>
+ if (propertyValue.userType() == QMetaType::QVariantList) {
+ QVariantList list = propertyValue.value<QVariantList>();
+ if (list.count() > 0 && list.at(0).userType() == qNodeIdTypeId)
+ isNested = true;
+ }
+
+ // We check if property is a Transformed property
+ if (propertyValue.userType() == QVariant::Vector3D) {
+ // if there is a matching QShaderData::TransformType propertyTransformed
+ isTransformed = propertyNames.contains(propertyName + QLatin1String("Transformed"));
+ }
+ m_originalProperties.insert(propertyName, { propertyValue, isNested, isTransformed });
+ }
+ BackendNode::markDirty(AbstractRenderer::ParameterDirty);
+ } else {
+ // Updates
+ if (!m_propertyReader.isNull()) {
+ auto it = m_originalProperties.begin();
+ const auto end = m_originalProperties.end();
+
+ while (it != end) {
+ const QVariant newValue = m_propertyReader->readProperty(node->property(it.key().toLatin1()));
+ PropertyValue &propValue = it.value();
+ if (propValue.value != newValue) {
+ // Note we aren't notified about nested QShaderData in this call
+ // only scalar / vec properties
+ propValue.value = newValue;
+ BackendNode::markDirty(AbstractRenderer::ParameterDirty);
+ }
+ ++it;
+ }
}
- ++it;
}
}
-
ShaderData *ShaderData::lookupResource(NodeManagers *managers, QNodeId id)
{
return managers->shaderDataManager()->lookupResource(id);
@@ -135,120 +164,62 @@ ShaderData *ShaderData::lookupResource(QNodeId id)
return ShaderData::lookupResource(m_managers, id);
}
-// Call by cleanup job (single thread)
-void ShaderData::clearUpdatedProperties()
-{
- // DISABLED: Is only useful when building UBO from a ShaderData, which is disable since 5.7
- // const QHash<QString, QVariant>::const_iterator end = m_nestedShaderDataProperties.end();
- // QHash<QString, QVariant>::const_iterator it = m_nestedShaderDataProperties.begin();
-
- // while (it != end) {
- // if (it.value().userType() == QMetaType::QVariantList) {
- // const auto values = it.value().value<QVariantList>();
- // for (const QVariant &v : values) {
- // ShaderData *nested = lookupResource(v.value<QNodeId>());
- // if (nested != nullptr)
- // nested->clearUpdatedProperties();
- // }
- // } else {
- // ShaderData *nested = lookupResource(it.value().value<QNodeId>());
- // if (nested != nullptr)
- // nested->clearUpdatedProperties();
- // }
- // ++it;
- // }
-}
-
void ShaderData::cleanup(NodeManagers *managers)
{
Q_UNUSED(managers)
- // DISABLED: Is only useful when building UBO from a ShaderData, which is disable since 5.7
- // for (Qt3DCore::QNodeId id : qAsConst(m_updatedShaderData)) {
- // ShaderData *shaderData = ShaderData::lookupResource(managers, id);
- // if (shaderData)
- // shaderData->clearUpdatedProperties();
- // }
- m_updatedShaderData.clear();
}
+// RenderCommand updater jobs
QVariant ShaderData::getTransformedProperty(const QString &name, const Matrix4x4 &viewMatrix)
{
// Note protecting m_worldMatrix at this point as we assume all world updates
// have been performed when reaching this point
- auto it = m_transformedProperties.find(name);
- if (it != m_transformedProperties.end()) {
- const TransformType transformType = it.value();
- switch (transformType) {
- case ModelToEye:
- return QVariant::fromValue(viewMatrix * m_worldMatrix * Vector3D(m_originalProperties.value(name).value<QVector3D>()));
- case ModelToWorld:
- return QVariant::fromValue(m_worldMatrix * Vector3D(m_originalProperties.value(it.key()).value<QVector3D>()));
- case ModelToWorldDirection:
- return QVariant::fromValue(Vector3D(m_worldMatrix * Vector4D(m_originalProperties.value(it.key()).value<QVector3D>(), 0.0f)));
- case NoTransform:
- break;
+ const auto it = m_originalProperties.constFind(name);
+ if (it != m_originalProperties.constEnd()) {
+ const PropertyValue &propertyValue = it.value();
+ if (propertyValue.isTransformed) {
+ const auto transformedIt = m_originalProperties.constFind(name + QLatin1String("Transformed"));
+ if (transformedIt != m_originalProperties.constEnd()) {
+ const PropertyValue &transformedValue = transformedIt.value();
+ const TransformType transformType = static_cast<TransformType>(transformedValue.value.toInt());
+ switch (transformType) {
+ case ModelToEye:
+ return QVariant::fromValue(viewMatrix * m_worldMatrix * Vector3D(propertyValue.value.value<QVector3D>()));
+ case ModelToWorld:
+ return QVariant::fromValue(m_worldMatrix * Vector3D(propertyValue.value.value<QVector3D>()));
+ case ModelToWorldDirection:
+ return QVariant::fromValue(Vector3D(m_worldMatrix * Vector4D(propertyValue.value.value<QVector3D>(), 0.0f)));
+ case NoTransform:
+ break;
+ }
+ }
}
+ return propertyValue.value;
}
return QVariant();
}
-// Called by FramePreparationJob or by RenderView when dealing with lights
-void ShaderData::updateWorldTransform(const Matrix4x4 &worldMatrix)
-{
- QMutexLocker lock(&m_mutex);
- if (m_worldMatrix != worldMatrix) {
- m_worldMatrix = worldMatrix;
- }
-}
-
-// This will add the ShaderData to be cleared from updates at the end of the frame
-// by the cleanup job
-// Called by renderview jobs (several concurrent threads)
-void ShaderData::markDirty()
-{
- QMutexLocker lock(&m_mutex);
- if (!ShaderData::m_updatedShaderData.contains(peerId()))
- ShaderData::m_updatedShaderData.append(peerId());
-}
-
-/*!
- \internal
- Lookup if the current ShaderData or a nested ShaderData has updated properties.
- UpdateProperties contains either the value of the propertie of a QNodeId if it's another ShaderData.
- Transformed properties are updated for all of ShaderData that have ones at the point.
-
- \note This needs to be performed for every top level ShaderData every time it is used.
- As we don't know if the transformed properties use the same viewMatrix for all RenderViews.
- */
-
+// Unit tests only
ShaderData::TransformType ShaderData::propertyTransformType(const QString &name) const
{
- return m_transformedProperties.value(name, TransformType::NoTransform);
+ const auto it = m_originalProperties.constFind(name);
+ if (it != m_originalProperties.constEnd()) {
+ const PropertyValue &propertyValue = it.value();
+ if (propertyValue.isTransformed) {
+ auto transformedIt = m_originalProperties.constFind(name + QLatin1String("Transformed"));
+ if (transformedIt != m_originalProperties.end())
+ return static_cast<TransformType>(transformedIt.value().value.toInt());
+ }
+ }
+ return NoTransform;
}
-void ShaderData::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
+// Called by FramePreparationJob or by RenderView when dealing with lights
+void ShaderData::updateWorldTransform(const Matrix4x4 &worldMatrix)
{
- if (!m_propertyReader.isNull() && e->type() == PropertyUpdated) {
- QString propertyName;
- QVariant propertyValue;
-
- if (auto propertyChange = qSharedPointerDynamicCast<QPropertyUpdatedChange>(e)) {
- propertyName = QString::fromLatin1(propertyChange->propertyName());
- propertyValue = m_propertyReader->readProperty(propertyChange->value());
- } else if (auto propertyChange = qSharedPointerDynamicCast<QDynamicPropertyUpdatedChange>(e)) {
- propertyName = QString::fromLatin1(propertyChange->propertyName());
- propertyValue = m_propertyReader->readProperty(propertyChange->value());
- } else {
- Q_UNREACHABLE();
- }
-
- // Note we aren't notified about nested QShaderData in this call
- // only scalar / vec properties
- m_originalProperties.insert(propertyName, propertyValue);
- BackendNode::markDirty(AbstractRenderer::ParameterDirty);
+ if (m_worldMatrix != worldMatrix) {
+ m_worldMatrix = worldMatrix;
}
-
- BackendNode::sceneChangeEvent(e);
}
RenderShaderDataFunctor::RenderShaderDataFunctor(AbstractRenderer *renderer, NodeManagers *managers)
diff --git a/src/render/materialsystem/shaderdata_p.h b/src/render/materialsystem/shaderdata_p.h
index f9c3ecc79..c9cc22939 100644
--- a/src/render/materialsystem/shaderdata_p.h
+++ b/src/render/materialsystem/shaderdata_p.h
@@ -76,49 +76,42 @@ public:
ModelToWorld,
ModelToWorldDirection
};
+ struct PropertyValue {
+ QVariant value;
+ bool isNested;
+ bool isTransformed;
+ };
ShaderData();
~ShaderData();
- QHash<QString, QVariant> properties() const { return m_originalProperties; }
+ QHash<QString, PropertyValue> properties() const { return m_originalProperties; }
// Called by FramePreparationJob
void updateWorldTransform(const Matrix4x4 &worldMatrix);
- // Call by RenderViewJob
- void markDirty();
+ QVariant getTransformedProperty(const QString &name, const Matrix4x4 &viewMatrix);
+ // Unit tests purposes only
TransformType propertyTransformType(const QString &name) const;
- QVariant getTransformedProperty(const QString &name, const Matrix4x4 &viewMatrix);
// Called by FrameCleanupJob
static void cleanup(NodeManagers *managers);
void setManagers(NodeManagers *managers);
-protected:
- void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) override;
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) override;
+ void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override;
+protected:
PropertyReaderInterfacePtr m_propertyReader;
- // 1 to 1 match with frontend properties, modified only by sceneChangeEvent
- QHash<QString, QVariant> m_originalProperties;
-
- // Contains properties thar are of type ShaderData
- QHash<QString, QVariant> m_nestedShaderDataProperties;
-
- // Contains property that are defined like: postionTransformed: ModelToEye
- QHash<QString, TransformType> m_transformedProperties;
+ // 1 to 1 match with frontend properties
+ QHash<QString, PropertyValue> m_originalProperties;
- QMutex m_mutex;
- static QVector<Qt3DCore::QNodeId> m_updatedShaderData;
Matrix4x4 m_worldMatrix;
- Matrix4x4 m_viewMatrix;
NodeManagers *m_managers;
- void clearUpdatedProperties();
static ShaderData *lookupResource(NodeManagers *managers, Qt3DCore::QNodeId id);
ShaderData *lookupResource(Qt3DCore::QNodeId id);
diff --git a/src/render/materialsystem/shaderimage.cpp b/src/render/materialsystem/shaderimage.cpp
index c1fb72bfd..65a4cf761 100644
--- a/src/render/materialsystem/shaderimage.cpp
+++ b/src/render/materialsystem/shaderimage.cpp
@@ -39,7 +39,6 @@
#include "shaderimage_p.h"
#include <Qt3DRender/private/qshaderimage_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
#include <Qt3DRender/qabstracttexture.h>
diff --git a/src/render/materialsystem/technique.cpp b/src/render/materialsystem/technique.cpp
index d4199b7e3..10e9af990 100644
--- a/src/render/materialsystem/technique.cpp
+++ b/src/render/materialsystem/technique.cpp
@@ -48,9 +48,6 @@
#include <Qt3DRender/private/qtechnique_p.h>
#include <Qt3DRender/private/shader_p.h>
#include <Qt3DCore/private/qchangearbiter_p.h>
-#include <Qt3DCore/qpropertyupdatedchange.h>
-#include <Qt3DCore/qpropertynodeaddedchange.h>
-#include <Qt3DCore/qpropertynoderemovedchange.h>
#include <Qt3DRender/private/managers_p.h>
#include <Qt3DRender/private/techniquemanager_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>