MyGUI  3.0.1
MyGUI_RenderItem.h
Go to the documentation of this file.
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_ISubWidget.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();
00042         virtual ~RenderItem();
00043 
00044         void renderToTarget(IRenderTarget* _target, bool _update);
00045 
00046         void setTexture(ITexture* _value);
00047         ITexture* getTexture();
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() const { return mNeedVertexCount; }
00056         size_t getVertexCount() const { return mCountVertex; }
00057 
00058         bool getCurrentUpdate() const { return mCurrentUpdate; }
00059         Vertex* getCurrentVertextBuffer() const { return mCurrentVertext; }
00060 
00061         void setLastVertexCount(size_t _count) { mLastVertextCount = _count; }
00062 
00063         IRenderTarget* getRenderTarget() { return mRenderTarget; }
00064 
00065         bool getCompression();
00066 
00067     private:
00068 #if MYGUI_DEBUG_MODE == 1
00069         std::string mTextureName;
00070 #endif
00071 
00072         ITexture* mTexture;
00073 
00074         size_t mNeedVertexCount;
00075 
00076         bool mOutDate;
00077         VectorDrawItem mDrawItems;
00078 
00079         // колличество отрендренных реально вершин
00080         size_t mCountVertex;
00081 
00082         bool mCurrentUpdate;
00083         Vertex* mCurrentVertext;
00084         size_t mLastVertextCount;
00085 
00086         IVertexBuffer* mVertexBuffer;
00087         IRenderTarget* mRenderTarget;
00088 
00089         bool mCompression;
00090     };
00091 
00092 } // namespace MyGUI
00093 
00094 #endif // __MYGUI_RENDER_ITEM_H__