| 52 | } |
| 53 | |
| 54 | void VGNode::render(const std::function<void()>& func) { |
| 55 | AssertIf(_flags.isOn(Node::Cleanup), "can not operate on an invalid VGNode"); |
| 56 | VGTexture* texture = s_cast<VGTexture*>(_surface->getTexture()); |
| 57 | NVGLUframebuffer* framebuffer = texture->getFramebuffer(); |
| 58 | NVGcontext* context = texture->getContext(); |
| 59 | SharedView.pushFront("VGNode"_slice, [&]() { |
| 60 | bgfx::ViewId viewId = SharedView.getId(); |
| 61 | bgfx::setViewClear(viewId, |
| 62 | BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH | BGFX_CLEAR_STENCIL, |
| 63 | 0x0); |
| 64 | nvgluSetViewFramebuffer(viewId, framebuffer); |
| 65 | bgfx::setViewRect(viewId, 0, 0, texture->getWidth(), texture->getHeight()); |
| 66 | nvgluBindFramebuffer(framebuffer); |
| 67 | nvgBeginFrame(context, _frameWidth, _frameHeight, _frameScale); |
| 68 | nvg::BindContext(context); |
| 69 | switch (bgfx::getCaps()->rendererType) { |
| 70 | case bgfx::RendererType::OpenGL: |
| 71 | case bgfx::RendererType::OpenGLES: |
| 72 | nvgScale(context, 1.0f, -1.0f); |
| 73 | nvgTranslate(context, 0.0f, -_frameHeight); |
| 74 | break; |
| 75 | default: |
| 76 | break; |
| 77 | } |
| 78 | func(); |
| 79 | nvg::BindContext(nullptr); |
| 80 | nvgEndFrame(context); |
| 81 | nvgluBindFramebuffer(nullptr); |
| 82 | }); |
| 83 | } |
| 84 | |
| 85 | NS_DORA_END |
nothing calls this directly
no test coverage detected