MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / doRender

Method doRender

Source/Basic/Director.cpp:328–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328void Director::doRender() {
329 if (_paused || _stoped) return;
330
331 /* push default view projection */
332 const auto& defaultViewProj = getCurrentViewProjection();
333
334 /* push default view projection */
335 pushViewProjection(defaultViewProj, [&]() {
336 /* do render */
337 if (SharedView.isPostProcessNeeded()) {
338 /* initialize RT */
339 if (_root) {
340 auto grabber = _root->grab(1, 1);
341 grabber->setBlendFunc({BlendFunc::One, BlendFunc::Zero});
342 grabber->setEffect(SharedView.getPostEffect());
343 grabber->setCamera(getCurrentCamera());
344 grabber->setClearColor(_clearColor);
345 Size viewSize = SharedView.getSize();
346 float w = viewSize.width / 2.0f;
347 float h = viewSize.height / 2.0f;
348 grabber->setPos(0, 0, {-w, h});
349 grabber->setPos(1, 0, {w, h});
350 grabber->setPos(0, 1, {-w, -h});
351 grabber->setPos(1, 1, {w, -h});
352 }
353
354 /* render RT, post node and ui node */
355 SharedView.pushBack("Main"_slice, [&]() {
356 bgfx::ViewId viewId = SharedView.getId();
357 /* RT */
358 if (_root) {
359 bgfx::setViewClear(viewId, BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL);
360 Size viewSize = SharedView.getSize();
361 Matrix ortho;
362 bx::mtxOrtho(ortho.m,
363 0, viewSize.width, 0, viewSize.height,
364 -1000.0f, 1000.0f, 0,
365 bgfx::getCaps()->homogeneousDepth);
366 pushViewProjection(ortho, [&]() {
367 bgfx::setViewTransform(viewId, nullptr, getViewProjection().m);
368 _root->visit();
369 SharedRendererManager.flush();
370 });
371 } else {
372 bgfx::setViewClear(viewId,
373 BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL,
374 _clearColor.toRGBA());
375 }
376 /* post node */
377 if (_postNode) {
378 bgfx::setViewTransform(viewId, nullptr, getViewProjection().m);
379 _postNode->visit();
380 SharedRendererManager.flush();
381 }
382 /* ui 3D node */
383 if (_ui3D) {
384 pushViewProjection(_ui3DCamera->getView(), [&]() {
385 bgfx::setViewTransform(viewId, nullptr, getViewProjection().m);

Callers 1

mainLogicMethod · 0.80

Calls 15

setViewClearFunction · 0.85
mtxOrthoFunction · 0.85
getCapsFunction · 0.85
setViewTransformFunction · 0.85
nvgSetViewIdFunction · 0.85
nvgEndFrameFunction · 0.85
setViewOrderFunction · 0.85
isPostProcessNeededMethod · 0.80
getPostEffectMethod · 0.80
toRGBAMethod · 0.80
getOrdersMethod · 0.80
getIdMethod · 0.65

Tested by

no test coverage detected