Example #1
0
void PScene::render(PRenderState *renderState)
{
	// Update the world transform of each node in the scene.
	PNode::iterator ni(m_root);

	PNode *node = *ni;
	while (node != P_NULL)
	{
		// Update the transformation of each node.
		node->updateWorldTransform();
        // Update the bounding box in the world space.
        node->updateBBox();
		// Call customized update routing of each node.
		node->update();

		node = *(++ni);
	}

    // Do the rendering.
    m_renderer->render(renderState);

    // Apply the post processing effects to the scene.
    PList<PAbstractEffect *>::iterator it = m_effects.begin();
    PList<PAbstractEffect *>::iterator ie = m_effects.end();
    while (it != ie)
    {
        (*it)->render(renderState);
        ++it;
    }
}