m_current_model_view_matrix = *m_currentMatrix;
else
m_current_model_view_matrix.setToIdentity();
+ m_current_determinant = m_current_model_view_matrix.determinant();
updates |= QSGMaterialShader::RenderState::DirtyMatrix;
}
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.
/*!
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
QMatrix4x4 modelViewMatrix() const;
QRect viewportRect() const;
QRect deviceRect() const;
+ float determinant() const;
QOpenGLContext *context() const;
, m_clear_color(Qt::transparent)
, m_clear_mode(ClearColorBuffer | ClearDepthBuffer)
, m_current_opacity(1)
+ , m_current_determinant(1)
, m_context(context)
, m_root_node(0)
, m_node_updater(0)
QMatrix4x4 currentModelViewMatrix() const { return m_current_model_view_matrix; }
QMatrix4x4 currentCombinedMatrix() const { return m_current_projection_matrix * m_current_model_view_matrix; }
qreal currentOpacity() const { return m_current_opacity; }
+ qreal determinant() const { return m_current_determinant; }
void setProjectionMatrixToDeviceRect();
void setProjectionMatrixToRect(const QRectF &rect);
QMatrix4x4 m_current_projection_matrix;
QMatrix4x4 m_current_model_view_matrix;
qreal m_current_opacity;
+ qreal m_current_determinant;
QSGContext *m_context;
}
if (state.isMatrixDirty()) {
program()->setUniformValue(m_matrix_id, state.combinedMatrix());
- m_matrixScale = qSqrt(qAbs(state.modelViewMatrix().determinant()));
+ m_matrixScale = qSqrt(qAbs(state.determinant()));
updateRange = true;
}
if (updateRange) {