Code: Select all
/*************************************************************************
Causes the Window object to render itself.
*************************************************************************/
void Window::render(void)
{
// don't do anything if window is not visible
if (!isVisible()) {
return;
}
// signal rendering started
WindowEventArgs args(this);
onRenderingStarted(args);
// perform drawing for 'this' Window
Renderer* renderer = System::getSingleton().getRenderer();
drawSelf(renderer->getCurrentZ());
///////////////////////////////////////////////////////////////////////////////////////////////////
renderer->advanceZValue();
///////////////////////////////////////////////////////////////////////////////////////////////////
// render any child windows
size_t child_count = getChildCount();
for (size_t i = 0; i < child_count; ++i)
{
d_drawList[i]->render();
}
// signal rendering ended
onRenderingEnded(args);
}
Rendering can be optimized if all child elements will have same z-value. So if window contains 10 children, all should have same z-value. If they overlap, order of rendering is not determine, but it is not big deal in such cases. I am not sure if it is possible to fix it with current z-value handling, because rendering is recursive and advancing z-value not (variable is not stored in stack). I will try to fix this issue somehow in CEGUI but I think it is good idea to fix this to improve rendering performance.