Crazy Eddies GUI System  0.7.1
CEGUIIrrlichtRenderer.h
1 /***********************************************************************
2  filename: CEGUIIrrlichtRenderer.h
3  created: Tue Mar 3 2009
4  author: Paul D Turner (parts based on original code by Thomas Suter)
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _CEGUIIrrlichtRenderer_h_
29 #define _CEGUIIrrlichtRenderer_h_
30 
31 #include "CEGUIIrrlichtRendererDef.h"
32 #include "../../CEGUIRenderer.h"
33 #include "../../CEGUISize.h"
34 #include "../../CEGUIVector.h"
35 
36 #include <vector>
37 
38 #if defined(_MSC_VER)
39 # pragma warning(push)
40 # pragma warning(disable : 4251)
41 #endif
42 
43 // forward reference irrlicht classes
44 namespace irr
45 {
46 class IrrlichtDevice;
47 struct SEvent;
48 
49 namespace video
50 {
51 class IVideoDriver;
52 }
53 
54 namespace io
55 {
56 class IFileSystem;
57 }
58 
59 }
60 
61 // Start of CEGUI namespace section
62 namespace CEGUI
63 {
64 class IrrlichtTexture;
65 class IrrlichtGeometryBuffer;
66 class IrrlichtResourceProvider;
67 class IrrlichtEventPusher;
68 class IrrlichtImageCodec;
69 
71 class IRR_GUIRENDERER_API IrrlichtRenderer : public Renderer
72 {
73 public:
92  static IrrlichtRenderer& bootstrapSystem(irr::IrrlichtDevice& device);
93 
110  static void destroySystem();
111 
113  static IrrlichtRenderer& create(irr::IrrlichtDevice& device);
114 
116  static void destroy(IrrlichtRenderer& renderer);
117 
120  createIrrlichtResourceProvider(irr::io::IFileSystem& fs);
121 
123  static void destroyIrrlichtResourceProvider(IrrlichtResourceProvider& rp);
124 
126  static IrrlichtImageCodec& createIrrlichtImageCodec(
127  irr::video::IVideoDriver& driver);
128 
130  static void destroyIrrlichtImageCodec(IrrlichtImageCodec& ic);
131 
133  bool injectEvent(const irr::SEvent& event);
134 
145  Size getAdjustedTextureSize(const Size& sz) const;
146 
152  static float getNextPOTSize(const float f);
153 
154  // implement Renderer interface
155  RenderingRoot& getDefaultRenderingRoot();
156  GeometryBuffer& createGeometryBuffer();
157  void destroyGeometryBuffer(const GeometryBuffer& buffer);
158  void destroyAllGeometryBuffers();
159  TextureTarget* createTextureTarget();
160  void destroyTextureTarget(TextureTarget* target);
161  void destroyAllTextureTargets();
162  Texture& createTexture();
163  Texture& createTexture(const String& filename, const String& resourceGroup);
164  Texture& createTexture(const Size& size);
165  void destroyTexture(Texture& texture);
166  void destroyAllTextures();
167  void beginRendering();
168  void endRendering();
169  void setDisplaySize(const Size& sz);
170  const Size& getDisplaySize() const;
171  const Vector2& getDisplayDPI() const;
172  uint getMaxTextureSize() const;
173  const String& getIdentifierString() const;
174 
175 protected:
177  IrrlichtRenderer(irr::IrrlichtDevice& device);
179  ~IrrlichtRenderer();
180 
184  irr::IrrlichtDevice& d_device;
186  irr::video::IVideoDriver* d_driver;
196  typedef std::vector<TextureTarget*> TextureTargetList;
200  typedef std::vector<IrrlichtGeometryBuffer*> GeometryBufferList;
204  typedef std::vector<IrrlichtTexture*> TextureList;
215 };
216 
217 } // End of CEGUI namespace section
218 
219 #if defined(_MSC_VER)
220 # pragma warning(pop)
221 #endif
222 
223 #endif // end of guard _CEGUIIrrlichtRenderer_h_