25 mCurrentVertex(nullptr),
27 mVertexBuffer(nullptr),
28 mRenderTarget(nullptr),
29 mNeedCompression(false),
38 mVertexBuffer =
nullptr;
43 if (mTexture ==
nullptr)
46 mRenderTarget = _target;
48 mCurrentUpdate = _update;
50 if (mOutOfDate || _update)
54 if (buffer !=
nullptr)
56 for (VectorDrawItem::iterator iter = mDrawItems.begin(); iter != mDrawItems.end(); ++iter)
59 mCurrentVertex = buffer;
62 (*iter).first->doRender();
66 buffer += mLastVertexCount;
67 mCountVertex += mLastVertexCount;
77 if (0 != mCountVertex)
79#if MYGUI_DEBUG_MODE == 1
83 MYGUI_EXCEPT(
"texture pointer is not valid, texture name '" << mTextureName <<
"'");
90 for (VectorDrawItem::iterator iter = mDrawItems.begin(); iter != mDrawItems.end(); ++iter)
91 (*iter).first->doManualRender(mVertexBuffer, mTexture, mCountVertex);
95 _target->
doRender(mVertexBuffer, mTexture, mCountVertex);
102 for (VectorDrawItem::iterator iter = mDrawItems.begin(); iter != mDrawItems.end(); ++iter)
104 if ((*iter).first == _item)
106 mNeedVertexCount -= (*iter).second;
107 mDrawItems.erase(iter);
113 if (mDrawItems.empty())
116 mNeedCompression =
true;
129#if MYGUI_DEBUG_MODE == 1
130 for (VectorDrawItem::iterator iter = mDrawItems.begin(); iter != mDrawItems.end(); ++iter)
137 mNeedVertexCount += _count;
145 for (VectorDrawItem::iterator iter = mDrawItems.begin(); iter != mDrawItems.end(); ++iter)
147 if ((*iter).first == _item)
150 if ((*iter).second < _count)
152 mNeedVertexCount -= (*iter).second;
153 mNeedVertexCount += _count;
154 (*iter).second = _count;
167 if (mTexture == _value)
175#if MYGUI_DEBUG_MODE == 1
176 mTextureName = mTexture ==
nullptr ?
"" : mTexture->
getName();
187 mNeedCompression = _compression;
192 return mNeedCompression;
197 mManualRender = _value;
202 return mManualRender;
217 return mNeedVertexCount;
227 return mCurrentUpdate;
232 return mCurrentVertex;
237 mLastVertexCount = _count;
242 return mRenderTarget;
#define MYGUI_ASSERT(exp, dest)
#define MYGUI_DEBUG_ASSERT(exp, dest)
#define MYGUI_EXCEPT(dest)
virtual void doRender(IVertexBuffer *_buffer, ITexture *_texture, size_t _count)=0
virtual const std::string & getName() const =0
virtual void setVertexCount(size_t _value)=0
virtual size_t getVertexCount() const =0
virtual Vertex * lock()=0
void addDrawItem(ISubWidget *_item, size_t _count)
bool getCurrentUpdate() const
void setManualRender(bool _value)
void setTexture(ITexture *_value)
IRenderTarget * getRenderTarget()
void renderToTarget(IRenderTarget *_target, bool _update)
bool getManualRender() const
size_t getVertexCount() const
bool getNeedCompression() const
void setNeedCompression(bool _compression)
void reallockDrawItem(ISubWidget *_item, size_t _count)
size_t getNeedVertexCount() const
void removeDrawItem(ISubWidget *_item)
Vertex * getCurrentVertexBuffer() const
ITexture * getTexture() const
void setLastVertexCount(size_t _count)
virtual void destroyVertexBuffer(IVertexBuffer *_buffer)=0
static RenderManager & getInstance()
virtual IVertexBuffer * createVertexBuffer()=0
std::pair< ISubWidget *, size_t > DrawItemInfo