MyGUI  3.0.1
MyGUI_RenderItem.h
Go to the documentation of this file.
1 
7 /*
8  This file is part of MyGUI.
9 
10  MyGUI is free software: you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MyGUI is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #ifndef __MYGUI_RENDER_ITEM_H__
24 #define __MYGUI_RENDER_ITEM_H__
25 
26 #include "MyGUI_Prerequest.h"
27 #include "MyGUI_ISubWidget.h"
28 #include "MyGUI_IVertexBuffer.h"
29 #include "MyGUI_VertexData.h"
30 #include "MyGUI_IRenderTarget.h"
31 
32 namespace MyGUI
33 {
34 
35  typedef std::pair<ISubWidget*, size_t> DrawItemInfo;
36  typedef std::vector<DrawItemInfo> VectorDrawItem;
37 
39  {
40  public:
41  RenderItem();
42  virtual ~RenderItem();
43 
44  void renderToTarget(IRenderTarget* _target, bool _update);
45 
46  void setTexture(ITexture* _value);
47  ITexture* getTexture();
48 
49  void addDrawItem(ISubWidget* _item, size_t _count);
50  void removeDrawItem(ISubWidget* _item);
51  void reallockDrawItem(ISubWidget* _item, size_t _count);
52 
53  void outOfDate() { mOutDate = true; }
54 
55  size_t getNeedVertexCount() const { return mNeedVertexCount; }
56  size_t getVertexCount() const { return mCountVertex; }
57 
58  bool getCurrentUpdate() const { return mCurrentUpdate; }
59  Vertex* getCurrentVertextBuffer() const { return mCurrentVertext; }
60 
61  void setLastVertexCount(size_t _count) { mLastVertextCount = _count; }
62 
63  IRenderTarget* getRenderTarget() { return mRenderTarget; }
64 
65  bool getCompression();
66 
67  private:
68 #if MYGUI_DEBUG_MODE == 1
69  std::string mTextureName;
70 #endif
71 
72  ITexture* mTexture;
73 
74  size_t mNeedVertexCount;
75 
76  bool mOutDate;
77  VectorDrawItem mDrawItems;
78 
79  // колличество отрендренных реально вершин
80  size_t mCountVertex;
81 
82  bool mCurrentUpdate;
83  Vertex* mCurrentVertext;
84  size_t mLastVertextCount;
85 
86  IVertexBuffer* mVertexBuffer;
87  IRenderTarget* mRenderTarget;
88 
89  bool mCompression;
90  };
91 
92 } // namespace MyGUI
93 
94 #endif // __MYGUI_RENDER_ITEM_H__