| 39 | } |
| 40 | |
| 41 | void RTTLayerNode::renderToTarget(IRenderTarget* _target, bool _update) |
| 42 | { |
| 43 | unsigned long time = mTimer.getMilliseconds(); |
| 44 | mTimer.reset(); |
| 45 | |
| 46 | float frameTime = (float)((double)(time) / (double)1000); |
| 47 | // скорее всего рендер таргет пересоздается, |
| 48 | // необходимо пересчитать смещение рендер таргета |
| 49 | if (_update) |
| 50 | { |
| 51 | mOutOfDateRtt = true; |
| 52 | mCurrentCoord.clear(); |
| 53 | } |
| 54 | |
| 55 | if (mMajorUpdate) |
| 56 | { |
| 57 | _update = true; |
| 58 | mMajorUpdate = false; |
| 59 | } |
| 60 | |
| 61 | if (!mChacheUsing) |
| 62 | { |
| 63 | LayerNode::renderToTarget(_target, _update); |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | RenderManager& render = RenderManager::getInstance(); |
| 68 | if (mVertexBuffer == nullptr) |
| 69 | { |
| 70 | mVertexBuffer = render.createVertexBuffer(); |
| 71 | mVertexBuffer->setVertexCount(VertexQuad::VertexCount); |
| 72 | mData.resize(1); |
| 73 | |
| 74 | _update = true; |
| 75 | mOutOfDateRtt = true; |
| 76 | } |
| 77 | |
| 78 | if (mOutOfDateRtt && !mLayerItems.empty()) |
| 79 | { |
| 80 | const IntCoord& coord = mLayerItems.front()->getLayerItemCoord(); |
| 81 | if (coord != mCurrentCoord) |
| 82 | { |
| 83 | mCurrentCoord = coord; |
| 84 | checkTexture(); |
| 85 | _update = true; |
| 86 | if (mTexture != nullptr) |
| 87 | { |
| 88 | MyGUI::IRenderTarget* target = mTexture->getRenderTarget(); |
| 89 | if (target != nullptr) |
| 90 | { |
| 91 | // смещение рендер таргета |
| 92 | target->getInfo().setOffset(mCurrentCoord.left, mCurrentCoord.top); |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | if (mTexture == nullptr) |
nothing calls this directly
no test coverage detected