In detail this function:
- ensures the effect specified by effect() is current on the painter
- sets the nodes materials onto the painter, if valid materials are present
- moves the model-view to the x, y, z position
- applies any local transforms() that may be set for this node
- calls draw() for all the child nodes
- calls draw(start, count) on this nodes geometry object (if any)
- restores the geometry's original materials if they were changed
- restores the model-view matrix if any local transform was applied
The bit I don't quite understand is what the step in bold actually means. I know that the model matrix is unique to each model and translates vertices into world space, and that the view matrix represents the camera's position and orientation in world space, but "moving" the product of the two matrices to a point doesn't make any sense to me. I would have thought that "moving" the view matrix would amount to a translation of the camera, which would be wrong if the camera had been set up to render from its original point, and that "moving" the model matrix would amount to translating the object. Even the concept of "moving" a matrix I'm not entirely clear on.
For reference, the only section of code which I can see modifies the matrix is the following:
// Gets the resulting matrix from the node's position, local transform,
// and list of transforms.
QMatrix4x4 m = transform();
if (!m.isIdentity())
{
// Painter is the QGLPainter interface which renders with OpenGL.
painter->modelViewMatrix().push();
painter->modelViewMatrix() *= m;
...
}
Can anyone explain what this step actually does?Thanks.