Detailed Description
The QGLRenderState class encapsulates the states of a rendering pass.
The QGLRenderState class works with the QGLRenderOrder class to optimize the rendering order of scene nodes.
In general instances of this class are managed by the render sequencer and it should not be necessary to explicitly create or manipulate them.
A QGLRenderState instance encapsulates rendering properties for a given path through the rendering process. The state includes properties such as effects, and materials; which may either be directly set on a scene node, or inherited from its parents.
QGLRenderState may be subclassed in advanced applications to provide a different inheritance pattern for rendering properties - reimplement the updateFrom() function to do this. The default implementation simply sets an effect on the state if the argument node has an effect (found by calling the QGLSceneNode::hasEffect() function), and sets a material on the state if the node has a non-null material; otherwise the existing state is left as it is.
The render sequencer will ensure that the relevant render state is set onto the painter at the beginning of the pass which renders all nodes with that state.
Member Function Documentation
QGLRenderState::QGLRenderState()
Creates a new QGLRenderState empty of any values.
QGLRenderState::QGLRenderState(const QGLRenderState & other)
Creates a new QGLRenderState as a copy of other
QGLRenderState::~QGLRenderState() [virtual]
Destroys this QGLRenderState recovering and resources.
QGLMaterial * QGLRenderState::backMaterial() const
Returns the back material stored on this QGLRenderState, or null if no back material has been set. The default value is null.
bool QGLRenderState::hasEffect() const
Returns true is there is a valid effect on this QGLRenderState. The default value is false.
uint QGLRenderState::hash() const
Returns a hash value representing this state.
bool QGLRenderState::isValid() const
Returns true if this is a valid representation of a render state, that is if it has ever been updated from a node; and false otherwise.
QGLMaterial * QGLRenderState::material() const
Returns the material stored on this QGLRenderState, or null if no material has been set. The default value is null.
const QGLSceneNode * QGLRenderState::node() const
Returns the node used to populate this QGLRenderState.
QGL::StandardEffect QGLRenderState::standardEffect() const
Returns the standard effect stored on this QGLRenderState. The default value is QGL::FlatColor. To determine if an effect has been specifically set call hasEffect().
void QGLRenderState::updateFrom(const QGLSceneNode * node) [virtual]
Sets the values of this QGLRenderState from the node, where the node has a value. For example if the node has an effect but no material, then this state will have its effect changed to that of the node, but this state's material will be unchanged.
QGLAbstractEffect * QGLRenderState::userEffect() const
Returns the user effect stored on this QGLRenderState, or null if no user effect has been set. The default value is null.
QGLRenderState & QGLRenderState::operator=(const QGLRenderState & rhs)
Assigns this QGLRenderState to be a copy of rhs.
bool QGLRenderState::operator==(const QGLRenderState & rhs) const
Returns true if this state is equal to rhs, that is if each of the materials, effects and values are equal to those of rhs.