aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi/qsgmaterial.cpp
diff options
context:
space:
mode:
authorGlenn Watson <glenn.watson@nokia.com>2012-02-08 09:36:18 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-08 14:37:04 +0100
commit5ba11cb77c9c30b0691cf5c15d132db9891b8773 (patch)
tree411b35faf4f2e9893e6a01a20025bea6100e9ac0 /src/quick/scenegraph/coreapi/qsgmaterial.cpp
parent8799d4f5501656dbf42f645a354c1f372b1139dc (diff)
Provide determinant accessor in render state structure.
This allows custom renderers to set the determinant to a value different than the actual model view transform matrix. This is useful when parts of the scene node transformation are done on the CPU rather than in the vertex shader. Change-Id: Icf26a5922b0933275a61af4656cf842bf61e70d5 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgmaterial.cpp')
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
index 3c7a401314..308a1fa572 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp
@@ -334,7 +334,15 @@ float QSGMaterialShader::RenderState::opacity() const
return static_cast<const QSGRenderer *>(m_data)->currentOpacity();
}
+/*!
+ Returns the modelview determinant to be used for rendering
+ */
+float QSGMaterialShader::RenderState::determinant() const
+{
+ Q_ASSERT(m_data);
+ return static_cast<const QSGRenderer *>(m_data)->determinant();
+}
/*!
Returns the matrix combined of modelview matrix and project matrix.
@@ -350,6 +358,20 @@ QMatrix4x4 QSGMaterialShader::RenderState::combinedMatrix() const
/*!
Returns the model view matrix.
+
+ If the material has the RequiresFullMatrix flag
+ set, this is guaranteed to be the complete transform
+ matrix calculated from the scenegraph.
+
+ However, if this flag is not set, the renderer may
+ choose to alter this matrix. For example, it may
+ pre-transform vertices on the CPU and set this matrix
+ to identity.
+
+ In a situation such as the above, it is still possible
+ to retrieve the actual matrix determinant by setting
+ the RequiresDeterminant flag in the material and
+ calling the determinant() accessor.
*/
QMatrix4x4 QSGMaterialShader::RenderState::modelViewMatrix() const