RenderState Class

( QSGMaterialShader::RenderState )

The QSGMaterialShader::RenderState encapsulates the current rendering state during a call to QSGMaterialShader::updateState (). 更多...

头: #include <RenderState>
qmake: QT += quick

公共类型

enum DirtyState { DirtyMatrix, DirtyOpacity, DirtyCachedMaterialData, DirtyAll }
flags DirtyStates

公共函数

QMatrix4x4 combinedMatrix () const
QOpenGLContext * context () const
float determinant () const
float devicePixelRatio () const
QRect deviceRect () const
RenderState::DirtyStates dirtyStates () const
bool isCachedMaterialDataDirty () const
bool isMatrixDirty () const
bool isOpacityDirty () const
QMatrix4x4 modelViewMatrix () const
float opacity () const
QMatrix4x4 projectionMatrix () const
QRect viewportRect () const

详细描述

The QSGMaterialShader::RenderState encapsulates the current rendering state during a call to QSGMaterialShader::updateState ().

The render state contains a number of accessors that the shader needs to respect in order to conform to the current state of the scene graph.

The instance is only valid inside a call to QSGMaterialShader::updateState () and should not be used outisde this function.

成员类型文档编制

enum RenderState:: DirtyState
flags RenderState:: DirtyStates

常量 描述
QSGMaterialShader::RenderState::DirtyMatrix 0x0001 Used to indicate that the matrix has changed and must be updated.
QSGMaterialShader::RenderState::DirtyOpacity 0x0002 Used to indicate that the opacity has changed and must be updated.
QSGMaterialShader::RenderState::DirtyCachedMaterialData 0x0004 Used to indicate that the cached material data have changed and must be updated.
QSGMaterialShader::RenderState::DirtyAll 0xFFFF Used to indicate that everything needs to be updated.

The DirtyStates type is a typedef for QFlags <DirtyState>. It stores an OR combination of DirtyState values.

成员函数文档编制

QMatrix4x4 RenderState:: combinedMatrix () const

Returns the matrix combined of modelview matrix and project matrix.

QOpenGLContext *RenderState:: context () const

返回 QOpenGLContext that is being used for rendering

float RenderState:: determinant () const

Returns the modelview determinant to be used for rendering.

float RenderState:: devicePixelRatio () const

Returns the ratio between physical pixels and device-independent pixels to be used for rendering.

QRect RenderState:: deviceRect () const

Returns the device rect of the surface being rendered to

RenderState::DirtyStates RenderState:: dirtyStates () const

Returns which rendering states that have changed and needs to be updated for geometry rendered with this material to conform to the current rendering state.

bool RenderState:: isCachedMaterialDataDirty () const

返回 true dirtyStates () contains the dirty cached material state, otherwise returns false .

bool RenderState:: isMatrixDirty () const

返回 true dirtyStates () contain the dirty matrix state, otherwise returns false .

bool RenderState:: isOpacityDirty () const

返回 true dirtyStates () contains the dirty opacity state, otherwise returns false .

QMatrix4x4 RenderState:: modelViewMatrix () 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.

float RenderState:: opacity () const

Returns the accumulated opacity to be used for rendering.

QMatrix4x4 RenderState:: projectionMatrix () const

Returns the projection matrix.

QRect RenderState:: viewportRect () const

Returns the viewport rect of the surface being rendered to.