summaryrefslogtreecommitdiffstats
path: root/src/render/materialsystem/shaderdata.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2016-09-05 09:03:05 +0200
committerPaul Lemire <paul.lemire@kdab.com>2016-09-07 14:18:10 +0000
commit73a386d4f62dcf83576d8f3e8b7ee7bb688b661d (patch)
tree1ac5c145c591eb3146f35a2c35238862eddc99b9 /src/render/materialsystem/shaderdata.cpp
parentc8531f512eda3074aa66d8a5c7f9525b3be7f75d (diff)
ShaderData: add getter to retrieve transform type of properties
Replaces isPropertyToBeTransformed by propertyTransformType which returns the TransformType (NoTransform) if the property isn't transformed. Change-Id: Ib7d91bdcfe18409e6ad6d6f5bc119c46dd7fb143 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/materialsystem/shaderdata.cpp')
-rw-r--r--src/render/materialsystem/shaderdata.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp
index d6873e7dc..e7c8a1c37 100644
--- a/src/render/materialsystem/shaderdata.cpp
+++ b/src/render/materialsystem/shaderdata.cpp
@@ -171,21 +171,6 @@ void ShaderData::cleanup(NodeManagers *managers)
m_updatedShaderData.clear();
}
-/*!
- \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.
- */
-
-bool ShaderData::isPropertyToBeTransformed(const QString &name) const
-{
- return m_transformedProperties.contains(name);
-}
-
QVariant ShaderData::getTransformedProperty(const QString &name, const QMatrix4x4 &viewMatrix)
{
// Note protecting m_worldMatrix at this point as we assume all world updates
@@ -200,6 +185,8 @@ QVariant ShaderData::getTransformedProperty(const QString &name, const QMatrix4x
return QVariant::fromValue(m_worldMatrix * m_originalProperties.value(it.key()).value<QVector3D>());
case ModelToWorldDirection:
return QVariant::fromValue((m_worldMatrix * QVector4D(m_originalProperties.value(it.key()).value<QVector3D>(), 0.0f)).toVector3D());
+ case NoTransform:
+ break;
}
}
return QVariant();
@@ -224,6 +211,21 @@ void ShaderData::markDirty()
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.
+ */
+
+ShaderData::TransformType ShaderData::propertyTransformType(const QString &name) const
+{
+ return m_transformedProperties.value(name, TransformType::NoTransform);
+}
+
void ShaderData::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
if (!m_propertyReader.isNull() && e->type() == PropertyUpdated) {