MCPcopy Create free account
hub / github.com/MyGUI/mygui / renderToTarget

Method renderToTarget

MyGUIEngine/src/MyGUI_RenderItem.cpp:29–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27 }
28
29 void RenderItem::renderToTarget(IRenderTarget* _target, bool _update)
30 {
31 if (mTexture == nullptr)
32 return;
33
34 mRenderTarget = _target;
35
36 mCurrentUpdate = _update;
37
38 if (mOutOfDate || _update)
39 {
40 mCountVertex = 0;
41 Vertex* buffer = mVertexBuffer->lock();
42 if (buffer != nullptr)
43 {
44 for (auto& item : mDrawItems)
45 {
46 mCurrentVertex = buffer;
47 mLastVertexCount = 0;
48
49 item.first->doRender();
50
51 MYGUI_DEBUG_ASSERT(mLastVertexCount <= item.second, "It is too much vertexes");
52 buffer += mLastVertexCount;
53 mCountVertex += mLastVertexCount;
54 }
55
56 mVertexBuffer->unlock();
57 }
58
59 mOutOfDate = false;
60 }
61
62 // хоть с 0 не выводиться батч, но все равно не будем дергать стейт и операцию
63 if (0 != mCountVertex)
64 {
65#if MYGUI_DEBUG_MODE == 1
66 if (!RenderManager::getInstance().checkTexture(mTexture))
67 {
68 auto textureName = mTexture->getName();
69 mTexture = nullptr;
70 MYGUI_EXCEPT("texture pointer is not valid, texture name '" << textureName << "'");
71 return;
72 }
73#endif
74 // непосредственный рендринг
75 if (mManualRender)
76 {
77 for (auto& item : mDrawItems)
78 item.first->doManualRender(mVertexBuffer, mTexture, mCountVertex);
79 }
80 else
81 {
82 _target->doRender(mVertexBuffer, mTexture, mCountVertex);
83 }
84 }
85 }
86

Callers

nothing calls this directly

Calls 5

doManualRenderMethod · 0.80
lockMethod · 0.45
doRenderMethod · 0.45
unlockMethod · 0.45
checkTextureMethod · 0.45

Tested by

no test coverage detected