MCPcopy Create free account
hub / github.com/axmolengine/axmol / drawScene

Method drawScene

core/base/Director.cpp:276–363  ·  view source on GitHub ↗

Draw the Scene

Source from the content-addressed store, hash-verified

274
275// Draw the Scene
276void Director::drawScene()
277{
278 _renderer->beginFrame();
279
280 // calculate "global" dt
281 calculateDeltaTime();
282
283 if (_renderView)
284 {
285 _renderView->pollEvents();
286 }
287
288 // tick before glClear: issue #533
289 if (!_paused)
290 {
291 _eventDispatcher->dispatchEvent(_eventBeforeUpdate);
292 _scheduler->update(_deltaTime);
293 _eventDispatcher->dispatchEvent(_eventAfterUpdate);
294 }
295
296 _renderer->clear(ClearFlag::ALL, _clearColor, 1, 0, -10000.0);
297
298 _eventDispatcher->dispatchEvent(_eventBeforeDraw);
299
300 /* to avoid flickr, nextScene MUST be here: after tick and before draw.
301 * FIXME: Which bug is this one. It seems that it can't be reproduced with v0.9
302 */
303 if (_nextScene)
304 {
305 setNextScene();
306 }
307
308 pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
309
310 if (_runningScene)
311 {
312#if (defined(AX_ENABLE_PHYSICS) || defined(AX_ENABLE_3D_PHYSICS) || \
313 defined(AX_ENABLE_NAVMESH))
314 _runningScene->stepPhysicsAndNavigation(_deltaTime);
315#endif
316 // clear draw stats
317 _renderer->clearDrawStats();
318
319 // render the scene
320 if (_renderView)
321 _renderView->renderScene(_runningScene, _renderer);
322
323 _eventDispatcher->dispatchEvent(_eventAfterVisit);
324 }
325
326 // draw the notifications node
327 if (_notificationNode)
328 {
329 _notificationNode->visit(_renderer, Mat4::IDENTITY, 0);
330 }
331
332 updateFrameRate();
333

Callers

nothing calls this directly

Calls 11

renderSceneMethod · 0.80
beginFrameMethod · 0.45
pollEventsMethod · 0.45
dispatchEventMethod · 0.45
updateMethod · 0.45
clearMethod · 0.45
visitMethod · 0.45
renderMethod · 0.45
swapBuffersMethod · 0.45
endFrameMethod · 0.45

Tested by

no test coverage detected