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