Thursday, March 5, 2009

The flow of renderOneFrame()

Root::renderOneFrame() -> Root::_updateAllRenderTargets() -> RenderTarget::update() -> Viewport::update() -> Camera::_renderScene() -> SceneManager::_renderScene()

SceneManager::_renderScene()
   \ ->SceneManager::_findVisibleObjects()
   \ ->SceneManager::_renderVisibleObjects() -> SceneManager::_renderQueueGroupObjects() -> SceneManager::renderObjects() -> SceneMgrQueuedRenderableVisitor::visit() -> SceneManager::renderSingleObject()

SceneManager::_renderScene() is the real rendering function.
Most importantly it calls SceneManager::_findVisibleObjects(), which traversals the scene graph and adds visible object to the render queue.
Then, after setting up the render system (e.g. matrices, lighting, etc), real rendering is started by calling SceneManager::_renderVisibleObjects().

SceneManager::renderSingleObject() is the real function that render a object. It setup the render states of the object. (e.g matrices, materials, shaders, vertex/index buffers)

No comments: