00001 00007 /* 00008 This file is part of MyGUI. 00009 00010 MyGUI is free software: you can redistribute it and/or modify 00011 it under the terms of the GNU Lesser General Public License as published by 00012 the Free Software Foundation, either version 3 of the License, or 00013 (at your option) any later version. 00014 00015 MyGUI is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public License 00021 along with MyGUI. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 #ifndef __MYGUI_RENDER_ITEM_H__ 00024 #define __MYGUI_RENDER_ITEM_H__ 00025 00026 #include "MyGUI_Prerequest.h" 00027 #include "MyGUI_Common.h" 00028 #include "MyGUI_IVertexBuffer.h" 00029 #include "MyGUI_VertexData.h" 00030 #include "MyGUI_IRenderTarget.h" 00031 00032 namespace MyGUI 00033 { 00034 00035 typedef std::pair<ISubWidget*, size_t> DrawItemInfo; 00036 typedef std::vector<DrawItemInfo> VectorDrawItem; 00037 00038 class MYGUI_EXPORT RenderItem 00039 { 00040 public: 00041 RenderItem(const std::string& _texture); 00042 virtual ~RenderItem(); 00043 00044 void renderToTarget(IRenderTarget* _target, bool _update); 00045 00046 void setTextureName(const std::string& _texture); 00047 const std::string& getTextureName() { return mTextureName; } 00048 00049 void addDrawItem(ISubWidget* _item, size_t _count); 00050 void removeDrawItem(ISubWidget* _item); 00051 void reallockDrawItem(ISubWidget* _item, size_t _count); 00052 00053 void outOfDate() { mOutDate = true; } 00054 00055 size_t getNeedVertexCount() { return mNeedVertexCount; } 00056 00057 bool getCurrentUpdate() { return mCurrentUpdate; } 00058 Vertex* getCurrentVertextBuffer() { return mCurrentVertext; } 00059 00060 void setLastVertexCount(size_t _count) { mLastVertextCount = _count; } 00061 00062 IRenderTarget* getRenderTarget() { return mRenderTarget; } 00063 00064 private: 00065 std::string mTextureName; 00066 00067 size_t mNeedVertexCount; 00068 00069 bool mOutDate; 00070 VectorDrawItem mDrawItems; 00071 00072 // колличество отрендренных реально вершин 00073 size_t mCountVertex; 00074 00075 bool mCurrentUpdate; 00076 Vertex* mCurrentVertext; 00077 size_t mLastVertextCount; 00078 00079 IVertexBuffer* mVertexBuffer; 00080 IRenderTarget* mRenderTarget; 00081 00082 }; 00083 00084 } // namespace MyGUI 00085 00086 #endif // __MYGUI_RENDER_ITEM_H__