1 /*
2  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3  * Distributed under the MIT License
4  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5  */
6 
7 #ifndef MYGUI_RENDER_MANAGER_H_
8 #define MYGUI_RENDER_MANAGER_H_
9 
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_Singleton.h"
12 #include "MyGUI_RenderFormat.h"
13 #include "MyGUI_ITexture.h"
14 #include "MyGUI_IVertexBuffer.h"
15 #include "MyGUI_IRenderTarget.h"
16 
17 namespace MyGUI
18 {
19 
20 	class MYGUI_EXPORT RenderManager :
21 		public Singleton<RenderManager>
22 	{
23 	public:
24 
25 		/** Create vertex buffer.
26 			This method should create vertex buffer with triangles list type,
27 			each vertex have position, colour, texture coordinates.
28 		*/
29 		virtual IVertexBuffer* createVertexBuffer() = 0;
30 		/** Destroy vertex buffer */
31 		virtual void destroyVertexBuffer(IVertexBuffer* _buffer) = 0;
32 
33 		/** Create empty texture instance */
34 		virtual ITexture* createTexture(const std::string& _name) = 0;
35 		/** Destroy texture */
36 		virtual void destroyTexture(ITexture* _texture) = 0;
37 		/** Get texture by name */
38 		virtual ITexture* getTexture(const std::string& _name) = 0;
39 
40 		//FIXME возможно перенести в структуру о рендер таргете
41 		virtual const IntSize& getViewSize() const = 0;
42 
43 		/** Get current vertex colour type */
44 		virtual VertexColourType getVertexFormat() = 0;
45 
46 		/** Check if texture format supported by hardware */
47 		virtual bool isFormatSupported(PixelFormat _format, TextureUsage _usage);
48 
49         /** Set render view size. Should be called on every window resize */
50 		virtual void setViewSize(int _width, int _height) = 0;
51 
52 #if MYGUI_DEBUG_MODE == 1
53 		/** Check if texture is valid */
54 		virtual bool checkTexture(ITexture* _texture);
55 #endif
56 
57 	protected:
58 		virtual void onResizeView(const IntSize& _viewSize);
59 		virtual void onRenderToTarget(IRenderTarget* _target, bool _update);
60 		virtual void onFrameEvent(float _time);
61 	};
62 
63 } // namespace MyGUI
64 
65 #endif // MYGUI_RENDER_MANAGER_H_
66